@bikdotai/bik-component-library 0.0.725-beta.3 → 0.0.725-beta.5

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 (23) hide show
  1. package/dist/cjs/assets/icons/searchIconWhatsNew.svg.js +1 -0
  2. package/dist/cjs/assets/icons/whatsNew.svg.js +1 -0
  3. package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.js +1 -1
  4. package/dist/cjs/components/feature-announcements/hooks/useFeatureAnnouncements.js +1 -1
  5. package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +2 -0
  6. package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
  7. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  8. package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +2 -0
  9. package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
  10. package/dist/cjs/components/whats-new/WhatsNewButton.js +1 -1
  11. package/dist/cjs/components/whats-new/WhatsNewPanel.js +1 -1
  12. package/dist/esm/assets/icons/searchIconWhatsNew.svg.js +1 -0
  13. package/dist/esm/assets/icons/whatsNew.svg.js +1 -0
  14. package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.js +1 -1
  15. package/dist/esm/components/feature-announcements/hooks/useFeatureAnnouncements.js +1 -1
  16. package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +2 -0
  17. package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
  18. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  19. package/dist/esm/components/product-picker-v2/searchScreen.d.ts +2 -0
  20. package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
  21. package/dist/esm/components/whats-new/WhatsNewButton.js +1 -1
  22. package/dist/esm/components/whats-new/WhatsNewPanel.js +1 -1
  23. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n.apply(this,arguments)}var a=e=>r.createElement("svg",n({fill:"none",viewBox:"0 0 24 24"},e),t||(t=r.createElement("path",{stroke:"currentColor",d:"m21 21-6-6m2-5a7 7 0 1 1-14 0 7 7 0 0 1 14 0z"})));exports.default=a;
