PageSourceSearch

https://app.listingview.io/_next/static/chunks/8569.046b665830e05c1b.js

js listingview.io collected 2026-09-24 14:26:25 UTC 29,362 bytes, 1 lines download raw bytes

1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8569],{18569:function(e,t,n){n.r(t),n.d(t,{buildSkuOnlyInventory:function(){return X},default:function(){return F}});var r=n(57437),i=n(2265),l=n(4385),o=n(46387),a=n(42187),s=n(67136),u=n(52180),c=n(74276),d=n(17716),v=n(59785),f=n(38869),p=n(69751),g=n(72823),h=n(7261),m=n(23909),y=n(1288),S=n(20914),x=n(18887),w=n(63916),b=n(25002),k=n(55194),_=n(72454),C=n(47113),j=n(41491),E=n(94229),I=n(82347),N=n(18457),L=n(15127),U=n(68575),K=n(66337),A=n(43792),P=n(64165),D=n(39095),O=n(17339);let Z="bulk.sku.tableEdits",z=(e,t)=>{try{localStorage.setItem(e,JSON.stringify(t))}catch(e){}},T=(e,t)=>{try{let n=localStorage.getItem(e);return n?JSON.parse(n):t}catch(e){return t}},R=e=>{if(!(null==e?void 0:e.price))return{amount:0,divisor:100,currency_code:"USD"};let{amount:t,divisor:n,currency_code:r}=e.price;return{amount:null!=t?t:0,divisor:n||100,currency_code:r||"USD"}},M=(e,t)=>{var n,r;let i=(e.property_values||[]).find(e=>(e.property_name||"").toLowerCase()===(t||"").toLowerCase());return null!==(r=null==i?void 0:null===(n=i.values)||void 0===n?void 0:n[0])&&void 0!==r?r:""};function q(e){var t;let n=(null==e?void 0:null===(t=e.inventory)||void 0===t?void 0:t.products)||[],r=[];n.forEach(e=>{(e.property_values||[]).forEach(e=>{let t=(e.property_name||"").trim();t&&!r.includes(t)&&r.push(t)})});let i=r[0]||"Variant 1",l=r[1]||null,o=n.map(e=>{var t,n,r;let o=(e.offerings||[])[0]||{},a=R(o),s=Number(null!==(t=a.amount)&&void 0!==t?t:0)/Number(a.divisor||100)||0,u=M(e,i),c=l?M(e,l):"";return{key:null!==(n=e.product_id)&&void 0!==n?n:l?"".concat(u,"|||").concat(c):u,v1:u,v2:c,sku:e.sku||"",price:s,currency:a.currency_code||"USD",quantity:Number(null!==(r=o.quantity)&&void 0!==r?r:0),_product:e,_axis1:i,_axis2:l}});return{axes:[i,l].filter(Boolean),rows:o}}function X(e,t,n,r){var i,l,o,a;let s=t[0]||"Variant 1",u=t[1]||null,c={},d=(null==e?void 0:null===(i=e.inventory)||void 0===i?void 0:i.products)||[];d.forEach(e=>{let t=M(e,s),n=u?M(e,u):"";c[u?"".concat(t,"|||").concat(n):t]=e});let v=n.map(e=>{var t,n,i,l;let o=c[u?"".concat(e.v1,"|||").concat(e.v2):e.v1]||{},a=(o.offerings||[])[0]||{},d=R(a),v=(0,k.dK)({base:o,axis1:s,axis2:u,v1:e.v1,v2:e.v2});return{sku:String(null!==(t=e.sku)&&void 0!==t?t:""),offerings:[{quantity:Number(null!==(n=a.quantity)&&void 0!==n?n:0),is_enabled:null===(i=a.is_enabled)||void 0===i||i,price:{amount:d.amount,divisor:d.divisor,currency_code:(0,k.VP)(a,r)},readiness_state_id:null!==(l=a.readiness_state_id)&&void 0!==l?l:1402579160544}],property_values:v}}),f=((null===(l=d[0])||void 0===l?void 0:l.property_values)||[]).map(e=>e.property_id).filter(e=>Number.isFinite(e)),p=null!==(o=f[0])&&void 0!==o?o:k.lT,g=u?null!==(a=f[1])&&void 0!==a?a:k.FT:null,h=u?[p,g]:[p];return{products:v,price_on_property:h,sku_on_property:h,...(0,x.rS)(v,h)}}function F(){let e=(0,U.v9)(e=>e.user.shopCurrencyCode||"USD"),{rows:t,filtered:n,drafts:x,selectedIds:k,commitInventoryForApi:R,activeSection:M,setActiveSection:F,getDraftInventoryFor:Q,getInventoryCacheFor:G,mergeInventoryCache:V,markEditorDirty:B,stageOperation:J,selectionIds:Y,tombstoneIds:H}=(0,d.rn)(),$=(0,p.ZP)(),W=(0,i.useMemo)(()=>(0,v.r)(M),[M]),[ee,et]=i.useState(!1),[en,er]=i.useState({}),[ei,el]=i.useState({}),eo=(e,t,n)=>el(r=>{let i={...r,[e]:{...r[e]||{},[t]:{sku:n}}};return z(Z,i),i}),ea=(0,f.ZP)({modes:f.$P,defaultMode:"ADD_END"}),es=(0,P.d)(i.useMemo(()=>Array.from(k||[]),[k])),eu=i.useCallback(e=>es.has(String(e)),[es]),{emitBlocked:ec,handleLockedInteraction:ed,handleLockedKeyDown:ev}=(0,D.Z)(O.yK.BULK_EDITOR);i.useEffect(()=>{el(e=>T(Z,e))},[]),i.useEffect(()=>{z(Z,ei)},[ei]);let[ef,ep]=(0,i.useState)(""),[eg,eh]=(0,i.useState)([]),em=(0,i.useMemo)(()=>new Set(Array.from(k||[]).map(String)),[k]),ey=i.useCallback(e=>(0,_.Xl)(e,"sku"),[]),eS=(0,i.useMemo)(()=>{let e=ef.trim().toLowerCase();return(n||[]).filter(t=>!!(ey(t)&&em.has(String((0,d.XQ)(t))))&&(!e||((null==t?void 0:t.title)||"").toLowerCase().includes(e)))},[n,ey,ef,em]),{isHydratingMatrix:ex,pendingIds:ew,hasFailedMatrices:eb,failedIds:ek,matrixReadyRows:e_,retryFailedMatrices:eC}=(0,j.Z)(eS),ej=(0,i.useMemo)(()=>(0,_.s7)(e_,d.XQ,x),[e_,x]),eE=(0,i.useMemo)(()=>{let e=(t||[]).filter(e=>ey(e)).map(e=>(0,d.XQ)(e)).filter(e=>em.has(String(e)));return $&&(0,g.JU)({eligibleIds:ej.map(e=>e.listingId),candidateIds:e,tombstoneIds:H,filtersActive:!!ef.trim()})},[ef,t,ey,em,ej,H,$]),{value:eI,stage:eN}=(0,C.Z)(x),eL=async e=>{if(!(null==e?void 0:e.length)){er({});return}let r=new Map((t||n||[]).map(e=>[String((0,d.XQ)(e)),e])),i=e.filter(e=>{let t=r.get(String(e));return!(t&&ey(t))&&!(G(e)&&G(e).inventory||en[e]&&en[e].inventory||Q(e))});if(i.length){et(!0);try{let e=await l.default.post("".concat("https://backend.listingview.io","/api/integration/etsy-bulk/getInventoryByListingIds"),{listingIds:i}),t=Array.isArray(e.data.data)?e.data.data:[e.data.data],r={};
1i.forEach(e=>{var t,i,l,o,a,s;let u=(n||[]).find(t=>Number((0,d.XQ)(t))===Number(e))||{};r[e]={listingId:e,listing:{title:(null==u?void 0:u.title)||"Listing #".concat(e),image:(null==u?void 0:null===(t=u.primaryImage)||void 0===t?void 0:t.srcSmall)||(null==u?void 0:null===(i=u.primaryImage)||void 0===i?void 0:i.srcMedium)||(null==u?void 0:null===(o=u.images)||void 0===o?void 0:null===(l=o[0])||void 0===l?void 0:l.url_170x135)||(null==u?void 0:null===(s=u.images)||void 0===s?void 0:null===(a=s[0])||void 0===a?void 0:a.url_570xN)||"https://via.placeholder.com/80x80.png?text=Image"},images:((null==u?void 0:u.images)||[]).map(e=>e.url_170x135||e.url_570xN||e.url_fullxfull).filter(Boolean),inventory:null}}),t.forEach(e=>{let t=Number((null==e?void 0:e.listingId)||(null==e?void 0:e.listing_id)||(null==e?void 0:e.id));t&&r[t]&&(r[t].inventory=e.inventory||null)}),er(e=>({...e,...r})),V(r)}catch(e){console.error("Error fetching inventory:",e)}finally{et(!1)}}};i.useEffect(()=>{let e=Array.from(k||[]),t={};e.forEach(e=>{let n=Q(e),r=G(e);n?t[e]={listingId:e,inventory:n}:r&&r.inventory&&(t[e]=r)}),Object.keys(t).length&&er(e=>({...t,...e})),eL(e)},[Array.from(k||[]).join(",")]);let eU=(0,i.useMemo)(()=>{let e={};n.forEach(t=>{let n=en[(0,d.XQ)(t)];if(!n)return;let r=q(n);if(!r)return;let i=r.axes||[],l=r.rows||[];i.forEach((t,n)=>{e[t]||(e[t]=new Set),l.forEach(r=>{let i=0===n?r.v1:r.v2;i&&e[t].add(i)})})});let t={};return Object.keys(e).forEach(n=>{t[n]=Array.from(e[n]).sort()}),t},[n,en]),eK=(0,i.useMemo)(()=>{let e=(n||[]).filter(e=>!ey(e));if(ef.trim()){let t=ef.toLowerCase().trim();e=e.filter(e=>((null==e?void 0:e.title)||"").toLowerCase().includes(t))}if(!eg||0===eg.length)return e;let t={};return eg.forEach(e=>{let n=e.variant.toLowerCase().trim();t[n]||(t[n]=[]),t[n].push(e)}),e.filter(e=>{let n=en[(0,d.XQ)(e)];if(!n)return!1;let r=q(n);if(!r)return!1;let i=r.axes||[],l=r.rows||[];return Object.values(t).every(e=>e.some(e=>{let{variant:t,option:n}=e,r=i.findIndex(e=>{let n=e.toLowerCase().trim(),r=t.toLowerCase().trim();return n===r||"color"===n&&"colors"===r||"colors"===n&&"color"===r||"size"===n&&"sizes"===r||"sizes"===n&&"size"===r});if(-1===r)return!1;let o=n.trim().toLowerCase();return l.some(e=>{let t=0===r?e.v1:e.v2;return!!t&&t.trim().toLowerCase()===o})}))})},[n,en,ey,eg,ef]),eA=t=>{var n;if(eu(t))return;let r=en[t]||(Q(t)?{inventory:Q(t)}:null);if(!(null==r?void 0:r.inventory)){console.warn("⚠️ SKUEditor: No inventory for listing",t);return}let i=q(r),l=ei[t]||{},o=i.rows.map(e=>({...e,...l[e.key]||{}})),a=X(r,i.axes,o,e);console.log("\uD83C\uDFF7️ SKUEditor: Committing SKU changes",{listingId:t,hasPayload:!!a,payloadType:typeof a,payloadKeys:a?Object.keys(a):[],productsCount:(null==a?void 0:null===(n=a.products)||void 0===n?void 0:n.length)||0}),R({[t]:a}),B&&B("sku")};return(0,r.jsx)(r.Fragment,{children:(0,r.jsx)(S.Z,{editorKey:"sku",showSearch:!1,showImagePreview:!0,rowsFilter:()=>eK,emptyMessage:ej.length>0?null:void 0,globalControls:(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)(o.Z,{className:"text-lg font-semibold",children:W.title}),(0,r.jsx)(o.Z,{className:"text-xs text-lv-text-secondary",children:W.description}),(0,r.jsxs)("div",{className:"grid grid-cols-12 gap-3 mt-4",children:[(0,r.jsx)("div",{className:"col-span-2",children:(0,r.jsxs)(c.Z,{compact:!0,value:M||"variations",onChange:e=>F(e.target.value),children:[(0,r.jsx)(a.Z,{value:"variations",children:"Variation"}),(0,r.jsx)(a.Z,{value:"price",children:"Price"}),(0,r.jsx)(a.Z,{value:"quantity",children:"Quantity"}),(0,r.jsx)(a.Z,{value:"sku",children:"SKU"})]})}),(0,r.jsx)("div",{className:"col-span-8",children:(0,r.jsx)(m.Z,{...ea,size:"sm"})}),(0,r.jsx)("div",{className:"col-span-2 flex items-center justify-end",children:(0,r.jsx)(u.Z,{text:"Update",color:"white",onClick:()=>{let n=new Set(eK.map(e=>String((0,d.XQ)(e)))),r=Array.from(k||[]).filter(e=>n.has(String(e))),i=r.filter(e=>!eu(e)),l=r.length-i.length;l>0&&(h.Am.info((0,O._G)(l),{toastId:"pod-sku-locked-bulk"}),ec(O.vk));let o=Array.from(k||[]).filter(e=>(t||[]).some(t=>String((0,d.XQ)(t))===String(e))),a=$&&"function"==typeof J&&(0,g.JU)({eligibleIds:i,candidateIds:o,tombstoneIds:H,filtersActive:eg.length>0||!!ef.trim()})?(0,g.Zp)(ea.mode,ea.input):null;if(a){let e=J(a);if(!e.ok){h.Am.error(e.error);return}h.Am.success("Staged for all ".concat(((null==Y?void 0:Y.length)||0).toLocaleStr
1ing()," selected listing(s). Review it on Publish.")),ea.reset();return}let s={};i.forEach(t=>{let n=en[t];if(!(null==n?void 0:n.inventory))return;let r=q(n),i=ei[t]||{},l=new Set((0,w.O)(r.rows,r.axes,eg).map(e=>e.key));if(0===l.size)return;let o=!1,a=r.rows.map(e=>{var t,n;let r={...e,...i[e.key]||{}};if(!l.has(e.key))return r;let a=ea.transform(String(null!==(t=r.sku)&&void 0!==t?t:""));return String(null!=a?a:"")!==String(null!==(n=r.sku)&&void 0!==n?n:"")&&(o=!0),{...r,sku:a}});if(!o)return;el(e=>{let n={...e[t]||{}};return a.forEach(e=>{l.has(e.key)&&(n[e.key]={sku:e.sku})}),{...e,[t]:n}});let u=X(n,r.axes,a,e);s[t]=u}),Object.keys(s).length&&(console.log("SkuEditor — Global Update staged:",s),R(s),B&&B("sku"),ea.reset())}})})]})]}),headerContent:(0,r.jsxs)(r.Fragment,{children:[ee&&(0,r.jsx)("div",{className:"flex justify-center py-6",children:(0,r.jsx)("div",{className:"h-6 w-6 animate-spin rounded-full border-2 border-lv-border-strong border-t-gray-900"})}),ex?(0,r.jsx)(E.Z,{listingCount:ew.size}):null,eb?(0,r.jsx)(I.Z,{listingCount:ek.size,onRetry:eC}):null,ej.length>0&&(0,r.jsx)(N.ZP,{stageOperation:J,bulkUpdateJobsEnabled:$,canStageOperation:eE,listings:ej,value:eI,onChange:(t,n)=>{let r=(0,_.Ck)({listings:ej,delta:t,currencyCode:e});if(eN(t,r),0!==Object.keys(r).length&&(R(r),B&&B("sku"),!(null==n?void 0:n.op))){var i,l;(0,L.Z)(N.oO,{podListings:null!==(i=null==n?void 0:n.changedListings)&&void 0!==i?i:1,variantCells:null!==(l=null==n?void 0:n.changedCells)&&void 0!==l?l:1,source:N.V_.GRID})}},source:N.V_.GRID}),(0,r.jsx)(b.Z,{search:ef,onSearchChange:ep,availableVariantsAndOptions:eU,selectedFilters:eg,onSelectedFiltersChange:eh,editingCount:eK.length})]}),getRowCardProps:e=>{var t,n,r;return{imgSrc:(null==e?void 0:null===(t=e.primaryImage)||void 0===t?void 0:t.srcFull)||(null==e?void 0:e.primaryImage)||(null==e?void 0:null===(r=e.images)||void 0===r?void 0:null===(n=r[0])||void 0===n?void 0:n.url_fullxfull)||"https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcSHZqj-XReJ2R76nji51cZl4ETk6-eHRmZBRw&s"}},renderRow:(e,t)=>{let{isChecked:n}=t,i=(0,d.XQ)(e),l=n?en[i]:null,o=l?q(l):null;if(!n||!o)return null;let a=eu(i);return(0,r.jsx)(w.Z,{axes:o.axes,rows:o.rows,editsForListing:ei[i]||{},selectedFilters:eg,listingId:i,isSelected:n,spanConfig:{single:{v1:5,sku:3,price:2,qty:2},dual:{v1:2,v2:2,sku:3,price:3,qty:2}},columns:[{key:"sku",header:"SKU",readOnly:a,renderCell:(e,t)=>{var l;let o=null!==(l=t.sku)&&void 0!==l?l:e.sku;if(a)return(0,r.jsx)(A.Z,{title:O._1,placement:"top",children:(0,r.jsxs)("span",{"aria-label":(0,O.ZQ)(o),"data-testid":O.eD,onClick:()=>ed("".concat(i,":").concat(e.key)),onKeyDown:t=>ev(t,"".concat(i,":").concat(e.key)),tabIndex:0,className:"inline-flex cursor-not-allowed items-center justify-center gap-1 rounded-lv-sm text-lv-body text-lv-text-secondary focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-lv-focus",children:[o||"—",(0,r.jsx)(K.Z,{size:14,role:"img","aria-label":O.Cw,className:"shrink-0 text-lv-text-tertiary"})]})});let u=(0,y.N)({base:o,isSelected:n,editorMode:ea});return(0,r.jsx)(s.Z,{size:"sm",value:u.showPreview?u.value:o,onChange:t=>eo(i,e.key,t),onBlur:()=>eA(i),placeholder:"Enter SKU",previewParts:u.previewParts,sx:{maxWidth:260}})}},{key:"price",header:"PRICE",readOnly:!0,renderCell:e=>null==e.price||""===e.price?"—":"$".concat(Number(e.price).toFixed(2))},{key:"qty",header:"QTY",readOnly:!0,renderCell:e=>{var t;return null!==(t=e.quantity)&&void 0!==t?t:0}}]})}})})}},63916:function(e,t,n){n.d(t,{O:function(){return l},Z:function(){return o}});var r=n(57437),i=n(2265);function l(e,t,n){if(!n||0===n.length)return e;let r={};return n.forEach(e=>{let t=e.variant.toLowerCase().trim();r[t]||(r[t]=[]),r[t].push(e)}),e.filter(e=>Object.values(r).every(n=>n.some(n=>{let{variant:r,option:i}=n,l=t.findIndex(e=>{let t=e.toLowerCase().trim(),n=r.toLowerCase().trim();return t===n||"color"===t&&"colors"===n||"colors"===t&&"color"===n||"size"===t&&"sizes"===n||"sizes"===t&&"size"===n});if(-1===l||l>=t.length)return!1;let o=i.trim().toLowerCase(),a=0===l?e.v1:e.v2;return!!a&&String(a).trim().toLowerCase()===o})))}function o(e){let{axes:t,rows:n,editsForListing:o,selectedFilters:a,listingId:s,isSelected:u,spanConfig:c,columns:d}=e,[v,f]=(0,i.useState)({}),p=t.length>1,g=p?c.dual:c.single,h=l(n,t,a),m="listing-".concat(s),y=v[m]===h.length,S=y?h:h.slice(0,5),x=h.length>5;return(0,r.jsxs)("div",{className:"mt-3 overflow-hidden rounded-lg border border-lv-border bg-lv-card",children:[(0,r.jsxs)("div",{className:"grid grid-cols-12 border-b border-lv-border bg-lv-elevated px-3 py-2 text-xs font-semibold text-lv-text-secondary",children:[(0,r.jsx)("div",{className:"col-span-".concat(g.v1," text-center uppercase"),children:t[0]||"Variant 1"}),p&&(0,r.jsx)("div",{className:"col-span-".concat(g.v2," text-center uppercase"),children:t[1]}),d.map(e=>(0,r.jsx)("div",{className:"col-span-".concat(g[e.key]," text-center"),children:e.header},e.key))]}),S.map((e,t)=>{let n=o[e.key]||{},i=t===S.length-1&&x&&!y;return(0,r.jsxs)("div",{className:["grid grid-cols-12 items-center px-3 py-2 text-sm relative",i||t===S.length-1?"":"border-b border-lv-subtle"].join(" "),children:[i&&(0,r.jsx)("div",{className:"absolute inset-0 flex items-center justify-center z-20",children:(0,r.jsxs)("button",{type:"button",onClick:()=>f(e=>({...e,[m]:h.length})),className:"text-xs text-lv-text-secondary hover:text-lv-text-primary border border-lv-border-strong rounded px-2 py-1 bg-lv-card shadow-sm",children:["Show all ",h.length," variants â
1†“"]})}),(0,r.jsx)("div",{className:"".concat(i?"blur-sm ":"","col-span-").concat(g.v1," text-lv-text-primary text-center"),children:e.v1}),p&&(0,r.jsx)("div",{className:"".concat(i?"blur-sm ":"","col-span-").concat(g.v2," text-lv-text-primary text-center"),children:e.v2}),d.map(t=>(0,r.jsx)("div",{className:[i?"blur-sm ":"","col-span-".concat(g[t.key]),"text-center",t.readOnly?" text-lv-text-primary":""].join(" "),children:t.renderCell(e,n,i)},t.key))]},e.key)}),y&&h.length>5&&(0,r.jsx)("div",{className:"grid grid-cols-12 items-center px-3 py-2 text-sm border-t border-lv-border",children:(0,r.jsx)("div",{className:"col-span-12 flex justify-center",children:(0,r.jsx)("button",{type:"button",onClick:()=>f(e=>{let t={...e};return delete t[m],t}),className:"text-xs text-lv-text-secondary hover:text-lv-text-primary border border-lv-border-strong rounded px-2 py-1 bg-lv-card",children:"Collapse variants ↑"})})})]})}},1288:function(e,t,n){n.d(t,{N:function(){return l}});var r=n(47502);let i=new Set(["ADD_FRONT","ADD_END","OVERWRITE","INC_PCT","DEC_PCT","INC_AMT","DEC_AMT","KEYWORD_SCRAMBLE"]);function l(e){let{base:t,isSelected:n,editorMode:l}=e,o=String(null!=t?t:""),{mode:a,input:s,findText:u,replaceText:c}=l,d={value:o,showPreview:!1,previewParts:void 0};if(!n)return d;if("FIND_REPLACE"===a)return u&&o.toLowerCase().includes(u.toLowerCase())?{value:o,showPreview:!0,previewParts:(0,r.fB)({mode:a,preview:o,input:s,findText:u,replaceText:c})}:d;if(!i.has(a)||!s)return d;let{preview:v,didTransform:f}=l.preview(o);return f?{value:v,showPreview:!0,previewParts:(0,r.fB)({mode:a,preview:v,input:s,findText:u,replaceText:c})}:d}},64165:function(e,t,n){n.d(t,{Z:function(){return o},d:function(){return a}});var r=n(2265),i=n(86438),l=n(32090);function o(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{enabled:n=!0}=t,o=(0,i.Hd)(),a=n&&o?(0,l.XL)(e):null,[s,u]=(0,r.useState)(()=>null!=a&&!0===(0,l.P3)(a)),[c,d]=(0,r.useState)(()=>(0,l.ku)(a)),[v,f]=(0,r.useState)(()=>null==a||void 0!==(0,l.ku)(a)||!1===(0,l.P3)(a));return(0,r.useEffect)(()=>{if(null==a){u(e=>!e&&e),d(void 0),f(!0);return}let e=(0,l.P3)(a),t=(0,l.ku)(a);if(d(t),void 0!==e){u(t=>t===e?t:e),f(void 0!==t||!1===e);return}f(!1);let n=!1;return(0,l.ZP)(a).then(e=>{n||void 0===e||(u(e),f(!0)),n||d((0,l.ku)(a))}),()=>{n=!0}},[a]),(0,r.useEffect)(()=>{if(null==a)return;let e=e=>{var t,n,r;if(String(null==e?void 0:null===(t=e.detail)||void 0===t?void 0:t.listingId)!==a||!(null==e?void 0:null===(n=e.detail)||void 0===n?void 0:n.payload))return;let i=e.detail.payload;d(i),u(!!(null==i?void 0:null===(r=i.links)||void 0===r?void 0:r.length)),f(!0)};return window.addEventListener(l.SD,e),()=>window.removeEventListener(l.SD,e)},[a]),{linked:s,statusResolved:v,markLinked:(0,r.useCallback)(()=>{null!=a&&(0,l.dJ)(a,!0),u(!0),f(void 0!==c)},[a,c]),status:c,refreshStatus:(0,r.useCallback)(async()=>{if(null==a)return null;let e=await (0,l.JG)(a);if(void 0!==e){var t;d(null!=e?e:void 0),u(!!(null==e?void 0:null===(t=e.links)||void 0===t?void 0:t.length)),f(!0)}return e},[a])}}function a(e){let t=(0,i.Hd)(),n=(0,r.useMemo)(()=>{if(!t)return[];let n=new Set;for(let t of Array.isArray(e)?e:[]){let e=(0,l.XL)(t);null!=e&&n.add(e)}return Array.from(n).sort()},[t,(Array.isArray(e)?e:[]).join()]),[o,a]=(0,r.useState)(()=>new Set);return(0,r.useEffect)(()=>{let e=new Set(n.filter(e=>!0===(0,l.P3)(e)));a(t=>!function(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}(t,e)?e:t);let t=n.filter(e=>void 0===(0,l.P3)(e));if(0===t.length)return;let r=!1;return(0,l.wK)(t).then(e=>{r||0===e.size||a(t=>{let n=new Set(t);return e.forEach(e=>n.add(e)),n})}),()=>{r=!0}},[n]),o}},86438:function(e,t,n){n.d(t,{Hd:function(){return s},YC:function(){return u}});var r=n(68575),i=n(95846),l=n(74231);let o="pod-draft-routing",a=(0,l.iv)(o);function s(){let e=(0,i.y)(o),t=(0,r.v9)(a);return e&&t}function u(){return(0,i.c)(o)}},39095:function(e,t,n){n.d(t,{Z:function(){return o}});var r=n(2265),i=n(15127),l=n(17339);function o(e){let t=(0,r.useRef)(new Map),n=(0,r.useCallback)(n=>{var r;let o=Date.now();o-(null!==(r=t.current.get(n))&&void 0!==r?r:0)<l.Nn||(t.current.set(n,o),(0,i.L)(l.wU,{surface:e}))},[e]),o=(0,r.useCallback)(e=>n(e),[n]),a=(0,r.useCallback)((e,t)=>{(0,l.mI)(e)&&(e.preventDefault(),n(t))},[n]);return{emitBlocked:n,handleLockedInteraction:o,handleLockedKeyDown:a}}},4465:function(e,t,n){n.d(t,{Ay:function(){return p},Hq:function(){return k},Kf:function(){return m},Kp:function(){return _},MM:function(){return C},Ps:function(){return h},SQ:function(){return f},St:function(){return y},Sv:function(){return s},T0:function(){return c},Tq:function(){return x},Tz:function(){return l},UU:function(){return E},Wi:function(){return U},Y$:function(){return d},aO:function(){return o},bt:function(){return u},c5:function(){return j},eU:function(){return b},f_:function(){return v},fz:function(){return S},lT:function(){return a},qL:function(){return I},qv:function(){return N},uv:function(){return w},vv:function(){return g},wr:function(){return L}});var r=n(4385);let i="https://backend.listingview.io",l=(e,t)=>
1r.default.patch("".concat(i,"/api/listings/").concat(e,"/product-type"),{product_type:t}),o=function(e,t,n,l){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;return r.default.post("".concat(i,"/api/listings/").concat(e,"/pod-products"),{catalog_product_id:t,selected_colors:n,selected_sizes:l,...null!=o&&""!==o?{print_provider_id:String(o)}:{}})},a=(e,t,n)=>r.default.post("".concat(i,"/api/listings/").concat(e,"/pod-products/").concat(t,"/change-provider"),{print_provider_id:String(n)}),s=(e,t)=>r.default.delete("".concat(i,"/api/listings/").concat(e,"/pod-products/").concat(t)),u=(e,t,n)=>r.default.patch("".concat(i,"/api/listings/").concat(e,"/pod-products/").concat(t,"/options"),n),c=(e,t,n)=>r.default.patch("".concat(i,"/api/listings/").concat(e,"/pod-products/").concat(t,"/overrides"),n),d=(e,t,n)=>r.default.patch("".concat(i,"/api/listings/").concat(e,"/variant-matrix"),{pod_product_id:t,updates:n}),v=(e,t)=>r.default.get("".concat(i,"/api/digital-files/listing/").concat(e),t),f=e=>r.default.get("".concat(i,"/api/integration/etsy/optimizer-listing/").concat(e,"/mockup-progress")),p=e=>r.default.get("".concat(i,"/api/integration/etsy-bulk/presets/").concat(e,"/mockup-progress")),g=(e,t)=>r.default.get("".concat(i,"/api/listings/").concat(e,"/file-assignments"),t),h=(e,t)=>r.default.post("".concat(i,"/api/listings/").concat(e,"/file-assignments"),t),m=(e,t,n)=>r.default.patch("".concat(i,"/api/listings/").concat(e,"/file-assignments/").concat(t),{is_enabled:n}),y=(e,t)=>r.default.delete("".concat(i,"/api/listings/").concat(e,"/file-assignments/").concat(t)),S=(e,t,n)=>r.default.post("".concat(i,"/api/listings/").concat(e,"/file-assignments/").concat(t,"/targets"),n),x=function(e,t,n,l){let o=arguments.length>4&&void 0!==arguments[4]?arguments[4]:null;return r.default.patch("".concat(i,"/api/listings/").concat(e,"/file-assignments/").concat(t,"/targets/").concat(n),o?{...l,target_ref:o}:l)},w=function(e,t,n){let l=arguments.length>3&&void 0!==arguments[3]?arguments[3]:null;return r.default.delete("".concat(i,"/api/listings/").concat(e,"/file-assignments/").concat(t,"/targets/").concat(n),l?{params:{pod_product_id:l.pod_product_id,print_area_id:l.print_area_id}}:void 0)},b=(e,t)=>r.default.put("".concat(i,"/api/listings/").concat(e,"/file-assignments/color-partition"),t),k=e=>r.default.get("".concat(i,"/api/listings/").concat(e,"/coverage-status")),_=(e,t)=>r.default.post("".concat(i,"/api/listings/").concat(e,"/pod-products/").concat(t,"/publish-to-printify")),C=(e,t,n)=>r.default.post("".concat(i,"/api/listings/").concat(e,"/pod-products/").concat(t,"/refresh-costs"),Array.isArray(n)&&n.length>0?{variant_keys:n}:{}),j=(e,t)=>r.default.get("".concat(i,"/api/listings/").concat(e,"/pod-draft-status"),t),E=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return r.default.post("".concat(i,"/api/listings/").concat(e,"/pod-draft/retry"),t?{pod_product_id:t}:{})};function I(e,t){var n,r,i,l;let o=null===(n=e.variations)||void 0===n?void 0:n.find(e=>"colors"===e.id||e.is_design_variable),a=null===(r=e.variations)||void 0===r?void 0:r.find(e=>e.id!==(null==o?void 0:o.id)&&("sizes"===e.id||!e.is_design_variable));return{selectedColors:(null!==(i=null==o?void 0:o.options)&&void 0!==i?i:[]).filter(e=>{var n;return null==t?void 0:null===(n=t[o.id])||void 0===n?void 0:n[e.id]}).map(e=>e.label),selectedSizes:(null!==(l=null==a?void 0:a.options)&&void 0!==l?l:[]).filter(e=>{var n;return null==t?void 0:null===(n=t[a.id])||void 0===n?void 0:n[e.id]}).map(e=>e.label)}}function N(e,t,n){let{selectedColors:r,selectedSizes:i}=I(e,t),{selectedColors:l,selectedSizes:o}=I(e,n),a=new Set(r),s=new Set(l),u=new Set(i),c=new Set(o);return{add_colors:l.filter(e=>!a.has(e)),remove_colors:r.filter(e=>!s.has(e)),add_sizes:o.filter(e=>!u.has(e)),remove_sizes:i.filter(e=>!c.has(e))}}function L(e,t){let n=e=>(null!=e?e:"").toLowerCase().replace(/[^a-z0-9]+/g,"_").replace(/^_|_$/g,""),r=e?"color_".concat(n(e)):null,i=t?"size_".concat(n(t)):null;return r&&i?"".concat(r,"+").concat(i):r||i||""}function U(e){return"digital"===e?"digital":"pod"===e?"pod":"physical"}},32090:function(e,t,n){n.d(t,{JG:function(){return S},NK:function(){return y},P3:function(){return v},SD:function(){return u},XK:function(){return m},XL:function(){return c},ZP:function(){return x},bd:function(){return h},dJ:function(){return f},ku:function(){return p},wK:function(){return w},wq:function(){return g}});var r=n(4465),i=n(86438);let l=new Map,o=new Set,a=new Map,s=new Map,u="listingview:pod-draft-status-updated";function c(e){return null==e||""===e?null:String(e)}function d(e){return Array.isArray(null==e?void 0:e.links)&&e.links.length>0}function v(e){if(null!=e)return l.get(e)}function f(e,t){null!=e&&(l.set(e,t),t&&o.delete(e))}function p(e){if(null!=e)return s.get(e)}function g(e,t){null!=e&&t&&(s.set(e,t),f(e,d(t)),window.dispatchEvent(new CustomEvent(u,{detail:{listingId:String(e),payload:t}}
1)))}function h(e){return null!=e&&o.has(e)}function m(e){null!=e&&o.add(e)}function y(e){let t=c(e);null!=t&&o.delete(t)}async function S(e){var t,n,l;if(!(0,i.YC)())return null;let o=c(e);if(null==o)return null;try{let e=await (0,r.c5)(o),i=null!==(n=null==e?void 0:null===(t=e.data)||void 0===t?void 0:t.data)&&void 0!==n?n:null;return i&&g(o,i),i}catch(e){if((null==e?void 0:null===(l=e.response)||void 0===l?void 0:l.status)===404)return f(o,!1),m(o),s.delete(o),null;return}}async function x(e){if(!(0,i.YC)())return!1;let t=c(e);if(null==t)return!1;let n=l.get(t);if(void 0!==n)return n;if(o.has(t))return!1;let s=a.get(t);if(s)return s;let u=(async()=>{var e,n;try{let n=await (0,r.c5)(t),i=null==n?void 0:null===(e=n.data)||void 0===e?void 0:e.data,l=d(i);return i?g(t,i):f(t,l),l}catch(e){if((null==e?void 0:null===(n=e.response)||void 0===n?void 0:n.status)===404)return f(t,!1),m(t),!1;return}finally{a.delete(t)}})();return a.set(t,u),u}async function w(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{concurrency:n=6}=t,r=new Set;if(!(0,i.YC)())return r;let l=[],o=new Set;for(let t of Array.isArray(e)?e:[]){let e=c(t);null==e||o.has(e)||(o.add(e),l.push(e))}if(0===l.length)return r;let a=0,s=async()=>{for(;a<l.length;){let e=l[a];a+=1,await x(e)===!0&&r.add(e)}};return await Promise.all(Array.from({length:Math.min(n,l.length)},s)),r}},17339:function(e,t,n){n.d(t,{Bh:function(){return a},Cw:function(){return m},EO:function(){return p},Nn:function(){return x},X:function(){return k},Z0:function(){return v},ZQ:function(){return y},_1:function(){return i},_G:function(){return b},dd:function(){return f},eD:function(){return g},hr:function(){return o},ll:function(){return h},mI:function(){return S},vk:function(){return w},wU:function(){return s},wy:function(){return l},yK:function(){return u}});let r=RegExp("^[^\\p{C}]+$","u"),i="SKUs on auto-routed listings are managed by ListingView.",l="ListingView assigns and manages this SKU so print-on-demand orders route to the right product.",o=Object.freeze({LOCKED_ROUTED_LISTING:"SKU_LOCKED_ROUTED_LISTING",DUPLICATE_CROSS_LISTING:"SKU_DUPLICATE_CROSS_LISTING"}),a=Object.freeze({[o.LOCKED_ROUTED_LISTING]:"SKUs on auto-routed listings are managed by ListingView. This listing's orders route to Printify by SKU, so its SKUs can't be changed. Prices, quantities and which variants are enabled are still editable.",[o.DUPLICATE_CROSS_LISTING]:"Another auto-routed listing in this Printify shop already uses this SKU. Printify matches SKUs across the whole shop, so orders would be fulfilled from the wrong product. Use a different SKU."}),s="pod_sku_edit_blocked",u=Object.freeze({MATRIX:"matrix",BULK_EDITOR:"bulk_editor",API:"api"}),c=e=>"SKU is ".concat(e," characters. Etsy allows ").concat(32,". One ")+"over-length SKU makes the entire listing's variations fail to save — shorten it.",d=e=>"Two variants share SKU '".concat(e,"'. Each variant needs a unique SKU for order ")+"routing.";function v(e){return null==e?"":String(e).trim()}function f(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},{requireNonEmpty:n=!0,duplicate:i=!1}=t,l=null==e?"":String(e),o=l.trim();return""===o?n?"This variant has no SKU, so its orders won't route to Printify automatically. Add one or disable the variant.":null:l===o&&r.test(o)?o.length>32?c(o.length):i?d(o):null:"SKUs can't contain control characters or leading/trailing spaces (max 32)."}function p(e){let t=function(e){var t,n,r,i;let l=null==e?void 0:null===(t=e.response)||void 0===t?void 0:t.data,o=null!==(i=null!==(r=null==l?void 0:null===(n=l.data)||void 0===n?void 0:n.code)&&void 0!==r?r:null==l?void 0:l.code)&&void 0!==i?i:null;return"string"==typeof o?o:null}(e),n=t?a[t]:void 0;return n?{code:t,message:n}:null}let g="pod-sku-locked",h="pod-sku-persisted",m="SKU locked",y=e=>"SKU, ".concat(e?String(e):"empty",", locked. ").concat(i);function S(e){return!!(null==e?void 0:e.key)&&!e.altKey&&!e.ctrlKey&&!e.metaKey&&("Enter"===e.key||" "===e.key||"Spacebar"===e.key||"Backspace"===e.key||"Delete"===e.key||1===e.key.length)}let x=3e3,w="__sku_write__",b=e=>
1"SKUs are locked on ".concat(e," routed listing").concat(1===e?"":"s"," — ")+"they're managed by ListingView for order routing.",k="SKUs are locked — ListingView manages them for order routing."}}]);

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.