@nuskin/react-loyalty-elements 1.1.0-dev-sea.2 → 1.1.0-dev-sea.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
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
+ function e(e,n,o){if(n in e){Object.defineProperty(e,n,{value:o,enumerable:true,configurable:true,writable:true})}else{e[n]=o}return e}function n(n){for(var o=1;o<arguments.length;o++){var t=arguments[o]!=null?arguments[o]:{};var r=Object.keys(t);if(typeof Object.getOwnPropertySymbols==="function"){r=r.concat(Object.getOwnPropertySymbols(t).filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))}r.forEach(function(o){e(n,o,t[o])})}return n}function o(e,n){var o=Object.keys(e);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(e);if(n){t=t.filter(function(n){return Object.getOwnPropertyDescriptor(e,n).enumerable})}o.push.apply(o,t)}return o}function t(e,n){n=n!=null?n:{};if(Object.getOwnPropertyDescriptors){Object.defineProperties(e,Object.getOwnPropertyDescriptors(n))}else{o(Object(n)).forEach(function(o){Object.defineProperty(e,o,Object.getOwnPropertyDescriptor(n,o))})}return e}function r(e,n){if(!n){n=e.slice(0)}return Object.freeze(Object.defineProperties(e,{raw:{value:Object.freeze(n)}}))}function i(){var e=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 align-items: stretch;\n width: 100%;\n }\n"]);i=function n(){return e};return e}function a(){var e=r(["\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"]);a=function n(){return e};return e}function l(){var e=r(["\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"]);l=function n(){return e};return e}function s(){var e=r(["\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n color: #252525;\n"]);s=function n(){return e};return e}import{b as d,c as c,f as u,g as h,i as f,k as v,l as m}from"../chunk-NVD2PQ2C.mjs";import{a as p}from"../chunk-UHWCPMTT.mjs";import{a as g,b as b}from"../chunk-3RJWIGAN.mjs";import{d as C}from"../chunk-PN67M2PP.mjs";import"../chunk-CBUBKPM6.mjs";import"../chunk-73SFLUWV.mjs";import{CircularProgressbarWithChildren as y,buildStyles as M}from"react-circular-progressbar";var x=C.div(i()),w=C.div(a()),j=C.div(l()),L=C.a(s());import{jsx as P,jsxs as k}from"react/jsx-runtime";var N=function(e){var n=e.value,o=e.cadenceMonths,t=e.notQualifyThisMonth,r=e.translationConfig,i=e.giftConfig,a=e.showLogo,l=a===void 0?!0:a;var s=o>0&&n===o&&!t,d="";s?d=r.giftEarned:t?d=r.notQualify:d=g(r.callToAction,{threshold_value:i.thresholdValue,currency_symbol:i.thresholdKey==="subtotal"?b():""});var u=P("u",{children:r.learnMore});return k(c,{children:[l&&P("img",{className:"reward-logo",src:r.loyaltyLogoBlack,alt:"Rewards Logo"}),P("div",{className:"info-item",children:d}),P(L,{id:"learnMoreGift",href:r.learnMoreLink,target:"_blank",rel:"noopener noreferrer",children:u})]})};N.displayName="GiftProgressBarMonthDescription";var O=N;import{FaExclamationTriangle as S}from"react-icons/fa";import{NsTypography as T}from"@nuskin/foundation-ui-components";import{jsx as I,jsxs as G}from"react/jsx-runtime";var _=function(e){var n=e.isComplete,o=e.notQualifyThisMonth,t=e.value,r=e.cadenceMonths,i=e.monthsLabel,a=e.giftIssuedLabel;return o?I(f,{children:I(S,{className:"outline-exclamation-icon",color:"#91ACC8"})}):G(u,{children:[I(T,{component:"div",className:"center-value-progress-bar-price",variant:"title-l",weight:"bold",children:"".concat(t,"/").concat(r)}),I(T,{variant:"label-s",weight:"bold",component:"div",className:"center-value-progress-bar-voucher",children:i}),n&&I(T,{variant:"label-s",weight:"bold",component:"div",className:"center-value-progress-bar-voucher",children:a})]})};_.displayName="GiftWheelCenterContent";var E=_;import{jsx as Q,jsxs as D}from"react/jsx-runtime";var B=function(e){var n;var o=e.value,t=o===void 0?0:o,r=e.cadenceMonths,i=r===void 0?0:r,a=e.notQualifyThisMonth,l=a===void 0?!1:a,s=e.translationConfig,d=e.giftConfig,c=e.currentCadenceIndex,u=c===void 0?0:c,h=e.issuedCadenceCount,f=h===void 0?0:h,m=e.showRoadmap,g=m===void 0?!0:m,b=e.showLogo,C=b===void 0?!0:b,x=i>0&&t===i&&!l,L=i>0?Math.floor(((n=d===null||d===void 0?void 0:d.maxCSM)!==null&&n!==void 0?n:0)/i):0;var P,k,N,S,T;return D(w,{children:[Q("div",{className:"reward-progress",children:D(y,{value:i>0?t/i*100:0,strokeWidth:12,background:!0,styles:M({rotation:.5,strokeLinecap:"butt",backgroundColor:"#fff",pathColor:"#ED7219",trailColor:"#E0E0E0"}),children:[i>0&&Q(v,{count:i}),Q(E,{isComplete:x,notQualifyThisMonth:l,value:t,cadenceMonths:i,monthsLabel:(P=s===null||s===void 0?void 0:s.monthsLabel)!==null&&P!==void 0?P:"Months",giftIssuedLabel:(k=s===null||s===void 0?void 0:s.giftIssuedLabel)!==null&&k!==void 0?k:"Gift issued"})]})}),D(j,{children:[g&&L>1&&Q(p,{giftCycle:i,maxCSM:(N=d===null||d===void 0?void 0:d.maxCSM)!==null&&N!==void 0?N:0,currentCadenceIndex:u,issuedCadenceCount:f,translationConfig:{monthLabel:(S=s===null||s===void 0?void 0:s.roadmapMonthLabel)!==null&&S!==void 0?S:"Month %cadence_month%",giftLabel:(T=s===null||s===void 0?void 0:s.roadmapGiftLabel)!==null&&T!==void 0?T:"Gift %gift_index%"}}),Q(O,{value:t,cadenceMonths:i,notQualifyThisMonth:l,translationConfig:s,giftConfig:d,showLogo:C})]})]})};B.displayName="GiftProgressBar";var R=B;import{CircularProgressbarWithChildren as W,buildStyles as V}from"react-circular-progressbar";import{NsTypography as q}from"@nuskin/foundation-ui-components";import{jsx as z,jsxs as A}from"react/jsx-runtime";var F=function(e){var n;var o=e.value,t=o===void 0?0:o,r=e.cadenceMonths,i=r===void 0?0:r,a=e.notQualifyThisMonth,l=a===void 0?!1:a,s=e.amountShow,u=e.translationConfig,f=e.giftConfig,m=e.currentCadenceIndex,b=m===void 0?0:m,C=e.issuedCadenceCount,y=C===void 0?0:C,M=e.showRoadmap,x=M===void 0?!0:M,w=e.showLogo,j=w===void 0?!0:w,P=e.showTotalSection,k=P===void 0?!0:P,N=i>0&&t===i&&!l,O=i>0?Math.floor(((n=f===null||f===void 0?void 0:f.maxCSM)!==null&&n!==void 0?n:0)/i):0,S=g(u.monthsComplete,{completed_months:t,total_months:i});N?S=u.giftEarned:l&&(S=u.notQualify);var T=g(u.approximateMonthly,{currency_symbol:"",estimated_running_subscription_spend:""}),I=z("u",{children:u.learnMore});var G,_,Q,D,B;return A(d,{children:[z("div",{className:"reward-progress",children:A(W,{value:i>0?t/i*100:0,strokeWidth:12,background:!0,styles:V({rotation:.5,strokeLinecap:"butt",backgroundColor:"#fff",pathColor:"#ED7219",trailColor:"#E0E0E0"}),children:[i>0&&z(v,{count:i}),z(E,{isComplete:N,notQualifyThisMonth:l,value:t,cadenceMonths:i,monthsLabel:(G=u===null||u===void 0?void 0:u.monthsLabel)!==null&&G!==void 0?G:"Months",giftIssuedLabel:(_=u===null||u===void 0?void 0:u.giftIssuedLabel)!==null&&_!==void 0?_:"Gift issued"})]})}),x&&O>1&&z(p,{giftCycle:i,maxCSM:(Q=f===null||f===void 0?void 0:f.maxCSM)!==null&&Q!==void 0?Q:0,currentCadenceIndex:b,issuedCadenceCount:y,translationConfig:{monthLabel:(D=u===null||u===void 0?void 0:u.roadmapMonthLabel)!==null&&D!==void 0?D:"Month %cadence_month%",giftLabel:(B=u===null||u===void 0?void 0:u.roadmapGiftLabel)!==null&&B!==void 0?B:"Gift %gift_index%"}}),A(c,{children:[j&&z("img",{className:"reward-logo",src:u.loyaltyLogoBlack,alt:"Rewards Logo"}),z("div",{className:"info-item",children:S})]}),z(h,{children:k&&!N&&A(q,{variant:"body-s",weight:"normal",className:"reward-subtitle",colorOverride:"#252525",component:"div",children:[T," ",z(q,{component:"span",className:"button-price",variant:"body-s",weight:"bold",children:s!==null&&s!==void 0?s:0})]})}),z(c,{children:z(L,{id:"learnMoreGiftMobile",href:u.learnMoreLink,target:"_blank",rel:"noopener noreferrer",children:I})})]})};F.displayName="GiftProgressBarMobile";var U=F;var K={completedMonthsInCadence:0,totalCSMCount:0,totalCadences:0,currentCadenceIndex:0,issuedCadenceCount:0,isGiftIssued:!1,isProgramComplete:!1},H=function(e,o,r,i,a){var l=Math.min(Math.max(e,0),i);if(l===0)return t(n({},K),{totalCadences:a});var s=l%r,d=s===0&&o,c=Math.min(Math.floor(l/r),a),u=d?c-1:Math.floor(l/r);return{completedMonthsInCadence:d?r:s,totalCSMCount:l,totalCadences:a,currentCadenceIndex:Math.min(Math.max(u,0),a-1),issuedCadenceCount:c,isGiftIssued:d,isProgramComplete:l>=i}},J=function(e){var o=e.giftCycle,r=e.maxCSM,i=e.giftProperties;var a=o>0?Math.floor(r/o):0;if(a<=0)return t(n({},K),{totalCadences:Math.max(a,0)});if(!i)return t(n({},K),{totalCadences:a});var l=i.continuousSubscriptionMonths,s=i.qualifiedThisMonth,d=l+(s?1:0);return H(d,s,o,r,a)};var X="giftContinuousSubscriptionMonth",Y="giftQualifiedThisMonth",Z=function(e,n){var o,t;return e===null||e===void 0?void 0:(t=e.properties)===null||t===void 0?void 0:(o=t.find(function(e){return(e===null||e===void 0?void 0:e.name)===n}))===null||o===void 0?void 0:o.value},$=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 o=Z(e,X),t=Z(e,Y);if(o===void 0&&t===void 0)return null;var r=Number.parseInt(o!==null&&o!==void 0?o:"",10);return{continuousSubscriptionMonths:Number.isNaN(r)?0:Math.max(r,0),qualifiedThisMonth:Number.parseInt(t!==null&&t!==void 0?t:"",10)===1}};import{jsx as ee}from"react/jsx-runtime";var en=function(e){var o;var t,r,i,a;var l=e.subscriptionData,s=e.loyaltyData,d=e.translationConfig,c=e.giftConfig,u=e.showRoadmap,h=u===void 0?!0:u,f=e.showLogo,v=f===void 0?!0:f,p=e.showTotalSection,g=p===void 0?!0:p,b=(t=c===null||c===void 0?void 0:c.giftCycle)!==null&&t!==void 0?t:0,C=(r=c===null||c===void 0?void 0:c.thresholdValue)!==null&&r!==void 0?r:0,y=parseFloat(String((i=l===null||l===void 0?void 0:(o=l.approximateMonthlyTotalResponse)===null||o===void 0?void 0:o.currentMonthTotal)!==null&&i!==void 0?i:"0")),M=$(s),w=M?!M.qualifiedThisMonth:y<C,j=J({giftCycle:b,maxCSM:(a=c===null||c===void 0?void 0:c.maxCSM)!==null&&a!==void 0?a:0,giftProperties:M}),L=j.completedMonthsInCadence,P=j.currentCadenceIndex,k=j.issuedCadenceCount,N={value:L,cadenceMonths:b,notQualifyThisMonth:w,amountShow:y,translationConfig:d,giftConfig:c,currentCadenceIndex:P,issuedCadenceCount:k,showRoadmap:h,showLogo:v,showTotalSection:g};return ee(x,{className:"loyalty-reward-card",children:m.isMobile?ee(U,n({},N)):ee(R,n({},N))})};en.displayName="GiftReward";var eo=en;export{R as GiftProgressBar,U as GiftProgressBarMobile,eo 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","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,OAA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../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
+ {"version":3,"sources":["/gitlab-runner-data/builds/nextgen-development/loyalty/npm/react-loyalty-elements/dist/GiftProgressBar/index.mjs","../../src/GiftProgressBar/GiftProgressBar.tsx","../../src/GiftProgressBar/GiftProgressBar.styled.tsx","../../src/GiftProgressBar/GiftProgressBarMonthDescription.tsx","../../src/GiftProgressBar/GiftWheelCenterContent.tsx","../../src/GiftProgressBar/GiftProgressBarMobile.tsx","../../src/GiftProgressBar/logic/calculateGiftMonthCompletion.ts","../../src/GiftProgressBar/logic/readGiftProperties.ts","../../src/GiftProgressBar/GiftReward.tsx"],"names":["b","E","c","g","f","W","D","i","Q","k","M","l","V","a","x","C","F","d","h","CircularProgressbarWithChildren","buildStyles","GiftRewardContainer","newStyled","div","GiftProgressBarWrapper","GiftDetailsColumn","GiftLearnMoreLink","jsx","jsxs","GiftProgressBarMonthDescription","value","cadenceMonths","notQualifyThisMonth","translationConfig","giftConfig","showLogo","isComplete","infoText","giftEarned","notQualify","replacePlaceholders","callToAction","threshold_value","thresholdValue","currency_symbol","thresholdKey","currencySymbol","learnMoreContent","children","learnMore","StyledCard","className","src","loyaltyLogoBlack","alt","id","href","learnMoreLink","target","rel","displayName","GiftProgressBarMonthDescription_default","FaExclamationTriangle","NsTypography","GiftWheelCenterContent","monthsLabel","giftIssuedLabel","IconContainer","color","ProgressBarCenter","component","variant","weight","GiftWheelCenterContent_default","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","buildResult","csmCount","qualifiedThisMonth","min","max","remainder","rawCadenceIndex","calculateGiftMonthCompletion","giftProperties","continuousSubscriptionMonths","GIFT_CSM_PROPERTY","GIFT_QUALIFIED_PROPERTY","findValue","loyaltyData","name","properties","find","property","readGiftProperties","length","rawMonths","rawQualified","months","Number","parseInt","isNaN","GiftReward","subscriptionData","minSpend","parseFloat","String","approximateMonthlyTotalResponse","currentMonthTotal","commonProps","applicationContainer","is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AAA,EAAAA,UAAAA,mBAAAA,EAAAA,EAAkBI,+BAAA,UAAlBJ,kBAAAA,EAAmDK,iBAAA,UAAnDL,WAAAA,EAAwE,MACvGnB,EAAiBU,EAAmBL,GACpCnG,EAAsB8F,EAAiB,CAACA,EAAeN,kBAAA,CAAqBnB,EAAa6C,EAEjBrB,EAAAA,EAA6B,CACvG/B,UAAW/D,EACXmD,OAAQhD,CAAAA,EAAAA,UAAAA,kBAAAA,EAAYgD,MAAA,UAAZhD,WAAAA,EAAsB,EAC9B4F,eAAAA,CACJ,GAJQZ,EAAsEW,EAAtEX,yBAA0BtC,EAA4CiD,EAA5CjD,oBAAqBC,EAAuBgD,EAAvBhD,mBAMjD0E,EAAc,CAChBzH,MAAOoF,EACPnF,cAAAA,EACAC,oBAAAA,EACAqE,WAAAA,EACApE,kBAAAA,EACAC,WAAAA,EACA0C,oBAAAA,EACAC,mBAAAA,EACAC,YAAAA,EACA3C,SAAAA,EACAmE,iBAAAA,CACJ,EAEA,OACI3E,GAACN,EAAA,CAAoB8B,UAAU,sBAC1BH,SAAAwG,EAAYC,QAAA,CAAW9H,GAACqF,EAAA,KAA0BuC,IAAkB5H,GAACwE,EAAA,KAAoBoD,GAAa,EAGnH,CAEAP,CAAAA,GAAWpF,WAAA,CAAc,aAEzB,IAAO8F,GAAQV,UAAAA,KAAAA,eAAAA,CAAAA,KAAAA,qBAAAA,CAAAA,MAAAA,UAAAA","sourcesContent":["import{b as E,c as g,f as W,g as D,i as Q,k as M,l as V}from\"../chunk-NVD2PQ2C.mjs\";import{a as x}from\"../chunk-UHWCPMTT.mjs\";import{a as C,b as F}from\"../chunk-3RJWIGAN.mjs\";import{d as h}from\"../chunk-PN67M2PP.mjs\";import\"../chunk-CBUBKPM6.mjs\";import\"../chunk-73SFLUWV.mjs\";import{CircularProgressbarWithChildren as ae,buildStyles as ne}from\"react-circular-progressbar\";var q=h.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`,A=h.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`,O=h.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`,P=h.a`\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n color: #252525;\n`;import{jsx as w,jsxs as te}from\"react/jsx-runtime\";var Y=({value:n,cadenceMonths:r,notQualifyThisMonth:e,translationConfig:o,giftConfig:a,showLogo:t=!0})=>{let s=r>0&&n===r&&!e,i=\"\";s?i=o.giftEarned:e?i=o.notQualify:i=C(o.callToAction,{threshold_value:a.thresholdValue,currency_symbol:a.thresholdKey===\"subtotal\"?F():\"\"});let l=w(\"u\",{children:o.learnMore});return te(g,{children:[t&&w(\"img\",{className:\"reward-logo\",src:o.loyaltyLogoBlack,alt:\"Rewards Logo\"}),w(\"div\",{className:\"info-item\",children:i}),w(P,{id:\"learnMoreGift\",href:o.learnMoreLink,target:\"_blank\",rel:\"noopener noreferrer\",children:l})]})};Y.displayName=\"GiftProgressBarMonthDescription\";var K=Y;import{FaExclamationTriangle as oe}from\"react-icons/fa\";import{NsTypography as R}from\"@nuskin/foundation-ui-components\";import{jsx as y,jsxs as re}from\"react/jsx-runtime\";var U=({isComplete:n,notQualifyThisMonth:r,value:e,cadenceMonths:o,monthsLabel:a,giftIssuedLabel:t})=>r?y(Q,{children:y(oe,{className:\"outline-exclamation-icon\",color:\"#91ACC8\"})}):re(W,{children:[y(R,{component:\"div\",className:\"center-value-progress-bar-price\",variant:\"title-l\",weight:\"bold\",children:`${e}/${o}`}),y(R,{variant:\"label-s\",weight:\"bold\",component:\"div\",className:\"center-value-progress-bar-voucher\",children:a}),n&&y(R,{variant:\"label-s\",weight:\"bold\",component:\"div\",className:\"center-value-progress-bar-voucher\",children:t})]});U.displayName=\"GiftWheelCenterContent\";var L=U;import{jsx as b,jsxs as S}from\"react/jsx-runtime\";var $=n=>{let{value:r=0,cadenceMonths:e=0,notQualifyThisMonth:o=!1,translationConfig:a,giftConfig:t,currentCadenceIndex:s=0,issuedCadenceCount:i=0,showRoadmap:l=!0,showLogo:p=!0}=n,m=e>0&&r===e&&!o,d=e>0?Math.floor((t?.maxCSM??0)/e):0;return S(A,{children:[b(\"div\",{className:\"reward-progress\",children:S(ae,{value:e>0?r/e*100:0,strokeWidth:12,background:!0,styles:ne({rotation:.5,strokeLinecap:\"butt\",backgroundColor:\"#fff\",pathColor:\"#ED7219\",trailColor:\"#E0E0E0\"}),children:[e>0&&b(M,{count:e}),b(L,{isComplete:m,notQualifyThisMonth:o,value:r,cadenceMonths:e,monthsLabel:a?.monthsLabel??\"Months\",giftIssuedLabel:a?.giftIssuedLabel??\"Gift issued\"})]})}),S(O,{children:[l&&d>1&&b(x,{giftCycle:e,maxCSM:t?.maxCSM??0,currentCadenceIndex:s,issuedCadenceCount:i,translationConfig:{monthLabel:a?.roadmapMonthLabel??\"Month %cadence_month%\",giftLabel:a?.roadmapGiftLabel??\"Gift %gift_index%\"}}),b(K,{value:r,cadenceMonths:e,notQualifyThisMonth:o,translationConfig:a,giftConfig:t,showLogo:p})]})]})};$.displayName=\"GiftProgressBar\";var N=$;import{CircularProgressbarWithChildren as ie,buildStyles as se}from\"react-circular-progressbar\";import{NsTypography as z}from\"@nuskin/foundation-ui-components\";import{jsx as f,jsxs as T}from\"react/jsx-runtime\";var H=n=>{let{value:r=0,cadenceMonths:e=0,notQualifyThisMonth:o=!1,amountShow:a,translationConfig:t,giftConfig:s,currentCadenceIndex:i=0,issuedCadenceCount:l=0,showRoadmap:p=!0,showLogo:m=!0,showTotalSection:d=!0}=n,c=e>0&&r===e&&!o,v=e>0?Math.floor((s?.maxCSM??0)/e):0,u=C(t.monthsComplete,{completed_months:r,total_months:e});c?u=t.giftEarned:o&&(u=t.notQualify);let G=C(t.approximateMonthly,{currency_symbol:\"\",estimated_running_subscription_spend:\"\"}),ee=f(\"u\",{children:t.learnMore});return T(E,{children:[f(\"div\",{className:\"reward-progress\",children:T(ie,{value:e>0?r/e*100:0,strokeWidth:12,background:!0,styles:se({rotation:.5,strokeLinecap:\"butt\",backgroundColor:\"#fff\",pathColor:\"#ED7219\",trailColor:\"#E0E0E0\"}),children:[e>0&&f(M,{count:e}),f(L,{isComplete:c,notQualifyThisMonth:o,value:r,cadenceMonths:e,monthsLabel:t?.monthsLabel??\"Months\",giftIssuedLabel:t?.giftIssuedLabel??\"Gift issued\"})]})}),p&&v>1&&f(x,{giftCycle:e,maxCSM:s?.maxCSM??0,currentCadenceIndex:i,issuedCadenceCount:l,translationConfig:{monthLabel:t?.roadmapMonthLabel??\"Month %cadence_month%\",giftLabel:t?.roadmapGiftLabel??\"Gift %gift_index%\"}}),T(g,{children:[m&&f(\"img\",{className:\"reward-logo\",src:t.loyaltyLogoBlack,alt:\"Rewards Logo\"}),f(\"div\",{className:\"info-item\",children:u})]}),f(D,{children:d&&!c&&T(z,{variant:\"body-s\",weight:\"normal\",className:\"reward-subtitle\",colorOverride:\"#252525\",component:\"div\",children:[G,\" \",f(z,{component:\"span\",className:\"button-price\",variant:\"body-s\",weight:\"bold\",children:a??0})]})}),f(g,{children:f(P,{id:\"learnMoreGiftMobile\",href:t.learnMoreLink,target:\"_blank\",rel:\"noopener noreferrer\",children:ee})})]})};H.displayName=\"GiftProgressBarMobile\";var B=H;var I={completedMonthsInCadence:0,totalCSMCount:0,totalCadences:0,currentCadenceIndex:0,issuedCadenceCount:0,isGiftIssued:!1,isProgramComplete:!1},le=(n,r,e,o,a)=>{let t=Math.min(Math.max(n,0),o);if(t===0)return{...I,totalCadences:a};let s=t%e,i=s===0&&r,l=Math.min(Math.floor(t/e),a),p=i?l-1:Math.floor(t/e);return{completedMonthsInCadence:i?e:s,totalCSMCount:t,totalCadences:a,currentCadenceIndex:Math.min(Math.max(p,0),a-1),issuedCadenceCount:l,isGiftIssued:i,isProgramComplete:t>=o}},J=({giftCycle:n,maxCSM:r,giftProperties:e})=>{let o=n>0?Math.floor(r/n):0;if(o<=0)return{...I,totalCadences:Math.max(o,0)};if(!e)return{...I,totalCadences:o};let{continuousSubscriptionMonths:a,qualifiedThisMonth:t}=e,s=a+(t?1:0);return le(s,t,n,r,o)};var fe=\"giftContinuousSubscriptionMonth\",pe=\"giftQualifiedThisMonth\",X=(n,r)=>n?.properties?.find(e=>e?.name===r)?.value,Z=n=>{if(!n?.properties?.length)return null;let r=X(n,fe),e=X(n,pe);if(r===void 0&&e===void 0)return null;let o=Number.parseInt(r??\"\",10);return{continuousSubscriptionMonths:Number.isNaN(o)?0:Math.max(o,0),qualifiedThisMonth:Number.parseInt(e??\"\",10)===1}};import{jsx as k}from\"react/jsx-runtime\";var j=n=>{let{subscriptionData:r,loyaltyData:e,translationConfig:o,giftConfig:a,showRoadmap:t=!0,showLogo:s=!0,showTotalSection:i=!0}=n,l=a?.giftCycle??0,p=a?.thresholdValue??0,m=parseFloat(String(r?.approximateMonthlyTotalResponse?.currentMonthTotal??\"0\")),d=Z(e),c=d?!d.qualifiedThisMonth:m<p,{completedMonthsInCadence:v,currentCadenceIndex:_,issuedCadenceCount:u}=J({giftCycle:l,maxCSM:a?.maxCSM??0,giftProperties:d}),G={value:v,cadenceMonths:l,notQualifyThisMonth:c,amountShow:m,translationConfig:o,giftConfig:a,currentCadenceIndex:_,issuedCadenceCount:u,showRoadmap:t,showLogo:s,showTotalSection:i};return k(q,{className:\"loyalty-reward-card\",children:V.isMobile?k(B,{...G}):k(N,{...G})})};j.displayName=\"GiftReward\";var de=j;export{N 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 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 showLogo={showLogo}\n />\n </GiftDetailsColumn>\n </GiftProgressBarWrapper>\n );\n};\n\nGiftProgressBar.displayName = 'GiftProgressBar';\n\nexport default GiftProgressBar;\nexport { GiftProgressBar };\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\nexport const GiftLearnMoreLink = styled.a`\n font-size: 12px;\n font-weight: 600;\n cursor: pointer;\n color: #252525;\n`;\n","import React from 'react';\nimport { StyledCard } from '../CircularProgressBar/CircularProgressBar.styled';\nimport { GiftProgressBarProps } from './types';\nimport { currencySymbol, replacePlaceholders } from '../Utils/helper';\nimport { GiftLearnMoreLink } from './GiftProgressBar.styled';\n\ntype GiftProgressBarMonthDescriptionProps = Pick<\n GiftProgressBarProps,\n 'value' | 'cadenceMonths' | 'notQualifyThisMonth' | 'translationConfig' | 'giftConfig' | 'showLogo'\n>;\n\nconst GiftProgressBarMonthDescription = ({\n value,\n cadenceMonths,\n notQualifyThisMonth,\n translationConfig,\n giftConfig,\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 const learnMoreContent = <u>{translationConfig.learnMore}</u>;\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 <GiftLearnMoreLink\n id=\"learnMoreGift\"\n href={translationConfig.learnMoreLink}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {learnMoreContent}\n </GiftLearnMoreLink>\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 React from 'react';\nimport { CircularProgressbarWithChildren, buildStyles } from 'react-circular-progressbar';\nimport { NsTypography } from '@nuskin/foundation-ui-components';\nimport RadialSeparators from '../CircularProgressBar/RadialSeparator';\nimport {\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';\nimport { GiftLearnMoreLink } from './GiftProgressBar.styled';\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 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 const learnMoreContent = <u>{translationConfig.learnMore}</u>;\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 <GiftLearnMoreLink\n id=\"learnMoreGiftMobile\"\n href={translationConfig.learnMoreLink}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n >\n {learnMoreContent}\n </GiftLearnMoreLink>\n </StyledCard>\n </LoyaltyProgressSubContainer>\n );\n};\n\nGiftProgressBarMobile.displayName = 'GiftProgressBarMobile';\n\nexport default GiftProgressBarMobile;\nexport { GiftProgressBarMobile };\n","import { CalculateGiftCompletionParams, GiftCompletionResult } from '../types';\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\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) counters from the loyalty response\n * onto the gift roadmap. `continuousSubscriptionMonths` counts the months completed before the\n * current one and `qualifiedThisMonth` adds the current month when it meets the threshold.\n */\nexport const calculateGiftMonthCompletion = ({\n giftCycle,\n maxCSM,\n giftProperties,\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 return { ...EMPTY_RESULT, totalCadences };\n }\n\n const { continuousSubscriptionMonths, qualifiedThisMonth } = giftProperties;\n const csmCount = continuousSubscriptionMonths + (qualifiedThisMonth ? 1 : 0);\n return buildResult(csmCount, 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 giftCycle: cadenceMonths,\n maxCSM: giftConfig?.maxCSM ?? 0,\n giftProperties,\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,7 @@
1
1
  import { CalculateGiftCompletionParams, GiftCompletionResult } from '../types';
2
2
  /**
3
- * Maps the customer's consecutive subscription month (CSM) streak onto the gift roadmap.
4
- *
5
- * Prefers `giftProperties` from the loyalty response, where `continuousSubscriptionMonths` counts
6
- * the months completed *before* the current one and `qualifiedThisMonth` adds the current month.
7
- * Falls back to walking `csmMonthlySubsOrderTotal` when those properties are unavailable.
3
+ * Maps the customer's consecutive subscription month (CSM) counters from the loyalty response
4
+ * onto the gift roadmap. `continuousSubscriptionMonths` counts the months completed before the
5
+ * current one and `qualifiedThisMonth` adds the current month when it meets the threshold.
8
6
  */
9
- export declare const calculateGiftMonthCompletion: ({ data, giftCycle, maxCSM, minSpend, giftProperties, today, }: CalculateGiftCompletionParams) => GiftCompletionResult;
7
+ export declare const calculateGiftMonthCompletion: ({ giftCycle, maxCSM, giftProperties, }: CalculateGiftCompletionParams) => GiftCompletionResult;
@@ -3,6 +3,7 @@ export type GiftTranslationConfig = {
3
3
  monthsComplete: string;
4
4
  giftEarned: string;
5
5
  learnMore: string;
6
+ learnMoreLink: string;
6
7
  callToAction: string;
7
8
  notQualify: string;
8
9
  approximateMonthly: string;
@@ -37,7 +38,6 @@ export type GiftProgressBarProps = {
37
38
  showLogo?: boolean;
38
39
  /** Set false when the approximate-total pill is hoisted into the shared header. */
39
40
  showTotalSection?: boolean;
40
- handleOpenLearnMore?: () => void;
41
41
  };
42
42
  export type GiftLoyaltyProperty = {
43
43
  name: string;
@@ -64,13 +64,10 @@ export type GiftRewardProps = {
64
64
  showTotalSection?: boolean;
65
65
  };
66
66
  export type CalculateGiftCompletionParams = {
67
- data: MonthlyData | null | undefined;
68
67
  giftCycle: number;
69
68
  maxCSM: number;
70
- minSpend: number;
71
- /** Preferred source; when omitted the CSM records are walked instead */
69
+ /** Gift counters from the loyalty response */
72
70
  giftProperties?: GiftLoyaltyProperties | null;
73
- today: Date;
74
71
  };
75
72
  export type GiftCompletionResult = {
76
73
  /** Qualifying months inside the active cadence (0..giftCycle) */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nuskin/react-loyalty-elements",
3
- "version": "1.1.0-dev-sea.2",
3
+ "version": "1.1.0-dev-sea.3",
4
4
  "description": "A React based component library for reusable Nextgen Loyalty component",
5
5
  "types": "dist/index.d.ts",
6
6
  "main": "dist/index.js",