1"use strict";(self.webpackChunk_kaggle_workspace=self.webpackChunk_kaggle_workspace||[]).push([["2757"],{22473(e,t,n){n.r(t),n.d(t,{default:()=>H});var a=n(94582),r=n(13749),o=n(71101),l=n(92258),i=n(66552),s=n(14874),u=n(64866),c=n(72433),d=n(23571),h=n(87158),m=n(42556),f=n(9075),g=n(70915),y=n(96540),p=n(52575);function b(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,a=Array(t);n<t;n++)a[n]=e[n];return a}function v(e,t,n,a,r,o,l){try{var i=e[o](l),s=i.value}catch(e){n(e);return}i.done?t(s):Promise.resolve(s).then(a,r)}function w(e){return function(){var t=this,n=arguments;return new Promise(function(a,r){var o=e.apply(t,n);function l(e){v(o,a,r,l,i,"next",e)}function i(e){v(o,a,r,l,i,"throw",e)}l(void 0)})}}function T(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n,a,r=null==e?null:"u">typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(null!=r){var o=[],l=!0,i=!1;try{for(r=r.call(e);!(l=(n=r.next()).done)&&(o.push(n.value),!t||o.length!==t);l=!0);}catch(e){i=!0,a=e}finally{try{l||null==r.return||r.return()}finally{if(i)throw a}}return o}}(e,t)||function(e,t){if(e){if("string"==typeof e)return b(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);if("Object"===n&&e.constructor&&(n=e.constructor.name),"Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return b(e,t)}}(e,t)||function(){throw TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function E(e,t){return t||(t=e.slice(0)),Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(t)}}))}function k(e,t){var n,a,r,o={label:0,sent:function(){if(1&r[0])throw r[1];return r[1]},trys:[],ops:[]},l=Object.create(("function"==typeof Iterator?Iterator:Object).prototype),i=Object.defineProperty;return i(l,"next",{value:s(0)}),i(l,"throw",{value:s(1)}),i(l,"return",{value:s(2)}),"function"==typeof Symbol&&i(l,Symbol.iterator,{value:function(){return this}}),l;function s(i){return function(s){var u=[i,s];if(n)throw TypeError("Generator is already executing.");for(;l&&(l=0,u[0]&&(o=0)),o;)try{if(n=1,a&&(r=2&u[0]?a.return:u[0]?a.throw||((r=a.return)&&r.call(a),0):a.next)&&!(r=r.call(a,u[1])).done)return r;switch(a=0,r&&(u=[2&u[0],r.value]),u[0]){case 0:case 1:r=u;break;case 4:return o.label++,{value:u[1],done:!1};case 5:o.label++,a=u[1],u=[0];continue;case 7:u=o.ops.pop(),o.trys.pop();continue;default:if(!(r=(r=o.trys).length>0&&r[r.length-1])&&(6===u[0]||2===u[0])){o=0;continue}if(3===u[0]&&(!r||u[1]>r[0]&&u[1]<r[3])){o.label=u[1];break}if(6===u[0]&&o.label<r[1]){o.label=r[1],r=u;break}if(r&&o.label<r[2]){o.label=r[2],o.ops.push(u);break}r[2]&&o.ops.pop(),o.trys.pop();continue}u=t.call(e,o)}catch(e){u=[6,e],a=0}finally{n=r=0}if(5&u[0])throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}}function M(){var e=E(["\n margin-top: 40px;\n margin-bottom: 40px;\n"]);return M=function(){return e},e}function S(){var e=E(["\n margin-top: 20px;\n margin-bottom: 20px;\n"]);return S=function(){return e},e}function D(){var e=E(["\n list-style: decimal inside;\n color: ",";\n"]);return D=function(){return e},e}function x(){var e=E(["\n display: inline;\n margin: 5px 0;\n"]);return x=function(){return e},e}function C(){var e=E(["\n margin: 10px 0;\n"]);return C=function(){return e},e}var O=(0,p.default)(s.c)(M()),L=(0,p.default)(u.mM)(S()),A=p.default.ol(D(),function(e){return e.theme.km.color.text.medium}),Y=(0,p.default)(u.jz)(x()),z=p.default.li(C()),I=function(e){var t=e.children;return y.createElement(z,null,y.createElement(Y,null,t))},N=function(){var e,t=T(y.useState(void 0),2),n=t[0],a=t[1],s=T(y.useState(0),2),p=s[0],b=s[1],v=T(y.useState(void 0),2),E=v[0],M=v[1],S=T(y.useState(0),2),D=S[0],x=S[1],C=T(y.useState(""),2),Y=C[0],z=C[1],N=y.useContext(f.I).currentUser;function H(e){return w(function(){var t;return k(this,function(n){switch(n.label){case 0:return[4,g.usersClient.nudgeService.getNudgeConfig({})];case 1:return a(t=n.sent()),e&&(x(D+1),M(t.nudges.find(function(e){return e.nudgeId===p})),(0,l.ud)()),[2]}})})()}return(y.useEffect(function(){H()}
1,[]),void 0===n)?y.createElement("p",null,"Loading"):y.createElement(r.L,null,y.createElement(u._,null,"How to use"),y.createElement(L,null,"To edit an existing nudge (note built-in nudges are not editable):"),y.createElement(A,null,y.createElement(I,null,"Use the dropdown to select the nudge to edit."),y.createElement(I,null,"Copy the CanSeeExpression somewhere to remember it, then change it to `disabled`. This makes sure nobody will see the nudge until you review it and are satisfied."),y.createElement(I,null,"You can view the current look of the nudge on your screen, feel free to dismiss it if it gets in the way while editing. (Note this won't live-update)."),y.createElement(I,null,"Next edit the fields you desire to change, see below for a description."),y.createElement(I,null,"Click Save to save the changes, the page should refresh and show you the new nudge."),y.createElement(I,null,'Verify it looks as expected, and the call to action button is the correct link (right click then "open in new tab" to verify).'),y.createElement(I,null,"If you're satisfied, change the CanSeeExpression back to it's original value.")),y.createElement(L,null,"To create a new nudge:"),y.createElement(A,null,y.createElement(I,null,"Choose a name to identify the nudge. Must be only letters and numbers and it can't be changed once the nudge is created."),y.createElement(I,null,"Click `Add New Nudge` to create the nudge, this should open up the editor and a preview."),y.createElement(I,null,"The first field is an expression for determining whether a user should see it. Set this to `disabled` initially until you are ready to start showing it to users. More on this below."),y.createElement(I,null,"Next is the pages it should show on: 0=any, 1=any competition page, 2=profile, 3=any landing page."),y.createElement(I,null,"Title: Which appears on the top line."),y.createElement(I,null,"Body: The main text in the middle."),y.createElement(I,null,"ActionText: The text on the call to action button"),y.createElement(I,null,"ActionUrl: A link for the call to action button"),y.createElement(I,null,'OptOutText: A message for checkbox that says "Don\'t show me this again". This replaces the "this".'),y.createElement(I,null,"GraphicFileName: The illustration to use for the nudge, or empty to be text-only. Must be a valid IllustrationName from IllustrationOptions.tsx"),y.createElement(I,null,"Priority: The priority of the nudge, higher numbered nudges will be shown first. All the built in nudges are from 1-10, with HaTS being 5."),y.createElement(I,null,"Once you've set all these fields, click save to save the nudge and it will reload the nudge to show you how it appears."),y.createElement(I,null,"Once you're happy with how it looks, verify that the link goes to the right spot (right click and open in new tab)."),y.createElement(I,null,"Change the CanSeeExpression to test it out live. Set it to `userids[",N.id,"]` to show it just to yourself, or `private` to show it to all admins."),y.createElement(I,null,"Click Save then open up a new tab/window and go to a page that should show it to verify it works live."),y.createElement(I,null,"Now you can set the CanSeeExpression to start showing to users. The syntax is the same as for feature flags. The best option to use here is something like `date(5%)`, which will show the nudge to 5% of users, using a different set of users each day. This spreads it out so everyone doesn't all see it the same day."),y.createElement(I,null,"Click Save again and it'll start showing to users.")),y.createElement(L,null,"To remove a nudge:"),y.createElement(u.jz,null,"We currently remove nudges from Kaggle by disabling (rather than deleting) them."),y.createElement(A,null,y.createElement(I,null,"Use the dropdown to select the nudge to remove."),y.createElement(I,null,"Change the CanSeeExpression to `disabled`. This will hide the nudge from all users.")),y.createElement(L,null,"After a nudge goes live:"),y.createElement(u.jz,null,y.createElement(c.X,null,y.createElement("li",null,"Evaluate the performance of your nudge, using a query like"," ",
1y.createElement(u.Yq,{href:"https://plx.corp.google.com/scripts2/script_ef._d5e973_aad2_491e_bc8f_c9f52f2ddd3e",target:"_blank"},"this one")),y.createElement("li",null,"When trying to view a nudge for verification in production, you will only receive the nudge once, due to frequency capping."),y.createElement("li",null,"Users are eligible to receive a nudge in"," ",y.createElement(u.Yq,{href:"https://github.com/Kaggle/kaggleazure/blob/dc54da997244062393f699a029acee4feb905cff/Kaggle.Services.Users/Handlers/Users/IsAadcApplicableHandler.cs"},"certain countries and states")," ",". Of particular relevance, users in California, Florida, and Connecticut are not eligible at this time."))),y.createElement(d.l,{style:{marginTop:"32px"},label:"Select Nudge",onSelect:function(e){b(e),M(null==n?void 0:n.nudges.find(function(t){return t.nudgeId===e}))},options:n.nudges.map(function(e){return{label:e.type,value:e.nudgeId}}),placeholder:"Select a Nudge",value:p}),y.createElement(O,null),p>0&&(!E||!E.isBuiltIn)&&y.createElement(y.Fragment,null,y.createElement(u.jz,null,y.createElement(o._,{typeName:"Nudge",id:p,onSuccessfulSaveCallback:function(){return H(p)},isGenieType:!1})),y.createElement(O,null)),y.createElement(h.A,{pattern:"[a-zA-Z0-9]{1,50}",label:"Name/key for new nudge (alphanumeric only). This cannot be changed.",onChange:function(e){return z(e.currentTarget.value)},value:Y}),y.createElement(m.$,{onClick:function(){return w(function(){var e;return k(this,function(t){switch(t.label){case 0:return[4,g.usersClient.nudgeService.addNudge({name:Y})];case 1:return b((e=t.sent()).nudgeId),[4,H(e.nudgeId)];case 2:return t.sent(),[2]}})})()},style:{marginLeft:"32px"}},"Add New Nudge"),E&&y.createElement(i.X,{nudge:null!=(e=null==E?void 0:E.type)?e:"",variant:D,controlledNudge:null==E?void 0:E.showingNudgeResponse}))};let H=function(){return y.createElement(a.b,{pageName:"admin-nudges",title:"Nudge Config | Kaggle Admin",element:y.createElement(N,null)})}},39671(e,t,n){n.d(t,{Y:()=>s});var a=n(72739),r=n(95093);let o={Y:"year",YY:"year",YYYY:{sectionType:"year",contentType:"digit",maxLength:4},M:{sectionType:"month",contentType:"digit",maxLength:2},MM:"month",MMM:{sectionType:"month",contentType:"letter"},MMMM:{sectionType:"month",contentType:"letter"},D:{sectionType:"day",contentType:"digit",maxLength:2},DD:"day",Do:{sectionType:"day",contentType:"digit-with-letter"},E:{sectionType:"weekDay",contentType:"digit",maxLength:1},e:{sectionType:"weekDay",contentType:"digit",maxLength:1},d:{sectionType:"weekDay",contentType:"digit",maxLength:1},dd:{sectionType:"weekDay",contentType:"letter"},ddd:{sectionType:"weekDay",contentType:"letter"},dddd:{sectionType:"weekDay",contentType:"letter"},A:"meridiem",a:"meridiem",H:{sectionType:"hours",contentType:"digit",maxLength:2},HH:"hours",h:{sectionType:"hours",contentType:"digit",maxLength:2},hh:"hours",m:{sectionType:"minutes",contentType:"digit",maxLength:2},mm:"minutes",s:{sectionType:"seconds",contentType:"digit",maxLength:2},ss:"seconds"},l={year:"YYYY",month:"MMMM",monthShort:"MMM",dayOfMonth:"D",dayOfMonthFull:"Do",weekday:"dddd",weekdayShort:"ddd",hours24h:"HH",hours12h:"hh",meridiem:"A",minutes:"mm",seconds:"ss",fullDate:"ll",keyboardDate:"L",shortDate:"MMM D",normalDate:"D MMMM",normalDateWithWeekday:"ddd, MMM D",fullTime12h:"hh:mm A",fullTime24h:"HH:mm",keyboardDateTime12h:"L hh:mm A",keyboardDateTime24h:"L HH:mm"},i="Missing timezone plugin\nTo be able to use timezones, you have to pass the default export from `moment-timezone` to the `dateLibInstance` prop of `LocalizationProvider`\nFind more information on https://mui.com/x/react-date-pickers/timezone/#moment-and-timezone";class s{isMUIAdapter=!0;isTimezoneCompatible=!0;lib="moment";escapedCharacters={start:"[",end:"]"};formatTokenMap=o;constructor({locale:e,formats:t,instance:n}={}){this.moment=n||r,this.locale=e,this.formats=(0,a.A)({},l,t)}setLocaleToValue=e=>{let t=this.getCurrentLocaleCode();return t===e.locale()?e:e.locale(t)};hasTimezonePlugin=()=>void 0!==this.moment.tz;createSystemDate=e=>{let t=this.moment(e).local();return void 0===this.locale?t:t.locale(this.locale)};createUTCDate=e=>{let t=this.moment.utc(e);return void 0===this.locale?t:t.locale(this.locale)};createTZDate=(e,t)=>
1{if(!this.hasTimezonePlugin())throw Error(i);let n="default"===t?this.moment(e):this.moment.tz(e,t);return void 0===this.locale?n:n.locale(this.locale)};date=(e,t="default")=>null===e?null:"UTC"===t?this.createUTCDate(e):"system"!==t&&("default"!==t||this.hasTimezonePlugin())?this.createTZDate(e,t):this.createSystemDate(e);getInvalidDate=()=>this.moment(new Date("Invalid Date"));getTimezone=e=>{let t=e._z?.name,n=e.isUTC()?"UTC":"system";return t??this.moment.defaultZone?.name??n};setTimezone=(e,t)=>{if(this.getTimezone(e)===t)return e;if("UTC"===t)return e.clone().utc();if("system"===t)return e.clone().local();if(!this.hasTimezonePlugin()){if("default"!==t)throw Error(i);return e}let n="default"===t?this.moment.defaultZone?.name??"system":t;if("system"===n)return e.clone().local();let a=e.clone();return a.tz(n),a};toJsDate=e=>e.toDate();parse=(e,t)=>""===e?null:this.locale?this.moment(e,t,this.locale,!0):this.moment(e,t,!0);getCurrentLocaleCode=()=>this.locale||r.locale();is12HourCycleInCurrentLocale=()=>/A|a/.test(r.localeData(this.getCurrentLocaleCode()).longDateFormat("LT"));expandFormat=e=>e.match(/(\[[^[]*\])|(\\)?(LTS|LT|LL?L?L?|l{1,4})|./g).map(e=>{let t=e[0];return"L"===t||";"===t?r.localeData(this.getCurrentLocaleCode()).longDateFormat(e):e}).join("");isValid=e=>null!=e&&e.isValid();format=(e,t)=>this.formatByString(e,this.formats[t]);formatByString=(e,t)=>{let n=e.clone();return n.locale(this.getCurrentLocaleCode()),n.format(t)};formatNumber=e=>e;isEqual=(e,t)=>null===e&&null===t||null!==e&&null!==t&&e.isSame(t);isSameYear=(e,t)=>e.isSame(t,"year");isSameMonth=(e,t)=>e.isSame(t,"month");isSameDay=(e,t)=>e.isSame(t,"day");isSameHour=(e,t)=>e.isSame(t,"hour");isAfter=(e,t)=>e.isAfter(t);isAfterYear=(e,t)=>e.isAfter(t,"year");isAfterDay=(e,t)=>e.isAfter(t,"day");isBefore=(e,t)=>e.isBefore(t);isBeforeYear=(e,t)=>e.isBefore(t,"year");isBeforeDay=(e,t)=>e.isBefore(t,"day");isWithinRange=(e,[t,n])=>e.isBetween(t,n,null,"[]");startOfYear=e=>e.clone().startOf("year");startOfMonth=e=>e.clone().startOf("month");startOfWeek=e=>this.setLocaleToValue(e.clone()).startOf("week");startOfDay=e=>e.clone().startOf("day");endOfYear=e=>e.clone().endOf("year");endOfMonth=e=>e.clone().endOf("month");endOfWeek=e=>this.setLocaleToValue(e.clone()).endOf("week");endOfDay=e=>e.clone().endOf("day");addYears=(e,t)=>t<0?e.clone().subtract(Math.abs(t),"years"):e.clone().add(t,"years");addMonths=(e,t)=>t<0?e.clone().subtract(Math.abs(t),"months"):e.clone().add(t,"months");addWeeks=(e,t)=>t<0?e.clone().subtract(Math.abs(t),"weeks"):e.clone().add(t,"weeks");addDays=(e,t)=>t<0?e.clone().subtract(Math.abs(t),"days"):e.clone().add(t,"days");addHours=(e,t)=>t<0?e.clone().subtract(Math.abs(t),"hours"):e.clone().add(t,"hours");addMinutes=(e,t)=>t<0?e.clone().subtract(Math.abs(t),"minutes"):e.clone().add(t,"minutes");addSeconds=(e,t)=>t<0?e.clone().subtract(Math.abs(t),"seconds"):e.clone().add(t,"seconds");getYear=e=>e.get("year");getMonth=e=>e.get("month");getDate=e=>e.get("date");getHours=e=>e.get("hours");getMinutes=e=>e.get("minutes");getSeconds=e=>e.get("seconds");getMilliseconds=e=>e.get("milliseconds");setYear=(e,t)=>e.clone().year(t);setMonth=(e,t)=>e.clone().month(t);setDate=(e,t)=>e.clone().date(t);setHours=(e,t)=>e.clone().hours(t);setMinutes=(e,t)=>e.clone().minutes(t);setSeconds=(e,t)=>e.clone().seconds(t);setMilliseconds=(e,t)=>e.clone().milliseconds(t);getDaysInMonth=e=>e.daysInMonth();getWeekArray=e=>{let t=this.startOfWeek(this.startOfMonth(e)),n=this.endOfWeek(this.endOfMonth(e)),a=0,r=t,o=r.get("dayOfYear"),l=[];for(;r.isBefore(n);){let e=Math.floor(a/7);l[e]=l[e]||[],l[e].push(r),o===(o=(r=this.addDays(r,1)).get("dayOfYear"))&&(r=r.add(12,"h").startOf("day")),a+=1}return l};getWeekNumber=e=>e.week();getDayOfWeek=e=>e.day()+1;getYearRange([e,t]){let n=this.startOfYear(e),a=this.endOfYear(t),r=[],o=n;for(;this.isBefore(o,a);)r.push(o),o=this.addYears(o,1);return r}}}}]); 2//# sourceMappingURL=AdminNudges.fe63e9b132801fd1.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.