1(this.webpackJsonpapp=this.webpackJsonpapp||[]).push([[159],{1731:function(e,t,a){"use strict";a.r(t),a.d(t,"default",(function(){return S}));var n=a(1),l=a(1368),c=a(0),r=a.n(c),i=a(9),o=a(2),s=a(41),u=a(52),d=a(30),m=a(23),p=a(1485),E=a(1617);function h(e){let{product:t}=e;const{id:a}=t,{handleRemoveProduct:l}=Object(E.h)(),[c,i]=r.a.useState(!1),o=r.a.useCallback(e=>()=>{i(e)},[]),[u]=Object(s.a)(),d=r.a.useCallback(()=>{a&&(o(!1)(),u(()=>{l(a)},100))},[a,l]);return r.a.createElement(r.a.Fragment,null,r.a.createElement(n.g,{icon:p.a,destructive:!0,onClick:o(!0),plain:!0}),r.a.createElement(n.E,{title:"Remove this product",open:c,onClose:o(!1),sectioned:!0,primaryAction:{content:"Remove",onAction:d},secondaryActions:[{content:"Cancel",onAction:o(!1)}]},r.a.createElement("p",null,"Are you sure to remove this product?")))}var b=a(27),v=a.n(b);function f(e){let{children:t,product:a}=e;const l=v()(a,"isLock");let c=v()(a,"inPromotion");c||(c="other");const i=`This product is locked because the product is included in the ${c} promotion`;return l?r.a.createElement(n.gb,{content:i},t):t}function g(e){let{product:t}=e;const{productsSelected:a,handleSelectRow:l}=Object(E.h)(),c=a.includes(null===t||void 0===t?void 0:t.id),[i]=Object(s.a)(),o=r.a.useCallback((e,t)=>{i(()=>{l(t)},100)},[l]);return r.a.createElement(f,{product:t},r.a.createElement(n.j,{id:null===t||void 0===t?void 0:t.id,checked:c,onChange:o,disabled:!!t.isLock}))}var k=a(66),y=a.n(k);function C(e){let{product:t,type:a}=e;const{id:l}=t,{handleProductConfigChange:c}=Object(E.h)(),i=t[a],[o,u]=r.a.useState(()=>i||""),d=r.a.useRef(!1);r.a.useEffect(()=>{d.current||i&&!y()(i,o)&&u(i)},[i,o]);const[m]=Object(s.a)(),p=r.a.useCallback(e=>{const t=function(e,t){let a=+e;return-1>a||a>99?t:e}(e,o);u(t),l&&m(()=>{c({[a]:t},l),d.current=!1},750)},[c,l,a,o]),h=r.a.useCallback(()=>{d.current=!0},[]);return r.a.createElement(n.cb,{value:o,onChange:p,type:"number",min:-1,max:99,onFocus:h})}const w=Object(c.lazy)(()=>Promise.resolve().then(a.bind(null,37)));function S(){const{products:e,productsSelected:t,total:a,totalVariant:c,checkAll:i,handleCheckAll:p,setFilter:b,loading:v,filter:k,error:y}=Object(E.h)(),S=null===e||void 0===e?void 0:e.length,O=null===t||void 0===t?void 0:t.length,[x,A]=r.a.useState(""),[L]=Object(s.a)(),q=r.a.useCallback(e=>{A(e),L(()=>{b({search:e})})},[]),R=r.a.useMemo(()=>function(e){const t=[];for(let a of e){if(Object(o.Gb)(a))continue;const{originID:e,title:c}=a,i=[r.a.createElement("div",{className:"select-row item"},r.a.createElement(g,{product:a})),r.a.createElement("div",{className:"origin-id item"},r.a.createElement(f,{product:a},r.a.createElement("div",{className:"origin-inner"},r.a.createElement("span",null,e),a.isLock?r.a.createElement("div",null,r.a.createElement(n.w,{source:l.a})):null))),r.a.createElement("div",{className:"title item"},r.a.createElement(u.a,{href:"https://www.tiktok.com/view/product/"+e},c)),r.a.createElement("div",{className:"discount item"},r.a.createElement(C,{product:a,type:"discount"})),r.a.createElement("div",{className:"quantity-limit item"},r.a.createElement(C,{product:a,type:"quantityLimit"})),r.a.createElement("div",{className:"quantity-per-user item"},r.a.createElement(C,{product:a,type:"quantityPerUser"})),r.a.createElement("div",{className:"actions item"},r.a.createElement(h,{product:a}))];t.push(i)}return t}(e),[JSON.stringify(e)]),D=r.a.useMemo(()=>r.a.createElement(n.j,{id:"checkall_artist_task",checked:i,onChange:p}),[i,p]),T=r.a.useCallback((e,t)=>{b({paged:e/t+1,limit:t})},[]),_=r.a.useCallback(()=>{b({search:""})},[]),{limit:F,paged:I}=k,J={page:I,totalPage:Math.ceil(a/F),offset:(I-1)*F,limit:F,onChange:T,total:a};return r.a.createElement(j,null,r.a.createElement("div",{className:"head"},r.a.createElement(n.Y,{vertical:!0,spacing:"tight"},r.a.createElement(n.cb,{label:"Search Product",value:x,onChange:q,onClearButtonClick:_,clearButton:!0}),r.a.createElement(P,{pLen:O,total:c,productsSelected:t}),y?r.a.createElement(n.x,{message:y}):null)),v?r.a.createElement(m.SkeletonPagePolaris,{sizeSmall:!0}):S>0?r.a.createElement("div",{className:"table-wrap"},r.a.createElement(n.n,{rows:R,columnContentTypes:["text",...Array.from({length:5}).fill("text"),"numeric"],hideScrollIndicator:!0,verticalAlign:"middle",headings:[D,"Origin ID","Product","Discount","Quantity Limit","Quantity Per User","Action"]}),r.a.createElement(N,null,r.a.createElement(r.a.Suspense,{fallback:null},r.a.createElement(w,{aggregation:J,showTotal:!0})))):r.a.createElement(d.EmptyStatePolaris,null))}function P(e){let{pLen:t,total:a,productsSelected:l}=e;const c=function(e,t){let a=0;for(let[n,l]of Object.entries(e))t.includes(n)&&(a+=Number(l));return a}(a,l);return r.a.createElement("div",{className:"stats"},r.a.createElement("div",null,r.a.createElement(n.db,{variation:"subdued"},"Products selected: "),r.a.createElement(n.db,{variation:"subdued"},t||0)),r.a.createElement("div",null,r.a.createElement(n.db,{variation:"subdued"},"Product variants selected: "),r.a.createElement("span",null,r.a.createElement("div",{style:{display:"inline-flex",columnGap:"0.5rem"}},r.a.createElement("span",null,c||0)))))}const j=i.b.div` 2 .table-wrap { 3 overflow-x: auto; 4 } 5 6 .head { 7 padding: 1.6rem; 8 padding-bottom: 0; 9 } 10 11 .Polaris-DataTable__ScrollContainer { 12 overflow-x: inherit; 13 } 14 15 .item { 16 white-space: normal; 17 word-break: break-word; 18 } 19 20 .discount, 21 .quantity-limit, 22 .quantity-per-user { 23 width: 100px; 24 } 25 26 .title { 27 width: calc(32rem - 3.2rem); 28 } 29 30 .origin-inner { 31 display: flex; 32 column-gap: 0.5rem; 33 } 34`,N=i.b.div` 35 padding: 1.6rem; 36 overflow-x: scroll; 37 background: var(--p-surface-subdued, #f4f6f8); 38`}}]); 39//# sourceMappingURL=159.5857247d.chunk.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.