@bikdotai/bik-component-library 0.0.751 → 0.0.753
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/assets/icons/play.svg.js +1 -0
- package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.js +1 -1
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.js +1 -1
- package/dist/cjs/components/feature-announcements/constants/dimensions.d.ts +99 -25
- package/dist/cjs/components/feature-announcements/constants/dimensions.js +1 -1
- package/dist/cjs/components/feature-announcements/styles/joyride.styles.d.ts +2 -2
- package/dist/cjs/components/feature-announcements/styles/majorPopup.styles.d.ts +14 -1
- package/dist/cjs/components/feature-announcements/styles/majorPopup.styles.js +1 -1
- package/dist/cjs/components/feature-announcements/types/feature.types.d.ts +47 -0
- package/dist/cjs/components/feature-announcements/types/props.types.d.ts +25 -3
- package/dist/cjs/components/whats-new/WhatsNew.types.d.ts +6 -0
- package/dist/cjs/components/whats-new/WhatsNewButton.js +1 -1
- package/dist/cjs/components/whats-new/WhatsNewPanel.js +1 -1
- package/dist/esm/assets/icons/play.svg.js +1 -0
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.js +1 -1
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.js +1 -1
- package/dist/esm/components/feature-announcements/constants/dimensions.d.ts +99 -25
- package/dist/esm/components/feature-announcements/constants/dimensions.js +1 -1
- package/dist/esm/components/feature-announcements/styles/joyride.styles.d.ts +2 -2
- package/dist/esm/components/feature-announcements/styles/majorPopup.styles.d.ts +14 -1
- package/dist/esm/components/feature-announcements/styles/majorPopup.styles.js +1 -1
- package/dist/esm/components/feature-announcements/types/feature.types.d.ts +47 -0
- package/dist/esm/components/feature-announcements/types/props.types.d.ts +25 -3
- package/dist/esm/components/whats-new/WhatsNew.types.d.ts +6 -0
- package/dist/esm/components/whats-new/WhatsNewButton.js +1 -1
- package/dist/esm/components/whats-new/WhatsNewPanel.js +1 -1
- 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({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 40 40"},e),t||(t=r.createElement("path",{fill:"#fff",d:"M10 6.34c0-1.308 1.44-2.107 2.55-1.413l21.855 13.66a1.667 1.667 0 0 1 0 2.826L12.55 35.073c-1.11.694-2.55-.104-2.55-1.413V6.34Z"})));exports.default=a;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),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:y}=d;var S;const{majorUpdateFeatures:x,minorUpdateFeatures:C,isLoading:k,markFeatureAsViewed:T}=r.useFeatureAnnouncements({fetchVisibleFeatures:p,getStoreFeatureProgress:f,fetchFeatureById:b,markFeatureAsViewedForStore:g,isFeatureApplicableToCurrentPage:h,module:m,router:y}),[v,w]=o.useState(null),[B,j]=o.useState(null),[I,E]=o.useState(!1),[F,N]=o.useState([]),[q,P]=o.useState(!1),[O,W]=o.useState([]),[_,M]=o.useState(!1),[V,A]=o.useState(!1),[L,R]=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==y?void 0:y.pathname]),o.useEffect((()=>{if(!(x.length>0)||v||k||_||K)0!==x.length||k||H(!0);else{H(!1),$(!1),E(!1),N([]),j(null),R([]);let e=0;const t=10,o=()=>{e++;document.querySelector('[data-testid="whats-new-button"]')?le(x[0]):e<t?setTimeout(o,1e3):H(!0)};o()}}),[x,v,k,_,K]),o.useEffect((()=>{var e;const t=null===(e=null==y?void 0:y.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),A(!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];R(e),he(o,e),clearInterval(a)}else n>=25&&(A(!1),clearInterval(a))}),200);return()=>{clearInterval(a)}}),[C,null===(S=null==y?void 0:y.query)||void 0===S?void 0:S.featureId,k]),o.useEffect((()=>{var e;if(C.length>0&&!k&&!I&&!V&&!B&&!U&&z&&!K){let e=null,t=null,o=null,n=!1;const a=()=>{if(n||V||B||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&&(R(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}I||n||V||B||U||!z||!t||(o&&clearTimeout(o),o=setTimeout((()=>{n||V||B||U||!z||a()}),200))})),t=()=>{I||n||V||B||U||!z||(o&&clearTimeout(o),requestAnimationFrame((()=>{o=setTimeout((()=>{n||V||B||U||!z||a()}),300)})))},e&&e.observe(document.body,{childList:!0,subtree:!0}),t&&window.addEventListener("scroll",t,{passive:!0}),a(),setTimeout((()=>{n||V||B||U||!z||a()}),100),setTimeout((()=>{n||V||B||U||!z||a()}),1e3),setTimeout((()=>{n||V||B||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==y?void 0:y.query)||void 0===e?void 0:e.featureId)&&B||(E(!1),N([]),j(null),R([]),$(!1))}}),[C,k,I,V,B,U,z,T,K]);const le=e=>{w(e);const o=x.findIndex((t=>t.id===e.id)),n=x.length,r=[{target:a.SELECTORS.WHATS_NEW_BUTTON,content:t.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"}}}];W(r),P(!0)},de=o.useCallback((e=>{(e||v)&&(M(!0),x.forEach((e=>{T(e.id)})),P(!1),w(null),W([]),H(!0),setTimeout((()=>{M(!1)}),500))}),[v,x,T]),ue=o.useCallback((e=>{M(!0),T(e.id),e.productVideo&&(J(e.productVideo),D(!0),Q(!0)),P(!1),w(null),W([]);x.findIndex((t=>t.id===e.id))===x.length-1&&H(!0),setTimeout((()=>{M(!1)}),500)}),[x,T]),ce=o.useCallback((e=>{const o=e||v;if(!o)return;const n=x.findIndex((e=>e.id===o.id));if(n>0){const e=x[n-1];w(e);const o=n-1,a=x.length,r=[{target:'[data-testid="whats-new-button"]',content:t.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"}}}];W(r)}}),[v,x]),pe=o.useCallback((e=>{const o=e||v;if(!o)return;const n=x.findIndex((e=>e.id===o.id));if(n<x.length-1){const e=x[n+1];w(e);const o=n+1,a=x.length,r=[{target:'[data-testid="whats-new-button"]',content:t.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"}}}];W(r)}else M(!0),T(o.id),P(!1),w(null),W([]),H(!0),setTimeout((()=>{M(!1)}),500)}),[v,x,T]),fe=()=>{if(x.length>0&&!v){document.querySelector('[data-testid="whats-new-button"]')&&le(x[0])}};o.useEffect((()=>(window.showMajorUpdatePopup=fe,()=>{delete window.showMajorUpdatePopup})),[x,v]);const be=o.useCallback((e=>{const{action:t}=e;t===n.ACTIONS.CLOSE&&(v&&(M(!0),x.forEach((e=>{T(e.id)})),H(!0),setTimeout((()=>{M(!1)}),500)),P(!1),w(null),W([]))}),[v,x,T]),ge=o.useCallback((e=>{const{action:t}=e;if(t===n.ACTIONS.CLOSE){if(B){A(!0),T(B.id);L.findIndex((e=>e.id===B.id))===L.length-1&&$(!0),setTimeout((()=>{A(!1)}),500)}E(!1),j(null),N([])}}),[B,L,T]),he=(o,n)=>e.__awaiter(void 0,void 0,void 0,(function*(){j(o);const e=n||L,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.jsx(i.default,{feature:o,currentIndex:a,totalFeatures:r,onSkip:()=>me(o),onExplore:()=>ye(o),onPrevious:()=>Se(o),onNext:()=>xe(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),E(!0)})),me=o.useCallback((e=>{const t=e||B;if(t){A(!0),T(t.id),ie((e=>new Set(e).add(t.id))),E(!1),j(null),N([]);const e=L.find((e=>e.id!==t.id&&!se.has(e.id)));setTimeout((()=>{A(!1),e?he(e,L):$(!0)}),500)}}),[B,L,T,se]),ye=o.useCallback((e=>{A(!0),T(e.id),ie((t=>new Set(t).add(e.id))),e.productVideo&&(J(e.productVideo),D(!0),Q(!0)),E(!1),j(null),N([]);const t=L.find((t=>t.id!==e.id&&!se.has(t.id)));setTimeout((()=>{A(!1),t&&!e.productVideo?he(t,L):t||$(!0)}),500)}),[L,T,se]),Se=o.useCallback((o=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=o||B;if(!e)return;const n=L.findIndex((t=>t.id===e.id));if(n>0){const e=L[n-1];j(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=L.length,l=[{target:o,content:t.jsx(i.default,{feature:e,currentIndex:r,totalFeatures:s,onSkip:()=>me(e),onExplore:()=>ye(e),onPrevious:()=>Se(e),onNext:()=>xe(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)}}))),[B,L]),xe=o.useCallback((o=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=o||B;if(!e)return;const n=L.findIndex((t=>t.id===e.id));if(n<L.length-1){const e=L[n+1];j(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=L.length,l=[{target:o,content:t.jsx(i.default,{feature:e,currentIndex:r,totalFeatures:s,onSkip:()=>me(e),onExplore:()=>ye(e),onPrevious:()=>Se(e),onNext:()=>xe(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 A(!0),$(!0),T(e.id),E(!1),j(null),N([]),setTimeout((()=>{A(!1)}),500)}))),[B,L,T]);return t.jsxs(t.Fragment,{children:[c,O.length>0&&t.jsx(u.default,{steps:O,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.jsx(u.default,{steps:F,run:I,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.jsx(l.VideoModal,{isOpen:Z,videoUrl:G,onClose:()=>{D(!1),J(""),Q(!1);const e=L.find((e=>!se.has(e.id)));e?setTimeout((()=>{he(e,L)}),300):$(!0)}})]})};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),o=require("react"),n=require("react-joyride");require("./constants/animations.js");var a=require("./constants/selectors.js"),r=require("./hooks/useFeatureAnnouncements.js"),i=require("./MajorUpdatePopup.js"),s=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:m,module:h,router:y,storeId:S,onAnnouncementShown:x,onAnnouncementInteracted:C}=d;var k;const{majorUpdateFeatures:T,minorUpdateFeatures:v,isLoading:w,markFeatureAsViewed:I}=r.useFeatureAnnouncements({fetchVisibleFeatures:p,getStoreFeatureProgress:f,fetchFeatureById:b,markFeatureAsViewedForStore:g,isFeatureApplicableToCurrentPage:m,module:h,router:y}),[B,j]=o.useState(null),[E,F]=o.useState(null),[N,q]=o.useState(!1),[P,_]=o.useState([]),[O,U]=o.useState(!1),[W,V]=o.useState([]),[M,A]=o.useState(!1),[L,R]=o.useState(!1),[$,z]=o.useState([]),[H,Z]=o.useState(!1),[D,G]=o.useState(!1),[J,K]=o.useState(!1),[Q,X]=o.useState(""),[Y,ee]=o.useState(!1),[te,oe]=o.useState(!1),[ne,ae]=o.useState(!1),[re,ie]=o.useState(0),[se,le]=o.useState(0),[de,ue]=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\t.react-joyride__floater {\n\t\t\t\tright: 12px !important;\n\t\t\t\tleft: auto !important;\n\t\t\t}\n\t\t",()=>{const t=document.getElementById(e);t&&t.remove()}}),[]),o.useEffect((()=>{ie((e=>e+1)),le((e=>e+1)),oe(!1),ae(!1),ue(new Set)}),[null==y?void 0:y.pathname]),o.useEffect((()=>{if(!(T.length>0)||B||w||M||Y)0!==T.length||w||G(!0);else{G(!1),Z(!1),q(!1),_([]),F(null),z([]);let e=0;const t=10,o=()=>{e++;document.querySelector('[data-testid="whats-new-button"]')?ce(T[0]):e<t?setTimeout(o,1e3):G(!0)};o()}}),[T,B,w,M,Y]),o.useEffect((()=>{var e;const t=null===(e=null==y?void 0:y.query)||void 0===e?void 0:e.featureId;if(!t||w||0===v.length)return;const o=v.find((e=>e.id===t));if(!o||!o.featureTag)return;Z(!0),R(!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];z(e),Se(o,e),clearInterval(a)}else n>=25&&(R(!1),clearInterval(a))}),200);return()=>{clearInterval(a)}}),[v,null===(k=null==y?void 0:y.query)||void 0===k?void 0:k.featureId,w]),o.useEffect((()=>{var e;if(v.length>0&&!w&&!N&&!L&&!E&&!H&&D&&!Y){let e=null,t=null,o=null,n=!1;const a=()=>{if(n||L||E||H||!D)return;const a=v.filter((e=>{if(!e.featureTag||""===e.featureTag.trim())return!1;if(de.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&&(z(a),Se(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}N||n||L||E||H||!D||!t||(o&&clearTimeout(o),o=setTimeout((()=>{n||L||E||H||!D||a()}),200))})),t=()=>{N||n||L||E||H||!D||(o&&clearTimeout(o),requestAnimationFrame((()=>{o=setTimeout((()=>{n||L||E||H||!D||a()}),300)})))},e&&e.observe(document.body,{childList:!0,subtree:!0}),t&&window.addEventListener("scroll",t,{passive:!0}),a(),setTimeout((()=>{n||L||E||H||!D||a()}),100),setTimeout((()=>{n||L||E||H||!D||a()}),1e3),setTimeout((()=>{n||L||E||H||!D||a()}),500),()=>{n=!0,e&&e.disconnect(),t&&window.removeEventListener("scroll",t),o&&clearTimeout(o)}}if(0===v.length||w){(null===(e=null==y?void 0:y.query)||void 0===e?void 0:e.featureId)&&E||(q(!1),_([]),F(null),z([]),Z(!1))}}),[v,w,N,L,E,H,D,I,Y]);const ce=e=>{j(e);const o=T.findIndex((t=>t.id===e.id)),n=T.length,r=[{target:a.SELECTORS.WHATS_NEW_BUTTON,content:t.jsx(i.default,{feature:e,currentIndex:o,totalFeatures:n,onSkip:()=>pe(e),onExplore:()=>fe(e),onPrevious:()=>be(e),onNext:()=>ge(e),setIsClosing:oe}),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"}}}];V(r),U(!0),x&&S&&x({storeId:S,announcementId:e.id,announcementTitle:e.title,imageUrl:e.displayImage||e.image,videoUrl:e.productVideo})},pe=o.useCallback((e=>{const t=e||B;t&&(A(!0),T.forEach((e=>{I(e.id)})),U(!1),j(null),V([]),G(!0),C&&S&&C({storeId:S,announcementId:t.id,announcementTitle:t.title,imageUrl:t.displayImage||t.image,videoUrl:t.productVideo,buttonClicked:"Skip",buttonName:"Skip",buttonUrl:void 0}),setTimeout((()=>{A(!1)}),500))}),[B,T,I]),fe=o.useCallback((e=>{A(!0),I(e.id),e.productVideo&&(X(e.productVideo),K(!0),ee(!0)),U(!1),j(null),V([]);T.findIndex((t=>t.id===e.id))===T.length-1&&G(!0),C&&S&&C({storeId:S,announcementId:e.id,announcementTitle:e.title,imageUrl:e.displayImage||e.image,videoUrl:e.productVideo,buttonClicked:"Primary",buttonName:e.buttonText||"Explore",buttonUrl:e.redirectUrl||e.productVideo}),setTimeout((()=>{A(!1)}),500)}),[T,I]),be=o.useCallback((e=>{const o=e||B;if(!o)return;const n=T.findIndex((e=>e.id===o.id));if(n>0){const e=T[n-1];j(e);const o=n-1,a=T.length,r=[{target:'[data-testid="whats-new-button"]',content:t.jsx(i.default,{feature:e,currentIndex:o,totalFeatures:a,onSkip:()=>pe(e),onExplore:()=>fe(e),onPrevious:()=>be(e),onNext:()=>ge(e),setIsClosing:oe}),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"}}}];V(r)}}),[B,T]),ge=o.useCallback((e=>{const o=e||B;if(!o)return;const n=T.findIndex((e=>e.id===o.id));if(n<T.length-1){const e=T[n+1];j(e);const o=n+1,a=T.length,r=[{target:'[data-testid="whats-new-button"]',content:t.jsx(i.default,{feature:e,currentIndex:o,totalFeatures:a,onSkip:()=>pe(e),onExplore:()=>fe(e),onPrevious:()=>be(e),onNext:()=>ge(e),setIsClosing:oe}),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"}}}];V(r)}else A(!0),I(o.id),U(!1),j(null),V([]),G(!0),setTimeout((()=>{A(!1)}),500)}),[B,T,I]),me=()=>{if(T.length>0&&!B){document.querySelector('[data-testid="whats-new-button"]')&&ce(T[0])}};o.useEffect((()=>(window.showMajorUpdatePopup=me,()=>{delete window.showMajorUpdatePopup})),[T,B]);const he=o.useCallback((e=>{const{action:t}=e;t===n.ACTIONS.CLOSE&&(B&&(A(!0),T.forEach((e=>{I(e.id)})),G(!0),setTimeout((()=>{A(!1)}),500)),U(!1),j(null),V([]))}),[B,T,I]),ye=o.useCallback((e=>{const{action:t}=e;if(t===n.ACTIONS.CLOSE){if(E){R(!0),I(E.id);$.findIndex((e=>e.id===E.id))===$.length-1&&Z(!0),setTimeout((()=>{R(!1)}),500)}q(!1),F(null),_([])}}),[E,$,I]),Se=(o,n)=>e.__awaiter(void 0,void 0,void 0,(function*(){F(o);const e=n||$,a=e.findIndex((e=>e.id===o.id)),r=e.length,i=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`,l=document.querySelector(i);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:i,content:t.jsx(s.default,{feature:o,currentIndex:a,totalFeatures:r,onSkip:()=>xe(o),onExplore:()=>Ce(o),onPrevious:()=>ke(o),onNext:()=>Te(o),setIsClosing:ae}),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"}}}];_(d),q(!0)})),xe=o.useCallback((e=>{const t=e||E;if(t){R(!0),I(t.id),ue((e=>new Set(e).add(t.id))),q(!1),F(null),_([]);const e=$.find((e=>e.id!==t.id&&!de.has(e.id)));setTimeout((()=>{R(!1),e?Se(e,$):Z(!0)}),500)}}),[E,$,I,de]),Ce=o.useCallback((e=>{R(!0),I(e.id),ue((t=>new Set(t).add(e.id))),e.productVideo&&(X(e.productVideo),K(!0),ee(!0)),q(!1),F(null),_([]);const t=$.find((t=>t.id!==e.id&&!de.has(t.id)));setTimeout((()=>{R(!1),t&&!e.productVideo?Se(t,$):t||Z(!0)}),500)}),[$,I,de]),ke=o.useCallback((o=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=o||E;if(!e)return;const n=$.findIndex((t=>t.id===e.id));if(n>0){const e=$[n-1];F(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,i=$.length,l=[{target:o,content:t.jsx(s.default,{feature:e,currentIndex:r,totalFeatures:i,onSkip:()=>xe(e),onExplore:()=>Ce(e),onPrevious:()=>ke(e),onNext:()=>Te(e),setIsClosing:ae}),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"}}}];_(l)}}))),[E,$]),Te=o.useCallback((o=>e.__awaiter(void 0,void 0,void 0,(function*(){const e=o||E;if(!e)return;const n=$.findIndex((t=>t.id===e.id));if(n<$.length-1){const e=$[n+1];F(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,i=$.length,l=[{target:o,content:t.jsx(s.default,{feature:e,currentIndex:r,totalFeatures:i,onSkip:()=>xe(e),onExplore:()=>Ce(e),onPrevious:()=>ke(e),onNext:()=>Te(e),setIsClosing:ae}),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"}}}];_(l)}else R(!0),Z(!0),I(e.id),q(!1),F(null),_([]),setTimeout((()=>{R(!1)}),500)}))),[E,$,I]);return t.jsxs(t.Fragment,{children:[c,W.length>0&&t.jsx(u.default,{steps:W,run:O,continuous:!1,showProgress:!1,showSkipButton:!1,callback:he,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,spotlightClicks:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:te?"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-${re}`),P.length>0&&t.jsx(u.default,{steps:P,run:N,continuous:!1,showProgress:!1,showSkipButton:!1,callback:ye,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,scrollToFirstStep:!0,scrollOffset:120,disableScrolling:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:ne?"transparent":"#ffffff"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",borderRadius:"8px",boxShadow:ne?"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-${se}`),t.jsx(l.VideoModal,{isOpen:J,videoUrl:Q,onClose:()=>{K(!1),X(""),ee(!1);const e=$.find((e=>!de.has(e.id)));e?setTimeout((()=>{Se(e,$)}),300):Z(!0)}})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("react"),n=require("../../assets/icons/chevronRight2.svg.js"),r=require("../../assets/icons/play.svg.js"),s=require("../button/Button.js"),o=require("./constants/index.js"),a=require("./styles/majorPopup.styles.js");require("../../constants/Theme.js"),require("./constants/animations.js");var i=require("./utils/htmlHelpers.js"),l=require("./utils/animationHelpers.js"),u=require("./utils/elementHelpers.js");exports.default=c=>{let{feature:d,currentIndex:p,totalFeatures:g,onSkip:y,onExplore:v,onPrevious:b,onNext:j,setIsClosing:h,onSecondaryAction:f,ratio:x="16:9",padding:B}=c;var T,O,m,E,M,k,U,P,C,w;const[_,L]=e.useState(!1),[W,q]=e.useState(!1),[S,A]=e.useState(""),D=e.useRef(null),[I,H]=e.useState(!1),[N,R]=e.useState(!0),F=e.useRef(null),[X,V]=e.useState(x),J=e.useRef(null);e.useEffect((()=>{_&&q(!0)}),[_]);const z=()=>{var t,e;const n=null===(t=d.primaryButton)||void 0===t?void 0:t.action;if("Play Video"===n)v();else if("Open link"===n){const t=(null===(e=d.primaryButton)||void 0===e?void 0:e.redirectionUrl)||d.redirectUrl;if(t){t.startsWith("http")?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}}else v();l.hideJoyrideArrow(D.current);const r=u.findWhatsNewButton();if(r&&D.current){const t=l.calculateCloseTransform(D.current,r);A(t)}else A("scale(0)");null==h||h(!0),L(!0)},G=t=>{var e,n;t.preventDefault(),t.stopPropagation();const r=null===(e=d.secondaryButton)||void 0===e?void 0:e.action;if("Open link"===r){const t=null===(n=d.secondaryButton)||void 0===n?void 0:n.redirectionUrl;if(t){t.startsWith("http")?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}}else"Close popup"!==r&&""!==r||f&&f();l.hideJoyrideArrow(D.current);const s=u.findWhatsNewButton();if(s&&D.current){const t=l.calculateCloseTransform(D.current,s);A(t)}else A("scale(0)");null==h||h(!0),L(!0)},K=a.getMajorPopupStyles(W,S,X,B||d.padding,null===(T=d.primaryButton)||void 0===T?void 0:T.style,null===(O=d.secondaryButton)||void 0===O?void 0:O.style);return t.jsx("div",Object.assign({style:K.outerWrapper},{children:t.jsxs("div",Object.assign({ref:D,style:Object.assign(Object.assign({},K.container),{opacity:W?0:1,transition:"opacity 0.2s ease-in-out, transform 0.3s ease"})},{children:[t.jsx("style",{children:"\n\t\t\t\t[data-popup-content] ul {\n\t\t\t\t\tmargin: 0;\n\t\t\t\t\tpadding-left: 20px;\n\t\t\t\t\tlist-style-type: disc;\n\t\t\t\t}\n\t\t\t\t[data-popup-content] ul li {\n\t\t\t\t\tmargin-bottom: 8px;\n\t\t\t\t\tcolor: rgba(255, 255, 255, 0.8);\n\t\t\t\t\tfont-size: 12px;\n\t\t\t\t\tline-height: 16px;\n\t\t\t\t\tfont-family: Inter, sans-serif;\n\t\t\t\t}\n\t\t\t"}),t.jsxs("div",Object.assign({style:K.contentWrapper},{children:[t.jsx("div",Object.assign({style:K.imageContainer},{children:d.productVideo?t.jsxs(t.Fragment,{children:[t.jsx("video",{ref:F,src:d.productVideo,style:K.image,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,controls:!0,"aria-label":`Product video for ${d.title}`,onLoadedMetadata:t=>{const e=t.currentTarget,n=e.videoWidth,r=e.videoHeight;if(n&&r){const t=n/r;Math.abs(t-16/9)<.1?V("16:9"):Math.abs(t-1)<.1?V("1:1"):Math.abs(t-4/3)<.1?V("4:3"):V(t>1.5?"16:9":t<.9?"4:3":"1:1")}}}),(I||N)&&t.jsx("div",Object.assign({style:K.videoOverlay,onClick:t=>{t.stopPropagation(),F.current&&(F.current.paused?(F.current.play(),H(!1),R(!1)):(F.current.pause(),H(!0),R(!0)))},role:"button",tabIndex:0,"aria-label":I?"Play video":"Pause video",onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),F.current&&(F.current.paused?(F.current.play(),H(!1),R(!1)):(F.current.pause(),H(!0),R(!0))))}},{children:t.jsx(r.default,{width:20,height:20})}))]}):d.displayImage?t.jsx("img",{ref:J,src:d.displayImage,alt:d.title,style:K.image,onLoad:t=>{const e=t.currentTarget,n=e.naturalWidth,r=e.naturalHeight;if(n&&r){const t=n/r;Math.abs(t-16/9)<.1?V("16:9"):Math.abs(t-1)<.1?V("1:1"):Math.abs(t-4/3)<.1?V("4:3"):V(t>1.5?"16:9":t<.9?"4:3":"1:1")}},onError:t=>{d.image&&(t.target.src=d.image)}}):t.jsx("div",Object.assign({style:K.imagePlaceholder},{children:o.TEXT.FEATURE_PREVIEW_PLACEHOLDER}))})),t.jsxs("div",Object.assign({style:K.contentContainer},{children:[t.jsx("div",Object.assign({style:K.skipButtonContainer},{children:t.jsx("button",Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),(t=>{l.hideJoyrideArrow(D.current);const e=u.findWhatsNewButton();if(e&&D.current){const t=l.calculateCloseTransform(D.current,e);A(t)}else A("scale(0)");null==h||h(!0),L(!0),l.executeAfterAnimation(t)})(y)},style:K.skipButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,K.skipButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,K.skipButton.base),"aria-label":"Skip feature announcement"},{children:"Skip"}))})),t.jsx("h3",Object.assign({style:K.title},{children:d.title})),t.jsx("div",{"data-popup-content":!0,style:K.content,dangerouslySetInnerHTML:{__html:i.decodeHTMLEntities(d.content||d.body||"")}}),t.jsxs("div",Object.assign({style:K.actionsWrapper},{children:[t.jsxs("div",Object.assign({style:K.buttonsGroup},{children:[(null===(m=d.primaryButton)||void 0===m?void 0:m.redirectionUrl)||d.redirectUrl?t.jsx("a",Object.assign({href:(null===(E=d.primaryButton)||void 0===E?void 0:E.redirectionUrl)||d.redirectUrl,target:((null===(M=d.primaryButton)||void 0===M?void 0:M.redirectionUrl)||d.redirectUrl).startsWith("http")?"_blank":"_self",rel:((null===(k=d.primaryButton)||void 0===k?void 0:k.redirectionUrl)||d.redirectUrl).startsWith("http")?"noopener noreferrer":void 0,onClick:z,style:K.exploreButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,K.exploreButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,K.exploreButton.base)},{children:(null===(U=d.primaryButton)||void 0===U?void 0:U.text)||d.buttonText||o.TEXT.DEFAULT_BUTTON_TEXT})):t.jsx(s.Button,{onClick:z,style:K.exploreButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,K.exploreButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,K.exploreButton.base),buttonText:(null===(P=d.primaryButton)||void 0===P?void 0:P.text)||d.buttonText||o.TEXT.DEFAULT_BUTTON_TEXT}),(null===(C=d.secondaryButton)||void 0===C?void 0:C.text)&&((null===(w=d.secondaryButton)||void 0===w?void 0:w.redirectionUrl)?t.jsx("a",Object.assign({href:d.secondaryButton.redirectionUrl,target:d.secondaryButton.redirectionUrl.startsWith("http")?"_blank":"_self",rel:d.secondaryButton.redirectionUrl.startsWith("http")?"noopener noreferrer":void 0,onClick:G,style:K.secondaryButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,K.secondaryButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,K.secondaryButton.base)},{children:d.secondaryButton.text})):t.jsx("button",Object.assign({onClick:G,style:K.secondaryButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,K.secondaryButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,K.secondaryButton.base)},{children:d.secondaryButton.text})))]})),g>1&&t.jsxs("div",Object.assign({style:K.navigationContainer},{children:[t.jsx("button",Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),b()},disabled:0===p,style:K.navigationButton(0===p).base,onMouseEnter:t=>{0!==p&&Object.assign(t.currentTarget.style,K.navigationButton(!1).hover)},onMouseLeave:t=>{0!==p&&Object.assign(t.currentTarget.style,K.navigationButton(!1).base)},"aria-label":"Previous feature"},{children:t.jsx(n.default,{style:{transform:"rotate(180deg)"}})})),t.jsx("button",Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),j()},disabled:p===g-1,style:K.navigationButton(p===g-1).base,onMouseEnter:t=>{p!==g-1&&Object.assign(t.currentTarget.style,K.navigationButton(!1).hover)},onMouseLeave:t=>{p!==g-1&&Object.assign(t.currentTarget.style,K.navigationButton(p===g-1).base)},"aria-label":"Next feature"},{children:t.jsx(n.default,{})}))]}))]}))]}))]}))]}))}))};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Popup dimension constants
|
|
3
|
-
*/
|
|
4
1
|
export declare const POPUP_DIMENSIONS: {
|
|
5
2
|
readonly MAJOR: {
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
readonly imageWidth:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly imagePlaceholderHeight: 258;
|
|
3
|
+
readonly height: 224;
|
|
4
|
+
readonly textAreaWidth: 398;
|
|
5
|
+
readonly imageWidth: {
|
|
6
|
+
readonly '16:9': 398;
|
|
7
|
+
readonly '1:1': 224;
|
|
8
|
+
readonly '4:3': 299;
|
|
9
|
+
};
|
|
14
10
|
};
|
|
15
11
|
readonly MINOR: {
|
|
16
12
|
readonly width: 519;
|
|
@@ -20,20 +16,41 @@ export declare const POPUP_DIMENSIONS: {
|
|
|
20
16
|
readonly badgeHeight: 27;
|
|
21
17
|
};
|
|
22
18
|
};
|
|
19
|
+
export declare const TEXT_LIMITS: {
|
|
20
|
+
readonly MAJOR: {
|
|
21
|
+
readonly TITLE: {
|
|
22
|
+
readonly MAX_LINES: 2;
|
|
23
|
+
};
|
|
24
|
+
readonly CONTENT: {
|
|
25
|
+
readonly MAX_LINES: 4;
|
|
26
|
+
readonly MAX_CHARS: 360;
|
|
27
|
+
readonly CHARS_PER_LINE: 72;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
23
31
|
/**
|
|
24
32
|
* Spacing constants
|
|
25
33
|
*/
|
|
26
34
|
export declare const SPACING: {
|
|
27
35
|
readonly MAJOR: {
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
readonly
|
|
34
|
-
readonly
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
36
|
+
readonly containerPadding: "16px";
|
|
37
|
+
readonly contentGap: "16px";
|
|
38
|
+
readonly titleBottom: "0px";
|
|
39
|
+
readonly listGap: "8px";
|
|
40
|
+
readonly actionsTop: "16px";
|
|
41
|
+
readonly headerMarginBottom: "8px";
|
|
42
|
+
readonly contentMarginLeft: "0px";
|
|
43
|
+
readonly skipButtonContainerMargin: "8px";
|
|
44
|
+
readonly contentMargin: "0 0 0 0px";
|
|
45
|
+
readonly imagePadding: "0px";
|
|
46
|
+
readonly titlePadding: "0 0 0px 0";
|
|
47
|
+
readonly buttonMarginTop: "0px";
|
|
48
|
+
readonly skipButtonPadding: "2px 4px";
|
|
49
|
+
readonly skipButtonTop: "8px";
|
|
50
|
+
readonly skipButtonRight: "8px";
|
|
51
|
+
readonly navigationBottom: "0px";
|
|
52
|
+
readonly navigationRight: "0px";
|
|
53
|
+
readonly navigationGap: "4px";
|
|
37
54
|
};
|
|
38
55
|
readonly MINOR: {
|
|
39
56
|
readonly imageMargin: "13px 10px 13px 10px";
|
|
@@ -43,14 +60,71 @@ export declare const SPACING: {
|
|
|
43
60
|
readonly actionsGap: "16px";
|
|
44
61
|
};
|
|
45
62
|
};
|
|
46
|
-
/**
|
|
47
|
-
* Border radius constants
|
|
48
|
-
*/
|
|
49
63
|
export declare const BORDER_RADIUS: {
|
|
50
|
-
readonly POPUP: "
|
|
51
|
-
readonly IMAGE: "
|
|
64
|
+
readonly POPUP: "8px";
|
|
65
|
+
readonly IMAGE: "6px";
|
|
52
66
|
readonly BUTTON: "4px";
|
|
53
67
|
readonly VIDEO_MODAL: "12px";
|
|
54
68
|
readonly CLOSE_BUTTON: "50%";
|
|
55
69
|
readonly SPOTLIGHT: "8px";
|
|
56
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Design tokens - Colors
|
|
73
|
+
*/
|
|
74
|
+
export declare const DESIGN_COLORS: {
|
|
75
|
+
readonly BACKGROUND: {
|
|
76
|
+
readonly SURFACE: "#212121";
|
|
77
|
+
readonly IMAGE: "#F0F0F0";
|
|
78
|
+
};
|
|
79
|
+
readonly TEXT: {
|
|
80
|
+
readonly PRIMARY: "#FFFFFF";
|
|
81
|
+
readonly SECONDARY: "rgba(255, 255, 255, 0.8)";
|
|
82
|
+
readonly TERTIARY: "#BDBDBD";
|
|
83
|
+
};
|
|
84
|
+
readonly BUTTON: {
|
|
85
|
+
readonly PRIMARY_TEXT: "#FEC02D";
|
|
86
|
+
readonly PRIMARY_BORDER: "#FEC02D";
|
|
87
|
+
};
|
|
88
|
+
readonly ICON: {
|
|
89
|
+
readonly DISABLED: "rgba(255, 255, 255, 0.3)";
|
|
90
|
+
readonly ENABLED: "#FFFFFF";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Design tokens - Typography
|
|
95
|
+
*/
|
|
96
|
+
export declare const DESIGN_TYPOGRAPHY: {
|
|
97
|
+
readonly SKIP_BUTTON: {
|
|
98
|
+
readonly fontSize: "14px";
|
|
99
|
+
readonly fontWeight: "600";
|
|
100
|
+
readonly lineHeight: "20px";
|
|
101
|
+
readonly fontFamily: "Inter, sans-serif";
|
|
102
|
+
};
|
|
103
|
+
readonly TITLE: {
|
|
104
|
+
readonly fontSize: "14px";
|
|
105
|
+
readonly fontWeight: "600";
|
|
106
|
+
readonly lineHeight: "20px";
|
|
107
|
+
readonly fontFamily: "Inter, sans-serif";
|
|
108
|
+
};
|
|
109
|
+
readonly CONTENT: {
|
|
110
|
+
readonly fontSize: "12px";
|
|
111
|
+
readonly fontWeight: "400";
|
|
112
|
+
readonly lineHeight: "16px";
|
|
113
|
+
readonly fontFamily: "Inter, sans-serif";
|
|
114
|
+
};
|
|
115
|
+
readonly BUTTON: {
|
|
116
|
+
readonly fontSize: "14px";
|
|
117
|
+
readonly fontWeight: "600";
|
|
118
|
+
readonly lineHeight: "20px";
|
|
119
|
+
readonly fontFamily: "Inter, sans-serif";
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Design tokens - Dimensions
|
|
124
|
+
*/
|
|
125
|
+
export declare const DESIGN_DIMENSIONS: {
|
|
126
|
+
readonly IMAGE_HEIGHT: 224;
|
|
127
|
+
readonly NAVIGATION_BUTTON_SIZE: 24;
|
|
128
|
+
readonly BUTTON_HEIGHT: 32;
|
|
129
|
+
readonly BUTTON_PADDING_HORIZONTAL: "12px";
|
|
130
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.BORDER_RADIUS={POPUP:"
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});exports.BORDER_RADIUS={POPUP:"8px",IMAGE:"6px",BUTTON:"4px",VIDEO_MODAL:"12px",CLOSE_BUTTON:"50%",SPOTLIGHT:"8px"},exports.DESIGN_COLORS={BACKGROUND:{SURFACE:"#212121",IMAGE:"#F0F0F0"},TEXT:{PRIMARY:"#FFFFFF",SECONDARY:"rgba(255, 255, 255, 0.8)",TERTIARY:"#BDBDBD"},BUTTON:{PRIMARY_TEXT:"#FEC02D",PRIMARY_BORDER:"#FEC02D"},ICON:{DISABLED:"rgba(255, 255, 255, 0.3)",ENABLED:"#FFFFFF"}},exports.DESIGN_DIMENSIONS={IMAGE_HEIGHT:224,NAVIGATION_BUTTON_SIZE:24,BUTTON_HEIGHT:32,BUTTON_PADDING_HORIZONTAL:"12px"},exports.DESIGN_TYPOGRAPHY={SKIP_BUTTON:{fontSize:"14px",fontWeight:"600",lineHeight:"20px",fontFamily:"Inter, sans-serif"},TITLE:{fontSize:"14px",fontWeight:"600",lineHeight:"20px",fontFamily:"Inter, sans-serif"},CONTENT:{fontSize:"12px",fontWeight:"400",lineHeight:"16px",fontFamily:"Inter, sans-serif"},BUTTON:{fontSize:"14px",fontWeight:"600",lineHeight:"20px",fontFamily:"Inter, sans-serif"}},exports.POPUP_DIMENSIONS={MAJOR:{height:224,textAreaWidth:398,imageWidth:{"16:9":398,"1:1":224,"4:3":299}},MINOR:{width:519,height:160,imageWidth:235,imageHeight:134,badgeHeight:27}},exports.SPACING={MAJOR:{containerPadding:"16px",contentGap:"16px",titleBottom:"0px",listGap:"8px",actionsTop:"16px",headerMarginBottom:"8px",contentMarginLeft:"0px",skipButtonContainerMargin:"8px",contentMargin:"0 0 0 0px",imagePadding:"0px",titlePadding:"0 0 0px 0",buttonMarginTop:"0px",skipButtonPadding:"2px 4px",skipButtonTop:"8px",skipButtonRight:"8px",navigationBottom:"0px",navigationRight:"0px",navigationGap:"4px"},MINOR:{imageMargin:"13px 10px 13px 10px",contentMargin:"13px 13px 13px 3px",actionsBottom:"13px",actionsRight:"10px",actionsGap:"16px"}};
|
|
@@ -27,7 +27,7 @@ export declare const minorStepStyles: {
|
|
|
27
27
|
tooltip: {
|
|
28
28
|
padding: number;
|
|
29
29
|
backgroundColor: string;
|
|
30
|
-
borderRadius: "
|
|
30
|
+
borderRadius: "8px";
|
|
31
31
|
border: string;
|
|
32
32
|
filter: string;
|
|
33
33
|
boxShadow: string;
|
|
@@ -101,7 +101,7 @@ export declare const getMinorJoyrideStyles: (isClosing: boolean) => {
|
|
|
101
101
|
tooltip: {
|
|
102
102
|
padding: number;
|
|
103
103
|
backgroundColor: string;
|
|
104
|
-
borderRadius: "
|
|
104
|
+
borderRadius: "8px";
|
|
105
105
|
border: string;
|
|
106
106
|
filter: string;
|
|
107
107
|
boxShadow: string;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
|
|
2
|
+
import { ButtonStyle } from '../types/feature.types';
|
|
3
|
+
export declare const getMajorPopupStyles: (startAnimation: boolean, transform: string, ratio?: '16:9' | '1:1' | '4:3', padding?: string, primaryButtonStyle?: ButtonStyle, secondaryButtonStyle?: ButtonStyle) => {
|
|
4
|
+
outerWrapper: CSSProperties;
|
|
3
5
|
container: CSSProperties;
|
|
6
|
+
headerContainer: CSSProperties;
|
|
7
|
+
contentWrapper: CSSProperties;
|
|
4
8
|
skipButton: {
|
|
5
9
|
base: CSSProperties;
|
|
6
10
|
hover: CSSProperties;
|
|
@@ -8,13 +12,22 @@ export declare const getMajorPopupStyles: (startAnimation: boolean, transform: s
|
|
|
8
12
|
imageContainer: CSSProperties;
|
|
9
13
|
image: CSSProperties;
|
|
10
14
|
imagePlaceholder: CSSProperties;
|
|
15
|
+
videoOverlay: CSSProperties;
|
|
16
|
+
playIcon: CSSProperties;
|
|
11
17
|
contentContainer: CSSProperties;
|
|
18
|
+
skipButtonContainer: CSSProperties;
|
|
12
19
|
title: CSSProperties;
|
|
13
20
|
content: CSSProperties;
|
|
21
|
+
actionsWrapper: CSSProperties;
|
|
22
|
+
buttonsGroup: CSSProperties;
|
|
14
23
|
exploreButton: {
|
|
15
24
|
base: CSSProperties;
|
|
16
25
|
hover: CSSProperties;
|
|
17
26
|
};
|
|
27
|
+
secondaryButton: {
|
|
28
|
+
base: CSSProperties;
|
|
29
|
+
hover: CSSProperties;
|
|
30
|
+
};
|
|
18
31
|
navigationContainer: CSSProperties;
|
|
19
32
|
navigationButton: (disabled: boolean) => {
|
|
20
33
|
base: CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../../constants/Theme.js"),e=require("../constants/animations.js"),n=require("../constants/dimensions.js");const o=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"16:9";return n.POPUP_DIMENSIONS.MAJOR.imageWidth[t]||n.POPUP_DIMENSIONS.MAJOR.imageWidth["16:9"]},i=(t,e)=>Object.assign(Object.assign(Object.assign(Object.assign({},t),(null==e?void 0:e.textColor)&&{color:e.textColor}),(null==e?void 0:e.backgroundColor)&&{backgroundColor:e.backgroundColor}),(null==e?void 0:e.borderColor)&&{borderColor:e.borderColor});exports.getMajorPopupStyles=function(r,a){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"16:9",O=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.SPACING.MAJOR.containerPadding,I=arguments.length>4?arguments[4]:void 0,d=arguments.length>5?arguments[5]:void 0;const N=o(l),S=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"16:9";const e=o(t);let i;switch(t){case"16:9":i=Math.round(e*(9/16));break;case"1:1":i=e;break;case"4:3":i=Math.round(e*(3/4));break;default:i=n.DESIGN_DIMENSIONS.IMAGE_HEIGHT}return Math.min(i,224)}(l),s=parseInt(O,10)||16,g=s+N+parseInt(n.SPACING.MAJOR.contentGap,10)+n.POPUP_DIMENSIONS.MAJOR.textAreaWidth+s,T=S+2*s;return{outerWrapper:{width:`${s+o("16:9")+parseInt(n.SPACING.MAJOR.contentGap,10)+n.POPUP_DIMENSIONS.MAJOR.textAreaWidth+s}px`,display:"flex",justifyContent:"flex-end",background:"transparent"},container:{width:`${g}px`,height:"auto",minHeight:`${T}px`,display:"flex",flexDirection:"column",backgroundColor:n.DESIGN_COLORS.BACKGROUND.SURFACE,borderRadius:n.BORDER_RADIUS.POPUP,overflow:"hidden",position:"relative",padding:O,transform:r?a:"scale(1)",opacity:r?0:1,transition:e.POPUP_TRANSITION,boxSizing:"border-box"},headerContainer:{width:"100%",display:"flex",justifyContent:"flex-end",marginBottom:n.SPACING.MAJOR.headerMarginBottom,position:"relative"},contentWrapper:{display:"flex",flex:1,gap:n.SPACING.MAJOR.contentGap},skipButton:{base:{background:"transparent",border:"none",color:n.DESIGN_COLORS.TEXT.TERTIARY,fontSize:n.DESIGN_TYPOGRAPHY.SKIP_BUTTON.fontSize,fontWeight:n.DESIGN_TYPOGRAPHY.SKIP_BUTTON.fontWeight,cursor:"pointer",padding:n.SPACING.MAJOR.skipButtonPadding,borderRadius:n.BORDER_RADIUS.BUTTON,fontFamily:n.DESIGN_TYPOGRAPHY.SKIP_BUTTON.fontFamily,lineHeight:n.DESIGN_TYPOGRAPHY.SKIP_BUTTON.lineHeight},hover:{backgroundColor:"rgba(255, 255, 255, 0.10)",color:t.BASE_COLORS.grayscale[700]}},imageContainer:{backgroundColor:n.DESIGN_COLORS.BACKGROUND.IMAGE,width:`${N}px`,height:`${S}px`,position:"relative",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:n.BORDER_RADIUS.BUTTON,overflow:"hidden",flexShrink:0},image:{width:"100%",height:"100%",objectFit:"cover"},imagePlaceholder:{color:t.BASE_COLORS.grayscale[500],fontSize:"14px",textAlign:"center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:t.BASE_COLORS.grayscale[800]},videoOverlay:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,transition:"opacity 0.2s"},playIcon:{width:"84px",height:"84px",color:"#060606ff"},contentContainer:{flex:"1 0 auto",width:`${n.POPUP_DIMENSIONS.MAJOR.textAreaWidth}px`,minWidth:`${n.POPUP_DIMENSIONS.MAJOR.textAreaWidth}px`,maxWidth:`${n.POPUP_DIMENSIONS.MAJOR.textAreaWidth}px`,display:"flex",flexDirection:"column",justifyContent:"flex-start",background:"transparent",gap:n.SPACING.MAJOR.listGap},skipButtonContainer:{width:"100%",display:"flex",justifyContent:"flex-end",marginBottom:n.SPACING.MAJOR.skipButtonContainerMargin},title:{fontSize:n.DESIGN_TYPOGRAPHY.TITLE.fontSize,fontWeight:n.DESIGN_TYPOGRAPHY.TITLE.fontWeight,marginBottom:n.SPACING.MAJOR.titleBottom,padding:0,color:n.DESIGN_COLORS.TEXT.PRIMARY,lineHeight:n.DESIGN_TYPOGRAPHY.TITLE.lineHeight,textAlign:"left",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",fontFamily:n.DESIGN_TYPOGRAPHY.TITLE.fontFamily},content:{fontSize:n.DESIGN_TYPOGRAPHY.CONTENT.fontSize,lineHeight:n.DESIGN_TYPOGRAPHY.CONTENT.lineHeight,color:n.DESIGN_COLORS.TEXT.SECONDARY,textAlign:"left",marginBottom:"auto",fontFamily:n.DESIGN_TYPOGRAPHY.CONTENT.fontFamily,fontWeight:n.DESIGN_TYPOGRAPHY.CONTENT.fontWeight},actionsWrapper:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"auto",gap:"8px",flexWrap:"nowrap"},buttonsGroup:{display:"flex",alignItems:"center",gap:n.SPACING.MAJOR.listGap},exploreButton:{base:i({backgroundColor:"transparent",border:`1px solid ${n.DESIGN_COLORS.BUTTON.PRIMARY_BORDER}`,color:n.DESIGN_COLORS.BUTTON.PRIMARY_TEXT,borderRadius:n.BORDER_RADIUS.BUTTON,fontSize:n.DESIGN_TYPOGRAPHY.BUTTON.fontSize,fontWeight:n.DESIGN_TYPOGRAPHY.BUTTON.fontWeight,cursor:"pointer",padding:`0 ${n.DESIGN_DIMENSIONS.BUTTON_PADDING_HORIZONTAL}`,height:`${n.DESIGN_DIMENSIONS.BUTTON_HEIGHT}px`,textAlign:"center",minWidth:"auto",textDecoration:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",fontFamily:n.DESIGN_TYPOGRAPHY.BUTTON.fontFamily,lineHeight:n.DESIGN_TYPOGRAPHY.BUTTON.lineHeight},I),hover:{backgroundColor:"rgba(255, 255, 255, 0.10)"}},secondaryButton:{base:i({backgroundColor:"transparent",color:n.DESIGN_COLORS.BUTTON.PRIMARY_TEXT,borderRadius:n.BORDER_RADIUS.BUTTON,fontSize:n.DESIGN_TYPOGRAPHY.BUTTON.fontSize,fontWeight:n.DESIGN_TYPOGRAPHY.BUTTON.fontWeight,cursor:"pointer",padding:`0 ${n.DESIGN_DIMENSIONS.BUTTON_PADDING_HORIZONTAL}`,height:`${n.DESIGN_DIMENSIONS.BUTTON_HEIGHT}px`,border:"none",boxShadow:"none",textAlign:"center",minWidth:"auto",textDecoration:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",fontFamily:n.DESIGN_TYPOGRAPHY.BUTTON.fontFamily,lineHeight:n.DESIGN_TYPOGRAPHY.BUTTON.lineHeight,transition:"none"},d),hover:{backgroundColor:(null==d?void 0:d.backgroundColor)?`${d.backgroundColor}cc`:"rgba(254, 192, 45, 0.1)"}},navigationContainer:{display:"flex",gap:n.SPACING.MAJOR.navigationGap,alignItems:"center"},navigationButton:t=>({base:{width:`${n.DESIGN_DIMENSIONS.NAVIGATION_BUTTON_SIZE}px`,height:`${n.DESIGN_DIMENSIONS.NAVIGATION_BUTTON_SIZE}px`,backgroundColor:"transparent",border:"none",color:t?n.DESIGN_COLORS.ICON.DISABLED:n.DESIGN_COLORS.ICON.ENABLED,fontSize:"16px",cursor:t?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:n.BORDER_RADIUS.BUTTON,padding:0},hover:{backgroundColor:"rgba(255, 255, 255, 0.10)"}})}};
|
|
@@ -5,6 +5,32 @@ export interface FirestoreTimestamp {
|
|
|
5
5
|
seconds: number;
|
|
6
6
|
nanoseconds?: number;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Button styling configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface ButtonStyle {
|
|
12
|
+
textColor?: string;
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
borderColor?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Primary button configuration
|
|
18
|
+
*/
|
|
19
|
+
export interface ButtonConfig {
|
|
20
|
+
text?: string;
|
|
21
|
+
action?: 'Play Video' | 'Open link';
|
|
22
|
+
redirectionUrl?: string;
|
|
23
|
+
style?: ButtonStyle;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Secondary button configuration
|
|
27
|
+
*/
|
|
28
|
+
export interface SecondaryButtonConfig {
|
|
29
|
+
text?: string;
|
|
30
|
+
action?: 'Open link' | 'Close popup' | '';
|
|
31
|
+
redirectionUrl?: string;
|
|
32
|
+
style?: ButtonStyle;
|
|
33
|
+
}
|
|
8
34
|
/**
|
|
9
35
|
* Feature announcement data model
|
|
10
36
|
*/
|
|
@@ -27,6 +53,9 @@ export interface FeatureAnnouncement {
|
|
|
27
53
|
archived?: boolean;
|
|
28
54
|
createdAt: FirestoreTimestamp;
|
|
29
55
|
expirationDate?: FirestoreTimestamp | string | Date;
|
|
56
|
+
primaryButton?: ButtonConfig;
|
|
57
|
+
secondaryButton?: SecondaryButtonConfig;
|
|
58
|
+
padding?: string;
|
|
30
59
|
}
|
|
31
60
|
/**
|
|
32
61
|
* Store feature progress tracking
|
|
@@ -39,3 +68,21 @@ export interface StoreFeatureProgress {
|
|
|
39
68
|
* Feature update types
|
|
40
69
|
*/
|
|
41
70
|
export type FeatureUpdateType = 'Major' | 'Minor';
|
|
71
|
+
/**
|
|
72
|
+
* Announcement event data (for tracking when announcement is shown)
|
|
73
|
+
*/
|
|
74
|
+
export interface AnnouncementEvent {
|
|
75
|
+
storeId: string;
|
|
76
|
+
announcementId: string;
|
|
77
|
+
announcementTitle: string;
|
|
78
|
+
imageUrl?: string;
|
|
79
|
+
videoUrl?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Announcement interaction event data (for tracking button clicks)
|
|
83
|
+
*/
|
|
84
|
+
export interface AnnouncementInteractionEvent extends AnnouncementEvent {
|
|
85
|
+
buttonClicked: 'Primary' | 'Secondary' | 'Skip';
|
|
86
|
+
buttonName: string;
|
|
87
|
+
buttonUrl?: string;
|
|
88
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FeatureAnnouncement } from './feature.types';
|
|
2
|
+
import { AnnouncementEvent, AnnouncementInteractionEvent, FeatureAnnouncement } from './feature.types';
|
|
3
3
|
import { FeatureAnnouncementRepository } from './repository.types';
|
|
4
4
|
import { RouterProps } from './router.types';
|
|
5
5
|
/**
|
|
@@ -14,17 +14,27 @@ export interface PopupBaseProps {
|
|
|
14
14
|
onPrevious: () => void;
|
|
15
15
|
onNext: () => void;
|
|
16
16
|
setIsClosing?: (isClosing: boolean) => void;
|
|
17
|
+
onSecondaryAction?: () => void;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Major update popup props
|
|
20
21
|
*/
|
|
21
22
|
export interface MajorUpdatePopupProps extends PopupBaseProps {
|
|
23
|
+
/**
|
|
24
|
+
* Aspect ratio for the image/video container
|
|
25
|
+
* @default '16:9'
|
|
26
|
+
*/
|
|
27
|
+
ratio?: '16:9' | '1:1' | '4:3';
|
|
28
|
+
/**
|
|
29
|
+
* Custom padding for the popup container
|
|
30
|
+
* @default '16px'
|
|
31
|
+
*/
|
|
32
|
+
padding?: string;
|
|
22
33
|
}
|
|
23
34
|
/**
|
|
24
35
|
* Minor update popup props
|
|
25
36
|
*/
|
|
26
|
-
export
|
|
27
|
-
}
|
|
37
|
+
export type MinorUpdatePopupProps = PopupBaseProps;
|
|
28
38
|
/**
|
|
29
39
|
* Video modal props
|
|
30
40
|
*/
|
|
@@ -40,4 +50,16 @@ export interface FeatureAnnouncementProviderProps extends FeatureAnnouncementRep
|
|
|
40
50
|
children: React.ReactNode;
|
|
41
51
|
module?: string;
|
|
42
52
|
router?: RouterProps;
|
|
53
|
+
/**
|
|
54
|
+
* Store ID for event tracking
|
|
55
|
+
*/
|
|
56
|
+
storeId?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Callback fired when a major announcement popup is shown
|
|
59
|
+
*/
|
|
60
|
+
onAnnouncementShown?: (event: AnnouncementEvent) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Callback fired when user interacts with an announcement (clicks a button)
|
|
63
|
+
*/
|
|
64
|
+
onAnnouncementInteracted?: (event: AnnouncementInteractionEvent) => void;
|
|
43
65
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ButtonConfig, SecondaryButtonConfig } from '../feature-announcements/types/feature.types';
|
|
3
|
+
export type { ButtonConfig, SecondaryButtonConfig };
|
|
2
4
|
export interface WhatsNewContent {
|
|
3
5
|
id: string;
|
|
4
6
|
title: string;
|
|
@@ -12,6 +14,10 @@ export interface WhatsNewContent {
|
|
|
12
14
|
createdAt: any;
|
|
13
15
|
module: string[];
|
|
14
16
|
visibility: boolean;
|
|
17
|
+
primaryButton?: ButtonConfig;
|
|
18
|
+
secondaryButton?: SecondaryButtonConfig;
|
|
19
|
+
featureUpdateType?: 'Major' | 'Minor';
|
|
20
|
+
displayImage?: string;
|
|
15
21
|
}
|
|
16
22
|
export interface WhatsNewProviderProps {
|
|
17
23
|
children: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("../../assets/icons/whatsNew.svg.js"),s=require("../../constants/Theme.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("react/jsx-runtime"),e=require("../../assets/icons/whatsNew.svg.js"),s=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:d=!1,tooltip:l="What's new",testId:h="whats-new-button",iconWidth:j=32,iconHeight:u=32,customIcon:x}=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(i.WhatsNewIconContainer,Object.assign({count:a},{children:t.jsxs("div",Object.assign({className:"main-icon-class "+(c?"icon-active":""),style:{color:c?s.COLORS.content.brand:s.COLORS.content.primary},onClick:r,"data-testid":h},{children:[t.jsx(n.Tooltip,Object.assign({body:l,placement:"bottom"},{children:t.jsx("div",{children:x?t.jsx(x,{width:j,height:u,color:c?s.COLORS.content.brand:s.COLORS.content.primary}):t.jsx(e.default,{width:j,height:u})})})),a>0&&t.jsx("div",Object.assign({className:"notification--count"},{children:t.jsx("div",Object.assign({className:"count--text"},{children:a}))}))]}))}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("date-fns"),s=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("date-fns"),s=require("react"),r=require("../../assets/icons/searchIcon.svg.js"),a=require("../../assets/icons/whatsNew.svg.js"),n=require("../../constants/Theme.js"),i=require("../button/Button.js"),o=require("../feature-announcements/VideoModal.js"),d=require("../searchBar/searchBar.js"),c=require("../side-modal/SideModal.js"),l=require("../TypographyStyle.js"),h=require("./WhatsNew.styles.js");exports.WhatsNewPanel=u=>{let{isOpen:j,onClose:m,content:x,isLoading:g=!1,title:p="What's new on BIK",searchPlaceholder:w="Search posts",emptyStateTitle:b="Nothing new!",emptyStateDescription:y="There are no new updates or features at the moment. Check back soon!",noResultsText:C="Sorry, no results found.",width:O="480px",onContentClick:f,renderCustomContent:v}=u;const[N,S]=s.useState(""),[M,q]=s.useState(!1),[B,L]=s.useState(""),T=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},k=s.useMemo((()=>{if(!N.trim())return x;const e=N.toLowerCase();return x.filter((t=>t.title.toLowerCase().includes(e)||t.body.toLowerCase().includes(e)||t.content&&t.content.toLowerCase().includes(e)))}),[x,N]),D=0===x.length,A=0===k.length;return j?e.jsxs(c.SideModal,Object.assign({width:O,onClose:m,header:"",headerCustomComponent:e.jsx(l.TitleMedium,Object.assign({color:n.COLORS.background.inverse},{children:p})),headerStyle:{background:n.COLORS.background.brandLight},hideFooter:!0},{children:[e.jsxs(h.MainContainer,{children:[e.jsx("div",Object.assign({className:"mt-8"},{children:e.jsx(d.SearchBar,{width:"100%",isEnabled:!D,onChange:e=>{S(e)},onEnter:e=>{S(e)},placeholder:w,variant:"default",searchValue:N,onClickCross:()=>{S("")}})})),e.jsx(h.WhatsNewWrapper,{children:D||A?e.jsxs("div",Object.assign({className:"no--data--found"},{children:[e.jsx("div",Object.assign({className:"icon--wrapper"},{children:D?e.jsx(a.default,{width:32,height:32}):e.jsx(r.default,{width:32,height:32})})),D?e.jsxs(e.Fragment,{children:[e.jsx(l.TitleRegular,{children:b}),e.jsx(l.BodyPrimary,Object.assign({color:n.COLORS.content.secondary,className:"text--align",style:{maxWidth:300}},{children:y}))]}):A?e.jsx(l.BodyPrimary,Object.assign({color:n.COLORS.content.secondary,className:"text--align",style:{maxWidth:300}},{children:C})):null]})):e.jsx("div",Object.assign({className:"scroller"},{children:k.map(((s,r)=>{var a;return v?v(s):e.jsxs(h.MainCardContainer,Object.assign({className:"padding--16 mb-mt-8"},{children:[e.jsx(h.BackgroundImageContainer,{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:[T(s)?e.jsx("div",Object.assign({className:"new--content--tag"},{children:e.jsx(l.Caption,{children:"New"})})):e.jsx(e.Fragment,{}),e.jsx(l.Caption,Object.assign({style:{color:n.COLORS.content.placeholder}},{children:s.createdAt?t.format(s.createdAt.toDate?s.createdAt.toDate():new Date(s.createdAt),"dd MMMM yyyy"):""}))]}))})),e.jsx("div",Object.assign({className:"mt--8"},{children:e.jsx(l.TitleSmall,{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(i.Button,{buttonText:(null===(a=s.primaryButton)||void 0===a?void 0:a.text)||s.buttonText||"Explore the feature",onClick:()=>(e=>{var t;if(e.productVideo)L(e.productVideo),q(!0);else{const s=(null===(t=e.primaryButton)||void 0===t?void 0:t.redirectionUrl)||e.redirectUrl;s&&window.open(s,"_blank","noopener,noreferrer")}f&&f(e)})(s),matchParentWidth:!0,size:"medium"})}))]}),`whats-new-${r}`)}))}))})]}),e.jsx(o.VideoModal,{isOpen:M,videoUrl:B,onClose:()=>{q(!1)}})]})):e.jsx(e.Fragment,{})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import*as t from"react";var e;function r(){return r=Object.assign?Object.assign.bind():function(t){for(var e=1;e<arguments.length;e++){var r=arguments[e];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(t[a]=r[a])}return t},r.apply(this,arguments)}var a=a=>t.createElement("svg",r({xmlns:"http://www.w3.org/2000/svg",fill:"none",viewBox:"0 0 40 40"},a),e||(e=t.createElement("path",{fill:"#fff",d:"M10 6.34c0-1.308 1.44-2.107 2.55-1.413l21.855 13.66a1.667 1.667 0 0 1 0 2.826L12.55 35.073c-1.11.694-2.55-.104-2.55-1.413V6.34Z"})));export{a as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{__awaiter as t}from"../../_virtual/_tslib.js";import{jsx as e,jsxs as o,Fragment as n}from"react/jsx-runtime";import{useState as r,useEffect as a,useCallback as i}from"react";import s,{ACTIONS as d}from"react-joyride";import"./constants/animations.js";import{SELECTORS as l}from"./constants/selectors.js";import{useFeatureAnnouncements as u}from"./hooks/useFeatureAnnouncements.js";import c from"./MajorUpdatePopup.js";import p from"./MinorUpdatePopup.js";import{VideoModal as f}from"./VideoModal.js";const b=b=>{let{children:m,fetchVisibleFeatures:g,getStoreFeatureProgress:h,fetchFeatureById:y,markFeatureAsViewedForStore:x,isFeatureApplicableToCurrentPage:C,module:S,router:k}=b;var T;const{majorUpdateFeatures:w,minorUpdateFeatures:v,isLoading:B,markFeatureAsViewed:I}=u({fetchVisibleFeatures:g,getStoreFeatureProgress:h,fetchFeatureById:y,markFeatureAsViewedForStore:x,isFeatureApplicableToCurrentPage:C,module:S,router:k}),[F,E]=r(null),[j,N]=r(null),[W,P]=r(!1),[M,O]=r([]),[q,V]=r(!1),[L,R]=r([]),[_,A]=r(!1),[U,$]=r(!1),[z,H]=r([]),[Z,D]=r(!1),[G,J]=r(!1),[K,Q]=r(!1),[X,Y]=r(""),[tt,et]=r(!1),[ot,nt]=r(!1),[rt,at]=r(!1),[it,st]=r(0),[dt,lt]=r(0),[ut,ct]=r(new Set);a((()=>{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()}}),[]),a((()=>{st((t=>t+1)),lt((t=>t+1)),nt(!1),at(!1),ct(new Set)}),[null==k?void 0:k.pathname]),a((()=>{if(!(w.length>0)||F||B||_||tt)0!==w.length||B||J(!0);else{J(!1),D(!1),P(!1),O([]),N(null),H([]);let t=0;const e=10,o=()=>{t++;document.querySelector('[data-testid="whats-new-button"]')?pt(w[0]):t<e?setTimeout(o,1e3):J(!0)};o()}}),[w,F,B,_,tt]),a((()=>{var t;const e=null===(t=null==k?void 0:k.query)||void 0===t?void 0:t.featureId;if(!e||B||0===v.length)return;const o=v.find((t=>t.id===e));if(!o||!o.featureTag)return;D(!0),$(!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];H(t),Ct(o,t),clearInterval(r)}else n>=25&&($(!1),clearInterval(r))}),200);return()=>{clearInterval(r)}}),[v,null===(T=null==k?void 0:k.query)||void 0===T?void 0:T.featureId,B]),a((()=>{var t;if(v.length>0&&!B&&!W&&!U&&!j&&!Z&&G&&!tt){let t=null,e=null,o=null,n=!1;const r=()=>{if(n||U||j||Z||!G)return;const r=v.filter((t=>{if(!t.featureTag||""===t.featureTag.trim())return!1;if(ut.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&&(H(r),Ct(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}W||n||U||j||Z||!G||!e||(o&&clearTimeout(o),o=setTimeout((()=>{n||U||j||Z||!G||r()}),200))})),e=()=>{W||n||U||j||Z||!G||(o&&clearTimeout(o),requestAnimationFrame((()=>{o=setTimeout((()=>{n||U||j||Z||!G||r()}),300)})))},t&&t.observe(document.body,{childList:!0,subtree:!0}),e&&window.addEventListener("scroll",e,{passive:!0}),r(),setTimeout((()=>{n||U||j||Z||!G||r()}),100),setTimeout((()=>{n||U||j||Z||!G||r()}),1e3),setTimeout((()=>{n||U||j||Z||!G||r()}),500),()=>{n=!0,t&&t.disconnect(),e&&window.removeEventListener("scroll",e),o&&clearTimeout(o)}}if(0===v.length||B){(null===(t=null==k?void 0:k.query)||void 0===t?void 0:t.featureId)&&j||(P(!1),O([]),N(null),H([]),D(!1))}}),[v,B,W,U,j,Z,G,I,tt]);const pt=t=>{E(t);const o=w.findIndex((e=>e.id===t.id)),n=w.length,r=[{target:l.WHATS_NEW_BUTTON,content:e(c,{feature:t,currentIndex:o,totalFeatures:n,onSkip:()=>ft(t),onExplore:()=>bt(t),onPrevious:()=>mt(t),onNext:()=>gt(t),setIsClosing:nt}),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"}}}];R(r),V(!0)},ft=i((t=>{(t||F)&&(A(!0),w.forEach((t=>{I(t.id)})),V(!1),E(null),R([]),J(!0),setTimeout((()=>{A(!1)}),500))}),[F,w,I]),bt=i((t=>{A(!0),I(t.id),t.productVideo&&(Y(t.productVideo),Q(!0),et(!0)),V(!1),E(null),R([]);w.findIndex((e=>e.id===t.id))===w.length-1&&J(!0),setTimeout((()=>{A(!1)}),500)}),[w,I]),mt=i((t=>{const o=t||F;if(!o)return;const n=w.findIndex((t=>t.id===o.id));if(n>0){const t=w[n-1];E(t);const o=n-1,r=w.length,a=[{target:'[data-testid="whats-new-button"]',content:e(c,{feature:t,currentIndex:o,totalFeatures:r,onSkip:()=>ft(t),onExplore:()=>bt(t),onPrevious:()=>mt(t),onNext:()=>gt(t),setIsClosing:nt}),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"}}}];R(a)}}),[F,w]),gt=i((t=>{const o=t||F;if(!o)return;const n=w.findIndex((t=>t.id===o.id));if(n<w.length-1){const t=w[n+1];E(t);const o=n+1,r=w.length,a=[{target:'[data-testid="whats-new-button"]',content:e(c,{feature:t,currentIndex:o,totalFeatures:r,onSkip:()=>ft(t),onExplore:()=>bt(t),onPrevious:()=>mt(t),onNext:()=>gt(t),setIsClosing:nt}),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"}}}];R(a)}else A(!0),I(o.id),V(!1),E(null),R([]),J(!0),setTimeout((()=>{A(!1)}),500)}),[F,w,I]),ht=()=>{if(w.length>0&&!F){document.querySelector('[data-testid="whats-new-button"]')&&pt(w[0])}};a((()=>(window.showMajorUpdatePopup=ht,()=>{delete window.showMajorUpdatePopup})),[w,F]);const yt=i((t=>{const{action:e}=t;e===d.CLOSE&&(F&&(A(!0),w.forEach((t=>{I(t.id)})),J(!0),setTimeout((()=>{A(!1)}),500)),V(!1),E(null),R([]))}),[F,w,I]),xt=i((t=>{const{action:e}=t;if(e===d.CLOSE){if(j){$(!0),I(j.id);z.findIndex((t=>t.id===j.id))===z.length-1&&D(!0),setTimeout((()=>{$(!1)}),500)}P(!1),N(null),O([])}}),[j,z,I]),Ct=(o,n)=>t(void 0,void 0,void 0,(function*(){N(o);const t=n||z,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(p,{feature:o,currentIndex:r,totalFeatures:a,onSkip:()=>St(o),onExplore:()=>kt(o),onPrevious:()=>Tt(o),onNext:()=>wt(o),setIsClosing:at}),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"}}}];O(d),P(!0)})),St=i((t=>{const e=t||j;if(e){$(!0),I(e.id),ct((t=>new Set(t).add(e.id))),P(!1),N(null),O([]);const t=z.find((t=>t.id!==e.id&&!ut.has(t.id)));setTimeout((()=>{$(!1),t?Ct(t,z):D(!0)}),500)}}),[j,z,I,ut]),kt=i((t=>{$(!0),I(t.id),ct((e=>new Set(e).add(t.id))),t.productVideo&&(Y(t.productVideo),Q(!0),et(!0)),P(!1),N(null),O([]);const e=z.find((e=>e.id!==t.id&&!ut.has(e.id)));setTimeout((()=>{$(!1),e&&!t.productVideo?Ct(e,z):e||D(!0)}),500)}),[z,I,ut]),Tt=i((o=>t(void 0,void 0,void 0,(function*(){const t=o||j;if(!t)return;const n=z.findIndex((e=>e.id===t.id));if(n>0){const t=z[n-1];N(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=z.length,s=[{target:o,content:e(p,{feature:t,currentIndex:a,totalFeatures:i,onSkip:()=>St(t),onExplore:()=>kt(t),onPrevious:()=>Tt(t),onNext:()=>wt(t),setIsClosing:at}),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"}}}];O(s)}}))),[j,z]),wt=i((o=>t(void 0,void 0,void 0,(function*(){const t=o||j;if(!t)return;const n=z.findIndex((e=>e.id===t.id));if(n<z.length-1){const t=z[n+1];N(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=z.length,s=[{target:o,content:e(p,{feature:t,currentIndex:a,totalFeatures:i,onSkip:()=>St(t),onExplore:()=>kt(t),onPrevious:()=>Tt(t),onNext:()=>wt(t),setIsClosing:at}),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"}}}];O(s)}else $(!0),D(!0),I(t.id),P(!1),N(null),O([]),setTimeout((()=>{$(!1)}),500)}))),[j,z,I]);return o(n,{children:[m,L.length>0&&e(s,{steps:L,run:q,continuous:!1,showProgress:!1,showSkipButton:!1,callback:yt,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,spotlightClicks:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:ot?"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-${it}`),M.length>0&&e(s,{steps:M,run:W,continuous:!1,showProgress:!1,showSkipButton:!1,callback:xt,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,scrollToFirstStep:!0,scrollOffset:120,disableScrolling:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:rt?"transparent":"#ffffff"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",borderRadius:"8px",boxShadow:rt?"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-${dt}`),e(f,{isOpen:K,videoUrl:X,onClose:()=>{Q(!1),Y(""),et(!1);const t=z.find((t=>!ut.has(t.id)));t?setTimeout((()=>{Ct(t,z)}),300):D(!0)}})]})};export{b as default};
|
|
1
|
+
import{__awaiter as t}from"../../_virtual/_tslib.js";import{jsx as e,jsxs as o,Fragment as n}from"react/jsx-runtime";import{useState as r,useEffect as a,useCallback as i}from"react";import s,{ACTIONS as d}from"react-joyride";import"./constants/animations.js";import{SELECTORS as l}from"./constants/selectors.js";import{useFeatureAnnouncements as u}from"./hooks/useFeatureAnnouncements.js";import c from"./MajorUpdatePopup.js";import p from"./MinorUpdatePopup.js";import{VideoModal as f}from"./VideoModal.js";const m=m=>{let{children:b,fetchVisibleFeatures:g,getStoreFeatureProgress:h,fetchFeatureById:y,markFeatureAsViewedForStore:x,isFeatureApplicableToCurrentPage:k,module:S,router:C,storeId:T,onAnnouncementShown:v,onAnnouncementInteracted:w}=m;var I;const{majorUpdateFeatures:B,minorUpdateFeatures:F,isLoading:E,markFeatureAsViewed:N}=u({fetchVisibleFeatures:g,getStoreFeatureProgress:h,fetchFeatureById:y,markFeatureAsViewedForStore:x,isFeatureApplicableToCurrentPage:k,module:S,router:C}),[j,P]=r(null),[U,W]=r(null),[V,M]=r(!1),[O,q]=r([]),[_,A]=r(!1),[L,R]=r([]),[$,z]=r(!1),[H,Z]=r(!1),[D,G]=r([]),[J,K]=r(!1),[Q,X]=r(!1),[Y,tt]=r(!1),[et,ot]=r(""),[nt,rt]=r(!1),[at,it]=r(!1),[st,dt]=r(!1),[lt,ut]=r(0),[ct,pt]=r(0),[ft,mt]=r(new Set);a((()=>{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\t.react-joyride__floater {\n\t\t\t\tright: 12px !important;\n\t\t\t\tleft: auto !important;\n\t\t\t}\n\t\t",()=>{const e=document.getElementById(t);e&&e.remove()}}),[]),a((()=>{ut((t=>t+1)),pt((t=>t+1)),it(!1),dt(!1),mt(new Set)}),[null==C?void 0:C.pathname]),a((()=>{if(!(B.length>0)||j||E||$||nt)0!==B.length||E||X(!0);else{X(!1),K(!1),M(!1),q([]),W(null),G([]);let t=0;const e=10,o=()=>{t++;document.querySelector('[data-testid="whats-new-button"]')?bt(B[0]):t<e?setTimeout(o,1e3):X(!0)};o()}}),[B,j,E,$,nt]),a((()=>{var t;const e=null===(t=null==C?void 0:C.query)||void 0===t?void 0:t.featureId;if(!e||E||0===F.length)return;const o=F.find((t=>t.id===e));if(!o||!o.featureTag)return;K(!0),Z(!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];G(t),Tt(o,t),clearInterval(r)}else n>=25&&(Z(!1),clearInterval(r))}),200);return()=>{clearInterval(r)}}),[F,null===(I=null==C?void 0:C.query)||void 0===I?void 0:I.featureId,E]),a((()=>{var t;if(F.length>0&&!E&&!V&&!H&&!U&&!J&&Q&&!nt){let t=null,e=null,o=null,n=!1;const r=()=>{if(n||H||U||J||!Q)return;const r=F.filter((t=>{if(!t.featureTag||""===t.featureTag.trim())return!1;if(ft.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&&(G(r),Tt(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}V||n||H||U||J||!Q||!e||(o&&clearTimeout(o),o=setTimeout((()=>{n||H||U||J||!Q||r()}),200))})),e=()=>{V||n||H||U||J||!Q||(o&&clearTimeout(o),requestAnimationFrame((()=>{o=setTimeout((()=>{n||H||U||J||!Q||r()}),300)})))},t&&t.observe(document.body,{childList:!0,subtree:!0}),e&&window.addEventListener("scroll",e,{passive:!0}),r(),setTimeout((()=>{n||H||U||J||!Q||r()}),100),setTimeout((()=>{n||H||U||J||!Q||r()}),1e3),setTimeout((()=>{n||H||U||J||!Q||r()}),500),()=>{n=!0,t&&t.disconnect(),e&&window.removeEventListener("scroll",e),o&&clearTimeout(o)}}if(0===F.length||E){(null===(t=null==C?void 0:C.query)||void 0===t?void 0:t.featureId)&&U||(M(!1),q([]),W(null),G([]),K(!1))}}),[F,E,V,H,U,J,Q,N,nt]);const bt=t=>{P(t);const o=B.findIndex((e=>e.id===t.id)),n=B.length,r=[{target:l.WHATS_NEW_BUTTON,content:e(c,{feature:t,currentIndex:o,totalFeatures:n,onSkip:()=>gt(t),onExplore:()=>ht(t),onPrevious:()=>yt(t),onNext:()=>xt(t),setIsClosing:it}),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"}}}];R(r),A(!0),v&&T&&v({storeId:T,announcementId:t.id,announcementTitle:t.title,imageUrl:t.displayImage||t.image,videoUrl:t.productVideo})},gt=i((t=>{const e=t||j;e&&(z(!0),B.forEach((t=>{N(t.id)})),A(!1),P(null),R([]),X(!0),w&&T&&w({storeId:T,announcementId:e.id,announcementTitle:e.title,imageUrl:e.displayImage||e.image,videoUrl:e.productVideo,buttonClicked:"Skip",buttonName:"Skip",buttonUrl:void 0}),setTimeout((()=>{z(!1)}),500))}),[j,B,N]),ht=i((t=>{z(!0),N(t.id),t.productVideo&&(ot(t.productVideo),tt(!0),rt(!0)),A(!1),P(null),R([]);B.findIndex((e=>e.id===t.id))===B.length-1&&X(!0),w&&T&&w({storeId:T,announcementId:t.id,announcementTitle:t.title,imageUrl:t.displayImage||t.image,videoUrl:t.productVideo,buttonClicked:"Primary",buttonName:t.buttonText||"Explore",buttonUrl:t.redirectUrl||t.productVideo}),setTimeout((()=>{z(!1)}),500)}),[B,N]),yt=i((t=>{const o=t||j;if(!o)return;const n=B.findIndex((t=>t.id===o.id));if(n>0){const t=B[n-1];P(t);const o=n-1,r=B.length,a=[{target:'[data-testid="whats-new-button"]',content:e(c,{feature:t,currentIndex:o,totalFeatures:r,onSkip:()=>gt(t),onExplore:()=>ht(t),onPrevious:()=>yt(t),onNext:()=>xt(t),setIsClosing:it}),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"}}}];R(a)}}),[j,B]),xt=i((t=>{const o=t||j;if(!o)return;const n=B.findIndex((t=>t.id===o.id));if(n<B.length-1){const t=B[n+1];P(t);const o=n+1,r=B.length,a=[{target:'[data-testid="whats-new-button"]',content:e(c,{feature:t,currentIndex:o,totalFeatures:r,onSkip:()=>gt(t),onExplore:()=>ht(t),onPrevious:()=>yt(t),onNext:()=>xt(t),setIsClosing:it}),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"}}}];R(a)}else z(!0),N(o.id),A(!1),P(null),R([]),X(!0),setTimeout((()=>{z(!1)}),500)}),[j,B,N]),kt=()=>{if(B.length>0&&!j){document.querySelector('[data-testid="whats-new-button"]')&&bt(B[0])}};a((()=>(window.showMajorUpdatePopup=kt,()=>{delete window.showMajorUpdatePopup})),[B,j]);const St=i((t=>{const{action:e}=t;e===d.CLOSE&&(j&&(z(!0),B.forEach((t=>{N(t.id)})),X(!0),setTimeout((()=>{z(!1)}),500)),A(!1),P(null),R([]))}),[j,B,N]),Ct=i((t=>{const{action:e}=t;if(e===d.CLOSE){if(U){Z(!0),N(U.id);D.findIndex((t=>t.id===U.id))===D.length-1&&K(!0),setTimeout((()=>{Z(!1)}),500)}M(!1),W(null),q([])}}),[U,D,N]),Tt=(o,n)=>t(void 0,void 0,void 0,(function*(){W(o);const t=n||D,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(p,{feature:o,currentIndex:r,totalFeatures:a,onSkip:()=>vt(o),onExplore:()=>wt(o),onPrevious:()=>It(o),onNext:()=>Bt(o),setIsClosing:dt}),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"}}}];q(d),M(!0)})),vt=i((t=>{const e=t||U;if(e){Z(!0),N(e.id),mt((t=>new Set(t).add(e.id))),M(!1),W(null),q([]);const t=D.find((t=>t.id!==e.id&&!ft.has(t.id)));setTimeout((()=>{Z(!1),t?Tt(t,D):K(!0)}),500)}}),[U,D,N,ft]),wt=i((t=>{Z(!0),N(t.id),mt((e=>new Set(e).add(t.id))),t.productVideo&&(ot(t.productVideo),tt(!0),rt(!0)),M(!1),W(null),q([]);const e=D.find((e=>e.id!==t.id&&!ft.has(e.id)));setTimeout((()=>{Z(!1),e&&!t.productVideo?Tt(e,D):e||K(!0)}),500)}),[D,N,ft]),It=i((o=>t(void 0,void 0,void 0,(function*(){const t=o||U;if(!t)return;const n=D.findIndex((e=>e.id===t.id));if(n>0){const t=D[n-1];W(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=D.length,s=[{target:o,content:e(p,{feature:t,currentIndex:a,totalFeatures:i,onSkip:()=>vt(t),onExplore:()=>wt(t),onPrevious:()=>It(t),onNext:()=>Bt(t),setIsClosing:dt}),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"}}}];q(s)}}))),[U,D]),Bt=i((o=>t(void 0,void 0,void 0,(function*(){const t=o||U;if(!t)return;const n=D.findIndex((e=>e.id===t.id));if(n<D.length-1){const t=D[n+1];W(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=D.length,s=[{target:o,content:e(p,{feature:t,currentIndex:a,totalFeatures:i,onSkip:()=>vt(t),onExplore:()=>wt(t),onPrevious:()=>It(t),onNext:()=>Bt(t),setIsClosing:dt}),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"}}}];q(s)}else Z(!0),K(!0),N(t.id),M(!1),W(null),q([]),setTimeout((()=>{Z(!1)}),500)}))),[U,D,N]);return o(n,{children:[b,L.length>0&&e(s,{steps:L,run:_,continuous:!1,showProgress:!1,showSkipButton:!1,callback:St,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,spotlightClicks:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:at?"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-${lt}`),O.length>0&&e(s,{steps:O,run:V,continuous:!1,showProgress:!1,showSkipButton:!1,callback:Ct,disableOverlayClose:!0,disableCloseOnEsc:!1,disableOverlay:!1,scrollToFirstStep:!0,scrollOffset:120,disableScrolling:!1,styles:{options:{primaryColor:"#007bff",zIndex:1e4,width:"auto",arrowColor:st?"transparent":"#ffffff"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",borderRadius:"8px",boxShadow:st?"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-${ct}`),e(f,{isOpen:Y,videoUrl:et,onClose:()=>{tt(!1),ot(""),rt(!1);const t=D.find((t=>!ft.has(t.id)));t?setTimeout((()=>{Tt(t,D)}),300):K(!0)}})]})};export{m as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{jsx as t,jsxs as e,Fragment as n}from"react/jsx-runtime";import{useState as r,useRef as o,useEffect as s}from"react";import i from"../../assets/icons/chevronRight2.svg.js";import a from"../../assets/icons/play.svg.js";import{Button as l}from"../button/Button.js";import{TEXT as c}from"./constants/index.js";import{getMajorPopupStyles as u}from"./styles/majorPopup.styles.js";import"../../constants/Theme.js";import"./constants/animations.js";import{decodeHTMLEntities as d}from"./utils/htmlHelpers.js";import{hideJoyrideArrow as p,calculateCloseTransform as g,executeAfterAnimation as y}from"./utils/animationHelpers.js";import{findWhatsNewButton as v}from"./utils/elementHelpers.js";const b=b=>{let{feature:h,currentIndex:m,totalFeatures:f,onSkip:j,onExplore:B,onPrevious:O,onNext:T,setIsClosing:x,onSecondaryAction:k,ratio:M="16:9",padding:E}=b;var U,P,C,L,_,W,w,D,I,H;const[A,S]=r(!1),[F,N]=r(!1),[R,V]=r(""),X=o(null),[z,G]=r(!1),[K,$]=r(!0),q=o(null),[J,Q]=r(M),Y=o(null);s((()=>{A&&N(!0)}),[A]);const Z=()=>{var t,e;const n=null===(t=h.primaryButton)||void 0===t?void 0:t.action;if("Play Video"===n)B();else if("Open link"===n){const t=(null===(e=h.primaryButton)||void 0===e?void 0:e.redirectionUrl)||h.redirectUrl;if(t){t.startsWith("http")?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}}else B();p(X.current);const r=v();if(r&&X.current){const t=g(X.current,r);V(t)}else V("scale(0)");null==x||x(!0),S(!0)},tt=t=>{var e,n;t.preventDefault(),t.stopPropagation();const r=null===(e=h.secondaryButton)||void 0===e?void 0:e.action;if("Open link"===r){const t=null===(n=h.secondaryButton)||void 0===n?void 0:n.redirectionUrl;if(t){t.startsWith("http")?window.open(t,"_blank","noopener,noreferrer"):window.location.href=t}}else"Close popup"!==r&&""!==r||k&&k();p(X.current);const o=v();if(o&&X.current){const t=g(X.current,o);V(t)}else V("scale(0)");null==x||x(!0),S(!0)},et=u(F,R,J,E||h.padding,null===(U=h.primaryButton)||void 0===U?void 0:U.style,null===(P=h.secondaryButton)||void 0===P?void 0:P.style);return t("div",Object.assign({style:et.outerWrapper},{children:e("div",Object.assign({ref:X,style:Object.assign(Object.assign({},et.container),{opacity:F?0:1,transition:"opacity 0.2s ease-in-out, transform 0.3s ease"})},{children:[t("style",{children:"\n\t\t\t\t[data-popup-content] ul {\n\t\t\t\t\tmargin: 0;\n\t\t\t\t\tpadding-left: 20px;\n\t\t\t\t\tlist-style-type: disc;\n\t\t\t\t}\n\t\t\t\t[data-popup-content] ul li {\n\t\t\t\t\tmargin-bottom: 8px;\n\t\t\t\t\tcolor: rgba(255, 255, 255, 0.8);\n\t\t\t\t\tfont-size: 12px;\n\t\t\t\t\tline-height: 16px;\n\t\t\t\t\tfont-family: Inter, sans-serif;\n\t\t\t\t}\n\t\t\t"}),e("div",Object.assign({style:et.contentWrapper},{children:[t("div",Object.assign({style:et.imageContainer},{children:h.productVideo?e(n,{children:[t("video",{ref:q,src:h.productVideo,style:et.image,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,controls:!0,"aria-label":`Product video for ${h.title}`,onLoadedMetadata:t=>{const e=t.currentTarget,n=e.videoWidth,r=e.videoHeight;if(n&&r){const t=n/r;Math.abs(t-16/9)<.1?Q("16:9"):Math.abs(t-1)<.1?Q("1:1"):Math.abs(t-4/3)<.1?Q("4:3"):Q(t>1.5?"16:9":t<.9?"4:3":"1:1")}}}),(z||K)&&t("div",Object.assign({style:et.videoOverlay,onClick:t=>{t.stopPropagation(),q.current&&(q.current.paused?(q.current.play(),G(!1),$(!1)):(q.current.pause(),G(!0),$(!0)))},role:"button",tabIndex:0,"aria-label":z?"Play video":"Pause video",onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||(t.preventDefault(),t.stopPropagation(),q.current&&(q.current.paused?(q.current.play(),G(!1),$(!1)):(q.current.pause(),G(!0),$(!0))))}},{children:t(a,{width:20,height:20})}))]}):h.displayImage?t("img",{ref:Y,src:h.displayImage,alt:h.title,style:et.image,onLoad:t=>{const e=t.currentTarget,n=e.naturalWidth,r=e.naturalHeight;if(n&&r){const t=n/r;Math.abs(t-16/9)<.1?Q("16:9"):Math.abs(t-1)<.1?Q("1:1"):Math.abs(t-4/3)<.1?Q("4:3"):Q(t>1.5?"16:9":t<.9?"4:3":"1:1")}},onError:t=>{h.image&&(t.target.src=h.image)}}):t("div",Object.assign({style:et.imagePlaceholder},{children:c.FEATURE_PREVIEW_PLACEHOLDER}))})),e("div",Object.assign({style:et.contentContainer},{children:[t("div",Object.assign({style:et.skipButtonContainer},{children:t("button",Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),(t=>{p(X.current);const e=v();if(e&&X.current){const t=g(X.current,e);V(t)}else V("scale(0)");null==x||x(!0),S(!0),y(t)})(j)},style:et.skipButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,et.skipButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,et.skipButton.base),"aria-label":"Skip feature announcement"},{children:"Skip"}))})),t("h3",Object.assign({style:et.title},{children:h.title})),t("div",{"data-popup-content":!0,style:et.content,dangerouslySetInnerHTML:{__html:d(h.content||h.body||"")}}),e("div",Object.assign({style:et.actionsWrapper},{children:[e("div",Object.assign({style:et.buttonsGroup},{children:[(null===(C=h.primaryButton)||void 0===C?void 0:C.redirectionUrl)||h.redirectUrl?t("a",Object.assign({href:(null===(L=h.primaryButton)||void 0===L?void 0:L.redirectionUrl)||h.redirectUrl,target:((null===(_=h.primaryButton)||void 0===_?void 0:_.redirectionUrl)||h.redirectUrl).startsWith("http")?"_blank":"_self",rel:((null===(W=h.primaryButton)||void 0===W?void 0:W.redirectionUrl)||h.redirectUrl).startsWith("http")?"noopener noreferrer":void 0,onClick:Z,style:et.exploreButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,et.exploreButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,et.exploreButton.base)},{children:(null===(w=h.primaryButton)||void 0===w?void 0:w.text)||h.buttonText||c.DEFAULT_BUTTON_TEXT})):t(l,{onClick:Z,style:et.exploreButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,et.exploreButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,et.exploreButton.base),buttonText:(null===(D=h.primaryButton)||void 0===D?void 0:D.text)||h.buttonText||c.DEFAULT_BUTTON_TEXT}),(null===(I=h.secondaryButton)||void 0===I?void 0:I.text)&&((null===(H=h.secondaryButton)||void 0===H?void 0:H.redirectionUrl)?t("a",Object.assign({href:h.secondaryButton.redirectionUrl,target:h.secondaryButton.redirectionUrl.startsWith("http")?"_blank":"_self",rel:h.secondaryButton.redirectionUrl.startsWith("http")?"noopener noreferrer":void 0,onClick:tt,style:et.secondaryButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,et.secondaryButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,et.secondaryButton.base)},{children:h.secondaryButton.text})):t("button",Object.assign({onClick:tt,style:et.secondaryButton.base,onMouseEnter:t=>Object.assign(t.currentTarget.style,et.secondaryButton.hover),onMouseLeave:t=>Object.assign(t.currentTarget.style,et.secondaryButton.base)},{children:h.secondaryButton.text})))]})),f>1&&e("div",Object.assign({style:et.navigationContainer},{children:[t("button",Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),O()},disabled:0===m,style:et.navigationButton(0===m).base,onMouseEnter:t=>{0!==m&&Object.assign(t.currentTarget.style,et.navigationButton(!1).hover)},onMouseLeave:t=>{0!==m&&Object.assign(t.currentTarget.style,et.navigationButton(!1).base)},"aria-label":"Previous feature"},{children:t(i,{style:{transform:"rotate(180deg)"}})})),t("button",Object.assign({onClick:t=>{t.preventDefault(),t.stopPropagation(),T()},disabled:m===f-1,style:et.navigationButton(m===f-1).base,onMouseEnter:t=>{m!==f-1&&Object.assign(t.currentTarget.style,et.navigationButton(!1).hover)},onMouseLeave:t=>{m!==f-1&&Object.assign(t.currentTarget.style,et.navigationButton(m===f-1).base)},"aria-label":"Next feature"},{children:t(i,{})}))]}))]}))]}))]}))]}))}))};export{b as default};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Popup dimension constants
|
|
3
|
-
*/
|
|
4
1
|
export declare const POPUP_DIMENSIONS: {
|
|
5
2
|
readonly MAJOR: {
|
|
6
|
-
readonly
|
|
7
|
-
readonly
|
|
8
|
-
readonly imageWidth:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
readonly imagePlaceholderHeight: 258;
|
|
3
|
+
readonly height: 224;
|
|
4
|
+
readonly textAreaWidth: 398;
|
|
5
|
+
readonly imageWidth: {
|
|
6
|
+
readonly '16:9': 398;
|
|
7
|
+
readonly '1:1': 224;
|
|
8
|
+
readonly '4:3': 299;
|
|
9
|
+
};
|
|
14
10
|
};
|
|
15
11
|
readonly MINOR: {
|
|
16
12
|
readonly width: 519;
|
|
@@ -20,20 +16,41 @@ export declare const POPUP_DIMENSIONS: {
|
|
|
20
16
|
readonly badgeHeight: 27;
|
|
21
17
|
};
|
|
22
18
|
};
|
|
19
|
+
export declare const TEXT_LIMITS: {
|
|
20
|
+
readonly MAJOR: {
|
|
21
|
+
readonly TITLE: {
|
|
22
|
+
readonly MAX_LINES: 2;
|
|
23
|
+
};
|
|
24
|
+
readonly CONTENT: {
|
|
25
|
+
readonly MAX_LINES: 4;
|
|
26
|
+
readonly MAX_CHARS: 360;
|
|
27
|
+
readonly CHARS_PER_LINE: 72;
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
};
|
|
23
31
|
/**
|
|
24
32
|
* Spacing constants
|
|
25
33
|
*/
|
|
26
34
|
export declare const SPACING: {
|
|
27
35
|
readonly MAJOR: {
|
|
28
|
-
readonly
|
|
29
|
-
readonly
|
|
30
|
-
readonly
|
|
31
|
-
readonly
|
|
32
|
-
readonly
|
|
33
|
-
readonly
|
|
34
|
-
readonly
|
|
35
|
-
readonly
|
|
36
|
-
readonly
|
|
36
|
+
readonly containerPadding: "16px";
|
|
37
|
+
readonly contentGap: "16px";
|
|
38
|
+
readonly titleBottom: "0px";
|
|
39
|
+
readonly listGap: "8px";
|
|
40
|
+
readonly actionsTop: "16px";
|
|
41
|
+
readonly headerMarginBottom: "8px";
|
|
42
|
+
readonly contentMarginLeft: "0px";
|
|
43
|
+
readonly skipButtonContainerMargin: "8px";
|
|
44
|
+
readonly contentMargin: "0 0 0 0px";
|
|
45
|
+
readonly imagePadding: "0px";
|
|
46
|
+
readonly titlePadding: "0 0 0px 0";
|
|
47
|
+
readonly buttonMarginTop: "0px";
|
|
48
|
+
readonly skipButtonPadding: "2px 4px";
|
|
49
|
+
readonly skipButtonTop: "8px";
|
|
50
|
+
readonly skipButtonRight: "8px";
|
|
51
|
+
readonly navigationBottom: "0px";
|
|
52
|
+
readonly navigationRight: "0px";
|
|
53
|
+
readonly navigationGap: "4px";
|
|
37
54
|
};
|
|
38
55
|
readonly MINOR: {
|
|
39
56
|
readonly imageMargin: "13px 10px 13px 10px";
|
|
@@ -43,14 +60,71 @@ export declare const SPACING: {
|
|
|
43
60
|
readonly actionsGap: "16px";
|
|
44
61
|
};
|
|
45
62
|
};
|
|
46
|
-
/**
|
|
47
|
-
* Border radius constants
|
|
48
|
-
*/
|
|
49
63
|
export declare const BORDER_RADIUS: {
|
|
50
|
-
readonly POPUP: "
|
|
51
|
-
readonly IMAGE: "
|
|
64
|
+
readonly POPUP: "8px";
|
|
65
|
+
readonly IMAGE: "6px";
|
|
52
66
|
readonly BUTTON: "4px";
|
|
53
67
|
readonly VIDEO_MODAL: "12px";
|
|
54
68
|
readonly CLOSE_BUTTON: "50%";
|
|
55
69
|
readonly SPOTLIGHT: "8px";
|
|
56
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* Design tokens - Colors
|
|
73
|
+
*/
|
|
74
|
+
export declare const DESIGN_COLORS: {
|
|
75
|
+
readonly BACKGROUND: {
|
|
76
|
+
readonly SURFACE: "#212121";
|
|
77
|
+
readonly IMAGE: "#F0F0F0";
|
|
78
|
+
};
|
|
79
|
+
readonly TEXT: {
|
|
80
|
+
readonly PRIMARY: "#FFFFFF";
|
|
81
|
+
readonly SECONDARY: "rgba(255, 255, 255, 0.8)";
|
|
82
|
+
readonly TERTIARY: "#BDBDBD";
|
|
83
|
+
};
|
|
84
|
+
readonly BUTTON: {
|
|
85
|
+
readonly PRIMARY_TEXT: "#FEC02D";
|
|
86
|
+
readonly PRIMARY_BORDER: "#FEC02D";
|
|
87
|
+
};
|
|
88
|
+
readonly ICON: {
|
|
89
|
+
readonly DISABLED: "rgba(255, 255, 255, 0.3)";
|
|
90
|
+
readonly ENABLED: "#FFFFFF";
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Design tokens - Typography
|
|
95
|
+
*/
|
|
96
|
+
export declare const DESIGN_TYPOGRAPHY: {
|
|
97
|
+
readonly SKIP_BUTTON: {
|
|
98
|
+
readonly fontSize: "14px";
|
|
99
|
+
readonly fontWeight: "600";
|
|
100
|
+
readonly lineHeight: "20px";
|
|
101
|
+
readonly fontFamily: "Inter, sans-serif";
|
|
102
|
+
};
|
|
103
|
+
readonly TITLE: {
|
|
104
|
+
readonly fontSize: "14px";
|
|
105
|
+
readonly fontWeight: "600";
|
|
106
|
+
readonly lineHeight: "20px";
|
|
107
|
+
readonly fontFamily: "Inter, sans-serif";
|
|
108
|
+
};
|
|
109
|
+
readonly CONTENT: {
|
|
110
|
+
readonly fontSize: "12px";
|
|
111
|
+
readonly fontWeight: "400";
|
|
112
|
+
readonly lineHeight: "16px";
|
|
113
|
+
readonly fontFamily: "Inter, sans-serif";
|
|
114
|
+
};
|
|
115
|
+
readonly BUTTON: {
|
|
116
|
+
readonly fontSize: "14px";
|
|
117
|
+
readonly fontWeight: "600";
|
|
118
|
+
readonly lineHeight: "20px";
|
|
119
|
+
readonly fontFamily: "Inter, sans-serif";
|
|
120
|
+
};
|
|
121
|
+
};
|
|
122
|
+
/**
|
|
123
|
+
* Design tokens - Dimensions
|
|
124
|
+
*/
|
|
125
|
+
export declare const DESIGN_DIMENSIONS: {
|
|
126
|
+
readonly IMAGE_HEIGHT: 224;
|
|
127
|
+
readonly NAVIGATION_BUTTON_SIZE: 24;
|
|
128
|
+
readonly BUTTON_HEIGHT: 32;
|
|
129
|
+
readonly BUTTON_PADDING_HORIZONTAL: "12px";
|
|
130
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const t={MAJOR:{height:224,textAreaWidth:398,imageWidth:{"16:9":398,"1:1":224,"4:3":299}},MINOR:{width:519,height:160,imageWidth:235,imageHeight:134,badgeHeight:27}},i={MAJOR:{containerPadding:"16px",contentGap:"16px",titleBottom:"0px",listGap:"8px",actionsTop:"16px",headerMarginBottom:"8px",contentMarginLeft:"0px",skipButtonContainerMargin:"8px",contentMargin:"0 0 0 0px",imagePadding:"0px",titlePadding:"0 0 0px 0",buttonMarginTop:"0px",skipButtonPadding:"2px 4px",skipButtonTop:"8px",skipButtonRight:"8px",navigationBottom:"0px",navigationRight:"0px",navigationGap:"4px"},MINOR:{imageMargin:"13px 10px 13px 10px",contentMargin:"13px 13px 13px 3px",actionsBottom:"13px",actionsRight:"10px",actionsGap:"16px"}},n={POPUP:"8px",IMAGE:"6px",BUTTON:"4px",VIDEO_MODAL:"12px",CLOSE_BUTTON:"50%",SPOTLIGHT:"8px"},p={BACKGROUND:{SURFACE:"#212121",IMAGE:"#F0F0F0"},TEXT:{PRIMARY:"#FFFFFF",SECONDARY:"rgba(255, 255, 255, 0.8)",TERTIARY:"#BDBDBD"},BUTTON:{PRIMARY_TEXT:"#FEC02D",PRIMARY_BORDER:"#FEC02D"},ICON:{DISABLED:"rgba(255, 255, 255, 0.3)",ENABLED:"#FFFFFF"}},e={SKIP_BUTTON:{fontSize:"14px",fontWeight:"600",lineHeight:"20px",fontFamily:"Inter, sans-serif"},TITLE:{fontSize:"14px",fontWeight:"600",lineHeight:"20px",fontFamily:"Inter, sans-serif"},CONTENT:{fontSize:"12px",fontWeight:"400",lineHeight:"16px",fontFamily:"Inter, sans-serif"},BUTTON:{fontSize:"14px",fontWeight:"600",lineHeight:"20px",fontFamily:"Inter, sans-serif"}},x={IMAGE_HEIGHT:224,NAVIGATION_BUTTON_SIZE:24,BUTTON_HEIGHT:32,BUTTON_PADDING_HORIZONTAL:"12px"};export{n as BORDER_RADIUS,p as DESIGN_COLORS,x as DESIGN_DIMENSIONS,e as DESIGN_TYPOGRAPHY,t as POPUP_DIMENSIONS,i as SPACING};
|
|
@@ -27,7 +27,7 @@ export declare const minorStepStyles: {
|
|
|
27
27
|
tooltip: {
|
|
28
28
|
padding: number;
|
|
29
29
|
backgroundColor: string;
|
|
30
|
-
borderRadius: "
|
|
30
|
+
borderRadius: "8px";
|
|
31
31
|
border: string;
|
|
32
32
|
filter: string;
|
|
33
33
|
boxShadow: string;
|
|
@@ -101,7 +101,7 @@ export declare const getMinorJoyrideStyles: (isClosing: boolean) => {
|
|
|
101
101
|
tooltip: {
|
|
102
102
|
padding: number;
|
|
103
103
|
backgroundColor: string;
|
|
104
|
-
borderRadius: "
|
|
104
|
+
borderRadius: "8px";
|
|
105
105
|
border: string;
|
|
106
106
|
filter: string;
|
|
107
107
|
boxShadow: string;
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
import { CSSProperties } from 'react';
|
|
2
|
-
|
|
2
|
+
import { ButtonStyle } from '../types/feature.types';
|
|
3
|
+
export declare const getMajorPopupStyles: (startAnimation: boolean, transform: string, ratio?: '16:9' | '1:1' | '4:3', padding?: string, primaryButtonStyle?: ButtonStyle, secondaryButtonStyle?: ButtonStyle) => {
|
|
4
|
+
outerWrapper: CSSProperties;
|
|
3
5
|
container: CSSProperties;
|
|
6
|
+
headerContainer: CSSProperties;
|
|
7
|
+
contentWrapper: CSSProperties;
|
|
4
8
|
skipButton: {
|
|
5
9
|
base: CSSProperties;
|
|
6
10
|
hover: CSSProperties;
|
|
@@ -8,13 +12,22 @@ export declare const getMajorPopupStyles: (startAnimation: boolean, transform: s
|
|
|
8
12
|
imageContainer: CSSProperties;
|
|
9
13
|
image: CSSProperties;
|
|
10
14
|
imagePlaceholder: CSSProperties;
|
|
15
|
+
videoOverlay: CSSProperties;
|
|
16
|
+
playIcon: CSSProperties;
|
|
11
17
|
contentContainer: CSSProperties;
|
|
18
|
+
skipButtonContainer: CSSProperties;
|
|
12
19
|
title: CSSProperties;
|
|
13
20
|
content: CSSProperties;
|
|
21
|
+
actionsWrapper: CSSProperties;
|
|
22
|
+
buttonsGroup: CSSProperties;
|
|
14
23
|
exploreButton: {
|
|
15
24
|
base: CSSProperties;
|
|
16
25
|
hover: CSSProperties;
|
|
17
26
|
};
|
|
27
|
+
secondaryButton: {
|
|
28
|
+
base: CSSProperties;
|
|
29
|
+
hover: CSSProperties;
|
|
30
|
+
};
|
|
18
31
|
navigationContainer: CSSProperties;
|
|
19
32
|
navigationButton: (disabled: boolean) => {
|
|
20
33
|
base: CSSProperties;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BASE_COLORS as t}from"../../../constants/Theme.js";import{POPUP_TRANSITION as e}from"../constants/animations.js";import{
|
|
1
|
+
import{BASE_COLORS as t}from"../../../constants/Theme.js";import{POPUP_TRANSITION as e}from"../constants/animations.js";import{SPACING as n,POPUP_DIMENSIONS as o,DESIGN_COLORS as i,BORDER_RADIUS as r,DESIGN_TYPOGRAPHY as a,DESIGN_DIMENSIONS as l}from"../constants/dimensions.js";const d=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"16:9";return o.MAJOR.imageWidth[t]||o.MAJOR.imageWidth["16:9"]},s=(t,e)=>Object.assign(Object.assign(Object.assign(Object.assign({},t),(null==e?void 0:e.textColor)&&{color:e.textColor}),(null==e?void 0:e.backgroundColor)&&{backgroundColor:e.backgroundColor}),(null==e?void 0:e.borderColor)&&{borderColor:e.borderColor}),g=function(g,c){let p=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"16:9",T=arguments.length>3&&void 0!==arguments[3]?arguments[3]:n.MAJOR.containerPadding,f=arguments.length>4?arguments[4]:void 0,h=arguments.length>5?arguments[5]:void 0;const u=d(p),O=function(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"16:9";const e=d(t);let n;switch(t){case"16:9":n=Math.round(e*(9/16));break;case"1:1":n=e;break;case"4:3":n=Math.round(e*(3/4));break;default:n=l.IMAGE_HEIGHT}return Math.min(n,224)}(p),x=parseInt(T,10)||16,b=x+u+parseInt(n.MAJOR.contentGap,10)+o.MAJOR.textAreaWidth+x,m=O+2*x;return{outerWrapper:{width:`${x+d("16:9")+parseInt(n.MAJOR.contentGap,10)+o.MAJOR.textAreaWidth+x}px`,display:"flex",justifyContent:"flex-end",background:"transparent"},container:{width:`${b}px`,height:"auto",minHeight:`${m}px`,display:"flex",flexDirection:"column",backgroundColor:i.BACKGROUND.SURFACE,borderRadius:r.POPUP,overflow:"hidden",position:"relative",padding:T,transform:g?c:"scale(1)",opacity:g?0:1,transition:e,boxSizing:"border-box"},headerContainer:{width:"100%",display:"flex",justifyContent:"flex-end",marginBottom:n.MAJOR.headerMarginBottom,position:"relative"},contentWrapper:{display:"flex",flex:1,gap:n.MAJOR.contentGap},skipButton:{base:{background:"transparent",border:"none",color:i.TEXT.TERTIARY,fontSize:a.SKIP_BUTTON.fontSize,fontWeight:a.SKIP_BUTTON.fontWeight,cursor:"pointer",padding:n.MAJOR.skipButtonPadding,borderRadius:r.BUTTON,fontFamily:a.SKIP_BUTTON.fontFamily,lineHeight:a.SKIP_BUTTON.lineHeight},hover:{backgroundColor:"rgba(255, 255, 255, 0.10)",color:t.grayscale[700]}},imageContainer:{backgroundColor:i.BACKGROUND.IMAGE,width:`${u}px`,height:`${O}px`,position:"relative",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:r.BUTTON,overflow:"hidden",flexShrink:0},image:{width:"100%",height:"100%",objectFit:"cover"},imagePlaceholder:{color:t.grayscale[500],fontSize:"14px",textAlign:"center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:t.grayscale[800]},videoOverlay:{position:"absolute",top:0,left:0,width:"100%",height:"100%",backgroundColor:"rgba(0,0,0,0.4)",display:"flex",alignItems:"center",justifyContent:"center",cursor:"pointer",zIndex:10,transition:"opacity 0.2s"},playIcon:{width:"84px",height:"84px",color:"#060606ff"},contentContainer:{flex:"1 0 auto",width:`${o.MAJOR.textAreaWidth}px`,minWidth:`${o.MAJOR.textAreaWidth}px`,maxWidth:`${o.MAJOR.textAreaWidth}px`,display:"flex",flexDirection:"column",justifyContent:"flex-start",background:"transparent",gap:n.MAJOR.listGap},skipButtonContainer:{width:"100%",display:"flex",justifyContent:"flex-end",marginBottom:n.MAJOR.skipButtonContainerMargin},title:{fontSize:a.TITLE.fontSize,fontWeight:a.TITLE.fontWeight,marginBottom:n.MAJOR.titleBottom,padding:0,color:i.TEXT.PRIMARY,lineHeight:a.TITLE.lineHeight,textAlign:"left",display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden",fontFamily:a.TITLE.fontFamily},content:{fontSize:a.CONTENT.fontSize,lineHeight:a.CONTENT.lineHeight,color:i.TEXT.SECONDARY,textAlign:"left",marginBottom:"auto",fontFamily:a.CONTENT.fontFamily,fontWeight:a.CONTENT.fontWeight},actionsWrapper:{display:"flex",alignItems:"center",justifyContent:"space-between",marginTop:"auto",gap:"8px",flexWrap:"nowrap"},buttonsGroup:{display:"flex",alignItems:"center",gap:n.MAJOR.listGap},exploreButton:{base:s({backgroundColor:"transparent",border:`1px solid ${i.BUTTON.PRIMARY_BORDER}`,color:i.BUTTON.PRIMARY_TEXT,borderRadius:r.BUTTON,fontSize:a.BUTTON.fontSize,fontWeight:a.BUTTON.fontWeight,cursor:"pointer",padding:`0 ${l.BUTTON_PADDING_HORIZONTAL}`,height:`${l.BUTTON_HEIGHT}px`,textAlign:"center",minWidth:"auto",textDecoration:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",fontFamily:a.BUTTON.fontFamily,lineHeight:a.BUTTON.lineHeight},f),hover:{backgroundColor:"rgba(255, 255, 255, 0.10)"}},secondaryButton:{base:s({backgroundColor:"transparent",color:i.BUTTON.PRIMARY_TEXT,borderRadius:r.BUTTON,fontSize:a.BUTTON.fontSize,fontWeight:a.BUTTON.fontWeight,cursor:"pointer",padding:`0 ${l.BUTTON_PADDING_HORIZONTAL}`,height:`${l.BUTTON_HEIGHT}px`,border:"none",boxShadow:"none",textAlign:"center",minWidth:"auto",textDecoration:"none",display:"inline-flex",alignItems:"center",justifyContent:"center",fontFamily:a.BUTTON.fontFamily,lineHeight:a.BUTTON.lineHeight,transition:"none"},h),hover:{backgroundColor:(null==h?void 0:h.backgroundColor)?`${h.backgroundColor}cc`:"rgba(254, 192, 45, 0.1)"}},navigationContainer:{display:"flex",gap:n.MAJOR.navigationGap,alignItems:"center"},navigationButton:t=>({base:{width:`${l.NAVIGATION_BUTTON_SIZE}px`,height:`${l.NAVIGATION_BUTTON_SIZE}px`,backgroundColor:"transparent",border:"none",color:t?i.ICON.DISABLED:i.ICON.ENABLED,fontSize:"16px",cursor:t?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",borderRadius:r.BUTTON,padding:0},hover:{backgroundColor:"rgba(255, 255, 255, 0.10)"}})}};export{g as getMajorPopupStyles};
|
|
@@ -5,6 +5,32 @@ export interface FirestoreTimestamp {
|
|
|
5
5
|
seconds: number;
|
|
6
6
|
nanoseconds?: number;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* Button styling configuration
|
|
10
|
+
*/
|
|
11
|
+
export interface ButtonStyle {
|
|
12
|
+
textColor?: string;
|
|
13
|
+
backgroundColor?: string;
|
|
14
|
+
borderColor?: string;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Primary button configuration
|
|
18
|
+
*/
|
|
19
|
+
export interface ButtonConfig {
|
|
20
|
+
text?: string;
|
|
21
|
+
action?: 'Play Video' | 'Open link';
|
|
22
|
+
redirectionUrl?: string;
|
|
23
|
+
style?: ButtonStyle;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Secondary button configuration
|
|
27
|
+
*/
|
|
28
|
+
export interface SecondaryButtonConfig {
|
|
29
|
+
text?: string;
|
|
30
|
+
action?: 'Open link' | 'Close popup' | '';
|
|
31
|
+
redirectionUrl?: string;
|
|
32
|
+
style?: ButtonStyle;
|
|
33
|
+
}
|
|
8
34
|
/**
|
|
9
35
|
* Feature announcement data model
|
|
10
36
|
*/
|
|
@@ -27,6 +53,9 @@ export interface FeatureAnnouncement {
|
|
|
27
53
|
archived?: boolean;
|
|
28
54
|
createdAt: FirestoreTimestamp;
|
|
29
55
|
expirationDate?: FirestoreTimestamp | string | Date;
|
|
56
|
+
primaryButton?: ButtonConfig;
|
|
57
|
+
secondaryButton?: SecondaryButtonConfig;
|
|
58
|
+
padding?: string;
|
|
30
59
|
}
|
|
31
60
|
/**
|
|
32
61
|
* Store feature progress tracking
|
|
@@ -39,3 +68,21 @@ export interface StoreFeatureProgress {
|
|
|
39
68
|
* Feature update types
|
|
40
69
|
*/
|
|
41
70
|
export type FeatureUpdateType = 'Major' | 'Minor';
|
|
71
|
+
/**
|
|
72
|
+
* Announcement event data (for tracking when announcement is shown)
|
|
73
|
+
*/
|
|
74
|
+
export interface AnnouncementEvent {
|
|
75
|
+
storeId: string;
|
|
76
|
+
announcementId: string;
|
|
77
|
+
announcementTitle: string;
|
|
78
|
+
imageUrl?: string;
|
|
79
|
+
videoUrl?: string;
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Announcement interaction event data (for tracking button clicks)
|
|
83
|
+
*/
|
|
84
|
+
export interface AnnouncementInteractionEvent extends AnnouncementEvent {
|
|
85
|
+
buttonClicked: 'Primary' | 'Secondary' | 'Skip';
|
|
86
|
+
buttonName: string;
|
|
87
|
+
buttonUrl?: string;
|
|
88
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { FeatureAnnouncement } from './feature.types';
|
|
2
|
+
import { AnnouncementEvent, AnnouncementInteractionEvent, FeatureAnnouncement } from './feature.types';
|
|
3
3
|
import { FeatureAnnouncementRepository } from './repository.types';
|
|
4
4
|
import { RouterProps } from './router.types';
|
|
5
5
|
/**
|
|
@@ -14,17 +14,27 @@ export interface PopupBaseProps {
|
|
|
14
14
|
onPrevious: () => void;
|
|
15
15
|
onNext: () => void;
|
|
16
16
|
setIsClosing?: (isClosing: boolean) => void;
|
|
17
|
+
onSecondaryAction?: () => void;
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
20
|
* Major update popup props
|
|
20
21
|
*/
|
|
21
22
|
export interface MajorUpdatePopupProps extends PopupBaseProps {
|
|
23
|
+
/**
|
|
24
|
+
* Aspect ratio for the image/video container
|
|
25
|
+
* @default '16:9'
|
|
26
|
+
*/
|
|
27
|
+
ratio?: '16:9' | '1:1' | '4:3';
|
|
28
|
+
/**
|
|
29
|
+
* Custom padding for the popup container
|
|
30
|
+
* @default '16px'
|
|
31
|
+
*/
|
|
32
|
+
padding?: string;
|
|
22
33
|
}
|
|
23
34
|
/**
|
|
24
35
|
* Minor update popup props
|
|
25
36
|
*/
|
|
26
|
-
export
|
|
27
|
-
}
|
|
37
|
+
export type MinorUpdatePopupProps = PopupBaseProps;
|
|
28
38
|
/**
|
|
29
39
|
* Video modal props
|
|
30
40
|
*/
|
|
@@ -40,4 +50,16 @@ export interface FeatureAnnouncementProviderProps extends FeatureAnnouncementRep
|
|
|
40
50
|
children: React.ReactNode;
|
|
41
51
|
module?: string;
|
|
42
52
|
router?: RouterProps;
|
|
53
|
+
/**
|
|
54
|
+
* Store ID for event tracking
|
|
55
|
+
*/
|
|
56
|
+
storeId?: string;
|
|
57
|
+
/**
|
|
58
|
+
* Callback fired when a major announcement popup is shown
|
|
59
|
+
*/
|
|
60
|
+
onAnnouncementShown?: (event: AnnouncementEvent) => void;
|
|
61
|
+
/**
|
|
62
|
+
* Callback fired when user interacts with an announcement (clicks a button)
|
|
63
|
+
*/
|
|
64
|
+
onAnnouncementInteracted?: (event: AnnouncementInteractionEvent) => void;
|
|
43
65
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ButtonConfig, SecondaryButtonConfig } from '../feature-announcements/types/feature.types';
|
|
3
|
+
export type { ButtonConfig, SecondaryButtonConfig };
|
|
2
4
|
export interface WhatsNewContent {
|
|
3
5
|
id: string;
|
|
4
6
|
title: string;
|
|
@@ -12,6 +14,10 @@ export interface WhatsNewContent {
|
|
|
12
14
|
createdAt: any;
|
|
13
15
|
module: string[];
|
|
14
16
|
visibility: boolean;
|
|
17
|
+
primaryButton?: ButtonConfig;
|
|
18
|
+
secondaryButton?: SecondaryButtonConfig;
|
|
19
|
+
featureUpdateType?: 'Major' | 'Minor';
|
|
20
|
+
displayImage?: string;
|
|
15
21
|
}
|
|
16
22
|
export interface WhatsNewProviderProps {
|
|
17
23
|
children: React.ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as
|
|
1
|
+
import{jsxs as t,jsx as n}from"react/jsx-runtime";import i from"../../assets/icons/whatsNew.svg.js";import{COLORS as e}from"../../constants/Theme.js";import{Tooltip as o}from"../tooltips/Tooltip.js";import{WhatsNewIconContainer as s}from"./WhatsNew.styles.js";const r=r=>{let{onClick:c,newContentCount:a=0,isOpen:d=!1,isLoading:l=!1,tooltip:m="What's new",testId:h="whats-new-button",iconWidth:p=32,iconHeight:g=32,customIcon:b}=r;return l?t("div",Object.assign({style:{margin:"0px 8px"}},{children:[n("div",{style:{width:16,height:16,border:"2px solid #f3f3f3",borderTop:"2px solid #731DCF",borderRadius:"50%",animation:"spin 1s linear infinite"}}),n("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"})]})):n(s,Object.assign({count:a},{children:t("div",Object.assign({className:"main-icon-class "+(d?"icon-active":""),style:{color:d?e.content.brand:e.content.primary},onClick:c,"data-testid":h},{children:[n(o,Object.assign({body:m,placement:"bottom"},{children:n("div",{children:b?n(b,{width:p,height:g,color:d?e.content.brand:e.content.primary}):n(i,{width:p,height:g})})})),a>0&&n("div",Object.assign({className:"notification--count"},{children:n("div",Object.assign({className:"count--text"},{children:a}))}))]}))}))};export{r as WhatsNewButton};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as t,jsxs as
|
|
1
|
+
import{jsx as e,Fragment as t,jsxs as r}from"react/jsx-runtime";import{format as n,differenceInBusinessDays as o}from"date-fns";import{useState as s,useMemo as a}from"react";import i from"../../assets/icons/searchIcon.svg.js";import c from"../../assets/icons/whatsNew.svg.js";import{COLORS as d}from"../../constants/Theme.js";import{Button as l}from"../button/Button.js";import{VideoModal as m}from"../feature-announcements/VideoModal.js";import{SearchBar as h}from"../searchBar/searchBar.js";import{SideModal as u}from"../side-modal/SideModal.js";import{TitleMedium as p,TitleRegular as g,BodyPrimary as f,Caption as b,TitleSmall as w}from"../TypographyStyle.js";import{MainContainer as j,WhatsNewWrapper as y,MainCardContainer as v,BackgroundImageContainer as x}from"./WhatsNew.styles.js";const C=C=>{let{isOpen:N,onClose:O,content:k,isLoading:A=!1,title:D="What's new on BIK",searchPlaceholder:S="Search posts",emptyStateTitle:T="Nothing new!",emptyStateDescription:L="There are no new updates or features at the moment. Check back soon!",noResultsText:M="Sorry, no results found.",width:B="480px",onContentClick:W,renderCustomContent:U}=C;const[V,E]=s(""),[I,_]=s(!1),[P,R]=s(""),z=e=>{if(!e.createdAt)return!1;const t=e.createdAt.toDate?e.createdAt.toDate():new Date(e.createdAt);return o(new Date,t)<7},F=a((()=>{if(!V.trim())return k;const e=V.toLowerCase();return k.filter((t=>t.title.toLowerCase().includes(e)||t.body.toLowerCase().includes(e)||t.content&&t.content.toLowerCase().includes(e)))}),[k,V]),H=0===k.length,K=0===F.length;return N?r(u,Object.assign({width:B,onClose:O,header:"",headerCustomComponent:e(p,Object.assign({color:d.background.inverse},{children:D})),headerStyle:{background:d.background.brandLight},hideFooter:!0},{children:[r(j,{children:[e("div",Object.assign({className:"mt-8"},{children:e(h,{width:"100%",isEnabled:!H,onChange:e=>{E(e)},onEnter:e=>{E(e)},placeholder:S,variant:"default",searchValue:V,onClickCross:()=>{E("")}})})),e(y,{children:H||K?r("div",Object.assign({className:"no--data--found"},{children:[e("div",Object.assign({className:"icon--wrapper"},{children:e(H?c:i,{width:32,height:32})})),H?r(t,{children:[e(g,{children:T}),e(f,Object.assign({color:d.content.secondary,className:"text--align",style:{maxWidth:300}},{children:L}))]}):K?e(f,Object.assign({color:d.content.secondary,className:"text--align",style:{maxWidth:300}},{children:M})):null]})):e("div",Object.assign({className:"scroller"},{children:F.map(((o,s)=>{var a;return U?U(o):r(v,Object.assign({className:"padding--16 mb-mt-8"},{children:[e(x,{imageUrl:o.image,height:"209px",width:"100%",style:{borderRadius:"4px"}}),e("div",Object.assign({className:"mt-20 full--width"},{children:r("div",Object.assign({className:"created--at flex flex--row"},{children:[z(o)?e("div",Object.assign({className:"new--content--tag"},{children:e(b,{children:"New"})})):e(t,{}),e(b,Object.assign({style:{color:d.content.placeholder}},{children:o.createdAt?n(o.createdAt.toDate?o.createdAt.toDate():new Date(o.createdAt),"dd MMMM yyyy"):""}))]}))})),e("div",Object.assign({className:"mt--8"},{children:e(w,{children:o.title})})),e("div",{dangerouslySetInnerHTML:{__html:o.body},className:"card--desc mt--12"}),e("div",Object.assign({className:"flex flex--row mt-20 full--width"},{children:e(l,{buttonText:(null===(a=o.primaryButton)||void 0===a?void 0:a.text)||o.buttonText||"Explore the feature",onClick:()=>(e=>{var t;if(e.productVideo)R(e.productVideo),_(!0);else{const r=(null===(t=e.primaryButton)||void 0===t?void 0:t.redirectionUrl)||e.redirectUrl;r&&window.open(r,"_blank","noopener,noreferrer")}W&&W(e)})(o),matchParentWidth:!0,size:"medium"})}))]}),`whats-new-${s}`)}))}))})]}),e(m,{isOpen:I,videoUrl:P,onClose:()=>{_(!1)}})]})):e(t,{})};export{C as WhatsNewPanel};
|