-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path2228.js
1 lines (1 loc) · 8.72 KB
/
2228.js
1
"use strict";(("undefined"!=typeof self?self:global).webpackChunkclient_web=("undefined"!=typeof self?self:global).webpackChunkclient_web||[]).push([[2228],{42228:(e,s,a)=>{a.d(s,{AdDebug:()=>S});a(61026);var t=a(30758),r=a(88729),n=a(87732),i=a(60646),o=a(26446),l=a(45143),c=a(93028),d=a(555),u=a(13505),h=a(1914),m=a(73959),g=a(61329),p=a(4942);const v=(0,g.h)();window.abba={get:async function(e,s){const a=new m.EW((0,p.X)()),t=(await a.getValues(m.kM.fromPartial({}))).pairs;let r={},n="";if(t.abbaOverrides?n=t.abbaOverrides:t.abbaoverrides&&(n=t.abbaoverrides),n)try{r=JSON.parse(n)}catch(e){console.error(`error parsing value=${n}, error=${e}`)}if(Object.prototype.hasOwnProperty.call(r,e))return console.warn(`Abba: Override for ${e} : ${r[e]}`),void setTimeout((()=>s(null,r[e])),0);v.post("sp://abba/v1/flags",{flags:[e]}).then((a=>{const{flags:t=[]}=a,r=t[0]&&t[0].featureName===e&&t[0].cell;s(null,r||null)})).catch((e=>{s(e)}))},getAll:function(e){console.warn("Abba:getAll should only be used by TA tests for logging purposes."),v.get("sp://abba/v1/all_flags").then((s=>{const{flags:a=[]}=s,t=a.reduce(((e,s)=>(e[s.featureName]=s.cell,e)),{});e(null,JSON.stringify(t,null,2))})).catch((s=>{e(s)}))},getRequestedFlagNames:function(e){v.get("sp://abba/v1/requested_flag_names").then((s=>{e(null,JSON.stringify(s.sort(),null,2))})).catch((s=>{e(s)}))}};var b=a(91791);const x=function(){const[e,s]=(0,t.useState)();return{adMocks:e,getAdMocks:(0,t.useCallback)((async()=>b.D.getMocksList().then((e=>{s(e.body.test_cases)}))),[])}},j="rh7v8PDNC0ke2OkkyRhk",f="Kh0jtEAjRK83Z5A_IZRx";var k=a(86070);const S=()=>{const e=e=>60*e,[s,a]=(0,t.useState)(e(20)),[m,g]=(0,t.useState)(""),[p,v]=(0,t.useState)(""),[S,y]=(0,t.useState)(""),[w,C]=(0,t.useState)((new Date).toISOString()),[A,E]=(0,t.useState)({message:"",status:"success"}),[N,$]=(0,t.useState)(!1),{adMocks:O,getAdMocks:T}=x(),D=({message:e,isError:s})=>{E({message:e,status:s?"error":"success"}),$(!0),setTimeout((()=>$(!1)),5e3)},Z=(0,t.useCallback)((e=>{b.D.clearSlot(e).then((()=>{D({message:`${e} cleared`,isError:!1})}))}),[]),I=(0,t.useCallback)((e=>{a(e),b.D.increaseStreamTime(e).then((()=>{D({message:`${e} seconds of stream time added`,isError:!1})})).catch((e=>{D({message:`Error increasing stream time: ${e}`,isError:!0})}))}),[]);return(0,t.useEffect)((()=>{T().then((()=>{D({message:"Ad mocks fetched",isError:!1})})).catch((()=>{D({message:"Ad mocks fetch failed",isError:!0})}))}),[T]),(0,k.jsxs)("div",{className:j,children:[(0,k.jsx)(r.qb,{colorSet:"error"===A.status?"negative":"brightAccent",showSnackbar:N,children:A.message}),(0,k.jsx)(n.Z,{as:"h1",variant:"forte",paddingBottom:"24px",children:"Ad Debug Tools"}),(0,k.jsx)(n.Z,{as:"h2",variant:"alto",paddingBottom:"8px",children:"Increase Stream Time"}),(0,k.jsx)(i.g,{label:"Quick add stream time",children:(0,k.jsx)("div",{className:f,children:(0,k.jsxs)(o.I,{mode:"action",layout:"single-line","aria-label":"Stream time presets",children:[(0,k.jsx)(l.v,{variant:"contrasting",onClick:()=>I(e(1)),children:"Add 1 min"}),(0,k.jsx)(l.v,{variant:"contrasting",onClick:()=>I(e(20)),children:"Add 20 mins"}),(0,k.jsx)(l.v,{variant:"contrasting",onClick:()=>I(e(40)),children:"Add 40 mins"}),(0,k.jsx)(l.v,{variant:"contrasting",onClick:()=>I(e(60)),children:"Add 1 hour"})]})})}),(0,k.jsxs)(i.g,{label:"Custom stream time in seconds",children:[(0,k.jsx)("div",{className:f,children:(0,k.jsx)(c.Z,{onChange:e=>a(e.currentTarget.value),placeholder:"seconds",value:s,type:"number",min:0})}),(0,k.jsx)("div",{className:f,children:(0,k.jsxs)(d.$,{size:"small",onClick:()=>I(s),children:["Add ",s," seconds (~ ",(M=s,Math.round(Number(M)/60))," minutes)"]})})]}),(0,k.jsx)(n.Z,{as:"h2",variant:"alto",paddingBottom:"8px",children:"Fetch ad from Ad Mocker"}),(0,k.jsxs)(i.g,{label:"Enqueue ad json directly into pod",children:[(0,k.jsxs)("div",{className:f,children:[(0,k.jsx)(u.E,{as:"label",htmlFor:"adMockerSessionId",variant:"bodyMedium",children:"Session ID"}),(0,k.jsx)(c.Z,{name:"adMockerSessionId",type:"text",value:w,onChange:e=>C(String(e.currentTarget.value))})]}),(0,k.jsx)("div",{className:f,children:(0,k.jsxs)(h.F,{value:S,onChange:e=>{y(e.currentTarget.value)},children:[(0,k.jsx)("option",{disabled:!0,value:"",children:"Choose a mock"}),O?.map((e=>(0,k.jsxs)("option",{value:e.name,children:[e.name," (",e.group,")"]},e.name)))]})}),(0,k.jsx)(d.$,{size:"small",onClick:()=>{b.D.fetchAdAndEnqueue(S,w).then((()=>{D({message:`${S} inserted`,isError:!1})})).catch((e=>{D({message:`Error inserting ${S}: ${e}`,isError:!0})}))},children:"Insert ad directly"})]}),(0,k.jsx)(n.Z,{as:"h2",variant:"alto",paddingBottom:"8px",children:"Override Country"}),(0,k.jsxs)(i.g,{label:"Calls testingClient.requestOverride with country key",children:[(0,k.jsx)("div",{className:f,children:(0,k.jsxs)(h.F,{value:p,onChange:e=>{v(e.currentTarget.value)},children:[(0,k.jsx)("option",{disabled:!0,value:"",children:"Choose a country"}),(0,k.jsx)("option",{value:"AU",children:"Australia"}),(0,k.jsx)("option",{value:"BR",children:"Brasil"}),(0,k.jsx)("option",{value:"JP",children:"Japan"}),(0,k.jsx)("option",{value:"SE",children:"Sweden"}),(0,k.jsx)("option",{value:"UK",children:"United Kingdom"}),(0,k.jsx)("option",{value:"US",children:"USA"}),(0,k.jsx)("option",{value:"NZ",children:"New Zealand"}),(0,k.jsx)("option",{value:"",children:"Clear"})]})}),(0,k.jsx)(d.$,{size:"small",onClick:()=>{b.D.overrideCountry(p).then((e=>{0===e.status?D({message:`${p} override successful`,isError:!1}):D({message:`Error overriding country: ${e.status}`,isError:!0})}))},children:"OVERRIDE COUNTRY"})]}),(0,k.jsx)(n.Z,{as:"h2",variant:"alto",paddingBottom:"8px",children:"Clear Slot"}),(0,k.jsxs)(i.g,{label:"Calls slotsClient.clearAllAds for the selected slot",children:[(0,k.jsx)("div",{className:f,children:(0,k.jsxs)(h.F,{value:m,onChange:e=>{g(e.currentTarget.value)},children:[(0,k.jsx)("option",{disabled:!0,value:"",children:"Choose a slot"}),(0,k.jsx)("option",{value:"leaderboard",children:"leaderboard"}),(0,k.jsx)("option",{value:"sponsored-playlist",children:"sponsored playlist"}),(0,k.jsx)("option",{value:"billboard",children:"billboard"}),(0,k.jsx)("option",{value:"hpto",children:"hpto"}),(0,k.jsx)("option",{value:"stream",children:"stream"})]})}),(0,k.jsx)(d.$,{size:"small",onClick:()=>{""!==m?Z(m):D({message:"Please select a slot",isError:!0})},children:"CLEAR SLOT"})]}),(0,k.jsx)(n.Z,{as:"h2",variant:"alto",paddingBottom:"8px",children:"Trigger Stream Slot"}),(0,k.jsx)(i.g,{label:"Calls slotsClient.createSlot, adds 20 mins, puts targeting in focus",children:(0,k.jsx)(d.$,{size:"small",onClick:()=>{b.D.queueVideoAd().then((e=>{const s=e[0];s.error?D({message:`Error queuing video ad: ${s?.error}`,isError:!0}):D({message:"Video queued in stream slot",isError:!1})}))},children:"Queue Video Ad"})})]});var M}},88729:(e,s,a)=>{a.d(s,{qb:()=>x,t:()=>b});var t=a(97294),r=a(32511),n=a(30758),i=a(63616),o=a(32037),l=a(13505),c=a(28860),d=a(36923),u=a(70585),h=a(13822),m=a(59804),g=a(87150),p=m.Ay.div.withConfig({displayName:"Container",componentId:"sc-eij2zk-0"})(["",""],(function(e){var s=e.$colorSet,a=e.$isVisible;return(0,g.AH)([""," padding-block:",";padding-inline:",";overflow-wrap:break-word;text-align:center;position:fixed;overflow-x:hidden;text-overflow:ellipsis;z-index:",";transition:visibility ","ms linear,opacity ","ms ease-in-out;bottom:48px;.docs-story{position:absolute;}@media (max-width:","){inset-inline:8px;}@media (min-width:","){margin-inline:auto;inset-inline:0;width:max-content;}",""],(0,d.Lw)({maxWidth:"384px",colorSet:s}),(0,u.po)("tighter","12px"),(0,u.po)("looser-2","32px"),h.Bd,b,b,c.eA,c.Dg,a?(0,g.AH)(["animation-fill-mode:forwards;visibility:visible;opacity:1;"]):(0,g.AH)(["visibility:hidden;opacity:0;"]))})),v=["onExited","colorSet","showSnackbar","className","children"],b=300,x=n.forwardRef((function(e,s){var a=e.onExited,c=e.colorSet,d=void 0===c?"base":c,u=e.showSnackbar,h=e.className,m=e.children,g=(0,r.A)(e,v),b=(0,n.useState)(!1),x=(0,t.A)(b,2),j=x[0],f=x[1];return void 0===u&&console.warn('Warning: If you are not conditionally rendering Snackbar within an aria-live region (wrapping element with role="status") the component will be inaccessible on Windows operating systems. Please use the showSnackbar prop to conditionally render Snackbar. For guidance on how to implement this, refer to our Snackbar Accessibility documentation: https://encore-web.spotify.net/?path=/docs/components-snackbar--accessibility'),(0,n.useEffect)((function(){if(void 0===u){f(!0);var e=setTimeout((function(){f(!1),a&&a()}),5e3);return function(){return clearTimeout(e)}}u?f(!0):(f(!1),a&&a())}),[u,a]),n.createElement("div",{role:"status"},n.createElement(p,Object.assign({ref:s,className:(0,o.Ju)(d,h),$colorSet:d,$isVisible:j,"data-encore-id":i.j.Snackbar},g),n.createElement(l.E,{variant:"bodySmall",semanticColor:"textBase"},m)))}))}}]);