@uniformdev/mesh-sdk-react 17.6.1-alpha.60 → 17.7.1-alpha.34
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.d.ts +151 -46
- package/dist/index.esm.js +154 -154
- package/dist/index.js +156 -156
- package/dist/index.mjs +154 -154
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Go=Object.defineProperty;var Ho=(e,t)=>{for(var r in t)Go(e,r,{get:t[r],enumerable:!0})};import{jsx as c}from"@emotion/react";import*as y from"react";var it={};Ho(it,{Caution:()=>Ot,Checkmark:()=>Me,ChevronDown:()=>Ue,Close:()=>Nt,Danger:()=>$t,ExclamationPoint:()=>Kt,Info:()=>qe,Lightbulb:()=>Zt,MagnifyingGlass:()=>Jt,MaximizeAlt:()=>er,Minus:()=>Be,MoreVerticalAlt:()=>Ve,Plus:()=>Ae});import{jsx as zt}from"@emotion/react/jsx-runtime";var No=e=>zt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 16 16",fill:"currentColor",...e,children:zt("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"})}),Ot=No;import{jsx as Gt}from"@emotion/react/jsx-runtime";var Fo=e=>Gt("svg",{width:"1em",height:"1em",viewBox:"0 0 40 40",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:Gt("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"})}),Me=Fo;import{jsx as Ht}from"@emotion/react/jsx-runtime";var $o=e=>Ht("svg",{viewBox:"0 0 24 24",width:"1em",height:"1em",...e,children:Ht("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"})}),Ue=$o;import{jsx as nt,jsxs as Ko}from"@emotion/react/jsx-runtime";var Wo=e=>nt("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 19 19",fill:"currentColor",...e,children:Ko("g",{fillRule:"evenodd",children:[nt("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"}),nt("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"})]})}),Nt=Wo;import{jsx as Ft}from"@emotion/react/jsx-runtime";var Qo=e=>Ft("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 12 16",fill:"currentColor",...e,children:Ft("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=Qo;import{jsx as Wt}from"@emotion/react/jsx-runtime";var Yo=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"})}),Kt=Yo;import{jsx as Qt,jsxs as Xo}from"@emotion/react/jsx-runtime";var Zo=e=>Xo("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"})]}),qe=Zo;import{jsx as Yt}from"@emotion/react/jsx-runtime";var Jo=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"})}),Zt=Jo;import{jsx as Le,jsxs as Xt}from"@emotion/react/jsx-runtime";var jo=e=>Xt("svg",{width:"1em",height:"1em",viewBox:"0 0 26 24",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:[Xt("g",{clipPath:"url(#magnifying-glass_svg__a)",children:[Le("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"}),Le("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"})]}),Le("defs",{children:Le("clipPath",{id:"magnifying-glass_svg__a",children:Le("path",{fill:"#fff",transform:"translate(.558)",d:"M0 0h24.935v24H0z"})})})]}),Jt=jo;import{jsx as jt}from"@emotion/react/jsx-runtime";var en=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=en;import{jsx as tr}from"@emotion/react/jsx-runtime";var tn=e=>tr("svg",{width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:tr("path",{d:"M4 12a1 1 0 0 1 1-1h14a1 1 0 1 1 0 2H5a1 1 0 0 1-1-1Z",fill:"currentColor"})}),Be=tn;import{jsx as rr}from"@emotion/react/jsx-runtime";var rn=e=>rr("svg",{width:"1em",height:"1em",fill:"currentColor",...e,children:rr("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"})}),Ve=rn;import{jsx as ar}from"@emotion/react/jsx-runtime";var an=e=>ar("svg",{width:"1em",height:"1em",viewBox:"0 0 46 46",fill:"currentColor",xmlns:"http://www.w3.org/2000/svg",...e,children:ar("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"})}),Ae=an;import{css as kr}from"@emotion/react";import{scrollbarStyles as mn}from"@uniformdev/design-system";import{jsx as or}from"@emotion/react/jsx-runtime";function W({src:e,alt:t,className:r}){let a=e&&typeof e!="string"?e:null;return a?or(a,{className:r}):or("img",{src:e,alt:t,className:r})}import{css as V}from"@emotion/react";import{Input as mr,InputSelect as ze,mq as Oe}from"@uniformdev/design-system";import dn,{useContext as cn,useMemo as Ge}from"react";import{useAsyncFn as pn,useDebounce as un}from"react-use";import{css as on}from"@emotion/react";import{Icon as nn,InputSelect as sn}from"@uniformdev/design-system";import{CgClose as ln}from"react-icons/cg";import{Fragment as nr,jsxs as ir}from"@emotion/react/jsx-runtime";var sr=({value:e,text:t,loading:r})=>ir(nr,{children:[!!t&&t,!t&&ir(nr,{children:[r&&`${e} (Loading...)`,!r&&`${e} (Unresolvable)`]})]});import{css as st}from"@emotion/react";var lr=st`
|
|
2
2
|
align-items: center;
|
|
3
3
|
background: var(--gray-100);
|
|
4
4
|
border: 1px solid var(--gray-300);
|
|
@@ -7,66 +7,66 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
7
7
|
justify-content: space-between;
|
|
8
8
|
margin-bottom: var(--spacing-sm);
|
|
9
9
|
margin-right: var(--spacing-sm);
|
|
10
|
-
`,
|
|
10
|
+
`,dr=st`
|
|
11
11
|
color: var(--gray-800);
|
|
12
12
|
padding: var(--spacing-3);
|
|
13
|
-
`,
|
|
13
|
+
`,cr=st`
|
|
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
|
|
18
|
+
`;import{jsx as ke,jsxs as pr}from"@emotion/react/jsx-runtime";var ur=({id:e,label:t,loading:r,selectedValues:a,values:o,onAdd:i,onRemove:n})=>{var p;let s=(p=o==null?void 0:o.filter(d=>!(a!=null&&a.includes(d.id.toString()))))!=null?p:[],l=(d,u)=>{d.preventDefault(),n(u)};return pr("div",{children:[ke(sn,{id:e,name:e,label:t,onChange:d=>i(d.target.value),disabled:r,options:[{value:"",label:"Add..."},...s.map(d=>({value:d.id,label:d.name||d.id}))],value:"",css:Array.isArray(a)&&a.length>0?on`
|
|
19
19
|
margin-bottom: var(--spacing-base);
|
|
20
|
-
`:""}),a==null?void 0:a.map(
|
|
20
|
+
`:""}),a==null?void 0:a.map(d=>{var u;return pr("div",{css:lr,children:[ke("span",{css:dr,children:ke(sr,{value:d,loading:r,text:(u=o.find(v=>v.id===d))==null?void 0:u.name})}),ke("button",{css:cr,title:"remove",onClick:v=>l(v,d),children:ke(nn,{icon:ln,iconColor:"currentColor",size:20})})]},d)})]})};import{jsx as R,jsxs as fe}from"@emotion/react/jsx-runtime";var gr={count:1,categories:[],brand:"",keyword:"",sort:"date_modified",sortOrder:"desc"},Nl=({value:e,setValue:t,brands:r,categories:a,loading:o,categoriesLoading:i,brandsLoading:n,logoIcon:s,onGetProducts:l,sortOptions:p,sortOrderOptions:d,categoryLabel:u="Product Category",brandLabel:v="Brand",disableBrands:f,restrictToSingleCategory:w=!1})=>{var U,h,z;let b=async m=>{t({...gr,...e||{},...m})},S=Ge(()=>({...gr,...e||{}}),[e]),[ge,Pe]=pn(async m=>await l(m),[l]);un(async()=>{await Pe({brand:S.brand,categories:S.categories,keyword:S.keyword,sort:S.sort,sortOrder:S.sortOrder,count:S.count})},250,[S]);let $=Ge(()=>{let m=[];return a==null||a.forEach(G=>{let P=vr(G,void 0);m.push(...P)}),m},[a]),j=Ge(()=>[{value:"",label:"All categories"},...$.map(m=>({label:m.name,value:m.id}))],[$]),J=Ge(()=>(r==null?void 0:r.map(m=>({id:m.id.toString(),name:m.name})))||[],[r]),Te=m=>{if(!m)return;let G=(e==null?void 0:e.categories)||[];b({categories:[...G,m]})},Ee=m=>{var G;b({categories:(G=e==null?void 0:e.categories)==null?void 0:G.filter(P=>P!==m)})},ie=m=>{b({brand:m.target.value})},M=m=>{b({count:m||1})};return o?R("div",{children:"Loading..."}):R(hr.Provider,{value:{categories:a,logoIcon:s},children:fe("div",{css:V`
|
|
21
21
|
> :not(:last-child) {
|
|
22
22
|
margin-bottom: var(--spacing-md);
|
|
23
23
|
}
|
|
24
|
-
`,children:[
|
|
24
|
+
`,children:[w?R(ze,{id:"selection-field-product-category",label:u,disabled:o,value:(h=(U=S.categories)==null?void 0:U[0])!=null?h:"",options:j,onChange:m=>{b({categories:m.target.value===""?[]:[m.target.value]})}}):R(ur,{loading:i||!1,id:"selection-field-product-category",label:u,onAdd:Te,onRemove:Ee,selectedValues:S.categories,values:$}),fe("div",{css:V`
|
|
25
25
|
display: flex;
|
|
26
26
|
flex-wrap: wrap;
|
|
27
27
|
column-gap: var(--spacing-lg);
|
|
28
28
|
row-gap: var(--spacing-md);
|
|
29
|
-
${
|
|
29
|
+
${Oe("md")} {
|
|
30
30
|
flex-wrap: nowrap;
|
|
31
31
|
}
|
|
32
|
-
`,children:[f?null:R("div",{css:
|
|
32
|
+
`,children:[f?null:R("div",{css:V`
|
|
33
33
|
width: 50%;
|
|
34
|
-
`,children:R(
|
|
34
|
+
`,children:R(ze,{id:"brand",name:"brand",label:v,disabled:n,value:S.brand,onChange:ie,options:[{value:"",label:"Choose..."},...J.map(m=>({value:m.id,label:m.name}))]})}),R("div",{css:V`
|
|
35
35
|
flex-grow: 1;
|
|
36
36
|
position: relative;
|
|
37
|
-
`,children:R(
|
|
37
|
+
`,children:R(mr,{id:"keyword-search",name:"keyword-search",label:"Keyword",value:S.keyword,placeholder:"Enter keyword",onChange:m=>b({keyword:m.target.value})})})]}),fe("div",{css:V`
|
|
38
38
|
display: flex;
|
|
39
39
|
flex-wrap: wrap;
|
|
40
40
|
column-gap: var(--spacing-lg);
|
|
41
41
|
row-gap: var(--spacing-md);
|
|
42
|
-
${
|
|
42
|
+
${Oe("md")} {
|
|
43
43
|
flex-wrap: nowrap;
|
|
44
44
|
}
|
|
45
|
-
`,children:[fe("div",{css:
|
|
45
|
+
`,children:[fe("div",{css:V`
|
|
46
46
|
width: 100%;
|
|
47
|
-
${
|
|
47
|
+
${Oe("md")} {
|
|
48
48
|
width: 33.333333%;
|
|
49
49
|
}
|
|
50
50
|
position: relative;
|
|
51
|
-
`,children:[R(
|
|
51
|
+
`,children:[R(mr,{id:"count",name:"count",type:"number",min:1,step:1,value:S.count,onChange:m=>M(m.target.valueAsNumber),label:"Count"}),fe("div",{css:V`
|
|
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:[R(
|
|
57
|
+
`,children:[R(fr,{onCountChange:()=>M(S.count-1),countIcon:"decrement",disabled:S.count===1}),R(fr,{onCountChange:()=>M(S.count+1),countIcon:"increment"})]})]}),Array.isArray(p)&&p.length>0?R("div",{css:V`
|
|
58
58
|
flex-grow: 1;
|
|
59
|
-
${
|
|
59
|
+
${Oe("md")} {
|
|
60
60
|
width: 33.333333%;
|
|
61
61
|
}
|
|
62
|
-
`,children:R(
|
|
62
|
+
`,children:R(ze,{id:"sort",name:"sort",label:"Sort",value:S.sort,onChange:m=>b({sort:m.target.value}),options:[{value:"",label:"Select a sort"},...p.map(m=>({value:m.sortKey,label:m.name}))]})}):null,Array.isArray(d)&&d.length>0?R("div",{css:V`
|
|
63
63
|
flex-grow: 1;
|
|
64
|
-
`,children:R(
|
|
64
|
+
`,children:R(ze,{id:"sort-order",name:"sort-order",label:"Sort Order",value:S.sortOrder,onChange:m=>b({sortOrder:m.target.value}),options:d.map(m=>({value:m.sortOrderKey,label:m.name}))})}):null]}),fe("div",{children:[R("h3",{css:V`
|
|
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"}),R(
|
|
69
|
+
`,children:"Result Preview"}),R(br,{products:(z=ge.value)==null?void 0:z.products})]})]})})};function vr(e,t){var i;let r=[],a=t?`${t.name} > `:"",o={id:e.id.toString(),name:`${a}${e.name}`};return r.push(o),(i=e.children)==null||i.forEach(n=>{let s=vr(n,o);r.push(...s)}),r}function fr({onCountChange:e,countIcon:t,disabled:r}){return R("button",{css:V`
|
|
70
70
|
width: 2.25rem;
|
|
71
71
|
height: 2.25rem;
|
|
72
72
|
border: 1px solid var(--gray-300);
|
|
@@ -78,17 +78,17 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
78
78
|
&:hover {
|
|
79
79
|
background-color: var(--gray-200);
|
|
80
80
|
}
|
|
81
|
-
${
|
|
81
|
+
${r?V`
|
|
82
82
|
cursor: not-allowed;
|
|
83
83
|
opacity: 0.3;
|
|
84
84
|
`:""}
|
|
85
|
-
`,onClick:e,disabled:
|
|
85
|
+
`,onClick:e,disabled:r,children:t==="increment"?R(Ae,{css:V`
|
|
86
86
|
width: 1rem;
|
|
87
87
|
height: 1rem;
|
|
88
|
-
`}):R(
|
|
88
|
+
`}):R(Be,{css:V`
|
|
89
89
|
width: 1rem;
|
|
90
90
|
height: 1rem;
|
|
91
|
-
`})})}var
|
|
91
|
+
`})})}var hr=dn.createContext(void 0),yr=()=>{let e=cn(hr);if(!e)throw new Error("useProductQueryContext must be used within a <ProductQueryContext> provider");return e};import{css as K}from"@emotion/react";var xr=K`
|
|
92
92
|
align-items: center;
|
|
93
93
|
background: var(--white);
|
|
94
94
|
border-radius: var(--rounded-base);
|
|
@@ -103,65 +103,65 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
103
103
|
&:hover {
|
|
104
104
|
background: var(--gray-50);
|
|
105
105
|
}
|
|
106
|
-
`,
|
|
106
|
+
`,wr=K`
|
|
107
107
|
font-size: var(--fs-sm);
|
|
108
|
-
`,
|
|
108
|
+
`,Sr=K`
|
|
109
109
|
width: 1rem;
|
|
110
110
|
height: 1rem;
|
|
111
|
-
`,
|
|
111
|
+
`,lt=K`
|
|
112
112
|
margin-right: var(--spacing-lg);
|
|
113
113
|
font-size: var(--fs-sm);
|
|
114
|
-
`,
|
|
114
|
+
`,Cr=K`
|
|
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
|
-
`,
|
|
119
|
+
`,Rr=K`
|
|
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
|
-
`,
|
|
126
|
+
`,Pr=K`
|
|
127
127
|
background: var(--gray-200);
|
|
128
128
|
width: 3.5rem;
|
|
129
129
|
height: 3.5rem;
|
|
130
130
|
object-fit: cover;
|
|
131
|
-
`,
|
|
131
|
+
`,Tr=K`
|
|
132
132
|
background: var(--gray-100);
|
|
133
133
|
height: 3.5rem;
|
|
134
134
|
width: 3.5rem;
|
|
135
|
-
`,
|
|
135
|
+
`,Lr=K`
|
|
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
|
-
`,
|
|
140
|
+
`,Vr=K`
|
|
141
141
|
display: block;
|
|
142
142
|
font-weight: var(--fw-regular);
|
|
143
|
-
`;import{Fragment as
|
|
143
|
+
`;import{Fragment as Dr,jsx as re,jsxs as te}from"@emotion/react/jsx-runtime";var br=({products:e})=>{let{categories:t,logoIcon:r}=yr();return te(Dr,{children:[te("p",{css:kr`
|
|
144
144
|
margin-bottom: var(--spacing-base);
|
|
145
|
-
`,children:["Matching ",(e==null?void 0:e.length)||0," products"]}),re("ul",{css:[
|
|
145
|
+
`,children:["Matching ",(e==null?void 0:e.length)||0," products"]}),re("ul",{css:[kr`
|
|
146
146
|
max-height: 24rem;
|
|
147
147
|
overflow-x: auto;
|
|
148
|
-
`,
|
|
148
|
+
`,mn],children:e==null?void 0:e.map((a,o)=>{var s,l;let[i]=(a==null?void 0:a.categories)||[],n=typeof i=="undefined"||!t||(s=t.find(p=>p.id===i.id))==null?void 0:s.name;return re("li",{css:Cr,children:te("div",{css:Rr,"data-test-id":`product-item-${a.sku||a.id}`,children:[a.thumbnailUrl?re("img",{src:a.thumbnailUrl,alt:typeof a.title=="string"?a.title:a.name||`Product ${o}`,css:Pr,"data-test-id":"product-image"}):re("div",{css:Tr}),te("h4",{css:Lr,"data-test-id":"product-name",children:[a.title||a.name,n&&re("span",{css:Vr,children:n})]}),a&&te(Dr,{children:[te("p",{css:lt,"data-test-id":"product-sku",children:["SKU: ",a.sku||a.id,re("br",{})]}),a.price!==void 0?te("p",{css:lt,"data-test-id":"product-price",children:["Price: ",a.price]}):null,a.editLink||a.url?te("a",{css:xr,href:(l=a.editLink)!=null?l:a.url,title:`Go to ${a.title||a.name}`,target:"_blank",rel:"noopener noreferrer","data-test-id":"edit-product-button",children:[re("span",{css:wr,children:"Edit"}),r?re(W,{src:r,alt:"Logo",css:Sr}):null]}):null]})]})},`product-${a.id}`)})})]})};import{Callout as Fn}from"@uniformdev/design-system";import $n,{useContext as Wn,useMemo as Kn,useRef as Qn}from"react";import{useAsync as Yn,useAsyncFn as Zn}from"react-use";import{css as qr}from"@emotion/react";import{useEffect as gn,useRef as Br,useState as fn}from"react";import{css as le}from"@emotion/react";var _r=le`
|
|
149
149
|
cursor: pointer;
|
|
150
150
|
padding: var(--spacing-sm);
|
|
151
151
|
position: relative;
|
|
152
152
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
153
153
|
color var(--duration-fast) var(--timing-ease-out);
|
|
154
|
-
`,
|
|
154
|
+
`,Ir=le`
|
|
155
155
|
padding-right: var(--spacing-lg);
|
|
156
|
-
`,
|
|
156
|
+
`,Er=le`
|
|
157
157
|
background: var(--brand-secondary-3);
|
|
158
158
|
color: var(--white);
|
|
159
|
-
`,
|
|
159
|
+
`,dt=le`
|
|
160
160
|
font-size: var(--fs-xs);
|
|
161
|
-
`,
|
|
161
|
+
`,ct=le`
|
|
162
162
|
font-weight: var(--fw-bold);
|
|
163
163
|
margin-right: var(--spacing-sm);
|
|
164
|
-
`,
|
|
164
|
+
`,Mr=le`
|
|
165
165
|
background: var(--white);
|
|
166
166
|
border-left: 4px solid var(--brand-secondary-3);
|
|
167
167
|
border-radius: var(--rounded-base);
|
|
@@ -173,20 +173,20 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
173
173
|
right: var(--spacing-xl);
|
|
174
174
|
z-index: var(--z-10);
|
|
175
175
|
width: max-content;
|
|
176
|
-
`,
|
|
176
|
+
`,Ur=le`
|
|
177
177
|
position: absolute;
|
|
178
178
|
inset: 0 var(--spacing-sm) 0 auto;
|
|
179
|
-
`;import{Fragment as
|
|
179
|
+
`;import{Fragment as vn,jsx as Ar,jsxs as de}from"@emotion/react/jsx-runtime";var zr=({result:e,isSelected:t,triggerSelection:r})=>{let a=Br(null),o=Br(null),[i,n]=fn(!1);gn(()=>{function l(p){a.current&&!a.current.contains(p.target)&&o.current&&!o.current.contains(p.target)&&n(!1)}return document.addEventListener("mousedown",l),()=>{document.removeEventListener("mousedown",l)}},[o]);let s=l=>{l.stopPropagation(),n(!i)};return de("div",{css:[_r,t?Er:void 0,e.popoverData?Ir:void 0],"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>r(),children:[e.title,e.popoverData&&t?de(vn,{children:[Ar("button",{type:"button",ref:a,css:Ur,"aria-controls":"path-details",onClick:l=>s(l),"aria-expanded":i,children:Ar(qe,{width:24,height:24})}),de("div",{id:"path-details","aria-hidden":!i,ref:o,css:[Mr,i?qr`
|
|
180
180
|
visibility: visible;
|
|
181
|
-
`:
|
|
181
|
+
`:qr`
|
|
182
182
|
visibility: hidden;
|
|
183
|
-
`],children:[e.metadata&&Object.entries(e.metadata).map(([
|
|
183
|
+
`],children:[e.metadata&&Object.entries(e.metadata).map(([l,p],d)=>de("div",{css:dt,children:[de("span",{css:ct,children:[l,":"]}),p]},d)),Object.entries(e.popoverData).map(([l,p],d)=>de("div",{css:dt,children:[de("span",{css:ct,children:[l,":"]}),p]},d))]})]}):null]},e.id)};import{css as ae}from"@emotion/react";import{Icon as Qr}from"@uniformdev/design-system";import{useEffect as yn,useRef as Yr,useState as bn}from"react";import{CgClose as xn,CgInfo as wn}from"react-icons/cg";import{format as Sn}from"timeago.js";function He(e,t){let r=window.open(e,"_blank"),a=setInterval(()=>{r!=null&&r.closed&&(clearInterval(a),t())},500)}import{css as H}from"@emotion/react";import{mq as hn}from"@uniformdev/design-system";var Or=H`
|
|
184
184
|
border: 1px solid var(--gray-200);
|
|
185
185
|
background: var(--gray-50);
|
|
186
186
|
border-radius: var(--rounded-base);
|
|
187
187
|
display: flex;
|
|
188
188
|
width: 100%;
|
|
189
|
-
`,
|
|
189
|
+
`,Gr=H`
|
|
190
190
|
align-items: center;
|
|
191
191
|
display: flex;
|
|
192
192
|
flex-grow: 1;
|
|
@@ -194,22 +194,22 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
194
194
|
margin-inline: 0 var(--spacing-sm);
|
|
195
195
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
196
196
|
position: relative;
|
|
197
|
-
`,
|
|
197
|
+
`,Hr=H`
|
|
198
198
|
flex-grow: 1;
|
|
199
|
-
`,
|
|
199
|
+
`,Nr=H`
|
|
200
200
|
align-items: start;
|
|
201
201
|
display: inline-flex;
|
|
202
202
|
position: relative;
|
|
203
|
-
`,
|
|
203
|
+
`,Fr=H`
|
|
204
204
|
color: var(--brand-secondary-1);
|
|
205
205
|
font-size: var(--fs-base);
|
|
206
206
|
font-weight: var(--fw-bold);
|
|
207
207
|
line-height: 1;
|
|
208
208
|
margin: 0;
|
|
209
|
-
|
|
209
|
+
`,$r=H`
|
|
210
210
|
width: 1.5rem;
|
|
211
211
|
height: 1.5rem;
|
|
212
|
-
`,
|
|
212
|
+
`,Wr=H`
|
|
213
213
|
background: var(--white);
|
|
214
214
|
border-radius: var(--rounded-base);
|
|
215
215
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -218,22 +218,22 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
218
218
|
padding: var(--spacing-base);
|
|
219
219
|
z-index: var(--z-10);
|
|
220
220
|
width: max-content;
|
|
221
|
-
`,ce=
|
|
221
|
+
`,ce=H`
|
|
222
222
|
font-size: var(--fs-sm);
|
|
223
|
-
`,
|
|
223
|
+
`,De=H`
|
|
224
224
|
font-weight: var(--fw-bold);
|
|
225
225
|
margin-right: var(--spacing-sm);
|
|
226
|
-
`,
|
|
226
|
+
`,Kr=H`
|
|
227
227
|
display: flex;
|
|
228
228
|
flex-direction: column;
|
|
229
229
|
gap: var(--spacing-sm);
|
|
230
230
|
|
|
231
|
-
${
|
|
231
|
+
${hn("md")} {
|
|
232
232
|
flex-direction: row;
|
|
233
233
|
min-width: 200px;
|
|
234
234
|
justify-content: end;
|
|
235
235
|
}
|
|
236
|
-
`,
|
|
236
|
+
`,pt=H`
|
|
237
237
|
align-items: center;
|
|
238
238
|
background: var(--white);
|
|
239
239
|
border-radius: var(--rounded-base);
|
|
@@ -248,29 +248,29 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
248
248
|
&:hover {
|
|
249
249
|
background: var(--gray-50);
|
|
250
250
|
}
|
|
251
|
-
`;import{Fragment as
|
|
251
|
+
`;import{Fragment as Cn,jsx as Q,jsxs as k}from"@emotion/react/jsx-runtime";var Zr=({selectedItem:e,logoIcon:t,onDeselect:r,onEditClosed:a})=>{var p;let o=Yr(null),i=Yr(null),[n,s]=bn(!1);yn(()=>{let d=v=>{o.current&&!o.current.contains(v.target)&&i.current&&!i.current.contains(v.target)&&s(!1)},u=()=>{s(!1)};return window.addEventListener("resize",u,!0),document.addEventListener("scroll",d,!0),document.addEventListener("mousedown",d),()=>{window.removeEventListener("resize",u,!0),document.removeEventListener("scroll",d,!0),document.removeEventListener("mousedown",d)}},[i]);let l=()=>{var d;if(s(!n),i.current&&o.current){let u=(d=o==null?void 0:o.current)==null?void 0:d.getBoundingClientRect(),v=i.current.offsetWidth;i.current.style.top=`${u.top+30}px`,i.current.style.left=`${u.left-v+30}px`}};return Q("div",{css:Or,children:k("div",{css:Gr,children:[k("div",{css:Hr,children:[k("div",{css:Nr,children:[Q("h4",{css:[Fr,e.popoverData?ae`
|
|
252
252
|
margin-bottom: var(--spacing-sm);
|
|
253
|
-
`:""],title:`ID: ${e.id}`,"data-test-id":"entry-id",children:e.title||e.id||""}),e.popoverData?
|
|
253
|
+
`:""],title:`ID: ${e.id}`,"data-test-id":"entry-id",children:e.title||e.id||""}),e.popoverData?k(Cn,{children:[Q("button",{type:"button",ref:o,css:ae`
|
|
254
254
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
255
|
-
`,"aria-controls":"path-details","aria-expanded":
|
|
255
|
+
`,"aria-controls":"path-details","aria-expanded":n,onClick:l,children:Q(Qr,{icon:wn,iconColor:"gray",size:24,css:ae`
|
|
256
256
|
opacity: var(--opacity-75);
|
|
257
|
-
`})}),Q("div",{id:"path-details","aria-hidden":!
|
|
257
|
+
`})}),Q("div",{id:"path-details","aria-hidden":!n,ref:i,css:[Wr,n?ae`
|
|
258
258
|
visibility: visible;
|
|
259
259
|
`:ae`
|
|
260
260
|
visibility: hidden;
|
|
261
|
-
`],children:Object.entries(e.popoverData).map(([
|
|
261
|
+
`],children:Object.entries(e.popoverData).map(([d,u],v)=>k("div",{css:ce,children:[k("span",{css:De,children:[d,":"]}),u]},v))})]}):null]}),e.createdDate&&k("div",{css:ce,children:[Q("span",{css:De,children:"Created:"}),Sn((p=e.createdDate)!=null?p:0)]}),e.metadata?Object.entries(e.metadata).filter(([d])=>["type","status"].includes(d.toLocaleLowerCase())).map(([d,u])=>k("div",{css:[ce,ae`
|
|
262
262
|
order: 1;
|
|
263
|
-
`],children:[
|
|
263
|
+
`],children:[k("span",{css:De,children:[d,":"]}),u]},d)):null,e.metadata?Object.entries(e.metadata).filter(([d])=>!["type","status"].includes(d.toLocaleLowerCase())).map(([d,u])=>k("div",{css:[ce,ae`
|
|
264
264
|
order: 1;
|
|
265
|
-
`],children:[
|
|
265
|
+
`],children:[k("span",{css:[De,ae`
|
|
266
266
|
order: 1;
|
|
267
|
-
`],children:[
|
|
267
|
+
`],children:[d,":"]}),u]},d)):null]}),k("div",{css:Kr,children:[e.editLink?k("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:d=>{a&&(He(d.currentTarget.href,()=>a(e)),d.preventDefault())},css:pt,children:[Q("span",{css:ce,children:"Edit"}),Q(W,{src:t,css:$r,alt:"Logo"})]}):null,k("button",{type:"button",onClick:()=>{r(e)},css:pt,children:[Q("span",{css:ce,children:"Unlink"}),Q(Qr,{icon:xn,iconColor:"red",size:16})]})]})]})},e.id)};import{css as Y}from"@emotion/react";import{Button as gt,Callout as Tn,InputKeywordSearch as Ln,InputSelect as Vn,LoadingIndicator as kn,LoadingOverlay as Dn,Menu as _n,MenuItem as In,scrollbarStyles as En}from"@uniformdev/design-system";import*as Z from"react";import{DragDropContext as Mn,Draggable as Un,Droppable as qn}from"react-beautiful-dnd";import{useDebounce as Bn}from"react-use";import{v4 as An}from"uuid";import{useEffect as Xr,useRef as Rn,useState as Pn}from"react";function Jr(e,{delay:t=500,minDuration:r=200}={delay:500,minDuration:200}){let[a,o]=Pn("IDLE"),i=Rn(void 0);return Xr(()=>{e&&a==="IDLE"&&(clearTimeout(i.current),i.current=setTimeout(()=>{if(!e)return o("IDLE");i.current=setTimeout(()=>{o("EXPIRE")},r),o("DISPLAY")},t),o("DELAY")),!e&&a!=="DISPLAY"&&(clearTimeout(i.current),o("IDLE"))},[e,a,t,r]),Xr(()=>()=>clearTimeout(i.current),[]),a==="DISPLAY"||a==="EXPIRE"}import{css as T}from"@emotion/react";var jr=T`
|
|
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
|
-
`,
|
|
273
|
+
`,ea=T`
|
|
274
274
|
align-items: center;
|
|
275
275
|
display: flex;
|
|
276
276
|
position: relative;
|
|
@@ -278,7 +278,7 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
278
278
|
width: 100%;
|
|
279
279
|
background-color: transparent;
|
|
280
280
|
border: 0;
|
|
281
|
-
`,
|
|
281
|
+
`,ta=T`
|
|
282
282
|
color: var(--brand-secondary-1);
|
|
283
283
|
display: block;
|
|
284
284
|
font-weight: var(--fw-bold);
|
|
@@ -294,15 +294,15 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
294
294
|
background: var(--gray-100);
|
|
295
295
|
outline: none;
|
|
296
296
|
}
|
|
297
|
-
`,
|
|
297
|
+
`,ra=T`
|
|
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
|
-
`,
|
|
303
|
+
`,aa=T`
|
|
304
304
|
display: none;
|
|
305
|
-
`,
|
|
305
|
+
`,oa=T`
|
|
306
306
|
overflow-y: auto;
|
|
307
307
|
height: 16rem;
|
|
308
308
|
margin-bottom: var(--spacing-base);
|
|
@@ -311,26 +311,26 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
311
311
|
& > :not(:last-child) {
|
|
312
312
|
border-bottom: 1px solid var(--gray-200);
|
|
313
313
|
}
|
|
314
|
-
`,
|
|
314
|
+
`,Bd=T`
|
|
315
315
|
background-color: var(--gray-50);
|
|
316
316
|
max-width: 33.33%;
|
|
317
|
-
`,
|
|
317
|
+
`,na=T`
|
|
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
|
-
`,
|
|
324
|
+
`,ia=T`
|
|
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
|
-
`,
|
|
330
|
+
`,Ad=T`
|
|
331
331
|
background: var(--white);
|
|
332
332
|
color: var(--brand-secondary-1);
|
|
333
|
-
`,
|
|
333
|
+
`,sa=T`
|
|
334
334
|
position: relative;
|
|
335
335
|
margin-block: var(--spacing-sm) 0;
|
|
336
336
|
|
|
@@ -342,96 +342,96 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
342
342
|
left: auto !important;
|
|
343
343
|
top: auto !important;
|
|
344
344
|
}
|
|
345
|
-
`,
|
|
345
|
+
`,la=T`
|
|
346
346
|
align-items: center;
|
|
347
347
|
display: flex;
|
|
348
348
|
position: absolute;
|
|
349
349
|
inset: 0 auto 0 0;
|
|
350
350
|
margin-block: auto;
|
|
351
351
|
opacity: 0;
|
|
352
|
-
`,
|
|
352
|
+
`,ut=T`
|
|
353
353
|
color: var(--brand-secondary-1);
|
|
354
|
-
`,
|
|
354
|
+
`,da=T`
|
|
355
355
|
position: absolute;
|
|
356
356
|
left: 0.375rem;
|
|
357
|
-
`,
|
|
357
|
+
`,mt=T`
|
|
358
358
|
width: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
359
359
|
height: calc(var(--spacing-lg) + var(--spacing-xs));
|
|
360
|
-
`;import{Fragment as
|
|
360
|
+
`;import{Fragment as On,jsx as x,jsxs as N}from"@emotion/react/jsx-runtime";var zn=({searchText:e,selectedContentType:t})=>{let r="No content found";return t&&t!=="any"&&(r=`No ${t} content was found`),e&&(r=`${r} for keyword '${e}'.`),x(Tn,{type:"info",children:r})},ca=({search:e,results:t,contentTypes:r,selectedItems:a,logoIcon:o,select:i,multiSelect:n,multiSelectId:s,rowComponent:l,selectedItemComponent:p,totalResults:d,cursor:u,resultsLoading:v,requireContentType:f,onAddNew:w,onEditClosed:b,onCancel:S,noResultsComponent:ge,helpComponent:Pe,onSort:$,typeSelectorLabel:j="Content Type Select",typeSelectorAllTypesOptionText:J="All content types",loadingIndicatorDelay:Te=1e3})=>{var qt,Bt,At;let ie=()=>f?Array.isArray(r)&&r.length>0?r[0].id:"":"any",[M,U]=Z.useState(""),[h,z]=Z.useState(ie),[m,G]=Z.useState(!1),[P,se]=Z.useState([]),[Lo,It]=Z.useState(!1),rt=Z.useRef(`x${An()}`);Bn(()=>{e(M,{count:5,offset:0,contentType:h==="any"?void 0:h})},300,[M,h]);let Vo=Jr(v,{delay:Te}),ko=g=>{P.some(C=>C.id===g.id)?se(C=>C.filter(ee=>ee.id!==g.id)):se(n?C=>[...C,g]:[g])},Do=a==null?void 0:a.map(g=>g.id+g.title).join(",");Z.useEffect(()=>{Array.isArray(a)&&se(a)},[Do]);let _o=()=>{z(ie()),U(""),se(a!=null&&a.length?a:[])},Io=()=>{G(g=>!g),m||_o()},Et=g=>{let C=(P==null?void 0:P.filter(ee=>ee.id!==g.id))||[];se(C),i(C,"")},Eo=g=>{g.preventDefault(),i(P,h),G(!1)},Mo=g=>{g.preventDefault(),G(!1),S&&S()},Uo=()=>{e(M,{count:5,offset:(t==null?void 0:t.length)||0,contentType:h==="any"?void 0:h,cursor:u}),It(!0);let g=setTimeout(()=>{It(!1)},750);return()=>clearTimeout(g)},qo=!(a==null?void 0:a.length)||n,Bo=l||zr,Mt=p||Zr,Ao=ge||zn,Ut=o&&typeof o!="string"?o:null,zo=Ut?x(Ut,{css:mt}):x("img",{src:o,alt:"Logo",css:mt}),Oo=g=>{var C,ee;if(g.destination&&g.source.droppableId===((C=g.destination)==null?void 0:C.droppableId)){let q=[...a||[]],[at]=(ee=q==null?void 0:q.splice(g.source.index,1))!=null?ee:[];return q==null||q.splice(g.destination.index,0,at),$&&(se(q),$==null||$(q)),q}};return x("div",{css:Y`
|
|
361
361
|
width: 100%;
|
|
362
362
|
`,children:N("div",{css:Y`
|
|
363
363
|
position: relative;
|
|
364
364
|
margin-block: var(--spacing-base);
|
|
365
|
-
`,children:[
|
|
365
|
+
`,children:[qo?N(On,{children:[x("div",{css:jr,"data-test-id":"component-search",children:N("button",{css:ea,onClick:Io,type:"button","aria-haspopup":!0,"aria-expanded":m,"aria-controls":`entry-search-config-${rt.current}`,children:[zo,x("span",{css:Y`
|
|
366
366
|
margin-left: var(--spacing-base);
|
|
367
|
-
`,children:"Select"}),x("span",{css:
|
|
367
|
+
`,children:"Select"}),x("span",{css:na,children:x(Ue,{css:[ia,m?Y`
|
|
368
368
|
transform: rotate(180deg);
|
|
369
|
-
`:void 0]})})]})}),N("div",{id:`entry-search-config-${
|
|
369
|
+
`:void 0]})})]})}),N("div",{id:`entry-search-config-${rt.current}`,"aria-hidden":!m,css:[ra,m?void 0:aa],children:[Pe||null,N("div",{css:Y`
|
|
370
370
|
display: flex;
|
|
371
371
|
gap: calc(var(--spacing-base) - 0.25rem);
|
|
372
372
|
margin-bottom: var(--spacing-base);
|
|
373
|
-
`,children:[x(
|
|
373
|
+
`,children:[x(Vn,{onChange:g=>z(g.target.value),value:h,label:j,showLabel:!1,options:[...f?[]:[{value:"any",label:J}],...r?r.map(g=>({value:g.id,label:g.name})):[]]}),x("div",{css:Y`
|
|
374
374
|
flex-grow: 1;
|
|
375
|
-
`,children:x(
|
|
375
|
+
`,children:x(Ln,{inputFieldName:"searchText",placeholder:"Enter keyword to narrow your results",onSearchTextChanged:U,disabledFieldSubmission:!0,value:M})})]}),N("div",{css:[oa,En],id:rt.current,role:"listbox",tabIndex:0,"data-test-id":"entry-list",children:[x(Dn,{isActive:Vo}),Array.isArray(t)&&t.length>0?t.map(g=>x(Bo,{isSelected:P.some(C=>C.id===g.id),result:g,triggerSelection:()=>ko(g)},g.id)):v?null:x(Ao,{searchText:M||M,selectedContentType:(Bt=(qt=r==null?void 0:r.find(g=>g.id===h))==null?void 0:qt.name)!=null?Bt:h}),!v&&typeof d!="undefined"&&t&&(t==null?void 0:t.length)<d&&x("button",{type:"button",css:ta,onClick:Uo,children:Lo?x(kn,{}):"Load More"})]}),N("div",{css:Y`
|
|
376
376
|
display: flex;
|
|
377
377
|
justify-content: space-between;
|
|
378
|
-
`,children:[x("div",{children:
|
|
378
|
+
`,children:[x("div",{children:w&&((At=r==null?void 0:r.length)!=null?At:0)>0?x(_n,{menuLabel:"Add new menu",menuTrigger:x(gt,{buttonType:"secondary",children:"Add New"}),children:r==null?void 0:r.map(g=>x(In,{css:Y`
|
|
379
379
|
background: var(--white);
|
|
380
380
|
color: var(--brand-secondary-1);
|
|
381
|
-
`,onClick:()=>
|
|
381
|
+
`,onClick:()=>w(g),children:g.name},g.id))}):null}),N("div",{css:Y`
|
|
382
382
|
display: flex;
|
|
383
383
|
gap: var(--spacing-base);
|
|
384
|
-
`,children:[x(
|
|
384
|
+
`,children:[x(gt,{buttonType:"unimportant",onClick:Mo,children:"Cancel"}),x(gt,{disabled:!P.length,onClick:Eo,"data-test-id":"entry-accept-button",children:"Accept"})]})]})]})]}):null,m?null:n&&P.length>1?x(Mn,{onDragEnd:g=>Oo(g),children:x(qn,{droppableId:s||"canvas-multi-select",children:g=>N("div",{...g.droppableProps,ref:g.innerRef,css:Y`
|
|
385
385
|
margin-block: var(--spacing-sm) 0;
|
|
386
|
-
`,children:[P==null?void 0:P.map((
|
|
386
|
+
`,children:[P==null?void 0:P.map((C,ee)=>{if(C!=null&&C.id)return x(Un,{draggableId:C.id,index:ee,children:(q,at)=>N("div",{css:sa,ref:q.innerRef,"data-dragging":at.isDragging,...q.draggableProps,...q.dragHandleProps,children:[N("span",{css:la,children:[x(Ve,{css:[ut,da],width:24,height:24}),x(Ve,{css:ut,width:24,height:24})]}),x(Mt,{logoIcon:o,selectedItem:C,onDeselect:ot=>Et(ot),onEditClosed:b?ot=>b(ot):void 0},`selected-item-${C.id}`)]})},C.id)}),g.placeholder]})})}):P==null?void 0:P.map(g=>x(Mt,{logoIcon:o,selectedItem:g,onDeselect:C=>Et(C),onEditClosed:b?C=>b(C):void 0},`selected-item-${g.id}`))]})})};import{css as ya}from"@emotion/react";import{css as pe}from"@emotion/react";var pa=pe`
|
|
387
387
|
cursor: pointer;
|
|
388
388
|
padding: var(--spacing-sm) 0;
|
|
389
389
|
margin-right: var(--spacing-sm);
|
|
390
390
|
position: relative;
|
|
391
391
|
transition: background-color var(--duration-fast) var(--timing-ease-out),
|
|
392
392
|
color var(--duration-fast) var(--timing-ease-out);
|
|
393
|
-
`,
|
|
393
|
+
`,ua=pe`
|
|
394
394
|
border: 2px solid transparent;
|
|
395
395
|
border-radius: var(--rounded-base);
|
|
396
396
|
display: flex;
|
|
397
397
|
align-items: center;
|
|
398
398
|
gap: var(--spacing-base);
|
|
399
399
|
padding: var(--spacing-sm) var(--spacing-xs);
|
|
400
|
-
`,
|
|
400
|
+
`,ma=pe`
|
|
401
401
|
background-color: var(--green-50);
|
|
402
|
-
`,
|
|
402
|
+
`,ga=pe`
|
|
403
403
|
font-size: var(--fs-sm);
|
|
404
404
|
font-weight: var(--fw-bold);
|
|
405
405
|
width: 50%;
|
|
406
|
-
`,
|
|
406
|
+
`,fa=pe`
|
|
407
407
|
font-weight: var(--fw-normal);
|
|
408
408
|
display: block;
|
|
409
|
-
`,
|
|
409
|
+
`,va=pe`
|
|
410
410
|
font-size: var(--fs-sm);
|
|
411
411
|
> * {
|
|
412
412
|
display: block;
|
|
413
413
|
}
|
|
414
|
-
`,
|
|
414
|
+
`,ha=pe`
|
|
415
415
|
display: block;
|
|
416
416
|
height: 1.5rem;
|
|
417
417
|
width: 1.5rem;
|
|
418
418
|
color: var(--brand-secondary-3);
|
|
419
419
|
margin-left: auto;
|
|
420
|
-
`;import{jsx as ve,jsxs as
|
|
420
|
+
`;import{jsx as ve,jsxs as ft}from"@emotion/react/jsx-runtime";function ba({result:e,isSelected:t,triggerSelection:r}){var s;let{categories:a,logoIcon:o}=Ne(),[i]=e.categories||[{id:"",name:""}],n=typeof i=="undefined"||!a||(s=a.find(l=>l.id===i.id))==null?void 0:s.name;return ve("div",{"data-value":e.id,role:"option",tabIndex:-1,onClick:()=>r(),css:[pa],children:ft("div",{css:[ua,t?ma:void 0],children:[e.thumbnailUrl?ve("img",{src:e.thumbnailUrl,alt:`Thumbnail for ${e.title}`,css:ya`
|
|
421
421
|
background-color: var(--gray-200);
|
|
422
422
|
width: 3rem;
|
|
423
423
|
height: 3rem;
|
|
424
424
|
object-fit: cover;
|
|
425
|
-
`}):ve(W,{src:
|
|
425
|
+
`}):ve(W,{src:o,alt:"Logo",css:ya`
|
|
426
426
|
height: 2.25rem;
|
|
427
427
|
width: 2.25rem;
|
|
428
|
-
`}),
|
|
428
|
+
`}),ft("h4",{css:[ga],children:[e.title,n?ve("span",{css:[fa],children:n}):null]}),ft("p",{css:[va],children:["SKU: ",e.sku||e.id,e.price!==void 0?ve("span",{children:e.price}):null]}),t?ve(Me,{css:[ha]}):null]})},e.id)}import{css as he}from"@emotion/react";import{Icon as Gn,mq as Hn}from"@uniformdev/design-system";import{CgClose as Nn}from"react-icons/cg";import{css as oe}from"@emotion/react";import{mq as xa}from"@uniformdev/design-system";var wa=oe`
|
|
429
429
|
border: 1px solid var(--gray-200);
|
|
430
430
|
border-radius: var(--rounded-base);
|
|
431
431
|
background: var(--gray-50);
|
|
432
432
|
display: flex;
|
|
433
433
|
width: 100%;
|
|
434
|
-
`,
|
|
434
|
+
`,Sa=oe`
|
|
435
435
|
align-items: center;
|
|
436
436
|
display: flex;
|
|
437
437
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
@@ -439,22 +439,22 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
439
439
|
flex-grow: 1;
|
|
440
440
|
gap: var(--spacing-sm);
|
|
441
441
|
margin-inline: 0 var(--spacing-sm);
|
|
442
|
-
`,
|
|
442
|
+
`,Ca=oe`
|
|
443
443
|
display: flex;
|
|
444
444
|
align-items: center;
|
|
445
445
|
gap: var(--spacing-sm);
|
|
446
446
|
flex-grow: 1;
|
|
447
447
|
|
|
448
|
-
${
|
|
448
|
+
${xa("lg")} {
|
|
449
449
|
width: 50%;
|
|
450
450
|
margin-bottom: 0;
|
|
451
451
|
}
|
|
452
|
-
`,
|
|
452
|
+
`,vt=oe`
|
|
453
453
|
background-color: var(--gray-200);
|
|
454
454
|
width: 3.5rem;
|
|
455
455
|
height: 3.5rem;
|
|
456
456
|
object-fit: cover;
|
|
457
|
-
`,
|
|
457
|
+
`,ht=oe`
|
|
458
458
|
align-items: center;
|
|
459
459
|
background: var(--white);
|
|
460
460
|
border-radius: var(--rounded-base);
|
|
@@ -469,50 +469,50 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
469
469
|
&:hover {
|
|
470
470
|
background: var(--gray-50);
|
|
471
471
|
}
|
|
472
|
-
`,
|
|
472
|
+
`,yt=oe`
|
|
473
473
|
font-size: var(--fs-sm);
|
|
474
|
-
`,
|
|
474
|
+
`,Ra=oe`
|
|
475
475
|
display: block;
|
|
476
476
|
width: 1rem;
|
|
477
477
|
height: 1rem;
|
|
478
|
-
`,
|
|
478
|
+
`,Pa=oe`
|
|
479
479
|
display: flex;
|
|
480
480
|
flex-direction: column;
|
|
481
481
|
gap: var(--spacing-sm);
|
|
482
482
|
|
|
483
|
-
${
|
|
483
|
+
${xa("md")} {
|
|
484
484
|
flex-direction: row;
|
|
485
485
|
min-width: 200px;
|
|
486
486
|
justify-content: end;
|
|
487
487
|
}
|
|
488
|
-
`;import{jsx as
|
|
488
|
+
`;import{jsx as F,jsxs as X}from"@emotion/react/jsx-runtime";function Ta({selectedItem:e,onDeselect:t}){var n;let{categories:r,logoIcon:a}=Ne(),[o]=e.categories||[{id:"",name:""}],i=typeof o=="undefined"||!r||(n=r.find(s=>s.id===o.id))==null?void 0:n.name;return F("div",{css:[wa],children:X("article",{css:[Sa],children:[X("div",{css:[Ca],children:[e.thumbnailUrl?F("img",{src:e.thumbnailUrl,alt:i,css:[vt],loading:"lazy"}):F("div",{css:[vt]}),X("div",{css:he`
|
|
489
489
|
> :not(:last-child) {
|
|
490
490
|
margin-bottom: var(--spacing-xs);
|
|
491
491
|
}
|
|
492
492
|
`,children:[X("h4",{css:he`
|
|
493
493
|
margin-top: 0px;
|
|
494
494
|
font-weight: var(--fw-bold);
|
|
495
|
-
`,children:[e.title||e.id||"",
|
|
495
|
+
`,children:[e.title||e.id||"",i&&F("span",{css:he`
|
|
496
496
|
display: block;
|
|
497
497
|
font-weight: var(--fw-regular);
|
|
498
|
-
`,children:
|
|
498
|
+
`,children:i})]}),X("ul",{css:he`
|
|
499
499
|
font-size: var(--fs-sm);
|
|
500
500
|
|
|
501
|
-
${
|
|
501
|
+
${Hn("sm")} {
|
|
502
502
|
display: flex;
|
|
503
503
|
gap: var(--spacing-base);
|
|
504
504
|
}
|
|
505
|
-
`,children:[X("li",{children:[
|
|
505
|
+
`,children:[X("li",{children:[F("span",{css:he`
|
|
506
506
|
margin-right: var(--spacing-xs);
|
|
507
|
-
`,children:"SKU:"}),e.sku||e.id]}),e.price!==void 0?X("li",{children:[
|
|
507
|
+
`,children:"SKU:"}),e.sku||e.id]}),e.price!==void 0?X("li",{children:[F("span",{css:he`
|
|
508
508
|
margin-right: var(--spacing-xs);
|
|
509
|
-
`,children:"Price:"})
|
|
509
|
+
`,children:"Price:"}),F("span",{children:e.price})]}):null]})]})]}),X("div",{css:Pa,children:[e.editLink?X("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",css:ht,children:[F("span",{css:yt,children:"Edit"}),F(W,{src:a,alt:"Logo",css:Ra})]}):null,X("button",{type:"button",onClick:()=>{t==null||t(e)},css:ht,children:[F("span",{css:yt,children:"Unlink"}),F(Gn,{icon:Nn,iconColor:"red",size:16})]})]})]})},e.id)}import{jsx as bt,jsxs as Xn}from"@emotion/react/jsx-runtime";function qc({selectedProducts:e,setSelectedProducts:t,onGetCategories:r,onSearchProducts:a,logoIcon:o,multiSelect:i,multiSelectId:n,selectedItemComponent:s,rowComponent:l,errorComponent:p,helpComponent:d,noResultsComponent:u,onSort:v,typeSelectorAllTypesOptionText:f="All categories",typeSelectorLabel:w="Select Category"}){var ie,M;let{value:b,loading:S,error:ge}=Yn(async()=>await r(),[r]),Pe=b==null?void 0:b.map(U=>U.id).join(","),$=Kn(()=>b?b.map(h=>({id:h.id,name:h.name})):void 0,[Pe]),j=Qn(),[J,Te]=Zn(async(U,h)=>{let z=await a({text:U,options:{limit:h==null?void 0:h.count,offset:h==null?void 0:h.offset,categoryId:h==null?void 0:h.contentType,cursor:h==null?void 0:h.cursor}});return(h==null?void 0:h.offset)===0&&(j.current=[]),(j.current=j.current||[]).push(...z.products),z},[a]),Ee=async U=>{await t(U)};return ge||J.error?bt(p||(({categoriesError:h,searchError:z})=>Xn(Fn,{type:"error",children:["There was an error: ",(h==null?void 0:h.message)||(z==null?void 0:z.message)]})),{categoriesError:ge,searchError:J.error}):bt(La.Provider,{value:{categories:b,logoIcon:o},children:bt(ca,{search:Te,results:j.current,logoIcon:o,selectedItems:e,select:Ee,multiSelectId:n||"product-search-multi-select",multiSelect:i,contentTypes:$,selectedItemComponent:s||Ta,rowComponent:l||ba,totalResults:(ie=J.value)==null?void 0:ie.total,cursor:(M=J.value)==null?void 0:M.cursor,resultsLoading:J.loading||S,helpComponent:d,noResultsComponent:u,onSort:v,typeSelectorAllTypesOptionText:f,typeSelectorLabel:w})})}var La=$n.createContext(void 0),Ne=()=>{let e=Wn(La);if(!e)throw new Error("useProductSearchContext must be used within a <ProductSearchContext> provider");return e};import{css as be}from"@emotion/react";import{Icon as Aa}from"@uniformdev/design-system";import{useEffect as jn,useRef as za,useState as ei}from"react";import{CgClose as ti,CgInfo as ri}from"react-icons/cg";import{format as ai}from"timeago.js";import{css as D}from"@emotion/react";import{mq as Jn}from"@uniformdev/design-system";var Va=D`
|
|
510
510
|
border: 1px solid var(--gray-200);
|
|
511
511
|
background: var(--gray-50);
|
|
512
512
|
border-radius: var(--rounded-base);
|
|
513
513
|
display: flex;
|
|
514
514
|
width: 100%;
|
|
515
|
-
`,
|
|
515
|
+
`,ka=D`
|
|
516
516
|
align-items: center;
|
|
517
517
|
display: flex;
|
|
518
518
|
flex-grow: 1;
|
|
@@ -520,23 +520,23 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
520
520
|
margin-inline: 0 var(--spacing-sm);
|
|
521
521
|
padding: var(--spacing-base) var(--spacing-base) var(--spacing-base) var(--spacing-lg);
|
|
522
522
|
position: relative;
|
|
523
|
-
`,
|
|
523
|
+
`,Da=D`
|
|
524
524
|
flex-grow: 1;
|
|
525
|
-
`,
|
|
525
|
+
`,_a=D`
|
|
526
526
|
align-items: center;
|
|
527
527
|
display: flex;
|
|
528
528
|
position: relative;
|
|
529
|
-
`,
|
|
529
|
+
`,Ia=D`
|
|
530
530
|
color: var(--brand-secondary-1);
|
|
531
531
|
font-size: var(--fs-base);
|
|
532
532
|
font-weight: var(--fw-bold);
|
|
533
533
|
line-height: 1;
|
|
534
534
|
margin: 0;
|
|
535
535
|
word-break: break-word;
|
|
536
|
-
`,
|
|
536
|
+
`,Ea=D`
|
|
537
537
|
width: 1.5rem;
|
|
538
538
|
height: 1.5rem;
|
|
539
|
-
`,
|
|
539
|
+
`,Ma=D`
|
|
540
540
|
background: var(--white);
|
|
541
541
|
border-radius: var(--rounded-base);
|
|
542
542
|
border-left: 4px solid var(--brand-secondary-3);
|
|
@@ -545,22 +545,22 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
545
545
|
padding: var(--spacing-base);
|
|
546
546
|
z-index: var(--z-10);
|
|
547
547
|
width: max-content;
|
|
548
|
-
`,
|
|
548
|
+
`,ye=D`
|
|
549
549
|
font-size: var(--fs-sm);
|
|
550
|
-
`,
|
|
550
|
+
`,Fe=D`
|
|
551
551
|
font-weight: var(--fw-bold);
|
|
552
552
|
margin-right: var(--spacing-sm);
|
|
553
|
-
`,
|
|
553
|
+
`,Ua=D`
|
|
554
554
|
display: flex;
|
|
555
555
|
flex-direction: column;
|
|
556
556
|
gap: var(--spacing-sm);
|
|
557
557
|
|
|
558
|
-
${
|
|
558
|
+
${Jn("md")} {
|
|
559
559
|
flex-direction: row;
|
|
560
560
|
justify-content: end;
|
|
561
561
|
min-width: 200px;
|
|
562
562
|
}
|
|
563
|
-
`,
|
|
563
|
+
`,xt=D`
|
|
564
564
|
align-items: center;
|
|
565
565
|
background: var(--white);
|
|
566
566
|
border-radius: var(--rounded-base);
|
|
@@ -575,52 +575,40 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
575
575
|
&:hover {
|
|
576
576
|
background: var(--gray-50);
|
|
577
577
|
}
|
|
578
|
-
`,
|
|
578
|
+
`,qa=D`
|
|
579
579
|
display: flex;
|
|
580
580
|
margin-top: var(--spacing-sm);
|
|
581
581
|
gap: var(--spacing-sm);
|
|
582
|
-
`,
|
|
582
|
+
`,Ba=D`
|
|
583
583
|
background: none;
|
|
584
584
|
outline: none;
|
|
585
585
|
border: none;
|
|
586
586
|
margin: calc(var(--spacing-xs) * -1) 0 calc(var(--spacing-xs) * -1) var(--spacing-sm);
|
|
587
|
-
`,
|
|
587
|
+
`,wt=D`
|
|
588
588
|
display: block;
|
|
589
589
|
max-width: 100%;
|
|
590
590
|
min-width: 100px;
|
|
591
591
|
height: auto;
|
|
592
|
-
`;import{Fragment as
|
|
592
|
+
`;import{Fragment as ni,jsx as _,jsxs as I}from"@emotion/react/jsx-runtime";function jc({selectedItem:e,onDeselect:t,onEditClosed:r,logoIcon:a,itemDetailsRendererComponent:o}){let i=za(null),n=za(null),[s,l]=ei(!1);jn(()=>{let u=f=>{i.current&&!i.current.contains(f.target)&&n.current&&!n.current.contains(f.target)&&l(!1)},v=()=>{l(!1)};return window.addEventListener("resize",v,!0),document.addEventListener("scroll",u,!0),document.addEventListener("mousedown",u),()=>{window.removeEventListener("resize",v,!0),document.removeEventListener("scroll",u,!0),document.removeEventListener("mousedown",u)}},[n]);let p=()=>{var u;if(l(!s),n.current&&i.current){let v=(u=i==null?void 0:i.current)==null?void 0:u.getBoundingClientRect();n.current.style.top=`${v.top+30}px`}},d=o!=null?o:oi;return _("div",{css:[Va,be`
|
|
593
593
|
margin: 0 0 1rem 0;
|
|
594
|
-
`],children:
|
|
594
|
+
`],children:I("div",{css:ka,children:[I("div",{css:Da,children:[I("div",{css:_a,children:[_("h4",{css:[Ia],title:`ID: ${e.id}`,"data-test-id":"dam-selected-item",children:e.title||e.id||""}),e.popoverData?I(ni,{children:[_("button",{type:"button",ref:i,css:Ba,"aria-controls":"path-details","aria-expanded":s,onClick:p,children:_(Aa,{icon:ri,iconColor:"gray",size:24,css:be`
|
|
595
595
|
opacity: var(--opacity-75);
|
|
596
|
-
`})}),
|
|
596
|
+
`})}),_("div",{id:"path-details","aria-hidden":!s,ref:n,css:[Ma,s?be`
|
|
597
597
|
visibility: visible;
|
|
598
|
-
`:
|
|
598
|
+
`:be`
|
|
599
599
|
visibility: hidden;
|
|
600
|
-
`],children:Object.entries(e.popoverData).map(([
|
|
600
|
+
`],children:Object.entries(e.popoverData).map(([u,v],f)=>I("div",{css:ye,children:[I("span",{css:Fe,children:[u,":"]}),v]},f))})]}):null]}),_(d,{item:e})]}),I("div",{css:Ua,children:[e.editLink?typeof e.editLink=="string"?I("a",{href:e.editLink,title:"edit",rel:"noopener noreferrer",target:"_blank",onClick:u=>{r&&(He(u.currentTarget.href,()=>r(e)),u.preventDefault())},css:xt,children:[_("span",{css:ye,children:"Edit"}),a?_(W,{src:a,css:Ea,alt:"Logo"}):null]}):e.editLink:null,I("button",{type:"button",onClick:()=>{t(e)},css:xt,children:[_("span",{css:ye,children:"Unlink"}),_(Aa,{icon:ti,iconColor:"red",size:16})]})]})]})},e.id)}function oi({item:e}){let t=null;return e.previewUrl&&typeof e.previewUrl=="string"?e.type==="image"?t=_("img",{src:e.previewUrl,alt:e.id,width:"200",css:wt}):e.type==="video"&&(t=_("video",{src:e.previewUrl,title:e.id,width:"200",controls:!0,css:wt})):e.previewUrl&&typeof e.previewUrl!="string"&&(t=e.previewUrl),t||e.metadata?I("div",{css:qa,children:[t?_("div",{children:t}):null,I("ul",{children:[e.metadata?Object.entries(e.metadata).map(([r,a])=>I("li",{css:[ye,be`
|
|
601
601
|
order: 1;
|
|
602
|
-
`],children:[
|
|
602
|
+
`],children:[I("span",{css:[Fe,be`
|
|
603
603
|
order: 1;
|
|
604
|
-
`],children:[
|
|
605
|
-
background: var(--white);
|
|
606
|
-
`,Na=e=>Oa`
|
|
607
|
-
align-items: start;
|
|
608
|
-
background: ${e};
|
|
609
|
-
display: grid;
|
|
610
|
-
grid-template-columns: 12ch 1fr;
|
|
611
|
-
gap: var(--spacing-sm);
|
|
612
|
-
`;import{jsx as pi}from"@emotion/react/jsx-runtime";var $a=({bgColor:e="transparent",children:t,...o})=>pi("div",{css:Na(e),...o,children:t});import{jsx as bt,jsxs as vi}from"@emotion/react/jsx-runtime";var fi=[{label:"Text",value:"plaintext"},{label:"JSON",value:"json"},{label:"YAML",value:"yaml"},{label:"JavaScript",value:"javascript"},{label:"XML",value:"xml"},{label:"HTML",value:"html"}],Wa={plaintext:"text/plain",json:"application/json",yaml:"application/x-yaml",javascript:"application/javascript",xml:"application/xml",html:"text/html"};function Ep(){let{request:e,dispatch:t}=H(),[o,a]=mi("json");return vi("div",{css:Fa`
|
|
613
|
-
background: var(--white);
|
|
614
|
-
`,children:[bt($a,{bgColor:"var(--gray-100)",css:Fa`
|
|
615
|
-
padding: var(--spacing-sm) var(--spacing-base);
|
|
616
|
-
`,children:bt(gi,{label:"Language",showLabel:!1,options:fi,value:o,onChange:r=>{let n=r.currentTarget.value;a(n),e.body&&t({type:"setBody",body:e.body,contentType:Wa[n]})}})}),bt(ui,{height:200,value:e.body,language:o,options:{language:o,minimap:{enabled:!1},folding:!1},onChange:r=>{r&&t({type:"setBody",body:r,contentType:Wa[o]})}})]})}import{Input as Ka,Table as hi,TableBody as bi,TableCellData as Ke,TableCellHead as Qa,TableHead as yi,TableRow as yt,WarningMessage as xi}from"@uniformdev/design-system";import{jsx as A,jsxs as ue}from"@emotion/react/jsx-runtime";function qp({disableVariables:e}){var r,n;let{dispatch:t,request:o}=H(),a=[...o.headers,{key:"",value:""}];return A("div",{css:We,children:ue(hi,{children:[A(yi,{children:ue(yt,{children:[A(Qa,{children:"Name"}),A(Qa,{children:"Value"})]})}),ue(bi,{children:[(n=(r=o.baseRequest)==null?void 0:r.headers)==null?void 0:n.map(i=>ue(yt,{children:[ue(Ke,{width:"50%",children:[i.key,A("br",{}),A("i",{css:{color:"var(--gray-500)"},children:A("small",{children:"from data source"})})]}),ue(Ke,{width:"50%",children:[A("i",{css:{color:"var(--gray-500)"},children:i.value}),o.headers.find(l=>l.key===i.key)?A(xi,{message:"overridden below"}):null]})]},i.key)),a.map((i,l)=>ue(yt,{children:[A(Ke,{width:"50%",children:A(Ka,{label:i.key,value:i.key,showLabel:!1,onChange:d=>{d.currentTarget.value?t({type:"updateHeader",header:{key:d.currentTarget.value,value:i.value},index:l}):t({type:"removeHeader",index:l})}})}),A(Ke,{width:"50%",children:i.key?A(Ka,{showLabel:!1,label:i.value,value:i.value,onChange:d=>t({type:"updateHeader",header:{key:i.key,value:d.currentTarget.value},index:l})}):null})]},l))]})]})})}import{InputSelect as wi}from"@uniformdev/design-system";import{jsx as Si}from"@emotion/react/jsx-runtime";function Wp(e){var a;let{request:t,dispatch:o}=H();return Si(wi,{...e,options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"HEAD",value:"HEAD"}],value:(a=t.method)!=null?a:"GET",onChange:r=>o({type:"setMethod",method:r.currentTarget.value})})}import{Input as Ya,Table as Ci,TableBody as Ri,TableCellData as Qe,TableCellHead as Za,TableHead as Pi,TableRow as xt,WarningMessage as ki}from"@uniformdev/design-system";import{jsx as z,jsxs as ge}from"@emotion/react/jsx-runtime";function Jp({disableVariables:e}){var r,n;let{dispatch:t,request:o}=H(),a=[...o.parameters,{key:"",value:""}];return z("div",{css:We,children:ge(Ci,{children:[z(Pi,{children:ge(xt,{children:[z(Za,{children:"Name"}),z(Za,{children:"Value"})]})}),ge(Ri,{children:[(n=(r=o.baseRequest)==null?void 0:r.parameters)==null?void 0:n.map(i=>ge(xt,{children:[ge(Qe,{width:"50%",children:[i.key,z("br",{}),z("i",{css:{color:"var(--gray-500)"},children:z("small",{children:"from data source"})})]}),ge(Qe,{width:"50%",children:[z("i",{css:{color:"var(--gray-500)"},children:i.value}),o.parameters.find(l=>l.key===i.key)?z(ki,{message:"overridden below"}):null]})]},i.key)),a.map((i,l)=>ge(xt,{children:[z(Qe,{width:"50%",children:z(Ya,{label:i.key,value:i.key,showLabel:!1,onChange:d=>{d.currentTarget.value?t({type:"updateParameter",parameter:{key:d.currentTarget.value,value:i.value},index:l}):t({type:"removeParameter",index:l})}})}),z(Qe,{width:"50%",children:i.key?z(Ya,{showLabel:!1,label:i.value,value:i.value,onChange:d=>t({type:"updateParameter",parameter:{key:i.key,value:d.currentTarget.value},index:l})}):null})]},l))]})]})})}import{css as Ki}from"@emotion/react";import{useMemo as Qi}from"react";import{Global as Di}from"@emotion/react";import Vi from"@yaireo/tagify/dist/react.tagify";import*as E from"react";import{css as wt}from"@emotion/react";var Xa=wt`
|
|
604
|
+
`],children:[r,":"]}),a]},r)):null,e.createdDate?I("li",{css:ye,children:[_("span",{css:Fe,children:"Date:"}),ai(e.createdDate)]}):null]})]}):null}import{Callout as Ui,Input as qi}from"@uniformdev/design-system";import{createContext as ci,useContext as pi,useEffect as ui,useState as mi}from"react";import{Theme as ii}from"@uniformdev/design-system";import{createContext as si,useContext as li}from"react";import{jsx as Oa,jsxs as di}from"@emotion/react/jsx-runtime";var $e=si(void 0),sp=({children:e})=>{let t;return typeof window!="undefined"&&typeof window.UniformMeshSDK!="undefined"&&(t={sdk:window.UniformMeshSDK}),di($e.Provider,{value:t,children:[Oa(ii,{}),Oa(We,{children:e})]})},Ga=()=>{let e=li($e);if(!e)throw new Error("useUniformMeshSdkContext must be used within <MeshApp /> or <UniformMeshSdkContext />");return e};function Ha(){let{sdk:e}=Ga();return e}import{jsx as gi}from"@emotion/react/jsx-runtime";var Na=ci(void 0),We=({children:e})=>{let t=Ha(),[r,a]=mi(t.getCurrentLocation()),o=i=>{a(n=>({...n,value:i.newValue}))};return ui(()=>(t.events.on("onValueChanged",o),()=>{t.events.off("onValueChanged",o)}),[t]),gi(Na.Provider,{value:{location:r},children:e})},Ke=()=>{let e=pi(Na);if(!e)throw new Error("useUniformMeshLocationContext must be used within a UniformMeshLocationContextProvider");return e};var Fa=!1;function xe(e){let{location:t}=Ke(),r=e;if(e==="dataTypeInstance"&&(r="dataResource",Fa||(console.warn("`dataTypeInstance` mesh location is deprecated, please switch to `dataResource` instead."),Fa=!0)),r&&t.type!==r)throw new Error(`Expected location type ${e} but got ${t.type}`);return{...t,setValue:o=>{let{newValue:i,options:n}=o(t.value);t.setValue(i,n)}}}import{Global as bi}from"@emotion/react";import xi from"@yaireo/tagify/dist/react.tagify";import*as E from"react";import{css as St}from"@emotion/react";var $a=St`
|
|
617
605
|
> * {
|
|
618
606
|
margin: var(--spacing-base) 0 0;
|
|
619
607
|
}
|
|
620
|
-
`,
|
|
608
|
+
`,Wa=St`
|
|
621
609
|
display: flex;
|
|
622
610
|
gap: var(--spacing-sm);
|
|
623
|
-
`,
|
|
611
|
+
`,Ka=St`
|
|
624
612
|
:root {
|
|
625
613
|
--tagify-dd-color-primary: rgb(53, 149, 246);
|
|
626
614
|
--tagify-dd-bg-color: var(--white);
|
|
@@ -1117,14 +1105,14 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
1117
1105
|
opacity: 0;
|
|
1118
1106
|
transition: inherit;
|
|
1119
1107
|
}
|
|
1120
|
-
`;import*as Se from"react";import{Button as
|
|
1108
|
+
`;import*as Se from"react";import{Button as Ya,Input as Ct}from"@uniformdev/design-system";import{Form as fi,Formik as vi}from"formik";import{jsx as we,jsxs as Za}from"@emotion/react/jsx-runtime";function Xa({variable:e,onSubmit:t,onCancel:r}){var o,i,n,s,l,p,d,u,v;let{variables:a}=ne();return we(vi,{initialValues:{name:e,default:(i=(o=a[e])==null?void 0:o.default)!=null?i:"",displayName:(s=(n=a[e])==null?void 0:n.displayName)!=null?s:"",helpText:(p=(l=a[e])==null?void 0:l.helpText)!=null?p:"",order:(d=a[e])==null?void 0:d.order,type:(v=(u=a[e])==null?void 0:u.type)!=null?v:""},onSubmit:f=>{let w={...f,helpText:f.helpText||void 0,type:f.type||void 0,displayName:f.displayName||void 0};return t(w)},children:({getFieldProps:f,initialValues:w})=>Za(fi,{css:$a,children:[we(Ct,{...f("name"),label:"Name",disabled:w.name!=="",caption:"This cannot change once created."}),we(Ct,{...f("helpText"),label:"Help Text",caption:"Appears in the composition data resource when entering a value for this variable.",autoComplete:"off"}),we(Ct,{...f("default"),label:"Default Value",autoComplete:"off"}),Za("div",{css:Wa,children:[we(Ya,{type:"submit",children:"Save"}),we(Ya,{type:"button",buttonType:"ghost",onClick:r,children:"cancel"})]})]})})}import{jsx as hi,jsxs as yi}from"@emotion/react/jsx-runtime";var Ja=Se.createContext(null);function Qe({value:e,onChange:t,editVariableComponent:r,children:a}){let[o,i]=Se.useState(),n=r!=null?r:Xa,s={dispatch:l=>{if(l.type==="set"){let{name:p,...d}=l.variable;t({...s.variables,[l.variable.name]:d}),l.openEditor&&i(l.variable.name)}else if(l.type==="edit")i(l.variable);else if(l.type==="remove"){let p={...e};delete p[l.variable],t(p)}else if(l.type==="reorder")t(l.result);else throw new Error(`Unknown event ${JSON.stringify(l)}`)},variables:e};return yi(Ja.Provider,{value:s,children:[a,typeof o!="undefined"?hi(n,{onSubmit:l=>{i(void 0);let{name:p,...d}=l;t({...e,[p]:d})},onCancel:()=>i(void 0),variable:o}):null]})}function ne(){let e=Se.useContext(Ja);if(!e)throw new Error("No VariablesProvider present");return e}import{Fragment as wi,jsx as ja,jsxs as Si}from"@emotion/react/jsx-runtime";function Rt(e){return e.replace(/\${{.*?"value":"([^"]+)".*?}}/g,"${$1}").replace(/[\r\n]+/g,"")}function eo({"aria-label":e,value:t,disableVariables:r,onChange:a,onPaste:o}){let{variables:i,dispatch:n}=ne(),s=E.useRef(i),l=E.useRef(n),p=E.useRef(a),d=E.useRef();E.useEffect(()=>{s.current=i},[i]),E.useEffect(()=>{l.current=n},[n]),E.useEffect(()=>{p.current=a},[a]),E.useEffect(()=>{var f;((f=d==null?void 0:d.current)==null?void 0:f.DOM)&&o&&(d.current.DOM.input.onpaste=()=>{var w,b;return o(Rt((b=(w=d.current)==null?void 0:w.getInputValue())!=null?b:""))})}),E.useEffect(()=>{var w,b,S;let f=Rt((b=(w=d.current)==null?void 0:w.getInputValue())!=null?b:"");t!==f&&((S=d.current)==null||S.loadOriginalValues(t))},[t]);let u=E.useCallback(f=>{p.current(Rt(f))},[]),v=E.useCallback(f=>{s.current[f]||l.current({type:"set",variable:{name:f,default:""},openEditor:!0})},[]);return Si(wi,{children:[ja(bi,{styles:Ka}),ja(xi,{tagifyRef:d,"aria-label":e,defaultValue:t,autoFocus:!1,whitelist:Object.entries(i).map(([f,w])=>{var b;return{name:(b=w.displayName)!=null?b:f,value:f}}),settings:{pattern:r?null:/\$/,enforceWhitelist:r,mixTagsInterpolator:["${","}"],duplicates:!0,tagTextProp:"name",dropdown:{position:"text",enabled:0,mapValueTo:f=>f.name,includeSelectedTags:!0,searchKeys:["name","value"],highlightFirst:!0}},InputMode:"textarea",onAdd:f=>{var b;let w=(b=f.detail.data)==null?void 0:b.value;w&&v(w)},onRemove:f=>{u(f.detail.tagify.getInputValue())},onChange:f=>{u(f.detail.value)},onInput:f=>{u(f.detail.tagify.getInputValue())}})]})}import{css as Ri}from"@emotion/react";import{AddListButton as Pi,button as Ti,Icon as Li,Table as Vi,TableBody as ki,TableCellData as Pt,TableCellHead as Tt,TableHead as Di,TableRow as no}from"@uniformdev/design-system";import{DragDropContext as _i,Draggable as Ii,Droppable as Ei}from"react-beautiful-dnd";import{css as Ye}from"@emotion/react";var to=e=>Ye`
|
|
1121
1109
|
position: relative;
|
|
1122
1110
|
${e?`
|
|
1123
1111
|
display: table;
|
|
1124
1112
|
left: auto !important;
|
|
1125
1113
|
top: auto !important;
|
|
1126
1114
|
`:void 0}
|
|
1127
|
-
`,
|
|
1115
|
+
`,ro=Ye`
|
|
1128
1116
|
&::after {
|
|
1129
1117
|
content: '';
|
|
1130
1118
|
display: block;
|
|
@@ -1141,7 +1129,7 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
1141
1129
|
&:hover::after {
|
|
1142
1130
|
opacity: 1;
|
|
1143
1131
|
}
|
|
1144
|
-
`,
|
|
1132
|
+
`,ao=Ye`
|
|
1145
1133
|
border: none;
|
|
1146
1134
|
color: var(--brand-secondary-5);
|
|
1147
1135
|
font-weight: var(--fw-medium);
|
|
@@ -1151,15 +1139,27 @@ var Io=Object.defineProperty;var Do=(e,t)=>{for(var o in t)Io(e,o,{get:t[o],enum
|
|
|
1151
1139
|
text-overflow: ellipsis;
|
|
1152
1140
|
white-space: nowrap;
|
|
1153
1141
|
max-width: 20ch;
|
|
1154
|
-
`,
|
|
1142
|
+
`,oo=Ye`
|
|
1155
1143
|
overflow: hidden;
|
|
1156
1144
|
text-overflow: ellipsis;
|
|
1157
1145
|
white-space: nowrap;
|
|
1158
1146
|
max-width: 20ch;
|
|
1159
|
-
`;function
|
|
1147
|
+
`;function Ze(e){return Object.entries(e||{}).sort(([t,r],[a,o])=>{var i,n;return r.order&&o.order?r.order-o.order:r.order?1:o.order?-1:((i=r.displayName)!=null?i:t).localeCompare((n=o.displayName)!=null?n:a)}).map(([t,r])=>({name:t,...r}))}import{Fragment as Mi,jsx as L,jsxs as _e}from"@emotion/react/jsx-runtime";function Jp(){let{variables:e,dispatch:t}=ne(),r=Ze(e),a=o=>{var i,n;if(o.destination&&o.source.droppableId===((i=o.destination)==null?void 0:i.droppableId)){let s=[...r||[]],[l]=(n=s==null?void 0:s.splice(o.source.index,1))!=null?n:[];s==null||s.splice(o.destination.index,0,l);let p=s.reduce((d,u,v)=>({...d,[u.name]:{type:u.type,default:u.default,order:v}}),{});return t({type:"reorder",result:p}),s}};return _e(Mi,{children:[L(_i,{onDragEnd:o=>a(o),children:L(Ei,{droppableId:"variables-table",children:o=>_e(Vi,{...o.droppableProps,ref:o.innerRef,children:[L(Di,{children:_e(no,{children:[L(Tt,{children:"Name"}),L(Tt,{children:"Default Value"}),L(Tt,{})]})}),_e(ki,{children:[r.map(({name:i,displayName:n,default:s},l)=>{let p=n!=null?n:i;return L(Ii,{draggableId:i,index:l,isDragDisabled:r.length===1,children:(d,u)=>_e(no,{ref:d.innerRef,...d.dragHandleProps,...d.draggableProps,id:p,css:to(u.isDragging),"data-dragging":u.isDragging,children:[L(Pt,{css:r.length>1?ro:void 0,children:L("button",{css:ao,type:"button",onClick:v=>{v.preventDefault(),t({type:"edit",variable:i})},title:p,children:p})}),L(Pt,{children:L("span",{css:oo,title:s,children:s})}),L(Pt,{align:"right",children:L("button",{type:"button",title:`delete ${p}`,css:[Ti,Ri`
|
|
1160
1148
|
background: transparent;
|
|
1161
|
-
`],"aria-controls":
|
|
1149
|
+
`],"aria-controls":p,onClick:()=>t({type:"remove",variable:i}),children:L(Li,{icon:"trash",iconColor:"red"})})})]})},i)}),o.placeholder]})]})})}),L(Pi,{onButtonClick:()=>t({type:"edit",variable:""}),"aria-label":"Add variable",buttonText:"add variable",icon:"math-plus",css:{marginLeft:"var(--spacing-md)"}})]})}import{jsx as Ce,jsxs as so}from"@emotion/react/jsx-runtime";function su({setVariables:e,noVariables:t,typeRenderers:r}){let{value:a,metadata:{dataType:o}}=xe("dataTypeInstance"),i=Ze(o.variables);return i.length===0?t?Ce(t,{}):Ce(Ui,{type:"note",children:"No settings are required."}):Ce("div",{children:i.map(n=>{var l,p,d;let s=n.type&&(l=r==null?void 0:r[n.type])!=null?l:io;return Ce("div",{children:Ce(s,{definition:n,value:(d=(p=a==null?void 0:a[n.name])!=null?p:n.default)!=null?d:"",setValue:u=>{e(v=>{let f=u===n.default,w={...v};return f||u===void 0?delete w[n.name]:w[n.name]=u,{newValue:w}})}})},n.name)})})}function io({definition:e,value:t,setValue:r}){return so("div",{children:[Ce(qi,{label:e.displayName||e.name,value:t,caption:e.helpText,onChange:a=>{r(a.target.value)}}),e.default!==""?so("small",{children:["Default value: ",e.default]}):null]})}import{css as mo}from"@emotion/react";import zi from"@monaco-editor/react";import{InputSelect as Oi}from"@uniformdev/design-system";import{useState as Gi}from"react";import*as Re from"react";import{jsx as Bi}from"@emotion/react/jsx-runtime";var lo=Re.createContext(null);function Xe({value:e,onChange:t,children:r}){let a=Re.useMemo(()=>({dispatch:o=>{if(o.type==="setRelativeUrl")t(i=>({...i,relativeUrl:o.relativeUrl}));else if(o.type==="updateParameter")t(i=>{let n=[...i.parameters];return typeof o.index=="number"?n[o.index]=o.parameter:n.push(o.parameter),{...i,parameters:n}});else if(o.type==="removeParameter")t(i=>{let n=[...i.parameters];return n.splice(o.index,1),{...i,parameters:n}});else if(o.type==="updateHeader")t(i=>{let n=[...i.headers];return typeof o.index!="undefined"?n[o.index]=o.header:n.push(o.header),{...i,headers:n}});else if(o.type==="removeHeader")t(i=>{let n=[...i.headers];return n.splice(o.index,1),{...i,headers:n}});else if(o.type==="setMethod")t(i=>({...i,method:o.method}));else if(o.type==="setBody")t(i=>{let n=[...i.headers],s=n.findIndex(({key:l})=>l.trim().toLocaleLowerCase()==="content-type");return s>-1?n[s].value=o.contentType:n.push({key:"Content-Type",value:o.contentType}),{...i,body:o.body,headers:n}});else throw new Error(`Unknown event ${JSON.stringify(o)}`)},request:e}),[t,e]);return Bi(lo.Provider,{value:a,children:r})}function O(){let e=Re.useContext(lo);if(!e)throw new Error("No RequestProvider present");return e}import{css as co}from"@emotion/react";var Je=co`
|
|
1150
|
+
background: var(--white);
|
|
1151
|
+
`,po=e=>co`
|
|
1152
|
+
align-items: start;
|
|
1153
|
+
background: ${e};
|
|
1154
|
+
display: grid;
|
|
1155
|
+
grid-template-columns: 12ch 1fr;
|
|
1156
|
+
gap: var(--spacing-sm);
|
|
1157
|
+
`;import{jsx as Ai}from"@emotion/react/jsx-runtime";var uo=({bgColor:e="transparent",children:t,...r})=>Ai("div",{css:po(e),...r,children:t});import{jsx as Vt,jsxs as Ni}from"@emotion/react/jsx-runtime";var Hi=[{label:"Text",value:"plaintext"},{label:"JSON",value:"json"},{label:"YAML",value:"yaml"},{label:"JavaScript",value:"javascript"},{label:"XML",value:"xml"},{label:"HTML",value:"html"}],go={plaintext:"text/plain",json:"application/json",yaml:"application/x-yaml",javascript:"application/javascript",xml:"application/xml",html:"text/html"};function Pu(){let{request:e,dispatch:t}=O(),[r,a]=Gi("json");return Ni("div",{css:mo`
|
|
1158
|
+
background: var(--white);
|
|
1159
|
+
`,children:[Vt(uo,{bgColor:"var(--gray-100)",css:mo`
|
|
1160
|
+
padding: var(--spacing-sm) var(--spacing-base);
|
|
1161
|
+
`,children:Vt(Oi,{label:"Language",showLabel:!1,options:Hi,value:r,onChange:o=>{let i=o.currentTarget.value;a(i),e.body&&t({type:"setBody",body:e.body,contentType:go[i]})}})}),Vt(zi,{height:200,value:e.body,language:r,options:{language:r,minimap:{enabled:!1},folding:!1},onChange:o=>{o&&t({type:"setBody",body:o,contentType:go[r]})}})]})}import{Input as fo,Table as Fi,TableBody as $i,TableCellData as je,TableCellHead as vo,TableHead as Wi,TableRow as kt,WarningMessage as Ki}from"@uniformdev/design-system";import{jsx as B,jsxs as ue}from"@emotion/react/jsx-runtime";function _u({disableVariables:e}){var o,i;let{dispatch:t,request:r}=O(),a=[...r.headers,{key:"",value:""}];return B("div",{css:Je,children:ue(Fi,{children:[B(Wi,{children:ue(kt,{children:[B(vo,{children:"Name"}),B(vo,{children:"Value"})]})}),ue($i,{children:[(i=(o=r.baseRequest)==null?void 0:o.headers)==null?void 0:i.map(n=>ue(kt,{children:[ue(je,{width:"50%",children:[n.key,B("br",{}),B("i",{css:{color:"var(--gray-500)"},children:B("small",{children:"from data source"})})]}),ue(je,{width:"50%",children:[B("i",{css:{color:"var(--gray-500)"},children:n.value}),r.headers.find(s=>s.key===n.key)?B(Ki,{message:"overridden below"}):null]})]},n.key)),a.map((n,s)=>ue(kt,{children:[B(je,{width:"50%",children:B(fo,{label:n.key,value:n.key,showLabel:!1,onChange:l=>{l.currentTarget.value?t({type:"updateHeader",header:{key:l.currentTarget.value,value:n.value},index:s}):t({type:"removeHeader",index:s})}})}),B(je,{width:"50%",children:n.key?B(fo,{showLabel:!1,label:n.value,value:n.value,onChange:l=>t({type:"updateHeader",header:{key:n.key,value:l.currentTarget.value},index:s})}):null})]},s))]})]})})}import{InputSelect as Qi}from"@uniformdev/design-system";import{jsx as Yi}from"@emotion/react/jsx-runtime";function Au(e){var a;let{request:t,dispatch:r}=O();return Yi(Qi,{...e,options:[{label:"GET",value:"GET"},{label:"POST",value:"POST"},{label:"HEAD",value:"HEAD"}],value:(a=t.method)!=null?a:"GET",onChange:o=>r({type:"setMethod",method:o.currentTarget.value})})}import{Input as ho,Table as Zi,TableBody as Xi,TableCellData as et,TableCellHead as yo,TableHead as Ji,TableRow as Dt,WarningMessage as ji}from"@uniformdev/design-system";import{jsx as A,jsxs as me}from"@emotion/react/jsx-runtime";function Fu({disableVariables:e}){var o,i;let{dispatch:t,request:r}=O(),a=[...r.parameters,{key:"",value:""}];return A("div",{css:Je,children:me(Zi,{children:[A(Ji,{children:me(Dt,{children:[A(yo,{children:"Name"}),A(yo,{children:"Value"})]})}),me(Xi,{children:[(i=(o=r.baseRequest)==null?void 0:o.parameters)==null?void 0:i.map(n=>me(Dt,{children:[me(et,{width:"50%",children:[n.key,A("br",{}),A("i",{css:{color:"var(--gray-500)"},children:A("small",{children:"from data source"})})]}),me(et,{width:"50%",children:[A("i",{css:{color:"var(--gray-500)"},children:n.value}),r.parameters.find(s=>s.key===n.key)?A(ji,{message:"overridden below"}):null]})]},n.key)),a.map((n,s)=>me(Dt,{children:[A(et,{width:"50%",children:A(ho,{label:n.key,value:n.key,showLabel:!1,onChange:l=>{l.currentTarget.value?t({type:"updateParameter",parameter:{key:l.currentTarget.value,value:n.value},index:s}):t({type:"removeParameter",index:s})}})}),A(et,{width:"50%",children:n.key?A(ho,{showLabel:!1,label:n.value,value:n.value,onChange:l=>t({type:"updateParameter",parameter:{key:n.key,value:l.currentTarget.value},index:s})}):null})]},s))]})]})})}import{css as es}from"@emotion/react";import{useMemo as ts}from"react";function bo(e,t){return _t(encodeURI(e),t)}function xo(e,t){return{key:_t(encodeURIComponent(e.key),t),value:_t(encodeURIComponent(e.value),t)}}function _t(e,t){return e.replace(/(\$|%24)%7B(.*?)%7D/g,(r,a,o)=>{var n;let i=decodeURIComponent(o);return(n=t==null?void 0:t[i])!=null&&n.default?t[i].default:`\${${i}}`})}import{Fragment as as,jsx as rs,jsxs as tt}from"@emotion/react/jsx-runtime";function tm(){var a,o;let{variables:e}=ne(),{request:t}=O(),r=ts(()=>{var i;return(i=t.baseRequest)!=null&&i.parameters?t.baseRequest.parameters.filter(n=>!t.parameters.find(s=>s.key===n.key)).concat(t.parameters):t.parameters},[(a=t.baseRequest)==null?void 0:a.parameters,t.parameters]);return tt("small",{css:es`
|
|
1162
1162
|
display: inline-block;
|
|
1163
1163
|
margin-bottom: var(--spacing-xs);
|
|
1164
1164
|
word-break: break-word;
|
|
1165
|
-
`,children:[t.baseRequest?
|
|
1165
|
+
`,children:[t.baseRequest?rs("span",{children:(o=t.baseRequest)==null?void 0:o.baseUrl}):null,tt("span",{css:{fontWeight:t.baseRequest?"bold":"inherit"},children:[bo(t.relativeUrl,e),r.length>0?tt(as,{children:["?",r.map((i,n)=>{let s=xo(i,e);return tt("span",{children:[n>0?"&":null,s.key,"=",s.value]},n)})]}):null]})]})}import{jsx as os}from"@emotion/react/jsx-runtime";function lm(e){let{request:t,dispatch:r}=O();return os(eo,{...e,value:t.relativeUrl,onPaste:a=>{var i,n,s;let o=a.indexOf("?");if(o>=0){let l=a.substring(0,o);((i=t.baseRequest)==null?void 0:i.baseUrl)&&l.startsWith((n=t.baseRequest)==null?void 0:n.baseUrl)&&(l=l.substring((s=t.baseRequest)==null?void 0:s.baseUrl.length)),r({type:"setRelativeUrl",relativeUrl:l});for(let p=t.parameters.length-1;p>=0;p--)r({type:"removeParameter",index:p});try{new URLSearchParams(a.substring(o)).forEach((d,u)=>{r({type:"updateParameter",parameter:{key:u,value:d}})})}catch(p){}}},onChange:a=>{r({type:"setRelativeUrl",relativeUrl:a})}})}import{jsx as So}from"@emotion/react/jsx-runtime";function hm({onChange:e,children:t}){var o;let{value:r}=xe("dataSource"),a=wo(r);return So(Qe,{value:(o=r.variables)!=null?o:{},onChange:i=>e(n=>({newValue:{...n,variables:i}})),children:So(Xe,{value:a,onChange:i=>{e(n=>{let s=wo(n),l=i(s);return{newValue:ns(n,l)}})},children:t})})}function wo(e){var t,r,a;return{headers:(t=e==null?void 0:e.headers)!=null?t:[],parameters:(r=e==null?void 0:e.parameters)!=null?r:[],relativeUrl:(a=e==null?void 0:e.baseUrl)!=null?a:""}}function ns(e,t){return{...e,baseUrl:t.relativeUrl,headers:t.headers.length?t.headers:void 0,parameters:t.parameters}}import{jsx as Ro}from"@emotion/react/jsx-runtime";function Tm({onChange:e,children:t}){var i;let{value:r,metadata:{dataSource:a}}=xe("dataType"),o=Co(r,a);return Ro(Qe,{value:(i=r.variables)!=null?i:{},onChange:n=>e(s=>({newValue:{...s,variables:n}})),children:Ro(Xe,{value:o,onChange:n=>{e(s=>{let l=Co(s,a),p=n(l);return{newValue:is(s,p)}})},children:t})})}function Co(e,t){var r,a;return{...e,headers:(r=e.headers)!=null?r:[],parameters:(a=e.parameters)!=null?a:[],relativeUrl:e.path,baseRequest:{baseUrl:t.baseUrl,headers:t.headers,parameters:t.parameters}}}function is(e,t){var r;return{...e,path:t.relativeUrl,headers:t.headers.length?t.headers:void 0,parameters:t.parameters.length?t.parameters:void 0,method:(r=t.method)!=null?r:"GET",body:t.body}}import{LoadingIndicator as cs,Theme as ps}from"@uniformdev/design-system";import{initializeUniformMeshSDK as ss}from"@uniformdev/mesh-sdk";import{useEffect as ls,useRef as ds,useState as Po}from"react";var To=({autoResizingDisabled:e}={})=>{let[t,r]=Po(),[a,o]=Po(),i=ds(!1);return ls(()=>{typeof window=="undefined"||a||(typeof window.UniformMeshSDK=="undefined"&&!i.current?(i.current=!0,ss({autoResizingDisabled:e}).then(n=>{o(n)}).catch(n=>{r(n)}).finally(()=>{i.current=!1})):o(window.UniformMeshSDK))},[e]),{initializing:!a&&!t,error:t,sdk:a}};import{jsx as Ie,jsxs as us}from"@emotion/react/jsx-runtime";var zm=({children:e,loadingComponent:t,errorComponent:r})=>{let{initializing:a,error:o,sdk:i}=To();if(a||!i){let n=t;return n?Ie(n,{}):Ie(cs,{})}if(o){let n=r;if(n)return Ie(n,{error:o});throw o}return us($e.Provider,{value:{sdk:i},children:[Ie(ps,{}),Ie(We,{children:e})]})};function Fm(){let{location:e}=Ke();return e}function Km(e,t){return r=>e(a=>{let{newValue:o,options:i}=r(a);return{newValue:o,options:t(o,i)}})}import{AddListButton as rg,Button as ag,Callout as og,Heading as ng,Input as ig,InputComboBox as sg,InputKeywordSearch as lg,InputSelect as dg,InputToggle as cg,InputKeywordSearch as pg,Label as ug,LoadingIndicator as mg,LoadingOverlay as gg,Menu as fg,MenuItem as vg,ScrollableList as hg,ScrollableListItem as yg,Switch as bg,Textarea as xg,Theme as wg}from"@uniformdev/design-system";export*from"@uniformdev/mesh-sdk";export{rg as AddListButton,ag as Button,og as Callout,jc as DamSelectedItem,su as DataResourceVariablesList,hm as DataSourceEditor,Tm as DataTypeEditor,zr as DefaultSearchRow,Zr as DefaultSelectedItem,ca as EntrySearch,ng as Heading,it as Icons,ig as Input,sg as InputComboBox,lg as InputKeywordSearch,dg as InputSelect,cg as InputToggle,eo as InputVariables,pg as KeywordSearchInput,ug as Label,mg as LoadingIndicator,gg as LoadingOverlay,fg as Menu,vg as MenuItem,zm as MeshApp,br as ProductPreviewList,Nl as ProductQuery,hr as ProductQueryContext,qc as ProductSearch,La as ProductSearchContext,ba as ProductSearchRow,Ta as ProductSelectedItem,Pu as RequestBody,_u as RequestHeaders,Au as RequestMethodSelect,Fu as RequestParameters,Xe as RequestProvider,uo as RequestTypeContainer,tm as RequestUrl,lm as RequestUrlInput,sr as ResolvableLoadingValue,hg as ScrollableList,yg as ScrollableListItem,ur as SelectionField,bg as Switch,io as TextVariableRenderer,xg as Textarea,wg as Theme,Na as UniformMeshLocationContext,We as UniformMeshLocationContextProvider,$e as UniformMeshSdkContext,sp as UniformMeshSdkContextProvider,Xa as VariableEditor,Jp as VariablesList,Qe as VariablesProvider,mt as badgeIcon,Km as createLocationValidator,wt as damSelectItemImage,Va as damSelectedItemContainer,_a as damSelectedItemCopy,Da as damSelectedItemDetails,Ea as damSelectedItemIcon,Ba as damSelectedItemInfoBtn,ka as damSelectedItemInner,xt as damSelectedItemLinkBtn,Ua as damSelectedItemLinkContainer,qa as damSelectedItemMediaContainer,Ma as damSelectedItemPopover,Fe as damSelectedItemPopoverLabel,ye as damSelectedItemSmallText,Ia as damSelectedItemTitle,sa as draggableContainer,ut as draggableIcon,da as draggableIconOffset,la as draggableIconWrapper,ea as entrySearchBtn,ra as entrySearchConfig,aa as entrySearchConfigHidden,ta as entrySearchLoadMoreBtn,oa as entrySearchResultList,na as entrySearchSelectIcon,ia as entrySearchSelectImg,Bd as entrySearchSelectInput,Ad as entrySearchSelectOption,jr as entrySearchWrapper,ha as productSearchRowActiveIcon,fa as productSearchRowCategory,pa as productSearchRowContainer,ua as productSearchRowContent,ma as productSearchRowContentActive,va as productSearchRowDetails,ga as productSearchRowTitle,wa as productSelectedItemContainer,Ca as productSelectedItemContent,Sa as productSelectedItemDetails,Ra as productSelectedItemIcon,vt as productSelectedItemImage,Pa as productSelectedItemLinkContainer,ht as productedSelectedItemLinkBtn,yt as productedSelectedItemSmallText,Ur as searchRowBtn,_r as searchRowContainer,Er as searchRowContainerActive,Ir as searchRowContainerWithPopover,Mr as searchRowPopover,ct as searchRowText,dt as searchRowTextSmall,pt as selectItemLinkBtn,Kr as selectItemLinkContainer,Wr as selectItemPopover,De as selectItemPopoverLabel,ce as selectItemSmallText,Or as selectedItemContainer,Nr as selectedItemCopy,Hr as selectedItemDetails,$r as selectedItemIcon,Gr as selectedItemInner,Fr as selectedItemTitle,xo as urlEncodeRequestParameter,bo as urlEncodeRequestUrl,To as useInitializeUniformMeshSdk,xe as useMeshLocation,yr as useProductQueryContext,Ne as useProductSearchContext,O as useRequest,Fm as useUniformMeshLocation,Ke as useUniformMeshLocationContext,Ha as useUniformMeshSdk,Ga as useUniformMeshSdkContext,ne as useVariables,Ze as variablesToList};
|