PageSourceSearch

https://app.promolayer.io/_next/static/chunks/pages/template-creator-371f9a1d4adf33f7.js

js promolayer.io collected 2026-10-02 02:48:15 UTC 5,529 bytes, 2 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7882],{16067:function(e,s,l){(window.__NEXT_P=window.__NEXT_P||[]).push(["/template-creator",function(){return l(14338)}])},14338:function(e,s,l){"use strict";l.r(s);var t=l(85893),i=l(27484),a=l.n(i),n=l(75472),c=l.n(n),r=l(41664),d=l.n(r),o=l(11163),u=l(67294),p=l(53573),h=l(84082),m=l(35773),x=l(95305),j=l(39886),f=l(54610),y=l(49816),N=l(65031),w=l(53135),g=l(96180);l(64897);var v=l(94777),S=l(49942),Z=l(8587),D=l(84387),b=l(78476),C=l(47974),E=l(47226);let _=null;s.default=()=>{let e;let s=(0,o.useRouter)(),{t:l}=(0,p.$)(),{userData:i}=(0,Z.a)(),{showToast:n}=(0,b.pm)(),{firebase:r,Display:k}=(0,D.f)(),{currentWorkspace:T}=(0,C.c)(),{showModal:Y,hideModal:F}=(0,b.dd)(),[I,M]=(0,u.useState)([]),[A,O]=(0,u.useState)(!1),[P,B]=(0,u.useState)(""),[L,H]=(0,u.useState)(""),X=(0,u.useMemo)(()=>e=>{let{handleChange:i}=e;return(0,t.jsx)(w.Z,{menuOpen:!1,children:(0,t.jsxs)("div",{className:"justify-content-between d-flex w-100",children:[(0,t.jsx)("form",{className:"app-search",onSubmit:e=>{e.preventDefault()},children:(0,t.jsxs)("div",{className:"position-relative",children:[(0,t.jsx)("input",{type:"text",className:"form-control",placeholder:l("Filter..."),defaultValue:L,onChange:i}),(0,t.jsx)("span",{className:"bx bx-search-alt"})]})}),(0,t.jsxs)(h.Z,{className:"add-display",color:"primary",onClick:()=>s.push("/displays/starters"),children:[(0,t.jsx)("i",{className:"mdi mdi-plus-circle-outline"})," ",l("New display")]})]})})},[]),deleteDisplay=async e=>{if(confirm(l("Do you really want to delete this item?"))){let t=I.find(s=>s.id===e);try{await k.delete(e);let s=I.findIndex(s=>s.id===e);I.splice(s,1),M([...I]),(0,E.tO)(i.userId,T.id),n({title:l("Success"),message:l("Successfully deleted"),isSuccess:!0})}catch(a){(0,S.t6)(a,{action:"delete",route:s.pathname,module:"pages/template-creator",functionName:"deleteDisplay",currentWorkspace:T,userData:i,display:t,displayId:e}),n({title:l("Success"),message:l("The display was deleted"),isSuccess:!0})}}},duplicateDisplay=async(e,s)=>{try{let t=await k.create({...e,title:"".concat(e.title," (Copy)"),published:!1});I.splice(s,0,t),M([...I]),n({title:l("Success"),message:l("Successfully duplicated"),isSuccess:!0})}catch(e){n({title:l("Error"),message:l("Cannot duplicate the item"),isError:!0})}},fetchAllDisplays=async()=>{O(!0);try{let e=await k.getAllInWorkspace(T);M(e)}catch(e){n({title:l("Error"),message:l("Something went wrong with the server"),isError:!0})}finally{O(!1)}};return(0,u.useEffect)(()=>{fetchAllDisplays()},[T]),A?(0,t.jsx)(N.Z,{}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(X,{handleChange:e=>{let s=e.target.value;_&&clearTimeout(_),_=setTimeout(()=>{H(s.toLowerCase())},500)}}),(0,t.jsx)("div",{className:"container",children:(0,t.jsxs)("div",{className:"page-content",children:[(0,t.jsx)(g.Z,{showBackButton:!1,title:l("Home"),titleLink:"/",breadcrumbItem:l("Displays"),workspace:T}),(0,t.jsx)(m.Z,{children:(0,t.jsx)(x.Z,{xs:2,children:(0,t.jsxs)("select",{className:"form-control mb-3",onChange:e=>B(e.target.value),value:P,children:[(0,t.jsx)("option",{value:"",children:"Type"}),(0,t.jsx)("option",{value:"popup",children:"Popup"}),(0,t.jsx)("option",{value:"spin-to-win",children:"Spin to win"}),(0,t.jsx)("option",{value:"slide-in",children:"Slide in"}),(0,t.jsx)("option",{value:"header-footer",children:"Header / Footer"}),(0,t.jsx)("option",{value:"full-screen",children:"Full screen"}),(0,t.jsx)("option",{value:"image-only",children:"Image only"})]})})}),(0,t.jsx)(m.Z,{children:(e=c()(I,"updatedAt","desc"),(P&&(e=e.filter(e=>e.type===P)),L)?e.filter(e=>{var s;return null===(s=e.title)||void 0===s?void 0:s.toLowerCase().includes(L)}):e).map((e,s)=>(0,t.jsx)(x.Z,{xs:4,children:(0,t.jsx)(j.Z,{className:"mb-4",children:(0,t.jsxs)(f.Z,{children:[(0,t.jsxs)(m.Z,{children:[(0,t.jsx)(x.Z,{xs:3,className:"d-flex justify-content-center",children:(0,v.q7)(e.type)}),(0,t.jsxs)(x.Z,{xs:9,children:[(0,t.jsx)(y.Z,{tag:"h5",children:e.title}),(0,t.jsxs)("div",{children:[l("Type"),":",(0,t.jsx)("span",{className:"ms-1",style:{textTransform:"capitalize"},children:l((0,v.gr)(e.type))}),e.whenToShow.perpetual?(0,t.jsx)("div",{children:l("Perpetual")}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsxs)("div",{children:[l("Starts"),":"," ",(0,t.jsx)("span",{className:"ms-1",children:a()(e.whenToShow.start).format("YYYY/MM/DD")})]}),(0,t.jsxs)("div",{children:[l("Ends"),":"," ",(0,t.jsx)("span",{className:"ms-1",children:a()(e.whenToShow.end).format("YYYY/MM/DD")})]})]})]})]})]}),(0,t.jsx)(m.Z,{className:"mt-1 pt-3 border-top",children:(0,t.jsxs)(x.Z,{className:"d-flex justify-content-around align-items-center ",children:[(0,t.jsx)(d(),{href:"/displays/".concat(e.id),legacyBehavior:!0,children:(0,t.jsxs)(h.Z,{color:"primary",children:[(0,t.jsx)("i",{className:"mdi mdi-pencil-outline"})," ",(0,t.jsx)("span",{className:"d-none d-lg-inline",children:l("Edit")})]})}),(0,t.jsxs)(h.Z,{color:"info",onClick:()=>duplicateDisplay(e,s),children:[(0,t.jsx)("i",{className:"mdi mdi-content-duplicate"})," ",(0,t.jsx)("span",{className:"d-none d-lg-inline",children:l("Duplicate")})]}),(0,t.jsxs)(h.Z,{color:"danger",onClick:()=>deleteDisplay(e.id),children:[(0,t.jsx)("i",{className:"mdi mdi-trash-can-outline"})," ",(0,t.jsx)("span",{className:"d-none d-lg-inline",children:l("Delete")})]})]})})]})},e.id)},s))})]})})]})}}},function(e){e.O(0,[4897,9774,2888,179],function(){return e(e.s=16067)}),_N_E=e.O()}]);
2//# sourceMappingURL=template-creator-371f9a1d4adf33f7.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.