@bikdotai/bik-widgets 1.0.0 → 1.0.1
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/dist-package/chunks/node_modules_lottie-web_build_player_lottie_light_js.927c24cd7bf65e593181.js +1 -0
- package/dist-package/chunks/src_components_UserDetailsV2_userDetailsV2_desktop_module_css.1efff8cddc83e0d3401c.js +1 -0
- package/dist-package/chunks/src_components_UserDetailsV2_userDetailsV2_mobile_module_css.dc9f2aa849ff133f141e.js +1 -0
- package/dist-package/chunks/src_components_UserDetailsV2_userDetailsV2_module_css.2a5fcc435fb3f37d0034.js +1 -0
- package/dist-package/chunks/src_components_checkbox_checkbox_module_css.be362d6b95515915d752.js +1 -0
- package/dist-package/chunks/src_components_countryCodePicker_countriesDropdown_module_css.a1c8409dacb9abf0dfce.js +1 -0
- package/dist-package/chunks/src_components_couponDetails_couponPreviewDesktop_module_css.ba5ab63e0394cc8a886f.js +1 -0
- package/dist-package/chunks/src_components_couponDetails_couponPreviewMobile_module_css.12642fbc4c56a68af36a.js +1 -0
- package/dist-package/chunks/src_components_couponDetails_coupon_module_css.828bdce7a75e349ebbb1.js +1 -0
- package/dist-package/chunks/src_components_inputComponents_Dropdown_module_css.7a0ce85538bef9add9d6.js +1 -0
- package/dist-package/chunks/src_components_selectedCountry_selectedCountryPreviewDesktop_module_css.7f3139377b37f12d921f.js +1 -0
- package/dist-package/chunks/src_components_selectedCountry_selectedCountryPreviewMobile_module_css.fed0a331046797ed5973.js +1 -0
- package/dist-package/chunks/src_components_selectedCountry_selectedCountry_module_css.630e2d9d9273a276f88c.js +1 -0
- package/dist-package/chunks/src_widgets_BottomDrawer_config_ts.c222c906d3920af1e1cb.js +1 -0
- package/dist-package/chunks/src_widgets_BottomDrawer_index_tsx.e9213fe49b5889e994e2.js +1 -0
- package/dist-package/chunks/src_widgets_CaptivateBanner_config_ts.9aaaf84faf2c9d249a49.js +1 -0
- package/dist-package/chunks/src_widgets_CaptivateBanner_index_tsx.af1c8798259dec2cb3fb.js +1 -0
- package/dist-package/chunks/src_widgets_CaptivateBanner_previewDesktop_module_css.934a120419e64fdcea21.js +1 -0
- package/dist-package/chunks/src_widgets_CaptivateBanner_previewMobile_module_css.ea372353d7adf8c386ed.js +1 -0
- package/dist-package/chunks/src_widgets_CaptivateBanner_style_module_css.ed1acad346401f481abc.js +1 -0
- package/dist-package/chunks/src_widgets_CentrallyAlignedPopup_config_ts.ddfca241b6f1a15049e3.js +1 -0
- package/dist-package/chunks/src_widgets_CentrallyAlignedPopup_index_tsx.d7599511d8519b775ec2.js +1 -0
- package/dist-package/chunks/src_widgets_DirectReward_config_ts.ec522622f042ce691399.js +1 -0
- package/dist-package/chunks/src_widgets_DirectReward_index_tsx.d56025f4ea5792718067.js +2 -0
- package/dist-package/chunks/src_widgets_DirectReward_previewStyles_thankYouPreviewDesktop_module_css.5a86965d82116b2d7b91.js +1 -0
- package/dist-package/chunks/src_widgets_DirectReward_previewStyles_thankYouPreviewMobile_module_css.c93d0e8be4e1f183bcfa.js +1 -0
- package/dist-package/chunks/src_widgets_DirectReward_previewStyles_userDetailsPreviewDesktop_module_css.d1d862bb3b3a826e6368.js +1 -0
- package/dist-package/chunks/src_widgets_DirectReward_previewStyles_userDetailsPreviewMobile_module_css.b6bed87791445adb8886.js +1 -0
- package/dist-package/chunks/src_widgets_DirectReward_style_module_css.8d53a303557c3ca8323a.js +1 -0
- package/dist-package/chunks/src_widgets_ExitIntentHook_tsx.36222875fcd0408c040e.js +1 -0
- package/dist-package/chunks/src_widgets_STW_config_ts.a12b07b7f62eb0ea6dc0.js +1 -0
- package/dist-package/chunks/src_widgets_STW_index_tsx.e6bce54b3f841b9f2113.js +2 -0
- package/dist-package/chunks/src_widgets_STW_previewStyles_thankyouPreviewDesktop_module_css.eda5e42e4f6cd9d87904.js +1 -0
- package/dist-package/chunks/src_widgets_STW_previewStyles_thankyouPreviewMobile_module_css.2da674c296feaef1b037.js +1 -0
- package/dist-package/chunks/src_widgets_STW_previewStyles_userInputsPreviewDesktop_module_css.ea588b3bebcbf4eccf95.js +1 -0
- package/dist-package/chunks/src_widgets_STW_previewStyles_userInputsPreviewMobile_module_css.dc4596a5b41427fae2e2.js +1 -0
- package/dist-package/chunks/src_widgets_STW_previewStyles_wheelPreviewDesktop_module_css.8b9735c97d5240afc20a.js +1 -0
- package/dist-package/chunks/src_widgets_STW_previewStyles_wheelPreviewMobile_module_css.66ddd61f1aedef0ecaa0.js +1 -0
- package/dist-package/chunks/src_widgets_STW_stw1_tsx.e62b308fba62beb29793.js +1 -0
- package/dist-package/chunks/src_widgets_STW_stw2Components_wheelDesign_tsx.925c7d3dd11bc361199d.js +2 -0
- package/dist-package/chunks/src_widgets_STW_stw2Pages_couponDetails_tsx.aa4f9803222126c1d645.js +2 -0
- package/dist-package/chunks/src_widgets_STW_stw2Pages_style_module_css.3a683c60c6678865aee1.js +1 -0
- package/dist-package/chunks/src_widgets_STW_stw2Pages_userDetails_tsx.da1c0b70a43507bcacd0.js +2 -0
- package/dist-package/chunks/src_widgets_STW_stw2Pages_wheel_tsx.a25f6eedaf43920b3f13.js +2 -0
- package/dist-package/chunks/src_widgets_STW_stw2PreviewStyles_thankyouPreviewDesktop_module_css.4d86be690aa2ac02d42d.js +1 -0
- package/dist-package/chunks/src_widgets_STW_stw2PreviewStyles_thankyouPreviewMobile_module_css.514e8bc036d20099217f.js +1 -0
- package/dist-package/chunks/src_widgets_STW_stw2PreviewStyles_userInputsPreviewDesktop_module_css.7dcb9e7b063e981a2730.js +1 -0
- package/dist-package/chunks/src_widgets_STW_stw2PreviewStyles_userInputsPreviewMobile_module_css.c2e5280360cd4298e0df.js +1 -0
- package/dist-package/chunks/src_widgets_STW_stw2PreviewStyles_wheelPreviewDesktop_module_css.7aaac3771035b1929dca.js +1 -0
- package/dist-package/chunks/src_widgets_STW_stw2PreviewStyles_wheelPreviewMobile_module_css.e8042369ff79890e7ff4.js +1 -0
- package/dist-package/chunks/src_widgets_STW_style_module_css.dd14839c719d8ae26778.js +1 -0
- package/dist-package/chunks/src_widgets_ScratchCard_config_ts.a49cbd81b255752007b2.js +1 -0
- package/dist-package/chunks/src_widgets_ScratchCard_globalStyle_module_css.1844fdb9f244f7eea6a3.js +1 -0
- package/dist-package/chunks/src_widgets_ScratchCard_index_tsx.8e6339dbbe8791e2bbea.js +2 -0
- package/dist-package/chunks/src_widgets_ScratchCard_previewStyles_userDetailsPreviewDesktop_module_css.bf4e3d52d37c4a2c8653.js +1 -0
- package/dist-package/chunks/src_widgets_ScratchCard_previewStyles_userDetailsPreviewMobile_module_css.68bd5853e5a6f0136f54.js +1 -0
- package/dist-package/chunks/src_widgets_ShopifyForm_config_ts.ae68d20563321b24c42f.js +1 -0
- package/dist-package/chunks/src_widgets_ShopifyForm_index_tsx.7f33a3f0fffbd88444c0.js +1 -0
- package/dist-package/chunks/src_widgets_ShopifyForm_previewDesktop_module_css.f5bb8a66eec449599342.js +1 -0
- package/dist-package/chunks/src_widgets_ShopifyForm_previewMobile_module_css.84fab56fb812decfa88b.js +1 -0
- package/dist-package/chunks/src_widgets_ShopifyForm_style_module_css.93e042eb60d4e7a9969e.js +1 -0
- package/dist-package/chunks/src_widgets_SingleButtonRedirection_config_ts.b34f37a93d9f21ca12d2.js +1 -0
- package/dist-package/chunks/src_widgets_WebStories_config_ts.347332569990592c9215.js +1 -0
- package/dist-package/chunks/src_widgets_WebStories_index_css.82d92057971ad51334f8.js +1 -0
- package/dist-package/chunks/src_widgets_WebStories_index_tsx.03f74c2c52432896cce9.js +1 -0
- package/dist-package/chunks/src_widgets_WebStories_style_module_css.acd37b9a11117cfb851a.js +1 -0
- package/dist-package/chunks/src_widgets_index_tsx.d0409ffd2e3c285e9dd3.js +1 -0
- package/dist-package/index.css +31 -0
- package/dist-package/index.js +2 -0
- package/dist-package/src_components_UserDetailsV2_userDetailsV2_desktop_module_css.index.css +1 -0
- package/dist-package/src_components_UserDetailsV2_userDetailsV2_mobile_module_css.index.css +1 -0
- package/dist-package/src_components_UserDetailsV2_userDetailsV2_module_css.index.css +1 -0
- package/dist-package/src_components_checkbox_checkbox_module_css.index.css +1 -0
- package/dist-package/src_components_countryCodePicker_countriesDropdown_module_css.index.css +1 -0
- package/dist-package/src_components_couponDetails_couponPreviewDesktop_module_css.index.css +1 -0
- package/dist-package/src_components_couponDetails_couponPreviewMobile_module_css.index.css +1 -0
- package/dist-package/src_components_couponDetails_coupon_module_css.index.css +1 -0
- package/dist-package/src_components_inputComponents_Dropdown_module_css.index.css +1 -0
- package/dist-package/src_components_selectedCountry_selectedCountryPreviewDesktop_module_css.index.css +1 -0
- package/dist-package/src_components_selectedCountry_selectedCountryPreviewMobile_module_css.index.css +1 -0
- package/dist-package/src_components_selectedCountry_selectedCountry_module_css.index.css +1 -0
- package/dist-package/src_widgets_CaptivateBanner_previewDesktop_module_css.index.css +1 -0
- package/dist-package/src_widgets_CaptivateBanner_previewMobile_module_css.index.css +1 -0
- package/dist-package/src_widgets_CaptivateBanner_style_module_css.index.css +1 -0
- package/dist-package/src_widgets_DirectReward_index_tsx.index.css +1 -0
- package/dist-package/src_widgets_DirectReward_previewStyles_thankYouPreviewDesktop_module_css.index.css +3 -0
- package/dist-package/src_widgets_DirectReward_previewStyles_thankYouPreviewMobile_module_css.index.css +3 -0
- package/dist-package/src_widgets_DirectReward_previewStyles_userDetailsPreviewDesktop_module_css.index.css +1 -0
- package/dist-package/src_widgets_DirectReward_previewStyles_userDetailsPreviewMobile_module_css.index.css +1 -0
- package/dist-package/src_widgets_DirectReward_style_module_css.index.css +1 -0
- package/dist-package/src_widgets_STW_index_tsx.index.css +2 -0
- package/dist-package/src_widgets_STW_previewStyles_thankyouPreviewDesktop_module_css.index.css +3 -0
- package/dist-package/src_widgets_STW_previewStyles_thankyouPreviewMobile_module_css.index.css +1 -0
- package/dist-package/src_widgets_STW_previewStyles_userInputsPreviewDesktop_module_css.index.css +3 -0
- package/dist-package/src_widgets_STW_previewStyles_userInputsPreviewMobile_module_css.index.css +1 -0
- package/dist-package/src_widgets_STW_previewStyles_wheelPreviewDesktop_module_css.index.css +3 -0
- package/dist-package/src_widgets_STW_previewStyles_wheelPreviewMobile_module_css.index.css +1 -0
- package/dist-package/src_widgets_STW_stw2Pages_style_module_css.index.css +1 -0
- package/dist-package/src_widgets_STW_stw2PreviewStyles_thankyouPreviewDesktop_module_css.index.css +3 -0
- package/dist-package/src_widgets_STW_stw2PreviewStyles_thankyouPreviewMobile_module_css.index.css +1 -0
- package/dist-package/src_widgets_STW_stw2PreviewStyles_userInputsPreviewDesktop_module_css.index.css +1 -0
- package/dist-package/src_widgets_STW_stw2PreviewStyles_userInputsPreviewMobile_module_css.index.css +1 -0
- package/dist-package/src_widgets_STW_stw2PreviewStyles_wheelPreviewDesktop_module_css.index.css +3 -0
- package/dist-package/src_widgets_STW_stw2PreviewStyles_wheelPreviewMobile_module_css.index.css +3 -0
- package/dist-package/src_widgets_STW_style_module_css.index.css +1 -0
- package/dist-package/src_widgets_ScratchCard_globalStyle_module_css.index.css +2 -0
- package/dist-package/src_widgets_ScratchCard_previewStyles_userDetailsPreviewDesktop_module_css.index.css +3 -0
- package/dist-package/src_widgets_ScratchCard_previewStyles_userDetailsPreviewMobile_module_css.index.css +3 -0
- package/dist-package/src_widgets_ShopifyForm_previewDesktop_module_css.index.css +1 -0
- package/dist-package/src_widgets_ShopifyForm_previewMobile_module_css.index.css +1 -0
- package/dist-package/src_widgets_ShopifyForm_style_module_css.index.css +1 -0
- package/dist-package/src_widgets_WebStories_index_css.index.css +1 -0
- package/dist-package/src_widgets_WebStories_index_tsx.index.css +3 -0
- package/dist-package/src_widgets_WebStories_style_module_css.index.css +1 -0
- package/package.json +17 -4
- package/.eslintrc +0 -22
- package/.eslintrc.js +0 -19
- package/.github/workflows/main.yml +0 -293
- package/.prettierignore +0 -13
- package/.prettierrc +0 -10
- package/cypress/apiHelper/endpoints.ts +0 -21
- package/cypress/apiHelper/executor.ts +0 -42
- package/cypress/e2e/bottomDrawer.cy.ts +0 -49
- package/cypress/e2e/directReward.cy.ts +0 -67
- package/cypress/e2e/scratchTheCard.cy.ts +0 -68
- package/cypress/e2e/stw.cy.ts +0 -82
- package/cypress/e2e/waRedirection.cy.ts +0 -46
- package/cypress/fixtures/payloads.ts +0 -330
- package/cypress/support/commands.ts +0 -37
- package/cypress/support/e2e.ts +0 -20
- package/cypress.staging.config.ts +0 -23
- package/jsconfig.json +0 -6
- package/localtest.sh +0 -10
- package/log-server.js +0 -86
- package/postcss.config.js +0 -8
- package/src/Globals.d.ts +0 -2
- package/src/assets/lottie/santa.json +0 -11722
- package/src/assets/svg/CalendarClockIcon.tsx +0 -30
- package/src/assets/svg/CalendarIcon.tsx +0 -24
- package/src/assets/svg/CheckIcon.tsx +0 -17
- package/src/assets/svg/ChevronIcon.tsx +0 -21
- package/src/assets/svg/Close.tsx +0 -39
- package/src/assets/svg/Confetti.tsx +0 -140
- package/src/assets/svg/Copy.tsx +0 -26
- package/src/assets/svg/DropdownCheckIcon.tsx +0 -35
- package/src/assets/svg/ErrorIcon.tsx +0 -27
- package/src/assets/svg/RadioIcon.tsx +0 -25
- package/src/assets/svg/UncheckedCheckboxIcon.tsx +0 -28
- package/src/assets/svg/UncheckedRadioIcon.tsx +0 -26
- package/src/assets/svg/info.tsx +0 -30
- package/src/assets/svg/qrcode.svg +0 -14
- package/src/bootstrap.tsx +0 -8
- package/src/components/CtaCard/index.tsx +0 -37
- package/src/components/CtaCard/preview.module.css +0 -32
- package/src/components/CtaCard/style.module.css +0 -32
- package/src/components/EmailInput/emailInputBox.tsx +0 -95
- package/src/components/Fab/index.tsx +0 -224
- package/src/components/Fab/preview.module.css +0 -28
- package/src/components/Fab/style.module.css +0 -37
- package/src/components/Icons/Call.tsx +0 -26
- package/src/components/Icons/Cross.tsx +0 -24
- package/src/components/Icons/Gmail.tsx +0 -61
- package/src/components/Icons/Instagram.tsx +0 -60
- package/src/components/Icons/LiveChat.tsx +0 -43
- package/src/components/Icons/Messenger.tsx +0 -57
- package/src/components/Icons/Send.tsx +0 -22
- package/src/components/Icons/Whatsapp.tsx +0 -24
- package/src/components/Shimmer/index.tsx +0 -12
- package/src/components/Shimmer/style.module.css +0 -37
- package/src/components/SmsInput/smsInputBox.tsx +0 -135
- package/src/components/UserDetailsV2/userDetailsV2.desktop.module.css +0 -52
- package/src/components/UserDetailsV2/userDetailsV2.mobile.module.css +0 -52
- package/src/components/UserDetailsV2/userDetailsV2.module.css +0 -81
- package/src/components/UserDetailsV2/userDetailsV2.tsx +0 -527
- package/src/components/WhatsappInput/Spinner.tsx +0 -26
- package/src/components/WhatsappInput/whatsappInput.module.css +0 -106
- package/src/components/WhatsappInput/whatsappInputBox.tsx +0 -155
- package/src/components/WhatsappInput/whatsappInputPreviewDesktop.module.css +0 -71
- package/src/components/WhatsappInput/whatsappInputPreviewMobile.module.css +0 -65
- package/src/components/checkbox/checkbox.module.css +0 -19
- package/src/components/checkbox/checkbox.tsx +0 -88
- package/src/components/countryCodePicker/countriesDropdown.module.css +0 -77
- package/src/components/countryCodePicker/countriesDropdown.tsx +0 -81
- package/src/components/couponDetails/coupon.module.css +0 -208
- package/src/components/couponDetails/coupon.tsx +0 -210
- package/src/components/couponDetails/couponPreviewDesktop.module.css +0 -158
- package/src/components/couponDetails/couponPreviewMobile.module.css +0 -164
- package/src/components/index.ts +0 -3
- package/src/components/inputComponents/Checkbox.module.css +0 -197
- package/src/components/inputComponents/Checkbox.tsx +0 -85
- package/src/components/inputComponents/DatePicker.module.css +0 -565
- package/src/components/inputComponents/DatePicker.tsx +0 -278
- package/src/components/inputComponents/Dropdown.module.css +0 -796
- package/src/components/inputComponents/Dropdown.tsx +0 -630
- package/src/components/inputComponents/InputBox.module.css +0 -401
- package/src/components/inputComponents/InputBox.tsx +0 -209
- package/src/components/selectedCountry/selectedCountry.module.css +0 -76
- package/src/components/selectedCountry/selectedCountry.tsx +0 -76
- package/src/components/selectedCountry/selectedCountryPreviewDesktop.module.css +0 -56
- package/src/components/selectedCountry/selectedCountryPreviewMobile.module.css +0 -57
- package/src/components/userDetailsForm/RenderCustomFields.tsx +0 -333
- package/src/components/userDetailsForm/userDetailsForm.tsx +0 -675
- package/src/hooks/index.ts +0 -4
- package/src/hooks/useExitIntent.ts +0 -452
- package/src/hooks/useIsMobile.tsx +0 -21
- package/src/hooks/useMessageEvent.ts +0 -8
- package/src/hooks/useTriggeredIntentDetails.ts +0 -43
- package/src/hooks/useUrlListerner.ts +0 -30
- package/src/hooks/useWebSocketLogger.ts +0 -59
- package/src/hooks/useWindowEvent.ts +0 -8
- package/src/icons/copyIcon.tsx +0 -26
- package/src/icons/crossIconDesktop.tsx +0 -20
- package/src/icons/crossIconMobile.tsx +0 -20
- package/src/index.html +0 -30
- package/src/index.ts +0 -32
- package/src/index.tsx +0 -1
- package/src/repo/widgetRepo.ts +0 -21
- package/src/types/customFields.ts +0 -73
- package/src/utilities/cookie.ts +0 -70
- package/src/utilities/customFieldTypeMapping.ts +0 -67
- package/src/utilities/customFieldValidation.ts +0 -201
- package/src/utilities/encryption.ts +0 -21
- package/src/utilities/exitIntentUtils.ts +0 -31
- package/src/utilities/global.css +0 -11
- package/src/utilities/languageUtilities.ts +0 -235
- package/src/utilities/localRunner.js +0 -26
- package/src/utilities/localRunner.ts +0 -27
- package/src/utilities/localStorage.ts +0 -40
- package/src/utilities/script.tsx +0 -15
- package/src/utilities/stringUtils.ts +0 -5
- package/src/utilities/styleUtils.ts +0 -134
- package/src/utilities/variables.ts +0 -11
- package/src/utilities/widgetUtils.js +0 -342
- package/src/utilities/widgetUtils.ts +0 -313
- package/src/widgets/BottomDrawer/config.ts +0 -41
- package/src/widgets/BottomDrawer/index.tsx +0 -116
- package/src/widgets/BottomDrawer/modal.tsx +0 -286
- package/src/widgets/BottomDrawer/preview.module.css +0 -122
- package/src/widgets/BottomDrawer/previewMobile.module.css +0 -124
- package/src/widgets/BottomDrawer/style.module.css +0 -279
- package/src/widgets/CaptivateBanner/captivateBanner.tsx +0 -200
- package/src/widgets/CaptivateBanner/config.ts +0 -72
- package/src/widgets/CaptivateBanner/index.tsx +0 -204
- package/src/widgets/CaptivateBanner/previewDesktop.module.css +0 -51
- package/src/widgets/CaptivateBanner/previewMobile.module.css +0 -51
- package/src/widgets/CaptivateBanner/style.module.css +0 -77
- package/src/widgets/CaptivateBanner/utils.ts +0 -104
- package/src/widgets/CentrallyAlignedPopup/config.ts +0 -42
- package/src/widgets/CentrallyAlignedPopup/index.tsx +0 -109
- package/src/widgets/CentrallyAlignedPopup/modal.tsx +0 -269
- package/src/widgets/CentrallyAlignedPopup/preview.module.css +0 -153
- package/src/widgets/CentrallyAlignedPopup/previewMobile.module.css +0 -153
- package/src/widgets/CentrallyAlignedPopup/style.module.css +0 -283
- package/src/widgets/DirectReward/components/couponDetails.tsx +0 -265
- package/src/widgets/DirectReward/components/userDetails.tsx +0 -117
- package/src/widgets/DirectReward/config.ts +0 -186
- package/src/widgets/DirectReward/directReward.tsx +0 -350
- package/src/widgets/DirectReward/index.tsx +0 -579
- package/src/widgets/DirectReward/previewStyles/thankYouPreviewDesktop.module.css +0 -276
- package/src/widgets/DirectReward/previewStyles/thankYouPreviewMobile.module.css +0 -303
- package/src/widgets/DirectReward/previewStyles/userDetailsPreviewDesktop.module.css +0 -511
- package/src/widgets/DirectReward/previewStyles/userDetailsPreviewMobile.module.css +0 -462
- package/src/widgets/DirectReward/style.module.css +0 -836
- package/src/widgets/ExitIntentHook.tsx +0 -28
- package/src/widgets/STW/api.ts +0 -70
- package/src/widgets/STW/components/svgFactory.tsx +0 -44
- package/src/widgets/STW/config.ts +0 -193
- package/src/widgets/STW/context.ts +0 -7
- package/src/widgets/STW/couponDetails.tsx +0 -121
- package/src/widgets/STW/index.tsx +0 -733
- package/src/widgets/STW/previewStyles/thankyouPreviewDesktop.module.css +0 -215
- package/src/widgets/STW/previewStyles/thankyouPreviewMobile.module.css +0 -205
- package/src/widgets/STW/previewStyles/userInputsPreviewDesktop.module.css +0 -732
- package/src/widgets/STW/previewStyles/userInputsPreviewMobile.module.css +0 -661
- package/src/widgets/STW/previewStyles/wheelPreviewDesktop.module.css +0 -498
- package/src/widgets/STW/previewStyles/wheelPreviewMobile.module.css +0 -497
- package/src/widgets/STW/stw1.tsx +0 -119
- package/src/widgets/STW/stw2Components/wheelDesign.tsx +0 -183
- package/src/widgets/STW/stw2Pages/couponDetails.tsx +0 -72
- package/src/widgets/STW/stw2Pages/stw2.tsx +0 -212
- package/src/widgets/STW/stw2Pages/style.module.css +0 -1226
- package/src/widgets/STW/stw2Pages/userDetails.tsx +0 -86
- package/src/widgets/STW/stw2Pages/wheel.tsx +0 -117
- package/src/widgets/STW/stw2PreviewStyles/thankyouPreviewDesktop.module.css +0 -835
- package/src/widgets/STW/stw2PreviewStyles/thankyouPreviewMobile.module.css +0 -787
- package/src/widgets/STW/stw2PreviewStyles/userInputsPreviewDesktop.module.css +0 -867
- package/src/widgets/STW/stw2PreviewStyles/userInputsPreviewMobile.module.css +0 -798
- package/src/widgets/STW/stw2PreviewStyles/wheelPreviewDesktop.module.css +0 -572
- package/src/widgets/STW/stw2PreviewStyles/wheelPreviewMobile.module.css +0 -559
- package/src/widgets/STW/style.module.css +0 -901
- package/src/widgets/STW/userDetails.tsx +0 -150
- package/src/widgets/STW/utility.ts +0 -664
- package/src/widgets/STW/wheel.tsx +0 -304
- package/src/widgets/ScratchCard/ScratchOff/scratchOff.tsx +0 -157
- package/src/widgets/ScratchCard/config.ts +0 -152
- package/src/widgets/ScratchCard/globalStyle.module.css +0 -931
- package/src/widgets/ScratchCard/index.tsx +0 -546
- package/src/widgets/ScratchCard/modal.tsx +0 -225
- package/src/widgets/ScratchCard/preview.module.css +0 -250
- package/src/widgets/ScratchCard/previewMobile.module.css +0 -247
- package/src/widgets/ScratchCard/previewStyles/userDetailsPreviewDesktop.module.css +0 -537
- package/src/widgets/ScratchCard/previewStyles/userDetailsPreviewMobile.module.css +0 -463
- package/src/widgets/ScratchCard/style.module.css +0 -220
- package/src/widgets/ShopifyForm/config.ts +0 -168
- package/src/widgets/ShopifyForm/index.tsx +0 -214
- package/src/widgets/ShopifyForm/previewDesktop.module.css +0 -117
- package/src/widgets/ShopifyForm/previewMobile.module.css +0 -131
- package/src/widgets/ShopifyForm/shopifyForm.tsx +0 -445
- package/src/widgets/ShopifyForm/style.module.css +0 -161
- package/src/widgets/SingleButtonRedirection/config.ts +0 -47
- package/src/widgets/SingleButtonRedirection/index.tsx +0 -121
- package/src/widgets/WebStories/config.ts +0 -105
- package/src/widgets/WebStories/index.css +0 -3
- package/src/widgets/WebStories/index.tsx +0 -282
- package/src/widgets/WebStories/style.module.css +0 -26
- package/src/widgets/index.tsx +0 -3
- package/src/widgets/utility.ts +0 -31
- package/tsconfig.json +0 -12
- package/webpack.config.js +0 -239
|
@@ -1,342 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
/**
|
|
3
|
-
* Considerations
|
|
4
|
-
* if path is greater we can ignore it
|
|
5
|
-
* fallback path query params should not be considered
|
|
6
|
-
*/
|
|
7
|
-
var __assign =
|
|
8
|
-
(this && this.__assign) ||
|
|
9
|
-
function () {
|
|
10
|
-
__assign =
|
|
11
|
-
Object.assign ||
|
|
12
|
-
function (t) {
|
|
13
|
-
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
14
|
-
s = arguments[i];
|
|
15
|
-
for (var p in s)
|
|
16
|
-
if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
|
17
|
-
}
|
|
18
|
-
return t;
|
|
19
|
-
};
|
|
20
|
-
return __assign.apply(this, arguments);
|
|
21
|
-
};
|
|
22
|
-
exports.__esModule = true;
|
|
23
|
-
exports.WidgetUtils = exports.FAB_POSITION = void 0;
|
|
24
|
-
var FAB_POSITION;
|
|
25
|
-
(function (FAB_POSITION) {
|
|
26
|
-
FAB_POSITION['BOTTOM_LEFT'] = 'BOTTOM_LEFT';
|
|
27
|
-
FAB_POSITION['BOTTOM_RIGHT'] = 'BOTTOM_RIGHT';
|
|
28
|
-
FAB_POSITION['CENTER_LEFT'] = 'CENTER_LEFT';
|
|
29
|
-
FAB_POSITION['CENTER_RIGHT'] = 'CENTER_RIGHT';
|
|
30
|
-
FAB_POSITION['POP_UP'] = 'POP_UP';
|
|
31
|
-
})((FAB_POSITION = exports.FAB_POSITION || (exports.FAB_POSITION = {})));
|
|
32
|
-
function isInIframe() {
|
|
33
|
-
try {
|
|
34
|
-
return window.self !== window.top;
|
|
35
|
-
} catch (e) {
|
|
36
|
-
return true;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
var WidgetUtils = /** @class */ (function () {
|
|
40
|
-
function WidgetUtils() {}
|
|
41
|
-
WidgetUtils.prototype.isValidUrl = function (urlString) {
|
|
42
|
-
var urlPattern = new RegExp(
|
|
43
|
-
'^(https?:\\/\\/)?' +
|
|
44
|
-
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' +
|
|
45
|
-
'((\\d{1,3}\\.){3}\\d{1,3}))' +
|
|
46
|
-
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' +
|
|
47
|
-
'(\\?[;&a-z\\d%_.~+=-]*)?' +
|
|
48
|
-
'(\\#[-a-z\\d_]*)?$',
|
|
49
|
-
'i',
|
|
50
|
-
);
|
|
51
|
-
return !!urlPattern.test(urlString);
|
|
52
|
-
};
|
|
53
|
-
WidgetUtils.prototype.isHomePage = function (urlString) {
|
|
54
|
-
var urlPattern = urlString.match(/^\/(\?.*)?$/);
|
|
55
|
-
return !!urlPattern;
|
|
56
|
-
};
|
|
57
|
-
//entry point
|
|
58
|
-
WidgetUtils.prototype.showWidget = function (config, isAutomationTest) {
|
|
59
|
-
var _this = this;
|
|
60
|
-
var _a, _b;
|
|
61
|
-
try {
|
|
62
|
-
// if(!isAutomationTest && isInIframe()){
|
|
63
|
-
// console.log('return 1')
|
|
64
|
-
// return false;
|
|
65
|
-
// }
|
|
66
|
-
var updatedCustomUrls_1 = {};
|
|
67
|
-
Object.keys(config.customUrls).forEach(function (key) {
|
|
68
|
-
if (_this.isValidUrl(key)) {
|
|
69
|
-
var newUrl = new URL(key);
|
|
70
|
-
var correctKey = newUrl.href.replace(newUrl.origin, '');
|
|
71
|
-
updatedCustomUrls_1[correctKey] = config.customUrls[key];
|
|
72
|
-
} else {
|
|
73
|
-
updatedCustomUrls_1[key] = config.customUrls[key];
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
var updatedConfig_1 = __assign(__assign({}, config), {
|
|
77
|
-
customUrls: updatedCustomUrls_1,
|
|
78
|
-
});
|
|
79
|
-
//handling home page alone
|
|
80
|
-
var homePageWidgetsArray =
|
|
81
|
-
(_a = updatedConfig_1.customUrls['/']) !== null && _a !== void 0
|
|
82
|
-
? _a
|
|
83
|
-
: [];
|
|
84
|
-
if (homePageWidgetsArray.length) {
|
|
85
|
-
var filtered = homePageWidgetsArray.filter(function (widget) {
|
|
86
|
-
return widget.widgetId == config.currentWidgetId;
|
|
87
|
-
});
|
|
88
|
-
if (filtered.length) {
|
|
89
|
-
if (updatedConfig_1.currentUrl == '/') {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
var constructedUrl = new URL(
|
|
93
|
-
'https://bik.ai' + updatedConfig_1.currentUrl,
|
|
94
|
-
);
|
|
95
|
-
if (constructedUrl.pathname == '/') {
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
//handling all pages
|
|
101
|
-
var allPagesWidgetsArray =
|
|
102
|
-
(_b = updatedConfig_1.customUrls['/*']) !== null && _b !== void 0
|
|
103
|
-
? _b
|
|
104
|
-
: [];
|
|
105
|
-
console.log('allPagesWidgetsArray', allPagesWidgetsArray);
|
|
106
|
-
if (allPagesWidgetsArray.length) {
|
|
107
|
-
var filtered = allPagesWidgetsArray.filter(function (widget) {
|
|
108
|
-
return widget.widgetId == config.currentWidgetId;
|
|
109
|
-
});
|
|
110
|
-
console.log('filtered', filtered);
|
|
111
|
-
if (filtered.length) {
|
|
112
|
-
var currentWidgetPosition_1 = filtered[0].fabPosition;
|
|
113
|
-
var allWidgetedUrls = Object.keys(updatedConfig_1.customUrls);
|
|
114
|
-
var filteredWidgetedUrls = allWidgetedUrls.filter(function (url) {
|
|
115
|
-
return url !== '/*';
|
|
116
|
-
});
|
|
117
|
-
console.log('filteredWidgetedUrls', filteredWidgetedUrls);
|
|
118
|
-
var priorityUrls = [];
|
|
119
|
-
for (var i = 0; i < filteredWidgetedUrls.length; i++) {
|
|
120
|
-
if (
|
|
121
|
-
filteredWidgetedUrls[i] !== '/' &&
|
|
122
|
-
updatedConfig_1.currentUrl.startsWith(filteredWidgetedUrls[i])
|
|
123
|
-
) {
|
|
124
|
-
priorityUrls.push(filteredWidgetedUrls[i]);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
console.log('priorityUrls', priorityUrls);
|
|
128
|
-
if (!priorityUrls.length) {
|
|
129
|
-
return true;
|
|
130
|
-
}
|
|
131
|
-
for (var i = 0; i < priorityUrls.length; i++) {
|
|
132
|
-
var clashingWidgets = updatedConfig_1.customUrls[
|
|
133
|
-
priorityUrls[i]
|
|
134
|
-
].filter(function (widget) {
|
|
135
|
-
return (
|
|
136
|
-
widget.widgetId !== updatedConfig_1.currentWidgetId &&
|
|
137
|
-
widget.fabPosition === currentWidgetPosition_1
|
|
138
|
-
);
|
|
139
|
-
});
|
|
140
|
-
console.log('clashingWidgets', clashingWidgets);
|
|
141
|
-
if (clashingWidgets.length) {
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return true;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
var ans = this.findExactMatch(updatedConfig_1);
|
|
149
|
-
if (ans && ans === config.currentWidgetId) {
|
|
150
|
-
return true;
|
|
151
|
-
}
|
|
152
|
-
var fuzzyAns = this.tryFuzzyMatch(updatedConfig_1);
|
|
153
|
-
console.log('fuzzyAns', fuzzyAns);
|
|
154
|
-
return fuzzyAns && fuzzyAns === config.currentWidgetId;
|
|
155
|
-
} catch (err) {
|
|
156
|
-
return false;
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
WidgetUtils.prototype.findExactMatch = function (config) {
|
|
160
|
-
try {
|
|
161
|
-
// try exact match
|
|
162
|
-
var ans_1;
|
|
163
|
-
if (config.customUrls[config.currentUrl]) {
|
|
164
|
-
var values = config.customUrls[config.currentUrl];
|
|
165
|
-
if (values.length) {
|
|
166
|
-
values.forEach(function (item) {
|
|
167
|
-
if (item.widgetId == config.currentWidgetId) {
|
|
168
|
-
ans_1 = config.currentWidgetId;
|
|
169
|
-
}
|
|
170
|
-
});
|
|
171
|
-
}
|
|
172
|
-
}
|
|
173
|
-
return ans_1;
|
|
174
|
-
} catch (err) {
|
|
175
|
-
return;
|
|
176
|
-
}
|
|
177
|
-
};
|
|
178
|
-
WidgetUtils.prototype.tryFuzzyMatch = function (config) {
|
|
179
|
-
var _this = this;
|
|
180
|
-
try {
|
|
181
|
-
var ans_2 = null;
|
|
182
|
-
var currentUrlRaw = config.currentUrl.replace(/\/\?/, '?');
|
|
183
|
-
var currentUrl_1 = this.separatePathAndQuery(
|
|
184
|
-
currentUrlRaw,
|
|
185
|
-
config.currentWidgetId,
|
|
186
|
-
);
|
|
187
|
-
if (!currentUrl_1) {
|
|
188
|
-
return;
|
|
189
|
-
}
|
|
190
|
-
// try max path match
|
|
191
|
-
var onlyUrls = Object.keys(config.customUrls);
|
|
192
|
-
var currentUrlPathLength_1 = currentUrl_1.path.split('/').length;
|
|
193
|
-
var possibleMatches_1 = [];
|
|
194
|
-
var possibleFallback_1 = {
|
|
195
|
-
path: '',
|
|
196
|
-
query: [],
|
|
197
|
-
count: 0,
|
|
198
|
-
};
|
|
199
|
-
onlyUrls.forEach(function (url) {
|
|
200
|
-
// if number of paths are greater than current url paths - ignore them
|
|
201
|
-
// only consider the path part here - remove/ignore the query params
|
|
202
|
-
if (_this.isHomePage(url)) return;
|
|
203
|
-
var values = config.customUrls[url];
|
|
204
|
-
values.forEach(function (item) {
|
|
205
|
-
var urlPath = _this.separatePathAndQuery(url, item.widgetId);
|
|
206
|
-
var urlPathLength =
|
|
207
|
-
urlPath === null || urlPath === void 0
|
|
208
|
-
? void 0
|
|
209
|
-
: urlPath.path.split('/').length;
|
|
210
|
-
if (urlPathLength && urlPathLength > currentUrlPathLength_1) {
|
|
211
|
-
// Do nothing
|
|
212
|
-
} else if (urlPathLength == currentUrlPathLength_1) {
|
|
213
|
-
// check if they match
|
|
214
|
-
if (
|
|
215
|
-
(currentUrl_1 === null || currentUrl_1 === void 0
|
|
216
|
-
? void 0
|
|
217
|
-
: currentUrl_1.path) ==
|
|
218
|
-
(urlPath === null || urlPath === void 0 ? void 0 : urlPath.path)
|
|
219
|
-
) {
|
|
220
|
-
possibleMatches_1.push(urlPath);
|
|
221
|
-
}
|
|
222
|
-
} else {
|
|
223
|
-
// fallback
|
|
224
|
-
// consider only pure url i.e. only path and no query params
|
|
225
|
-
if (
|
|
226
|
-
!(urlPath === null || urlPath === void 0
|
|
227
|
-
? void 0
|
|
228
|
-
: urlPath.query.length)
|
|
229
|
-
) {
|
|
230
|
-
if (
|
|
231
|
-
(currentUrl_1 === null || currentUrl_1 === void 0
|
|
232
|
-
? void 0
|
|
233
|
-
: currentUrl_1.path.includes(
|
|
234
|
-
urlPath === null || urlPath === void 0
|
|
235
|
-
? void 0
|
|
236
|
-
: urlPath.path,
|
|
237
|
-
)) &&
|
|
238
|
-
currentUrl_1.count > possibleFallback_1.count
|
|
239
|
-
) {
|
|
240
|
-
possibleFallback_1 = urlPath;
|
|
241
|
-
}
|
|
242
|
-
} else {
|
|
243
|
-
// Do nothing
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
});
|
|
247
|
-
});
|
|
248
|
-
if (possibleMatches_1.length) {
|
|
249
|
-
// if there are query params in currentUrl calculate max query match
|
|
250
|
-
if (currentUrl_1 && currentUrl_1.query.length) {
|
|
251
|
-
// find max query match
|
|
252
|
-
// even if one query param matches, consider that url
|
|
253
|
-
// else fallback to exact path match
|
|
254
|
-
var maxMatchPercentage_1 = 0;
|
|
255
|
-
var currentQueryHashMap_1 = new Map();
|
|
256
|
-
currentUrl_1.query.forEach(function (param) {
|
|
257
|
-
currentQueryHashMap_1.set(param, 1);
|
|
258
|
-
});
|
|
259
|
-
possibleMatches_1.forEach(function (possibleMatch) {
|
|
260
|
-
var matchCount = 0;
|
|
261
|
-
possibleMatch.query.forEach(function (query) {
|
|
262
|
-
if (currentQueryHashMap_1.has(query)) {
|
|
263
|
-
matchCount++;
|
|
264
|
-
}
|
|
265
|
-
});
|
|
266
|
-
var matchPercentage = currentUrl_1
|
|
267
|
-
? (matchCount /
|
|
268
|
-
(possibleMatch.query.length + currentUrl_1.query.length)) *
|
|
269
|
-
100
|
|
270
|
-
: 0;
|
|
271
|
-
if (maxMatchPercentage_1 < matchPercentage) {
|
|
272
|
-
maxMatchPercentage_1 = matchPercentage;
|
|
273
|
-
ans_2 = possibleMatch;
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
if (ans_2) {
|
|
277
|
-
// Do nothing
|
|
278
|
-
} else {
|
|
279
|
-
ans_2 = this.possibleMatchWithZeroQueryParam(possibleMatches_1);
|
|
280
|
-
if (ans_2 && ans_2.length) {
|
|
281
|
-
ans_2 = ans_2[0];
|
|
282
|
-
} else {
|
|
283
|
-
// if that is also empty, return best fallback
|
|
284
|
-
ans_2 = possibleFallback_1;
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
} else {
|
|
288
|
-
// if there are no query params in currentUrl, return the option with 0 query params
|
|
289
|
-
ans_2 = this.possibleMatchWithZeroQueryParam(possibleMatches_1);
|
|
290
|
-
if (ans_2 && ans_2.length) {
|
|
291
|
-
ans_2 = ans_2[0];
|
|
292
|
-
} else {
|
|
293
|
-
// if that is also empty, return best fallback
|
|
294
|
-
ans_2 = possibleFallback_1;
|
|
295
|
-
}
|
|
296
|
-
}
|
|
297
|
-
} else {
|
|
298
|
-
ans_2 = possibleFallback_1;
|
|
299
|
-
}
|
|
300
|
-
return (
|
|
301
|
-
(ans_2 === null || ans_2 === void 0 ? void 0 : ans_2.template) || null
|
|
302
|
-
);
|
|
303
|
-
} catch (err) {
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
};
|
|
307
|
-
WidgetUtils.prototype.separatePathAndQuery = function (url, widgetId) {
|
|
308
|
-
try {
|
|
309
|
-
// any dummy base url will do
|
|
310
|
-
url = 'https://www.bik.ai' + url;
|
|
311
|
-
var newUrl = new URL(url);
|
|
312
|
-
var obj = {
|
|
313
|
-
path: '',
|
|
314
|
-
query: [],
|
|
315
|
-
count: 0,
|
|
316
|
-
template: widgetId,
|
|
317
|
-
};
|
|
318
|
-
obj.path = newUrl.pathname;
|
|
319
|
-
obj.count = newUrl.pathname.split('/').length;
|
|
320
|
-
if (newUrl.search) {
|
|
321
|
-
var params = newUrl.search.split('?');
|
|
322
|
-
obj.query = params[1].split('&');
|
|
323
|
-
}
|
|
324
|
-
return obj;
|
|
325
|
-
} catch (err) {
|
|
326
|
-
return;
|
|
327
|
-
}
|
|
328
|
-
};
|
|
329
|
-
WidgetUtils.prototype.possibleMatchWithZeroQueryParam = function (
|
|
330
|
-
possibleMatches,
|
|
331
|
-
) {
|
|
332
|
-
try {
|
|
333
|
-
return possibleMatches.filter(function (possibleMatch) {
|
|
334
|
-
return !possibleMatch.query.length;
|
|
335
|
-
});
|
|
336
|
-
} catch (err) {
|
|
337
|
-
return;
|
|
338
|
-
}
|
|
339
|
-
};
|
|
340
|
-
return WidgetUtils;
|
|
341
|
-
})();
|
|
342
|
-
exports.WidgetUtils = WidgetUtils;
|
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Considerations
|
|
3
|
-
* if path is greater we can ignore it
|
|
4
|
-
* fallback path query params should not be considered
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
export enum FAB_POSITION {
|
|
8
|
-
BOTTOM_LEFT = 'BOTTOM_LEFT',
|
|
9
|
-
BOTTOM_RIGHT = 'BOTTOM_RIGHT',
|
|
10
|
-
CENTER_LEFT = 'CENTER_LEFT',
|
|
11
|
-
CENTER_RIGHT = 'CENTER_RIGHT',
|
|
12
|
-
POP_UP = 'POP_UP',
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export interface IPageConfigProcessed {
|
|
16
|
-
[key: string]: {
|
|
17
|
-
widgetId: string;
|
|
18
|
-
fabPosition: FAB_POSITION;
|
|
19
|
-
}[];
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface IShowWidget {
|
|
23
|
-
currentWidgetId: string;
|
|
24
|
-
customUrls: IPageConfigProcessed;
|
|
25
|
-
currentUrl: string;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
interface IParsedUrl {
|
|
29
|
-
path: string;
|
|
30
|
-
query: string[];
|
|
31
|
-
count: number;
|
|
32
|
-
template?: string;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
function isInIframe() {
|
|
36
|
-
try {
|
|
37
|
-
return window.self !== window.top;
|
|
38
|
-
} catch (e) {
|
|
39
|
-
return true;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export class WidgetUtils {
|
|
44
|
-
isValidUrl(urlString: string) {
|
|
45
|
-
const urlPattern = new RegExp(
|
|
46
|
-
'^(https?:\\/\\/)?' +
|
|
47
|
-
'((([a-z\\d]([a-z\\d-]*[a-z\\d])*)\\.)+[a-z]{2,}|' +
|
|
48
|
-
'((\\d{1,3}\\.){3}\\d{1,3}))' +
|
|
49
|
-
'(\\:\\d+)?(\\/[-a-z\\d%_.~+]*)*' +
|
|
50
|
-
'(\\?[;&a-z\\d%_.~+=-]*)?' +
|
|
51
|
-
'(\\#[-a-z\\d_]*)?$',
|
|
52
|
-
'i',
|
|
53
|
-
);
|
|
54
|
-
return !!urlPattern.test(urlString);
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
isHomePage(urlString: string) {
|
|
58
|
-
const urlPattern = urlString.match(/^\/(\?.*)?$/);
|
|
59
|
-
return !!urlPattern;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
//entry point
|
|
63
|
-
showWidget(config: IShowWidget, isAutomationTest?: boolean) {
|
|
64
|
-
try {
|
|
65
|
-
if (!isAutomationTest && isInIframe()) {
|
|
66
|
-
return false;
|
|
67
|
-
}
|
|
68
|
-
let updatedCustomUrls: IPageConfigProcessed = {};
|
|
69
|
-
Object.keys(config.customUrls).forEach(key => {
|
|
70
|
-
if (this.isValidUrl(key)) {
|
|
71
|
-
const newUrl = new URL(key);
|
|
72
|
-
const correctKey = newUrl.href.replace(newUrl.origin, '');
|
|
73
|
-
updatedCustomUrls[correctKey] = config.customUrls[key];
|
|
74
|
-
} else {
|
|
75
|
-
updatedCustomUrls[key] = config.customUrls[key];
|
|
76
|
-
}
|
|
77
|
-
});
|
|
78
|
-
const updatedConfig: IShowWidget = {
|
|
79
|
-
...config,
|
|
80
|
-
customUrls: updatedCustomUrls,
|
|
81
|
-
};
|
|
82
|
-
//handling home page alone
|
|
83
|
-
const homePageWidgetsArray = updatedConfig.customUrls['/'] ?? [];
|
|
84
|
-
if (homePageWidgetsArray.length) {
|
|
85
|
-
const filtered = homePageWidgetsArray.filter(
|
|
86
|
-
widget => widget.widgetId == config.currentWidgetId,
|
|
87
|
-
);
|
|
88
|
-
if (filtered.length) {
|
|
89
|
-
if (updatedConfig.currentUrl == '/') {
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
const constructedUrl = new URL(
|
|
93
|
-
'https://bik.ai' + updatedConfig.currentUrl,
|
|
94
|
-
);
|
|
95
|
-
if (constructedUrl.pathname == '/') {
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
//handling all pages
|
|
102
|
-
const allPagesWidgetsArray = updatedConfig.customUrls['/*'] ?? [];
|
|
103
|
-
if (allPagesWidgetsArray.length) {
|
|
104
|
-
const filtered = allPagesWidgetsArray.filter(
|
|
105
|
-
widget => widget.widgetId == config.currentWidgetId,
|
|
106
|
-
);
|
|
107
|
-
if (filtered.length) {
|
|
108
|
-
const currentWidgetPosition = filtered[0].fabPosition;
|
|
109
|
-
const allWidgetedUrls = Object.keys(updatedConfig.customUrls);
|
|
110
|
-
const filteredWidgetedUrls = allWidgetedUrls.filter(
|
|
111
|
-
url => url !== '/*',
|
|
112
|
-
);
|
|
113
|
-
const priorityUrls = [];
|
|
114
|
-
for (let i = 0; i < filteredWidgetedUrls.length; i++) {
|
|
115
|
-
if (updatedConfig.currentUrl.startsWith(filteredWidgetedUrls[i])) {
|
|
116
|
-
priorityUrls.push(filteredWidgetedUrls[i]);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
if (!priorityUrls.length) {
|
|
120
|
-
return true;
|
|
121
|
-
}
|
|
122
|
-
for (let i = 0; i < priorityUrls.length; i++) {
|
|
123
|
-
const clashingWidgets = updatedConfig.customUrls[
|
|
124
|
-
priorityUrls[i]
|
|
125
|
-
].filter(widget => {
|
|
126
|
-
return (
|
|
127
|
-
widget.widgetId !== updatedConfig.currentWidgetId &&
|
|
128
|
-
widget.fabPosition === currentWidgetPosition
|
|
129
|
-
);
|
|
130
|
-
});
|
|
131
|
-
if (clashingWidgets.length) {
|
|
132
|
-
return false;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
return true;
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
const ans = this.findExactMatch(updatedConfig);
|
|
139
|
-
if (ans && ans === config.currentWidgetId) {
|
|
140
|
-
return true;
|
|
141
|
-
}
|
|
142
|
-
const fuzzyAns = this.tryFuzzyMatch(updatedConfig);
|
|
143
|
-
return fuzzyAns && fuzzyAns === config.currentWidgetId;
|
|
144
|
-
} catch (err: any) {
|
|
145
|
-
return false;
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
findExactMatch(config: IShowWidget) {
|
|
150
|
-
try {
|
|
151
|
-
// try exact match
|
|
152
|
-
let ans;
|
|
153
|
-
if (config.customUrls[config.currentUrl]) {
|
|
154
|
-
const values = config.customUrls[config.currentUrl];
|
|
155
|
-
if (values.length) {
|
|
156
|
-
values.forEach(item => {
|
|
157
|
-
if (item.widgetId == config.currentWidgetId) {
|
|
158
|
-
ans = config.currentWidgetId;
|
|
159
|
-
}
|
|
160
|
-
});
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
return ans;
|
|
164
|
-
} catch (err: any) {
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
tryFuzzyMatch(config: IShowWidget) {
|
|
170
|
-
try {
|
|
171
|
-
let ans = null;
|
|
172
|
-
const currentUrlRaw = config.currentUrl.replace(/\/\?/, '?');
|
|
173
|
-
const currentUrl = this.separatePathAndQuery(
|
|
174
|
-
currentUrlRaw,
|
|
175
|
-
config.currentWidgetId,
|
|
176
|
-
);
|
|
177
|
-
if (!currentUrl) {
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
// try max path match
|
|
181
|
-
const onlyUrls = Object.keys(config.customUrls);
|
|
182
|
-
const currentUrlPathLength = currentUrl.path.split('/').length;
|
|
183
|
-
const possibleMatches: IParsedUrl[] = [];
|
|
184
|
-
let possibleFallback: IParsedUrl = {
|
|
185
|
-
path: '',
|
|
186
|
-
query: [],
|
|
187
|
-
count: 0,
|
|
188
|
-
};
|
|
189
|
-
onlyUrls.forEach(url => {
|
|
190
|
-
// if number of paths are greater than current url paths - ignore them
|
|
191
|
-
// only consider the path part here - remove/ignore the query params
|
|
192
|
-
if (this.isHomePage(url)) return;
|
|
193
|
-
const values = config.customUrls[url];
|
|
194
|
-
values.forEach(item => {
|
|
195
|
-
const urlPath = this.separatePathAndQuery(url, item.widgetId);
|
|
196
|
-
const urlPathLength = urlPath?.path.split('/').length;
|
|
197
|
-
if (urlPathLength && urlPathLength > currentUrlPathLength) {
|
|
198
|
-
// Do nothing
|
|
199
|
-
} else if (urlPathLength == currentUrlPathLength) {
|
|
200
|
-
// check if they match
|
|
201
|
-
if (currentUrl?.path == urlPath?.path) {
|
|
202
|
-
possibleMatches.push(urlPath);
|
|
203
|
-
}
|
|
204
|
-
} else {
|
|
205
|
-
// fallback
|
|
206
|
-
// consider only pure url i.e. only path and no query params
|
|
207
|
-
if (!urlPath?.query.length) {
|
|
208
|
-
if (
|
|
209
|
-
currentUrl?.path.includes(urlPath?.path as string) &&
|
|
210
|
-
currentUrl.count > possibleFallback.count
|
|
211
|
-
) {
|
|
212
|
-
possibleFallback = urlPath as unknown as IParsedUrl;
|
|
213
|
-
}
|
|
214
|
-
} else {
|
|
215
|
-
// Do nothing
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
});
|
|
220
|
-
|
|
221
|
-
if (possibleMatches.length) {
|
|
222
|
-
// if there are query params in currentUrl calculate max query match
|
|
223
|
-
if (currentUrl && currentUrl.query.length) {
|
|
224
|
-
// find max query match
|
|
225
|
-
// even if one query param matches, consider that url
|
|
226
|
-
// else fallback to exact path match
|
|
227
|
-
let maxMatchPercentage = 0;
|
|
228
|
-
|
|
229
|
-
const currentQueryHashMap = new Map();
|
|
230
|
-
currentUrl.query.forEach(param => {
|
|
231
|
-
currentQueryHashMap.set(param, 1);
|
|
232
|
-
});
|
|
233
|
-
possibleMatches.forEach(possibleMatch => {
|
|
234
|
-
let matchCount = 0;
|
|
235
|
-
possibleMatch.query.forEach((query: string) => {
|
|
236
|
-
if (currentQueryHashMap.has(query)) {
|
|
237
|
-
matchCount++;
|
|
238
|
-
}
|
|
239
|
-
});
|
|
240
|
-
const matchPercentage = currentUrl
|
|
241
|
-
? (matchCount /
|
|
242
|
-
(possibleMatch.query.length + currentUrl.query.length)) *
|
|
243
|
-
100
|
|
244
|
-
: 0;
|
|
245
|
-
if (maxMatchPercentage < matchPercentage) {
|
|
246
|
-
maxMatchPercentage = matchPercentage;
|
|
247
|
-
ans = possibleMatch;
|
|
248
|
-
}
|
|
249
|
-
});
|
|
250
|
-
|
|
251
|
-
if (ans) {
|
|
252
|
-
// Do nothing
|
|
253
|
-
} else {
|
|
254
|
-
ans = this.possibleMatchWithZeroQueryParam(possibleMatches);
|
|
255
|
-
if (ans && ans.length) {
|
|
256
|
-
ans = ans[0];
|
|
257
|
-
} else {
|
|
258
|
-
// if that is also empty, return best fallback
|
|
259
|
-
ans = possibleFallback;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
} else {
|
|
263
|
-
// if there are no query params in currentUrl, return the option with 0 query params
|
|
264
|
-
ans = this.possibleMatchWithZeroQueryParam(possibleMatches);
|
|
265
|
-
if (ans && ans.length) {
|
|
266
|
-
ans = ans[0];
|
|
267
|
-
} else {
|
|
268
|
-
// if that is also empty, return best fallback
|
|
269
|
-
ans = possibleFallback;
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
} else {
|
|
273
|
-
ans = possibleFallback;
|
|
274
|
-
}
|
|
275
|
-
return ans?.template || null;
|
|
276
|
-
} catch (err: any) {
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
|
-
separatePathAndQuery(url: string, widgetId: string) {
|
|
282
|
-
try {
|
|
283
|
-
// any dummy base url will do
|
|
284
|
-
url = 'https://www.bik.ai' + url;
|
|
285
|
-
const newUrl = new URL(url);
|
|
286
|
-
const obj: IParsedUrl = {
|
|
287
|
-
path: '',
|
|
288
|
-
query: [],
|
|
289
|
-
count: 0,
|
|
290
|
-
template: widgetId,
|
|
291
|
-
};
|
|
292
|
-
obj.path = newUrl.pathname;
|
|
293
|
-
obj.count = newUrl.pathname.split('/').length;
|
|
294
|
-
if (newUrl.search) {
|
|
295
|
-
const params = newUrl.search.split('?');
|
|
296
|
-
obj.query = params[1].split('&');
|
|
297
|
-
}
|
|
298
|
-
return obj;
|
|
299
|
-
} catch (err: any) {
|
|
300
|
-
return;
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
possibleMatchWithZeroQueryParam(possibleMatches: IParsedUrl[]) {
|
|
305
|
-
try {
|
|
306
|
-
return possibleMatches.filter(
|
|
307
|
-
possibleMatch => !possibleMatch.query.length,
|
|
308
|
-
);
|
|
309
|
-
} catch (err: any) {
|
|
310
|
-
return;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { IBottomDrawer } from './index';
|
|
2
|
-
const config: IBottomDrawer = {
|
|
3
|
-
preview: false,
|
|
4
|
-
environment: 'staging',
|
|
5
|
-
visibility: {
|
|
6
|
-
visiblePages: ['/', '/products'],
|
|
7
|
-
},
|
|
8
|
-
widgetCustomisation: {
|
|
9
|
-
iconColor: '#000000',
|
|
10
|
-
fabBackgroundColor: '#FBDC7E',
|
|
11
|
-
widgetName: 'Bottom Drawer tmyv',
|
|
12
|
-
redirectWidgetBackgroundColor: '',
|
|
13
|
-
redirectWidgetTitleText: 'Connect with us!',
|
|
14
|
-
redirectWidgetBannerImage:
|
|
15
|
-
'https://png.pngtree.com/thumb_back/fh260/back_pic/02/50/63/71577e1cf59d802.jpg',
|
|
16
|
-
livechatEnabled: false,
|
|
17
|
-
whatsapp: '916364856308',
|
|
18
|
-
whatsappMessage: 'afas',
|
|
19
|
-
emailSubject: '',
|
|
20
|
-
emailBody: '',
|
|
21
|
-
fabPositioner: {
|
|
22
|
-
bottom: '30px',
|
|
23
|
-
right: '30px',
|
|
24
|
-
},
|
|
25
|
-
fabIconLink:
|
|
26
|
-
'https://storage.googleapis.com/bik-widget-mfe/bap%2Ffab-assets%2Ficons%2Fbik%2Fredirect.svg',
|
|
27
|
-
fabPosition: 'BOTTOM_RIGHT',
|
|
28
|
-
fabMobileSize: 50,
|
|
29
|
-
fabWebSize: 50,
|
|
30
|
-
multiLingualConfigurations: {
|
|
31
|
-
ENGLISH: {
|
|
32
|
-
redirectWidgetTitleText: 'Connect English',
|
|
33
|
-
},
|
|
34
|
-
FRENCH: {
|
|
35
|
-
redirectWidgetTitleText: 'Connect French',
|
|
36
|
-
},
|
|
37
|
-
},
|
|
38
|
-
},
|
|
39
|
-
};
|
|
40
|
-
|
|
41
|
-
export default config;
|