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