@cleartrip/ct-platform-banner 1.0.0-beta.4 → 1.0.0-beta.5
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,133 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
var tslib = require('tslib');
|
|
4
|
-
var jsxRuntime = require('react/jsx-runtime');
|
|
5
|
-
var react = require('react');
|
|
6
|
-
var ctPlatformAssets = require('@cleartrip/ct-platform-assets');
|
|
7
|
-
|
|
8
|
-
function styleInject(css, ref) {
|
|
9
|
-
if (ref === void 0) ref = {};
|
|
10
|
-
var insertAt = ref.insertAt;
|
|
11
|
-
if (!css || typeof document === 'undefined') {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
15
|
-
var style = document.createElement('style');
|
|
16
|
-
style.type = 'text/css';
|
|
17
|
-
if (insertAt === 'top') {
|
|
18
|
-
if (head.firstChild) {
|
|
19
|
-
head.insertBefore(style, head.firstChild);
|
|
20
|
-
} else {
|
|
21
|
-
head.appendChild(style);
|
|
22
|
-
}
|
|
23
|
-
} else {
|
|
24
|
-
head.appendChild(style);
|
|
25
|
-
}
|
|
26
|
-
if (style.styleSheet) {
|
|
27
|
-
style.styleSheet.cssText = css;
|
|
28
|
-
} else {
|
|
29
|
-
style.appendChild(document.createTextNode(css));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
var css_248z = ".ct-banner{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Ubuntu,Arial,sans-serif}.ct-banner .m-0{margin:0!important}.ct-banner .ml-4{margin-left:4px!important}.ct-banner .mb-5{margin-bottom:5px!important}.ct-banner .mb-2{margin-bottom:2px!important}.ct-banner .p-0{padding:0!important}.ct-banner .py-8{padding-bottom:8px!important;padding-top:8px!important}.ct-banner .mr-12{margin-right:12px!important}.ct-banner .pr-20{padding-right:20px!important}.ct-banner .pl-4{padding-left:4px!important}.ct-banner .pl-20{padding-left:20px!important}.ct-banner .fw-600{font-weight:600!important}.ct-banner .fs-2{font-size:12px!important}.ct-banner .fs-2,.ct-banner .lh-16{line-height:16px!important}.ct-banner .lh-20{line-height:20px!important}.ct-banner .d-none{display:none!important}.ct-banner .c-tripblue{color:#0f6bff!important}.ct-banner .pr-16{padding-right:16px!important}.ct-banner .fw-500{font-weight:500!important}.ct-banner .bento-c-neutral-500{color:gray!important}.ct-banner .animateSlideIn{-webkit-transition:all .3s ease-in-out!important;transition:all .3s ease-in-out!important}.ct-banner .mb-12{margin-bottom:12px!important}.ct-banner .h-48p{height:48px!important}.ct-banner .w-100p{width:100%!important}.ct-banner .w-50p{width:50%!important}.ct-banner .w-fit-content{width:fit-content!important}.ct-banner .bento-bg-secondary-500{background-color:#36c!important}.ct-banner .c-white{color:#fff!important}.ct-banner .mr-16{margin-right:16px!important}.ct-banner .ml-20{margin-left:20px!important}.ct-banner .flex-middle{align-items:center!important}.ct-banner .flex-center{-webkit-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.ct-banner .flex-around{justify-content:space-around!important}.ct-banner .flex{display:flex!important}.ct-banner .fs-14{font-size:14px!important}.ct-banner .pl-15{padding-left:15px!important}.ct-banner .pr-24{padding-right:24px!important}.ct-banner .pt-8{padding-top:8px!important}.ct-banner .pb-24{padding-bottom:24px!important}.ct-banner .z-20{z-index:20!important}.ct-banner .w-100vw{width:100vw!important}.ct-banner .bg-orange-light-100{background-color:#fff1ec!important}.ct-banner .px-16{padding-left:16px!important;padding-right:16px!important}.ct-banner .br-6-imp{border-radius:6px!important}.ct-banner .p-relative{position:relative!important}.ct-banner .p-absolute{position:absolute!important}.ct-banner .p-fixed{position:fixed!important}.ct-banner .r-0{right:0!important}.ct-banner .t-0{top:0!important}.ct-banner .l-0{left:0!important}.ct-banner .b--4{bottom:-4px!important}.ct-banner .flex-grow{-webkit-box-flex:1!important;-ms-flex-positive:1!important;flex-grow:1!important}.ct-banner .bento-c-neutral-900{color:#1a1a1a!important}.ct-banner .pb-8{padding-bottom:8px!important}.ct-banner .bg-black{background-color:#000!important}.ct-banner .pl-16{padding-left:16px!important}.ct-banner .pt-12{padding-top:12px!important}.ct-banner .flex-column{flex-direction:column!important}.ct-banner .flex-start{align-items:flex-start!important}";
|
|
34
|
-
styleInject(css_248z);
|
|
35
|
-
|
|
36
|
-
var CtBanner = function (_a) {
|
|
37
|
-
var campaignTopic = _a.campaignTopic, isMobileApp = _a.isMobileApp, isDesktop = _a.isDesktop, initialProps = _a.initialProps, tupleIndex = _a.tupleIndex, componentClassNames = _a.componentClassNames, onClick = _a.onClick, onLoad = _a.onLoad;
|
|
38
|
-
var _b = react.useState(initialProps || undefined), banner = _b[0], setBanner = _b[1];
|
|
39
|
-
var bannerRef = react.useRef(null);
|
|
40
|
-
var _c = banner || {}, img_url = _c.img_url, img_class = _c.img_class, img_height = _c.img_height, img_style = _c.img_style, appBanner = _c.appBanner, pwaBanner = _c.pwaBanner, title_class = _c.title_class, title = _c.title, subTitle = _c.subTitle, subtitle_class = _c.subtitle_class, cta = _c.cta, cta_class = _c.cta_class, cta_copy_class = _c.cta_copy_class, cta_style = _c.cta_style, title_container_class = _c.title_container_class, title_container_style = _c.title_container_style, banner_icon = _c.banner_icon, banner_icon_class = _c.banner_icon_class, content_icon = _c.content_icon, content_icon_class = _c.content_icon_class, button_one_link = _c.button_one_link, button_two_link = _c.button_two_link, btn1_Style = _c.btn1_Style, btn2_Style = _c.btn2_Style, btn1_class = _c.btn1_class, btn2_class = _c.btn2_class, banner_container_class = _c.banner_container_class, banner_container_style = _c.banner_container_style, banner_icon_style = _c.banner_icon_style, content_icon_style = _c.content_icon_style, redirection_link = _c.redirection_link, open_in_new_tab = _c.open_in_new_tab, index = _c.index, clickable_banner = _c.clickable_banner, is_banner_icon = _c.is_banner_icon, is_content_icon = _c.is_content_icon;
|
|
41
|
-
var bannerIndex = index && parseInt(index);
|
|
42
|
-
var targetAttribute = open_in_new_tab === 'true' ? '_blank' : '_self';
|
|
43
|
-
var handleBannerClick = react.useCallback(function () {
|
|
44
|
-
if (clickable_banner !== 'true') {
|
|
45
|
-
return;
|
|
46
|
-
}
|
|
47
|
-
if (redirection_link) {
|
|
48
|
-
if (open_in_new_tab === 'true') {
|
|
49
|
-
window.open(redirection_link, '_blank');
|
|
50
|
-
}
|
|
51
|
-
else {
|
|
52
|
-
window.location.href = redirection_link;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
if (onClick) {
|
|
56
|
-
onClick();
|
|
57
|
-
}
|
|
58
|
-
}, [clickable_banner, redirection_link, open_in_new_tab, onClick]);
|
|
59
|
-
var handleNonClickableFlow = react.useCallback(function () {
|
|
60
|
-
if (clickable_banner === 'false') {
|
|
61
|
-
onClick();
|
|
62
|
-
}
|
|
63
|
-
}, [clickable_banner, onClick]);
|
|
64
|
-
var showBanner = (isMobileApp && appBanner === 'true') ||
|
|
65
|
-
(!isMobileApp && pwaBanner === 'true') ||
|
|
66
|
-
isDesktop;
|
|
67
|
-
react.useLayoutEffect(function () {
|
|
68
|
-
if (!banner)
|
|
69
|
-
return;
|
|
70
|
-
var bannerElement = bannerRef.current;
|
|
71
|
-
var bannerHeight = bannerElement
|
|
72
|
-
? bannerElement.getBoundingClientRect().height
|
|
73
|
-
: 0;
|
|
74
|
-
if (onLoad && bannerHeight > 0) {
|
|
75
|
-
onLoad();
|
|
76
|
-
}
|
|
77
|
-
}, [banner]);
|
|
78
|
-
react.useEffect(function () {
|
|
79
|
-
var eventListener = function (event) {
|
|
80
|
-
var _a;
|
|
81
|
-
var data = event === null || event === void 0 ? void 0 : event.detail;
|
|
82
|
-
var topic = (_a = data === null || data === void 0 ? void 0 : data.kv) === null || _a === void 0 ? void 0 : _a.topic;
|
|
83
|
-
if (topic === campaignTopic) {
|
|
84
|
-
setBanner(data === null || data === void 0 ? void 0 : data.kv);
|
|
85
|
-
}
|
|
86
|
-
};
|
|
87
|
-
document.addEventListener('CT_web_native_display', eventListener);
|
|
88
|
-
return function () {
|
|
89
|
-
document.removeEventListener('CT_web_native_display', eventListener);
|
|
90
|
-
};
|
|
91
|
-
}, [campaignTopic]);
|
|
92
|
-
var bannerImageStyle = {};
|
|
93
|
-
var bannerCtastyle = {};
|
|
94
|
-
var titleContainerStyle = {};
|
|
95
|
-
var buttonOneStyle = {};
|
|
96
|
-
var buttonTwoStyle = {};
|
|
97
|
-
var bannerContainerStyle = {};
|
|
98
|
-
var bannerIconStyle = {};
|
|
99
|
-
var contentIconStyle = {};
|
|
100
|
-
try {
|
|
101
|
-
if (banner_icon_style) {
|
|
102
|
-
bannerIconStyle = JSON.parse(banner_icon_style);
|
|
103
|
-
}
|
|
104
|
-
if (img_style) {
|
|
105
|
-
bannerImageStyle = JSON.parse(img_style);
|
|
106
|
-
}
|
|
107
|
-
if (cta_style) {
|
|
108
|
-
bannerCtastyle = JSON.parse(cta_style);
|
|
109
|
-
}
|
|
110
|
-
if (title_container_style) {
|
|
111
|
-
titleContainerStyle = JSON.parse(title_container_style);
|
|
112
|
-
}
|
|
113
|
-
if (btn1_Style) {
|
|
114
|
-
buttonOneStyle = JSON.parse(btn1_Style);
|
|
115
|
-
}
|
|
116
|
-
if (btn2_Style) {
|
|
117
|
-
buttonTwoStyle = JSON.parse(btn2_Style);
|
|
118
|
-
}
|
|
119
|
-
if (banner_container_style) {
|
|
120
|
-
bannerContainerStyle = JSON.parse(banner_container_style);
|
|
121
|
-
}
|
|
122
|
-
if (content_icon_style) {
|
|
123
|
-
contentIconStyle = JSON.parse(content_icon_style);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
catch (error) {
|
|
127
|
-
}
|
|
128
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: showBanner &&
|
|
129
|
-
(bannerIndex === tupleIndex || index === undefined) && (jsxRuntime.jsx("div", tslib.__assign({ className: 'utilswrapper' }, { children: jsxRuntime.jsx("div", tslib.__assign({ className: "ct-banner p-relative ".concat(componentClassNames ? componentClassNames : ''), ref: bannerRef }, { children: jsxRuntime.jsxs("div", tslib.__assign({ style: bannerImageStyle, onClick: handleBannerClick }, { children: [img_url && (jsxRuntime.jsx("img", { src: img_url, className: img_class, height: img_height })), (button_one_link || button_two_link) && (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("a", tslib.__assign({ href: button_one_link, target: targetAttribute }, { children: jsxRuntime.jsx("div", { className: btn1_class, style: buttonOneStyle }) })), jsxRuntime.jsx("a", tslib.__assign({ href: button_two_link, target: targetAttribute }, { children: jsxRuntime.jsx("div", { className: btn2_class, style: buttonTwoStyle }) }))] })), title && (jsxRuntime.jsxs("div", tslib.__assign({ className: banner_container_class, style: bannerContainerStyle }, { children: [is_banner_icon === 'true' && (jsxRuntime.jsx("div", tslib.__assign({ className: banner_icon_class }, { children: banner_icon ? (jsxRuntime.jsx("img", { src: banner_icon, style: bannerIconStyle })) : (jsxRuntime.jsx(ctPlatformAssets.CTLogo, { fill: '#FF4F17' })) }))), jsxRuntime.jsxs("div", tslib.__assign({ className: title_container_class, style: titleContainerStyle }, { children: [jsxRuntime.jsx("div", tslib.__assign({ className: title_class }, { children: title })), jsxRuntime.jsx("div", tslib.__assign({ className: subtitle_class }, { children: subTitle })), is_content_icon === 'true' && (jsxRuntime.jsx("div", tslib.__assign({ className: content_icon_class }, { children: content_icon ? (jsxRuntime.jsx("img", { src: content_icon, style: contentIconStyle })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx(ctPlatformAssets.Ratings, {}), "(10M+ Downloads)"] })) })))] })), jsxRuntime.jsx("div", tslib.__assign({ className: cta_class, style: bannerCtastyle }, { children: jsxRuntime.jsx("span", tslib.__assign({ className: cta_copy_class, onClick: handleNonClickableFlow }, { children: cta })) }))] })))] })) })) }))) }));
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
exports.CTBanner = CtBanner;
|
|
1
|
+
"use strict";var t=require("tslib"),n=require("react/jsx-runtime"),e=require("react"),a=require("@cleartrip/ct-platform-assets");!function(t,n){void 0===n&&(n={});var e=n.insertAt;if(t&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],i=document.createElement("style");i.type="text/css","top"===e&&a.firstChild?a.insertBefore(i,a.firstChild):a.appendChild(i),i.styleSheet?i.styleSheet.cssText=t:i.appendChild(document.createTextNode(t))}}(".ct-banner{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Ubuntu,Arial,sans-serif}.ct-banner .m-0{margin:0!important}.ct-banner .ml-4{margin-left:4px!important}.ct-banner .mb-5{margin-bottom:5px!important}.ct-banner .mb-2{margin-bottom:2px!important}.ct-banner .p-0{padding:0!important}.ct-banner .py-8{padding-bottom:8px!important;padding-top:8px!important}.ct-banner .mr-12{margin-right:12px!important}.ct-banner .pr-20{padding-right:20px!important}.ct-banner .pl-4{padding-left:4px!important}.ct-banner .pl-20{padding-left:20px!important}.ct-banner .fw-600{font-weight:600!important}.ct-banner .fs-2{font-size:12px!important}.ct-banner .fs-2,.ct-banner .lh-16{line-height:16px!important}.ct-banner .lh-20{line-height:20px!important}.ct-banner .d-none{display:none!important}.ct-banner .c-tripblue{color:#0f6bff!important}.ct-banner .pr-16{padding-right:16px!important}.ct-banner .fw-500{font-weight:500!important}.ct-banner .bento-c-neutral-500{color:gray!important}.ct-banner .animateSlideIn{-webkit-transition:all .3s ease-in-out!important;transition:all .3s ease-in-out!important}.ct-banner .mb-12{margin-bottom:12px!important}.ct-banner .h-48p{height:48px!important}.ct-banner .w-100p{width:100%!important}.ct-banner .w-50p{width:50%!important}.ct-banner .w-fit-content{width:fit-content!important}.ct-banner .bento-bg-secondary-500{background-color:#36c!important}.ct-banner .c-white{color:#fff!important}.ct-banner .mr-16{margin-right:16px!important}.ct-banner .ml-20{margin-left:20px!important}.ct-banner .flex-middle{align-items:center!important}.ct-banner .flex-center{-webkit-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.ct-banner .flex-around{justify-content:space-around!important}.ct-banner .flex{display:flex!important}.ct-banner .fs-14{font-size:14px!important}.ct-banner .pl-15{padding-left:15px!important}.ct-banner .pr-24{padding-right:24px!important}.ct-banner .pt-8{padding-top:8px!important}.ct-banner .pb-24{padding-bottom:24px!important}.ct-banner .z-20{z-index:20!important}.ct-banner .w-100vw{width:100vw!important}.ct-banner .bg-orange-light-100{background-color:#fff1ec!important}.ct-banner .px-16{padding-left:16px!important;padding-right:16px!important}.ct-banner .br-6-imp{border-radius:6px!important}.ct-banner .p-relative{position:relative!important}.ct-banner .p-absolute{position:absolute!important}.ct-banner .p-fixed{position:fixed!important}.ct-banner .r-0{right:0!important}.ct-banner .t-0{top:0!important}.ct-banner .l-0{left:0!important}.ct-banner .b--4{bottom:-4px!important}.ct-banner .flex-grow{-webkit-box-flex:1!important;-ms-flex-positive:1!important;flex-grow:1!important}.ct-banner .bento-c-neutral-900{color:#1a1a1a!important}.ct-banner .pb-8{padding-bottom:8px!important}.ct-banner .bg-black{background-color:#000!important}.ct-banner .pl-16{padding-left:16px!important}.ct-banner .pt-12{padding-top:12px!important}.ct-banner .flex-column{flex-direction:column!important}.ct-banner .flex-start{align-items:flex-start!important}");exports.CTBanner=function(i){var r=i.campaignTopic,o=i.isMobileApp,s=i.isDesktop,c=i.initialProps,p=i.tupleIndex,l=i.componentClassNames,m=i.onClick,b=i.onLoad,d=e.useState(c||void 0),g=d[0],_=d[1],x=e.useRef(null),f=g||{},u=f.img_url,h=f.img_class,v=f.img_height,y=f.img_style,w=f.appBanner,j=f.pwaBanner,N=f.title_class,k=f.title,S=f.subTitle,C=f.subtitle_class,T=f.cta,J=f.cta_class,O=f.cta_copy_class,B=f.cta_style,F=f.title_container_class,E=f.title_container_style,L=f.banner_icon,q=f.banner_icon_class,z=f.content_icon,I=f.content_icon_class,R=f.button_one_link,A=f.button_two_link,M=f.btn1_Style,D=f.btn2_Style,U=f.btn1_class,H=f.btn2_class,P=f.banner_container_class,G=f.banner_container_style,K=f.banner_icon_style,Q=f.content_icon_style,V=f.redirection_link,W=f.open_in_new_tab,X=f.index,Y=f.clickable_banner,Z=f.is_banner_icon,$=f.is_content_icon,tt=X&&parseInt(X),nt="true"===W?"_blank":"_self",et=e.useCallback((function(){"true"===Y&&(V&&("true"===W?window.open(V,"_blank"):window.location.href=V),m&&m())}),[Y,V,W,m]),at=e.useCallback((function(){"false"===Y&&m()}),[Y,m]),it=o&&"true"===w||!o&&"true"===j||s;e.useLayoutEffect((function(){if(g){var t=x.current,n=t?t.getBoundingClientRect().height:0;b&&n>0&&b()}}),[g]),e.useEffect((function(){var t=function(t){var n,e=null==t?void 0:t.detail;(null===(n=null==e?void 0:e.kv)||void 0===n?void 0:n.topic)===r&&_(null==e?void 0:e.kv)};return document.addEventListener("CT_web_native_display",t),function(){document.removeEventListener("CT_web_native_display",t)}}),[r]);var rt={},ot={},st={},ct={},pt={},lt={},mt={},bt={};try{K&&(mt=JSON.parse(K)),y&&(rt=JSON.parse(y)),B&&(ot=JSON.parse(B)),E&&(st=JSON.parse(E)),M&&(ct=JSON.parse(M)),D&&(pt=JSON.parse(D)),G&&(lt=JSON.parse(G)),Q&&(bt=JSON.parse(Q))}catch(t){}return n.jsx(n.Fragment,{children:it&&(tt===p||void 0===X)&&n.jsx("div",t.__assign({className:"utilswrapper"},{children:n.jsx("div",t.__assign({className:"ct-banner p-relative ".concat(l||""),ref:x},{children:n.jsxs("div",t.__assign({style:rt,onClick:et},{children:[u&&n.jsx("img",{src:u,className:h,height:v}),(R||A)&&n.jsxs(n.Fragment,{children:[n.jsx("a",t.__assign({href:R,target:nt},{children:n.jsx("div",{className:U,style:ct})})),n.jsx("a",t.__assign({href:A,target:nt},{children:n.jsx("div",{className:H,style:pt})}))]}),k&&n.jsxs("div",t.__assign({className:P,style:lt},{children:["true"===Z&&n.jsx("div",t.__assign({className:q},{children:L?n.jsx("img",{src:L,style:mt}):n.jsx(a.CTLogo,{fill:"#FF4F17"})})),n.jsxs("div",t.__assign({className:F,style:st},{children:[n.jsx("div",t.__assign({className:N},{children:k})),n.jsx("div",t.__assign({className:C},{children:S})),"true"===$&&n.jsx("div",t.__assign({className:I},{children:z?n.jsx("img",{src:z,style:bt}):n.jsxs(n.Fragment,{children:[n.jsx(a.Ratings,{}),"(10M+ Downloads)"]})}))]})),n.jsx("div",t.__assign({className:J,style:ot},{children:n.jsx("span",t.__assign({className:O,onClick:at},{children:T}))}))]}))]}))}))}))})};
|
|
133
2
|
//# sourceMappingURL=ct-platform-banner.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-platform-banner.cjs.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/Banner/src/Banner.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],"names":["
|
|
1
|
+
{"version":3,"file":"ct-platform-banner.cjs.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/Banner/src/Banner.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],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","_a","campaignTopic","isMobileApp","isDesktop","initialProps","tupleIndex","componentClassNames","onClick","onLoad","_b","useState","undefined","banner","setBanner","bannerRef","useRef","_c","img_url","img_class","img_height","img_style","appBanner","pwaBanner","title_class","title","subTitle","subtitle_class","cta","cta_class","cta_copy_class","cta_style","title_container_class","title_container_style","banner_icon","banner_icon_class","content_icon","content_icon_class","button_one_link","button_two_link","btn1_Style","btn2_Style","btn1_class","btn2_class","banner_container_class","banner_container_style","banner_icon_style","content_icon_style","redirection_link","open_in_new_tab","index","clickable_banner","is_banner_icon","is_content_icon","bannerIndex","parseInt","targetAttribute","handleBannerClick","useCallback","window","open","location","href","handleNonClickableFlow","showBanner","useLayoutEffect","bannerElement","current","bannerHeight","getBoundingClientRect","height","useEffect","eventListener","event","data","detail","kv","topic","addEventListener","removeEventListener","bannerImageStyle","bannerCtastyle","titleContainerStyle","buttonOneStyle","buttonTwoStyle","bannerContainerStyle","bannerIconStyle","contentIconStyle","JSON","parse","error","_jsx","__assign","className","children","jsx","concat","_jsxs","jsxs","src","_Fragment","Fragment","target","CTLogo","fill","Ratings"],"mappings":"kIAAA,SAAqBA,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,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K,MAAAC,EAAAA,SAAA,CAAAC,UAAWlE,GACX,CAAAmE,SAAApE,KAGgB,SAApB2B,GACGsC,EAAAA,IACI,MAAAC,EAAAA,SAAA,CAAAC,UACIxD,GAGH,CAAAyD,SAAA1D,EACGuD,EAAAA,IACI,MAAA,CAAAQ,IAAK/D,EACL5C,MACI+F,KAIRU,EACIC,KAAAE,WAAA,CAAAN,SAAA,CAAAH,EAAAA,IAACc,EAAOA,QAAA,CAAA,GAET,6BAMnBd,EAAAA,IACI,MAAAC,EAAAA,SAAA,CAAAC,UAAWhE,EACXrC,MAAOyF,IAEP,CAAAa,SAAAH,EAAAA,IAAA,OAAAC,EAAAA,SAAA,CACIC,UAAW/D,EACXtB,QAASuD,IAAsB,CAAA+B,SAE9BlE,uBAWjD","x_google_ignoreList":[0]}
|
|
@@ -1,131 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import { useState, useRef, useCallback, useLayoutEffect, useEffect } from 'react';
|
|
4
|
-
import { CTLogo, Ratings } from '@cleartrip/ct-platform-assets';
|
|
5
|
-
|
|
6
|
-
function styleInject(css, ref) {
|
|
7
|
-
if (ref === void 0) ref = {};
|
|
8
|
-
var insertAt = ref.insertAt;
|
|
9
|
-
if (!css || typeof document === 'undefined') {
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
var head = document.head || document.getElementsByTagName('head')[0];
|
|
13
|
-
var style = document.createElement('style');
|
|
14
|
-
style.type = 'text/css';
|
|
15
|
-
if (insertAt === 'top') {
|
|
16
|
-
if (head.firstChild) {
|
|
17
|
-
head.insertBefore(style, head.firstChild);
|
|
18
|
-
} else {
|
|
19
|
-
head.appendChild(style);
|
|
20
|
-
}
|
|
21
|
-
} else {
|
|
22
|
-
head.appendChild(style);
|
|
23
|
-
}
|
|
24
|
-
if (style.styleSheet) {
|
|
25
|
-
style.styleSheet.cssText = css;
|
|
26
|
-
} else {
|
|
27
|
-
style.appendChild(document.createTextNode(css));
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
var css_248z = ".ct-banner{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Ubuntu,Arial,sans-serif}.ct-banner .m-0{margin:0!important}.ct-banner .ml-4{margin-left:4px!important}.ct-banner .mb-5{margin-bottom:5px!important}.ct-banner .mb-2{margin-bottom:2px!important}.ct-banner .p-0{padding:0!important}.ct-banner .py-8{padding-bottom:8px!important;padding-top:8px!important}.ct-banner .mr-12{margin-right:12px!important}.ct-banner .pr-20{padding-right:20px!important}.ct-banner .pl-4{padding-left:4px!important}.ct-banner .pl-20{padding-left:20px!important}.ct-banner .fw-600{font-weight:600!important}.ct-banner .fs-2{font-size:12px!important}.ct-banner .fs-2,.ct-banner .lh-16{line-height:16px!important}.ct-banner .lh-20{line-height:20px!important}.ct-banner .d-none{display:none!important}.ct-banner .c-tripblue{color:#0f6bff!important}.ct-banner .pr-16{padding-right:16px!important}.ct-banner .fw-500{font-weight:500!important}.ct-banner .bento-c-neutral-500{color:gray!important}.ct-banner .animateSlideIn{-webkit-transition:all .3s ease-in-out!important;transition:all .3s ease-in-out!important}.ct-banner .mb-12{margin-bottom:12px!important}.ct-banner .h-48p{height:48px!important}.ct-banner .w-100p{width:100%!important}.ct-banner .w-50p{width:50%!important}.ct-banner .w-fit-content{width:fit-content!important}.ct-banner .bento-bg-secondary-500{background-color:#36c!important}.ct-banner .c-white{color:#fff!important}.ct-banner .mr-16{margin-right:16px!important}.ct-banner .ml-20{margin-left:20px!important}.ct-banner .flex-middle{align-items:center!important}.ct-banner .flex-center{-webkit-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.ct-banner .flex-around{justify-content:space-around!important}.ct-banner .flex{display:flex!important}.ct-banner .fs-14{font-size:14px!important}.ct-banner .pl-15{padding-left:15px!important}.ct-banner .pr-24{padding-right:24px!important}.ct-banner .pt-8{padding-top:8px!important}.ct-banner .pb-24{padding-bottom:24px!important}.ct-banner .z-20{z-index:20!important}.ct-banner .w-100vw{width:100vw!important}.ct-banner .bg-orange-light-100{background-color:#fff1ec!important}.ct-banner .px-16{padding-left:16px!important;padding-right:16px!important}.ct-banner .br-6-imp{border-radius:6px!important}.ct-banner .p-relative{position:relative!important}.ct-banner .p-absolute{position:absolute!important}.ct-banner .p-fixed{position:fixed!important}.ct-banner .r-0{right:0!important}.ct-banner .t-0{top:0!important}.ct-banner .l-0{left:0!important}.ct-banner .b--4{bottom:-4px!important}.ct-banner .flex-grow{-webkit-box-flex:1!important;-ms-flex-positive:1!important;flex-grow:1!important}.ct-banner .bento-c-neutral-900{color:#1a1a1a!important}.ct-banner .pb-8{padding-bottom:8px!important}.ct-banner .bg-black{background-color:#000!important}.ct-banner .pl-16{padding-left:16px!important}.ct-banner .pt-12{padding-top:12px!important}.ct-banner .flex-column{flex-direction:column!important}.ct-banner .flex-start{align-items:flex-start!important}";
|
|
32
|
-
styleInject(css_248z);
|
|
33
|
-
|
|
34
|
-
var CtBanner = function (_a) {
|
|
35
|
-
var campaignTopic = _a.campaignTopic, isMobileApp = _a.isMobileApp, isDesktop = _a.isDesktop, initialProps = _a.initialProps, tupleIndex = _a.tupleIndex, componentClassNames = _a.componentClassNames, onClick = _a.onClick, onLoad = _a.onLoad;
|
|
36
|
-
var _b = useState(initialProps || undefined), banner = _b[0], setBanner = _b[1];
|
|
37
|
-
var bannerRef = useRef(null);
|
|
38
|
-
var _c = banner || {}, img_url = _c.img_url, img_class = _c.img_class, img_height = _c.img_height, img_style = _c.img_style, appBanner = _c.appBanner, pwaBanner = _c.pwaBanner, title_class = _c.title_class, title = _c.title, subTitle = _c.subTitle, subtitle_class = _c.subtitle_class, cta = _c.cta, cta_class = _c.cta_class, cta_copy_class = _c.cta_copy_class, cta_style = _c.cta_style, title_container_class = _c.title_container_class, title_container_style = _c.title_container_style, banner_icon = _c.banner_icon, banner_icon_class = _c.banner_icon_class, content_icon = _c.content_icon, content_icon_class = _c.content_icon_class, button_one_link = _c.button_one_link, button_two_link = _c.button_two_link, btn1_Style = _c.btn1_Style, btn2_Style = _c.btn2_Style, btn1_class = _c.btn1_class, btn2_class = _c.btn2_class, banner_container_class = _c.banner_container_class, banner_container_style = _c.banner_container_style, banner_icon_style = _c.banner_icon_style, content_icon_style = _c.content_icon_style, redirection_link = _c.redirection_link, open_in_new_tab = _c.open_in_new_tab, index = _c.index, clickable_banner = _c.clickable_banner, is_banner_icon = _c.is_banner_icon, is_content_icon = _c.is_content_icon;
|
|
39
|
-
var bannerIndex = index && parseInt(index);
|
|
40
|
-
var targetAttribute = open_in_new_tab === 'true' ? '_blank' : '_self';
|
|
41
|
-
var handleBannerClick = useCallback(function () {
|
|
42
|
-
if (clickable_banner !== 'true') {
|
|
43
|
-
return;
|
|
44
|
-
}
|
|
45
|
-
if (redirection_link) {
|
|
46
|
-
if (open_in_new_tab === 'true') {
|
|
47
|
-
window.open(redirection_link, '_blank');
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
window.location.href = redirection_link;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (onClick) {
|
|
54
|
-
onClick();
|
|
55
|
-
}
|
|
56
|
-
}, [clickable_banner, redirection_link, open_in_new_tab, onClick]);
|
|
57
|
-
var handleNonClickableFlow = useCallback(function () {
|
|
58
|
-
if (clickable_banner === 'false') {
|
|
59
|
-
onClick();
|
|
60
|
-
}
|
|
61
|
-
}, [clickable_banner, onClick]);
|
|
62
|
-
var showBanner = (isMobileApp && appBanner === 'true') ||
|
|
63
|
-
(!isMobileApp && pwaBanner === 'true') ||
|
|
64
|
-
isDesktop;
|
|
65
|
-
useLayoutEffect(function () {
|
|
66
|
-
if (!banner)
|
|
67
|
-
return;
|
|
68
|
-
var bannerElement = bannerRef.current;
|
|
69
|
-
var bannerHeight = bannerElement
|
|
70
|
-
? bannerElement.getBoundingClientRect().height
|
|
71
|
-
: 0;
|
|
72
|
-
if (onLoad && bannerHeight > 0) {
|
|
73
|
-
onLoad();
|
|
74
|
-
}
|
|
75
|
-
}, [banner]);
|
|
76
|
-
useEffect(function () {
|
|
77
|
-
var eventListener = function (event) {
|
|
78
|
-
var _a;
|
|
79
|
-
var data = event === null || event === void 0 ? void 0 : event.detail;
|
|
80
|
-
var topic = (_a = data === null || data === void 0 ? void 0 : data.kv) === null || _a === void 0 ? void 0 : _a.topic;
|
|
81
|
-
if (topic === campaignTopic) {
|
|
82
|
-
setBanner(data === null || data === void 0 ? void 0 : data.kv);
|
|
83
|
-
}
|
|
84
|
-
};
|
|
85
|
-
document.addEventListener('CT_web_native_display', eventListener);
|
|
86
|
-
return function () {
|
|
87
|
-
document.removeEventListener('CT_web_native_display', eventListener);
|
|
88
|
-
};
|
|
89
|
-
}, [campaignTopic]);
|
|
90
|
-
var bannerImageStyle = {};
|
|
91
|
-
var bannerCtastyle = {};
|
|
92
|
-
var titleContainerStyle = {};
|
|
93
|
-
var buttonOneStyle = {};
|
|
94
|
-
var buttonTwoStyle = {};
|
|
95
|
-
var bannerContainerStyle = {};
|
|
96
|
-
var bannerIconStyle = {};
|
|
97
|
-
var contentIconStyle = {};
|
|
98
|
-
try {
|
|
99
|
-
if (banner_icon_style) {
|
|
100
|
-
bannerIconStyle = JSON.parse(banner_icon_style);
|
|
101
|
-
}
|
|
102
|
-
if (img_style) {
|
|
103
|
-
bannerImageStyle = JSON.parse(img_style);
|
|
104
|
-
}
|
|
105
|
-
if (cta_style) {
|
|
106
|
-
bannerCtastyle = JSON.parse(cta_style);
|
|
107
|
-
}
|
|
108
|
-
if (title_container_style) {
|
|
109
|
-
titleContainerStyle = JSON.parse(title_container_style);
|
|
110
|
-
}
|
|
111
|
-
if (btn1_Style) {
|
|
112
|
-
buttonOneStyle = JSON.parse(btn1_Style);
|
|
113
|
-
}
|
|
114
|
-
if (btn2_Style) {
|
|
115
|
-
buttonTwoStyle = JSON.parse(btn2_Style);
|
|
116
|
-
}
|
|
117
|
-
if (banner_container_style) {
|
|
118
|
-
bannerContainerStyle = JSON.parse(banner_container_style);
|
|
119
|
-
}
|
|
120
|
-
if (content_icon_style) {
|
|
121
|
-
contentIconStyle = JSON.parse(content_icon_style);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
catch (error) {
|
|
125
|
-
}
|
|
126
|
-
return (jsx(Fragment, { children: showBanner &&
|
|
127
|
-
(bannerIndex === tupleIndex || index === undefined) && (jsx("div", __assign({ className: 'utilswrapper' }, { children: jsx("div", __assign({ className: "ct-banner p-relative ".concat(componentClassNames ? componentClassNames : ''), ref: bannerRef }, { children: jsxs("div", __assign({ style: bannerImageStyle, onClick: handleBannerClick }, { children: [img_url && (jsx("img", { src: img_url, className: img_class, height: img_height })), (button_one_link || button_two_link) && (jsxs(Fragment, { children: [jsx("a", __assign({ href: button_one_link, target: targetAttribute }, { children: jsx("div", { className: btn1_class, style: buttonOneStyle }) })), jsx("a", __assign({ href: button_two_link, target: targetAttribute }, { children: jsx("div", { className: btn2_class, style: buttonTwoStyle }) }))] })), title && (jsxs("div", __assign({ className: banner_container_class, style: bannerContainerStyle }, { children: [is_banner_icon === 'true' && (jsx("div", __assign({ className: banner_icon_class }, { children: banner_icon ? (jsx("img", { src: banner_icon, style: bannerIconStyle })) : (jsx(CTLogo, { fill: '#FF4F17' })) }))), jsxs("div", __assign({ className: title_container_class, style: titleContainerStyle }, { children: [jsx("div", __assign({ className: title_class }, { children: title })), jsx("div", __assign({ className: subtitle_class }, { children: subTitle })), is_content_icon === 'true' && (jsx("div", __assign({ className: content_icon_class }, { children: content_icon ? (jsx("img", { src: content_icon, style: contentIconStyle })) : (jsxs(Fragment, { children: [jsx(Ratings, {}), "(10M+ Downloads)"] })) })))] })), jsx("div", __assign({ className: cta_class, style: bannerCtastyle }, { children: jsx("span", __assign({ className: cta_copy_class, onClick: handleNonClickableFlow }, { children: cta })) }))] })))] })) })) }))) }));
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
export { CtBanner as CTBanner };
|
|
1
|
+
import{__assign as t}from"tslib";import{jsx as n,Fragment as e,jsxs as a}from"react/jsx-runtime";import{useState as r,useRef as i,useCallback as o,useLayoutEffect as c,useEffect as p}from"react";import{CTLogo as l,Ratings as s}from"@cleartrip/ct-platform-assets";!function(t,n){void 0===n&&(n={});var e=n.insertAt;if(t&&"undefined"!=typeof document){var a=document.head||document.getElementsByTagName("head")[0],r=document.createElement("style");r.type="text/css","top"===e&&a.firstChild?a.insertBefore(r,a.firstChild):a.appendChild(r),r.styleSheet?r.styleSheet.cssText=t:r.appendChild(document.createTextNode(t))}}(".ct-banner{font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica Neue,Ubuntu,Arial,sans-serif}.ct-banner .m-0{margin:0!important}.ct-banner .ml-4{margin-left:4px!important}.ct-banner .mb-5{margin-bottom:5px!important}.ct-banner .mb-2{margin-bottom:2px!important}.ct-banner .p-0{padding:0!important}.ct-banner .py-8{padding-bottom:8px!important;padding-top:8px!important}.ct-banner .mr-12{margin-right:12px!important}.ct-banner .pr-20{padding-right:20px!important}.ct-banner .pl-4{padding-left:4px!important}.ct-banner .pl-20{padding-left:20px!important}.ct-banner .fw-600{font-weight:600!important}.ct-banner .fs-2{font-size:12px!important}.ct-banner .fs-2,.ct-banner .lh-16{line-height:16px!important}.ct-banner .lh-20{line-height:20px!important}.ct-banner .d-none{display:none!important}.ct-banner .c-tripblue{color:#0f6bff!important}.ct-banner .pr-16{padding-right:16px!important}.ct-banner .fw-500{font-weight:500!important}.ct-banner .bento-c-neutral-500{color:gray!important}.ct-banner .animateSlideIn{-webkit-transition:all .3s ease-in-out!important;transition:all .3s ease-in-out!important}.ct-banner .mb-12{margin-bottom:12px!important}.ct-banner .h-48p{height:48px!important}.ct-banner .w-100p{width:100%!important}.ct-banner .w-50p{width:50%!important}.ct-banner .w-fit-content{width:fit-content!important}.ct-banner .bento-bg-secondary-500{background-color:#36c!important}.ct-banner .c-white{color:#fff!important}.ct-banner .mr-16{margin-right:16px!important}.ct-banner .ml-20{margin-left:20px!important}.ct-banner .flex-middle{align-items:center!important}.ct-banner .flex-center{-webkit-box-pack:center!important;-ms-flex-pack:center!important;justify-content:center!important}.ct-banner .flex-around{justify-content:space-around!important}.ct-banner .flex{display:flex!important}.ct-banner .fs-14{font-size:14px!important}.ct-banner .pl-15{padding-left:15px!important}.ct-banner .pr-24{padding-right:24px!important}.ct-banner .pt-8{padding-top:8px!important}.ct-banner .pb-24{padding-bottom:24px!important}.ct-banner .z-20{z-index:20!important}.ct-banner .w-100vw{width:100vw!important}.ct-banner .bg-orange-light-100{background-color:#fff1ec!important}.ct-banner .px-16{padding-left:16px!important;padding-right:16px!important}.ct-banner .br-6-imp{border-radius:6px!important}.ct-banner .p-relative{position:relative!important}.ct-banner .p-absolute{position:absolute!important}.ct-banner .p-fixed{position:fixed!important}.ct-banner .r-0{right:0!important}.ct-banner .t-0{top:0!important}.ct-banner .l-0{left:0!important}.ct-banner .b--4{bottom:-4px!important}.ct-banner .flex-grow{-webkit-box-flex:1!important;-ms-flex-positive:1!important;flex-grow:1!important}.ct-banner .bento-c-neutral-900{color:#1a1a1a!important}.ct-banner .pb-8{padding-bottom:8px!important}.ct-banner .bg-black{background-color:#000!important}.ct-banner .pl-16{padding-left:16px!important}.ct-banner .pt-12{padding-top:12px!important}.ct-banner .flex-column{flex-direction:column!important}.ct-banner .flex-start{align-items:flex-start!important}");var m=function(m){var d=m.campaignTopic,b=m.isMobileApp,f=m.isDesktop,g=m.initialProps,u=m.tupleIndex,h=m.componentClassNames,x=m.onClick,_=m.onLoad,v=r(g||void 0),y=v[0],w=v[1],N=i(null),k=y||{},S=k.img_url,C=k.img_class,J=k.img_height,O=k.img_style,T=k.appBanner,B=k.pwaBanner,z=k.title_class,E=k.title,F=k.subTitle,I=k.subtitle_class,j=k.cta,A=k.cta_class,L=k.cta_copy_class,M=k.cta_style,D=k.title_container_class,R=k.title_container_style,U=k.banner_icon,H=k.banner_icon_class,P=k.content_icon,q=k.content_icon_class,G=k.button_one_link,K=k.button_two_link,Q=k.btn1_Style,V=k.btn2_Style,W=k.btn1_class,X=k.btn2_class,Y=k.banner_container_class,Z=k.banner_container_style,$=k.banner_icon_style,tt=k.content_icon_style,nt=k.redirection_link,et=k.open_in_new_tab,at=k.index,rt=k.clickable_banner,it=k.is_banner_icon,ot=k.is_content_icon,ct=at&&parseInt(at),pt="true"===et?"_blank":"_self",lt=o((function(){"true"===rt&&(nt&&("true"===et?window.open(nt,"_blank"):window.location.href=nt),x&&x())}),[rt,nt,et,x]),st=o((function(){"false"===rt&&x()}),[rt,x]),mt=b&&"true"===T||!b&&"true"===B||f;c((function(){if(y){var t=N.current,n=t?t.getBoundingClientRect().height:0;_&&n>0&&_()}}),[y]),p((function(){var t=function(t){var n,e=null==t?void 0:t.detail;(null===(n=null==e?void 0:e.kv)||void 0===n?void 0:n.topic)===d&&w(null==e?void 0:e.kv)};return document.addEventListener("CT_web_native_display",t),function(){document.removeEventListener("CT_web_native_display",t)}}),[d]);var dt={},bt={},ft={},gt={},ut={},ht={},xt={},_t={};try{$&&(xt=JSON.parse($)),O&&(dt=JSON.parse(O)),M&&(bt=JSON.parse(M)),R&&(ft=JSON.parse(R)),Q&&(gt=JSON.parse(Q)),V&&(ut=JSON.parse(V)),Z&&(ht=JSON.parse(Z)),tt&&(_t=JSON.parse(tt))}catch(t){}return n(e,{children:mt&&(ct===u||void 0===at)&&n("div",t({className:"utilswrapper"},{children:n("div",t({className:"ct-banner p-relative ".concat(h||""),ref:N},{children:a("div",t({style:dt,onClick:lt},{children:[S&&n("img",{src:S,className:C,height:J}),(G||K)&&a(e,{children:[n("a",t({href:G,target:pt},{children:n("div",{className:W,style:gt})})),n("a",t({href:K,target:pt},{children:n("div",{className:X,style:ut})}))]}),E&&a("div",t({className:Y,style:ht},{children:["true"===it&&n("div",t({className:H},{children:U?n("img",{src:U,style:xt}):n(l,{fill:"#FF4F17"})})),a("div",t({className:D,style:ft},{children:[n("div",t({className:z},{children:E})),n("div",t({className:I},{children:F})),"true"===ot&&n("div",t({className:q},{children:P?n("img",{src:P,style:_t}):a(e,{children:[n(s,{}),"(10M+ Downloads)"]})}))]})),n("div",t({className:A,style:bt},{children:n("span",t({className:L,onClick:st},{children:j}))}))]}))]}))}))}))})};export{m as CTBanner};
|
|
131
2
|
//# sourceMappingURL=ct-platform-banner.esm.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ct-platform-banner.esm.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/Banner/src/Banner.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],"names":["
|
|
1
|
+
{"version":3,"file":"ct-platform-banner.esm.js","sources":["../../../../node_modules/.pnpm/style-inject@0.3.0/node_modules/style-inject/dist/style-inject.es.js","../packages/components/Banner/src/Banner.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],"names":["css","ref","insertAt","document","head","getElementsByTagName","style","createElement","type","firstChild","insertBefore","appendChild","styleSheet","cssText","createTextNode","CtBanner","_a","campaignTopic","isMobileApp","isDesktop","initialProps","tupleIndex","componentClassNames","onClick","onLoad","_b","useState","undefined","banner","setBanner","bannerRef","useRef","_c","img_url","img_class","img_height","img_style","appBanner","pwaBanner","title_class","title","subTitle","subtitle_class","cta","cta_class","cta_copy_class","cta_style","title_container_class","title_container_style","banner_icon","banner_icon_class","content_icon","content_icon_class","button_one_link","button_two_link","btn1_Style","btn2_Style","btn1_class","btn2_class","banner_container_class","banner_container_style","banner_icon_style","content_icon_style","redirection_link","open_in_new_tab","index","clickable_banner","is_banner_icon","is_content_icon","bannerIndex","parseInt","targetAttribute","handleBannerClick","useCallback","window","open","location","href","handleNonClickableFlow","showBanner","useLayoutEffect","bannerElement","current","bannerHeight","getBoundingClientRect","height","useEffect","eventListener","event","data","detail","kv","topic","addEventListener","removeEventListener","bannerImageStyle","bannerCtastyle","titleContainerStyle","buttonOneStyle","buttonTwoStyle","bannerContainerStyle","bannerIconStyle","contentIconStyle","JSON","parse","error","_jsx","__assign","className","children","concat","_jsxs","src","_Fragment","target","CTLogo","fill","Ratings"],"mappings":"wQAAA,SAAqBA,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,q/FCVM,IAAAe,EAAkC,SAACC,OACrCC,EAAaD,EAAAC,cACbC,EAAWF,EAAAE,YACXC,EAASH,EAAAG,UACTC,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A,OAAAC,EAAA,CACIC,UAAW/D,EACXtB,QAASuD,IAAsB,CAAA+B,SAE9BlE,uBAWjD","x_google_ignoreList":[0]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cleartrip/ct-platform-banner",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.5",
|
|
4
4
|
"description": "Banner Component",
|
|
5
5
|
"types": "dist/index.d.ts",
|
|
6
6
|
"main": "dist/ct-platform-banner.cjs.js",
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
"dist"
|
|
11
11
|
],
|
|
12
12
|
"dependencies": {
|
|
13
|
-
"@cleartrip/ct-platform-assets": "1.0.0-beta.
|
|
13
|
+
"@cleartrip/ct-platform-assets": "1.0.0-beta.3"
|
|
14
14
|
},
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"react": ">=16.8.0",
|