@uniformdev/mesh-sdk-react 17.2.1-alpha.134 → 17.2.1-alpha.201

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.esm.js CHANGED
@@ -1,4 +1,4 @@
1
- var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enumerable:!0})};import{jsx as d}from"@emotion/react";import*as w from"react";import{createContext as Io,useContext as Eo,useState as To}from"react";import{jsx as Mo}from"@emotion/react/jsx-runtime";var ot=Io(void 0),nt=({children:e})=>{let[o,r]=To(),t;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let n=o||window.UniformMeshSDK.getCurrentLocation();t={location:{getValue:n.getValue,getMetadata:n.getMetadata,setValue:async(a,l)=>{await n.setValue(a,l),r(window.UniformMeshSDK.getCurrentLocation())},setValidationResult:async a=>{await n.setValidationResult(a)}}}}return Mo(ot.Provider,{value:t,children:e})},at=()=>{let e=Eo(ot);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function la(){let{location:e}=at();return{value:e==null?void 0:e.getValue(),setValue:e==null?void 0:e.setValue,metadata:e==null?void 0:e.getMetadata(),setValidationResult:e==null?void 0:e.setValidationResult}}import{initializeUniformMeshSDK as Vo}from"@uniformdev/mesh-sdk";import{useEffect as Do,useRef as zo,useState as it}from"react";var fa=({autoResizingDisabled:e}={})=>{let[o,r]=it(),[t,n]=it(),a=zo(!1);return Do(()=>{typeof window=="undefined"||t||(typeof window.UniformMeshSDK=="undefined"&&!a.current?(a.current=!0,Vo({autoResizingDisabled:e}).then(l=>{n(l)}).catch(l=>{r(l)}).finally(()=>{a.current=!1})):n(window.UniformMeshSDK))},[e]),{initializing:!t&&!o,error:o,sdk:t}};import{createContext as Uo,useContext as Go}from"react";import{Theme as Ao}from"@uniformdev/design-system";import{jsx as st,jsxs as Bo}from"@emotion/react/jsx-runtime";var ct=Uo(void 0),xa=({children:e})=>{let o;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(o={sdk:window.UniformMeshSDK}),Bo(ct.Provider,{value:o,children:[st(Ao,{}),st(nt,{children:e})]})},dt=()=>{let e=Go(ct);if(!e)throw new Error("useUniformMeshSdkContext must be used within a UniformMeshSdkContextProvider");return e};function Pa(){let{sdk:e}=dt();return e}import Qo,{useMemo as Ce,useContext as Wo}from"react";import{css as Oo}from"@emotion/react";import{Icon as Ho,InputSelect as Fo}from"@uniformdev/design-system";import{CgClose as $o}from"react-icons/cg";import{Fragment as lt,jsxs as pt}from"@emotion/react/jsx-runtime";var ut=({value:e,text:o,loading:r})=>pt(lt,{children:[!!o&&o,!o&&pt(lt,{children:[r&&`${e} (Loading...)`,!r&&`${e} (Unresolvable)`]})]});import{css as De}from"@emotion/react";var mt=De`
1
+ var Io=Object.defineProperty;var To=(e,r)=>{for(var o in r)Io(e,o,{get:r[o],enumerable:!0})};import{jsx as l}from"@emotion/react";import*as x from"react";import{createContext as Eo,useContext as Mo,useState as Vo}from"react";import{jsx as Do}from"@emotion/react/jsx-runtime";var st=Eo(void 0),we=({children:e})=>{let[r,o]=Vo(),t;if(typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"){let n=r||window.UniformMeshSDK.getCurrentLocation();t={location:{...n,setValue:async(a,d)=>{var m;await n.setValue(a,d),o((m=window.UniformMeshSDK)==null?void 0:m.getCurrentLocation())}}}}return Do(st.Provider,{value:t,children:e})},Ce=()=>{let e=Mo(st);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};function fa(){let{location:e}=Ce();return e}import{initializeUniformMeshSDK as Uo}from"@uniformdev/mesh-sdk";import{useEffect as zo,useRef as Ao,useState as ct}from"react";var dt=({autoResizingDisabled:e}={})=>{let[r,o]=ct(),[t,n]=ct(),a=Ao(!1);return zo(()=>{typeof window=="undefined"||t||(typeof window.UniformMeshSDK=="undefined"&&!a.current?(a.current=!0,Uo({autoResizingDisabled:e}).then(d=>{n(d)}).catch(d=>{o(d)}).finally(()=>{a.current=!1})):n(window.UniformMeshSDK))},[e]),{initializing:!t&&!r,error:r,sdk:t}};import{createContext as Go,useContext as Bo}from"react";import{Theme as Oo}from"@uniformdev/design-system";import{jsx as lt,jsxs as Ho}from"@emotion/react/jsx-runtime";var Pe=Go(void 0),La=({children:e})=>{let r;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(r={sdk:window.UniformMeshSDK}),Ho(Pe.Provider,{value:r,children:[lt(Oo,{}),lt(we,{children:e})]})},pt=()=>{let e=Bo(Pe);if(!e)throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");return e};function Ia(){let{sdk:e}=pt();return e}function Ma(e){let{location:r}=Ce();if(e&&r.type!==e)throw new Error(`Expected location type ${e} but got ${r.type}`);return r}import _o,{useMemo as ke,useContext as Zo}from"react";import{css as $o}from"@emotion/react";import{Icon as Fo,InputSelect as Ko}from"@uniformdev/design-system";import{CgClose as No}from"react-icons/cg";import{Fragment as ut,jsxs as mt}from"@emotion/react/jsx-runtime";var gt=({value:e,text:r,loading:o})=>mt(ut,{children:[!!r&&r,!r&&mt(ut,{children:[o&&`${e} (Loading...)`,!o&&`${e} (Unresolvable)`]})]});import{css as Ge}from"@emotion/react";var ft=Ge`
2
2
  align-items: center;
3
3
  background: var(--gray-100);
4
4
  border: 1px solid var(--gray-300);
@@ -7,66 +7,66 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
7
7
  justify-content: space-between;
8
8
  margin-bottom: var(--spacing-sm);
9
9
  margin-right: var(--spacing-sm);
10
- `,gt=De`
10
+ `,vt=Ge`
11
11
  color: var(--gray-800);
12
12
  padding: var(--spacing-3);
13
- `,ft=De`
13
+ `,ht=Ge`
14
14
  border: none;
15
15
  border-left: 1px solid var(--gray-300);
16
16
  background: var(--gray-100);
17
17
  padding: var(--spacing-3);
18
- `;import{jsx as fe,jsxs as vt}from"@emotion/react/jsx-runtime";var ht=({id:e,label:o,loading:r,selectedValues:t,values:n,onAdd:a,onRemove:l})=>{var v;let f=(v=n==null?void 0:n.filter(i=>!(t!=null&&t.includes(i.id.toString()))))!=null?v:[],m=(i,p)=>{i.preventDefault(),l(p)};return vt("div",{children:[fe(Fo,{id:e,name:e,label:o,onChange:i=>a(i.target.value),disabled:r,options:[{value:"",label:"Add..."},...f.map(i=>({value:i.id,label:i.name||i.id}))],value:"",css:Array.isArray(t)&&t.length>0?Oo`
18
+ `;import{jsx as fe,jsxs as yt}from"@emotion/react/jsx-runtime";var St=({id:e,label:r,loading:o,selectedValues:t,values:n,onAdd:a,onRemove:d})=>{var v;let m=(v=n==null?void 0:n.filter(i=>!(t!=null&&t.includes(i.id.toString()))))!=null?v:[],g=(i,p)=>{i.preventDefault(),d(p)};return yt("div",{children:[fe(Ko,{id:e,name:e,label:r,onChange:i=>a(i.target.value),disabled:o,options:[{value:"",label:"Add..."},...m.map(i=>({value:i.id,label:i.name||i.id}))],value:"",css:Array.isArray(t)&&t.length>0?$o`
19
19
  margin-bottom: var(--spacing-base);
20
- `:""}),t==null?void 0:t.map(i=>{var p;return vt("div",{css:mt,children:[fe("span",{css:gt,children:fe(ut,{value:i,loading:r,text:(p=n.find(b=>b.id===i))==null?void 0:p.name})}),fe("button",{css:ft,title:"remove",onClick:b=>m(b,i),children:fe(Ho,{icon:$o,iconColor:"currentColor",size:20})})]},i)})]})};import{jsx as bt}from"@emotion/react/jsx-runtime";var Ko=e=>bt("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:bt("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})}),xe=Ko;import{jsx as yt}from"@emotion/react/jsx-runtime";var No=e=>yt("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:yt("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})}),we=No;import{useAsyncFn as _o,useDebounce as Zo}from"react-use";import{Input as St,InputSelect as Pe,mq as Re}from"@uniformdev/design-system";import{css as R}from"@emotion/react";import{jsx as x,jsxs as se}from"@emotion/react/jsx-runtime";var xt={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},_a=({value:e,setValue:o,brands:r,categories:t,loading:n,categoriesLoading:a,brandsLoading:l,logoIcon:f,onGetProducts:m,sortOptions:v,sortOrderOptions:i,categoryLabel:p="Product Category",brandLabel:b="Brand",disableBrands:D,restrictToSingleCategory:ae=!1})=>{var T,u,V;let S=async s=>{o({...xt,...e||{},...s})},y=Ce(()=>({...xt,...e||{}}),[e]),[ie,ue]=_o(async s=>await m(s),[m]);Zo(async()=>{await ue({brand:y.brand,categories:y.categories,keyword:y.keyword,sort:y.sort,sortOrder:y.sortOrder,count:y.count})},250,[y]);let O=Ce(()=>{let s=[];return t==null||t.forEach(z=>{let C=Ct(z,void 0);s.push(...C)}),s},[t]),_=Ce(()=>[{value:"",label:"All categories"},...O.map(s=>({label:s.name,value:s.id}))],[O]),W=Ce(()=>(r==null?void 0:r.map(s=>({id:s.id.toString(),name:s.name})))||[],[r]),me=s=>{if(!s)return;let z=(e==null?void 0:e.categories)||[];S({categories:[...z,s]})},ye=s=>{var z;S({categories:(z=e==null?void 0:e.categories)==null?void 0:z.filter(C=>C!==s)})},j=s=>{S({brand:s.target.value})},H=s=>{S({count:s||1})};return n?x("div",{children:"Loading..."}):x(Pt.Provider,{value:{categories:t,logoIcon:f},children:se("div",{css:R`
20
+ `:""}),t==null?void 0:t.map(i=>{var p;return yt("div",{css:ft,children:[fe("span",{css:vt,children:fe(gt,{value:i,loading:o,text:(p=n.find(y=>y.id===i))==null?void 0:p.name})}),fe("button",{css:ht,title:"remove",onClick:y=>g(y,i),children:fe(Fo,{icon:No,iconColor:"currentColor",size:20})})]},i)})]})};import{jsx as bt}from"@emotion/react/jsx-runtime";var Qo=e=>bt("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:bt("path",{d:"M44.203 21.203H24.797V1.797a1.797 1.797 0 1 0-3.594 0v19.406H1.797a1.797 1.797 0 1 0 0 3.594h19.406v19.406a1.797 1.797 0 0 0 3.594 0V24.797h19.406a1.797 1.797 0 0 0 0-3.594Z"})}),Le=Qo;import{jsx as xt}from"@emotion/react/jsx-runtime";var Wo=e=>xt("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:xt("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})}),Re=Wo;import{useAsyncFn as Xo,useDebounce as qo}from"react-use";import{Input as wt,InputSelect as Ie,mq as Te}from"@uniformdev/design-system";import{css as L}from"@emotion/react";import{jsx as w,jsxs as se}from"@emotion/react/jsx-runtime";var Ct={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},ei=({value:e,setValue:r,brands:o,categories:t,loading:n,categoriesLoading:a,brandsLoading:d,logoIcon:m,onGetProducts:g,sortOptions:v,sortOrderOptions:i,categoryLabel:p="Product Category",brandLabel:y="Brand",disableBrands:D,restrictToSingleCategory:ae=!1})=>{var E,u,V;let b=async s=>{r({...Ct,...e||{},...s})},S=ke(()=>({...Ct,...e||{}}),[e]),[ie,ue]=Xo(async s=>await g(s),[g]);qo(async()=>{await ue({brand:S.brand,categories:S.categories,keyword:S.keyword,sort:S.sort,sortOrder:S.sortOrder,count:S.count})},250,[S]);let O=ke(()=>{let s=[];return t==null||t.forEach(U=>{let C=Lt(U,void 0);s.push(...C)}),s},[t]),_=ke(()=>[{value:"",label:"All categories"},...O.map(s=>({label:s.name,value:s.id}))],[O]),W=ke(()=>(o==null?void 0:o.map(s=>({id:s.id.toString(),name:s.name})))||[],[o]),me=s=>{if(!s)return;let U=(e==null?void 0:e.categories)||[];b({categories:[...U,s]})},be=s=>{var U;b({categories:(U=e==null?void 0:e.categories)==null?void 0:U.filter(C=>C!==s)})},j=s=>{b({brand:s.target.value})},H=s=>{b({count:s||1})};return n?w("div",{children:"Loading..."}):w(Rt.Provider,{value:{categories:t,logoIcon:m},children:se("div",{css:L`
21
21
  > :not(:last-child) {
22
22
  margin-bottom: var(--spacing-md);
23
23
  }
24
- `,children:[ae?x(Pe,{id:"selection-field-product-category",label:p,disabled:n,value:(u=(T=y.categories)==null?void 0:T[0])!=null?u:"",options:_,onChange:s=>{S({categories:s.target.value===""?[]:[s.target.value]})}}):x(ht,{loading:a||!1,id:"selection-field-product-category",label:p,onAdd:me,onRemove:ye,selectedValues:y.categories,values:O}),se("div",{css:R`
24
+ `,children:[ae?w(Ie,{id:"selection-field-product-category",label:p,disabled:n,value:(u=(E=S.categories)==null?void 0:E[0])!=null?u:"",options:_,onChange:s=>{b({categories:s.target.value===""?[]:[s.target.value]})}}):w(St,{loading:a||!1,id:"selection-field-product-category",label:p,onAdd:me,onRemove:be,selectedValues:S.categories,values:O}),se("div",{css:L`
25
25
  display: flex;
26
26
  flex-wrap: wrap;
27
27
  column-gap: var(--spacing-lg);
28
28
  row-gap: var(--spacing-md);
29
- ${Re("md")} {
29
+ ${Te("md")} {
30
30
  flex-wrap: nowrap;
31
31
  }
32
- `,children:[D?null:x("div",{css:R`
32
+ `,children:[D?null:w("div",{css:L`
33
33
  width: 50%;
34
- `,children:x(Pe,{id:"brand",name:"brand",label:b,disabled:l,value:y.brand,onChange:j,options:[{value:"",label:"Choose..."},...W.map(s=>({value:s.id,label:s.name}))]})}),x("div",{css:R`
34
+ `,children:w(Ie,{id:"brand",name:"brand",label:y,disabled:d,value:S.brand,onChange:j,options:[{value:"",label:"Choose..."},...W.map(s=>({value:s.id,label:s.name}))]})}),w("div",{css:L`
35
35
  flex-grow: 1;
36
36
  position: relative;
37
- `,children:x(St,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:y.keyword,placeholder:"Enter keyword",onChange:s=>S({keyword:s.target.value})})})]}),se("div",{css:R`
37
+ `,children:w(wt,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:S.keyword,placeholder:"Enter keyword",onChange:s=>b({keyword:s.target.value})})})]}),se("div",{css:L`
38
38
  display: flex;
39
39
  flex-wrap: wrap;
40
40
  column-gap: var(--spacing-lg);
41
41
  row-gap: var(--spacing-md);
42
- ${Re("md")} {
42
+ ${Te("md")} {
43
43
  flex-wrap: nowrap;
44
44
  }
45
- `,children:[se("div",{css:R`
45
+ `,children:[se("div",{css:L`
46
46
  width: 100%;
47
- ${Re("md")} {
47
+ ${Te("md")} {
48
48
  width: 33.333333%;
49
49
  }
50
50
  position: relative;
51
- `,children:[x(St,{id:"count",name:"count",type:"number",min:1,step:1,value:y.count,onChange:s=>H(s.target.valueAsNumber),label:"Count"}),se("div",{css:R`
51
+ `,children:[w(wt,{id:"count",name:"count",type:"number",min:1,step:1,value:S.count,onChange:s=>H(s.target.valueAsNumber),label:"Count"}),se("div",{css:L`
52
52
  position: absolute;
53
53
  bottom: var(--spacing-sm);
54
54
  right: var(--spacing-sm);
55
55
  display: flex;
56
56
  gap: var(--spacing-sm);
57
- `,children:[x(wt,{onCountChange:()=>H(y.count-1),countIcon:"decrement",disabled:y.count===1}),x(wt,{onCountChange:()=>H(y.count+1),countIcon:"increment"})]})]}),Array.isArray(v)&&v.length>0?x("div",{css:R`
57
+ `,children:[w(Pt,{onCountChange:()=>H(S.count-1),countIcon:"decrement",disabled:S.count===1}),w(Pt,{onCountChange:()=>H(S.count+1),countIcon:"increment"})]})]}),Array.isArray(v)&&v.length>0?w("div",{css:L`
58
58
  flex-grow: 1;
59
- ${Re("md")} {
59
+ ${Te("md")} {
60
60
  width: 33.333333%;
61
61
  }
62
- `,children:x(Pe,{id:"sort",name:"sort",label:"Sort",value:y.sort,onChange:s=>S({sort:s.target.value}),options:[{value:"",label:"Select a sort"},...v.map(s=>({value:s.sortKey,label:s.name}))]})}):null,Array.isArray(i)&&i.length>0?x("div",{css:R`
62
+ `,children:w(Ie,{id:"sort",name:"sort",label:"Sort",value:S.sort,onChange:s=>b({sort:s.target.value}),options:[{value:"",label:"Select a sort"},...v.map(s=>({value:s.sortKey,label:s.name}))]})}):null,Array.isArray(i)&&i.length>0?w("div",{css:L`
63
63
  flex-grow: 1;
64
- `,children:x(Pe,{id:"sort-order",name:"sort-order",label:"Sort Order",value:y.sortOrder,onChange:s=>S({sortOrder:s.target.value}),options:i.map(s=>({value:s.sortOrderKey,label:s.name}))})}):null]}),se("div",{children:[x("h3",{css:R`
64
+ `,children:w(Ie,{id:"sort-order",name:"sort-order",label:"Sort Order",value:S.sortOrder,onChange:s=>b({sortOrder:s.target.value}),options:i.map(s=>({value:s.sortOrderKey,label:s.name}))})}):null]}),se("div",{children:[w("h3",{css:L`
65
65
  font-size: var(--fs-md);
66
66
  line-height: var(--spacing-md);
67
67
  font-weight: var(--fw-bold);
68
68
  margin-bottom: var(--spacing-xs);
69
- `,children:"Result Preview"}),x(Lt,{products:(V=ie.value)==null?void 0:V.products})]})]})})};function Ct(e,o){var a;let r=[],t=o?`${o.name} > `:"",n={id:e.id.toString(),name:`${t}${e.name}`};return r.push(n),(a=e.children)==null||a.forEach(l=>{let f=Ct(l,n);r.push(...f)}),r}function wt({onCountChange:e,countIcon:o,disabled:r}){return x("button",{css:R`
69
+ `,children:"Result Preview"}),w(It,{products:(V=ie.value)==null?void 0:V.products})]})]})})};function Lt(e,r){var a;let o=[],t=r?`${r.name} > `:"",n={id:e.id.toString(),name:`${t}${e.name}`};return o.push(n),(a=e.children)==null||a.forEach(d=>{let m=Lt(d,n);o.push(...m)}),o}function Pt({onCountChange:e,countIcon:r,disabled:o}){return w("button",{css:L`
70
70
  width: 2.25rem;
71
71
  height: 2.25rem;
72
72
  border: 1px solid var(--gray-300);
@@ -78,17 +78,17 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
78
78
  &:hover {
79
79
  background-color: var(--gray-200);
80
80
  }
81
- ${r?R`
81
+ ${o?L`
82
82
  cursor: not-allowed;
83
83
  opacity: 0.3;
84
84
  `:""}
85
- `,onClick:e,disabled:r,children:o==="increment"?x(xe,{css:R`
85
+ `,onClick:e,disabled:o,children:r==="increment"?w(Le,{css:L`
86
86
  width: 1rem;
87
87
  height: 1rem;
88
- `}):x(we,{css:R`
88
+ `}):w(Re,{css:L`
89
89
  width: 1rem;
90
90
  height: 1rem;
91
- `})})}var Pt=Qo.createContext(void 0),Rt=()=>{let e=Wo(Pt);if(!e)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return e};import{jsx as kt}from"@emotion/react/jsx-runtime";function F({src:e,alt:o,className:r}){let t=e&&typeof e!="string"?e:null;return t?kt(t,{className:r}):kt("img",{src:e,alt:o,className:r})}import{css as At}from"@emotion/react";import{scrollbarStyles as Xo}from"@uniformdev/design-system";import{css as $}from"@emotion/react";var It=$`
91
+ `})})}var Rt=_o.createContext(void 0),kt=()=>{let e=Zo(Rt);if(!e)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return e};import{jsx as Tt}from"@emotion/react/jsx-runtime";function $({src:e,alt:r,className:o}){let t=e&&typeof e!="string"?e:null;return t?Tt(t,{className:o}):Tt("img",{src:e,alt:r,className:o})}import{css as Ot}from"@emotion/react";import{scrollbarStyles as Yo}from"@uniformdev/design-system";import{css as F}from"@emotion/react";var Et=F`
92
92
  align-items: center;
93
93
  background: var(--white);
94
94
  border-radius: var(--rounded-base);
@@ -103,55 +103,55 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
103
103
  &:hover {
104
104
  background: var(--gray-50);
105
105
  }
106
- `,Et=$`
106
+ `,Mt=F`
107
107
  font-size: var(--fs-sm);
108
- `,Tt=$`
108
+ `,Vt=F`
109
109
  width: 1rem;
110
110
  height: 1rem;
111
- `,ze=$`
111
+ `,Be=F`
112
112
  margin-right: var(--spacing-lg);
113
113
  font-size: var(--fs-sm);
114
- `,Mt=$`
114
+ `,Dt=F`
115
115
  border: 1px solid var(--gray-200);
116
116
  border-radius: var(--rounded-md);
117
117
  background: var(--gray-50);
118
118
  margin: var(--spacing-base) 0;
119
- `,Vt=$`
119
+ `,Ut=F`
120
120
  align-items: center;
121
121
  display: flex;
122
122
  flex-grow: 1;
123
123
  gap: var(--spacing-base);
124
124
  padding: var(--spacing-sm);
125
125
  margin-right: var(--spacing-sm);
126
- `,Dt=$`
126
+ `,zt=F`
127
127
  background: var(--gray-200);
128
128
  width: 3.5rem;
129
129
  height: 3.5rem;
130
130
  object-fit: cover;
131
- `,zt=$`
131
+ `,At=F`
132
132
  background: var(--gray-100);
133
133
  height: 3.5rem;
134
134
  width: 3.5rem;
135
- `,Ut=$`
135
+ `,Gt=F`
136
136
  margin-top: 0;
137
137
  font-weight: var(--fw-bold);
138
138
  font-size: var(--fs-sm);
139
139
  width: calc(100% / 3);
140
- `,Gt=$`
140
+ `,Bt=F`
141
141
  display: block;
142
142
  font-weight: var(--fw-regular);
143
- `;import{Fragment as Bt,jsx as q,jsxs as X}from"@emotion/react/jsx-runtime";var Lt=({products:e})=>{let{categories:o,logoIcon:r}=Rt();return X(Bt,{children:[X("p",{css:At`
143
+ `;import{Fragment as Ht,jsx as q,jsxs as X}from"@emotion/react/jsx-runtime";var It=({products:e})=>{let{categories:r,logoIcon:o}=kt();return X(Ht,{children:[X("p",{css:Ot`
144
144
  margin-bottom: var(--spacing-base);
145
- `,children:["Matching ",(e==null?void 0:e.length)||0," products"]}),q("ul",{css:[At`
145
+ `,children:["Matching ",(e==null?void 0:e.length)||0," products"]}),q("ul",{css:[Ot`
146
146
  max-height: 24rem;
147
147
  overflow-x: auto;
148
- `,Xo],children:e==null?void 0:e.map((t,n)=>{var f,m;let[a]=(t==null?void 0:t.categories)||[],l=typeof a=="undefined"||!o||(f=o.find(v=>v.id===a.id))==null?void 0:f.name;return q("li",{css:Mt,children:X("div",{css:Vt,"data-test-id":`product-item-${t.sku||t.id}`,children:[t.thumbnailUrl?q("img",{src:t.thumbnailUrl,alt:typeof t.title=="string"?t.title:t.name||`Product ${n}`,css:Dt,"data-test-id":"product-image"}):q("div",{css:zt}),X("h4",{css:Ut,"data-test-id":"product-name",children:[t.title||t.name,l&&q("span",{css:Gt,children:l})]}),t&&X(Bt,{children:[X("p",{css:ze,"data-test-id":"product-sku",children:["SKU: ",t.sku||t.id,q("br",{})]}),t.price!==void 0?X("p",{css:ze,"data-test-id":"product-price",children:["Price: ",t.price]}):null,t.editLink||t.url?X("a",{css:It,href:(m=t.editLink)!=null?m:t.url,title:`Go to ${t.title||t.name}`,target:"_blank",rel:"noopener noreferrer","data-test-id":"edit-product-button",children:[q("span",{css:Et,children:"Edit"}),r?q(F,{src:r,alt:"Logo",css:Tt}):null]}):null]})]})},`product-${t.id}`)})})]})};import Hn,{useContext as Fn,useMemo as $n,useRef as Kn}from"react";import*as A from"react";var Ge={};ko(Ge,{Caution:()=>Ht,Checkmark:()=>Le,ChevronDown:()=>ke,Close:()=>Kt,Danger:()=>Qt,ExclamationPoint:()=>_t,Info:()=>Ie,Lightbulb:()=>qt,MagnifyingGlass:()=>Jt,MaximizeAlt:()=>er,Minus:()=>we,MoreVerticalAlt:()=>he,Plus:()=>xe});import{jsx as Ot}from"@emotion/react/jsx-runtime";var qo=e=>Ot("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...e,children:Ot("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})}),Ht=qo;import{jsx as Ft}from"@emotion/react/jsx-runtime";var Yo=e=>Ft("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:Ft("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})}),Le=Yo;import{jsx as $t}from"@emotion/react/jsx-runtime";var Jo=e=>$t("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...e,children:$t("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})}),ke=Jo;import{jsx as Ue,jsxs as en}from"@emotion/react/jsx-runtime";var jo=e=>Ue("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...e,children:en("g",{fillRule:"evenodd",children:[Ue("path",{d:"M16.578 1.636a1.174 1.174 0 0 1 0 1.66L3.296 16.578a1.174 1.174 0 1 1-1.66-1.66L14.918 1.636a1.174 1.174 0 0 1 1.66 0Z"}),Ue("path",{d:"M1.636 1.636a1.174 1.174 0 0 1 1.66 0l13.282 13.282a1.174 1.174 0 1 1-1.66 1.66L1.636 3.296a1.174 1.174 0 0 1 0-1.66Z"})]})}),Kt=jo;import{jsx as Nt}from"@emotion/react/jsx-runtime";var tn=e=>Nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:Nt("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})}),Qt=tn;import{jsx as Wt}from"@emotion/react/jsx-runtime";var rn=e=>Wt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...e,children:Wt("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})}),_t=rn;import{jsx as Zt,jsxs as nn}from"@emotion/react/jsx-runtime";var on=e=>nn("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:[Zt("path",{xmlns:"http://www.w3.org/2000/svg",d:"M11 10.98a1 1 0 1 1 2 0v6a1 1 0 1 1-2 0v-6zm1-4.929a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),Zt("path",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0z"})]}),Ie=on;import{jsx as Xt}from"@emotion/react/jsx-runtime";var an=e=>Xt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:Xt("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})}),qt=an;import{jsx as ve,jsxs as Yt}from"@emotion/react/jsx-runtime";var sn=e=>Yt("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[Yt("g",{clipPath:"url(#magnifying-glass_svg__a)",children:[ve("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),ve("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})]}),ve("defs",{children:ve("clipPath",{id:"magnifying-glass_svg__a",children:ve("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})})})]}),Jt=sn;import{jsx as jt}from"@emotion/react/jsx-runtime";var cn=e=>jt("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:jt("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})}),er=cn;import{jsx as tr}from"@emotion/react/jsx-runtime";var dn=e=>tr("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:tr("path",{xmlns:"http://www.w3.org/2000/svg",d:"M14 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),he=dn;import{useThrottle as wn}from"react-use";import{v4 as Cn}from"uuid";import{useState as pn,useRef as lr,useEffect as un}from"react";function Ee(e,o){let r=window.open(e,"_blank"),t=setInterval(()=>{r!=null&&r.closed&&(clearInterval(t),o())},500)}import{format as mn}from"timeago.js";import{css as U}from"@emotion/react";import{mq as ln}from"@uniformdev/design-system";var rr=U`
148
+ `,Yo],children:e==null?void 0:e.map((t,n)=>{var m,g;let[a]=(t==null?void 0:t.categories)||[],d=typeof a=="undefined"||!r||(m=r.find(v=>v.id===a.id))==null?void 0:m.name;return q("li",{css:Dt,children:X("div",{css:Ut,"data-test-id":`product-item-${t.sku||t.id}`,children:[t.thumbnailUrl?q("img",{src:t.thumbnailUrl,alt:typeof t.title=="string"?t.title:t.name||`Product ${n}`,css:zt,"data-test-id":"product-image"}):q("div",{css:At}),X("h4",{css:Gt,"data-test-id":"product-name",children:[t.title||t.name,d&&q("span",{css:Bt,children:d})]}),t&&X(Ht,{children:[X("p",{css:Be,"data-test-id":"product-sku",children:["SKU: ",t.sku||t.id,q("br",{})]}),t.price!==void 0?X("p",{css:Be,"data-test-id":"product-price",children:["Price: ",t.price]}):null,t.editLink||t.url?X("a",{css:Et,href:(g=t.editLink)!=null?g:t.url,title:`Go to ${t.title||t.name}`,target:"_blank",rel:"noopener noreferrer","data-test-id":"edit-product-button",children:[q("span",{css:Mt,children:"Edit"}),o?q($,{src:o,alt:"Logo",css:Vt}):null]}):null]})]})},`product-${t.id}`)})})]})};import Fn,{useContext as Kn,useMemo as Nn,useRef as Qn}from"react";import*as G from"react";var He={};To(He,{Caution:()=>Ft,Checkmark:()=>Ee,ChevronDown:()=>Me,Close:()=>Qt,Danger:()=>_t,ExclamationPoint:()=>Xt,Info:()=>Ve,Lightbulb:()=>Jt,MagnifyingGlass:()=>er,MaximizeAlt:()=>rr,Minus:()=>Re,MoreVerticalAlt:()=>he,Plus:()=>Le});import{jsx as $t}from"@emotion/react/jsx-runtime";var Jo=e=>$t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...e,children:$t("path",{fillRule:"evenodd",d:"M8.893 1.5c-.183-.31-.52-.5-.887-.5s-.703.19-.886.5L.138 13.499a.98.98 0 0 0 0 1.001c.193.31.53.501.886.501h13.964c.367 0 .704-.19.877-.5a1.03 1.03 0 0 0 .01-1.002L8.893 1.5zm.133 11.497H6.987v-2.003h2.039v2.003zm0-3.004H6.987V5.987h2.039v4.006z"})}),Ft=Jo;import{jsx as Kt}from"@emotion/react/jsx-runtime";var jo=e=>Kt("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:Kt("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M20 39.2A19.2 19.2 0 1 0 20 .8a19.2 19.2 0 0 0 0 38.4Zm8.897-22.303a2.4 2.4 0 0 0-3.394-3.394L17.6 21.407l-3.103-3.104a2.4 2.4 0 0 0-3.394 3.394l4.8 4.8a2.4 2.4 0 0 0 3.394 0l9.6-9.6Z"})}),Ee=jo;import{jsx as Nt}from"@emotion/react/jsx-runtime";var en=e=>Nt("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...e,children:Nt("path",{d:"M5.293 8.293a1 1 0 0 1 1.414 0L12 13.586l5.293-5.293a1 1 0 1 1 1.414 1.414l-6 6a1 1 0 0 1-1.414 0l-6-6a1 1 0 0 1 0-1.414Z"})}),Me=en;import{jsx as Oe,jsxs as rn}from"@emotion/react/jsx-runtime";var tn=e=>Oe("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...e,children:rn("g",{fillRule:"evenodd",children:[Oe("path",{d:"M16.578 1.636a1.174 1.174 0 0 1 0 1.66L3.296 16.578a1.174 1.174 0 1 1-1.66-1.66L14.918 1.636a1.174 1.174 0 0 1 1.66 0Z"}),Oe("path",{d:"M1.636 1.636a1.174 1.174 0 0 1 1.66 0l13.282 13.282a1.174 1.174 0 1 1-1.66 1.66L1.636 3.296a1.174 1.174 0 0 1 0-1.66Z"})]})}),Qt=tn;import{jsx as Wt}from"@emotion/react/jsx-runtime";var on=e=>Wt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:Wt("path",{fillRule:"evenodd",d:"M5.05.31c.81 2.17.41 3.38-.52 4.31C3.55 5.67 1.98 6.45.9 7.98c-1.45 2.05-1.7 6.53 3.53 7.7-2.2-1.16-2.67-4.52-.3-6.61-.61 2.03.53 3.33 1.94 2.86 1.39-.47 2.3.53 2.27 1.67-.02.78-.31 1.44-1.13 1.81 3.42-.59 4.78-3.42 4.78-5.56 0-2.84-2.53-3.22-1.25-5.61-1.52.13-2.03 1.13-1.89 2.75.09 1.08-1.02 1.8-1.86 1.33-.67-.41-.66-1.19-.06-1.78C8.18 5.31 8.68 2.45 5.05.32L5.03.3l.02.01z"})}),_t=on;import{jsx as Zt}from"@emotion/react/jsx-runtime";var nn=e=>Zt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 14 16",fill:"currentColor",...e,children:Zt("path",{fillRule:"evenodd",d:"M7 2.3c3.14 0 5.7 2.56 5.7 5.7s-2.56 5.7-5.7 5.7A5.71 5.71 0 0 1 1.3 8c0-3.14 2.56-5.7 5.7-5.7zM7 1C3.14 1 0 4.14 0 8s3.14 7 7 7 7-3.14 7-7-3.14-7-7-7zm1 3H6v5h2V4zm0 6H6v2h2v-2z"})}),Xt=nn;import{jsx as qt,jsxs as sn}from"@emotion/react/jsx-runtime";var an=e=>sn("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:[qt("path",{xmlns:"http://www.w3.org/2000/svg",d:"M11 10.98a1 1 0 1 1 2 0v6a1 1 0 1 1-2 0v-6zm1-4.929a1 1 0 1 0 0 2 1 1 0 0 0 0-2z"}),qt("path",{xmlns:"http://www.w3.org/2000/svg",fillRule:"evenodd",clipRule:"evenodd",d:"M12 2C6.477 2 2 6.477 2 12s4.477 10 10 10 10-4.477 10-10S17.523 2 12 2zM4 12a8 8 0 1 0 16 0 8 8 0 0 0-16 0z"})]}),Ve=an;import{jsx as Yt}from"@emotion/react/jsx-runtime";var cn=e=>Yt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:Yt("path",{fillRule:"evenodd",d:"M6.5 0C3.48 0 1 2.19 1 5c0 .92.55 2.25 1 3 1.34 2.25 1.78 2.78 2 4v1h5v-1c.22-1.22.66-1.75 2-4 .45-.75 1-2.08 1-3 0-2.81-2.48-5-5.5-5zm3.64 7.48c-.25.44-.47.8-.67 1.11-.86 1.41-1.25 2.06-1.45 3.23-.02.05-.02.11-.02.17H5c0-.06 0-.13-.02-.17-.2-1.17-.59-1.83-1.45-3.23-.2-.31-.42-.67-.67-1.11C2.44 6.78 2 5.65 2 5c0-2.2 2.02-4 4.5-4 1.22 0 2.36.42 3.22 1.19C10.55 2.94 11 3.94 11 5c0 .66-.44 1.78-.86 2.48zM4 14h5c-.23 1.14-1.3 2-2.5 2s-2.27-.86-2.5-2z"})}),Jt=cn;import{jsx as ve,jsxs as jt}from"@emotion/react/jsx-runtime";var dn=e=>jt("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[jt("g",{clipPath:"url(#magnifying-glass_svg__a)",children:[ve("path",{d:"M11.539 0C5.484 0 .559 4.741.559 10.57c0 5.827 4.925 10.568 10.98 10.568 6.055 0 10.98-4.74 10.98-10.569C22.52 4.741 17.595 0 11.54 0Zm0 19.187c-4.937 0-8.954-3.866-8.954-8.618 0-4.752 4.017-8.618 8.954-8.618s8.954 3.866 8.954 8.618c0 4.752-4.017 8.618-8.954 8.618Z"}),ve("path",{d:"m25.196 22.334-5.811-5.593a1.041 1.041 0 0 0-1.434 0 .95.95 0 0 0 0 1.38l5.812 5.593c.198.19.457.286.716.286.26 0 .519-.096.717-.286a.95.95 0 0 0 0-1.38Z"})]}),ve("defs",{children:ve("clipPath",{id:"magnifying-glass_svg__a",children:ve("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})})})]}),er=dn;import{jsx as tr}from"@emotion/react/jsx-runtime";var ln=e=>tr("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:tr("path",{xmlns:"http://www.w3.org/2000/svg",d:"M3 3h6v2H6.462l4.843 4.843-1.415 1.414L5 6.367V9H3V3zm0 18h6v-2H6.376l4.929-4.928-1.415-1.414L5 17.548V15H3v6zm12 0h6v-6h-2v2.524l-4.867-4.866-1.414 1.414L17.647 19H15v2zm6-18h-6v2h2.562l-4.843 4.843 1.414 1.414L19 6.39V9h2V3z"})}),rr=ln;import{jsx as or}from"@emotion/react/jsx-runtime";var pn=e=>or("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:or("path",{xmlns:"http://www.w3.org/2000/svg",d:"M14 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0zm0 6a2 2 0 1 1-4 0 2 2 0 0 1 4 0z"})}),he=pn;import{useThrottle as Pn}from"react-use";import{v4 as Ln}from"uuid";import{useState as mn,useRef as ur,useEffect as gn}from"react";function De(e,r){let o=window.open(e,"_blank"),t=setInterval(()=>{o!=null&&o.closed&&(clearInterval(t),r())},500)}import{format as fn}from"timeago.js";import{css as z}from"@emotion/react";import{mq as un}from"@uniformdev/design-system";var nr=z`
149
149
  border: 1px solid var(--gray-200);
150
150
  background: var(--gray-50);
151
151
  border-radius: var(--rounded-base);
152
152
  display: flex;
153
153
  width: 100%;
154
- `,or=U`
154
+ `,ar=z`
155
155
  align-items: center;
156
156
  display: flex;
157
157
  flex-grow: 1;
@@ -159,22 +159,22 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
159
159
  margin-inline: 0 var(--spacing-sm);
160
160
  padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
161
161
  position: relative;
162
- `,nr=U`
162
+ `,ir=z`
163
163
  flex-grow: 1;
164
- `,ar=U`
164
+ `,sr=z`
165
165
  align-items: start;
166
166
  display: inline-flex;
167
167
  position: relative;
168
- `,ir=U`
168
+ `,cr=z`
169
169
  color: var(--brand-secondary-1);
170
170
  font-size: var(--fs-base);
171
171
  font-weight: var(--fw-bold);
172
172
  line-height: 1;
173
173
  margin: 0;
174
- `,sr=U`
174
+ `,dr=z`
175
175
  width: 1.5rem;
176
176
  height: 1.5rem;
177
- `,cr=U`
177
+ `,lr=z`
178
178
  background: var(--white);
179
179
  border-radius: var(--rounded-base);
180
180
  border-left: 4px solid var(--brand-secondary-3);
@@ -183,22 +183,22 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
183
183
  padding: var(--spacing-base);
184
184
  z-index: var(--z-10);
185
185
  width: max-content;
186
- `,te=U`
186
+ `,te=z`
187
187
  font-size: var(--fs-sm);
188
- `,be=U`
188
+ `,ye=z`
189
189
  font-weight: var(--fw-bold);
190
190
  margin-right: var(--spacing-sm);
191
- `,dr=U`
191
+ `,pr=z`
192
192
  display: flex;
193
193
  flex-direction: column;
194
194
  gap: var(--spacing-sm);
195
195
 
196
- ${ln("md")} {
196
+ ${un("md")} {
197
197
  flex-direction: row;
198
198
  min-width: 200px;
199
199
  justify-content: end;
200
200
  }
201
- `,Ae=U`
201
+ `,$e=z`
202
202
  align-items: center;
203
203
  background: var(--white);
204
204
  border-radius: var(--rounded-base);
@@ -213,39 +213,39 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
213
213
  &:hover {
214
214
  background: var(--gray-50);
215
215
  }
216
- `;import{css as Y}from"@emotion/react";import{Icon as pr}from"@uniformdev/design-system";import{CgClose as gn,CgInfo as fn}from"react-icons/cg";import{Fragment as vn,jsx as K,jsxs as L}from"@emotion/react/jsx-runtime";var ur=({selectedItem:e,logoIcon:o,onDeselect:r,onEditClosed:t})=>{var v;let n=lr(null),a=lr(null),[l,f]=pn(!1);un(()=>{let i=b=>{n.current&&!n.current.contains(b.target)&&a.current&&!a.current.contains(b.target)&&f(!1)},p=()=>{f(!1)};return window.addEventListener("resize",p,!0),document.addEventListener("scroll",i,!0),document.addEventListener("mousedown",i),()=>{window.removeEventListener("resize",p,!0),document.removeEventListener("scroll",i,!0),document.removeEventListener("mousedown",i)}},[a]);let m=()=>{var i;if(f(!l),a.current&&n.current){let p=(i=n==null?void 0:n.current)==null?void 0:i.getBoundingClientRect(),b=a.current.offsetWidth;a.current.style.top=`${p.top+30}px`,a.current.style.left=`${p.left-b+30}px`}};return K("div",{css:rr,children:L("div",{css:or,children:[L("div",{css:nr,children:[L("div",{css:ar,children:[K("h4",{css:[ir,e.popoverData?Y`
216
+ `;import{css as Y}from"@emotion/react";import{Icon as mr}from"@uniformdev/design-system";import{CgClose as vn,CgInfo as hn}from"react-icons/cg";import{Fragment as yn,jsx as K,jsxs as R}from"@emotion/react/jsx-runtime";var gr=({selectedItem:e,logoIcon:r,onDeselect:o,onEditClosed:t})=>{var v;let n=ur(null),a=ur(null),[d,m]=mn(!1);gn(()=>{let i=y=>{n.current&&!n.current.contains(y.target)&&a.current&&!a.current.contains(y.target)&&m(!1)},p=()=>{m(!1)};return window.addEventListener("resize",p,!0),document.addEventListener("scroll",i,!0),document.addEventListener("mousedown",i),()=>{window.removeEventListener("resize",p,!0),document.removeEventListener("scroll",i,!0),document.removeEventListener("mousedown",i)}},[a]);let g=()=>{var i;if(m(!d),a.current&&n.current){let p=(i=n==null?void 0:n.current)==null?void 0:i.getBoundingClientRect(),y=a.current.offsetWidth;a.current.style.top=`${p.top+30}px`,a.current.style.left=`${p.left-y+30}px`}};return K("div",{css:nr,children:R("div",{css:ar,children:[R("div",{css:ir,children:[R("div",{css:sr,children:[K("h4",{css:[cr,e.popoverData?Y`
217
217
  margin-bottom: var(--spacing-sm);
218
- `:""],title:`ID: ${e.id}`,"data-test-id":"entry-id",children:e.title||e.id||""}),e.popoverData?L(vn,{children:[K("button",{type:"button",ref:n,css:Y`
218
+ `:""],title:`ID: ${e.id}`,"data-test-id":"entry-id",children:e.title||e.id||""}),e.popoverData?R(yn,{children:[K("button",{type:"button",ref:n,css:Y`
219
219
  margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
220
- `,"aria-controls":"path-details","aria-expanded":l,onClick:m,children:K(pr,{icon:fn,iconColor:"gray",size:24,css:Y`
220
+ `,"aria-controls":"path-details","aria-expanded":d,onClick:g,children:K(mr,{icon:hn,iconColor:"gray",size:24,css:Y`
221
221
  opacity: var(--opacity-75);
222
- `})}),K("div",{id:"path-details","aria-hidden":!l,ref:a,css:[cr,l?Y`
222
+ `})}),K("div",{id:"path-details","aria-hidden":!d,ref:a,css:[lr,d?Y`
223
223
  visibility: visible;
224
224
  `:Y`
225
225
  visibility: hidden;
226
- `],children:Object.entries(e.popoverData).map(([i,p],b)=>L("div",{css:te,children:[L("span",{css:be,children:[i,":"]}),p]},b))})]}):null]}),e.createdDate&&L("div",{css:te,children:[K("span",{css:be,children:"Created:"}),mn((v=e.createdDate)!=null?v:0)]}),e.metadata?Object.entries(e.metadata).filter(([i])=>["type","status"].includes(i.toLocaleLowerCase())).map(([i,p])=>L("div",{css:[te,Y`
226
+ `],children:Object.entries(e.popoverData).map(([i,p],y)=>R("div",{css:te,children:[R("span",{css:ye,children:[i,":"]}),p]},y))})]}):null]}),e.createdDate&&R("div",{css:te,children:[K("span",{css:ye,children:"Created:"}),fn((v=e.createdDate)!=null?v:0)]}),e.metadata?Object.entries(e.metadata).filter(([i])=>["type","status"].includes(i.toLocaleLowerCase())).map(([i,p])=>R("div",{css:[te,Y`
227
227
  order: 1;
228
- `],children:[L("span",{css:be,children:[i,":"]}),p]},i)):null,e.metadata?Object.entries(e.metadata).filter(([i])=>!["type","status"].includes(i.toLocaleLowerCase())).map(([i,p])=>L("div",{css:[te,Y`
228
+ `],children:[R("span",{css:ye,children:[i,":"]}),p]},i)):null,e.metadata?Object.entries(e.metadata).filter(([i])=>!["type","status"].includes(i.toLocaleLowerCase())).map(([i,p])=>R("div",{css:[te,Y`
229
229
  order: 1;
230
- `],children:[L("span",{css:[be,Y`
230
+ `],children:[R("span",{css:[ye,Y`
231
231
  order: 1;
232
- `],children:[i,":"]}),p]},i)):null]}),L("div",{css:dr,children:[e.editLink?L("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:i=>{t&&(Ee(i.currentTarget.href,()=>t(e)),i.preventDefault())},css:Ae,children:[K("span",{css:te,children:"Edit"}),K(F,{src:o,css:sr,alt:"Logo"})]}):null,L("button",{type:"button",onClick:()=>{r(e)},css:Ae,children:[K("span",{css:te,children:"Unlink"}),K(pr,{icon:gn,iconColor:"red",size:16})]})]})]})},e.id)};import{useState as hn,useRef as br,useEffect as bn}from"react";import{css as re}from"@emotion/react";var mr=re`
232
+ `],children:[i,":"]}),p]},i)):null]}),R("div",{css:pr,children:[e.editLink?R("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:i=>{t&&(De(i.currentTarget.href,()=>t(e)),i.preventDefault())},css:$e,children:[K("span",{css:te,children:"Edit"}),K($,{src:r,css:dr,alt:"Logo"})]}):null,R("button",{type:"button",onClick:()=>{o(e)},css:$e,children:[K("span",{css:te,children:"Unlink"}),K(mr,{icon:vn,iconColor:"red",size:16})]})]})]})},e.id)};import{useState as Sn,useRef as br,useEffect as bn}from"react";import{css as re}from"@emotion/react";var fr=re`
233
233
  cursor: pointer;
234
234
  padding: var(--spacing-sm);
235
235
  position: relative;
236
236
  transition: background-color var(--duration-fast) var(--timing-ease-out),
237
237
  color var(--duration-fast) var(--timing-ease-out);
238
- `,gr=re`
238
+ `,vr=re`
239
239
  padding-right: var(--spacing-lg);
240
- `,fr=re`
240
+ `,hr=re`
241
241
  background: var(--brand-secondary-3);
242
242
  color: var(--white);
243
- `,Be=re`
243
+ `,Fe=re`
244
244
  font-size: var(--fs-xs);
245
- `,Oe=re`
245
+ `,Ke=re`
246
246
  font-weight: var(--fw-bold);
247
247
  margin-right: var(--spacing-sm);
248
- `,vr=re`
248
+ `,yr=re`
249
249
  background: var(--white);
250
250
  border-left: 4px solid var(--brand-secondary-3);
251
251
  border-radius: var(--rounded-base);
@@ -257,20 +257,20 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
257
257
  right: var(--spacing-xl);
258
258
  z-index: var(--z-10);
259
259
  width: max-content;
260
- `,hr=re`
260
+ `,Sr=re`
261
261
  position: absolute;
262
262
  inset: 0 var(--spacing-sm) 0 auto;
263
- `;import{css as yr}from"@emotion/react";import{Fragment as yn,jsx as Sr,jsxs as oe}from"@emotion/react/jsx-runtime";var xr=({result:e,isSelected:o,triggerSelection:r})=>{let t=br(null),n=br(null),[a,l]=hn(!1);bn(()=>{function m(v){t.current&&!t.current.contains(v.target)&&n.current&&!n.current.contains(v.target)&&l(!1)}return document.addEventListener("mousedown",m),()=>{document.removeEventListener("mousedown",m)}},[n]);let f=m=>{m.stopPropagation(),l(!a)};return oe("div",{css:[mr,o?fr:void 0,e.popoverData?gr:void 0],"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>r(),children:[e.title,e.popoverData&&o?oe(yn,{children:[Sr("button",{type:"button",ref:t,css:hr,"aria-controls":"path-details",onClick:m=>f(m),"aria-expanded":a,children:Sr(Ie,{width:24,height:24})}),oe("div",{id:"path-details","aria-hidden":!a,ref:n,css:[vr,a?yr`
263
+ `;import{css as xr}from"@emotion/react";import{Fragment as xn,jsx as wr,jsxs as oe}from"@emotion/react/jsx-runtime";var Cr=({result:e,isSelected:r,triggerSelection:o})=>{let t=br(null),n=br(null),[a,d]=Sn(!1);bn(()=>{function g(v){t.current&&!t.current.contains(v.target)&&n.current&&!n.current.contains(v.target)&&d(!1)}return document.addEventListener("mousedown",g),()=>{document.removeEventListener("mousedown",g)}},[n]);let m=g=>{g.stopPropagation(),d(!a)};return oe("div",{css:[fr,r?hr:void 0,e.popoverData?vr:void 0],"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>o(),children:[e.title,e.popoverData&&r?oe(xn,{children:[wr("button",{type:"button",ref:t,css:Sr,"aria-controls":"path-details",onClick:g=>m(g),"aria-expanded":a,children:wr(Ve,{width:24,height:24})}),oe("div",{id:"path-details","aria-hidden":!a,ref:n,css:[yr,a?xr`
264
264
  visibility: visible;
265
- `:yr`
265
+ `:xr`
266
266
  visibility: hidden;
267
- `],children:[e.metadata&&Object.entries(e.metadata).map(([m,v],i)=>oe("div",{css:Be,children:[oe("span",{css:Oe,children:[m,":"]}),v]},i)),Object.entries(e.popoverData).map(([m,v],i)=>oe("div",{css:Be,children:[oe("span",{css:Oe,children:[m,":"]}),v]},i))]})]}):null]},e.id)};import{Droppable as Pn,DragDropContext as Rn,Draggable as Ln}from"react-beautiful-dnd";import{css as P}from"@emotion/react";var wr=P`
267
+ `],children:[e.metadata&&Object.entries(e.metadata).map(([g,v],i)=>oe("div",{css:Fe,children:[oe("span",{css:Ke,children:[g,":"]}),v]},i)),Object.entries(e.popoverData).map(([g,v],i)=>oe("div",{css:Fe,children:[oe("span",{css:Ke,children:[g,":"]}),v]},i))]})]}):null]},e.id)};import{Droppable as Rn,DragDropContext as kn,Draggable as In}from"react-beautiful-dnd";import{css as P}from"@emotion/react";var Pr=P`
268
268
  background: var(--white);
269
269
  border: 1px solid var(--gray-300);
270
270
  border-radius: var(--rounded-base);
271
271
  padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-sm);
272
272
  margin-bottom: var(--spacing-base);
273
- `,Cr=P`
273
+ `,Lr=P`
274
274
  align-items: center;
275
275
  display: flex;
276
276
  position: relative;
@@ -278,7 +278,7 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
278
278
  width: 100%;
279
279
  background-color: transparent;
280
280
  border: 0;
281
- `,Pr=P`
281
+ `,Rr=P`
282
282
  color: var(--brand-secondary-1);
283
283
  display: block;
284
284
  font-weight: var(--fw-bold);
@@ -294,15 +294,15 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
294
294
  background: var(--gray-100);
295
295
  outline: none;
296
296
  }
297
- `,Rr=P`
297
+ `,kr=P`
298
298
  background: var(--white);
299
299
  border: 1px solid var(--gray-300);
300
300
  border-radius: var(--rounded-base);
301
301
  padding: calc(var(--spacing-base) - 0.25rem) var(--spacing-base);
302
302
  display: block;
303
- `,Lr=P`
303
+ `,Ir=P`
304
304
  display: none;
305
- `,kr=P`
305
+ `,Tr=P`
306
306
  overflow-y: auto;
307
307
  height: 16rem;
308
308
  margin-bottom: var(--spacing-base);
@@ -311,122 +311,122 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
311
311
  & > :not(:last-child) {
312
312
  border-bottom: 1px solid var(--gray-200);
313
313
  }
314
- `,Yi=P`
314
+ `,ns=P`
315
315
  background-color: var(--gray-50);
316
316
  max-width: 33.33%;
317
- `,Ir=P`
317
+ `,Er=P`
318
318
  align-items: center;
319
319
  display: flex;
320
320
  position: absolute;
321
321
  inset: 0 0 0 auto;
322
322
  pointer-events: none;
323
323
  padding-right: var(--spacing-sm);
324
- `,Er=P`
324
+ `,Mr=P`
325
325
  color: var(--brand-secondary-1);
326
326
  width: 1.25rem;
327
327
  height: 1.25rem;
328
328
  transition: transform var(--duration-fast) var(--timing-ease-out);
329
329
  transform: rotate(0);
330
- `,Ji=P`
330
+ `,as=P`
331
331
  background: var(--white);
332
332
  color: var(--brand-secondary-1);
333
- `,Tr=P`
333
+ `,Vr=P`
334
334
  position: relative;
335
335
  margin-block: var(--spacing-sm) 0;
336
336
 
337
337
  &:hover > span {
338
338
  opacity: 0.3;
339
339
  }
340
- `,Mr=P`
340
+ `,Dr=P`
341
341
  align-items: center;
342
342
  display: flex;
343
343
  position: absolute;
344
344
  inset: 0 auto 0 0;
345
345
  margin-block: auto;
346
346
  opacity: 0;
347
- `,He=P`
347
+ `,Ne=P`
348
348
  color: var(--brand-secondary-1);
349
- `,Vr=P`
349
+ `,Ur=P`
350
350
  position: absolute;
351
351
  left: 0.375rem;
352
- `,Fe=P`
352
+ `,Qe=P`
353
353
  width: calc(var(--spacing-lg) + var(--spacing-xs));
354
354
  height: calc(var(--spacing-lg) + var(--spacing-xs));
355
- `;import{css as N}from"@emotion/react";import{InputSelect as kn,scrollbarStyles as In,Button as $e,Callout as En,InputKeywordSearch as Tn,LoadingIndicator as Mn,Menu as Vn,MenuItem as Dn,LoadingOverlay as zn}from"@uniformdev/design-system";import{useState as Sn,useEffect as Dr,useRef as xn}from"react";function zr(e,{delay:o=500,minDuration:r=200}={delay:500,minDuration:200}){let[t,n]=Sn("IDLE"),a=xn(void 0);return Dr(()=>{e&&t==="IDLE"&&(clearTimeout(a.current),a.current=setTimeout(()=>{if(!e)return n("IDLE");a.current=setTimeout(()=>{n("EXPIRE")},r),n("DISPLAY")},o),n("DELAY")),!e&&t!=="DISPLAY"&&(clearTimeout(a.current),n("IDLE"))},[e,t,o,r]),Dr(()=>()=>clearTimeout(a.current),[]),t==="DISPLAY"||t==="EXPIRE"}import{Fragment as Gn,jsx as g,jsxs as G}from"@emotion/react/jsx-runtime";var Un=({searchText:e,selectedContentType:o})=>{let r="No content found";return o&&o!=="any"&&(r=`No ${o} content was found`),e&&(r=`${r} for keyword '${e}'.`),g(En,{type:"info",children:r})},Ur=({search:e,results:o,contentTypes:r,selectedItems:t,logoIcon:n,select:a,multiSelect:l,multiSelectId:f,rowComponent:m,selectedItemComponent:v,totalResults:i,cursor:p,resultsLoading:b,requireContentType:D,onAddNew:ae,onEditClosed:S,onCancel:y,noResultsComponent:ie,helpComponent:ue,onSort:O,typeSelectorLabel:_="Content Type Select",typeSelectorAllTypesOptionText:W="All content types",loadingIndicatorDelay:me=1e3})=>{var et,tt,rt;let j=()=>D?Array.isArray(r)&&r.length>0?r[0].id:"":"any",[H,T]=A.useState(""),[u,V]=A.useState(j),[s,z]=A.useState(!1),[C,ee]=A.useState([]),[uo,qe]=A.useState(!1),Ve=A.useRef(`x${Cn()}`),Se=wn(H,750);A.useEffect(()=>{e(Se,{count:5,offset:0,contentType:u==="any"?void 0:u})},[Se,u]);let mo=zr(b,{delay:me}),go=c=>{C.some(h=>h.id===c.id)?ee(h=>h.filter(Z=>Z.id!==c.id)):ee(l?h=>[...h,c]:[c])},fo=t==null?void 0:t.map(c=>c.id+c.title).join(",");A.useEffect(()=>{Array.isArray(t)&&ee(t)},[fo]);let vo=()=>{V(j()),T(""),ee(t!=null&&t.length?t:[])},ho=()=>{z(c=>!c),s||vo()},Ye=c=>{let h=(C==null?void 0:C.filter(Z=>Z.id!==c.id))||[];ee(h),a(h,"")},bo=c=>{c.preventDefault(),a(C,u),z(!1)},yo=c=>{c.preventDefault(),z(!1),y&&y()},So=()=>{e(Se,{count:5,offset:(o==null?void 0:o.length)||0,contentType:u==="any"?void 0:u,cursor:p}),qe(!0);let c=setTimeout(()=>{qe(!1)},750);return()=>clearTimeout(c)},xo=!(t==null?void 0:t.length)||l,wo=m||xr,Je=v||ur,Co=ie||Un,je=n&&typeof n!="string"?n:null,Po=je?g(je,{css:Fe}):g("img",{src:n,alt:"Logo",css:Fe}),Ro=c=>{var h,Z;if(c.destination&&c.source.droppableId===((h=c.destination)==null?void 0:h.droppableId)){let M=[...t||[]],[ge]=(Z=M==null?void 0:M.splice(c.source.index,1))!=null?Z:[];return M==null||M.splice(c.destination.index,0,ge),O&&(ee(M),O==null||O(M)),M}};return g("div",{css:N`
355
+ `;import{css as N}from"@emotion/react";import{InputSelect as Tn,scrollbarStyles as En,Button as We,Callout as Mn,InputKeywordSearch as Vn,LoadingIndicator as Dn,Menu as Un,MenuItem as zn,LoadingOverlay as An}from"@uniformdev/design-system";import{useState as wn,useEffect as zr,useRef as Cn}from"react";function Ar(e,{delay:r=500,minDuration:o=200}={delay:500,minDuration:200}){let[t,n]=wn("IDLE"),a=Cn(void 0);return zr(()=>{e&&t==="IDLE"&&(clearTimeout(a.current),a.current=setTimeout(()=>{if(!e)return n("IDLE");a.current=setTimeout(()=>{n("EXPIRE")},o),n("DISPLAY")},r),n("DELAY")),!e&&t!=="DISPLAY"&&(clearTimeout(a.current),n("IDLE"))},[e,t,r,o]),zr(()=>()=>clearTimeout(a.current),[]),t==="DISPLAY"||t==="EXPIRE"}import{Fragment as Bn,jsx as f,jsxs as A}from"@emotion/react/jsx-runtime";var Gn=({searchText:e,selectedContentType:r})=>{let o="No content found";return r&&r!=="any"&&(o=`No ${r} content was found`),e&&(o=`${o} for keyword '${e}'.`),f(Mn,{type:"info",children:o})},Gr=({search:e,results:r,contentTypes:o,selectedItems:t,logoIcon:n,select:a,multiSelect:d,multiSelectId:m,rowComponent:g,selectedItemComponent:v,totalResults:i,cursor:p,resultsLoading:y,requireContentType:D,onAddNew:ae,onEditClosed:b,onCancel:S,noResultsComponent:ie,helpComponent:ue,onSort:O,typeSelectorLabel:_="Content Type Select",typeSelectorAllTypesOptionText:W="All content types",loadingIndicatorDelay:me=1e3})=>{var nt,at,it;let j=()=>D?Array.isArray(o)&&o.length>0?o[0].id:"":"any",[H,E]=G.useState(""),[u,V]=G.useState(j),[s,U]=G.useState(!1),[C,ee]=G.useState([]),[go,et]=G.useState(!1),Ae=G.useRef(`x${Ln()}`),xe=Pn(H,750);G.useEffect(()=>{e(xe,{count:5,offset:0,contentType:u==="any"?void 0:u})},[xe,u]);let fo=Ar(y,{delay:me}),vo=c=>{C.some(h=>h.id===c.id)?ee(h=>h.filter(Z=>Z.id!==c.id)):ee(d?h=>[...h,c]:[c])},ho=t==null?void 0:t.map(c=>c.id+c.title).join(",");G.useEffect(()=>{Array.isArray(t)&&ee(t)},[ho]);let yo=()=>{V(j()),E(""),ee(t!=null&&t.length?t:[])},So=()=>{U(c=>!c),s||yo()},tt=c=>{let h=(C==null?void 0:C.filter(Z=>Z.id!==c.id))||[];ee(h),a(h,"")},bo=c=>{c.preventDefault(),a(C,u),U(!1)},xo=c=>{c.preventDefault(),U(!1),S&&S()},wo=()=>{e(xe,{count:5,offset:(r==null?void 0:r.length)||0,contentType:u==="any"?void 0:u,cursor:p}),et(!0);let c=setTimeout(()=>{et(!1)},750);return()=>clearTimeout(c)},Co=!(t==null?void 0:t.length)||d,Po=g||Cr,rt=v||gr,Lo=ie||Gn,ot=n&&typeof n!="string"?n:null,Ro=ot?f(ot,{css:Qe}):f("img",{src:n,alt:"Logo",css:Qe}),ko=c=>{var h,Z;if(c.destination&&c.source.droppableId===((h=c.destination)==null?void 0:h.droppableId)){let M=[...t||[]],[ge]=(Z=M==null?void 0:M.splice(c.source.index,1))!=null?Z:[];return M==null||M.splice(c.destination.index,0,ge),O&&(ee(M),O==null||O(M)),M}};return f("div",{css:N`
356
356
  width: 100%;
357
- `,children:G("div",{css:N`
357
+ `,children:A("div",{css:N`
358
358
  position: relative;
359
359
  margin-block: var(--spacing-base);
360
- `,children:[xo?G(Gn,{children:[g("div",{css:wr,"data-test-id":"component-search",children:G("button",{css:Cr,onClick:ho,type:"button","aria-haspopup":!0,"aria-expanded":s,"aria-controls":`entry-search-config-${Ve.current}`,children:[Po,g("span",{css:N`
360
+ `,children:[Co?A(Bn,{children:[f("div",{css:Pr,"data-test-id":"component-search",children:A("button",{css:Lr,onClick:So,type:"button","aria-haspopup":!0,"aria-expanded":s,"aria-controls":`entry-search-config-${Ae.current}`,children:[Ro,f("span",{css:N`
361
361
  margin-left: var(--spacing-base);
362
- `,children:"Select"}),g("span",{css:Ir,children:g(ke,{css:[Er,s?N`
362
+ `,children:"Select"}),f("span",{css:Er,children:f(Me,{css:[Mr,s?N`
363
363
  transform: rotate(180deg);
364
- `:void 0]})})]})}),G("div",{id:`entry-search-config-${Ve.current}`,"aria-hidden":!s,css:[Rr,s?void 0:Lr],children:[ue||null,G("div",{css:N`
364
+ `:void 0]})})]})}),A("div",{id:`entry-search-config-${Ae.current}`,"aria-hidden":!s,css:[kr,s?void 0:Ir],children:[ue||null,A("div",{css:N`
365
365
  display: flex;
366
366
  gap: calc(var(--spacing-base) - 0.25rem);
367
367
  margin-bottom: var(--spacing-base);
368
- `,children:[g(kn,{onChange:c=>V(c.target.value),value:u,label:_,showLabel:!1,options:[...D?[]:[{value:"any",label:W}],...r?r.map(c=>({value:c.id,label:c.name})):[]]}),g("div",{css:N`
368
+ `,children:[f(Tn,{onChange:c=>V(c.target.value),value:u,label:_,showLabel:!1,options:[...D?[]:[{value:"any",label:W}],...o?o.map(c=>({value:c.id,label:c.name})):[]]}),f("div",{css:N`
369
369
  flex-grow: 1;
370
- `,children:g(Tn,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:T,disabledFieldSubmission:!0,value:H})})]}),G("div",{css:[kr,In],id:Ve.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list",children:[g(zn,{isActive:mo}),Array.isArray(o)&&o.length>0?o.map(c=>g(wo,{isSelected:C.some(h=>h.id===c.id),result:c,triggerSelection:()=>go(c)},c.id)):g(Co,{searchText:Se||H,selectedContentType:(tt=(et=r==null?void 0:r.find(c=>c.id===u))==null?void 0:et.name)!=null?tt:u}),!b&&typeof i!="undefined"&&o&&(o==null?void 0:o.length)<i&&g("button",{type:"button",css:Pr,onClick:So,children:uo?g(Mn,{}):"Load More"})]}),G("div",{css:N`
370
+ `,children:f(Vn,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:E,disabledFieldSubmission:!0,value:H})})]}),A("div",{css:[Tr,En],id:Ae.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list",children:[f(An,{isActive:fo}),Array.isArray(r)&&r.length>0?r.map(c=>f(Po,{isSelected:C.some(h=>h.id===c.id),result:c,triggerSelection:()=>vo(c)},c.id)):f(Lo,{searchText:xe||H,selectedContentType:(at=(nt=o==null?void 0:o.find(c=>c.id===u))==null?void 0:nt.name)!=null?at:u}),!y&&typeof i!="undefined"&&r&&(r==null?void 0:r.length)<i&&f("button",{type:"button",css:Rr,onClick:wo,children:go?f(Dn,{}):"Load More"})]}),A("div",{css:N`
371
371
  display: flex;
372
372
  justify-content: space-between;
373
- `,children:[g("div",{children:ae&&((rt=r==null?void 0:r.length)!=null?rt:0)>0?g(Vn,{menuLabel:"Add new menu",menuTrigger:g($e,{buttonType:"secondary",children:"Add New"}),children:r==null?void 0:r.map(c=>g(Dn,{css:N`
373
+ `,children:[f("div",{children:ae&&((it=o==null?void 0:o.length)!=null?it:0)>0?f(Un,{menuLabel:"Add new menu",menuTrigger:f(We,{buttonType:"secondary",children:"Add New"}),children:o==null?void 0:o.map(c=>f(zn,{css:N`
374
374
  background: var(--white);
375
375
  color: var(--brand-secondary-1);
376
- `,onClick:()=>ae(c),children:c.name},c.id))}):null}),G("div",{css:N`
376
+ `,onClick:()=>ae(c),children:c.name},c.id))}):null}),A("div",{css:N`
377
377
  display: flex;
378
378
  gap: var(--spacing-base);
379
- `,children:[g($e,{buttonType:"unimportant",onClick:yo,children:"Cancel"}),g($e,{disabled:!C.length,onClick:bo,"data-test-id":"entry-accept-button",children:"Accept"})]})]})]})]}):null,s?null:l&&C.length>1?g(Rn,{onDragEnd:c=>Ro(c),children:g(Pn,{droppableId:f||"canvas-multi-select",children:c=>G("div",{...c.droppableProps,ref:c.innerRef,css:N`
379
+ `,children:[f(We,{buttonType:"unimportant",onClick:xo,children:"Cancel"}),f(We,{disabled:!C.length,onClick:bo,"data-test-id":"entry-accept-button",children:"Accept"})]})]})]})]}):null,s?null:d&&C.length>1?f(kn,{onDragEnd:c=>ko(c),children:f(Rn,{droppableId:m||"canvas-multi-select",children:c=>A("div",{...c.droppableProps,ref:c.innerRef,css:N`
380
380
  margin-block: var(--spacing-sm) 0;
381
- `,children:[C==null?void 0:C.map((h,Z)=>{if(h!=null&&h.id)return g(Ln,{draggableId:h.id,index:Z,children:M=>G("div",{css:Tr,ref:M.innerRef,...M.draggableProps,...M.dragHandleProps,children:[G("span",{css:Mr,children:[g(he,{css:[He,Vr],width:24,height:24}),g(he,{css:He,width:24,height:24})]}),g(Je,{logoIcon:n,selectedItem:h,onDeselect:ge=>Ye(ge),onEditClosed:S?ge=>S(ge):void 0},`selected-item-${h.id}`)]})},h.id)}),c.placeholder]})})}):C==null?void 0:C.map(c=>g(Je,{logoIcon:n,selectedItem:c,onDeselect:h=>Ye(h),onEditClosed:S?h=>S(h):void 0},`selected-item-${c.id}`))]})})};import{css as ne}from"@emotion/react";var Gr=ne`
381
+ `,children:[C==null?void 0:C.map((h,Z)=>{if(h!=null&&h.id)return f(In,{draggableId:h.id,index:Z,children:M=>A("div",{css:Vr,ref:M.innerRef,...M.draggableProps,...M.dragHandleProps,children:[A("span",{css:Dr,children:[f(he,{css:[Ne,Ur],width:24,height:24}),f(he,{css:Ne,width:24,height:24})]}),f(rt,{logoIcon:n,selectedItem:h,onDeselect:ge=>tt(ge),onEditClosed:b?ge=>b(ge):void 0},`selected-item-${h.id}`)]})},h.id)}),c.placeholder]})})}):C==null?void 0:C.map(c=>f(rt,{logoIcon:n,selectedItem:c,onDeselect:h=>tt(h),onEditClosed:b?h=>b(h):void 0},`selected-item-${c.id}`))]})})};import{css as ne}from"@emotion/react";var Br=ne`
382
382
  cursor: pointer;
383
383
  padding: var(--spacing-sm) 0;
384
384
  margin-right: var(--spacing-sm);
385
385
  position: relative;
386
386
  transition: background-color var(--duration-fast) var(--timing-ease-out),
387
387
  color var(--duration-fast) var(--timing-ease-out);
388
- `,Ar=ne`
388
+ `,Or=ne`
389
389
  border: 2px solid transparent;
390
390
  border-radius: var(--rounded-base);
391
391
  display: flex;
392
392
  align-items: center;
393
393
  gap: var(--spacing-base);
394
394
  padding: var(--spacing-sm) var(--spacing-xs);
395
- `,Br=ne`
395
+ `,Hr=ne`
396
396
  background-color: var(--green-50);
397
- `,Or=ne`
397
+ `,$r=ne`
398
398
  font-size: var(--fs-sm);
399
399
  font-weight: var(--fw-bold);
400
400
  width: 50%;
401
- `,Hr=ne`
401
+ `,Fr=ne`
402
402
  font-weight: var(--fw-normal);
403
403
  display: block;
404
- `,Fr=ne`
404
+ `,Kr=ne`
405
405
  font-size: var(--fs-sm);
406
406
  > * {
407
407
  display: block;
408
408
  }
409
- `,$r=ne`
409
+ `,Nr=ne`
410
410
  display: block;
411
411
  height: 1.5rem;
412
412
  width: 1.5rem;
413
413
  color: var(--brand-secondary-3);
414
414
  margin-left: auto;
415
- `;import{css as Kr}from"@emotion/react";import{jsx as ce,jsxs as Ke}from"@emotion/react/jsx-runtime";function Nr({result:e,isSelected:o,triggerSelection:r}){var f;let{categories:t,logoIcon:n}=Te(),[a]=e.categories||[{id:"",name:""}],l=typeof a=="undefined"||!t||(f=t.find(m=>m.id===a.id))==null?void 0:f.name;return ce("div",{"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>r(),css:[Gr],children:Ke("div",{css:[Ar,o?Br:void 0],children:[e.thumbnailUrl?ce("img",{src:e.thumbnailUrl,alt:`Thumbnail for ${e.title}`,css:Kr`
415
+ `;import{css as Qr}from"@emotion/react";import{jsx as ce,jsxs as _e}from"@emotion/react/jsx-runtime";function Wr({result:e,isSelected:r,triggerSelection:o}){var m;let{categories:t,logoIcon:n}=Ue(),[a]=e.categories||[{id:"",name:""}],d=typeof a=="undefined"||!t||(m=t.find(g=>g.id===a.id))==null?void 0:m.name;return ce("div",{"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>o(),css:[Br],children:_e("div",{css:[Or,r?Hr:void 0],children:[e.thumbnailUrl?ce("img",{src:e.thumbnailUrl,alt:`Thumbnail for ${e.title}`,css:Qr`
416
416
  background-color: var(--gray-200);
417
417
  width: 3rem;
418
418
  height: 3rem;
419
419
  object-fit: cover;
420
- `}):ce(F,{src:n,alt:"Logo",css:Kr`
420
+ `}):ce($,{src:n,alt:"Logo",css:Qr`
421
421
  height: 2.25rem;
422
422
  width: 2.25rem;
423
- `}),Ke("h4",{css:[Or],children:[e.title,l?ce("span",{css:[Hr],children:l}):null]}),Ke("p",{css:[Fr],children:["SKU: ",e.sku||e.id,e.price!==void 0?ce("span",{children:e.price}):null]}),o?ce(Le,{css:[$r]}):null]})},e.id)}import{css as J}from"@emotion/react";import{mq as Qr}from"@uniformdev/design-system";var Wr=J`
423
+ `}),_e("h4",{css:[$r],children:[e.title,d?ce("span",{css:[Fr],children:d}):null]}),_e("p",{css:[Kr],children:["SKU: ",e.sku||e.id,e.price!==void 0?ce("span",{children:e.price}):null]}),r?ce(Ee,{css:[Nr]}):null]})},e.id)}import{css as J}from"@emotion/react";import{mq as _r}from"@uniformdev/design-system";var Zr=J`
424
424
  border: 1px solid var(--gray-200);
425
425
  border-radius: var(--rounded-base);
426
426
  background: var(--gray-50);
427
427
  display: flex;
428
428
  width: 100%;
429
- `,_r=J`
429
+ `,Xr=J`
430
430
  align-items: center;
431
431
  display: flex;
432
432
  padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
@@ -434,22 +434,22 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
434
434
  flex-grow: 1;
435
435
  gap: var(--spacing-sm);
436
436
  margin-inline: 0 var(--spacing-sm);
437
- `,Zr=J`
437
+ `,qr=J`
438
438
  display: flex;
439
439
  align-items: center;
440
440
  gap: var(--spacing-sm);
441
441
  flex-grow: 1;
442
442
 
443
- ${Qr("lg")} {
443
+ ${_r("lg")} {
444
444
  width: 50%;
445
445
  margin-bottom: 0;
446
446
  }
447
- `,Ne=J`
447
+ `,Ze=J`
448
448
  background-color: var(--gray-200);
449
449
  width: 3.5rem;
450
450
  height: 3.5rem;
451
451
  object-fit: cover;
452
- `,Qe=J`
452
+ `,Xe=J`
453
453
  align-items: center;
454
454
  background: var(--white);
455
455
  border-radius: var(--rounded-base);
@@ -464,23 +464,23 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
464
464
  &:hover {
465
465
  background: var(--gray-50);
466
466
  }
467
- `,We=J`
467
+ `,qe=J`
468
468
  font-size: var(--fs-sm);
469
- `,Xr=J`
469
+ `,Yr=J`
470
470
  display: block;
471
471
  width: 1rem;
472
472
  height: 1rem;
473
- `,qr=J`
473
+ `,Jr=J`
474
474
  display: flex;
475
475
  flex-direction: column;
476
476
  gap: var(--spacing-sm);
477
477
 
478
- ${Qr("md")} {
478
+ ${_r("md")} {
479
479
  flex-direction: row;
480
480
  min-width: 200px;
481
481
  justify-content: end;
482
482
  }
483
- `;import{css as de}from"@emotion/react";import{Icon as An,mq as Bn}from"@uniformdev/design-system";import{CgClose as On}from"react-icons/cg";import{jsx as B,jsxs as Q}from"@emotion/react/jsx-runtime";function Yr({selectedItem:e,onDeselect:o}){var l;let{categories:r,logoIcon:t}=Te(),[n]=e.categories||[{id:"",name:""}],a=typeof n=="undefined"||!r||(l=r.find(f=>f.id===n.id))==null?void 0:l.name;return B("div",{css:[Wr],children:Q("article",{css:[_r],children:[Q("div",{css:[Zr],children:[e.thumbnailUrl?B("img",{src:e.thumbnailUrl,alt:a,css:[Ne],loading:"lazy"}):B("div",{css:[Ne]}),Q("div",{css:de`
483
+ `;import{css as de}from"@emotion/react";import{Icon as On,mq as Hn}from"@uniformdev/design-system";import{CgClose as $n}from"react-icons/cg";import{jsx as B,jsxs as Q}from"@emotion/react/jsx-runtime";function jr({selectedItem:e,onDeselect:r}){var d;let{categories:o,logoIcon:t}=Ue(),[n]=e.categories||[{id:"",name:""}],a=typeof n=="undefined"||!o||(d=o.find(m=>m.id===n.id))==null?void 0:d.name;return B("div",{css:[Zr],children:Q("article",{css:[Xr],children:[Q("div",{css:[qr],children:[e.thumbnailUrl?B("img",{src:e.thumbnailUrl,alt:a,css:[Ze],loading:"lazy"}):B("div",{css:[Ze]}),Q("div",{css:de`
484
484
  > :not(:last-child) {
485
485
  margin-bottom: var(--spacing-xs);
486
486
  }
@@ -493,7 +493,7 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
493
493
  `,children:a})]}),Q("ul",{css:de`
494
494
  font-size: var(--fs-sm);
495
495
 
496
- ${Bn("sm")} {
496
+ ${Hn("sm")} {
497
497
  display: flex;
498
498
  gap: var(--spacing-base);
499
499
  }
@@ -501,13 +501,13 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
501
501
  margin-right: var(--spacing-xs);
502
502
  `,children:"SKU:"}),e.sku||e.id]}),e.price!==void 0?Q("li",{children:[B("span",{css:de`
503
503
  margin-right: var(--spacing-xs);
504
- `,children:"Price:"}),B("span",{children:e.price})]}):null]})]})]}),Q("div",{css:qr,children:[e.editLink?Q("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:Qe,children:[B("span",{css:We,children:"Edit"}),B(F,{src:t,alt:"Logo",css:Xr})]}):null,Q("button",{type:"button",onClick:()=>{o==null||o(e)},css:Qe,children:[B("span",{css:We,children:"Unlink"}),B(An,{icon:On,iconColor:"red",size:16})]})]})]})},e.id)}import{Callout as Nn}from"@uniformdev/design-system";import{useAsync as Qn,useAsyncFn as Wn}from"react-use";import{jsx as _e,jsxs as _n}from"@emotion/react/jsx-runtime";function Ks({selectedProducts:e,setSelectedProducts:o,onGetCategories:r,onSearchProducts:t,logoIcon:n,multiSelect:a,multiSelectId:l,selectedItemComponent:f,rowComponent:m,errorComponent:v,helpComponent:i,noResultsComponent:p,onSort:b,typeSelectorAllTypesOptionText:D="All categories",typeSelectorLabel:ae="Select Category"}){var j,H;let{value:S,loading:y,error:ie}=Qn(async()=>await r(),[r]),ue=S==null?void 0:S.map(T=>T.id).join(","),O=$n(()=>S?S.map(u=>({id:u.id,name:u.name})):void 0,[ue]),_=Kn(),[W,me]=Wn(async(T,u)=>{let V=await t({text:T,options:{limit:u==null?void 0:u.count,offset:u==null?void 0:u.offset,categoryId:u==null?void 0:u.contentType,cursor:u==null?void 0:u.cursor}});return(u==null?void 0:u.offset)===0&&(_.current=[]),(_.current=_.current||[]).push(...V.products),V},[t]),ye=async T=>{await o(T)};return ie||W.error?_e(v||(({categoriesError:u,searchError:V})=>_n(Nn,{type:"error",children:["There was an error: ",(u==null?void 0:u.message)||(V==null?void 0:V.message)]})),{categoriesError:ie,searchError:W.error}):_e(Jr.Provider,{value:{categories:S,logoIcon:n},children:_e(Ur,{search:me,results:_.current,logoIcon:n,selectedItems:e,select:ye,multiSelectId:l||"product-search-multi-select",multiSelect:a,contentTypes:O,selectedItemComponent:f||Yr,rowComponent:m||Nr,totalResults:(j=W.value)==null?void 0:j.total,cursor:(H=W.value)==null?void 0:H.cursor,resultsLoading:W.loading||y,helpComponent:i,noResultsComponent:p,onSort:b,typeSelectorAllTypesOptionText:D,typeSelectorLabel:ae})})}var Jr=Hn.createContext(void 0),Te=()=>{let e=Fn(Jr);if(!e)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return e};import{css as k}from"@emotion/react";import{mq as Zn}from"@uniformdev/design-system";var jr=k`
504
+ `,children:"Price:"}),B("span",{children:e.price})]}):null]})]})]}),Q("div",{css:Jr,children:[e.editLink?Q("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:Xe,children:[B("span",{css:qe,children:"Edit"}),B($,{src:t,alt:"Logo",css:Yr})]}):null,Q("button",{type:"button",onClick:()=>{r==null||r(e)},css:Xe,children:[B("span",{css:qe,children:"Unlink"}),B(On,{icon:$n,iconColor:"red",size:16})]})]})]})},e.id)}import{Callout as Wn}from"@uniformdev/design-system";import{useAsync as _n,useAsyncFn as Zn}from"react-use";import{jsx as Ye,jsxs as Xn}from"@emotion/react/jsx-runtime";function qs({selectedProducts:e,setSelectedProducts:r,onGetCategories:o,onSearchProducts:t,logoIcon:n,multiSelect:a,multiSelectId:d,selectedItemComponent:m,rowComponent:g,errorComponent:v,helpComponent:i,noResultsComponent:p,onSort:y,typeSelectorAllTypesOptionText:D="All categories",typeSelectorLabel:ae="Select Category"}){var j,H;let{value:b,loading:S,error:ie}=_n(async()=>await o(),[o]),ue=b==null?void 0:b.map(E=>E.id).join(","),O=Nn(()=>b?b.map(u=>({id:u.id,name:u.name})):void 0,[ue]),_=Qn(),[W,me]=Zn(async(E,u)=>{let V=await t({text:E,options:{limit:u==null?void 0:u.count,offset:u==null?void 0:u.offset,categoryId:u==null?void 0:u.contentType,cursor:u==null?void 0:u.cursor}});return(u==null?void 0:u.offset)===0&&(_.current=[]),(_.current=_.current||[]).push(...V.products),V},[t]),be=async E=>{await r(E)};return ie||W.error?Ye(v||(({categoriesError:u,searchError:V})=>Xn(Wn,{type:"error",children:["There was an error: ",(u==null?void 0:u.message)||(V==null?void 0:V.message)]})),{categoriesError:ie,searchError:W.error}):Ye(eo.Provider,{value:{categories:b,logoIcon:n},children:Ye(Gr,{search:me,results:_.current,logoIcon:n,selectedItems:e,select:be,multiSelectId:d||"product-search-multi-select",multiSelect:a,contentTypes:O,selectedItemComponent:m||jr,rowComponent:g||Wr,totalResults:(j=W.value)==null?void 0:j.total,cursor:(H=W.value)==null?void 0:H.cursor,resultsLoading:W.loading||S,helpComponent:i,noResultsComponent:p,onSort:y,typeSelectorAllTypesOptionText:D,typeSelectorLabel:ae})})}var eo=Fn.createContext(void 0),Ue=()=>{let e=Kn(eo);if(!e)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return e};import{css as k}from"@emotion/react";import{mq as qn}from"@uniformdev/design-system";var to=k`
505
505
  border: 1px solid var(--gray-200);
506
506
  background: var(--gray-50);
507
507
  border-radius: var(--rounded-base);
508
508
  display: flex;
509
509
  width: 100%;
510
- `,eo=k`
510
+ `,ro=k`
511
511
  align-items: center;
512
512
  display: flex;
513
513
  flex-grow: 1;
@@ -515,23 +515,23 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
515
515
  margin-inline: 0 var(--spacing-sm);
516
516
  padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
517
517
  position: relative;
518
- `,to=k`
518
+ `,oo=k`
519
519
  flex-grow: 1;
520
- `,ro=k`
520
+ `,no=k`
521
521
  align-items: center;
522
522
  display: flex;
523
523
  position: relative;
524
- `,oo=k`
524
+ `,ao=k`
525
525
  color: var(--brand-secondary-1);
526
526
  font-size: var(--fs-base);
527
527
  font-weight: var(--fw-bold);
528
528
  line-height: 1;
529
529
  margin: 0;
530
530
  word-break: break-word;
531
- `,no=k`
531
+ `,io=k`
532
532
  width: 1.5rem;
533
533
  height: 1.5rem;
534
- `,ao=k`
534
+ `,so=k`
535
535
  background: var(--white);
536
536
  border-radius: var(--rounded-base);
537
537
  border-left: 4px solid var(--brand-secondary-3);
@@ -542,20 +542,20 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
542
542
  width: max-content;
543
543
  `,le=k`
544
544
  font-size: var(--fs-sm);
545
- `,Me=k`
545
+ `,ze=k`
546
546
  font-weight: var(--fw-bold);
547
547
  margin-right: var(--spacing-sm);
548
- `,io=k`
548
+ `,co=k`
549
549
  display: flex;
550
550
  flex-direction: column;
551
551
  gap: var(--spacing-sm);
552
552
 
553
- ${Zn("md")} {
553
+ ${qn("md")} {
554
554
  flex-direction: row;
555
555
  justify-content: end;
556
556
  min-width: 200px;
557
557
  }
558
- `,Ze=k`
558
+ `,Je=k`
559
559
  align-items: center;
560
560
  background: var(--white);
561
561
  border-radius: var(--rounded-base);
@@ -570,30 +570,30 @@ var Lo=Object.defineProperty;var ko=(e,o)=>{for(var r in o)Lo(e,r,{get:o[r],enum
570
570
  &:hover {
571
571
  background: var(--gray-50);
572
572
  }
573
- `,so=k`
573
+ `,lo=k`
574
574
  display: flex;
575
575
  margin-top: var(--spacing-sm);
576
576
  gap: var(--spacing-sm);
577
- `,co=k`
577
+ `,po=k`
578
578
  background: none;
579
579
  outline: none;
580
580
  border: none;
581
581
  margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
582
- `,Xe=k`
582
+ `,je=k`
583
583
  display: block;
584
584
  max-width: 100%;
585
585
  min-width: 100px;
586
586
  height: auto;
587
- `;import{useState as Xn,useRef as lo,useEffect as qn}from"react";import{CgInfo as Yn,CgClose as Jn}from"react-icons/cg";import{format as jn}from"timeago.js";import{css as pe}from"@emotion/react";import{Icon as po}from"@uniformdev/design-system";import{Fragment as ta,jsx as I,jsxs as E}from"@emotion/react/jsx-runtime";function oc({selectedItem:e,onDeselect:o,onEditClosed:r,logoIcon:t,itemDetailsRendererComponent:n}){let a=lo(null),l=lo(null),[f,m]=Xn(!1);qn(()=>{let p=D=>{a.current&&!a.current.contains(D.target)&&l.current&&!l.current.contains(D.target)&&m(!1)},b=()=>{m(!1)};return window.addEventListener("resize",b,!0),document.addEventListener("scroll",p,!0),document.addEventListener("mousedown",p),()=>{window.removeEventListener("resize",b,!0),document.removeEventListener("scroll",p,!0),document.removeEventListener("mousedown",p)}},[l]);let v=()=>{var p;if(m(!f),l.current&&a.current){let b=(p=a==null?void 0:a.current)==null?void 0:p.getBoundingClientRect();l.current.style.top=`${b.top+30}px`}},i=n!=null?n:ea;return I("div",{css:[jr,pe`
587
+ `;import{useState as Yn,useRef as uo,useEffect as Jn}from"react";import{CgInfo as jn,CgClose as ea}from"react-icons/cg";import{format as ta}from"timeago.js";import{css as pe}from"@emotion/react";import{Icon as mo}from"@uniformdev/design-system";import{Fragment as oa,jsx as I,jsxs as T}from"@emotion/react/jsx-runtime";function lc({selectedItem:e,onDeselect:r,onEditClosed:o,logoIcon:t,itemDetailsRendererComponent:n}){let a=uo(null),d=uo(null),[m,g]=Yn(!1);Jn(()=>{let p=D=>{a.current&&!a.current.contains(D.target)&&d.current&&!d.current.contains(D.target)&&g(!1)},y=()=>{g(!1)};return window.addEventListener("resize",y,!0),document.addEventListener("scroll",p,!0),document.addEventListener("mousedown",p),()=>{window.removeEventListener("resize",y,!0),document.removeEventListener("scroll",p,!0),document.removeEventListener("mousedown",p)}},[d]);let v=()=>{var p;if(g(!m),d.current&&a.current){let y=(p=a==null?void 0:a.current)==null?void 0:p.getBoundingClientRect();d.current.style.top=`${y.top+30}px`}},i=n!=null?n:ra;return I("div",{css:[to,pe`
588
588
  margin: 0 0 1rem 0;
589
- `],children:E("div",{css:eo,children:[E("div",{css:to,children:[E("div",{css:ro,children:[I("h4",{css:[oo],title:`ID: ${e.id}`,"data-test-id":"dam-selected-item",children:e.title||e.id||""}),e.popoverData?E(ta,{children:[I("button",{type:"button",ref:a,css:co,"aria-controls":"path-details","aria-expanded":f,onClick:v,children:I(po,{icon:Yn,iconColor:"gray",size:24,css:pe`
589
+ `],children:T("div",{css:ro,children:[T("div",{css:oo,children:[T("div",{css:no,children:[I("h4",{css:[ao],title:`ID: ${e.id}`,"data-test-id":"dam-selected-item",children:e.title||e.id||""}),e.popoverData?T(oa,{children:[I("button",{type:"button",ref:a,css:po,"aria-controls":"path-details","aria-expanded":m,onClick:v,children:I(mo,{icon:jn,iconColor:"gray",size:24,css:pe`
590
590
  opacity: var(--opacity-75);
591
- `})}),I("div",{id:"path-details","aria-hidden":!f,ref:l,css:[ao,f?pe`
591
+ `})}),I("div",{id:"path-details","aria-hidden":!m,ref:d,css:[so,m?pe`
592
592
  visibility: visible;
593
593
  `:pe`
594
594
  visibility: hidden;
595
- `],children:Object.entries(e.popoverData).map(([p,b],D)=>E("div",{css:le,children:[E("span",{css:Me,children:[p,":"]}),b]},D))})]}):null]}),I(i,{item:e})]}),E("div",{css:io,children:[e.editLink?typeof e.editLink=="string"?E("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:p=>{r&&(Ee(p.currentTarget.href,()=>r(e)),p.preventDefault())},css:Ze,children:[I("span",{css:le,children:"Edit"}),t?I(F,{src:t,css:no,alt:"Logo"}):null]}):e.editLink:null,E("button",{type:"button",onClick:()=>{o(e)},css:Ze,children:[I("span",{css:le,children:"Unlink"}),I(po,{icon:Jn,iconColor:"red",size:16})]})]})]})},e.id)}function ea({item:e}){let o=null;return e.previewUrl&&typeof e.previewUrl=="string"?e.type==="image"?o=I("img",{src:e.previewUrl,alt:e.id,width:"200",css:Xe}):e.type==="video"&&(o=I("video",{src:e.previewUrl,title:e.id,width:"200",controls:!0,css:Xe})):e.previewUrl&&typeof e.previewUrl!="string"&&(o=e.previewUrl),o||e.metadata?E("div",{css:so,children:[o?I("div",{children:o}):null,E("ul",{children:[e.metadata?Object.entries(e.metadata).map(([r,t])=>E("li",{css:[le,pe`
595
+ `],children:Object.entries(e.popoverData).map(([p,y],D)=>T("div",{css:le,children:[T("span",{css:ze,children:[p,":"]}),y]},D))})]}):null]}),I(i,{item:e})]}),T("div",{css:co,children:[e.editLink?typeof e.editLink=="string"?T("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:p=>{o&&(De(p.currentTarget.href,()=>o(e)),p.preventDefault())},css:Je,children:[I("span",{css:le,children:"Edit"}),t?I($,{src:t,css:io,alt:"Logo"}):null]}):e.editLink:null,T("button",{type:"button",onClick:()=>{r(e)},css:Je,children:[I("span",{css:le,children:"Unlink"}),I(mo,{icon:ea,iconColor:"red",size:16})]})]})]})},e.id)}function ra({item:e}){let r=null;return e.previewUrl&&typeof e.previewUrl=="string"?e.type==="image"?r=I("img",{src:e.previewUrl,alt:e.id,width:"200",css:je}):e.type==="video"&&(r=I("video",{src:e.previewUrl,title:e.id,width:"200",controls:!0,css:je})):e.previewUrl&&typeof e.previewUrl!="string"&&(r=e.previewUrl),r||e.metadata?T("div",{css:lo,children:[r?I("div",{children:r}):null,T("ul",{children:[e.metadata?Object.entries(e.metadata).map(([o,t])=>T("li",{css:[le,pe`
596
596
  order: 1;
597
- `],children:[E("span",{css:[Me,pe`
597
+ `],children:[T("span",{css:[ze,pe`
598
598
  order: 1;
599
- `],children:[r,":"]}),t]},r)):null,e.createdDate?E("li",{css:le,children:[I("span",{css:Me,children:"Date:"}),jn(e.createdDate)]}):null]})]}):null}export*from"@uniformdev/mesh-sdk";import{Button as uc,Callout as mc,LoadingIndicator as gc,LoadingOverlay as fc,Menu as vc,MenuItem as hc,Input as bc,InputSelect as yc,InputToggle as Sc,Theme as xc,InputKeywordSearch as wc,Heading as Cc,ScrollableList as Pc,ScrollableListItem as Rc,Textarea as Lc,Switch as kc,Label as Ic,AddListButton as Ec}from"@uniformdev/design-system";export{Ec as AddListButton,uc as Button,mc as Callout,oc as DamSelectedItem,xr as DefaultSearchRow,ur as DefaultSelectedItem,Ur as EntrySearch,Cc as Heading,Ge as Icons,bc as Input,yc as InputSelect,Sc as InputToggle,wc as KeywordSearchInput,Ic as Label,gc as LoadingIndicator,fc as LoadingOverlay,vc as Menu,hc as MenuItem,Lt as ProductPreviewList,_a as ProductQuery,Pt as ProductQueryContext,Ks as ProductSearch,Jr as ProductSearchContext,Nr as ProductSearchRow,Yr as ProductSelectedItem,ut as ResolvableLoadingValue,Pc as ScrollableList,Rc as ScrollableListItem,ht as SelectionField,kc as Switch,Lc as Textarea,xc as Theme,ot as UniformMeshLocationContext,nt as UniformMeshLocationContextProvider,ct as UniformMeshSdkContext,xa as UniformMeshSdkContextProvider,Fe as badgeIcon,Xe as damSelectItemImage,jr as damSelectedItemContainer,ro as damSelectedItemCopy,to as damSelectedItemDetails,no as damSelectedItemIcon,co as damSelectedItemInfoBtn,eo as damSelectedItemInner,Ze as damSelectedItemLinkBtn,io as damSelectedItemLinkContainer,so as damSelectedItemMediaContainer,ao as damSelectedItemPopover,Me as damSelectedItemPopoverLabel,le as damSelectedItemSmallText,oo as damSelectedItemTitle,Tr as draggableContainer,He as draggableIcon,Vr as draggableIconOffset,Mr as draggableIconWrapper,Cr as entrySearchBtn,Rr as entrySearchConfig,Lr as entrySearchConfigHidden,Pr as entrySearchLoadMoreBtn,kr as entrySearchResultList,Ir as entrySearchSelectIcon,Er as entrySearchSelectImg,Yi as entrySearchSelectInput,Ji as entrySearchSelectOption,wr as entrySearchWrapper,$r as productSearchRowActiveIcon,Hr as productSearchRowCategory,Gr as productSearchRowContainer,Ar as productSearchRowContent,Br as productSearchRowContentActive,Fr as productSearchRowDetails,Or as productSearchRowTitle,Wr as productSelectedItemContainer,Zr as productSelectedItemContent,_r as productSelectedItemDetails,Xr as productSelectedItemIcon,Ne as productSelectedItemImage,qr as productSelectedItemLinkContainer,Qe as productedSelectedItemLinkBtn,We as productedSelectedItemSmallText,hr as searchRowBtn,mr as searchRowContainer,fr as searchRowContainerActive,gr as searchRowContainerWithPopover,vr as searchRowPopover,Oe as searchRowText,Be as searchRowTextSmall,Ae as selectItemLinkBtn,dr as selectItemLinkContainer,cr as selectItemPopover,be as selectItemPopoverLabel,te as selectItemSmallText,rr as selectedItemContainer,ar as selectedItemCopy,nr as selectedItemDetails,sr as selectedItemIcon,or as selectedItemInner,ir as selectedItemTitle,fa as useInitializeUniformMeshSdk,Rt as useProductQueryContext,Te as useProductSearchContext,la as useUniformMeshLocation,at as useUniformMeshLocationContext,Pa as useUniformMeshSdk,dt as useUniformMeshSdkContext};
599
+ `],children:[o,":"]}),t]},o)):null,e.createdDate?T("li",{css:le,children:[I("span",{css:ze,children:"Date:"}),ta(e.createdDate)]}):null]})]}):null}import{LoadingIndicator as na,Theme as aa}from"@uniformdev/design-system";import{jsx as Se,jsxs as ia}from"@emotion/react/jsx-runtime";var hc=({children:e,loadingComponent:r,errorComponent:o})=>{let{initializing:t,error:n}=dt();if(t){let d=r;return d?Se(d,{}):Se(na,{})}if(n){let d=o;if(d)return Se(d,{error:n});throw n}let a;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(a={sdk:window.UniformMeshSDK}),ia(Pe.Provider,{value:a,children:[Se(aa,{}),Se(we,{children:e})]})};export*from"@uniformdev/mesh-sdk";import{Button as kc,Callout as Ic,LoadingIndicator as Tc,LoadingOverlay as Ec,Menu as Mc,MenuItem as Vc,Input as Dc,InputSelect as Uc,InputToggle as zc,Theme as Ac,InputKeywordSearch as Gc,Heading as Bc,ScrollableList as Oc,ScrollableListItem as Hc,Textarea as $c,Switch as Fc,Label as Kc,AddListButton as Nc}from"@uniformdev/design-system";export{Nc as AddListButton,kc as Button,Ic as Callout,lc as DamSelectedItem,Cr as DefaultSearchRow,gr as DefaultSelectedItem,Gr as EntrySearch,Bc as Heading,He as Icons,Dc as Input,Uc as InputSelect,zc as InputToggle,Gc as KeywordSearchInput,Kc as Label,Tc as LoadingIndicator,Ec as LoadingOverlay,Mc as Menu,Vc as MenuItem,hc as MeshApp,It as ProductPreviewList,ei as ProductQuery,Rt as ProductQueryContext,qs as ProductSearch,eo as ProductSearchContext,Wr as ProductSearchRow,jr as ProductSelectedItem,gt as ResolvableLoadingValue,Oc as ScrollableList,Hc as ScrollableListItem,St as SelectionField,Fc as Switch,$c as Textarea,Ac as Theme,st as UniformMeshLocationContext,we as UniformMeshLocationContextProvider,Pe as UniformMeshSdkContext,La as UniformMeshSdkContextProvider,Qe as badgeIcon,je as damSelectItemImage,to as damSelectedItemContainer,no as damSelectedItemCopy,oo as damSelectedItemDetails,io as damSelectedItemIcon,po as damSelectedItemInfoBtn,ro as damSelectedItemInner,Je as damSelectedItemLinkBtn,co as damSelectedItemLinkContainer,lo as damSelectedItemMediaContainer,so as damSelectedItemPopover,ze as damSelectedItemPopoverLabel,le as damSelectedItemSmallText,ao as damSelectedItemTitle,Vr as draggableContainer,Ne as draggableIcon,Ur as draggableIconOffset,Dr as draggableIconWrapper,Lr as entrySearchBtn,kr as entrySearchConfig,Ir as entrySearchConfigHidden,Rr as entrySearchLoadMoreBtn,Tr as entrySearchResultList,Er as entrySearchSelectIcon,Mr as entrySearchSelectImg,ns as entrySearchSelectInput,as as entrySearchSelectOption,Pr as entrySearchWrapper,Nr as productSearchRowActiveIcon,Fr as productSearchRowCategory,Br as productSearchRowContainer,Or as productSearchRowContent,Hr as productSearchRowContentActive,Kr as productSearchRowDetails,$r as productSearchRowTitle,Zr as productSelectedItemContainer,qr as productSelectedItemContent,Xr as productSelectedItemDetails,Yr as productSelectedItemIcon,Ze as productSelectedItemImage,Jr as productSelectedItemLinkContainer,Xe as productedSelectedItemLinkBtn,qe as productedSelectedItemSmallText,Sr as searchRowBtn,fr as searchRowContainer,hr as searchRowContainerActive,vr as searchRowContainerWithPopover,yr as searchRowPopover,Ke as searchRowText,Fe as searchRowTextSmall,$e as selectItemLinkBtn,pr as selectItemLinkContainer,lr as selectItemPopover,ye as selectItemPopoverLabel,te as selectItemSmallText,nr as selectedItemContainer,sr as selectedItemCopy,ir as selectedItemDetails,dr as selectedItemIcon,ar as selectedItemInner,cr as selectedItemTitle,dt as useInitializeUniformMeshSdk,Ma as useMeshLocation,kt as useProductQueryContext,Ue as useProductSearchContext,fa as useUniformMeshLocation,Ce as useUniformMeshLocationContext,Ia as useUniformMeshSdk,pt as useUniformMeshSdkContext};