@nuskin/react-loyalty-elements 1.1.0-dev-sea.1 → 1.1.0-dev-sea.2
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/CircularProgressBar/ApproximateMonthlyAmount.d.ts +4 -1
- package/dist/CircularProgressBar/AvailableVouchers.d.ts +4 -1
- package/dist/CircularProgressBar/LoyaltyRewardsHeader.d.ts +4 -1
- package/dist/CircularProgressBar/RadialSeparator.d.ts +3 -0
- package/dist/CircularProgressBar/RewardProgressBar.d.ts +1 -0
- package/dist/CircularProgressBar/RewardSubscriptionMonthDescription.d.ts +1 -0
- package/dist/CircularProgressBar/RewardSubscriptionTotal.d.ts +1 -0
- package/dist/CircularProgressBar/SubscriptionReward.d.ts +4 -1
- package/dist/CircularProgressBar/SubscriptionRewardMobile.d.ts +4 -1
- package/dist/CircularProgressBar/index.js +1 -1
- package/dist/CircularProgressBar/index.js.map +1 -1
- package/dist/CircularProgressBar/index.mjs +1 -1
- package/dist/CircularProgressBar/index.mjs.map +1 -1
- package/dist/CircularProgressBar/logic/getRewardTrackingText.d.ts +12 -0
- package/dist/CircularProgressBar/types.d.ts +8 -0
- package/dist/GiftProgressBar/GiftProgressBar.d.ts +4 -1
- package/dist/GiftProgressBar/GiftProgressBarMobile.d.ts +4 -1
- package/dist/GiftProgressBar/GiftProgressBarMonthDescription.d.ts +4 -1
- package/dist/GiftProgressBar/GiftReward.d.ts +4 -1
- package/dist/GiftProgressBar/GiftWheelCenterContent.d.ts +4 -1
- package/dist/GiftProgressBar/index.d.ts +1 -1
- package/dist/GiftProgressBar/index.js +1 -1
- package/dist/GiftProgressBar/index.js.map +1 -1
- package/dist/GiftProgressBar/index.mjs +1 -1
- package/dist/GiftProgressBar/index.mjs.map +1 -1
- package/dist/GiftProgressBar/logic/readGiftProperties.d.ts +3 -3
- package/dist/GiftProgressBar/types.d.ts +3 -3
- package/dist/GiftRoadmap/index.mjs +1 -1
- package/dist/GiftRoadmap/index.mjs.map +1 -1
- package/dist/chunk-3RJWIGAN.mjs +1 -0
- package/dist/chunk-3RJWIGAN.mjs.map +1 -0
- package/dist/chunk-NVD2PQ2C.mjs +1 -0
- package/dist/chunk-NVD2PQ2C.mjs.map +1 -0
- package/dist/{chunk-M6F5BD5Q.mjs → chunk-UHWCPMTT.mjs} +1 -1
- package/dist/{chunk-M6F5BD5Q.mjs.map → chunk-UHWCPMTT.mjs.map} +1 -1
- package/package.json +1 -1
- package/dist/chunk-THTK5CGU.mjs +0 -1
- package/dist/chunk-THTK5CGU.mjs.map +0 -1
- package/dist/chunk-TURO34CN.mjs +0 -1
- package/dist/chunk-TURO34CN.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
function n(n,e){if(e==null||e>n.length)e=n.length;for(var t=0,o=new Array(e);t<e;t++)o[t]=n[t];return o}function e(e){if(Array.isArray(e))return n(e)}function t(n,e,t){if(e in n){Object.defineProperty(n,e,{value:t,enumerable:true,configurable:true,writable:true})}else{n[e]=t}return n}function o(n){if(typeof Symbol!=="undefined"&&n[Symbol.iterator]!=null||n["@@iterator"]!=null)return Array.from(n)}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(n){for(var e=1;e<arguments.length;e++){var o=arguments[e]!=null?arguments[e]:{};var r=Object.keys(o);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(o).filter(function(n){return Object.getOwnPropertyDescriptor(o,n).enumerable}))}r.forEach(function(e){t(n,e,o[e])})}return n}function a(n,e){var t=Object.keys(n);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(n);if(e){o=o.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})}t.push.apply(t,o)}return t}function l(n,e){e=e!=null?e:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(n,Object.getOwnPropertyDescriptors(e))}else{a(Object(e)).forEach(function(t){Object.defineProperty(n,t,Object.getOwnPropertyDescriptor(e,t))})}return n}function s(n,e){if(!e){e=n.slice(0)}return Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(e)}}))}function d(n){return e(n)||o(n)||u(n)||r()}function u(e,t){if(!e)return;if(typeof e==="string")return n(e,t);var o=Object.prototype.toString.call(e).slice(8,-1);if(o==="Object"&&e.constructor)o=e.constructor.name;if(o==="Map"||o==="Set")return Array.from(o);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return n(e,t)}function c(){var n=s(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n background-color: #f5f5f5;\n border: 1px solid #e0e0e0;\n border-radius: 10px;\n padding: 1.5rem;\n margin-bottom: 20px;\n height: 50%;\n margin: auto;\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: stretch;\n width: 100%;\n }\n"]);c=function e(){return n};return n}function f(){var n=s(["\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n gap: 24px;\n width: 100%;\n\n .reward-progress {\n height: 150px;\n width: 150px;\n flex-shrink: 0;\n\n /* The library stylesheet is not bundled, so the SVG stays inline and its baseline gap\n makes the wrapper taller than the ring, pushing the radial separators off centre. */\n > div {\n height: 100%;\n }\n\n .CircularProgressbar {\n display: block;\n width: 100%;\n height: 100%;\n }\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: center;\n }\n"]);f=function e(){return n};return n}function h(){var n=s(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 16px;\n flex: 1 0 0;\n min-width: 0;\n\n /* The wrapper turns into a column here, so flex-basis governs height and the width would\n otherwise collapse to shrink-to-fit under the wrapper's align-items: center. */\n @media (max-width: 950px) {\n width: 100%;\n align-self: stretch;\n text-align: center;\n }\n"]);h=function e(){return n};return n}import{b as m,c as v,d as p,f as g,g as b,i as C,k as y,l as M}from"../chunk-TURO34CN.mjs";import{a as x}from"../chunk-M6F5BD5Q.mjs";import{a as w}from"../chunk-THTK5CGU.mjs";import{d as j}from"../chunk-PN67M2PP.mjs";import"../chunk-CBUBKPM6.mjs";import"../chunk-73SFLUWV.mjs";import{CircularProgressbarWithChildren as O,buildStyles as S}from"react-circular-progressbar";import{jsx as L,jsxs as k}from"react/jsx-runtime";var T=function(n){var e=n.value,t=n.cadenceMonths,o=n.notQualifyThisMonth,r=n.translationConfig,i=n.handleOpenLearnMore,a=i===void 0?function(){}:i,l=n.showLogo,s=l===void 0?!0:l;var d=t>0&&e===t&&!o,u=w(r.monthsComplete,{completed_months:e,total_months:t});return d?u=r.giftEarned:o&&(u=r.notQualify),k(v,{children:[s&&L("img",{className:"reward-logo",src:r.loyaltyLogoBlack,alt:"Rewards Logo"}),L("div",{className:"info-item",children:u}),L(p,{id:"learnMoreGift",onClick:a,children:L("u",{children:r.learnMore})})]})},P=T;import{FaExclamationTriangle as I}from"react-icons/fa";import{NsTypography as N}from"@nuskin/foundation-ui-components";import{jsx as G,jsxs as E}from"react/jsx-runtime";var D=function(n){var e=n.isComplete,t=n.notQualifyThisMonth,o=n.value,r=n.cadenceMonths,i=n.monthsLabel,a=n.giftIssuedLabel;return t?G(C,{children:G(I,{className:"outline-exclamation-icon",color:"#91ACC8"})}):E(g,{children:[G(N,{component:"div",className:"center-value-progress-bar-price",variant:"title-l",weight:"bold",children:"".concat(o,"/").concat(r)}),G(N,{variant:"label-s",weight:"bold",component:"div",className:"center-value-progress-bar-voucher",children:i}),e&&G(N,{variant:"label-s",weight:"bold",component:"div",className:"center-value-progress-bar-voucher",children:a})]})},Q=D;var _=j.div(c()),A=j.div(f()),R=j.div(h());import{jsx as B,jsxs as F}from"react/jsx-runtime";var U=function(n){var e;var t=n.value,o=t===void 0?0:t,r=n.cadenceMonths,i=r===void 0?0:r,a=n.notQualifyThisMonth,l=a===void 0?!1:a,s=n.translationConfig,d=n.giftConfig,u=n.currentCadenceIndex,c=u===void 0?0:u,f=n.issuedCadenceCount,h=f===void 0?0:f,m=n.showRoadmap,v=m===void 0?!0:m,p=n.handleOpenLearnMore,g=p===void 0?function(){}:p,b=n.showLogo,C=b===void 0?!0:b,M=i>0&&o===i&&!l,w=i>0?Math.floor(((e=d===null||d===void 0?void 0:d.maxCSM)!==null&&e!==void 0?e:0)/i):0;var j,L,k,T,I;return F(A,{children:[B("div",{className:"reward-progress",children:F(O,{value:i>0?o/i*100:0,strokeWidth:12,background:!0,styles:S({rotation:.5,strokeLinecap:"butt",backgroundColor:"#fff",pathColor:"#ED7219",trailColor:"#E0E0E0"}),children:[i>0&&B(y,{count:i}),B(Q,{isComplete:M,notQualifyThisMonth:l,value:o,cadenceMonths:i,monthsLabel:(j=s===null||s===void 0?void 0:s.monthsLabel)!==null&&j!==void 0?j:"Months",giftIssuedLabel:(L=s===null||s===void 0?void 0:s.giftIssuedLabel)!==null&&L!==void 0?L:"Gift issued"})]})}),F(R,{children:[v&&w>1&&B(x,{giftCycle:i,maxCSM:(k=d===null||d===void 0?void 0:d.maxCSM)!==null&&k!==void 0?k:0,currentCadenceIndex:c,issuedCadenceCount:h,translationConfig:{monthLabel:(T=s===null||s===void 0?void 0:s.roadmapMonthLabel)!==null&&T!==void 0?T:"Month %cadence_month%",giftLabel:(I=s===null||s===void 0?void 0:s.roadmapGiftLabel)!==null&&I!==void 0?I:"Gift %gift_index%"}}),B(P,{value:o,cadenceMonths:i,notQualifyThisMonth:l,translationConfig:s,giftConfig:d,handleOpenLearnMore:g,showLogo:C})]})]})},W=U;import{CircularProgressbarWithChildren as q,buildStyles as V}from"react-circular-progressbar";import{NsTypography as z}from"@nuskin/foundation-ui-components";import{jsx as K,jsxs as Y}from"react/jsx-runtime";var H=function(n){var e;var t=n.value,o=t===void 0?0:t,r=n.cadenceMonths,i=r===void 0?0:r,a=n.notQualifyThisMonth,l=a===void 0?!1:a,s=n.amountShow,d=n.translationConfig,u=n.giftConfig,c=n.currentCadenceIndex,f=c===void 0?0:c,h=n.issuedCadenceCount,g=h===void 0?0:h,C=n.showRoadmap,M=C===void 0?!0:C,j=n.handleOpenLearnMore,O=j===void 0?function(){}:j,S=n.showLogo,L=S===void 0?!0:S,k=n.showTotalSection,T=k===void 0?!0:k,P=i>0&&o===i&&!l,I=i>0?Math.floor(((e=u===null||u===void 0?void 0:u.maxCSM)!==null&&e!==void 0?e:0)/i):0,N=w(d.monthsComplete,{completed_months:o,total_months:i});P?N=d.giftEarned:l&&(N=d.notQualify);var G=w(d.approximateMonthly,{currency_symbol:"",estimated_running_subscription_spend:""});var E,D,_,A,R;return Y(m,{children:[K("div",{className:"reward-progress",children:Y(q,{value:i>0?o/i*100:0,strokeWidth:12,background:!0,styles:V({rotation:.5,strokeLinecap:"butt",backgroundColor:"#fff",pathColor:"#ED7219",trailColor:"#E0E0E0"}),children:[i>0&&K(y,{count:i}),K(Q,{isComplete:P,notQualifyThisMonth:l,value:o,cadenceMonths:i,monthsLabel:(E=d===null||d===void 0?void 0:d.monthsLabel)!==null&&E!==void 0?E:"Months",giftIssuedLabel:(D=d===null||d===void 0?void 0:d.giftIssuedLabel)!==null&&D!==void 0?D:"Gift issued"})]})}),M&&I>1&&K(x,{giftCycle:i,maxCSM:(_=u===null||u===void 0?void 0:u.maxCSM)!==null&&_!==void 0?_:0,currentCadenceIndex:f,issuedCadenceCount:g,translationConfig:{monthLabel:(A=d===null||d===void 0?void 0:d.roadmapMonthLabel)!==null&&A!==void 0?A:"Month %cadence_month%",giftLabel:(R=d===null||d===void 0?void 0:d.roadmapGiftLabel)!==null&&R!==void 0?R:"Gift %gift_index%"}}),Y(v,{children:[L&&K("img",{className:"reward-logo",src:d.loyaltyLogoBlack,alt:"Rewards Logo"}),K("div",{className:"info-item",children:N})]}),K(b,{children:T&&!P&&Y(z,{variant:"body-s",weight:"normal",className:"reward-subtitle",colorOverride:"#252525",component:"div",children:[G," ",K(z,{component:"span",className:"button-price",variant:"body-s",weight:"bold",children:s!==null&&s!==void 0?s:0})]})}),K(v,{children:K(p,{id:"learnMoreGiftMobile",onClick:O,children:K("u",{children:d.learnMore})})})]})},$=H;var J={completedMonthsInCadence:0,totalCSMCount:0,totalCadences:0,currentCadenceIndex:0,issuedCadenceCount:0,isGiftIssued:!1,isProgramComplete:!1},X=function(n){return d(n).sort(function(n,e){return n.year===e.year?e.month-n.month:e.year-n.year})},Z=function(n,e){return new Date(n,e-2,1)},nn=function(n,e,t){var o=0;for(var r=0;r<n.length;r++){var i=n[r],a=new Date(i.year,i.month-1,1);if(r===0){if(a>t)break}else{var l=n[r-1];if(a.getTime()!==Z(l.year,l.month).getTime())break}if(i.totalAmount<e)break;o++}return o},ne=function(n,e,t,o,r){var a=Math.min(Math.max(n,0),o);if(a===0)return l(i({},J),{totalCadences:r});var s=a%t,d=s===0&&e,u=Math.min(Math.floor(a/t),r),c=d?u-1:Math.floor(a/t);return{completedMonthsInCadence:d?t:s,totalCSMCount:a,totalCadences:r,currentCadenceIndex:Math.min(Math.max(c,0),r-1),issuedCadenceCount:u,isGiftIssued:d,isProgramComplete:a>=o}},nt=function(n){var e=n.data,t=n.giftCycle,o=n.maxCSM,r=n.minSpend,a=n.giftProperties,s=n.today;var d=t>0?Math.floor(o/t):0;if(d<=0)return l(i({},J),{totalCadences:Math.max(d,0)});if(a){var u=a.continuousSubscriptionMonths,c=a.qualifiedThisMonth,f=u+(c?1:0);return ne(f,c,t,o,d)}var h;var m=(h=e===null||e===void 0?void 0:e.csmMonthlySubsOrderTotal)!==null&&h!==void 0?h:[];if(!m.length)return l(i({},J),{totalCadences:d});var v=X(m),p=new Date(s.getFullYear(),s.getMonth(),1),g=nn(v,r,p),b=v[0],C=b.year===s.getFullYear()&&b.month-1===s.getMonth()&&b.totalAmount>=r;return ne(g,C,t,o,d)};var no="giftContinuousSubscriptionMonth",nr="giftQualifiedThisMonth",ni=function(n,e){var t,o;return n===null||n===void 0?void 0:(o=n.properties)===null||o===void 0?void 0:(t=o.find(function(n){return(n===null||n===void 0?void 0:n.name)===e}))===null||t===void 0?void 0:t.value},na=function(n){var e;if(!(n===null||n===void 0?void 0:(e=n.properties)===null||e===void 0?void 0:e.length))return null;var t=ni(n,no),o=ni(n,nr);if(t===void 0&&o===void 0)return null;var r=Number.parseInt(t!==null&&t!==void 0?t:"",10);return{continuousSubscriptionMonths:Number.isNaN(r)?0:Math.max(r,0),qualifiedThisMonth:Number.parseInt(o!==null&&o!==void 0?o:"",10)===1}};import{jsx as nl}from"react/jsx-runtime";var ns=function(n){var e;var t,o,r,a;var l=n.subscriptionData,s=n.loyaltyResponse,d=n.translationConfig,u=n.giftConfig,c=n.showRoadmap,f=c===void 0?!0:c,h=n.showLogo,m=h===void 0?!0:h,v=n.showTotalSection,p=v===void 0?!0:v,g=(t=u===null||u===void 0?void 0:u.giftCycle)!==null&&t!==void 0?t:0,b=(o=u===null||u===void 0?void 0:u.thresholdValue)!==null&&o!==void 0?o:0,C=parseFloat(String((r=l===null||l===void 0?void 0:(e=l.approximateMonthlyTotalResponse)===null||e===void 0?void 0:e.currentMonthTotal)!==null&&r!==void 0?r:"0")),y=na(s),x=y?!y.qualifiedThisMonth:C<b,w=nt({data:l,giftCycle:g,maxCSM:(a=u===null||u===void 0?void 0:u.maxCSM)!==null&&a!==void 0?a:0,minSpend:b,giftProperties:y,today:new Date}),j=w.completedMonthsInCadence,O=w.currentCadenceIndex,S=w.issuedCadenceCount,L={value:j,cadenceMonths:g,notQualifyThisMonth:x,amountShow:C,translationConfig:d,giftConfig:u,currentCadenceIndex:O,issuedCadenceCount:S,showRoadmap:f,showLogo:m,showTotalSection:p};return nl(_,{className:"loyalty-reward-card",children:M.isMobile?nl($,i({},L)):nl(W,i({},L))})},nd=ns;export{W as GiftProgressBar,$ as GiftProgressBarMobile,nd as GiftReward};//# sourceMappingURL=index.mjs.map
|
|
1
|
+
function e(e,n){if(n==null||n>e.length)n=e.length;for(var t=0,o=new Array(n);t<n;t++)o[t]=e[t];return o}function n(n){if(Array.isArray(n))return e(n)}function t(e,n,t){if(n in e){Object.defineProperty(e,n,{value:t,enumerable:true,configurable:true,writable:true})}else{e[n]=t}return e}function o(e){if(typeof Symbol!=="undefined"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function r(){throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function i(e){for(var n=1;n<arguments.length;n++){var o=arguments[n]!=null?arguments[n]:{};var r=Object.keys(o);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(o).filter(function(e){return Object.getOwnPropertyDescriptor(o,e).enumerable}))}r.forEach(function(n){t(e,n,o[n])})}return e}function a(e,n){var t=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);if(n){o=o.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})}t.push.apply(t,o)}return t}function l(e,n){n=n!=null?n:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(n))}else{a(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}function s(e,n){if(!n){n=e.slice(0)}return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}function d(e){return n(e)||o(e)||u(e)||r()}function u(n,t){if(!n)return;if(typeof n==="string")return e(n,t);var o=Object.prototype.toString.call(n).slice(8,-1);if(o==="Object"&&n.constructor)o=n.constructor.name;if(o==="Map"||o==="Set")return Array.from(o);if(o==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o))return e(n,t)}function c(){var e=s(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n background-color: #f5f5f5;\n border: 1px solid #e0e0e0;\n border-radius: 10px;\n padding: 1.5rem;\n margin-bottom: 20px;\n height: 50%;\n margin: auto;\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: stretch;\n width: 100%;\n }\n"]);c=function n(){return e};return e}function f(){var e=s(["\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n gap: 24px;\n width: 100%;\n\n .reward-progress {\n height: 150px;\n width: 150px;\n flex-shrink: 0;\n\n /* The library stylesheet is not bundled, so the SVG stays inline and its baseline gap\n makes the wrapper taller than the ring, pushing the radial separators off centre. */\n > div {\n height: 100%;\n }\n\n .CircularProgressbar {\n display: block;\n width: 100%;\n height: 100%;\n }\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: center;\n }\n"]);f=function n(){return e};return e}function h(){var e=s(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 16px;\n flex: 1 0 0;\n min-width: 0;\n\n /* The wrapper turns into a column here, so flex-basis governs height and the width would\n otherwise collapse to shrink-to-fit under the wrapper's align-items: center. */\n @media (max-width: 950px) {\n width: 100%;\n align-self: stretch;\n text-align: center;\n }\n"]);h=function n(){return e};return e}import{b as v,c as m,d as p,f as g,g as b,i as y,k as C,l as M}from"../chunk-NVD2PQ2C.mjs";import{a as x}from"../chunk-UHWCPMTT.mjs";import{a as w,b as j}from"../chunk-3RJWIGAN.mjs";import{d as S}from"../chunk-PN67M2PP.mjs";import"../chunk-CBUBKPM6.mjs";import"../chunk-73SFLUWV.mjs";import{CircularProgressbarWithChildren as L,buildStyles as O}from"react-circular-progressbar";import{jsx as k,jsxs as P}from"react/jsx-runtime";var T=function(e){var n=e.value,t=e.cadenceMonths,o=e.notQualifyThisMonth,r=e.translationConfig,i=e.giftConfig,a=e.handleOpenLearnMore,l=a===void 0?function(){}:a,s=e.showLogo,d=s===void 0?!0:s;var u=t>0&&n===t&&!o,c="";return u?c=r.giftEarned:o?c=r.notQualify:c=w(r.callToAction,{threshold_value:i.thresholdValue,currency_symbol:i.thresholdKey==="subtotal"?j():""}),P(m,{children:[d&&k("img",{className:"reward-logo",src:r.loyaltyLogoBlack,alt:"Rewards Logo"}),k("div",{className:"info-item",children:c}),k(p,{id:"learnMoreGift",onClick:l,children:k("u",{children:r.learnMore})})]})};T.displayName="GiftProgressBarMonthDescription";var N=T;import{FaExclamationTriangle as I}from"react-icons/fa";import{NsTypography as G}from"@nuskin/foundation-ui-components";import{jsx as D,jsxs as E}from"react/jsx-runtime";var A=function(e){var n=e.isComplete,t=e.notQualifyThisMonth,o=e.value,r=e.cadenceMonths,i=e.monthsLabel,a=e.giftIssuedLabel;return t?D(y,{children:D(I,{className:"outline-exclamation-icon",color:"#91ACC8"})}):E(g,{children:[D(G,{component:"div",className:"center-value-progress-bar-price",variant:"title-l",weight:"bold",children:"".concat(o,"/").concat(r)}),D(G,{variant:"label-s",weight:"bold",component:"div",className:"center-value-progress-bar-voucher",children:i}),n&&D(G,{variant:"label-s",weight:"bold",component:"div",className:"center-value-progress-bar-voucher",children:a})]})};A.displayName="GiftWheelCenterContent";var Q=A;var _=S.div(c()),B=S.div(f()),R=S.div(h());import{jsx as W,jsxs as F}from"react/jsx-runtime";var V=function(e){var n;var t=e.value,o=t===void 0?0:t,r=e.cadenceMonths,i=r===void 0?0:r,a=e.notQualifyThisMonth,l=a===void 0?!1:a,s=e.translationConfig,d=e.giftConfig,u=e.currentCadenceIndex,c=u===void 0?0:u,f=e.issuedCadenceCount,h=f===void 0?0:f,v=e.showRoadmap,m=v===void 0?!0:v,p=e.handleOpenLearnMore,g=p===void 0?function(){}:p,b=e.showLogo,y=b===void 0?!0:b,M=i>0&&o===i&&!l,w=i>0?Math.floor(((n=d===null||d===void 0?void 0:d.maxCSM)!==null&&n!==void 0?n:0)/i):0;var j,S,k,P,T;return F(B,{children:[W("div",{className:"reward-progress",children:F(L,{value:i>0?o/i*100:0,strokeWidth:12,background:!0,styles:O({rotation:.5,strokeLinecap:"butt",backgroundColor:"#fff",pathColor:"#ED7219",trailColor:"#E0E0E0"}),children:[i>0&&W(C,{count:i}),W(Q,{isComplete:M,notQualifyThisMonth:l,value:o,cadenceMonths:i,monthsLabel:(j=s===null||s===void 0?void 0:s.monthsLabel)!==null&&j!==void 0?j:"Months",giftIssuedLabel:(S=s===null||s===void 0?void 0:s.giftIssuedLabel)!==null&&S!==void 0?S:"Gift issued"})]})}),F(R,{children:[m&&w>1&&W(x,{giftCycle:i,maxCSM:(k=d===null||d===void 0?void 0:d.maxCSM)!==null&&k!==void 0?k:0,currentCadenceIndex:c,issuedCadenceCount:h,translationConfig:{monthLabel:(P=s===null||s===void 0?void 0:s.roadmapMonthLabel)!==null&&P!==void 0?P:"Month %cadence_month%",giftLabel:(T=s===null||s===void 0?void 0:s.roadmapGiftLabel)!==null&&T!==void 0?T:"Gift %gift_index%"}}),W(N,{value:o,cadenceMonths:i,notQualifyThisMonth:l,translationConfig:s,giftConfig:d,handleOpenLearnMore:g,showLogo:y})]})]})};V.displayName="GiftProgressBar";var U=V;import{CircularProgressbarWithChildren as q,buildStyles as z}from"react-circular-progressbar";import{NsTypography as K}from"@nuskin/foundation-ui-components";import{jsx as Y,jsxs as H}from"react/jsx-runtime";var J=function(e){var n;var t=e.value,o=t===void 0?0:t,r=e.cadenceMonths,i=r===void 0?0:r,a=e.notQualifyThisMonth,l=a===void 0?!1:a,s=e.amountShow,d=e.translationConfig,u=e.giftConfig,c=e.currentCadenceIndex,f=c===void 0?0:c,h=e.issuedCadenceCount,g=h===void 0?0:h,y=e.showRoadmap,M=y===void 0?!0:y,j=e.handleOpenLearnMore,S=j===void 0?function(){}:j,L=e.showLogo,O=L===void 0?!0:L,k=e.showTotalSection,P=k===void 0?!0:k,T=i>0&&o===i&&!l,N=i>0?Math.floor(((n=u===null||u===void 0?void 0:u.maxCSM)!==null&&n!==void 0?n:0)/i):0,I=w(d.monthsComplete,{completed_months:o,total_months:i});T?I=d.giftEarned:l&&(I=d.notQualify);var G=w(d.approximateMonthly,{currency_symbol:"",estimated_running_subscription_spend:""});var D,E,A,_,B;return H(v,{children:[Y("div",{className:"reward-progress",children:H(q,{value:i>0?o/i*100:0,strokeWidth:12,background:!0,styles:z({rotation:.5,strokeLinecap:"butt",backgroundColor:"#fff",pathColor:"#ED7219",trailColor:"#E0E0E0"}),children:[i>0&&Y(C,{count:i}),Y(Q,{isComplete:T,notQualifyThisMonth:l,value:o,cadenceMonths:i,monthsLabel:(D=d===null||d===void 0?void 0:d.monthsLabel)!==null&&D!==void 0?D:"Months",giftIssuedLabel:(E=d===null||d===void 0?void 0:d.giftIssuedLabel)!==null&&E!==void 0?E:"Gift issued"})]})}),M&&N>1&&Y(x,{giftCycle:i,maxCSM:(A=u===null||u===void 0?void 0:u.maxCSM)!==null&&A!==void 0?A:0,currentCadenceIndex:f,issuedCadenceCount:g,translationConfig:{monthLabel:(_=d===null||d===void 0?void 0:d.roadmapMonthLabel)!==null&&_!==void 0?_:"Month %cadence_month%",giftLabel:(B=d===null||d===void 0?void 0:d.roadmapGiftLabel)!==null&&B!==void 0?B:"Gift %gift_index%"}}),H(m,{children:[O&&Y("img",{className:"reward-logo",src:d.loyaltyLogoBlack,alt:"Rewards Logo"}),Y("div",{className:"info-item",children:I})]}),Y(b,{children:P&&!T&&H(K,{variant:"body-s",weight:"normal",className:"reward-subtitle",colorOverride:"#252525",component:"div",children:[G," ",Y(K,{component:"span",className:"button-price",variant:"body-s",weight:"bold",children:s!==null&&s!==void 0?s:0})]})}),Y(m,{children:Y(p,{id:"learnMoreGiftMobile",onClick:S,children:Y("u",{children:d.learnMore})})})]})};J.displayName="GiftProgressBarMobile";var $=J;var X={completedMonthsInCadence:0,totalCSMCount:0,totalCadences:0,currentCadenceIndex:0,issuedCadenceCount:0,isGiftIssued:!1,isProgramComplete:!1},Z=function(e){return d(e).sort(function(e,n){return e.year===n.year?n.month-e.month:n.year-e.year})},ee=function(e,n){return new Date(e,n-2,1)},en=function(e,n,t){var o=0;for(var r=0;r<e.length;r++){var i=e[r],a=new Date(i.year,i.month-1,1);if(r===0){if(a>t)break}else{var l=e[r-1];if(a.getTime()!==ee(l.year,l.month).getTime())break}if(i.totalAmount<n)break;o++}return o},et=function(e,n,t,o,r){var a=Math.min(Math.max(e,0),o);if(a===0)return l(i({},X),{totalCadences:r});var s=a%t,d=s===0&&n,u=Math.min(Math.floor(a/t),r),c=d?u-1:Math.floor(a/t);return{completedMonthsInCadence:d?t:s,totalCSMCount:a,totalCadences:r,currentCadenceIndex:Math.min(Math.max(c,0),r-1),issuedCadenceCount:u,isGiftIssued:d,isProgramComplete:a>=o}},eo=function(e){var n=e.data,t=e.giftCycle,o=e.maxCSM,r=e.minSpend,a=e.giftProperties,s=e.today;var d=t>0?Math.floor(o/t):0;if(d<=0)return l(i({},X),{totalCadences:Math.max(d,0)});if(a){var u=a.continuousSubscriptionMonths,c=a.qualifiedThisMonth,f=u+(c?1:0);return et(f,c,t,o,d)}var h;var v=(h=n===null||n===void 0?void 0:n.csmMonthlySubsOrderTotal)!==null&&h!==void 0?h:[];if(!v.length)return l(i({},X),{totalCadences:d});var m=Z(v),p=new Date(s.getFullYear(),s.getMonth(),1),g=en(m,r,p),b=m[0],y=b.year===s.getFullYear()&&b.month-1===s.getMonth()&&b.totalAmount>=r;return et(g,y,t,o,d)};var er="giftContinuousSubscriptionMonth",ei="giftQualifiedThisMonth",ea=function(e,n){var t,o;return e===null||e===void 0?void 0:(o=e.properties)===null||o===void 0?void 0:(t=o.find(function(e){return(e===null||e===void 0?void 0:e.name)===n}))===null||t===void 0?void 0:t.value},el=function(e){var n;if(!(e===null||e===void 0?void 0:(n=e.properties)===null||n===void 0?void 0:n.length))return null;var t=ea(e,er),o=ea(e,ei);if(t===void 0&&o===void 0)return null;var r=Number.parseInt(t!==null&&t!==void 0?t:"",10);return{continuousSubscriptionMonths:Number.isNaN(r)?0:Math.max(r,0),qualifiedThisMonth:Number.parseInt(o!==null&&o!==void 0?o:"",10)===1}};import{jsx as es}from"react/jsx-runtime";var ed=function(e){var n;var t,o,r,a;var l=e.subscriptionData,s=e.loyaltyData,d=e.translationConfig,u=e.giftConfig,c=e.showRoadmap,f=c===void 0?!0:c,h=e.showLogo,v=h===void 0?!0:h,m=e.showTotalSection,p=m===void 0?!0:m,g=(t=u===null||u===void 0?void 0:u.giftCycle)!==null&&t!==void 0?t:0,b=(o=u===null||u===void 0?void 0:u.thresholdValue)!==null&&o!==void 0?o:0,y=parseFloat(String((r=l===null||l===void 0?void 0:(n=l.approximateMonthlyTotalResponse)===null||n===void 0?void 0:n.currentMonthTotal)!==null&&r!==void 0?r:"0")),C=el(s),x=C?!C.qualifiedThisMonth:y<b,w=eo({data:l,giftCycle:g,maxCSM:(a=u===null||u===void 0?void 0:u.maxCSM)!==null&&a!==void 0?a:0,minSpend:b,giftProperties:C,today:new Date}),j=w.completedMonthsInCadence,S=w.currentCadenceIndex,L=w.issuedCadenceCount,O={value:j,cadenceMonths:g,notQualifyThisMonth:x,amountShow:y,translationConfig:d,giftConfig:u,currentCadenceIndex:S,issuedCadenceCount:L,showRoadmap:f,showLogo:v,showTotalSection:p};return es(_,{className:"loyalty-reward-card",children:M.isMobile?es($,i({},O)):es(U,i({},O))})};ed.displayName="GiftReward";var eu=ed;export{U as GiftProgressBar,$ as GiftProgressBarMobile,eu as GiftReward};//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/gitlab-runner-data/builds/nextgen-development/loyalty/npm/react-loyalty-elements/dist/GiftProgressBar/index.mjs","../../src/GiftProgressBar/GiftProgressBar.tsx","../../src/GiftProgressBar/GiftProgressBarMonthDescription.tsx","../../src/GiftProgressBar/GiftWheelCenterContent.tsx","../../src/GiftProgressBar/GiftProgressBar.styled.tsx","../../src/GiftProgressBar/GiftProgressBarMobile.tsx","../../src/GiftProgressBar/logic/calculateGiftMonthCompletion.ts","../../src/GiftProgressBar/logic/readGiftProperties.ts","../../src/GiftProgressBar/GiftReward.tsx"],"names":["b","_","c","C","d","P","f","E","g","W","i","Q","k","w","l","O","a","L","y","x","CircularProgressbarWithChildren","buildStyles","jsx","jsxs","GiftProgressBarMonthDescription","value","cadenceMonths","notQualifyThisMonth","translationConfig","handleOpenLearnMore","showLogo","isComplete","infoText","replacePlaceholders","monthsComplete","completed_months","total_months","giftEarned","notQualify","StyledCard","children","className","src","loyaltyLogoBlack","alt","Learn3XLink","id","onClick","learnMore","GiftProgressBarMonthDescription_default","FaExclamationTriangle","NsTypography","GiftWheelCenterContent","monthsLabel","giftIssuedLabel","IconContainer","color","ProgressBarCenter","component","variant","weight","GiftWheelCenterContent_default","GiftRewardContainer","newStyled","div","GiftProgressBarWrapper","GiftDetailsColumn","GiftProgressBar","props","giftConfig","currentCadenceIndex","issuedCadenceCount","showRoadmap","totalCadences","Math","floor","maxCSM","strokeWidth","background","styles","rotation","strokeLinecap","backgroundColor","pathColor","trailColor","RadialSeparator_default","count","GiftRoadmap_default","giftCycle","monthLabel","roadmapMonthLabel","giftLabel","roadmapGiftLabel","GiftProgressBar_default","GiftProgressBarMobile","amountShow","showTotalSection","approximateMonthlyText","approximateMonthly","currency_symbol","estimated_running_subscription_spend","LoyaltyProgressSubContainer","RewardProgressTotalContainer","colorOverride","GiftProgressBarMobile_default","EMPTY_RESULT","completedMonthsInCadence","totalCSMCount","isGiftIssued","isProgramComplete","sortByDateDesc","records","sort","year","month","getPreviousMonthDate","Date","countConsecutiveQualifyingMonths","sorted","minSpend","currentMonthDate","streak","length","record","recordDate","prev","getTime","totalAmount","buildResult","csmCount","qualifiedThisMonth","min","max","remainder","rawCadenceIndex","calculateGiftMonthCompletion","data","giftProperties","today","continuousSubscriptionMonths","csmMonthlySubsOrderTotal","getFullYear","getMonth","latest","GIFT_CSM_PROPERTY","GIFT_QUALIFIED_PROPERTY","findValue","response","name","properties","find","property","readGiftProperties","rawMonths","rawQualified","months","Number","parseInt","isNaN","GiftReward","subscriptionData","loyaltyResponse","thresholdValue","parseFloat","String","approximateMonthlyTotalResponse","currentMonthTotal","commonProps","applicationContainer","isMobile","GiftReward_default"],"mappings":"ogHAAA,OAAOA,KAAKC,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,KAAK,uBAA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AA,EAAYO,MAAA,UAAZP,WAAAA,EAAsB,EAC9BkD,SAAAA,EACAkB,eAAAA,EACAC,MAAO,IAAItB,IACf,GAPQV,EAAsE6B,EAAtE7B,yBAA0BpC,EAA4CiE,EAA5CjE,oBAAqBC,EAAuBgE,EAAvBhE,mBASjDgG,EAAc,CAChB9I,MAAOiF,EACPhF,cAAAA,EACAC,oBAAAA,EACAoE,WAAAA,EACAnE,kBAAAA,EACAyC,WAAAA,EACAC,oBAAAA,EACAC,mBAAAA,EACAC,YAAAA,EACA1C,SAAAA,EACAkE,iBAAAA,CACJ,EAEA,OACI1E,GAACwC,EAAA,CAAoBrB,UAAU,sBAC1BD,SAAAgI,EAAYC,QAAA,CAAWnJ,GAACkF,EAAA,KAA0B+D,IAAkBjJ,GAACuE,EAAA,KAAoB0E,GAAa,EAGnH,EAEOG,GAAQX,UAAAA,KAAAA,eAAAA,CAAAA,KAAAA,qBAAAA,CAAAA,MAAAA,UAAAA","sourcesContent":["import{b as _,c as C,d as P,f as E,g as W,i as Q,k as w,l as O}from\"../chunk-TURO34CN.mjs\";import{a as L}from\"../chunk-M6F5BD5Q.mjs\";import{a as y}from\"../chunk-THTK5CGU.mjs\";import{d as x}from\"../chunk-PN67M2PP.mjs\";import\"../chunk-CBUBKPM6.mjs\";import\"../chunk-73SFLUWV.mjs\";import{CircularProgressbarWithChildren as te,buildStyles as oe}from\"react-circular-progressbar\";import{jsx as R,jsxs as J}from\"react/jsx-runtime\";var H=({value:a,cadenceMonths:t,notQualifyThisMonth:e,translationConfig:n,handleOpenLearnMore:r=()=>{},showLogo:o=!0})=>{let i=t>0&&a===t&&!e,l=y(n.monthsComplete,{completed_months:a,total_months:t});return i?l=n.giftEarned:e&&(l=n.notQualify),J(C,{children:[o&&R(\"img\",{className:\"reward-logo\",src:n.loyaltyLogoBlack,alt:\"Rewards Logo\"}),R(\"div\",{className:\"info-item\",children:l}),R(P,{id:\"learnMoreGift\",onClick:r,children:R(\"u\",{children:n.learnMore})})]})},F=H;import{FaExclamationTriangle as Z}from\"react-icons/fa\";import{NsTypography as S}from\"@nuskin/foundation-ui-components\";import{jsx as b,jsxs as ee}from\"react/jsx-runtime\";var j=({isComplete:a,notQualifyThisMonth:t,value:e,cadenceMonths:n,monthsLabel:r,giftIssuedLabel:o})=>t?b(Q,{children:b(Z,{className:\"outline-exclamation-icon\",color:\"#91ACC8\"})}):ee(E,{children:[b(S,{component:\"div\",className:\"center-value-progress-bar-price\",variant:\"title-l\",weight:\"bold\",children:`${e}/${n}`}),b(S,{variant:\"label-s\",weight:\"bold\",component:\"div\",className:\"center-value-progress-bar-voucher\",children:r}),a&&b(S,{variant:\"label-s\",weight:\"bold\",component:\"div\",className:\"center-value-progress-bar-voucher\",children:o})]}),T=j;var A=x.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n background-color: #f5f5f5;\n border: 1px solid #e0e0e0;\n border-radius: 10px;\n padding: 1.5rem;\n margin-bottom: 20px;\n height: 50%;\n margin: auto;\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: stretch;\n width: 100%;\n }\n`,Y=x.div`\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n gap: 24px;\n width: 100%;\n\n .reward-progress {\n height: 150px;\n width: 150px;\n flex-shrink: 0;\n\n /* The library stylesheet is not bundled, so the SVG stays inline and its baseline gap\n makes the wrapper taller than the ring, pushing the radial separators off centre. */\n > div {\n height: 100%;\n }\n\n .CircularProgressbar {\n display: block;\n width: 100%;\n height: 100%;\n }\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: center;\n }\n`,q=x.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 16px;\n flex: 1 0 0;\n min-width: 0;\n\n /* The wrapper turns into a column here, so flex-basis governs height and the width would\n otherwise collapse to shrink-to-fit under the wrapper's align-items: center. */\n @media (max-width: 950px) {\n width: 100%;\n align-self: stretch;\n text-align: center;\n }\n`;import{jsx as M,jsxs as k}from\"react/jsx-runtime\";var re=a=>{let{value:t=0,cadenceMonths:e=0,notQualifyThisMonth:n=!1,translationConfig:r,giftConfig:o,currentCadenceIndex:i=0,issuedCadenceCount:s=0,showRoadmap:l=!0,handleOpenLearnMore:p=()=>{},showLogo:c=!0}=a,m=e>0&&t===e&&!n,d=e>0?Math.floor((o?.maxCSM??0)/e):0;return k(Y,{children:[M(\"div\",{className:\"reward-progress\",children:k(te,{value:e>0?t/e*100:0,strokeWidth:12,background:!0,styles:oe({rotation:.5,strokeLinecap:\"butt\",backgroundColor:\"#fff\",pathColor:\"#ED7219\",trailColor:\"#E0E0E0\"}),children:[e>0&&M(w,{count:e}),M(T,{isComplete:m,notQualifyThisMonth:n,value:t,cadenceMonths:e,monthsLabel:r?.monthsLabel??\"Months\",giftIssuedLabel:r?.giftIssuedLabel??\"Gift issued\"})]})}),k(q,{children:[l&&d>1&&M(L,{giftCycle:e,maxCSM:o?.maxCSM??0,currentCadenceIndex:i,issuedCadenceCount:s,translationConfig:{monthLabel:r?.roadmapMonthLabel??\"Month %cadence_month%\",giftLabel:r?.roadmapGiftLabel??\"Gift %gift_index%\"}}),M(F,{value:t,cadenceMonths:e,notQualifyThisMonth:n,translationConfig:r,giftConfig:o,handleOpenLearnMore:p,showLogo:c})]})]})},I=re;import{CircularProgressbarWithChildren as ne,buildStyles as ae}from\"react-circular-progressbar\";import{NsTypography as X}from\"@nuskin/foundation-ui-components\";import{jsx as f,jsxs as v}from\"react/jsx-runtime\";var ie=a=>{let{value:t=0,cadenceMonths:e=0,notQualifyThisMonth:n=!1,amountShow:r,translationConfig:o,giftConfig:i,currentCadenceIndex:s=0,issuedCadenceCount:l=0,showRoadmap:p=!0,handleOpenLearnMore:c=()=>{},showLogo:m=!0,showTotalSection:d=!0}=a,u=e>0&&t===e&&!n,h=e>0?Math.floor((i?.maxCSM??0)/e):0,g=y(o.monthsComplete,{completed_months:t,total_months:e});u?g=o.giftEarned:n&&(g=o.notQualify);let z=y(o.approximateMonthly,{currency_symbol:\"\",estimated_running_subscription_spend:\"\"});return v(_,{children:[f(\"div\",{className:\"reward-progress\",children:v(ne,{value:e>0?t/e*100:0,strokeWidth:12,background:!0,styles:ae({rotation:.5,strokeLinecap:\"butt\",backgroundColor:\"#fff\",pathColor:\"#ED7219\",trailColor:\"#E0E0E0\"}),children:[e>0&&f(w,{count:e}),f(T,{isComplete:u,notQualifyThisMonth:n,value:t,cadenceMonths:e,monthsLabel:o?.monthsLabel??\"Months\",giftIssuedLabel:o?.giftIssuedLabel??\"Gift issued\"})]})}),p&&h>1&&f(L,{giftCycle:e,maxCSM:i?.maxCSM??0,currentCadenceIndex:s,issuedCadenceCount:l,translationConfig:{monthLabel:o?.roadmapMonthLabel??\"Month %cadence_month%\",giftLabel:o?.roadmapGiftLabel??\"Gift %gift_index%\"}}),v(C,{children:[m&&f(\"img\",{className:\"reward-logo\",src:o.loyaltyLogoBlack,alt:\"Rewards Logo\"}),f(\"div\",{className:\"info-item\",children:g})]}),f(W,{children:d&&!u&&v(X,{variant:\"body-s\",weight:\"normal\",className:\"reward-subtitle\",colorOverride:\"#252525\",component:\"div\",children:[z,\" \",f(X,{component:\"span\",className:\"button-price\",variant:\"body-s\",weight:\"bold\",children:r??0})]})}),f(C,{children:f(P,{id:\"learnMoreGiftMobile\",onClick:c,children:f(\"u\",{children:o.learnMore})})})]})},B=ie;var N={completedMonthsInCadence:0,totalCSMCount:0,totalCadences:0,currentCadenceIndex:0,issuedCadenceCount:0,isGiftIssued:!1,isProgramComplete:!1},se=a=>[...a].sort((t,e)=>t.year===e.year?e.month-t.month:e.year-t.year),le=(a,t)=>new Date(a,t-2,1),me=(a,t,e)=>{let n=0;for(let r=0;r<a.length;r++){let o=a[r],i=new Date(o.year,o.month-1,1);if(r===0){if(i>e)break}else{let s=a[r-1];if(i.getTime()!==le(s.year,s.month).getTime())break}if(o.totalAmount<t)break;n++}return n},V=(a,t,e,n,r)=>{let o=Math.min(Math.max(a,0),n);if(o===0)return{...N,totalCadences:r};let i=o%e,s=i===0&&t,l=Math.min(Math.floor(o/e),r),p=s?l-1:Math.floor(o/e);return{completedMonthsInCadence:s?e:i,totalCSMCount:o,totalCadences:r,currentCadenceIndex:Math.min(Math.max(p,0),r-1),issuedCadenceCount:l,isGiftIssued:s,isProgramComplete:o>=n}},U=({data:a,giftCycle:t,maxCSM:e,minSpend:n,giftProperties:r,today:o})=>{let i=t>0?Math.floor(e/t):0;if(i<=0)return{...N,totalCadences:Math.max(i,0)};if(r){let{continuousSubscriptionMonths:u,qualifiedThisMonth:h}=r,G=u+(h?1:0);return V(G,h,t,e,i)}let s=a?.csmMonthlySubsOrderTotal??[];if(!s.length)return{...N,totalCadences:i};let l=se(s),p=new Date(o.getFullYear(),o.getMonth(),1),c=me(l,n,p),m=l[0],d=m.year===o.getFullYear()&&m.month-1===o.getMonth()&&m.totalAmount>=n;return V(c,d,t,e,i)};var fe=\"giftContinuousSubscriptionMonth\",pe=\"giftQualifiedThisMonth\",$=(a,t)=>a?.properties?.find(e=>e?.name===t)?.value,K=a=>{if(!a?.properties?.length)return null;let t=$(a,fe),e=$(a,pe);if(t===void 0&&e===void 0)return null;let n=Number.parseInt(t??\"\",10);return{continuousSubscriptionMonths:Number.isNaN(n)?0:Math.max(n,0),qualifiedThisMonth:Number.parseInt(e??\"\",10)===1}};import{jsx as D}from\"react/jsx-runtime\";var ce=a=>{let{subscriptionData:t,loyaltyResponse:e,translationConfig:n,giftConfig:r,showRoadmap:o=!0,showLogo:i=!0,showTotalSection:s=!0}=a,l=r?.giftCycle??0,p=r?.thresholdValue??0,c=parseFloat(String(t?.approximateMonthlyTotalResponse?.currentMonthTotal??\"0\")),m=K(e),d=m?!m.qualifiedThisMonth:c<p,{completedMonthsInCadence:u,currentCadenceIndex:h,issuedCadenceCount:G}=U({data:t,giftCycle:l,maxCSM:r?.maxCSM??0,minSpend:p,giftProperties:m,today:new Date}),g={value:u,cadenceMonths:l,notQualifyThisMonth:d,amountShow:c,translationConfig:n,giftConfig:r,currentCadenceIndex:h,issuedCadenceCount:G,showRoadmap:o,showLogo:i,showTotalSection:s};return D(A,{className:\"loyalty-reward-card\",children:O.isMobile?D(B,{...g}):D(I,{...g})})},de=ce;export{I as GiftProgressBar,B as GiftProgressBarMobile,de as GiftReward};\n","import React from 'react';\nimport { CircularProgressbarWithChildren, buildStyles } from 'react-circular-progressbar';\nimport RadialSeparators from '../CircularProgressBar/RadialSeparator';\nimport GiftRoadmap from '../GiftRoadmap/GiftRoadmap';\nimport GiftProgressBarMonthDescription from './GiftProgressBarMonthDescription';\nimport GiftWheelCenterContent from './GiftWheelCenterContent';\nimport { GiftProgressBarProps } from './types';\nimport { GiftDetailsColumn, GiftProgressBarWrapper } from './GiftProgressBar.styled';\n\nconst GiftProgressBar = (props: GiftProgressBarProps) => {\n const {\n value = 0,\n cadenceMonths = 0,\n notQualifyThisMonth = false,\n translationConfig,\n giftConfig,\n currentCadenceIndex = 0,\n issuedCadenceCount = 0,\n showRoadmap = true,\n handleOpenLearnMore = () => {},\n showLogo = true,\n } = props;\n\n const isComplete = cadenceMonths > 0 && value === cadenceMonths && !notQualifyThisMonth;\n const totalCadences = cadenceMonths > 0 ? Math.floor((giftConfig?.maxCSM ?? 0) / cadenceMonths) : 0;\n\n return (\n <GiftProgressBarWrapper>\n <div className=\"reward-progress\">\n <CircularProgressbarWithChildren\n value={cadenceMonths > 0 ? (value / cadenceMonths) * 100 : 0}\n strokeWidth={12}\n background\n styles={buildStyles({\n rotation: 0.5,\n strokeLinecap: 'butt',\n backgroundColor: '#fff',\n pathColor: '#ED7219',\n trailColor: '#E0E0E0',\n })}\n >\n {cadenceMonths > 0 && <RadialSeparators count={cadenceMonths} />}\n <GiftWheelCenterContent\n isComplete={isComplete}\n notQualifyThisMonth={notQualifyThisMonth}\n value={value}\n cadenceMonths={cadenceMonths}\n monthsLabel={translationConfig?.monthsLabel ?? 'Months'}\n giftIssuedLabel={translationConfig?.giftIssuedLabel ?? 'Gift issued'}\n />\n </CircularProgressbarWithChildren>\n </div>\n <GiftDetailsColumn>\n {showRoadmap && totalCadences > 1 && (\n <GiftRoadmap\n giftCycle={cadenceMonths}\n maxCSM={giftConfig?.maxCSM ?? 0}\n currentCadenceIndex={currentCadenceIndex}\n issuedCadenceCount={issuedCadenceCount}\n translationConfig={{\n monthLabel: translationConfig?.roadmapMonthLabel ?? 'Month %cadence_month%',\n giftLabel: translationConfig?.roadmapGiftLabel ?? 'Gift %gift_index%',\n }}\n />\n )}\n <GiftProgressBarMonthDescription\n value={value}\n cadenceMonths={cadenceMonths}\n notQualifyThisMonth={notQualifyThisMonth}\n translationConfig={translationConfig}\n giftConfig={giftConfig}\n handleOpenLearnMore={handleOpenLearnMore}\n showLogo={showLogo}\n />\n </GiftDetailsColumn>\n </GiftProgressBarWrapper>\n );\n};\n\nexport default GiftProgressBar;\nexport { GiftProgressBar };\n","import React from 'react';\nimport { Learn3XLink, StyledCard } from '../CircularProgressBar/CircularProgressBar.styled';\nimport { GiftProgressBarProps } from './types';\nimport { replacePlaceholders } from '../Utils/helper';\n\ntype GiftProgressBarMonthDescriptionProps = Pick<\n GiftProgressBarProps,\n | 'value'\n | 'cadenceMonths'\n | 'notQualifyThisMonth'\n | 'translationConfig'\n | 'giftConfig'\n | 'handleOpenLearnMore'\n | 'showLogo'\n>;\n\nconst GiftProgressBarMonthDescription = ({\n value,\n cadenceMonths,\n notQualifyThisMonth,\n translationConfig,\n handleOpenLearnMore = () => {},\n showLogo = true,\n}: GiftProgressBarMonthDescriptionProps) => {\n const isComplete = cadenceMonths > 0 && value === cadenceMonths && !notQualifyThisMonth;\n\n const monthsCompleteText = replacePlaceholders(translationConfig.monthsComplete, {\n completed_months: value,\n total_months: cadenceMonths,\n });\n\n let infoText = monthsCompleteText;\n if (isComplete) {\n infoText = translationConfig.giftEarned;\n } else if (notQualifyThisMonth) {\n infoText = translationConfig.notQualify;\n }\n\n return (\n <StyledCard>\n {showLogo && <img className=\"reward-logo\" src={translationConfig.loyaltyLogoBlack} alt=\"Rewards Logo\" />}\n <div className=\"info-item\">{infoText}</div>\n <Learn3XLink id=\"learnMoreGift\" onClick={handleOpenLearnMore}>\n <u>{translationConfig.learnMore}</u>\n </Learn3XLink>\n </StyledCard>\n );\n};\n\nexport default GiftProgressBarMonthDescription;\nexport { GiftProgressBarMonthDescription };\n","import React from 'react';\nimport { FaExclamationTriangle } from 'react-icons/fa';\nimport { NsTypography } from '@nuskin/foundation-ui-components';\nimport { IconContainer, ProgressBarCenter } from '../CircularProgressBar/CircularProgressBar.styled';\n\ntype GiftWheelCenterContentProps = Readonly<{\n isComplete: boolean;\n notQualifyThisMonth: boolean;\n value: number;\n cadenceMonths: number;\n monthsLabel: string;\n giftIssuedLabel: string;\n}>;\n\n/**\n * Content inside the gift wheel ring — shared by the desktop and mobile variants so the fraction /\n * warning / gift-issued states can't drift apart between the two.\n */\nconst GiftWheelCenterContent = ({\n isComplete,\n notQualifyThisMonth,\n value,\n cadenceMonths,\n monthsLabel,\n giftIssuedLabel,\n}: GiftWheelCenterContentProps) => {\n if (notQualifyThisMonth) {\n return (\n <IconContainer>\n <FaExclamationTriangle className=\"outline-exclamation-icon\" color=\"#91ACC8\" />\n </IconContainer>\n );\n }\n return (\n <ProgressBarCenter>\n <NsTypography component=\"div\" className=\"center-value-progress-bar-price\" variant=\"title-l\" weight=\"bold\">\n {`${value}/${cadenceMonths}`}\n </NsTypography>\n <NsTypography variant=\"label-s\" weight=\"bold\" component=\"div\" className=\"center-value-progress-bar-voucher\">\n {monthsLabel}\n </NsTypography>\n {isComplete && (\n <NsTypography\n variant=\"label-s\"\n weight=\"bold\"\n component=\"div\"\n className=\"center-value-progress-bar-voucher\"\n >\n {giftIssuedLabel}\n </NsTypography>\n )}\n </ProgressBarCenter>\n );\n};\n\nexport default GiftWheelCenterContent;\nexport { GiftWheelCenterContent };\nexport type { GiftWheelCenterContentProps };\n","import styled from '@emotion/styled';\n\n// GiftProgressBar uses these shared styled components directly from CircularProgressBar.styled\n// to stay consistent with the existing design language.\n// Only gift-specific overrides are defined here.\n\nexport const GiftRewardContainer = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n background-color: #f5f5f5;\n border: 1px solid #e0e0e0;\n border-radius: 10px;\n padding: 1.5rem;\n margin-bottom: 20px;\n height: 50%;\n margin: auto;\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: stretch;\n width: 100%;\n }\n`;\n\nexport const GiftProgressBarWrapper = styled.div`\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n gap: 24px;\n width: 100%;\n\n .reward-progress {\n height: 150px;\n width: 150px;\n flex-shrink: 0;\n\n /* The library stylesheet is not bundled, so the SVG stays inline and its baseline gap\n makes the wrapper taller than the ring, pushing the radial separators off centre. */\n > div {\n height: 100%;\n }\n\n .CircularProgressbar {\n display: block;\n width: 100%;\n height: 100%;\n }\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: center;\n }\n`;\n\nexport const GiftDetailsColumn = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 16px;\n flex: 1 0 0;\n min-width: 0;\n\n /* The wrapper turns into a column here, so flex-basis governs height and the width would\n otherwise collapse to shrink-to-fit under the wrapper's align-items: center. */\n @media (max-width: 950px) {\n width: 100%;\n align-self: stretch;\n text-align: center;\n }\n`;\n","import React from 'react';\nimport { CircularProgressbarWithChildren, buildStyles } from 'react-circular-progressbar';\nimport { NsTypography } from '@nuskin/foundation-ui-components';\nimport RadialSeparators from '../CircularProgressBar/RadialSeparator';\nimport {\n Learn3XLink,\n LoyaltyProgressSubContainer,\n RewardProgressTotalContainer,\n StyledCard,\n} from '../CircularProgressBar/CircularProgressBar.styled';\nimport GiftRoadmap from '../GiftRoadmap/GiftRoadmap';\nimport GiftWheelCenterContent from './GiftWheelCenterContent';\nimport { GiftProgressBarProps } from './types';\nimport { replacePlaceholders } from '../Utils/helper';\n\nconst GiftProgressBarMobile = (props: GiftProgressBarProps) => {\n const {\n value = 0,\n cadenceMonths = 0,\n notQualifyThisMonth = false,\n amountShow,\n translationConfig,\n giftConfig,\n currentCadenceIndex = 0,\n issuedCadenceCount = 0,\n showRoadmap = true,\n handleOpenLearnMore = () => {},\n showLogo = true,\n showTotalSection = true,\n } = props;\n\n const isComplete = cadenceMonths > 0 && value === cadenceMonths && !notQualifyThisMonth;\n const totalCadences = cadenceMonths > 0 ? Math.floor((giftConfig?.maxCSM ?? 0) / cadenceMonths) : 0;\n\n const monthsCompleteText = replacePlaceholders(translationConfig.monthsComplete, {\n completed_months: value,\n total_months: cadenceMonths,\n });\n\n let infoText = monthsCompleteText;\n if (isComplete) {\n infoText = translationConfig.giftEarned;\n } else if (notQualifyThisMonth) {\n infoText = translationConfig.notQualify;\n }\n\n const approximateMonthlyText = replacePlaceholders(translationConfig.approximateMonthly, {\n currency_symbol: '',\n estimated_running_subscription_spend: '',\n });\n\n return (\n <LoyaltyProgressSubContainer>\n <div className=\"reward-progress\">\n <CircularProgressbarWithChildren\n value={cadenceMonths > 0 ? (value / cadenceMonths) * 100 : 0}\n strokeWidth={12}\n background\n styles={buildStyles({\n rotation: 0.5,\n strokeLinecap: 'butt',\n backgroundColor: '#fff',\n pathColor: '#ED7219',\n trailColor: '#E0E0E0',\n })}\n >\n {cadenceMonths > 0 && <RadialSeparators count={cadenceMonths} />}\n <GiftWheelCenterContent\n isComplete={isComplete}\n notQualifyThisMonth={notQualifyThisMonth}\n value={value}\n cadenceMonths={cadenceMonths}\n monthsLabel={translationConfig?.monthsLabel ?? 'Months'}\n giftIssuedLabel={translationConfig?.giftIssuedLabel ?? 'Gift issued'}\n />\n </CircularProgressbarWithChildren>\n </div>\n {showRoadmap && totalCadences > 1 && (\n <GiftRoadmap\n giftCycle={cadenceMonths}\n maxCSM={giftConfig?.maxCSM ?? 0}\n currentCadenceIndex={currentCadenceIndex}\n issuedCadenceCount={issuedCadenceCount}\n translationConfig={{\n monthLabel: translationConfig?.roadmapMonthLabel ?? 'Month %cadence_month%',\n giftLabel: translationConfig?.roadmapGiftLabel ?? 'Gift %gift_index%',\n }}\n />\n )}\n <StyledCard>\n {showLogo && (\n <img className=\"reward-logo\" src={translationConfig.loyaltyLogoBlack} alt=\"Rewards Logo\" />\n )}\n <div className=\"info-item\">{infoText}</div>\n </StyledCard>\n <RewardProgressTotalContainer>\n {showTotalSection && !isComplete && (\n <NsTypography\n variant=\"body-s\"\n weight=\"normal\"\n className=\"reward-subtitle\"\n colorOverride=\"#252525\"\n component=\"div\"\n >\n {approximateMonthlyText}{' '}\n <NsTypography component=\"span\" className=\"button-price\" variant=\"body-s\" weight=\"bold\">\n {amountShow ?? 0}\n </NsTypography>\n </NsTypography>\n )}\n </RewardProgressTotalContainer>\n <StyledCard>\n <Learn3XLink id=\"learnMoreGiftMobile\" onClick={handleOpenLearnMore}>\n <u>{translationConfig.learnMore}</u>\n </Learn3XLink>\n </StyledCard>\n </LoyaltyProgressSubContainer>\n );\n};\n\nexport default GiftProgressBarMobile;\nexport { GiftProgressBarMobile };\n","import { CalculateGiftCompletionParams, GiftCompletionResult } from '../types';\n\ntype GiftRecord = {\n year: number;\n month: number;\n totalAmount: number;\n promocode?: string | null;\n};\n\nconst EMPTY_RESULT: GiftCompletionResult = {\n completedMonthsInCadence: 0,\n totalCSMCount: 0,\n totalCadences: 0,\n currentCadenceIndex: 0,\n issuedCadenceCount: 0,\n isGiftIssued: false,\n isProgramComplete: false,\n};\n\nconst sortByDateDesc = (records: GiftRecord[]): GiftRecord[] =>\n [...records].sort((a, b) => (a.year === b.year ? b.month - a.month : b.year - a.year));\n\n// Returns a Date representing the month prior to (year, month) where month is 1-indexed\nconst getPreviousMonthDate = (year: number, month: number): Date => new Date(year, month - 2, 1);\n\n/**\n * Walks backwards from the most recent non-future record and counts the unbroken run of\n * qualifying months — no month gaps, each month at or above the threshold.\n */\nconst countConsecutiveQualifyingMonths = (sorted: GiftRecord[], minSpend: number, currentMonthDate: Date): number => {\n let streak = 0;\n\n for (let i = 0; i < sorted.length; i++) {\n const record = sorted[i];\n const recordDate = new Date(record.year, record.month - 1, 1);\n\n if (i === 0) {\n if (recordDate > currentMonthDate) break;\n } else {\n const prev = sorted[i - 1];\n if (recordDate.getTime() !== getPreviousMonthDate(prev.year, prev.month).getTime()) break;\n }\n\n if (record.totalAmount < minSpend) break;\n\n streak++;\n }\n\n return streak;\n};\n\n/**\n * Shared shaping step. Both the loyalty-property source and the record-walk fallback reduce to a\n * qualifying-month count plus whether the current month qualified, so cadence placement is identical\n * regardless of where the numbers came from.\n *\n * Per the business rule the gift is issued the moment the final month of a cadence qualifies, and\n * that issued state is retained until the end of that month — the next cadence starts from zero on\n * the 1st, which is why a completed cadence with an unqualified current month rolls forward.\n */\nconst buildResult = (\n csmCount: number,\n qualifiedThisMonth: boolean,\n giftCycle: number,\n maxCSM: number,\n totalCadences: number,\n): GiftCompletionResult => {\n const totalCSMCount = Math.min(Math.max(csmCount, 0), maxCSM);\n\n if (totalCSMCount === 0) {\n return { ...EMPTY_RESULT, totalCadences };\n }\n\n const remainder = totalCSMCount % giftCycle;\n const isGiftIssued = remainder === 0 && qualifiedThisMonth;\n const issuedCadenceCount = Math.min(Math.floor(totalCSMCount / giftCycle), totalCadences);\n const rawCadenceIndex = isGiftIssued ? issuedCadenceCount - 1 : Math.floor(totalCSMCount / giftCycle);\n\n return {\n completedMonthsInCadence: isGiftIssued ? giftCycle : remainder,\n totalCSMCount,\n totalCadences,\n currentCadenceIndex: Math.min(Math.max(rawCadenceIndex, 0), totalCadences - 1),\n issuedCadenceCount,\n isGiftIssued,\n isProgramComplete: totalCSMCount >= maxCSM,\n };\n};\n\n/**\n * Maps the customer's consecutive subscription month (CSM) streak onto the gift roadmap.\n *\n * Prefers `giftProperties` from the loyalty response, where `continuousSubscriptionMonths` counts\n * the months completed *before* the current one and `qualifiedThisMonth` adds the current month.\n * Falls back to walking `csmMonthlySubsOrderTotal` when those properties are unavailable.\n */\nexport const calculateGiftMonthCompletion = ({\n data,\n giftCycle,\n maxCSM,\n minSpend,\n giftProperties,\n today,\n}: CalculateGiftCompletionParams): GiftCompletionResult => {\n const totalCadences = giftCycle > 0 ? Math.floor(maxCSM / giftCycle) : 0;\n\n if (totalCadences <= 0) {\n return { ...EMPTY_RESULT, totalCadences: Math.max(totalCadences, 0) };\n }\n\n if (giftProperties) {\n const { continuousSubscriptionMonths, qualifiedThisMonth } = giftProperties;\n const csmCount = continuousSubscriptionMonths + (qualifiedThisMonth ? 1 : 0);\n return buildResult(csmCount, qualifiedThisMonth, giftCycle, maxCSM, totalCadences);\n }\n\n const records = (data?.csmMonthlySubsOrderTotal as GiftRecord[] | undefined) ?? [];\n\n if (!records.length) {\n return { ...EMPTY_RESULT, totalCadences };\n }\n\n const sorted = sortByDateDesc(records);\n const currentMonthDate = new Date(today.getFullYear(), today.getMonth(), 1);\n const streak = countConsecutiveQualifyingMonths(sorted, minSpend, currentMonthDate);\n const latest = sorted[0];\n const qualifiedThisMonth =\n latest.year === today.getFullYear() && latest.month - 1 === today.getMonth() && latest.totalAmount >= minSpend;\n\n return buildResult(streak, qualifiedThisMonth, giftCycle, maxCSM, totalCadences);\n};\n","import { GiftLoyaltyProperties, GiftLoyaltyResponse } from '../types';\n\nexport const GIFT_CSM_PROPERTY = 'giftContinuousSubscriptionMonth';\nexport const GIFT_QUALIFIED_PROPERTY = 'giftQualifiedThisMonth';\n\nconst findValue = (response: GiftLoyaltyResponse, name: string): string | undefined =>\n response?.properties?.find((property) => property?.name === name)?.value;\n\n/**\n * Reads the gift counters off the loyalty response. `giftContinuousSubscriptionMonth` counts the\n * completed months *before* the current one; `giftQualifiedThisMonth` says whether the current month\n * has met the threshold. Returns null when neither property is present so callers can fall back.\n */\nexport const readGiftProperties = (response: GiftLoyaltyResponse | null | undefined): GiftLoyaltyProperties | null => {\n if (!response?.properties?.length) {\n return null;\n }\n\n const rawMonths = findValue(response, GIFT_CSM_PROPERTY);\n const rawQualified = findValue(response, GIFT_QUALIFIED_PROPERTY);\n\n if (rawMonths === undefined && rawQualified === undefined) {\n return null;\n }\n\n const months = Number.parseInt(rawMonths ?? '', 10);\n\n return {\n continuousSubscriptionMonths: Number.isNaN(months) ? 0 : Math.max(months, 0),\n qualifiedThisMonth: Number.parseInt(rawQualified ?? '', 10) === 1,\n };\n};\n","import React from 'react';\nimport GiftProgressBar from './GiftProgressBar';\nimport GiftProgressBarMobile from './GiftProgressBarMobile';\nimport { GiftRewardProps } from './types';\nimport { application } from '../Utils/application';\nimport { calculateGiftMonthCompletion } from './logic/calculateGiftMonthCompletion';\nimport { readGiftProperties } from './logic/readGiftProperties';\nimport { GiftRewardContainer } from './GiftProgressBar.styled';\n\nconst GiftReward = (props: GiftRewardProps) => {\n const {\n subscriptionData,\n loyaltyResponse,\n translationConfig,\n giftConfig,\n showRoadmap = true,\n showLogo = true,\n showTotalSection = true,\n } = props;\n\n const cadenceMonths = giftConfig?.giftCycle ?? 0;\n const minSpend = giftConfig?.thresholdValue ?? 0;\n\n const amountShow = parseFloat(String(subscriptionData?.approximateMonthlyTotalResponse?.currentMonthTotal ?? '0'));\n const giftProperties = readGiftProperties(loyaltyResponse);\n const notQualifyThisMonth = giftProperties ? !giftProperties.qualifiedThisMonth : amountShow < minSpend;\n\n const { completedMonthsInCadence, currentCadenceIndex, issuedCadenceCount } = calculateGiftMonthCompletion({\n data: subscriptionData,\n giftCycle: cadenceMonths,\n maxCSM: giftConfig?.maxCSM ?? 0,\n minSpend,\n giftProperties,\n today: new Date(),\n });\n\n const commonProps = {\n value: completedMonthsInCadence,\n cadenceMonths,\n notQualifyThisMonth,\n amountShow,\n translationConfig,\n giftConfig,\n currentCadenceIndex,\n issuedCadenceCount,\n showRoadmap,\n showLogo,\n showTotalSection,\n };\n\n return (\n <GiftRewardContainer className=\"loyalty-reward-card\">\n {application.isMobile ? <GiftProgressBarMobile {...commonProps} /> : <GiftProgressBar {...commonProps} />}\n </GiftRewardContainer>\n );\n};\n\nexport default GiftReward;\nexport { GiftReward };\n"]}
|
|
1
|
+
{"version":3,"sources":["/gitlab-runner-data/builds/nextgen-development/loyalty/npm/react-loyalty-elements/dist/GiftProgressBar/index.mjs","../../src/GiftProgressBar/GiftProgressBar.tsx","../../src/GiftProgressBar/GiftProgressBarMonthDescription.tsx","../../src/GiftProgressBar/GiftWheelCenterContent.tsx","../../src/GiftProgressBar/GiftProgressBar.styled.tsx","../../src/GiftProgressBar/GiftProgressBarMobile.tsx","../../src/GiftProgressBar/logic/calculateGiftMonthCompletion.ts","../../src/GiftProgressBar/logic/readGiftProperties.ts","../../src/GiftProgressBar/GiftReward.tsx"],"names":["b","_","c","C","d","P","f","E","g","W","i","Q","k","w","l","F","a","L","y","O","x","CircularProgressbarWithChildren","buildStyles","jsx","jsxs","GiftProgressBarMonthDescription","value","cadenceMonths","notQualifyThisMonth","translationConfig","giftConfig","handleOpenLearnMore","showLogo","isComplete","infoText","giftEarned","notQualify","replacePlaceholders","callToAction","threshold_value","thresholdValue","currency_symbol","thresholdKey","currencySymbol","StyledCard","children","className","src","loyaltyLogoBlack","alt","Learn3XLink","id","onClick","learnMore","displayName","GiftProgressBarMonthDescription_default","FaExclamationTriangle","NsTypography","GiftWheelCenterContent","monthsLabel","giftIssuedLabel","IconContainer","color","ProgressBarCenter","component","variant","weight","GiftWheelCenterContent_default","GiftRewardContainer","newStyled","div","GiftProgressBarWrapper","GiftDetailsColumn","GiftProgressBar","props","currentCadenceIndex","issuedCadenceCount","showRoadmap","totalCadences","Math","floor","maxCSM","strokeWidth","background","styles","rotation","strokeLinecap","backgroundColor","pathColor","trailColor","RadialSeparator_default","count","GiftRoadmap_default","giftCycle","monthLabel","roadmapMonthLabel","giftLabel","roadmapGiftLabel","GiftProgressBar_default","GiftProgressBarMobile","amountShow","showTotalSection","monthsComplete","completed_months","total_months","approximateMonthlyText","approximateMonthly","estimated_running_subscription_spend","LoyaltyProgressSubContainer","RewardProgressTotalContainer","colorOverride","GiftProgressBarMobile_default","EMPTY_RESULT","completedMonthsInCadence","totalCSMCount","isGiftIssued","isProgramComplete","sortByDateDesc","records","sort","year","month","getPreviousMonthDate","Date","countConsecutiveQualifyingMonths","sorted","minSpend","currentMonthDate","streak","length","record","recordDate","prev","getTime","totalAmount","buildResult","csmCount","qualifiedThisMonth","min","max","remainder","rawCadenceIndex","calculateGiftMonthCompletion","data","giftProperties","today","continuousSubscriptionMonths","csmMonthlySubsOrderTotal","getFullYear","getMonth","latest","GIFT_CSM_PROPERTY","GIFT_QUALIFIED_PROPERTY","findValue","loyaltyData","name","properties","find","property","readGiftProperties","rawMonths","rawQualified","months","Number","parseInt","isNaN","GiftReward","subscriptionData","parseFloat","String","approximateMonthlyTotalResponse","currentMonthTotal","commonProps","applicationContainer","isMobile","GiftReward_default"],"mappings":"ogHAAA,OAAOA,KAAKC,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,KAAK,uBAAwB,QAAOC,KAAKC,CAAC,KAAK,uBAAwB,QAAOD,KAAKE,CAAC,CAAClB,KAAKmB,CAAC,KAAK,uBAAwB,QAAOf,KAAKgB,CAAC,KAAK,uBAAwB,OAAM,uBAAwB,OAAM,uBCCpQ,QAASC,mCAAAA,CAAAA,CAAiCC,eAAAA,CAAAA,KAAmB,4BCuCrD,QACiBC,OAAAA,CAAAA,CADjBC,QAAAA,CAAAA,KAAA,mBAxBR,CAAA,IAAMC,EAAkC,gBACpCC,IAAAA,MACAC,IAAAA,cACAC,IAAAA,oBACAC,IAAAA,kBACAC,IAAAA,WACAC,IAAAA,oBAAAA,EAAAA,WAAsB,WAAO,EAA7BA,EACAC,IAAAA,SAAAA,EAAAA,WAAW,CAAA,EAAXA,EAEA,IAAMC,EAAaN,EAAgB,GAAKD,IAAUC,GAAiB,CAACC,EAEhEM,EAAW,GACf,OAAID,EACAC,EAAWL,EAAkBM,UAAA,CACtBP,EACPM,EAAWL,EAAkBO,UAAA,CAE7BF,E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AA,EACA7C,SAAAA,EACAqE,iBAAAA,CACJ,EAEA,OACI9E,GAAC6C,EAAA,CAAoBtB,UAAU,sBAC1BD,SAAAgI,EAAYC,QAAA,CAAWvJ,GAACwF,EAAA,KAA0B6D,IAAkBrJ,GAAC2E,EAAA,KAAoB0E,GAAa,EAGnH,CAEAN,CAAAA,GAAWhH,WAAA,CAAc,aAEzB,IAAOyH,GAAQT,UAAAA,KAAAA,eAAAA,CAAAA,KAAAA,qBAAAA,CAAAA,MAAAA,UAAAA","sourcesContent":["import{b as _,c as C,d as P,f as E,g as W,i as Q,k as w,l as F}from\"../chunk-NVD2PQ2C.mjs\";import{a as L}from\"../chunk-UHWCPMTT.mjs\";import{a as y,b as O}from\"../chunk-3RJWIGAN.mjs\";import{d as x}from\"../chunk-PN67M2PP.mjs\";import\"../chunk-CBUBKPM6.mjs\";import\"../chunk-73SFLUWV.mjs\";import{CircularProgressbarWithChildren as ae,buildStyles as ie}from\"react-circular-progressbar\";import{jsx as T,jsxs as oe}from\"react/jsx-runtime\";var A=({value:a,cadenceMonths:t,notQualifyThisMonth:e,translationConfig:n,giftConfig:r,handleOpenLearnMore:o=()=>{},showLogo:i=!0})=>{let s=t>0&&a===t&&!e,l=\"\";return s?l=n.giftEarned:e?l=n.notQualify:l=y(n.callToAction,{threshold_value:r.thresholdValue,currency_symbol:r.thresholdKey===\"subtotal\"?O():\"\"}),oe(C,{children:[i&&T(\"img\",{className:\"reward-logo\",src:n.loyaltyLogoBlack,alt:\"Rewards Logo\"}),T(\"div\",{className:\"info-item\",children:l}),T(P,{id:\"learnMoreGift\",onClick:o,children:T(\"u\",{children:n.learnMore})})]})};A.displayName=\"GiftProgressBarMonthDescription\";var Y=A;import{FaExclamationTriangle as re}from\"react-icons/fa\";import{NsTypography as S}from\"@nuskin/foundation-ui-components\";import{jsx as b,jsxs as ne}from\"react/jsx-runtime\";var q=({isComplete:a,notQualifyThisMonth:t,value:e,cadenceMonths:n,monthsLabel:r,giftIssuedLabel:o})=>t?b(Q,{children:b(re,{className:\"outline-exclamation-icon\",color:\"#91ACC8\"})}):ne(E,{children:[b(S,{component:\"div\",className:\"center-value-progress-bar-price\",variant:\"title-l\",weight:\"bold\",children:`${e}/${n}`}),b(S,{variant:\"label-s\",weight:\"bold\",component:\"div\",className:\"center-value-progress-bar-voucher\",children:r}),a&&b(S,{variant:\"label-s\",weight:\"bold\",component:\"div\",className:\"center-value-progress-bar-voucher\",children:o})]});q.displayName=\"GiftWheelCenterContent\";var v=q;var V=x.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n background-color: #f5f5f5;\n border: 1px solid #e0e0e0;\n border-radius: 10px;\n padding: 1.5rem;\n margin-bottom: 20px;\n height: 50%;\n margin: auto;\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: stretch;\n width: 100%;\n }\n`,X=x.div`\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n gap: 24px;\n width: 100%;\n\n .reward-progress {\n height: 150px;\n width: 150px;\n flex-shrink: 0;\n\n /* The library stylesheet is not bundled, so the SVG stays inline and its baseline gap\n makes the wrapper taller than the ring, pushing the radial separators off centre. */\n > div {\n height: 100%;\n }\n\n .CircularProgressbar {\n display: block;\n width: 100%;\n height: 100%;\n }\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: center;\n }\n`,K=x.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 16px;\n flex: 1 0 0;\n min-width: 0;\n\n /* The wrapper turns into a column here, so flex-basis governs height and the width would\n otherwise collapse to shrink-to-fit under the wrapper's align-items: center. */\n @media (max-width: 950px) {\n width: 100%;\n align-self: stretch;\n text-align: center;\n }\n`;import{jsx as G,jsxs as N}from\"react/jsx-runtime\";var U=a=>{let{value:t=0,cadenceMonths:e=0,notQualifyThisMonth:n=!1,translationConfig:r,giftConfig:o,currentCadenceIndex:i=0,issuedCadenceCount:s=0,showRoadmap:l=!0,handleOpenLearnMore:f=()=>{},showLogo:c=!0}=a,d=e>0&&t===e&&!n,p=e>0?Math.floor((o?.maxCSM??0)/e):0;return N(X,{children:[G(\"div\",{className:\"reward-progress\",children:N(ae,{value:e>0?t/e*100:0,strokeWidth:12,background:!0,styles:ie({rotation:.5,strokeLinecap:\"butt\",backgroundColor:\"#fff\",pathColor:\"#ED7219\",trailColor:\"#E0E0E0\"}),children:[e>0&&G(w,{count:e}),G(v,{isComplete:d,notQualifyThisMonth:n,value:t,cadenceMonths:e,monthsLabel:r?.monthsLabel??\"Months\",giftIssuedLabel:r?.giftIssuedLabel??\"Gift issued\"})]})}),N(K,{children:[l&&p>1&&G(L,{giftCycle:e,maxCSM:o?.maxCSM??0,currentCadenceIndex:i,issuedCadenceCount:s,translationConfig:{monthLabel:r?.roadmapMonthLabel??\"Month %cadence_month%\",giftLabel:r?.roadmapGiftLabel??\"Gift %gift_index%\"}}),G(Y,{value:t,cadenceMonths:e,notQualifyThisMonth:n,translationConfig:r,giftConfig:o,handleOpenLearnMore:f,showLogo:c})]})]})};U.displayName=\"GiftProgressBar\";var B=U;import{CircularProgressbarWithChildren as se,buildStyles as le}from\"react-circular-progressbar\";import{NsTypography as $}from\"@nuskin/foundation-ui-components\";import{jsx as m,jsxs as R}from\"react/jsx-runtime\";var z=a=>{let{value:t=0,cadenceMonths:e=0,notQualifyThisMonth:n=!1,amountShow:r,translationConfig:o,giftConfig:i,currentCadenceIndex:s=0,issuedCadenceCount:l=0,showRoadmap:f=!0,handleOpenLearnMore:c=()=>{},showLogo:d=!0,showTotalSection:p=!0}=a,u=e>0&&t===e&&!n,h=e>0?Math.floor((i?.maxCSM??0)/e):0,g=y(o.monthsComplete,{completed_months:t,total_months:e});u?g=o.giftEarned:n&&(g=o.notQualify);let te=y(o.approximateMonthly,{currency_symbol:\"\",estimated_running_subscription_spend:\"\"});return R(_,{children:[m(\"div\",{className:\"reward-progress\",children:R(se,{value:e>0?t/e*100:0,strokeWidth:12,background:!0,styles:le({rotation:.5,strokeLinecap:\"butt\",backgroundColor:\"#fff\",pathColor:\"#ED7219\",trailColor:\"#E0E0E0\"}),children:[e>0&&m(w,{count:e}),m(v,{isComplete:u,notQualifyThisMonth:n,value:t,cadenceMonths:e,monthsLabel:o?.monthsLabel??\"Months\",giftIssuedLabel:o?.giftIssuedLabel??\"Gift issued\"})]})}),f&&h>1&&m(L,{giftCycle:e,maxCSM:i?.maxCSM??0,currentCadenceIndex:s,issuedCadenceCount:l,translationConfig:{monthLabel:o?.roadmapMonthLabel??\"Month %cadence_month%\",giftLabel:o?.roadmapGiftLabel??\"Gift %gift_index%\"}}),R(C,{children:[d&&m(\"img\",{className:\"reward-logo\",src:o.loyaltyLogoBlack,alt:\"Rewards Logo\"}),m(\"div\",{className:\"info-item\",children:g})]}),m(W,{children:p&&!u&&R($,{variant:\"body-s\",weight:\"normal\",className:\"reward-subtitle\",colorOverride:\"#252525\",component:\"div\",children:[te,\" \",m($,{component:\"span\",className:\"button-price\",variant:\"body-s\",weight:\"bold\",children:r??0})]})}),m(C,{children:m(P,{id:\"learnMoreGiftMobile\",onClick:c,children:m(\"u\",{children:o.learnMore})})})]})};z.displayName=\"GiftProgressBarMobile\";var k=z;var D={completedMonthsInCadence:0,totalCSMCount:0,totalCadences:0,currentCadenceIndex:0,issuedCadenceCount:0,isGiftIssued:!1,isProgramComplete:!1},de=a=>[...a].sort((t,e)=>t.year===e.year?e.month-t.month:e.year-t.year),me=(a,t)=>new Date(a,t-2,1),fe=(a,t,e)=>{let n=0;for(let r=0;r<a.length;r++){let o=a[r],i=new Date(o.year,o.month-1,1);if(r===0){if(i>e)break}else{let s=a[r-1];if(i.getTime()!==me(s.year,s.month).getTime())break}if(o.totalAmount<t)break;n++}return n},H=(a,t,e,n,r)=>{let o=Math.min(Math.max(a,0),n);if(o===0)return{...D,totalCadences:r};let i=o%e,s=i===0&&t,l=Math.min(Math.floor(o/e),r),f=s?l-1:Math.floor(o/e);return{completedMonthsInCadence:s?e:i,totalCSMCount:o,totalCadences:r,currentCadenceIndex:Math.min(Math.max(f,0),r-1),issuedCadenceCount:l,isGiftIssued:s,isProgramComplete:o>=n}},J=({data:a,giftCycle:t,maxCSM:e,minSpend:n,giftProperties:r,today:o})=>{let i=t>0?Math.floor(e/t):0;if(i<=0)return{...D,totalCadences:Math.max(i,0)};if(r){let{continuousSubscriptionMonths:u,qualifiedThisMonth:h}=r,M=u+(h?1:0);return H(M,h,t,e,i)}let s=a?.csmMonthlySubsOrderTotal??[];if(!s.length)return{...D,totalCadences:i};let l=de(s),f=new Date(o.getFullYear(),o.getMonth(),1),c=fe(l,n,f),d=l[0],p=d.year===o.getFullYear()&&d.month-1===o.getMonth()&&d.totalAmount>=n;return H(c,p,t,e,i)};var ce=\"giftContinuousSubscriptionMonth\",pe=\"giftQualifiedThisMonth\",Z=(a,t)=>a?.properties?.find(e=>e?.name===t)?.value,j=a=>{if(!a?.properties?.length)return null;let t=Z(a,ce),e=Z(a,pe);if(t===void 0&&e===void 0)return null;let n=Number.parseInt(t??\"\",10);return{continuousSubscriptionMonths:Number.isNaN(n)?0:Math.max(n,0),qualifiedThisMonth:Number.parseInt(e??\"\",10)===1}};import{jsx as I}from\"react/jsx-runtime\";var ee=a=>{let{subscriptionData:t,loyaltyData:e,translationConfig:n,giftConfig:r,showRoadmap:o=!0,showLogo:i=!0,showTotalSection:s=!0}=a,l=r?.giftCycle??0,f=r?.thresholdValue??0,c=parseFloat(String(t?.approximateMonthlyTotalResponse?.currentMonthTotal??\"0\")),d=j(e),p=d?!d.qualifiedThisMonth:c<f,{completedMonthsInCadence:u,currentCadenceIndex:h,issuedCadenceCount:M}=J({data:t,giftCycle:l,maxCSM:r?.maxCSM??0,minSpend:f,giftProperties:d,today:new Date}),g={value:u,cadenceMonths:l,notQualifyThisMonth:p,amountShow:c,translationConfig:n,giftConfig:r,currentCadenceIndex:h,issuedCadenceCount:M,showRoadmap:o,showLogo:i,showTotalSection:s};return I(V,{className:\"loyalty-reward-card\",children:F.isMobile?I(k,{...g}):I(B,{...g})})};ee.displayName=\"GiftReward\";var ue=ee;export{B as GiftProgressBar,k as GiftProgressBarMobile,ue as GiftReward};\n","import React from 'react';\nimport { CircularProgressbarWithChildren, buildStyles } from 'react-circular-progressbar';\nimport RadialSeparators from '../CircularProgressBar/RadialSeparator';\nimport GiftRoadmap from '../GiftRoadmap/GiftRoadmap';\nimport GiftProgressBarMonthDescription from './GiftProgressBarMonthDescription';\nimport GiftWheelCenterContent from './GiftWheelCenterContent';\nimport { GiftProgressBarProps } from './types';\nimport { GiftDetailsColumn, GiftProgressBarWrapper } from './GiftProgressBar.styled';\n\nconst GiftProgressBar = (props: GiftProgressBarProps) => {\n const {\n value = 0,\n cadenceMonths = 0,\n notQualifyThisMonth = false,\n translationConfig,\n giftConfig,\n currentCadenceIndex = 0,\n issuedCadenceCount = 0,\n showRoadmap = true,\n handleOpenLearnMore = () => {},\n showLogo = true,\n } = props;\n\n const isComplete = cadenceMonths > 0 && value === cadenceMonths && !notQualifyThisMonth;\n const totalCadences = cadenceMonths > 0 ? Math.floor((giftConfig?.maxCSM ?? 0) / cadenceMonths) : 0;\n\n return (\n <GiftProgressBarWrapper>\n <div className=\"reward-progress\">\n <CircularProgressbarWithChildren\n value={cadenceMonths > 0 ? (value / cadenceMonths) * 100 : 0}\n strokeWidth={12}\n background\n styles={buildStyles({\n rotation: 0.5,\n strokeLinecap: 'butt',\n backgroundColor: '#fff',\n pathColor: '#ED7219',\n trailColor: '#E0E0E0',\n })}\n >\n {cadenceMonths > 0 && <RadialSeparators count={cadenceMonths} />}\n <GiftWheelCenterContent\n isComplete={isComplete}\n notQualifyThisMonth={notQualifyThisMonth}\n value={value}\n cadenceMonths={cadenceMonths}\n monthsLabel={translationConfig?.monthsLabel ?? 'Months'}\n giftIssuedLabel={translationConfig?.giftIssuedLabel ?? 'Gift issued'}\n />\n </CircularProgressbarWithChildren>\n </div>\n <GiftDetailsColumn>\n {showRoadmap && totalCadences > 1 && (\n <GiftRoadmap\n giftCycle={cadenceMonths}\n maxCSM={giftConfig?.maxCSM ?? 0}\n currentCadenceIndex={currentCadenceIndex}\n issuedCadenceCount={issuedCadenceCount}\n translationConfig={{\n monthLabel: translationConfig?.roadmapMonthLabel ?? 'Month %cadence_month%',\n giftLabel: translationConfig?.roadmapGiftLabel ?? 'Gift %gift_index%',\n }}\n />\n )}\n <GiftProgressBarMonthDescription\n value={value}\n cadenceMonths={cadenceMonths}\n notQualifyThisMonth={notQualifyThisMonth}\n translationConfig={translationConfig}\n giftConfig={giftConfig}\n handleOpenLearnMore={handleOpenLearnMore}\n showLogo={showLogo}\n />\n </GiftDetailsColumn>\n </GiftProgressBarWrapper>\n );\n};\n\nGiftProgressBar.displayName = 'GiftProgressBar';\n\nexport default GiftProgressBar;\nexport { GiftProgressBar };\n","import React from 'react';\nimport { Learn3XLink, StyledCard } from '../CircularProgressBar/CircularProgressBar.styled';\nimport { GiftProgressBarProps } from './types';\nimport { currencySymbol, replacePlaceholders } from '../Utils/helper';\n\ntype GiftProgressBarMonthDescriptionProps = Pick<\n GiftProgressBarProps,\n | 'value'\n | 'cadenceMonths'\n | 'notQualifyThisMonth'\n | 'translationConfig'\n | 'giftConfig'\n | 'handleOpenLearnMore'\n | 'showLogo'\n>;\n\nconst GiftProgressBarMonthDescription = ({\n value,\n cadenceMonths,\n notQualifyThisMonth,\n translationConfig,\n giftConfig,\n handleOpenLearnMore = () => {},\n showLogo = true,\n}: GiftProgressBarMonthDescriptionProps) => {\n const isComplete = cadenceMonths > 0 && value === cadenceMonths && !notQualifyThisMonth;\n\n let infoText = '';\n if (isComplete) {\n infoText = translationConfig.giftEarned;\n } else if (notQualifyThisMonth) {\n infoText = translationConfig.notQualify;\n } else {\n infoText = replacePlaceholders(translationConfig.callToAction, {\n threshold_value: giftConfig.thresholdValue,\n currency_symbol: giftConfig.thresholdKey === 'subtotal' ? currencySymbol() : '',\n });\n }\n\n return (\n <StyledCard>\n {showLogo && <img className=\"reward-logo\" src={translationConfig.loyaltyLogoBlack} alt=\"Rewards Logo\" />}\n <div className=\"info-item\">{infoText}</div>\n <Learn3XLink id=\"learnMoreGift\" onClick={handleOpenLearnMore}>\n <u>{translationConfig.learnMore}</u>\n </Learn3XLink>\n </StyledCard>\n );\n};\n\nGiftProgressBarMonthDescription.displayName = 'GiftProgressBarMonthDescription';\n\nexport default GiftProgressBarMonthDescription;\nexport { GiftProgressBarMonthDescription };\n","import React from 'react';\nimport { FaExclamationTriangle } from 'react-icons/fa';\nimport { NsTypography } from '@nuskin/foundation-ui-components';\nimport { IconContainer, ProgressBarCenter } from '../CircularProgressBar/CircularProgressBar.styled';\n\ntype GiftWheelCenterContentProps = Readonly<{\n isComplete: boolean;\n notQualifyThisMonth: boolean;\n value: number;\n cadenceMonths: number;\n monthsLabel: string;\n giftIssuedLabel: string;\n}>;\n\n/**\n * Content inside the gift wheel ring — shared by the desktop and mobile variants so the fraction /\n * warning / gift-issued states can't drift apart between the two.\n */\nconst GiftWheelCenterContent = ({\n isComplete,\n notQualifyThisMonth,\n value,\n cadenceMonths,\n monthsLabel,\n giftIssuedLabel,\n}: GiftWheelCenterContentProps) => {\n if (notQualifyThisMonth) {\n return (\n <IconContainer>\n <FaExclamationTriangle className=\"outline-exclamation-icon\" color=\"#91ACC8\" />\n </IconContainer>\n );\n }\n return (\n <ProgressBarCenter>\n <NsTypography component=\"div\" className=\"center-value-progress-bar-price\" variant=\"title-l\" weight=\"bold\">\n {`${value}/${cadenceMonths}`}\n </NsTypography>\n <NsTypography variant=\"label-s\" weight=\"bold\" component=\"div\" className=\"center-value-progress-bar-voucher\">\n {monthsLabel}\n </NsTypography>\n {isComplete && (\n <NsTypography\n variant=\"label-s\"\n weight=\"bold\"\n component=\"div\"\n className=\"center-value-progress-bar-voucher\"\n >\n {giftIssuedLabel}\n </NsTypography>\n )}\n </ProgressBarCenter>\n );\n};\n\nGiftWheelCenterContent.displayName = 'GiftWheelCenterContent';\n\nexport default GiftWheelCenterContent;\nexport { GiftWheelCenterContent };\nexport type { GiftWheelCenterContentProps };\n","import styled from '@emotion/styled';\n\n// GiftProgressBar uses these shared styled components directly from CircularProgressBar.styled\n// to stay consistent with the existing design language.\n// Only gift-specific overrides are defined here.\n\nexport const GiftRewardContainer = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n background-color: #f5f5f5;\n border: 1px solid #e0e0e0;\n border-radius: 10px;\n padding: 1.5rem;\n margin-bottom: 20px;\n height: 50%;\n margin: auto;\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: stretch;\n width: 100%;\n }\n`;\n\nexport const GiftProgressBarWrapper = styled.div`\n display: flex;\n flex-direction: row;\n align-items: flex-start;\n gap: 24px;\n width: 100%;\n\n .reward-progress {\n height: 150px;\n width: 150px;\n flex-shrink: 0;\n\n /* The library stylesheet is not bundled, so the SVG stays inline and its baseline gap\n makes the wrapper taller than the ring, pushing the radial separators off centre. */\n > div {\n height: 100%;\n }\n\n .CircularProgressbar {\n display: block;\n width: 100%;\n height: 100%;\n }\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: center;\n }\n`;\n\nexport const GiftDetailsColumn = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n gap: 16px;\n flex: 1 0 0;\n min-width: 0;\n\n /* The wrapper turns into a column here, so flex-basis governs height and the width would\n otherwise collapse to shrink-to-fit under the wrapper's align-items: center. */\n @media (max-width: 950px) {\n width: 100%;\n align-self: stretch;\n text-align: center;\n }\n`;\n","import React from 'react';\nimport { CircularProgressbarWithChildren, buildStyles } from 'react-circular-progressbar';\nimport { NsTypography } from '@nuskin/foundation-ui-components';\nimport RadialSeparators from '../CircularProgressBar/RadialSeparator';\nimport {\n Learn3XLink,\n LoyaltyProgressSubContainer,\n RewardProgressTotalContainer,\n StyledCard,\n} from '../CircularProgressBar/CircularProgressBar.styled';\nimport GiftRoadmap from '../GiftRoadmap/GiftRoadmap';\nimport GiftWheelCenterContent from './GiftWheelCenterContent';\nimport { GiftProgressBarProps } from './types';\nimport { replacePlaceholders } from '../Utils/helper';\n\nconst GiftProgressBarMobile = (props: GiftProgressBarProps) => {\n const {\n value = 0,\n cadenceMonths = 0,\n notQualifyThisMonth = false,\n amountShow,\n translationConfig,\n giftConfig,\n currentCadenceIndex = 0,\n issuedCadenceCount = 0,\n showRoadmap = true,\n handleOpenLearnMore = () => {},\n showLogo = true,\n showTotalSection = true,\n } = props;\n\n const isComplete = cadenceMonths > 0 && value === cadenceMonths && !notQualifyThisMonth;\n const totalCadences = cadenceMonths > 0 ? Math.floor((giftConfig?.maxCSM ?? 0) / cadenceMonths) : 0;\n\n const monthsCompleteText = replacePlaceholders(translationConfig.monthsComplete, {\n completed_months: value,\n total_months: cadenceMonths,\n });\n\n let infoText = monthsCompleteText;\n if (isComplete) {\n infoText = translationConfig.giftEarned;\n } else if (notQualifyThisMonth) {\n infoText = translationConfig.notQualify;\n }\n\n const approximateMonthlyText = replacePlaceholders(translationConfig.approximateMonthly, {\n currency_symbol: '',\n estimated_running_subscription_spend: '',\n });\n\n return (\n <LoyaltyProgressSubContainer>\n <div className=\"reward-progress\">\n <CircularProgressbarWithChildren\n value={cadenceMonths > 0 ? (value / cadenceMonths) * 100 : 0}\n strokeWidth={12}\n background\n styles={buildStyles({\n rotation: 0.5,\n strokeLinecap: 'butt',\n backgroundColor: '#fff',\n pathColor: '#ED7219',\n trailColor: '#E0E0E0',\n })}\n >\n {cadenceMonths > 0 && <RadialSeparators count={cadenceMonths} />}\n <GiftWheelCenterContent\n isComplete={isComplete}\n notQualifyThisMonth={notQualifyThisMonth}\n value={value}\n cadenceMonths={cadenceMonths}\n monthsLabel={translationConfig?.monthsLabel ?? 'Months'}\n giftIssuedLabel={translationConfig?.giftIssuedLabel ?? 'Gift issued'}\n />\n </CircularProgressbarWithChildren>\n </div>\n {showRoadmap && totalCadences > 1 && (\n <GiftRoadmap\n giftCycle={cadenceMonths}\n maxCSM={giftConfig?.maxCSM ?? 0}\n currentCadenceIndex={currentCadenceIndex}\n issuedCadenceCount={issuedCadenceCount}\n translationConfig={{\n monthLabel: translationConfig?.roadmapMonthLabel ?? 'Month %cadence_month%',\n giftLabel: translationConfig?.roadmapGiftLabel ?? 'Gift %gift_index%',\n }}\n />\n )}\n <StyledCard>\n {showLogo && (\n <img className=\"reward-logo\" src={translationConfig.loyaltyLogoBlack} alt=\"Rewards Logo\" />\n )}\n <div className=\"info-item\">{infoText}</div>\n </StyledCard>\n <RewardProgressTotalContainer>\n {showTotalSection && !isComplete && (\n <NsTypography\n variant=\"body-s\"\n weight=\"normal\"\n className=\"reward-subtitle\"\n colorOverride=\"#252525\"\n component=\"div\"\n >\n {approximateMonthlyText}{' '}\n <NsTypography component=\"span\" className=\"button-price\" variant=\"body-s\" weight=\"bold\">\n {amountShow ?? 0}\n </NsTypography>\n </NsTypography>\n )}\n </RewardProgressTotalContainer>\n <StyledCard>\n <Learn3XLink id=\"learnMoreGiftMobile\" onClick={handleOpenLearnMore}>\n <u>{translationConfig.learnMore}</u>\n </Learn3XLink>\n </StyledCard>\n </LoyaltyProgressSubContainer>\n );\n};\n\nGiftProgressBarMobile.displayName = 'GiftProgressBarMobile';\n\nexport default GiftProgressBarMobile;\nexport { GiftProgressBarMobile };\n","import { CalculateGiftCompletionParams, GiftCompletionResult } from '../types';\n\ntype GiftRecord = {\n year: number;\n month: number;\n totalAmount: number;\n promocode?: string | null;\n};\n\nconst EMPTY_RESULT: GiftCompletionResult = {\n completedMonthsInCadence: 0,\n totalCSMCount: 0,\n totalCadences: 0,\n currentCadenceIndex: 0,\n issuedCadenceCount: 0,\n isGiftIssued: false,\n isProgramComplete: false,\n};\n\nconst sortByDateDesc = (records: GiftRecord[]): GiftRecord[] =>\n [...records].sort((a, b) => (a.year === b.year ? b.month - a.month : b.year - a.year));\n\n// Returns a Date representing the month prior to (year, month) where month is 1-indexed\nconst getPreviousMonthDate = (year: number, month: number): Date => new Date(year, month - 2, 1);\n\n/**\n * Walks backwards from the most recent non-future record and counts the unbroken run of\n * qualifying months — no month gaps, each month at or above the threshold.\n */\nconst countConsecutiveQualifyingMonths = (sorted: GiftRecord[], minSpend: number, currentMonthDate: Date): number => {\n let streak = 0;\n\n for (let i = 0; i < sorted.length; i++) {\n const record = sorted[i];\n const recordDate = new Date(record.year, record.month - 1, 1);\n\n if (i === 0) {\n if (recordDate > currentMonthDate) break;\n } else {\n const prev = sorted[i - 1];\n if (recordDate.getTime() !== getPreviousMonthDate(prev.year, prev.month).getTime()) break;\n }\n\n if (record.totalAmount < minSpend) break;\n\n streak++;\n }\n\n return streak;\n};\n\n/**\n * Shared shaping step. Both the loyalty-property source and the record-walk fallback reduce to a\n * qualifying-month count plus whether the current month qualified, so cadence placement is identical\n * regardless of where the numbers came from.\n *\n * Per the business rule the gift is issued the moment the final month of a cadence qualifies, and\n * that issued state is retained until the end of that month — the next cadence starts from zero on\n * the 1st, which is why a completed cadence with an unqualified current month rolls forward.\n */\nconst buildResult = (\n csmCount: number,\n qualifiedThisMonth: boolean,\n giftCycle: number,\n maxCSM: number,\n totalCadences: number,\n): GiftCompletionResult => {\n const totalCSMCount = Math.min(Math.max(csmCount, 0), maxCSM);\n\n if (totalCSMCount === 0) {\n return { ...EMPTY_RESULT, totalCadences };\n }\n\n const remainder = totalCSMCount % giftCycle;\n const isGiftIssued = remainder === 0 && qualifiedThisMonth;\n const issuedCadenceCount = Math.min(Math.floor(totalCSMCount / giftCycle), totalCadences);\n const rawCadenceIndex = isGiftIssued ? issuedCadenceCount - 1 : Math.floor(totalCSMCount / giftCycle);\n\n return {\n completedMonthsInCadence: isGiftIssued ? giftCycle : remainder,\n totalCSMCount,\n totalCadences,\n currentCadenceIndex: Math.min(Math.max(rawCadenceIndex, 0), totalCadences - 1),\n issuedCadenceCount,\n isGiftIssued,\n isProgramComplete: totalCSMCount >= maxCSM,\n };\n};\n\n/**\n * Maps the customer's consecutive subscription month (CSM) streak onto the gift roadmap.\n *\n * Prefers `giftProperties` from the loyalty response, where `continuousSubscriptionMonths` counts\n * the months completed *before* the current one and `qualifiedThisMonth` adds the current month.\n * Falls back to walking `csmMonthlySubsOrderTotal` when those properties are unavailable.\n */\nexport const calculateGiftMonthCompletion = ({\n data,\n giftCycle,\n maxCSM,\n minSpend,\n giftProperties,\n today,\n}: CalculateGiftCompletionParams): GiftCompletionResult => {\n const totalCadences = giftCycle > 0 ? Math.floor(maxCSM / giftCycle) : 0;\n\n if (totalCadences <= 0) {\n return { ...EMPTY_RESULT, totalCadences: Math.max(totalCadences, 0) };\n }\n\n if (giftProperties) {\n const { continuousSubscriptionMonths, qualifiedThisMonth } = giftProperties;\n const csmCount = continuousSubscriptionMonths + (qualifiedThisMonth ? 1 : 0);\n return buildResult(csmCount, qualifiedThisMonth, giftCycle, maxCSM, totalCadences);\n }\n\n const records = (data?.csmMonthlySubsOrderTotal as GiftRecord[] | undefined) ?? [];\n\n if (!records.length) {\n return { ...EMPTY_RESULT, totalCadences };\n }\n\n const sorted = sortByDateDesc(records);\n const currentMonthDate = new Date(today.getFullYear(), today.getMonth(), 1);\n const streak = countConsecutiveQualifyingMonths(sorted, minSpend, currentMonthDate);\n const latest = sorted[0];\n const qualifiedThisMonth =\n latest.year === today.getFullYear() && latest.month - 1 === today.getMonth() && latest.totalAmount >= minSpend;\n\n return buildResult(streak, qualifiedThisMonth, giftCycle, maxCSM, totalCadences);\n};\n","import { GiftLoyaltyData, GiftLoyaltyProperties } from '../types';\n\nexport const GIFT_CSM_PROPERTY = 'giftContinuousSubscriptionMonth';\nexport const GIFT_QUALIFIED_PROPERTY = 'giftQualifiedThisMonth';\n\nconst findValue = (loyaltyData: GiftLoyaltyData, name: string): string | undefined =>\n loyaltyData?.properties?.find((property) => property?.name === name)?.value;\n\n/**\n * Reads the gift counters off the loyalty data. `giftContinuousSubscriptionMonth` counts the\n * completed months *before* the current one; `giftQualifiedThisMonth` says whether the current month\n * has met the threshold. Returns null when neither property is present so callers can fall back.\n */\nexport const readGiftProperties = (loyaltyData: GiftLoyaltyData | null | undefined): GiftLoyaltyProperties | null => {\n if (!loyaltyData?.properties?.length) {\n return null;\n }\n\n const rawMonths = findValue(loyaltyData, GIFT_CSM_PROPERTY);\n const rawQualified = findValue(loyaltyData, GIFT_QUALIFIED_PROPERTY);\n\n if (rawMonths === undefined && rawQualified === undefined) {\n return null;\n }\n\n const months = Number.parseInt(rawMonths ?? '', 10);\n\n return {\n continuousSubscriptionMonths: Number.isNaN(months) ? 0 : Math.max(months, 0),\n qualifiedThisMonth: Number.parseInt(rawQualified ?? '', 10) === 1,\n };\n};\n","import React from 'react';\nimport GiftProgressBar from './GiftProgressBar';\nimport GiftProgressBarMobile from './GiftProgressBarMobile';\nimport { GiftRewardProps } from './types';\nimport { application } from '../Utils/application';\nimport { calculateGiftMonthCompletion } from './logic/calculateGiftMonthCompletion';\nimport { readGiftProperties } from './logic/readGiftProperties';\nimport { GiftRewardContainer } from './GiftProgressBar.styled';\n\nconst GiftReward = (props: GiftRewardProps) => {\n const {\n subscriptionData,\n loyaltyData,\n translationConfig,\n giftConfig,\n showRoadmap = true,\n showLogo = true,\n showTotalSection = true,\n } = props;\n\n const cadenceMonths = giftConfig?.giftCycle ?? 0;\n const minSpend = giftConfig?.thresholdValue ?? 0;\n\n const amountShow = parseFloat(String(subscriptionData?.approximateMonthlyTotalResponse?.currentMonthTotal ?? '0'));\n const giftProperties = readGiftProperties(loyaltyData);\n const notQualifyThisMonth = giftProperties ? !giftProperties.qualifiedThisMonth : amountShow < minSpend;\n\n const { completedMonthsInCadence, currentCadenceIndex, issuedCadenceCount } = calculateGiftMonthCompletion({\n data: subscriptionData,\n giftCycle: cadenceMonths,\n maxCSM: giftConfig?.maxCSM ?? 0,\n minSpend,\n giftProperties,\n today: new Date(),\n });\n\n const commonProps = {\n value: completedMonthsInCadence,\n cadenceMonths,\n notQualifyThisMonth,\n amountShow,\n translationConfig,\n giftConfig,\n currentCadenceIndex,\n issuedCadenceCount,\n showRoadmap,\n showLogo,\n showTotalSection,\n };\n\n return (\n <GiftRewardContainer className=\"loyalty-reward-card\">\n {application.isMobile ? <GiftProgressBarMobile {...commonProps} /> : <GiftProgressBar {...commonProps} />}\n </GiftRewardContainer>\n );\n};\n\nGiftReward.displayName = 'GiftReward';\n\nexport default GiftReward;\nexport { GiftReward };\n"]}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { GiftLoyaltyData, GiftLoyaltyProperties } from '../types';
|
|
2
2
|
export declare const GIFT_CSM_PROPERTY = "giftContinuousSubscriptionMonth";
|
|
3
3
|
export declare const GIFT_QUALIFIED_PROPERTY = "giftQualifiedThisMonth";
|
|
4
4
|
/**
|
|
5
|
-
* Reads the gift counters off the loyalty
|
|
5
|
+
* Reads the gift counters off the loyalty data. `giftContinuousSubscriptionMonth` counts the
|
|
6
6
|
* completed months *before* the current one; `giftQualifiedThisMonth` says whether the current month
|
|
7
7
|
* has met the threshold. Returns null when neither property is present so callers can fall back.
|
|
8
8
|
*/
|
|
9
|
-
export declare const readGiftProperties: (
|
|
9
|
+
export declare const readGiftProperties: (loyaltyData: GiftLoyaltyData | null | undefined) => GiftLoyaltyProperties | null;
|
|
@@ -43,7 +43,7 @@ export type GiftLoyaltyProperty = {
|
|
|
43
43
|
name: string;
|
|
44
44
|
value: string;
|
|
45
45
|
};
|
|
46
|
-
export type
|
|
46
|
+
export type GiftLoyaltyData = {
|
|
47
47
|
properties?: GiftLoyaltyProperty[];
|
|
48
48
|
};
|
|
49
49
|
export type GiftLoyaltyProperties = {
|
|
@@ -53,8 +53,8 @@ export type GiftLoyaltyProperties = {
|
|
|
53
53
|
};
|
|
54
54
|
export type GiftRewardProps = {
|
|
55
55
|
subscriptionData?: MonthlyData | null;
|
|
56
|
-
/** Loyalty
|
|
57
|
-
|
|
56
|
+
/** Loyalty data carrying giftContinuousSubscriptionMonth / giftQualifiedThisMonth */
|
|
57
|
+
loyaltyData?: GiftLoyaltyData | null;
|
|
58
58
|
translationConfig: GiftTranslationConfig;
|
|
59
59
|
giftConfig: GiftConfig;
|
|
60
60
|
showRoadmap?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as m}from"../chunk-
|
|
1
|
+
import{a as m}from"../chunk-UHWCPMTT.mjs";import"../chunk-3RJWIGAN.mjs";import"../chunk-PN67M2PP.mjs";import"../chunk-CBUBKPM6.mjs";import"../chunk-73SFLUWV.mjs";export{m as GiftRoadmap};//# sourceMappingURL=index.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/gitlab-runner-data/builds/nextgen-development/loyalty/npm/react-loyalty-elements/dist/GiftRoadmap/index.mjs"],"names":["a","GiftRoadmap"],"mappings":"AAAA,OAAOA,KAAAA,CAAC,KAAK,uBAAwB,OAAM,uBAAwB,OAAM,uBAAwB,OAAM,uBAAwB,OAAM,uBAAwB,QAAOA,KAAKC,WAAW","sourcesContent":["import{a}from\"../chunk-
|
|
1
|
+
{"version":3,"sources":["/gitlab-runner-data/builds/nextgen-development/loyalty/npm/react-loyalty-elements/dist/GiftRoadmap/index.mjs"],"names":["a","GiftRoadmap"],"mappings":"AAAA,OAAOA,KAAAA,CAAC,KAAK,uBAAwB,OAAM,uBAAwB,OAAM,uBAAwB,OAAM,uBAAwB,OAAM,uBAAwB,QAAOA,KAAKC,WAAW","sourcesContent":["import{a}from\"../chunk-UHWCPMTT.mjs\";import\"../chunk-3RJWIGAN.mjs\";import\"../chunk-PN67M2PP.mjs\";import\"../chunk-CBUBKPM6.mjs\";import\"../chunk-73SFLUWV.mjs\";export{a as GiftRoadmap};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
var n=function(n,r){return Object.keys(r).reduce(function(n,e){var t;var a=(t=r[e])!==null&&t!==void 0?t:"";return n.replace(new RegExp("%".concat(e,"%"),"g"),String(a))},n)},r=function(){return"$"};export{n as a,r as b};//# sourceMappingURL=chunk-3RJWIGAN.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/Utils/helper.ts"],"names":["replacePlaceholders","template","values","Object","keys","reduce","result","key","value","replace","RegExp","String","currencySymbol","l","a","o","b"],"mappings":"AAAO,IAAMA,EAAsB,SAC/BC,EACAC,UAEOC,OAAOC,IAAA,CAAKF,GAAQG,MAAA,CAAO,SAACC,EAAQC,OACzBL,EAAd,IAAMM,EAAQN,CAAAA,EAAAA,CAAAA,CAAOK,EAAG,UAAVL,WAAAA,EAAe,GAC7B,OAAOI,EAAOG,OAAA,CAAQ,IAAIC,OAAO,IAAO,OAAHH,EAAG,KAAK,KAAMI,OAAOH,GAC9D,EAAGP,IAGMW,EAAiB,iBACnB,YAAAC,KAAAC,CAAA,CAAAC,KAAAC,CAAA","sourcesContent":["export const replacePlaceholders = (\n template: string,\n values: { [key: string]: string | number | null }, // Add null\n) => {\n return Object.keys(values).reduce((result, key) => {\n const value = values[key] ?? ''; // Replace null with empty string\n return result.replace(new RegExp(`%${key}%`, 'g'), String(value));\n }, template);\n};\n\nexport const currencySymbol = () => {\n return '$';\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
function n(n,t){if(!(n instanceof t)){throw new TypeError("Cannot call a class as a function")}}function t(n,t){for(var e=0;e<t.length;e++){var i=t[e];i.enumerable=i.enumerable||false;i.configurable=true;if("value"in i)i.writable=true;Object.defineProperty(n,i.key,i)}}function e(n,e,i){if(e)t(n.prototype,e);if(i)t(n,i);return n}function i(n,t){if(!t){t=n.slice(0)}return Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(t)}}))}function r(n){"@swc/helpers - typeof";return n&&typeof Symbol!=="undefined"&&n.constructor===Symbol?"symbol":typeof n}function o(){var n=i(["\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n row-gap: 12px;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n background-color: #f5f5f5;\n border: 1px solid #e0e0e0;\n border-radius: 10px;\n padding: 1.5rem;\n margin-bottom: 20px;\n height: 50%;\n margin: auto;\n\n @media (max-width: 950px) {\n flex-direction: column;\n }\n"]);o=function t(){return n};return n}function a(){var n=i(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n /* Grows to take whatever the sibling total/voucher block (fixed width, flex-shrink: 0) doesn't\n need; min-width: 0 lets it shrink below its text's natural width so .info-item can wrap. */\n flex: 1 1 0;\n min-width: 0;\n justify-content: left;\n\n .reward-logo {\n width: 200px;\n margin-bottom: 12px;\n }\n\n .reward-progress {\n height: 150px;\n width: 150px;\n flex-shrink: 0;\n\n /* The library stylesheet is not bundled, so the SVG stays inline and its baseline gap\n makes the wrapper taller than the ring, pushing the radial separators off centre. */\n > div {\n height: 100%;\n }\n\n .CircularProgressbar {\n display: block;\n width: 100%;\n height: 100%;\n }\n }\n .progress-bar {\n background-color: #e0e0e0;\n height: 100%;\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n width: 100%;\n\n .info-container {\n margin-left: 0px;\n align-items: center;\n }\n .reward-progress-total-div {\n margin-top: 10px;\n }\n }\n"]);a=function t(){return n};return n}function l(){var n=i(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n margin-left: 16px;\n .info-item {\n margin: 5px 0;\n font-weight: 600;\n }\n\n .reward-subtitle {\n margin-top: 4px;\n }\n\n @media (max-width: 950px) {\n align-items: center;\n margin-left: 0;\n }\n"]);l=function t(){return n};return n}function s(){var n=i(["\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n"]);s=function t(){return n};return n}function c(){var n=i(["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n width: 100%;\n\n .reward-logo {\n width: 200px;\n margin-bottom: 0;\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: center;\n\n .reward-header-total {\n width: 100%;\n justify-content: center;\n }\n }\n"]);c=function t(){return n};return n}function u(){var n=i(["\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n color: black;\n\n .center-value-progress-bar-price {\n margin: 0;\n }\n .center-value-progress-bar-voucher {\n margin: 0;\n letter-spacing: 0.01em;\n }\n"]);u=function t(){return n};return n}function f(){var n=i(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n /* Stays at its natural width so RewardProgressBar's column can grow to fill what's left. */\n flex-shrink: 0;\n min-width: 160px;\n\n .total-button {\n display: flex;\n align-items: center;\n background-color: #e5edf6;\n border-radius: 20px;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n }\n .reward-subtitle {\n letter-spacing: 0;\n display: flex;\n }\n\n @media (max-width: 950px) {\n .reward-subtitle {\n letter-spacing: 0;\n display: flex;\n text-align: center;\n }\n margin-top: 10px;\n }\n"]);f=function t(){return n};return n}function d(){var n=i(["\n display: flex;\n align-items: center;\n background-color: #e5edf6;\n border-radius: 20px;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n padding: 1rem;\n margin-bottom: 14px;\n\n @media (max-width: 950px) {\n margin-top: 14px;\n }\n"]);d=function t(){return n};return n}function p(){var n=i(["\n .info-icon {\n margin-left: 6px !important;\n }\n .loyalty-icon {\n height: 19px !important;\n width: 19px !important;\n margin-left: 6px !important;\n }\n .loyalty-warning-icon {\n height: 19px !important;\n width: 19px !important;\n margin-right: 6px !important;\n }\n .outline-exclamation-icon {\n height: 48px !important;\n width: 48px !important;\n }\n"]);p=function t(){return n};return n}function h(){var n=i(["\n position: absolute;\n height: 100%;\n"]);h=function t(){return n};return n}function m(){var n=i(["\n background: #fff;\n width: 6px;\n height: 12%;\n"]);m=function t(){return n};return n}import{d as g}from"./chunk-PN67M2PP.mjs";var x=g.div(o()),w=g.div(a()),b=g.div(l()),y=g.div(s()),v=g.div(c()),k=g.div(u()),j=g.div(f()),P=g.div(d()),F=g.span(p()),z=g.div(h()),S=g.div(m()),C={tooltip:{sx:{color:"#FFFFFF",backgroundColor:"#252525",fontFamily:"Inter",fontWeight:400,fontSize:"14px",lineHeight:"20px","& .MuiTooltip-arrow":{color:"#252525"}}}};import{jsx as O}from"react/jsx-runtime";function _(n){return O(z,{style:{transform:"rotate(".concat(n.turns,"turn)")},children:O(S,{})})}function M(n){var t=1/n.count,e=.5;return Array.from({length:n.count},function(n,i){return i*t+e}).map(function(n){return O(_,{turns:n},n)})}M.displayName="RadialSeparators";var R=M;var T=(typeof window==="undefined"?"undefined":r(window))=="object",W=/*#__PURE__*/function(){"use strict";function t(){n(this,t);this.width=T?window.innerWidth:0;this.scroll={vertical:T?window.scrollY:0,horizontal:T?window.scrollX:0,direction:"none"}}e(t,[{key:"isMobile",get:function n(){return this.isPhone}},{key:"isPhone",get:function n(){return T?window.innerWidth<768:this.width<768}}]);return t}(),E=new W;export{x as a,w as b,b as c,y as d,v as e,k as f,j as g,P as h,F as i,C as j,R as k,E as l};//# sourceMappingURL=chunk-NVD2PQ2C.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/gitlab-runner-data/builds/nextgen-development/loyalty/npm/react-loyalty-elements/dist/chunk-NVD2PQ2C.mjs","../src/CircularProgressBar/CircularProgressBar.styled.tsx","../src/CircularProgressBar/RadialSeparator.tsx","../src/Utils/application/application.ts"],"names":["d","t","RewardProgressBarContainer","newStyled","div","LoyaltyProgressSubContainer","StyledCard","Learn3XLink","LoyaltyRewardsHeaderContainer","ProgressBarCenter","RewardProgressTotalContainer","RewardProgressTotalButtonWithIcon","IconContainer","span","SeparatorCard","SeparatorInnerCard","TooltipStyles","tooltip","sx","color","backgroundColor","fontFamily","fontWeight","fontSize","lineHeight","jsx","Separator","props","style","transform","turns","children","RadialSeparators","count","separatorNumber","Array","from","length","_","index","map","turn","displayName","RadialSeparator_default","IS_BROWSER","window","ApplicationStore","width","innerWidth","scroll","vertical","scrollY","horizontal","scrollX","direction","isMobile","isPhone","applicationContainer"],"mappings":"uoLAAA,OAAOA,KAAKC,CAAC,KAAK,sBCEX,CAAA,IAAMC,EAA6BC,EAAOC,GAAA,MAqBpCC,EAA8BF,EAAOC,GAAA,MAoDrCE,EAAaH,EAAOC,GAAA,MAmBpBG,EAAcJ,EAA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aACI,OAAO,IAAA,CAAKC,OAChB,IAEIA,IAAAA,cAAJ,aACI,OAAOZ,EAAaC,OAAOG,UAAA,CAAa,IAAM,IAAA,CAAKD,KAAA,CAAQ,GAC/D,iBAGEU,EAAuB,IAAIX,SAAAA,KAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAAA,CAAAA,CAAAA,KAAAA,CAAAA","sourcesContent":["import{d as t}from\"./chunk-PN67M2PP.mjs\";var h=t.div`\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n row-gap: 12px;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n background-color: #f5f5f5;\n border: 1px solid #e0e0e0;\n border-radius: 10px;\n padding: 1.5rem;\n margin-bottom: 20px;\n height: 50%;\n margin: auto;\n\n @media (max-width: 950px) {\n flex-direction: column;\n }\n`,f=t.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n /* Grows to take whatever the sibling total/voucher block (fixed width, flex-shrink: 0) doesn't\n need; min-width: 0 lets it shrink below its text's natural width so .info-item can wrap. */\n flex: 1 1 0;\n min-width: 0;\n justify-content: left;\n\n .reward-logo {\n width: 200px;\n margin-bottom: 12px;\n }\n\n .reward-progress {\n height: 150px;\n width: 150px;\n flex-shrink: 0;\n\n /* The library stylesheet is not bundled, so the SVG stays inline and its baseline gap\n makes the wrapper taller than the ring, pushing the radial separators off centre. */\n > div {\n height: 100%;\n }\n\n .CircularProgressbar {\n display: block;\n width: 100%;\n height: 100%;\n }\n }\n .progress-bar {\n background-color: #e0e0e0;\n height: 100%;\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n width: 100%;\n\n .info-container {\n margin-left: 0px;\n align-items: center;\n }\n .reward-progress-total-div {\n margin-top: 10px;\n }\n }\n`,w=t.div`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n margin-left: 16px;\n .info-item {\n margin: 5px 0;\n font-weight: 600;\n }\n\n .reward-subtitle {\n margin-top: 4px;\n }\n\n @media (max-width: 950px) {\n align-items: center;\n margin-left: 0;\n }\n`,u=t.div`\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n`,b=t.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n width: 100%;\n\n .reward-logo {\n width: 200px;\n margin-bottom: 0;\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: center;\n\n .reward-header-total {\n width: 100%;\n justify-content: center;\n }\n }\n`,y=t.div`\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n color: black;\n\n .center-value-progress-bar-price {\n margin: 0;\n }\n .center-value-progress-bar-voucher {\n margin: 0;\n letter-spacing: 0.01em;\n }\n`,v=t.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n /* Stays at its natural width so RewardProgressBar's column can grow to fill what's left. */\n flex-shrink: 0;\n min-width: 160px;\n\n .total-button {\n display: flex;\n align-items: center;\n background-color: #e5edf6;\n border-radius: 20px;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n }\n .reward-subtitle {\n letter-spacing: 0;\n display: flex;\n }\n\n @media (max-width: 950px) {\n .reward-subtitle {\n letter-spacing: 0;\n display: flex;\n text-align: center;\n }\n margin-top: 10px;\n }\n`,k=t.div`\n display: flex;\n align-items: center;\n background-color: #e5edf6;\n border-radius: 20px;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n padding: 1rem;\n margin-bottom: 14px;\n\n @media (max-width: 950px) {\n margin-top: 14px;\n }\n`,C=t.span`\n .info-icon {\n margin-left: 6px !important;\n }\n .loyalty-icon {\n height: 19px !important;\n width: 19px !important;\n margin-left: 6px !important;\n }\n .loyalty-warning-icon {\n height: 19px !important;\n width: 19px !important;\n margin-right: 6px !important;\n }\n .outline-exclamation-icon {\n height: 48px !important;\n width: 48px !important;\n }\n`,a=t.div`\n position: absolute;\n height: 100%;\n`,s=t.div`\n background: #fff;\n width: 6px;\n height: 12%;\n`,S={tooltip:{sx:{color:\"#FFFFFF\",backgroundColor:\"#252525\",fontFamily:\"Inter\",fontWeight:400,fontSize:\"14px\",lineHeight:\"20px\",\"& .MuiTooltip-arrow\":{color:\"#252525\"}}}};import{jsx as o}from\"react/jsx-runtime\";function x(e){return o(a,{style:{transform:`rotate(${e.turns}turn)`},children:o(s,{})})}function l(e){let p=1/e.count,d=.5;return Array.from({length:e.count},(i,c)=>c*p+d).map(i=>o(x,{turns:i},i))}l.displayName=\"RadialSeparators\";var F=l;var r=typeof window==\"object\",n=class{constructor(){this.width=r?window.innerWidth:0;this.scroll={vertical:r?window.scrollY:0,horizontal:r?window.scrollX:0,direction:\"none\"}}get isMobile(){return this.isPhone}get isPhone(){return r?window.innerWidth<768:this.width<768}},I=new n;export{h as a,f as b,w as c,u as d,b as e,y as f,v as g,k as h,C as i,S as j,F as k,I as l};\n","import styled from '@emotion/styled';\n\nexport const RewardProgressBarContainer = styled.div`\n display: flex;\n flex-direction: row;\n flex-wrap: wrap;\n row-gap: 12px;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n background-color: #f5f5f5;\n border: 1px solid #e0e0e0;\n border-radius: 10px;\n padding: 1.5rem;\n margin-bottom: 20px;\n height: 50%;\n margin: auto;\n\n @media (max-width: 950px) {\n flex-direction: column;\n }\n`;\n\nexport const LoyaltyProgressSubContainer = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n /* Grows to take whatever the sibling total/voucher block (fixed width, flex-shrink: 0) doesn't\n need; min-width: 0 lets it shrink below its text's natural width so .info-item can wrap. */\n flex: 1 1 0;\n min-width: 0;\n justify-content: left;\n\n .reward-logo {\n width: 200px;\n margin-bottom: 12px;\n }\n\n .reward-progress {\n height: 150px;\n width: 150px;\n flex-shrink: 0;\n\n /* The library stylesheet is not bundled, so the SVG stays inline and its baseline gap\n makes the wrapper taller than the ring, pushing the radial separators off centre. */\n > div {\n height: 100%;\n }\n\n .CircularProgressbar {\n display: block;\n width: 100%;\n height: 100%;\n }\n }\n .progress-bar {\n background-color: #e0e0e0;\n height: 100%;\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n width: 100%;\n\n .info-container {\n margin-left: 0px;\n align-items: center;\n }\n .reward-progress-total-div {\n margin-top: 10px;\n }\n }\n`;\nexport const StyledCard = styled.div`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n margin-left: 16px;\n .info-item {\n margin: 5px 0;\n font-weight: 600;\n }\n\n .reward-subtitle {\n margin-top: 4px;\n }\n\n @media (max-width: 950px) {\n align-items: center;\n margin-left: 0;\n }\n`;\nexport const Learn3XLink = styled.div`\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n`;\n\nexport const LoyaltyRewardsHeaderContainer = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n width: 100%;\n\n .reward-logo {\n width: 200px;\n margin-bottom: 0;\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: center;\n\n .reward-header-total {\n width: 100%;\n justify-content: center;\n }\n }\n`;\nexport const ProgressBarCenter = styled.div`\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n color: black;\n\n .center-value-progress-bar-price {\n margin: 0;\n }\n .center-value-progress-bar-voucher {\n margin: 0;\n letter-spacing: 0.01em;\n }\n`;\nexport const RewardProgressTotalContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n /* Stays at its natural width so RewardProgressBar's column can grow to fill what's left. */\n flex-shrink: 0;\n min-width: 160px;\n\n .total-button {\n display: flex;\n align-items: center;\n background-color: #e5edf6;\n border-radius: 20px;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n }\n .reward-subtitle {\n letter-spacing: 0;\n display: flex;\n }\n\n @media (max-width: 950px) {\n .reward-subtitle {\n letter-spacing: 0;\n display: flex;\n text-align: center;\n }\n margin-top: 10px;\n }\n`;\n\nexport const RewardProgressTotalButtonWithIcon = styled.div`\n display: flex;\n align-items: center;\n background-color: #e5edf6;\n border-radius: 20px;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n padding: 1rem;\n margin-bottom: 14px;\n\n @media (max-width: 950px) {\n margin-top: 14px;\n }\n`;\n\nexport const IconContainer = styled.span`\n .info-icon {\n margin-left: 6px !important;\n }\n .loyalty-icon {\n height: 19px !important;\n width: 19px !important;\n margin-left: 6px !important;\n }\n .loyalty-warning-icon {\n height: 19px !important;\n width: 19px !important;\n margin-right: 6px !important;\n }\n .outline-exclamation-icon {\n height: 48px !important;\n width: 48px !important;\n }\n`;\n\nexport const SeparatorCard = styled.div`\n position: absolute;\n height: 100%;\n`;\n\n// Height must equal the ring thickness, which is strokeWidth (12) as a percentage of the 100 viewBox.\nexport const SeparatorInnerCard = styled.div`\n background: #fff;\n width: 6px;\n height: 12%;\n`;\n\nexport const TooltipStyles = {\n tooltip: {\n sx: {\n color: '#FFFFFF',\n backgroundColor: '#252525',\n fontFamily: 'Inter',\n fontWeight: 400,\n fontSize: '14px',\n lineHeight: '20px',\n '& .MuiTooltip-arrow': {\n color: '#252525',\n },\n },\n },\n};\n","import React from 'react';\nimport { SeparatorCard, SeparatorInnerCard } from './CircularProgressBar.styled';\n\nfunction Separator(props: { readonly turns: number }) {\n return (\n <SeparatorCard\n style={{\n transform: `rotate(${props.turns}turn)`,\n }}\n >\n <SeparatorInnerCard />\n </SeparatorCard>\n );\n}\n\nfunction RadialSeparators(props: { count: number }) {\n const turns = 1 / props.count;\n const separatorNumber = 0.5; // to center the separator\n const separatorTurns = Array.from({ length: props.count }, (_, index) => index * turns + separatorNumber);\n return separatorTurns.map((turn) => <Separator key={turn} turns={turn} />);\n}\n\nRadialSeparators.displayName = 'RadialSeparators';\n\nexport default RadialSeparators;\n","const IS_BROWSER = typeof window === 'object';\n\nclass ApplicationStore {\n width = IS_BROWSER ? window.innerWidth : 0;\n\n scroll = {\n vertical: IS_BROWSER ? window.scrollY : 0,\n horizontal: IS_BROWSER ? window.scrollX : 0,\n direction: 'none',\n };\n\n get isMobile() {\n return this.isPhone;\n }\n\n get isPhone() {\n return IS_BROWSER ? window.innerWidth < 768 : this.width < 768;\n }\n}\n\nconst applicationContainer = new ApplicationStore();\nexport { IS_BROWSER, ApplicationStore, applicationContainer, applicationContainer as application };\nexport default applicationContainer;\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
function n(n,t){if(!t){t=n.slice(0)}return Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(t)}}))}function t(){var e=n(["\n display: flex;\n align-items: flex-start;\n width: 100%;\n\n @media (max-width: 950px) {\n margin-top: 24px;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n }\n"]);t=function n(){return e};return e}function e(){var t=n(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 8px;\n padding-left: ",";\n padding-right: ",";\n flex: ",";\n min-width: ",";\n"]);e=function n(){return t};return t}function i(){var t=n(["\n display: flex;\n align-items: center;\n gap: 16px;\n width: 100%;\n\n svg {\n flex-shrink: 0;\n }\n"]);i=function n(){return t};return t}function r(){var t=n(["\n flex: 1 0 0;\n min-width: 0;\n height: 3px;\n border-radius: 2px;\n background-color: ",";\n"]);r=function n(){return t};return t}function a(){var t=n(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n white-space: nowrap;\n word-break: break-word;\n\n .gift-roadmap-month {\n font-size: 10px;\n font-weight: 600;\n line-height: 12px;\n letter-spacing: 0.2px;\n color: #8c8c8c;\n }\n\n .gift-roadmap-gift {\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n letter-spacing: 0.12px;\n color: ",";\n }\n"]);a=function n(){return t};return t}import{a as o}from"./chunk-
|
|
1
|
+
function n(n,t){if(!t){t=n.slice(0)}return Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(t)}}))}function t(){var e=n(["\n display: flex;\n align-items: flex-start;\n width: 100%;\n\n @media (max-width: 950px) {\n margin-top: 24px;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n }\n"]);t=function n(){return e};return e}function e(){var t=n(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 8px;\n padding-left: ",";\n padding-right: ",";\n flex: ",";\n min-width: ",";\n"]);e=function n(){return t};return t}function i(){var t=n(["\n display: flex;\n align-items: center;\n gap: 16px;\n width: 100%;\n\n svg {\n flex-shrink: 0;\n }\n"]);i=function n(){return t};return t}function r(){var t=n(["\n flex: 1 0 0;\n min-width: 0;\n height: 3px;\n border-radius: 2px;\n background-color: ",";\n"]);r=function n(){return t};return t}function a(){var t=n(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n white-space: nowrap;\n word-break: break-word;\n\n .gift-roadmap-month {\n font-size: 10px;\n font-weight: 600;\n line-height: 12px;\n letter-spacing: 0.2px;\n color: #8c8c8c;\n }\n\n .gift-roadmap-gift {\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n letter-spacing: 0.12px;\n color: ",";\n }\n"]);a=function n(){return t};return t}import{a as o}from"./chunk-3RJWIGAN.mjs";import{d as s}from"./chunk-PN67M2PP.mjs";import{a as c,b as u,c as f}from"./chunk-CBUBKPM6.mjs";var d="#0B0A09",l="#E6E6E5",p=s.div(t()),x=s.div(e(),function(n){var t=n.isFirst;return t?"0":"16px"},function(n){var t=n.isLast;return t?"16px":"0"},function(n){var t=n.isLast;return t?"0 0 auto":"1 0 0"},function(n){var t=n.isLast;return t?"auto":"0"}),h=s.div(i()),m=s.div(r(),function(n){var t=n.isFilled;return t?d:l}),g=s.div(a(),d);import{jsx as v,jsxs as w}from"react/jsx-runtime";var b={issued:c,active:u,future:f},j=function(n,t,e){return n<e?"issued":n===t?"active":"future"},k=function(n,t,e,i){var r=n>0?Math.floor(t/n):0;return Array.from({length:Math.max(r,0)},function(t,r){return{index:r,cadenceMonth:(r+1)*n,state:j(r,e,i)}})},M=function(n){var t=n.giftCycle,e=n.maxCSM,i=n.currentCadenceIndex,r=i===void 0?0:i,a=n.issuedCadenceCount,s=a===void 0?0:a,c=n.translationConfig,u=k(t,e,r,s);return u.length?v(p,{"data-testid":"gift-roadmap",children:u.map(function(n){var t=n.index===u.length-1,e=b[n.state];return w(x,{isFirst:n.index===0,isLast:t,"data-step-state":n.state,children:[w(h,{children:[v(e,{}),!t&&v(m,{isFilled:n.state==="issued"})]}),w(g,{children:[v("span",{className:"gift-roadmap-month",children:o(c.monthLabel,{cadence_month:n.cadenceMonth})}),v("span",{className:"gift-roadmap-gift",children:o(c.giftLabel,{gift_index:n.index+1})})]})]},n.cadenceMonth)})}):null},y=M;export{y as a};//# sourceMappingURL=chunk-UHWCPMTT.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/gitlab-runner-data/builds/nextgen-development/loyalty/npm/react-loyalty-elements/dist/chunk-M6F5BD5Q.mjs","../src/GiftRoadmap/GiftRoadmap.styled.tsx","../src/GiftRoadmap/GiftRoadmap.tsx"],"names":["a","d","o","f","b","x","c","u","RAIL_ACTIVE_COLOR","RAIL_INACTIVE_COLOR","GiftRoadmapWrapper","newStyled","div","StepColumn","isFirst","isLast","StepTrack","StepRail","isFilled","StepLabels","jsx","jsxs","STEP_ICONS","issued","GiftBlackFilledIcon_default","active","GiftWhiteFilledIcon_default","future","GiftDisabledIcon_default","getStepState","index","currentCadenceIndex","issuedCadenceCount","buildSteps","giftCycle","maxCSM","totalCadences","Math","floor","Array","from","length","max","_","cadenceMonth","state","GiftRoadmap","props","translationConfig","steps","children","map","step","StepIcon","className","replacePlaceholders","monthLabel","cadence_month","giftLabel","gift_index","GiftRoadmap_default"],"mappings":"0/CAAA,OAAOA,KAAKC,CAAC,KAAK,sBAAuB,QAAOA,KAAKC,CAAC,KAAK,sBAAuB,QA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tBC,kBAEtEC,EAAQhB,EAAWC,EAAWC,EAAQJ,EAAqBC,GAEjE,OAAKiB,EAAMR,MAAA,CAKPrB,EAACV,EAAA,CAAmB,cAAY,eAC3BwC,SAAAD,EAAME,GAAA,CAAKC,SAAAA,GACR,IAAMrC,EAASqC,EAAKtB,KAAA,GAAUmB,EAAMR,MAAA,CAAS,EACvCY,EAAW/B,CAAAA,CAAW8B,EAAKP,KAAK,CAAA,CAEtC,OACIxB,EAACR,EAAA,CAEGC,QAASsC,EAAKtB,KAAA,GAAU,EACxBf,OAAQA,EACR,kBAAiBqC,EAAKP,KAAA,CAEtBK,SAAA,CAAA7B,EAACL,EAAA,CACGkC,SAAA,CAAA9B,EAACiC,EAAA,CAAA,GACA,CAACtC,GAAUK,EAACH,EAAA,CAASC,SAAUkC,EAAKP,KAAA,GAAU,QAAA,GAAU,GAE7DxB,EAACF,EAAA,CACG+B,SAAA,CAAA9B,EAAC,OAAA,CAAKkC,UAAU,qBACXJ,SAAAK,EAAoBP,EAAkBQ,UAAA,CAAY,CAC/CC,cAAeL,EAAKR,YACxB,EAAC,GAELxB,EAAC,OAAA,CAAKkC,UAAU,oBACXJ,SAAAK,EAAoBP,EAAkBU,SAAA,CAAW,CAC9CC,WAAYP,EAAKtB,KAAA,CAAQ,CAC7B,EAAC,GACL,GACJ,EApBKsB,EAAKR,YAqBd,CAER,EAAC,GAlCE,IAqCf,EAEOgB,EAAQd,SAAAA,KAAAA,CAAAA","sourcesContent":["import{a as d}from\"./chunk-THTK5CGU.mjs\";import{d as o}from\"./chunk-PN67M2PP.mjs\";import{a as f,b as x,c as u}from\"./chunk-CBUBKPM6.mjs\";var g=\"#0B0A09\",C=\"#E6E6E5\",h=o.div`\n display: flex;\n align-items: flex-start;\n width: 100%;\n\n @media (max-width: 950px) {\n margin-top: 24px;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n }\n`,S=o.div`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 8px;\n padding-left: ${({isFirst:t})=>t?\"0\":\"16px\"};\n padding-right: ${({isLast:t})=>t?\"16px\":\"0\"};\n flex: ${({isLast:t})=>t?\"0 0 auto\":\"1 0 0\"};\n min-width: ${({isLast:t})=>t?\"auto\":\"0\"};\n`,b=o.div`\n display: flex;\n align-items: center;\n gap: 16px;\n width: 100%;\n\n svg {\n flex-shrink: 0;\n }\n`,R=o.div`\n flex: 1 0 0;\n min-width: 0;\n height: 3px;\n border-radius: 2px;\n background-color: ${({isFilled:t})=>t?g:C};\n`,w=o.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n white-space: nowrap;\n word-break: break-word;\n\n .gift-roadmap-month {\n font-size: 10px;\n font-weight: 600;\n line-height: 12px;\n letter-spacing: 0.2px;\n color: #8c8c8c;\n }\n\n .gift-roadmap-gift {\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n letter-spacing: 0.12px;\n color: ${g};\n }\n`;import{jsx as n,jsxs as m}from\"react/jsx-runtime\";var L={issued:f,active:x,future:u},I=(t,i,r)=>t<r?\"issued\":t===i?\"active\":\"future\",k=(t,i,r,p)=>{let s=t>0?Math.floor(i/t):0;return Array.from({length:Math.max(s,0)},(l,a)=>({index:a,cadenceMonth:(a+1)*t,state:I(a,r,p)}))},v=t=>{let{giftCycle:i,maxCSM:r,currentCadenceIndex:p=0,issuedCadenceCount:s=0,translationConfig:l}=t,a=k(i,r,p,s);return a.length?n(h,{\"data-testid\":\"gift-roadmap\",children:a.map(e=>{let c=e.index===a.length-1,G=L[e.state];return m(S,{isFirst:e.index===0,isLast:c,\"data-step-state\":e.state,children:[m(b,{children:[n(G,{}),!c&&n(R,{isFilled:e.state===\"issued\"})]}),m(w,{children:[n(\"span\",{className:\"gift-roadmap-month\",children:d(l.monthLabel,{cadence_month:e.cadenceMonth})}),n(\"span\",{className:\"gift-roadmap-gift\",children:d(l.giftLabel,{gift_index:e.index+1})})]})]},e.cadenceMonth)})}):null},$=v;export{$ as a};\n","import styled from '@emotion/styled';\n\nexport const RAIL_ACTIVE_COLOR = '#0B0A09';\nexport const RAIL_INACTIVE_COLOR = '#E6E6E5';\n\nexport const GiftRoadmapWrapper = styled.div`\n display: flex;\n align-items: flex-start;\n width: 100%;\n\n @media (max-width: 950px) {\n margin-top: 24px;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n }\n`;\n\nexport const StepColumn = styled.div<{ isFirst: boolean; isLast: boolean }>`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 8px;\n padding-left: ${({ isFirst }) => (isFirst ? '0' : '16px')};\n padding-right: ${({ isLast }) => (isLast ? '16px' : '0')};\n flex: ${({ isLast }) => (isLast ? '0 0 auto' : '1 0 0')};\n min-width: ${({ isLast }) => (isLast ? 'auto' : '0')};\n`;\n\nexport const StepTrack = styled.div`\n display: flex;\n align-items: center;\n gap: 16px;\n width: 100%;\n\n svg {\n flex-shrink: 0;\n }\n`;\n\nexport const StepRail = styled.div<{ isFilled: boolean }>`\n flex: 1 0 0;\n min-width: 0;\n height: 3px;\n border-radius: 2px;\n background-color: ${({ isFilled }) => (isFilled ? RAIL_ACTIVE_COLOR : RAIL_INACTIVE_COLOR)};\n`;\n\nexport const StepLabels = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n white-space: nowrap;\n word-break: break-word;\n\n .gift-roadmap-month {\n font-size: 10px;\n font-weight: 600;\n line-height: 12px;\n letter-spacing: 0.2px;\n color: #8c8c8c;\n }\n\n .gift-roadmap-gift {\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n letter-spacing: 0.12px;\n color: ${RAIL_ACTIVE_COLOR};\n }\n`;\n","import React from 'react';\nimport GiftBlackFilledIcon from '../Icons/GiftBlackFilledIcon';\nimport GiftWhiteFilledIcon from '../Icons/GiftWhiteFilledIcon';\nimport GiftDisabledIcon from '../Icons/GiftDisabledIcon';\nimport { replacePlaceholders } from '../Utils/helper';\nimport { GiftRoadmapProps, GiftRoadmapStep, GiftRoadmapStepState } from './types';\nimport { GiftRoadmapWrapper, StepColumn, StepLabels, StepRail, StepTrack } from './GiftRoadmap.styled';\n\nconst STEP_ICONS: Record<GiftRoadmapStepState, () => JSX.Element> = {\n issued: GiftBlackFilledIcon,\n active: GiftWhiteFilledIcon,\n future: GiftDisabledIcon,\n};\n\nconst getStepState = (index: number, currentCadenceIndex: number, issuedCadenceCount: number): GiftRoadmapStepState => {\n if (index < issuedCadenceCount) return 'issued';\n if (index === currentCadenceIndex) return 'active';\n return 'future';\n};\n\nconst buildSteps = (\n giftCycle: number,\n maxCSM: number,\n currentCadenceIndex: number,\n issuedCadenceCount: number,\n): GiftRoadmapStep[] => {\n const totalCadences = giftCycle > 0 ? Math.floor(maxCSM / giftCycle) : 0;\n\n return Array.from({ length: Math.max(totalCadences, 0) }, (_, index) => ({\n index,\n cadenceMonth: (index + 1) * giftCycle,\n state: getStepState(index, currentCadenceIndex, issuedCadenceCount),\n }));\n};\n\nconst GiftRoadmap = (props: GiftRoadmapProps) => {\n const { giftCycle, maxCSM, currentCadenceIndex = 0, issuedCadenceCount = 0, translationConfig } = props;\n\n const steps = buildSteps(giftCycle, maxCSM, currentCadenceIndex, issuedCadenceCount);\n\n if (!steps.length) {\n return null;\n }\n\n return (\n <GiftRoadmapWrapper data-testid=\"gift-roadmap\">\n {steps.map((step) => {\n const isLast = step.index === steps.length - 1;\n const StepIcon = STEP_ICONS[step.state];\n\n return (\n <StepColumn\n key={step.cadenceMonth}\n isFirst={step.index === 0}\n isLast={isLast}\n data-step-state={step.state}\n >\n <StepTrack>\n <StepIcon />\n {!isLast && <StepRail isFilled={step.state === 'issued'} />}\n </StepTrack>\n <StepLabels>\n <span className=\"gift-roadmap-month\">\n {replacePlaceholders(translationConfig.monthLabel, {\n cadence_month: step.cadenceMonth,\n })}\n </span>\n <span className=\"gift-roadmap-gift\">\n {replacePlaceholders(translationConfig.giftLabel, {\n gift_index: step.index + 1,\n })}\n </span>\n </StepLabels>\n </StepColumn>\n );\n })}\n </GiftRoadmapWrapper>\n );\n};\n\nexport default GiftRoadmap;\nexport { GiftRoadmap };\n"]}
|
|
1
|
+
{"version":3,"sources":["/gitlab-runner-data/builds/nextgen-development/loyalty/npm/react-loyalty-elements/dist/chunk-UHWCPMTT.mjs","../src/GiftRoadmap/GiftRoadmap.styled.tsx","../src/GiftRoadmap/GiftRoadmap.tsx"],"names":["a","d","o","f","b","x","c","u","RAIL_ACTIVE_COLOR","RAIL_INACTIVE_COLOR","GiftRoadmapWrapper","newStyled","div","StepColumn","isFirst","isLast","StepTrack","StepRail","isFilled","StepLabels","jsx","jsxs","STEP_ICONS","issued","GiftBlackFilledIcon_default","active","GiftWhiteFilledIcon_default","future","GiftDisabledIcon_default","getStepState","index","currentCadenceIndex","issuedCadenceCount","buildSteps","giftCycle","maxCSM","totalCadences","Math","floor","Array","from","length","max","_","cadenceMonth","state","GiftRoadmap","props","translationConfig","steps","children","map","step","StepIcon","className","replacePlaceholders","monthLabel","cadence_month","giftLabel","gift_index","GiftRoadmap_default"],"mappings":"0/CAAA,OAAOA,KAAKC,CAAC,KAAK,sBAAuB,QAAOA,KAAKC,CAAC,KAAK,sBAAuB,QAAOF,KAAKG,CAAC,CAACC,KAAKC,CAAC,CAACC,KAAKC,CAAC,KAAK,sBCE3G,CAAA,IAAMC,EAAoB,UACpBC,EAAsB,UAEtBC,EAAqBC,EAAOC,GAAA,MAY5BC,EAAaF,EAAOC,GAAA,KAKb,gBAAGE,IAAAA,eAAeA,EAAU,IAAM,QACjC,gBAAGC,IAAAA,cAAcA,EAAS,OAAS,KAC5C,gBAAGA,IAAAA,cAAcA,EAAS,WAAa,SAClC,gBAAGA,IAAAA,cAAcA,EAAS,OAAS,MAGvCC,EAAYL,EAAOC,GAAA,MAWnBK,EAAWN,EAAOC,GAAA,KAKP,gBAAGM,IAAAA,gBAAgBA,EAAWV,EAAoBC,IAG7DU,EAAaR,EAAOC,GAAA,KAoBhBJ,ECVO,QACIY,OAAAA,CAAAA,CADJC,QAAAA,CAAAA,KAAA,mBAjDxB,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xB,EAACF,EAAA,CACG+B,SAAA,CAAA9B,EAAC,OAAA,CAAKkC,UAAU,qBACXJ,SAAAK,EAAoBP,EAAkBQ,UAAA,CAAY,CAC/CC,cAAeL,EAAKR,YACxB,EAAC,GAELxB,EAAC,OAAA,CAAKkC,UAAU,oBACXJ,SAAAK,EAAoBP,EAAkBU,SAAA,CAAW,CAC9CC,WAAYP,EAAKtB,KAAA,CAAQ,CAC7B,EAAC,GACL,GACJ,EApBKsB,EAAKR,YAqBd,CAER,EAAC,GAlCE,IAqCf,EAEOgB,EAAQd,SAAAA,KAAAA,CAAAA","sourcesContent":["import{a as d}from\"./chunk-3RJWIGAN.mjs\";import{d as o}from\"./chunk-PN67M2PP.mjs\";import{a as f,b as x,c as u}from\"./chunk-CBUBKPM6.mjs\";var g=\"#0B0A09\",C=\"#E6E6E5\",h=o.div`\n display: flex;\n align-items: flex-start;\n width: 100%;\n\n @media (max-width: 950px) {\n margin-top: 24px;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n }\n`,S=o.div`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 8px;\n padding-left: ${({isFirst:t})=>t?\"0\":\"16px\"};\n padding-right: ${({isLast:t})=>t?\"16px\":\"0\"};\n flex: ${({isLast:t})=>t?\"0 0 auto\":\"1 0 0\"};\n min-width: ${({isLast:t})=>t?\"auto\":\"0\"};\n`,b=o.div`\n display: flex;\n align-items: center;\n gap: 16px;\n width: 100%;\n\n svg {\n flex-shrink: 0;\n }\n`,R=o.div`\n flex: 1 0 0;\n min-width: 0;\n height: 3px;\n border-radius: 2px;\n background-color: ${({isFilled:t})=>t?g:C};\n`,w=o.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n white-space: nowrap;\n word-break: break-word;\n\n .gift-roadmap-month {\n font-size: 10px;\n font-weight: 600;\n line-height: 12px;\n letter-spacing: 0.2px;\n color: #8c8c8c;\n }\n\n .gift-roadmap-gift {\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n letter-spacing: 0.12px;\n color: ${g};\n }\n`;import{jsx as n,jsxs as m}from\"react/jsx-runtime\";var L={issued:f,active:x,future:u},I=(t,i,r)=>t<r?\"issued\":t===i?\"active\":\"future\",k=(t,i,r,p)=>{let s=t>0?Math.floor(i/t):0;return Array.from({length:Math.max(s,0)},(l,a)=>({index:a,cadenceMonth:(a+1)*t,state:I(a,r,p)}))},v=t=>{let{giftCycle:i,maxCSM:r,currentCadenceIndex:p=0,issuedCadenceCount:s=0,translationConfig:l}=t,a=k(i,r,p,s);return a.length?n(h,{\"data-testid\":\"gift-roadmap\",children:a.map(e=>{let c=e.index===a.length-1,G=L[e.state];return m(S,{isFirst:e.index===0,isLast:c,\"data-step-state\":e.state,children:[m(b,{children:[n(G,{}),!c&&n(R,{isFilled:e.state===\"issued\"})]}),m(w,{children:[n(\"span\",{className:\"gift-roadmap-month\",children:d(l.monthLabel,{cadence_month:e.cadenceMonth})}),n(\"span\",{className:\"gift-roadmap-gift\",children:d(l.giftLabel,{gift_index:e.index+1})})]})]},e.cadenceMonth)})}):null},$=v;export{$ as a};\n","import styled from '@emotion/styled';\n\nexport const RAIL_ACTIVE_COLOR = '#0B0A09';\nexport const RAIL_INACTIVE_COLOR = '#E6E6E5';\n\nexport const GiftRoadmapWrapper = styled.div`\n display: flex;\n align-items: flex-start;\n width: 100%;\n\n @media (max-width: 950px) {\n margin-top: 24px;\n overflow-x: auto;\n -webkit-overflow-scrolling: touch;\n }\n`;\n\nexport const StepColumn = styled.div<{ isFirst: boolean; isLast: boolean }>`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n gap: 8px;\n padding-left: ${({ isFirst }) => (isFirst ? '0' : '16px')};\n padding-right: ${({ isLast }) => (isLast ? '16px' : '0')};\n flex: ${({ isLast }) => (isLast ? '0 0 auto' : '1 0 0')};\n min-width: ${({ isLast }) => (isLast ? 'auto' : '0')};\n`;\n\nexport const StepTrack = styled.div`\n display: flex;\n align-items: center;\n gap: 16px;\n width: 100%;\n\n svg {\n flex-shrink: 0;\n }\n`;\n\nexport const StepRail = styled.div<{ isFilled: boolean }>`\n flex: 1 0 0;\n min-width: 0;\n height: 3px;\n border-radius: 2px;\n background-color: ${({ isFilled }) => (isFilled ? RAIL_ACTIVE_COLOR : RAIL_INACTIVE_COLOR)};\n`;\n\nexport const StepLabels = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n white-space: nowrap;\n word-break: break-word;\n\n .gift-roadmap-month {\n font-size: 10px;\n font-weight: 600;\n line-height: 12px;\n letter-spacing: 0.2px;\n color: #8c8c8c;\n }\n\n .gift-roadmap-gift {\n font-size: 12px;\n font-weight: 400;\n line-height: 16px;\n letter-spacing: 0.12px;\n color: ${RAIL_ACTIVE_COLOR};\n }\n`;\n","import React from 'react';\nimport GiftBlackFilledIcon from '../Icons/GiftBlackFilledIcon';\nimport GiftWhiteFilledIcon from '../Icons/GiftWhiteFilledIcon';\nimport GiftDisabledIcon from '../Icons/GiftDisabledIcon';\nimport { replacePlaceholders } from '../Utils/helper';\nimport { GiftRoadmapProps, GiftRoadmapStep, GiftRoadmapStepState } from './types';\nimport { GiftRoadmapWrapper, StepColumn, StepLabels, StepRail, StepTrack } from './GiftRoadmap.styled';\n\nconst STEP_ICONS: Record<GiftRoadmapStepState, () => JSX.Element> = {\n issued: GiftBlackFilledIcon,\n active: GiftWhiteFilledIcon,\n future: GiftDisabledIcon,\n};\n\nconst getStepState = (index: number, currentCadenceIndex: number, issuedCadenceCount: number): GiftRoadmapStepState => {\n if (index < issuedCadenceCount) return 'issued';\n if (index === currentCadenceIndex) return 'active';\n return 'future';\n};\n\nconst buildSteps = (\n giftCycle: number,\n maxCSM: number,\n currentCadenceIndex: number,\n issuedCadenceCount: number,\n): GiftRoadmapStep[] => {\n const totalCadences = giftCycle > 0 ? Math.floor(maxCSM / giftCycle) : 0;\n\n return Array.from({ length: Math.max(totalCadences, 0) }, (_, index) => ({\n index,\n cadenceMonth: (index + 1) * giftCycle,\n state: getStepState(index, currentCadenceIndex, issuedCadenceCount),\n }));\n};\n\nconst GiftRoadmap = (props: GiftRoadmapProps) => {\n const { giftCycle, maxCSM, currentCadenceIndex = 0, issuedCadenceCount = 0, translationConfig } = props;\n\n const steps = buildSteps(giftCycle, maxCSM, currentCadenceIndex, issuedCadenceCount);\n\n if (!steps.length) {\n return null;\n }\n\n return (\n <GiftRoadmapWrapper data-testid=\"gift-roadmap\">\n {steps.map((step) => {\n const isLast = step.index === steps.length - 1;\n const StepIcon = STEP_ICONS[step.state];\n\n return (\n <StepColumn\n key={step.cadenceMonth}\n isFirst={step.index === 0}\n isLast={isLast}\n data-step-state={step.state}\n >\n <StepTrack>\n <StepIcon />\n {!isLast && <StepRail isFilled={step.state === 'issued'} />}\n </StepTrack>\n <StepLabels>\n <span className=\"gift-roadmap-month\">\n {replacePlaceholders(translationConfig.monthLabel, {\n cadence_month: step.cadenceMonth,\n })}\n </span>\n <span className=\"gift-roadmap-gift\">\n {replacePlaceholders(translationConfig.giftLabel, {\n gift_index: step.index + 1,\n })}\n </span>\n </StepLabels>\n </StepColumn>\n );\n })}\n </GiftRoadmapWrapper>\n );\n};\n\nexport default GiftRoadmap;\nexport { GiftRoadmap };\n"]}
|
package/package.json
CHANGED
package/dist/chunk-THTK5CGU.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
var e=function(e,r){return Object.keys(r).reduce(function(e,n){var t;var a=(t=r[n])!==null&&t!==void 0?t:"";return e.replace(new RegExp("%".concat(n,"%"),"g"),String(a))},e)};export{e as a};//# sourceMappingURL=chunk-THTK5CGU.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/Utils/helper.ts"],"names":["replacePlaceholders","template","values","Object","keys","reduce","result","key","value","replace","RegExp","String","l","a"],"mappings":"AAAO,IAAMA,EAAsB,SAC/BC,EACAC,UAEOC,OAAOC,IAAA,CAAKF,GAAQG,MAAA,CAAO,SAACC,EAAQC,OACzBL,EAAd,IAAMM,EAAQN,CAAAA,EAAAA,CAAAA,CAAOK,EAAG,UAAVL,WAAAA,EAAe,GAC7B,OAAOI,EAAOG,OAAA,CAAQ,IAAIC,OAAO,IAAO,OAAHH,EAAG,KAAK,KAAMI,OAAOH,GAC9D,EAAGP,WAAQW,KAAAC,CAAA","sourcesContent":["export const replacePlaceholders = (\n template: string,\n values: { [key: string]: string | number | null }, // Add null\n) => {\n return Object.keys(values).reduce((result, key) => {\n const value = values[key] ?? ''; // Replace null with empty string\n return result.replace(new RegExp(`%${key}%`, 'g'), String(value));\n }, template);\n};\n\nexport const currencySymbol = () => {\n return '$';\n};\n"]}
|
package/dist/chunk-TURO34CN.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
function n(n,t){if(!(n instanceof t)){throw new TypeError("Cannot call a class as a function")}}function t(n,t){for(var e=0;e<t.length;e++){var r=t[e];r.enumerable=r.enumerable||false;r.configurable=true;if("value"in r)r.writable=true;Object.defineProperty(n,r.key,r)}}function e(n,e,r){if(e)t(n.prototype,e);if(r)t(n,r);return n}function r(n,t){if(!t){t=n.slice(0)}return Object.freeze(Object.defineProperties(n,{raw:{value:Object.freeze(t)}}))}function i(n){"@swc/helpers - typeof";return n&&typeof Symbol!=="undefined"&&n.constructor===Symbol?"symbol":typeof n}function o(){var n=r(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n background-color: #f5f5f5;\n border: 1px solid #e0e0e0;\n border-radius: 10px;\n padding: 1.5rem;\n margin-bottom: 20px;\n height: 50%;\n margin: auto;\n\n @media (max-width: 950px) {\n flex-direction: column;\n }\n"]);o=function t(){return n};return n}function a(){var n=r(["\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n\n .reward-logo {\n width: 200px;\n margin-bottom: 12px;\n }\n\n .reward-progress {\n height: 150px;\n width: 150px;\n flex-shrink: 0;\n\n /* The library stylesheet is not bundled, so the SVG stays inline and its baseline gap\n makes the wrapper taller than the ring, pushing the radial separators off centre. */\n > div {\n height: 100%;\n }\n\n .CircularProgressbar {\n display: block;\n width: 100%;\n height: 100%;\n }\n }\n .progress-bar {\n background-color: #e0e0e0;\n height: 100%;\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n width: 100%;\n\n .info-container {\n margin-left: 0px;\n align-items: center;\n }\n .reward-progress-total-div {\n margin-top: 10px;\n }\n }\n"]);a=function t(){return n};return n}function c(){var n=r(["\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n margin-left: 16px;\n min-width: 0;\n\n .info-item {\n margin: 5px 0;\n font-weight: 600;\n }\n\n @media (max-width: 950px) {\n align-items: center;\n margin-left: 0;\n }\n"]);c=function t(){return n};return n}function l(){var n=r(["\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n"]);l=function t(){return n};return n}function u(){var n=r(["\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n width: 100%;\n\n .reward-logo {\n width: 200px;\n margin-bottom: 0;\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: center;\n\n .reward-header-total {\n width: 100%;\n justify-content: center;\n }\n }\n"]);u=function t(){return n};return n}function s(){var n=r(["\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n color: black;\n\n .center-value-progress-bar-price {\n margin: 0;\n }\n .center-value-progress-bar-voucher {\n margin: 0;\n letter-spacing: 0.01em;\n }\n"]);s=function t(){return n};return n}function f(){var n=r(["\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n .total-button {\n display: flex;\n align-items: center;\n background-color: #e5edf6;\n border-radius: 20px;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n }\n .reward-subtitle {\n letter-spacing: 0;\n display: flex;\n }\n\n @media (max-width: 950px) {\n .reward-subtitle {\n letter-spacing: 0;\n display: flex;\n text-align: center;\n }\n margin-top: 10px;\n }\n"]);f=function t(){return n};return n}function d(){var n=r(["\n display: flex;\n align-items: center;\n background-color: #e5edf6;\n border-radius: 20px;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n padding: 1rem;\n margin-bottom: 14px;\n\n @media (max-width: 950px) {\n margin-top: 14px;\n }\n"]);d=function t(){return n};return n}function p(){var n=r(["\n .info-icon {\n margin-left: 6px !important;\n }\n .loyalty-icon {\n height: 19px !important;\n width: 19px !important;\n margin-left: 6px !important;\n }\n .loyalty-warning-icon {\n height: 19px !important;\n width: 19px !important;\n margin-right: 6px !important;\n }\n .outline-exclamation-icon {\n height: 48px !important;\n width: 48px !important;\n }\n"]);p=function t(){return n};return n}function m(){var n=r(["\n position: absolute;\n height: 100%;\n"]);m=function t(){return n};return n}function g(){var n=r(["\n background: #fff;\n width: 6px;\n height: 12%;\n"]);g=function t(){return n};return n}import{d as h}from"./chunk-PN67M2PP.mjs";var x=h.div(o()),w=h.div(a()),b=h.div(c()),y=h.div(l()),v=h.div(u()),k=h.div(s()),j=h.div(f()),P=h.div(d()),F=h.span(p()),z=h.div(m()),S=h.div(g()),C={tooltip:{sx:{color:"#FFFFFF",backgroundColor:"#252525",fontFamily:"Inter",fontWeight:400,fontSize:"14px",lineHeight:"20px","& .MuiTooltip-arrow":{color:"#252525"}}}};import{jsx as O}from"react/jsx-runtime";function _(n){return O(z,{style:{transform:"rotate(".concat(n.turns,"turn)")},children:O(S,{})})}function M(n){var t=1/n.count,e=.5;return Array.from({length:n.count},function(n,r){return r*t+e}).map(function(n){return O(_,{turns:n},n)})}var T=M;var W=(typeof window==="undefined"?"undefined":i(window))=="object",E=/*#__PURE__*/function(){"use strict";function t(){n(this,t);this.width=W?window.innerWidth:0;this.scroll={vertical:W?window.scrollY:0,horizontal:W?window.scrollX:0,direction:"none"}}e(t,[{key:"isMobile",get:function n(){return this.isPhone}},{key:"isPhone",get:function n(){return W?window.innerWidth<768:this.width<768}}]);return t}(),A=new E;export{x as a,w as b,b as c,y as d,v as e,k as f,j as g,P as h,F as i,C as j,T as k,A as l};//# sourceMappingURL=chunk-TURO34CN.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/gitlab-runner-data/builds/nextgen-development/loyalty/npm/react-loyalty-elements/dist/chunk-TURO34CN.mjs","../src/CircularProgressBar/CircularProgressBar.styled.tsx","../src/CircularProgressBar/RadialSeparator.tsx","../src/Utils/application/application.ts"],"names":["d","t","RewardProgressBarContainer","newStyled","div","LoyaltyProgressSubContainer","StyledCard","Learn3XLink","LoyaltyRewardsHeaderContainer","ProgressBarCenter","RewardProgressTotalContainer","RewardProgressTotalButtonWithIcon","IconContainer","span","SeparatorCard","SeparatorInnerCard","TooltipStyles","tooltip","sx","color","backgroundColor","fontFamily","fontWeight","fontSize","lineHeight","jsx","Separator","props","style","transform","turns","children","RadialSeparators","count","separatorNumber","Array","from","length","_","index","map","turn","RadialSeparator_default","IS_BROWSER","window","ApplicationStore","width","innerWidth","scroll","vertical","scrollY","horizontal","scrollX","direction","isMobile","isPhone","applicationContainer"],"mappings":"+pKAAA,OAAOA,KAAKC,CAAC,KAAK,sBCEX,CAAA,IAAMC,EAA6BC,EAAOC,GAAA,MAmBpCC,EAA8BF,EAAOC,GAAA,MA+CrCE,EAAaH,EAAOC,GAAA,MAiBpBG,EAAcJ,EAAOC,GAAA,MAMrBI,EAAgCL,EAAOC,GAAA,MAuBvCK,EAAoBN,EAAOC,GAAA,MAgB3BM,EAA+BP,EAAOC,GAAA,MA8BtCO,EAAoCR,EAAOC,GAAA,MAgB3CQ,EAAgBT,EAAOU,IAAA,MAoBvBC,EAAgBX,EAAOC,GAAA,MAMvBW,EAAqBZ,EAAOC,GAAA,MAM5BY,EAAgB,CACzBC,QAAS,CACLC,GAAI,CACAC,MAAO,UACPC,gBAAiB,UACjBC,WAAY,QACZC,WAAY,IACZC,SAAU,OACVC,WAAY,OACZ,sBAAuB,CACnBL,MAAO,SACX,CACJ,CACJ,CACJ,CCpNY,QAAAM,OAAAA,CAAAA,KAAA,mBAPZ,CAAA,SAASC,EAAUC,CAAAA,EACf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\n align-items: center;\n align-content: center;\n background-color: #f5f5f5;\n border: 1px solid #e0e0e0;\n border-radius: 10px;\n padding: 1.5rem;\n margin-bottom: 20px;\n height: 50%;\n margin: auto;\n\n @media (max-width: 950px) {\n flex-direction: column;\n }\n`,f=t.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n\n .reward-logo {\n width: 200px;\n margin-bottom: 12px;\n }\n\n .reward-progress {\n height: 150px;\n width: 150px;\n flex-shrink: 0;\n\n /* The library stylesheet is not bundled, so the SVG stays inline and its baseline gap\n makes the wrapper taller than the ring, pushing the radial separators off centre. */\n > div {\n height: 100%;\n }\n\n .CircularProgressbar {\n display: block;\n width: 100%;\n height: 100%;\n }\n }\n .progress-bar {\n background-color: #e0e0e0;\n height: 100%;\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n width: 100%;\n\n .info-container {\n margin-left: 0px;\n align-items: center;\n }\n .reward-progress-total-div {\n margin-top: 10px;\n }\n }\n`,u=t.div`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n margin-left: 16px;\n min-width: 0;\n\n .info-item {\n margin: 5px 0;\n font-weight: 600;\n }\n\n @media (max-width: 950px) {\n align-items: center;\n margin-left: 0;\n }\n`,w=t.div`\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n`,b=t.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n width: 100%;\n\n .reward-logo {\n width: 200px;\n margin-bottom: 0;\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: center;\n\n .reward-header-total {\n width: 100%;\n justify-content: center;\n }\n }\n`,y=t.div`\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n color: black;\n\n .center-value-progress-bar-price {\n margin: 0;\n }\n .center-value-progress-bar-voucher {\n margin: 0;\n letter-spacing: 0.01em;\n }\n`,v=t.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n .total-button {\n display: flex;\n align-items: center;\n background-color: #e5edf6;\n border-radius: 20px;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n }\n .reward-subtitle {\n letter-spacing: 0;\n display: flex;\n }\n\n @media (max-width: 950px) {\n .reward-subtitle {\n letter-spacing: 0;\n display: flex;\n text-align: center;\n }\n margin-top: 10px;\n }\n`,C=t.div`\n display: flex;\n align-items: center;\n background-color: #e5edf6;\n border-radius: 20px;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n padding: 1rem;\n margin-bottom: 14px;\n\n @media (max-width: 950px) {\n margin-top: 14px;\n }\n`,S=t.span`\n .info-icon {\n margin-left: 6px !important;\n }\n .loyalty-icon {\n height: 19px !important;\n width: 19px !important;\n margin-left: 6px !important;\n }\n .loyalty-warning-icon {\n height: 19px !important;\n width: 19px !important;\n margin-right: 6px !important;\n }\n .outline-exclamation-icon {\n height: 48px !important;\n width: 48px !important;\n }\n`,a=t.div`\n position: absolute;\n height: 100%;\n`,l=t.div`\n background: #fff;\n width: 6px;\n height: 12%;\n`,k={tooltip:{sx:{color:\"#FFFFFF\",backgroundColor:\"#252525\",fontFamily:\"Inter\",fontWeight:400,fontSize:\"14px\",lineHeight:\"20px\",\"& .MuiTooltip-arrow\":{color:\"#252525\"}}}};import{jsx as o}from\"react/jsx-runtime\";function c(e){return o(a,{style:{transform:`rotate(${e.turns}turn)`},children:o(l,{})})}function x(e){let s=1/e.count,p=.5;return Array.from({length:e.count},(i,d)=>d*s+p).map(i=>o(c,{turns:i},i))}var F=x;var r=typeof window==\"object\",n=class{constructor(){this.width=r?window.innerWidth:0;this.scroll={vertical:r?window.scrollY:0,horizontal:r?window.scrollX:0,direction:\"none\"}}get isMobile(){return this.isPhone}get isPhone(){return r?window.innerWidth<768:this.width<768}},j=new n;export{h as a,f as b,u as c,w as d,b as e,y as f,v as g,C as h,S as i,k as j,F as k,j as l};\n","import styled from '@emotion/styled';\n\nexport const RewardProgressBarContainer = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n background-color: #f5f5f5;\n border: 1px solid #e0e0e0;\n border-radius: 10px;\n padding: 1.5rem;\n margin-bottom: 20px;\n height: 50%;\n margin: auto;\n\n @media (max-width: 950px) {\n flex-direction: column;\n }\n`;\n\nexport const LoyaltyProgressSubContainer = styled.div`\n display: flex;\n flex-direction: row;\n justify-content: space-between;\n align-items: center;\n align-content: center;\n\n .reward-logo {\n width: 200px;\n margin-bottom: 12px;\n }\n\n .reward-progress {\n height: 150px;\n width: 150px;\n flex-shrink: 0;\n\n /* The library stylesheet is not bundled, so the SVG stays inline and its baseline gap\n makes the wrapper taller than the ring, pushing the radial separators off centre. */\n > div {\n height: 100%;\n }\n\n .CircularProgressbar {\n display: block;\n width: 100%;\n height: 100%;\n }\n }\n .progress-bar {\n background-color: #e0e0e0;\n height: 100%;\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n width: 100%;\n\n .info-container {\n margin-left: 0px;\n align-items: center;\n }\n .reward-progress-total-div {\n margin-top: 10px;\n }\n }\n`;\nexport const StyledCard = styled.div`\n display: flex;\n flex-direction: column;\n align-items: flex-start;\n margin-left: 16px;\n min-width: 0;\n\n .info-item {\n margin: 5px 0;\n font-weight: 600;\n }\n\n @media (max-width: 950px) {\n align-items: center;\n margin-left: 0;\n }\n`;\nexport const Learn3XLink = styled.div`\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n`;\n\nexport const LoyaltyRewardsHeaderContainer = styled.div`\n display: flex;\n flex-direction: row;\n align-items: center;\n justify-content: space-between;\n gap: 1rem;\n width: 100%;\n\n .reward-logo {\n width: 200px;\n margin-bottom: 0;\n }\n\n @media (max-width: 950px) {\n flex-direction: column;\n align-items: center;\n\n .reward-header-total {\n width: 100%;\n justify-content: center;\n }\n }\n`;\nexport const ProgressBarCenter = styled.div`\n position: absolute;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%);\n text-align: center;\n color: black;\n\n .center-value-progress-bar-price {\n margin: 0;\n }\n .center-value-progress-bar-voucher {\n margin: 0;\n letter-spacing: 0.01em;\n }\n`;\nexport const RewardProgressTotalContainer = styled.div`\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n\n .total-button {\n display: flex;\n align-items: center;\n background-color: #e5edf6;\n border-radius: 20px;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n }\n .reward-subtitle {\n letter-spacing: 0;\n display: flex;\n }\n\n @media (max-width: 950px) {\n .reward-subtitle {\n letter-spacing: 0;\n display: flex;\n text-align: center;\n }\n margin-top: 10px;\n }\n`;\n\nexport const RewardProgressTotalButtonWithIcon = styled.div`\n display: flex;\n align-items: center;\n background-color: #e5edf6;\n border-radius: 20px;\n font-size: 14px;\n font-weight: 400;\n line-height: 20px;\n padding: 1rem;\n margin-bottom: 14px;\n\n @media (max-width: 950px) {\n margin-top: 14px;\n }\n`;\n\nexport const IconContainer = styled.span`\n .info-icon {\n margin-left: 6px !important;\n }\n .loyalty-icon {\n height: 19px !important;\n width: 19px !important;\n margin-left: 6px !important;\n }\n .loyalty-warning-icon {\n height: 19px !important;\n width: 19px !important;\n margin-right: 6px !important;\n }\n .outline-exclamation-icon {\n height: 48px !important;\n width: 48px !important;\n }\n`;\n\nexport const SeparatorCard = styled.div`\n position: absolute;\n height: 100%;\n`;\n\n// Height must equal the ring thickness, which is strokeWidth (12) as a percentage of the 100 viewBox.\nexport const SeparatorInnerCard = styled.div`\n background: #fff;\n width: 6px;\n height: 12%;\n`;\n\nexport const TooltipStyles = {\n tooltip: {\n sx: {\n color: '#FFFFFF',\n backgroundColor: '#252525',\n fontFamily: 'Inter',\n fontWeight: 400,\n fontSize: '14px',\n lineHeight: '20px',\n '& .MuiTooltip-arrow': {\n color: '#252525',\n },\n },\n },\n};\n","import React from 'react';\nimport { SeparatorCard, SeparatorInnerCard } from './CircularProgressBar.styled';\n\nfunction Separator(props: { readonly turns: number }) {\n return (\n <SeparatorCard\n style={{\n transform: `rotate(${props.turns}turn)`,\n }}\n >\n <SeparatorInnerCard />\n </SeparatorCard>\n );\n}\n\nfunction RadialSeparators(props: { count: number }) {\n const turns = 1 / props.count;\n const separatorNumber = 0.5; // to center the separator\n const separatorTurns = Array.from({ length: props.count }, (_, index) => index * turns + separatorNumber);\n return separatorTurns.map((turn) => <Separator key={turn} turns={turn} />);\n}\n\nexport default RadialSeparators;\n","const IS_BROWSER = typeof window === 'object';\n\nclass ApplicationStore {\n width = IS_BROWSER ? window.innerWidth : 0;\n\n scroll = {\n vertical: IS_BROWSER ? window.scrollY : 0,\n horizontal: IS_BROWSER ? window.scrollX : 0,\n direction: 'none',\n };\n\n get isMobile() {\n return this.isPhone;\n }\n\n get isPhone() {\n return IS_BROWSER ? window.innerWidth < 768 : this.width < 768;\n }\n}\n\nconst applicationContainer = new ApplicationStore();\nexport { IS_BROWSER, ApplicationStore, applicationContainer, applicationContainer as application };\nexport default applicationContainer;\n"]}
|