1(this.webpackJsonpapp=this.webpackJsonpapp||[]).push([[85],{1713:function(e,t,a){"use strict";a.r(t);var l=a(0),n=a.n(l),i=a(9),r=a(27),s=a.n(r),o=a(21),p=a(1),d=a(2),c=a(41),u=a(7),m=a(35);const f=m.a` 2 query templates($filter: TemplateFilter!) { 3 templates(filter: $filter) { 4 total 5 nodes { 6 id 7 name 8 } 9 } 10 } 11`,g=m.a` 12 query getTemplateByID($id: ID!) { 13 getTemplateByID(id: $id) { 14 id 15 name 16 slug 17 data { 18 products { 19 productbaseId 20 variants { 21 disabled 22 productBaseVariantID 23 } 24 } 25 productBases { 26 id 27 title 28 slug 29 fulfillment { 30 fulfillmentId 31 fulfillmentTitle 32 } 33 attributes { 34 name 35 slug 36 options 37 } 38 variants { 39 id 40 fulfillmentWarehouses 41 attributes { 42 name 43 slug 44 option 45 } 46 } 47 shippingOptions { 48 id 49 name 50 } 51 defaultShippingOptionId 52 } 53 } 54 } 55 } 56`;t.default=n.a.forwardRef((e,t)=>{let{onChange:a}=e;const[l,i]=n.a.useReducer(d.Hb,{selected:[],input:"",templates:[],originTemplates:[],templateCache:new Map}),[r,m]=n.a.useReducer(d.Hb,{limit:20,offset:0,product:!0,grouping:!1,search:""}),{loading:h,error:v}=Object(u.d)(f,{variables:{filter:r},onCompleted:e=>{const t=function(e){const t=s()(e,"templates.nodes");return{templates:(t||[]).map(e=>({value:e.id,label:e.name})),originTemplates:t}}(e);i(t)}}),[T]=Object(u.b)(g,{onCompleted:e=>{const t=(l=e,s()(l,"getTemplateByID")||null);var l;t&&i(e=>({...e,templateCache:e.templateCache.set(t.id,t)})),a(t)}}),[C]=Object(c.a)(),I=n.a.useCallback(e=>{const t=function(e,t){const a=[],l=function(e){const t=new Map;for(let a of e)t.set(a.id,a);return Object.fromEntries(t.entries())}(t);for(let n of e)l[n]&&a.push(l[n]);return a[0]}(e,l.originTemplates);var n;if(i({selected:e,input:(n=t,(null===n||void 0===n?void 0:n.name)||"")}),t){const e=l.templateCache.get(t.value);if(e)return void a(e.id,e);T({variables:{id:t.id}})}},[l.originTemplates,l.templateCache]),w=n.a.useCallback(e=>{i({input:e}),C(()=>{m({search:e})})},[m]);n.a.useImperativeHandle(t,()=>({getTemplate:()=>l.selected}));const E=n.a.createElement(p.c.TextField,{placeholder:"Search template",value:l.input,onChange:w});return n.a.createElement(b,null,n.a.createElement(o.a,{label:"Product templates",required:!0}),n.a.createElement(p.c,{options:l.templates,selected:l.selected,onSelect:I,textField:E,loading:h}),v?n.a.createElement("span",null,"Error: ",Object(d.ib)(null===v||void 0===v?void 0:v.toString())):null)});const b=i.b.div` 57 padding-top: 1.6rem; 58 59 .helpText-wrap { 60 display: flex; 61 align-items: center; 62 font-weight: 400; 63 line-height: 2rem; 64 text-transform: none; 65 letter-spacing: normal; 66 color: var(--p-text-subdued, #637381); 67 margin-top: 0.4rem; 68 font-size: 1.4rem; 69 70 .Polaris-Button { 71 margin-left: 0.3rem; 72 } 73 } 74`}}]); 75//# sourceMappingURL=85.b4e7de0e.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.