@bikdotai/bik-component-library 0.0.499-1 → 0.0.499-3

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.
Files changed (29) hide show
  1. package/dist/cjs/components/add-variableV2/AddVariableBox.styled.d.ts +1 -3
  2. package/dist/cjs/components/add-variableV2/AddVariableBox.styled.js +22 -22
  3. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +0 -2
  4. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
  5. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.d.ts +0 -1
  6. package/dist/cjs/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.js +1 -1
  7. package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +0 -1
  8. package/dist/cjs/components/input-with-vars/InputWithVariables.js +2 -1
  9. package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
  10. package/dist/cjs/components/product-picker-v2/modal.d.ts +1 -0
  11. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  12. package/dist/cjs/components/product-picker-v2/product.js +1 -1
  13. package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
  14. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  15. package/dist/esm/components/add-variableV2/AddVariableBox.styled.d.ts +1 -3
  16. package/dist/esm/components/add-variableV2/AddVariableBox.styled.js +22 -22
  17. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.d.ts +0 -2
  18. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.js +1 -1
  19. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.d.ts +0 -1
  20. package/dist/esm/components/analytics-chips-and-dropdowns/chart/LineChart/LineChart.styled.js +1 -1
  21. package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +0 -1
  22. package/dist/esm/components/input-with-vars/InputWithVariables.js +2 -1
  23. package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
  24. package/dist/esm/components/product-picker-v2/modal.d.ts +1 -0
  25. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  26. package/dist/esm/components/product-picker-v2/product.js +1 -1
  27. package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
  28. package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -1
  29. package/package.json +1 -1
@@ -1,3 +1 @@
1
- export declare const AddVariableStyled: import("styled-components").StyledComponent<"button", any, {
2
- right: string;
3
- }, never>;
1
+ export declare const AddVariableStyled: import("styled-components").StyledComponent<"button", any, {}, never>;
@@ -1,25 +1,25 @@
1
1
  "use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t:{default:t}}Object.defineProperty(exports,"__esModule",{value:!0});const e=t(require("styled-components")).default.button`
2
- padding: 2px 8px;
3
- position: absolute;
4
- right: ${t=>t.right};
5
- cursor: pointer;
6
- color: white;
7
- background-color: black;
8
- width: fit-content;
9
- float: right;
10
- margin-top: 0px;
11
- font-family: Inter;
12
- font-style: normal;
13
- font-weight: 600;
14
- font-size: 14px;
15
- line-height: 20px;
16
- border-radius: 4px;
17
- border: 1px solid #ccc;
18
- margin-right: 1px;
19
- z-index: 100;
2
+ padding: 2px 8px;
3
+ position: absolute;
4
+ right: 0px;
5
+ cursor: pointer;
6
+ color: white;
7
+ background-color: black;
8
+ width: fit-content;
9
+ float: right;
10
+ margin-top: 0px;
11
+ font-family: Inter;
12
+ font-style: normal;
13
+ font-weight: 600;
14
+ font-size: 14px;
15
+ line-height: 20px;
16
+ border-radius: 4px;
17
+ border: 1px solid #ccc;
18
+ margin-right: 1px;
19
+ z-index: 100;
20
20
 
21
- .add {
22
- display: flex;
23
- align-items: center;
24
- }
21
+ .add {
22
+ display: flex;
23
+ align-items: center;
24
+ }
25
25
  `;exports.AddVariableStyled=e;
@@ -9,7 +9,6 @@ export type LineChartProps = {
9
9
  dotted?: boolean;
10
10
  gradient?: boolean;
11
11
  legend?: string;
12
- squareLegends?: boolean;
13
12
  }[];
14
13
  labels: Array<string>;
15
14
  scaleText?: {
@@ -22,7 +21,6 @@ export type LineChartProps = {
22
21
  min?: number;
23
22
  max?: number;
24
23
  isZeroState?: boolean;
25
- lineThickness?: number;
26
24
  ticksLabelCallback?: (val: string, index: number) => void;
27
25
  };
28
26
  export declare const LineChart: React.FC<LineChartProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("chart.js"),r=require("react"),l=require("react-chartjs-2"),i=require("../../../TypographyStyle.js"),n=require("../../../../constants/Theme.js"),a=require("./LineChart.styled.js");t.Chart.register(t.CategoryScale,t.LinearScale,t.PointElement,t.BarElement,t.LineElement,t.ArcElement,t.Filler,t.Title,t.Tooltip,t.Legend);exports.LineChart=t=>{let{scaleText:o,labels:s,canvasHeight:d,datas:c,maintainAspectRatio:u=!1,stepSize:g,min:p,max:y,isZeroState:C,lineThickness:b,ticksLabelCallback:v}=t;var h;const[m,x]=r.useState(null),O=r.useRef();r.useEffect((()=>{var e,t,r,l;if(null===(l=null===(r=null===(t=null===(e=O.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.y)||void 0===r?void 0:r.ticks)||void 0===l?void 0:l.length){const e=38*O.current.scales.y.ticks.length;x(e)}}),[O]);const L=c.map((e=>({text:e.legend,color:e.lineColor?e.lineColor:e.dotted?n.COLORS.content.placeholder:n.COLORS.background.brand,square:e.squareLegends})));return e.jsxs("div",Object.assign({style:Object.assign(Object.assign({},u?{}:{height:null!==(h=null!=d?d:m)&&void 0!==h?h:204}),{display:"flex",flexDirection:"column",gap:2})},{children:[e.jsx(a.LegendWrapper,{children:L.map(((t,r)=>{let{text:l,color:n,square:o}=t;return l?e.jsxs(a.LegendContainer,{children:[e.jsx(a.LegendColor,{color:n,square:o}),e.jsx(i.SmallRegular,Object.assign({color:"#667085"},{children:l}))]},r):e.jsx(e.Fragment,{})}))}),e.jsx(l.Line,{ref:O,options:{maintainAspectRatio:u,responsive:!0,plugins:{legend:{display:!1},title:{display:!1},tooltip:{displayColors:!1,titleFont:()=>({weight:"600",size:14,family:"inter"}),titleColor:()=>n.COLORS.content.primaryInverse,backgroundColor:n.COLORS.content.primary,callbacks:{labelTextColor:()=>n.COLORS.content.primaryInverse},bodyFont:()=>({weight:"400",size:14,family:"inter"})}},scales:{y:{beginAtZero:!0,min:C?0:p,max:C?10:y,ticks:{color:n.COLORS.content.secondary,callback:e=>{var t;return`${null!==(t=null==o?void 0:o.yPrefix)&&void 0!==t?t:""}${e}`},font:{family:"inter",size:12,weight:"400"},stepSize:C?1:g},title:{display:!!(null==o?void 0:o.y),text:null==o?void 0:o.y},grid:{color:n.COLORS.background.base}},x:{ticks:{callback:v,color:n.COLORS.content.secondary,font:{family:"inter",size:12,weight:"400"}},title:{display:!!(null==o?void 0:o.x),text:null==o?void 0:o.x},grid:{display:!1,drawBorder:!1}}}},data:{labels:s,datasets:c.map(((e,t)=>{var r;return{tension:.4,fill:e.gradient?"start":0,pointRadius:1,borderDash:e.dotted?[8,3]:void 0,data:e.data,borderWidth:null!=b?b:2,borderColor:e.lineColor?e.lineColor:e.dotted?n.COLORS.content.placeholder:n.COLORS.background.brand,backgroundColor:e.gradient?e=>{const t=e.chart.ctx.createLinearGradient(0,0,0,m?m-75:150);return t.addColorStop(0,"#F1EEFB"),t.addColorStop(1,"rgba(127, 86, 217, 0)"),t}:null!==(r=e.backgroundColor)&&void 0!==r?r:"transparent"}}))}})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("chart.js"),r=require("react"),l=require("react-chartjs-2"),i=require("../../../TypographyStyle.js"),n=require("../../../../constants/Theme.js"),o=require("./LineChart.styled.js");t.Chart.register(t.CategoryScale,t.LinearScale,t.PointElement,t.BarElement,t.LineElement,t.ArcElement,t.Filler,t.Title,t.Tooltip,t.Legend);exports.LineChart=t=>{let{scaleText:a,labels:s,canvasHeight:d,datas:c,maintainAspectRatio:u=!1,stepSize:g,min:p,max:y,isZeroState:C,ticksLabelCallback:b}=t;var v;const[h,m]=r.useState(null),x=r.useRef();r.useEffect((()=>{var e,t,r,l;if(null===(l=null===(r=null===(t=null===(e=x.current)||void 0===e?void 0:e.scales)||void 0===t?void 0:t.y)||void 0===r?void 0:r.ticks)||void 0===l?void 0:l.length){const e=38*x.current.scales.y.ticks.length;m(e)}}),[x]);const O=c.map((e=>({text:e.legend,color:e.lineColor?e.lineColor:e.dotted?n.COLORS.content.placeholder:n.COLORS.background.brand})));return e.jsxs("div",Object.assign({style:Object.assign(Object.assign({},u?{}:{height:null!==(v=null!=d?d:h)&&void 0!==v?v:204}),{display:"flex",flexDirection:"column",gap:2})},{children:[e.jsx(o.LegendWrapper,{children:O.map(((t,r)=>{let{text:l,color:n}=t;return l?e.jsxs(o.LegendContainer,{children:[e.jsx(o.LegendColor,{color:n}),e.jsx(i.SmallRegular,Object.assign({color:"#667085"},{children:l}))]},r):e.jsx(e.Fragment,{})}))}),e.jsx(l.Line,{ref:x,options:{maintainAspectRatio:u,responsive:!0,plugins:{legend:{display:!1},title:{display:!1},tooltip:{displayColors:!1,titleFont:()=>({weight:"600",size:14,family:"inter"}),titleColor:()=>n.COLORS.content.primaryInverse,backgroundColor:n.COLORS.content.primary,callbacks:{labelTextColor:()=>n.COLORS.content.primaryInverse},bodyFont:()=>({weight:"400",size:14,family:"inter"})}},scales:{y:{beginAtZero:!0,min:C?0:p,max:C?10:y,ticks:{color:n.COLORS.content.secondary,callback:e=>{var t;return`${null!==(t=null==a?void 0:a.yPrefix)&&void 0!==t?t:""}${e}`},font:{family:"inter",size:12,weight:"400"},stepSize:C?1:g},title:{display:!!(null==a?void 0:a.y),text:null==a?void 0:a.y},grid:{color:n.COLORS.background.base}},x:{ticks:{callback:b,color:n.COLORS.content.secondary,font:{family:"inter",size:12,weight:"400"}},title:{display:!!(null==a?void 0:a.x),text:null==a?void 0:a.x},grid:{display:!1,drawBorder:!1}}}},data:{labels:s,datasets:c.map(((e,t)=>{var r;return{tension:.4,fill:e.gradient?"start":0,pointRadius:1,borderDash:e.dotted?[8,3]:void 0,data:e.data,borderWidth:2,borderColor:e.lineColor?e.lineColor:e.dotted?n.COLORS.content.placeholder:n.COLORS.background.brand,backgroundColor:e.gradient?e=>{const t=e.chart.ctx.createLinearGradient(0,0,0,h?h-75:150);return t.addColorStop(0,"#F1EEFB"),t.addColorStop(1,"rgba(127, 86, 217, 0)"),t}:null!==(r=e.backgroundColor)&&void 0!==r?r:"transparent"}}))}})]}))};
@@ -8,7 +8,6 @@ export declare const LegendColor: import("@emotion/styled").StyledComponent<{
8
8
  as?: import("react").ElementType<any> | undefined;
9
9
  } & {
10
10
  color: string;
11
- square?: boolean | undefined;
12
11
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
13
12
  export declare const LegendWrapper: import("@emotion/styled").StyledComponent<{
14
13
  theme?: import("@emotion/react").Theme | undefined;
@@ -1 +1 @@
1
- "use strict";function c(c){return c&&"object"==typeof c&&"default"in c?c:{default:c}}Object.defineProperty(exports,"__esModule",{value:!0});var e=c(require("@emotion/styled/base"));const l=e.default("div","production"===process.env.NODE_ENV?{target:"eyesbkg2"}:{target:"eyesbkg2",label:"LegendContainer"})("production"===process.env.NODE_ENV?{name:"nqbxsj",styles:"display:flex;flex-direction:row;gap:8px;align-items:center"}:{name:"nqbxsj",styles:"display:flex;flex-direction:row;gap:8px;align-items:center",map:"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxpbmVDaGFydC5zdHlsZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQzBDIiwiZmlsZSI6IkxpbmVDaGFydC5zdHlsZWQudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRDb250YWluZXIgPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0ZmxleC1kaXJlY3Rpb246IHJvdztcblx0Z2FwOiA4cHg7XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xyXG5leHBvcnQgY29uc3QgTGVnZW5kQ29sb3IgPSBzdHlsZWQuZGl2IGBcblx0d2lkdGg6ICR7KHByb3BzKSA9PiAocHJvcHMuc3F1YXJlID8gMTYgOiA4KX1weDtcblx0aGVpZ2h0OiAkeyhwcm9wcykgPT4gKHByb3BzLnNxdWFyZSA/IDE2IDogOCl9cHg7XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IHByb3BzLmNvbG9yfTtcbmA7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRXcmFwcGVyID0gc3R5bGVkLmRpdiBgXG5cdGRpc3BsYXk6IGZsZXg7XG5cdGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cdGdhcDogMTJweDtcblx0anVzdGlmeS1jb250ZW50OiAkeyhwcm9wcykgPT4gKHByb3BzLnBvc2l0aW9uID8gcHJvcHMucG9zaXRpb24gOiAnZW5kJyl9O1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9TGluZUNoYXJ0LnN0eWxlZC5qcy5tYXAiXX0= */",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),d=e.default("div","production"===process.env.NODE_ENV?{target:"eyesbkg1"}:{target:"eyesbkg1",label:"LegendColor"})("width:",(c=>c.square?16:8),"px;height:",(c=>c.square?16:8),"px;border-radius:4px;background:",(c=>c.color),";"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxpbmVDaGFydC5zdHlsZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT3NDIiwiZmlsZSI6IkxpbmVDaGFydC5zdHlsZWQudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRDb250YWluZXIgPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0ZmxleC1kaXJlY3Rpb246IHJvdztcblx0Z2FwOiA4cHg7XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xyXG5leHBvcnQgY29uc3QgTGVnZW5kQ29sb3IgPSBzdHlsZWQuZGl2IGBcblx0d2lkdGg6ICR7KHByb3BzKSA9PiAocHJvcHMuc3F1YXJlID8gMTYgOiA4KX1weDtcblx0aGVpZ2h0OiAkeyhwcm9wcykgPT4gKHByb3BzLnNxdWFyZSA/IDE2IDogOCl9cHg7XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IHByb3BzLmNvbG9yfTtcbmA7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRXcmFwcGVyID0gc3R5bGVkLmRpdiBgXG5cdGRpc3BsYXk6IGZsZXg7XG5cdGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cdGdhcDogMTJweDtcblx0anVzdGlmeS1jb250ZW50OiAkeyhwcm9wcykgPT4gKHByb3BzLnBvc2l0aW9uID8gcHJvcHMucG9zaXRpb24gOiAnZW5kJyl9O1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9TGluZUNoYXJ0LnN0eWxlZC5qcy5tYXAiXX0= */")),b=e.default("div","production"===process.env.NODE_ENV?{target:"eyesbkg0"}:{target:"eyesbkg0",label:"LegendWrapper"})("display:flex;flex-direction:row;gap:12px;justify-content:",(c=>c.position?c.position:"end"),";"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxpbmVDaGFydC5zdHlsZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBYXdDIiwiZmlsZSI6IkxpbmVDaGFydC5zdHlsZWQudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRDb250YWluZXIgPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0ZmxleC1kaXJlY3Rpb246IHJvdztcblx0Z2FwOiA4cHg7XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xyXG5leHBvcnQgY29uc3QgTGVnZW5kQ29sb3IgPSBzdHlsZWQuZGl2IGBcblx0d2lkdGg6ICR7KHByb3BzKSA9PiAocHJvcHMuc3F1YXJlID8gMTYgOiA4KX1weDtcblx0aGVpZ2h0OiAkeyhwcm9wcykgPT4gKHByb3BzLnNxdWFyZSA/IDE2IDogOCl9cHg7XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IHByb3BzLmNvbG9yfTtcbmA7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRXcmFwcGVyID0gc3R5bGVkLmRpdiBgXG5cdGRpc3BsYXk6IGZsZXg7XG5cdGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cdGdhcDogMTJweDtcblx0anVzdGlmeS1jb250ZW50OiAkeyhwcm9wcykgPT4gKHByb3BzLnBvc2l0aW9uID8gcHJvcHMucG9zaXRpb24gOiAnZW5kJyl9O1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9TGluZUNoYXJ0LnN0eWxlZC5qcy5tYXAiXX0= */"));exports.LegendColor=d,exports.LegendContainer=l,exports.LegendWrapper=b;
1
+ "use strict";function c(c){return c&&"object"==typeof c&&"default"in c?c:{default:c}}Object.defineProperty(exports,"__esModule",{value:!0});var e=c(require("@emotion/styled/base"));const d=e.default("div","production"===process.env.NODE_ENV?{target:"eyesbkg2"}:{target:"eyesbkg2",label:"LegendContainer"})("production"===process.env.NODE_ENV?{name:"nqbxsj",styles:"display:flex;flex-direction:row;gap:8px;align-items:center"}:{name:"nqbxsj",styles:"display:flex;flex-direction:row;gap:8px;align-items:center",map:"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxpbmVDaGFydC5zdHlsZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQzBDIiwiZmlsZSI6IkxpbmVDaGFydC5zdHlsZWQudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRDb250YWluZXIgPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0ZmxleC1kaXJlY3Rpb246IHJvdztcblx0Z2FwOiA4cHg7XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xyXG5leHBvcnQgY29uc3QgTGVnZW5kQ29sb3IgPSBzdHlsZWQuZGl2IGBcblx0d2lkdGg6IDhweDtcblx0aGVpZ2h0OiA4cHg7XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IHByb3BzLmNvbG9yfTtcbmA7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRXcmFwcGVyID0gc3R5bGVkLmRpdiBgXG5cdGRpc3BsYXk6IGZsZXg7XG5cdGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cdGdhcDogMTJweDtcblx0anVzdGlmeS1jb250ZW50OiAkeyhwcm9wcykgPT4gKHByb3BzLnBvc2l0aW9uID8gcHJvcHMucG9zaXRpb24gOiAnZW5kJyl9O1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9TGluZUNoYXJ0LnN0eWxlZC5qcy5tYXAiXX0= */",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),l=e.default("div","production"===process.env.NODE_ENV?{target:"eyesbkg1"}:{target:"eyesbkg1",label:"LegendColor"})("width:8px;height:8px;border-radius:4px;background:",(c=>c.color),";"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxpbmVDaGFydC5zdHlsZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT3NDIiwiZmlsZSI6IkxpbmVDaGFydC5zdHlsZWQudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRDb250YWluZXIgPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0ZmxleC1kaXJlY3Rpb246IHJvdztcblx0Z2FwOiA4cHg7XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xyXG5leHBvcnQgY29uc3QgTGVnZW5kQ29sb3IgPSBzdHlsZWQuZGl2IGBcblx0d2lkdGg6IDhweDtcblx0aGVpZ2h0OiA4cHg7XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IHByb3BzLmNvbG9yfTtcbmA7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRXcmFwcGVyID0gc3R5bGVkLmRpdiBgXG5cdGRpc3BsYXk6IGZsZXg7XG5cdGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cdGdhcDogMTJweDtcblx0anVzdGlmeS1jb250ZW50OiAkeyhwcm9wcykgPT4gKHByb3BzLnBvc2l0aW9uID8gcHJvcHMucG9zaXRpb24gOiAnZW5kJyl9O1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9TGluZUNoYXJ0LnN0eWxlZC5qcy5tYXAiXX0= */")),b=e.default("div","production"===process.env.NODE_ENV?{target:"eyesbkg0"}:{target:"eyesbkg0",label:"LegendWrapper"})("display:flex;flex-direction:row;gap:12px;justify-content:",(c=>c.position?c.position:"end"),";"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxpbmVDaGFydC5zdHlsZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBYXdDIiwiZmlsZSI6IkxpbmVDaGFydC5zdHlsZWQudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRDb250YWluZXIgPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0ZmxleC1kaXJlY3Rpb246IHJvdztcblx0Z2FwOiA4cHg7XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xyXG5leHBvcnQgY29uc3QgTGVnZW5kQ29sb3IgPSBzdHlsZWQuZGl2IGBcblx0d2lkdGg6IDhweDtcblx0aGVpZ2h0OiA4cHg7XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IHByb3BzLmNvbG9yfTtcbmA7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRXcmFwcGVyID0gc3R5bGVkLmRpdiBgXG5cdGRpc3BsYXk6IGZsZXg7XG5cdGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cdGdhcDogMTJweDtcblx0anVzdGlmeS1jb250ZW50OiAkeyhwcm9wcykgPT4gKHByb3BzLnBvc2l0aW9uID8gcHJvcHMucG9zaXRpb24gOiAnZW5kJyl9O1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9TGluZUNoYXJ0LnN0eWxlZC5qcy5tYXAiXX0= */"));exports.LegendColor=l,exports.LegendContainer=d,exports.LegendWrapper=b;
@@ -7,7 +7,6 @@ export interface InputWithVariablesProps {
7
7
  variablesList: any;
8
8
  onChange: (val: SelectedVariable) => void;
9
9
  onBlur?: (e: Event, val?: SelectedVariable | Variable) => void;
10
- addVarBoxRight: string;
11
10
  allowMix: boolean;
12
11
  prevVariable: SelectedVariable;
13
12
  showHelp?: boolean;
@@ -1,6 +1,7 @@
1
1
  "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../assets/icons/PlusIcon.js"),l=require("react"),r=require("styled-components"),t=require("uuid"),i=require("../../constants/Theme.js"),d=require("../add-variableV2/AddVariableV2SideModal.js"),s=require("../add-variableV2/AddVariableV2.js"),u=require("../add-variableV2/AddVariableBox.styled.js"),n=require("../input/Input.js"),o=require("../TypographyStyle.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const v=c(r).default.div`