@@ -0,0 +1 @@
1
+ "use strict";function e(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(r){if("default"!==r){var n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,n.get?n:{enumerable:!0,get:function(){return e[r]}})}})),t.default=e,Object.freeze(t)}Object.defineProperty(exports,"__esModule",{value:!0});var t,r=e(require("react"));function n(){return n=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&(e[n]=r[n])}return e},n.apply(this,arguments)}var a=e=>r.createElement("svg",n({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32"},e),t||(t=r.createElement("g",{stroke:"currentColor"},r.createElement("path",{d:"m22.18 15.305-6.725 9.097a.75.75 0 0 0-.102.7l.42 1.165a.75.75 0 0 0 1.183.325l3.78-3.027"}),r.createElement("path",{d:"M6.446 17.664a.75.75 0 0 0 .65 1.194c6.4-.393 10.625 2.478 10.625 2.478l3.016 2.23a3.75 3.75 0 1 0 4.458-6.032l-3.015-2.229s-3.985-3.197-5.486-9.43a.75.75 0 0 0-1.332-.273L6.446 17.664ZM7.692 12.082l-2.443-.73M10.942 8.357 9.89 6.036M8.92 9.686 5.667 6.87"}))));exports.default=a;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("../../node_modules/react/jsx-runtime.js"),o=require("react"),n=require("react-joyride");require("./constants/animations.js");var a=require("./constants/selectors.js"),r=require("./hooks/useFeatureAnnouncements.js"),s=require("./MajorUpdatePopup.js"),i=require("./MinorUpdatePopup.js"),l=require("./VideoModal.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=u(n);exports.default=u=>{let{children:c,fetchVisibleFeatures:p,getStoreFeatureProgress:f,fetchFeatureById:b,markFeatureAsViewedForStore:g,isFeatureApplicableToCurrentPage:h,module:m,router:x}=u;var y;const{majorUpdateFeatures:S,minorUpdateFeatures:C,isLoading:k,markFeatureAsViewed:v}=r.useFeatureAnnouncements({fetchVisibleFeatures:p,getStoreFeatureProgress:f,fetchFeatureById:b,markFeatureAsViewedForStore:g,isFeatureApplicableToCurrentPage:h,module:m,router:x}),[T,w]=o.useState(null),[j,E]=o.useState(null),[B,F]=o.useState(!1),[I,N]=o.useState([]),[q,P]=o.useState(!1),[R,U]=o.useState([]),[W,M]=o.useState(!1),[O,_]=o.useState(!1),[A,D]=o.useState([]),[V,L]=o.useState(!1),[G,$]=o.useState(!1),[z,H]=o.useState(!1),[Z,J]=o.useState(""),[K,Q]=o.useState(!1),[X,Y]=o.useState(!1),[ee,te]=o.useState(!1),[oe,ne]=o.useState(0),[ae,re]=o.useState(0),[se,ie]=o.useState(new Set);o.useEffect((()=>{const e="minor-spotlight-cutout-style";let t=document.getElementById(e);return t||(t=document.createElement("style"),t.id=e,document.head.appendChild(t)),t.textContent="\n\t\t\t.react-joyride__spotlight {\n\t\t\t\ttransition: box-shadow 0.3s ease-in-out !important;\n\t\t\t\twill-change: box-shadow, transform;\n\t\t\t\ttransform: translateZ(0);\n\t\t\t}\n\t\t\t.react-joyride__tooltip {\n\t\t\t\twill-change: transform, opacity;\n\t\t\t\ttransform: translateZ(0);\n\t\t\t}\n\t\t",()=>{const t=document.getElementById(e);t&&t.remove()}}),[]),o.useEffect((()=>{ne((e=>e+1)),re((e=>e+1)),Y(!1),te(!1),ie(new Set)}),[null==x?void 0:x.pathname]),o.useEffect((()=>{if(console.log("🔍 [DEBUG] Route check:",{pathname:null==x?void 0:x.pathname,query:null==x?void 0:x.query,majorFeaturesCount:S.length,minorFeaturesCount:C.length,currentMajorFeature:null==T?void 0:T.id,isLoading:k,blockPopups:K,isProcessingMajorUpdate:W}),S.length>0)if(console.log("🔍 [DEBUG] First major feature details:",{featureId:S[0].id,title:S[0].title,featureUpdateType:S[0].featureUpdateType}),h){const e=h(S[0]);console.log("🔍 [DEBUG] Is major feature applicable to current page?",e)}else console.log("🔍 [DEBUG] isFeatureApplicableToCurrentPage function not provided");const e=document.querySelector('[data-testid="whats-new-button"]');console.log("🔍 [DEBUG] What's New button exists in DOM?",!!e)}),[null==x?void 0:x.pathname,null==x?void 0:x.query,S,C,k,T,K,W,h]),o.useEffect((()=>{if(!(S.length>0)||T||k||W||K)0!==S.length||k||(console.log("🔍 [DEBUG] No major features, enabling minor updates"),$(!0));else{console.log("🔍 [DEBUG] Starting major popup flow..."),$(!1),L(!1),F(!1),N([]),E(null),D([]);let e=0;const t=10,o=()=>{e++;const n=document.querySelector('[data-testid="whats-new-button"]');console.log(`🔍 [DEBUG] Polling for What's New button - Attempt ${e}/${t}`,{buttonFound:!!n,pathname:null==x?void 0:x.pathname}),n?(console.log("✅ [DEBUG] What's New button found! Showing major popup"),le(S[0])):e<t?setTimeout(o,1e3):(console.warn("⚠️ [DEBUG] What's New button not found after 10s. Allowing minor updates.",{pathname:null==x?void 0:x.pathname}),$(!0))};o()}}),[S,T,k,W,K]),o.useEffect((()=>{var e;const t=null===(e=null==x?void 0:x.query)||void 0===e?void 0:e.featureId;if(!t||k||0===C.length)return;const o=C.find((e=>e.id===t));if(!o||!o.featureTag)return;L(!0),_(!0);let n=0;const a=setInterval((()=>{n++;const e=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`;if(document.querySelector(e)){const e=[o];D(e),he(o,e),clearInterval(a)}else n>=25&&(_(!1),clearInterval(a))}),200);return()=>{clearInterval(a)}}),[C,null===(y=null==x?void 0:x.query)||void 0===y?void 0:y.featureId,k]),o.useEffect((()=>{var e;if(C.length>0&&!k&&!B&&!O&&!j&&!V&&G&&!K){let e=null,t=null,o=null,n=!1;const a=()=>{if(n||O||j||V||!G)return;const a=C.filter((e=>{if(!e.featureTag||""===e.featureTag.trim())return!1;if(se.has(e.id))return!1;const t=e.featureTag.startsWith("#")||e.featureTag.startsWith(".")||e.featureTag.startsWith("[")?e.featureTag:`#${e.featureTag}`;return null!==document.querySelector(t)}));a.length>0&&(D(a),he(a[0],a),e&&(e.disconnect(),e=null),t&&(window.removeEventListener("scroll",t),t=null),o&&(clearTimeout(o),o=null))};return e=new MutationObserver((e=>{let t=!1;for(const o of e){if("childList"===o.type&&o.addedNodes.length>0)for(let e=0;e<o.addedNodes.length;e++){const n=o.addedNodes[e];if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(e.id||e.querySelector("[id]")){t=!0;break}}}if(t)break}B||n||O||j||V||!G||!t||(o&&clearTimeout(o),o=setTimeout((()=>{n||O||j||V||!G||a()}),200))})),t=()=>{B||n||O||j||V||!G||(o&&clearTimeout(o),requestAnimationFrame((()=>{o=setTimeout((()=>{n||O||j||V||!G||a()}),300)})))},e&&e.observe(document.body,{childList:!0,subtree:!0}),t&&window.addEventListener("scroll",t,{passive:!0}),a(),setTimeout((()=>{n||O||j||V||!G||a()}),100),setTimeout((()=>{n||O||j||V||!G||a()}),1e3),setTimeout((()=>{n||O||j||V||!G||a()}),500),()=>{n=!0,e&&e.disconnect(),t&&window.removeEventListener("scroll",t),o&&clearTimeout(o)}}if(0===C.length||k){(null===(e=null==x?void 0:x.query)||void 0===e?void 0:e.featureId)&&j||(F(!1),N([]),E(null),D([]),L(!1))}}),[C,k,B,O,j,V,G,v,K]);const le=e=>{w(e);const o=S.findIndex((t=>t.id===e.id)),n=S.length,r=[{target:a.SELECTORS.WHATS_NEW_BUTTON,content:t.jsxRuntimeExports.jsx(s.default,{feature:e,currentIndex:o,totalFeatures:n,onSkip:()=>ue(e),onExplore:()=>de(e),onPrevious:()=>ce(e),onNext:()=>pe(e),setIsClosing:Y}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];U(r),P(!0)},ue=o.useCallback((e=>{(e||T)&&(M(!0),S.forEach((e=>{v(e.id)})),P(!1),w(null),U([]),$(!0),setTimeout((()=>{M(!1)}),500))}),[T,S,v]),de=o.useCallback((e=>{M(!0),v(e.id),e.productVideo&&(J(e.productVideo),H(!0),Q(!0)),P(!1),w(null),U([]);S.findIndex((t=>t.id===e.id))===S.length-1&&$(!0),setTimeout((()=>{M(!1)}),500)}),[S,v]),ce=o.useCallback((e=>{const o=e||T;if(!o)return;const n=S.findIndex((e=>e.id===o.id));if(n>0){const e=S[n-1];w(e);const o=n-1,a=S.length,r=[{target:'[data-testid="whats-new-button"]',content:t.jsxRuntimeExports.jsx(s.default,{feature:e,currentIndex:o,totalFeatures:a,onSkip:()=>ue(e),onExplore:()=>de(e),onPrevious:()=>ce(e),onNext:()=>pe(e),setIsClosing:Y}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];U(r)}}),[T,S]),pe=o.useCallback((e=>{const o=e||T;if(!o)return;const n=S.findIndex((e=>e.id===o.id));if(n<S.length-1){const e=S[n+1];w(e);const o=n+1,a=S.length,r=[{target:'[data-testid="whats-new-button"]',content:t.jsxRuntimeExports.jsx(s.default,{feature:e,currentIndex:o,totalFeatures:a,onSkip:()=>ue(e),onExplore:()=>de(e),onPrevious:()=>ce(e),onNext:()=>pe(e),setIsClosing:Y}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];U(r)}else M(!0),v(o.id),P(!1),w(null),U([]),$(!0),setTimeout((()=>{M(!1)}),500)}),[T,S,v]),fe=()=>{if(S.length>0&&!T){document.querySelector('[data-testid="whats-new-button"]')&&le(S[0])}};o.useEffect((()=>(window.showMajorUpdatePopup=fe,()=>{delete window.showMajorUpdatePopup})),[S,T]);const be=o.useCallback((e=>{const{action:t}=e;t===n.ACTIONS.CLOSE&&(T&&(M(!0),S.forEach((e=>{v(e.id)})),$(!0),setTimeout((()=>{M(!1)}),500)),P(!1),w(null),U([]))}),[T,S,v]),ge=o.useCallback((e=>{const{action:t}=e;if(t===n.ACTIONS.CLOSE){if(j){_(!0),v(j.id);A.findIndex((e=>e.id===j.id))===A.length-1&&L(!0),setTimeout((()=>{_(!1)}),500)}F(!1),E(null),N([])}}),[j,A,v]),he=(o,n)=>e.__awaiter(void 0,void 0,void 0,(function*(){E(o);const e=n||A,a=e.findIndex((e=>e.id===o.id)),r=e.length,s=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`,l=document.querySelector(s);if(l)try{const{scrollToElementSmooth:e}=yield Promise.resolve().then((function(){return require("./utils/elementHelpers.js")}));yield e(l,120)}catch(e){}const u=[{target:s,content:t.jsxRuntimeExports.jsx(i.default,{feature:o,currentIndex:a,totalFeatures:r,onSkip:()=>me(o),onExplore:()=>xe(o),onPrevious:()=>ye(o),onNext:()=>Se(o),setIsClosing:te}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:o,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];N(u),F(!0)})),me=o.useCallback((e=>{const t=e||j;if(t){_(!0),v(t.id),ie((e=>new Set(e).add(t.id))),F(!1),E(null),N([]);const e=A.find((e=>e.id!==t.id&&!se.has(e.id)));setTimeout((()=>{_(!1),e?he(e,A):L(!0)}),500)}}),[j,A,v,se]),xe=o.useCallback((e=>{_(!0),v(e.id),ie((t=>new Set(t).add(e.id))),e.productVideo&&(J(e.productVideo),H(!0),Q(!0)),F(!1),E(null),N([]);const t=A.find((t=>t.id!==e.id&&!se.has(t.id)));setTimeout((()=>{_(!1),t&&!e.productVideo?he(t,A):t||L(!0)}),500)}),[A,v,se]),ye=o.useCallback((o=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=o||j;if(!e)return;const n=A.findIndex((t=>t.id===e.id));if(n>0){const e=A[n-1];E(e);const o=e.featureTag.startsWith("#")||e.featureTag.startsWith(".")||e.featureTag.startsWith("[")?e.featureTag:`#${e.featureTag}`,a=document.querySelector(o);if(a)try{const{scrollToElementSmooth:e}=yield Promise.resolve().then((function(){return require("./utils/elementHelpers.js")}));yield e(a,120)}catch(e){}const r=n-1,s=A.length,l=[{target:o,content:t.jsxRuntimeExports.jsx(i.default,{feature:e,currentIndex:r,totalFeatures:s,onSkip:()=>me(e),onExplore:()=>xe(e),onPrevious:()=>ye(e),onNext:()=>Se(e),setIsClosing:te}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];N(l)}}))),[j,A]),Se=o.useCallback((o=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=o||j;if(!e)return;const n=A.findIndex((t=>t.id===e.id));if(n<A.length-1){const e=A[n+1];E(e);const o=e.featureTag.startsWith("#")||e.featureTag.startsWith(".")||e.featureTag.startsWith("[")?e.featureTag:`#${e.featureTag}`,a=document.querySelector(o);if(a)try{const{scrollToElementSmooth:e}=yield Promise.resolve().then((function(){return require("./utils/elementHelpers.js")}));yield e(a,120)}catch(e){}const r=n+1,s=A.length,l=[{target:o,content:t.jsxRuntimeExports.jsx(i.default,{feature:e,currentIndex:r,totalFeatures:s,onSkip:()=>me(e),onExplore:()=>xe(e),onPrevious:()=>ye(e),onNext:()=>Se(e),setIsClosing:te}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];N(l)}else _(!0),L(!0),v(e.id),F(!1),E(null),N([]),setTimeout((()=>{_(!1)}),500)}))),[j,A,v]);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[c,R.length>0&&t.jsxRuntimeExports.jsx(d.default,{steps:R,run:q,continuous:!1,showProgress:!1,showSkipButton:!1,callback:be,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,spotlightClicks:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:X?"transparent":"#212121"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",border:"none",boxShadow:"none"},tooltip:{borderRadius:"16px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}},`major-joyride-${oe}`),I.length>0&&t.jsxRuntimeExports.jsx(d.default,{steps:I,run:B,continuous:!1,showProgress:!1,showSkipButton:!1,callback:ge,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,scrollToFirstStep:!0,scrollOffset:120,disableScrolling:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:ee?"transparent":"#ffffff"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",borderRadius:"8px",boxShadow:ee?"none":"0 0 0 9999px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 20px 8px rgba(255, 255, 255, 0.4)"},tooltip:{borderRadius:"4px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonSkip:{display:"none"},buttonClose:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}},`minor-joyride-${ae}`),t.jsxRuntimeExports.jsx(l.VideoModal,{isOpen:z,videoUrl:Z,onClose:()=>{H(!1),J(""),Q(!1);const e=A.find((e=>!se.has(e.id)));e?setTimeout((()=>{he(e,A)}),300):L(!0)}})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("../../node_modules/react/jsx-runtime.js"),o=require("react"),n=require("react-joyride");require("./constants/animations.js");var a=require("./constants/selectors.js"),r=require("./hooks/useFeatureAnnouncements.js"),s=require("./MajorUpdatePopup.js"),i=require("./MinorUpdatePopup.js"),l=require("./VideoModal.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(n);exports.default=d=>{let{children:c,fetchVisibleFeatures:p,getStoreFeatureProgress:f,fetchFeatureById:b,markFeatureAsViewedForStore:g,isFeatureApplicableToCurrentPage:h,module:m,router:x}=d;var y;const{majorUpdateFeatures:S,minorUpdateFeatures:C,isLoading:k,markFeatureAsViewed:T}=r.useFeatureAnnouncements({fetchVisibleFeatures:p,getStoreFeatureProgress:f,fetchFeatureById:b,markFeatureAsViewedForStore:g,isFeatureApplicableToCurrentPage:h,module:m,router:x}),[v,w]=o.useState(null),[j,E]=o.useState(null),[B,I]=o.useState(!1),[F,N]=o.useState([]),[q,R]=o.useState(!1),[P,_]=o.useState([]),[O,W]=o.useState(!1),[M,V]=o.useState(!1),[A,L]=o.useState([]),[U,$]=o.useState(!1),[z,H]=o.useState(!1),[Z,D]=o.useState(!1),[G,J]=o.useState(""),[K,Q]=o.useState(!1),[X,Y]=o.useState(!1),[ee,te]=o.useState(!1),[oe,ne]=o.useState(0),[ae,re]=o.useState(0),[se,ie]=o.useState(new Set);o.useEffect((()=>{const e="minor-spotlight-cutout-style";let t=document.getElementById(e);return t||(t=document.createElement("style"),t.id=e,document.head.appendChild(t)),t.textContent="\n\t\t\t.react-joyride__spotlight {\n\t\t\t\ttransition: box-shadow 0.3s ease-in-out !important;\n\t\t\t\twill-change: box-shadow, transform;\n\t\t\t\ttransform: translateZ(0);\n\t\t\t}\n\t\t\t.react-joyride__tooltip {\n\t\t\t\twill-change: transform, opacity;\n\t\t\t\ttransform: translateZ(0);\n\t\t\t}\n\t\t",()=>{const t=document.getElementById(e);t&&t.remove()}}),[]),o.useEffect((()=>{ne((e=>e+1)),re((e=>e+1)),Y(!1),te(!1),ie(new Set)}),[null==x?void 0:x.pathname]),o.useEffect((()=>{if(!(S.length>0)||v||k||O||K)0!==S.length||k||H(!0);else{H(!1),$(!1),I(!1),N([]),E(null),L([]);let e=0;const t=10,o=()=>{e++;document.querySelector('[data-testid="whats-new-button"]')?le(S[0]):e<t?setTimeout(o,1e3):H(!0)};o()}}),[S,v,k,O,K]),o.useEffect((()=>{var e;const t=null===(e=null==x?void 0:x.query)||void 0===e?void 0:e.featureId;if(!t||k||0===C.length)return;const o=C.find((e=>e.id===t));if(!o||!o.featureTag)return;$(!0),V(!0);let n=0;const a=setInterval((()=>{n++;const e=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`;if(document.querySelector(e)){const e=[o];L(e),he(o,e),clearInterval(a)}else n>=25&&(V(!1),clearInterval(a))}),200);return()=>{clearInterval(a)}}),[C,null===(y=null==x?void 0:x.query)||void 0===y?void 0:y.featureId,k]),o.useEffect((()=>{var e;if(C.length>0&&!k&&!B&&!M&&!j&&!U&&z&&!K){let e=null,t=null,o=null,n=!1;const a=()=>{if(n||M||j||U||!z)return;const a=C.filter((e=>{if(!e.featureTag||""===e.featureTag.trim())return!1;if(se.has(e.id))return!1;const t=e.featureTag.startsWith("#")||e.featureTag.startsWith(".")||e.featureTag.startsWith("[")?e.featureTag:`#${e.featureTag}`;return null!==document.querySelector(t)}));a.length>0&&(L(a),he(a[0],a),e&&(e.disconnect(),e=null),t&&(window.removeEventListener("scroll",t),t=null),o&&(clearTimeout(o),o=null))};return e=new MutationObserver((e=>{let t=!1;for(const o of e){if("childList"===o.type&&o.addedNodes.length>0)for(let e=0;e<o.addedNodes.length;e++){const n=o.addedNodes[e];if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(e.id||e.querySelector("[id]")){t=!0;break}}}if(t)break}B||n||M||j||U||!z||!t||(o&&clearTimeout(o),o=setTimeout((()=>{n||M||j||U||!z||a()}),200))})),t=()=>{B||n||M||j||U||!z||(o&&clearTimeout(o),requestAnimationFrame((()=>{o=setTimeout((()=>{n||M||j||U||!z||a()}),300)})))},e&&e.observe(document.body,{childList:!0,subtree:!0}),t&&window.addEventListener("scroll",t,{passive:!0}),a(),setTimeout((()=>{n||M||j||U||!z||a()}),100),setTimeout((()=>{n||M||j||U||!z||a()}),1e3),setTimeout((()=>{n||M||j||U||!z||a()}),500),()=>{n=!0,e&&e.disconnect(),t&&window.removeEventListener("scroll",t),o&&clearTimeout(o)}}if(0===C.length||k){(null===(e=null==x?void 0:x.query)||void 0===e?void 0:e.featureId)&&j||(I(!1),N([]),E(null),L([]),$(!1))}}),[C,k,B,M,j,U,z,T,K]);const le=e=>{w(e);const o=S.findIndex((t=>t.id===e.id)),n=S.length,r=[{target:a.SELECTORS.WHATS_NEW_BUTTON,content:t.jsxRuntimeExports.jsx(s.default,{feature:e,currentIndex:o,totalFeatures:n,onSkip:()=>de(e),onExplore:()=>ue(e),onPrevious:()=>ce(e),onNext:()=>pe(e),setIsClosing:Y}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];_(r),R(!0)},de=o.useCallback((e=>{(e||v)&&(W(!0),S.forEach((e=>{T(e.id)})),R(!1),w(null),_([]),H(!0),setTimeout((()=>{W(!1)}),500))}),[v,S,T]),ue=o.useCallback((e=>{W(!0),T(e.id),e.productVideo&&(J(e.productVideo),D(!0),Q(!0)),R(!1),w(null),_([]);S.findIndex((t=>t.id===e.id))===S.length-1&&H(!0),setTimeout((()=>{W(!1)}),500)}),[S,T]),ce=o.useCallback((e=>{const o=e||v;if(!o)return;const n=S.findIndex((e=>e.id===o.id));if(n>0){const e=S[n-1];w(e);const o=n-1,a=S.length,r=[{target:'[data-testid="whats-new-button"]',content:t.jsxRuntimeExports.jsx(s.default,{feature:e,currentIndex:o,totalFeatures:a,onSkip:()=>de(e),onExplore:()=>ue(e),onPrevious:()=>ce(e),onNext:()=>pe(e),setIsClosing:Y}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];_(r)}}),[v,S]),pe=o.useCallback((e=>{const o=e||v;if(!o)return;const n=S.findIndex((e=>e.id===o.id));if(n<S.length-1){const e=S[n+1];w(e);const o=n+1,a=S.length,r=[{target:'[data-testid="whats-new-button"]',content:t.jsxRuntimeExports.jsx(s.default,{feature:e,currentIndex:o,totalFeatures:a,onSkip:()=>de(e),onExplore:()=>ue(e),onPrevious:()=>ce(e),onNext:()=>pe(e),setIsClosing:Y}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];_(r)}else W(!0),T(o.id),R(!1),w(null),_([]),H(!0),setTimeout((()=>{W(!1)}),500)}),[v,S,T]),fe=()=>{if(S.length>0&&!v){document.querySelector('[data-testid="whats-new-button"]')&&le(S[0])}};o.useEffect((()=>(window.showMajorUpdatePopup=fe,()=>{delete window.showMajorUpdatePopup})),[S,v]);const be=o.useCallback((e=>{const{action:t}=e;t===n.ACTIONS.CLOSE&&(v&&(W(!0),S.forEach((e=>{T(e.id)})),H(!0),setTimeout((()=>{W(!1)}),500)),R(!1),w(null),_([]))}),[v,S,T]),ge=o.useCallback((e=>{const{action:t}=e;if(t===n.ACTIONS.CLOSE){if(j){V(!0),T(j.id);A.findIndex((e=>e.id===j.id))===A.length-1&&$(!0),setTimeout((()=>{V(!1)}),500)}I(!1),E(null),N([])}}),[j,A,T]),he=(o,n)=>e.__awaiter(void 0,void 0,void 0,(function*(){E(o);const e=n||A,a=e.findIndex((e=>e.id===o.id)),r=e.length,s=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`,l=document.querySelector(s);if(l)try{const{scrollToElementSmooth:e}=yield Promise.resolve().then((function(){return require("./utils/elementHelpers.js")}));yield e(l,120)}catch(e){}const d=[{target:s,content:t.jsxRuntimeExports.jsx(i.default,{feature:o,currentIndex:a,totalFeatures:r,onSkip:()=>me(o),onExplore:()=>xe(o),onPrevious:()=>ye(o),onNext:()=>Se(o),setIsClosing:te}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:o,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];N(d),I(!0)})),me=o.useCallback((e=>{const t=e||j;if(t){V(!0),T(t.id),ie((e=>new Set(e).add(t.id))),I(!1),E(null),N([]);const e=A.find((e=>e.id!==t.id&&!se.has(e.id)));setTimeout((()=>{V(!1),e?he(e,A):$(!0)}),500)}}),[j,A,T,se]),xe=o.useCallback((e=>{V(!0),T(e.id),ie((t=>new Set(t).add(e.id))),e.productVideo&&(J(e.productVideo),D(!0),Q(!0)),I(!1),E(null),N([]);const t=A.find((t=>t.id!==e.id&&!se.has(t.id)));setTimeout((()=>{V(!1),t&&!e.productVideo?he(t,A):t||$(!0)}),500)}),[A,T,se]),ye=o.useCallback((o=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=o||j;if(!e)return;const n=A.findIndex((t=>t.id===e.id));if(n>0){const e=A[n-1];E(e);const o=e.featureTag.startsWith("#")||e.featureTag.startsWith(".")||e.featureTag.startsWith("[")?e.featureTag:`#${e.featureTag}`,a=document.querySelector(o);if(a)try{const{scrollToElementSmooth:e}=yield Promise.resolve().then((function(){return require("./utils/elementHelpers.js")}));yield e(a,120)}catch(e){}const r=n-1,s=A.length,l=[{target:o,content:t.jsxRuntimeExports.jsx(i.default,{feature:e,currentIndex:r,totalFeatures:s,onSkip:()=>me(e),onExplore:()=>xe(e),onPrevious:()=>ye(e),onNext:()=>Se(e),setIsClosing:te}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];N(l)}}))),[j,A]),Se=o.useCallback((o=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=o||j;if(!e)return;const n=A.findIndex((t=>t.id===e.id));if(n<A.length-1){const e=A[n+1];E(e);const o=e.featureTag.startsWith("#")||e.featureTag.startsWith(".")||e.featureTag.startsWith("[")?e.featureTag:`#${e.featureTag}`,a=document.querySelector(o);if(a)try{const{scrollToElementSmooth:e}=yield Promise.resolve().then((function(){return require("./utils/elementHelpers.js")}));yield e(a,120)}catch(e){}const r=n+1,s=A.length,l=[{target:o,content:t.jsxRuntimeExports.jsx(i.default,{feature:e,currentIndex:r,totalFeatures:s,onSkip:()=>me(e),onExplore:()=>xe(e),onPrevious:()=>ye(e),onNext:()=>Se(e),setIsClosing:te}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:e,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];N(l)}else V(!0),$(!0),T(e.id),I(!1),E(null),N([]),setTimeout((()=>{V(!1)}),500)}))),[j,A,T]);return t.jsxRuntimeExports.jsxs(t.jsxRuntimeExports.Fragment,{children:[c,P.length>0&&t.jsxRuntimeExports.jsx(u.default,{steps:P,run:q,continuous:!1,showProgress:!1,showSkipButton:!1,callback:be,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,spotlightClicks:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:X?"transparent":"#212121"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",border:"none",boxShadow:"none"},tooltip:{borderRadius:"16px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}},`major-joyride-${oe}`),F.length>0&&t.jsxRuntimeExports.jsx(u.default,{steps:F,run:B,continuous:!1,showProgress:!1,showSkipButton:!1,callback:ge,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,scrollToFirstStep:!0,scrollOffset:120,disableScrolling:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:ee?"transparent":"#ffffff"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",borderRadius:"8px",boxShadow:ee?"none":"0 0 0 9999px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 20px 8px rgba(255, 255, 255, 0.4)"},tooltip:{borderRadius:"4px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonSkip:{display:"none"},buttonClose:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}},`minor-joyride-${ae}`),t.jsxRuntimeExports.jsx(l.VideoModal,{isOpen:Z,videoUrl:G,onClose:()=>{D(!1),J(""),Q(!1);const e=A.find((e=>!se.has(e.id)));e?setTimeout((()=>{he(e,A)}),300):$(!0)}})]})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react"),r=require("../constants/animations.js"),a=require("../constants/localStorageKeys.js");exports.useFeatureAnnouncements=o=>{let{fetchVisibleFeatures:n,getStoreFeatureProgress:i,fetchFeatureById:l,markFeatureAsViewedForStore:s,isFeatureApplicableToCurrentPage:u,module:c,router:d}=o;var f;const p=(()=>{const[e,r]=t.useState(null);return t.useEffect((()=>{if("undefined"!=typeof window){let e=null;try{if(e=localStorage.getItem(a.LOCAL_STORAGE_KEYS.STORE_ID)||localStorage.getItem(a.LOCAL_STORAGE_KEYS.BIK_STORE_ID)||localStorage.getItem(a.LOCAL_STORAGE_KEYS.CURRENT_STORE)||localStorage.getItem(a.LOCAL_STORAGE_KEYS.STORE),!e){const t=localStorage.getItem(a.LOCAL_STORAGE_KEYS.CURRENT_USER);t&&(e=JSON.parse(t).storeId)}e||(e=new URLSearchParams(window.location.search).get(a.LOCAL_STORAGE_KEYS.QUERY_PARAM))}catch(e){console.error("FeatureAnnouncements: Failed to get store ID",e)}r(e)}}),[]),e})(),[A,S]=t.useState([]),[_,v]=t.useState([]),[g,y]=t.useState([]),[E,m]=t.useState(!1),[R,w]=t.useState(null),F=t.useCallback((()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(p){m(!0),w(null);try{const[e,t]=yield n(c);if(e||!t)return console.error("FeatureAnnouncements: Failed to fetch features",e),void w("Failed to fetch features");const[a,o]=yield i(p);a&&console.warn("FeatureAnnouncements: Progress fetch failed, treating all features as new",a);const l=new Date,s="undefined"!=typeof window?window.location.pathname:"",d=e=>{if(!e.expirationDate)return!0;let t;return"object"==typeof e.expirationDate&&null!==e.expirationDate&&("seconds"in e.expirationDate||"nanoseconds"in e.expirationDate)?t=new Date(1e3*e.expirationDate.seconds):"string"==typeof e.expirationDate?t=new Date(e.expirationDate):e.expirationDate instanceof Date&&(t=e.expirationDate),!(!t||isNaN(t.getTime()))&&l<t},f=e=>{if("Major"===e.featureUpdateType){let t=[];return Array.isArray(e.pageUrls)?t=e.pageUrls:"object"==typeof e.pageUrls&&null!==e.pageUrls&&"length"in e.pageUrls&&(t=Array.from(e.pageUrls)),t.includes(s)}return!0},A=t.filter((e=>{var t;const r=(null===(t=null==o?void 0:o.viewedFeatures)||void 0===t?void 0:t[e.id])||!1,a=e.archived||!1;return!r&&!a&&u(e)&&d(e)&&f(e)})),_=A.filter((e=>"Major"===e.featureUpdateType)),g=A.filter((e=>"Minor"===e.featureUpdateType));S(A),v(_),setTimeout((()=>{y(g)}),r.ANIMATION_TIMING.MINOR_POPUP_DELAY)}catch(e){console.error("FeatureAnnouncements: Unexpected error in fetchFeatures",e),w("An unexpected error occurred")}finally{m(!1)}}}))),[p,n,i,u,c]),T=t.useCallback((t=>e.__awaiter(void 0,void 0,void 0,(function*(){m(!0),w(null);try{const[e,r]=yield l(t);if(e||!r)return void w("Failed to fetch feature by ID");"Major"===r.featureUpdateType?v([r]):y([r]),S([r])}catch(e){w("An unexpected error occurred while fetching by ID")}finally{m(!1)}}))),[l]),U=t.useCallback((t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(!p)return;const[e]=yield s(p,t);e?(console.warn("FeatureAnnouncements: Failed to mark feature as viewed, removing from local state anyway",e),S((e=>e.filter((e=>e.id!==t)))),v((e=>e.filter((e=>e.id!==t)))),y((e=>e.filter((e=>e.id!==t))))):(S((e=>e.filter((e=>e.id!==t)))),v((e=>e.filter((e=>e.id!==t)))),y((e=>e.filter((e=>e.id!==t)))))}))),[p,s]);return t.useEffect((()=>{var e;const t=null===(e=null==d?void 0:d.query)||void 0===e?void 0:e[a.QUERY_PARAMS.FEATURE_ID];t&&d?T(t):F()}),[null==d?void 0:d.pathname,null===(f=null==d?void 0:d.query)||void 0===f?void 0:f[a.QUERY_PARAMS.FEATURE_ID],p,F,T,d]),{features:A,majorUpdateFeatures:_,minorUpdateFeatures:g,isLoading:E,error:R,markFeatureAsViewed:U,refetch:F}};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("react"),r=require("../constants/animations.js"),a=require("../constants/localStorageKeys.js");exports.useFeatureAnnouncements=i=>{let{fetchVisibleFeatures:o,getStoreFeatureProgress:n,fetchFeatureById:l,markFeatureAsViewedForStore:u,isFeatureApplicableToCurrentPage:s,module:c,router:d}=i;var f;const p=(()=>{const[e,r]=t.useState(null);return t.useEffect((()=>{if("undefined"!=typeof window){let e=null;try{if(e=localStorage.getItem(a.LOCAL_STORAGE_KEYS.STORE_ID)||localStorage.getItem(a.LOCAL_STORAGE_KEYS.BIK_STORE_ID)||localStorage.getItem(a.LOCAL_STORAGE_KEYS.CURRENT_STORE)||localStorage.getItem(a.LOCAL_STORAGE_KEYS.STORE),!e){const t=localStorage.getItem(a.LOCAL_STORAGE_KEYS.CURRENT_USER);t&&(e=JSON.parse(t).storeId)}e||(e=new URLSearchParams(window.location.search).get(a.LOCAL_STORAGE_KEYS.QUERY_PARAM))}catch(e){}r(e)}}),[]),e})(),[S,_]=t.useState([]),[A,E]=t.useState([]),[g,v]=t.useState([]),[y,R]=t.useState(!1),[T,U]=t.useState(null),D=t.useCallback((()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(p){R(!0),U(null);try{const[e,t]=yield o(c);if(e||!t)return void U("Failed to fetch features");const[a,i]=yield n(p),l=new Date,u="undefined"!=typeof window?window.location.pathname:"",d=e=>{if(!e.expirationDate)return!0;let t;return"object"==typeof e.expirationDate&&null!==e.expirationDate&&("seconds"in e.expirationDate||"nanoseconds"in e.expirationDate)?t=new Date(1e3*e.expirationDate.seconds):"string"==typeof e.expirationDate?t=new Date(e.expirationDate):e.expirationDate instanceof Date&&(t=e.expirationDate),!(!t||isNaN(t.getTime()))&&l<t},f=e=>{if("Major"===e.featureUpdateType){let t=[];return Array.isArray(e.pageUrls)?t=e.pageUrls:"object"==typeof e.pageUrls&&null!==e.pageUrls&&"length"in e.pageUrls&&(t=Array.from(e.pageUrls)),t.some((e=>{if(e===u)return!0;const t=e.replace(/\[([^\]]+)\]/g,"[^/]+").replace(/\//g,"\\/");return new RegExp(`^${t}$`).test(u)}))}return!0},S=t.filter((e=>{var t;const r=(null===(t=null==i?void 0:i.viewedFeatures)||void 0===t?void 0:t[e.id])||!1,a=e.archived||!1,o=s(e),n=d(e),l=f(e);return!r&&!a&&o&&n&&l})),A=S.filter((e=>"Major"===e.featureUpdateType)),g=S.filter((e=>"Minor"===e.featureUpdateType));_(S),E(A),setTimeout((()=>{v(g)}),r.ANIMATION_TIMING.MINOR_POPUP_DELAY)}catch(e){U("An unexpected error occurred")}finally{R(!1)}}}))),[p,o,n,s,c]),O=t.useCallback((t=>e.__awaiter(void 0,void 0,void 0,(function*(){R(!0),U(null);try{const[e,r]=yield l(t);if(e||!r)return void U("Failed to fetch feature by ID");"Major"===r.featureUpdateType?E([r]):v([r]),_([r])}catch(e){U("An unexpected error occurred while fetching by ID")}finally{R(!1)}}))),[l]),w=t.useCallback((t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(!p)return;const[e]=yield u(p,t);_((e=>e.filter((e=>e.id!==t)))),E((e=>e.filter((e=>e.id!==t)))),v((e=>e.filter((e=>e.id!==t))))}))),[p,u]);return t.useEffect((()=>{var e;const t=null===(e=null==d?void 0:d.query)||void 0===e?void 0:e[a.QUERY_PARAMS.FEATURE_ID];t&&d?O(t):D()}),[null==d?void 0:d.pathname,null===(f=null==d?void 0:d.query)||void 0===f?void 0:f[a.QUERY_PARAMS.FEATURE_ID],p,D,O,d]),{features:S,majorUpdateFeatures:A,minorUpdateFeatures:g,isLoading:y,error:T,markFeatureAsViewed:w,refetch:D}};
@@ -27,6 +27,8 @@ interface CollectionsScreenInterface {
27
27
  pickerType?: 'COLLECTION' | 'PRODUCT';
28
28
  scrollContainerRef: React.RefObject<HTMLDivElement>;
29
29
  appType: ApplicationType;
30
+ limit?: number;
31
+ exactLimit?: number;
30
32
  }
31
33
  export declare const CollectionsScreen: (props: CollectionsScreenInterface) => import("react/jsx-runtime").JSX.Element;
32
34
  export interface CollectionCardInterface {
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("../../assets/icons/chevronRight.svg.js"),s=require("react"),i=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),o=require("../tag/Tag.js"),r=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),c=require("./emptyState.js"),u=require("./ProductPickerShimmer.js"),d=require("./style.js"),a=require("./utility.js");const x=s=>{const{customCollectionRestriction:c,data:u,selectedCollectionsDispatch:a,setCollectionId:x,setSelectedCollectionId:p,isPartiallyChecked:j,setScreen:h,id:C,isChecked:m,isDisabled:v,hideCollectionCheckbox:y,pickerType:g,usedInSearch:R}=s;return u?e.jsxRuntimeExports.jsxs(d.CollectionCardStyle,Object.assign({isDisabled:v,onClick:e=>{if(!v){if("COLLECTION"===g)return e.stopPropagation(),a({type:"reset",data:{}}),a({type:"selected",data:{id:C,val:u,isRestricted:c}}),x(C),void p(C);x(C),p(C),h("products")}},isActive:m,usedInSearch:null!=R&&R},{children:[e.jsxRuntimeExports.jsxs(d.CollectionCardInfoStyle,{children:[!y&&e.jsxRuntimeExports.jsx(i.CheckBox,{isDisabled:v,isChecked:m,isPartiallyChecked:j,onValueChange:function(e,t,s){null==s||s.stopPropagation(),a(e?{type:"selected",data:{id:C,val:u,isRestricted:c}}:{type:"unselected",data:{id:C}}),p(e?C:"")}}),e.jsxRuntimeExports.jsx(d.CollectionCardDetailStyle,{children:e.jsxRuntimeExports.jsx(r.Tooltip,Object.assign({body:u.name,placement:"bottom",delay:400,variant:"light"},{children:e.jsxRuntimeExports.jsxs(d.CollectionNameHolder,{children:[R?e.jsxRuntimeExports.jsx(n.BodyPrimary,Object.assign({numberOfLines:1},{children:u.name})):e.jsxRuntimeExports.jsx(n.TitleRegular,Object.assign({numberOfLines:1},{children:u.name})),u.isSmartCollection?e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsxRuntimeExports.jsx(o.Tag,{tagText:"Smart Collection",type:"warning"})})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]})}))})]}),"COLLECTION"!==g&&e.jsxRuntimeExports.jsx(l.IconButton,{height:12,width:12,disabled:v,Icon:t.default})]})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})};exports.CollectionCard=x,exports.CollectionsScreen=t=>{var i;const{customCollectionRestriction:l,dataLoading:o,collections:r,selectedCollectionsDispatch:n,setCollectionId:d,setSelectedCollectionId:p,selectedCollections:j,setScreen:h,collectionFetcher:C,collectionsDispatch:m,pagingControls:v,storeId:y,setSaveDisabled:g,hideCollectionCheckbox:R,renderWithoutModal:E,pickerType:b,scrollContainerRef:k,appType:f}=t,S=s.useRef(v.curPage),P=!!l&&(null==j?void 0:j.isCustom),[O,I]=s.useState(!1),T=s.useRef(!1),q=s.useRef(!1),D=()=>{if(!k||!(null==k?void 0:k.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:s}=k.current;e+t>=s-20&&!T.current&&!q.current&&(g(!0),I(!0),q.current=!0,g(!0),I(!0),C(S.current,y,f).then((e=>{m({type:"paged",data:(null==e?void 0:e.collections)||{}}),v.setCurPage(S.current+1),I(!1),g(!1),q.current=!1,Object.keys(null==e?void 0:e.collections).length||(T.current=!0)})).catch())};return s.useEffect((()=>{var e;return null===(e=null==k?void 0:k.current)||void 0===e||e.addEventListener("scroll",D),()=>{var e;null===(e=null==k?void 0:k.current)||void 0===e||e.removeEventListener("scroll",D)}}),[]),s.useEffect((()=>{S.current=v.curPage}),[v.curPage]),e.jsxRuntimeExports.jsxs("div",{children:[(null===(i=Object.keys(null!=r?r:{}))||void 0===i?void 0:i.length)?Object.keys(r).map((t=>{var s,i;const o=!!(null==j?void 0:j[t])&&("PRODUCT"!==b||!!Object.keys(null!==(i=null===(s=null==j?void 0:j[t])||void 0===s?void 0:s.products)&&void 0!==i?i:{}).length);return e.jsxRuntimeExports.jsx(x,{customCollectionRestriction:l,data:r[t],isDisabled:P&&!(null==j?void 0:j[t]),isChecked:o,isPartiallyChecked:a.isCollectionPartiallyChecked(t,null==r?void 0:r[t],j),selectedCollectionsDispatch:n,setCollectionId:d,setSelectedCollectionId:p,setScreen:h,id:t,hideCollectionCheckbox:R||"-1"===t,selectedCollections:j,renderWithoutModal:E,pickerType:b},t)})):o?e.jsxRuntimeExports.jsx(u.ProductPickerShimmer,{}):e.jsxRuntimeExports.jsx(c.EmptyState,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),O&&e.jsxRuntimeExports.jsx(u.ProductPickerShimmer,{})]})},exports.truncate=(e,t,s)=>{if(!e)return"";if(e.length<=t)return e;const i=e.slice(0,t-1);return(s?i.slice(0,i.lastIndexOf(" ")):i)+"..."};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("../../assets/icons/chevronRight.svg.js"),s=require("react"),i=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),o=require("../tag/Tag.js"),r=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),c=require("./emptyState.js"),u=require("./ProductPickerShimmer.js"),d=require("./style.js"),a=require("./utility.js");const x=s=>{const{customCollectionRestriction:c,data:u,selectedCollectionsDispatch:a,setCollectionId:x,setSelectedCollectionId:p,isPartiallyChecked:j,setScreen:C,id:h,isChecked:m,isDisabled:y,hideCollectionCheckbox:g,pickerType:v,usedInSearch:R}=s;return u?e.jsxRuntimeExports.jsxs(d.CollectionCardStyle,Object.assign({isDisabled:y,onClick:e=>{if(!y){if("COLLECTION"===v)return e.stopPropagation(),a({type:"reset",data:{}}),a({type:"selected",data:{id:h,val:u,isRestricted:c}}),x(h),void p(h);x(h),p(h),C("products")}},isActive:m,usedInSearch:null!=R&&R},{children:[e.jsxRuntimeExports.jsxs(d.CollectionCardInfoStyle,{children:[!g&&e.jsxRuntimeExports.jsx(i.CheckBox,{isDisabled:y,isChecked:m,isPartiallyChecked:j,onValueChange:function(e,t,s){null==s||s.stopPropagation(),a(e?{type:"selected",data:{id:h,val:u,isRestricted:c}}:{type:"unselected",data:{id:h}}),p(e?h:"")}}),e.jsxRuntimeExports.jsx(d.CollectionCardDetailStyle,{children:e.jsxRuntimeExports.jsx(r.Tooltip,Object.assign({body:u.name,placement:"bottom",delay:400,variant:"light"},{children:e.jsxRuntimeExports.jsxs(d.CollectionNameHolder,{children:[R?e.jsxRuntimeExports.jsx(n.BodyPrimary,Object.assign({numberOfLines:1},{children:u.name})):e.jsxRuntimeExports.jsx(n.TitleRegular,Object.assign({numberOfLines:1},{children:u.name})),u.isSmartCollection?e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsxRuntimeExports.jsx(o.Tag,{tagText:"Smart Collection",type:"warning"})})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]})}))})]}),"COLLECTION"!==v&&e.jsxRuntimeExports.jsx(l.IconButton,{height:12,width:12,disabled:y,Icon:t.default})]})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})};exports.CollectionCard=x,exports.CollectionsScreen=t=>{var i;const{customCollectionRestriction:l,dataLoading:o,collections:r,selectedCollectionsDispatch:n,setCollectionId:d,setSelectedCollectionId:p,selectedCollections:j,setScreen:C,collectionFetcher:h,collectionsDispatch:m,pagingControls:y,storeId:g,setSaveDisabled:v,hideCollectionCheckbox:R,renderWithoutModal:E,pickerType:b,scrollContainerRef:k,appType:f,limit:S,exactLimit:O}=t,P=s.useRef(y.curPage),I=!!l&&(null==j?void 0:j.isCustom),[T,q]=s.useState(!1),L=s.useRef(!1),D=s.useRef(!1),B=()=>{if(!k||!(null==k?void 0:k.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:s}=k.current;e+t>=s-20&&!L.current&&!D.current&&(v(!0),q(!0),D.current=!0,v(!0),q(!0),h(P.current,g,f).then((e=>{m({type:"paged",data:(null==e?void 0:e.collections)||{}}),y.setCurPage(P.current+1),q(!1),v(!1),D.current=!1,Object.keys(null==e?void 0:e.collections).length||(L.current=!0)})).catch())};s.useEffect((()=>{var e;return null===(e=null==k?void 0:k.current)||void 0===e||e.addEventListener("scroll",B),()=>{var e;null===(e=null==k?void 0:k.current)||void 0===e||e.removeEventListener("scroll",B)}}),[]),s.useEffect((()=>{P.current=y.curPage}),[y.curPage]);const N=Object.keys(j||{}).filter((e=>"isCustom"!==e)).length;return e.jsxRuntimeExports.jsxs("div",{children:[(null===(i=Object.keys(null!=r?r:{}))||void 0===i?void 0:i.length)?Object.keys(r).map((t=>{var s,i;const o=!!(null==j?void 0:j[t])&&("PRODUCT"!==b||!!Object.keys(null!==(i=null===(s=null==j?void 0:j[t])||void 0===s?void 0:s.products)&&void 0!==i?i:{}).length),c="COLLECTION"===b&&!o&&(!!O&&N>=O||!!S&&N>=S);return e.jsxRuntimeExports.jsx(x,{customCollectionRestriction:l,data:r[t],isDisabled:I&&!(null==j?void 0:j[t])||c,isChecked:o,isPartiallyChecked:a.isCollectionPartiallyChecked(t,null==r?void 0:r[t],j),selectedCollectionsDispatch:n,setCollectionId:d,setSelectedCollectionId:p,setScreen:C,id:t,hideCollectionCheckbox:R||"-1"===t,selectedCollections:j,renderWithoutModal:E,pickerType:b},t)})):o?e.jsxRuntimeExports.jsx(u.ProductPickerShimmer,{}):e.jsxRuntimeExports.jsx(c.EmptyState,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),T&&e.jsxRuntimeExports.jsx(u.ProductPickerShimmer,{})]})},exports.truncate=(e,t,s)=>{if(!e)return"";if(e.length<=t)return e;const i=e.slice(0,t-1);return(s?i.slice(0,i.lastIndexOf(" ")):i)+"..."};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth/models/bik-store"),o=require("../../assets/icons/search.svg.js"),s=require("react"),r=require("../../constants/Theme.js"),c=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),i=require("../input/Input.js"),l=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),p=require("./productInfoOverlay.js"),x=require("./productScreen.js"),h=require("./rearrangeScreen.js"),j=require("./reducers.js"),m=require("./searchScreen.js"),S=require("./selectedScreen.js"),C=require("./style.js"),g=require("./type.js"),y=require("./utility.js");exports.ProductPickerModal=R=>{const{storeId:b,selectedItems:f,onClose:E,visible:k,zIndex:v,exactLimit:I,limit:O,hideCollectionCheckbox:F,hideProductCheckbox:P,outOfStockAction:T=g.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,hideSelectionCount:N,title:A,width:B,left:w,renderWithoutModal:L,onClickSave:M,pickerType:V,hideProductVariants:z=!1,startupScreen:$=g.ScreenName.Collections,rearrangeEnabled:_,selectSingleItem:H=!1,showProductDetails:K,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:U={},primaryButton:Y,secondaryButton:J,subtitle:Q}=R,X=R.appType||t.ApplicationType.BIK,[Z,ee]=s.useReducer(j.collectionsReducer,{}),[te,oe]=s.useState([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections),[se,re]=s.useState("grid"),[ce,ne]=s.useState(""),[ie,le]=s.useState(""),[ae,de]=s.useState(0),[ue,pe]=s.useState(!1),[xe,he]=s.useState(0),[je,me]=s.useState(""),[Se,Ce]=s.useState(!1),[ge,ye]=s.useState(!1),[Re,be]=s.useReducer(j.searchReducer,{collections:{},products:{}}),[fe,Ee]=s.useReducer(j.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ke=s.useRef(null),[ve,Ie]=s.useState(!1),[Oe,Fe]=s.useState();s.useEffect((()=>{pe(!0),ye(!0),R.collectionFetcher(ae,b,X).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),pe(!1),de((e=>e+1)),ye(!1)})).catch()}),[]),s.useEffect((()=>{let e=0;z?Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s;"-1"!==t&&fe[-1]&&(null===(s=fe[-1].products)||void 0===s?void 0:s[o])||(e+=1)}))})):Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s,r;Object.keys((null===(r=null===(s=fe[t].products)||void 0===s?void 0:s[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),he(e)}),[Z,fe,z]),s.useEffect((()=>{ie&&(pe(!0),R.productFetcher(ie,b,X).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:ie,products:e}}),pe(!1)})).catch())}),[ie]),s.useEffect((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(je.length||"collections"!==te)&&(je.length?(Ce(!0),R.searchFetcher(b,je,X).then((e=>{"collections"in e&&"products"in e?(be({type:"set",data:e}),ee({type:"searched",data:e.collections}),ee({type:"searched",data:e.products})):(be({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),pe(!1),Ce(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[je]),s.useEffect((()=>{M&&(R.onAdd(fe,xe),Pe())}),[M]),s.useEffect((()=>{H&&Object.keys(fe||{}).length&&xe&&(R.onAdd(fe,xe),Pe())}),[H,fe,xe]);const Pe=()=>{Ee({type:"reset",data:{}})},Te=()=>I&&xe>I?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${I} products`,type:"negative"}):O&&xe>O?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${O} products`,type:"negative"}):xe>0?e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>{oe(_?g.ScreenName.RearrangeProducts:g.ScreenName.SelectedProducts)},buttonText:I?`${xe}/${I} products selected`:`${xe} products selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}):e.jsxRuntimeExports.jsx(n.Button,{disabled:!0,buttonText:I?`${xe}/${I} products selected`:`${xe} products selected`,buttonType:"tertiaryGray"}),De=e=>ue?"Loading...":te===g.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",qe=e.jsxRuntimeExports.jsxs(C.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[R.postHeader&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:R.postHeader})),!R.hideGlobalSearch&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:("collections"===te||"searchProducts"===te)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:L?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsxRuntimeExports.jsx(i.Input,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Se?e.jsxRuntimeExports.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):e.jsxRuntimeExports.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:je,onChangeText:e=>{e.length&&e.trim().length?me(e):me("")}})}))}),e.jsxRuntimeExports.jsxs(C.ScrollContainerStyle,Object.assign({ref:ke,screenName:te},{children:["collections"===te&&e.jsxRuntimeExports.jsx(u.CollectionsScreen,{customCollectionRestriction:R.customCollectionRestriction,dataLoading:ge,collections:Z,selectedCollectionsDispatch:Ee,setCollectionId:ne,setSelectedCollectionId:le,setScreen:oe,selectedCollections:fe,collectionFetcher:R.collectionFetcher,storeId:b,appType:X,collectionsDispatch:ee,setSaveDisabled:pe,pagingControls:{curPage:ae,setCurPage:de},hideCollectionCheckbox:F,renderWithoutModal:L,pickerType:V,scrollContainerRef:ke}),"products"===te&&ce&&e.jsxRuntimeExports.jsx(j.CollectionIdContext.Provider,Object.assign({value:ce},{children:e.jsxRuntimeExports.jsx(x.ProductsScreen,{hideInCollectionSearch:R.hideInCollectionSearch,customCollectionRestriction:R.customCollectionRestriction,productFetcher:R.productFetcher,setScreen:oe,storeId:b,appType:X,data:Z[ce],collectionsDispatch:ee,selectedCollectionsDispatch:Ee,selectedData:fe,setSaveDisabled:pe,searchInCollectionFetcher:R.searchInCollectionFetcher,hideProductCheckbox:P,outOfStockAction:T,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,renderWithoutModal:L,pickerType:V,hideProductVariants:z,fbStatusFetcher:R.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Fe(e)},showProductDetailInfoIcon:K,scrollContainerRef:ke})})),"view"===te&&e.jsxRuntimeExports.jsx(S.SelectedScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,hideProductVariants:z,outOfStockAction:T,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"rearrange"===te&&e.jsxRuntimeExports.jsx(h.RearrangeScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,outOfStockAction:T,rearrangeViewType:"grid"===se?"list":"grid",scrollContainerRef:ke,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"searchProducts"===te&&e.jsxRuntimeExports.jsx(m.SearchScreen,{customCollectionRestriction:R.customCollectionRestriction,selectedCollections:fe||{},searchedCollections:Re||{},searchedCollectionsDispatch:be,selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,onBackPress:()=>{me(""),be({type:"set",data:{collections:{},products:{}}})},pickerType:V,hideProductCheckbox:P,hideProductVariants:z,hideVariantCheckbox:D,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher,setCollectionId:ne,setSelectedCollectionId:le,renderWithoutModal:L,hideCollectionCheckbox:F,outOfStockAction:T})]}))]}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:L?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[qe,U.renderFooter?e.jsxRuntimeExports.jsxs(C.StyledFooterForNonModal,{children:[Te(),e.jsxRuntimeExports.jsx(n.Button,{buttonText:De(U.primaryButtonText),disabled:!U.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||U.primaryButtonDisabled,isLoading:U.isLoading,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections)}})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),ve&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,outOfStockAction:T,useDynamicInfoImageSize:R.useDynamicInfoImageSize,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}):e.jsxRuntimeExports.jsxs(l.StyledModal,Object.assign({zIndex:v,open:k,onClose:()=>{null==E||E(),Pe()},headingTitle:A||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),headingSubtitle:Q,footerShadow:!0,centralContainerStyles:{width:B||"600px",left:w||"auto"},headerRightCustomElement:G?e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:E},{children:e.jsxRuntimeExports.jsx(c.default,{width:20,height:20,color:r.COLORS.content.secondary})})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),footerContainerStyle:R.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:Y?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||e.disabled,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes($)?$:g.ScreenName.Collections)}}))(Y):{buttonText:De(),disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{R.onAdd(fe,xe),Pe()}},secondaryButton:J?(e=>Object.assign(Object.assign({},e),{disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{const e=y.updateAllVariantsForSelectedProducts(fe,Z,Re);R.onAdd(e,xe,!0)}}))(J):void 0,wrapperStyle:R.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):Te(),hideCrossButton:ve||G},{children:[qe,ve&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,useDynamicInfoImageSize:R.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}))})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("@bikdotai/bik-models/growth/models/bik-store"),o=require("../../assets/icons/search.svg.js"),s=require("react"),r=require("../../constants/Theme.js"),c=require("../../assets/icons/cross.svg.js"),n=require("../button/Button.js"),i=require("../input/Input.js"),l=require("../modals/styledModal.js"),a=require("../spinner/Spinner.js"),d=require("../tag/Tag.js"),u=require("./collectionScreen.js"),p=require("./productInfoOverlay.js"),x=require("./productScreen.js"),h=require("./rearrangeScreen.js"),j=require("./reducers.js"),m=require("./searchScreen.js"),S=require("./selectedScreen.js"),C=require("./style.js"),g=require("./type.js"),y=require("./utility.js");exports.ProductPickerModal=R=>{const{storeId:b,selectedItems:f,onClose:E,visible:v,zIndex:k,exactLimit:I,limit:O,hideCollectionCheckbox:F,hideProductCheckbox:P,outOfStockAction:T=g.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,hideSelectionCount:N,title:L,width:A,left:B,renderWithoutModal:w,onClickSave:$,pickerType:M,hideProductVariants:V=!1,startupScreen:z=g.ScreenName.Collections,rearrangeEnabled:_,selectSingleItem:H=!1,showProductDetails:K,containerStyle:W,crossButtonInsideHeader:G=!1,footerForNonModal:U={},primaryButton:Y,secondaryButton:J,subtitle:Q}=R,X=R.appType||t.ApplicationType.BIK,[Z,ee]=s.useReducer(j.collectionsReducer,{}),[te,oe]=s.useState([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes(z)?z:g.ScreenName.Collections),[se,re]=s.useState("grid"),[ce,ne]=s.useState(""),[ie,le]=s.useState(""),[ae,de]=s.useState(0),[ue,pe]=s.useState(!1),[xe,he]=s.useState(0),[je,me]=s.useState(""),[Se,Ce]=s.useState(!1),[ge,ye]=s.useState(!1),[Re,be]=s.useReducer(j.searchReducer,{collections:{},products:{}}),[fe,Ee]=s.useReducer(j.selectedColectionsReducer,Object.keys(f).length>0?f:{}),ve=s.useRef(null),[ke,Ie]=s.useState(!1),[Oe,Fe]=s.useState();s.useEffect((()=>{pe(!0),ye(!0),R.collectionFetcher(ae,b,X).then((e=>{ee({type:"fetched",data:(null==e?void 0:e.collections)||{}}),pe(!1),de((e=>e+1)),ye(!1)})).catch()}),[]),s.useEffect((()=>{let e=0;"COLLECTION"===M?e=Object.keys(fe||{}).filter((e=>"isCustom"!==e)).length:V?Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s;"-1"!==t&&fe[-1]&&(null===(s=fe[-1].products)||void 0===s?void 0:s[o])||(e+=1)}))})):Object.keys(fe||[]).forEach((t=>{var o;Object.keys((null===(o=fe[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var s,r;Object.keys((null===(r=null===(s=fe[t].products)||void 0===s?void 0:s[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),he(e)}),[Z,fe,V,M]),s.useEffect((()=>{ie&&(pe(!0),R.productFetcher(ie,b,X).then((e=>{Object.keys(e).length&&ee({type:"productsFetched",data:{collectionId:ie,products:e}}),pe(!1)})).catch())}),[ie]),s.useEffect((()=>{const e=setTimeout((()=>{"rearrange"!==te&&(je.length||"collections"!==te)&&(je.length?(Ce(!0),R.searchFetcher(b,je,X).then((e=>{"collections"in e&&"products"in e?(be({type:"set",data:e}),ee({type:"searched",data:e.collections}),ee({type:"searched",data:e.products})):(be({type:"set",data:{collections:{},products:e}}),ee({type:"searched",data:e})),oe("searchProducts"),pe(!1),Ce(!1)}))):oe("collections"))}),800);return()=>clearTimeout(e)}),[je]),s.useEffect((()=>{$&&(R.onAdd(fe,xe),Pe())}),[$]),s.useEffect((()=>{H&&Object.keys(fe||{}).length&&xe&&(R.onAdd(fe,xe),Pe())}),[H,fe,xe]);const Pe=()=>{Ee({type:"reset",data:{}})},Te=()=>{let t,o;return"COLLECTION"===M?(t="collection",o="collections"):V?(t="product",o="products"):(t="variant",o="variants"),I&&xe>I?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${I} ${1===I?t:o}`,type:"negative"}):O&&xe>O?e.jsxRuntimeExports.jsx(d.Tag,{tagText:`You can only select ${O} ${1===O?t:o}`,type:"negative"}):xe>0?e.jsxRuntimeExports.jsx(n.Button,{onClick:()=>{oe(_?g.ScreenName.RearrangeProducts:g.ScreenName.SelectedProducts)},buttonText:I?`${xe}/${I} ${1===xe?t:o} selected`:`${xe} ${1===xe?t:o} selected`,buttonType:["rearrange","view"].includes(te)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(te)}):e.jsxRuntimeExports.jsx(n.Button,{disabled:!0,buttonText:I?`${xe}/${I} ${1===I?t:o} selected`:`${xe} ${1===xe?t:o} selected`,buttonType:"tertiaryGray"})},De=e=>ue?"Loading...":te===g.ScreenName.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",qe=e.jsxRuntimeExports.jsxs(C.ContainerStyle,Object.assign({style:null!=W?W:{}},{children:[R.postHeader&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:R.postHeader})),!R.hideGlobalSearch&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:("collections"===te||"searchProducts"===te)&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{padding:w?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsxRuntimeExports.jsx(i.Input,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Se?e.jsxRuntimeExports.jsx(a.Spinner,{size:"small",color:r.COLORS.content.primary}):e.jsxRuntimeExports.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:je,onChangeText:e=>{e.length&&e.trim().length?me(e):me("")}})}))}),e.jsxRuntimeExports.jsxs(C.ScrollContainerStyle,Object.assign({ref:ve,screenName:te},{children:["collections"===te&&e.jsxRuntimeExports.jsx(u.CollectionsScreen,{customCollectionRestriction:R.customCollectionRestriction,dataLoading:ge,collections:Z,selectedCollectionsDispatch:Ee,setCollectionId:ne,setSelectedCollectionId:le,setScreen:oe,selectedCollections:fe,collectionFetcher:R.collectionFetcher,storeId:b,appType:X,collectionsDispatch:ee,setSaveDisabled:pe,pagingControls:{curPage:ae,setCurPage:de},hideCollectionCheckbox:F,renderWithoutModal:w,pickerType:M,scrollContainerRef:ve,limit:O,exactLimit:I}),"products"===te&&ce&&e.jsxRuntimeExports.jsx(j.CollectionIdContext.Provider,Object.assign({value:ce},{children:e.jsxRuntimeExports.jsx(x.ProductsScreen,{hideInCollectionSearch:R.hideInCollectionSearch,customCollectionRestriction:R.customCollectionRestriction,productFetcher:R.productFetcher,setScreen:oe,storeId:b,appType:X,data:Z[ce],collectionsDispatch:ee,selectedCollectionsDispatch:Ee,selectedData:fe,setSaveDisabled:pe,searchInCollectionFetcher:R.searchInCollectionFetcher,hideProductCheckbox:P,outOfStockAction:T,hideVariantCheckbox:D,selectProductsFromCustomCollection:q,renderWithoutModal:w,pickerType:M,hideProductVariants:V,fbStatusFetcher:R.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Fe(e)},showProductDetailInfoIcon:K,scrollContainerRef:ve})})),"view"===te&&e.jsxRuntimeExports.jsx(S.SelectedScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,hideProductVariants:V,outOfStockAction:T,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"rearrange"===te&&e.jsxRuntimeExports.jsx(h.RearrangeScreen,{selectedCollections:fe||{},selectedCollectionsDispatch:Ee,setScreen:oe,outOfStockAction:T,rearrangeViewType:"grid"===se?"list":"grid",scrollContainerRef:ve,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher}),"searchProducts"===te&&e.jsxRuntimeExports.jsx(m.SearchScreen,{customCollectionRestriction:R.customCollectionRestriction,selectedCollections:fe||{},searchedCollections:Re||{},searchedCollectionsDispatch:be,selectedCollectionsDispatch:Ee,setScreen:oe,collections:Z,onBackPress:()=>{me(""),be({type:"set",data:{collections:{},products:{}}})},pickerType:M,hideProductCheckbox:P,hideProductVariants:V,hideVariantCheckbox:D,storeId:b,appType:X,fbStatusFetcher:R.fbStatusFetcher,setCollectionId:ne,setSelectedCollectionId:le,renderWithoutModal:w,hideCollectionCheckbox:F,outOfStockAction:T,limit:O,exactLimit:I})]}))]}));return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:w?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[qe,U.renderFooter?e.jsxRuntimeExports.jsxs(C.StyledFooterForNonModal,{children:[Te(),e.jsxRuntimeExports.jsx(n.Button,{buttonText:De(U.primaryButtonText),disabled:!U.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||U.primaryButtonDisabled,isLoading:U.isLoading,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes(z)?z:g.ScreenName.Collections)}})]}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),ke&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,outOfStockAction:T,useDynamicInfoImageSize:R.useDynamicInfoImageSize,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}):e.jsxRuntimeExports.jsxs(l.StyledModal,Object.assign({zIndex:k,open:v,onClose:()=>{null==E||E(),Pe()},headingTitle:L||("collections"===te||"products"===te?"Select Products":"view"===te?"Selected Products":"searchProducts"===te?"Searched Results":"rearrange"===te?"Rearrange Products":void 0),headingSubtitle:Q,footerShadow:!0,centralContainerStyles:{width:A||"600px",left:B||"auto"},headerRightCustomElement:G?e.jsxRuntimeExports.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:E},{children:e.jsxRuntimeExports.jsx(c.default,{width:20,height:20,color:r.COLORS.content.secondary})})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),footerContainerStyle:R.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:Y?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(ue||xe<1||I&&xe<I||!I&&O&&xe>O)||e.disabled,onClick:()=>{R.onAdd(fe,xe),Pe(),oe([g.ScreenName.Collections,g.ScreenName.RearrangeProducts].includes(z)?z:g.ScreenName.Collections)}}))(Y):{buttonText:De(),disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{R.onAdd(fe,xe),Pe()}},secondaryButton:J?(e=>Object.assign(Object.assign({},e),{disabled:ue||xe<1||I&&xe<I||!I&&O&&xe>O||!1,onClick:()=>{const e=y.updateAllVariantsForSelectedProducts(fe,Z,Re);R.onAdd(e,xe,!0)}}))(J):void 0,wrapperStyle:R.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:N?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}):Te(),hideCrossButton:ke||G},{children:[qe,ke&&Oe?e.jsxRuntimeExports.jsx(p.ProductInfoOverlay,{productData:Oe,useDynamicInfoImageSize:R.useDynamicInfoImageSize,outOfStockAction:T,onClose:()=>{Ie(!1)}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}))})};
@@ -26,6 +26,8 @@ interface SearchScreenInterface {
26
26
  hideCollectionCheckbox?: boolean;
27
27
  renderWithoutModal?: boolean;
28
28
  outOfStockAction?: OUT_OF_STOCK_ACTION;
29
+ limit?: number;
30
+ exactLimit?: number;
29
31
  }
30
32
  export declare const SearchScreen: (props: SearchScreenInterface) => import("react/jsx-runtime").JSX.Element;
31
33
  export {};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("../../assets/icons/arrow_left.svg.js"),o=require("react"),s=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),l=require("./collectionScreen.js"),c=require("./emptyState.js"),r=require("./product.js"),d=require("./style.js"),n=require("./utility.js");exports.SearchScreen=u=>{var a;const{customCollectionRestriction:p,selectedCollections:x,searchedCollections:h,searchedCollectionsDispatch:j,selectedCollectionsDispatch:v,setScreen:C,collections:m,onBackPress:y,hideVariantCheckbox:k,pickerType:b,hideProductVariants:S,hideProductCheckbox:R,storeId:E,fbStatusFetcher:P,setCollectionId:f,setSelectedCollectionId:O,hideCollectionCheckbox:g,renderWithoutModal:I,outOfStockAction:q,appType:D}=u;o.useEffect((()=>{var e;n.fetchFbStatusCollection(null!==(e=h.products)&&void 0!==e?e:{},E,D,j,P,"setProducts")}),[null==h?void 0:h.products]);const T=!!p&&(null==x?void 0:x.isCustom);return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs(d.SelectedScreenHeader,{children:[e.jsxRuntimeExports.jsx(s.IconButton,{Icon:t.default,onClick:()=>{C("collections"),y()}}),e.jsxRuntimeExports.jsx(i.BodyCaption,{children:(null===(a=Object.keys(null==h?void 0:h.collections))||void 0===a?void 0:a.length)?"Searched Collections & Products":"Searched Products"})]}),e.jsxRuntimeExports.jsx("div",{children:Object.keys(null==h?void 0:h.products).length||Object.keys(null==h?void 0:h.collections).length?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Object.keys(null==h?void 0:h.collections).map((t=>e.jsxRuntimeExports.jsx(l.CollectionCard,{customCollectionRestriction:p,data:null==m?void 0:m[t],isDisabled:T&&!(null==x?void 0:x[t]),isChecked:!!(null==x?void 0:x[t]),isPartiallyChecked:n.isCollectionPartiallyChecked(t,null==m?void 0:m[t],x,S),selectedCollectionsDispatch:v,setCollectionId:f,setSelectedCollectionId:O,setScreen:C,id:t,hideCollectionCheckbox:g||"-1"===t,selectedCollections:x,renderWithoutModal:I,pickerType:b,usedInSearch:!0},t)))}),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Object.keys(null==h?void 0:h.products).map((t=>{var o,s;return Object.keys((null===(s=null===(o=null==h?void 0:h.products)||void 0===o?void 0:o[t])||void 0===s?void 0:s.products)||[]).map((o=>{var s,i,l;let c=!1;return(null===(s=null==h?void 0:h.products)||void 0===s?void 0:s.isCustom)&&(c=!0),e.jsxRuntimeExports.jsx(r.ProductGroup,{collectionId:t,upliftAdditions:(e,o)=>((e,t,o)=>{var s;const i=n.liftTheStateUp(o,null===(s=null==h?void 0:h.products)||void 0===s?void 0:s[e]);v({type:t,data:Object.assign(Object.assign({},i),{isRestricted:p})})})(t,e,o),productId:o,data:(null===(i=null==h?void 0:h.products)||void 0===i?void 0:i[t].products)[o],isProductPartiallyChecked:n.isProductPartiallyChecked(t,o,x,null===(l=h.products)||void 0===l?void 0:l[t],S),selectedData:x,selectedCollectionsDispatch:v,viewOnly:c,hideProductCheckbox:R,hideVariantCheckbox:k,hideProductVariants:S,pickerType:b,outOfStockAction:q},o)}))}))})]}):e.jsxRuntimeExports.jsx(c.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("../../assets/icons/arrow_left.svg.js"),o=require("react"),i=require("../icon-button/IconButton.js"),s=require("../TypographyStyle.js"),l=require("./collectionScreen.js"),c=require("./emptyState.js"),r=require("./product.js"),n=require("./style.js"),d=require("./utility.js");exports.SearchScreen=u=>{var a;const{customCollectionRestriction:p,selectedCollections:x,searchedCollections:h,searchedCollectionsDispatch:j,selectedCollectionsDispatch:v,setScreen:C,collections:m,onBackPress:y,hideVariantCheckbox:k,pickerType:b,hideProductVariants:S,hideProductCheckbox:E,storeId:R,fbStatusFetcher:P,setCollectionId:f,setSelectedCollectionId:O,hideCollectionCheckbox:g,renderWithoutModal:I,outOfStockAction:q,appType:T,limit:D,exactLimit:F}=u;o.useEffect((()=>{var e;d.fetchFbStatusCollection(null!==(e=h.products)&&void 0!==e?e:{},R,T,j,P,"setProducts")}),[null==h?void 0:h.products]);const B=!!p&&(null==x?void 0:x.isCustom),V=Object.keys(x||{}).filter((e=>"isCustom"!==e)).length;return e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsxs(n.SelectedScreenHeader,{children:[e.jsxRuntimeExports.jsx(i.IconButton,{Icon:t.default,onClick:()=>{C("collections"),y()}}),e.jsxRuntimeExports.jsx(s.BodyCaption,{children:(null===(a=Object.keys(null==h?void 0:h.collections))||void 0===a?void 0:a.length)?"Searched Collections & Products":"Searched Products"})]}),e.jsxRuntimeExports.jsx("div",{children:Object.keys(null==h?void 0:h.products).length||Object.keys(null==h?void 0:h.collections).length?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Object.keys(null==h?void 0:h.collections).map((t=>{const o=!!(null==x?void 0:x[t]),i="COLLECTION"===b&&!o&&(!!F&&V>=F||!!D&&V>=D);return e.jsxRuntimeExports.jsx(l.CollectionCard,{customCollectionRestriction:p,data:null==m?void 0:m[t],isDisabled:B&&!(null==x?void 0:x[t])||i,isChecked:o,isPartiallyChecked:d.isCollectionPartiallyChecked(t,null==m?void 0:m[t],x,S),selectedCollectionsDispatch:v,setCollectionId:f,setSelectedCollectionId:O,setScreen:C,id:t,hideCollectionCheckbox:g||"-1"===t,selectedCollections:x,renderWithoutModal:I,pickerType:b,usedInSearch:!0},t)}))}),e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:Object.keys(null==h?void 0:h.products).map((t=>{var o,i;return Object.keys((null===(i=null===(o=null==h?void 0:h.products)||void 0===o?void 0:o[t])||void 0===i?void 0:i.products)||[]).map((o=>{var i,s,l;let c=!1;return(null===(i=null==h?void 0:h.products)||void 0===i?void 0:i.isCustom)&&(c=!0),e.jsxRuntimeExports.jsx(r.ProductGroup,{collectionId:t,upliftAdditions:(e,o)=>((e,t,o)=>{var i;const s=d.liftTheStateUp(o,null===(i=null==h?void 0:h.products)||void 0===i?void 0:i[e]);v({type:t,data:Object.assign(Object.assign({},s),{isRestricted:p})})})(t,e,o),productId:o,data:(null===(s=null==h?void 0:h.products)||void 0===s?void 0:s[t].products)[o],isProductPartiallyChecked:d.isProductPartiallyChecked(t,o,x,null===(l=h.products)||void 0===l?void 0:l[t],S),selectedData:x,selectedCollectionsDispatch:v,viewOnly:c,hideProductCheckbox:E,hideVariantCheckbox:k,hideProductVariants:S,pickerType:b,outOfStockAction:q},o)}))}))})]}):e.jsxRuntimeExports.jsx(c.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../node_modules/react/jsx-runtime.js"),s=require("../../constants/Theme.js"),e=require("../tooltips/Tooltip.js"),n=require("./WhatsNew.styles.js");const i=s=>{let{width:e=32,height:n=32}=s;return t.jsxRuntimeExports.jsxs("svg",Object.assign({width:e,height:n,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[t.jsxRuntimeExports.jsxs("g",Object.assign({clipPath:"url(#clip0_4309_13422)"},{children:[t.jsxRuntimeExports.jsx("path",{d:"M22.1797 15.3052L15.4548 24.4022C15.3815 24.5014 15.3339 24.6172 15.316 24.7392C15.2982 24.8613 15.3108 24.9859 15.3526 25.1019L15.7733 26.2675C15.8141 26.3806 15.8815 26.4822 15.9698 26.5638C16.0581 26.6454 16.1647 26.7046 16.2806 26.7364C16.3966 26.7682 16.5185 26.7716 16.636 26.7464C16.7536 26.7212 16.8634 26.6681 16.9561 26.5916L20.7368 23.5654",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsxRuntimeExports.jsx("path",{d:"M6.4457 17.6642C6.36082 17.7791 6.31051 17.9158 6.30068 18.0583C6.29085 18.2008 6.32192 18.3431 6.39022 18.4686C6.45853 18.594 6.56123 18.6973 6.68626 18.7664C6.81128 18.8355 6.95343 18.8674 7.09598 18.8584C13.4962 18.4646 17.7214 21.3363 17.7214 21.3363L20.7369 23.5654C21.5366 24.1567 22.5385 24.406 23.5221 24.2585C24.5056 24.111 25.3903 23.5789 25.9816 22.7791C26.5728 21.9794 26.8221 20.9775 26.6746 19.9939C26.5272 19.0104 25.995 18.1257 25.1952 17.5344L22.1797 15.3053C22.1797 15.3053 18.1953 12.1079 16.6943 5.87443C16.6611 5.7356 16.5889 5.60913 16.4863 5.50988C16.3837 5.41062 16.2549 5.34272 16.1151 5.31413C15.9752 5.28554 15.8301 5.29746 15.6968 5.34849C15.5635 5.39952 15.4475 5.48754 15.3624 5.6022L6.4457 17.6642Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsxRuntimeExports.jsx("path",{d:"M7.69175 12.0819L5.24902 11.3518",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),t.jsxRuntimeExports.jsx("path",{d:"M10.9423 8.35748L9.88867 6.03589",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),t.jsxRuntimeExports.jsx("path",{d:"M8.91955 9.68574L5.66699 6.87134",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})),t.jsxRuntimeExports.jsx("defs",{children:t.jsxRuntimeExports.jsx("clipPath",Object.assign({id:"clip0_4309_13422"},{children:t.jsxRuntimeExports.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(4 4)"})}))})]}))};exports.WhatsNewButton=r=>{let{onClick:o,newContentCount:x=0,isOpen:c=!1,isLoading:d=!1,tooltip:a="What's new",testId:j="whats-new-button",iconWidth:l=32,iconHeight:p=32,customIcon:u}=r;return d?t.jsxRuntimeExports.jsxs("div",Object.assign({style:{margin:"0px 8px"}},{children:[t.jsxRuntimeExports.jsx("div",{style:{width:16,height:16,border:"2px solid #f3f3f3",borderTop:"2px solid #731DCF",borderRadius:"50%",animation:"spin 1s linear infinite"}}),t.jsxRuntimeExports.jsx("style",{children:"\n\t\t\t\t\t\t@keyframes spin {\n\t\t\t\t\t\t\t0% { transform: rotate(0deg); }\n\t\t\t\t\t\t\t100% { transform: rotate(360deg); }\n\t\t\t\t\t\t}\n\t\t\t\t\t"})]})):t.jsxRuntimeExports.jsx(n.WhatsNewIconContainer,Object.assign({count:x},{children:t.jsxRuntimeExports.jsxs("div",Object.assign({className:"main-icon-class "+(c?"icon-active":""),style:{color:c?s.COLORS.content.brand:s.COLORS.content.primary},onClick:o,"data-testid":j},{children:[t.jsxRuntimeExports.jsx(e.Tooltip,Object.assign({body:a},{children:t.jsxRuntimeExports.jsx("div",{children:u?t.jsxRuntimeExports.jsx(u,{width:l,height:p,color:c?s.COLORS.content.brand:s.COLORS.content.primary}):t.jsxRuntimeExports.jsx(i,{width:l,height:p})})})),x>0&&t.jsxRuntimeExports.jsx("div",Object.assign({className:"notification--count"},{children:t.jsxRuntimeExports.jsx("div",Object.assign({className:"count--text"},{children:x}))}))]}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../node_modules/react/jsx-runtime.js"),s=require("../../assets/icons/whatsNew.svg.js"),e=require("../../constants/Theme.js"),n=require("../tooltips/Tooltip.js"),i=require("./WhatsNew.styles.js");exports.WhatsNewButton=o=>{let{onClick:r,newContentCount:a=0,isOpen:c=!1,isLoading:x=!1,tooltip:d="What's new",testId:j="whats-new-button",iconWidth:l=32,iconHeight:u=32,customIcon:p}=o;return x?t.jsxRuntimeExports.jsxs("div",Object.assign({style:{margin:"0px 8px"}},{children:[t.jsxRuntimeExports.jsx("div",{style:{width:16,height:16,border:"2px solid #f3f3f3",borderTop:"2px solid #731DCF",borderRadius:"50%",animation:"spin 1s linear infinite"}}),t.jsxRuntimeExports.jsx("style",{children:"\n\t\t\t\t\t\t@keyframes spin {\n\t\t\t\t\t\t\t0% { transform: rotate(0deg); }\n\t\t\t\t\t\t\t100% { transform: rotate(360deg); }\n\t\t\t\t\t\t}\n\t\t\t\t\t"})]})):t.jsxRuntimeExports.jsx(i.WhatsNewIconContainer,Object.assign({count:a},{children:t.jsxRuntimeExports.jsxs("div",Object.assign({className:"main-icon-class "+(c?"icon-active":""),style:{color:c?e.COLORS.content.brand:e.COLORS.content.primary},onClick:r,"data-testid":j},{children:[t.jsxRuntimeExports.jsx(n.Tooltip,Object.assign({body:d},{children:t.jsxRuntimeExports.jsx("div",{children:p?t.jsxRuntimeExports.jsx(p,{width:l,height:u,color:c?e.COLORS.content.brand:e.COLORS.content.primary}):t.jsxRuntimeExports.jsx(s.default,{})})})),a>0&&t.jsxRuntimeExports.jsx("div",Object.assign({className:"notification--count"},{children:t.jsxRuntimeExports.jsx("div",Object.assign({className:"count--text"},{children:a}))}))]}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("date-fns"),s=require("react"),r=require("../../constants/Theme.js"),n=require("../button/Button.js"),i=require("../feature-announcements/VideoModal.js"),o=require("../searchBar/searchBar.js"),a=require("../side-modal/SideModal.js"),x=require("../TypographyStyle.js"),d=require("./WhatsNew.styles.js");const l=t=>{let{width:s=32,height:r=32}=t;return e.jsxRuntimeExports.jsx("svg",Object.assign({width:s,height:r,viewBox:"0 0 24 24",fill:"none"},{children:e.jsxRuntimeExports.jsx("path",{d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},c=t=>{let{width:s=32,height:r=32}=t;return e.jsxRuntimeExports.jsxs("svg",Object.assign({width:s,height:r,viewBox:"0 0 32 32",fill:"none"},{children:[e.jsxRuntimeExports.jsx("path",{d:"M16 2C8.268 2 2 8.268 2 16s6.268 14 14 14 14-6.268 14-14S23.732 2 16 2zm0 25c-6.065 0-11-4.935-11-11S9.935 5 16 5s11 4.935 11 11-4.935 11-11 11z",fill:"currentColor"}),e.jsxRuntimeExports.jsx("path",{d:"M16 10.5c-.828 0-1.5.672-1.5 1.5s.672 1.5 1.5 1.5 1.5-.672 1.5-1.5-.672-1.5-1.5-1.5zM15 15h2v8h-2v-8z",fill:"currentColor"})]}))};exports.WhatsNewPanel=u=>{let{isOpen:j,onClose:m,content:h,isLoading:p=!1,title:g="What's new on BIK",searchPlaceholder:R="Search posts",emptyStateTitle:E="Nothing new!",emptyStateDescription:w="There are no new updates or features at the moment. Check back soon!",noResultsText:C="Sorry, no results found.",width:b="480px",onContentClick:O,renderCustomContent:y}=u;const[f,v]=s.useState(""),[S,M]=s.useState(!1),[N,k]=s.useState(""),L=e=>{if(!e.createdAt)return!1;const s=e.createdAt.toDate?e.createdAt.toDate():new Date(e.createdAt);return t.differenceInBusinessDays(new Date,s)<7},B=s.useMemo((()=>{if(!f.trim())return h;const e=f.toLowerCase();return h.filter((t=>t.title.toLowerCase().includes(e)||t.body.toLowerCase().includes(e)||t.content&&t.content.toLowerCase().includes(e)))}),[h,f]),T=0===h.length,q=0===B.length;return j?e.jsxRuntimeExports.jsxs(a.SideModal,Object.assign({width:b,onClose:m,header:"",headerCustomComponent:e.jsxRuntimeExports.jsx(x.TitleMedium,Object.assign({color:r.COLORS.background.inverse},{children:g})),headerStyle:{background:r.COLORS.background.brandLight},hideFooter:!0},{children:[e.jsxRuntimeExports.jsxs(d.MainContainer,{children:[e.jsxRuntimeExports.jsx("div",Object.assign({className:"mt-8"},{children:e.jsxRuntimeExports.jsx(o.SearchBar,{width:"100%",isEnabled:!T,onChange:e=>{v(e)},onEnter:e=>{v(e)},placeholder:R,variant:"default",searchValue:f,onClickCross:()=>{v("")}})})),e.jsxRuntimeExports.jsx(d.WhatsNewWrapper,{children:T||q?e.jsxRuntimeExports.jsxs("div",Object.assign({className:"no--data--found"},{children:[e.jsxRuntimeExports.jsx("div",Object.assign({className:"icon--wrapper"},{children:T?e.jsxRuntimeExports.jsx(c,{width:32,height:32}):e.jsxRuntimeExports.jsx(l,{width:32,height:32})})),T?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(x.TitleRegular,{children:E}),e.jsxRuntimeExports.jsx(x.BodyPrimary,Object.assign({color:r.COLORS.content.secondary,className:"text--align",style:{maxWidth:300}},{children:w}))]}):q?e.jsxRuntimeExports.jsx(x.BodyPrimary,Object.assign({color:r.COLORS.content.secondary,className:"text--align",style:{maxWidth:300}},{children:C})):null]})):e.jsxRuntimeExports.jsx("div",Object.assign({className:"scroller"},{children:B.map(((s,i)=>y?y(s):e.jsxRuntimeExports.jsxs(d.MainCardContainer,Object.assign({className:"padding--16 mb-mt-8"},{children:[e.jsxRuntimeExports.jsx(d.BackgroundImageContainer,{imageUrl:s.image,height:"209px",width:"100%",style:{borderRadius:"4px"}}),e.jsxRuntimeExports.jsx("div",Object.assign({className:"mt-20 full--width"},{children:e.jsxRuntimeExports.jsxs("div",Object.assign({className:"created--at flex flex--row"},{children:[L(s)?e.jsxRuntimeExports.jsx("div",Object.assign({className:"new--content--tag"},{children:e.jsxRuntimeExports.jsx(x.Caption,{children:"New"})})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),e.jsxRuntimeExports.jsx(x.Caption,Object.assign({style:{color:r.COLORS.content.placeholder}},{children:s.createdAt?t.format(s.createdAt.toDate?s.createdAt.toDate():new Date(s.createdAt),"dd MMMM yyyy"):""}))]}))})),e.jsxRuntimeExports.jsx("div",Object.assign({className:"mt--8"},{children:e.jsxRuntimeExports.jsx(x.TitleSmall,{children:s.title})})),e.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:s.body},className:"card--desc mt--12"}),e.jsxRuntimeExports.jsx("div",Object.assign({className:"flex flex--row mt-20 full--width"},{children:e.jsxRuntimeExports.jsx(n.Button,{buttonText:s.buttonText||"Explore the feature",onClick:()=>(e=>{e.productVideo?(k(e.productVideo),M(!0)):e.redirectUrl&&window.open(e.redirectUrl,"_blank"),O&&O(e)})(s),matchParentWidth:!0,size:"medium"})}))]}),`whats-new-${i}`)))}))})]}),e.jsxRuntimeExports.jsx(i.VideoModal,{isOpen:S,videoUrl:N,onClose:()=>{M(!1)}})]})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("date-fns"),s=require("react"),r=require("../../assets/icons/searchIconWhatsNew.svg.js"),n=require("../../assets/icons/whatsNew.svg.js"),i=require("../../constants/Theme.js"),a=require("../button/Button.js"),o=require("../feature-announcements/VideoModal.js"),c=require("../searchBar/searchBar.js"),d=require("../side-modal/SideModal.js"),x=require("../TypographyStyle.js"),l=require("./WhatsNew.styles.js");exports.WhatsNewPanel=u=>{let{isOpen:j,onClose:m,content:h,isLoading:p=!1,title:g="What's new on BIK",searchPlaceholder:R="Search posts",emptyStateTitle:E="Nothing new!",emptyStateDescription:w="There are no new updates or features at the moment. Check back soon!",noResultsText:b="Sorry, no results found.",width:C="480px",onContentClick:O,renderCustomContent:y}=u;const[f,N]=s.useState(""),[S,v]=s.useState(!1),[M,q]=s.useState(""),L=e=>{if(!e.createdAt)return!1;const s=e.createdAt.toDate?e.createdAt.toDate():new Date(e.createdAt);return t.differenceInBusinessDays(new Date,s)<7},T=s.useMemo((()=>{if(!f.trim())return h;const e=f.toLowerCase();return h.filter((t=>t.title.toLowerCase().includes(e)||t.body.toLowerCase().includes(e)||t.content&&t.content.toLowerCase().includes(e)))}),[h,f]),k=0===h.length,B=0===T.length;return j?e.jsxRuntimeExports.jsxs(d.SideModal,Object.assign({width:C,onClose:m,header:"",headerCustomComponent:e.jsxRuntimeExports.jsx(x.TitleMedium,Object.assign({color:i.COLORS.background.inverse},{children:g})),headerStyle:{background:i.COLORS.background.brandLight},hideFooter:!0},{children:[e.jsxRuntimeExports.jsxs(l.MainContainer,{children:[e.jsxRuntimeExports.jsx("div",Object.assign({className:"mt-8"},{children:e.jsxRuntimeExports.jsx(c.SearchBar,{width:"100%",isEnabled:!k,onChange:e=>{N(e)},onEnter:e=>{N(e)},placeholder:R,variant:"default",searchValue:f,onClickCross:()=>{N("")}})})),e.jsxRuntimeExports.jsx(l.WhatsNewWrapper,{children:k||B?e.jsxRuntimeExports.jsxs("div",Object.assign({className:"no--data--found"},{children:[e.jsxRuntimeExports.jsx("div",Object.assign({className:"icon--wrapper"},{children:k?e.jsxRuntimeExports.jsx(n.default,{}):e.jsxRuntimeExports.jsx(r.default,{})})),k?e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsx(x.TitleRegular,{children:E}),e.jsxRuntimeExports.jsx(x.BodyPrimary,Object.assign({color:i.COLORS.content.secondary,className:"text--align",style:{maxWidth:300}},{children:w}))]}):B?e.jsxRuntimeExports.jsx(x.BodyPrimary,Object.assign({color:i.COLORS.content.secondary,className:"text--align",style:{maxWidth:300}},{children:b})):null]})):e.jsxRuntimeExports.jsx("div",Object.assign({className:"scroller"},{children:T.map(((s,r)=>y?y(s):e.jsxRuntimeExports.jsxs(l.MainCardContainer,Object.assign({className:"padding--16 mb-mt-8"},{children:[e.jsxRuntimeExports.jsx(l.BackgroundImageContainer,{imageUrl:s.image,height:"209px",width:"100%",style:{borderRadius:"4px"}}),e.jsxRuntimeExports.jsx("div",Object.assign({className:"mt-20 full--width"},{children:e.jsxRuntimeExports.jsxs("div",Object.assign({className:"created--at flex flex--row"},{children:[L(s)?e.jsxRuntimeExports.jsx("div",Object.assign({className:"new--content--tag"},{children:e.jsxRuntimeExports.jsx(x.Caption,{children:"New"})})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),e.jsxRuntimeExports.jsx(x.Caption,Object.assign({style:{color:i.COLORS.content.placeholder}},{children:s.createdAt?t.format(s.createdAt.toDate?s.createdAt.toDate():new Date(s.createdAt),"dd MMMM yyyy"):""}))]}))})),e.jsxRuntimeExports.jsx("div",Object.assign({className:"mt--8"},{children:e.jsxRuntimeExports.jsx(x.TitleSmall,{children:s.title})})),e.jsxRuntimeExports.jsx("div",{dangerouslySetInnerHTML:{__html:s.body},className:"card--desc mt--12"}),e.jsxRuntimeExports.jsx("div",Object.assign({className:"flex flex--row mt-20 full--width"},{children:e.jsxRuntimeExports.jsx(a.Button,{buttonText:s.buttonText||"Explore the feature",onClick:()=>(e=>{e.productVideo?(q(e.productVideo),v(!0)):e.redirectUrl&&window.open(e.redirectUrl,"_blank"),O&&O(e)})(s),matchParentWidth:!0,size:"medium"})}))]}),`whats-new-${r}`)))}))})]}),e.jsxRuntimeExports.jsx(o.VideoModal,{isOpen:S,videoUrl:M,onClose:()=>{v(!1)}})]})):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})};
@@ -0,0 +1 @@
1
+ import*as r from"react";var e;function t(){return t=Object.assign?Object.assign.bind():function(r){for(var e=1;e<arguments.length;e++){var t=arguments[e];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(r[a]=t[a])}return r},t.apply(this,arguments)}var a=a=>r.createElement("svg",t({fill:"none",viewBox:"0 0 24 24"},a),e||(e=r.createElement("path",{stroke:"currentColor",d:"m21 21-6-6m2-5a7 7 0 1 1-14 0 7 7 0 0 1 14 0z"})));export{a as default};
@@ -0,0 +1 @@
1
+ import*as e from"react";var t;function r(){return r=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},r.apply(this,arguments)}var a=a=>e.createElement("svg",r({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 32 32"},a),t||(t=e.createElement("g",{stroke:"currentColor"},e.createElement("path",{d:"m22.18 15.305-6.725 9.097a.75.75 0 0 0-.102.7l.42 1.165a.75.75 0 0 0 1.183.325l3.78-3.027"}),e.createElement("path",{d:"M6.446 17.664a.75.75 0 0 0 .65 1.194c6.4-.393 10.625 2.478 10.625 2.478l3.016 2.23a3.75 3.75 0 1 0 4.458-6.032l-3.015-2.229s-3.985-3.197-5.486-9.43a.75.75 0 0 0-1.332-.273L6.446 17.664ZM7.692 12.082l-2.443-.73M10.942 8.357 9.89 6.036M8.92 9.686 5.667 6.87"}))));export{a as default};
@@ -1 +1 @@
1
- import{__awaiter as t}from"../../_virtual/_tslib.js";import{j as e}from"../../node_modules/react/jsx-runtime.js";import{useState as o,useEffect as n,useCallback as a}from"react";import r,{ACTIONS as i}from"react-joyride";import"./constants/animations.js";import{SELECTORS as s}from"./constants/selectors.js";import{useFeatureAnnouncements as l}from"./hooks/useFeatureAnnouncements.js";import d from"./MajorUpdatePopup.js";import u from"./MinorUpdatePopup.js";import{VideoModal as p}from"./VideoModal.js";const c=c=>{let{children:f,fetchVisibleFeatures:g,getStoreFeatureProgress:m,fetchFeatureById:b,markFeatureAsViewedForStore:h,isFeatureApplicableToCurrentPage:y,module:x,router:C}=c;var S;const{majorUpdateFeatures:k,minorUpdateFeatures:T,isLoading:w,markFeatureAsViewed:v}=l({fetchVisibleFeatures:g,getStoreFeatureProgress:m,fetchFeatureById:b,markFeatureAsViewedForStore:h,isFeatureApplicableToCurrentPage:y,module:x,router:C}),[B,j]=o(null),[F,E]=o(null),[I,N]=o(!1),[U,W]=o([]),[P,q]=o(!1),[M,O]=o([]),[D,A]=o(!1),[V,G]=o(!1),[L,R]=o([]),[_,$]=o(!1),[z,H]=o(!1),[Z,J]=o(!1),[K,Q]=o(""),[X,Y]=o(!1),[tt,et]=o(!1),[ot,nt]=o(!1),[at,rt]=o(0),[it,st]=o(0),[lt,dt]=o(new Set);n((()=>{const t="minor-spotlight-cutout-style";let e=document.getElementById(t);return e||(e=document.createElement("style"),e.id=t,document.head.appendChild(e)),e.textContent="\n\t\t\t.react-joyride__spotlight {\n\t\t\t\ttransition: box-shadow 0.3s ease-in-out !important;\n\t\t\t\twill-change: box-shadow, transform;\n\t\t\t\ttransform: translateZ(0);\n\t\t\t}\n\t\t\t.react-joyride__tooltip {\n\t\t\t\twill-change: transform, opacity;\n\t\t\t\ttransform: translateZ(0);\n\t\t\t}\n\t\t",()=>{const e=document.getElementById(t);e&&e.remove()}}),[]),n((()=>{rt((t=>t+1)),st((t=>t+1)),et(!1),nt(!1),dt(new Set)}),[null==C?void 0:C.pathname]),n((()=>{if(console.log("🔍 [DEBUG] Route check:",{pathname:null==C?void 0:C.pathname,query:null==C?void 0:C.query,majorFeaturesCount:k.length,minorFeaturesCount:T.length,currentMajorFeature:null==B?void 0:B.id,isLoading:w,blockPopups:X,isProcessingMajorUpdate:D}),k.length>0)if(console.log("🔍 [DEBUG] First major feature details:",{featureId:k[0].id,title:k[0].title,featureUpdateType:k[0].featureUpdateType}),y){const t=y(k[0]);console.log("🔍 [DEBUG] Is major feature applicable to current page?",t)}else console.log("🔍 [DEBUG] isFeatureApplicableToCurrentPage function not provided");const t=document.querySelector('[data-testid="whats-new-button"]');console.log("🔍 [DEBUG] What's New button exists in DOM?",!!t)}),[null==C?void 0:C.pathname,null==C?void 0:C.query,k,T,w,B,X,D,y]),n((()=>{if(!(k.length>0)||B||w||D||X)0!==k.length||w||(console.log("🔍 [DEBUG] No major features, enabling minor updates"),H(!0));else{console.log("🔍 [DEBUG] Starting major popup flow..."),H(!1),$(!1),N(!1),W([]),E(null),R([]);let t=0;const e=10,o=()=>{t++;const n=document.querySelector('[data-testid="whats-new-button"]');console.log(`🔍 [DEBUG] Polling for What's New button - Attempt ${t}/${e}`,{buttonFound:!!n,pathname:null==C?void 0:C.pathname}),n?(console.log("✅ [DEBUG] What's New button found! Showing major popup"),ut(k[0])):t<e?setTimeout(o,1e3):(console.warn("⚠️ [DEBUG] What's New button not found after 10s. Allowing minor updates.",{pathname:null==C?void 0:C.pathname}),H(!0))};o()}}),[k,B,w,D,X]),n((()=>{var t;const e=null===(t=null==C?void 0:C.query)||void 0===t?void 0:t.featureId;if(!e||w||0===T.length)return;const o=T.find((t=>t.id===e));if(!o||!o.featureTag)return;$(!0),G(!0);let n=0;const a=setInterval((()=>{n++;const t=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`;if(document.querySelector(t)){const t=[o];R(t),yt(o,t),clearInterval(a)}else n>=25&&(G(!1),clearInterval(a))}),200);return()=>{clearInterval(a)}}),[T,null===(S=null==C?void 0:C.query)||void 0===S?void 0:S.featureId,w]),n((()=>{var t;if(T.length>0&&!w&&!I&&!V&&!F&&!_&&z&&!X){let t=null,e=null,o=null,n=!1;const a=()=>{if(n||V||F||_||!z)return;const a=T.filter((t=>{if(!t.featureTag||""===t.featureTag.trim())return!1;if(lt.has(t.id))return!1;const e=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`;return null!==document.querySelector(e)}));a.length>0&&(R(a),yt(a[0],a),t&&(t.disconnect(),t=null),e&&(window.removeEventListener("scroll",e),e=null),o&&(clearTimeout(o),o=null))};return t=new MutationObserver((t=>{let e=!1;for(const o of t){if("childList"===o.type&&o.addedNodes.length>0)for(let t=0;t<o.addedNodes.length;t++){const n=o.addedNodes[t];if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(t.id||t.querySelector("[id]")){e=!0;break}}}if(e)break}I||n||V||F||_||!z||!e||(o&&clearTimeout(o),o=setTimeout((()=>{n||V||F||_||!z||a()}),200))})),e=()=>{I||n||V||F||_||!z||(o&&clearTimeout(o),requestAnimationFrame((()=>{o=setTimeout((()=>{n||V||F||_||!z||a()}),300)})))},t&&t.observe(document.body,{childList:!0,subtree:!0}),e&&window.addEventListener("scroll",e,{passive:!0}),a(),setTimeout((()=>{n||V||F||_||!z||a()}),100),setTimeout((()=>{n||V||F||_||!z||a()}),1e3),setTimeout((()=>{n||V||F||_||!z||a()}),500),()=>{n=!0,t&&t.disconnect(),e&&window.removeEventListener("scroll",e),o&&clearTimeout(o)}}if(0===T.length||w){(null===(t=null==C?void 0:C.query)||void 0===t?void 0:t.featureId)&&F||(N(!1),W([]),E(null),R([]),$(!1))}}),[T,w,I,V,F,_,z,v,X]);const ut=t=>{j(t);const o=k.findIndex((e=>e.id===t.id)),n=k.length,a=[{target:s.WHATS_NEW_BUTTON,content:e.jsx(d,{feature:t,currentIndex:o,totalFeatures:n,onSkip:()=>pt(t),onExplore:()=>ct(t),onPrevious:()=>ft(t),onNext:()=>gt(t),setIsClosing:et}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];O(a),q(!0)},pt=a((t=>{(t||B)&&(A(!0),k.forEach((t=>{v(t.id)})),q(!1),j(null),O([]),H(!0),setTimeout((()=>{A(!1)}),500))}),[B,k,v]),ct=a((t=>{A(!0),v(t.id),t.productVideo&&(Q(t.productVideo),J(!0),Y(!0)),q(!1),j(null),O([]);k.findIndex((e=>e.id===t.id))===k.length-1&&H(!0),setTimeout((()=>{A(!1)}),500)}),[k,v]),ft=a((t=>{const o=t||B;if(!o)return;const n=k.findIndex((t=>t.id===o.id));if(n>0){const t=k[n-1];j(t);const o=n-1,a=k.length,r=[{target:'[data-testid="whats-new-button"]',content:e.jsx(d,{feature:t,currentIndex:o,totalFeatures:a,onSkip:()=>pt(t),onExplore:()=>ct(t),onPrevious:()=>ft(t),onNext:()=>gt(t),setIsClosing:et}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];O(r)}}),[B,k]),gt=a((t=>{const o=t||B;if(!o)return;const n=k.findIndex((t=>t.id===o.id));if(n<k.length-1){const t=k[n+1];j(t);const o=n+1,a=k.length,r=[{target:'[data-testid="whats-new-button"]',content:e.jsx(d,{feature:t,currentIndex:o,totalFeatures:a,onSkip:()=>pt(t),onExplore:()=>ct(t),onPrevious:()=>ft(t),onNext:()=>gt(t),setIsClosing:et}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];O(r)}else A(!0),v(o.id),q(!1),j(null),O([]),H(!0),setTimeout((()=>{A(!1)}),500)}),[B,k,v]),mt=()=>{if(k.length>0&&!B){document.querySelector('[data-testid="whats-new-button"]')&&ut(k[0])}};n((()=>(window.showMajorUpdatePopup=mt,()=>{delete window.showMajorUpdatePopup})),[k,B]);const bt=a((t=>{const{action:e}=t;e===i.CLOSE&&(B&&(A(!0),k.forEach((t=>{v(t.id)})),H(!0),setTimeout((()=>{A(!1)}),500)),q(!1),j(null),O([]))}),[B,k,v]),ht=a((t=>{const{action:e}=t;if(e===i.CLOSE){if(F){G(!0),v(F.id);L.findIndex((t=>t.id===F.id))===L.length-1&&$(!0),setTimeout((()=>{G(!1)}),500)}N(!1),E(null),W([])}}),[F,L,v]),yt=(o,n)=>t(void 0,void 0,void 0,(function*(){E(o);const t=n||L,a=t.findIndex((t=>t.id===o.id)),r=t.length,i=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`,s=document.querySelector(i);if(s)try{const{scrollToElementSmooth:t}=yield import("./utils/elementHelpers.js");yield t(s,120)}catch(t){}const l=[{target:i,content:e.jsx(u,{feature:o,currentIndex:a,totalFeatures:r,onSkip:()=>xt(o),onExplore:()=>Ct(o),onPrevious:()=>St(o),onNext:()=>kt(o),setIsClosing:nt}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:o,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];W(l),N(!0)})),xt=a((t=>{const e=t||F;if(e){G(!0),v(e.id),dt((t=>new Set(t).add(e.id))),N(!1),E(null),W([]);const t=L.find((t=>t.id!==e.id&&!lt.has(t.id)));setTimeout((()=>{G(!1),t?yt(t,L):$(!0)}),500)}}),[F,L,v,lt]),Ct=a((t=>{G(!0),v(t.id),dt((e=>new Set(e).add(t.id))),t.productVideo&&(Q(t.productVideo),J(!0),Y(!0)),N(!1),E(null),W([]);const e=L.find((e=>e.id!==t.id&&!lt.has(e.id)));setTimeout((()=>{G(!1),e&&!t.productVideo?yt(e,L):e||$(!0)}),500)}),[L,v,lt]),St=a((o=>t(void 0,void 0,void 0,(function*(){const t=o||F;if(!t)return;const n=L.findIndex((e=>e.id===t.id));if(n>0){const t=L[n-1];E(t);const o=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,a=document.querySelector(o);if(a)try{const{scrollToElementSmooth:t}=yield import("./utils/elementHelpers.js");yield t(a,120)}catch(t){}const r=n-1,i=L.length,s=[{target:o,content:e.jsx(u,{feature:t,currentIndex:r,totalFeatures:i,onSkip:()=>xt(t),onExplore:()=>Ct(t),onPrevious:()=>St(t),onNext:()=>kt(t),setIsClosing:nt}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];W(s)}}))),[F,L]),kt=a((o=>t(void 0,void 0,void 0,(function*(){const t=o||F;if(!t)return;const n=L.findIndex((e=>e.id===t.id));if(n<L.length-1){const t=L[n+1];E(t);const o=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,a=document.querySelector(o);if(a)try{const{scrollToElementSmooth:t}=yield import("./utils/elementHelpers.js");yield t(a,120)}catch(t){}const r=n+1,i=L.length,s=[{target:o,content:e.jsx(u,{feature:t,currentIndex:r,totalFeatures:i,onSkip:()=>xt(t),onExplore:()=>Ct(t),onPrevious:()=>St(t),onNext:()=>kt(t),setIsClosing:nt}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];W(s)}else G(!0),$(!0),v(t.id),N(!1),E(null),W([]),setTimeout((()=>{G(!1)}),500)}))),[F,L,v]);return e.jsxs(e.Fragment,{children:[f,M.length>0&&e.jsx(r,{steps:M,run:P,continuous:!1,showProgress:!1,showSkipButton:!1,callback:bt,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,spotlightClicks:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:tt?"transparent":"#212121"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",border:"none",boxShadow:"none"},tooltip:{borderRadius:"16px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}},`major-joyride-${at}`),U.length>0&&e.jsx(r,{steps:U,run:I,continuous:!1,showProgress:!1,showSkipButton:!1,callback:ht,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,scrollToFirstStep:!0,scrollOffset:120,disableScrolling:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:ot?"transparent":"#ffffff"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",borderRadius:"8px",boxShadow:ot?"none":"0 0 0 9999px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 20px 8px rgba(255, 255, 255, 0.4)"},tooltip:{borderRadius:"4px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonSkip:{display:"none"},buttonClose:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}},`minor-joyride-${it}`),e.jsx(p,{isOpen:Z,videoUrl:K,onClose:()=>{J(!1),Q(""),Y(!1);const t=L.find((t=>!lt.has(t.id)));t?setTimeout((()=>{yt(t,L)}),300):$(!0)}})]})};export{c as default};
1
+ import{__awaiter as t}from"../../_virtual/_tslib.js";import{j as e}from"../../node_modules/react/jsx-runtime.js";import{useState as o,useEffect as n,useCallback as r}from"react";import a,{ACTIONS as i}from"react-joyride";import"./constants/animations.js";import{SELECTORS as s}from"./constants/selectors.js";import{useFeatureAnnouncements as d}from"./hooks/useFeatureAnnouncements.js";import l from"./MajorUpdatePopup.js";import u from"./MinorUpdatePopup.js";import{VideoModal as c}from"./VideoModal.js";const p=p=>{let{children:f,fetchVisibleFeatures:b,getStoreFeatureProgress:m,fetchFeatureById:g,markFeatureAsViewedForStore:h,isFeatureApplicableToCurrentPage:y,module:x,router:C}=p;var S;const{majorUpdateFeatures:k,minorUpdateFeatures:T,isLoading:w,markFeatureAsViewed:v}=d({fetchVisibleFeatures:b,getStoreFeatureProgress:m,fetchFeatureById:g,markFeatureAsViewedForStore:h,isFeatureApplicableToCurrentPage:y,module:x,router:C}),[B,j]=o(null),[I,F]=o(null),[E,N]=o(!1),[W,P]=o([]),[M,O]=o(!1),[q,V]=o([]),[_,L]=o(!1),[R,A]=o(!1),[U,$]=o([]),[z,H]=o(!1),[Z,D]=o(!1),[G,J]=o(!1),[K,Q]=o(""),[X,Y]=o(!1),[tt,et]=o(!1),[ot,nt]=o(!1),[rt,at]=o(0),[it,st]=o(0),[dt,lt]=o(new Set);n((()=>{const t="minor-spotlight-cutout-style";let e=document.getElementById(t);return e||(e=document.createElement("style"),e.id=t,document.head.appendChild(e)),e.textContent="\n\t\t\t.react-joyride__spotlight {\n\t\t\t\ttransition: box-shadow 0.3s ease-in-out !important;\n\t\t\t\twill-change: box-shadow, transform;\n\t\t\t\ttransform: translateZ(0);\n\t\t\t}\n\t\t\t.react-joyride__tooltip {\n\t\t\t\twill-change: transform, opacity;\n\t\t\t\ttransform: translateZ(0);\n\t\t\t}\n\t\t",()=>{const e=document.getElementById(t);e&&e.remove()}}),[]),n((()=>{at((t=>t+1)),st((t=>t+1)),et(!1),nt(!1),lt(new Set)}),[null==C?void 0:C.pathname]),n((()=>{if(!(k.length>0)||B||w||_||X)0!==k.length||w||D(!0);else{D(!1),H(!1),N(!1),P([]),F(null),$([]);let t=0;const e=10,o=()=>{t++;document.querySelector('[data-testid="whats-new-button"]')?ut(k[0]):t<e?setTimeout(o,1e3):D(!0)};o()}}),[k,B,w,_,X]),n((()=>{var t;const e=null===(t=null==C?void 0:C.query)||void 0===t?void 0:t.featureId;if(!e||w||0===T.length)return;const o=T.find((t=>t.id===e));if(!o||!o.featureTag)return;H(!0),A(!0);let n=0;const r=setInterval((()=>{n++;const t=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`;if(document.querySelector(t)){const t=[o];$(t),yt(o,t),clearInterval(r)}else n>=25&&(A(!1),clearInterval(r))}),200);return()=>{clearInterval(r)}}),[T,null===(S=null==C?void 0:C.query)||void 0===S?void 0:S.featureId,w]),n((()=>{var t;if(T.length>0&&!w&&!E&&!R&&!I&&!z&&Z&&!X){let t=null,e=null,o=null,n=!1;const r=()=>{if(n||R||I||z||!Z)return;const r=T.filter((t=>{if(!t.featureTag||""===t.featureTag.trim())return!1;if(dt.has(t.id))return!1;const e=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`;return null!==document.querySelector(e)}));r.length>0&&($(r),yt(r[0],r),t&&(t.disconnect(),t=null),e&&(window.removeEventListener("scroll",e),e=null),o&&(clearTimeout(o),o=null))};return t=new MutationObserver((t=>{let e=!1;for(const o of t){if("childList"===o.type&&o.addedNodes.length>0)for(let t=0;t<o.addedNodes.length;t++){const n=o.addedNodes[t];if(n.nodeType===Node.ELEMENT_NODE){const t=n;if(t.id||t.querySelector("[id]")){e=!0;break}}}if(e)break}E||n||R||I||z||!Z||!e||(o&&clearTimeout(o),o=setTimeout((()=>{n||R||I||z||!Z||r()}),200))})),e=()=>{E||n||R||I||z||!Z||(o&&clearTimeout(o),requestAnimationFrame((()=>{o=setTimeout((()=>{n||R||I||z||!Z||r()}),300)})))},t&&t.observe(document.body,{childList:!0,subtree:!0}),e&&window.addEventListener("scroll",e,{passive:!0}),r(),setTimeout((()=>{n||R||I||z||!Z||r()}),100),setTimeout((()=>{n||R||I||z||!Z||r()}),1e3),setTimeout((()=>{n||R||I||z||!Z||r()}),500),()=>{n=!0,t&&t.disconnect(),e&&window.removeEventListener("scroll",e),o&&clearTimeout(o)}}if(0===T.length||w){(null===(t=null==C?void 0:C.query)||void 0===t?void 0:t.featureId)&&I||(N(!1),P([]),F(null),$([]),H(!1))}}),[T,w,E,R,I,z,Z,v,X]);const ut=t=>{j(t);const o=k.findIndex((e=>e.id===t.id)),n=k.length,r=[{target:s.WHATS_NEW_BUTTON,content:e.jsx(l,{feature:t,currentIndex:o,totalFeatures:n,onSkip:()=>ct(t),onExplore:()=>pt(t),onPrevious:()=>ft(t),onNext:()=>bt(t),setIsClosing:et}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];V(r),O(!0)},ct=r((t=>{(t||B)&&(L(!0),k.forEach((t=>{v(t.id)})),O(!1),j(null),V([]),D(!0),setTimeout((()=>{L(!1)}),500))}),[B,k,v]),pt=r((t=>{L(!0),v(t.id),t.productVideo&&(Q(t.productVideo),J(!0),Y(!0)),O(!1),j(null),V([]);k.findIndex((e=>e.id===t.id))===k.length-1&&D(!0),setTimeout((()=>{L(!1)}),500)}),[k,v]),ft=r((t=>{const o=t||B;if(!o)return;const n=k.findIndex((t=>t.id===o.id));if(n>0){const t=k[n-1];j(t);const o=n-1,r=k.length,a=[{target:'[data-testid="whats-new-button"]',content:e.jsx(l,{feature:t,currentIndex:o,totalFeatures:r,onSkip:()=>ct(t),onExplore:()=>pt(t),onPrevious:()=>ft(t),onNext:()=>bt(t),setIsClosing:et}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];V(a)}}),[B,k]),bt=r((t=>{const o=t||B;if(!o)return;const n=k.findIndex((t=>t.id===o.id));if(n<k.length-1){const t=k[n+1];j(t);const o=n+1,r=k.length,a=[{target:'[data-testid="whats-new-button"]',content:e.jsx(l,{feature:t,currentIndex:o,totalFeatures:r,onSkip:()=>ct(t),onExplore:()=>pt(t),onPrevious:()=>ft(t),onNext:()=>bt(t),setIsClosing:et}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];V(a)}else L(!0),v(o.id),O(!1),j(null),V([]),D(!0),setTimeout((()=>{L(!1)}),500)}),[B,k,v]),mt=()=>{if(k.length>0&&!B){document.querySelector('[data-testid="whats-new-button"]')&&ut(k[0])}};n((()=>(window.showMajorUpdatePopup=mt,()=>{delete window.showMajorUpdatePopup})),[k,B]);const gt=r((t=>{const{action:e}=t;e===i.CLOSE&&(B&&(L(!0),k.forEach((t=>{v(t.id)})),D(!0),setTimeout((()=>{L(!1)}),500)),O(!1),j(null),V([]))}),[B,k,v]),ht=r((t=>{const{action:e}=t;if(e===i.CLOSE){if(I){A(!0),v(I.id);U.findIndex((t=>t.id===I.id))===U.length-1&&H(!0),setTimeout((()=>{A(!1)}),500)}N(!1),F(null),P([])}}),[I,U,v]),yt=(o,n)=>t(void 0,void 0,void 0,(function*(){F(o);const t=n||U,r=t.findIndex((t=>t.id===o.id)),a=t.length,i=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`,s=document.querySelector(i);if(s)try{const{scrollToElementSmooth:t}=yield import("./utils/elementHelpers.js");yield t(s,120)}catch(t){}const d=[{target:i,content:e.jsx(u,{feature:o,currentIndex:r,totalFeatures:a,onSkip:()=>xt(o),onExplore:()=>Ct(o),onPrevious:()=>St(o),onNext:()=>kt(o),setIsClosing:nt}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:o,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];P(d),N(!0)})),xt=r((t=>{const e=t||I;if(e){A(!0),v(e.id),lt((t=>new Set(t).add(e.id))),N(!1),F(null),P([]);const t=U.find((t=>t.id!==e.id&&!dt.has(t.id)));setTimeout((()=>{A(!1),t?yt(t,U):H(!0)}),500)}}),[I,U,v,dt]),Ct=r((t=>{A(!0),v(t.id),lt((e=>new Set(e).add(t.id))),t.productVideo&&(Q(t.productVideo),J(!0),Y(!0)),N(!1),F(null),P([]);const e=U.find((e=>e.id!==t.id&&!dt.has(e.id)));setTimeout((()=>{A(!1),e&&!t.productVideo?yt(e,U):e||H(!0)}),500)}),[U,v,dt]),St=r((o=>t(void 0,void 0,void 0,(function*(){const t=o||I;if(!t)return;const n=U.findIndex((e=>e.id===t.id));if(n>0){const t=U[n-1];F(t);const o=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,r=document.querySelector(o);if(r)try{const{scrollToElementSmooth:t}=yield import("./utils/elementHelpers.js");yield t(r,120)}catch(t){}const a=n-1,i=U.length,s=[{target:o,content:e.jsx(u,{feature:t,currentIndex:a,totalFeatures:i,onSkip:()=>xt(t),onExplore:()=>Ct(t),onPrevious:()=>St(t),onNext:()=>kt(t),setIsClosing:nt}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];P(s)}}))),[I,U]),kt=r((o=>t(void 0,void 0,void 0,(function*(){const t=o||I;if(!t)return;const n=U.findIndex((e=>e.id===t.id));if(n<U.length-1){const t=U[n+1];F(t);const o=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,r=document.querySelector(o);if(r)try{const{scrollToElementSmooth:t}=yield import("./utils/elementHelpers.js");yield t(r,120)}catch(t){}const a=n+1,i=U.length,s=[{target:o,content:e.jsx(u,{feature:t,currentIndex:a,totalFeatures:i,onSkip:()=>xt(t),onExplore:()=>Ct(t),onPrevious:()=>St(t),onNext:()=>kt(t),setIsClosing:nt}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];P(s)}else A(!0),H(!0),v(t.id),N(!1),F(null),P([]),setTimeout((()=>{A(!1)}),500)}))),[I,U,v]);return e.jsxs(e.Fragment,{children:[f,q.length>0&&e.jsx(a,{steps:q,run:M,continuous:!1,showProgress:!1,showSkipButton:!1,callback:gt,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,spotlightClicks:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:tt?"transparent":"#212121"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",border:"none",boxShadow:"none"},tooltip:{borderRadius:"16px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}},`major-joyride-${rt}`),W.length>0&&e.jsx(a,{steps:W,run:E,continuous:!1,showProgress:!1,showSkipButton:!1,callback:ht,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,scrollToFirstStep:!0,scrollOffset:120,disableScrolling:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:ot?"transparent":"#ffffff"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",borderRadius:"8px",boxShadow:ot?"none":"0 0 0 9999px rgba(0, 0, 0, 0.4), 0 0 0 3px rgba(255, 255, 255, 0.8), 0 0 20px 8px rgba(255, 255, 255, 0.4)"},tooltip:{borderRadius:"4px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonSkip:{display:"none"},buttonClose:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}},`minor-joyride-${it}`),e.jsx(c,{isOpen:G,videoUrl:K,onClose:()=>{J(!1),Q(""),Y(!1);const t=U.find((t=>!dt.has(t.id)));t?setTimeout((()=>{yt(t,U)}),300):H(!0)}})]})};export{p as default};
@@ -1 +1 @@
1
- import{__awaiter as e}from"../../../_virtual/_tslib.js";import{useState as t,useCallback as r,useEffect as o}from"react";import{ANIMATION_TIMING as a}from"../constants/animations.js";import{QUERY_PARAMS as n,LOCAL_STORAGE_KEYS as i}from"../constants/localStorageKeys.js";const l=l=>{let{fetchVisibleFeatures:s,getStoreFeatureProgress:u,fetchFeatureById:d,markFeatureAsViewedForStore:c,isFeatureApplicableToCurrentPage:f,module:p,router:m}=l;var g;const v=(()=>{const[e,r]=t(null);return o((()=>{if("undefined"!=typeof window){let e=null;try{if(e=localStorage.getItem(i.STORE_ID)||localStorage.getItem(i.BIK_STORE_ID)||localStorage.getItem(i.CURRENT_STORE)||localStorage.getItem(i.STORE),!e){const t=localStorage.getItem(i.CURRENT_USER);t&&(e=JSON.parse(t).storeId)}e||(e=new URLSearchParams(window.location.search).get(i.QUERY_PARAM))}catch(e){console.error("FeatureAnnouncements: Failed to get store ID",e)}r(e)}}),[]),e})(),[y,F]=t([]),[D,w]=t([]),[U,h]=t([]),[A,I]=t(!1),[R,S]=t(null),T=r((()=>e(void 0,void 0,void 0,(function*(){if(v){I(!0),S(null);try{const[e,t]=yield s(p);if(e||!t)return console.error("FeatureAnnouncements: Failed to fetch features",e),void S("Failed to fetch features");const[r,o]=yield u(v);r&&console.warn("FeatureAnnouncements: Progress fetch failed, treating all features as new",r);const n=new Date,i="undefined"!=typeof window?window.location.pathname:"",l=e=>{if(!e.expirationDate)return!0;let t;return"object"==typeof e.expirationDate&&null!==e.expirationDate&&("seconds"in e.expirationDate||"nanoseconds"in e.expirationDate)?t=new Date(1e3*e.expirationDate.seconds):"string"==typeof e.expirationDate?t=new Date(e.expirationDate):e.expirationDate instanceof Date&&(t=e.expirationDate),!(!t||isNaN(t.getTime()))&&n<t},d=e=>{if("Major"===e.featureUpdateType){let t=[];return Array.isArray(e.pageUrls)?t=e.pageUrls:"object"==typeof e.pageUrls&&null!==e.pageUrls&&"length"in e.pageUrls&&(t=Array.from(e.pageUrls)),t.includes(i)}return!0},c=t.filter((e=>{var t;const r=(null===(t=null==o?void 0:o.viewedFeatures)||void 0===t?void 0:t[e.id])||!1,a=e.archived||!1;return!r&&!a&&f(e)&&l(e)&&d(e)})),m=c.filter((e=>"Major"===e.featureUpdateType)),g=c.filter((e=>"Minor"===e.featureUpdateType));F(c),w(m),setTimeout((()=>{h(g)}),a.MINOR_POPUP_DELAY)}catch(e){console.error("FeatureAnnouncements: Unexpected error in fetchFeatures",e),S("An unexpected error occurred")}finally{I(!1)}}}))),[v,s,u,f,p]),x=r((t=>e(void 0,void 0,void 0,(function*(){I(!0),S(null);try{const[e,r]=yield d(t);if(e||!r)return void S("Failed to fetch feature by ID");"Major"===r.featureUpdateType?w([r]):h([r]),F([r])}catch(e){S("An unexpected error occurred while fetching by ID")}finally{I(!1)}}))),[d]),E=r((t=>e(void 0,void 0,void 0,(function*(){if(!v)return;const[e]=yield c(v,t);e?(console.warn("FeatureAnnouncements: Failed to mark feature as viewed, removing from local state anyway",e),F((e=>e.filter((e=>e.id!==t)))),w((e=>e.filter((e=>e.id!==t)))),h((e=>e.filter((e=>e.id!==t))))):(F((e=>e.filter((e=>e.id!==t)))),w((e=>e.filter((e=>e.id!==t)))),h((e=>e.filter((e=>e.id!==t)))))}))),[v,c]);return o((()=>{var e;const t=null===(e=null==m?void 0:m.query)||void 0===e?void 0:e[n.FEATURE_ID];t&&m?x(t):T()}),[null==m?void 0:m.pathname,null===(g=null==m?void 0:m.query)||void 0===g?void 0:g[n.FEATURE_ID],v,T,x,m]),{features:y,majorUpdateFeatures:D,minorUpdateFeatures:U,isLoading:A,error:R,markFeatureAsViewed:E,refetch:T}};export{l as useFeatureAnnouncements};
1
+ import{__awaiter as e}from"../../../_virtual/_tslib.js";import{useState as t,useCallback as r,useEffect as o}from"react";import{ANIMATION_TIMING as i}from"../constants/animations.js";import{QUERY_PARAMS as a,LOCAL_STORAGE_KEYS as n}from"../constants/localStorageKeys.js";const l=l=>{let{fetchVisibleFeatures:d,getStoreFeatureProgress:u,fetchFeatureById:s,markFeatureAsViewedForStore:c,isFeatureApplicableToCurrentPage:f,module:p,router:g}=l;var v;const y=(()=>{const[e,r]=t(null);return o((()=>{if("undefined"!=typeof window){let e=null;try{if(e=localStorage.getItem(n.STORE_ID)||localStorage.getItem(n.BIK_STORE_ID)||localStorage.getItem(n.CURRENT_STORE)||localStorage.getItem(n.STORE),!e){const t=localStorage.getItem(n.CURRENT_USER);t&&(e=JSON.parse(t).storeId)}e||(e=new URLSearchParams(window.location.search).get(n.QUERY_PARAM))}catch(e){}r(e)}}),[]),e})(),[m,D]=t([]),[U,w]=t([]),[h,R]=t([]),[I,S]=t(!1),[T,x]=t(null),E=r((()=>e(void 0,void 0,void 0,(function*(){if(y){S(!0),x(null);try{const[e,t]=yield d(p);if(e||!t)return void x("Failed to fetch features");const[r,o]=yield u(y),a=new Date,n="undefined"!=typeof window?window.location.pathname:"",l=e=>{if(!e.expirationDate)return!0;let t;return"object"==typeof e.expirationDate&&null!==e.expirationDate&&("seconds"in e.expirationDate||"nanoseconds"in e.expirationDate)?t=new Date(1e3*e.expirationDate.seconds):"string"==typeof e.expirationDate?t=new Date(e.expirationDate):e.expirationDate instanceof Date&&(t=e.expirationDate),!(!t||isNaN(t.getTime()))&&a<t},s=e=>{if("Major"===e.featureUpdateType){let t=[];return Array.isArray(e.pageUrls)?t=e.pageUrls:"object"==typeof e.pageUrls&&null!==e.pageUrls&&"length"in e.pageUrls&&(t=Array.from(e.pageUrls)),t.some((e=>{if(e===n)return!0;const t=e.replace(/\[([^\]]+)\]/g,"[^/]+").replace(/\//g,"\\/");return new RegExp(`^${t}$`).test(n)}))}return!0},c=t.filter((e=>{var t;const r=(null===(t=null==o?void 0:o.viewedFeatures)||void 0===t?void 0:t[e.id])||!1,i=e.archived||!1,a=f(e),n=l(e),d=s(e);return!r&&!i&&a&&n&&d})),g=c.filter((e=>"Major"===e.featureUpdateType)),v=c.filter((e=>"Minor"===e.featureUpdateType));D(c),w(g),setTimeout((()=>{R(v)}),i.MINOR_POPUP_DELAY)}catch(e){x("An unexpected error occurred")}finally{S(!1)}}}))),[y,d,u,f,p]),F=r((t=>e(void 0,void 0,void 0,(function*(){S(!0),x(null);try{const[e,r]=yield s(t);if(e||!r)return void x("Failed to fetch feature by ID");"Major"===r.featureUpdateType?w([r]):R([r]),D([r])}catch(e){x("An unexpected error occurred while fetching by ID")}finally{S(!1)}}))),[s]),A=r((t=>e(void 0,void 0,void 0,(function*(){if(!y)return;const[e]=yield c(y,t);D((e=>e.filter((e=>e.id!==t)))),w((e=>e.filter((e=>e.id!==t)))),R((e=>e.filter((e=>e.id!==t))))}))),[y,c]);return o((()=>{var e;const t=null===(e=null==g?void 0:g.query)||void 0===e?void 0:e[a.FEATURE_ID];t&&g?F(t):E()}),[null==g?void 0:g.pathname,null===(v=null==g?void 0:g.query)||void 0===v?void 0:v[a.FEATURE_ID],y,E,F,g]),{features:m,majorUpdateFeatures:U,minorUpdateFeatures:h,isLoading:I,error:T,markFeatureAsViewed:A,refetch:E}};export{l as useFeatureAnnouncements};
@@ -27,6 +27,8 @@ interface CollectionsScreenInterface {
27
27
  pickerType?: 'COLLECTION' | 'PRODUCT';
28
28
  scrollContainerRef: React.RefObject<HTMLDivElement>;
29
29
  appType: ApplicationType;
30
+ limit?: number;
31
+ exactLimit?: number;
30
32
  }
31
33
  export declare const CollectionsScreen: (props: CollectionsScreenInterface) => import("react/jsx-runtime").JSX.Element;
32
34
  export interface CollectionCardInterface {
@@ -1 +1 @@
1
- import{j as e}from"../../node_modules/react/jsx-runtime.js";import t from"../../assets/icons/chevronRight.svg.js";import{useRef as i,useState as o,useEffect as l}from"react";import{CheckBox as s}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{Tag as c}from"../tag/Tag.js";import{Tooltip as r}from"../tooltips/Tooltip.js";import{TitleRegular as d,BodyPrimary as a}from"../TypographyStyle.js";import{EmptyState as u}from"./emptyState.js";import{ProductPickerShimmer as h}from"./ProductPickerShimmer.js";import{CollectionCardStyle as p,CollectionCardInfoStyle as m,CollectionCardDetailStyle as j,CollectionNameHolder as C}from"./style.js";import{isCollectionPartiallyChecked as v}from"./utility.js";const g=(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)+"..."},x=t=>{var s;const{customCollectionRestriction:n,dataLoading:c,collections:r,selectedCollectionsDispatch:d,setCollectionId:a,setSelectedCollectionId:p,selectedCollections:m,setScreen:j,collectionFetcher:C,collectionsDispatch:g,pagingControls:x,storeId:b,setSaveDisabled:f,hideCollectionCheckbox:k,renderWithoutModal:O,pickerType:I,scrollContainerRef:S,appType:P}=t,T=i(x.curPage),D=!!n&&(null==m?void 0:m.isCustom),[L,R]=o(!1),E=i(!1),w=i(!1),B=()=>{if(!S||!(null==S?void 0:S.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:i}=S.current;e+t>=i-20&&!E.current&&!w.current&&(f(!0),R(!0),w.current=!0,f(!0),R(!0),C(T.current,b,P).then((e=>{g({type:"paged",data:(null==e?void 0:e.collections)||{}}),x.setCurPage(T.current+1),R(!1),f(!1),w.current=!1,Object.keys(null==e?void 0:e.collections).length||(E.current=!0)})).catch())};return l((()=>{var e;return null===(e=null==S?void 0:S.current)||void 0===e||e.addEventListener("scroll",B),()=>{var e;null===(e=null==S?void 0:S.current)||void 0===e||e.removeEventListener("scroll",B)}}),[]),l((()=>{T.current=x.curPage}),[x.curPage]),e.jsxs("div",{children:[(null===(s=Object.keys(null!=r?r:{}))||void 0===s?void 0:s.length)?Object.keys(r).map((t=>{var i,o;const l=!!(null==m?void 0:m[t])&&("PRODUCT"!==I||!!Object.keys(null!==(o=null===(i=null==m?void 0:m[t])||void 0===i?void 0:i.products)&&void 0!==o?o:{}).length);return e.jsx(y,{customCollectionRestriction:n,data:r[t],isDisabled:D&&!(null==m?void 0:m[t]),isChecked:l,isPartiallyChecked:v(t,null==r?void 0:r[t],m),selectedCollectionsDispatch:d,setCollectionId:a,setSelectedCollectionId:p,setScreen:j,id:t,hideCollectionCheckbox:k||"-1"===t,selectedCollections:m,renderWithoutModal:O,pickerType:I},t)})):c?e.jsx(h,{}):e.jsx(u,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),L&&e.jsx(h,{})]})},y=i=>{const{customCollectionRestriction:o,data:l,selectedCollectionsDispatch:u,setCollectionId:h,setSelectedCollectionId:v,isPartiallyChecked:g,setScreen:x,id:y,isChecked:b,isDisabled:f,hideCollectionCheckbox:k,pickerType:O,usedInSearch:I}=i;return l?e.jsxs(p,Object.assign({isDisabled:f,onClick:e=>{if(!f){if("COLLECTION"===O)return e.stopPropagation(),u({type:"reset",data:{}}),u({type:"selected",data:{id:y,val:l,isRestricted:o}}),h(y),void v(y);h(y),v(y),x("products")}},isActive:b,usedInSearch:null!=I&&I},{children:[e.jsxs(m,{children:[!k&&e.jsx(s,{isDisabled:f,isChecked:b,isPartiallyChecked:g,onValueChange:function(e,t,i){null==i||i.stopPropagation(),u(e?{type:"selected",data:{id:y,val:l,isRestricted:o}}:{type:"unselected",data:{id:y}}),v(e?y:"")}}),e.jsx(j,{children:e.jsx(r,Object.assign({body:l.name,placement:"bottom",delay:400,variant:"light"},{children:e.jsxs(C,{children:[I?e.jsx(a,Object.assign({numberOfLines:1},{children:l.name})):e.jsx(d,Object.assign({numberOfLines:1},{children:l.name})),l.isSmartCollection?e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(c,{tagText:"Smart Collection",type:"warning"})})):e.jsx(e.Fragment,{})]})}))})]}),"COLLECTION"!==O&&e.jsx(n,{height:12,width:12,disabled:f,Icon:t})]})):e.jsx(e.Fragment,{})};export{y as CollectionCard,x as CollectionsScreen,g as truncate};
1
+ import{j as e}from"../../node_modules/react/jsx-runtime.js";import t from"../../assets/icons/chevronRight.svg.js";import{useRef as i,useState as o,useEffect as l}from"react";import{CheckBox as s}from"../checkBox/CheckBox.js";import{IconButton as n}from"../icon-button/IconButton.js";import{Tag as c}from"../tag/Tag.js";import{Tooltip as r}from"../tooltips/Tooltip.js";import{TitleRegular as d,BodyPrimary as a}from"../TypographyStyle.js";import{EmptyState as u}from"./emptyState.js";import{ProductPickerShimmer as h}from"./ProductPickerShimmer.js";import{CollectionCardStyle as m,CollectionCardInfoStyle as p,CollectionCardDetailStyle as C,CollectionNameHolder as j}from"./style.js";import{isCollectionPartiallyChecked as g}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)+"..."},x=t=>{var s;const{customCollectionRestriction:n,dataLoading:c,collections:r,selectedCollectionsDispatch:d,setCollectionId:a,setSelectedCollectionId:m,selectedCollections:p,setScreen:C,collectionFetcher:j,collectionsDispatch:v,pagingControls:x,storeId:b,setSaveDisabled:f,hideCollectionCheckbox:k,renderWithoutModal:O,pickerType:I,scrollContainerRef:S,appType:T,limit:L,exactLimit:P}=t,D=i(x.curPage),R=!!n&&(null==p?void 0:p.isCustom),[E,N]=o(!1),w=i(!1),B=i(!1),F=()=>{if(!S||!(null==S?void 0:S.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:i}=S.current;e+t>=i-20&&!w.current&&!B.current&&(f(!0),N(!0),B.current=!0,f(!0),N(!0),j(D.current,b,T).then((e=>{v({type:"paged",data:(null==e?void 0:e.collections)||{}}),x.setCurPage(D.current+1),N(!1),f(!1),B.current=!1,Object.keys(null==e?void 0:e.collections).length||(w.current=!0)})).catch())};l((()=>{var e;return null===(e=null==S?void 0:S.current)||void 0===e||e.addEventListener("scroll",F),()=>{var e;null===(e=null==S?void 0:S.current)||void 0===e||e.removeEventListener("scroll",F)}}),[]),l((()=>{D.current=x.curPage}),[x.curPage]);const W=Object.keys(p||{}).filter((e=>"isCustom"!==e)).length;return e.jsxs("div",{children:[(null===(s=Object.keys(null!=r?r:{}))||void 0===s?void 0:s.length)?Object.keys(r).map((t=>{var i,o;const l=!!(null==p?void 0:p[t])&&("PRODUCT"!==I||!!Object.keys(null!==(o=null===(i=null==p?void 0:p[t])||void 0===i?void 0:i.products)&&void 0!==o?o:{}).length),s="COLLECTION"===I&&!l&&(!!P&&W>=P||!!L&&W>=L);return e.jsx(y,{customCollectionRestriction:n,data:r[t],isDisabled:R&&!(null==p?void 0:p[t])||s,isChecked:l,isPartiallyChecked:g(t,null==r?void 0:r[t],p),selectedCollectionsDispatch:d,setCollectionId:a,setSelectedCollectionId:m,setScreen:C,id:t,hideCollectionCheckbox:k||"-1"===t,selectedCollections:p,renderWithoutModal:O,pickerType:I},t)})):c?e.jsx(h,{}):e.jsx(u,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),E&&e.jsx(h,{})]})},y=i=>{const{customCollectionRestriction:o,data:l,selectedCollectionsDispatch:u,setCollectionId:h,setSelectedCollectionId:g,isPartiallyChecked:v,setScreen:x,id:y,isChecked:b,isDisabled:f,hideCollectionCheckbox:k,pickerType:O,usedInSearch:I}=i;return l?e.jsxs(m,Object.assign({isDisabled:f,onClick:e=>{if(!f){if("COLLECTION"===O)return e.stopPropagation(),u({type:"reset",data:{}}),u({type:"selected",data:{id:y,val:l,isRestricted:o}}),h(y),void g(y);h(y),g(y),x("products")}},isActive:b,usedInSearch:null!=I&&I},{children:[e.jsxs(p,{children:[!k&&e.jsx(s,{isDisabled:f,isChecked:b,isPartiallyChecked:v,onValueChange:function(e,t,i){null==i||i.stopPropagation(),u(e?{type:"selected",data:{id:y,val:l,isRestricted:o}}:{type:"unselected",data:{id:y}}),g(e?y:"")}}),e.jsx(C,{children:e.jsx(r,Object.assign({body:l.name,placement:"bottom",delay:400,variant:"light"},{children:e.jsxs(j,{children:[I?e.jsx(a,Object.assign({numberOfLines:1},{children:l.name})):e.jsx(d,Object.assign({numberOfLines:1},{children:l.name})),l.isSmartCollection?e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(c,{tagText:"Smart Collection",type:"warning"})})):e.jsx(e.Fragment,{})]})}))})]}),"COLLECTION"!==O&&e.jsx(n,{height:12,width:12,disabled:f,Icon:t})]})):e.jsx(e.Fragment,{})};export{y as CollectionCard,x as CollectionsScreen,v as truncate};
@@ -1 +1 @@
1
- import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth/models/bik-store";import o from"../../assets/icons/search.svg.js";import{useReducer as c,useState as s,useRef as r,useEffect as i}from"react";import{COLORS as n}from"../../constants/Theme.js";import l from"../../assets/icons/cross.svg.js";import{Button as a}from"../button/Button.js";import{Input as d}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as p}from"../spinner/Spinner.js";import{Tag as h}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as g}from"./productInfoOverlay.js";import{ProductsScreen as C}from"./productScreen.js";import{RearrangeScreen as j}from"./rearrangeScreen.js";import{collectionsReducer as y,searchReducer as x,selectedColectionsReducer as b,CollectionIdContext as f}from"./reducers.js";import{SearchScreen as S}from"./searchScreen.js";import{SelectedScreen as k}from"./selectedScreen.js";import{ContainerStyle as v,ScrollContainerStyle as I,StyledFooterForNonModal as F}from"./style.js";import{OUT_OF_STOCK_ACTION as P,ScreenName as O}from"./type.js";import{updateAllVariantsForSelectedProducts as T}from"./utility.js";const D=D=>{const{storeId:R,selectedItems:w,onClose:A,visible:B,zIndex:E,exactLimit:L,limit:z,hideCollectionCheckbox:V,hideProductCheckbox:$,outOfStockAction:M=P.BLUR,hideVariantCheckbox:H,selectProductsFromCustomCollection:W,hideSelectionCount:G,title:K,width:N,left:U,renderWithoutModal:Y,onClickSave:_,pickerType:q,hideProductVariants:J=!1,startupScreen:Q=O.Collections,rearrangeEnabled:X,selectSingleItem:Z=!1,showProductDetails:ee,containerStyle:te,crossButtonInsideHeader:oe=!1,footerForNonModal:ce={},primaryButton:se,secondaryButton:re,subtitle:ie}=D,ne=D.appType||t.BIK,[le,ae]=c(y,{}),[de,ue]=s([O.Collections,O.RearrangeProducts].includes(Q)?Q:O.Collections),[pe,he]=s("grid"),[me,ge]=s(""),[Ce,je]=s(""),[ye,xe]=s(0),[be,fe]=s(!1),[Se,ke]=s(0),[ve,Ie]=s(""),[Fe,Pe]=s(!1),[Oe,Te]=s(!1),[De,Re]=c(x,{collections:{},products:{}}),[we,Ae]=c(b,Object.keys(w).length>0?w:{}),Be=r(null),[Ee,Le]=s(!1),[ze,Ve]=s();i((()=>{fe(!0),Te(!0),D.collectionFetcher(ye,R,ne).then((e=>{ae({type:"fetched",data:(null==e?void 0:e.collections)||{}}),fe(!1),xe((e=>e+1)),Te(!1)})).catch()}),[]),i((()=>{let e=0;J?Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&we[-1]&&(null===(c=we[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,s;Object.keys((null===(s=null===(c=we[t].products)||void 0===c?void 0:c[o])||void 0===s?void 0:s.variants)||[]).forEach((()=>{e+=1}))}))})),ke(e)}),[le,we,J]),i((()=>{Ce&&(fe(!0),D.productFetcher(Ce,R,ne).then((e=>{Object.keys(e).length&&ae({type:"productsFetched",data:{collectionId:Ce,products:e}}),fe(!1)})).catch())}),[Ce]),i((()=>{const e=setTimeout((()=>{"rearrange"!==de&&(ve.length||"collections"!==de)&&(ve.length?(Pe(!0),D.searchFetcher(R,ve,ne).then((e=>{"collections"in e&&"products"in e?(Re({type:"set",data:e}),ae({type:"searched",data:e.collections}),ae({type:"searched",data:e.products})):(Re({type:"set",data:{collections:{},products:e}}),ae({type:"searched",data:e})),ue("searchProducts"),fe(!1),Pe(!1)}))):ue("collections"))}),800);return()=>clearTimeout(e)}),[ve]),i((()=>{_&&(D.onAdd(we,Se),$e())}),[_]),i((()=>{Z&&Object.keys(we||{}).length&&Se&&(D.onAdd(we,Se),$e())}),[Z,we,Se]);const $e=()=>{Ae({type:"reset",data:{}})},Me=()=>L&&Se>L?e.jsx(h,{tagText:`You can only select ${L} products`,type:"negative"}):z&&Se>z?e.jsx(h,{tagText:`You can only select ${z} products`,type:"negative"}):Se>0?e.jsx(a,{onClick:()=>{ue(X?O.RearrangeProducts:O.SelectedProducts)},buttonText:L?`${Se}/${L} products selected`:`${Se} products selected`,buttonType:["rearrange","view"].includes(de)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(de)}):e.jsx(a,{disabled:!0,buttonText:L?`${Se}/${L} products selected`:`${Se} products selected`,buttonType:"tertiaryGray"}),He=e=>be?"Loading...":de===O.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",We=e.jsxs(v,Object.assign({style:null!=te?te:{}},{children:[D.postHeader&&e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:D.postHeader})),!D.hideGlobalSearch&&e.jsx(e.Fragment,{children:("collections"===de||"searchProducts"===de)&&e.jsx("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(d,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Fe?e.jsx(p,{size:"small",color:n.content.primary}):e.jsx(o,{})},id:"listInput",height:"24px",type:"text",value:ve,onChangeText:e=>{e.length&&e.trim().length?Ie(e):Ie("")}})}))}),e.jsxs(I,Object.assign({ref:Be,screenName:de},{children:["collections"===de&&e.jsx(m,{customCollectionRestriction:D.customCollectionRestriction,dataLoading:Oe,collections:le,selectedCollectionsDispatch:Ae,setCollectionId:ge,setSelectedCollectionId:je,setScreen:ue,selectedCollections:we,collectionFetcher:D.collectionFetcher,storeId:R,appType:ne,collectionsDispatch:ae,setSaveDisabled:fe,pagingControls:{curPage:ye,setCurPage:xe},hideCollectionCheckbox:V,renderWithoutModal:Y,pickerType:q,scrollContainerRef:Be}),"products"===de&&me&&e.jsx(f.Provider,Object.assign({value:me},{children:e.jsx(C,{hideInCollectionSearch:D.hideInCollectionSearch,customCollectionRestriction:D.customCollectionRestriction,productFetcher:D.productFetcher,setScreen:ue,storeId:R,appType:ne,data:le[me],collectionsDispatch:ae,selectedCollectionsDispatch:Ae,selectedData:we,setSaveDisabled:fe,searchInCollectionFetcher:D.searchInCollectionFetcher,hideProductCheckbox:$,outOfStockAction:M,hideVariantCheckbox:H,selectProductsFromCustomCollection:W,renderWithoutModal:Y,pickerType:q,hideProductVariants:J,fbStatusFetcher:D.fbStatusFetcher,onProductDetailClick:e=>{Le(!0),Ve(e)},showProductDetailInfoIcon:ee,scrollContainerRef:Be})})),"view"===de&&e.jsx(k,{selectedCollections:we||{},selectedCollectionsDispatch:Ae,setScreen:ue,collections:le,hideProductVariants:J,outOfStockAction:M,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"rearrange"===de&&e.jsx(j,{selectedCollections:we||{},selectedCollectionsDispatch:Ae,setScreen:ue,outOfStockAction:M,rearrangeViewType:"grid"===pe?"list":"grid",scrollContainerRef:Be,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"searchProducts"===de&&e.jsx(S,{customCollectionRestriction:D.customCollectionRestriction,selectedCollections:we||{},searchedCollections:De||{},searchedCollectionsDispatch:Re,selectedCollectionsDispatch:Ae,setScreen:ue,collections:le,onBackPress:()=>{Ie(""),Re({type:"set",data:{collections:{},products:{}}})},pickerType:q,hideProductCheckbox:$,hideProductVariants:J,hideVariantCheckbox:H,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher,setCollectionId:ge,setSelectedCollectionId:je,renderWithoutModal:Y,hideCollectionCheckbox:V,outOfStockAction:M})]}))]}));return e.jsx(e.Fragment,{children:Y?e.jsxs(e.Fragment,{children:[We,ce.renderFooter?e.jsxs(F,{children:[Me(),e.jsx(a,{buttonText:He(ce.primaryButtonText),disabled:!ce.isLoading&&(be||Se<1||L&&Se<L||!L&&z&&Se>z)||ce.primaryButtonDisabled,isLoading:ce.isLoading,onClick:()=>{D.onAdd(we,Se),$e(),ue([O.Collections,O.RearrangeProducts].includes(Q)?Q:O.Collections)}})]}):e.jsx(e.Fragment,{}),Ee&&ze?e.jsx(g,{productData:ze,outOfStockAction:M,useDynamicInfoImageSize:D.useDynamicInfoImageSize,onClose:()=>{Le(!1)}}):e.jsx(e.Fragment,{})]}):e.jsxs(u,Object.assign({zIndex:E,open:B,onClose:()=>{null==A||A(),$e()},headingTitle:K||("collections"===de||"products"===de?"Select Products":"view"===de?"Selected Products":"searchProducts"===de?"Searched Results":"rearrange"===de?"Rearrange Products":void 0),headingSubtitle:ie,footerShadow:!0,centralContainerStyles:{width:N||"600px",left:U||"auto"},headerRightCustomElement:oe?e.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:A},{children:e.jsx(l,{width:20,height:20,color:n.content.secondary})})):e.jsx(e.Fragment,{}),footerContainerStyle:D.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:se?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(be||Se<1||L&&Se<L||!L&&z&&Se>z)||e.disabled,onClick:()=>{D.onAdd(we,Se),$e(),ue([O.Collections,O.RearrangeProducts].includes(Q)?Q:O.Collections)}}))(se):{buttonText:He(),disabled:be||Se<1||L&&Se<L||!L&&z&&Se>z||!1,onClick:()=>{D.onAdd(we,Se),$e()}},secondaryButton:re?(e=>Object.assign(Object.assign({},e),{disabled:be||Se<1||L&&Se<L||!L&&z&&Se>z||!1,onClick:()=>{const e=T(we,le,De);D.onAdd(e,Se,!0)}}))(re):void 0,wrapperStyle:D.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:G?e.jsx(e.Fragment,{}):Me(),hideCrossButton:Ee||oe},{children:[We,Ee&&ze?e.jsx(g,{productData:ze,useDynamicInfoImageSize:D.useDynamicInfoImageSize,outOfStockAction:M,onClose:()=>{Le(!1)}}):e.jsx(e.Fragment,{})]}))})};export{D as ProductPickerModal};
1
+ import{j as e}from"../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth/models/bik-store";import o from"../../assets/icons/search.svg.js";import{useReducer as c,useState as s,useRef as r,useEffect as i}from"react";import{COLORS as n}from"../../constants/Theme.js";import l from"../../assets/icons/cross.svg.js";import{Button as a}from"../button/Button.js";import{Input as d}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 g}from"./productInfoOverlay.js";import{ProductsScreen as C}from"./productScreen.js";import{RearrangeScreen as j}from"./rearrangeScreen.js";import{collectionsReducer as y,searchReducer as x,selectedColectionsReducer as b,CollectionIdContext as f}from"./reducers.js";import{SearchScreen as S}from"./searchScreen.js";import{SelectedScreen as k}from"./selectedScreen.js";import{ContainerStyle as v,ScrollContainerStyle as I,StyledFooterForNonModal as F}from"./style.js";import{OUT_OF_STOCK_ACTION as O,ScreenName as P}from"./type.js";import{updateAllVariantsForSelectedProducts as T}from"./utility.js";const D=D=>{const{storeId:R,selectedItems:w,onClose:L,visible:A,zIndex:E,exactLimit:$,limit:B,hideCollectionCheckbox:z,hideProductCheckbox:V,outOfStockAction:M=O.BLUR,hideVariantCheckbox:N,selectProductsFromCustomCollection:H,hideSelectionCount:W,title:G,width:K,left:U,renderWithoutModal:Y,onClickSave:_,pickerType:q,hideProductVariants:J=!1,startupScreen:Q=P.Collections,rearrangeEnabled:X,selectSingleItem:Z=!1,showProductDetails:ee,containerStyle:te,crossButtonInsideHeader:oe=!1,footerForNonModal:ce={},primaryButton:se,secondaryButton:re,subtitle:ie}=D,ne=D.appType||t.BIK,[le,ae]=c(y,{}),[de,ue]=s([P.Collections,P.RearrangeProducts].includes(Q)?Q:P.Collections),[he,pe]=s("grid"),[me,ge]=s(""),[Ce,je]=s(""),[ye,xe]=s(0),[be,fe]=s(!1),[Se,ke]=s(0),[ve,Ie]=s(""),[Fe,Oe]=s(!1),[Pe,Te]=s(!1),[De,Re]=c(x,{collections:{},products:{}}),[we,Le]=c(b,Object.keys(w).length>0?w:{}),Ae=r(null),[Ee,$e]=s(!1),[Be,ze]=s();i((()=>{fe(!0),Te(!0),D.collectionFetcher(ye,R,ne).then((e=>{ae({type:"fetched",data:(null==e?void 0:e.collections)||{}}),fe(!1),xe((e=>e+1)),Te(!1)})).catch()}),[]),i((()=>{let e=0;"COLLECTION"===q?e=Object.keys(we||{}).filter((e=>"isCustom"!==e)).length:J?Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&we[-1]&&(null===(c=we[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(we||[]).forEach((t=>{var o;Object.keys((null===(o=we[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,s;Object.keys((null===(s=null===(c=we[t].products)||void 0===c?void 0:c[o])||void 0===s?void 0:s.variants)||[]).forEach((()=>{e+=1}))}))})),ke(e)}),[le,we,J,q]),i((()=>{Ce&&(fe(!0),D.productFetcher(Ce,R,ne).then((e=>{Object.keys(e).length&&ae({type:"productsFetched",data:{collectionId:Ce,products:e}}),fe(!1)})).catch())}),[Ce]),i((()=>{const e=setTimeout((()=>{"rearrange"!==de&&(ve.length||"collections"!==de)&&(ve.length?(Oe(!0),D.searchFetcher(R,ve,ne).then((e=>{"collections"in e&&"products"in e?(Re({type:"set",data:e}),ae({type:"searched",data:e.collections}),ae({type:"searched",data:e.products})):(Re({type:"set",data:{collections:{},products:e}}),ae({type:"searched",data:e})),ue("searchProducts"),fe(!1),Oe(!1)}))):ue("collections"))}),800);return()=>clearTimeout(e)}),[ve]),i((()=>{_&&(D.onAdd(we,Se),Ve())}),[_]),i((()=>{Z&&Object.keys(we||{}).length&&Se&&(D.onAdd(we,Se),Ve())}),[Z,we,Se]);const Ve=()=>{Le({type:"reset",data:{}})},Me=()=>{let t,o;return"COLLECTION"===q?(t="collection",o="collections"):J?(t="product",o="products"):(t="variant",o="variants"),$&&Se>$?e.jsx(p,{tagText:`You can only select ${$} ${1===$?t:o}`,type:"negative"}):B&&Se>B?e.jsx(p,{tagText:`You can only select ${B} ${1===B?t:o}`,type:"negative"}):Se>0?e.jsx(a,{onClick:()=>{ue(X?P.RearrangeProducts:P.SelectedProducts)},buttonText:$?`${Se}/${$} ${1===Se?t:o} selected`:`${Se} ${1===Se?t:o} selected`,buttonType:["rearrange","view"].includes(de)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(de)}):e.jsx(a,{disabled:!0,buttonText:$?`${Se}/${$} ${1===$?t:o} selected`:`${Se} ${1===Se?t:o} selected`,buttonType:"tertiaryGray"})},Ne=e=>be?"Loading...":de===P.RearrangeProducts?null!=e?e:"Done":null!=e?e:"Add",He=e.jsxs(v,Object.assign({style:null!=te?te:{}},{children:[D.postHeader&&e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:D.postHeader})),!D.hideGlobalSearch&&e.jsx(e.Fragment,{children:("collections"===de||"searchProducts"===de)&&e.jsx("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(d,{placeholder:"Search using ID, Name or SKU ID",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Fe?e.jsx(h,{size:"small",color:n.content.primary}):e.jsx(o,{})},id:"listInput",height:"24px",type:"text",value:ve,onChangeText:e=>{e.length&&e.trim().length?Ie(e):Ie("")}})}))}),e.jsxs(I,Object.assign({ref:Ae,screenName:de},{children:["collections"===de&&e.jsx(m,{customCollectionRestriction:D.customCollectionRestriction,dataLoading:Pe,collections:le,selectedCollectionsDispatch:Le,setCollectionId:ge,setSelectedCollectionId:je,setScreen:ue,selectedCollections:we,collectionFetcher:D.collectionFetcher,storeId:R,appType:ne,collectionsDispatch:ae,setSaveDisabled:fe,pagingControls:{curPage:ye,setCurPage:xe},hideCollectionCheckbox:z,renderWithoutModal:Y,pickerType:q,scrollContainerRef:Ae,limit:B,exactLimit:$}),"products"===de&&me&&e.jsx(f.Provider,Object.assign({value:me},{children:e.jsx(C,{hideInCollectionSearch:D.hideInCollectionSearch,customCollectionRestriction:D.customCollectionRestriction,productFetcher:D.productFetcher,setScreen:ue,storeId:R,appType:ne,data:le[me],collectionsDispatch:ae,selectedCollectionsDispatch:Le,selectedData:we,setSaveDisabled:fe,searchInCollectionFetcher:D.searchInCollectionFetcher,hideProductCheckbox:V,outOfStockAction:M,hideVariantCheckbox:N,selectProductsFromCustomCollection:H,renderWithoutModal:Y,pickerType:q,hideProductVariants:J,fbStatusFetcher:D.fbStatusFetcher,onProductDetailClick:e=>{$e(!0),ze(e)},showProductDetailInfoIcon:ee,scrollContainerRef:Ae})})),"view"===de&&e.jsx(k,{selectedCollections:we||{},selectedCollectionsDispatch:Le,setScreen:ue,collections:le,hideProductVariants:J,outOfStockAction:M,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"rearrange"===de&&e.jsx(j,{selectedCollections:we||{},selectedCollectionsDispatch:Le,setScreen:ue,outOfStockAction:M,rearrangeViewType:"grid"===he?"list":"grid",scrollContainerRef:Ae,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher}),"searchProducts"===de&&e.jsx(S,{customCollectionRestriction:D.customCollectionRestriction,selectedCollections:we||{},searchedCollections:De||{},searchedCollectionsDispatch:Re,selectedCollectionsDispatch:Le,setScreen:ue,collections:le,onBackPress:()=>{Ie(""),Re({type:"set",data:{collections:{},products:{}}})},pickerType:q,hideProductCheckbox:V,hideProductVariants:J,hideVariantCheckbox:N,storeId:R,appType:ne,fbStatusFetcher:D.fbStatusFetcher,setCollectionId:ge,setSelectedCollectionId:je,renderWithoutModal:Y,hideCollectionCheckbox:z,outOfStockAction:M,limit:B,exactLimit:$})]}))]}));return e.jsx(e.Fragment,{children:Y?e.jsxs(e.Fragment,{children:[He,ce.renderFooter?e.jsxs(F,{children:[Me(),e.jsx(a,{buttonText:Ne(ce.primaryButtonText),disabled:!ce.isLoading&&(be||Se<1||$&&Se<$||!$&&B&&Se>B)||ce.primaryButtonDisabled,isLoading:ce.isLoading,onClick:()=>{D.onAdd(we,Se),Ve(),ue([P.Collections,P.RearrangeProducts].includes(Q)?Q:P.Collections)}})]}):e.jsx(e.Fragment,{}),Ee&&Be?e.jsx(g,{productData:Be,outOfStockAction:M,useDynamicInfoImageSize:D.useDynamicInfoImageSize,onClose:()=>{$e(!1)}}):e.jsx(e.Fragment,{})]}):e.jsxs(u,Object.assign({zIndex:E,open:A,onClose:()=>{null==L||L(),Ve()},headingTitle:G||("collections"===de||"products"===de?"Select Products":"view"===de?"Selected Products":"searchProducts"===de?"Searched Results":"rearrange"===de?"Rearrange Products":void 0),headingSubtitle:ie,footerShadow:!0,centralContainerStyles:{width:K||"600px",left:U||"auto"},headerRightCustomElement:oe?e.jsx("div",Object.assign({style:{cursor:"pointer",display:"flex"},onClick:L},{children:e.jsx(l,{width:20,height:20,color:n.content.secondary})})):e.jsx(e.Fragment,{}),footerContainerStyle:D.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:se?(e=>Object.assign(Object.assign({},e),{disabled:!e.isLoading&&(be||Se<1||$&&Se<$||!$&&B&&Se>B)||e.disabled,onClick:()=>{D.onAdd(we,Se),Ve(),ue([P.Collections,P.RearrangeProducts].includes(Q)?Q:P.Collections)}}))(se):{buttonText:Ne(),disabled:be||Se<1||$&&Se<$||!$&&B&&Se>B||!1,onClick:()=>{D.onAdd(we,Se),Ve()}},secondaryButton:re?(e=>Object.assign(Object.assign({},e),{disabled:be||Se<1||$&&Se<$||!$&&B&&Se>B||!1,onClick:()=>{const e=T(we,le,De);D.onAdd(e,Se,!0)}}))(re):void 0,wrapperStyle:D.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?e.jsx(e.Fragment,{}):Me(),hideCrossButton:Ee||oe},{children:[He,Ee&&Be?e.jsx(g,{productData:Be,useDynamicInfoImageSize:D.useDynamicInfoImageSize,outOfStockAction:M,onClose:()=>{$e(!1)}}):e.jsx(e.Fragment,{})]}))})};export{D as ProductPickerModal};
@@ -26,6 +26,8 @@ interface SearchScreenInterface {
26
26
  hideCollectionCheckbox?: boolean;
27
27
  renderWithoutModal?: boolean;
28
28
  outOfStockAction?: OUT_OF_STOCK_ACTION;
29
+ limit?: number;
30
+ exactLimit?: number;
29
31
  }
30
32
  export declare const SearchScreen: (props: SearchScreenInterface) => import("react/jsx-runtime").JSX.Element;
31
33
  export {};
@@ -1 +1 @@
1
- import{j as o}from"../../node_modules/react/jsx-runtime.js";import e from"../../assets/icons/arrow_left.svg.js";import{useEffect as t}from"react";import{IconButton as l}from"../icon-button/IconButton.js";import{BodyCaption as i}from"../TypographyStyle.js";import{CollectionCard as c}from"./collectionScreen.js";import{EmptyState as s}from"./emptyState.js";import{ProductGroup as d}from"./product.js";import{SelectedScreenHeader as r}from"./style.js";import{fetchFbStatusCollection as n,isCollectionPartiallyChecked as u,isProductPartiallyChecked as a,liftTheStateUp as p}from"./utility.js";const h=h=>{var v;const{customCollectionRestriction:m,selectedCollections:j,searchedCollections:C,searchedCollectionsDispatch:k,selectedCollectionsDispatch:y,setScreen:x,collections:b,onBackPress:f,hideVariantCheckbox:S,pickerType:g,hideProductVariants:O,hideProductCheckbox:P,storeId:I,fbStatusFetcher:D,setCollectionId:T,setSelectedCollectionId:F,hideCollectionCheckbox:V,renderWithoutModal:w,outOfStockAction:A,appType:R}=h;t((()=>{var o;n(null!==(o=C.products)&&void 0!==o?o:{},I,R,k,D,"setProducts")}),[null==C?void 0:C.products]);const W=!!m&&(null==j?void 0:j.isCustom);return o.jsxs("div",{children:[o.jsxs(r,{children:[o.jsx(l,{Icon:e,onClick:()=>{x("collections"),f()}}),o.jsx(i,{children:(null===(v=Object.keys(null==C?void 0:C.collections))||void 0===v?void 0:v.length)?"Searched Collections & Products":"Searched Products"})]}),o.jsx("div",{children:Object.keys(null==C?void 0:C.products).length||Object.keys(null==C?void 0:C.collections).length?o.jsxs(o.Fragment,{children:[o.jsx(o.Fragment,{children:Object.keys(null==C?void 0:C.collections).map((e=>o.jsx(c,{customCollectionRestriction:m,data:null==b?void 0:b[e],isDisabled:W&&!(null==j?void 0:j[e]),isChecked:!!(null==j?void 0:j[e]),isPartiallyChecked:u(e,null==b?void 0:b[e],j,O),selectedCollectionsDispatch:y,setCollectionId:T,setSelectedCollectionId:F,setScreen:x,id:e,hideCollectionCheckbox:V||"-1"===e,selectedCollections:j,renderWithoutModal:w,pickerType:g,usedInSearch:!0},e)))}),o.jsx(o.Fragment,{children:Object.keys(null==C?void 0:C.products).map((e=>{var t,l;return Object.keys((null===(l=null===(t=null==C?void 0:C.products)||void 0===t?void 0:t[e])||void 0===l?void 0:l.products)||[]).map((t=>{var l,i,c;let s=!1;return(null===(l=null==C?void 0:C.products)||void 0===l?void 0:l.isCustom)&&(s=!0),o.jsx(d,{collectionId:e,upliftAdditions:(o,t)=>((o,e,t)=>{var l;const i=p(t,null===(l=null==C?void 0:C.products)||void 0===l?void 0:l[o]);y({type:e,data:Object.assign(Object.assign({},i),{isRestricted:m})})})(e,o,t),productId:t,data:(null===(i=null==C?void 0:C.products)||void 0===i?void 0:i[e].products)[t],isProductPartiallyChecked:a(e,t,j,null===(c=C.products)||void 0===c?void 0:c[e],O),selectedData:j,selectedCollectionsDispatch:y,viewOnly:s,hideProductCheckbox:P,hideVariantCheckbox:S,hideProductVariants:O,pickerType:g,outOfStockAction:A},t)}))}))})]}):o.jsx(s,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{h as SearchScreen};
1
+ import{j as e}from"../../node_modules/react/jsx-runtime.js";import o from"../../assets/icons/arrow_left.svg.js";import{useEffect as t}from"react";import{IconButton as l}from"../icon-button/IconButton.js";import{BodyCaption as i}from"../TypographyStyle.js";import{CollectionCard as c}from"./collectionScreen.js";import{EmptyState as s}from"./emptyState.js";import{ProductGroup as d}from"./product.js";import{SelectedScreenHeader as r}from"./style.js";import{fetchFbStatusCollection as n,isCollectionPartiallyChecked as u,isProductPartiallyChecked as a,liftTheStateUp as p}from"./utility.js";const h=h=>{var v;const{customCollectionRestriction:m,selectedCollections:j,searchedCollections:C,searchedCollectionsDispatch:k,selectedCollectionsDispatch:y,setScreen:x,collections:b,onBackPress:f,hideVariantCheckbox:O,pickerType:S,hideProductVariants:g,hideProductCheckbox:I,storeId:P,fbStatusFetcher:D,setCollectionId:T,setSelectedCollectionId:F,hideCollectionCheckbox:V,renderWithoutModal:w,outOfStockAction:A,appType:L,limit:R,exactLimit:W}=h;t((()=>{var e;n(null!==(e=C.products)&&void 0!==e?e:{},P,L,k,D,"setProducts")}),[null==C?void 0:C.products]);const B=!!m&&(null==j?void 0:j.isCustom),M=Object.keys(j||{}).filter((e=>"isCustom"!==e)).length;return e.jsxs("div",{children:[e.jsxs(r,{children:[e.jsx(l,{Icon:o,onClick:()=>{x("collections"),f()}}),e.jsx(i,{children:(null===(v=Object.keys(null==C?void 0:C.collections))||void 0===v?void 0:v.length)?"Searched Collections & Products":"Searched Products"})]}),e.jsx("div",{children:Object.keys(null==C?void 0:C.products).length||Object.keys(null==C?void 0:C.collections).length?e.jsxs(e.Fragment,{children:[e.jsx(e.Fragment,{children:Object.keys(null==C?void 0:C.collections).map((o=>{const t=!!(null==j?void 0:j[o]),l="COLLECTION"===S&&!t&&(!!W&&M>=W||!!R&&M>=R);return e.jsx(c,{customCollectionRestriction:m,data:null==b?void 0:b[o],isDisabled:B&&!(null==j?void 0:j[o])||l,isChecked:t,isPartiallyChecked:u(o,null==b?void 0:b[o],j,g),selectedCollectionsDispatch:y,setCollectionId:T,setSelectedCollectionId:F,setScreen:x,id:o,hideCollectionCheckbox:V||"-1"===o,selectedCollections:j,renderWithoutModal:w,pickerType:S,usedInSearch:!0},o)}))}),e.jsx(e.Fragment,{children:Object.keys(null==C?void 0:C.products).map((o=>{var t,l;return Object.keys((null===(l=null===(t=null==C?void 0:C.products)||void 0===t?void 0:t[o])||void 0===l?void 0:l.products)||[]).map((t=>{var l,i,c;let s=!1;return(null===(l=null==C?void 0:C.products)||void 0===l?void 0:l.isCustom)&&(s=!0),e.jsx(d,{collectionId:o,upliftAdditions:(e,t)=>((e,o,t)=>{var l;const i=p(t,null===(l=null==C?void 0:C.products)||void 0===l?void 0:l[e]);y({type:o,data:Object.assign(Object.assign({},i),{isRestricted:m})})})(o,e,t),productId:t,data:(null===(i=null==C?void 0:C.products)||void 0===i?void 0:i[o].products)[t],isProductPartiallyChecked:a(o,t,j,null===(c=C.products)||void 0===c?void 0:c[o],g),selectedData:j,selectedCollectionsDispatch:y,viewOnly:s,hideProductCheckbox:I,hideVariantCheckbox:O,hideProductVariants:g,pickerType:S,outOfStockAction:A},t)}))}))})]}):e.jsx(s,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{h as SearchScreen};
@@ -1 +1 @@
1
- import{j as t}from"../../node_modules/react/jsx-runtime.js";import{COLORS as s}from"../../constants/Theme.js";import{Tooltip as e}from"../tooltips/Tooltip.js";import{WhatsNewIconContainer as i}from"./WhatsNew.styles.js";const n=s=>{let{width:e=32,height:i=32}=s;return t.jsxs("svg",Object.assign({width:e,height:i,viewBox:"0 0 32 32",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[t.jsxs("g",Object.assign({clipPath:"url(#clip0_4309_13422)"},{children:[t.jsx("path",{d:"M22.1797 15.3052L15.4548 24.4022C15.3815 24.5014 15.3339 24.6172 15.316 24.7392C15.2982 24.8613 15.3108 24.9859 15.3526 25.1019L15.7733 26.2675C15.8141 26.3806 15.8815 26.4822 15.9698 26.5638C16.0581 26.6454 16.1647 26.7046 16.2806 26.7364C16.3966 26.7682 16.5185 26.7716 16.636 26.7464C16.7536 26.7212 16.8634 26.6681 16.9561 26.5916L20.7368 23.5654",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("path",{d:"M6.4457 17.6642C6.36082 17.7791 6.31051 17.9158 6.30068 18.0583C6.29085 18.2008 6.32192 18.3431 6.39022 18.4686C6.45853 18.594 6.56123 18.6973 6.68626 18.7664C6.81128 18.8355 6.95343 18.8674 7.09598 18.8584C13.4962 18.4646 17.7214 21.3363 17.7214 21.3363L20.7369 23.5654C21.5366 24.1567 22.5385 24.406 23.5221 24.2585C24.5056 24.111 25.3903 23.5789 25.9816 22.7791C26.5728 21.9794 26.8221 20.9775 26.6746 19.9939C26.5272 19.0104 25.995 18.1257 25.1952 17.5344L22.1797 15.3053C22.1797 15.3053 18.1953 12.1079 16.6943 5.87443C16.6611 5.7356 16.5889 5.60913 16.4863 5.50988C16.3837 5.41062 16.2549 5.34272 16.1151 5.31413C15.9752 5.28554 15.8301 5.29746 15.6968 5.34849C15.5635 5.39952 15.4475 5.48754 15.3624 5.6022L6.4457 17.6642Z",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"}),t.jsx("path",{d:"M7.69175 12.0819L5.24902 11.3518",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),t.jsx("path",{d:"M10.9423 8.35748L9.88867 6.03589",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"}),t.jsx("path",{d:"M8.91955 9.68574L5.66699 6.87134",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})]})),t.jsx("defs",{children:t.jsx("clipPath",Object.assign({id:"clip0_4309_13422"},{children:t.jsx("rect",{width:"24",height:"24",fill:"white",transform:"translate(4 4)"})}))})]}))},o=o=>{let{onClick:r,newContentCount:c=0,isOpen:d=!1,isLoading:a=!1,tooltip:h="What's new",testId:l="whats-new-button",iconWidth:j=32,iconHeight:p=32,customIcon:x}=o;return a?t.jsxs("div",Object.assign({style:{margin:"0px 8px"}},{children:[t.jsx("div",{style:{width:16,height:16,border:"2px solid #f3f3f3",borderTop:"2px solid #731DCF",borderRadius:"50%",animation:"spin 1s linear infinite"}}),t.jsx("style",{children:"\n\t\t\t\t\t\t@keyframes spin {\n\t\t\t\t\t\t\t0% { transform: rotate(0deg); }\n\t\t\t\t\t\t\t100% { transform: rotate(360deg); }\n\t\t\t\t\t\t}\n\t\t\t\t\t"})]})):t.jsx(i,Object.assign({count:c},{children:t.jsxs("div",Object.assign({className:"main-icon-class "+(d?"icon-active":""),style:{color:d?s.content.brand:s.content.primary},onClick:r,"data-testid":l},{children:[t.jsx(e,Object.assign({body:h},{children:t.jsx("div",{children:x?t.jsx(x,{width:j,height:p,color:d?s.content.brand:s.content.primary}):t.jsx(n,{width:j,height:p})})})),c>0&&t.jsx("div",Object.assign({className:"notification--count"},{children:t.jsx("div",Object.assign({className:"count--text"},{children:c}))}))]}))}))};export{o as WhatsNewButton};
1
+ import{j as t}from"../../node_modules/react/jsx-runtime.js";import s from"../../assets/icons/whatsNew.svg.js";import{COLORS as n}from"../../constants/Theme.js";import{Tooltip as i}from"../tooltips/Tooltip.js";import{WhatsNewIconContainer as e}from"./WhatsNew.styles.js";const o=o=>{let{onClick:r,newContentCount:a=0,isOpen:c=!1,isLoading:d=!1,tooltip:l="What's new",testId:m="whats-new-button",iconWidth:j=32,iconHeight:h=32,customIcon:p}=o;return d?t.jsxs("div",Object.assign({style:{margin:"0px 8px"}},{children:[t.jsx("div",{style:{width:16,height:16,border:"2px solid #f3f3f3",borderTop:"2px solid #731DCF",borderRadius:"50%",animation:"spin 1s linear infinite"}}),t.jsx("style",{children:"\n\t\t\t\t\t\t@keyframes spin {\n\t\t\t\t\t\t\t0% { transform: rotate(0deg); }\n\t\t\t\t\t\t\t100% { transform: rotate(360deg); }\n\t\t\t\t\t\t}\n\t\t\t\t\t"})]})):t.jsx(e,Object.assign({count:a},{children:t.jsxs("div",Object.assign({className:"main-icon-class "+(c?"icon-active":""),style:{color:c?n.content.brand:n.content.primary},onClick:r,"data-testid":m},{children:[t.jsx(i,Object.assign({body:l},{children:t.jsx("div",{children:p?t.jsx(p,{width:j,height:h,color:c?n.content.brand:n.content.primary}):t.jsx(s,{})})})),a>0&&t.jsx("div",Object.assign({className:"notification--count"},{children:t.jsx("div",Object.assign({className:"count--text"},{children:a}))}))]}))}))};export{o as WhatsNewButton};
@@ -1 +1 @@
1
- import{j as e}from"../../node_modules/react/jsx-runtime.js";import{format as t,differenceInBusinessDays as s}from"date-fns";import{useState as n,useMemo as r}from"react";import{COLORS as o}from"../../constants/Theme.js";import{Button as a}from"../button/Button.js";import{VideoModal as i}from"../feature-announcements/VideoModal.js";import{SearchBar as c}from"../searchBar/searchBar.js";import{SideModal as d}from"../side-modal/SideModal.js";import{TitleMedium as l,TitleRegular as h,BodyPrimary as m,Caption as j,TitleSmall as x}from"../TypographyStyle.js";import{MainContainer as g,WhatsNewWrapper as u,MainCardContainer as p,BackgroundImageContainer as w}from"./WhatsNew.styles.js";const b=t=>{let{width:s=32,height:n=32}=t;return e.jsx("svg",Object.assign({width:s,height:n,viewBox:"0 0 24 24",fill:"none"},{children:e.jsx("path",{d:"M21 21l-6-6m2-5a7 7 0 11-14 0 7 7 0 0114 0z",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})}))},f=t=>{let{width:s=32,height:n=32}=t;return e.jsxs("svg",Object.assign({width:s,height:n,viewBox:"0 0 32 32",fill:"none"},{children:[e.jsx("path",{d:"M16 2C8.268 2 2 8.268 2 16s6.268 14 14 14 14-6.268 14-14S23.732 2 16 2zm0 25c-6.065 0-11-4.935-11-11S9.935 5 16 5s11 4.935 11 11-4.935 11-11 11z",fill:"currentColor"}),e.jsx("path",{d:"M16 10.5c-.828 0-1.5.672-1.5 1.5s.672 1.5 1.5 1.5 1.5-.672 1.5-1.5-.672-1.5-1.5-1.5zM15 15h2v8h-2v-8z",fill:"currentColor"})]}))},C=C=>{let{isOpen:y,onClose:v,content:O,isLoading:N=!1,title:k="What's new on BIK",searchPlaceholder:M="Search posts",emptyStateTitle:S="Nothing new!",emptyStateDescription:L="There are no new updates or features at the moment. Check back soon!",noResultsText:A="Sorry, no results found.",width:D="480px",onContentClick:T,renderCustomContent:z}=C;const[B,W]=n(""),[F,U]=n(!1),[V,_]=n(""),E=e=>{if(!e.createdAt)return!1;const t=e.createdAt.toDate?e.createdAt.toDate():new Date(e.createdAt);return s(new Date,t)<7},I=r((()=>{if(!B.trim())return O;const e=B.toLowerCase();return O.filter((t=>t.title.toLowerCase().includes(e)||t.body.toLowerCase().includes(e)||t.content&&t.content.toLowerCase().includes(e)))}),[O,B]),P=0===O.length,R=0===I.length;return y?e.jsxs(d,Object.assign({width:D,onClose:v,header:"",headerCustomComponent:e.jsx(l,Object.assign({color:o.background.inverse},{children:k})),headerStyle:{background:o.background.brandLight},hideFooter:!0},{children:[e.jsxs(g,{children:[e.jsx("div",Object.assign({className:"mt-8"},{children:e.jsx(c,{width:"100%",isEnabled:!P,onChange:e=>{W(e)},onEnter:e=>{W(e)},placeholder:M,variant:"default",searchValue:B,onClickCross:()=>{W("")}})})),e.jsx(u,{children:P||R?e.jsxs("div",Object.assign({className:"no--data--found"},{children:[e.jsx("div",Object.assign({className:"icon--wrapper"},{children:P?e.jsx(f,{width:32,height:32}):e.jsx(b,{width:32,height:32})})),P?e.jsxs(e.Fragment,{children:[e.jsx(h,{children:S}),e.jsx(m,Object.assign({color:o.content.secondary,className:"text--align",style:{maxWidth:300}},{children:L}))]}):R?e.jsx(m,Object.assign({color:o.content.secondary,className:"text--align",style:{maxWidth:300}},{children:A})):null]})):e.jsx("div",Object.assign({className:"scroller"},{children:I.map(((s,n)=>z?z(s):e.jsxs(p,Object.assign({className:"padding--16 mb-mt-8"},{children:[e.jsx(w,{imageUrl:s.image,height:"209px",width:"100%",style:{borderRadius:"4px"}}),e.jsx("div",Object.assign({className:"mt-20 full--width"},{children:e.jsxs("div",Object.assign({className:"created--at flex flex--row"},{children:[E(s)?e.jsx("div",Object.assign({className:"new--content--tag"},{children:e.jsx(j,{children:"New"})})):e.jsx(e.Fragment,{}),e.jsx(j,Object.assign({style:{color:o.content.placeholder}},{children:s.createdAt?t(s.createdAt.toDate?s.createdAt.toDate():new Date(s.createdAt),"dd MMMM yyyy"):""}))]}))})),e.jsx("div",Object.assign({className:"mt--8"},{children:e.jsx(x,{children:s.title})})),e.jsx("div",{dangerouslySetInnerHTML:{__html:s.body},className:"card--desc mt--12"}),e.jsx("div",Object.assign({className:"flex flex--row mt-20 full--width"},{children:e.jsx(a,{buttonText:s.buttonText||"Explore the feature",onClick:()=>(e=>{e.productVideo?(_(e.productVideo),U(!0)):e.redirectUrl&&window.open(e.redirectUrl,"_blank"),T&&T(e)})(s),matchParentWidth:!0,size:"medium"})}))]}),`whats-new-${n}`)))}))})]}),e.jsx(i,{isOpen:F,videoUrl:V,onClose:()=>{U(!1)}})]})):e.jsx(e.Fragment,{})};export{C as WhatsNewPanel};
1
+ import{j as e}from"../../node_modules/react/jsx-runtime.js";import{format as t,differenceInBusinessDays as s}from"date-fns";import{useState as n,useMemo as r}from"react";import a from"../../assets/icons/searchIconWhatsNew.svg.js";import o from"../../assets/icons/whatsNew.svg.js";import{COLORS as i}from"../../constants/Theme.js";import{Button as c}from"../button/Button.js";import{VideoModal as d}from"../feature-announcements/VideoModal.js";import{SearchBar as l}from"../searchBar/searchBar.js";import{SideModal as m}from"../side-modal/SideModal.js";import{TitleMedium as h,TitleRegular as j,BodyPrimary as x,Caption as g,TitleSmall as u}from"../TypographyStyle.js";import{MainContainer as p,WhatsNewWrapper as b,MainCardContainer as w,BackgroundImageContainer as f}from"./WhatsNew.styles.js";const y=y=>{let{isOpen:C,onClose:N,content:O,isLoading:v=!1,title:k="What's new on BIK",searchPlaceholder:A="Search posts",emptyStateTitle:D="Nothing new!",emptyStateDescription:S="There are no new updates or features at the moment. Check back soon!",noResultsText:T="Sorry, no results found.",width:L="480px",onContentClick:M,renderCustomContent:W}=y;const[B,F]=n(""),[U,V]=n(!1),[_,E]=n(""),I=e=>{if(!e.createdAt)return!1;const t=e.createdAt.toDate?e.createdAt.toDate():new Date(e.createdAt);return s(new Date,t)<7},P=r((()=>{if(!B.trim())return O;const e=B.toLowerCase();return O.filter((t=>t.title.toLowerCase().includes(e)||t.body.toLowerCase().includes(e)||t.content&&t.content.toLowerCase().includes(e)))}),[O,B]),R=0===O.length,z=0===P.length;return C?e.jsxs(m,Object.assign({width:L,onClose:N,header:"",headerCustomComponent:e.jsx(h,Object.assign({color:i.background.inverse},{children:k})),headerStyle:{background:i.background.brandLight},hideFooter:!0},{children:[e.jsxs(p,{children:[e.jsx("div",Object.assign({className:"mt-8"},{children:e.jsx(l,{width:"100%",isEnabled:!R,onChange:e=>{F(e)},onEnter:e=>{F(e)},placeholder:A,variant:"default",searchValue:B,onClickCross:()=>{F("")}})})),e.jsx(b,{children:R||z?e.jsxs("div",Object.assign({className:"no--data--found"},{children:[e.jsx("div",Object.assign({className:"icon--wrapper"},{children:R?e.jsx(o,{}):e.jsx(a,{})})),R?e.jsxs(e.Fragment,{children:[e.jsx(j,{children:D}),e.jsx(x,Object.assign({color:i.content.secondary,className:"text--align",style:{maxWidth:300}},{children:S}))]}):z?e.jsx(x,Object.assign({color:i.content.secondary,className:"text--align",style:{maxWidth:300}},{children:T})):null]})):e.jsx("div",Object.assign({className:"scroller"},{children:P.map(((s,n)=>W?W(s):e.jsxs(w,Object.assign({className:"padding--16 mb-mt-8"},{children:[e.jsx(f,{imageUrl:s.image,height:"209px",width:"100%",style:{borderRadius:"4px"}}),e.jsx("div",Object.assign({className:"mt-20 full--width"},{children:e.jsxs("div",Object.assign({className:"created--at flex flex--row"},{children:[I(s)?e.jsx("div",Object.assign({className:"new--content--tag"},{children:e.jsx(g,{children:"New"})})):e.jsx(e.Fragment,{}),e.jsx(g,Object.assign({style:{color:i.content.placeholder}},{children:s.createdAt?t(s.createdAt.toDate?s.createdAt.toDate():new Date(s.createdAt),"dd MMMM yyyy"):""}))]}))})),e.jsx("div",Object.assign({className:"mt--8"},{children:e.jsx(u,{children:s.title})})),e.jsx("div",{dangerouslySetInnerHTML:{__html:s.body},className:"card--desc mt--12"}),e.jsx("div",Object.assign({className:"flex flex--row mt-20 full--width"},{children:e.jsx(c,{buttonText:s.buttonText||"Explore the feature",onClick:()=>(e=>{e.productVideo?(E(e.productVideo),V(!0)):e.redirectUrl&&window.open(e.redirectUrl,"_blank"),M&&M(e)})(s),matchParentWidth:!0,size:"medium"})}))]}),`whats-new-${n}`)))}))})]}),e.jsx(d,{isOpen:U,videoUrl:_,onClose:()=>{V(!1)}})]})):e.jsx(e.Fragment,{})};export{y as WhatsNewPanel};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.725-beta.3",
3
+ "version": "0.0.725-beta.5",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",