@cleartrip/ct-platform-supercoins-chip 2.2.0-beta.16 → 2.2.0-beta.18
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,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),r=require("@cleartrip/ct-design-typography"),o=require("@cleartrip/ct-platform-shimmer"),a=require("@cleartrip/ct-platform-utils");function t(e){return e&&e.__esModule?e:{default:e}}var s=t(i);function l(e,n){void 0===n&&(n={});var i=n.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var c={supercoinsBalance:"index-module_supercoinsBalance__w9srh",supercoinsExpiryPill:"index-module_supercoinsExpiryPill__v4w06",supercoinChipWrapper:"index-module_supercoinChipWrapper__QPdUS",supercoinBurnTextAlign:"index-module_supercoinBurnTextAlign__g-go5",supercoinBurnExpiryColor:"index-module_supercoinBurnExpiryColor__FTFjA",supercoinExpiryText:"index-module_supercoinExpiryText__rkVbG",supercoinExpiryAnimating:"index-module_supercoinExpiryAnimating__Gdq0n",superCoinsFloatingIslandContainer:"index-module_superCoinsFloatingIslandContainer__5FNNa",supercoinsBalanceBackgroundColorShift:"index-module_supercoinsBalanceBackgroundColorShift__r6YWa",supercoins_balance_background_color_shift:"index-module_supercoins_balance_background_color_shift__1NHEU",supercoinsBalanceTextColorShift:"index-module_supercoinsBalanceTextColorShift__y7vva",supercoins_balance_text_color_shift:"index-module_supercoins_balance_text_color_shift__V8yxU",supercoinsBalanceBackgroundColorShift_exit:"index-module_supercoinsBalanceBackgroundColorShift_exit__sinUJ",supercoins_balance_background_color_shift_exit:"index-module_supercoins_balance_background_color_shift_exit__qAHuv",supercoinsBalanceTextColorShift_exit:"index-module_supercoinsBalanceTextColorShift_exit__JKt90",supercoins_balance_text_color_shift_exit:"index-module_supercoins_balance_text_color_shift_exit__rluZH",supercoin_chip_loading_shimmer:"index-module_supercoin_chip_loading_shimmer__0jquY",supercoins_balance_background_shimmer:"index-module_supercoins_balance_background_shimmer__2lOFp"};l('.index-module_supercoinsBalance__w9srh{background-color:#fff;border:1px solid #e6e6e6;border-radius:16px;display:inline-block;overflow:hidden;padding:6px 8px}.index-module_supercoinsExpiryPill__v4w06{background-color:#fbefef;border:1.5px solid #c83232;border-radius:16px;display:inline-block;overflow:hidden;padding:6px 0 6px 8px}.index-module_supercoinChipWrapper__QPdUS{align-items:center;display:flex;justify-content:center;padding:0 4px}.index-module_supercoinBurnTextAlign__g-go5{line-height:18px;margin-right:4px}.index-module_supercoinBurnExpiryColor__FTFjA{color:#c83232!important}.index-module_supercoinExpiryText__rkVbG{color:#c83232!important;display:inline-block;line-height:18px;opacity:0;overflow:hidden;transition:width .5s ease-in-out,opacity .5s ease-in-out;white-space:nowrap;width:0}.index-module_supercoinExpiryAnimating__Gdq0n{opacity:1;width:97px}.index-module_superCoinsFloatingIslandContainer__5FNNa{margin-left:100%;position:relative;width:1px}.index-module_supercoinsBalanceBackgroundColorShift__r6YWa{animation:index-module_supercoins_balance_background_color_shift__1NHEU .6s forwards;overflow:hidden;position:relative}.index-module_supercoinsBalanceTextColorShift__y7vva{animation:index-module_supercoins_balance_text_color_shift__V8yxU .6s forwards}.index-module_supercoinsBalanceBackgroundColorShift_exit__sinUJ{animation:index-module_supercoins_balance_background_color_shift_exit__qAHuv .6s forwards;overflow:hidden;position:relative}.index-module_supercoinsBalanceTextColorShift_exit__JKt90{animation:index-module_supercoins_balance_text_color_shift_exit__rluZH .6s forwards}.index-module_supercoinsBalanceBackgroundColorShift__r6YWa:before{animation:index-module_supercoin_chip_loading_shimmer__0jquY .4s ease-in .5s;background:hsla(0,0%,100%,.8);content:"";height:64px;left:-30%;position:absolute;top:-10px;transform:rotate(25deg);width:8px}@keyframes index-module_supercoin_chip_loading_shimmer__0jquY{0%{left:-30%}to{left:120%}}@keyframes index-module_supercoins_balance_background_color_shift__1NHEU{0%{background-color:rgba(0,62,162,.1)}to{background-color:#003ea2}}@keyframes index-module_supercoins_balance_background_color_shift_exit__qAHuv{0%{background-color:#003ea2}to{background-color:rgba(0,62,162,0)}}@keyframes index-module_supercoins_balance_text_color_shift__V8yxU{0%{color:#000}to{color:#fff}}@keyframes index-module_supercoins_balance_text_color_shift_exit__rluZH{0%{color:#fff}to{color:#000}}@keyframes index-module_supercoins_balance_background_shimmer__2lOFp{0%{background-color:rgba(0,62,162,.1)}to{background-color:#003ea2}}');var u="https://rukmini-ct.flixcart.com/f_auto,q_auto,dpr_2/offermgmt-prod/offermgmt/images/banner/supercoins-chip-icon.png",_="https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/offermgmt/images/banner/wallet-pill-icon.png",p="island_rendered_frquency",d="islandAnimationPlayed",m="island_expiration_frquency",x=5,f=2,g=2e3,h=500,v=1500,y={requiredSupercoins:50,frequency:1,frequencyGapInDays:1,cutoffTimeInMs:5e3,isVisibleOnScroll:!1};function b(e){var n,i=e.renderFloatingIsland,r=e.supercoins;if(!i)return!1;if(r<y.requiredSupercoins)return!1;if(!("true"===a.getQueryParam("isMobileApp")))return!1;if(function(){var e=localStorage.getItem(p);return e&&"number"==typeof parseInt(e)?parseInt(e):0}()>=y.frequency){var o=(n=localStorage.getItem(m))&&"number"==typeof parseInt(n)?parseInt(n):null;return!o||!(o>Math.floor(Date.now()/1e3))&&(localStorage.removeItem(p),localStorage.removeItem(m),!0)}return!sessionStorage.getItem(d)}function S(){var e=localStorage.getItem(p);e||(e="0");var n=parseInt(e)+1;if(localStorage.setItem(p,n.toString()),n>=y.frequency){var i=Math.floor(Date.now()/1e3)+86400*y.frequencyGapInDays;localStorage.setItem(m,i.toString())}}var B={chipWrapper:"index-module_chipWrapper__EwpUk",chipTextWrapper:"index-module_chipTextWrapper__Uburn",textWrapper:"index-module_textWrapper__BysJP",pillContainer:"index-module_pillContainer__bz7P4","spring-up-wallet":"index-module_spring-up-wallet__GJrXW","spring-up1":"index-module_spring-up1__OLe4L","spring-up-wallet-sc":"index-module_spring-up-wallet-sc__KKKf0","spring-up2":"index-module_spring-up2__SIbCp"};function k(i){var o=i.supercoinBalance;return n.jsxs("div",e.__assign({className:B.chipWrapper},{children:[n.jsx("img",{src:u,alt:"supercoin_icon",width:18,height:18}),n.jsx("div",e.__assign({className:B.chipTextWrapper},{children:n.jsx(r.Typography,e.__assign({variant:"B2",className:B.textWrapper},{children:o}))}))]}))}function w(i){var o=i.walletBalance;return n.jsxs("div",e.__assign({className:B.chipWrapper},{children:[n.jsx("img",{src:_,alt:"supercoin_icon",width:18,height:18}),n.jsx("div",e.__assign({className:B.chipTextWrapper},{children:n.jsxs(r.Typography,e.__assign({variant:"B2",className:B.textWrapper},{children:["₹",o]}))}))]}))}function C(i){var r=i.supercoinBalance,o=i.walletBalance,a=i.handleClick,t=0===o&&r>0||0===r&&0===o,s=t?B["spring-up-wallet-sc"]:B["spring-up-wallet"];return n.jsx("div",e.__assign({onClick:a},{children:n.jsx("div",e.__assign({className:"".concat(B.pillContainer),style:{height:"34px"}},{children:n.jsxs("div",e.__assign({className:s},{children:[n.jsx(k,{supercoinBalance:r}),n.jsx(w,{walletBalance:o}),t?n.jsx(k,{supercoinBalance:r}):null]}))}))}))}l(".index-module_chipWrapper__EwpUk{align-items:center;display:flex;gap:4px;margin-bottom:20px;text-align:center}.index-module_chipTextWrapper__Uburn{align-items:center;display:flex;justify-content:center;padding:0 4px;text-align:center;width:100%}.index-module_textWrapper__BysJP{margin-right:4px}.index-module_pillContainer__bz7P4{background-color:#fff;border:1px solid #e6e6e6;border-radius:16px;box-sizing:border-box;display:inline-block;overflow:hidden;padding:6px 8px}@keyframes index-module_spring-up1__OLe4L{0%{transform:translateY(0)}60%{transform:translateY(-44px)}90%{transform:translateY(-40px)}to{transform:translateY(-40px)}}@keyframes index-module_spring-up2__SIbCp{0%{transform:translateY(-40px)}60%{transform:translateY(-84px)}90%{transform:translateY(-80px)}to{transform:translateY(-80px)}}.index-module_spring-up-wallet__GJrXW{animation:index-module_spring-up1__OLe4L .7s ease-in-out 2s forwards}.index-module_spring-up-wallet-sc__KKKf0{animation:index-module_spring-up1__OLe4L .7s ease-in-out 2s forwards,index-module_spring-up2__SIbCp .7s ease-in-out 5s forwards}");var T=s.default.lazy((function(){return import("@cleartrip/ct-platform-supercoins-floating-island").then((function(e){return{default:e.SupercoinsFloatingIsland}}))}));exports.SupercoinsChip=function(t){var s=t.supercoinsLoading,l=t.supercoinBurnBalance,_=t.ravenPayload,p=void 0===_?{}:_,m=t.onSupercoinsClick,B=t.supercoinsExpiryCount,k=t.renderFloatingIsland,w=void 0===k||k,j=t.walletEnabled,I=void 0!==j&&j,E=t.walletBalance,N=i.useMemo((function(){var e;return null!==(e=a.getQueryParam("utm_source"))&&void 0!==e?e:"organic"}),[]),q=i.useState(!1),W=q[0],A=q[1],F=i.useState(0),P=F[0],Y=F[1],U=i.useState(!1),H=U[0],K=U[1],L=i.useState(!1),M=L[0],G=L[1],J=i.useMemo((function(){return"number"==typeof l&&l>=0&&!s}),[l,s]),D=i.useState(!1),O=D[0],V=D[1],z=i.useState(null),Q=z[0],Z=z[1],X=i.useState(!1),R=X[0],$=X[1],ee="entry"===Q?c.supercoinsBalanceBackgroundColorShift:"exit"===Q?c.supercoinsBalanceBackgroundColorShift_exit:"",ne="entry"===Q?c.supercoinsBalanceTextColorShift:"exit"===Q?c.supercoinsBalanceTextColorShift_exit:"";function ie(){var n;m&&"function"==typeof m&&m();var i=p.action_event_name;p.impression_event_name;var r=e.__rest(p,["action_event_name","impression_event_name"]);a.ravenSDKTrigger(null!==(n=i)&&void 0!==n?n:"u_ui_action",e.__assign({action_name:"supercoin_icon_click",page_name:"unified_homepage",supercoin_balance:l,u_utm_source:N},r))}if(i.useEffect((function(){Y(Number(null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("expiryAnimationCount")));var e=function(){window.scrollY>0&&(sessionStorage.getItem(d)||($(!0),Z(null)))};return window.addEventListener("scroll",e),function(){window.removeEventListener("scroll",e)}}),[]),i.useEffect((function(){var e,n=b({renderFloatingIsland:w,supercoins:l});return A("number"==typeof B&&B>=x&&!n),n&&sessionStorage.setItem("disable_floater","true"),n&&!R?(Z("entry"),e=setTimeout((function(){V(!0)}),1500)):I&&G(!0),function(){clearTimeout(e)}}),[l,B]),i.useEffect((function(){if(w&&O){var e=setTimeout((function(){sessionStorage.getItem(d)||(V(!1),Z("exit"),G(!0))}),y.cutoffTimeInMs);return function(){clearTimeout(e)}}}),[]),i.useEffect((function(){var n;if("number"==typeof l&&l>=0&&!s){p.action_event_name;var i=p.impression_event_name,r=e.__rest(p,["action_event_name","impression_event_name"]);a.ravenSDKTrigger(null!==(n=i)&&void 0!==n?n:"u_impression",e.__assign({action_name:"supercoin_pill_impression",page_name:"unified_homepage",supercoin_balance:l,u_utm_source:N,supercoinsExpiryCount:B||"N/A"},r))}}),[s]),i.useEffect((function(){if(W&&!(P>=f)){var e=setTimeout((function(){K(!0);var e=setTimeout((function(){K(!1);var e=P+1;Y(e),sessionStorage.setItem("expiryAnimationCount",e.toString())}),v);return function(){return clearTimeout(e)}}),0===P?h:g);return function(){return clearTimeout(e)}}}),[W,P]),s)return n.jsx("div",e.__assign({className:c.supercoinsBalance},{children:n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsx(o.Shimmer,{width:18,height:18,type:"rounded"}),n.jsx(o.Shimmer,{width:44,height:18,type:"rounded"})]}))}));if(!J)return null;var re=W?"HM4":"B2",oe=W?c.supercoinsExpiryPill:c.supercoinsBalance,ae=W?c.supercoinBurnExpiryColor:"";return M?n.jsx(C,{walletBalance:E,supercoinBalance:Number(l),handleClick:ie}):n.jsxs("div",e.__assign({style:{position:"relative"}},{children:[n.jsx("div",e.__assign({className:"".concat(oe," ").concat(ee),onClick:ie},{children:n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsx("img",{src:u,alt:"supercoin_icon",width:18,height:18}),n.jsxs("div",e.__assign({className:c.supercoinChipWrapper},{children:[n.jsx(r.Typography,e.__assign({variant:re,className:[ne,c.supercoinBurnTextAlign,ae].join(" ")},{children:H?B:l})),W&&n.jsx(r.Typography,e.__assign({variant:"HM4",className:"".concat(c.supercoinExpiryText," ").concat(H?c.supercoinExpiryAnimating:"")},{children:"expiring soon"}))]}))]}))})),O&&!R&&n.jsx("div",e.__assign({className:c.superCoinsFloatingIslandContainer},{children:n.jsx(i.Suspense,e.__assign({fallback:n.jsx(n.Fragment,{})},{children:n.jsx(T,{superCoins:l,onAnimationStart:function(){return function(n){var i,r=n.supercoins,o=n.ravenPayload,t=void 0===o?{}:o,s=n.utmSource,l=void 0===s?"":s;t.action_event_name;var c=t.impression_event_name,u=e.__rest(t,["action_event_name","impression_event_name"]);a.ravenSDKTrigger(null!==(i=c)&&void 0!==i?i:"u_impression",e.__assign({action_name:"supercoin_banner_impression",page_name:"unified_homepage",supercoin_balance:r,u_utm_source:l},u)),sessionStorage.setItem("islandAnimationPlayed","true"),S()}({supercoins:l,ravenPayload:p,utmSource:N})},onAnimationEnd:function(){setTimeout((function(){I&&G(!0)}),500),Z("exit")}})}))}))]}))};
|
|
1
|
+
"use strict";var e=require("tslib"),n=require("react/jsx-runtime"),i=require("react"),r=require("@cleartrip/ct-design-typography"),o=require("@cleartrip/ct-platform-shimmer"),a=require("@cleartrip/ct-platform-utils");function t(e){return e&&e.__esModule?e:{default:e}}var s=t(i);function l(e,n){void 0===n&&(n={});var i=n.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var c={supercoinsBalance:"index-module_supercoinsBalance__w9srh",supercoinsExpiryPill:"index-module_supercoinsExpiryPill__v4w06",supercoinChipWrapper:"index-module_supercoinChipWrapper__QPdUS",supercoinBurnTextAlign:"index-module_supercoinBurnTextAlign__g-go5",supercoinBurnExpiryColor:"index-module_supercoinBurnExpiryColor__FTFjA",supercoinExpiryText:"index-module_supercoinExpiryText__rkVbG",supercoinExpiryAnimating:"index-module_supercoinExpiryAnimating__Gdq0n",superCoinsFloatingIslandContainer:"index-module_superCoinsFloatingIslandContainer__5FNNa",supercoinsBalanceBackgroundColorShift:"index-module_supercoinsBalanceBackgroundColorShift__r6YWa",supercoins_balance_background_color_shift:"index-module_supercoins_balance_background_color_shift__1NHEU",supercoinsBalanceTextColorShift:"index-module_supercoinsBalanceTextColorShift__y7vva",supercoins_balance_text_color_shift:"index-module_supercoins_balance_text_color_shift__V8yxU",supercoinsBalanceBackgroundColorShift_exit:"index-module_supercoinsBalanceBackgroundColorShift_exit__sinUJ",supercoins_balance_background_color_shift_exit:"index-module_supercoins_balance_background_color_shift_exit__qAHuv",supercoinsBalanceTextColorShift_exit:"index-module_supercoinsBalanceTextColorShift_exit__JKt90",supercoins_balance_text_color_shift_exit:"index-module_supercoins_balance_text_color_shift_exit__rluZH",supercoin_chip_loading_shimmer:"index-module_supercoin_chip_loading_shimmer__0jquY",supercoins_balance_background_shimmer:"index-module_supercoins_balance_background_shimmer__2lOFp"};l('.index-module_supercoinsBalance__w9srh{background-color:#fff;border:1px solid #e6e6e6;border-radius:16px;display:inline-block;overflow:hidden;padding:6px 8px}.index-module_supercoinsExpiryPill__v4w06{background-color:#fbefef;border:1.5px solid #c83232;border-radius:16px;display:inline-block;overflow:hidden;padding:6px 0 6px 8px}.index-module_supercoinChipWrapper__QPdUS{align-items:center;display:flex;justify-content:center;padding:0 4px}.index-module_supercoinBurnTextAlign__g-go5{line-height:18px;margin-right:4px}.index-module_supercoinBurnExpiryColor__FTFjA{color:#c83232!important}.index-module_supercoinExpiryText__rkVbG{color:#c83232!important;display:inline-block;line-height:18px;opacity:0;overflow:hidden;transition:width .5s ease-in-out,opacity .5s ease-in-out;white-space:nowrap;width:0}.index-module_supercoinExpiryAnimating__Gdq0n{opacity:1;width:97px}.index-module_superCoinsFloatingIslandContainer__5FNNa{margin-left:100%;position:relative;width:1px}.index-module_supercoinsBalanceBackgroundColorShift__r6YWa{animation:index-module_supercoins_balance_background_color_shift__1NHEU .6s forwards;overflow:hidden;position:relative}.index-module_supercoinsBalanceTextColorShift__y7vva{animation:index-module_supercoins_balance_text_color_shift__V8yxU .6s forwards}.index-module_supercoinsBalanceBackgroundColorShift_exit__sinUJ{animation:index-module_supercoins_balance_background_color_shift_exit__qAHuv .6s forwards;overflow:hidden;position:relative}.index-module_supercoinsBalanceTextColorShift_exit__JKt90{animation:index-module_supercoins_balance_text_color_shift_exit__rluZH .6s forwards}.index-module_supercoinsBalanceBackgroundColorShift__r6YWa:before{animation:index-module_supercoin_chip_loading_shimmer__0jquY .4s ease-in .5s;background:hsla(0,0%,100%,.8);content:"";height:64px;left:-30%;position:absolute;top:-10px;transform:rotate(25deg);width:8px}@keyframes index-module_supercoin_chip_loading_shimmer__0jquY{0%{left:-30%}to{left:120%}}@keyframes index-module_supercoins_balance_background_color_shift__1NHEU{0%{background-color:rgba(0,62,162,.1)}to{background-color:#003ea2}}@keyframes index-module_supercoins_balance_background_color_shift_exit__qAHuv{0%{background-color:#003ea2}to{background-color:#fff}}@keyframes index-module_supercoins_balance_text_color_shift__V8yxU{0%{color:#000}to{color:#fff}}@keyframes index-module_supercoins_balance_text_color_shift_exit__rluZH{0%{color:#fff}to{color:#000}}@keyframes index-module_supercoins_balance_background_shimmer__2lOFp{0%{background-color:rgba(0,62,162,.1)}to{background-color:#003ea2}}');var u="https://rukmini-ct.flixcart.com/f_auto,q_auto,dpr_2/offermgmt-prod/offermgmt/images/banner/supercoins-chip-icon.png",_="https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/offermgmt/images/banner/wallet-pill-icon.png",p="island_rendered_frquency",d="islandAnimationPlayed",m="island_expiration_frquency",x=5,f=2,g=2e3,h=500,v=1500,y={requiredSupercoins:50,frequency:1,frequencyGapInDays:1,cutoffTimeInMs:5e3,isVisibleOnScroll:!1};function b(e){var n,i=e.renderFloatingIsland,r=e.supercoins;if(!i)return!1;if(r<y.requiredSupercoins)return!1;if(!("true"===a.getQueryParam("isMobileApp")))return!1;if(function(){var e=localStorage.getItem(p);return e&&"number"==typeof parseInt(e)?parseInt(e):0}()>=y.frequency){var o=(n=localStorage.getItem(m))&&"number"==typeof parseInt(n)?parseInt(n):null;return!o||!(o>Math.floor(Date.now()/1e3))&&(localStorage.removeItem(p),localStorage.removeItem(m),!0)}return!sessionStorage.getItem(d)}function S(){var e=localStorage.getItem(p);e||(e="0");var n=parseInt(e)+1;if(localStorage.setItem(p,n.toString()),n>=y.frequency){var i=Math.floor(Date.now()/1e3)+86400*y.frequencyGapInDays;localStorage.setItem(m,i.toString())}}var B={chipWrapper:"index-module_chipWrapper__EwpUk",chipTextWrapper:"index-module_chipTextWrapper__Uburn",textWrapper:"index-module_textWrapper__BysJP",pillContainer:"index-module_pillContainer__bz7P4","spring-up-wallet":"index-module_spring-up-wallet__GJrXW","spring-up1":"index-module_spring-up1__OLe4L","spring-up-wallet-sc":"index-module_spring-up-wallet-sc__KKKf0","spring-up2":"index-module_spring-up2__SIbCp"};function k(i){var o=i.supercoinBalance;return n.jsxs("div",e.__assign({className:B.chipWrapper},{children:[n.jsx("img",{src:u,alt:"supercoin_icon",width:18,height:18}),n.jsx("div",e.__assign({className:B.chipTextWrapper},{children:n.jsx(r.Typography,e.__assign({variant:"B2",className:B.textWrapper},{children:o}))}))]}))}function w(i){var o=i.walletBalance;return n.jsxs("div",e.__assign({className:B.chipWrapper},{children:[n.jsx("img",{src:_,alt:"supercoin_icon",width:18,height:18}),n.jsx("div",e.__assign({className:B.chipTextWrapper},{children:n.jsxs(r.Typography,e.__assign({variant:"B2",className:B.textWrapper},{children:["₹",o]}))}))]}))}function C(i){var r=i.supercoinBalance,o=i.walletBalance,a=i.handleClick,t=0===o&&r>0||0===r&&0===o,s=t?B["spring-up-wallet-sc"]:B["spring-up-wallet"];return n.jsx("div",e.__assign({onClick:a},{children:n.jsx("div",e.__assign({className:"".concat(B.pillContainer),style:{height:"32px"}},{children:n.jsxs("div",e.__assign({className:s},{children:[n.jsx(k,{supercoinBalance:r}),n.jsx(w,{walletBalance:o}),t?n.jsx(k,{supercoinBalance:r}):null]}))}))}))}l(".index-module_chipWrapper__EwpUk{align-items:center;display:flex;gap:4px;margin-bottom:20px;text-align:center}.index-module_chipTextWrapper__Uburn{align-items:center;display:flex;justify-content:center;padding:0 4px;text-align:center;width:100%}.index-module_textWrapper__BysJP{margin-right:4px}.index-module_pillContainer__bz7P4{background-color:#fff;border:1px solid #e6e6e6;border-radius:16px;box-sizing:border-box;display:inline-block;overflow:hidden;padding:5px 8px}@keyframes index-module_spring-up1__OLe4L{0%{transform:translateY(0)}60%{transform:translateY(-44px)}90%{transform:translateY(-40px)}to{transform:translateY(-40px)}}@keyframes index-module_spring-up2__SIbCp{0%{transform:translateY(-40px)}60%{transform:translateY(-84px)}90%{transform:translateY(-80px)}to{transform:translateY(-80px)}}.index-module_spring-up-wallet__GJrXW{animation:index-module_spring-up1__OLe4L .7s ease-in-out 2s forwards}.index-module_spring-up-wallet-sc__KKKf0{animation:index-module_spring-up1__OLe4L .7s ease-in-out 2s forwards,index-module_spring-up2__SIbCp .7s ease-in-out 5s forwards}");var T=s.default.lazy((function(){return import("@cleartrip/ct-platform-supercoins-floating-island").then((function(e){return{default:e.SupercoinsFloatingIsland}}))}));exports.SupercoinsChip=function(t){var s=t.supercoinsLoading,l=t.supercoinBurnBalance,_=t.ravenPayload,p=void 0===_?{}:_,m=t.onSupercoinsClick,B=t.supercoinsExpiryCount,k=t.renderFloatingIsland,w=void 0===k||k,j=t.walletEnabled,I=void 0!==j&&j,E=t.walletBalance,N=i.useMemo((function(){var e;return null!==(e=a.getQueryParam("utm_source"))&&void 0!==e?e:"organic"}),[]),q=i.useState(!1),W=q[0],A=q[1],F=i.useState(0),P=F[0],Y=F[1],U=i.useState(!1),H=U[0],K=U[1],L=i.useState(!1),M=L[0],G=L[1],J=i.useMemo((function(){return"number"==typeof l&&l>=0&&!s}),[l,s]),D=i.useState(!1),O=D[0],V=D[1],z=i.useState(null),Q=z[0],Z=z[1],X=i.useState(!1),R=X[0],$=X[1],ee="entry"===Q?c.supercoinsBalanceBackgroundColorShift:"exit"===Q?c.supercoinsBalanceBackgroundColorShift_exit:"",ne="entry"===Q?c.supercoinsBalanceTextColorShift:"exit"===Q?c.supercoinsBalanceTextColorShift_exit:"";function ie(){var n;m&&"function"==typeof m&&m();var i=p.action_event_name;p.impression_event_name;var r=e.__rest(p,["action_event_name","impression_event_name"]);a.ravenSDKTrigger(null!==(n=i)&&void 0!==n?n:"u_ui_action",e.__assign({action_name:"supercoin_icon_click",page_name:"unified_homepage",supercoin_balance:l,u_utm_source:N},r))}if(i.useEffect((function(){Y(Number(null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("expiryAnimationCount")));var e=function(){window.scrollY>0&&(sessionStorage.getItem(d)||($(!0),Z(null)))};return window.addEventListener("scroll",e),function(){window.removeEventListener("scroll",e)}}),[]),i.useEffect((function(){var e,n=b({renderFloatingIsland:w,supercoins:l});return A("number"==typeof B&&B>=x&&!n),n&&sessionStorage.setItem("disable_floater","true"),n&&!R?(Z("entry"),e=setTimeout((function(){V(!0)}),1500)):I&&G(!0),function(){clearTimeout(e)}}),[l,B]),i.useEffect((function(){if(w&&O){var e=setTimeout((function(){sessionStorage.getItem(d)||(V(!1),Z("exit"),G(!0))}),y.cutoffTimeInMs);return function(){clearTimeout(e)}}}),[]),i.useEffect((function(){var n;if("number"==typeof l&&l>=0&&!s){p.action_event_name;var i=p.impression_event_name,r=e.__rest(p,["action_event_name","impression_event_name"]);a.ravenSDKTrigger(null!==(n=i)&&void 0!==n?n:"u_impression",e.__assign({action_name:"supercoin_pill_impression",page_name:"unified_homepage",supercoin_balance:l,u_utm_source:N,supercoinsExpiryCount:B||"N/A"},r))}}),[s]),i.useEffect((function(){if(W&&!(P>=f)){var e=setTimeout((function(){K(!0);var e=setTimeout((function(){K(!1);var e=P+1;Y(e),sessionStorage.setItem("expiryAnimationCount",e.toString())}),v);return function(){return clearTimeout(e)}}),0===P?h:g);return function(){return clearTimeout(e)}}}),[W,P]),s)return n.jsx("div",e.__assign({className:c.supercoinsBalance},{children:n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsx(o.Shimmer,{width:18,height:18,type:"rounded"}),n.jsx(o.Shimmer,{width:44,height:18,type:"rounded"})]}))}));if(!J)return null;var re=W?"HM4":"B2",oe=W?c.supercoinsExpiryPill:c.supercoinsBalance,ae=W?c.supercoinBurnExpiryColor:"";return M?n.jsx(C,{walletBalance:E,supercoinBalance:Number(l),handleClick:ie}):n.jsxs("div",e.__assign({style:{position:"relative"}},{children:[n.jsx("div",e.__assign({className:"".concat(oe," ").concat(ee),onClick:ie},{children:n.jsxs("div",e.__assign({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[n.jsx("img",{src:u,alt:"supercoin_icon",width:18,height:18}),n.jsxs("div",e.__assign({className:c.supercoinChipWrapper},{children:[n.jsx(r.Typography,e.__assign({variant:re,className:[ne,c.supercoinBurnTextAlign,ae].join(" ")},{children:H?B:l})),W&&n.jsx(r.Typography,e.__assign({variant:"HM4",className:"".concat(c.supercoinExpiryText," ").concat(H?c.supercoinExpiryAnimating:"")},{children:"expiring soon"}))]}))]}))})),O&&!R&&n.jsx("div",e.__assign({className:c.superCoinsFloatingIslandContainer},{children:n.jsx(i.Suspense,e.__assign({fallback:n.jsx(n.Fragment,{})},{children:n.jsx(T,{superCoins:l,onAnimationStart:function(){return function(n){var i,r=n.supercoins,o=n.ravenPayload,t=void 0===o?{}:o,s=n.utmSource,l=void 0===s?"":s;t.action_event_name;var c=t.impression_event_name,u=e.__rest(t,["action_event_name","impression_event_name"]);a.ravenSDKTrigger(null!==(i=c)&&void 0!==i?i:"u_impression",e.__assign({action_name:"supercoin_banner_impression",page_name:"unified_homepage",supercoin_balance:r,u_utm_source:l},u)),sessionStorage.setItem("islandAnimationPlayed","true"),S()}({supercoins:l,ravenPayload:p,utmSource:N})},onAnimationEnd:function(){setTimeout((function(){I&&G(!0)}),500),Z("exit")}})}))}))]}))};
|
|
2
2
|
//# sourceMappingURL=ct-platform-supercoins-chip.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-platform-supercoins-chip.cjs.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/SupercoinsChip/src/constants.ts","../packages/components/SupercoinsChip/src/utils/shouldRenderFloatingIsland.ts","../packages/components/SupercoinsChip/src/utils/onIslandAnimationStart.ts","../packages/components/SupercoinsChip/src/walletAnimation/index.tsx","../packages/components/SupercoinsChip/src/SupercoinsChip.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null,null],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","SUPERCOINS_CHIP_ICON","WALLET_CHIP_ICON","SUPERCOIN_ISLAND_RENDERED_FREQUENCY","SUPERCOIN_ISLAND_ANIMATION_PLAYED","SUPERCOIN_ISLAND_EXPIRATION_FREQUENCY","SUPERCOIN_EXPIRY_CONFIG","SUPERCOIN_FLOATING_ISLAND_CONFIG","requiredSupercoins","frequency","frequencyGapInDays","cutoffTimeInMs","isVisibleOnScroll","shouldRenderFloatingIsland","_a","expiry","renderFloatingIsland","supercoins","getQueryParam","localStorage","getItem","parseInt","getIslandShownFrequency","expiryEpoch","Math","floor","Date","now","removeItem","sessionStorage","incrementAnimationPlayedFrequency","currentFrequency","setItem","toString","SupercoinChip","supercoinBalance","_jsxs","className","styles","chipWrapper","children","_jsx","jsx","src","alt","width","height","__assign","chipTextWrapper","Typography","variant","textWrapper","WalletChip","walletBalance","WalletAnimation","handleClick","renderSupercoinPillOnAnimationEnd","wrapperAnimation","onClick","concat","pillContainer","LazySuperCoinsFloatingIsland","React","lazy","import","then","module","default","SupercoinsFloatingIsland","supercoinsLoading","supercoinBurnBalance","_b","ravenPayload","onSupercoinsClick","supercoinsExpiryCount","_c","_d","walletEnabled","utmSource","useMemo","_e","useState","showSupercoinExpiryAnimation","setSupercoinExpiryAnimation","_f","animationCount","setAnimationCount","_g","isAnimating","setIsAnimating","_h","startWalletAnimation","setStartWalletAnimation","shouldRenderSupercoins","_j","renderSuperCoinIsland","setRenderSuperCoinIsland","_k","chipAnimationType","setChipAnimationType","_l","hasScrolledBeforeAnimation","setHasScrolledBeforeAnimation","chipBackgroundAnimationClassname","supercoinsBalanceBackgroundColorShift","supercoinsBalanceBackgroundColorShift_exit","chipTextAnimationClassname","supercoinsBalanceTextColorShift","supercoinsBalanceTextColorShift_exit","handleSupercoinsClick","action_event_name","impression_event_name","restPayload","__rest","ravenSDKTrigger","action_name","page_name","supercoin_balance","u_utm_source","useEffect","Number","handleScroll","window","scrollY","addEventListener","removeEventListener","timeout","shouldRender","setTimeout","clearTimeout","startTimer","switchBackTimer","newCount","supercoinsBalance","jsxs","display","alignItems","gap","Shimmer","typographyVariant","chipClassName","supercoinsExpiryPill","expiryColorClass","supercoinBurnExpiryColor","position","supercoinChipWrapper","supercoinBurnTextAlign","join","supercoinExpiryText","supercoinExpiryAnimating","superCoinsFloatingIslandContainer","Suspense","fallback","superCoins","onAnimationStart","onIslandAnimationStart","onAnimationEnd"],"mappings":"uRAAA,SAASA,EAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,0iICzBO,IAAMe,EACT,sHAESC,EACT,4GAESC,EAAsC,2BAEtCC,EAAoC,wBAEpCC,EACT,6BAISC,EACkB,EADlBA,EAEK,EAFLA,EAGyB,IAHzBA,EAIkB,IAJlBA,EAKkB,KAGlBC,EAAmC,CAC5CC,mBAAoB,GACpBC,UAAW,EACXC,mBAAoB,EACpBC,eAAgB,IAChBC,mBAAmB,GCPC,SAAAC,EAA2BC,OALzCC,EAMNC,EAAoBF,EAAAE,qBACpBC,EAAUH,EAAAG,WAGV,IAAKD,EAAsB,OAAO,EAElC,GAAIC,EAAaV,EAAiCC,mBAC9C,OAAO,EAIX,KADqD,SAAjCU,EAAAA,cAAc,gBAChB,OAAO,EAIzB,GA5BJ,WACI,IAAMT,EAAYU,aAAaC,QAAQjB,GACvC,OAAKM,GAA4C,iBAAxBY,SAASZ,GAC3BY,SAASZ,GADkD,CAEtE,CAuBsBa,IACDf,EAAiCE,UAAW,CAEzD,IAAMc,GAvBJR,EAASI,aAAaC,QAAQf,KACO,iBAArBgB,SAASN,GACxBM,SAASN,GAD4C,KAuBxD,OAAKQ,KAEDA,EADiBC,KAAKC,MAAMC,KAAKC,MAAQ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MACRb,UAAW,GAAAsB,OAAGrB,EAAO8G,oBAAmB,KAAAzF,OAAI6B,EAAclD,EAAO+G,yBAA2B,KAGnF,CAAA7G,SAAA,8BAM5BuD,IAA0BM,GACvB5D,EAAAA,IAAA,MAAAM,EAAAA,SAAA,CAAKV,UAAWC,EAAOgH,mCACnB,CAAA9G,SAAAC,EAAAA,IAAC8G,EAAAA,SAAQxG,EAAAA,SAAA,CAACyG,SAAU/G,EAAAA,oBAChB,CAAAD,SAAAC,EAAAA,IAACoB,EAA4B,CACzB4F,WAAYnF,EACZoF,iBAAkB,WACd,OFnS1B,SAAiC5I,SACnCG,EAAUH,EAAAG,WACV0D,EAAiB7D,EAAA0D,aAAjBA,OAAe,IAAAG,EAAA,CAAE,EAAAA,EACjBC,EAAc9D,EAAAgE,UAAdA,OAAS,IAAAF,EAAG,GAAEA,EAKVJ,EADqBsC,sBAAEC,EACvBvC,EAD4CuC,sBAAKC,EACjDC,EAAAA,OAAAzC,EADE,CAAA,oBAAA,0BAEN0C,kBAAqD,QAApC3C,EAAAwC,SAAoC,IAAAxC,EAAAA,EAAA,2BACjD4C,YAAa,8BACbC,UAAW,mBACXC,kBAAmBpG,EACnBqG,aAAcxC,GACXkC,IAIPnF,eAAeG,QAAQ,wBAAyB,QAGhDF,GACJ,CE6QgC6H,CAAuB,CACnB1I,WAAYqD,EACZE,aAAYA,EACZM,UAASA,KAGjB8E,eAlQxB,WACI5B,YAAW,WACHnD,GAAee,GAAwB,EAC9C,GAAE,KACHO,EAAqB,OACxB,aAoQL","x_google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"ct-platform-supercoins-chip.cjs.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/SupercoinsChip/src/constants.ts","../packages/components/SupercoinsChip/src/utils/shouldRenderFloatingIsland.ts","../packages/components/SupercoinsChip/src/utils/onIslandAnimationStart.ts","../packages/components/SupercoinsChip/src/walletAnimation/index.tsx","../packages/components/SupercoinsChip/src/SupercoinsChip.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null,null],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","SUPERCOINS_CHIP_ICON","WALLET_CHIP_ICON","SUPERCOIN_ISLAND_RENDERED_FREQUENCY","SUPERCOIN_ISLAND_ANIMATION_PLAYED","SUPERCOIN_ISLAND_EXPIRATION_FREQUENCY","SUPERCOIN_EXPIRY_CONFIG","SUPERCOIN_FLOATING_ISLAND_CONFIG","requiredSupercoins","frequency","frequencyGapInDays","cutoffTimeInMs","isVisibleOnScroll","shouldRenderFloatingIsland","_a","expiry","renderFloatingIsland","supercoins","getQueryParam","localStorage","getItem","parseInt","getIslandShownFrequency","expiryEpoch","Math","floor","Date","now","removeItem","sessionStorage","incrementAnimationPlayedFrequency","currentFrequency","setItem","toString","SupercoinChip","supercoinBalance","_jsxs","className","styles","chipWrapper","children","_jsx","jsx","src","alt","width","height","__assign","chipTextWrapper","Typography","variant","textWrapper","WalletChip","walletBalance","WalletAnimation","handleClick","renderSupercoinPillOnAnimationEnd","wrapperAnimation","onClick","concat","pillContainer","LazySuperCoinsFloatingIsland","React","lazy","import","then","module","default","SupercoinsFloatingIsland","supercoinsLoading","supercoinBurnBalance","_b","ravenPayload","onSupercoinsClick","supercoinsExpiryCount","_c","_d","walletEnabled","utmSource","useMemo","_e","useState","showSupercoinExpiryAnimation","setSupercoinExpiryAnimation","_f","animationCount","setAnimationCount","_g","isAnimating","setIsAnimating","_h","startWalletAnimation","setStartWalletAnimation","shouldRenderSupercoins","_j","renderSuperCoinIsland","setRenderSuperCoinIsland","_k","chipAnimationType","setChipAnimationType","_l","hasScrolledBeforeAnimation","setHasScrolledBeforeAnimation","chipBackgroundAnimationClassname","supercoinsBalanceBackgroundColorShift","supercoinsBalanceBackgroundColorShift_exit","chipTextAnimationClassname","supercoinsBalanceTextColorShift","supercoinsBalanceTextColorShift_exit","handleSupercoinsClick","action_event_name","impression_event_name","restPayload","__rest","ravenSDKTrigger","action_name","page_name","supercoin_balance","u_utm_source","useEffect","Number","handleScroll","window","scrollY","addEventListener","removeEventListener","timeout","shouldRender","setTimeout","clearTimeout","startTimer","switchBackTimer","newCount","supercoinsBalance","jsxs","display","alignItems","gap","Shimmer","typographyVariant","chipClassName","supercoinsExpiryPill","expiryColorClass","supercoinBurnExpiryColor","position","supercoinChipWrapper","supercoinBurnTextAlign","join","supercoinExpiryText","supercoinExpiryAnimating","superCoinsFloatingIslandContainer","Suspense","fallback","superCoins","onAnimationStart","onIslandAnimationStart","onAnimationEnd"],"mappings":"uRAAA,SAASA,EAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed,GAnBW,CAqBzD,8hICzBO,IAAMe,EACT,sHAESC,EACT,4GAESC,EAAsC,2BAEtCC,EAAoC,wBAEpCC,EACT,6BAISC,EACk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C,EADE,CAAA,oBAAA,0BAEN0C,kBAAqD,QAApC3C,EAAAwC,SAAoC,IAAAxC,EAAAA,EAAA,2BACjD4C,YAAa,8BACbC,UAAW,mBACXC,kBAAmBpG,EACnBqG,aAAcxC,GACXkC,IAIPnF,eAAeG,QAAQ,wBAAyB,QAGhDF,GACJ,CE6QgC6H,CAAuB,CACnB1I,WAAYqD,EACZE,aAAYA,EACZM,UAASA,KAGjB8E,eAlQxB,WACI5B,YAAW,WACHnD,GAAee,GAAwB,EAC9C,GAAE,KACHO,EAAqB,OACxB,aAoQL","x_google_ignoreList":[0]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__rest as e,__assign as n}from"tslib";import{jsx as i,jsxs as r,Fragment as o}from"react/jsx-runtime";import a,{useMemo as t,useState as s,useEffect as l,Suspense as c}from"react";import{Typography as u}from"@cleartrip/ct-design-typography";import{Shimmer as p}from"@cleartrip/ct-platform-shimmer";import{getQueryParam as _,ravenSDKTrigger as d}from"@cleartrip/ct-platform-utils";function m(e,n){void 0===n&&(n={});var i=n.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var x={supercoinsBalance:"index-module_supercoinsBalance__w9srh",supercoinsExpiryPill:"index-module_supercoinsExpiryPill__v4w06",supercoinChipWrapper:"index-module_supercoinChipWrapper__QPdUS",supercoinBurnTextAlign:"index-module_supercoinBurnTextAlign__g-go5",supercoinBurnExpiryColor:"index-module_supercoinBurnExpiryColor__FTFjA",supercoinExpiryText:"index-module_supercoinExpiryText__rkVbG",supercoinExpiryAnimating:"index-module_supercoinExpiryAnimating__Gdq0n",superCoinsFloatingIslandContainer:"index-module_superCoinsFloatingIslandContainer__5FNNa",supercoinsBalanceBackgroundColorShift:"index-module_supercoinsBalanceBackgroundColorShift__r6YWa",supercoins_balance_background_color_shift:"index-module_supercoins_balance_background_color_shift__1NHEU",supercoinsBalanceTextColorShift:"index-module_supercoinsBalanceTextColorShift__y7vva",supercoins_balance_text_color_shift:"index-module_supercoins_balance_text_color_shift__V8yxU",supercoinsBalanceBackgroundColorShift_exit:"index-module_supercoinsBalanceBackgroundColorShift_exit__sinUJ",supercoins_balance_background_color_shift_exit:"index-module_supercoins_balance_background_color_shift_exit__qAHuv",supercoinsBalanceTextColorShift_exit:"index-module_supercoinsBalanceTextColorShift_exit__JKt90",supercoins_balance_text_color_shift_exit:"index-module_supercoins_balance_text_color_shift_exit__rluZH",supercoin_chip_loading_shimmer:"index-module_supercoin_chip_loading_shimmer__0jquY",supercoins_balance_background_shimmer:"index-module_supercoins_balance_background_shimmer__2lOFp"};m('.index-module_supercoinsBalance__w9srh{background-color:#fff;border:1px solid #e6e6e6;border-radius:16px;display:inline-block;overflow:hidden;padding:6px 8px}.index-module_supercoinsExpiryPill__v4w06{background-color:#fbefef;border:1.5px solid #c83232;border-radius:16px;display:inline-block;overflow:hidden;padding:6px 0 6px 8px}.index-module_supercoinChipWrapper__QPdUS{align-items:center;display:flex;justify-content:center;padding:0 4px}.index-module_supercoinBurnTextAlign__g-go5{line-height:18px;margin-right:4px}.index-module_supercoinBurnExpiryColor__FTFjA{color:#c83232!important}.index-module_supercoinExpiryText__rkVbG{color:#c83232!important;display:inline-block;line-height:18px;opacity:0;overflow:hidden;transition:width .5s ease-in-out,opacity .5s ease-in-out;white-space:nowrap;width:0}.index-module_supercoinExpiryAnimating__Gdq0n{opacity:1;width:97px}.index-module_superCoinsFloatingIslandContainer__5FNNa{margin-left:100%;position:relative;width:1px}.index-module_supercoinsBalanceBackgroundColorShift__r6YWa{animation:index-module_supercoins_balance_background_color_shift__1NHEU .6s forwards;overflow:hidden;position:relative}.index-module_supercoinsBalanceTextColorShift__y7vva{animation:index-module_supercoins_balance_text_color_shift__V8yxU .6s forwards}.index-module_supercoinsBalanceBackgroundColorShift_exit__sinUJ{animation:index-module_supercoins_balance_background_color_shift_exit__qAHuv .6s forwards;overflow:hidden;position:relative}.index-module_supercoinsBalanceTextColorShift_exit__JKt90{animation:index-module_supercoins_balance_text_color_shift_exit__rluZH .6s forwards}.index-module_supercoinsBalanceBackgroundColorShift__r6YWa:before{animation:index-module_supercoin_chip_loading_shimmer__0jquY .4s ease-in .5s;background:hsla(0,0%,100%,.8);content:"";height:64px;left:-30%;position:absolute;top:-10px;transform:rotate(25deg);width:8px}@keyframes index-module_supercoin_chip_loading_shimmer__0jquY{0%{left:-30%}to{left:120%}}@keyframes index-module_supercoins_balance_background_color_shift__1NHEU{0%{background-color:rgba(0,62,162,.1)}to{background-color:#003ea2}}@keyframes index-module_supercoins_balance_background_color_shift_exit__qAHuv{0%{background-color:#003ea2}to{background-color:rgba(0,62,162,0)}}@keyframes index-module_supercoins_balance_text_color_shift__V8yxU{0%{color:#000}to{color:#fff}}@keyframes index-module_supercoins_balance_text_color_shift_exit__rluZH{0%{color:#fff}to{color:#000}}@keyframes index-module_supercoins_balance_background_shimmer__2lOFp{0%{background-color:rgba(0,62,162,.1)}to{background-color:#003ea2}}');var f="https://rukmini-ct.flixcart.com/f_auto,q_auto,dpr_2/offermgmt-prod/offermgmt/images/banner/supercoins-chip-icon.png",g="https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/offermgmt/images/banner/wallet-pill-icon.png",h="island_rendered_frquency",v="islandAnimationPlayed",b="island_expiration_frquency",y=5,B=2,k=2e3,w=500,C=1500,S={requiredSupercoins:50,frequency:1,frequencyGapInDays:1,cutoffTimeInMs:5e3,isVisibleOnScroll:!1};function T(e){var n,i=e.renderFloatingIsland,r=e.supercoins;if(!i)return!1;if(r<S.requiredSupercoins)return!1;if(!("true"===_("isMobileApp")))return!1;if(function(){var e=localStorage.getItem(h);return e&&"number"==typeof parseInt(e)?parseInt(e):0}()>=S.frequency){var o=(n=localStorage.getItem(b))&&"number"==typeof parseInt(n)?parseInt(n):null;return!o||!(o>Math.floor(Date.now()/1e3))&&(localStorage.removeItem(h),localStorage.removeItem(b),!0)}return!sessionStorage.getItem(v)}function I(){var e=localStorage.getItem(h);e||(e="0");var n=parseInt(e)+1;if(localStorage.setItem(h,n.toString()),n>=S.frequency){var i=Math.floor(Date.now()/1e3)+86400*S.frequencyGapInDays;localStorage.setItem(b,i.toString())}}var E={chipWrapper:"index-module_chipWrapper__EwpUk",chipTextWrapper:"index-module_chipTextWrapper__Uburn",textWrapper:"index-module_textWrapper__BysJP",pillContainer:"index-module_pillContainer__bz7P4","spring-up-wallet":"index-module_spring-up-wallet__GJrXW","spring-up1":"index-module_spring-up1__OLe4L","spring-up-wallet-sc":"index-module_spring-up-wallet-sc__KKKf0","spring-up2":"index-module_spring-up2__SIbCp"};function N(e){var o=e.supercoinBalance;return r("div",n({className:E.chipWrapper},{children:[i("img",{src:f,alt:"supercoin_icon",width:18,height:18}),i("div",n({className:E.chipTextWrapper},{children:i(u,n({variant:"B2",className:E.textWrapper},{children:o}))}))]}))}function W(e){var o=e.walletBalance;return r("div",n({className:E.chipWrapper},{children:[i("img",{src:g,alt:"supercoin_icon",width:18,height:18}),i("div",n({className:E.chipTextWrapper},{children:r(u,n({variant:"B2",className:E.textWrapper},{children:["₹",o]}))}))]}))}function A(e){var o=e.supercoinBalance,a=e.walletBalance,t=e.handleClick,s=0===a&&o>0||0===o&&0===a,l=s?E["spring-up-wallet-sc"]:E["spring-up-wallet"];return i("div",n({onClick:t},{children:i("div",n({className:"".concat(E.pillContainer),style:{height:"34px"}},{children:r("div",n({className:l},{children:[i(N,{supercoinBalance:o}),i(W,{walletBalance:a}),s?i(N,{supercoinBalance:o}):null]}))}))}))}m(".index-module_chipWrapper__EwpUk{align-items:center;display:flex;gap:4px;margin-bottom:20px;text-align:center}.index-module_chipTextWrapper__Uburn{align-items:center;display:flex;justify-content:center;padding:0 4px;text-align:center;width:100%}.index-module_textWrapper__BysJP{margin-right:4px}.index-module_pillContainer__bz7P4{background-color:#fff;border:1px solid #e6e6e6;border-radius:16px;box-sizing:border-box;display:inline-block;overflow:hidden;padding:6px 8px}@keyframes index-module_spring-up1__OLe4L{0%{transform:translateY(0)}60%{transform:translateY(-44px)}90%{transform:translateY(-40px)}to{transform:translateY(-40px)}}@keyframes index-module_spring-up2__SIbCp{0%{transform:translateY(-40px)}60%{transform:translateY(-84px)}90%{transform:translateY(-80px)}to{transform:translateY(-80px)}}.index-module_spring-up-wallet__GJrXW{animation:index-module_spring-up1__OLe4L .7s ease-in-out 2s forwards}.index-module_spring-up-wallet-sc__KKKf0{animation:index-module_spring-up1__OLe4L .7s ease-in-out 2s forwards,index-module_spring-up2__SIbCp .7s ease-in-out 5s forwards}");var q=a.lazy((function(){return import("@cleartrip/ct-platform-supercoins-floating-island").then((function(e){return{default:e.SupercoinsFloatingIsland}}))})),F=function(a){var m=a.supercoinsLoading,g=a.supercoinBurnBalance,h=a.ravenPayload,b=void 0===h?{}:h,E=a.onSupercoinsClick,N=a.supercoinsExpiryCount,W=a.renderFloatingIsland,F=void 0===W||W,P=a.walletEnabled,Y=void 0!==P&&P,U=a.walletBalance,H=t((function(){var e;return null!==(e=_("utm_source"))&&void 0!==e?e:"organic"}),[]),L=s(!1),j=L[0],G=L[1],J=s(0),K=J[0],M=J[1],O=s(!1),V=O[0],z=O[1],D=s(!1),Z=D[0],Q=D[1],X=t((function(){return"number"==typeof g&&g>=0&&!m}),[g,m]),R=s(!1),$=R[0],ee=R[1],ne=s(null),ie=ne[0],re=ne[1],oe=s(!1),ae=oe[0],te=oe[1],se="entry"===ie?x.supercoinsBalanceBackgroundColorShift:"exit"===ie?x.supercoinsBalanceBackgroundColorShift_exit:"",le="entry"===ie?x.supercoinsBalanceTextColorShift:"exit"===ie?x.supercoinsBalanceTextColorShift_exit:"";function ce(){var i;E&&"function"==typeof E&&E();var r=b.action_event_name;b.impression_event_name;var o=e(b,["action_event_name","impression_event_name"]);d(null!==(i=r)&&void 0!==i?i:"u_ui_action",n({action_name:"supercoin_icon_click",page_name:"unified_homepage",supercoin_balance:g,u_utm_source:H},o))}if(l((function(){M(Number(null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("expiryAnimationCount")));var e=function(){window.scrollY>0&&(sessionStorage.getItem(v)||(te(!0),re(null)))};return window.addEventListener("scroll",e),function(){window.removeEventListener("scroll",e)}}),[]),l((function(){var e,n=T({renderFloatingIsland:F,supercoins:g});return G("number"==typeof N&&N>=y&&!n),n&&sessionStorage.setItem("disable_floater","true"),n&&!ae?(re("entry"),e=setTimeout((function(){ee(!0)}),1500)):Y&&Q(!0),function(){clearTimeout(e)}}),[g,N]),l((function(){if(F&&$){var e=setTimeout((function(){sessionStorage.getItem(v)||(ee(!1),re("exit"),Q(!0))}),S.cutoffTimeInMs);return function(){clearTimeout(e)}}}),[]),l((function(){var i;if("number"==typeof g&&g>=0&&!m){b.action_event_name;var r=b.impression_event_name,o=e(b,["action_event_name","impression_event_name"]);d(null!==(i=r)&&void 0!==i?i:"u_impression",n({action_name:"supercoin_pill_impression",page_name:"unified_homepage",supercoin_balance:g,u_utm_source:H,supercoinsExpiryCount:N||"N/A"},o))}}),[m]),l((function(){if(j&&!(K>=B)){var e=setTimeout((function(){z(!0);var e=setTimeout((function(){z(!1);var e=K+1;M(e),sessionStorage.setItem("expiryAnimationCount",e.toString())}),C);return function(){return clearTimeout(e)}}),0===K?w:k);return function(){return clearTimeout(e)}}}),[j,K]),m)return i("div",n({className:x.supercoinsBalance},{children:r("div",n({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[i(p,{width:18,height:18,type:"rounded"}),i(p,{width:44,height:18,type:"rounded"})]}))}));if(!X)return null;var ue=j?"HM4":"B2",pe=j?x.supercoinsExpiryPill:x.supercoinsBalance,_e=j?x.supercoinBurnExpiryColor:"";return Z?i(A,{walletBalance:U,supercoinBalance:Number(g),handleClick:ce}):r("div",n({style:{position:"relative"}},{children:[i("div",n({className:"".concat(pe," ").concat(se),onClick:ce},{children:r("div",n({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[i("img",{src:f,alt:"supercoin_icon",width:18,height:18}),r("div",n({className:x.supercoinChipWrapper},{children:[i(u,n({variant:ue,className:[le,x.supercoinBurnTextAlign,_e].join(" ")},{children:V?N:g})),j&&i(u,n({variant:"HM4",className:"".concat(x.supercoinExpiryText," ").concat(V?x.supercoinExpiryAnimating:"")},{children:"expiring soon"}))]}))]}))})),$&&!ae&&i("div",n({className:x.superCoinsFloatingIslandContainer},{children:i(c,n({fallback:i(o,{})},{children:i(q,{superCoins:g,onAnimationStart:function(){return function(i){var r,o=i.supercoins,a=i.ravenPayload,t=void 0===a?{}:a,s=i.utmSource,l=void 0===s?"":s;t.action_event_name;var c=t.impression_event_name,u=e(t,["action_event_name","impression_event_name"]);d(null!==(r=c)&&void 0!==r?r:"u_impression",n({action_name:"supercoin_banner_impression",page_name:"unified_homepage",supercoin_balance:o,u_utm_source:l},u)),sessionStorage.setItem("islandAnimationPlayed","true"),I()}({supercoins:g,ravenPayload:b,utmSource:H})},onAnimationEnd:function(){setTimeout((function(){Y&&Q(!0)}),500),re("exit")}})}))}))]}))};export{F as SupercoinsChip};
|
|
1
|
+
import{__rest as e,__assign as n}from"tslib";import{jsx as i,jsxs as r,Fragment as o}from"react/jsx-runtime";import a,{useMemo as t,useState as s,useEffect as l,Suspense as c}from"react";import{Typography as u}from"@cleartrip/ct-design-typography";import{Shimmer as p}from"@cleartrip/ct-platform-shimmer";import{getQueryParam as _,ravenSDKTrigger as d}from"@cleartrip/ct-platform-utils";function m(e,n){void 0===n&&(n={});var i=n.insertAt;if(e&&"undefined"!=typeof document){var r=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===i&&r.firstChild?r.insertBefore(o,r.firstChild):r.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}var x={supercoinsBalance:"index-module_supercoinsBalance__w9srh",supercoinsExpiryPill:"index-module_supercoinsExpiryPill__v4w06",supercoinChipWrapper:"index-module_supercoinChipWrapper__QPdUS",supercoinBurnTextAlign:"index-module_supercoinBurnTextAlign__g-go5",supercoinBurnExpiryColor:"index-module_supercoinBurnExpiryColor__FTFjA",supercoinExpiryText:"index-module_supercoinExpiryText__rkVbG",supercoinExpiryAnimating:"index-module_supercoinExpiryAnimating__Gdq0n",superCoinsFloatingIslandContainer:"index-module_superCoinsFloatingIslandContainer__5FNNa",supercoinsBalanceBackgroundColorShift:"index-module_supercoinsBalanceBackgroundColorShift__r6YWa",supercoins_balance_background_color_shift:"index-module_supercoins_balance_background_color_shift__1NHEU",supercoinsBalanceTextColorShift:"index-module_supercoinsBalanceTextColorShift__y7vva",supercoins_balance_text_color_shift:"index-module_supercoins_balance_text_color_shift__V8yxU",supercoinsBalanceBackgroundColorShift_exit:"index-module_supercoinsBalanceBackgroundColorShift_exit__sinUJ",supercoins_balance_background_color_shift_exit:"index-module_supercoins_balance_background_color_shift_exit__qAHuv",supercoinsBalanceTextColorShift_exit:"index-module_supercoinsBalanceTextColorShift_exit__JKt90",supercoins_balance_text_color_shift_exit:"index-module_supercoins_balance_text_color_shift_exit__rluZH",supercoin_chip_loading_shimmer:"index-module_supercoin_chip_loading_shimmer__0jquY",supercoins_balance_background_shimmer:"index-module_supercoins_balance_background_shimmer__2lOFp"};m('.index-module_supercoinsBalance__w9srh{background-color:#fff;border:1px solid #e6e6e6;border-radius:16px;display:inline-block;overflow:hidden;padding:6px 8px}.index-module_supercoinsExpiryPill__v4w06{background-color:#fbefef;border:1.5px solid #c83232;border-radius:16px;display:inline-block;overflow:hidden;padding:6px 0 6px 8px}.index-module_supercoinChipWrapper__QPdUS{align-items:center;display:flex;justify-content:center;padding:0 4px}.index-module_supercoinBurnTextAlign__g-go5{line-height:18px;margin-right:4px}.index-module_supercoinBurnExpiryColor__FTFjA{color:#c83232!important}.index-module_supercoinExpiryText__rkVbG{color:#c83232!important;display:inline-block;line-height:18px;opacity:0;overflow:hidden;transition:width .5s ease-in-out,opacity .5s ease-in-out;white-space:nowrap;width:0}.index-module_supercoinExpiryAnimating__Gdq0n{opacity:1;width:97px}.index-module_superCoinsFloatingIslandContainer__5FNNa{margin-left:100%;position:relative;width:1px}.index-module_supercoinsBalanceBackgroundColorShift__r6YWa{animation:index-module_supercoins_balance_background_color_shift__1NHEU .6s forwards;overflow:hidden;position:relative}.index-module_supercoinsBalanceTextColorShift__y7vva{animation:index-module_supercoins_balance_text_color_shift__V8yxU .6s forwards}.index-module_supercoinsBalanceBackgroundColorShift_exit__sinUJ{animation:index-module_supercoins_balance_background_color_shift_exit__qAHuv .6s forwards;overflow:hidden;position:relative}.index-module_supercoinsBalanceTextColorShift_exit__JKt90{animation:index-module_supercoins_balance_text_color_shift_exit__rluZH .6s forwards}.index-module_supercoinsBalanceBackgroundColorShift__r6YWa:before{animation:index-module_supercoin_chip_loading_shimmer__0jquY .4s ease-in .5s;background:hsla(0,0%,100%,.8);content:"";height:64px;left:-30%;position:absolute;top:-10px;transform:rotate(25deg);width:8px}@keyframes index-module_supercoin_chip_loading_shimmer__0jquY{0%{left:-30%}to{left:120%}}@keyframes index-module_supercoins_balance_background_color_shift__1NHEU{0%{background-color:rgba(0,62,162,.1)}to{background-color:#003ea2}}@keyframes index-module_supercoins_balance_background_color_shift_exit__qAHuv{0%{background-color:#003ea2}to{background-color:#fff}}@keyframes index-module_supercoins_balance_text_color_shift__V8yxU{0%{color:#000}to{color:#fff}}@keyframes index-module_supercoins_balance_text_color_shift_exit__rluZH{0%{color:#fff}to{color:#000}}@keyframes index-module_supercoins_balance_background_shimmer__2lOFp{0%{background-color:rgba(0,62,162,.1)}to{background-color:#003ea2}}');var f="https://rukmini-ct.flixcart.com/f_auto,q_auto,dpr_2/offermgmt-prod/offermgmt/images/banner/supercoins-chip-icon.png",g="https://rukmini-ct.flixcart.com/f_auto,q_auto/offermgmt-prod/offermgmt/images/banner/wallet-pill-icon.png",h="island_rendered_frquency",v="islandAnimationPlayed",b="island_expiration_frquency",y=5,B=2,k=2e3,w=500,C=1500,S={requiredSupercoins:50,frequency:1,frequencyGapInDays:1,cutoffTimeInMs:5e3,isVisibleOnScroll:!1};function T(e){var n,i=e.renderFloatingIsland,r=e.supercoins;if(!i)return!1;if(r<S.requiredSupercoins)return!1;if(!("true"===_("isMobileApp")))return!1;if(function(){var e=localStorage.getItem(h);return e&&"number"==typeof parseInt(e)?parseInt(e):0}()>=S.frequency){var o=(n=localStorage.getItem(b))&&"number"==typeof parseInt(n)?parseInt(n):null;return!o||!(o>Math.floor(Date.now()/1e3))&&(localStorage.removeItem(h),localStorage.removeItem(b),!0)}return!sessionStorage.getItem(v)}function I(){var e=localStorage.getItem(h);e||(e="0");var n=parseInt(e)+1;if(localStorage.setItem(h,n.toString()),n>=S.frequency){var i=Math.floor(Date.now()/1e3)+86400*S.frequencyGapInDays;localStorage.setItem(b,i.toString())}}var E={chipWrapper:"index-module_chipWrapper__EwpUk",chipTextWrapper:"index-module_chipTextWrapper__Uburn",textWrapper:"index-module_textWrapper__BysJP",pillContainer:"index-module_pillContainer__bz7P4","spring-up-wallet":"index-module_spring-up-wallet__GJrXW","spring-up1":"index-module_spring-up1__OLe4L","spring-up-wallet-sc":"index-module_spring-up-wallet-sc__KKKf0","spring-up2":"index-module_spring-up2__SIbCp"};function N(e){var o=e.supercoinBalance;return r("div",n({className:E.chipWrapper},{children:[i("img",{src:f,alt:"supercoin_icon",width:18,height:18}),i("div",n({className:E.chipTextWrapper},{children:i(u,n({variant:"B2",className:E.textWrapper},{children:o}))}))]}))}function W(e){var o=e.walletBalance;return r("div",n({className:E.chipWrapper},{children:[i("img",{src:g,alt:"supercoin_icon",width:18,height:18}),i("div",n({className:E.chipTextWrapper},{children:r(u,n({variant:"B2",className:E.textWrapper},{children:["₹",o]}))}))]}))}function A(e){var o=e.supercoinBalance,a=e.walletBalance,t=e.handleClick,s=0===a&&o>0||0===o&&0===a,l=s?E["spring-up-wallet-sc"]:E["spring-up-wallet"];return i("div",n({onClick:t},{children:i("div",n({className:"".concat(E.pillContainer),style:{height:"32px"}},{children:r("div",n({className:l},{children:[i(N,{supercoinBalance:o}),i(W,{walletBalance:a}),s?i(N,{supercoinBalance:o}):null]}))}))}))}m(".index-module_chipWrapper__EwpUk{align-items:center;display:flex;gap:4px;margin-bottom:20px;text-align:center}.index-module_chipTextWrapper__Uburn{align-items:center;display:flex;justify-content:center;padding:0 4px;text-align:center;width:100%}.index-module_textWrapper__BysJP{margin-right:4px}.index-module_pillContainer__bz7P4{background-color:#fff;border:1px solid #e6e6e6;border-radius:16px;box-sizing:border-box;display:inline-block;overflow:hidden;padding:5px 8px}@keyframes index-module_spring-up1__OLe4L{0%{transform:translateY(0)}60%{transform:translateY(-44px)}90%{transform:translateY(-40px)}to{transform:translateY(-40px)}}@keyframes index-module_spring-up2__SIbCp{0%{transform:translateY(-40px)}60%{transform:translateY(-84px)}90%{transform:translateY(-80px)}to{transform:translateY(-80px)}}.index-module_spring-up-wallet__GJrXW{animation:index-module_spring-up1__OLe4L .7s ease-in-out 2s forwards}.index-module_spring-up-wallet-sc__KKKf0{animation:index-module_spring-up1__OLe4L .7s ease-in-out 2s forwards,index-module_spring-up2__SIbCp .7s ease-in-out 5s forwards}");var q=a.lazy((function(){return import("@cleartrip/ct-platform-supercoins-floating-island").then((function(e){return{default:e.SupercoinsFloatingIsland}}))})),F=function(a){var m=a.supercoinsLoading,g=a.supercoinBurnBalance,h=a.ravenPayload,b=void 0===h?{}:h,E=a.onSupercoinsClick,N=a.supercoinsExpiryCount,W=a.renderFloatingIsland,F=void 0===W||W,P=a.walletEnabled,Y=void 0!==P&&P,U=a.walletBalance,H=t((function(){var e;return null!==(e=_("utm_source"))&&void 0!==e?e:"organic"}),[]),L=s(!1),j=L[0],G=L[1],J=s(0),K=J[0],M=J[1],O=s(!1),V=O[0],z=O[1],D=s(!1),Z=D[0],Q=D[1],X=t((function(){return"number"==typeof g&&g>=0&&!m}),[g,m]),R=s(!1),$=R[0],ee=R[1],ne=s(null),ie=ne[0],re=ne[1],oe=s(!1),ae=oe[0],te=oe[1],se="entry"===ie?x.supercoinsBalanceBackgroundColorShift:"exit"===ie?x.supercoinsBalanceBackgroundColorShift_exit:"",le="entry"===ie?x.supercoinsBalanceTextColorShift:"exit"===ie?x.supercoinsBalanceTextColorShift_exit:"";function ce(){var i;E&&"function"==typeof E&&E();var r=b.action_event_name;b.impression_event_name;var o=e(b,["action_event_name","impression_event_name"]);d(null!==(i=r)&&void 0!==i?i:"u_ui_action",n({action_name:"supercoin_icon_click",page_name:"unified_homepage",supercoin_balance:g,u_utm_source:H},o))}if(l((function(){M(Number(null===sessionStorage||void 0===sessionStorage?void 0:sessionStorage.getItem("expiryAnimationCount")));var e=function(){window.scrollY>0&&(sessionStorage.getItem(v)||(te(!0),re(null)))};return window.addEventListener("scroll",e),function(){window.removeEventListener("scroll",e)}}),[]),l((function(){var e,n=T({renderFloatingIsland:F,supercoins:g});return G("number"==typeof N&&N>=y&&!n),n&&sessionStorage.setItem("disable_floater","true"),n&&!ae?(re("entry"),e=setTimeout((function(){ee(!0)}),1500)):Y&&Q(!0),function(){clearTimeout(e)}}),[g,N]),l((function(){if(F&&$){var e=setTimeout((function(){sessionStorage.getItem(v)||(ee(!1),re("exit"),Q(!0))}),S.cutoffTimeInMs);return function(){clearTimeout(e)}}}),[]),l((function(){var i;if("number"==typeof g&&g>=0&&!m){b.action_event_name;var r=b.impression_event_name,o=e(b,["action_event_name","impression_event_name"]);d(null!==(i=r)&&void 0!==i?i:"u_impression",n({action_name:"supercoin_pill_impression",page_name:"unified_homepage",supercoin_balance:g,u_utm_source:H,supercoinsExpiryCount:N||"N/A"},o))}}),[m]),l((function(){if(j&&!(K>=B)){var e=setTimeout((function(){z(!0);var e=setTimeout((function(){z(!1);var e=K+1;M(e),sessionStorage.setItem("expiryAnimationCount",e.toString())}),C);return function(){return clearTimeout(e)}}),0===K?w:k);return function(){return clearTimeout(e)}}}),[j,K]),m)return i("div",n({className:x.supercoinsBalance},{children:r("div",n({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[i(p,{width:18,height:18,type:"rounded"}),i(p,{width:44,height:18,type:"rounded"})]}))}));if(!X)return null;var ue=j?"HM4":"B2",pe=j?x.supercoinsExpiryPill:x.supercoinsBalance,_e=j?x.supercoinBurnExpiryColor:"";return Z?i(A,{walletBalance:U,supercoinBalance:Number(g),handleClick:ce}):r("div",n({style:{position:"relative"}},{children:[i("div",n({className:"".concat(pe," ").concat(se),onClick:ce},{children:r("div",n({style:{display:"flex",alignItems:"center",gap:"4px"}},{children:[i("img",{src:f,alt:"supercoin_icon",width:18,height:18}),r("div",n({className:x.supercoinChipWrapper},{children:[i(u,n({variant:ue,className:[le,x.supercoinBurnTextAlign,_e].join(" ")},{children:V?N:g})),j&&i(u,n({variant:"HM4",className:"".concat(x.supercoinExpiryText," ").concat(V?x.supercoinExpiryAnimating:"")},{children:"expiring soon"}))]}))]}))})),$&&!ae&&i("div",n({className:x.superCoinsFloatingIslandContainer},{children:i(c,n({fallback:i(o,{})},{children:i(q,{superCoins:g,onAnimationStart:function(){return function(i){var r,o=i.supercoins,a=i.ravenPayload,t=void 0===a?{}:a,s=i.utmSource,l=void 0===s?"":s;t.action_event_name;var c=t.impression_event_name,u=e(t,["action_event_name","impression_event_name"]);d(null!==(r=c)&&void 0!==r?r:"u_impression",n({action_name:"supercoin_banner_impression",page_name:"unified_homepage",supercoin_balance:o,u_utm_source:l},u)),sessionStorage.setItem("islandAnimationPlayed","true"),I()}({supercoins:g,ravenPayload:b,utmSource:H})},onAnimationEnd:function(){setTimeout((function(){Y&&Q(!0)}),500),re("exit")}})}))}))]}))};export{F as SupercoinsChip};
|
|
2
2
|
//# sourceMappingURL=ct-platform-supercoins-chip.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-platform-supercoins-chip.esm.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/SupercoinsChip/src/constants.ts","../packages/components/SupercoinsChip/src/utils/shouldRenderFloatingIsland.ts","../packages/components/SupercoinsChip/src/utils/onIslandAnimationStart.ts","../packages/components/SupercoinsChip/src/walletAnimation/index.tsx","../packages/components/SupercoinsChip/src/SupercoinsChip.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null,null],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","SUPERCOINS_CHIP_ICON","WALLET_CHIP_ICON","SUPERCOIN_ISLAND_RENDERED_FREQUENCY","SUPERCOIN_ISLAND_ANIMATION_PLAYED","SUPERCOIN_ISLAND_EXPIRATION_FREQUENCY","SUPERCOIN_EXPIRY_CONFIG","SUPERCOIN_FLOATING_ISLAND_CONFIG","requiredSupercoins","frequency","frequencyGapInDays","cutoffTimeInMs","isVisibleOnScroll","shouldRenderFloatingIsland","_a","expiry","renderFloatingIsland","supercoins","getQueryParam","localStorage","getItem","parseInt","getIslandShownFrequency","expiryEpoch","Math","floor","Date","now","removeItem","sessionStorage","incrementAnimationPlayedFrequency","currentFrequency","setItem","toString","SupercoinChip","supercoinBalance","_jsxs","className","styles","chipWrapper","children","_jsx","src","alt","width","height","__assign","chipTextWrapper","Typography","variant","textWrapper","WalletChip","walletBalance","WalletAnimation","handleClick","renderSupercoinPillOnAnimationEnd","wrapperAnimation","onClick","concat","pillContainer","LazySuperCoinsFloatingIsland","React","lazy","import","then","module","default","SupercoinsFloatingIsland","SupercoinsChip","supercoinsLoading","supercoinBurnBalance","_b","ravenPayload","onSupercoinsClick","supercoinsExpiryCount","_c","_d","walletEnabled","utmSource","useMemo","_e","useState","showSupercoinExpiryAnimation","setSupercoinExpiryAnimation","_f","animationCount","setAnimationCount","_g","isAnimating","setIsAnimating","_h","startWalletAnimation","setStartWalletAnimation","shouldRenderSupercoins","_j","renderSuperCoinIsland","setRenderSuperCoinIsland","_k","chipAnimationType","setChipAnimationType","_l","hasScrolledBeforeAnimation","setHasScrolledBeforeAnimation","chipBackgroundAnimationClassname","supercoinsBalanceBackgroundColorShift","supercoinsBalanceBackgroundColorShift_exit","chipTextAnimationClassname","supercoinsBalanceTextColorShift","supercoinsBalanceTextColorShift_exit","handleSupercoinsClick","action_event_name","impression_event_name","restPayload","__rest","ravenSDKTrigger","action_name","page_name","supercoin_balance","u_utm_source","useEffect","Number","handleScroll","window","scrollY","addEventListener","removeEventListener","timeout","shouldRender","setTimeout","clearTimeout","startTimer","switchBackTimer","newCount","supercoinsBalance","display","alignItems","gap","Shimmer","typographyVariant","chipClassName","supercoinsExpiryPill","expiryColorClass","supercoinBurnExpiryColor","position","supercoinChipWrapper","supercoinBurnTextAlign","join","supercoinExpiryText","supercoinExpiryAnimating","superCoinsFloatingIslandContainer","Suspense","fallback","superCoins","onAnimationStart","onIslandAnimationStart","onAnimationEnd"],"mappings":"mYAAA,SAASA,EAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EAAME,KAAO,WAEI,QAAbN,GACEE,EAAKK,WACPL,EAAKM,aAAaJ,EAAOF,EAAKK,YAKhCL,EAAKO,YAAYL,GAGfA,EAAMM,WACRN,EAAMM,WAAWC,QAAUb,EAE3BM,EAAMK,YAAYR,SAASW,eAAed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google_ignoreList":[0]}
|
|
1
|
+
{"version":3,"file":"ct-platform-supercoins-chip.esm.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/SupercoinsChip/src/constants.ts","../packages/components/SupercoinsChip/src/utils/shouldRenderFloatingIsland.ts","../packages/components/SupercoinsChip/src/utils/onIslandAnimationStart.ts","../packages/components/SupercoinsChip/src/walletAnimation/index.tsx","../packages/components/SupercoinsChip/src/SupercoinsChip.tsx"],"sourcesContent":["function styleInject(css, ref) {\n if ( ref === void 0 ) ref = {};\n var insertAt = ref.insertAt;\n\n if (!css || typeof document === 'undefined') { return; }\n\n var head = document.head || document.getElementsByTagName('head')[0];\n var style = document.createElement('style');\n style.type = 'text/css';\n\n if (insertAt === 'top') {\n if (head.firstChild) {\n head.insertBefore(style, head.firstChild);\n } else {\n head.appendChild(style);\n }\n } else {\n head.appendChild(style);\n }\n\n if (style.styleSheet) {\n style.styleSheet.cssText = css;\n } else {\n style.appendChild(document.createTextNode(css));\n }\n}\n\nexport default styleInject;\n",null,null,null,null,null],"names":["styleInject","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","SUPERCOINS_CHIP_ICON","WALLET_CHIP_ICON","SUPERCOIN_ISLAND_RENDERED_FREQUENCY","SUPERCOIN_ISLAND_ANIMATION_PLAYED","SUPERCOIN_ISLAND_EXPIRATION_FREQUENCY","SUPERCOIN_EXPIRY_CONFIG","SUPERCOIN_FLOATING_ISLAND_CONFIG","requiredSupercoins","frequency","frequencyGapInDays","cutoffTimeInMs","isVisibleOnScroll","shouldRenderFloatingIsland","_a","expiry","renderFloatingIsland","supercoins","getQueryParam","localStorage","getItem","parseInt","getIslandShownFrequency","expiryEpoch","Math","floor","Date","now","removeItem","sessionStorage","incrementAnimationPlayedFrequency","currentFrequency","setItem","toString","SupercoinChip","supercoinBalance","_jsxs","className","styles","chipWrapper","children","_jsx","src","alt","width","height","__assign","chipTextWrapper","Typography","variant","textWrapper","WalletChip","walletBalance","WalletAnimation","handleClick","renderSupercoinPillOnAnimationEnd","wrapperAnimation","onClick","concat","pillContainer","LazySuperCoinsFloatingIsland","React","lazy","import","then","module","default","SupercoinsFloatingIsland","SupercoinsChip","supercoinsLoading","supercoinBurnBalance","_b","ravenPayload","onSupercoinsClick","supercoinsExpiryCount","_c","_d","walletEnabled","utmSource","useMemo","_e","useState","showSupercoinExpiryAnimation","setSupercoinExpiryAnimation","_f","animationCount","setAnimationCount","_g","isAnimating","setIsAnimating","_h","startWalletAnimation","setStartWalletAnimation","shouldRenderSupercoins","_j","renderSuperCoinIsland","setRenderSuperCoinIsland","_k","chipAnimationType","setChipAnimationType","_l","hasScrolledBeforeAnimation","setHasScrolledBeforeAnimation","chipBackgroundAnimationClassname","supercoinsBalanceBackgroundColorShift","supercoinsBalanceBackgroundColorShift_exit","chipTextAnimationClassname","supercoinsBalanceTextColorShift","supercoinsBalanceTextColorShift_exit","handleSupercoinsClick","action_event_name","impression_event_name","restPayload","__rest","ravenSDKTrigger","action_name","page_name","supercoin_balance","u_utm_source","useEffect","Number","handleScroll","window","scrollY","addEventListener","removeEventListener","timeout","shouldRender","setTimeout","clearTimeout","startTimer","switchBackTimer","newCount","supercoinsBalance","display","alignItems","gap","Shimmer","typographyVariant","chipClassName","supercoinsExpiryPill","expiryColorClass","supercoinBurnExpiryColor","position","supercoinChipWrapper","supercoinBurnTextAlign","join","supercoinExpiryText","supercoinExpiryAnimating","superCoinsFloatingIslandContainer","Suspense","fallback","superCoins","onAnimationStart","onIslandAnimationStart","onAnimationEnd"],"mappings":"mYAAA,SAASA,EAAYC,EAAKC,QACX,IAARA,IAAiBA,EAAM,CAAA,GAC5B,IAAIC,EAAWD,EAAIC,SAEnB,GAAKF,GAA2B,oBAAbG,SAAnB,CAEA,IAAIC,EAAOD,SAASC,MAAQD,SAASE,qBAAqB,QAAQ,GAC9DC,EAAQH,SAASI,cAAc,SACnCD,EA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B,QAGhDF,GACJ,CE6QgC4H,CAAuB,CACnBzI,WAAYqD,EACZE,aAAYA,EACZM,UAASA,KAGjB6E,eAlQxB,WACI3B,YAAW,WACHnD,GAAee,GAAwB,EAC9C,GAAE,KACHO,GAAqB,OACxB,aAoQL","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleartrip/ct-platform-supercoins-chip",
|
|
3
|
-
"version": "2.2.0-beta.
|
|
3
|
+
"version": "2.2.0-beta.18",
|
|
4
4
|
"description": "SuperCoins Chip Component",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/ct-platform-supercoins-chip.cjs.js",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
13
|
"@cleartrip/ct-design-typography": "2.6.0",
|
|
14
|
-
"@cleartrip/ct-platform-shimmer": "4.2.0-beta.
|
|
15
|
-
"@cleartrip/ct-platform-utils": "4.2.0-beta.
|
|
16
|
-
"@cleartrip/ct-platform-supercoins-floating-island": "2.2.0-beta.
|
|
14
|
+
"@cleartrip/ct-platform-shimmer": "4.2.0-beta.18",
|
|
15
|
+
"@cleartrip/ct-platform-utils": "4.2.0-beta.18",
|
|
16
|
+
"@cleartrip/ct-platform-supercoins-floating-island": "2.2.0-beta.18"
|
|
17
17
|
},
|
|
18
18
|
"peerDependencies": {
|
|
19
19
|
"react": ">=16.8.0",
|