2
+ position: relative;
2
3
  margin-bottom: 16px;
3
4
  input {
4
5
  color: ${e=>e.isVar?i.COLORS.stroke.brand:"black"};
5
6
  }
6
- `;exports.InputWithVariables=r=>{let{type:i,addVarBoxRight:c,allowMix:b,onChange:h,prevVariable:g,variablesList:V,onBlur:p,onlyVariables:x,placeHolder:T,showAddButton:j=!0,showHelp:y,showSideVariablePanel:f,errorMessage:m,showSideModal:S,maxCharLimit:q,noMaxCharCheck:C,labelText:w,labelElement:A,isRequired:O=!1,hintText:k}=r;const B=l.useRef(!0),M=l.useRef(null),[L,N]=l.useState(!1),[R]=l.useState(t.v4()),[E,I]=l.useState(),[F,P]=l.useState(g),[Z,$]=l.useState(!1),[z,H]=l.useState(!1),[W,_]=l.useState(0);return l.useEffect((()=>{if(E&&E.actualValue)if(b){if(P((e=>{return{actualValue:(a=e.actualValue,l=E.actualValue,r=W,a.slice(0,r)+l+a.slice(r)),variableType:"string"};var a,l,r})),M.current){_(M.current.selectionStart);const e=W+E.actualValue.length+2;M.current.setSelectionRange(e,e),_(e)}}else P((e=>({actualValue:E.actualValue,variableType:E.variableType,needsFetching:E.needsFetching})))}),[E]),l.useEffect((()=>{B.current?B.current=!1:h(F)}),[F]),e.jsxs(e.Fragment,{children:[e.jsxs(v,Object.assign({isVar:/^{{.*}}$/.test(F.actualValue)},{children:[e.jsx(n.Input,{isRequired:O,hintText:k,type:null!=i?i:"text",id:R,ref:M,skipFocus:!0,isActive:L,value:F.actualValue,validate:e=>[!0,""],errorMessage:m,noMaxCharCheck:C,maxCharLimit:q,labelText:w,labelElement:A,placeholder:T||"Add a value",onClick:e=>{M.current&&_(M.current.selectionStart)},onChangeText:(e,a)=>{if(M.current&&_(M.current.selectionStart),x){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||P({actualValue:"",variableType:"string"})}else P(b?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{N(!0),H(!0),document.getElementById("varList")&&!Z&&$(!0)},onBlur:e=>{var a,l,r,t,i,d,s;null==p||p(e,F),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"varList"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(t=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===t?void 0:t.includes("exlualr0"))||(null===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?(M.current&&M.current.focus(),N(!0)):"search-bar"===(null===(s=e.relatedTarget)||void 0===s?void 0:s.id)?N(!0):(N(!1),$(!1),H(!1))}}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[F.actualValue&&y&&e.jsx("div",Object.assign({style:{marginTop:4}},{children:e.jsx(o.BodyCaption,{children:`This value is of type ${F.variableType}`})})),j&&z&&e.jsx("div",Object.assign({style:{marginTop:m||k?"-24px":"0px"}},{children:e.jsx(u.AddVariableStyled,Object.assign({right:c,id:"addVar",onClick:()=>{$(!Z)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(a.default,{color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]})),!f&&Z&&e.jsx(s.AddVariableV2,{data:V,showVariable:!0,setShowVariable:()=>{$(!1)},variableValue:E,setVariableValue:I,placeholder:"",pickerSize:"large",enableVariable:!0,selectWithTypes:!0,onSearchBlur:e=>{var a,l,r,t,i,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(i=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===i?void 0:i.includes("sc-dZoequ "))?M.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==R&&($(!1),H(!1),N(!1)):($(!1),H(!1),N(!1))}})]})),f&&Z&&e.jsx(d.AddVariableV2SideModal,{zIndex:2e3,data:null!=V?V:[],showVariable:Z,setShowVariable:()=>{$(!1)},placeholder:"Add a variable",customTrigger:e=>{I({actualValue:e.actualValue,variableType:"string"}),P(e)},onSearchBlur:e=>{var a,l,r,t,i,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(i=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===i?void 0:i.includes("sc-dZoequ "))?M.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==R&&($(!1),H(!1),N(!1)):($(!1),H(!1),N(!1))}})]})};
7
+ `;exports.InputWithVariables=r=>{let{type:i,allowMix:c,onChange:b,prevVariable:h,variablesList:g,onBlur:p,onlyVariables:V,placeHolder:x,showAddButton:T=!0,showHelp:j,showSideVariablePanel:y,errorMessage:f,showSideModal:m,maxCharLimit:S,noMaxCharCheck:q,labelText:C,labelElement:w,isRequired:A=!1,hintText:O}=r;const k=l.useRef(!0),M=l.useRef(null),[B,L]=l.useState(!1),[N]=l.useState(t.v4()),[E,I]=l.useState(),[R,F]=l.useState(h),[P,Z]=l.useState(!1),[$,z]=l.useState(!1),[H,W]=l.useState(0);return l.useEffect((()=>{if(E&&E.actualValue)if(c){if(F((e=>{return{actualValue:(a=e.actualValue,l=E.actualValue,r=H,a.slice(0,r)+l+a.slice(r)),variableType:"string"};var a,l,r})),M.current){W(M.current.selectionStart);const e=H+E.actualValue.length+2;M.current.setSelectionRange(e,e),W(e)}}else F((e=>({actualValue:E.actualValue,variableType:E.variableType,needsFetching:E.needsFetching})))}),[E]),l.useEffect((()=>{k.current?k.current=!1:b(R)}),[R]),e.jsxs(e.Fragment,{children:[e.jsxs(v,Object.assign({isVar:/^{{.*}}$/.test(R.actualValue)},{children:[e.jsx(n.Input,{isRequired:A,hintText:O,type:null!=i?i:"text",id:N,ref:M,skipFocus:!0,isActive:B,value:R.actualValue,validate:e=>[!0,""],errorMessage:f,noMaxCharCheck:q,maxCharLimit:S,labelText:C,labelElement:w,placeholder:x||"Add a value",onClick:e=>{M.current&&W(M.current.selectionStart)},onChangeText:(e,a)=>{if(M.current&&W(M.current.selectionStart),V){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||F({actualValue:"",variableType:"string"})}else F(c?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{L(!0),z(!0),document.getElementById("varList")&&!P&&Z(!0)},onBlur:e=>{var a,l,r,t,i,d,s;null==p||p(e,R),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"varList"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(t=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===t?void 0:t.includes("exlualr0"))||(null===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?(M.current&&M.current.focus(),L(!0)):"search-bar"===(null===(s=e.relatedTarget)||void 0===s?void 0:s.id)?L(!0):(L(!1),Z(!1),z(!1))}}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[R.actualValue&&j&&e.jsx("div",Object.assign({style:{marginTop:4}},{children:e.jsx(o.BodyCaption,{children:`This value is of type ${R.variableType}`})})),T&&$&&e.jsx("div",Object.assign({style:{marginTop:f||O?"-24px":"0px"}},{children:e.jsx(u.AddVariableStyled,Object.assign({id:"addVar",onClick:()=>{Z(!P)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(a.default,{color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]})),!y&&P&&e.jsx(s.AddVariableV2,{data:g,showVariable:!0,setShowVariable:()=>{Z(!1)},variableValue:E,setVariableValue:I,placeholder:"",pickerSize:"large",enableVariable:!0,selectWithTypes:!0,onSearchBlur:e=>{var a,l,r,t,i,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(i=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===i?void 0:i.includes("sc-dZoequ "))?M.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==N&&(Z(!1),z(!1),L(!1)):(Z(!1),z(!1),L(!1))}})]})),y&&P&&e.jsx(d.AddVariableV2SideModal,{zIndex:2e3,data:null!=g?g:[],showVariable:P,setShowVariable:()=>{Z(!1)},placeholder:"Add a variable",customTrigger:e=>{I({actualValue:e.actualValue,variableType:"string"}),F(e)},onSearchBlur:e=>{var a,l,r,t,i,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(i=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===i?void 0:i.includes("sc-dZoequ "))?M.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==N&&(Z(!1),z(!1),L(!1)):(Z(!1),z(!1),L(!1))}})]})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronRight.svg.js"),i=require("react"),s=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),c=require("../tag/Tag.js"),o=require("../tooltips/Tooltip.js"),r=require("../TypographyStyle.js"),n=require("./emptyState.js"),d=require("./ProductPickerShimmer.js"),a=require("./style.js"),u=require("./utility.js");const h=i=>{const{customCollectionRestriction:n,data:d,selectedCollectionsDispatch:u,setCollectionId:h,setSelectedCollectionId:C,isPartiallyChecked:j,setScreen:p,id:y,isChecked:g,isDisabled:x,hideCollectionCheckbox:b,pickerType:m,selectedCollections:v,usedInSearch:k}=i;return e.jsxs(a.CollectionCardStyle,Object.assign({isDisabled:x,onClick:e=>{if(!x){if("COLLECTION"===m)return e.stopPropagation(),u({type:"reset",data:{}}),u({type:"selected",data:{id:y,val:d,isRestricted:n}}),h(y),void C(y);h(y),C(y),p("products")}},isActive:!!v[y],usedInSearch:null!=k&&k},{children:[e.jsxs(a.CollectionCardInfoStyle,{children:[!b&&e.jsx(s.CheckBox,{isDisabled:x,isChecked:g,isPartiallyChecked:j,onValueChange:function(e,t,i){null==i||i.stopPropagation(),u(e?{type:"selected",data:{id:y,val:d,isRestricted:n}}:{type:"unselected",data:{id:y}}),C(e?y:"")}}),e.jsx(a.CollectionCardDetailStyle,{children:e.jsx(o.Tooltip,Object.assign({body:d.name,placement:"bottom",delay:400,variant:"light"},{children:e.jsxs(a.CollectionNameHolder,{children:[k?e.jsx(r.BodyPrimary,Object.assign({numberOfLines:1},{children:d.name})):e.jsx(r.TitleRegular,Object.assign({numberOfLines:1},{children:d.name})),d.isSmartCollection?e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(c.Tag,{tagText:"Smart Collection",type:"warning"})})):e.jsx(e.Fragment,{})]})}))})]}),"COLLECTION"!==m&&e.jsx(l.IconButton,{height:12,width:12,disabled:x,Icon:t.default})]}))};exports.CollectionCard=h,exports.CollectionsScreen=t=>{var s;const{customCollectionRestriction:l,dataLoading:c,collections:o,selectedCollectionsDispatch:r,setCollectionId:a,setSelectedCollectionId:C,selectedCollections:j,setScreen:p,collectionFetcher:y,collectionsDispatch:g,pagingControls:x,storeId:b,setSaveDisabled:m,hideCollectionCheckbox:v,renderWithoutModal:k,pickerType:S}=t,f=i.useRef(null),I=i.useRef(x.curPage),P=!!l&&(null==j?void 0:j.isCustom),[O,q]=i.useState(!1),T=i.useRef(!1);return i.useEffect((()=>{I.current=x.curPage}),[x.curPage]),i.useEffect((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&I.current>0&&!T.current&&(m(!0),q(!0),y(I.current,b).then((e=>{g({type:"paged",data:(null==e?void 0:e.collections)||{}}),x.setCurPage(I.current+1),q(!1),m(!1),Object.keys(e).length||(T.current=!0)})).catch())}),{threshold:1});return f.current&&e.observe(f.current),()=>{f.current&&e.unobserve(f.current)}}),[f]),e.jsxs("div",{children:[(null===(s=Object.keys(null!=o?o:{}))||void 0===s?void 0:s.length)?Object.keys(o).map((t=>e.jsx(h,{customCollectionRestriction:l,data:o[t],isDisabled:P&&!(null==j?void 0:j[t]),isChecked:!!(null==j?void 0:j[t]),isPartiallyChecked:u.isCollectionPartiallyChecked(t,null==o?void 0:o[t],j),selectedCollectionsDispatch:r,setCollectionId:a,setSelectedCollectionId:C,setScreen:p,id:t,hideCollectionCheckbox:v||"-1"===t,selectedCollections:j,renderWithoutModal:k,pickerType:S},t))):c?e.jsx(d.ProductPickerShimmer,{}):e.jsx(n.EmptyState,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),e.jsx("div",{ref:f}),O&&e.jsx(d.ProductPickerShimmer,{})]})},exports.truncate=(e,t,i)=>{if(!e)return"";if(e.length<=t)return e;const s=e.slice(0,t-1);return(i?s.slice(0,s.lastIndexOf(" ")):s)+"..."};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronRight.svg.js"),i=require("react"),l=require("../checkBox/CheckBox.js"),s=require("../icon-button/IconButton.js"),c=require("../tag/Tag.js"),o=require("../tooltips/Tooltip.js"),r=require("../TypographyStyle.js"),n=require("./emptyState.js"),d=require("./ProductPickerShimmer.js"),a=require("./style.js"),u=require("./utility.js");const h=i=>{const{customCollectionRestriction:n,data:d,selectedCollectionsDispatch:u,setCollectionId:h,setSelectedCollectionId:C,isPartiallyChecked:j,setScreen:p,id:y,isChecked:g,isDisabled:x,hideCollectionCheckbox:v,pickerType:b,usedInSearch:m}=i;return e.jsxs(a.CollectionCardStyle,Object.assign({isDisabled:x,onClick:e=>{if(!x){if("COLLECTION"===b)return e.stopPropagation(),u({type:"reset",data:{}}),u({type:"selected",data:{id:y,val:d,isRestricted:n}}),h(y),void C(y);h(y),C(y),p("products")}},isActive:g,usedInSearch:null!=m&&m},{children:[e.jsxs(a.CollectionCardInfoStyle,{children:[!v&&e.jsx(l.CheckBox,{isDisabled:x,isChecked:g,isPartiallyChecked:j,onValueChange:function(e,t,i){null==i||i.stopPropagation(),u(e?{type:"selected",data:{id:y,val:d,isRestricted:n}}:{type:"unselected",data:{id:y}}),C(e?y:"")}}),e.jsx(a.CollectionCardDetailStyle,{children:e.jsx(o.Tooltip,Object.assign({body:d.name,placement:"bottom",delay:400,variant:"light"},{children:e.jsxs(a.CollectionNameHolder,{children:[m?e.jsx(r.BodyPrimary,Object.assign({numberOfLines:1},{children:d.name})):e.jsx(r.TitleRegular,Object.assign({numberOfLines:1},{children:d.name})),d.isSmartCollection?e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(c.Tag,{tagText:"Smart Collection",type:"warning"})})):e.jsx(e.Fragment,{})]})}))})]}),"COLLECTION"!==b&&e.jsx(s.IconButton,{height:12,width:12,disabled:x,Icon:t.default})]}))};exports.CollectionCard=h,exports.CollectionsScreen=t=>{var l;const{customCollectionRestriction:s,dataLoading:c,collections:o,selectedCollectionsDispatch:r,setCollectionId:a,setSelectedCollectionId:C,selectedCollections:j,setScreen:p,collectionFetcher:y,collectionsDispatch:g,pagingControls:x,storeId:v,setSaveDisabled:b,hideCollectionCheckbox:m,renderWithoutModal:k,pickerType:S="PRODUCT"}=t,f=i.useRef(null),O=i.useRef(x.curPage),P=!!s&&(null==j?void 0:j.isCustom),[I,T]=i.useState(!1),q=i.useRef(!1);return i.useEffect((()=>{O.current=x.curPage}),[x.curPage]),i.useEffect((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&O.current>0&&!q.current&&(b(!0),T(!0),y(O.current,v).then((e=>{g({type:"paged",data:(null==e?void 0:e.collections)||{}}),x.setCurPage(O.current+1),T(!1),b(!1),Object.keys(e).length||(q.current=!0)})).catch())}),{threshold:1});return f.current&&e.observe(f.current),()=>{f.current&&e.unobserve(f.current)}}),[f]),e.jsxs("div",{children:[(null===(l=Object.keys(null!=o?o:{}))||void 0===l?void 0:l.length)?Object.keys(o).map((t=>{var i,l;const c=!!(null==j?void 0:j[t])&&("PRODUCT"!==S||!!Object.keys(null!==(l=null===(i=null==j?void 0:j[t])||void 0===i?void 0:i.products)&&void 0!==l?l:{}).length);return e.jsx(h,{customCollectionRestriction:s,data:o[t],isDisabled:P&&!(null==j?void 0:j[t]),isChecked:c,isPartiallyChecked:u.isCollectionPartiallyChecked(t,null==o?void 0:o[t],j),selectedCollectionsDispatch:r,setCollectionId:a,setSelectedCollectionId:C,setScreen:p,id:t,hideCollectionCheckbox:m||"-1"===t,selectedCollections:j,renderWithoutModal:k,pickerType:S},t)})):c?e.jsx(d.ProductPickerShimmer,{}):e.jsx(n.EmptyState,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),e.jsx("div",{ref:f}),I&&e.jsx(d.ProductPickerShimmer,{})]})},exports.truncate=(e,t,i)=>{if(!e)return"";if(e.length<=t)return e;const l=e.slice(0,t-1);return(i?l.slice(0,l.lastIndexOf(" ")):l)+"..."};
@@ -90,6 +90,7 @@ export type ProductPickerInterface = {
90
90
  selectSingleItem?: boolean;
91
91
  stickyFooter?: boolean;
92
92
  showProductDetails?: boolean;
93
+ containerStyle?: React.CSSProperties;
93
94
  } & ({
94
95
  startupScreen: ScreenName.RearrangeProducts;
95
96
  rearrangeEnabled: true;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=require("../button/Button.js"),n=require("../input/Input.js"),l=require("../modals/styledModal.js"),i=require("../spinner/Spinner.js"),a=require("../tag/Tag.js"),d=require("./collectionScreen.js"),u=require("./productInfoOverlay.js"),h=require("./productScreen.js"),p=require("./rearrangeScreen.js"),S=require("./reducers.js"),C=require("./searchScreen.js"),x=require("./selectedScreen.js"),g=require("./style.js"),j=require("./type.js");exports.ScreenName=void 0,(e=exports.ScreenName||(exports.ScreenName={})).Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products";exports.ProductPickerModal=e=>{const{storeId:y,selectedItems:b,onClose:f,visible:m,zIndex:v,exactLimit:P,limit:k,hideCollectionCheckbox:I,hideProductCheckbox:O,outOfStockAction:F=j.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,hideSelectionCount:q,title:E,width:D,renderWithoutModal:w,onClickSave:N,pickerType:A,hideProductVariants:B=!1,startupScreen:M=exports.ScreenName.Collections,rearrangeEnabled:V,selectSingleItem:$=!1,showProductDetails:L}=e,[_,z]=c.useReducer(S.collectionsReducer,{}),[W,G]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(M)?M:exports.ScreenName.Collections),[H,K]=c.useState("grid"),[U,Y]=c.useState(""),[J,Q]=c.useState(""),[X,Z]=c.useState(0),[ee,te]=c.useState(!1),[oe,ce]=c.useState(0),[re,se]=c.useState(""),[ne,le]=c.useState(!1),[ie,ae]=c.useState(!1),[de,ue]=c.useReducer(S.searchReducer,{collections:{},products:{}}),[he,pe]=c.useReducer(S.selectedColectionsReducer,Object.keys(b).length>0?b:{}),Se=c.useRef(null),[Ce,xe]=c.useState(!1),[ge,je]=c.useState();c.useEffect((()=>{te(!0),ae(!0),e.collectionFetcher(X,y).then((e=>{z({type:"fetched",data:(null==e?void 0:e.collections)||{}}),te(!1),Z((e=>e+1)),ae(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;B?Object.keys(he||[]).forEach((t=>{var o;Object.keys((null===(o=he[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&he[-1]&&(null===(c=he[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(he||[]).forEach((t=>{var o;Object.keys((null===(o=he[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=he[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),ce(e)}),[_,he,B]),c.useEffect((()=>{J&&(te(!0),e.productFetcher(J,y).then((e=>{Object.keys(e).length&&z({type:"productsFetched",data:{collectionId:J,products:e}}),te(!1)})).catch())}),[J]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==W&&(re.length||"collections"!==W)&&(re.length?(le(!0),e.searchFetcher(y,re).then((e=>{"collections"in e&&"products"in e?(ue({type:"set",data:e}),z({type:"searched",data:e.collections})):(ue({type:"set",data:{collections:{},products:e}}),z({type:"searched",data:e})),G("searchProducts"),te(!1),le(!1)}))):G("collections"))}),800);return()=>clearTimeout(t)}),[re]),c.useEffect((()=>{N&&(e.onAdd(he,oe),ye())}),[N]),c.useEffect((()=>{$&&Object.keys(he||{}).length&&oe&&(e.onAdd(he,oe),ye())}),[$,he,oe]);const ye=()=>{pe({type:"reset",data:{}})},be=t.jsxs(g.ContainerStyle,{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===W||"searchProducts"===W)&&t.jsx("div",Object.assign({style:{padding:w?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(n.Input,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ne?t.jsx(i.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:re,onChangeText:e=>{e.length&&e.trim().length?se(e):se("")}})}))}),t.jsxs(g.ScrollContainerStyle,Object.assign({ref:Se,screenName:W},{children:["collections"===W&&t.jsx(d.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:ie,collections:_,selectedCollectionsDispatch:pe,setCollectionId:Y,setSelectedCollectionId:Q,setScreen:G,selectedCollections:he,collectionFetcher:e.collectionFetcher,storeId:y,collectionsDispatch:z,setSaveDisabled:te,pagingControls:{curPage:X,setCurPage:Z},hideCollectionCheckbox:I,renderWithoutModal:w,pickerType:A}),"products"===W&&U&&t.jsx(S.CollectionIdContext.Provider,Object.assign({value:U},{children:t.jsx(h.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:G,storeId:y,data:_[U],collectionsDispatch:z,selectedCollectionsDispatch:pe,selectedData:he,setSaveDisabled:te,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:O,outOfStockAction:F,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,renderWithoutModal:w,pickerType:A,hideProductVariants:B,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{xe(!0),je(e)},showProductDetailInfoIcon:L,scrollContainerRef:Se})})),"view"===W&&t.jsx(x.SelectedScreen,{selectedCollections:he||{},selectedCollectionsDispatch:pe,setScreen:G,collections:_,hideProductVariants:B,outOfStockAction:F,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===W&&t.jsx(p.RearrangeScreen,{selectedCollections:he||{},selectedCollectionsDispatch:pe,setScreen:G,outOfStockAction:F,rearrangeViewType:"grid"===H?"list":"grid",scrollContainerRef:Se,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===W&&t.jsx(C.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:he||{},searchedCollections:de||{},searchedCollectionsDispatch:ue,selectedCollectionsDispatch:pe,setScreen:G,collections:_,onBackPress:()=>{se(""),ue({type:"set",data:{collections:{},products:{}}})},pickerType:A,hideProductCheckbox:O,hideProductVariants:B,hideVariantCheckbox:R,storeId:y,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:Y,setSelectedCollectionId:Q,renderWithoutModal:w,hideCollectionCheckbox:I,outOfStockAction:F})]}))]});return t.jsx(t.Fragment,{children:w?be:t.jsxs(l.StyledModal,Object.assign({zIndex:v,open:m,onClose:()=>{null==f||f(),ye()},headingTitle:E||("collections"===W||"products"===W?"Select Products":"view"===W?"Selected Products":"searchProducts"===W?"Searched Results":"rearrange"===W?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:D||"600px"},headerRightCustomElement:"rearrange"===W?(console.log("ignore:",K),t.jsx(t.Fragment,{})):t.jsx(t.Fragment,{}),footerContainerStyle:e.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:{buttonText:ee?"Loading...":W===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:ee||oe<1||P&&oe<P||!P&&k&&oe>k||!1,onClick:()=>{e.onAdd(he,oe),ye()}},wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:q?t.jsx(t.Fragment,{}):P&&oe>P?t.jsx(a.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):k&&oe>k?t.jsx(a.Tag,{tagText:`You can only select ${k} products`,type:"negative"}):oe>0?t.jsx(s.Button,{onClick:()=>{G(V?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:P?`${oe}/${P} products selected`:`${oe} products selected`,buttonType:["rearrange","view"].includes(W)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(W)}):t.jsx(s.Button,{disabled:!0,buttonText:P?`${oe}/${P} products selected`:`${oe} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:Ce},{children:[be,Ce&&ge?t.jsx(u.ProductInfoOverlay,{productData:ge,outOfStockAction:F,onClose:()=>{xe(!1)}}):t.jsx(t.Fragment,{})]}))})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=require("../../constants/Theme.js"),s=require("../button/Button.js"),n=require("../input/Input.js"),l=require("../modals/styledModal.js"),i=require("../spinner/Spinner.js"),a=require("../tag/Tag.js"),d=require("./collectionScreen.js"),u=require("./productInfoOverlay.js"),h=require("./productScreen.js"),p=require("./rearrangeScreen.js"),S=require("./reducers.js"),C=require("./searchScreen.js"),x=require("./selectedScreen.js"),g=require("./style.js"),j=require("./type.js");exports.ScreenName=void 0,(e=exports.ScreenName||(exports.ScreenName={})).Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products";exports.ProductPickerModal=e=>{const{storeId:y,selectedItems:b,onClose:f,visible:m,zIndex:v,exactLimit:P,limit:k,hideCollectionCheckbox:O,hideProductCheckbox:I,outOfStockAction:F=j.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,hideSelectionCount:q,title:E,width:D,renderWithoutModal:w,onClickSave:N,pickerType:A,hideProductVariants:B=!1,startupScreen:M=exports.ScreenName.Collections,rearrangeEnabled:V,selectSingleItem:$=!1,showProductDetails:L,containerStyle:_}=e,[z,W]=c.useReducer(S.collectionsReducer,{}),[G,H]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(M)?M:exports.ScreenName.Collections),[K,U]=c.useState("grid"),[Y,J]=c.useState(""),[Q,X]=c.useState(""),[Z,ee]=c.useState(0),[te,oe]=c.useState(!1),[ce,re]=c.useState(0),[se,ne]=c.useState(""),[le,ie]=c.useState(!1),[ae,de]=c.useState(!1),[ue,he]=c.useReducer(S.searchReducer,{collections:{},products:{}}),[pe,Se]=c.useReducer(S.selectedColectionsReducer,Object.keys(b).length>0?b:{}),Ce=c.useRef(null),[xe,ge]=c.useState(!1),[je,ye]=c.useState();c.useEffect((()=>{oe(!0),de(!0),e.collectionFetcher(Z,y).then((e=>{W({type:"fetched",data:(null==e?void 0:e.collections)||{}}),oe(!1),ee((e=>e+1)),de(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;B?Object.keys(pe||[]).forEach((t=>{var o;Object.keys((null===(o=pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&pe[-1]&&(null===(c=pe[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(pe||[]).forEach((t=>{var o;Object.keys((null===(o=pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=pe[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),re(e)}),[z,pe,B]),c.useEffect((()=>{Q&&(oe(!0),e.productFetcher(Q,y).then((e=>{Object.keys(e).length&&W({type:"productsFetched",data:{collectionId:Q,products:e}}),oe(!1)})).catch())}),[Q]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==G&&(se.length||"collections"!==G)&&(se.length?(ie(!0),e.searchFetcher(y,se).then((e=>{"collections"in e&&"products"in e?(he({type:"set",data:e}),W({type:"searched",data:e.collections})):(he({type:"set",data:{collections:{},products:e}}),W({type:"searched",data:e})),H("searchProducts"),oe(!1),ie(!1)}))):H("collections"))}),800);return()=>clearTimeout(t)}),[se]),c.useEffect((()=>{N&&(e.onAdd(pe,ce),be())}),[N]),c.useEffect((()=>{$&&Object.keys(pe||{}).length&&ce&&(e.onAdd(pe,ce),be())}),[$,pe,ce]);const be=()=>{Se({type:"reset",data:{}})},fe=t.jsxs(g.ContainerStyle,Object.assign({style:null!=_?_:{}},{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===G||"searchProducts"===G)&&t.jsx("div",Object.assign({style:{padding:w?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(n.Input,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>le?t.jsx(i.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:se,onChangeText:e=>{e.length&&e.trim().length?ne(e):ne("")}})}))}),t.jsxs(g.ScrollContainerStyle,Object.assign({ref:Ce,screenName:G},{children:["collections"===G&&t.jsx(d.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:ae,collections:z,selectedCollectionsDispatch:Se,setCollectionId:J,setSelectedCollectionId:X,setScreen:H,selectedCollections:pe,collectionFetcher:e.collectionFetcher,storeId:y,collectionsDispatch:W,setSaveDisabled:oe,pagingControls:{curPage:Z,setCurPage:ee},hideCollectionCheckbox:O,renderWithoutModal:w,pickerType:A}),"products"===G&&Y&&t.jsx(S.CollectionIdContext.Provider,Object.assign({value:Y},{children:t.jsx(h.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:H,storeId:y,data:z[Y],collectionsDispatch:W,selectedCollectionsDispatch:Se,selectedData:pe,setSaveDisabled:oe,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:I,outOfStockAction:F,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,renderWithoutModal:w,pickerType:A,hideProductVariants:B,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{ge(!0),ye(e)},showProductDetailInfoIcon:L,scrollContainerRef:Ce})})),"view"===G&&t.jsx(x.SelectedScreen,{selectedCollections:pe||{},selectedCollectionsDispatch:Se,setScreen:H,collections:z,hideProductVariants:B,outOfStockAction:F,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===G&&t.jsx(p.RearrangeScreen,{selectedCollections:pe||{},selectedCollectionsDispatch:Se,setScreen:H,outOfStockAction:F,rearrangeViewType:"grid"===K?"list":"grid",scrollContainerRef:Ce,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===G&&t.jsx(C.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:pe||{},searchedCollections:ue||{},searchedCollectionsDispatch:he,selectedCollectionsDispatch:Se,setScreen:H,collections:z,onBackPress:()=>{ne(""),he({type:"set",data:{collections:{},products:{}}})},pickerType:A,hideProductCheckbox:I,hideProductVariants:B,hideVariantCheckbox:R,storeId:y,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:J,setSelectedCollectionId:X,renderWithoutModal:w,hideCollectionCheckbox:O,outOfStockAction:F})]}))]}));return t.jsx(t.Fragment,{children:w?fe:t.jsxs(l.StyledModal,Object.assign({zIndex:v,open:m,onClose:()=>{null==f||f(),be()},headingTitle:E||("collections"===G||"products"===G?"Select Products":"view"===G?"Selected Products":"searchProducts"===G?"Searched Results":"rearrange"===G?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:D||"600px"},headerRightCustomElement:t.jsx(t.Fragment,{}),footerContainerStyle:e.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:{buttonText:te?"Loading...":G===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:te||ce<1||P&&ce<P||!P&&k&&ce>k||!1,onClick:()=>{e.onAdd(pe,ce),be()}},wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:q?t.jsx(t.Fragment,{}):P&&ce>P?t.jsx(a.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):k&&ce>k?t.jsx(a.Tag,{tagText:`You can only select ${k} products`,type:"negative"}):ce>0?t.jsx(s.Button,{onClick:()=>{H(V?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:P?`${ce}/${P} products selected`:`${ce} products selected`,buttonType:["rearrange","view"].includes(G)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(G)}):t.jsx(s.Button,{disabled:!0,buttonText:P?`${ce}/${P} products selected`:`${ce} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:xe},{children:[fe,xe&&je?t.jsx(u.ProductInfoOverlay,{productData:je,outOfStockAction:F,onClose:()=>{ge(!1)}}):t.jsx(t.Fragment,{})]}))})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../constants/Theme.js"),i=require("../../assets/icons/info.svg.js"),o=require("../checkBox/CheckBox.js"),c=require("../icon-button/IconButton.js"),d=require("../shimmer-image/ShimmerImage.js"),r=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),l=require("./ProductPickerTag.js"),a=require("./style.js"),s=require("./utility.js");const u=s=>{const{isVariant:u,data:h,productId:p,collectionId:v,variantId:I,isSelected:j,selectedCollectionsDispatch:k,viewOnly:x,upliftAdditions:y,isPartiallyChecked:C,hideProductCheckbox:P,outOfStockAction:f,hideVariantCheckbox:m,hideProductVariants:O,pickerType:b="PRODUCT",onProductDetailClick:g,showProductDetailInfoIcon:S}=s;return e.jsxs(a.ProductCardStyle,Object.assign({isVariant:u,onClick:e=>{if(e.stopPropagation(),"PRODUCT"===b){const e=Object.keys(h.variants);O?y("productSelected",{productId:p,variantId:I,collectionId:v,product:h}):y("variantSelected",{productId:p,variantId:I||e[0],collectionId:v,variant:h})}},isActive:j},{children:[u&&!x&&!m||!u&&!x&&!P?e.jsx(o.CheckBox,{isChecked:j,isPartiallyChecked:C||!1,onValueChange:function(e){u?e?y(O?"productSelected":"variantSelected",{productId:p,variantId:I,collectionId:v,variant:h}):k({type:O?"productUnselected":"variantUnselected",data:{productId:p,variantId:I,collectionId:v}}):e?y("productSelected",{productId:p,collectionId:v,product:h}):k({type:"productUnselected",data:{productId:p,collectionId:v}})}}):e.jsx(e.Fragment,{}),e.jsx("div",{children:e.jsx(d.ShimmerImage,{width:40,height:40,imageUrl:h.image,alt:"Item",borderRadius:4})}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[e.jsx(r.Tooltip,Object.assign({variant:"light",body:h.name,placement:"bottom",delay:400},{children:e.jsx(n.BodyPrimary,Object.assign({numberOfLines:1},{children:h.name}))})),S&&e.jsx(c.IconButton,{onClick:()=>{null==g||g(h)},Icon:()=>e.jsx(i.default,{width:20,height:20,color:t.COLORS.content.placeholder})})]})),e.jsx(l.ProductPickerTag,{isVariant:u,data:h,outOfStockAction:f})]}))]}))};exports.ProductCard=u,exports.ProductGroup=t=>{const{collectionId:i,productId:o,data:c,selectedData:d,selectedCollectionsDispatch:r,viewOnly:n,upliftAdditions:l,isProductPartiallyChecked:a,hideProductCheckbox:h,outOfStockAction:p,hideVariantCheckbox:v,hideProductVariants:I,pickerType:j,onProductDetailClick:k,showProductDetailInfoIcon:x}=t,y=e=>{var t,c,r,n,l,a;if(!(null===(c=null===(t=null==d?void 0:d[i])||void 0===t?void 0:t.products)||void 0===c?void 0:c[o]))return!1;return!!(null===(a=null===(l=null===(n=null===(r=null==d?void 0:d[i])||void 0===r?void 0:r.products)||void 0===n?void 0:n[o])||void 0===l?void 0:l.variants)||void 0===a?void 0:a[e])};return e.jsxs("div",{children:[e.jsx(u,{isVariant:!1,data:c,productId:o,collectionId:i,isSelected:!!(null===(P=null===(C=null==d?void 0:d[i])||void 0===C?void 0:C.products)||void 0===P?void 0:P[o]),isPartiallyChecked:a,selectedCollectionsDispatch:r,upliftAdditions:l,viewOnly:n,hideProductCheckbox:h,hideVariantCheckbox:v,hideProductVariants:I,pickerType:j,outOfStockAction:p,onProductDetailClick:k,showProductDetailInfoIcon:x},o),I?null:s.shouldShowVariant(c)&&Object.keys(c.variants||[]).map((t=>e.jsx(u,{isVariant:!0,hideVariantCheckbox:v,data:c.variants[t],variantId:t,productId:o,viewOnly:n,upliftAdditions:l,collectionId:i,isSelected:y(t),selectedCollectionsDispatch:r,outOfStockAction:p,onProductDetailClick:k,showProductDetailInfoIcon:x},t)))]});var C,P};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("../../constants/Theme.js"),i=require("../../assets/icons/info.svg.js"),o=require("../checkBox/CheckBox.js"),c=require("../icon-button/IconButton.js"),d=require("../shimmer-image/ShimmerImage.js"),r=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),a=require("./ProductPickerTag.js"),l=require("./style.js"),s=require("./utility.js");const u=s=>{const{isVariant:u,data:p,productId:h,collectionId:v,variantId:I,isSelected:j,selectedCollectionsDispatch:k,viewOnly:x,upliftAdditions:y,isPartiallyChecked:P,hideProductCheckbox:C,outOfStockAction:f,hideVariantCheckbox:m,hideProductVariants:g,pickerType:O="PRODUCT",onProductDetailClick:b,showProductDetailInfoIcon:S}=s;return t.jsxs(l.ProductCardStyle,Object.assign({isVariant:u,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===O&&(C||m)){const t=Object.keys(p.variants);g?j?k({type:"productUnselected",data:{productId:h,collectionId:v}}):y("productSelected",{productId:h,variantId:I,collectionId:v,product:p}):j?k({type:"variantUnselected",data:{productId:h,variantId:I,collectionId:v}}):y("variantSelected",{productId:h,variantId:I||t[0],collectionId:v,variant:p})}},isActive:j},{children:[u&&!x&&!m||!u&&!x&&!C?t.jsx(o.CheckBox,{isChecked:j,isPartiallyChecked:P||!1,onValueChange:function(t,e,i){null==i||i.stopPropagation(),u?t?y(g?"productSelected":"variantSelected",{productId:h,variantId:I,collectionId:v,variant:p}):k({type:g?"productUnselected":"variantUnselected",data:{productId:h,variantId:I,collectionId:v}}):t?y("productSelected",{productId:h,collectionId:v,product:p}):k({type:"productUnselected",data:{productId:h,collectionId:v}})}}):t.jsx(t.Fragment,{}),t.jsx("div",{children:t.jsx(d.ShimmerImage,{width:40,height:40,imageUrl:p.image,alt:"Item",borderRadius:4})}),t.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[t.jsx(r.Tooltip,Object.assign({variant:"light",body:p.name,placement:"bottom",delay:400},{children:t.jsx(n.BodyPrimary,Object.assign({numberOfLines:1},{children:p.name}))})),S&&t.jsx(c.IconButton,{onClick:()=>{null==b||b(p)},Icon:()=>t.jsx(i.default,{width:20,height:20,color:e.COLORS.content.placeholder})})]})),t.jsx(a.ProductPickerTag,{isVariant:u,data:p,outOfStockAction:f})]}))]}))};exports.ProductCard=u,exports.ProductGroup=e=>{const{collectionId:i,productId:o,data:c,selectedData:d,selectedCollectionsDispatch:r,viewOnly:n,upliftAdditions:a,isProductPartiallyChecked:l,hideProductCheckbox:p,outOfStockAction:h,hideVariantCheckbox:v,hideProductVariants:I,pickerType:j,onProductDetailClick:k,showProductDetailInfoIcon:x}=e,y=t=>{var e,c,r,n,a,l;if(!(null===(c=null===(e=null==d?void 0:d[i])||void 0===e?void 0:e.products)||void 0===c?void 0:c[o]))return!1;return!!(null===(l=null===(a=null===(n=null===(r=null==d?void 0:d[i])||void 0===r?void 0:r.products)||void 0===n?void 0:n[o])||void 0===a?void 0:a.variants)||void 0===l?void 0:l[t])};return t.jsxs("div",{children:[t.jsx(u,{isVariant:!1,data:c,productId:o,collectionId:i,isSelected:!!(null===(C=null===(P=null==d?void 0:d[i])||void 0===P?void 0:P.products)||void 0===C?void 0:C[o]),isPartiallyChecked:l,selectedCollectionsDispatch:r,upliftAdditions:a,viewOnly:n,hideProductCheckbox:p,hideVariantCheckbox:v,hideProductVariants:I,pickerType:j,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:x},o),I?null:s.shouldShowVariant(c)&&Object.keys(c.variants||[]).map((e=>t.jsx(u,{isVariant:!0,hideVariantCheckbox:v,data:c.variants[e],variantId:e,productId:o,viewOnly:n,upliftAdditions:a,collectionId:i,isSelected:y(e),selectedCollectionsDispatch:r,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:x},e)))]});var P,C};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("../../assets/icons/box.svg.js"),c=require("../../assets/icons/search.svg.js"),o=require("lodash"),s=require("react"),n=require("../../constants/Theme.js"),i=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),u=require("../input/Input.js"),d=require("../spinner/Spinner.js"),a=require("../TypographyStyle.js"),h=require("./emptyState.js"),p=require("./product.js"),v=require("./ProductPickerShimmer.js"),j=require("./reducers.js"),g=require("./style.js"),y=require("./type.js"),P=require("./utility.js");exports.ProductsScreen=C=>{const{data:k,collectionsDispatch:O,selectedData:b,selectedCollectionsDispatch:f,productFetcher:x,storeId:S,setScreen:m,setSaveDisabled:I,hideInCollectionSearch:E,customCollectionRestriction:q,hideProductCheckbox:A,outOfStockAction:T=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D=!1,selectProductsFromCustomCollection:V=!1,pickerType:R,hideProductVariants:L,fbStatusFetcher:F,onProductDetailClick:w,showProductDetailInfoIcon:B,scrollContainerRef:_}=C,H=s.useContext(j.CollectionIdContext),U=s.useRef(0),J=s.useRef(!1),[K,M]=s.useState(!1),[N,W]=s.useState(""),[z,G]=s.useState(!1),[Q,X]=s.useState(k),Y=s.useRef(!1);s.useEffect((()=>{const e=setTimeout((()=>{N.length?(G(!0),C.searchInCollectionFetcher(S,H,N).then((e=>{const t=o.cloneDeep(k);t.products=e,X(t);const r=P.getVariantIdsToFetchAtProductLevel(null!=e?e:{});ee(r,null!=e?e:{},!0),I(!1),G(!1)}))):X(k)}),800);return()=>clearTimeout(e)}),[N]);const Z=()=>{if(!_||!(null==_?void 0:_.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:r}=_.current;e+t>=r-20&&!Y.current&&!J.current&&(I(!0),M(!0),J.current=!0,x(H,S,10,U.current).then((e=>{if(Object.keys(e).length||(Y.current=!0),Object.keys(e).length){const t=Q;t.products=Object.assign(Object.assign({},Q.products),e),X(t);const r=P.getVariantIdsToFetchAtProductLevel(e);ee(r,e),U.current+=1}J.current=!1,M(!1),I(!1)})).catch())};s.useEffect((()=>{var e;return null===(e=null==_?void 0:_.current)||void 0===e||e.addEventListener("scroll",Z),()=>{var e;null===(e=null==_?void 0:_.current)||void 0===e||e.removeEventListener("scroll",Z)}}),[]),s.useEffect((()=>{var e,t,r,c;Y.current=!1,U.current=Math.floor((null===(t=Object.keys(null!==(e=k.products)&&void 0!==e?e:{}))||void 0===t?void 0:t.length)/10);const o=P.getVariantIdsToFetchAtProductLevel(null!==(r=k.products)&&void 0!==r?r:{});ee(o,null!==(c=k.products)&&void 0!==c?c:{})}),[H]);const $=!!q&&k.isSmartCollection;s.useEffect((()=>{(null==k?void 0:k.products)||te(10)}),[]);const ee=(e,t,r)=>{F||(r?P.markVariantsAsApprovedProductsLevel(t,O,H,Q,X):P.markVariantsAsApprovedProductsLevel(t,O,H)),e.length>0&&F&&F(S,e).then((e=>{const c=Object.assign({},t);Object.keys(t).forEach((r=>{var o,s;Object.keys(null!==(s=null===(o=null==t?void 0:t[r])||void 0===o?void 0:o.variants)&&void 0!==s?s:{}).forEach((o=>{var s,n;const i=null===(s=null==t?void 0:t[r].variants)||void 0===s?void 0:s[o];i&&"REJECTED"===e[o]?i.fbStatus="REJECTED":i&&"APPROVED"===e[o]&&(i.fbStatus="APPROVED");const l=null===(n=null==c?void 0:c[r])||void 0===n?void 0:n.variants;l&&l[o]&&(l[o]=i)}))})),r?(X((e=>{const t=Object.assign({},e);return t.products=c,t})),O({type:"productsPaged",data:{collectionId:H,products:c}})):O({type:"productsPaged",data:{collectionId:H,products:c}})})).catch((e=>{r?P.markVariantsAsApprovedProductsLevel(t,O,H,Q,X):P.markVariantsAsApprovedProductsLevel(t,O,H)}))},te=e=>{I(!0),G(!0),x(H,S,e,0).then((t=>{if(Object.keys(t).length||(Y.current=!0),Object.keys(t).length){X(Object.assign(Object.assign({},Q),{products:t}));const e=P.getVariantIdsToFetchAtProductLevel(t);ee(e,t),U.current=1}e||f({type:"selected",data:{id:H,val:Object.assign(Object.assign({},k),{products:t})}}),I(!1),G(!1)})).catch()},re=(e,t)=>{const r=P.liftTheStateUp(t,k);f({type:e,data:Object.assign(Object.assign({},r),{isRestricted:q})})};return e.jsxs("div",{children:[e.jsxs(g.ProductScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,height:16,onClick:()=>{m("collections")}}),e.jsx(a.BodyCaption,Object.assign({style:{color:n.COLORS.content.secondary}},{children:k.name}))]}),!E&&e.jsx("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(u.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>z&&N.length?e.jsx(d.Spinner,{size:"small",color:n.COLORS.content.primary}):e.jsx(c.default,{})},id:"listInput",height:"24px",type:"text",value:N,onChangeText:e=>{e.length&&e.trim().length?W(e):W("")},placeholder:"Search products in this collection..."})})),e.jsxs("div",{children:[Object.keys((null==Q?void 0:Q.products)||[]).length>0&&!$&&!N.length&&!A&&"-1"!==H&&e.jsxs(g.ProductScreenCollectionCardStyle,{children:[e.jsx(i.CheckBox,{isChecked:!!(null==b?void 0:b[H]),isPartiallyChecked:P.isCollectionPartiallyChecked(H,Q,b,L),onValueChange:function(e){e?te():f({type:"unselected",data:{id:H}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(r.default,{})})),e.jsx(a.TitleRegular,{children:"All Products"})]}),Object.keys((null==Q?void 0:Q.products)||[]).length?Object.keys(Q.products||[]).map((t=>e.jsx(p.ProductGroup,{outOfStockAction:T,collectionId:H,isProductPartiallyChecked:P.isProductPartiallyChecked(H,t,b,Q,L),productId:t,data:Q.products[t],selectedData:b,selectedCollectionsDispatch:f,viewOnly:!V&&!!$,upliftAdditions:re,hideProductCheckbox:A,hideVariantCheckbox:D,hideProductVariants:L,pickerType:R,onProductDetailClick:w,showProductDetailInfoIcon:B},t))):z?e.jsx(v.ProductPickerShimmer,{limit:10}):e.jsx(h.EmptyState,{title:"No products to show",subtitle:N.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]}),K&&e.jsx(v.ProductPickerShimmer,{})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("../../assets/icons/box.svg.js"),c=require("../../assets/icons/search.svg.js"),o=require("lodash"),s=require("react"),n=require("../../constants/Theme.js"),i=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),u=require("../input/Input.js"),d=require("../spinner/Spinner.js"),a=require("../TypographyStyle.js"),h=require("./emptyState.js"),p=require("./product.js"),v=require("./ProductPickerShimmer.js"),j=require("./reducers.js"),g=require("./style.js"),y=require("./type.js"),P=require("./utility.js");exports.ProductsScreen=C=>{var k,O;const{data:b,collectionsDispatch:f,selectedData:x,selectedCollectionsDispatch:S,productFetcher:m,storeId:I,setScreen:E,setSaveDisabled:q,hideInCollectionSearch:A,customCollectionRestriction:T,hideProductCheckbox:D,outOfStockAction:V=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:R=!1,selectProductsFromCustomCollection:L=!1,pickerType:F,hideProductVariants:w,fbStatusFetcher:B,onProductDetailClick:_,showProductDetailInfoIcon:H,scrollContainerRef:U}=C,J=s.useContext(j.CollectionIdContext),K=s.useRef(0),M=s.useRef(!1),[N,W]=s.useState(!1),[z,G]=s.useState(""),[Q,X]=s.useState(!1),[Y,Z]=s.useState(b),$=s.useRef(!1);s.useEffect((()=>{const e=setTimeout((()=>{z.length?(X(!0),C.searchInCollectionFetcher(I,J,z).then((e=>{const t=o.cloneDeep(b);t.products=e,Z(t);const r=P.getVariantIdsToFetchAtProductLevel(null!=e?e:{});re(r,null!=e?e:{},!0),q(!1),X(!1)}))):Z(b)}),800);return()=>clearTimeout(e)}),[z]);const ee=()=>{if(!U||!(null==U?void 0:U.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:r}=U.current;e+t>=r-20&&!$.current&&!M.current&&(q(!0),W(!0),M.current=!0,m(J,I,10,K.current).then((e=>{if(Object.keys(e).length||($.current=!0),Object.keys(e).length){const t=Y;t.products=Object.assign(Object.assign({},Y.products),e),Z(t);const r=P.getVariantIdsToFetchAtProductLevel(e);re(r,e),K.current+=1}M.current=!1,W(!1),q(!1)})).catch())};s.useEffect((()=>{var e;return null===(e=null==U?void 0:U.current)||void 0===e||e.addEventListener("scroll",ee),()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.removeEventListener("scroll",ee)}}),[]),s.useEffect((()=>{var e,t,r,c;$.current=!1,K.current=Math.floor((null===(t=Object.keys(null!==(e=b.products)&&void 0!==e?e:{}))||void 0===t?void 0:t.length)/10);const o=P.getVariantIdsToFetchAtProductLevel(null!==(r=b.products)&&void 0!==r?r:{});re(o,null!==(c=b.products)&&void 0!==c?c:{})}),[J]);const te=!!T&&b.isSmartCollection;s.useEffect((()=>{(null==b?void 0:b.products)||ce(10)}),[]);const re=(e,t,r)=>{B||(r?P.markVariantsAsApprovedProductsLevel(t,f,J,Y,Z):P.markVariantsAsApprovedProductsLevel(t,f,J)),e.length>0&&B&&B(I,e).then((e=>{const c=Object.assign({},t);Object.keys(t).forEach((r=>{var o,s;Object.keys(null!==(s=null===(o=null==t?void 0:t[r])||void 0===o?void 0:o.variants)&&void 0!==s?s:{}).forEach((o=>{var s,n;const i=null===(s=null==t?void 0:t[r].variants)||void 0===s?void 0:s[o];i&&"REJECTED"===e[o]?i.fbStatus="REJECTED":i&&"APPROVED"===e[o]&&(i.fbStatus="APPROVED");const l=null===(n=null==c?void 0:c[r])||void 0===n?void 0:n.variants;l&&l[o]&&(l[o]=i)}))})),r?(Z((e=>{const t=Object.assign({},e);return t.products=c,t})),f({type:"productsPaged",data:{collectionId:J,products:c}})):f({type:"productsPaged",data:{collectionId:J,products:c}})})).catch((e=>{r?P.markVariantsAsApprovedProductsLevel(t,f,J,Y,Z):P.markVariantsAsApprovedProductsLevel(t,f,J)}))},ce=e=>{q(!0),X(!0),m(J,I,e,0).then((t=>{if(Object.keys(t).length||($.current=!0),Object.keys(t).length){Z(Object.assign(Object.assign({},Y),{products:t}));const e=P.getVariantIdsToFetchAtProductLevel(t);re(e,t),K.current=1}e||S({type:"selected",data:{id:J,val:Object.assign(Object.assign({},b),{products:t})}}),q(!1),X(!1)})).catch()},oe=(e,t)=>{const r=P.liftTheStateUp(t,b);S({type:e,data:Object.assign(Object.assign({},r),{isRestricted:T})})},se=!!(null==x?void 0:x[J])&&!!Object.keys(null!==(O=null===(k=null==x?void 0:x[J])||void 0===k?void 0:k.products)&&void 0!==O?O:{}).length;return e.jsxs("div",{children:[e.jsxs(g.ProductScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,height:16,onClick:()=>{E("collections")}}),e.jsx(a.BodyCaption,Object.assign({style:{color:n.COLORS.content.secondary}},{children:b.name}))]}),!A&&e.jsx("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(u.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Q&&z.length?e.jsx(d.Spinner,{size:"small",color:n.COLORS.content.primary}):e.jsx(c.default,{})},id:"listInput",height:"24px",type:"text",value:z,onChangeText:e=>{e.length&&e.trim().length?G(e):G("")},placeholder:"Search products in this collection..."})})),e.jsxs("div",{children:[Object.keys((null==Y?void 0:Y.products)||[]).length>0&&!te&&!z.length&&!D&&"-1"!==J&&e.jsxs(g.ProductScreenCollectionCardStyle,{children:[e.jsx(i.CheckBox,{isChecked:se,isPartiallyChecked:P.isCollectionPartiallyChecked(J,Y,x,w),onValueChange:function(e){e?ce():S({type:"unselected",data:{id:J}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(r.default,{})})),e.jsx(a.TitleRegular,{children:"All Products"})]}),Object.keys((null==Y?void 0:Y.products)||[]).length?Object.keys(Y.products||[]).map((t=>e.jsx(p.ProductGroup,{outOfStockAction:V,collectionId:J,isProductPartiallyChecked:P.isProductPartiallyChecked(J,t,x,Y,w),productId:t,data:Y.products[t],selectedData:x,selectedCollectionsDispatch:S,viewOnly:!L&&!!te,upliftAdditions:oe,hideProductCheckbox:D,hideVariantCheckbox:R,hideProductVariants:w,pickerType:F,onProductDetailClick:_,showProductDetailInfoIcon:H},t))):Q?e.jsx(v.ProductPickerShimmer,{limit:10}):e.jsx(h.EmptyState,{title:"No products to show",subtitle:z.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]}),N&&e.jsx(v.ProductPickerShimmer,{})]})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../button/Button.js"),a=require("../../input-with-vars/InputWithVariables.js"),s=require("../../modals/styledModal.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var i=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js");var r=require("../../template-preview/models/TemplateMeta.js"),l=require("../../template-preview/models/WhatsAppTemplate.js"),d=require("../../TypographyStyle.js"),o=require("../../../assets/icons/file.svg.js"),n=require("../../../assets/icons/filePdf.svg.js"),u=require("../../../assets/icons/image.svg.js"),p=require("../../../assets/icons/upload.svg.js"),c=require("../context/templateModalContext.js");exports.default=h=>{let{setOpenEditMedia:j,mediaComponentFormat:x,variableListForImage:g,openEditMedia:m,uploadMedia:E}=h;const{pod:b}=c.useTemplateModalContext();return e.jsx(s.StyledModal,Object.assign({open:m,zIndex:2e3,onClose:()=>j(!1),width:"440px"},{children:e.jsxs("div",Object.assign({style:{padding:24,borderRadius:4}},{children:[e.jsx(d.TitleMedium,Object.assign({style:{marginBottom:16}},{children:"Update media"})),e.jsxs("div",Object.assign({style:{padding:24,border:`1px dashed ${i.DEFAULT_THEME.colorsV2.stroke.primary}`,backgroundColor:i.DEFAULT_THEME.colorsV2.surface.subdued}},{children:[e.jsxs("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[e.jsx("div",Object.assign({style:{height:80,width:80,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:i.DEFAULT_THEME.colorsV2.background.base}},{children:x===r.HEADER_TYPES.IMAGE?e.jsx(u.default,{width:40,height:40}):x===r.HEADER_TYPES.VIDEO?e.jsx(o.default,{width:40,height:40}):e.jsx(n.default,{width:40,height:40})})),e.jsx(d.TitleMedium,{children:x===r.HEADER_TYPES.IMAGE?"Upload an image":x===r.HEADER_TYPES.VIDEO?"Upload a video":"Upload a document"}),e.jsx(d.BodySecondary,{children:x===r.HEADER_TYPES.IMAGE?"JPEG/ PNG format • Max 5MB":x===r.HEADER_TYPES.VIDEO?"MP4 format video • Max 16MB":"PDF format a document • Max 100MB"})]})),e.jsxs("div",Object.assign({style:{marginBottom:16}},{children:[e.jsx(d.BodyRegular,{children:"Media"}),e.jsx(a.InputWithVariables,{noMaxCharCheck:!0,addVarBoxRight:"46px",allowMix:!1,onChange:e=>{},prevVariable:{actualValue:"",variableType:"string"},variablesList:g,showSideVariablePanel:!0,placeHolder:"Enter URL or add variable...",onBlur:(e,t)=>{t&&t.actualValue&&E(t.actualValue)},showAddButton:b!==l.POD.CAMPAIGN||x===r.HEADER_TYPES.IMAGE})]})),e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4}},{children:[e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e.jsx(d.BodyCaption,Object.assign({style:{flex:1}},{children:"Or upload media from device"})),e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(t.Button,{matchParentWidth:!0,buttonText:"Upload",buttonType:"secondary",LeadingIcon:p.default,onClick:()=>E()})}))]}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../button/Button.js"),a=require("../../input-with-vars/InputWithVariables.js"),s=require("../../modals/styledModal.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var i=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js");var r=require("../../template-preview/models/TemplateMeta.js"),l=require("../../template-preview/models/WhatsAppTemplate.js"),d=require("../../TypographyStyle.js"),o=require("../../../assets/icons/file.svg.js"),n=require("../../../assets/icons/filePdf.svg.js"),u=require("../../../assets/icons/image.svg.js"),c=require("../../../assets/icons/upload.svg.js"),p=require("../context/templateModalContext.js");exports.default=h=>{let{setOpenEditMedia:j,mediaComponentFormat:x,variableListForImage:g,openEditMedia:m,uploadMedia:E}=h;const{pod:b}=p.useTemplateModalContext();return e.jsx(s.StyledModal,Object.assign({open:m,zIndex:2e3,onClose:()=>j(!1),width:"440px"},{children:e.jsxs("div",Object.assign({style:{padding:24,borderRadius:4}},{children:[e.jsx(d.TitleMedium,Object.assign({style:{marginBottom:16}},{children:"Update media"})),e.jsxs("div",Object.assign({style:{padding:24,border:`1px dashed ${i.DEFAULT_THEME.colorsV2.stroke.primary}`,backgroundColor:i.DEFAULT_THEME.colorsV2.surface.subdued}},{children:[e.jsxs("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[e.jsx("div",Object.assign({style:{height:80,width:80,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:i.DEFAULT_THEME.colorsV2.background.base}},{children:x===r.HEADER_TYPES.IMAGE?e.jsx(u.default,{width:40,height:40}):x===r.HEADER_TYPES.VIDEO?e.jsx(o.default,{width:40,height:40}):e.jsx(n.default,{width:40,height:40})})),e.jsx(d.TitleMedium,{children:x===r.HEADER_TYPES.IMAGE?"Upload an image":x===r.HEADER_TYPES.VIDEO?"Upload a video":"Upload a document"}),e.jsx(d.BodySecondary,{children:x===r.HEADER_TYPES.IMAGE?"JPEG/ PNG format • Max 5MB":x===r.HEADER_TYPES.VIDEO?"MP4 format video • Max 16MB":"PDF format a document • Max 100MB"})]})),e.jsxs("div",Object.assign({style:{marginBottom:16}},{children:[e.jsx(d.BodyRegular,{children:"Media"}),e.jsx(a.InputWithVariables,{noMaxCharCheck:!0,allowMix:!1,onChange:()=>{},prevVariable:{actualValue:"",variableType:"string"},variablesList:g,showSideVariablePanel:!0,placeHolder:"Enter URL or add variable...",onBlur:(e,t)=>{t&&t.actualValue&&E(t.actualValue)},showAddButton:b!==l.POD.CAMPAIGN||x===r.HEADER_TYPES.IMAGE})]})),e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4}},{children:[e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e.jsx(d.BodyCaption,Object.assign({style:{flex:1}},{children:"Or upload media from device"})),e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(t.Button,{matchParentWidth:!0,buttonText:"Upload",buttonType:"secondary",LeadingIcon:c.default,onClick:()=>E()})}))]}))]}))}))};
@@ -1,3 +1 @@
1
- export declare const AddVariableStyled: import("styled-components").StyledComponent<"button", any, {
2
- right: string;
3
- }, never>;
1
+ export declare const AddVariableStyled: import("styled-components").StyledComponent<"button", any, {}, never>;
@@ -1,25 +1,25 @@
1
1
  import t from"styled-components";const o=t.button`
2
- padding: 2px 8px;
3
- position: absolute;
4
- right: ${t=>t.right};
5
- cursor: pointer;
6
- color: white;
7
- background-color: black;
8
- width: fit-content;
9
- float: right;
10
- margin-top: 0px;
11
- font-family: Inter;
12
- font-style: normal;
13
- font-weight: 600;
14
- font-size: 14px;
15
- line-height: 20px;
16
- border-radius: 4px;
17
- border: 1px solid #ccc;
18
- margin-right: 1px;
19
- z-index: 100;
2
+ padding: 2px 8px;
3
+ position: absolute;
4
+ right: 0px;
5
+ cursor: pointer;
6
+ color: white;
7
+ background-color: black;
8
+ width: fit-content;
9
+ float: right;
10
+ margin-top: 0px;
11
+ font-family: Inter;
12
+ font-style: normal;
13
+ font-weight: 600;
14
+ font-size: 14px;
15
+ line-height: 20px;
16
+ border-radius: 4px;
17
+ border: 1px solid #ccc;
18
+ margin-right: 1px;
19
+ z-index: 100;
20
20
 
21
- .add {
22
- display: flex;
23
- align-items: center;
24
- }
21
+ .add {
22
+ display: flex;
23
+ align-items: center;
24
+ }
25
25
  `;export{o as AddVariableStyled};
@@ -9,7 +9,6 @@ export type LineChartProps = {
9
9
  dotted?: boolean;
10
10
  gradient?: boolean;
11
11
  legend?: string;
12
- squareLegends?: boolean;
13
12
  }[];
14
13
  labels: Array<string>;
15
14
  scaleText?: {
@@ -22,7 +21,6 @@ export type LineChartProps = {
22
21
  min?: number;
23
22
  max?: number;
24
23
  isZeroState?: boolean;
25
- lineThickness?: number;
26
24
  ticksLabelCallback?: (val: string, index: number) => void;
27
25
  };
28
26
  export declare const LineChart: React.FC<LineChartProps>;
@@ -1 +1 @@
1
- import{jsxs as t,jsx as e,Fragment as o}from"react/jsx-runtime";import{Chart as r,CategoryScale as l,LinearScale as i,PointElement as n,BarElement as a,LineElement as s,ArcElement as d,Filler as c,Title as p,Tooltip as u,Legend as m}from"chart.js";import{useState as g,useRef as y,useEffect as b}from"react";import{Line as v}from"react-chartjs-2";import{SmallRegular as h}from"../../../TypographyStyle.js";import{COLORS as f}from"../../../../constants/Theme.js";import{LegendWrapper as x,LegendContainer as k,LegendColor as C}from"./LineChart.styled.js";r.register(l,i,n,a,s,d,c,p,u,m);const j=r=>{let{scaleText:l,labels:i,canvasHeight:n,datas:a,maintainAspectRatio:s=!1,stepSize:d,min:c,max:p,isZeroState:u,lineThickness:m,ticksLabelCallback:j}=r;var z;const[S,w]=g(null),T=y();b((()=>{var t,e,o,r;if(null===(r=null===(o=null===(e=null===(t=T.current)||void 0===t?void 0:t.scales)||void 0===e?void 0:e.y)||void 0===o?void 0:o.ticks)||void 0===r?void 0:r.length){const t=38*T.current.scales.y.ticks.length;w(t)}}),[T]);const q=a.map((t=>({text:t.legend,color:t.lineColor?t.lineColor:t.dotted?f.content.placeholder:f.background.brand,square:t.squareLegends})));return t("div",Object.assign({style:Object.assign(Object.assign({},s?{}:{height:null!==(z=null!=n?n:S)&&void 0!==z?z:204}),{display:"flex",flexDirection:"column",gap:2})},{children:[e(x,{children:q.map(((r,l)=>{let{text:i,color:n,square:a}=r;return i?t(k,{children:[e(C,{color:n,square:a}),e(h,Object.assign({color:"#667085"},{children:i}))]},l):e(o,{})}))}),e(v,{ref:T,options:{maintainAspectRatio:s,responsive:!0,plugins:{legend:{display:!1},title:{display:!1},tooltip:{displayColors:!1,titleFont:()=>({weight:"600",size:14,family:"inter"}),titleColor:()=>f.content.primaryInverse,backgroundColor:f.content.primary,callbacks:{labelTextColor:()=>f.content.primaryInverse},bodyFont:()=>({weight:"400",size:14,family:"inter"})}},scales:{y:{beginAtZero:!0,min:u?0:c,max:u?10:p,ticks:{color:f.content.secondary,callback:t=>{var e;return`${null!==(e=null==l?void 0:l.yPrefix)&&void 0!==e?e:""}${t}`},font:{family:"inter",size:12,weight:"400"},stepSize:u?1:d},title:{display:!!(null==l?void 0:l.y),text:null==l?void 0:l.y},grid:{color:f.background.base}},x:{ticks:{callback:j,color:f.content.secondary,font:{family:"inter",size:12,weight:"400"}},title:{display:!!(null==l?void 0:l.x),text:null==l?void 0:l.x},grid:{display:!1,drawBorder:!1}}}},data:{labels:i,datasets:a.map(((t,e)=>{var o;return{tension:.4,fill:t.gradient?"start":0,pointRadius:1,borderDash:t.dotted?[8,3]:void 0,data:t.data,borderWidth:null!=m?m:2,borderColor:t.lineColor?t.lineColor:t.dotted?f.content.placeholder:f.background.brand,backgroundColor:t.gradient?t=>{const e=t.chart.ctx.createLinearGradient(0,0,0,S?S-75:150);return e.addColorStop(0,"#F1EEFB"),e.addColorStop(1,"rgba(127, 86, 217, 0)"),e}:null!==(o=t.backgroundColor)&&void 0!==o?o:"transparent"}}))}})]}))};export{j as LineChart};
1
+ import{jsxs as t,jsx as e,Fragment as o}from"react/jsx-runtime";import{Chart as r,CategoryScale as l,LinearScale as i,PointElement as n,BarElement as a,LineElement as s,ArcElement as d,Filler as c,Title as p,Tooltip as m,Legend as u}from"chart.js";import{useState as g,useRef as y,useEffect as b}from"react";import{Line as v}from"react-chartjs-2";import{SmallRegular as h}from"../../../TypographyStyle.js";import{COLORS as f}from"../../../../constants/Theme.js";import{LegendWrapper as x,LegendContainer as k,LegendColor as C}from"./LineChart.styled.js";r.register(l,i,n,a,s,d,c,p,m,u);const j=r=>{let{scaleText:l,labels:i,canvasHeight:n,datas:a,maintainAspectRatio:s=!1,stepSize:d,min:c,max:p,isZeroState:m,ticksLabelCallback:u}=r;var j;const[z,S]=g(null),w=y();b((()=>{var t,e,o,r;if(null===(r=null===(o=null===(e=null===(t=w.current)||void 0===t?void 0:t.scales)||void 0===e?void 0:e.y)||void 0===o?void 0:o.ticks)||void 0===r?void 0:r.length){const t=38*w.current.scales.y.ticks.length;S(t)}}),[w]);const F=a.map((t=>({text:t.legend,color:t.lineColor?t.lineColor:t.dotted?f.content.placeholder:f.background.brand})));return t("div",Object.assign({style:Object.assign(Object.assign({},s?{}:{height:null!==(j=null!=n?n:z)&&void 0!==j?j:204}),{display:"flex",flexDirection:"column",gap:2})},{children:[e(x,{children:F.map(((r,l)=>{let{text:i,color:n}=r;return i?t(k,{children:[e(C,{color:n}),e(h,Object.assign({color:"#667085"},{children:i}))]},l):e(o,{})}))}),e(v,{ref:w,options:{maintainAspectRatio:s,responsive:!0,plugins:{legend:{display:!1},title:{display:!1},tooltip:{displayColors:!1,titleFont:()=>({weight:"600",size:14,family:"inter"}),titleColor:()=>f.content.primaryInverse,backgroundColor:f.content.primary,callbacks:{labelTextColor:()=>f.content.primaryInverse},bodyFont:()=>({weight:"400",size:14,family:"inter"})}},scales:{y:{beginAtZero:!0,min:m?0:c,max:m?10:p,ticks:{color:f.content.secondary,callback:t=>{var e;return`${null!==(e=null==l?void 0:l.yPrefix)&&void 0!==e?e:""}${t}`},font:{family:"inter",size:12,weight:"400"},stepSize:m?1:d},title:{display:!!(null==l?void 0:l.y),text:null==l?void 0:l.y},grid:{color:f.background.base}},x:{ticks:{callback:u,color:f.content.secondary,font:{family:"inter",size:12,weight:"400"}},title:{display:!!(null==l?void 0:l.x),text:null==l?void 0:l.x},grid:{display:!1,drawBorder:!1}}}},data:{labels:i,datasets:a.map(((t,e)=>{var o;return{tension:.4,fill:t.gradient?"start":0,pointRadius:1,borderDash:t.dotted?[8,3]:void 0,data:t.data,borderWidth:2,borderColor:t.lineColor?t.lineColor:t.dotted?f.content.placeholder:f.background.brand,backgroundColor:t.gradient?t=>{const e=t.chart.ctx.createLinearGradient(0,0,0,z?z-75:150);return e.addColorStop(0,"#F1EEFB"),e.addColorStop(1,"rgba(127, 86, 217, 0)"),e}:null!==(o=t.backgroundColor)&&void 0!==o?o:"transparent"}}))}})]}))};export{j as LineChart};
@@ -8,7 +8,6 @@ export declare const LegendColor: import("@emotion/styled").StyledComponent<{
8
8
  as?: import("react").ElementType<any> | undefined;
9
9
  } & {
10
10
  color: string;
11
- square?: boolean | undefined;
12
11
  }, import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, {}>;
13
12
  export declare const LegendWrapper: import("@emotion/styled").StyledComponent<{
14
13
  theme?: import("@emotion/react").Theme | undefined;
@@ -1 +1 @@
1
- import c from"@emotion/styled/base";const l=c("div","production"===process.env.NODE_ENV?{target:"eyesbkg2"}:{target:"eyesbkg2",label:"LegendContainer"})("production"===process.env.NODE_ENV?{name:"nqbxsj",styles:"display:flex;flex-direction:row;gap:8px;align-items:center"}:{name:"nqbxsj",styles:"display:flex;flex-direction:row;gap:8px;align-items:center",map:"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxpbmVDaGFydC5zdHlsZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQzBDIiwiZmlsZSI6IkxpbmVDaGFydC5zdHlsZWQudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRDb250YWluZXIgPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0ZmxleC1kaXJlY3Rpb246IHJvdztcblx0Z2FwOiA4cHg7XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xyXG5leHBvcnQgY29uc3QgTGVnZW5kQ29sb3IgPSBzdHlsZWQuZGl2IGBcblx0d2lkdGg6ICR7KHByb3BzKSA9PiAocHJvcHMuc3F1YXJlID8gMTYgOiA4KX1weDtcblx0aGVpZ2h0OiAkeyhwcm9wcykgPT4gKHByb3BzLnNxdWFyZSA/IDE2IDogOCl9cHg7XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IHByb3BzLmNvbG9yfTtcbmA7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRXcmFwcGVyID0gc3R5bGVkLmRpdiBgXG5cdGRpc3BsYXk6IGZsZXg7XG5cdGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cdGdhcDogMTJweDtcblx0anVzdGlmeS1jb250ZW50OiAkeyhwcm9wcykgPT4gKHByb3BzLnBvc2l0aW9uID8gcHJvcHMucG9zaXRpb24gOiAnZW5kJyl9O1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9TGluZUNoYXJ0LnN0eWxlZC5qcy5tYXAiXX0= */",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),d=c("div","production"===process.env.NODE_ENV?{target:"eyesbkg1"}:{target:"eyesbkg1",label:"LegendColor"})("width:",(c=>c.square?16:8),"px;height:",(c=>c.square?16:8),"px;border-radius:4px;background:",(c=>c.color),";"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxpbmVDaGFydC5zdHlsZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT3NDIiwiZmlsZSI6IkxpbmVDaGFydC5zdHlsZWQudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRDb250YWluZXIgPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0ZmxleC1kaXJlY3Rpb246IHJvdztcblx0Z2FwOiA4cHg7XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xyXG5leHBvcnQgY29uc3QgTGVnZW5kQ29sb3IgPSBzdHlsZWQuZGl2IGBcblx0d2lkdGg6ICR7KHByb3BzKSA9PiAocHJvcHMuc3F1YXJlID8gMTYgOiA4KX1weDtcblx0aGVpZ2h0OiAkeyhwcm9wcykgPT4gKHByb3BzLnNxdWFyZSA/IDE2IDogOCl9cHg7XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IHByb3BzLmNvbG9yfTtcbmA7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRXcmFwcGVyID0gc3R5bGVkLmRpdiBgXG5cdGRpc3BsYXk6IGZsZXg7XG5cdGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cdGdhcDogMTJweDtcblx0anVzdGlmeS1jb250ZW50OiAkeyhwcm9wcykgPT4gKHByb3BzLnBvc2l0aW9uID8gcHJvcHMucG9zaXRpb24gOiAnZW5kJyl9O1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9TGluZUNoYXJ0LnN0eWxlZC5qcy5tYXAiXX0= */")),e=c("div","production"===process.env.NODE_ENV?{target:"eyesbkg0"}:{target:"eyesbkg0",label:"LegendWrapper"})("display:flex;flex-direction:row;gap:12px;justify-content:",(c=>c.position?c.position:"end"),";"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxpbmVDaGFydC5zdHlsZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBYXdDIiwiZmlsZSI6IkxpbmVDaGFydC5zdHlsZWQudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRDb250YWluZXIgPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0ZmxleC1kaXJlY3Rpb246IHJvdztcblx0Z2FwOiA4cHg7XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xyXG5leHBvcnQgY29uc3QgTGVnZW5kQ29sb3IgPSBzdHlsZWQuZGl2IGBcblx0d2lkdGg6ICR7KHByb3BzKSA9PiAocHJvcHMuc3F1YXJlID8gMTYgOiA4KX1weDtcblx0aGVpZ2h0OiAkeyhwcm9wcykgPT4gKHByb3BzLnNxdWFyZSA/IDE2IDogOCl9cHg7XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IHByb3BzLmNvbG9yfTtcbmA7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRXcmFwcGVyID0gc3R5bGVkLmRpdiBgXG5cdGRpc3BsYXk6IGZsZXg7XG5cdGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cdGdhcDogMTJweDtcblx0anVzdGlmeS1jb250ZW50OiAkeyhwcm9wcykgPT4gKHByb3BzLnBvc2l0aW9uID8gcHJvcHMucG9zaXRpb24gOiAnZW5kJyl9O1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9TGluZUNoYXJ0LnN0eWxlZC5qcy5tYXAiXX0= */"));export{d as LegendColor,l as LegendContainer,e as LegendWrapper};
1
+ import c from"@emotion/styled/base";const d=c("div","production"===process.env.NODE_ENV?{target:"eyesbkg2"}:{target:"eyesbkg2",label:"LegendContainer"})("production"===process.env.NODE_ENV?{name:"nqbxsj",styles:"display:flex;flex-direction:row;gap:8px;align-items:center"}:{name:"nqbxsj",styles:"display:flex;flex-direction:row;gap:8px;align-items:center",map:"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxpbmVDaGFydC5zdHlsZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQzBDIiwiZmlsZSI6IkxpbmVDaGFydC5zdHlsZWQudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRDb250YWluZXIgPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0ZmxleC1kaXJlY3Rpb246IHJvdztcblx0Z2FwOiA4cHg7XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xyXG5leHBvcnQgY29uc3QgTGVnZW5kQ29sb3IgPSBzdHlsZWQuZGl2IGBcblx0d2lkdGg6IDhweDtcblx0aGVpZ2h0OiA4cHg7XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IHByb3BzLmNvbG9yfTtcbmA7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRXcmFwcGVyID0gc3R5bGVkLmRpdiBgXG5cdGRpc3BsYXk6IGZsZXg7XG5cdGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cdGdhcDogMTJweDtcblx0anVzdGlmeS1jb250ZW50OiAkeyhwcm9wcykgPT4gKHByb3BzLnBvc2l0aW9uID8gcHJvcHMucG9zaXRpb24gOiAnZW5kJyl9O1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9TGluZUNoYXJ0LnN0eWxlZC5qcy5tYXAiXX0= */",toString:function(){return"You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."}}),l=c("div","production"===process.env.NODE_ENV?{target:"eyesbkg1"}:{target:"eyesbkg1",label:"LegendColor"})("width:8px;height:8px;border-radius:4px;background:",(c=>c.color),";"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxpbmVDaGFydC5zdHlsZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBT3NDIiwiZmlsZSI6IkxpbmVDaGFydC5zdHlsZWQudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRDb250YWluZXIgPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0ZmxleC1kaXJlY3Rpb246IHJvdztcblx0Z2FwOiA4cHg7XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xyXG5leHBvcnQgY29uc3QgTGVnZW5kQ29sb3IgPSBzdHlsZWQuZGl2IGBcblx0d2lkdGg6IDhweDtcblx0aGVpZ2h0OiA4cHg7XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IHByb3BzLmNvbG9yfTtcbmA7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRXcmFwcGVyID0gc3R5bGVkLmRpdiBgXG5cdGRpc3BsYXk6IGZsZXg7XG5cdGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cdGdhcDogMTJweDtcblx0anVzdGlmeS1jb250ZW50OiAkeyhwcm9wcykgPT4gKHByb3BzLnBvc2l0aW9uID8gcHJvcHMucG9zaXRpb24gOiAnZW5kJyl9O1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9TGluZUNoYXJ0LnN0eWxlZC5qcy5tYXAiXX0= */")),e=c("div","production"===process.env.NODE_ENV?{target:"eyesbkg0"}:{target:"eyesbkg0",label:"LegendWrapper"})("display:flex;flex-direction:row;gap:12px;justify-content:",(c=>c.position?c.position:"end"),";"+("production"===process.env.NODE_ENV?"":"/*# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkxpbmVDaGFydC5zdHlsZWQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBYXdDIiwiZmlsZSI6IkxpbmVDaGFydC5zdHlsZWQudHMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgc3R5bGVkIGZyb20gJ0BlbW90aW9uL3N0eWxlZCc7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRDb250YWluZXIgPSBzdHlsZWQuZGl2IGBcblx0ZGlzcGxheTogZmxleDtcblx0ZmxleC1kaXJlY3Rpb246IHJvdztcblx0Z2FwOiA4cHg7XG5cdGFsaWduLWl0ZW1zOiBjZW50ZXI7XG5gO1xyXG5leHBvcnQgY29uc3QgTGVnZW5kQ29sb3IgPSBzdHlsZWQuZGl2IGBcblx0d2lkdGg6IDhweDtcblx0aGVpZ2h0OiA4cHg7XG5cdGJvcmRlci1yYWRpdXM6IDRweDtcblx0YmFja2dyb3VuZDogJHsocHJvcHMpID0+IHByb3BzLmNvbG9yfTtcbmA7XHJcbmV4cG9ydCBjb25zdCBMZWdlbmRXcmFwcGVyID0gc3R5bGVkLmRpdiBgXG5cdGRpc3BsYXk6IGZsZXg7XG5cdGZsZXgtZGlyZWN0aW9uOiByb3c7XG5cdGdhcDogMTJweDtcblx0anVzdGlmeS1jb250ZW50OiAkeyhwcm9wcykgPT4gKHByb3BzLnBvc2l0aW9uID8gcHJvcHMucG9zaXRpb24gOiAnZW5kJyl9O1xuYDtcclxuLy8jIHNvdXJjZU1hcHBpbmdVUkw9TGluZUNoYXJ0LnN0eWxlZC5qcy5tYXAiXX0= */"));export{l as LegendColor,d as LegendContainer,e as LegendWrapper};
@@ -7,7 +7,6 @@ export interface InputWithVariablesProps {
7
7
  variablesList: any;
8
8
  onChange: (val: SelectedVariable) => void;
9
9
  onBlur?: (e: Event, val?: SelectedVariable | Variable) => void;
10
- addVarBoxRight: string;
11
10
  allowMix: boolean;
12
11
  prevVariable: SelectedVariable;
13
12
  showHelp?: boolean;
@@ -1,4 +1,5 @@
1
- import{jsxs as e,Fragment as a,jsx as l}from"react/jsx-runtime";import r from"../../assets/icons/PlusIcon.js";import{useRef as i,useState as t,useEffect as d}from"react";import o from"styled-components";import{v4 as n}from"uuid";import{COLORS as s}from"../../constants/Theme.js";import{AddVariableV2SideModal as c}from"../add-variableV2/AddVariableV2SideModal.js";import{AddVariableV2 as u}from"../add-variableV2/AddVariableV2.js";import{AddVariableStyled as v}from"../add-variableV2/AddVariableBox.styled.js";import{Input as h}from"../input/Input.js";import{BodyCaption as p}from"../TypographyStyle.js";const m=o=>{let{type:s,addVarBoxRight:m,allowMix:g,onChange:V,prevVariable:T,variablesList:y,onBlur:f,onlyVariables:x,placeHolder:j,showAddButton:C=!0,showHelp:S,showSideVariablePanel:w,errorMessage:k,showSideModal:A,maxCharLimit:B,noMaxCharCheck:N,labelText:L,labelElement:M,isRequired:O=!1,hintText:q}=o;const E=i(!0),I=i(null),[R,F]=t(!1),[Z]=t(n()),[$,z]=t(),[H,P]=t(T),[D,W]=t(!1),[G,J]=t(!1),[K,Q]=t(0);return d((()=>{if($&&$.actualValue)if(g){if(P((e=>{return{actualValue:(a=e.actualValue,l=$.actualValue,r=K,a.slice(0,r)+l+a.slice(r)),variableType:"string"};var a,l,r})),I.current){Q(I.current.selectionStart);const e=K+$.actualValue.length+2;I.current.setSelectionRange(e,e),Q(e)}}else P((e=>({actualValue:$.actualValue,variableType:$.variableType,needsFetching:$.needsFetching})))}),[$]),d((()=>{E.current?E.current=!1:V(H)}),[H]),e(a,{children:[e(b,Object.assign({isVar:/^{{.*}}$/.test(H.actualValue)},{children:[l(h,{isRequired:O,hintText:q,type:null!=s?s:"text",id:Z,ref:I,skipFocus:!0,isActive:R,value:H.actualValue,validate:e=>[!0,""],errorMessage:k,noMaxCharCheck:N,maxCharLimit:B,labelText:L,labelElement:M,placeholder:j||"Add a value",onClick:e=>{I.current&&Q(I.current.selectionStart)},onChangeText:(e,a)=>{if(I.current&&Q(I.current.selectionStart),x){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||P({actualValue:"",variableType:"string"})}else P(g?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{F(!0),J(!0),document.getElementById("varList")&&!D&&W(!0)},onBlur:e=>{var a,l,r,i,t,d,o;null==f||f(e,H),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"varList"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(i=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===i?void 0:i.includes("exlualr0"))||(null===(d=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?(I.current&&I.current.focus(),F(!0)):"search-bar"===(null===(o=e.relatedTarget)||void 0===o?void 0:o.id)?F(!0):(F(!1),W(!1),J(!1))}}),e("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[H.actualValue&&S&&l("div",Object.assign({style:{marginTop:4}},{children:l(p,{children:`This value is of type ${H.variableType}`})})),C&&G&&l("div",Object.assign({style:{marginTop:k||q?"-24px":"0px"}},{children:l(v,Object.assign({right:m,id:"addVar",onClick:()=>{W(!D)}},{children:e("div",Object.assign({className:"add"},{children:[l(r,{color:"white"}),l("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]})),!w&&D&&l(u,{data:y,showVariable:!0,setShowVariable:()=>{W(!1)},variableValue:$,setVariableValue:z,placeholder:"",pickerSize:"large",enableVariable:!0,selectWithTypes:!0,onSearchBlur:e=>{var a,l,r,i,t,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(t=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?I.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==Z&&(W(!1),J(!1),F(!1)):(W(!1),J(!1),F(!1))}})]})),w&&D&&l(c,{zIndex:2e3,data:null!=y?y:[],showVariable:D,setShowVariable:()=>{W(!1)},placeholder:"Add a variable",customTrigger:e=>{z({actualValue:e.actualValue,variableType:"string"}),P(e)},onSearchBlur:e=>{var a,l,r,i,t,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(t=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?I.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==Z&&(W(!1),J(!1),F(!1)):(W(!1),J(!1),F(!1))}})]})},b=o.div`
1
+ import{jsxs as e,Fragment as a,jsx as l}from"react/jsx-runtime";import r from"../../assets/icons/PlusIcon.js";import{useRef as i,useState as t,useEffect as d}from"react";import o from"styled-components";import{v4 as n}from"uuid";import{COLORS as s}from"../../constants/Theme.js";import{AddVariableV2SideModal as c}from"../add-variableV2/AddVariableV2SideModal.js";import{AddVariableV2 as u}from"../add-variableV2/AddVariableV2.js";import{AddVariableStyled as v}from"../add-variableV2/AddVariableBox.styled.js";import{Input as p}from"../input/Input.js";import{BodyCaption as h}from"../TypographyStyle.js";const m=o=>{let{type:s,allowMix:m,onChange:g,prevVariable:V,variablesList:T,onBlur:y,onlyVariables:f,placeHolder:x,showAddButton:j=!0,showHelp:C,showSideVariablePanel:S,errorMessage:w,showSideModal:k,maxCharLimit:A,noMaxCharCheck:N,labelText:B,labelElement:L,isRequired:M=!1,hintText:O}=o;const q=i(!0),E=i(null),[I,F]=t(!1),[R]=t(n()),[Z,$]=t(),[z,H]=t(V),[P,D]=t(!1),[W,G]=t(!1),[J,K]=t(0);return d((()=>{if(Z&&Z.actualValue)if(m){if(H((e=>{return{actualValue:(a=e.actualValue,l=Z.actualValue,r=J,a.slice(0,r)+l+a.slice(r)),variableType:"string"};var a,l,r})),E.current){K(E.current.selectionStart);const e=J+Z.actualValue.length+2;E.current.setSelectionRange(e,e),K(e)}}else H((e=>({actualValue:Z.actualValue,variableType:Z.variableType,needsFetching:Z.needsFetching})))}),[Z]),d((()=>{q.current?q.current=!1:g(z)}),[z]),e(a,{children:[e(b,Object.assign({isVar:/^{{.*}}$/.test(z.actualValue)},{children:[l(p,{isRequired:M,hintText:O,type:null!=s?s:"text",id:R,ref:E,skipFocus:!0,isActive:I,value:z.actualValue,validate:e=>[!0,""],errorMessage:w,noMaxCharCheck:N,maxCharLimit:A,labelText:B,labelElement:L,placeholder:x||"Add a value",onClick:e=>{E.current&&K(E.current.selectionStart)},onChangeText:(e,a)=>{if(E.current&&K(E.current.selectionStart),f){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||H({actualValue:"",variableType:"string"})}else H(m?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{F(!0),G(!0),document.getElementById("varList")&&!P&&D(!0)},onBlur:e=>{var a,l,r,i,t,d,o;null==y||y(e,z),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"varList"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(i=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===i?void 0:i.includes("exlualr0"))||(null===(d=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?(E.current&&E.current.focus(),F(!0)):"search-bar"===(null===(o=e.relatedTarget)||void 0===o?void 0:o.id)?F(!0):(F(!1),D(!1),G(!1))}}),e("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[z.actualValue&&C&&l("div",Object.assign({style:{marginTop:4}},{children:l(h,{children:`This value is of type ${z.variableType}`})})),j&&W&&l("div",Object.assign({style:{marginTop:w||O?"-24px":"0px"}},{children:l(v,Object.assign({id:"addVar",onClick:()=>{D(!P)}},{children:e("div",Object.assign({className:"add"},{children:[l(r,{color:"white"}),l("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]})),!S&&P&&l(u,{data:T,showVariable:!0,setShowVariable:()=>{D(!1)},variableValue:Z,setVariableValue:$,placeholder:"",pickerSize:"large",enableVariable:!0,selectWithTypes:!0,onSearchBlur:e=>{var a,l,r,i,t,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(t=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?E.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==R&&(D(!1),G(!1),F(!1)):(D(!1),G(!1),F(!1))}})]})),S&&P&&l(c,{zIndex:2e3,data:null!=T?T:[],showVariable:P,setShowVariable:()=>{D(!1)},placeholder:"Add a variable",customTrigger:e=>{$({actualValue:e.actualValue,variableType:"string"}),H(e)},onSearchBlur:e=>{var a,l,r,i,t,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(t=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?E.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==R&&(D(!1),G(!1),F(!1)):(D(!1),G(!1),F(!1))}})]})},b=o.div`
2
+ position: relative;
2
3
  margin-bottom: 16px;
3
4
  input {
4
5
  color: ${e=>e.isVar?s.stroke.brand:"black"};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import o from"../../assets/icons/chevronRight.svg.js";import{useRef as l,useState as c,useEffect as n}from"react";import{CheckBox as s}from"../checkBox/CheckBox.js";import{IconButton as r}from"../icon-button/IconButton.js";import{Tag as d}from"../tag/Tag.js";import{Tooltip as a}from"../tooltips/Tooltip.js";import{TitleRegular as u,BodyPrimary as h}from"../TypographyStyle.js";import{EmptyState as p}from"./emptyState.js";import{ProductPickerShimmer as m}from"./ProductPickerShimmer.js";import{CollectionCardStyle as C,CollectionCardInfoStyle as g,CollectionCardDetailStyle as y,CollectionNameHolder as b}from"./style.js";import{isCollectionPartiallyChecked as f}from"./utility.js";const v=(e,t,i)=>{if(!e)return"";if(e.length<=t)return e;const o=e.slice(0,t-1);return(i?o.slice(0,o.lastIndexOf(" ")):o)+"..."},k=i=>{var o;const{customCollectionRestriction:s,dataLoading:r,collections:d,selectedCollectionsDispatch:a,setCollectionId:u,setSelectedCollectionId:h,selectedCollections:C,setScreen:g,collectionFetcher:y,collectionsDispatch:b,pagingControls:v,storeId:k,setSaveDisabled:I,hideCollectionCheckbox:O,renderWithoutModal:S,pickerType:P}=i,x=l(null),D=l(v.curPage),T=!!s&&(null==C?void 0:C.isCustom),[L,R]=c(!1),w=l(!1);return n((()=>{D.current=v.curPage}),[v.curPage]),n((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&D.current>0&&!w.current&&(I(!0),R(!0),y(D.current,k).then((e=>{b({type:"paged",data:(null==e?void 0:e.collections)||{}}),v.setCurPage(D.current+1),R(!1),I(!1),Object.keys(e).length||(w.current=!0)})).catch())}),{threshold:1});return x.current&&e.observe(x.current),()=>{x.current&&e.unobserve(x.current)}}),[x]),e("div",{children:[(null===(o=Object.keys(null!=d?d:{}))||void 0===o?void 0:o.length)?Object.keys(d).map((e=>t(j,{customCollectionRestriction:s,data:d[e],isDisabled:T&&!(null==C?void 0:C[e]),isChecked:!!(null==C?void 0:C[e]),isPartiallyChecked:f(e,null==d?void 0:d[e],C),selectedCollectionsDispatch:a,setCollectionId:u,setSelectedCollectionId:h,setScreen:g,id:e,hideCollectionCheckbox:O||"-1"===e,selectedCollections:C,renderWithoutModal:S,pickerType:P},e))):r?t(m,{}):t(p,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),t("div",{ref:x}),L&&t(m,{})]})},j=l=>{const{customCollectionRestriction:c,data:n,selectedCollectionsDispatch:p,setCollectionId:m,setSelectedCollectionId:f,isPartiallyChecked:v,setScreen:k,id:j,isChecked:I,isDisabled:O,hideCollectionCheckbox:S,pickerType:P,selectedCollections:x,usedInSearch:D}=l;return e(C,Object.assign({isDisabled:O,onClick:e=>{if(!O){if("COLLECTION"===P)return e.stopPropagation(),p({type:"reset",data:{}}),p({type:"selected",data:{id:j,val:n,isRestricted:c}}),m(j),void f(j);m(j),f(j),k("products")}},isActive:!!x[j],usedInSearch:null!=D&&D},{children:[e(g,{children:[!S&&t(s,{isDisabled:O,isChecked:I,isPartiallyChecked:v,onValueChange:function(e,t,i){null==i||i.stopPropagation(),p(e?{type:"selected",data:{id:j,val:n,isRestricted:c}}:{type:"unselected",data:{id:j}}),f(e?j:"")}}),t(y,{children:t(a,Object.assign({body:n.name,placement:"bottom",delay:400,variant:"light"},{children:e(b,{children:[t(D?h:u,Object.assign({numberOfLines:1},{children:n.name})),n.isSmartCollection?t("div",Object.assign({style:{display:"flex"}},{children:t(d,{tagText:"Smart Collection",type:"warning"})})):t(i,{})]})}))})]}),"COLLECTION"!==P&&t(r,{height:12,width:12,disabled:O,Icon:o})]}))};export{j as CollectionCard,k as CollectionsScreen,v as truncate};
1
+ import{jsxs as e,jsx as t,Fragment as i}from"react/jsx-runtime";import o from"../../assets/icons/chevronRight.svg.js";import{useRef as l,useState as c,useEffect as n}from"react";import{CheckBox as r}from"../checkBox/CheckBox.js";import{IconButton as s}from"../icon-button/IconButton.js";import{Tag as d}from"../tag/Tag.js";import{Tooltip as a}from"../tooltips/Tooltip.js";import{TitleRegular as u,BodyPrimary as h}from"../TypographyStyle.js";import{EmptyState as p}from"./emptyState.js";import{ProductPickerShimmer as m}from"./ProductPickerShimmer.js";import{CollectionCardStyle as C,CollectionCardInfoStyle as g,CollectionCardDetailStyle as v,CollectionNameHolder as y}from"./style.js";import{isCollectionPartiallyChecked as b}from"./utility.js";const f=(e,t,i)=>{if(!e)return"";if(e.length<=t)return e;const o=e.slice(0,t-1);return(i?o.slice(0,o.lastIndexOf(" ")):o)+"..."},k=i=>{var o;const{customCollectionRestriction:r,dataLoading:s,collections:d,selectedCollectionsDispatch:a,setCollectionId:u,setSelectedCollectionId:h,selectedCollections:C,setScreen:g,collectionFetcher:v,collectionsDispatch:y,pagingControls:f,storeId:k,setSaveDisabled:O,hideCollectionCheckbox:I,renderWithoutModal:S,pickerType:P="PRODUCT"}=i,D=l(null),T=l(f.curPage),x=!!r&&(null==C?void 0:C.isCustom),[R,L]=c(!1),w=l(!1);return n((()=>{T.current=f.curPage}),[f.curPage]),n((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&T.current>0&&!w.current&&(O(!0),L(!0),v(T.current,k).then((e=>{y({type:"paged",data:(null==e?void 0:e.collections)||{}}),f.setCurPage(T.current+1),L(!1),O(!1),Object.keys(e).length||(w.current=!0)})).catch())}),{threshold:1});return D.current&&e.observe(D.current),()=>{D.current&&e.unobserve(D.current)}}),[D]),e("div",{children:[(null===(o=Object.keys(null!=d?d:{}))||void 0===o?void 0:o.length)?Object.keys(d).map((e=>{var i,o;const l=!!(null==C?void 0:C[e])&&("PRODUCT"!==P||!!Object.keys(null!==(o=null===(i=null==C?void 0:C[e])||void 0===i?void 0:i.products)&&void 0!==o?o:{}).length);return t(j,{customCollectionRestriction:r,data:d[e],isDisabled:x&&!(null==C?void 0:C[e]),isChecked:l,isPartiallyChecked:b(e,null==d?void 0:d[e],C),selectedCollectionsDispatch:a,setCollectionId:u,setSelectedCollectionId:h,setScreen:g,id:e,hideCollectionCheckbox:I||"-1"===e,selectedCollections:C,renderWithoutModal:S,pickerType:P},e)})):s?t(m,{}):t(p,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),t("div",{ref:D}),R&&t(m,{})]})},j=l=>{const{customCollectionRestriction:c,data:n,selectedCollectionsDispatch:p,setCollectionId:m,setSelectedCollectionId:b,isPartiallyChecked:f,setScreen:k,id:j,isChecked:O,isDisabled:I,hideCollectionCheckbox:S,pickerType:P,usedInSearch:D}=l;return e(C,Object.assign({isDisabled:I,onClick:e=>{if(!I){if("COLLECTION"===P)return e.stopPropagation(),p({type:"reset",data:{}}),p({type:"selected",data:{id:j,val:n,isRestricted:c}}),m(j),void b(j);m(j),b(j),k("products")}},isActive:O,usedInSearch:null!=D&&D},{children:[e(g,{children:[!S&&t(r,{isDisabled:I,isChecked:O,isPartiallyChecked:f,onValueChange:function(e,t,i){null==i||i.stopPropagation(),p(e?{type:"selected",data:{id:j,val:n,isRestricted:c}}:{type:"unselected",data:{id:j}}),b(e?j:"")}}),t(v,{children:t(a,Object.assign({body:n.name,placement:"bottom",delay:400,variant:"light"},{children:e(y,{children:[t(D?h:u,Object.assign({numberOfLines:1},{children:n.name})),n.isSmartCollection?t("div",Object.assign({style:{display:"flex"}},{children:t(d,{tagText:"Smart Collection",type:"warning"})})):t(i,{})]})}))})]}),"COLLECTION"!==P&&t(s,{height:12,width:12,disabled:I,Icon:o})]}))};export{j as CollectionCard,k as CollectionsScreen,f as truncate};
@@ -90,6 +90,7 @@ export type ProductPickerInterface = {
90
90
  selectSingleItem?: boolean;
91
91
  stickyFooter?: boolean;
92
92
  showProductDetails?: boolean;
93
+ containerStyle?: React.CSSProperties;
93
94
  } & ({
94
95
  startupScreen: ScreenName.RearrangeProducts;
95
96
  rearrangeEnabled: true;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as l}from"react";import{COLORS as n}from"../../constants/Theme.js";import{Button as d}from"../button/Button.js";import{Input as a}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as f}from"./rearrangeScreen.js";import{collectionsReducer as b,searchReducer as y,selectedColectionsReducer as S,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as k}from"./searchScreen.js";import{SelectedScreen as P}from"./selectedScreen.js";import{ContainerStyle as x,ScrollContainerStyle as j}from"./style.js";import{OUT_OF_STOCK_ACTION as I}from"./type.js";var F;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(F||(F={}));const O=O=>{const{storeId:T,selectedItems:D,onClose:R,visible:w,zIndex:E,exactLimit:A,limit:V,hideCollectionCheckbox:$,hideProductCheckbox:B,outOfStockAction:L=I.BLUR,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,hideSelectionCount:W,title:G,width:H,renderWithoutModal:Y,onClickSave:K,pickerType:N,hideProductVariants:U=!1,startupScreen:q=F.Collections,rearrangeEnabled:J,selectSingleItem:Q=!1,showProductDetails:X}=O,[Z,_]=r(b,{}),[ee,te]=s([F.Collections,F.RearrangeProducts].includes(q)?q:F.Collections),[oe,ce]=s("grid"),[re,se]=s(""),[ie,le]=s(""),[ne,de]=s(0),[ae,ue]=s(!1),[he,pe]=s(0),[me,Ce]=s(""),[ge,fe]=s(!1),[be,ye]=s(!1),[Se,ve]=r(y,{collections:{},products:{}}),[ke,Pe]=r(S,Object.keys(D).length>0?D:{}),xe=i(null),[je,Ie]=s(!1),[Fe,Oe]=s();l((()=>{ue(!0),ye(!0),O.collectionFetcher(ne,T).then((e=>{_({type:"fetched",data:(null==e?void 0:e.collections)||{}}),ue(!1),de((e=>e+1)),ye(!1)})).catch()}),[]),l((()=>{let e=0;U?Object.keys(ke||[]).forEach((t=>{var o;Object.keys((null===(o=ke[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&ke[-1]&&(null===(c=ke[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(ke||[]).forEach((t=>{var o;Object.keys((null===(o=ke[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=ke[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),pe(e)}),[Z,ke,U]),l((()=>{ie&&(ue(!0),O.productFetcher(ie,T).then((e=>{Object.keys(e).length&&_({type:"productsFetched",data:{collectionId:ie,products:e}}),ue(!1)})).catch())}),[ie]),l((()=>{const e=setTimeout((()=>{"rearrange"!==ee&&(me.length||"collections"!==ee)&&(me.length?(fe(!0),O.searchFetcher(T,me).then((e=>{"collections"in e&&"products"in e?(ve({type:"set",data:e}),_({type:"searched",data:e.collections})):(ve({type:"set",data:{collections:{},products:e}}),_({type:"searched",data:e})),te("searchProducts"),ue(!1),fe(!1)}))):te("collections"))}),800);return()=>clearTimeout(e)}),[me]),l((()=>{K&&(O.onAdd(ke,he),Te())}),[K]),l((()=>{Q&&Object.keys(ke||{}).length&&he&&(O.onAdd(ke,he),Te())}),[Q,ke,he]);const Te=()=>{Pe({type:"reset",data:{}})},De=e(x,{children:[O.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:O.postHeader})),!O.hideGlobalSearch&&t(o,{children:("collections"===ee||"searchProducts"===ee)&&t("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(a,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ge?t(h,{size:"small",color:n.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:me,onChangeText:e=>{e.length&&e.trim().length?Ce(e):Ce("")}})}))}),e(j,Object.assign({ref:xe,screenName:ee},{children:["collections"===ee&&t(m,{customCollectionRestriction:O.customCollectionRestriction,dataLoading:be,collections:Z,selectedCollectionsDispatch:Pe,setCollectionId:se,setSelectedCollectionId:le,setScreen:te,selectedCollections:ke,collectionFetcher:O.collectionFetcher,storeId:T,collectionsDispatch:_,setSaveDisabled:ue,pagingControls:{curPage:ne,setCurPage:de},hideCollectionCheckbox:$,renderWithoutModal:Y,pickerType:N}),"products"===ee&&re&&t(v.Provider,Object.assign({value:re},{children:t(g,{hideInCollectionSearch:O.hideInCollectionSearch,customCollectionRestriction:O.customCollectionRestriction,productFetcher:O.productFetcher,setScreen:te,storeId:T,data:Z[re],collectionsDispatch:_,selectedCollectionsDispatch:Pe,selectedData:ke,setSaveDisabled:ue,searchInCollectionFetcher:O.searchInCollectionFetcher,hideProductCheckbox:B,outOfStockAction:L,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,renderWithoutModal:Y,pickerType:N,hideProductVariants:U,fbStatusFetcher:O.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Oe(e)},showProductDetailInfoIcon:X,scrollContainerRef:xe})})),"view"===ee&&t(P,{selectedCollections:ke||{},selectedCollectionsDispatch:Pe,setScreen:te,collections:Z,hideProductVariants:U,outOfStockAction:L,storeId:T,fbStatusFetcher:O.fbStatusFetcher}),"rearrange"===ee&&t(f,{selectedCollections:ke||{},selectedCollectionsDispatch:Pe,setScreen:te,outOfStockAction:L,rearrangeViewType:"grid"===oe?"list":"grid",scrollContainerRef:xe,storeId:T,fbStatusFetcher:O.fbStatusFetcher}),"searchProducts"===ee&&t(k,{customCollectionRestriction:O.customCollectionRestriction,selectedCollections:ke||{},searchedCollections:Se||{},searchedCollectionsDispatch:ve,selectedCollectionsDispatch:Pe,setScreen:te,collections:Z,onBackPress:()=>{Ce(""),ve({type:"set",data:{collections:{},products:{}}})},pickerType:N,hideProductCheckbox:B,hideProductVariants:U,hideVariantCheckbox:M,storeId:T,fbStatusFetcher:O.fbStatusFetcher,setCollectionId:se,setSelectedCollectionId:le,renderWithoutModal:Y,hideCollectionCheckbox:$,outOfStockAction:L})]}))]});return t(o,{children:Y?De:e(u,Object.assign({zIndex:E,open:w,onClose:()=>{null==R||R(),Te()},headingTitle:G||("collections"===ee||"products"===ee?"Select Products":"view"===ee?"Selected Products":"searchProducts"===ee?"Searched Results":"rearrange"===ee?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:H||"600px"},headerRightCustomElement:"rearrange"===ee?(console.log("ignore:",ce),t(o,{})):t(o,{}),footerContainerStyle:O.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:{buttonText:ae?"Loading...":ee===F.RearrangeProducts?"Done":"Add",disabled:ae||he<1||A&&he<A||!A&&V&&he>V||!1,onClick:()=>{O.onAdd(ke,he),Te()}},wrapperStyle:O.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?t(o,{}):A&&he>A?t(p,{tagText:`You can only select ${A} products`,type:"negative"}):V&&he>V?t(p,{tagText:`You can only select ${V} products`,type:"negative"}):t(d,he>0?{onClick:()=>{te(J?F.RearrangeProducts:F.SelectedProducts)},buttonText:A?`${he}/${A} products selected`:`${he} products selected`,buttonType:["rearrange","view"].includes(ee)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(ee)}:{disabled:!0,buttonText:A?`${he}/${A} products selected`:`${he} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:je},{children:[De,je&&Fe?t(C,{productData:Fe,outOfStockAction:L,onClose:()=>{Ie(!1)}}):t(o,{})]}))})};export{O as ProductPickerModal,F as ScreenName};
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as l}from"react";import{COLORS as n}from"../../constants/Theme.js";import{Button as d}from"../button/Button.js";import{Input as a}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as f}from"./rearrangeScreen.js";import{collectionsReducer as b,searchReducer as y,selectedColectionsReducer as S,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as k}from"./searchScreen.js";import{SelectedScreen as P}from"./selectedScreen.js";import{ContainerStyle as j,ScrollContainerStyle as x}from"./style.js";import{OUT_OF_STOCK_ACTION as I}from"./type.js";var F;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(F||(F={}));const O=O=>{const{storeId:T,selectedItems:D,onClose:R,visible:w,zIndex:E,exactLimit:A,limit:V,hideCollectionCheckbox:$,hideProductCheckbox:B,outOfStockAction:L=I.BLUR,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,hideSelectionCount:W,title:G,width:H,renderWithoutModal:Y,onClickSave:K,pickerType:N,hideProductVariants:U=!1,startupScreen:q=F.Collections,rearrangeEnabled:J,selectSingleItem:Q=!1,showProductDetails:X,containerStyle:Z}=O,[_,ee]=r(b,{}),[te,oe]=s([F.Collections,F.RearrangeProducts].includes(q)?q:F.Collections),[ce,re]=s("grid"),[se,ie]=s(""),[le,ne]=s(""),[de,ae]=s(0),[ue,he]=s(!1),[pe,me]=s(0),[Ce,ge]=s(""),[fe,be]=s(!1),[ye,Se]=s(!1),[ve,ke]=r(y,{collections:{},products:{}}),[Pe,je]=r(S,Object.keys(D).length>0?D:{}),xe=i(null),[Ie,Fe]=s(!1),[Oe,Te]=s();l((()=>{he(!0),Se(!0),O.collectionFetcher(de,T).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),he(!1),ae((e=>e+1)),Se(!1)})).catch()}),[]),l((()=>{let e=0;U?Object.keys(Pe||[]).forEach((t=>{var o;Object.keys((null===(o=Pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&Pe[-1]&&(null===(c=Pe[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(Pe||[]).forEach((t=>{var o;Object.keys((null===(o=Pe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=Pe[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),me(e)}),[_,Pe,U]),l((()=>{le&&(he(!0),O.productFetcher(le,T).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:le,products:e}}),he(!1)})).catch())}),[le]),l((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(Ce.length||"collections"!==te)&&(Ce.length?(be(!0),O.searchFetcher(T,Ce).then((e=>{"collections"in e&&"products"in e?(ke({type:"set",data:e}),ee({type:"searched",data:e.collections})):(ke({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),he(!1),be(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[Ce]),l((()=>{K&&(O.onAdd(Pe,pe),De())}),[K]),l((()=>{Q&&Object.keys(Pe||{}).length&&pe&&(O.onAdd(Pe,pe),De())}),[Q,Pe,pe]);const De=()=>{je({type:"reset",data:{}})},Re=e(j,Object.assign({style:null!=Z?Z:{}},{children:[O.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:O.postHeader})),!O.hideGlobalSearch&&t(o,{children:("collections"===te||"searchProducts"===te)&&t("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(a,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>fe?t(h,{size:"small",color:n.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:Ce,onChangeText:e=>{e.length&&e.trim().length?ge(e):ge("")}})}))}),e(x,Object.assign({ref:xe,screenName:te},{children:["collections"===te&&t(m,{customCollectionRestriction:O.customCollectionRestriction,dataLoading:ye,collections:_,selectedCollectionsDispatch:je,setCollectionId:ie,setSelectedCollectionId:ne,setScreen:oe,selectedCollections:Pe,collectionFetcher:O.collectionFetcher,storeId:T,collectionsDispatch:ee,setSaveDisabled:he,pagingControls:{curPage:de,setCurPage:ae},hideCollectionCheckbox:$,renderWithoutModal:Y,pickerType:N}),"products"===te&&se&&t(v.Provider,Object.assign({value:se},{children:t(g,{hideInCollectionSearch:O.hideInCollectionSearch,customCollectionRestriction:O.customCollectionRestriction,productFetcher:O.productFetcher,setScreen:oe,storeId:T,data:_[se],collectionsDispatch:ee,selectedCollectionsDispatch:je,selectedData:Pe,setSaveDisabled:he,searchInCollectionFetcher:O.searchInCollectionFetcher,hideProductCheckbox:B,outOfStockAction:L,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,renderWithoutModal:Y,pickerType:N,hideProductVariants:U,fbStatusFetcher:O.fbStatusFetcher,onProductDetailClick:e=>{Fe(!0),Te(e)},showProductDetailInfoIcon:X,scrollContainerRef:xe})})),"view"===te&&t(P,{selectedCollections:Pe||{},selectedCollectionsDispatch:je,setScreen:oe,collections:_,hideProductVariants:U,outOfStockAction:L,storeId:T,fbStatusFetcher:O.fbStatusFetcher}),"rearrange"===te&&t(f,{selectedCollections:Pe||{},selectedCollectionsDispatch:je,setScreen:oe,outOfStockAction:L,rearrangeViewType:"grid"===ce?"list":"grid",scrollContainerRef:xe,storeId:T,fbStatusFetcher:O.fbStatusFetcher}),"searchProducts"===te&&t(k,{customCollectionRestriction:O.customCollectionRestriction,selectedCollections:Pe||{},searchedCollections:ve||{},searchedCollectionsDispatch:ke,selectedCollectionsDispatch:je,setScreen:oe,collections:_,onBackPress:()=>{ge(""),ke({type:"set",data:{collections:{},products:{}}})},pickerType:N,hideProductCheckbox:B,hideProductVariants:U,hideVariantCheckbox:M,storeId:T,fbStatusFetcher:O.fbStatusFetcher,setCollectionId:ie,setSelectedCollectionId:ne,renderWithoutModal:Y,hideCollectionCheckbox:$,outOfStockAction:L})]}))]}));return t(o,{children:Y?Re:e(u,Object.assign({zIndex:E,open:w,onClose:()=>{null==R||R(),De()},headingTitle:G||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:H||"600px"},headerRightCustomElement:t(o,{}),footerContainerStyle:O.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:{buttonText:ue?"Loading...":te===F.RearrangeProducts?"Done":"Add",disabled:ue||pe<1||A&&pe<A||!A&&V&&pe>V||!1,onClick:()=>{O.onAdd(Pe,pe),De()}},wrapperStyle:O.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?t(o,{}):A&&pe>A?t(p,{tagText:`You can only select ${A} products`,type:"negative"}):V&&pe>V?t(p,{tagText:`You can only select ${V} products`,type:"negative"}):t(d,pe>0?{onClick:()=>{oe(J?F.RearrangeProducts:F.SelectedProducts)},buttonText:A?`${pe}/${A} products selected`:`${pe} products selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}:{disabled:!0,buttonText:A?`${pe}/${A} products selected`:`${pe} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:Ie},{children:[Re,Ie&&Oe?t(C,{productData:Oe,outOfStockAction:L,onClose:()=>{Fe(!1)}}):t(o,{})]}))})};export{O as ProductPickerModal,F as ScreenName};
@@ -1 +1 @@
1
- import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{COLORS as e}from"../../constants/Theme.js";import c from"../../assets/icons/info.svg.js";import{CheckBox as d}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{ShimmerImage as l}from"../shimmer-image/ShimmerImage.js";import{Tooltip as r}from"../tooltips/Tooltip.js";import{BodyPrimary as a}from"../TypographyStyle.js";import{ProductPickerTag as s}from"./ProductPickerTag.js";import{ProductCardStyle as u}from"./style.js";import{shouldShowVariant as p}from"./utility.js";const h=o=>{const{collectionId:e,productId:c,data:d,selectedData:n,selectedCollectionsDispatch:l,viewOnly:r,upliftAdditions:a,isProductPartiallyChecked:s,hideProductCheckbox:u,outOfStockAction:h,hideVariantCheckbox:m,hideProductVariants:I,pickerType:f,onProductDetailClick:k,showProductDetailInfoIcon:y}=o,C=t=>{var i,o,d,l,r,a;if(!(null===(o=null===(i=null==n?void 0:n[e])||void 0===i?void 0:i.products)||void 0===o?void 0:o[c]))return!1;return!!(null===(a=null===(r=null===(l=null===(d=null==n?void 0:n[e])||void 0===d?void 0:d.products)||void 0===l?void 0:l[c])||void 0===r?void 0:r.variants)||void 0===a?void 0:a[t])};return t("div",{children:[i(v,{isVariant:!1,data:d,productId:c,collectionId:e,isSelected:!!(null===(b=null===(P=null==n?void 0:n[e])||void 0===P?void 0:P.products)||void 0===b?void 0:b[c]),isPartiallyChecked:s,selectedCollectionsDispatch:l,upliftAdditions:a,viewOnly:r,hideProductCheckbox:u,hideVariantCheckbox:m,hideProductVariants:I,pickerType:f,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:y},c),I?null:p(d)&&Object.keys(d.variants||[]).map((t=>i(v,{isVariant:!0,hideVariantCheckbox:m,data:d.variants[t],variantId:t,productId:c,viewOnly:r,upliftAdditions:a,collectionId:e,isSelected:C(t),selectedCollectionsDispatch:l,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:y},t)))]});var P,b},v=p=>{const{isVariant:h,data:v,productId:m,collectionId:I,variantId:f,isSelected:k,selectedCollectionsDispatch:y,viewOnly:C,upliftAdditions:P,isPartiallyChecked:b,hideProductCheckbox:j,outOfStockAction:O,hideVariantCheckbox:g,hideProductVariants:D,pickerType:x="PRODUCT",onProductDetailClick:S,showProductDetailInfoIcon:V}=p;return t(u,Object.assign({isVariant:h,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===x){const t=Object.keys(v.variants);D?P("productSelected",{productId:m,variantId:f,collectionId:I,product:v}):P("variantSelected",{productId:m,variantId:f||t[0],collectionId:I,variant:v})}},isActive:k},{children:[h&&!C&&!g||!h&&!C&&!j?i(d,{isChecked:k,isPartiallyChecked:b||!1,onValueChange:function(t){h?t?P(D?"productSelected":"variantSelected",{productId:m,variantId:f,collectionId:I,variant:v}):y({type:D?"productUnselected":"variantUnselected",data:{productId:m,variantId:f,collectionId:I}}):t?P("productSelected",{productId:m,collectionId:I,product:v}):y({type:"productUnselected",data:{productId:m,collectionId:I}})}}):i(o,{}),i("div",{children:i(l,{width:40,height:40,imageUrl:v.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[i(r,Object.assign({variant:"light",body:v.name,placement:"bottom",delay:400},{children:i(a,Object.assign({numberOfLines:1},{children:v.name}))})),V&&i(n,{onClick:()=>{null==S||S(v)},Icon:()=>i(c,{width:20,height:20,color:e.content.placeholder})})]})),i(s,{isVariant:h,data:v,outOfStockAction:O})]}))]}))};export{v as ProductCard,h as ProductGroup};
1
+ import{jsxs as t,jsx as i,Fragment as o}from"react/jsx-runtime";import{COLORS as e}from"../../constants/Theme.js";import c from"../../assets/icons/info.svg.js";import{CheckBox as d}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{ShimmerImage as l}from"../shimmer-image/ShimmerImage.js";import{Tooltip as a}from"../tooltips/Tooltip.js";import{BodyPrimary as r}from"../TypographyStyle.js";import{ProductPickerTag as s}from"./ProductPickerTag.js";import{ProductCardStyle as u}from"./style.js";import{shouldShowVariant as p}from"./utility.js";const h=o=>{const{collectionId:e,productId:c,data:d,selectedData:n,selectedCollectionsDispatch:l,viewOnly:a,upliftAdditions:r,isProductPartiallyChecked:s,hideProductCheckbox:u,outOfStockAction:h,hideVariantCheckbox:I,hideProductVariants:m,pickerType:f,onProductDetailClick:k,showProductDetailInfoIcon:y}=o,C=t=>{var i,o,d,l,a,r;if(!(null===(o=null===(i=null==n?void 0:n[e])||void 0===i?void 0:i.products)||void 0===o?void 0:o[c]))return!1;return!!(null===(r=null===(a=null===(l=null===(d=null==n?void 0:n[e])||void 0===d?void 0:d.products)||void 0===l?void 0:l[c])||void 0===a?void 0:a.variants)||void 0===r?void 0:r[t])};return t("div",{children:[i(v,{isVariant:!1,data:d,productId:c,collectionId:e,isSelected:!!(null===(b=null===(P=null==n?void 0:n[e])||void 0===P?void 0:P.products)||void 0===b?void 0:b[c]),isPartiallyChecked:s,selectedCollectionsDispatch:l,upliftAdditions:r,viewOnly:a,hideProductCheckbox:u,hideVariantCheckbox:I,hideProductVariants:m,pickerType:f,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:y},c),m?null:p(d)&&Object.keys(d.variants||[]).map((t=>i(v,{isVariant:!0,hideVariantCheckbox:I,data:d.variants[t],variantId:t,productId:c,viewOnly:a,upliftAdditions:r,collectionId:e,isSelected:C(t),selectedCollectionsDispatch:l,outOfStockAction:h,onProductDetailClick:k,showProductDetailInfoIcon:y},t)))]});var P,b},v=p=>{const{isVariant:h,data:v,productId:I,collectionId:m,variantId:f,isSelected:k,selectedCollectionsDispatch:y,viewOnly:C,upliftAdditions:P,isPartiallyChecked:b,hideProductCheckbox:g,outOfStockAction:j,hideVariantCheckbox:O,hideProductVariants:D,pickerType:x="PRODUCT",onProductDetailClick:S,showProductDetailInfoIcon:V}=p;return t(u,Object.assign({isVariant:h,onClick:t=>{if(t.stopPropagation(),"PRODUCT"===x&&(g||O)){const t=Object.keys(v.variants);D?k?y({type:"productUnselected",data:{productId:I,collectionId:m}}):P("productSelected",{productId:I,variantId:f,collectionId:m,product:v}):k?y({type:"variantUnselected",data:{productId:I,variantId:f,collectionId:m}}):P("variantSelected",{productId:I,variantId:f||t[0],collectionId:m,variant:v})}},isActive:k},{children:[h&&!C&&!O||!h&&!C&&!g?i(d,{isChecked:k,isPartiallyChecked:b||!1,onValueChange:function(t,i,o){null==o||o.stopPropagation(),h?t?P(D?"productSelected":"variantSelected",{productId:I,variantId:f,collectionId:m,variant:v}):y({type:D?"productUnselected":"variantUnselected",data:{productId:I,variantId:f,collectionId:m}}):t?P("productSelected",{productId:I,collectionId:m,product:v}):y({type:"productUnselected",data:{productId:I,collectionId:m}})}}):i(o,{}),i("div",{children:i(l,{width:40,height:40,imageUrl:v.image,alt:"Item",borderRadius:4})}),t("div",Object.assign({style:{display:"flex",flexDirection:"column",flex:1}},{children:[t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between"}},{children:[i(a,Object.assign({variant:"light",body:v.name,placement:"bottom",delay:400},{children:i(r,Object.assign({numberOfLines:1},{children:v.name}))})),V&&i(n,{onClick:()=>{null==S||S(v)},Icon:()=>i(c,{width:20,height:20,color:e.content.placeholder})})]})),i(s,{isVariant:h,data:v,outOfStockAction:j})]}))]}))};export{v as ProductCard,h as ProductGroup};
@@ -1 +1 @@
1
- import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import r from"../../assets/icons/search.svg.js";import{cloneDeep as n}from"lodash";import{useContext as i,useRef as s,useState as l,useEffect as d}from"react";import{COLORS as a}from"../../constants/Theme.js";import{CheckBox as u}from"../checkBox/CheckBox.js";import{IconButton as h}from"../icon-button/IconButton.js";import{Input as p}from"../input/Input.js";import{Spinner as m}from"../spinner/Spinner.js";import{BodyCaption as v,TitleRegular as g}from"../TypographyStyle.js";import{EmptyState as j}from"./emptyState.js";import{ProductGroup as f}from"./product.js";import{ProductPickerShimmer as y}from"./ProductPickerShimmer.js";import{CollectionIdContext as b}from"./reducers.js";import{ProductScreenHeader as k,ProductScreenCollectionCardStyle as O}from"./style.js";import{OUT_OF_STOCK_ACTION as C}from"./type.js";import{getVariantIdsToFetchAtProductLevel as P,markVariantsAsApprovedProductsLevel as E,isCollectionPartiallyChecked as I,isProductPartiallyChecked as D,liftTheStateUp as x}from"./utility.js";const S=S=>{const{data:T,collectionsDispatch:w,selectedData:R,selectedCollectionsDispatch:V,productFetcher:A,storeId:B,setScreen:F,setSaveDisabled:H,hideInCollectionSearch:L,customCollectionRestriction:J,hideProductCheckbox:W,outOfStockAction:z=C.BLUR,hideVariantCheckbox:K=!1,selectProductsFromCustomCollection:M=!1,pickerType:N,hideProductVariants:U,fbStatusFetcher:_,onProductDetailClick:q,showProductDetailInfoIcon:G,scrollContainerRef:Q}=S,X=i(b),Y=s(0),Z=s(!1),[$,tt]=l(!1),[et,ot]=l(""),[ct,rt]=l(!1),[nt,it]=l(T),st=s(!1);d((()=>{const t=setTimeout((()=>{et.length?(rt(!0),S.searchInCollectionFetcher(B,X,et).then((t=>{const e=n(T);e.products=t,it(e);const o=P(null!=t?t:{});at(o,null!=t?t:{},!0),H(!1),rt(!1)}))):it(T)}),800);return()=>clearTimeout(t)}),[et]);const lt=()=>{if(!Q||!(null==Q?void 0:Q.current))return;const{scrollTop:t,clientHeight:e,scrollHeight:o}=Q.current;t+e>=o-20&&!st.current&&!Z.current&&(H(!0),tt(!0),Z.current=!0,A(X,B,10,Y.current).then((t=>{if(Object.keys(t).length||(st.current=!0),Object.keys(t).length){const e=nt;e.products=Object.assign(Object.assign({},nt.products),t),it(e);const o=P(t);at(o,t),Y.current+=1}Z.current=!1,tt(!1),H(!1)})).catch())};d((()=>{var t;return null===(t=null==Q?void 0:Q.current)||void 0===t||t.addEventListener("scroll",lt),()=>{var t;null===(t=null==Q?void 0:Q.current)||void 0===t||t.removeEventListener("scroll",lt)}}),[]),d((()=>{var t,e,o,c;st.current=!1,Y.current=Math.floor((null===(e=Object.keys(null!==(t=T.products)&&void 0!==t?t:{}))||void 0===e?void 0:e.length)/10);const r=P(null!==(o=T.products)&&void 0!==o?o:{});at(r,null!==(c=T.products)&&void 0!==c?c:{})}),[X]);const dt=!!J&&T.isSmartCollection;d((()=>{(null==T?void 0:T.products)||ut(10)}),[]);const at=(t,e,o)=>{_||(o?E(e,w,X,nt,it):E(e,w,X)),t.length>0&&_&&_(B,t).then((t=>{const c=Object.assign({},e);Object.keys(e).forEach((o=>{var r,n;Object.keys(null!==(n=null===(r=null==e?void 0:e[o])||void 0===r?void 0:r.variants)&&void 0!==n?n:{}).forEach((r=>{var n,i;const s=null===(n=null==e?void 0:e[o].variants)||void 0===n?void 0:n[r];s&&"REJECTED"===t[r]?s.fbStatus="REJECTED":s&&"APPROVED"===t[r]&&(s.fbStatus="APPROVED");const l=null===(i=null==c?void 0:c[o])||void 0===i?void 0:i.variants;l&&l[r]&&(l[r]=s)}))})),o?(it((t=>{const e=Object.assign({},t);return e.products=c,e})),w({type:"productsPaged",data:{collectionId:X,products:c}})):w({type:"productsPaged",data:{collectionId:X,products:c}})})).catch((t=>{o?E(e,w,X,nt,it):E(e,w,X)}))},ut=t=>{H(!0),rt(!0),A(X,B,t,0).then((e=>{if(Object.keys(e).length||(st.current=!0),Object.keys(e).length){it(Object.assign(Object.assign({},nt),{products:e}));const t=P(e);at(t,e),Y.current=1}t||V({type:"selected",data:{id:X,val:Object.assign(Object.assign({},T),{products:e})}}),H(!1),rt(!1)})).catch()},ht=(t,e)=>{const o=x(e,T);V({type:t,data:Object.assign(Object.assign({},o),{isRestricted:J})})};return t("div",{children:[t(k,{children:[e(h,{Icon:o,height:16,onClick:()=>{F("collections")}}),e(v,Object.assign({style:{color:a.content.secondary}},{children:T.name}))]}),!L&&e("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e(p,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ct&&et.length?e(m,{size:"small",color:a.content.primary}):e(r,{})},id:"listInput",height:"24px",type:"text",value:et,onChangeText:t=>{t.length&&t.trim().length?ot(t):ot("")},placeholder:"Search products in this collection..."})})),t("div",{children:[Object.keys((null==nt?void 0:nt.products)||[]).length>0&&!dt&&!et.length&&!W&&"-1"!==X&&t(O,{children:[e(u,{isChecked:!!(null==R?void 0:R[X]),isPartiallyChecked:I(X,nt,R,U),onValueChange:function(t){t?ut():V({type:"unselected",data:{id:X}})}}),e("div",Object.assign({style:{width:40,height:40}},{children:e(c,{})})),e(g,{children:"All Products"})]}),Object.keys((null==nt?void 0:nt.products)||[]).length?Object.keys(nt.products||[]).map((t=>e(f,{outOfStockAction:z,collectionId:X,isProductPartiallyChecked:D(X,t,R,nt,U),productId:t,data:nt.products[t],selectedData:R,selectedCollectionsDispatch:V,viewOnly:!M&&!!dt,upliftAdditions:ht,hideProductCheckbox:W,hideVariantCheckbox:K,hideProductVariants:U,pickerType:N,onProductDetailClick:q,showProductDetailInfoIcon:G},t))):ct?e(y,{limit:10}):e(j,{title:"No products to show",subtitle:et.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]}),$&&e(y,{})]})};export{S as ProductsScreen};
1
+ import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import r from"../../assets/icons/search.svg.js";import{cloneDeep as n}from"lodash";import{useContext as i,useRef as s,useState as l,useEffect as d}from"react";import{COLORS as u}from"../../constants/Theme.js";import{CheckBox as a}from"../checkBox/CheckBox.js";import{IconButton as h}from"../icon-button/IconButton.js";import{Input as p}from"../input/Input.js";import{Spinner as m}from"../spinner/Spinner.js";import{BodyCaption as v,TitleRegular as g}from"../TypographyStyle.js";import{EmptyState as j}from"./emptyState.js";import{ProductGroup as f}from"./product.js";import{ProductPickerShimmer as y}from"./ProductPickerShimmer.js";import{CollectionIdContext as b}from"./reducers.js";import{ProductScreenHeader as k,ProductScreenCollectionCardStyle as O}from"./style.js";import{OUT_OF_STOCK_ACTION as C}from"./type.js";import{getVariantIdsToFetchAtProductLevel as P,markVariantsAsApprovedProductsLevel as E,isCollectionPartiallyChecked as I,isProductPartiallyChecked as D,liftTheStateUp as x}from"./utility.js";const S=S=>{var T,w;const{data:R,collectionsDispatch:V,selectedData:A,selectedCollectionsDispatch:B,productFetcher:F,storeId:H,setScreen:L,setSaveDisabled:J,hideInCollectionSearch:W,customCollectionRestriction:z,hideProductCheckbox:K,outOfStockAction:M=C.BLUR,hideVariantCheckbox:N=!1,selectProductsFromCustomCollection:U=!1,pickerType:_,hideProductVariants:q,fbStatusFetcher:G,onProductDetailClick:Q,showProductDetailInfoIcon:X,scrollContainerRef:Y}=S,Z=i(b),$=s(0),tt=s(!1),[et,ot]=l(!1),[ct,rt]=l(""),[nt,it]=l(!1),[st,lt]=l(R),dt=s(!1);d((()=>{const t=setTimeout((()=>{ct.length?(it(!0),S.searchInCollectionFetcher(H,Z,ct).then((t=>{const e=n(R);e.products=t,lt(e);const o=P(null!=t?t:{});ht(o,null!=t?t:{},!0),J(!1),it(!1)}))):lt(R)}),800);return()=>clearTimeout(t)}),[ct]);const ut=()=>{if(!Y||!(null==Y?void 0:Y.current))return;const{scrollTop:t,clientHeight:e,scrollHeight:o}=Y.current;t+e>=o-20&&!dt.current&&!tt.current&&(J(!0),ot(!0),tt.current=!0,F(Z,H,10,$.current).then((t=>{if(Object.keys(t).length||(dt.current=!0),Object.keys(t).length){const e=st;e.products=Object.assign(Object.assign({},st.products),t),lt(e);const o=P(t);ht(o,t),$.current+=1}tt.current=!1,ot(!1),J(!1)})).catch())};d((()=>{var t;return null===(t=null==Y?void 0:Y.current)||void 0===t||t.addEventListener("scroll",ut),()=>{var t;null===(t=null==Y?void 0:Y.current)||void 0===t||t.removeEventListener("scroll",ut)}}),[]),d((()=>{var t,e,o,c;dt.current=!1,$.current=Math.floor((null===(e=Object.keys(null!==(t=R.products)&&void 0!==t?t:{}))||void 0===e?void 0:e.length)/10);const r=P(null!==(o=R.products)&&void 0!==o?o:{});ht(r,null!==(c=R.products)&&void 0!==c?c:{})}),[Z]);const at=!!z&&R.isSmartCollection;d((()=>{(null==R?void 0:R.products)||pt(10)}),[]);const ht=(t,e,o)=>{G||(o?E(e,V,Z,st,lt):E(e,V,Z)),t.length>0&&G&&G(H,t).then((t=>{const c=Object.assign({},e);Object.keys(e).forEach((o=>{var r,n;Object.keys(null!==(n=null===(r=null==e?void 0:e[o])||void 0===r?void 0:r.variants)&&void 0!==n?n:{}).forEach((r=>{var n,i;const s=null===(n=null==e?void 0:e[o].variants)||void 0===n?void 0:n[r];s&&"REJECTED"===t[r]?s.fbStatus="REJECTED":s&&"APPROVED"===t[r]&&(s.fbStatus="APPROVED");const l=null===(i=null==c?void 0:c[o])||void 0===i?void 0:i.variants;l&&l[r]&&(l[r]=s)}))})),o?(lt((t=>{const e=Object.assign({},t);return e.products=c,e})),V({type:"productsPaged",data:{collectionId:Z,products:c}})):V({type:"productsPaged",data:{collectionId:Z,products:c}})})).catch((t=>{o?E(e,V,Z,st,lt):E(e,V,Z)}))},pt=t=>{J(!0),it(!0),F(Z,H,t,0).then((e=>{if(Object.keys(e).length||(dt.current=!0),Object.keys(e).length){lt(Object.assign(Object.assign({},st),{products:e}));const t=P(e);ht(t,e),$.current=1}t||B({type:"selected",data:{id:Z,val:Object.assign(Object.assign({},R),{products:e})}}),J(!1),it(!1)})).catch()},mt=(t,e)=>{const o=x(e,R);B({type:t,data:Object.assign(Object.assign({},o),{isRestricted:z})})},vt=!!(null==A?void 0:A[Z])&&!!Object.keys(null!==(w=null===(T=null==A?void 0:A[Z])||void 0===T?void 0:T.products)&&void 0!==w?w:{}).length;return t("div",{children:[t(k,{children:[e(h,{Icon:o,height:16,onClick:()=>{L("collections")}}),e(v,Object.assign({style:{color:u.content.secondary}},{children:R.name}))]}),!W&&e("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e(p,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>nt&&ct.length?e(m,{size:"small",color:u.content.primary}):e(r,{})},id:"listInput",height:"24px",type:"text",value:ct,onChangeText:t=>{t.length&&t.trim().length?rt(t):rt("")},placeholder:"Search products in this collection..."})})),t("div",{children:[Object.keys((null==st?void 0:st.products)||[]).length>0&&!at&&!ct.length&&!K&&"-1"!==Z&&t(O,{children:[e(a,{isChecked:vt,isPartiallyChecked:I(Z,st,A,q),onValueChange:function(t){t?pt():B({type:"unselected",data:{id:Z}})}}),e("div",Object.assign({style:{width:40,height:40}},{children:e(c,{})})),e(g,{children:"All Products"})]}),Object.keys((null==st?void 0:st.products)||[]).length?Object.keys(st.products||[]).map((t=>e(f,{outOfStockAction:M,collectionId:Z,isProductPartiallyChecked:D(Z,t,A,st,q),productId:t,data:st.products[t],selectedData:A,selectedCollectionsDispatch:B,viewOnly:!U&&!!at,upliftAdditions:mt,hideProductCheckbox:K,hideVariantCheckbox:N,hideProductVariants:q,pickerType:_,onProductDetailClick:Q,showProductDetailInfoIcon:X},t))):nt?e(y,{limit:10}):e(j,{title:"No products to show",subtitle:ct.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]}),et&&e(y,{})]})};export{S as ProductsScreen};
@@ -1 +1 @@
1
- import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Button as a}from"../../button/Button.js";import{InputWithVariables as i}from"../../input-with-vars/InputWithVariables.js";import{StyledModal as o}from"../../modals/styledModal.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{DEFAULT_THEME as r}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import{HEADER_TYPES as s}from"../../template-preview/models/TemplateMeta.js";import{POD as l}from"../../template-preview/models/WhatsAppTemplate.js";import{TitleMedium as n,BodySecondary as d,BodyRegular as p,BodyCaption as m}from"../../TypographyStyle.js";import c from"../../../assets/icons/file.svg.js";import h from"../../../assets/icons/filePdf.svg.js";import g from"../../../assets/icons/image.svg.js";import u from"../../../assets/icons/upload.svg.js";import{useTemplateModalContext as b}from"../context/templateModalContext.js";const f=f=>{let{setOpenEditMedia:j,mediaComponentFormat:v,variableListForImage:y,openEditMedia:x,uploadMedia:M}=f;const{pod:w}=b();return e(o,Object.assign({open:x,zIndex:2e3,onClose:()=>j(!1),width:"440px"},{children:t("div",Object.assign({style:{padding:24,borderRadius:4}},{children:[e(n,Object.assign({style:{marginBottom:16}},{children:"Update media"})),t("div",Object.assign({style:{padding:24,border:`1px dashed ${r.colorsV2.stroke.primary}`,backgroundColor:r.colorsV2.surface.subdued}},{children:[t("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[e("div",Object.assign({style:{height:80,width:80,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:r.colorsV2.background.base}},{children:v===s.IMAGE?e(g,{width:40,height:40}):v===s.VIDEO?e(c,{width:40,height:40}):e(h,{width:40,height:40})})),e(n,{children:v===s.IMAGE?"Upload an image":v===s.VIDEO?"Upload a video":"Upload a document"}),e(d,{children:v===s.IMAGE?"JPEG/ PNG format • Max 5MB":v===s.VIDEO?"MP4 format video • Max 16MB":"PDF format a document • Max 100MB"})]})),t("div",Object.assign({style:{marginBottom:16}},{children:[e(p,{children:"Media"}),e(i,{noMaxCharCheck:!0,addVarBoxRight:"46px",allowMix:!1,onChange:e=>{},prevVariable:{actualValue:"",variableType:"string"},variablesList:y,showSideVariablePanel:!0,placeHolder:"Enter URL or add variable...",onBlur:(e,t)=>{t&&t.actualValue&&M(t.actualValue)},showAddButton:w!==l.CAMPAIGN||v===s.IMAGE})]})),t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4}},{children:[e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e(m,Object.assign({style:{flex:1}},{children:"Or upload media from device"})),e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(a,{matchParentWidth:!0,buttonText:"Upload",buttonType:"secondary",LeadingIcon:u,onClick:()=>M()})}))]}))]}))}))};export{f as default};
1
+ import{jsx as e,jsxs as t}from"react/jsx-runtime";import{Button as a}from"../../button/Button.js";import{InputWithVariables as i}from"../../input-with-vars/InputWithVariables.js";import{StyledModal as o}from"../../modals/styledModal.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{DEFAULT_THEME as r}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import{HEADER_TYPES as s}from"../../template-preview/models/TemplateMeta.js";import{POD as l}from"../../template-preview/models/WhatsAppTemplate.js";import{TitleMedium as n,BodySecondary as d,BodyRegular as p,BodyCaption as m}from"../../TypographyStyle.js";import c from"../../../assets/icons/file.svg.js";import h from"../../../assets/icons/filePdf.svg.js";import g from"../../../assets/icons/image.svg.js";import u from"../../../assets/icons/upload.svg.js";import{useTemplateModalContext as b}from"../context/templateModalContext.js";const f=f=>{let{setOpenEditMedia:j,mediaComponentFormat:v,variableListForImage:y,openEditMedia:x,uploadMedia:M}=f;const{pod:w}=b();return e(o,Object.assign({open:x,zIndex:2e3,onClose:()=>j(!1),width:"440px"},{children:t("div",Object.assign({style:{padding:24,borderRadius:4}},{children:[e(n,Object.assign({style:{marginBottom:16}},{children:"Update media"})),t("div",Object.assign({style:{padding:24,border:`1px dashed ${r.colorsV2.stroke.primary}`,backgroundColor:r.colorsV2.surface.subdued}},{children:[t("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[e("div",Object.assign({style:{height:80,width:80,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:r.colorsV2.background.base}},{children:v===s.IMAGE?e(g,{width:40,height:40}):v===s.VIDEO?e(c,{width:40,height:40}):e(h,{width:40,height:40})})),e(n,{children:v===s.IMAGE?"Upload an image":v===s.VIDEO?"Upload a video":"Upload a document"}),e(d,{children:v===s.IMAGE?"JPEG/ PNG format • Max 5MB":v===s.VIDEO?"MP4 format video • Max 16MB":"PDF format a document • Max 100MB"})]})),t("div",Object.assign({style:{marginBottom:16}},{children:[e(p,{children:"Media"}),e(i,{noMaxCharCheck:!0,allowMix:!1,onChange:()=>{},prevVariable:{actualValue:"",variableType:"string"},variablesList:y,showSideVariablePanel:!0,placeHolder:"Enter URL or add variable...",onBlur:(e,t)=>{t&&t.actualValue&&M(t.actualValue)},showAddButton:w!==l.CAMPAIGN||v===s.IMAGE})]})),t("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:4}},{children:[e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e(m,Object.assign({style:{flex:1}},{children:"Or upload media from device"})),e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(a,{matchParentWidth:!0,buttonText:"Upload",buttonType:"secondary",LeadingIcon:u,onClick:()=>M()})}))]}))]}))}))};export{f as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.499-1",
3
+ "version": "0.0.499-3",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",