@bikdotai/bik-widgets 1.0.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.
- package/.eslintrc +22 -0
- package/.eslintrc.js +19 -0
- package/.github/workflows/main.yml +293 -0
- package/.prettierignore +13 -0
- package/.prettierrc +10 -0
- package/README.md +128 -0
- package/cypress/apiHelper/endpoints.ts +21 -0
- package/cypress/apiHelper/executor.ts +42 -0
- package/cypress/e2e/bottomDrawer.cy.ts +49 -0
- package/cypress/e2e/directReward.cy.ts +67 -0
- package/cypress/e2e/scratchTheCard.cy.ts +68 -0
- package/cypress/e2e/stw.cy.ts +82 -0
- package/cypress/e2e/waRedirection.cy.ts +46 -0
- package/cypress/fixtures/payloads.ts +330 -0
- package/cypress/support/commands.ts +37 -0
- package/cypress/support/e2e.ts +20 -0
- package/cypress.staging.config.ts +23 -0
- package/jsconfig.json +6 -0
- package/localtest.sh +10 -0
- package/log-server.js +86 -0
- package/package.json +79 -0
- package/postcss.config.js +8 -0
- package/src/Globals.d.ts +2 -0
- package/src/assets/lottie/santa.json +11722 -0
- package/src/assets/svg/CalendarClockIcon.tsx +30 -0
- package/src/assets/svg/CalendarIcon.tsx +24 -0
- package/src/assets/svg/CheckIcon.tsx +17 -0
- package/src/assets/svg/ChevronIcon.tsx +21 -0
- package/src/assets/svg/Close.tsx +39 -0
- package/src/assets/svg/Confetti.tsx +140 -0
- package/src/assets/svg/Copy.tsx +26 -0
- package/src/assets/svg/DropdownCheckIcon.tsx +35 -0
- package/src/assets/svg/ErrorIcon.tsx +27 -0
- package/src/assets/svg/RadioIcon.tsx +25 -0
- package/src/assets/svg/UncheckedCheckboxIcon.tsx +28 -0
- package/src/assets/svg/UncheckedRadioIcon.tsx +26 -0
- package/src/assets/svg/info.tsx +30 -0
- package/src/assets/svg/qrcode.svg +14 -0
- package/src/bootstrap.tsx +8 -0
- package/src/components/CtaCard/index.tsx +37 -0
- package/src/components/CtaCard/preview.module.css +32 -0
- package/src/components/CtaCard/style.module.css +32 -0
- package/src/components/EmailInput/emailInputBox.tsx +95 -0
- package/src/components/Fab/index.tsx +224 -0
- package/src/components/Fab/preview.module.css +28 -0
- package/src/components/Fab/style.module.css +37 -0
- package/src/components/Icons/Call.tsx +26 -0
- package/src/components/Icons/Cross.tsx +24 -0
- package/src/components/Icons/Gmail.tsx +61 -0
- package/src/components/Icons/Instagram.tsx +60 -0
- package/src/components/Icons/LiveChat.tsx +43 -0
- package/src/components/Icons/Messenger.tsx +57 -0
- package/src/components/Icons/Send.tsx +22 -0
- package/src/components/Icons/Whatsapp.tsx +24 -0
- package/src/components/Shimmer/index.tsx +12 -0
- package/src/components/Shimmer/style.module.css +37 -0
- package/src/components/SmsInput/smsInputBox.tsx +135 -0
- package/src/components/UserDetailsV2/userDetailsV2.desktop.module.css +52 -0
- package/src/components/UserDetailsV2/userDetailsV2.mobile.module.css +52 -0
- package/src/components/UserDetailsV2/userDetailsV2.module.css +81 -0
- package/src/components/UserDetailsV2/userDetailsV2.tsx +527 -0
- package/src/components/WhatsappInput/Spinner.tsx +26 -0
- package/src/components/WhatsappInput/whatsappInput.module.css +106 -0
- package/src/components/WhatsappInput/whatsappInputBox.tsx +155 -0
- package/src/components/WhatsappInput/whatsappInputPreviewDesktop.module.css +71 -0
- package/src/components/WhatsappInput/whatsappInputPreviewMobile.module.css +65 -0
- package/src/components/checkbox/checkbox.module.css +19 -0
- package/src/components/checkbox/checkbox.tsx +88 -0
- package/src/components/countryCodePicker/countriesDropdown.module.css +77 -0
- package/src/components/countryCodePicker/countriesDropdown.tsx +81 -0
- package/src/components/couponDetails/coupon.module.css +208 -0
- package/src/components/couponDetails/coupon.tsx +210 -0
- package/src/components/couponDetails/couponPreviewDesktop.module.css +158 -0
- package/src/components/couponDetails/couponPreviewMobile.module.css +164 -0
- package/src/components/index.ts +3 -0
- package/src/components/inputComponents/Checkbox.module.css +197 -0
- package/src/components/inputComponents/Checkbox.tsx +85 -0
- package/src/components/inputComponents/DatePicker.module.css +565 -0
- package/src/components/inputComponents/DatePicker.tsx +278 -0
- package/src/components/inputComponents/Dropdown.module.css +796 -0
- package/src/components/inputComponents/Dropdown.tsx +630 -0
- package/src/components/inputComponents/InputBox.module.css +401 -0
- package/src/components/inputComponents/InputBox.tsx +209 -0
- package/src/components/selectedCountry/selectedCountry.module.css +76 -0
- package/src/components/selectedCountry/selectedCountry.tsx +76 -0
- package/src/components/selectedCountry/selectedCountryPreviewDesktop.module.css +56 -0
- package/src/components/selectedCountry/selectedCountryPreviewMobile.module.css +57 -0
- package/src/components/userDetailsForm/RenderCustomFields.tsx +333 -0
- package/src/components/userDetailsForm/userDetailsForm.tsx +675 -0
- package/src/hooks/index.ts +4 -0
- package/src/hooks/useExitIntent.ts +452 -0
- package/src/hooks/useIsMobile.tsx +21 -0
- package/src/hooks/useMessageEvent.ts +8 -0
- package/src/hooks/useTriggeredIntentDetails.ts +43 -0
- package/src/hooks/useUrlListerner.ts +30 -0
- package/src/hooks/useWebSocketLogger.ts +59 -0
- package/src/hooks/useWindowEvent.ts +8 -0
- package/src/icons/copyIcon.tsx +26 -0
- package/src/icons/crossIconDesktop.tsx +20 -0
- package/src/icons/crossIconMobile.tsx +20 -0
- package/src/index.html +30 -0
- package/src/index.ts +32 -0
- package/src/index.tsx +1 -0
- package/src/repo/widgetRepo.ts +21 -0
- package/src/types/customFields.ts +73 -0
- package/src/utilities/cookie.ts +70 -0
- package/src/utilities/customFieldTypeMapping.ts +67 -0
- package/src/utilities/customFieldValidation.ts +201 -0
- package/src/utilities/encryption.ts +21 -0
- package/src/utilities/exitIntentUtils.ts +31 -0
- package/src/utilities/global.css +11 -0
- package/src/utilities/languageUtilities.ts +235 -0
- package/src/utilities/localRunner.js +26 -0
- package/src/utilities/localRunner.ts +27 -0
- package/src/utilities/localStorage.ts +40 -0
- package/src/utilities/script.tsx +15 -0
- package/src/utilities/stringUtils.ts +5 -0
- package/src/utilities/styleUtils.ts +134 -0
- package/src/utilities/variables.ts +11 -0
- package/src/utilities/widgetUtils.js +342 -0
- package/src/utilities/widgetUtils.ts +313 -0
- package/src/widgets/BottomDrawer/config.ts +41 -0
- package/src/widgets/BottomDrawer/index.tsx +116 -0
- package/src/widgets/BottomDrawer/modal.tsx +286 -0
- package/src/widgets/BottomDrawer/preview.module.css +122 -0
- package/src/widgets/BottomDrawer/previewMobile.module.css +124 -0
- package/src/widgets/BottomDrawer/style.module.css +279 -0
- package/src/widgets/CaptivateBanner/captivateBanner.tsx +200 -0
- package/src/widgets/CaptivateBanner/config.ts +72 -0
- package/src/widgets/CaptivateBanner/index.tsx +204 -0
- package/src/widgets/CaptivateBanner/previewDesktop.module.css +51 -0
- package/src/widgets/CaptivateBanner/previewMobile.module.css +51 -0
- package/src/widgets/CaptivateBanner/style.module.css +77 -0
- package/src/widgets/CaptivateBanner/utils.ts +104 -0
- package/src/widgets/CentrallyAlignedPopup/config.ts +42 -0
- package/src/widgets/CentrallyAlignedPopup/index.tsx +109 -0
- package/src/widgets/CentrallyAlignedPopup/modal.tsx +269 -0
- package/src/widgets/CentrallyAlignedPopup/preview.module.css +153 -0
- package/src/widgets/CentrallyAlignedPopup/previewMobile.module.css +153 -0
- package/src/widgets/CentrallyAlignedPopup/style.module.css +283 -0
- package/src/widgets/DirectReward/components/couponDetails.tsx +265 -0
- package/src/widgets/DirectReward/components/userDetails.tsx +117 -0
- package/src/widgets/DirectReward/config.ts +186 -0
- package/src/widgets/DirectReward/directReward.tsx +350 -0
- package/src/widgets/DirectReward/index.tsx +579 -0
- package/src/widgets/DirectReward/previewStyles/thankYouPreviewDesktop.module.css +276 -0
- package/src/widgets/DirectReward/previewStyles/thankYouPreviewMobile.module.css +303 -0
- package/src/widgets/DirectReward/previewStyles/userDetailsPreviewDesktop.module.css +511 -0
- package/src/widgets/DirectReward/previewStyles/userDetailsPreviewMobile.module.css +462 -0
- package/src/widgets/DirectReward/style.module.css +836 -0
- package/src/widgets/ExitIntentHook.tsx +28 -0
- package/src/widgets/STW/api.ts +70 -0
- package/src/widgets/STW/components/svgFactory.tsx +44 -0
- package/src/widgets/STW/config.ts +193 -0
- package/src/widgets/STW/context.ts +7 -0
- package/src/widgets/STW/couponDetails.tsx +121 -0
- package/src/widgets/STW/index.tsx +733 -0
- package/src/widgets/STW/previewStyles/thankyouPreviewDesktop.module.css +215 -0
- package/src/widgets/STW/previewStyles/thankyouPreviewMobile.module.css +205 -0
- package/src/widgets/STW/previewStyles/userInputsPreviewDesktop.module.css +732 -0
- package/src/widgets/STW/previewStyles/userInputsPreviewMobile.module.css +661 -0
- package/src/widgets/STW/previewStyles/wheelPreviewDesktop.module.css +498 -0
- package/src/widgets/STW/previewStyles/wheelPreviewMobile.module.css +497 -0
- package/src/widgets/STW/stw1.tsx +119 -0
- package/src/widgets/STW/stw2Components/wheelDesign.tsx +183 -0
- package/src/widgets/STW/stw2Pages/couponDetails.tsx +72 -0
- package/src/widgets/STW/stw2Pages/stw2.tsx +212 -0
- package/src/widgets/STW/stw2Pages/style.module.css +1226 -0
- package/src/widgets/STW/stw2Pages/userDetails.tsx +86 -0
- package/src/widgets/STW/stw2Pages/wheel.tsx +117 -0
- package/src/widgets/STW/stw2PreviewStyles/thankyouPreviewDesktop.module.css +835 -0
- package/src/widgets/STW/stw2PreviewStyles/thankyouPreviewMobile.module.css +787 -0
- package/src/widgets/STW/stw2PreviewStyles/userInputsPreviewDesktop.module.css +867 -0
- package/src/widgets/STW/stw2PreviewStyles/userInputsPreviewMobile.module.css +798 -0
- package/src/widgets/STW/stw2PreviewStyles/wheelPreviewDesktop.module.css +572 -0
- package/src/widgets/STW/stw2PreviewStyles/wheelPreviewMobile.module.css +559 -0
- package/src/widgets/STW/style.module.css +901 -0
- package/src/widgets/STW/userDetails.tsx +150 -0
- package/src/widgets/STW/utility.ts +664 -0
- package/src/widgets/STW/wheel.tsx +304 -0
- package/src/widgets/ScratchCard/ScratchOff/scratchOff.tsx +157 -0
- package/src/widgets/ScratchCard/config.ts +152 -0
- package/src/widgets/ScratchCard/globalStyle.module.css +931 -0
- package/src/widgets/ScratchCard/index.tsx +546 -0
- package/src/widgets/ScratchCard/modal.tsx +225 -0
- package/src/widgets/ScratchCard/preview.module.css +250 -0
- package/src/widgets/ScratchCard/previewMobile.module.css +247 -0
- package/src/widgets/ScratchCard/previewStyles/userDetailsPreviewDesktop.module.css +537 -0
- package/src/widgets/ScratchCard/previewStyles/userDetailsPreviewMobile.module.css +463 -0
- package/src/widgets/ScratchCard/style.module.css +220 -0
- package/src/widgets/ShopifyForm/config.ts +168 -0
- package/src/widgets/ShopifyForm/index.tsx +214 -0
- package/src/widgets/ShopifyForm/previewDesktop.module.css +117 -0
- package/src/widgets/ShopifyForm/previewMobile.module.css +131 -0
- package/src/widgets/ShopifyForm/shopifyForm.tsx +445 -0
- package/src/widgets/ShopifyForm/style.module.css +161 -0
- package/src/widgets/SingleButtonRedirection/config.ts +47 -0
- package/src/widgets/SingleButtonRedirection/index.tsx +121 -0
- package/src/widgets/WebStories/config.ts +105 -0
- package/src/widgets/WebStories/index.css +3 -0
- package/src/widgets/WebStories/index.tsx +282 -0
- package/src/widgets/WebStories/style.module.css +26 -0
- package/src/widgets/index.tsx +3 -0
- package/src/widgets/utility.ts +31 -0
- package/tsconfig.json +12 -0
- package/webpack.config.js +239 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
|
+
import { Fab } from 'components';
|
|
3
|
+
import includeMe from 'utilities/script';
|
|
4
|
+
import BottomDrawerModal from './modal';
|
|
5
|
+
import Send from 'components/Icons/Send';
|
|
6
|
+
import { IFab } from 'components/Fab';
|
|
7
|
+
import { IPageConfigProcessed, WidgetUtils } from '../../utilities/widgetUtils';
|
|
8
|
+
import { CookieUtils } from '../../utilities/cookie';
|
|
9
|
+
import { COOKIE_VALUES, EVENT_NAME } from 'utilities/variables';
|
|
10
|
+
import {
|
|
11
|
+
IRedirectWidgetCustomisation,
|
|
12
|
+
WidgetSchema,
|
|
13
|
+
ISO_CODES_VALUES,
|
|
14
|
+
} from '@bikdotai/bik-models/dm';
|
|
15
|
+
|
|
16
|
+
export interface IBottomDrawer extends WidgetSchema {
|
|
17
|
+
id?: string;
|
|
18
|
+
environment: string;
|
|
19
|
+
preview?: boolean;
|
|
20
|
+
isMobile?: boolean;
|
|
21
|
+
storeWidgetConfig: IPageConfigProcessed;
|
|
22
|
+
previewLanguage?: ISO_CODES_VALUES;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const BottomDrawer = (props: IBottomDrawer) => {
|
|
26
|
+
const [showModal, setShowModal] = useState(false);
|
|
27
|
+
const [showFab, setShowFab] = useState(false);
|
|
28
|
+
const [showWidget, setShowWidget] = useState(false);
|
|
29
|
+
const { widgetCustomisation } = props as {
|
|
30
|
+
widgetCustomisation: IRedirectWidgetCustomisation;
|
|
31
|
+
};
|
|
32
|
+
const widgetUtils = new WidgetUtils();
|
|
33
|
+
const cookieUtils = new CookieUtils();
|
|
34
|
+
|
|
35
|
+
cookieUtils.addItemInLocalStorage('storeId', props.info?.storeId);
|
|
36
|
+
|
|
37
|
+
cookieUtils.cookieClickHandler(
|
|
38
|
+
`bik-${props.id}-visitor`,
|
|
39
|
+
COOKIE_VALUES.BIK_VISITOR,
|
|
40
|
+
EVENT_NAME.WIDGET_VISITED,
|
|
41
|
+
1,
|
|
42
|
+
props.environment,
|
|
43
|
+
props.id,
|
|
44
|
+
);
|
|
45
|
+
|
|
46
|
+
const fabStyle: IFab = {
|
|
47
|
+
icon: <Send color={widgetCustomisation?.iconColor} />,
|
|
48
|
+
onClick() {
|
|
49
|
+
cookieUtils.cookieClickHandler(
|
|
50
|
+
`bik-${props.id}-clicked`,
|
|
51
|
+
'bikclick',
|
|
52
|
+
'WIDGET_CLICKED',
|
|
53
|
+
1,
|
|
54
|
+
props.environment,
|
|
55
|
+
props.id,
|
|
56
|
+
);
|
|
57
|
+
setShowFab(false);
|
|
58
|
+
setShowModal(true);
|
|
59
|
+
},
|
|
60
|
+
isMobile: props.isMobile,
|
|
61
|
+
preview: props.preview ?? false,
|
|
62
|
+
widgetCustomisation: {
|
|
63
|
+
iconColor: widgetCustomisation?.iconColor,
|
|
64
|
+
fabTransform: widgetCustomisation?.fabTransform,
|
|
65
|
+
fabPositioner: widgetCustomisation?.fabPositioner,
|
|
66
|
+
fabBackgroundColor: widgetCustomisation?.fabBackgroundColor,
|
|
67
|
+
fabLottie: widgetCustomisation?.fabLottie,
|
|
68
|
+
fabAnimationRun: widgetCustomisation?.fabAnimationRun,
|
|
69
|
+
fabImage: widgetCustomisation?.fabImage,
|
|
70
|
+
fabIconLink: widgetCustomisation?.fabIconLink,
|
|
71
|
+
fabWebSize: widgetCustomisation?.fabWebSize,
|
|
72
|
+
fabMobileSize: widgetCustomisation?.fabMobileSize,
|
|
73
|
+
},
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!props.preview) {
|
|
78
|
+
const shouldShow = widgetUtils.showWidget(
|
|
79
|
+
{
|
|
80
|
+
currentUrl: window.location.href.replace(window.location.origin, ''),
|
|
81
|
+
customUrls: props.storeWidgetConfig,
|
|
82
|
+
currentWidgetId: props.id,
|
|
83
|
+
},
|
|
84
|
+
props.info.isAutomationTesting,
|
|
85
|
+
);
|
|
86
|
+
setShowFab(shouldShow);
|
|
87
|
+
setShowWidget(shouldShow);
|
|
88
|
+
} else {
|
|
89
|
+
setShowFab(true);
|
|
90
|
+
}
|
|
91
|
+
}, [window.location.href]);
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<>
|
|
95
|
+
{showWidget && (
|
|
96
|
+
<div id={`bik-widget-root-${props.id}`}>
|
|
97
|
+
{showFab && <Fab {...fabStyle} id={`bik-bd-${props.id}-cta-fab`} />}
|
|
98
|
+
<BottomDrawerModal
|
|
99
|
+
{...props}
|
|
100
|
+
showModal={showModal}
|
|
101
|
+
onClose={() => {
|
|
102
|
+
setShowFab(true);
|
|
103
|
+
setShowModal(false);
|
|
104
|
+
}}
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
)}
|
|
108
|
+
</>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
export default React.memo(BottomDrawer);
|
|
113
|
+
|
|
114
|
+
if (process.env.NODE_ENV !== 'development') {
|
|
115
|
+
includeMe(BottomDrawer);
|
|
116
|
+
}
|
|
@@ -0,0 +1,286 @@
|
|
|
1
|
+
import React, { useEffect, useState } from 'react';
|
|
2
|
+
import CtaCard from 'components/CtaCard';
|
|
3
|
+
import Call from 'components/Icons/Call';
|
|
4
|
+
import Cross from 'components/Icons/Cross';
|
|
5
|
+
import Gmail from 'components/Icons/Gmail';
|
|
6
|
+
import Instagram from 'components/Icons/Instagram';
|
|
7
|
+
import Messenger from 'components/Icons/Messenger';
|
|
8
|
+
import Whatsapp from 'components/Icons/Whatsapp';
|
|
9
|
+
import ReactModal from 'react-modal';
|
|
10
|
+
import 'utilities/global.css';
|
|
11
|
+
import PreviewStyle from './preview.module.css';
|
|
12
|
+
import PreviewMobileStyle from './previewMobile.module.css';
|
|
13
|
+
import CAStyles from './style.module.css';
|
|
14
|
+
import SVGFactory, { SVGName } from 'widgets/STW/components/svgFactory';
|
|
15
|
+
import { decodeTextHelper } from '../utility';
|
|
16
|
+
import {
|
|
17
|
+
IRedirectWidgetCustomisation,
|
|
18
|
+
WidgetSchema,
|
|
19
|
+
LANGUAGE_VALUES,
|
|
20
|
+
LANGUAGE_ISO_CODES,
|
|
21
|
+
} from '@bikdotai/bik-models/dm';
|
|
22
|
+
import { LanguageUtils } from 'utilities/languageUtilities';
|
|
23
|
+
|
|
24
|
+
export interface IBottomDrawerModal extends WidgetSchema {
|
|
25
|
+
id?: string;
|
|
26
|
+
preview?: boolean;
|
|
27
|
+
isMobile?: boolean;
|
|
28
|
+
showModal: boolean;
|
|
29
|
+
environment: string;
|
|
30
|
+
onClose: () => void;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const BottomDrawerModal = (props: IBottomDrawerModal) => {
|
|
34
|
+
const languageUtils = new LanguageUtils();
|
|
35
|
+
const [widgetLanguage, setWidgetLanguage] = useState(LANGUAGE_VALUES.ENGLISH);
|
|
36
|
+
let currentStyle;
|
|
37
|
+
const { environment, widgetCustomisation } = props as unknown as {
|
|
38
|
+
environment: string;
|
|
39
|
+
widgetCustomisation: IRedirectWidgetCustomisation;
|
|
40
|
+
};
|
|
41
|
+
const redirectWidgetBackgroundColor =
|
|
42
|
+
widgetCustomisation?.redirectWidgetBackgroundColor ?? '#e0e0e0';
|
|
43
|
+
const bannerImage =
|
|
44
|
+
widgetCustomisation?.redirectWidgetBannerImage ??
|
|
45
|
+
'https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2Fbc3c06b3-e5cd-4d01-bd18-4a8e3639a665?alt=media&token=7e7b6987-c34c-4043-9b6e-3842b94d023d';
|
|
46
|
+
const title =
|
|
47
|
+
widgetCustomisation?.multiLingualConfigurations?.[widgetLanguage]
|
|
48
|
+
?.redirectWidgetTitleText ??
|
|
49
|
+
widgetCustomisation?.redirectWidgetTitleText ??
|
|
50
|
+
'Hi there';
|
|
51
|
+
let inlineOverlayStyle;
|
|
52
|
+
const { top, bottom, right, left } = widgetCustomisation?.fabPositioner ?? {
|
|
53
|
+
bottom: 30,
|
|
54
|
+
right: 30,
|
|
55
|
+
};
|
|
56
|
+
if (props?.preview) {
|
|
57
|
+
if (props?.isMobile) {
|
|
58
|
+
currentStyle = PreviewMobileStyle;
|
|
59
|
+
} else {
|
|
60
|
+
currentStyle = PreviewStyle;
|
|
61
|
+
inlineOverlayStyle = {
|
|
62
|
+
position: 'absolute',
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
currentStyle = CAStyles;
|
|
67
|
+
inlineOverlayStyle = {
|
|
68
|
+
zIndex: 2147483647,
|
|
69
|
+
pointerEvents: props?.preview ? 'none' : 'inherit',
|
|
70
|
+
top: 'inherit',
|
|
71
|
+
bottom: screen.width > 768 ? '30px' : '0px',
|
|
72
|
+
left: screen.width > 768 ? (left ? '30px' : 'inherit') : '0px',
|
|
73
|
+
right: screen.width > 768 ? (right ? '30px' : 'inherit') : '0px',
|
|
74
|
+
transform: screen.width > 768 ? 'inherit' : 'inherit',
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
const [show, setShow] = useState(false);
|
|
78
|
+
const {
|
|
79
|
+
whatsapp,
|
|
80
|
+
messenger,
|
|
81
|
+
phoneNumber,
|
|
82
|
+
instagram,
|
|
83
|
+
email,
|
|
84
|
+
emailSubject,
|
|
85
|
+
emailBody,
|
|
86
|
+
} = widgetCustomisation as IRedirectWidgetCustomisation;
|
|
87
|
+
let parent;
|
|
88
|
+
|
|
89
|
+
if (props.preview) {
|
|
90
|
+
parent = document.getElementById('preview-container');
|
|
91
|
+
} else {
|
|
92
|
+
parent = document.body;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
useEffect(() => {
|
|
96
|
+
setShow(props.showModal);
|
|
97
|
+
}, [props.showModal]);
|
|
98
|
+
|
|
99
|
+
useEffect(() => {
|
|
100
|
+
const isBikURL =
|
|
101
|
+
window.location.href?.includes('https://dashboard.bik.ai/') ||
|
|
102
|
+
window.location.href?.includes('https://staging.dashboard.bik.ai/');
|
|
103
|
+
const previewLanguage = props?.widgetCustomisation?.previewLanguage;
|
|
104
|
+
const storeLanguage =
|
|
105
|
+
(isBikURL ? previewLanguage : window?.Shopify?.locale) ??
|
|
106
|
+
previewLanguage ??
|
|
107
|
+
LANGUAGE_ISO_CODES.EN;
|
|
108
|
+
setWidgetLanguage(languageUtils.getStoreLanguage(storeLanguage));
|
|
109
|
+
}, [window.location.href, props?.widgetCustomisation?.previewLanguage]);
|
|
110
|
+
|
|
111
|
+
return (
|
|
112
|
+
<>
|
|
113
|
+
<ReactModal
|
|
114
|
+
isOpen={show}
|
|
115
|
+
ariaHideApp={false}
|
|
116
|
+
parentSelector={() => parent}
|
|
117
|
+
style={{
|
|
118
|
+
overlay: inlineOverlayStyle,
|
|
119
|
+
}}
|
|
120
|
+
className={currentStyle.content}
|
|
121
|
+
overlayClassName={currentStyle.overlay}
|
|
122
|
+
shouldCloseOnOverlayClick={true}
|
|
123
|
+
>
|
|
124
|
+
<div>
|
|
125
|
+
<button
|
|
126
|
+
className={currentStyle.crossBtn}
|
|
127
|
+
style={{ backgroundColor: redirectWidgetBackgroundColor }}
|
|
128
|
+
onClick={props.onClose}
|
|
129
|
+
>
|
|
130
|
+
<Cross
|
|
131
|
+
color={'#5C5C5C'}
|
|
132
|
+
height={props.preview ? 10 : 24}
|
|
133
|
+
width={props.preview ? 10 : 24}
|
|
134
|
+
/>
|
|
135
|
+
</button>
|
|
136
|
+
<div className={currentStyle.widgetContainer}>
|
|
137
|
+
<div className={currentStyle.widgetBody}>
|
|
138
|
+
<div className={currentStyle.widgetHeader}>
|
|
139
|
+
<img className={currentStyle.bannerImage} src={bannerImage} />
|
|
140
|
+
</div>
|
|
141
|
+
<div className={currentStyle.widgetContent}>
|
|
142
|
+
<div className={currentStyle.title}>{title}</div>
|
|
143
|
+
<div className={currentStyle.widgetRedirects}>
|
|
144
|
+
{whatsapp && (
|
|
145
|
+
<CtaCard
|
|
146
|
+
id={`bik-bd-${props.id}-cta-whatsapp`}
|
|
147
|
+
isMobile={props.isMobile}
|
|
148
|
+
Icon={() => (
|
|
149
|
+
<Whatsapp
|
|
150
|
+
height={
|
|
151
|
+
props.preview ? (props.isMobile ? 20 : 10) : 24
|
|
152
|
+
}
|
|
153
|
+
width={
|
|
154
|
+
props.preview ? (props.isMobile ? 20 : 10) : 24
|
|
155
|
+
}
|
|
156
|
+
/>
|
|
157
|
+
)}
|
|
158
|
+
text={'Open Whatsapp'}
|
|
159
|
+
onClick={() => {
|
|
160
|
+
const pathName = location.href.replace(
|
|
161
|
+
location.origin,
|
|
162
|
+
'',
|
|
163
|
+
);
|
|
164
|
+
window.open(
|
|
165
|
+
`${environment}/publicApiFunctions-redirectToChat/?contextType=bik-widgets&contextId=${props.id}&pathname=${pathName}&sourceUrl=${location.href}`,
|
|
166
|
+
);
|
|
167
|
+
}}
|
|
168
|
+
preview={props.preview}
|
|
169
|
+
/>
|
|
170
|
+
)}
|
|
171
|
+
{messenger && (
|
|
172
|
+
<CtaCard
|
|
173
|
+
id={`bik-bd-${props.id}-cta-messenger`}
|
|
174
|
+
isMobile={props.isMobile}
|
|
175
|
+
Icon={() => (
|
|
176
|
+
<Messenger
|
|
177
|
+
height={
|
|
178
|
+
props.preview ? (props.isMobile ? 20 : 10) : 24
|
|
179
|
+
}
|
|
180
|
+
width={
|
|
181
|
+
props.preview ? (props.isMobile ? 20 : 10) : 24
|
|
182
|
+
}
|
|
183
|
+
/>
|
|
184
|
+
)}
|
|
185
|
+
text={'Open Facebook Messenger'}
|
|
186
|
+
onClick={() => {
|
|
187
|
+
window.open(`https://m.me/${messenger}`);
|
|
188
|
+
}}
|
|
189
|
+
preview={props.preview}
|
|
190
|
+
/>
|
|
191
|
+
)}
|
|
192
|
+
{instagram && (
|
|
193
|
+
<CtaCard
|
|
194
|
+
id={`bik-bd-${props.id}-cta-instagram`}
|
|
195
|
+
isMobile={props.isMobile}
|
|
196
|
+
text={'Open Instagram'}
|
|
197
|
+
Icon={() => (
|
|
198
|
+
<Instagram
|
|
199
|
+
height={
|
|
200
|
+
props.preview ? (props.isMobile ? 20 : 10) : 24
|
|
201
|
+
}
|
|
202
|
+
width={
|
|
203
|
+
props.preview ? (props.isMobile ? 20 : 10) : 24
|
|
204
|
+
}
|
|
205
|
+
/>
|
|
206
|
+
)}
|
|
207
|
+
onClick={() => {
|
|
208
|
+
window.open(`https://www.instagram.com/${instagram}`);
|
|
209
|
+
}}
|
|
210
|
+
preview={props.preview}
|
|
211
|
+
/>
|
|
212
|
+
)}
|
|
213
|
+
{email && (
|
|
214
|
+
<CtaCard
|
|
215
|
+
id={`bik-bd-${props.id}-cta-email`}
|
|
216
|
+
isMobile={props.isMobile}
|
|
217
|
+
Icon={() => (
|
|
218
|
+
<Gmail
|
|
219
|
+
height={
|
|
220
|
+
props.preview ? (props.isMobile ? 20 : 10) : 24
|
|
221
|
+
}
|
|
222
|
+
width={
|
|
223
|
+
props.preview ? (props.isMobile ? 20 : 10) : 24
|
|
224
|
+
}
|
|
225
|
+
/>
|
|
226
|
+
)}
|
|
227
|
+
text={'Open Gmail'}
|
|
228
|
+
onClick={() => {
|
|
229
|
+
window.open(
|
|
230
|
+
`https://mail.google.com/mail/u/0/?fs=1&to=${email}&su=${encodeURIComponent(emailSubject)}&body=${encodeURIComponent(decodeTextHelper(emailBody))}&tf=cm`,
|
|
231
|
+
);
|
|
232
|
+
}}
|
|
233
|
+
preview={props.preview}
|
|
234
|
+
/>
|
|
235
|
+
)}
|
|
236
|
+
{phoneNumber && (
|
|
237
|
+
<CtaCard
|
|
238
|
+
id={`bik-bd-${props.id}-cta-phone`}
|
|
239
|
+
isMobile={props.isMobile}
|
|
240
|
+
Icon={() => (
|
|
241
|
+
<Call
|
|
242
|
+
height={
|
|
243
|
+
props.preview ? (props.isMobile ? 20 : 10) : 24
|
|
244
|
+
}
|
|
245
|
+
width={
|
|
246
|
+
props.preview ? (props.isMobile ? 20 : 10) : 24
|
|
247
|
+
}
|
|
248
|
+
/>
|
|
249
|
+
)}
|
|
250
|
+
text={`Call ${phoneNumber}`}
|
|
251
|
+
onClick={() => {
|
|
252
|
+
window.open(`tel:${phoneNumber}`);
|
|
253
|
+
}}
|
|
254
|
+
preview={props.preview}
|
|
255
|
+
/>
|
|
256
|
+
)}
|
|
257
|
+
<div
|
|
258
|
+
style={{
|
|
259
|
+
justifyContent: 'center',
|
|
260
|
+
alignItems: 'center',
|
|
261
|
+
display: 'flex',
|
|
262
|
+
}}
|
|
263
|
+
>
|
|
264
|
+
<button
|
|
265
|
+
onClick={() =>
|
|
266
|
+
window.open(
|
|
267
|
+
'https://bik.ai/?utm_campaign=Bottom_Drawer&utm_medium=Widgets&utm_source=Powered_by_bik',
|
|
268
|
+
)
|
|
269
|
+
}
|
|
270
|
+
className={currentStyle.poweredByBik}
|
|
271
|
+
>
|
|
272
|
+
{languageUtils.getPoweredByMessage(widgetLanguage)}
|
|
273
|
+
<SVGFactory name={SVGName.BIK} />
|
|
274
|
+
</button>
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
</div>
|
|
279
|
+
</div>
|
|
280
|
+
</div>
|
|
281
|
+
</ReactModal>
|
|
282
|
+
</>
|
|
283
|
+
);
|
|
284
|
+
};
|
|
285
|
+
|
|
286
|
+
export default BottomDrawerModal;
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700&display=swap');
|
|
2
|
+
|
|
3
|
+
.widgetContainer {
|
|
4
|
+
width: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.widgetBody {
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
position: relative;
|
|
10
|
+
border-radius: 8px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.widgetHeader {
|
|
14
|
+
position: absolute;
|
|
15
|
+
border-top-left-radius: 8px;
|
|
16
|
+
border-top-right-radius: 8px;
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.bannerImage {
|
|
21
|
+
height: 120px;
|
|
22
|
+
border-top-left-radius: 8px;
|
|
23
|
+
border-top-right-radius: 8px;
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.widgetContent {
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
margin: 44px 10px 10px 10px;
|
|
30
|
+
background-color: rgb(255, 255, 255);
|
|
31
|
+
box-shadow: rgb(0 0 0 / 12%) 0px 2px 8px;
|
|
32
|
+
border-radius: 4px;
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.widgetRedirects {
|
|
37
|
+
padding: 4px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.content {
|
|
41
|
+
background-color: white;
|
|
42
|
+
box-shadow: rgb(0 0 0 / 12%) 0px 2px 8px;
|
|
43
|
+
width: 130px;
|
|
44
|
+
border-radius: 8px;
|
|
45
|
+
border-width: 10px;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.overlay {
|
|
49
|
+
position: fixed;
|
|
50
|
+
right: 30px;
|
|
51
|
+
bottom: 30px;
|
|
52
|
+
border-radius: 5px;
|
|
53
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
54
|
+
display: flex;
|
|
55
|
+
align-items: center;
|
|
56
|
+
justify-content: center;
|
|
57
|
+
z-index: 10;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.crossBtn {
|
|
61
|
+
width: 20px;
|
|
62
|
+
height: 20px;
|
|
63
|
+
pointer-events: none;
|
|
64
|
+
border-radius: 16px;
|
|
65
|
+
display: flex;
|
|
66
|
+
position: absolute;
|
|
67
|
+
justify-content: center;
|
|
68
|
+
align-items: center;
|
|
69
|
+
top: -35px;
|
|
70
|
+
right: 0px;
|
|
71
|
+
border: none;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.bannerImage {
|
|
75
|
+
border-left: 4px;
|
|
76
|
+
border-right: 4px;
|
|
77
|
+
border-top: 4px;
|
|
78
|
+
overflow: hidden;
|
|
79
|
+
width: 300px;
|
|
80
|
+
height: 60px;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
.title {
|
|
84
|
+
font-family: 'Inter';
|
|
85
|
+
font-style: normal;
|
|
86
|
+
font-weight: 600;
|
|
87
|
+
font-size: 5px;
|
|
88
|
+
line-height: 24px;
|
|
89
|
+
text-align: center;
|
|
90
|
+
font-feature-settings:
|
|
91
|
+
'tnum' on,
|
|
92
|
+
'lnum' on,
|
|
93
|
+
'case' on,
|
|
94
|
+
'ss04' on;
|
|
95
|
+
color: #212121;
|
|
96
|
+
flex: none;
|
|
97
|
+
order: 0;
|
|
98
|
+
flex-grow: 0;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.poweredByBik {
|
|
102
|
+
background: none;
|
|
103
|
+
pointer-events: none;
|
|
104
|
+
font-family: 'Inter';
|
|
105
|
+
font-style: normal;
|
|
106
|
+
font-weight: 400;
|
|
107
|
+
font-size: 5px;
|
|
108
|
+
line-height: 16px;
|
|
109
|
+
font-feature-settings:
|
|
110
|
+
'tnum' on,
|
|
111
|
+
'lnum' on,
|
|
112
|
+
'case' on,
|
|
113
|
+
'ss04' on;
|
|
114
|
+
color: #9e9e9e;
|
|
115
|
+
border: none;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.poweredByBik svg {
|
|
119
|
+
width: 15px;
|
|
120
|
+
height: 15px;
|
|
121
|
+
margin-left: 2px;
|
|
122
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@100;200;300;400;500;600;700&display=swap');
|
|
2
|
+
|
|
3
|
+
.widgetContainer {
|
|
4
|
+
width: 100%;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.widgetBody {
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
position: relative;
|
|
10
|
+
border-radius: 8px;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.widgetHeader {
|
|
14
|
+
position: absolute;
|
|
15
|
+
border-top-left-radius: 8px;
|
|
16
|
+
border-top-right-radius: 8px;
|
|
17
|
+
width: 100%;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.bannerImage {
|
|
21
|
+
height: 120px;
|
|
22
|
+
border-top-left-radius: 8px;
|
|
23
|
+
border-top-right-radius: 8px;
|
|
24
|
+
width: 100%;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.widgetContent {
|
|
28
|
+
box-sizing: border-box;
|
|
29
|
+
margin: 90px 10px 10px 10px;
|
|
30
|
+
background-color: rgb(255, 255, 255);
|
|
31
|
+
box-shadow: rgb(0 0 0 / 12%) 0px 2px 8px;
|
|
32
|
+
border-radius: 4px;
|
|
33
|
+
position: relative;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
.widgetRedirects {
|
|
37
|
+
padding: 10px;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.liveChat {
|
|
41
|
+
width: 100%;
|
|
42
|
+
bottom: 0px;
|
|
43
|
+
left: 0px;
|
|
44
|
+
max-width: none;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
.content {
|
|
48
|
+
background-color: white;
|
|
49
|
+
box-shadow: rgb(0 0 0 / 12%) 0px 2px 8px;
|
|
50
|
+
width: 100%;
|
|
51
|
+
position: relative;
|
|
52
|
+
border-radius: 8px;
|
|
53
|
+
border-width: 10px;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
.overlay {
|
|
57
|
+
position: fixed;
|
|
58
|
+
right: 0px;
|
|
59
|
+
bottom: 0px;
|
|
60
|
+
width: 100%;
|
|
61
|
+
border-radius: 5px;
|
|
62
|
+
background-color: rgba(0, 0, 0, 0.5);
|
|
63
|
+
display: flex;
|
|
64
|
+
align-items: center;
|
|
65
|
+
justify-content: center;
|
|
66
|
+
z-index: 10;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.crossBtn {
|
|
70
|
+
width: 20px;
|
|
71
|
+
height: 20px;
|
|
72
|
+
border-radius: 16px;
|
|
73
|
+
display: flex;
|
|
74
|
+
pointer-events: none;
|
|
75
|
+
padding: 4px;
|
|
76
|
+
position: absolute;
|
|
77
|
+
justify-content: center;
|
|
78
|
+
align-items: center;
|
|
79
|
+
top: -20%;
|
|
80
|
+
left: 50%;
|
|
81
|
+
border: none;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.title {
|
|
85
|
+
font-family: 'Inter';
|
|
86
|
+
font-style: normal;
|
|
87
|
+
font-weight: 600;
|
|
88
|
+
font-size: 8px;
|
|
89
|
+
padding: 10px;
|
|
90
|
+
line-height: 24px;
|
|
91
|
+
text-align: center;
|
|
92
|
+
font-feature-settings:
|
|
93
|
+
'tnum' on,
|
|
94
|
+
'lnum' on,
|
|
95
|
+
'case' on,
|
|
96
|
+
'ss04' on;
|
|
97
|
+
color: #212121;
|
|
98
|
+
flex: none;
|
|
99
|
+
order: 0;
|
|
100
|
+
flex-grow: 0;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.poweredByBik {
|
|
104
|
+
pointer-events: none;
|
|
105
|
+
background: none;
|
|
106
|
+
font-family: 'Inter';
|
|
107
|
+
font-style: normal;
|
|
108
|
+
font-weight: 400;
|
|
109
|
+
font-size: 8px;
|
|
110
|
+
line-height: 16px;
|
|
111
|
+
font-feature-settings:
|
|
112
|
+
'tnum' on,
|
|
113
|
+
'lnum' on,
|
|
114
|
+
'case' on,
|
|
115
|
+
'ss04' on;
|
|
116
|
+
color: #9e9e9e;
|
|
117
|
+
border: none;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.poweredByBik svg {
|
|
121
|
+
width: 15px;
|
|
122
|
+
height: 15px;
|
|
123
|
+
margin-left: 2px;
|
|
124
|
+
}
|