@cleartrip/ct-platform-timer-widget 1.4.0-beta.1 → 1.6.0-beta.0
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
|
-
{"version":3,"file":"TimerWidget.d.ts","sourceRoot":"","sources":["../packages/components/TimerWidget/src/TimerWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAoBzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"TimerWidget.d.ts","sourceRoot":"","sources":["../packages/components/TimerWidget/src/TimerWidget.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAC;AAoBzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAEvD,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA8O3C,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),t=require("react-countdown"),l=require("@cleartrip/ct-platform-lazy-image"),o=require("@cleartrip/ct-platform-io-hoc"),a=require("@cleartrip/ct-platform-constants"),r=require("@cleartrip/ct-platform-utils");function s(e){return e&&e.__esModule?e:{default:e}}var d=s(t),c={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",fontSize:"24px",fontWeight:"500",width:"60px",height:"72px",backgroundColor:"#fff",color:"#1a1a1a",border:"1px solid #1a1a1a",borderRadius:"8px"},u={fontSize:"32px",fontWeight:"500",fontFamily:"Inter"},m={position:"absolute",width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"end",alignItems:"center",bottom:"24px",fontFamily:"Inter, Arial, sans-serif"},g=function(e,i,n){var t={position:"relative"};return e||Object.assign(t,{width:"100%",height:"100%",backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundImage:"url(".concat(i,")"),paddingBottom:"".concat(n,"%")}),t};var _="index-module_timer-bg-image__be1qA",p="index-module_timer-container__8bcOe",h="index-module_timer-box__U7pgT",x="index-module_timer-separator__7Ga7U",v="index-module_timer-button__ZGHD-",f="index-module_placeholder__5zI9P",b="index-module_header-ph-img__CCrxL",j="index-module_content-ph-img__A20jD",y="index-module_placeholder-img-wrapper__mcqYX";!function(e,i){void 0===i&&(i={});var n=i.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===n&&t.firstChild?t.insertBefore(l,t.firstChild):t.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}(".index-module_timer-bg-image__be1qA{background-position:50%;background-repeat:no-repeat;background-size:cover;height:100%;position:relative;width:100%}.index-module_timer-content__p9q7H{align-items:center;bottom:24px;display:flex;flex-direction:column;font-family:Inter,Arial,sans-serif;height:100%;justify-content:end;position:absolute;width:100%}.index-module_timer-container__8bcOe{align-items:center;display:flex;width:calc(100% - 32px)}.index-module_timer-box__U7pgT{align-items:center;background-color:#fff;border:1px solid #1a1a1a;border-radius:8px;color:#1a1a1a;display:flex;flex-direction:column;font-size:24px;font-weight:500;height:72px;justify-content:center;width:60px}.index-module_timer-box__U7pgT>span:nth-child(2){font-size:12px;padding-top:4px}.index-module_timer-separator__7Ga7U{font-family:Inter!important;font-size:32px;font-weight:500}.index-module_timer-button__ZGHD-{background-color:#1a1a1a;border-radius:8px;color:#fff;font-size:14px;font-weight:600;height:40px;margin-top:16px;width:calc(100% - 32px)}.index-module_placeholder__5zI9P{padding:8px}.index-module_header-ph-img__CCrxL{height:50%;width:auto}.index-module_content-ph-img__A20jD{height:15%;position:absolute;top:40%;width:auto}.index-module_placeholder-img-wrapper__mcqYX{align-items:center;background:#fef5f2;border-radius:8px;display:flex;height:100%;justify-content:center;position:relative;width:100%}");exports.TimerWidget=function(t){var s,C,w,I,N=t.headerImg,S=t.widgetData,k=t.lazyWidget,A=void 0===k||k,q=t.onItemView,z=t.onItemClick,D=t.onItemImpression,T=t.styleConfig,U=t.renderItem,F=n.useState(!A),H=F[0],
|
|
1
|
+
"use strict";var e=require("tslib"),i=require("react/jsx-runtime"),n=require("react"),t=require("react-countdown"),l=require("@cleartrip/ct-platform-lazy-image"),o=require("@cleartrip/ct-platform-io-hoc"),a=require("@cleartrip/ct-platform-constants"),r=require("@cleartrip/ct-platform-utils");function s(e){return e&&e.__esModule?e:{default:e}}var d=s(t),c={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",fontSize:"24px",fontWeight:"500",width:"60px",height:"72px",backgroundColor:"#fff",color:"#1a1a1a",border:"1px solid #1a1a1a",borderRadius:"8px"},u={fontSize:"32px",fontWeight:"500",fontFamily:"Inter"},m={position:"absolute",width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"end",alignItems:"center",bottom:"24px",fontFamily:"Inter, Arial, sans-serif"},g=function(e,i,n){var t={position:"relative"};return e||Object.assign(t,{width:"100%",height:"100%",backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundImage:"url(".concat(i,")"),paddingBottom:"".concat(n,"%")}),t};var _="index-module_timer-bg-image__be1qA",p="index-module_timer-container__8bcOe",h="index-module_timer-box__U7pgT",x="index-module_timer-separator__7Ga7U",v="index-module_timer-button__ZGHD-",f="index-module_placeholder__5zI9P",b="index-module_header-ph-img__CCrxL",j="index-module_content-ph-img__A20jD",y="index-module_placeholder-img-wrapper__mcqYX";!function(e,i){void 0===i&&(i={});var n=i.insertAt;if(e&&"undefined"!=typeof document){var t=document.head||document.getElementsByTagName("head")[0],l=document.createElement("style");l.type="text/css","top"===n&&t.firstChild?t.insertBefore(l,t.firstChild):t.appendChild(l),l.styleSheet?l.styleSheet.cssText=e:l.appendChild(document.createTextNode(e))}}(".index-module_timer-bg-image__be1qA{background-position:50%;background-repeat:no-repeat;background-size:cover;height:100%;position:relative;width:100%}.index-module_timer-content__p9q7H{align-items:center;bottom:24px;display:flex;flex-direction:column;font-family:Inter,Arial,sans-serif;height:100%;justify-content:end;position:absolute;width:100%}.index-module_timer-container__8bcOe{align-items:center;display:flex;width:calc(100% - 32px)}.index-module_timer-box__U7pgT{align-items:center;background-color:#fff;border:1px solid #1a1a1a;border-radius:8px;color:#1a1a1a;display:flex;flex-direction:column;font-size:24px;font-weight:500;height:72px;justify-content:center;width:60px}.index-module_timer-box__U7pgT>span:nth-child(2){font-size:12px;padding-top:4px}.index-module_timer-separator__7Ga7U{font-family:Inter!important;font-size:32px;font-weight:500}.index-module_timer-button__ZGHD-{background-color:#1a1a1a;border-radius:8px;color:#fff;font-size:14px;font-weight:600;height:40px;margin-top:16px;width:calc(100% - 32px)}.index-module_placeholder__5zI9P{padding:8px}.index-module_header-ph-img__CCrxL{height:50%;width:auto}.index-module_content-ph-img__A20jD{height:15%;position:absolute;top:40%;width:auto}.index-module_placeholder-img-wrapper__mcqYX{align-items:center;background:#fef5f2;border-radius:8px;display:flex;height:100%;justify-content:center;position:relative;width:100%}");exports.TimerWidget=function(t){var s,C,w,I,N=t.headerImg,S=t.widgetData,k=t.lazyWidget,A=void 0===k||k,q=t.onItemView,z=t.onItemClick,D=t.onItemImpression,T=t.styleConfig,U=t.renderItem;console.log(S,"Widget Data from Timer Component");var F=n.useState(!A),H=F[0],W=F[1],O=n.useState(A),L=O[0],B=O[1],E=n.useMemo((function(){var e;return r.getDimensionFromImageUrl(null===(e=null==S?void 0:S.image)||void 0===e?void 0:e.url)}),[null===(s=null==S?void 0:S.image)||void 0===s?void 0:s.url]),G=E.heightInNumber,M=E.widthInNumber,P=n.useState(G/M*100),R=P[0],Y=P[1],X=n.useMemo((function(){return r.getDimensionFromImageUrl(N).height}),[N]);n.useEffect((function(){var e;Z(null===(e=null==S?void 0:S.image)||void 0===e?void 0:e.url)}),[]);var Z=n.useCallback((function(e){if(e){var i=new Image;i.src=e,i.onload=function(){!U&&Y(i.height/i.width*100),B(!1)}}}),[]),V=n.useCallback((function(n){var t=n.days,l=n.hours,o=n.minutes,a=n.seconds;return i.jsxs("div",e.__assign({className:p,style:e.__assign({display:"flex",alignItems:"center",width:"calc(100% - 32px)"},t>0?{justifyContent:"space-between"}:{justifyContent:"center",gap:"8px"})},{children:[t>0&&i.jsxs(i.Fragment,{children:[i.jsxs("div",e.__assign({style:c,className:h},{children:[i.jsx("span",{children:String(t).padStart(2,"0")}),i.jsx("span",{children:"DAYS"})]})),i.jsx("div",e.__assign({className:x,style:e.__assign(e.__assign({},u),{color:(null==S?void 0:S.colonColor)?"".concat(S.colonColor):"#1A1A1A"})},{children:":"}))]}),i.jsxs("div",e.__assign({style:c,className:h},{children:[i.jsx("span",{children:String(l).padStart(2,"0")}),i.jsx("span",{children:"HRS"})]})),i.jsx("div",e.__assign({className:x,style:e.__assign(e.__assign({},u),{color:(null==S?void 0:S.colonColor)?"".concat(S.colonColor):"#1A1A1A"})},{children:":"})),i.jsxs("div",e.__assign({style:c,className:h},{children:[i.jsx("span",{children:String(o).padStart(2,"0")}),i.jsx("span",{children:"MINS"})]})),i.jsx("div",e.__assign({className:x,style:e.__assign(e.__assign({},u),{color:(null==S?void 0:S.colonColor)?"".concat(S.colonColor):"#1A1A1A"})},{children:":"})),i.jsxs("div",e.__assign({style:c,className:h},{children:[i.jsx("span",{children:String(a).padStart(2,"0")}),i.jsx("span",{children:"SECS"})]}))]}))}),[]),J=n.useCallback((function(e){var i,n;z&&(null==S?void 0:S.label)&&(null===(i=null==S?void 0:S.image)||void 0===i?void 0:i.url)&&z(null==S?void 0:S.label,null===(n=null==S?void 0:S.image)||void 0===n?void 0:n.url),window.location.href=e}),[z]),K=n.useCallback((function(){var e;q&&q(null==S?void 0:S.label,null===(e=null==S?void 0:S.image)||void 0===e?void 0:e.url)}),[S,q]),Q=n.useCallback((function(){var e;A&&W(!0),D&&D(null==S?void 0:S.label,null===(e=null==S?void 0:S.image)||void 0===e?void 0:e.url)}),[S,D]),$=n.useCallback((function(){var n,t=r.getHeightFromImgUrl(null===(n=null==S?void 0:S.image)||void 0===n?void 0:n.url)||180;return i.jsxs("div",{children:[N&&i.jsx("div",e.__assign({className:f,style:{height:X}},{children:i.jsx("div",e.__assign({className:y},{children:i.jsx("img",{src:a.placeholderLogo,className:b})}))})),i.jsx("div",e.__assign({className:f,style:{minHeight:"".concat(t,"px")}},{children:i.jsx("div",e.__assign({className:y,style:{paddingBottom:"".concat(R,"%")}},{children:i.jsx("img",{src:a.placeholderLogo,className:j})}))}))]})}),[N,S,R]);return i.jsx(o.IntersectionObserverHOC,e.__assign({onIntersection:Q,onTimedObservationComplete:K},{children:H?i.jsxs("div",{children:[N&&i.jsx(l.LazyImage,{src:N,style:{width:"100%",height:X}}),!L&&i.jsxs("div",e.__assign({className:_,style:e.__assign(e.__assign({},g(!!U,null===(C=null==S?void 0:S.image)||void 0===C?void 0:C.url,R)),null==T?void 0:T.timerWidgetImageWrapper),onClick:function(){var e;return J(null===(e=null==S?void 0:S.cta)||void 0===e?void 0:e.targetUrl)}},{children:[null==U?void 0:U(),i.jsxs("div",e.__assign({style:m},{children:[i.jsx(d.default,{date:null==S?void 0:S.endTime,renderer:V}),(null===(w=null==S?void 0:S.cta)||void 0===w?void 0:w.title)&&i.jsx("button",e.__assign({className:v},{children:null===(I=null==S?void 0:S.cta)||void 0===I?void 0:I.title}))]}))]}),null==S?void 0:S.label)]}):i.jsx(i.Fragment,{children:$()})}))};
|
|
2
2
|
//# sourceMappingURL=ct-platform-timer-widget.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-platform-timer-widget.cjs.js","sources":["../packages/components/TimerWidget/src/utils.ts","../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/TimerWidget/src/TimerWidget.tsx"],"sourcesContent":[null,"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],"names":["TIME_BOX_STYLES","display","flexDirection","alignItems","justifyContent","fontSize","fontWeight","width","height","backgroundColor","color","border","borderRadius","TIME_SEPARATOR_STYLES","fontFamily","TIMER_CONTENT_STYLES","position","bottom","getImageStyle","isRenderImage","imgUrl","aspectRatio","styles","Object","assign","backgroundSize","backgroundRepeat","backgroundPosition","backgroundImage","concat","paddingBottom","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","_a","headerImg","widgetData","_f","lazyWidget","onItemView","onItemClick","onItemImpression","styleConfig","renderItem","_g","useState","visible","setVisible","_h","isLoading","setIsLoading","_j","useMemo","getDimensionFromImageUrl","image","url","_b","heightInNumber","widthInNumber","_k","setAspectRatio","headerImageHeight","useEffect","calculateAspectRatio","useCallback","imageUrl","image_1","Image","src","onload","renderCountdown","days","hours","minutes","seconds","_jsxs","jsxs","__assign","className","gap","children","_Fragment","Fragment","_jsx","jsx","String","padStart","colonColor","handleClick","label","window","location","href","handleView","handleIntersection","showPlaceholders","contentImgHeight","getHeightFromImgUrl","placeholderLogo","minHeight","IntersectionObserverHOC","onIntersection","onTimedObservationComplete","LazyImage","_c","timerWidgetImageWrapper","onClick","cta","targetUrl","Countdown","default","date","endTime","renderer","_d","title","_e"],"mappings":"mWAKaA,EAAiC,CAC1CC,QAAS,OACTC,cAAe,SACfC,WAAY,SACZC,eAAgB,SAChBC,SAAU,OACVC,WAAY,MACZC,MAAO,OACPC,OAAQ,OACRC,gBAAiB,OACjBC,MAAO,UACPC,OAAQ,oBACRC,aAAc,OAGLC,EAAwC,CACjDR,SAAU,OACVC,WAAY,MACZQ,WAAY,SAGHC,EAAuC,CAChDC,SAAU,WACVT,MAAO,OACPC,OAAQ,OACRP,QAAS,OACTC,cAAe,SACfE,eAAgB,MAChBD,WAAY,SACZc,OAAQ,OACRH,WAAY,4BAWHI,EAAgB,SACzBC,EACAC,EACAC,GAEA,IAAMC,EAAwB,CAC1BN,SAAU,YAcd,OAXKG,GACDI,OAAOC,OAAOF,EAAQ,CAClBf,MAAO,OACPC,OAAQ,OACRiB,eAAgB,QAChBC,iBAAkB,YAClBC,mBAAoB,SACpBC,gBAAiB,OAAOC,OAAAT,EAAS,KACjCU,cAAe,GAAGD,OAAAR,EAAc,OAGjCC,CACX,sWCnEA,SAAqBS,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,24CCHgD,SAACe,eAC7CC,EAASD,EAAAC,UACTC,EAAUF,EAAAE,WACVC,eAAAC,OAAa,IAAAD,GAAIA,EACjBE,EAAUL,EAAAK,WACVC,EAAWN,EAAAM,YACXC,EAAgBP,EAAAO,iBAChBC,EAAWR,EAAAQ,YACXC,EAAUT,EAAAS,
|
|
1
|
+
{"version":3,"file":"ct-platform-timer-widget.cjs.js","sources":["../packages/components/TimerWidget/src/utils.ts","../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/TimerWidget/src/TimerWidget.tsx"],"sourcesContent":[null,"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],"names":["TIME_BOX_STYLES","display","flexDirection","alignItems","justifyContent","fontSize","fontWeight","width","height","backgroundColor","color","border","borderRadius","TIME_SEPARATOR_STYLES","fontFamily","TIMER_CONTENT_STYLES","position","bottom","getImageStyle","isRenderImage","imgUrl","aspectRatio","styles","Object","assign","backgroundSize","backgroundRepeat","backgroundPosition","backgroundImage","concat","paddingBottom","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","_a","headerImg","widgetData","_f","lazyWidget","onItemView","onItemClick","onItemImpression","styleConfig","renderItem","console","log","_g","useState","visible","setVisible","_h","isLoading","setIsLoading","_j","useMemo","getDimensionFromImageUrl","image","url","_b","heightInNumber","widthInNumber","_k","setAspectRatio","headerImageHeight","useEffect","calculateAspectRatio","useCallback","imageUrl","image_1","Image","src","onload","renderCountdown","days","hours","minutes","seconds","_jsxs","jsxs","__assign","className","gap","children","_Fragment","Fragment","_jsx","jsx","String","padStart","colonColor","handleClick","label","window","location","href","handleView","handleIntersection","showPlaceholders","contentImgHeight","getHeightFromImgUrl","placeholderLogo","minHeight","IntersectionObserverHOC","onIntersection","onTimedObservationComplete","LazyImage","_c","timerWidgetImageWrapper","onClick","cta","targetUrl","Countdown","default","date","endTime","renderer","_d","title","_e"],"mapp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eAAAA,EAAYyE,WAAK,IAAAS,OAAA,EAAAA,EAAAD,gBAtBzBjF,aAAA,EAAAA,EAAYuD,UA8B7BN,EAAAA,IAAGF,EAAAC,SAAA,CAAAF,SAAAe,QAInB","x_google_ignoreList":[1]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{__assign as e}from"tslib";import{jsxs as i,Fragment as t,jsx as n}from"react/jsx-runtime";import{useState as o,useMemo as l,useEffect as r,useCallback as d}from"react";import a from"react-countdown";import{LazyImage as c}from"@cleartrip/ct-platform-lazy-image";import{IntersectionObserverHOC as s}from"@cleartrip/ct-platform-io-hoc";import{placeholderLogo as m}from"@cleartrip/ct-platform-constants";import{getDimensionFromImageUrl as u,getHeightFromImgUrl as p}from"@cleartrip/ct-platform-utils";var h={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",fontSize:"24px",fontWeight:"500",width:"60px",height:"72px",backgroundColor:"#fff",color:"#1a1a1a",border:"1px solid #1a1a1a",borderRadius:"8px"},v={fontSize:"32px",fontWeight:"500",fontFamily:"Inter"},g={position:"absolute",width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"end",alignItems:"center",bottom:"24px",fontFamily:"Inter, Arial, sans-serif"},f=function(e,i,t){var n={position:"relative"};return e||Object.assign(n,{width:"100%",height:"100%",backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundImage:"url(".concat(i,")"),paddingBottom:"".concat(t,"%")}),n};var x="index-module_timer-bg-image__be1qA",_="index-module_timer-container__8bcOe",b="index-module_timer-box__U7pgT",y="index-module_timer-separator__7Ga7U",w="index-module_timer-button__ZGHD-",C="index-module_placeholder__5zI9P",I="index-module_header-ph-img__CCrxL",N="index-module_content-ph-img__A20jD",S="index-module_placeholder-img-wrapper__mcqYX";!function(e,i){void 0===i&&(i={});var t=i.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".index-module_timer-bg-image__be1qA{background-position:50%;background-repeat:no-repeat;background-size:cover;height:100%;position:relative;width:100%}.index-module_timer-content__p9q7H{align-items:center;bottom:24px;display:flex;flex-direction:column;font-family:Inter,Arial,sans-serif;height:100%;justify-content:end;position:absolute;width:100%}.index-module_timer-container__8bcOe{align-items:center;display:flex;width:calc(100% - 32px)}.index-module_timer-box__U7pgT{align-items:center;background-color:#fff;border:1px solid #1a1a1a;border-radius:8px;color:#1a1a1a;display:flex;flex-direction:column;font-size:24px;font-weight:500;height:72px;justify-content:center;width:60px}.index-module_timer-box__U7pgT>span:nth-child(2){font-size:12px;padding-top:4px}.index-module_timer-separator__7Ga7U{font-family:Inter!important;font-size:32px;font-weight:500}.index-module_timer-button__ZGHD-{background-color:#1a1a1a;border-radius:8px;color:#fff;font-size:14px;font-weight:600;height:40px;margin-top:16px;width:calc(100% - 32px)}.index-module_placeholder__5zI9P{padding:8px}.index-module_header-ph-img__CCrxL{height:50%;width:auto}.index-module_content-ph-img__A20jD{height:15%;position:absolute;top:40%;width:auto}.index-module_placeholder-img-wrapper__mcqYX{align-items:center;background:#fef5f2;border-radius:8px;display:flex;height:100%;justify-content:center;position:relative;width:100%}");var A=function(A){var k,z,j,D,T=A.headerImg,U=A.widgetData,
|
|
1
|
+
import{__assign as e}from"tslib";import{jsxs as i,Fragment as t,jsx as n}from"react/jsx-runtime";import{useState as o,useMemo as l,useEffect as r,useCallback as d}from"react";import a from"react-countdown";import{LazyImage as c}from"@cleartrip/ct-platform-lazy-image";import{IntersectionObserverHOC as s}from"@cleartrip/ct-platform-io-hoc";import{placeholderLogo as m}from"@cleartrip/ct-platform-constants";import{getDimensionFromImageUrl as u,getHeightFromImgUrl as p}from"@cleartrip/ct-platform-utils";var h={display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",fontSize:"24px",fontWeight:"500",width:"60px",height:"72px",backgroundColor:"#fff",color:"#1a1a1a",border:"1px solid #1a1a1a",borderRadius:"8px"},v={fontSize:"32px",fontWeight:"500",fontFamily:"Inter"},g={position:"absolute",width:"100%",height:"100%",display:"flex",flexDirection:"column",justifyContent:"end",alignItems:"center",bottom:"24px",fontFamily:"Inter, Arial, sans-serif"},f=function(e,i,t){var n={position:"relative"};return e||Object.assign(n,{width:"100%",height:"100%",backgroundSize:"cover",backgroundRepeat:"no-repeat",backgroundPosition:"center",backgroundImage:"url(".concat(i,")"),paddingBottom:"".concat(t,"%")}),n};var x="index-module_timer-bg-image__be1qA",_="index-module_timer-container__8bcOe",b="index-module_timer-box__U7pgT",y="index-module_timer-separator__7Ga7U",w="index-module_timer-button__ZGHD-",C="index-module_placeholder__5zI9P",I="index-module_header-ph-img__CCrxL",N="index-module_content-ph-img__A20jD",S="index-module_placeholder-img-wrapper__mcqYX";!function(e,i){void 0===i&&(i={});var t=i.insertAt;if(e&&"undefined"!=typeof document){var n=document.head||document.getElementsByTagName("head")[0],o=document.createElement("style");o.type="text/css","top"===t&&n.firstChild?n.insertBefore(o,n.firstChild):n.appendChild(o),o.styleSheet?o.styleSheet.cssText=e:o.appendChild(document.createTextNode(e))}}(".index-module_timer-bg-image__be1qA{background-position:50%;background-repeat:no-repeat;background-size:cover;height:100%;position:relative;width:100%}.index-module_timer-content__p9q7H{align-items:center;bottom:24px;display:flex;flex-direction:column;font-family:Inter,Arial,sans-serif;height:100%;justify-content:end;position:absolute;width:100%}.index-module_timer-container__8bcOe{align-items:center;display:flex;width:calc(100% - 32px)}.index-module_timer-box__U7pgT{align-items:center;background-color:#fff;border:1px solid #1a1a1a;border-radius:8px;color:#1a1a1a;display:flex;flex-direction:column;font-size:24px;font-weight:500;height:72px;justify-content:center;width:60px}.index-module_timer-box__U7pgT>span:nth-child(2){font-size:12px;padding-top:4px}.index-module_timer-separator__7Ga7U{font-family:Inter!important;font-size:32px;font-weight:500}.index-module_timer-button__ZGHD-{background-color:#1a1a1a;border-radius:8px;color:#fff;font-size:14px;font-weight:600;height:40px;margin-top:16px;width:calc(100% - 32px)}.index-module_placeholder__5zI9P{padding:8px}.index-module_header-ph-img__CCrxL{height:50%;width:auto}.index-module_content-ph-img__A20jD{height:15%;position:absolute;top:40%;width:auto}.index-module_placeholder-img-wrapper__mcqYX{align-items:center;background:#fef5f2;border-radius:8px;display:flex;height:100%;justify-content:center;position:relative;width:100%}");var A=function(A){var k,z,j,D,T=A.headerImg,U=A.widgetData,W=A.lazyWidget,q=void 0===W||W,H=A.onItemView,B=A.onItemClick,G=A.onItemImpression,O=A.styleConfig,E=A.renderItem;console.log(U,"Widget Data from Timer Component");var P=o(!q),R=P[0],Y=P[1],F=o(q),L=F[0],X=F[1],Z=l((function(){var e;return u(null===(e=null==U?void 0:U.image)||void 0===e?void 0:e.url)}),[null===(k=null==U?void 0:U.image)||void 0===k?void 0:k.url]),M=Z.heightInNumber,V=Z.widthInNumber,J=o(M/V*100),K=J[0],Q=J[1],$=l((function(){return u(T).height}),[T]);r((function(){var e;ee(null===(e=null==U?void 0:U.image)||void 0===e?void 0:e.url)}),[]);var ee=d((function(e){if(e){var i=new Image;i.src=e,i.onload=function(){!E&&Q(i.height/i.width*100),X(!1)}}}),[]),ie=d((function(o){var l=o.days,r=o.hours,d=o.minutes,a=o.seconds;return i("div",e({className:_,style:e({display:"flex",alignItems:"center",width:"calc(100% - 32px)"},l>0?{justifyContent:"space-between"}:{justifyContent:"center",gap:"8px"})},{children:[l>0&&i(t,{children:[i("div",e({style:h,className:b},{children:[n("span",{children:String(l).padStart(2,"0")}),n("span",{children:"DAYS"})]})),n("div",e({className:y,style:e(e({},v),{color:(null==U?void 0:U.colonColor)?"".concat(U.colonColor):"#1A1A1A"})},{children:":"}))]}),i("div",e({style:h,className:b},{children:[n("span",{children:String(r).padStart(2,"0")}),n("span",{children:"HRS"})]})),n("div",e({className:y,style:e(e({},v),{color:(null==U?void 0:U.colonColor)?"".concat(U.colonColor):"#1A1A1A"})},{children:":"})),i("div",e({style:h,className:b},{children:[n("span",{children:String(d).padStart(2,"0")}),n("span",{children:"MINS"})]})),n("div",e({className:y,style:e(e({},v),{color:(null==U?void 0:U.colonColor)?"".concat(U.colonColor):"#1A1A1A"})},{children:":"})),i("div",e({style:h,className:b},{children:[n("span",{children:String(a).padStart(2,"0")}),n("span",{children:"SECS"})]}))]}))}),[]),te=d((function(e){var i,t;B&&(null==U?void 0:U.label)&&(null===(i=null==U?void 0:U.image)||void 0===i?void 0:i.url)&&B(null==U?void 0:U.label,null===(t=null==U?void 0:U.image)||void 0===t?void 0:t.url),window.location.href=e}),[B]),ne=d((function(){var e;H&&H(null==U?void 0:U.label,null===(e=null==U?void 0:U.image)||void 0===e?void 0:e.url)}),[U,H]),oe=d((function(){var e;q&&Y(!0),G&&G(null==U?void 0:U.label,null===(e=null==U?void 0:U.image)||void 0===e?void 0:e.url)}),[U,G]),le=d((function(){var t,o=p(null===(t=null==U?void 0:U.image)||void 0===t?void 0:t.url)||180;return i("div",{children:[T&&n("div",e({className:C,style:{height:$}},{children:n("div",e({className:S},{children:n("img",{src:m,className:I})}))})),n("div",e({className:C,style:{minHeight:"".concat(o,"px")}},{children:n("div",e({className:S,style:{paddingBottom:"".concat(K,"%")}},{children:n("img",{src:m,className:N})}))}))]})}),[T,U,K]);return n(s,e({onIntersection:oe,onTimedObservationComplete:ne},{children:R?i("div",{children:[T&&n(c,{src:T,style:{width:"100%",height:$}}),!L&&i("div",e({className:x,style:e(e({},f(!!E,null===(z=null==U?void 0:U.image)||void 0===z?void 0:z.url,K)),null==O?void 0:O.timerWidgetImageWrapper),onClick:function(){var e;return te(null===(e=null==U?void 0:U.cta)||void 0===e?void 0:e.targetUrl)}},{children:[null==E?void 0:E(),i("div",e({style:g},{children:[n(a,{date:null==U?void 0:U.endTime,renderer:ie}),(null===(j=null==U?void 0:U.cta)||void 0===j?void 0:j.title)&&n("button",e({className:w},{children:null===(D=null==U?void 0:U.cta)||void 0===D?void 0:D.title}))]}))]}),null==U?void 0:U.label)]}):n(t,{children:le()})}))};export{A as TimerWidget};
|
|
2
2
|
//# sourceMappingURL=ct-platform-timer-widget.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-platform-timer-widget.esm.js","sources":["../packages/components/TimerWidget/src/utils.ts","../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/TimerWidget/src/TimerWidget.tsx"],"sourcesContent":[null,"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],"names":["TIME_BOX_STYLES","display","flexDirection","alignItems","justifyContent","fontSize","fontWeight","width","height","backgroundColor","color","border","borderRadius","TIME_SEPARATOR_STYLES","fontFamily","TIMER_CONTENT_STYLES","position","bottom","getImageStyle","isRenderImage","imgUrl","aspectRatio","styles","Object","assign","backgroundSize","backgroundRepeat","backgroundPosition","backgroundImage","concat","paddingBottom","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","TimerWidget","_a","headerImg","widgetData","_f","lazyWidget","onItemView","onItemClick","onItemImpression","styleConfig","renderItem","_g","useState","visible","setVisible","_h","isLoading","setIsLoading","_j","useMemo","getDimensionFromImageUrl","image","url","_b","heightInNumber","widthInNumber","_k","setAspectRatio","headerImageHeight","useEffect","calculateAspectRatio","useCallback","imageUrl","image_1","Image","src","onload","renderCountdown","days","hours","minutes","seconds","_jsxs","__assign","className","gap","children","_Fragment","_jsx","String","padStart","colonColor","handleClick","label","window","location","href","handleView","handleIntersection","showPlaceholders","contentImgHeight","getHeightFromImgUrl","placeholderLogo","minHeight","IntersectionObserverHOC","onIntersection","onTimedObservationComplete","LazyImage","_c","timerWidgetImageWrapper","onClick","cta","targetUrl","Countdown","date","endTime","renderer","_d","title","_e"],"mappings":"wfAKO,IAAMA,EAAiC,CAC1CC,QAAS,OACTC,cAAe,SACfC,WAAY,SACZC,eAAgB,SAChBC,SAAU,OACVC,WAAY,MACZC,MAAO,OACPC,OAAQ,OACRC,gBAAiB,OACjBC,MAAO,UACPC,OAAQ,oBACRC,aAAc,OAGLC,EAAwC,CACjDR,SAAU,OACVC,WAAY,MACZQ,WAAY,SAGHC,EAAuC,CAChDC,SAAU,WACVT,MAAO,OACPC,OAAQ,OACRP,QAAS,OACTC,cAAe,SACfE,eAAgB,MAChBD,WAAY,SACZc,OAAQ,OACRH,WAAY,4BAWHI,EAAgB,SACzBC,EACAC,EACAC,GAEA,IAAMC,EAAwB,CAC1BN,SAAU,YAcd,OAXKG,GACDI,OAAOC,OAAOF,EAAQ,CAClBf,MAAO,OACPC,OAAQ,OACRiB,eAAgB,QAChBC,iBAAkB,YAClBC,mBAAoB,SACpBC,gBAAiB,OAAOC,OAAAT,EAAS,KACjCU,cAAe,GAAGD,OAAAR,EAAc,OAGjCC,CACX,sWCnEA,SAAqBS,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,u3CCHM,IAAAe,EAA0C,SAACC,eAC7CC,EAASD,EAAAC,UACTC,EAAUF,EAAAE,WACVC,eAAAC,OAAa,IAAAD,GAAIA,EACjBE,EAAUL,EAAAK,WACVC,EAAWN,EAAAM,YACXC,EAAgBP,EAAAO,iBAChBC,EAAWR,EAAAQ,YACXC,EAAUT,EAAAS,
|
|
1
|
+
{"version":3,"file":"ct-platform-timer-widget.esm.js","sources":["../packages/components/TimerWidget/src/utils.ts","../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/TimerWidget/src/TimerWidget.tsx"],"sourcesContent":[null,"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],"names":["TIME_BOX_STYLES","display","flexDirection","alignItems","justifyContent","fontSize","fontWeight","width","height","backgroundColor","color","border","borderRadius","TIME_SEPARATOR_STYLES","fontFamily","TIMER_CONTENT_STYLES","position","bottom","getImageStyle","isRenderImage","imgUrl","aspectRatio","styles","Object","assign","backgroundSize","backgroundRepeat","backgroundPosition","backgroundImage","concat","paddingBottom","css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","TimerWidget","_a","headerImg","widgetData","_f","lazyWidget","onItemView","onItemClick","onItemImpression","styleConfig","renderItem","console","log","_g","useState","visible","setVisible","_h","isLoading","setIsLoading","_j","useMemo","getDimensionFromImageUrl","image","url","_b","heightInNumber","widthInNumber","_k","setAspectRatio","headerImageHeight","useEffect","calculateAspectRatio","useCallback","imageUrl","image_1","Image","src","onload","renderCountdown","days","hours","minutes","seconds","_jsxs","__assign","className","gap","children","_Fragment","_jsx","String","padStart","colonColor","handleClick","label","window","location","href","handleView","handleIntersection","showPlaceholders","contentImgHeight","getHeightFromImgUrl","placeholderLogo","minHeight","IntersectionObserverHOC","onIntersection","onTimedObservationComplete","LazyImage","_c","timerWidgetImageWrapper","onClick","cta","targetUrl","Countdown","date","endTime","renderer","_d","title","_e"],"mappings":"wfAKO,IAAMA,EAAiC,CAC1CC,QAAS,OACTC,cAAe,SACfC,WAAY,SACZC,eAAgB,SAChBC,SAAU,OACVC,WAAY,MACZC,MAAO,OACPC,OAAQ,OACRC,gBAAiB,OACjBC,MAAO,UACPC,OAAQ,oBACRC,aAAc,OAGLC,EAAwC,CACjDR,SAAU,OACVC,WAAY,MACZQ,WAAY,SAGHC,EAAuC,CAChDC,SAAU,WACVT,MAAO,OACPC,OAAQ,OACRP,QAAS,OACTC,cAAe,SACfE,eAAgB,MAChBD,WAAY,SACZc,OAAQ,OACRH,WAAY,4BAWHI,EAAgB,SACzBC,EACAC,EACAC,GAEA,IAAMC,EAAwB,CAC1BN,SAAU,YAcd,OAXKG,GACDI,OAAOC,OAAOF,EAAQ,CAClBf,MAAO,OACPC,OAAQ,OACRiB,eAAgB,QAChBC,iBAAkB,YAClBC,mBAAoB,SACpBC,gBAAiB,OAAOC,OAAAT,EAAS,KACjCU,cAAe,GAAGD,OAAAR,EAAc,OAGjCC,CACX,sWCnEA,SAAqBS,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,YAA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