@hhgtech/hhg-components 1.29.467 → 1.29.468
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/build/{InputDate-9b287d31.js → InputDate-5b0b7869.js} +5 -5
- package/build/{LastPeriod-a0ecbab4.js → LastPeriod-85ca707d.js} +1 -1
- package/build/{MobileBottomNavigationIcon-fbbcb45e.js → MobileBottomNavigationIcon-19d196c9.js} +3 -3
- package/build/{Spinner-a712cfcb.js → Spinner-39b4a549.js} +1 -1
- package/build/{WhatsApp-9cf7b0ec.js → WhatsApp-cf792749.js} +1 -1
- package/build/adapters.js +20 -20
- package/build/atoms.js +50 -50
- package/build/babyGrowth.js +86 -86
- package/build/cache.js +2 -2
- package/build/care.js +18 -18
- package/build/careBookingSearchBar.js +14 -14
- package/build/careBookingSearchBarV2.js +15 -15
- package/build/components.js +104 -104
- package/build/{constants-304f9adf.js → constants-00963ab7.js} +1 -1
- package/build/constants.js +3 -3
- package/build/constantsDomainLocales.js +1 -1
- package/build/constantsRiskScreener.js +2 -2
- package/build/constantsSite.js +2 -2
- package/build/{core-f6662dae.js → core-d51c7c39.js} +1 -1
- package/build/{dataTransform-5fe88f23.js → dataTransform-4ea49764.js} +1 -1
- package/build/ecom.js +5 -5
- package/build/{editor-2f5c609e.js → editor-56306bcc.js} +11 -11
- package/build/embeddedHeathToolCards_babyGrowth.js +25 -25
- package/build/embeddedHeathToolCards_babyPoop.js +22 -22
- package/build/embeddedHeathToolCards_babyVaccine.js +24 -24
- package/build/embeddedHeathToolCards_bmi_bmi.js +27 -27
- package/build/embeddedHeathToolCards_bmrBmr.js +27 -27
- package/build/embeddedHeathToolCards_dueDate_dueDate.js +24 -24
- package/build/embeddedHeathToolCards_ovulation_ovulation.js +24 -24
- package/build/embeddedHeathToolCards_pwg_pwg.js +28 -28
- package/build/embeddedHeathToolCards_targetHeartRate.js +29 -29
- package/build/esm/{InputDate-e16912cb.js → InputDate-674d51bc.js} +5 -5
- package/build/esm/{LastPeriod-b6ca67de.js → LastPeriod-81c8962f.js} +1 -1
- package/build/esm/{MobileBottomNavigationIcon-d74e19c7.js → MobileBottomNavigationIcon-eb8c0470.js} +3 -3
- package/build/esm/{Spinner-87a04254.js → Spinner-2b1edded.js} +1 -1
- package/build/esm/{WhatsApp-352685d9.js → WhatsApp-a3e8b9df.js} +1 -1
- package/build/esm/adapters.js +20 -20
- package/build/esm/atoms.js +50 -50
- package/build/esm/babyGrowth.js +86 -86
- package/build/esm/cache.js +2 -2
- package/build/esm/care.js +18 -18
- package/build/esm/careBookingSearchBar.js +14 -14
- package/build/esm/careBookingSearchBarV2.js +15 -15
- package/build/esm/components.js +104 -104
- package/build/esm/{constants-3c64b5a9.js → constants-2434775c.js} +1 -1
- package/build/esm/constants.js +3 -3
- package/build/esm/constantsDomainLocales.js +1 -1
- package/build/esm/constantsRiskScreener.js +2 -2
- package/build/esm/constantsSite.js +2 -2
- package/build/esm/{core-b8082a96.js → core-9b0e22c3.js} +1 -1
- package/build/esm/{dataTransform-cf78356f.js → dataTransform-d85e8f2f.js} +1 -1
- package/build/esm/ecom.js +5 -5
- package/build/esm/{editor-3d887dc2.js → editor-371e66a1.js} +11 -11
- package/build/esm/embeddedHeathToolCards_babyGrowth.js +25 -25
- package/build/esm/embeddedHeathToolCards_babyPoop.js +22 -22
- package/build/esm/embeddedHeathToolCards_babyVaccine.js +24 -24
- package/build/esm/embeddedHeathToolCards_bmi_bmi.js +27 -27
- package/build/esm/embeddedHeathToolCards_bmrBmr.js +27 -27
- package/build/esm/embeddedHeathToolCards_dueDate_dueDate.js +24 -24
- package/build/esm/embeddedHeathToolCards_ovulation_ovulation.js +24 -24
- package/build/esm/embeddedHeathToolCards_pwg_pwg.js +28 -28
- package/build/esm/embeddedHeathToolCards_targetHeartRate.js +29 -29
- package/build/esm/footer.js +22 -22
- package/build/esm/gAssets.js +2 -2
- package/build/esm/{healthTools-61e6142d.js → healthTools-eef0631c.js} +1 -1
- package/build/esm/healthToolsCardWrapper.js +20 -20
- package/build/esm/healthToolsForm.js +35 -35
- package/build/esm/hooks.js +13 -13
- package/build/esm/i18n.js +2 -2
- package/build/esm/i18nV2.js +2 -2
- package/build/esm/{index-d6f80ae6.js → index-01dc5712.js} +7 -7
- package/build/esm/{index-2f9ac679.js → index-02e24bd2.js} +22 -22
- package/build/esm/{index-11e21357.js → index-07a73a38.js} +26 -26
- package/build/esm/{index-0d3e8462.js → index-0997f55f.js} +16 -16
- package/build/esm/{index-df493292.js → index-140d47ba.js} +2 -2
- package/build/esm/{index-4148f726.js → index-16304953.js} +16 -16
- package/build/esm/{index-a011aa7b.js → index-171896a4.js} +3 -3
- package/build/esm/{index-a03eec47.js → index-17cf690f.js} +5 -5
- package/build/esm/{index-062cab04.js → index-1a149548.js} +6 -6
- package/build/esm/{index-b12bf0d8.js → index-1aad9e57.js} +2 -2
- package/build/esm/{index-1c505e14.js → index-1bd5d939.js} +2 -2
- package/build/esm/{index-527a9e64.js → index-1c8fd9e1.js} +13 -13
- package/build/esm/{index-29b9ef83.js → index-1d00e35b.js} +7 -7
- package/build/esm/{index-992d17b3.js → index-204ac58f.js} +2 -2
- package/build/esm/{index-20657236.js → index-20e54bdd.js} +6 -6
- package/build/esm/{index-354dab4a.js → index-2883f8be.js} +1 -1
- package/build/esm/{index-f5971067.js → index-2c4d2b8a.js} +15 -15
- package/build/esm/{index-250dd77e.js → index-360724d6.js} +32 -32
- package/build/esm/{index-8c18d5bb.js → index-3625e45c.js} +3 -3
- package/build/esm/{index-ee24dd2f.js → index-3972ecae.js} +2 -2
- package/build/esm/{index-8694e811.js → index-399f9f30.js} +19 -19
- package/build/esm/{index-e21ee0c8.js → index-3ac57b95.js} +18 -18
- package/build/esm/{index-2528aaf0.js → index-4061d1ab.js} +2 -2
- package/build/esm/{index-a9b12d78.js → index-479346aa.js} +1 -1
- package/build/esm/{index-c1864b5d.js → index-47e8beb4.js} +2 -2
- package/build/esm/{index-76c321f2.js → index-4ec86380.js} +14 -14
- package/build/esm/{index-d5d194d0.js → index-5e6925f7.js} +2 -2
- package/build/esm/{index-537ec13d.js → index-6090eace.js} +16 -16
- package/build/esm/{index-efe669b5.js → index-6717cc50.js} +8 -8
- package/build/esm/{index-28698234.js → index-68594694.js} +2 -2
- package/build/esm/{index-5ac64220.js → index-6eeb7603.js} +21 -21
- package/build/esm/{index-04c83109.js → index-727d98b6.js} +6 -6
- package/build/esm/{index-1a58120d.js → index-737fb420.js} +30 -30
- package/build/esm/{index-07b31406.js → index-77ab7e37.js} +8 -8
- package/build/esm/{index-2e1c57f3.js → index-77c20a53.js} +32 -32
- package/build/esm/{index-ed0d11fc.js → index-781aea50.js} +2 -2
- package/build/esm/{index-700cfcb4.js → index-862e18fe.js} +2 -2
- package/build/esm/{index-2afb5a3b.js → index-902514bf.js} +3 -3
- package/build/esm/{index-724ca7b9.js → index-94044c22.js} +1 -1
- package/build/esm/{index-1150c067.js → index-9a15feee.js} +21 -21
- package/build/esm/{index-a24ad065.js → index-9e688f4f.js} +13 -13
- package/build/esm/{index-98fdc97e.js → index-a30cde2d.js} +3 -3
- package/build/esm/{index-3cc386b3.js → index-a390c8de.js} +2 -2
- package/build/esm/{index-00a475d5.js → index-a9155f3e.js} +18 -18
- package/build/esm/{index-1318bcfa.js → index-ad6ec073.js} +10 -10
- package/build/esm/{index-aa28c9b7.js → index-b92ceb5a.js} +2 -2
- package/build/esm/{index-769b62ac.js → index-bed0d242.js} +14 -14
- package/build/esm/{index-43921892.js → index-ca959e2f.js} +4 -4
- package/build/esm/{index-f2917d18.js → index-ce19a7b9.js} +14 -14
- package/build/esm/{index-195b6f59.js → index-cf676a41.js} +1 -1
- package/build/esm/{index-2bc75ec0.js → index-cfc50adf.js} +11 -11
- package/build/esm/{index-be022759.js → index-d2d1a986.js} +1 -1
- package/build/esm/{index-65caf623.js → index-d63aad6a.js} +14 -14
- package/build/esm/{index-4f5b5d16.js → index-d971338a.js} +3 -3
- package/build/esm/{index-5d98bd65.js → index-da6b104e.js} +2 -2
- package/build/esm/{index-ea352220.js → index-dd4ecad7.js} +1 -1
- package/build/esm/{index-1d2a3f31.js → index-ddf56a22.js} +2 -2
- package/build/esm/{index-49895d0e.js → index-e166b086.js} +2 -2
- package/build/esm/{index-05f5dbbe.js → index-e16c3867.js} +1 -1
- package/build/esm/{index-2adab8d2.js → index-e2800d29.js} +3 -3
- package/build/esm/{index-3a690064.js → index-e6fe2975.js} +17 -17
- package/build/esm/{index-a18953c2.js → index-e7d6f8e6.js} +25 -25
- package/build/esm/{index-fa02dd81.js → index-ea77c224.js} +3 -3
- package/build/esm/{index-7e2d76fe.js → index-eeeaa36e.js} +16 -16
- package/build/esm/{index-3b3d0e53.js → index-ef16cd72.js} +4 -4
- package/build/esm/index-f0960e58.js +16 -0
- package/build/esm/{index-d183af3b.js → index-f696b62a.js} +3 -3
- package/build/esm/{index-4903fcd9.js → index-f6d3a3a5.js} +15 -15
- package/build/esm/{index-35cf65df.js → index-f7695557.js} +6 -6
- package/build/esm/{index-2f6f0fb3.js → index-f9929bd8.js} +5 -5
- package/build/esm/{index-2d0e3c8c.js → index-fa7858bf.js} +9 -9
- package/build/esm/{index-edb9db3c.js → index-fd37a14c.js} +2 -2
- package/build/esm/index.js +124 -124
- package/build/esm/{labelSorting-ccf7795b.js → labelSorting-b9bf74c1.js} +4 -4
- package/build/esm/lead.js +35 -35
- package/build/esm/{logoIcon-30072aaa.js → logoIcon-f5d7d4d4.js} +2 -2
- package/build/esm/mantine.js +29 -38
- package/build/esm/misc.js +19 -19
- package/build/esm/miscGetDynamicHealthTool.js +4 -4
- package/build/esm/miscGetSocialList.js +8 -8
- package/build/esm/miscScreenSizeContext.js +1 -1
- package/build/esm/mobileBottomNavigation.js +5 -5
- package/build/esm/mobileBottomNavigationIcon.js +5 -5
- package/build/esm/molecules.js +78 -78
- package/build/esm/moleculesArticleCard.js +6 -6
- package/build/esm/moleculesArticleCardV2.js +17 -17
- package/build/esm/navigation.js +47 -47
- package/build/esm/navigationLogoutPopup.js +11 -11
- package/build/esm/navigationProfileButton.js +27 -27
- package/build/esm/onboardingV2.js +30 -30
- package/build/esm/organisms.js +57 -57
- package/build/esm/{post-c41d8344.js → post-ba544b00.js} +2 -2
- package/build/esm/profileNavigation.js +20 -20
- package/build/esm/progressBar.js +1 -1
- package/build/esm/pwg.js +23 -23
- package/build/esm/ssoV2.js +31 -31
- package/build/esm/{store-790acf6f.js → store-0fa17a2f.js} +3 -3
- package/build/esm/subot/hooks/useVerifyPhoneNumber.d.ts +1 -0
- package/build/esm/subot/index.d.ts +1 -0
- package/build/esm/subot/subotInline/index.d.ts +4 -0
- package/build/esm/subot/subotInline/index.styled.d.ts +67 -0
- package/build/esm/subot/subotInline/subotInline.config.d.ts +37 -0
- package/build/esm/subot/subotInline/subotInlineAction/index.d.ts +25 -0
- package/build/esm/subot/subotInline/subotInlineAction/subotInlineAction.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineAction/subotInlineAction.styled.d.ts +54 -0
- package/build/esm/subot/subotInline/subotInlineFooter.d.ts +17 -0
- package/build/esm/subot/subotInline/subotInlineHeader.d.ts +3 -0
- package/build/esm/subot/subotInline/subotInlineIntent/index.d.ts +100 -0
- package/build/esm/subot/subotInline/subotInlineIntent/subotInlineIntent.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineIntent/subotInlineIntent.styled.d.ts +159 -0
- package/build/esm/subot/subotInline/subotInlineIntent/subotInlineIntentFinal.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/SubotInlineNodeResultPoll.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/index.d.ts +15 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNode.d.ts +5 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNode.styled.d.ts +74 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodeFinal.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodeFinalThankYou.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodeForm.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodeImage.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodeMultiple.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodeOTP.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodePoll.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodeRating.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodeReaction.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodeReview.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodeSSO.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodeStart.d.ts +4 -0
- package/build/esm/subot/subotInline/subotInlineNode/subotInlineNodeText.d.ts +4 -0
- package/build/esm/subot.js +3235 -107
- package/build/esm/surveyOrPremiumBanner.js +34 -34
- package/build/esm/surveyQuestionCard.js +11 -11
- package/build/esm/{surveyThankyouCard-553005a6.js → surveyThankyouCard-06be20f7.js} +5 -5
- package/build/esm/together/togetherComponentGlobalContext.d.ts +2 -0
- package/build/esm/together.js +57 -57
- package/build/esm/togetherApiUtils.js +4 -4
- package/build/esm/togetherAtoms.js +31 -31
- package/build/esm/togetherComponentGlobalContext.js +4 -4
- package/build/esm/togetherMolecules.js +52 -52
- package/build/esm/togetherMoleculesCardAuthor.js +29 -29
- package/build/esm/togetherMoleculesPostImagePreview.js +11 -11
- package/build/esm/togetherMoleculesProfileDetail.js +40 -40
- package/build/esm/togetherOrganisms.js +51 -51
- package/build/esm/togetherRichTextEditor.js +18 -18
- package/build/esm/togetherShareBox.js +10 -10
- package/build/esm/{translationsProvider-4c36d2fb.js → translationsProvider-d114f026.js} +1 -1
- package/build/esm/{treePopoverMenu-79e1e714.js → treePopoverMenu-49bc209a.js} +19 -19
- package/build/esm/types.js +2 -2
- package/build/esm/{useHealthToolCache-1a5355d6.js → useHealthToolCache-d2343d8e.js} +1 -1
- package/build/esm/{usePhoneValidator-71043279.js → usePhoneValidator-d107fed0.js} +5 -5
- package/build/esm/{usePlacesAutocomplete-f1eff124.js → usePlacesAutocomplete-a97ea834.js} +1 -1
- package/build/esm/useTogetherAuthRequiredAction.js +10 -10
- package/build/esm/{utils-76f8ba20.js → utils-1a0d3e3f.js} +2 -2
- package/build/esm/{utils-389a9a3d.js → utils-1ae0050a.js} +5 -5
- package/build/esm/{utils-b8e92437.js → utils-46cabd5d.js} +2 -2
- package/build/esm/{utils-5e1d66a7.js → utils-e7f04f97.js} +3 -3
- package/build/esm/vaccination.js +22 -22
- package/build/footer.js +22 -22
- package/build/gAssets.js +2 -2
- package/build/{healthTools-ed870a63.js → healthTools-3c04e345.js} +1 -1
- package/build/healthToolsCardWrapper.js +20 -20
- package/build/healthToolsForm.js +35 -35
- package/build/hooks.js +13 -13
- package/build/i18n.js +2 -2
- package/build/i18nV2.js +1 -1
- package/build/{index-7ebe364e.js → index-04d41ab4.js} +8 -8
- package/build/{index-2fd0bd40.js → index-05723ab5.js} +1 -1
- package/build/{index-bb7de61b.js → index-077a4fab.js} +7 -7
- package/build/{index-f3e59e17.js → index-07f3c30a.js} +15 -15
- package/build/{index-2dac7c43.js → index-0a50fc6b.js} +14 -14
- package/build/{index-03714c69.js → index-0cf8bbeb.js} +1 -1
- package/build/{index-768497f0.js → index-0fd5579a.js} +16 -16
- package/build/{index-c297bc45.js → index-11a12f89.js} +3 -3
- package/build/{index-7e0680d7.js → index-19a22b44.js} +30 -30
- package/build/{index-130342fa.js → index-205826e2.js} +2 -2
- package/build/{index-66f15d67.js → index-2471b40f.js} +6 -6
- package/build/{index-4040161e.js → index-2d11df17.js} +32 -32
- package/build/{index-7f919539.js → index-2e9bd898.js} +2 -2
- package/build/{index-719007b0.js → index-2fa70019.js} +16 -16
- package/build/{index-4328a910.js → index-342eca14.js} +2 -2
- package/build/{index-97d2d7f0.js → index-3602ebf0.js} +16 -16
- package/build/{index-483806a7.js → index-36f62452.js} +17 -17
- package/build/{index-39056b0e.js → index-388253d1.js} +6 -6
- package/build/{index-a3b70bfb.js → index-38e030e6.js} +7 -7
- package/build/{index-c7ab1e76.js → index-3a76667d.js} +21 -21
- package/build/{index-1d2d9ed8.js → index-4d7fc80d.js} +15 -15
- package/build/{index-ecaba738.js → index-4f3435fc.js} +3 -3
- package/build/{index-ce5ae067.js → index-51f4e3b5.js} +2 -2
- package/build/{index-16d895f3.js → index-5a20dc9e.js} +2 -2
- package/build/{index-c7abb03e.js → index-5afbd571.js} +2 -2
- package/build/{index-946b2e46.js → index-61472b8c.js} +3 -3
- package/build/{index-2d77bc32.js → index-659205b1.js} +25 -25
- package/build/{index-5a4a811f.js → index-67413132.js} +11 -11
- package/build/{index-9d6878a5.js → index-678a33dc.js} +13 -13
- package/build/{index-6469782f.js → index-7472dad9.js} +1 -1
- package/build/{index-6779bac2.js → index-77756576.js} +3 -3
- package/build/{index-d9cca0f6.js → index-79a1730b.js} +2 -2
- package/build/{index-6c1b94f3.js → index-7a583b85.js} +4 -4
- package/build/{index-e6a9ba99.js → index-7a6ee5df.js} +3 -3
- package/build/{index-15939a6f.js → index-7af34776.js} +26 -26
- package/build/{index-162d2bea.js → index-7af76903.js} +1 -1
- package/build/{index-167f677c.js → index-7cdf960a.js} +3 -3
- package/build/{index-7e39e6a6.js → index-8297a2e4.js} +1 -1
- package/build/{index-1dbecf82.js → index-85dcd98c.js} +21 -21
- package/build/{index-1e457fd7.js → index-877971fd.js} +2 -2
- package/build/index-877ae476.js +22 -0
- package/build/{index-9ea1ba65.js → index-88b540c9.js} +5 -5
- package/build/{index-1e844902.js → index-8cb64760.js} +9 -9
- package/build/{index-23182871.js → index-905c4fcb.js} +1 -1
- package/build/{index-3ddbaf17.js → index-95527ec4.js} +2 -2
- package/build/{index-dea56f05.js → index-980a4ab4.js} +14 -14
- package/build/{index-21958e45.js → index-987fea6e.js} +6 -6
- package/build/{index-df7d0642.js → index-9d7812ef.js} +3 -3
- package/build/{index-6f142d1b.js → index-9d9bb81f.js} +1 -1
- package/build/{index-de3c3162.js → index-9eb1a7fd.js} +22 -22
- package/build/{index-ac43ab0e.js → index-a79e5836.js} +19 -19
- package/build/{index-3ab101ed.js → index-a8c9a918.js} +13 -13
- package/build/{index-d517782d.js → index-ad251600.js} +10 -10
- package/build/{index-c3c15baa.js → index-ad8c501c.js} +18 -18
- package/build/{index-7bacda36.js → index-ad9e947d.js} +18 -18
- package/build/{index-04224e03.js → index-b3ca538b.js} +2 -2
- package/build/{index-b1b1b93f.js → index-c41708b0.js} +2 -2
- package/build/{index-9436a1d2.js → index-c776db1f.js} +6 -6
- package/build/{index-46dfbbd5.js → index-c78f1989.js} +2 -2
- package/build/{index-13132196.js → index-cee337ec.js} +4 -4
- package/build/{index-def5ee14.js → index-d0256457.js} +2 -2
- package/build/{index-db49933a.js → index-d3798ea7.js} +5 -5
- package/build/{index-54bf0581.js → index-d694b920.js} +14 -14
- package/build/{index-804e1385.js → index-d74ac2da.js} +16 -16
- package/build/{index-e06a414d.js → index-d8a6447e.js} +2 -2
- package/build/{index-d5784094.js → index-e16a9b23.js} +14 -14
- package/build/{index-8108704a.js → index-e1e09f51.js} +3 -3
- package/build/{index-217b689e.js → index-e410ee95.js} +2 -2
- package/build/{index-cae3aba1.js → index-f6abc75d.js} +8 -8
- package/build/{index-47d16e49.js → index-f880f6ef.js} +2 -2
- package/build/{index-ad5795d1.js → index-fb160a9f.js} +32 -32
- package/build/{index-8587c0ab.js → index-fd6de04f.js} +2 -2
- package/build/index.js +124 -124
- package/build/{labelSorting-116025fe.js → labelSorting-88436817.js} +4 -4
- package/build/lead.js +35 -35
- package/build/{logoIcon-e50fa661.js → logoIcon-cdc5219e.js} +2 -2
- package/build/mantine.js +40 -48
- package/build/misc.js +19 -19
- package/build/miscGetDynamicHealthTool.js +4 -4
- package/build/miscGetSocialList.js +8 -8
- package/build/miscScreenSizeContext.js +1 -1
- package/build/mobileBottomNavigation.js +5 -5
- package/build/mobileBottomNavigationIcon.js +5 -5
- package/build/molecules.js +78 -78
- package/build/moleculesArticleCard.js +6 -6
- package/build/moleculesArticleCardV2.js +17 -17
- package/build/navigation.js +47 -47
- package/build/navigationLogoutPopup.js +11 -11
- package/build/navigationProfileButton.js +27 -27
- package/build/onboardingV2.js +29 -29
- package/build/organisms.js +57 -57
- package/build/{post-a7d14fbe.js → post-a9ebeee7.js} +2 -2
- package/build/profileNavigation.js +20 -20
- package/build/progressBar.js +1 -1
- package/build/pwg.js +23 -23
- package/build/ssoV2.js +29 -29
- package/build/{store-60aef577.js → store-d25421b6.js} +3 -3
- package/build/subot/hooks/useVerifyPhoneNumber.d.ts +1 -0
- package/build/subot/index.d.ts +1 -0
- package/build/subot/subotInline/index.d.ts +4 -0
- package/build/subot/subotInline/index.styled.d.ts +67 -0
- package/build/subot/subotInline/subotInline.config.d.ts +37 -0
- package/build/subot/subotInline/subotInlineAction/index.d.ts +25 -0
- package/build/subot/subotInline/subotInlineAction/subotInlineAction.d.ts +4 -0
- package/build/subot/subotInline/subotInlineAction/subotInlineAction.styled.d.ts +54 -0
- package/build/subot/subotInline/subotInlineFooter.d.ts +17 -0
- package/build/subot/subotInline/subotInlineHeader.d.ts +3 -0
- package/build/subot/subotInline/subotInlineIntent/index.d.ts +100 -0
- package/build/subot/subotInline/subotInlineIntent/subotInlineIntent.d.ts +4 -0
- package/build/subot/subotInline/subotInlineIntent/subotInlineIntent.styled.d.ts +159 -0
- package/build/subot/subotInline/subotInlineIntent/subotInlineIntentFinal.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/SubotInlineNodeResultPoll.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/index.d.ts +15 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNode.d.ts +5 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNode.styled.d.ts +74 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodeFinal.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodeFinalThankYou.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodeForm.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodeImage.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodeMultiple.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodeOTP.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodePoll.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodeRating.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodeReaction.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodeReview.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodeSSO.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodeStart.d.ts +4 -0
- package/build/subot/subotInline/subotInlineNode/subotInlineNodeText.d.ts +4 -0
- package/build/subot.js +3250 -110
- package/build/surveyOrPremiumBanner.js +34 -34
- package/build/surveyQuestionCard.js +11 -11
- package/build/{surveyThankyouCard-4af08559.js → surveyThankyouCard-f8b13eae.js} +5 -5
- package/build/together/togetherComponentGlobalContext.d.ts +2 -0
- package/build/together.js +57 -57
- package/build/togetherApiUtils.js +4 -4
- package/build/togetherAtoms.js +31 -31
- package/build/togetherComponentGlobalContext.js +4 -4
- package/build/togetherMolecules.js +52 -52
- package/build/togetherMoleculesCardAuthor.js +29 -29
- package/build/togetherMoleculesPostImagePreview.js +11 -11
- package/build/togetherMoleculesProfileDetail.js +40 -40
- package/build/togetherOrganisms.js +51 -51
- package/build/togetherRichTextEditor.js +18 -18
- package/build/togetherShareBox.js +10 -10
- package/build/{translationsProvider-81882033.js → translationsProvider-a8753567.js} +1 -1
- package/build/{treePopoverMenu-26a49c1d.js → treePopoverMenu-7b840f8f.js} +19 -19
- package/build/types.js +2 -2
- package/build/{useHealthToolCache-8a0b6046.js → useHealthToolCache-4aa4c2eb.js} +1 -1
- package/build/{usePhoneValidator-00b1affb.js → usePhoneValidator-162c1bd3.js} +5 -5
- package/build/{usePlacesAutocomplete-a22b305a.js → usePlacesAutocomplete-48c44c61.js} +1 -1
- package/build/useTogetherAuthRequiredAction.js +10 -10
- package/build/{utils-9d6706a9.js → utils-14b8061a.js} +2 -2
- package/build/{utils-9181c2cb.js → utils-2985e713.js} +3 -3
- package/build/{utils-5012b8fe.js → utils-c0555488.js} +5 -5
- package/build/{utils-3cb3da06.js → utils-dbbca708.js} +2 -2
- package/build/vaccination.js +22 -22
- package/package.json +3 -1
- /package/build/{BMI_BOYS.percentile.monthly-417e2d86.js → BMI_BOYS.percentile.monthly-cfe10adf.js} +0 -0
- /package/build/{BMI_BOYS.percentile.weekly-bf4ddf0d.js → BMI_BOYS.percentile.weekly-aa6dd26a.js} +0 -0
- /package/build/{BMI_BOYS.percentile.yearly-05068392.js → BMI_BOYS.percentile.yearly-e19db864.js} +0 -0
- /package/build/{BMI_BOYS.zscore.monthly-ff8cbff5.js → BMI_BOYS.zscore.monthly-8f72c0a2.js} +0 -0
- /package/build/{BMI_BOYS.zscore.weekly-15139146.js → BMI_BOYS.zscore.weekly-a8ad71f2.js} +0 -0
- /package/build/{BMI_BOYS.zscore.yearly-55f3ab70.js → BMI_BOYS.zscore.yearly-5bf15f7b.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.monthly-487b0dd8.js → BMI_GIRLS.percentile.monthly-5fdb43fc.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.weekly-42a579c3.js → BMI_GIRLS.percentile.weekly-d30d3a9e.js} +0 -0
- /package/build/{BMI_GIRLS.percentile.yearly-34a0d28b.js → BMI_GIRLS.percentile.yearly-530310a2.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.monthly-22a2fe5b.js → BMI_GIRLS.zscore.monthly-5e825905.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.weekly-c247f7d5.js → BMI_GIRLS.zscore.weekly-fd89311a.js} +0 -0
- /package/build/{BMI_GIRLS.zscore.yearly-41cb6cd5.js → BMI_GIRLS.zscore.yearly-ce62584e.js} +0 -0
- /package/build/{ChevronDown-57f98bfb.js → ChevronDown-6091b7e4.js} +0 -0
- /package/build/{Close-00932092.js → Close-e4737e4c.js} +0 -0
- /package/build/{Google-70df0aff.js → Google-9e9ff8cf.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.monthly-f1a4e5e2.js → HEAD CIRCUM_BOYS.percentile.monthly-bc79ded9.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.weekly-0be0e8f9.js → HEAD CIRCUM_BOYS.percentile.weekly-641ebc32.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.percentile.yearly-f4475c99.js → HEAD CIRCUM_BOYS.percentile.yearly-bc5c3cbd.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.monthly-2efd0f92.js → HEAD CIRCUM_BOYS.zscore.monthly-8fc9d0a4.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.weekly-ec8629ed.js → HEAD CIRCUM_BOYS.zscore.weekly-b5748305.js} +0 -0
- /package/build/{HEAD CIRCUM_BOYS.zscore.yearly-b8fabe78.js → HEAD CIRCUM_BOYS.zscore.yearly-de74110c.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.monthly-4d0f46bf.js → HEAD CIRCUM_GIRLS.percentile.monthly-eaac45d8.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.weekly-5002dffa.js → HEAD CIRCUM_GIRLS.percentile.weekly-7e1c5c89.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.percentile.yearly-16a8c4e6.js → HEAD CIRCUM_GIRLS.percentile.yearly-6dd59ab4.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.monthly-714a7240.js → HEAD CIRCUM_GIRLS.zscore.monthly-2252fc27.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.weekly-bd7ee5a0.js → HEAD CIRCUM_GIRLS.zscore.weekly-40179ef7.js} +0 -0
- /package/build/{HEAD CIRCUM_GIRLS.zscore.yearly-857a28d1.js → HEAD CIRCUM_GIRLS.zscore.yearly-e5ff32cb.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.monthly-2d5211e5.js → HEIGHT_BOYS.percentile.monthly-2a93c4c4.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.weekly-7af4168c.js → HEIGHT_BOYS.percentile.weekly-e19d54b6.js} +0 -0
- /package/build/{HEIGHT_BOYS.percentile.yearly-82ffc316.js → HEIGHT_BOYS.percentile.yearly-72f7eab0.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.monthly-01ad1306.js → HEIGHT_BOYS.zscore.monthly-76b9ab92.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.weekly-74be5005.js → HEIGHT_BOYS.zscore.weekly-dc436e5e.js} +0 -0
- /package/build/{HEIGHT_BOYS.zscore.yearly-9ff520ad.js → HEIGHT_BOYS.zscore.yearly-e0910a2b.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.monthly-c1e02d60.js → HEIGHT_GIRLS.percentile.monthly-a02ec78e.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.weekly-a2f7e077.js → HEIGHT_GIRLS.percentile.weekly-040243b7.js} +0 -0
- /package/build/{HEIGHT_GIRLS.percentile.yearly-c7a14f59.js → HEIGHT_GIRLS.percentile.yearly-9583c101.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.monthly-9159de1b.js → HEIGHT_GIRLS.zscore.monthly-cbebfb9c.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.weekly-79d534f8.js → HEIGHT_GIRLS.zscore.weekly-dc4560ae.js} +0 -0
- /package/build/{HEIGHT_GIRLS.zscore.yearly-330604fe.js → HEIGHT_GIRLS.zscore.yearly-5abb3c9d.js} +0 -0
- /package/build/{Locale-7b990ab4.js → Locale-adb54541.js} +0 -0
- /package/build/{Visible-cc6da38a.js → Visible-93fd30d7.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.monthly-cee34f73.js → WEIGHT_BOYS.percentile.monthly-e3260ef5.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.weekly-27f569a4.js → WEIGHT_BOYS.percentile.weekly-06ef57e1.js} +0 -0
- /package/build/{WEIGHT_BOYS.percentile.yearly-2696ecab.js → WEIGHT_BOYS.percentile.yearly-568aa9b3.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.monthly-7a005e60.js → WEIGHT_BOYS.zscore.monthly-9d6cf07f.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.weekly-5dc7bce7.js → WEIGHT_BOYS.zscore.weekly-60a1a5bc.js} +0 -0
- /package/build/{WEIGHT_BOYS.zscore.yearly-db25b379.js → WEIGHT_BOYS.zscore.yearly-8896a16d.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.monthly-656b101c.js → WEIGHT_GIRLS.percentile.monthly-e088a3c1.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.weekly-27b1829a.js → WEIGHT_GIRLS.percentile.weekly-79cb95fb.js} +0 -0
- /package/build/{WEIGHT_GIRLS.percentile.yearly-032f81f4.js → WEIGHT_GIRLS.percentile.yearly-4843049f.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.monthly-d4f312f8.js → WEIGHT_GIRLS.zscore.monthly-d23879be.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.weekly-49dac6e3.js → WEIGHT_GIRLS.zscore.weekly-ef1e1985.js} +0 -0
- /package/build/{WEIGHT_GIRLS.zscore.yearly-27b2871a.js → WEIGHT_GIRLS.zscore.yearly-cd203302.js} +0 -0
- /package/build/{ageGenerate-bdba9999.js → ageGenerate-22f5970f.js} +0 -0
- /package/build/{animation-ab0621b4.js → animation-8a1fcd94.js} +0 -0
- /package/build/{constants-1f3e27ab.js → constants-092d4d1a.js} +0 -0
- /package/build/{constants-fe99309f.js → constants-1b1c9c6d.js} +0 -0
- /package/build/{constants-8e74d640.js → constants-50e0caf4.js} +0 -0
- /package/build/{context-48ea9a83.js → context-cd231d7c.js} +0 -0
- /package/build/{dataTransform-494f33e3.js → dataTransform-9a7e0a08.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.monthly-696a9d40.js → BMI_BOYS.percentile.monthly-98f315dc.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.weekly-dcb4886c.js → BMI_BOYS.percentile.weekly-07a49dcd.js} +0 -0
- /package/build/esm/{BMI_BOYS.percentile.yearly-c00c093b.js → BMI_BOYS.percentile.yearly-da86a04a.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.monthly-2ebacf43.js → BMI_BOYS.zscore.monthly-dfa7f8aa.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.weekly-3242aab7.js → BMI_BOYS.zscore.weekly-60530fdf.js} +0 -0
- /package/build/esm/{BMI_BOYS.zscore.yearly-63156b13.js → BMI_BOYS.zscore.yearly-3b388ba3.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.monthly-61a72917.js → BMI_GIRLS.percentile.monthly-ff857b9f.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.weekly-02dc31c9.js → BMI_GIRLS.percentile.weekly-298da26d.js} +0 -0
- /package/build/esm/{BMI_GIRLS.percentile.yearly-f92f1a43.js → BMI_GIRLS.percentile.yearly-dd7d67db.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.monthly-33a87fec.js → BMI_GIRLS.zscore.monthly-85b8d515.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.weekly-5f2d7eca.js → BMI_GIRLS.zscore.weekly-47271ecd.js} +0 -0
- /package/build/esm/{BMI_GIRLS.zscore.yearly-4919570a.js → BMI_GIRLS.zscore.yearly-f252c248.js} +0 -0
- /package/build/esm/{ChevronDown-362b50db.js → ChevronDown-fd9876ba.js} +0 -0
- /package/build/esm/{Close-53a16568.js → Close-27562735.js} +0 -0
- /package/build/esm/{Google-fb800329.js → Google-fe69296d.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.monthly-10dc1268.js → HEAD CIRCUM_BOYS.percentile.monthly-39009b17.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.weekly-f15accb0.js → HEAD CIRCUM_BOYS.percentile.weekly-bed7c9bc.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.percentile.yearly-e3e2264e.js → HEAD CIRCUM_BOYS.percentile.yearly-d26503ce.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.monthly-b6ba2db3.js → HEAD CIRCUM_BOYS.zscore.monthly-d2e7da92.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.weekly-d3d58c76.js → HEAD CIRCUM_BOYS.zscore.weekly-d0a8dd51.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_BOYS.zscore.yearly-f9768ce8.js → HEAD CIRCUM_BOYS.zscore.yearly-391043e0.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.monthly-16e9a43b.js → HEAD CIRCUM_GIRLS.percentile.monthly-304456db.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.weekly-62c042a5.js → HEAD CIRCUM_GIRLS.percentile.weekly-3b667a41.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.percentile.yearly-36ce99b2.js → HEAD CIRCUM_GIRLS.percentile.yearly-f161a50c.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.monthly-52dd8a7f.js → HEAD CIRCUM_GIRLS.zscore.monthly-9a663095.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.weekly-a5923b9c.js → HEAD CIRCUM_GIRLS.zscore.weekly-b0a08b06.js} +0 -0
- /package/build/esm/{HEAD CIRCUM_GIRLS.zscore.yearly-638305ff.js → HEAD CIRCUM_GIRLS.zscore.yearly-5ecd34c9.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.monthly-3be20837.js → HEIGHT_BOYS.percentile.monthly-13994e53.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.weekly-e782d119.js → HEIGHT_BOYS.percentile.weekly-f4d4418d.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.percentile.yearly-e6c88cd2.js → HEIGHT_BOYS.percentile.yearly-f6e8f5a9.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.monthly-ae6b9660.js → HEIGHT_BOYS.zscore.monthly-506c74dc.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.weekly-a0d9b7ff.js → HEIGHT_BOYS.zscore.weekly-2a63fb3b.js} +0 -0
- /package/build/esm/{HEIGHT_BOYS.zscore.yearly-d5c88cfd.js → HEIGHT_BOYS.zscore.yearly-929bfe3d.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.monthly-348342d5.js → HEIGHT_GIRLS.percentile.monthly-c30c96ba.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.weekly-16653ea6.js → HEIGHT_GIRLS.percentile.weekly-c4363b6d.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.percentile.yearly-e1f75bf8.js → HEIGHT_GIRLS.percentile.yearly-4bc3cd01.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.monthly-6562df05.js → HEIGHT_GIRLS.zscore.monthly-98b91a75.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.weekly-d5a7e47f.js → HEIGHT_GIRLS.zscore.weekly-e50ef1e4.js} +0 -0
- /package/build/esm/{HEIGHT_GIRLS.zscore.yearly-e7c8e0b7.js → HEIGHT_GIRLS.zscore.yearly-3cf085f9.js} +0 -0
- /package/build/esm/{Locale-5d8124a4.js → Locale-96eccf11.js} +0 -0
- /package/build/esm/{Visible-b1803552.js → Visible-8efffb9f.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.monthly-bcf253ab.js → WEIGHT_BOYS.percentile.monthly-061df07a.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.weekly-46c295ad.js → WEIGHT_BOYS.percentile.weekly-01bdbed1.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.percentile.yearly-b7c98edf.js → WEIGHT_BOYS.percentile.yearly-3bdc4fd9.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.monthly-531fc7b4.js → WEIGHT_BOYS.zscore.monthly-e109d278.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.weekly-662d1cb9.js → WEIGHT_BOYS.zscore.weekly-ec6f89e2.js} +0 -0
- /package/build/esm/{WEIGHT_BOYS.zscore.yearly-04c464ec.js → WEIGHT_BOYS.zscore.yearly-cdee15ff.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.monthly-6a60b578.js → WEIGHT_GIRLS.percentile.monthly-c1866c19.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.weekly-382aebe3.js → WEIGHT_GIRLS.percentile.weekly-a69ba565.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.percentile.yearly-74185978.js → WEIGHT_GIRLS.percentile.yearly-b8b22c54.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.monthly-877f15bf.js → WEIGHT_GIRLS.zscore.monthly-a6523c4d.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.weekly-d6b735cc.js → WEIGHT_GIRLS.zscore.weekly-66cca237.js} +0 -0
- /package/build/esm/{WEIGHT_GIRLS.zscore.yearly-57e3dfff.js → WEIGHT_GIRLS.zscore.yearly-9f43f944.js} +0 -0
- /package/build/esm/{ageGenerate-5b698977.js → ageGenerate-d7e4d843.js} +0 -0
- /package/build/esm/{animation-24ef5f79.js → animation-671e9bbc.js} +0 -0
- /package/build/esm/{constants-a1dd8e93.js → constants-21a69015.js} +0 -0
- /package/build/esm/{constants-45df2f47.js → constants-d5568084.js} +0 -0
- /package/build/esm/{constants-d765889a.js → constants-d8d08898.js} +0 -0
- /package/build/esm/{context-b27aa296.js → context-67ee0400.js} +0 -0
- /package/build/esm/{dataTransform-f482058f.js → dataTransform-88dbcdc3.js} +0 -0
- /package/build/esm/{index-2ed6bbe5.js → index-3e720c29.js} +0 -0
- /package/build/esm/{index-58421748.js → index-53f7d1de.js} +0 -0
- /package/build/esm/{index-7580fce8.js → index-7868f723.js} +0 -0
- /package/build/esm/{index-5f783e60.js → index-7cfa47da.js} +0 -0
- /package/build/esm/{index-7b5c4e24.js → index-d23b50a5.js} +0 -0
- /package/build/esm/{index-cdad251f.js → index-d281d58d.js} +0 -0
- /package/build/esm/{index-a605fbe4.js → index-e8ea7ecf.js} +0 -0
- /package/build/esm/{index-3bcd4576.js → index-e9c36fc6.js} +0 -0
- /package/build/esm/{index-ed89d1f8.js → index-eea5bd87.js} +0 -0
- /package/build/esm/{index.styles-fd8ca959.js → index.styles-33599bb2.js} +0 -0
- /package/build/esm/{localizeNumberFormat-dfa14a2e.js → localizeNumberFormat-65bb9e5b.js} +0 -0
- /package/build/esm/{normalizeLink-8b7abc30.js → normalizeLink-56bd7631.js} +0 -0
- /package/build/esm/{number-46ee7fdc.js → number-73f95484.js} +0 -0
- /package/build/esm/{paths-2756cf85.js → paths-53623c78.js} +0 -0
- /package/build/esm/{shared-9faeef87.js → shared-fa3b4de0.js} +0 -0
- /package/build/esm/{translationsContext-1f975c56.js → translationsContext-722bb06b.js} +0 -0
- /package/build/esm/{tslib.es6-b2e6926b.js → tslib.es6-5468ce84.js} +0 -0
- /package/build/esm/{types-4b82e4ca.js → types-b4100f79.js} +0 -0
- /package/build/esm/{types-1e82d2e8.js → types-ce76b019.js} +0 -0
- /package/build/esm/{useIsInit-10c4dfab.js → useIsInit-82c116f9.js} +0 -0
- /package/build/esm/{useOutsideClick-169ecf84.js → useOutsideClick-edc7b6aa.js} +0 -0
- /package/build/esm/{useScrollbarSize-ee66489a.js → useScrollbarSize-30002fe6.js} +0 -0
- /package/build/esm/{useUniqueId-ffebef23.js → useUniqueId-499108b8.js} +0 -0
- /package/build/esm/{utils-c2efefae.js → utils-46350ee7.js} +0 -0
- /package/build/esm/{utils-6bd52394.js → utils-e2fce4a3.js} +0 -0
- /package/build/{index-41d5792a.js → index-014cb7de.js} +0 -0
- /package/build/{index-85b8fcec.js → index-0e3f3775.js} +0 -0
- /package/build/{index-293f23b0.js → index-124bbf78.js} +0 -0
- /package/build/{index-68e254aa.js → index-18a655df.js} +0 -0
- /package/build/{index-e20b6ca5.js → index-27cd0701.js} +0 -0
- /package/build/{index-c895c0f8.js → index-38a57b00.js} +0 -0
- /package/build/{index-5c7163c5.js → index-3c49d0ea.js} +0 -0
- /package/build/{index-b1238965.js → index-bd043671.js} +0 -0
- /package/build/{index-497eb2b6.js → index-fb10314e.js} +0 -0
- /package/build/{index.styles-1cdd9f45.js → index.styles-00bcf270.js} +0 -0
- /package/build/{localizeNumberFormat-f340227f.js → localizeNumberFormat-d013c3f5.js} +0 -0
- /package/build/{normalizeLink-c361c763.js → normalizeLink-55ad3060.js} +0 -0
- /package/build/{number-52f0fdb9.js → number-d092c18b.js} +0 -0
- /package/build/{paths-41552867.js → paths-a3c75613.js} +0 -0
- /package/build/{shared-9f20667d.js → shared-121fdc4f.js} +0 -0
- /package/build/{translationsContext-dc7418e5.js → translationsContext-2aabf91a.js} +0 -0
- /package/build/{tslib.es6-be2cf26c.js → tslib.es6-53aa24cc.js} +0 -0
- /package/build/{types-cee006c6.js → types-0a1e6d6f.js} +0 -0
- /package/build/{types-bbb47a5b.js → types-1ee3c83f.js} +0 -0
- /package/build/{useIsInit-21624600.js → useIsInit-884f8482.js} +0 -0
- /package/build/{useOutsideClick-7b190179.js → useOutsideClick-ba975b17.js} +0 -0
- /package/build/{useScrollbarSize-f29bd511.js → useScrollbarSize-226886f5.js} +0 -0
- /package/build/{useUniqueId-e1bffd87.js → useUniqueId-6009302a.js} +0 -0
- /package/build/{utils-dcc2d7a0.js → utils-9ec33919.js} +0 -0
- /package/build/{utils-08864c1c.js → utils-ab620ae4.js} +0 -0
package/build/esm/subot.js
CHANGED
|
@@ -1,76 +1,91 @@
|
|
|
1
|
-
import React__default, { createContext, useContext, useRef, useState, useEffect, useCallback, useMemo, forwardRef, useImperativeHandle, memo } from 'react';
|
|
2
|
-
import { d as NodeType, E as ELEMENT_CONTROL_INPUT_TYPE, f as NodeActionType, c as NodePosition, e as NodeFinalTypes, g as NodeMultipleOptions, N as NodeIntentType, F as FULL_KEY_ADDRESS, C as COMMON_DATE_TRANSLATE_KEY } from './index-
|
|
3
|
-
import { a as __awaiter, _ as __rest } from './tslib.es6-
|
|
4
|
-
import { b as basePath, G as GA_TOKEN_COOKIE, A as API_DATE_FORMAT, I as ISO_FORMAT, j as SSO_URL } from './index-
|
|
1
|
+
import React__default, { createContext, useContext, useRef, useState, useEffect, useCallback, useMemo, forwardRef, useImperativeHandle, memo, useLayoutEffect } from 'react';
|
|
2
|
+
import { d as NodeType, E as ELEMENT_CONTROL_INPUT_TYPE, f as NodeActionType, c as NodePosition, e as NodeFinalTypes, g as NodeMultipleOptions, N as NodeIntentType, F as FULL_KEY_ADDRESS, C as COMMON_DATE_TRANSLATE_KEY, h as SubotType } from './index-cf676a41.js';
|
|
3
|
+
import { a as __awaiter, _ as __rest } from './tslib.es6-5468ce84.js';
|
|
4
|
+
import { b as basePath, G as GA_TOKEN_COOKIE, A as API_DATE_FORMAT, I as ISO_FORMAT, j as SSO_URL } from './index-140d47ba.js';
|
|
5
5
|
import Cookies from 'js-cookie';
|
|
6
6
|
import fd from 'fastdom';
|
|
7
7
|
import fastdomPromised from 'fastdom/extensions/fastdom-promised';
|
|
8
|
-
import { G as GlobalData, c as callApi, u as locale, T as TogetherComponentGlobalContext } from './utils-
|
|
8
|
+
import { G as GlobalData, c as callApi, u as locale, T as TogetherComponentGlobalContext } from './utils-e7f04f97.js';
|
|
9
9
|
import formatString from 'string-format';
|
|
10
|
-
import { a as getUserIdFromCookie, b as getSubotCookieId, c as getUserInfoFromCookie, d as getWindowId, o as overrideParamsByQuery, e as checkUntilFinished, g as getHelloSitesUrl, f as checkMobile, h as clickAndOpenInNewTab, i as formatUrlWithEncrypedGa, T as TIME_RESET_RESEND_OTP, j as isFakeEmail, s as ssoIntents, k as getHhgIdFromCookie } from './index-
|
|
11
|
-
export { T as TIME_RESET_RESEND_OTP, f as checkMobile, e as checkUntilFinished, h as clickAndOpenInNewTab, i as formatUrlWithEncrypedGa, g as getHelloSitesUrl, k as getHhgIdFromCookie, b as getSubotCookieId, a as getUserIdFromCookie, c as getUserInfoFromCookie, d as getWindowId, j as isFakeEmail, o as overrideParamsByQuery, s as ssoIntents } from './index-
|
|
10
|
+
import { a as getUserIdFromCookie, b as getSubotCookieId, c as getUserInfoFromCookie, d as getWindowId, o as overrideParamsByQuery, e as checkUntilFinished, g as getHelloSitesUrl, f as checkMobile, h as clickAndOpenInNewTab, i as formatUrlWithEncrypedGa, T as TIME_RESET_RESEND_OTP, j as isFakeEmail, s as ssoIntents, k as getHhgIdFromCookie } from './index-f696b62a.js';
|
|
11
|
+
export { T as TIME_RESET_RESEND_OTP, f as checkMobile, e as checkUntilFinished, h as clickAndOpenInNewTab, i as formatUrlWithEncrypedGa, g as getHelloSitesUrl, k as getHhgIdFromCookie, b as getSubotCookieId, a as getUserIdFromCookie, c as getUserInfoFromCookie, d as getWindowId, j as isFakeEmail, o as overrideParamsByQuery, s as ssoIntents } from './index-f696b62a.js';
|
|
12
12
|
import dayjs from 'dayjs';
|
|
13
13
|
import { MAP_DOMAIN_BY_LOCALE, domainLocales } from './constantsDomainLocales.js';
|
|
14
14
|
import classNames from 'classnames';
|
|
15
|
-
import { C as Container$w } from './index-
|
|
16
|
-
import { L as Loading } from './index-
|
|
15
|
+
import { C as Container$w } from './index-e8ea7ecf.js';
|
|
16
|
+
import { L as Loading } from './index-781aea50.js';
|
|
17
17
|
import { motion } from 'framer-motion';
|
|
18
18
|
import styled from '@emotion/styled';
|
|
19
|
-
import { M as MediaQueries } from './utils-
|
|
20
|
-
import { B as Button } from './index-
|
|
19
|
+
import { M as MediaQueries } from './utils-46350ee7.js';
|
|
20
|
+
import { B as Button } from './index-3625e45c.js';
|
|
21
21
|
import { Remarkable } from 'remarkable';
|
|
22
22
|
import { ArrowRight } from '@hhgtech/icons/other';
|
|
23
23
|
import { useInView } from 'react-intersection-observer';
|
|
24
24
|
import { Box, Textarea } from '@mantine/core';
|
|
25
|
-
import { C as CommonGAssets } from './index-
|
|
25
|
+
import { C as CommonGAssets } from './index-7cfa47da.js';
|
|
26
26
|
import isSameOrBefore from 'dayjs/plugin/isSameOrBefore';
|
|
27
|
-
import { d as LEAD_TOKEN_COOKIE } from './constants-
|
|
27
|
+
import { d as LEAD_TOKEN_COOKIE } from './constants-21a69015.js';
|
|
28
28
|
import { v4 } from 'uuid';
|
|
29
|
-
import { T as Text } from './index-
|
|
29
|
+
import { T as Text } from './index-3972ecae.js';
|
|
30
30
|
import { theme } from './miscTheme.js';
|
|
31
31
|
import { isProduction } from './constantsIsProduction.js';
|
|
32
|
-
import { S as Select } from './index-
|
|
32
|
+
import { S as Select } from './index-77ab7e37.js';
|
|
33
33
|
import '@mantine/dates';
|
|
34
|
-
import './index-
|
|
35
|
-
import './index-
|
|
36
|
-
import './index.styles-
|
|
37
|
-
import './translationsContext-
|
|
34
|
+
import './index-6717cc50.js';
|
|
35
|
+
import './index-d23b50a5.js';
|
|
36
|
+
import './index.styles-33599bb2.js';
|
|
37
|
+
import './translationsContext-722bb06b.js';
|
|
38
38
|
import '@mantine/hooks';
|
|
39
|
-
import './index-
|
|
39
|
+
import './index-171896a4.js';
|
|
40
40
|
import isEmpty from 'lodash/isEmpty';
|
|
41
41
|
import { Controller, useForm } from 'react-hook-form';
|
|
42
42
|
import PhoneInputBase, { getCountryCallingCode, isPossiblePhoneNumber, parsePhoneNumber } from 'react-phone-number-input';
|
|
43
43
|
import { LoadScript } from '@react-google-maps/api';
|
|
44
|
-
import { u as usePlacesAutocomplete, G as GOOGLE_API_KEY, a as GOOGLE_API_LANGUAGE } from './usePlacesAutocomplete-
|
|
44
|
+
import { u as usePlacesAutocomplete, G as GOOGLE_API_KEY, a as GOOGLE_API_LANGUAGE } from './usePlacesAutocomplete-a97ea834.js';
|
|
45
45
|
import { setDefaultClass } from './miscDefaultClassWrapper.js';
|
|
46
|
-
import { L as LOCALE } from './Locale-
|
|
47
|
-
import { I as InputDate } from './InputDate-
|
|
48
|
-
import { B as Button$1 } from './index-
|
|
49
|
-
import { D as Dropdown } from './index-
|
|
50
|
-
import { u as useSSOV2Store, I as IS_SSOV2_ENABLED } from './store-
|
|
51
|
-
import { g as getURLwithSSOTracking } from './utils-
|
|
46
|
+
import { L as LOCALE } from './Locale-96eccf11.js';
|
|
47
|
+
import { I as InputDate } from './InputDate-674d51bc.js';
|
|
48
|
+
import { B as Button$1 } from './index-a390c8de.js';
|
|
49
|
+
import { D as Dropdown } from './index-eea5bd87.js';
|
|
50
|
+
import { u as useSSOV2Store, I as IS_SSOV2_ENABLED } from './store-0fa17a2f.js';
|
|
51
|
+
import { g as getURLwithSSOTracking } from './utils-1ae0050a.js';
|
|
52
|
+
import { T as TextArea } from './index-f0960e58.js';
|
|
53
|
+
import CheckboxIcon from 'public/images/checkbox.svg';
|
|
54
|
+
import CheckIcon from 'public/svg/check.svg';
|
|
55
|
+
import DislikeIcon from 'public/svg/dislike-article.svg';
|
|
56
|
+
import LikeIcon from 'public/svg/like-article.svg';
|
|
57
|
+
import StarRatings from 'react-star-ratings';
|
|
58
|
+
import LeftArrowIcon from 'public/svg/arrow-left.svg';
|
|
59
|
+
import RightArrowIcon from 'public/svg/arrow-right.svg';
|
|
60
|
+
import { ArticleCard } from './moleculesArticleCard.js';
|
|
61
|
+
import ChevronRight$2 from 'public/images/chevronRightActive.svg';
|
|
62
|
+
import RotateLeftSvg from 'public/svg/rotate-left.svg';
|
|
63
|
+
import ArrowDown from 'public/svg/arrow-down.svg';
|
|
64
|
+
import ArrowUp from 'public/svg/arrow-up.svg';
|
|
65
|
+
import { T as Text$1 } from './index-9e688f4f.js';
|
|
66
|
+
import { H as Heading } from './index-5e6925f7.js';
|
|
52
67
|
import 'date-fns/locale';
|
|
53
68
|
import './constantsSite.js';
|
|
54
69
|
import './constantsRiskScreener.js';
|
|
55
|
-
import './index-
|
|
70
|
+
import './index-53f7d1de.js';
|
|
56
71
|
import './miscCookieHelper.js';
|
|
57
72
|
import 'slugify';
|
|
58
73
|
import './togetherApiPaths.js';
|
|
59
|
-
import './index-
|
|
60
|
-
import './WhatsApp-
|
|
61
|
-
import './Spinner-
|
|
62
|
-
import './index-
|
|
63
|
-
import './shared-
|
|
64
|
-
import './index-
|
|
74
|
+
import './index-e2800d29.js';
|
|
75
|
+
import './WhatsApp-a3e8b9df.js';
|
|
76
|
+
import './Spinner-2b1edded.js';
|
|
77
|
+
import './index-dd4ecad7.js';
|
|
78
|
+
import './shared-fa3b4de0.js';
|
|
79
|
+
import './index-1bd5d939.js';
|
|
65
80
|
import '@mantine/carousel';
|
|
66
|
-
import './useUniqueId-
|
|
81
|
+
import './useUniqueId-499108b8.js';
|
|
67
82
|
import '@emotion/react';
|
|
68
83
|
import '@hhgtech/icons/core';
|
|
69
84
|
import '@mantine/notifications';
|
|
70
85
|
import 'zustand';
|
|
71
|
-
import './index-
|
|
72
|
-
import './normalizeLink-
|
|
73
|
-
import './healthTools-
|
|
86
|
+
import './index-ca959e2f.js';
|
|
87
|
+
import './normalizeLink-56bd7631.js';
|
|
88
|
+
import './healthTools-eef0631c.js';
|
|
74
89
|
|
|
75
90
|
// extend fastdom
|
|
76
91
|
const fastdom = fd.extend(fastdomPromised);
|
|
@@ -152,7 +167,7 @@ const getSubotApiPath = (path, params) => {
|
|
|
152
167
|
return apiUrl + formatString(path, Object.assign({}, params));
|
|
153
168
|
};
|
|
154
169
|
/** inline message */
|
|
155
|
-
const subotInlineMessage = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
170
|
+
const subotInlineMessage$1 = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
156
171
|
try {
|
|
157
172
|
return yield callApi(getSubotApiPath(PATHS$1.GET_INLINE_MESSAGE), 'POST', {
|
|
158
173
|
data,
|
|
@@ -160,7 +175,7 @@ const subotInlineMessage = (data) => __awaiter(void 0, void 0, void 0, function*
|
|
|
160
175
|
}
|
|
161
176
|
catch (error) { }
|
|
162
177
|
});
|
|
163
|
-
const computeExtraSettingsForBot = (data) => {
|
|
178
|
+
const computeExtraSettingsForBot$1 = (data) => {
|
|
164
179
|
var _a;
|
|
165
180
|
if ((data === null || data === void 0 ? void 0 : data._status) === 1 && ((_a = data === null || data === void 0 ? void 0 : data._data) === null || _a === void 0 ? void 0 : _a.extra_settings)) {
|
|
166
181
|
try {
|
|
@@ -183,11 +198,11 @@ const computeExtraSettingsForBot = (data) => {
|
|
|
183
198
|
return data;
|
|
184
199
|
};
|
|
185
200
|
/** inline first node */
|
|
186
|
-
const subotInlineFirstNode = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
201
|
+
const subotInlineFirstNode$1 = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
187
202
|
try {
|
|
188
203
|
const data = yield CachedSystem.withCached('SubotInlineFirstNode/' + id, () => __awaiter(void 0, void 0, void 0, function* () {
|
|
189
204
|
const response = yield callApi(getSubotApiPath(PATHS$1.GET_INLINE_FIRST_NODE) + `/${id}`, 'GET');
|
|
190
|
-
computeExtraSettingsForBot(response);
|
|
205
|
+
computeExtraSettingsForBot$1(response);
|
|
191
206
|
return response;
|
|
192
207
|
}));
|
|
193
208
|
return data;
|
|
@@ -197,7 +212,7 @@ const subotInlineFirstNode = (id) => __awaiter(void 0, void 0, void 0, function*
|
|
|
197
212
|
}
|
|
198
213
|
});
|
|
199
214
|
/** inline click */
|
|
200
|
-
const subotInlineClick = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
215
|
+
const subotInlineClick$1 = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
201
216
|
try {
|
|
202
217
|
return yield callApi(getSubotApiPath(PATHS$1.GET_INLINE_CLICK), 'POST', {
|
|
203
218
|
data,
|
|
@@ -206,7 +221,7 @@ const subotInlineClick = (data) => __awaiter(void 0, void 0, void 0, function* (
|
|
|
206
221
|
catch (error) { }
|
|
207
222
|
});
|
|
208
223
|
/** inline impression */
|
|
209
|
-
const subotInlineImpression = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
224
|
+
const subotInlineImpression$1 = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
210
225
|
try {
|
|
211
226
|
return yield callApi(getSubotApiPath(PATHS$1.GET_INLINE_IMPRESSION), 'POST', {
|
|
212
227
|
data,
|
|
@@ -805,7 +820,7 @@ const detectToSkipNodeStart = (botItem, currentActiveId, currentListNodes) => {
|
|
|
805
820
|
return [currentActiveId, currentListNodes];
|
|
806
821
|
};
|
|
807
822
|
|
|
808
|
-
const SubotInlineContext = createContext({
|
|
823
|
+
const SubotInlineContext$1 = createContext({
|
|
809
824
|
activeId: '',
|
|
810
825
|
params: {},
|
|
811
826
|
listNodes: [],
|
|
@@ -918,7 +933,7 @@ const SubotInlineProvider = ({ children, articleLink, subotId, isFullContainer,
|
|
|
918
933
|
let newActiveId = '';
|
|
919
934
|
let nodes = [];
|
|
920
935
|
setLoading(true);
|
|
921
|
-
const resFirst = yield subotInlineFirstNode(params.bot_id);
|
|
936
|
+
const resFirst = yield subotInlineFirstNode$1(params.bot_id);
|
|
922
937
|
if ((resFirst === null || resFirst === void 0 ? void 0 : resFirst._status) === 1) {
|
|
923
938
|
newActiveId = resFirst === null || resFirst === void 0 ? void 0 : resFirst._data.id.toString();
|
|
924
939
|
nodes.push(resFirst === null || resFirst === void 0 ? void 0 : resFirst._data, resFirst === null || resFirst === void 0 ? void 0 : resFirst._data.first_node);
|
|
@@ -936,7 +951,7 @@ const SubotInlineProvider = ({ children, articleLink, subotId, isFullContainer,
|
|
|
936
951
|
if (previousState &&
|
|
937
952
|
previousState.params.action_id &&
|
|
938
953
|
previousState.params.action_value) {
|
|
939
|
-
const resResultInline = yield subotInlineMessage(previousState.params);
|
|
954
|
+
const resResultInline = yield subotInlineMessage$1(previousState.params);
|
|
940
955
|
if ((resResultInline === null || resResultInline === void 0 ? void 0 : resResultInline._status) === 1 && (resResultInline === null || resResultInline === void 0 ? void 0 : resResultInline._data.node)) {
|
|
941
956
|
newActiveId = resResultInline === null || resResultInline === void 0 ? void 0 : resResultInline._data.node.id;
|
|
942
957
|
nodes = previousState.listNodes;
|
|
@@ -1005,7 +1020,7 @@ const SubotInlineProvider = ({ children, articleLink, subotId, isFullContainer,
|
|
|
1005
1020
|
const onNext = useCallback((messageParams) => __awaiter(void 0, void 0, void 0, function* () {
|
|
1006
1021
|
if (messageParams === null || messageParams === void 0 ? void 0 : messageParams.node_id) {
|
|
1007
1022
|
const newMessage = Object.assign(Object.assign({}, messageParams), getCurrentTotalDynamicScore(listNodes, activeId, messageParams.action_id));
|
|
1008
|
-
const res = yield subotInlineMessage(newMessage);
|
|
1023
|
+
const res = yield subotInlineMessage$1(newMessage);
|
|
1009
1024
|
setLoading(false);
|
|
1010
1025
|
if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
|
|
1011
1026
|
const _b = res === null || res === void 0 ? void 0 : res._data, { node } = _b, restData = __rest(_b, ["node"]);
|
|
@@ -1153,7 +1168,7 @@ const SubotInlineProvider = ({ children, articleLink, subotId, isFullContainer,
|
|
|
1153
1168
|
if (!listNodes.length) {
|
|
1154
1169
|
return null;
|
|
1155
1170
|
}
|
|
1156
|
-
return (React__default.createElement(SubotInlineContext.Provider, { value: value },
|
|
1171
|
+
return (React__default.createElement(SubotInlineContext$1.Provider, { value: value },
|
|
1157
1172
|
React__default.createElement("div", { ref: ref }, children)));
|
|
1158
1173
|
};
|
|
1159
1174
|
|
|
@@ -1657,7 +1672,7 @@ const Container$u = () => {
|
|
|
1657
1672
|
var _a, _b, _c;
|
|
1658
1673
|
const { formatMessage: f, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
|
|
1659
1674
|
const currentUrl = useCurrentUrl();
|
|
1660
|
-
const { listNodes, activeId, isShowFooter, onNext, onPrev, params, onStartOver, loading, } = useContext(SubotInlineContext);
|
|
1675
|
+
const { listNodes, activeId, isShowFooter, onNext, onPrev, params, onStartOver, loading, } = useContext(SubotInlineContext$1);
|
|
1661
1676
|
const { value } = useContext(NodeContext);
|
|
1662
1677
|
const validation = useValidationMultiOption();
|
|
1663
1678
|
const botItem = listNodes[0];
|
|
@@ -2049,7 +2064,7 @@ const Container$s = ({ node, onClickStart }) => {
|
|
|
2049
2064
|
const refImpression = useRef(false);
|
|
2050
2065
|
const { ref, inView } = useInView();
|
|
2051
2066
|
const currentUrl = useCurrentUrl();
|
|
2052
|
-
const { params, getParams, onNext, setIsShowFooter, listNodes } = useContext(SubotInlineContext);
|
|
2067
|
+
const { params, getParams, onNext, setIsShowFooter, listNodes } = useContext(SubotInlineContext$1);
|
|
2053
2068
|
const botItem = listNodes[0];
|
|
2054
2069
|
const botType = (_a = botItem === null || botItem === void 0 ? void 0 : botItem.extra_settings) === null || _a === void 0 ? void 0 : _a.subot_type;
|
|
2055
2070
|
useMemo(() => {
|
|
@@ -2059,14 +2074,14 @@ const Container$s = ({ node, onClickStart }) => {
|
|
|
2059
2074
|
if (!inView || refImpression.current) {
|
|
2060
2075
|
return;
|
|
2061
2076
|
}
|
|
2062
|
-
subotInlineImpression(getParams());
|
|
2077
|
+
subotInlineImpression$1(getParams());
|
|
2063
2078
|
refImpression.current = true;
|
|
2064
2079
|
}, [inView]);
|
|
2065
2080
|
const handleClickStart = () => {
|
|
2066
2081
|
// 1. Tracking Event Click
|
|
2067
2082
|
const params = getParams();
|
|
2068
2083
|
params.device_id = checkMobile(window.navigator.userAgent) ? 2 : 1;
|
|
2069
|
-
subotInlineClick(params);
|
|
2084
|
+
subotInlineClick$1(params);
|
|
2070
2085
|
// 2. Call API to fetch next node
|
|
2071
2086
|
onNext();
|
|
2072
2087
|
onClickStart === null || onClickStart === void 0 ? void 0 : onClickStart();
|
|
@@ -2345,7 +2360,7 @@ const handleFrisoRedirecition = (listNode) => {
|
|
|
2345
2360
|
|
|
2346
2361
|
const Container$r = ({ intent }) => {
|
|
2347
2362
|
var _a;
|
|
2348
|
-
const { listNodes } = useContext(SubotInlineContext);
|
|
2363
|
+
const { listNodes } = useContext(SubotInlineContext$1);
|
|
2349
2364
|
const handleOnClick = () => {
|
|
2350
2365
|
var _a;
|
|
2351
2366
|
if ((_a = intent.url) === null || _a === void 0 ? void 0 : _a.includes('{{.frisoRedirectUrl}}')) {
|
|
@@ -2401,7 +2416,7 @@ const Container$q = ({ intent }) => {
|
|
|
2401
2416
|
Container$q.displayName = 'SubotInlineIntentBotImage';
|
|
2402
2417
|
|
|
2403
2418
|
const Container$p = ({ intent, indexNumber }) => {
|
|
2404
|
-
const { listNodes } = useContext(SubotInlineContext);
|
|
2419
|
+
const { listNodes } = useContext(SubotInlineContext$1);
|
|
2405
2420
|
const isShowLabel = ![NodeIntentType.SSO_INTENT].includes(intent === null || intent === void 0 ? void 0 : intent.type);
|
|
2406
2421
|
const isText = [
|
|
2407
2422
|
NodeIntentType.BOT_TEXT,
|
|
@@ -2435,7 +2450,7 @@ Container$p.displayName = 'SubotInlineIntentBotTitle';
|
|
|
2435
2450
|
|
|
2436
2451
|
const Container$o = ({ intent }) => {
|
|
2437
2452
|
const currentUrl = useCurrentUrl();
|
|
2438
|
-
const { listNodes, activeId, params } = useContext(SubotInlineContext);
|
|
2453
|
+
const { listNodes, activeId, params } = useContext(SubotInlineContext$1);
|
|
2439
2454
|
const foundNode = listNodes.find((n) => n.id == activeId);
|
|
2440
2455
|
if (!intent.label || !foundNode) {
|
|
2441
2456
|
return null;
|
|
@@ -2776,7 +2791,7 @@ const StyledWrap$e = styled.div `
|
|
|
2776
2791
|
`;
|
|
2777
2792
|
|
|
2778
2793
|
const Container$k = ({ intent }) => {
|
|
2779
|
-
const { listNodes } = useContext(SubotInlineContext);
|
|
2794
|
+
const { listNodes } = useContext(SubotInlineContext$1);
|
|
2780
2795
|
if (!(intent === null || intent === void 0 ? void 0 : intent.label)) {
|
|
2781
2796
|
return null;
|
|
2782
2797
|
}
|
|
@@ -2837,15 +2852,15 @@ const Container$j = ({ intent }) => {
|
|
|
2837
2852
|
};
|
|
2838
2853
|
Container$j.displayName = 'SubotInlineIntentSSO';
|
|
2839
2854
|
|
|
2840
|
-
var _a$
|
|
2841
|
-
const SubotInlineIntentCol = styled.div `
|
|
2855
|
+
var _a$2;
|
|
2856
|
+
const SubotInlineIntentCol$1 = styled.div `
|
|
2842
2857
|
width: ${({ width }) => width || '100%'};
|
|
2843
2858
|
padding: 4px;
|
|
2844
2859
|
${MediaQueries.mbDown} {
|
|
2845
2860
|
width: 100%;
|
|
2846
2861
|
}
|
|
2847
2862
|
`;
|
|
2848
|
-
const SubotInlineIntentUrlContainer = styled.div `
|
|
2863
|
+
const SubotInlineIntentUrlContainer$1 = styled.div `
|
|
2849
2864
|
display: flex;
|
|
2850
2865
|
.feature {
|
|
2851
2866
|
width: 30%;
|
|
@@ -2873,7 +2888,7 @@ const SubotInlineIntentUrlContainer = styled.div `
|
|
|
2873
2888
|
margin-left: 10px;
|
|
2874
2889
|
line-height: 1.5;
|
|
2875
2890
|
a {
|
|
2876
|
-
color: ${((_a$
|
|
2891
|
+
color: ${((_a$2 = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _a$2 === void 0 ? void 0 : _a$2.gray800) || '#262626'};
|
|
2877
2892
|
text-decoration: none;
|
|
2878
2893
|
}
|
|
2879
2894
|
}
|
|
@@ -2883,8 +2898,8 @@ const Container$i = ({ intent, }) => {
|
|
|
2883
2898
|
const article = useMemo(() => intent.label.includes('{')
|
|
2884
2899
|
? JSON.parse(intent.label)
|
|
2885
2900
|
: {}, [intent.label]);
|
|
2886
|
-
return (React__default.createElement(React__default.Fragment, null, !!Object.keys(article).length && (React__default.createElement(SubotInlineIntentCol, null,
|
|
2887
|
-
React__default.createElement(SubotInlineIntentUrlContainer, null,
|
|
2901
|
+
return (React__default.createElement(React__default.Fragment, null, !!Object.keys(article).length && (React__default.createElement(SubotInlineIntentCol$1, null,
|
|
2902
|
+
React__default.createElement(SubotInlineIntentUrlContainer$1, null,
|
|
2888
2903
|
React__default.createElement("div", { className: "feature" },
|
|
2889
2904
|
React__default.createElement("a", { href: article === null || article === void 0 ? void 0 : article.url, className: "feature-wrapper" },
|
|
2890
2905
|
React__default.createElement("img", { loading: "lazy", src: article === null || article === void 0 ? void 0 : article.thumbnail, alt: article === null || article === void 0 ? void 0 : article.title, className: "feature-img" }))),
|
|
@@ -2921,7 +2936,7 @@ const SubotInlineIntentBaseTarget = {
|
|
|
2921
2936
|
/** intents fake for sso block */
|
|
2922
2937
|
[NodeIntentType.SSO_INTENT]: Container$j,
|
|
2923
2938
|
};
|
|
2924
|
-
const SubotInlineIntentBase = new Proxy(SubotInlineIntentBaseTarget, {
|
|
2939
|
+
const SubotInlineIntentBase$1 = new Proxy(SubotInlineIntentBaseTarget, {
|
|
2925
2940
|
get(_, prop) {
|
|
2926
2941
|
const UnknowComponent = () => {
|
|
2927
2942
|
if (isProduction)
|
|
@@ -2948,7 +2963,7 @@ const Container$h = ({ intents: intentsProp, indexNumber, }) => {
|
|
|
2948
2963
|
const intentType = (intent === null || intent === void 0 ? void 0 : intent.type) || '';
|
|
2949
2964
|
if (excludeIntents.includes(intentType))
|
|
2950
2965
|
return null;
|
|
2951
|
-
const NodeIntent = SubotInlineIntentBase[intentType];
|
|
2966
|
+
const NodeIntent = SubotInlineIntentBase$1[intentType];
|
|
2952
2967
|
return NodeIntent && React__default.createElement(NodeIntent, { key: intent.id, intent: intent });
|
|
2953
2968
|
})))));
|
|
2954
2969
|
};
|
|
@@ -2956,7 +2971,7 @@ Container$h.displayName = 'SubotInlineIntent';
|
|
|
2956
2971
|
|
|
2957
2972
|
const Container$g = ({ node }) => {
|
|
2958
2973
|
var _a, _b;
|
|
2959
|
-
const { setIsShowFooter, listNodes } = useContext(SubotInlineContext);
|
|
2974
|
+
const { setIsShowFooter, listNodes } = useContext(SubotInlineContext$1);
|
|
2960
2975
|
const botItem = listNodes[0];
|
|
2961
2976
|
useMemo(() => {
|
|
2962
2977
|
setIsShowFooter(true);
|
|
@@ -3147,7 +3162,7 @@ const SubInlineIntent = ({ subIntents }) => {
|
|
|
3147
3162
|
React__default.createElement(ChevronDown, { className: "si-chevron-down" })),
|
|
3148
3163
|
React__default.createElement(motion.div, { className: "si-sub-intent-expand", animate: isShow ? { height: 'auto' } : { height: 0 }, transition: { duration: 0.3 }, "data-show": isShow }, restSubIntents.map((intent) => {
|
|
3149
3164
|
const intentType = (intent === null || intent === void 0 ? void 0 : intent.type) || '';
|
|
3150
|
-
const NodeIntent = SubotInlineIntentBase[intentType];
|
|
3165
|
+
const NodeIntent = SubotInlineIntentBase$1[intentType];
|
|
3151
3166
|
return NodeIntent && React__default.createElement(NodeIntent, { key: intent.id, intent: intent });
|
|
3152
3167
|
}))));
|
|
3153
3168
|
};
|
|
@@ -3158,7 +3173,7 @@ const Container$f = ({ node }) => {
|
|
|
3158
3173
|
// const isMobile = useGetIsMobile(true)
|
|
3159
3174
|
const refMainIntents = useRef(null);
|
|
3160
3175
|
const { formatMessage: f } = useContext(TogetherComponentGlobalContext);
|
|
3161
|
-
const { setIsShowFooter, listNodes } = useContext(SubotInlineContext);
|
|
3176
|
+
const { setIsShowFooter, listNodes } = useContext(SubotInlineContext$1);
|
|
3162
3177
|
const [isShowMore, setIsShowMore] = useState(false);
|
|
3163
3178
|
useEffect(() => {
|
|
3164
3179
|
var _a;
|
|
@@ -3263,11 +3278,11 @@ const Container$f = ({ node }) => {
|
|
|
3263
3278
|
defaultMessage: 'See more',
|
|
3264
3279
|
}))),
|
|
3265
3280
|
React__default.createElement("div", { className: "wrap-main-button-intent" }, (_a = [...mainButtonIntents, ...bookingButtonIntents]) === null || _a === void 0 ? void 0 : _a.map((intent) => {
|
|
3266
|
-
const NodeIntent = SubotInlineIntentBase[intent.type || ''];
|
|
3281
|
+
const NodeIntent = SubotInlineIntentBase$1[intent.type || ''];
|
|
3267
3282
|
return NodeIntent && React__default.createElement(NodeIntent, { key: intent.id, intent: intent });
|
|
3268
3283
|
})),
|
|
3269
3284
|
(suggestedServiceIntents === null || suggestedServiceIntents === void 0 ? void 0 : suggestedServiceIntents.length) > 0 && (React__default.createElement("div", null, suggestedServiceIntents.map((intent) => {
|
|
3270
|
-
const NodeIntent = SubotInlineIntentBase[intent.type || ''];
|
|
3285
|
+
const NodeIntent = SubotInlineIntentBase$1[intent.type || ''];
|
|
3271
3286
|
return NodeIntent && React__default.createElement(NodeIntent, { key: intent.id, intent: intent });
|
|
3272
3287
|
}))),
|
|
3273
3288
|
(relatedArticleIntents === null || relatedArticleIntents === void 0 ? void 0 : relatedArticleIntents.length) > 0 && (React__default.createElement("div", { style: { marginTop: 24 } },
|
|
@@ -3276,7 +3291,7 @@ const Container$f = ({ node }) => {
|
|
|
3276
3291
|
defaultMessage: 'Related Articles',
|
|
3277
3292
|
})),
|
|
3278
3293
|
React__default.createElement("div", { style: { padding: '8px 0' } }, relatedArticleIntents.map((intent) => {
|
|
3279
|
-
const NodeIntent = SubotInlineIntentBase[intent.type || ''];
|
|
3294
|
+
const NodeIntent = SubotInlineIntentBase$1[intent.type || ''];
|
|
3280
3295
|
return (NodeIntent && React__default.createElement(NodeIntent, { key: intent.id, intent: intent }));
|
|
3281
3296
|
})))),
|
|
3282
3297
|
React__default.createElement(SubInlineIntent, { subIntents: subIntents })));
|
|
@@ -3290,7 +3305,7 @@ const StyledWrap$b = styled.div `
|
|
|
3290
3305
|
`;
|
|
3291
3306
|
|
|
3292
3307
|
const Container$e = ({ node }) => {
|
|
3293
|
-
const { params, onNext, setIsShowFooter } = useContext(SubotInlineContext);
|
|
3308
|
+
const { params, onNext, setIsShowFooter } = useContext(SubotInlineContext$1);
|
|
3294
3309
|
useMemo(() => {
|
|
3295
3310
|
setIsShowFooter(true);
|
|
3296
3311
|
}, []);
|
|
@@ -3702,7 +3717,7 @@ const CountDown = ({ onFinish, onClick, isFinished, resendLabel, className }, re
|
|
|
3702
3717
|
};
|
|
3703
3718
|
var CountDown$1 = forwardRef(CountDown);
|
|
3704
3719
|
|
|
3705
|
-
styled.div `
|
|
3720
|
+
const StyledUserInfoFormContainer$1 = styled.div `
|
|
3706
3721
|
margin: 0 auto;
|
|
3707
3722
|
background: #f7f9fc;
|
|
3708
3723
|
border-radius: ${theme.borderRadius};
|
|
@@ -4634,7 +4649,7 @@ const OTP_VERIFIED_MSG_CODE = {
|
|
|
4634
4649
|
},
|
|
4635
4650
|
};
|
|
4636
4651
|
|
|
4637
|
-
var _a, _b, _c, _d, _e;
|
|
4652
|
+
var _a$1, _b$1, _c$1, _d$1, _e$1;
|
|
4638
4653
|
const StyledPhoneCode = styled.div `
|
|
4639
4654
|
display: flex;
|
|
4640
4655
|
align-items: center;
|
|
@@ -4646,21 +4661,21 @@ const StyledPhoneCode = styled.div `
|
|
|
4646
4661
|
border-radius: 2px;
|
|
4647
4662
|
}
|
|
4648
4663
|
> div {
|
|
4649
|
-
color: ${((_a = theme.colors) === null || _a === void 0 ? void 0 : _a.gray800) || ''};
|
|
4664
|
+
color: ${((_a$1 = theme.colors) === null || _a$1 === void 0 ? void 0 : _a$1.gray800) || ''};
|
|
4650
4665
|
white-space: nowrap;
|
|
4651
4666
|
}
|
|
4652
4667
|
`;
|
|
4653
4668
|
styled(PhoneInputBase) `
|
|
4654
4669
|
display: flex;
|
|
4655
|
-
border: 1px solid ${((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.gray200) || ''};
|
|
4670
|
+
border: 1px solid ${((_b$1 = theme.colors) === null || _b$1 === void 0 ? void 0 : _b$1.gray200) || ''};
|
|
4656
4671
|
border-radius: ${theme === null || theme === void 0 ? void 0 : theme.borderRadius};
|
|
4657
4672
|
.PhoneInputCountry {
|
|
4658
4673
|
position: relative;
|
|
4659
4674
|
padding: 12px 8px 12px 16px;
|
|
4660
|
-
border-right: 1px solid ${((_c = theme.colors) === null || _c === void 0 ? void 0 : _c.gray200) || ''};
|
|
4661
|
-
background-color: ${((_d = theme.colors) === null || _d === void 0 ? void 0 : _d.gray100) || ''};
|
|
4675
|
+
border-right: 1px solid ${((_c$1 = theme.colors) === null || _c$1 === void 0 ? void 0 : _c$1.gray200) || ''};
|
|
4676
|
+
background-color: ${((_d$1 = theme.colors) === null || _d$1 === void 0 ? void 0 : _d$1.gray100) || ''};
|
|
4662
4677
|
border-radius: 6px 0 0 6px;
|
|
4663
|
-
color: ${((_e = theme.colors) === null || _e === void 0 ? void 0 : _e.gray800) || ''};
|
|
4678
|
+
color: ${((_e$1 = theme.colors) === null || _e$1 === void 0 ? void 0 : _e$1.gray800) || ''};
|
|
4664
4679
|
.PhoneInputCountrySelect {
|
|
4665
4680
|
position: absolute;
|
|
4666
4681
|
top: 0;
|
|
@@ -5497,14 +5512,14 @@ const StyledWrap$a = styled.div `
|
|
|
5497
5512
|
const Container$d = ({ node, indexNumber }) => {
|
|
5498
5513
|
var _a;
|
|
5499
5514
|
const locale = GlobalData === null || GlobalData === void 0 ? void 0 : GlobalData.locale;
|
|
5500
|
-
const { params, listNodes, activeId, onSubmit, setIsShowFooter } = useContext(SubotInlineContext);
|
|
5515
|
+
const { params, listNodes, activeId, onSubmit, setIsShowFooter } = useContext(SubotInlineContext$1);
|
|
5501
5516
|
useMemo(() => {
|
|
5502
5517
|
setIsShowFooter(true);
|
|
5503
5518
|
}, []);
|
|
5504
5519
|
const handleSubmit = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
5505
5520
|
checkSyncDataOnFrisoCampaign(listNodes[0], data.form_submit_meta);
|
|
5506
5521
|
const _message = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, params), node._message), data), getCurrentTotalDynamicScore(listNodes, activeId, data.action_id, data.form_submit_meta)), { node_id: node.id });
|
|
5507
|
-
const res = yield subotInlineMessage(_message);
|
|
5522
|
+
const res = yield subotInlineMessage$1(_message);
|
|
5508
5523
|
// asking
|
|
5509
5524
|
if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
|
|
5510
5525
|
const _b = res === null || res === void 0 ? void 0 : res._data, { node: _node } = _b, restData = __rest(_b, ["node"]);
|
|
@@ -5669,7 +5684,7 @@ const StyledWrap$7 = styled.div `
|
|
|
5669
5684
|
`;
|
|
5670
5685
|
const Container$c = ({ action, active, onChange, htmlType, }) => {
|
|
5671
5686
|
const currentUrl = useCurrentUrl();
|
|
5672
|
-
const { params } = useContext(SubotInlineContext);
|
|
5687
|
+
const { params } = useContext(SubotInlineContext$1);
|
|
5673
5688
|
return (React__default.createElement(StyledWrap$7, { className: "si-action-img-choice", onClick: () => onChange && onChange(action), active: !!active, "data-event-category": "Service Connection", "data-event-action": "Risk Screening Answer Click", "data-event-label": currentUrl, "data-bot-id": params.bot_id },
|
|
5674
5689
|
React__default.createElement("div", { className: "si-action-image-wrap" },
|
|
5675
5690
|
React__default.createElement("img", { loading: "lazy", src: action === null || action === void 0 ? void 0 : action.url, alt: action === null || action === void 0 ? void 0 : action.label })),
|
|
@@ -5685,7 +5700,7 @@ const StyledWrap$6 = styled.div `
|
|
|
5685
5700
|
`;
|
|
5686
5701
|
const Container$b = ({ action, onChange }) => {
|
|
5687
5702
|
const currentUrl = useCurrentUrl();
|
|
5688
|
-
const { params, activeId } = useContext(SubotInlineContext);
|
|
5703
|
+
const { params, activeId } = useContext(SubotInlineContext$1);
|
|
5689
5704
|
return (React__default.createElement(StyledWrap$6, null,
|
|
5690
5705
|
React__default.createElement(Button, { onClick: () => onChange && onChange(action), size: "lg", "data-event-category": "Service Connection", "data-event-action": "Risk Screening Sign Up for Result", "data-event-label": currentUrl, "data-bot-id": params.bot_id, "data-event-question-id": activeId, styles: {
|
|
5691
5706
|
root: {
|
|
@@ -5747,7 +5762,7 @@ const Container$a = ({ action, onChange, active, htmlType, formSubmitMeta, }) =>
|
|
|
5747
5762
|
const currentUrl = useCurrentUrl();
|
|
5748
5763
|
const inputRef = useRef(null);
|
|
5749
5764
|
const [otherText, setOtherText] = useState('');
|
|
5750
|
-
const { params } = useContext(SubotInlineContext);
|
|
5765
|
+
const { params } = useContext(SubotInlineContext$1);
|
|
5751
5766
|
const isActionPollWithOther = (action === null || action === void 0 ? void 0 : action.type) === NodeActionType.POLL_CHOICE_TEXT_BY_INPUT;
|
|
5752
5767
|
const isActionSelectWithOther = (action === null || action === void 0 ? void 0 : action.type) === NodeActionType.USER_CHOICE_TEXT_BY_INPUT ||
|
|
5753
5768
|
isActionPollWithOther;
|
|
@@ -5831,7 +5846,7 @@ const SubotInlineActionBaseTarget = {
|
|
|
5831
5846
|
// [NodeActionType.RESULT_BUTTON]: SubotInlineActionTextChoice,
|
|
5832
5847
|
// [NodeActionType.POLL_RESULT]: SubotInlinePollResult,
|
|
5833
5848
|
};
|
|
5834
|
-
const SubotInlineActionBase = new Proxy(SubotInlineActionBaseTarget, {
|
|
5849
|
+
const SubotInlineActionBase$1 = new Proxy(SubotInlineActionBaseTarget, {
|
|
5835
5850
|
get(_, prop) {
|
|
5836
5851
|
const UnknowComponent = () => {
|
|
5837
5852
|
if (isProduction)
|
|
@@ -5862,14 +5877,14 @@ const Container$7 = ({ actions, value, onChange, htmlType, node_type, formSubmit
|
|
|
5862
5877
|
const actionType = action.type;
|
|
5863
5878
|
if (excludeActions.includes(actionType))
|
|
5864
5879
|
return null;
|
|
5865
|
-
const NodeAction = SubotInlineActionBase[action.type];
|
|
5880
|
+
const NodeAction = SubotInlineActionBase$1[action.type];
|
|
5866
5881
|
return (NodeAction && (React__default.createElement(NodeAction, { key: action.id, action: action, onChange: onChange, active: value === null || value === void 0 ? void 0 : value.includes(action.id), htmlType: htmlType, formSubmitMeta: formSubmitMeta })));
|
|
5867
5882
|
})));
|
|
5868
5883
|
};
|
|
5869
5884
|
Container$7.displayName = 'SubotInlineAction';
|
|
5870
5885
|
|
|
5871
5886
|
const Container$6 = ({ node, indexNumber }) => {
|
|
5872
|
-
const { params, listNodes, activeId, onSubmit, setIsShowFooter, setLoading } = useContext(SubotInlineContext);
|
|
5887
|
+
const { params, listNodes, activeId, onSubmit, setIsShowFooter, setLoading } = useContext(SubotInlineContext$1);
|
|
5873
5888
|
const { value, setValue } = useContext(NodeContext);
|
|
5874
5889
|
useMemo(() => {
|
|
5875
5890
|
setIsShowFooter(true);
|
|
@@ -5884,7 +5899,7 @@ const Container$6 = ({ node, indexNumber }) => {
|
|
|
5884
5899
|
setValue(Object.assign(Object.assign({}, value), { action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key }));
|
|
5885
5900
|
const newParams = Object.assign(Object.assign(Object.assign(Object.assign({}, params), value), { node_id: node.id, action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key }), getCurrentTotalDynamicScore(listNodes, activeId, action.id));
|
|
5886
5901
|
setLoading(true);
|
|
5887
|
-
const res = yield subotInlineMessage(newParams);
|
|
5902
|
+
const res = yield subotInlineMessage$1(newParams);
|
|
5888
5903
|
setLoading(false);
|
|
5889
5904
|
if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
|
|
5890
5905
|
const _a = res === null || res === void 0 ? void 0 : res._data, { node } = _a, restData = __rest(_a, ["node"]);
|
|
@@ -5909,7 +5924,7 @@ const StyledWrap$3 = styled.div `
|
|
|
5909
5924
|
|
|
5910
5925
|
const Container$5 = ({ node, indexNumber }) => {
|
|
5911
5926
|
var _a;
|
|
5912
|
-
const { setIsShowFooter, onChange } = useContext(SubotInlineContext);
|
|
5927
|
+
const { setIsShowFooter, onChange } = useContext(SubotInlineContext$1);
|
|
5913
5928
|
const { value, setValue } = useContext(NodeContext);
|
|
5914
5929
|
useMemo(() => {
|
|
5915
5930
|
setIsShowFooter(true);
|
|
@@ -6021,7 +6036,7 @@ const StyledWrap$2 = styled.div `
|
|
|
6021
6036
|
`;
|
|
6022
6037
|
|
|
6023
6038
|
const Container$4 = ({ node, indexNumber }) => {
|
|
6024
|
-
const { onChange, setIsShowFooter } = useContext(SubotInlineContext);
|
|
6039
|
+
const { onChange, setIsShowFooter } = useContext(SubotInlineContext$1);
|
|
6025
6040
|
const { value, setValue } = useContext(NodeContext);
|
|
6026
6041
|
const descriptionNode = useDescriptionPollNode({ node });
|
|
6027
6042
|
useMemo(() => {
|
|
@@ -6096,7 +6111,7 @@ const StyledWrap$1 = styled.div ``;
|
|
|
6096
6111
|
const Container$3 = ({ node }) => {
|
|
6097
6112
|
const refIsTrigger = useRef(false);
|
|
6098
6113
|
const { formatMessage: f, data: { userInfo }, } = useContext(TogetherComponentGlobalContext);
|
|
6099
|
-
const { params, setIsShowFooter, listNodes, activeId } = useContext(SubotInlineContext);
|
|
6114
|
+
const { params, setIsShowFooter, listNodes, activeId } = useContext(SubotInlineContext$1);
|
|
6100
6115
|
useMemo(() => {
|
|
6101
6116
|
setIsShowFooter(true);
|
|
6102
6117
|
}, []);
|
|
@@ -6158,7 +6173,7 @@ const StyledWrap = styled.div `
|
|
|
6158
6173
|
`;
|
|
6159
6174
|
|
|
6160
6175
|
const Container$2 = ({ node, indexNumber }) => {
|
|
6161
|
-
const { params, onSubmit, setIsShowFooter, listNodes, activeId, setLoading, onChange, } = useContext(SubotInlineContext);
|
|
6176
|
+
const { params, onSubmit, setIsShowFooter, listNodes, activeId, setLoading, onChange, } = useContext(SubotInlineContext$1);
|
|
6162
6177
|
const { value, setValue } = useContext(NodeContext);
|
|
6163
6178
|
useMemo(() => {
|
|
6164
6179
|
setIsShowFooter(true);
|
|
@@ -6174,7 +6189,7 @@ const Container$2 = ({ node, indexNumber }) => {
|
|
|
6174
6189
|
const handleOnChangeNormal = (action) => __awaiter(void 0, void 0, void 0, function* () {
|
|
6175
6190
|
const newParams = Object.assign(Object.assign(Object.assign(Object.assign({}, params), value), { node_id: node.id, action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key, form_submit_meta: undefined }), getCurrentTotalDynamicScore(listNodes, activeId, action.id));
|
|
6176
6191
|
setLoading(true);
|
|
6177
|
-
const res = yield subotInlineMessage(newParams);
|
|
6192
|
+
const res = yield subotInlineMessage$1(newParams);
|
|
6178
6193
|
setLoading(false);
|
|
6179
6194
|
if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
|
|
6180
6195
|
const _a = res === null || res === void 0 ? void 0 : res._data, { node } = _a, restData = __rest(_a, ["node"]);
|
|
@@ -6222,7 +6237,7 @@ const SubotInlineNodeBaseTarget = {
|
|
|
6222
6237
|
// RESULT_RATING = 12,
|
|
6223
6238
|
// RESULT_REACTION = 13,
|
|
6224
6239
|
};
|
|
6225
|
-
const SubotInlineNodeBase = new Proxy(SubotInlineNodeBaseTarget, {
|
|
6240
|
+
const SubotInlineNodeBase$1 = new Proxy(SubotInlineNodeBaseTarget, {
|
|
6226
6241
|
get(_, prop) {
|
|
6227
6242
|
const UnknowComponent = () => {
|
|
6228
6243
|
if (isProduction)
|
|
@@ -6237,7 +6252,7 @@ const SubotInlineNodeBase = new Proxy(SubotInlineNodeBaseTarget, {
|
|
|
6237
6252
|
|
|
6238
6253
|
const Container$1 = ({ onClickStart }) => {
|
|
6239
6254
|
var _a;
|
|
6240
|
-
const { listNodes, activeId, isDisabledAnimationOnMobile } = useContext(SubotInlineContext);
|
|
6255
|
+
const { listNodes, activeId, isDisabledAnimationOnMobile } = useContext(SubotInlineContext$1);
|
|
6241
6256
|
const foundIdx = useMemo(() => {
|
|
6242
6257
|
return listNodes.findIndex((n) => n.id == activeId);
|
|
6243
6258
|
}, [listNodes, activeId]);
|
|
@@ -6258,10 +6273,10 @@ const Container$1 = ({ onClickStart }) => {
|
|
|
6258
6273
|
const nodeType = NodeType[node.type].valueOf();
|
|
6259
6274
|
const nodeTypeSSO = (_a = NodePosition[node.position]) === null || _a === void 0 ? void 0 : _a.valueOf();
|
|
6260
6275
|
let NodeComponent = node.position === NodePosition.SSO
|
|
6261
|
-
? SubotInlineNodeBase[nodeTypeSSO]
|
|
6262
|
-
: SubotInlineNodeBase[nodeType];
|
|
6276
|
+
? SubotInlineNodeBase$1[nodeTypeSSO]
|
|
6277
|
+
: SubotInlineNodeBase$1[nodeType];
|
|
6263
6278
|
if (node.is_multi_select && node.type !== NodeType.POLL) {
|
|
6264
|
-
NodeComponent = SubotInlineNodeBase['MULTIPLE'];
|
|
6279
|
+
NodeComponent = SubotInlineNodeBase$1['MULTIPLE'];
|
|
6265
6280
|
}
|
|
6266
6281
|
return (React__default.createElement(motion.div, { key: node.id, initial: { opacity: 1, y: -300 }, animate: { opacity: 1, y: 0 }, transition: {
|
|
6267
6282
|
y: { type: 'spring', stiffness: 300, damping: 30 },
|
|
@@ -6299,7 +6314,7 @@ const View = ({ loading, backgroundImage, isShowFooter, isFullContainer, isDisab
|
|
|
6299
6314
|
backgroundRepeat: 'no-repeat',
|
|
6300
6315
|
backgroundPosition: 'center',
|
|
6301
6316
|
}), [backgroundImage]);
|
|
6302
|
-
const { isMobile, locale } = useContext(SubotInlineContext);
|
|
6317
|
+
const { isMobile, locale } = useContext(SubotInlineContext$1);
|
|
6303
6318
|
const [isDisplayFullMobile, setIsDisplayFullMobile] = useState(false);
|
|
6304
6319
|
useEffect(() => {
|
|
6305
6320
|
if (isDisplayFullMobile) {
|
|
@@ -6362,7 +6377,7 @@ const ViewWithMemo = memo(View);
|
|
|
6362
6377
|
ViewWithMemo.displayName = 'SubotInlineRevampView';
|
|
6363
6378
|
|
|
6364
6379
|
const Container = () => {
|
|
6365
|
-
const { loading, listNodes, isShowFooter, activeId, isFullContainer, isDisabledAnimationOnMobile, onCloseMobile, userInfo, bgImgFullContainer, typeFormProps, } = useContext(SubotInlineContext);
|
|
6380
|
+
const { loading, listNodes, isShowFooter, activeId, isFullContainer, isDisabledAnimationOnMobile, onCloseMobile, userInfo, bgImgFullContainer, typeFormProps, } = useContext(SubotInlineContext$1);
|
|
6366
6381
|
const backgroundImage = useMemo(() => {
|
|
6367
6382
|
var _a, _b;
|
|
6368
6383
|
const foundNode = listNodes.find((n) => n.id == activeId);
|
|
@@ -6419,6 +6434,3118 @@ const SubotInlineRevampWithTheme = (props) => {
|
|
|
6419
6434
|
return (React__default.createElement(ContainerWithProvider, Object.assign({}, props, { primaryColor: (_b = (_a = botData.extra_settings) === null || _a === void 0 ? void 0 : _a.inline_styles) === null || _b === void 0 ? void 0 : _b.primary_color, textColor: (_d = (_c = botData.extra_settings) === null || _c === void 0 ? void 0 : _c.inline_styles) === null || _d === void 0 ? void 0 : _d.text_color, textButtonColor: (_f = (_e = botData.extra_settings) === null || _e === void 0 ? void 0 : _e.inline_styles) === null || _f === void 0 ? void 0 : _f.text_button_color, bgColor: (_h = (_g = botData.extra_settings) === null || _g === void 0 ? void 0 : _g.inline_styles) === null || _h === void 0 ? void 0 : _h.container_bg_color, bgContentColor: (_k = (_j = botData.extra_settings) === null || _j === void 0 ? void 0 : _j.inline_styles) === null || _k === void 0 ? void 0 : _k.content_bg_color, bgImgFullContainer: (_m = (_l = botData.extra_settings) === null || _l === void 0 ? void 0 : _l.inline_styles) === null || _m === void 0 ? void 0 : _m.container_bg_image })));
|
|
6420
6435
|
};
|
|
6421
6436
|
|
|
6437
|
+
const SubotInlineContext = createContext({
|
|
6438
|
+
activeId: '',
|
|
6439
|
+
params: {},
|
|
6440
|
+
nodes: [],
|
|
6441
|
+
getParams: () => ({}),
|
|
6442
|
+
trackingCommonInline: {},
|
|
6443
|
+
});
|
|
6444
|
+
/** inline click */
|
|
6445
|
+
const subotInlineClick = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
6446
|
+
try {
|
|
6447
|
+
return yield callApi(getSubotApiPath(PATHS$1.GET_INLINE_CLICK), 'POST', {
|
|
6448
|
+
data,
|
|
6449
|
+
});
|
|
6450
|
+
}
|
|
6451
|
+
catch (error) { }
|
|
6452
|
+
});
|
|
6453
|
+
/** inline impression */
|
|
6454
|
+
const subotInlineImpression = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
6455
|
+
try {
|
|
6456
|
+
return yield callApi(getSubotApiPath(PATHS$1.GET_INLINE_IMPRESSION), 'POST', {
|
|
6457
|
+
data,
|
|
6458
|
+
});
|
|
6459
|
+
}
|
|
6460
|
+
catch (error) { }
|
|
6461
|
+
});
|
|
6462
|
+
/** inline message */
|
|
6463
|
+
const subotInlineMessage = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
6464
|
+
try {
|
|
6465
|
+
return yield callApi(getSubotApiPath(PATHS$1.GET_INLINE_MESSAGE), 'POST', {
|
|
6466
|
+
data,
|
|
6467
|
+
});
|
|
6468
|
+
}
|
|
6469
|
+
catch (error) { }
|
|
6470
|
+
});
|
|
6471
|
+
const computeExtraSettingsForBot = (data) => {
|
|
6472
|
+
var _a;
|
|
6473
|
+
if ((data === null || data === void 0 ? void 0 : data._status) === 1 && ((_a = data === null || data === void 0 ? void 0 : data._data) === null || _a === void 0 ? void 0 : _a.extra_settings)) {
|
|
6474
|
+
try {
|
|
6475
|
+
const extraSettingsObj = JSON.parse(data._data.extra_settings);
|
|
6476
|
+
if (typeof extraSettingsObj === 'object') {
|
|
6477
|
+
data._data.extra_settings = extraSettingsObj;
|
|
6478
|
+
}
|
|
6479
|
+
else {
|
|
6480
|
+
data._data.extra_settings = {
|
|
6481
|
+
sync_data_friso_campaign: false,
|
|
6482
|
+
};
|
|
6483
|
+
}
|
|
6484
|
+
}
|
|
6485
|
+
catch (err) {
|
|
6486
|
+
data._data.extra_settings = {
|
|
6487
|
+
sync_data_friso_campaign: false,
|
|
6488
|
+
};
|
|
6489
|
+
}
|
|
6490
|
+
}
|
|
6491
|
+
return data;
|
|
6492
|
+
};
|
|
6493
|
+
/** inline first node */
|
|
6494
|
+
const subotInlineFirstNode = (id) => __awaiter(void 0, void 0, void 0, function* () {
|
|
6495
|
+
try {
|
|
6496
|
+
const data = yield callApi(getSubotApiPath(PATHS$1.GET_INLINE_FIRST_NODE) + `/${id}`, 'GET');
|
|
6497
|
+
computeExtraSettingsForBot(data);
|
|
6498
|
+
return data;
|
|
6499
|
+
}
|
|
6500
|
+
catch (error) { }
|
|
6501
|
+
});
|
|
6502
|
+
|
|
6503
|
+
const SubotInlineFormContainer = styled.div `
|
|
6504
|
+
margin-top: 2rem;
|
|
6505
|
+
.form {
|
|
6506
|
+
background-color: ${theme.colors.white || '#fff'};
|
|
6507
|
+
}
|
|
6508
|
+
`;
|
|
6509
|
+
const SubotInlineIntentContainer = styled.div ``;
|
|
6510
|
+
const SubotInlineActionContainer = styled.div `
|
|
6511
|
+
margin-top: 1.25rem;
|
|
6512
|
+
`;
|
|
6513
|
+
const SubotInlineReviewContainer = styled.div `
|
|
6514
|
+
margin-bottom: 1rem;
|
|
6515
|
+
`;
|
|
6516
|
+
const SubotInlineDescription$1 = styled.div `
|
|
6517
|
+
font-weight: 400;
|
|
6518
|
+
font-size: 16px;
|
|
6519
|
+
line-height: 24px;
|
|
6520
|
+
color: #595959;
|
|
6521
|
+
font-style: italic;
|
|
6522
|
+
`;
|
|
6523
|
+
const SubotInlineFinalButton = styled(Button$1) `
|
|
6524
|
+
position: relative;
|
|
6525
|
+
min-width: 180px;
|
|
6526
|
+
svg {
|
|
6527
|
+
path {
|
|
6528
|
+
stroke: currentColor;
|
|
6529
|
+
}
|
|
6530
|
+
}
|
|
6531
|
+
&:hover {
|
|
6532
|
+
svg {
|
|
6533
|
+
path {
|
|
6534
|
+
stroke: currentColor;
|
|
6535
|
+
}
|
|
6536
|
+
}
|
|
6537
|
+
}
|
|
6538
|
+
`;
|
|
6539
|
+
const SubotInlineFinalMoreContainer = styled.div `
|
|
6540
|
+
display: flex;
|
|
6541
|
+
align-items: center;
|
|
6542
|
+
justify-content: center;
|
|
6543
|
+
`;
|
|
6544
|
+
const SubotInlineFinalWrapper = styled.div `
|
|
6545
|
+
position: relative;
|
|
6546
|
+
overflow: ${({ isMore }) => (isMore ? 'unset' : 'hidden')};
|
|
6547
|
+
max-height: ${({ maxHeight }) => (maxHeight ? maxHeight + 'px' : 'auto')};
|
|
6548
|
+
margin-bottom: 8px;
|
|
6549
|
+
transition: 0.25s all linear;
|
|
6550
|
+
&:before {
|
|
6551
|
+
position: absolute;
|
|
6552
|
+
z-index: 1;
|
|
6553
|
+
top: 50%;
|
|
6554
|
+
right: 0;
|
|
6555
|
+
bottom: 0;
|
|
6556
|
+
left: 0;
|
|
6557
|
+
background-image: linear-gradient(
|
|
6558
|
+
to top,
|
|
6559
|
+
${theme.colors.neutral50 || '#F7F9FC'} 0%,
|
|
6560
|
+
transparent 100%
|
|
6561
|
+
);
|
|
6562
|
+
content: '';
|
|
6563
|
+
pointer-events: none;
|
|
6564
|
+
${({ isMore }) => isMore && `opacity: 0;`}
|
|
6565
|
+
}
|
|
6566
|
+
`;
|
|
6567
|
+
const SubotInlineFinalContainer = styled.div `
|
|
6568
|
+
position: relative;
|
|
6569
|
+
padding: 32px 32px 16px;
|
|
6570
|
+
background-color: ${theme.colors.neutral50 || '#F7F9FC'};
|
|
6571
|
+
border-radius: ${theme.borderRadius};
|
|
6572
|
+
${MediaQueries.tdDown} {
|
|
6573
|
+
padding: 24px 24px 16px;
|
|
6574
|
+
}
|
|
6575
|
+
${MediaQueries.mbDown} {
|
|
6576
|
+
padding: 16px;
|
|
6577
|
+
border-radius: 0px;
|
|
6578
|
+
}
|
|
6579
|
+
`;
|
|
6580
|
+
const SubotInlineWrapper$1 = styled.div `
|
|
6581
|
+
padding: 12px 32px 32px;
|
|
6582
|
+
${MediaQueries.tdDown} {
|
|
6583
|
+
padding: 12px 24px 24px;
|
|
6584
|
+
}
|
|
6585
|
+
${MediaQueries.mbDown} {
|
|
6586
|
+
padding: 12px 16px 16px;
|
|
6587
|
+
}
|
|
6588
|
+
`;
|
|
6589
|
+
const SubotInlineContainer$1 = styled.div `
|
|
6590
|
+
border: 1px solid ${theme.colors.neutral100 || '#E4E8EC'};
|
|
6591
|
+
background-color: ${theme.colors.neutral50 || '#F7F9FC'};
|
|
6592
|
+
border-radius: ${theme.borderRadius};
|
|
6593
|
+
${MediaQueries.mbDown} {
|
|
6594
|
+
border: none;
|
|
6595
|
+
}
|
|
6596
|
+
`;
|
|
6597
|
+
|
|
6598
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
6599
|
+
const SubotInlineButtonReaction = styled.div `
|
|
6600
|
+
display: flex;
|
|
6601
|
+
align-items: center;
|
|
6602
|
+
justify-content: center;
|
|
6603
|
+
padding: 12px 24px;
|
|
6604
|
+
border: 1px solid ${theme.colors.neutral100 || '#E4E8EC'};
|
|
6605
|
+
background-color: ${theme.colors.white || 'white'};
|
|
6606
|
+
border-radius: 32px;
|
|
6607
|
+
cursor: pointer;
|
|
6608
|
+
transition: 0.25s all linear;
|
|
6609
|
+
svg {
|
|
6610
|
+
height: 16px;
|
|
6611
|
+
margin-right: 3px;
|
|
6612
|
+
}
|
|
6613
|
+
&:hover {
|
|
6614
|
+
background-color: ${theme.colors.neutral100};
|
|
6615
|
+
}
|
|
6616
|
+
&.active {
|
|
6617
|
+
background-color: ${theme.colors.primaryActive};
|
|
6618
|
+
color: ${theme.colors.white || '#fff'};
|
|
6619
|
+
svg {
|
|
6620
|
+
stroke: ${theme.colors.white || '#fff'};
|
|
6621
|
+
}
|
|
6622
|
+
}
|
|
6623
|
+
`;
|
|
6624
|
+
const SubotInlineButtonReview = styled.div `
|
|
6625
|
+
padding: 12px 24px;
|
|
6626
|
+
border: 1px solid ${theme.colors.neutral100 || '#E4E8EC'};
|
|
6627
|
+
background-color: ${theme.colors.white || 'white'};
|
|
6628
|
+
border-radius: 32px;
|
|
6629
|
+
cursor: pointer;
|
|
6630
|
+
transition: 0.25s all linear;
|
|
6631
|
+
&.active {
|
|
6632
|
+
background-color: ${(_a = theme.colors) === null || _a === void 0 ? void 0 : _a.primaryActive};
|
|
6633
|
+
color: ${theme.colors.white || '#fff'};
|
|
6634
|
+
svg {
|
|
6635
|
+
stroke: ${theme.colors.white || '#fff'};
|
|
6636
|
+
}
|
|
6637
|
+
}
|
|
6638
|
+
`;
|
|
6639
|
+
const SubotInlineActionText = styled.div `
|
|
6640
|
+
display: flex;
|
|
6641
|
+
align-items: center;
|
|
6642
|
+
padding: 16px 24px;
|
|
6643
|
+
border: 1px solid
|
|
6644
|
+
${({ active }) => active
|
|
6645
|
+
? theme.colors.primaryBase || '#2685F1'
|
|
6646
|
+
: theme.colors.white || '#fff'};
|
|
6647
|
+
background-color: ${theme.colors.white || '#fff'};
|
|
6648
|
+
border-radius: ${theme.borderRadius};
|
|
6649
|
+
cursor: pointer;
|
|
6650
|
+
transition: 0.25s all linear;
|
|
6651
|
+
.label {
|
|
6652
|
+
flex: 1;
|
|
6653
|
+
}
|
|
6654
|
+
.icon {
|
|
6655
|
+
position: relative;
|
|
6656
|
+
z-index: 0;
|
|
6657
|
+
display: flex;
|
|
6658
|
+
width: 24px;
|
|
6659
|
+
height: 24px;
|
|
6660
|
+
align-items: center;
|
|
6661
|
+
justify-content: center;
|
|
6662
|
+
padding: 1px;
|
|
6663
|
+
transition: 0.2s linear all;
|
|
6664
|
+
.icon-checkbox {
|
|
6665
|
+
width: 100%;
|
|
6666
|
+
height: 100%;
|
|
6667
|
+
opacity: 0;
|
|
6668
|
+
${({ active }) => active && `opacity: 1`};
|
|
6669
|
+
transition: 0.25s all linear;
|
|
6670
|
+
}
|
|
6671
|
+
&:before {
|
|
6672
|
+
position: absolute;
|
|
6673
|
+
top: 50%;
|
|
6674
|
+
left: 50%;
|
|
6675
|
+
width: 22px;
|
|
6676
|
+
height: 22px;
|
|
6677
|
+
border: 2px solid
|
|
6678
|
+
${({ active }) => active
|
|
6679
|
+
? theme.colors.primaryBase || '#2685F1'
|
|
6680
|
+
: theme.colors.gray600 || '#595959'};
|
|
6681
|
+
border-radius: 50%;
|
|
6682
|
+
content: '';
|
|
6683
|
+
transform: translate(-50%, -50%);
|
|
6684
|
+
transition: 0.25s all linear;
|
|
6685
|
+
}
|
|
6686
|
+
&:after {
|
|
6687
|
+
position: absolute;
|
|
6688
|
+
z-index: -1;
|
|
6689
|
+
top: 50%;
|
|
6690
|
+
left: 50%;
|
|
6691
|
+
width: 10px;
|
|
6692
|
+
height: 10px;
|
|
6693
|
+
background-color: ${theme.colors.primaryBase || '#2685F1'};
|
|
6694
|
+
border-radius: 50%;
|
|
6695
|
+
content: '';
|
|
6696
|
+
opacity: 0;
|
|
6697
|
+
${({ active }) => active && `opacity: 1`};
|
|
6698
|
+
transform: translate(-50%, -50%);
|
|
6699
|
+
transition: 0.25s all linear;
|
|
6700
|
+
}
|
|
6701
|
+
}
|
|
6702
|
+
&:hover {
|
|
6703
|
+
border-color: ${((_b = theme.colors) === null || _b === void 0 ? void 0 : _b.primaryBase) || '#2685F1'};
|
|
6704
|
+
.icon {
|
|
6705
|
+
&:before {
|
|
6706
|
+
border-color: ${((_c = theme.colors) === null || _c === void 0 ? void 0 : _c.primaryBase) || '#2685F1'};
|
|
6707
|
+
transition: 0.2s linear all;
|
|
6708
|
+
}
|
|
6709
|
+
}
|
|
6710
|
+
}
|
|
6711
|
+
${MediaQueries.tdDown} {
|
|
6712
|
+
padding: 16px 20px;
|
|
6713
|
+
}
|
|
6714
|
+
`;
|
|
6715
|
+
const SubotInlineActionImage = styled(SubotInlineActionText) `
|
|
6716
|
+
position: relative;
|
|
6717
|
+
flex-wrap: wrap;
|
|
6718
|
+
padding: 16px;
|
|
6719
|
+
background-color: ${((_d = theme.colors) === null || _d === void 0 ? void 0 : _d.white) || '#fff'};
|
|
6720
|
+
.image-container {
|
|
6721
|
+
position: relative;
|
|
6722
|
+
overflow: hidden;
|
|
6723
|
+
width: 100%;
|
|
6724
|
+
padding-top: 67%;
|
|
6725
|
+
border-radius: 10px;
|
|
6726
|
+
.image {
|
|
6727
|
+
position: absolute;
|
|
6728
|
+
top: 50%;
|
|
6729
|
+
left: 50%;
|
|
6730
|
+
width: 100%;
|
|
6731
|
+
min-width: 100%;
|
|
6732
|
+
height: auto;
|
|
6733
|
+
min-height: 100%;
|
|
6734
|
+
transform: translate(-50%, -50%);
|
|
6735
|
+
}
|
|
6736
|
+
}
|
|
6737
|
+
.label {
|
|
6738
|
+
margin-top: 16px;
|
|
6739
|
+
}
|
|
6740
|
+
.icon {
|
|
6741
|
+
position: absolute;
|
|
6742
|
+
top: 1.75rem;
|
|
6743
|
+
right: 1.75rem;
|
|
6744
|
+
&:before {
|
|
6745
|
+
z-index: -1;
|
|
6746
|
+
background-color: #fff;
|
|
6747
|
+
}
|
|
6748
|
+
}
|
|
6749
|
+
${MediaQueries.tdDown} {
|
|
6750
|
+
padding: 12px;
|
|
6751
|
+
.label {
|
|
6752
|
+
margin-top: 12px;
|
|
6753
|
+
}
|
|
6754
|
+
.icon {
|
|
6755
|
+
top: 1.3rem;
|
|
6756
|
+
right: 1.3rem;
|
|
6757
|
+
}
|
|
6758
|
+
}
|
|
6759
|
+
${MediaQueries.tdDown} {
|
|
6760
|
+
padding: 8px;
|
|
6761
|
+
.label {
|
|
6762
|
+
margin-top: 8px;
|
|
6763
|
+
}
|
|
6764
|
+
.icon {
|
|
6765
|
+
top: 0.9rem;
|
|
6766
|
+
right: 0.9rem;
|
|
6767
|
+
}
|
|
6768
|
+
}
|
|
6769
|
+
`;
|
|
6770
|
+
const SubotInlineActionRatingStartContainer = styled.div `
|
|
6771
|
+
display: flex;
|
|
6772
|
+
align-items: center;
|
|
6773
|
+
justify-content: flex-start;
|
|
6774
|
+
${MediaQueries.tdDown} {
|
|
6775
|
+
justify-content: center;
|
|
6776
|
+
}
|
|
6777
|
+
`;
|
|
6778
|
+
const SubotInlineActionRatingDescriptionContainer = styled.div `
|
|
6779
|
+
textarea {
|
|
6780
|
+
background-color: ${((_e = theme.colors) === null || _e === void 0 ? void 0 : _e.white) || '#fff'};
|
|
6781
|
+
}
|
|
6782
|
+
`;
|
|
6783
|
+
const SubotInlineActionPollResult = styled.div `
|
|
6784
|
+
margin-top: 20px;
|
|
6785
|
+
color: ${((_f = theme.colors) === null || _f === void 0 ? void 0 : _f.gray500) || '#737373'};
|
|
6786
|
+
font-weight: 600;
|
|
6787
|
+
`;
|
|
6788
|
+
const SubotInlineActionPollChoiceResult = styled.div `
|
|
6789
|
+
position: relative;
|
|
6790
|
+
z-index: 0;
|
|
6791
|
+
display: flex;
|
|
6792
|
+
overflow: hidden;
|
|
6793
|
+
align-items: center;
|
|
6794
|
+
padding: 16px 20px;
|
|
6795
|
+
border-radius: ${theme.borderRadius};
|
|
6796
|
+
.number {
|
|
6797
|
+
width: 32px;
|
|
6798
|
+
margin-right: 14px;
|
|
6799
|
+
font-weight: 600;
|
|
6800
|
+
}
|
|
6801
|
+
.content {
|
|
6802
|
+
flex: 1;
|
|
6803
|
+
}
|
|
6804
|
+
.icon {
|
|
6805
|
+
width: 16px;
|
|
6806
|
+
margin-left: 8px;
|
|
6807
|
+
}
|
|
6808
|
+
&:before {
|
|
6809
|
+
position: absolute;
|
|
6810
|
+
z-index: -1;
|
|
6811
|
+
top: 0;
|
|
6812
|
+
right: ${({ percent }) => (percent ? `${100 - percent}%` : '100%')};
|
|
6813
|
+
bottom: 0;
|
|
6814
|
+
left: 0;
|
|
6815
|
+
background-color: ${({ is_chosen }) => is_chosen
|
|
6816
|
+
? theme.colors.primary50 || '#E3F2FF'
|
|
6817
|
+
: theme.colors.neutral100 || '#E4E8EC'};
|
|
6818
|
+
content: '';
|
|
6819
|
+
transition: 0.3s all linear;
|
|
6820
|
+
}
|
|
6821
|
+
&:after {
|
|
6822
|
+
position: absolute;
|
|
6823
|
+
z-index: -2;
|
|
6824
|
+
top: 0;
|
|
6825
|
+
right: 0;
|
|
6826
|
+
bottom: 0;
|
|
6827
|
+
left: 0;
|
|
6828
|
+
background-color: ${((_g = theme.colors) === null || _g === void 0 ? void 0 : _g.white) || '#fff'};
|
|
6829
|
+
content: '';
|
|
6830
|
+
}
|
|
6831
|
+
${MediaQueries.mbDown} {
|
|
6832
|
+
padding: 6px 16px;
|
|
6833
|
+
}
|
|
6834
|
+
`;
|
|
6835
|
+
const SubotInlineActionItemContainer = styled.div `
|
|
6836
|
+
width: ${({ width }) => width || '100%'};
|
|
6837
|
+
padding: 4px;
|
|
6838
|
+
&.item-image-container {
|
|
6839
|
+
padding: 16px;
|
|
6840
|
+
${MediaQueries.tdDown} {
|
|
6841
|
+
padding: 7.5px;
|
|
6842
|
+
}
|
|
6843
|
+
${MediaQueries.mbDown} {
|
|
6844
|
+
width: 50%;
|
|
6845
|
+
}
|
|
6846
|
+
}
|
|
6847
|
+
`;
|
|
6848
|
+
const SubotInlineActionListContainer = styled.div `
|
|
6849
|
+
display: flex;
|
|
6850
|
+
flex-wrap: wrap;
|
|
6851
|
+
align-items: flex-start;
|
|
6852
|
+
justify-content: center;
|
|
6853
|
+
margin: -4px;
|
|
6854
|
+
|
|
6855
|
+
&.list-container {
|
|
6856
|
+
margin: -16px;
|
|
6857
|
+
${MediaQueries.tdDown} {
|
|
6858
|
+
margin: -7.5px;
|
|
6859
|
+
}
|
|
6860
|
+
}
|
|
6861
|
+
|
|
6862
|
+
&.review-container {
|
|
6863
|
+
margin: -8px;
|
|
6864
|
+
${SubotInlineActionItemContainer} {
|
|
6865
|
+
padding: 8px;
|
|
6866
|
+
}
|
|
6867
|
+
}
|
|
6868
|
+
`;
|
|
6869
|
+
|
|
6870
|
+
const SubotInlineAction = ({ actions, value, onChange, htmlType, node_type, formSubmitMeta, }) => {
|
|
6871
|
+
const className = useMemo(() => {
|
|
6872
|
+
switch (node_type) {
|
|
6873
|
+
case NodeType.IMAGE:
|
|
6874
|
+
case NodeType.REACTION:
|
|
6875
|
+
return 'list-container';
|
|
6876
|
+
default:
|
|
6877
|
+
return '';
|
|
6878
|
+
}
|
|
6879
|
+
}, [node_type]);
|
|
6880
|
+
return (React__default.createElement(React__default.Fragment, null, actions && !!(actions === null || actions === void 0 ? void 0 : actions.length) && (React__default.createElement(SubotInlineActionListContainer, { className: className }, actions === null || actions === void 0 ? void 0 : actions.map((action) => {
|
|
6881
|
+
const NodeAction = SubotInlineActionBase[action === null || action === void 0 ? void 0 : action.type];
|
|
6882
|
+
return (NodeAction && (React__default.createElement(NodeAction, { key: action.id, action: action, onChange: onChange, active: value === null || value === void 0 ? void 0 : value.includes(action.id), htmlType: htmlType, formSubmitMeta: formSubmitMeta })));
|
|
6883
|
+
})))));
|
|
6884
|
+
};
|
|
6885
|
+
|
|
6886
|
+
const ButtonStyled = styled(Button$1) `
|
|
6887
|
+
&:disabled {
|
|
6888
|
+
background-color: rgb(242, 242, 242);
|
|
6889
|
+
color: rgb(140, 140, 140);
|
|
6890
|
+
|
|
6891
|
+
&:hover {
|
|
6892
|
+
border: 0;
|
|
6893
|
+
}
|
|
6894
|
+
}
|
|
6895
|
+
svg {
|
|
6896
|
+
path {
|
|
6897
|
+
stroke: currentColor;
|
|
6898
|
+
}
|
|
6899
|
+
}
|
|
6900
|
+
`;
|
|
6901
|
+
const ButtonBackStyled = styled(ButtonStyled) `
|
|
6902
|
+
&:disabled {
|
|
6903
|
+
background-color: rgb(242, 242, 242);
|
|
6904
|
+
color: rgb(140, 140, 140);
|
|
6905
|
+
&:hover {
|
|
6906
|
+
border: 0;
|
|
6907
|
+
}
|
|
6908
|
+
}
|
|
6909
|
+
svg {
|
|
6910
|
+
path {
|
|
6911
|
+
stroke: currentColor;
|
|
6912
|
+
}
|
|
6913
|
+
}
|
|
6914
|
+
`;
|
|
6915
|
+
const SubotInlineFooterStyled = styled.div `
|
|
6916
|
+
display: flex;
|
|
6917
|
+
align-items: center;
|
|
6918
|
+
justify-content: flex-end;
|
|
6919
|
+
padding: 16px 32px;
|
|
6920
|
+
border-top: 4px solid ${theme.colors.neutral100 || '#E4E8EC'};
|
|
6921
|
+
${ButtonStyled} {
|
|
6922
|
+
+ ${ButtonStyled} {
|
|
6923
|
+
margin-left: 8px;
|
|
6924
|
+
}
|
|
6925
|
+
}
|
|
6926
|
+
${MediaQueries.tdDown} {
|
|
6927
|
+
padding: 12px 24px;
|
|
6928
|
+
}
|
|
6929
|
+
${MediaQueries.mbDown} {
|
|
6930
|
+
padding: 12px 16px;
|
|
6931
|
+
}
|
|
6932
|
+
`;
|
|
6933
|
+
|
|
6934
|
+
const SubotInlineActionTextChoice = ({ action, onChange, active, htmlType, formSubmitMeta, }) => {
|
|
6935
|
+
const { trackingCommonInline } = useContext(SubotInlineContext);
|
|
6936
|
+
const inputRef = useRef(null);
|
|
6937
|
+
const [otherText, setOtherText] = useState('');
|
|
6938
|
+
const isActionPollWithOther = (action === null || action === void 0 ? void 0 : action.type) === NodeActionType.POLL_CHOICE_TEXT_BY_INPUT;
|
|
6939
|
+
const isActionSelectWithOther = (action === null || action === void 0 ? void 0 : action.type) === NodeActionType.USER_CHOICE_TEXT_BY_INPUT ||
|
|
6940
|
+
isActionPollWithOther;
|
|
6941
|
+
const onChangeTextArea = (evt) => {
|
|
6942
|
+
setOtherText(evt.target.value);
|
|
6943
|
+
if (isActionSelectWithOther) {
|
|
6944
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(action, [
|
|
6945
|
+
{
|
|
6946
|
+
key: KEY_OF_TEXT_CHOICE_WITH_OTHER_FIELD,
|
|
6947
|
+
control: ELEMENT_CONTROL_INPUT_TYPE[action === null || action === void 0 ? void 0 : action.type] || 'text',
|
|
6948
|
+
value: evt.target.value,
|
|
6949
|
+
action_id: action.id,
|
|
6950
|
+
},
|
|
6951
|
+
]);
|
|
6952
|
+
}
|
|
6953
|
+
};
|
|
6954
|
+
useEffect(() => {
|
|
6955
|
+
var _a, _b;
|
|
6956
|
+
if (active) {
|
|
6957
|
+
setOtherText(((_a = formSubmitMeta === null || formSubmitMeta === void 0 ? void 0 : formSubmitMeta.find((f) => f.key === KEY_OF_TEXT_CHOICE_WITH_OTHER_FIELD)) === null || _a === void 0 ? void 0 : _a.value) || '');
|
|
6958
|
+
(_b = inputRef.current) === null || _b === void 0 ? void 0 : _b.focus();
|
|
6959
|
+
}
|
|
6960
|
+
}, [active, formSubmitMeta]);
|
|
6961
|
+
return (React__default.createElement(SubotInlineActionItemContainer, null,
|
|
6962
|
+
React__default.createElement(SubotInlineActionText, Object.assign({ active: !!active, onClick: () => onChange === null || onChange === void 0 ? void 0 : onChange(action), className: "pointer-event-child-none" }, trackingCommonInline, { "data-response-id": action === null || action === void 0 ? void 0 : action.id, "data-event-action": "Answer Click" }),
|
|
6963
|
+
React__default.createElement("div", { className: "label" },
|
|
6964
|
+
React__default.createElement(Markdown, null, action === null || action === void 0 ? void 0 : action.label)),
|
|
6965
|
+
React__default.createElement("div", { className: "icon" }, htmlType === 'checkbox' && (React__default.createElement(CheckboxIcon, { className: "icon-checkbox", viewBox: "0 0 22 22" })))),
|
|
6966
|
+
isActionSelectWithOther && active && (React__default.createElement(Box, { mt: "6px", style: { textAlign: 'right' } },
|
|
6967
|
+
React__default.createElement(Textarea, { ref: inputRef, placeholder: action === null || action === void 0 ? void 0 : action.label, styles: {
|
|
6968
|
+
input: {
|
|
6969
|
+
paddingLeft: '24px',
|
|
6970
|
+
paddingRight: '24px',
|
|
6971
|
+
boxShadow: 'none',
|
|
6972
|
+
':focus': { boxShadow: 'none' },
|
|
6973
|
+
},
|
|
6974
|
+
}, value: otherText, onChange: onChangeTextArea, maxLength: 360 })))));
|
|
6975
|
+
};
|
|
6976
|
+
const SubotInlineActionImageChoice = ({ action, onChange, active, htmlType, }) => {
|
|
6977
|
+
const { trackingCommonInline } = useContext(SubotInlineContext);
|
|
6978
|
+
return (React__default.createElement(SubotInlineActionItemContainer, { width: "45%", className: 'item-image-container' },
|
|
6979
|
+
React__default.createElement(SubotInlineActionImage, Object.assign({ onClick: () => onChange && onChange(action), active: !!active }, trackingCommonInline, { "data-response-id": action === null || action === void 0 ? void 0 : action.id, "data-event-action": "Answer Click" }),
|
|
6980
|
+
React__default.createElement("div", { className: "image-container" },
|
|
6981
|
+
React__default.createElement("img", { loading: "lazy", src: action === null || action === void 0 ? void 0 : action.url, alt: action === null || action === void 0 ? void 0 : action.label, className: "image" })),
|
|
6982
|
+
(action === null || action === void 0 ? void 0 : action.label) && (React__default.createElement("div", { className: "label" },
|
|
6983
|
+
React__default.createElement(Markdown, null, action === null || action === void 0 ? void 0 : action.label))),
|
|
6984
|
+
React__default.createElement("div", { className: "icon" }, htmlType === 'checkbox' && (React__default.createElement(CheckboxIcon, { className: "icon-checkbox", viewBox: "0 0 22 22" }))))));
|
|
6985
|
+
};
|
|
6986
|
+
const SubotInlineActionSSO = ({ action, onChange, }) => {
|
|
6987
|
+
const { trackingCommonInline } = useContext(SubotInlineContext);
|
|
6988
|
+
return (React__default.createElement(SubotInlineActionItemContainer, { width: "50%", style: { alignSelf: 'center' } },
|
|
6989
|
+
React__default.createElement(ButtonStyled, Object.assign({ onClick: () => onChange && onChange(action), size: "lg", isBlock: true }, trackingCommonInline, { className: "pointer-event-child-none", "data-event-action": "Login Click", "data-response-id": action === null || action === void 0 ? void 0 : action.id }),
|
|
6990
|
+
React__default.createElement(Markdown, null, action === null || action === void 0 ? void 0 : action.label))));
|
|
6991
|
+
};
|
|
6992
|
+
const SubotInlinePollChoice = ({ active, action, onChange, htmlType, node_type, }) => {
|
|
6993
|
+
const handleOnChange = (action) => {
|
|
6994
|
+
if (action)
|
|
6995
|
+
onChange &&
|
|
6996
|
+
onChange({
|
|
6997
|
+
key: (action === null || action === void 0 ? void 0 : action.key) || '',
|
|
6998
|
+
control: ELEMENT_CONTROL_INPUT_TYPE[action === null || action === void 0 ? void 0 : action.type],
|
|
6999
|
+
value: '',
|
|
7000
|
+
action_id: action === null || action === void 0 ? void 0 : action.id,
|
|
7001
|
+
});
|
|
7002
|
+
};
|
|
7003
|
+
if (node_type === NodeType.RESULT_POLL)
|
|
7004
|
+
return (React__default.createElement(SubotInlineActionItemContainer, null,
|
|
7005
|
+
React__default.createElement(SubotInlineActionPollChoiceResult, { percent: (action === null || action === void 0 ? void 0 : action.percent) || 0, is_chosen: action === null || action === void 0 ? void 0 : action.is_chosen },
|
|
7006
|
+
React__default.createElement("div", { className: "number" }, action === null || action === void 0 ? void 0 :
|
|
7007
|
+
action.percent,
|
|
7008
|
+
"%"),
|
|
7009
|
+
React__default.createElement("div", { className: "content" }, action === null || action === void 0 ? void 0 : action.label),
|
|
7010
|
+
React__default.createElement("div", { className: "icon" }, (action === null || action === void 0 ? void 0 : action.is_chosen) && React__default.createElement(CheckIcon, { viewBox: "0 0 16 16" })))));
|
|
7011
|
+
return (React__default.createElement(SubotInlineActionTextChoice, { active: !!active, action: action, onChange: handleOnChange, htmlType: htmlType }));
|
|
7012
|
+
};
|
|
7013
|
+
const SubotInlinePollChoiceImage = ({ active, action, onChange, htmlType, node_type, }) => {
|
|
7014
|
+
const handleOnChange = (action) => {
|
|
7015
|
+
if (action)
|
|
7016
|
+
onChange &&
|
|
7017
|
+
onChange({
|
|
7018
|
+
key: action === null || action === void 0 ? void 0 : action.key,
|
|
7019
|
+
control: ELEMENT_CONTROL_INPUT_TYPE[action === null || action === void 0 ? void 0 : action.type],
|
|
7020
|
+
value: '',
|
|
7021
|
+
action_id: action === null || action === void 0 ? void 0 : action.id,
|
|
7022
|
+
});
|
|
7023
|
+
};
|
|
7024
|
+
if (node_type === NodeType.RESULT_POLL)
|
|
7025
|
+
// TODO: Update layout result poll image
|
|
7026
|
+
return (React__default.createElement(SubotInlineActionItemContainer, null,
|
|
7027
|
+
React__default.createElement(SubotInlineActionPollChoiceResult, { percent: (action === null || action === void 0 ? void 0 : action.percent) || 0, is_chosen: action === null || action === void 0 ? void 0 : action.is_chosen },
|
|
7028
|
+
React__default.createElement("div", { className: "number" }, action === null || action === void 0 ? void 0 :
|
|
7029
|
+
action.percent,
|
|
7030
|
+
"%"),
|
|
7031
|
+
React__default.createElement("div", { className: "content" }, action === null || action === void 0 ? void 0 : action.label),
|
|
7032
|
+
React__default.createElement("div", { className: "icon" }, (action === null || action === void 0 ? void 0 : action.is_chosen) && React__default.createElement(CheckIcon, { viewBox: "0 0 16 16" })))));
|
|
7033
|
+
return (React__default.createElement(SubotInlineActionImageChoice, { active: !!active, action: action, onChange: handleOnChange, htmlType: htmlType }));
|
|
7034
|
+
};
|
|
7035
|
+
const SubotInlineRatingStar = ({ action, value, onChange, }) => {
|
|
7036
|
+
var _a, _b;
|
|
7037
|
+
return (React__default.createElement(SubotInlineActionItemContainer, null,
|
|
7038
|
+
React__default.createElement(SubotInlineActionRatingStartContainer, null,
|
|
7039
|
+
React__default.createElement(StarRatings, { rating: value && typeof value !== 'string' && (value === null || value === void 0 ? void 0 : value.value)
|
|
7040
|
+
? parseInt(value === null || value === void 0 ? void 0 : value.value)
|
|
7041
|
+
: 0, changeRating: (star) => {
|
|
7042
|
+
const _value = {
|
|
7043
|
+
key: action === null || action === void 0 ? void 0 : action.key,
|
|
7044
|
+
control: ELEMENT_CONTROL_INPUT_TYPE[action === null || action === void 0 ? void 0 : action.type],
|
|
7045
|
+
value: star.toString(),
|
|
7046
|
+
action_id: action === null || action === void 0 ? void 0 : action.id,
|
|
7047
|
+
};
|
|
7048
|
+
onChange && onChange(_value);
|
|
7049
|
+
}, starHoverColor: (_a = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _a === void 0 ? void 0 : _a.yellow600, starRatedColor: (_b = theme === null || theme === void 0 ? void 0 : theme.colors) === null || _b === void 0 ? void 0 : _b.yellow600, starDimension: "48" }))));
|
|
7050
|
+
};
|
|
7051
|
+
const SubotInlineTextArea = ({ action, value, onChange, }) => {
|
|
7052
|
+
return (React__default.createElement(SubotInlineActionItemContainer, null,
|
|
7053
|
+
React__default.createElement(SubotInlineActionRatingDescriptionContainer, null,
|
|
7054
|
+
React__default.createElement(TextArea, { placeholder: action === null || action === void 0 ? void 0 : action.label, value: value && typeof value !== 'string' && (value === null || value === void 0 ? void 0 : value.value)
|
|
7055
|
+
? value === null || value === void 0 ? void 0 : value.value
|
|
7056
|
+
: '', onChange: (evt) => {
|
|
7057
|
+
const _value = {
|
|
7058
|
+
key: action === null || action === void 0 ? void 0 : action.key,
|
|
7059
|
+
control: ELEMENT_CONTROL_INPUT_TYPE[action === null || action === void 0 ? void 0 : action.type],
|
|
7060
|
+
value: evt.target.value,
|
|
7061
|
+
action_id: action === null || action === void 0 ? void 0 : action.id,
|
|
7062
|
+
};
|
|
7063
|
+
onChange && onChange(_value);
|
|
7064
|
+
} }))));
|
|
7065
|
+
};
|
|
7066
|
+
const SubotInlineLikeChoice = ({ action, active, onChange, }) => {
|
|
7067
|
+
return (React__default.createElement(SubotInlineActionItemContainer, { width: "40%", className: 'item-image-container' },
|
|
7068
|
+
React__default.createElement(SubotInlineButtonReaction, { className: classNames(!!active && 'active'), onClick: () => onChange && onChange(action) },
|
|
7069
|
+
React__default.createElement(LikeIcon, { viewBox: "0 0 24 24" }),
|
|
7070
|
+
React__default.createElement(Markdown, null, action === null || action === void 0 ? void 0 : action.label))));
|
|
7071
|
+
};
|
|
7072
|
+
const SubotInlineDislikeChoice = ({ action, active, onChange, }) => {
|
|
7073
|
+
return (React__default.createElement(SubotInlineActionItemContainer, { width: "40%", className: 'item-image-container' },
|
|
7074
|
+
React__default.createElement(SubotInlineButtonReaction, { className: classNames(!!active && 'active'), onClick: () => onChange && onChange(action) },
|
|
7075
|
+
React__default.createElement(DislikeIcon, { viewBox: "0 0 24 24" }),
|
|
7076
|
+
React__default.createElement(Markdown, null, action === null || action === void 0 ? void 0 : action.label))));
|
|
7077
|
+
};
|
|
7078
|
+
const SubotInlineReviewChoice = ({ active, action, onChange, }) => (React__default.createElement(SubotInlineActionItemContainer, { width: "auto", className: "review-choice" },
|
|
7079
|
+
React__default.createElement(SubotInlineButtonReview, { className: classNames(!!active && 'active'), onClick: () => onChange &&
|
|
7080
|
+
onChange({
|
|
7081
|
+
key: action === null || action === void 0 ? void 0 : action.key,
|
|
7082
|
+
control: ELEMENT_CONTROL_INPUT_TYPE[action === null || action === void 0 ? void 0 : action.type],
|
|
7083
|
+
value: '',
|
|
7084
|
+
action_id: action === null || action === void 0 ? void 0 : action.id,
|
|
7085
|
+
}) },
|
|
7086
|
+
React__default.createElement(Markdown, null, action === null || action === void 0 ? void 0 : action.label))));
|
|
7087
|
+
const SubotInlinePollResult = ({ action, }) => (React__default.createElement(SubotInlineActionItemContainer, null,
|
|
7088
|
+
React__default.createElement(SubotInlineActionPollResult, null, action === null || action === void 0 ? void 0 : action.label)));
|
|
7089
|
+
const SubotInlineActionBase = {
|
|
7090
|
+
'user-image': SubotInlineActionImageChoice,
|
|
7091
|
+
[NodeActionType.USER_CHOICE_TEXT]: SubotInlineActionTextChoice,
|
|
7092
|
+
[NodeActionType.USER_CHOICE_TEXT_BY_INPUT]: SubotInlineActionTextChoice,
|
|
7093
|
+
[NodeActionType.USER_CHOICE_IMAGE]: SubotInlineActionImageChoice,
|
|
7094
|
+
[NodeActionType.ACTION_SSO_REDIRECT]: SubotInlineActionSSO,
|
|
7095
|
+
[NodeActionType.POLL_CHOICE]: SubotInlinePollChoice,
|
|
7096
|
+
[NodeActionType.POLL_CHOICE_TEXT_BY_INPUT]: SubotInlineActionTextChoice,
|
|
7097
|
+
[NodeActionType.POLL_CHOICE_IMAGE]: SubotInlinePollChoiceImage,
|
|
7098
|
+
[NodeActionType.RATING_STAR]: SubotInlineRatingStar,
|
|
7099
|
+
[NodeActionType.RATING_DESCRIPTION]: SubotInlineTextArea,
|
|
7100
|
+
[NodeActionType.LIKE_CHOICE]: SubotInlineLikeChoice,
|
|
7101
|
+
[NodeActionType.DISLIKE_CHOICE]: SubotInlineDislikeChoice,
|
|
7102
|
+
[NodeActionType.REVIEW_CHOICE]: SubotInlineReviewChoice,
|
|
7103
|
+
[NodeActionType.REVIEW_DESCRIPTION]: SubotInlineTextArea,
|
|
7104
|
+
[NodeActionType.RESULT_BUTTON]: SubotInlineActionTextChoice,
|
|
7105
|
+
[NodeActionType.POLL_RESULT]: SubotInlinePollResult,
|
|
7106
|
+
};
|
|
7107
|
+
|
|
7108
|
+
const SubotInlineFooter = ({ onBack, onNext: onSubmit, hideBack, hideNext, nextText, backProps, nextProps, }) => {
|
|
7109
|
+
var _a, _b, _c;
|
|
7110
|
+
const { formatMessage: f } = useContext(TogetherComponentGlobalContext);
|
|
7111
|
+
const { nodes: listNodes, activeId, params, onNext, trackingCommonInline, } = useContext(SubotInlineContext);
|
|
7112
|
+
const nodeMessage = listNodes.find((nodeItem) => nodeItem.id == activeId);
|
|
7113
|
+
const actionNextChoice = (_a = nodeMessage === null || nodeMessage === void 0 ? void 0 : nodeMessage.actions) === null || _a === void 0 ? void 0 : _a.find((act) => act.type === NodeActionType.USER_CHOICE_NEXT);
|
|
7114
|
+
const handleNextChoice = () => {
|
|
7115
|
+
if (nodeMessage && actionNextChoice) {
|
|
7116
|
+
const nextValue = {
|
|
7117
|
+
node_id: nodeMessage.id,
|
|
7118
|
+
action_id: actionNextChoice === null || actionNextChoice === void 0 ? void 0 : actionNextChoice.id,
|
|
7119
|
+
action_value: actionNextChoice === null || actionNextChoice === void 0 ? void 0 : actionNextChoice.key,
|
|
7120
|
+
};
|
|
7121
|
+
onNext === null || onNext === void 0 ? void 0 : onNext(Object.assign(Object.assign(Object.assign({}, params), nextValue), nodeMessage._message));
|
|
7122
|
+
}
|
|
7123
|
+
};
|
|
7124
|
+
const actionSubmitMultiple = (_b = nodeMessage === null || nodeMessage === void 0 ? void 0 : nodeMessage.actions) === null || _b === void 0 ? void 0 : _b.find((act) => act.type === NodeActionType.ACTION_MULTIPLE_BUTTON);
|
|
7125
|
+
return (React__default.createElement(SubotInlineFooterStyled, null,
|
|
7126
|
+
!hideBack && (React__default.createElement(ButtonBackStyled, Object.assign({ size: "md", color: "secondary", onClick: onBack }, backProps, { className: classNames('pointer-event-child-none', backProps === null || backProps === void 0 ? void 0 : backProps.className) }, trackingCommonInline, { "data-event-action": "Back Click" }),
|
|
7127
|
+
React__default.createElement(LeftArrowIcon, { style: { marginRight: 10 } }),
|
|
7128
|
+
f({
|
|
7129
|
+
id: 'riskScreener.back',
|
|
7130
|
+
defaultMessage: 'Back',
|
|
7131
|
+
}))),
|
|
7132
|
+
!hideNext && (React__default.createElement(ButtonStyled, Object.assign({ size: "md", color: "primary", onClick: actionNextChoice ? handleNextChoice : onSubmit }, nextProps, { className: classNames('pointer-event-child-none', nextProps === null || nextProps === void 0 ? void 0 : nextProps.className) }, trackingCommonInline, { "data-event-action": "Answer Click", "data-response-id": (actionSubmitMultiple === null || actionSubmitMultiple === void 0 ? void 0 : actionSubmitMultiple.id) ||
|
|
7133
|
+
(actionNextChoice === null || actionNextChoice === void 0 ? void 0 : actionNextChoice.id) ||
|
|
7134
|
+
((_c = nodeMessage === null || nodeMessage === void 0 ? void 0 : nodeMessage._message) === null || _c === void 0 ? void 0 : _c.action_id) }),
|
|
7135
|
+
!nextText
|
|
7136
|
+
? f({
|
|
7137
|
+
id: 'riskScreener.next',
|
|
7138
|
+
defaultMessage: 'Next',
|
|
7139
|
+
})
|
|
7140
|
+
: nextText,
|
|
7141
|
+
React__default.createElement(RightArrowIcon, { style: { marginLeft: 10 } })))));
|
|
7142
|
+
};
|
|
7143
|
+
var SubotInlineFooter$1 = memo(SubotInlineFooter);
|
|
7144
|
+
|
|
7145
|
+
const SubotInlineHeadline = styled.h4 `
|
|
7146
|
+
padding: 32px 0px 12px;
|
|
7147
|
+
border-bottom: 1px solid ${theme.colors.neutral100 || '#E4E8EC'};
|
|
7148
|
+
margin: 0px 32px;
|
|
7149
|
+
color: ${theme.colors.gray500 || '#737373'};
|
|
7150
|
+
font-size: 14px;
|
|
7151
|
+
font-weight: 700;
|
|
7152
|
+
line-height: 1.5;
|
|
7153
|
+
${MediaQueries.tdDown} {
|
|
7154
|
+
padding: 24px 0px 12px;
|
|
7155
|
+
margin: 0px 24px;
|
|
7156
|
+
}
|
|
7157
|
+
${MediaQueries.mbDown} {
|
|
7158
|
+
padding: 16px 0px 12px;
|
|
7159
|
+
margin: 0px 16px;
|
|
7160
|
+
}
|
|
7161
|
+
`;
|
|
7162
|
+
const SubotInlineHeader = () => {
|
|
7163
|
+
const { formatMessage: f } = useContext(TogetherComponentGlobalContext);
|
|
7164
|
+
const { nodes } = useContext(SubotInlineContext);
|
|
7165
|
+
const headline = useMemo(() => { var _a; return (_a = nodes[0]) === null || _a === void 0 ? void 0 : _a.inline_headline; }, [nodes]);
|
|
7166
|
+
return (React__default.createElement(SubotInlineHeadline, null, headline ||
|
|
7167
|
+
f({
|
|
7168
|
+
id: 'subotInline.quote',
|
|
7169
|
+
defaultMessage: 'HAVE TIME FOR A QUICK QUESTION?',
|
|
7170
|
+
})));
|
|
7171
|
+
};
|
|
7172
|
+
var SubotInlineHeader$1 = memo(SubotInlineHeader);
|
|
7173
|
+
|
|
7174
|
+
const SubotInlineIntentTitle = styled.h3 `
|
|
7175
|
+
margin-bottom: 0px;
|
|
7176
|
+
font-size: 22px;
|
|
7177
|
+
font-weight: bold;
|
|
7178
|
+
line-height: 1.45;
|
|
7179
|
+
${MediaQueries.tdDown} {
|
|
7180
|
+
font-size: 20px;
|
|
7181
|
+
}
|
|
7182
|
+
`;
|
|
7183
|
+
const SubotInlineRecalculateButton = styled(Button$1) `
|
|
7184
|
+
&.bot-recalculate {
|
|
7185
|
+
svg {
|
|
7186
|
+
path {
|
|
7187
|
+
stroke: ${theme.colors.primaryBase || '#2685F1'} !important;
|
|
7188
|
+
}
|
|
7189
|
+
}
|
|
7190
|
+
&:hover {
|
|
7191
|
+
svg {
|
|
7192
|
+
path {
|
|
7193
|
+
stroke: #fff !important;
|
|
7194
|
+
}
|
|
7195
|
+
}
|
|
7196
|
+
}
|
|
7197
|
+
}
|
|
7198
|
+
`;
|
|
7199
|
+
const SubotInlineIntentButton = styled(Button$1) `
|
|
7200
|
+
border: 2px solid transparent;
|
|
7201
|
+
`;
|
|
7202
|
+
const SubotInlineItemIcon = styled.div `
|
|
7203
|
+
display: flex;
|
|
7204
|
+
padding-top: 10px;
|
|
7205
|
+
padding-bottom: 10px;
|
|
7206
|
+
.icon {
|
|
7207
|
+
width: 64px;
|
|
7208
|
+
height: 64px;
|
|
7209
|
+
margin-right: 16px;
|
|
7210
|
+
object-fit: contain;
|
|
7211
|
+
object-position: center;
|
|
7212
|
+
}
|
|
7213
|
+
.content {
|
|
7214
|
+
flex: 1;
|
|
7215
|
+
.title {
|
|
7216
|
+
margin-top: 0;
|
|
7217
|
+
margin-bottom: 0;
|
|
7218
|
+
font-size: inherit;
|
|
7219
|
+
font-weight: 700;
|
|
7220
|
+
line-height: 1.4;
|
|
7221
|
+
}
|
|
7222
|
+
.description {
|
|
7223
|
+
color: ${theme.colors.gray700 || '#404040'};
|
|
7224
|
+
line-height: 1.4;
|
|
7225
|
+
}
|
|
7226
|
+
}
|
|
7227
|
+
${MediaQueries.mbDown} {
|
|
7228
|
+
.icon {
|
|
7229
|
+
width: 47px;
|
|
7230
|
+
height: 47px;
|
|
7231
|
+
margin-right: 16px;
|
|
7232
|
+
}
|
|
7233
|
+
.content {
|
|
7234
|
+
.title {
|
|
7235
|
+
font-size: 14px;
|
|
7236
|
+
}
|
|
7237
|
+
.description {
|
|
7238
|
+
font-size: 14px;
|
|
7239
|
+
}
|
|
7240
|
+
}
|
|
7241
|
+
}
|
|
7242
|
+
`;
|
|
7243
|
+
styled(Button$1) ``;
|
|
7244
|
+
const SubotInlineIntentFirstTextWrapper = styled.div `
|
|
7245
|
+
display: flex;
|
|
7246
|
+
align-items: flex-start;
|
|
7247
|
+
color: ${theme.colors.gray800 || '#262626'};
|
|
7248
|
+
font-size: 22px;
|
|
7249
|
+
font-weight: 700;
|
|
7250
|
+
letter-space: -0.6px;
|
|
7251
|
+
line-height: 1.45;
|
|
7252
|
+
.number {
|
|
7253
|
+
margin-right: 3px;
|
|
7254
|
+
}
|
|
7255
|
+
.title {
|
|
7256
|
+
flex: 1;
|
|
7257
|
+
}
|
|
7258
|
+
${MediaQueries.tdDown} {
|
|
7259
|
+
font-size: 20px;
|
|
7260
|
+
}
|
|
7261
|
+
${MediaQueries.mbDown} {
|
|
7262
|
+
font-size: 18px;
|
|
7263
|
+
}
|
|
7264
|
+
`;
|
|
7265
|
+
const SubotInlineIntentFirstImageWrapper = styled.div `
|
|
7266
|
+
display: flex;
|
|
7267
|
+
justify-content: center;
|
|
7268
|
+
`;
|
|
7269
|
+
const SubotInlineIntentFirstTextContainer = styled.div ``;
|
|
7270
|
+
const SubotInlineIntentTextContainer = styled.div `
|
|
7271
|
+
padding: 12px 16px;
|
|
7272
|
+
border: 1px solid ${theme.colors.gray200 || '#D9D9D9'};
|
|
7273
|
+
background-color: ${theme.colors.white || '#fff'};
|
|
7274
|
+
border-radius: ${theme.borderRadius};
|
|
7275
|
+
line-height: 1.5;
|
|
7276
|
+
`;
|
|
7277
|
+
const SubotInlineIntentImageContainer = styled.div `
|
|
7278
|
+
border: ${theme.colors.gray200 || '#D9D9D9'};
|
|
7279
|
+
background-color: ${theme.colors.white || '#FFF'};
|
|
7280
|
+
border-radius: ${theme.borderRadius};
|
|
7281
|
+
.intent-img {
|
|
7282
|
+
border-radius: ${theme.borderRadius};
|
|
7283
|
+
&.has-label {
|
|
7284
|
+
border-bottom-left-radius: 0px;
|
|
7285
|
+
border-bottom-right-radius: 0px;
|
|
7286
|
+
}
|
|
7287
|
+
}
|
|
7288
|
+
.intent-img-label {
|
|
7289
|
+
padding: 5px 10px;
|
|
7290
|
+
font-size: 0.8em;
|
|
7291
|
+
font-style: italic;
|
|
7292
|
+
font-weight: 400;
|
|
7293
|
+
}
|
|
7294
|
+
`;
|
|
7295
|
+
const SubotInlineIntentUrlContainer = styled.div `
|
|
7296
|
+
display: flex;
|
|
7297
|
+
.feature {
|
|
7298
|
+
width: 30%;
|
|
7299
|
+
.feature-wrapper {
|
|
7300
|
+
position: relative;
|
|
7301
|
+
display: block;
|
|
7302
|
+
overflow: hidden;
|
|
7303
|
+
width: 100%;
|
|
7304
|
+
padding-top: 66%;
|
|
7305
|
+
border-radius: ${theme.borderRadius};
|
|
7306
|
+
.feature-img {
|
|
7307
|
+
position: absolute;
|
|
7308
|
+
top: 50%;
|
|
7309
|
+
left: 50%;
|
|
7310
|
+
width: 100%;
|
|
7311
|
+
min-width: 100%;
|
|
7312
|
+
height: auto;
|
|
7313
|
+
min-height: 100%;
|
|
7314
|
+
transform: translate(-50%, -50%);
|
|
7315
|
+
}
|
|
7316
|
+
}
|
|
7317
|
+
}
|
|
7318
|
+
.body {
|
|
7319
|
+
flex: 1;
|
|
7320
|
+
margin-left: 10px;
|
|
7321
|
+
line-height: 1.5;
|
|
7322
|
+
a {
|
|
7323
|
+
color: ${theme.colors.gray800 || '#262626'};
|
|
7324
|
+
text-decoration: none;
|
|
7325
|
+
}
|
|
7326
|
+
}
|
|
7327
|
+
`;
|
|
7328
|
+
const SubotInlineIntentRiskScreenerContainer = styled.div `
|
|
7329
|
+
display: flex;
|
|
7330
|
+
align-items: center;
|
|
7331
|
+
justify-content: space-between;
|
|
7332
|
+
padding: 20px 40px 20px 16px;
|
|
7333
|
+
background-color: #fff;
|
|
7334
|
+
border-radius: ${theme.borderRadius};
|
|
7335
|
+
box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.04), 0px 0px 2px rgba(0, 0, 0, 0.06),
|
|
7336
|
+
0px 0px 1px rgba(0, 0, 0, 0.04);
|
|
7337
|
+
.feature {
|
|
7338
|
+
display: block;
|
|
7339
|
+
overflow: hidden;
|
|
7340
|
+
width: 72px;
|
|
7341
|
+
height: 72px;
|
|
7342
|
+
margin-right: 16px;
|
|
7343
|
+
border-radius: ${theme.borderRadius};
|
|
7344
|
+
img {
|
|
7345
|
+
width: 100%;
|
|
7346
|
+
height: 100%;
|
|
7347
|
+
object-fit: cover;
|
|
7348
|
+
object-position: center;
|
|
7349
|
+
}
|
|
7350
|
+
}
|
|
7351
|
+
.title-container {
|
|
7352
|
+
display: flex;
|
|
7353
|
+
flex: 1;
|
|
7354
|
+
align-items: center;
|
|
7355
|
+
justify-content: space-between;
|
|
7356
|
+
a {
|
|
7357
|
+
font-size: 16px;
|
|
7358
|
+
line-height: 1.5em;
|
|
7359
|
+
text-decoration: none;
|
|
7360
|
+
.title {
|
|
7361
|
+
padding: 0;
|
|
7362
|
+
color: #262626;
|
|
7363
|
+
font-size: inherit;
|
|
7364
|
+
line-height: inherit;
|
|
7365
|
+
}
|
|
7366
|
+
&.link {
|
|
7367
|
+
display: flex;
|
|
7368
|
+
align-items: center;
|
|
7369
|
+
justify-content: center;
|
|
7370
|
+
margin-left: 20px;
|
|
7371
|
+
color: #2d87f3;
|
|
7372
|
+
font-weight: 700;
|
|
7373
|
+
}
|
|
7374
|
+
}
|
|
7375
|
+
}
|
|
7376
|
+
@media screen and (max-width: 769px) {
|
|
7377
|
+
padding: 16px 12px;
|
|
7378
|
+
.feature {
|
|
7379
|
+
width: 50px;
|
|
7380
|
+
height: 50px;
|
|
7381
|
+
}
|
|
7382
|
+
.title-container {
|
|
7383
|
+
a {
|
|
7384
|
+
font-size: 13px;
|
|
7385
|
+
line-height: 20px;
|
|
7386
|
+
&.link {
|
|
7387
|
+
margin-left: 10px;
|
|
7388
|
+
}
|
|
7389
|
+
}
|
|
7390
|
+
}
|
|
7391
|
+
}
|
|
7392
|
+
`;
|
|
7393
|
+
const SubotInlineIntentFinalButtonContainer = styled.div `
|
|
7394
|
+
display: flex;
|
|
7395
|
+
align-items: center;
|
|
7396
|
+
justify-content: center;
|
|
7397
|
+
`;
|
|
7398
|
+
styled.div `
|
|
7399
|
+
padding: 16px;
|
|
7400
|
+
margin-top: 32px;
|
|
7401
|
+
margin-bottom: 32px;
|
|
7402
|
+
background-color: ${theme.colors.primary50 || ''};
|
|
7403
|
+
border-radius: ${theme.borderRadius};
|
|
7404
|
+
.item-grid {
|
|
7405
|
+
> div {
|
|
7406
|
+
box-shadow: none;
|
|
7407
|
+
}
|
|
7408
|
+
}
|
|
7409
|
+
.lp--affiliate-product {
|
|
7410
|
+
.arrow-left {
|
|
7411
|
+
left: -20px;
|
|
7412
|
+
}
|
|
7413
|
+
.arrow-right {
|
|
7414
|
+
right: -16px;
|
|
7415
|
+
}
|
|
7416
|
+
}
|
|
7417
|
+
.bullet-nav {
|
|
7418
|
+
bottom: -10px;
|
|
7419
|
+
}
|
|
7420
|
+
`;
|
|
7421
|
+
const SubotInlineIntentFinalCol = styled.div `
|
|
7422
|
+
width: ${({ width }) => width || '100%'};
|
|
7423
|
+
padding: 8px;
|
|
7424
|
+
${MediaQueries.mbDown} {
|
|
7425
|
+
width: 100%;
|
|
7426
|
+
}
|
|
7427
|
+
`;
|
|
7428
|
+
const SubotInlineIntentFinalRow = styled.div `
|
|
7429
|
+
display: flex;
|
|
7430
|
+
flex-wrap: wrap;
|
|
7431
|
+
align-items: flex-start;
|
|
7432
|
+
justify-content: center;
|
|
7433
|
+
margin: 0 -8px;
|
|
7434
|
+
`;
|
|
7435
|
+
const SubotInlineIntentCol = styled.div `
|
|
7436
|
+
width: ${({ width }) => width || '100%'};
|
|
7437
|
+
padding: 4px;
|
|
7438
|
+
${MediaQueries.mbDown} {
|
|
7439
|
+
width: 100%;
|
|
7440
|
+
}
|
|
7441
|
+
`;
|
|
7442
|
+
const SubotInlineIntentRow = styled.div `
|
|
7443
|
+
display: flex;
|
|
7444
|
+
flex-wrap: wrap;
|
|
7445
|
+
align-items: flex-start;
|
|
7446
|
+
justify-content: center;
|
|
7447
|
+
margin: 0 -4px;
|
|
7448
|
+
`;
|
|
7449
|
+
const SubotInlineIntentList = styled.div `
|
|
7450
|
+
margin-top: 20px;
|
|
7451
|
+
`;
|
|
7452
|
+
|
|
7453
|
+
const SubotInlineIntent = ({ intents, indexNumber, }) => {
|
|
7454
|
+
var _a, _b;
|
|
7455
|
+
const title = useMemo(() => {
|
|
7456
|
+
const _title = intents && intents[0];
|
|
7457
|
+
if (_title)
|
|
7458
|
+
return _title;
|
|
7459
|
+
return null;
|
|
7460
|
+
}, []);
|
|
7461
|
+
if (!intents.length)
|
|
7462
|
+
return React__default.createElement(SubotInlineIntentBotTitle, { indexNumber: indexNumber });
|
|
7463
|
+
return (React__default.createElement(React__default.Fragment, null,
|
|
7464
|
+
title && (React__default.createElement(SubotInlineIntentBotTitle, { intent: title, indexNumber: indexNumber })),
|
|
7465
|
+
!!((_a = intents.slice(1)) === null || _a === void 0 ? void 0 : _a.length) && (React__default.createElement(SubotInlineIntentList, null,
|
|
7466
|
+
React__default.createElement(SubotInlineIntentRow, null, (_b = intents.slice(1)) === null || _b === void 0 ? void 0 : _b.map((intent) => {
|
|
7467
|
+
const NodeIntent = SubotInlineIntentBase[intent === null || intent === void 0 ? void 0 : intent.type];
|
|
7468
|
+
return (NodeIntent && React__default.createElement(NodeIntent, { key: intent.id, intent: intent }));
|
|
7469
|
+
}))))));
|
|
7470
|
+
};
|
|
7471
|
+
|
|
7472
|
+
const SubotInlineIntentFinal = ({ intents: intentsProps, }) => {
|
|
7473
|
+
const intents = useMemo(() => {
|
|
7474
|
+
const mainIntents = [];
|
|
7475
|
+
const subIntents = [];
|
|
7476
|
+
const rest = [];
|
|
7477
|
+
intentsProps === null || intentsProps === void 0 ? void 0 : intentsProps.map((intent) => {
|
|
7478
|
+
switch (intent === null || intent === void 0 ? void 0 : intent.type) {
|
|
7479
|
+
case NodeIntentType.BOT_MAIN_IMAGE:
|
|
7480
|
+
mainIntents.push(intent);
|
|
7481
|
+
break;
|
|
7482
|
+
case NodeIntentType.BOT_MAIN_TITLE:
|
|
7483
|
+
mainIntents.push(intent);
|
|
7484
|
+
break;
|
|
7485
|
+
case NodeIntentType.BOT_MAIN_BODY:
|
|
7486
|
+
mainIntents.push(intent);
|
|
7487
|
+
break;
|
|
7488
|
+
case NodeIntentType.BOT_MAIN_BUTTON:
|
|
7489
|
+
mainIntents.push(intent);
|
|
7490
|
+
break;
|
|
7491
|
+
case NodeIntentType.BOT_RECALCULATE:
|
|
7492
|
+
mainIntents.push(intent);
|
|
7493
|
+
break;
|
|
7494
|
+
case NodeIntentType.BOT_SUB_TITLE:
|
|
7495
|
+
subIntents.push(intent);
|
|
7496
|
+
break;
|
|
7497
|
+
case NodeIntentType.BOT_SUB_BODY:
|
|
7498
|
+
subIntents.push(intent);
|
|
7499
|
+
break;
|
|
7500
|
+
default:
|
|
7501
|
+
rest.push(intent);
|
|
7502
|
+
break;
|
|
7503
|
+
}
|
|
7504
|
+
});
|
|
7505
|
+
return {
|
|
7506
|
+
mainIntents,
|
|
7507
|
+
subIntents,
|
|
7508
|
+
intents: rest,
|
|
7509
|
+
};
|
|
7510
|
+
}, []);
|
|
7511
|
+
if (!(intentsProps === null || intentsProps === void 0 ? void 0 : intentsProps.length)) {
|
|
7512
|
+
return null;
|
|
7513
|
+
}
|
|
7514
|
+
function renderIntent(intent) {
|
|
7515
|
+
const NodeIntent = SubotInlineIntentBase[intent === null || intent === void 0 ? void 0 : intent.type];
|
|
7516
|
+
if (!NodeIntent) {
|
|
7517
|
+
return null;
|
|
7518
|
+
}
|
|
7519
|
+
return React__default.createElement(NodeIntent, { key: intent.id, intent: intent });
|
|
7520
|
+
}
|
|
7521
|
+
return (React__default.createElement(SubotInlineIntentRow, null,
|
|
7522
|
+
React__default.createElement(SubotInlineIntentCol, null,
|
|
7523
|
+
React__default.createElement(SubotInlineIntentFinalRow, null,
|
|
7524
|
+
intents.mainIntents.map(renderIntent),
|
|
7525
|
+
intents.subIntents.map(renderIntent),
|
|
7526
|
+
intents.intents.map(renderIntent)))));
|
|
7527
|
+
};
|
|
7528
|
+
|
|
7529
|
+
/*******************************************************************************/
|
|
7530
|
+
/*************************** NodeIntentType: 'bot-text' ************************/
|
|
7531
|
+
//#region
|
|
7532
|
+
const SubotInlineIntentBotText = ({ intent, }) => {
|
|
7533
|
+
if (!(intent === null || intent === void 0 ? void 0 : intent.label))
|
|
7534
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7535
|
+
return (React__default.createElement(SubotInlineIntentCol, null,
|
|
7536
|
+
React__default.createElement(SubotInlineIntentTextContainer, null,
|
|
7537
|
+
React__default.createElement(Markdown, null, intent === null || intent === void 0 ? void 0 : intent.label))));
|
|
7538
|
+
};
|
|
7539
|
+
//#endregion
|
|
7540
|
+
/*************************** END - NodeIntentType: 'bot-text' ******************/
|
|
7541
|
+
/*******************************************************************************/
|
|
7542
|
+
/*******************************************************************************/
|
|
7543
|
+
/*************************** NodeIntentType: 'bot-image' ***********************/
|
|
7544
|
+
//#region
|
|
7545
|
+
const SubotInlineIntentBotImage = ({ intent, }) => {
|
|
7546
|
+
if (!intent.url)
|
|
7547
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7548
|
+
const isObject = (() => {
|
|
7549
|
+
try {
|
|
7550
|
+
return Boolean(JSON.parse((intent === null || intent === void 0 ? void 0 : intent.label) || ''));
|
|
7551
|
+
}
|
|
7552
|
+
catch (err) {
|
|
7553
|
+
return false;
|
|
7554
|
+
}
|
|
7555
|
+
})();
|
|
7556
|
+
return (React__default.createElement(SubotInlineIntentCol, { width: "50%" },
|
|
7557
|
+
React__default.createElement(SubotInlineIntentImageContainer, null,
|
|
7558
|
+
React__default.createElement("img", { loading: "lazy", src: intent.url, alt: intent.label, className: `intent-img ${intent.label && 'has-label'}` }),
|
|
7559
|
+
isObject && (React__default.createElement("h4", { className: "intent-img-label" },
|
|
7560
|
+
React__default.createElement(Markdown, null, intent.label))))));
|
|
7561
|
+
};
|
|
7562
|
+
//#endregion
|
|
7563
|
+
/*************************** END - NodeIntentType: 'bot-image' *****************/
|
|
7564
|
+
/*******************************************************************************/
|
|
7565
|
+
/*******************************************************************************/
|
|
7566
|
+
/*************************** NodeIntentType: 'bot-button' **********************/
|
|
7567
|
+
//#region
|
|
7568
|
+
const SubotInlineIntentBotButton = ({ intent, }) => {
|
|
7569
|
+
const { trackingCommonInline } = useContext(SubotInlineContext);
|
|
7570
|
+
const handleOnClick = () => {
|
|
7571
|
+
window.location.href = intent.url;
|
|
7572
|
+
};
|
|
7573
|
+
if (!(intent === null || intent === void 0 ? void 0 : intent.label))
|
|
7574
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7575
|
+
return (React__default.createElement(SubotInlineIntentCol, { width: "60%" },
|
|
7576
|
+
React__default.createElement(SubotInlineIntentButton, Object.assign({ size: "lg", color: "primary", onClick: handleOnClick, isBlock: true }, trackingCommonInline, { "data-event-action": "Click CTA", "data-response-id": intent.id }),
|
|
7577
|
+
React__default.createElement(Markdown, null, intent === null || intent === void 0 ? void 0 : intent.label))));
|
|
7578
|
+
};
|
|
7579
|
+
//#endregion
|
|
7580
|
+
/*************************** END - NodeIntentType: 'bot-button' ****************/
|
|
7581
|
+
/*******************************************************************************/
|
|
7582
|
+
/*******************************************************************************/
|
|
7583
|
+
/*************************** NodeIntentType: 'bot-url' *************************/
|
|
7584
|
+
//#region
|
|
7585
|
+
const SubotInlineIntentUrl = ({ intent, }) => {
|
|
7586
|
+
const article = useMemo(() => intent.label.includes('{')
|
|
7587
|
+
? JSON.parse(intent.label)
|
|
7588
|
+
: {}, [intent.label]);
|
|
7589
|
+
return (React__default.createElement(React__default.Fragment, null, !!Object.keys(article).length && (React__default.createElement(SubotInlineIntentCol, null,
|
|
7590
|
+
React__default.createElement(SubotInlineIntentUrlContainer, null,
|
|
7591
|
+
React__default.createElement("div", { className: "feature" },
|
|
7592
|
+
React__default.createElement("a", { href: article === null || article === void 0 ? void 0 : article.url, className: "feature-wrapper" },
|
|
7593
|
+
React__default.createElement("img", { loading: "lazy", src: article === null || article === void 0 ? void 0 : article.thumbnail, alt: article === null || article === void 0 ? void 0 : article.title, className: "feature-img" }))),
|
|
7594
|
+
React__default.createElement("div", { className: "body" },
|
|
7595
|
+
React__default.createElement("a", { href: article === null || article === void 0 ? void 0 : article.url },
|
|
7596
|
+
React__default.createElement("h5", { className: "title" },
|
|
7597
|
+
React__default.createElement(Markdown, null, article === null || article === void 0 ? void 0 : article.title)))))))));
|
|
7598
|
+
};
|
|
7599
|
+
//#endregion
|
|
7600
|
+
/*************************** END - NodeIntentType: 'bot-url' *******************/
|
|
7601
|
+
/*******************************************************************************/
|
|
7602
|
+
/*******************************************************************************/
|
|
7603
|
+
/*************************** NodeIntentType: 'sso-intent' *************************/
|
|
7604
|
+
//#region
|
|
7605
|
+
const SubotInlineIntentSSO = ({ intent, }) => {
|
|
7606
|
+
const info = (() => {
|
|
7607
|
+
try {
|
|
7608
|
+
return (intent === null || intent === void 0 ? void 0 : intent.label) ? JSON.parse(intent === null || intent === void 0 ? void 0 : intent.label) : {};
|
|
7609
|
+
}
|
|
7610
|
+
catch (err) {
|
|
7611
|
+
return {};
|
|
7612
|
+
}
|
|
7613
|
+
})();
|
|
7614
|
+
if (!info || !info.title)
|
|
7615
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7616
|
+
return (React__default.createElement(SubotInlineIntentCol, null,
|
|
7617
|
+
React__default.createElement(SubotInlineItemIcon, null,
|
|
7618
|
+
React__default.createElement("img", { loading: "lazy", src: intent === null || intent === void 0 ? void 0 : intent.url, className: "icon", alt: "" }),
|
|
7619
|
+
React__default.createElement("div", { className: "content" },
|
|
7620
|
+
React__default.createElement("h3", { className: "title" }, info.title),
|
|
7621
|
+
React__default.createElement("div", { className: "description" }, info === null || info === void 0 ? void 0 : info.description)))));
|
|
7622
|
+
};
|
|
7623
|
+
//#endregion
|
|
7624
|
+
/*************************** END - NodeIntentType: 'sso-intent' *******************/
|
|
7625
|
+
/*******************************************************************************/
|
|
7626
|
+
/*******************************************************************************/
|
|
7627
|
+
/*************************** NodeIntentType: 'bot-title' ***********************/
|
|
7628
|
+
//#region
|
|
7629
|
+
const SubotInlineIntentBotTitle = ({ intent, indexNumber, }) => {
|
|
7630
|
+
const isShowLabel = ![NodeIntentType.SSO_INTENT].includes(intent === null || intent === void 0 ? void 0 : intent.type);
|
|
7631
|
+
return (React__default.createElement(SubotInlineIntentFirstTextContainer, null,
|
|
7632
|
+
React__default.createElement(SubotInlineIntentFirstTextWrapper, null,
|
|
7633
|
+
indexNumber && (React__default.createElement("div", { className: "number" },
|
|
7634
|
+
indexNumber < 10 ? `0${indexNumber}` : indexNumber,
|
|
7635
|
+
".")),
|
|
7636
|
+
isShowLabel &&
|
|
7637
|
+
intent &&
|
|
7638
|
+
[NodeIntentType.BOT_TEXT, NodeIntentType.BOT_BUTTON].includes(intent === null || intent === void 0 ? void 0 : intent.type) && React__default.createElement(Markdown, { className: "title" }, intent.label)),
|
|
7639
|
+
intent &&
|
|
7640
|
+
[NodeIntentType.BOT_IMAGE].includes(intent === null || intent === void 0 ? void 0 : intent.type) && (React__default.createElement(SubotInlineIntentFirstImageWrapper, null,
|
|
7641
|
+
React__default.createElement(SubotInlineIntentBotImage, { intent: intent })))));
|
|
7642
|
+
};
|
|
7643
|
+
//#endregion
|
|
7644
|
+
/*************************** END - NodeIntentType: 'bot-title' *****************/
|
|
7645
|
+
/*******************************************************************************/
|
|
7646
|
+
/*******************************************************************************/
|
|
7647
|
+
/*************************** NodeIntentType: 'bot-main-title' ******************/
|
|
7648
|
+
//#region
|
|
7649
|
+
const SubotInlineIntentBotMainTitle = ({ intent, }) => {
|
|
7650
|
+
if (!intent.label ||
|
|
7651
|
+
intent.label === 'Sub title' ||
|
|
7652
|
+
intent.label === 'Main title') {
|
|
7653
|
+
return null;
|
|
7654
|
+
}
|
|
7655
|
+
return (React__default.createElement(SubotInlineIntentFinalCol, null,
|
|
7656
|
+
React__default.createElement(SubotInlineIntentTitle, null,
|
|
7657
|
+
React__default.createElement(Markdown, null, intent.label))));
|
|
7658
|
+
};
|
|
7659
|
+
//#endregion
|
|
7660
|
+
/*************************** END - NodeIntentType: 'bot-main-title' ************/
|
|
7661
|
+
/*******************************************************************************/
|
|
7662
|
+
/*******************************************************************************/
|
|
7663
|
+
/*************************** NodeIntentType: 'bot-main-image' ******************/
|
|
7664
|
+
//#region
|
|
7665
|
+
const SubotInlineIntentBotMainImage = ({ intent, }) => {
|
|
7666
|
+
if (!intent.url)
|
|
7667
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7668
|
+
return (React__default.createElement(SubotInlineIntentFinalCol, null,
|
|
7669
|
+
React__default.createElement(SubotInlineIntentImageContainer, null,
|
|
7670
|
+
React__default.createElement("img", { loading: "lazy", src: intent.url, alt: intent.label, className: `intent-img ${intent.label && 'has-label'}` }),
|
|
7671
|
+
intent.label && (React__default.createElement("h4", { className: "intent-img-label" },
|
|
7672
|
+
React__default.createElement(Markdown, null, intent.label))))));
|
|
7673
|
+
};
|
|
7674
|
+
//#endregion
|
|
7675
|
+
/*************************** END - NodeIntentType: 'bot-main-image' ************/
|
|
7676
|
+
/*******************************************************************************/
|
|
7677
|
+
/*******************************************************************************/
|
|
7678
|
+
/*************************** NodeIntentType: 'bot-main-body' ******************/
|
|
7679
|
+
//#region
|
|
7680
|
+
const SubotInlineIntentBotMainBody = ({ intent, }) => {
|
|
7681
|
+
if (!intent.label ||
|
|
7682
|
+
intent.label === 'Main body' ||
|
|
7683
|
+
intent.label === 'Sub body') {
|
|
7684
|
+
return null;
|
|
7685
|
+
}
|
|
7686
|
+
return (React__default.createElement(SubotInlineIntentFinalCol, null,
|
|
7687
|
+
React__default.createElement("div", { className: "intents__item markdown" },
|
|
7688
|
+
React__default.createElement(Markdown, null, intent.label))));
|
|
7689
|
+
};
|
|
7690
|
+
//#endregion
|
|
7691
|
+
/*************************** END - NodeIntentType: 'bot-main-body' ************/
|
|
7692
|
+
/*******************************************************************************/
|
|
7693
|
+
/*******************************************************************************/
|
|
7694
|
+
/*************************** NodeIntentType: 'bot-main-button' *****************/
|
|
7695
|
+
//#region
|
|
7696
|
+
const SubotInlineIntentBotMainButton = ({ intent, }) => {
|
|
7697
|
+
const { trackingCommonInline } = useContext(SubotInlineContext);
|
|
7698
|
+
const handleOnClick = () => {
|
|
7699
|
+
window.location.href = intent.url;
|
|
7700
|
+
};
|
|
7701
|
+
if (!intent.label)
|
|
7702
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7703
|
+
return (React__default.createElement(SubotInlineIntentCol, { width: "auto" },
|
|
7704
|
+
React__default.createElement(SubotInlineIntentFinalButtonContainer, null,
|
|
7705
|
+
React__default.createElement(SubotInlineIntentButton, Object.assign({ size: "lg", color: "primary", onClick: handleOnClick, className: "pointer-event-child-none" }, trackingCommonInline, { "data-event-action": "Click CTA", "data-response-id": intent.id }),
|
|
7706
|
+
React__default.createElement(Markdown, null, intent === null || intent === void 0 ? void 0 : intent.label)))));
|
|
7707
|
+
};
|
|
7708
|
+
//#endregion
|
|
7709
|
+
/*************************** END - NodeIntentType: 'bot-main-button' ***********/
|
|
7710
|
+
/*******************************************************************************/
|
|
7711
|
+
/*******************************************************************************/
|
|
7712
|
+
/*************************** NodeIntentType: 'bot-recalculate' *****************/
|
|
7713
|
+
//#region
|
|
7714
|
+
const SubotInlineIntentBotRecalculate = ({ intent }) => {
|
|
7715
|
+
const { onReset } = useContext(SubotInlineContext);
|
|
7716
|
+
const handleOnClick = () => {
|
|
7717
|
+
onReset && onReset();
|
|
7718
|
+
};
|
|
7719
|
+
if (!(intent === null || intent === void 0 ? void 0 : intent.label))
|
|
7720
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7721
|
+
return (React__default.createElement(SubotInlineIntentCol, { width: "auto", style: { justifyContent: 'center', display: 'flex' } },
|
|
7722
|
+
React__default.createElement(SubotInlineRecalculateButton, { size: "lg", color: "secondary", onClick: handleOnClick, icon: React__default.createElement(RotateLeftSvg, null), className: "bot-recalculate" },
|
|
7723
|
+
React__default.createElement(Markdown, null, intent === null || intent === void 0 ? void 0 : intent.label))));
|
|
7724
|
+
};
|
|
7725
|
+
//#endregion
|
|
7726
|
+
/*************************** END - NodeIntentType: 'bot-recalculate' ***********/
|
|
7727
|
+
/*******************************************************************************/
|
|
7728
|
+
/*******************************************************************************/
|
|
7729
|
+
/*************************** NodeIntentType: 'bot-risk-screener' ***************/
|
|
7730
|
+
//#region
|
|
7731
|
+
const SubotInlineIntentBotRiskScreener = ({ intent }) => {
|
|
7732
|
+
const { formatMessage: f } = useContext(TogetherComponentGlobalContext);
|
|
7733
|
+
const article = useMemo(() => {
|
|
7734
|
+
if (intent.label && intent.label.includes('{')) {
|
|
7735
|
+
return JSON.parse(intent.label);
|
|
7736
|
+
}
|
|
7737
|
+
return {};
|
|
7738
|
+
}, [intent, intent === null || intent === void 0 ? void 0 : intent.label]);
|
|
7739
|
+
return (React__default.createElement(React__default.Fragment, null, !!(article === null || article === void 0 ? void 0 : article.title) && !!(article === null || article === void 0 ? void 0 : article.thumbnail) && !!(article === null || article === void 0 ? void 0 : article.url) && (React__default.createElement(SubotInlineIntentFinalCol, null,
|
|
7740
|
+
React__default.createElement(SubotInlineIntentRiskScreenerContainer, null,
|
|
7741
|
+
React__default.createElement("a", { href: article === null || article === void 0 ? void 0 : article.url, className: "feature" },
|
|
7742
|
+
React__default.createElement("img", { loading: "lazy", src: article === null || article === void 0 ? void 0 : article.thumbnail, alt: article === null || article === void 0 ? void 0 : article.title })),
|
|
7743
|
+
React__default.createElement("div", { className: "title-container" },
|
|
7744
|
+
React__default.createElement("a", { href: article === null || article === void 0 ? void 0 : article.url },
|
|
7745
|
+
React__default.createElement("h5", { className: "title" }, article === null || article === void 0 ? void 0 : article.title)),
|
|
7746
|
+
React__default.createElement("a", { href: article === null || article === void 0 ? void 0 : article.url, className: "link" },
|
|
7747
|
+
f({
|
|
7748
|
+
id: 'riskScreener.start',
|
|
7749
|
+
defaultMessage: 'Start',
|
|
7750
|
+
}),
|
|
7751
|
+
React__default.createElement(ChevronRight$2, { style: { marginLeft: 10 } }))))))));
|
|
7752
|
+
};
|
|
7753
|
+
//#endregion
|
|
7754
|
+
/*************************** END - NodeIntentType: 'bot-risk-screener' *********/
|
|
7755
|
+
/*******************************************************************************/
|
|
7756
|
+
/*******************************************************************************/
|
|
7757
|
+
/*************************** NodeIntentType: 'bot-related-article' *************/
|
|
7758
|
+
//#region
|
|
7759
|
+
const SubotInlineIntentBotRelatedArticle = ({ intent }) => {
|
|
7760
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o;
|
|
7761
|
+
const article = useMemo(() => {
|
|
7762
|
+
if (intent.label && intent.label.includes('{')) {
|
|
7763
|
+
const _article = JSON.parse(intent.label);
|
|
7764
|
+
if (_article.meta) {
|
|
7765
|
+
const tmp = {};
|
|
7766
|
+
_article.meta.map(({ key, value }) => {
|
|
7767
|
+
if (key && value)
|
|
7768
|
+
tmp[key] = value;
|
|
7769
|
+
});
|
|
7770
|
+
_article.meta = Object.assign({}, tmp);
|
|
7771
|
+
}
|
|
7772
|
+
return Object.assign({}, _article);
|
|
7773
|
+
}
|
|
7774
|
+
return {};
|
|
7775
|
+
}, [intent, intent === null || intent === void 0 ? void 0 : intent.label]);
|
|
7776
|
+
return (React__default.createElement(React__default.Fragment, null, !!(article === null || article === void 0 ? void 0 : article.title) &&
|
|
7777
|
+
!!(article === null || article === void 0 ? void 0 : article.thumbnail) &&
|
|
7778
|
+
!!(article === null || article === void 0 ? void 0 : article.url) &&
|
|
7779
|
+
!!(article === null || article === void 0 ? void 0 : article.meta) &&
|
|
7780
|
+
!!((_a = article === null || article === void 0 ? void 0 : article.meta) === null || _a === void 0 ? void 0 : _a.post_modified) &&
|
|
7781
|
+
!!((_b = article === null || article === void 0 ? void 0 : article.meta) === null || _b === void 0 ? void 0 : _b.reviewed_display_name) &&
|
|
7782
|
+
!!((_c = article === null || article === void 0 ? void 0 : article.meta) === null || _c === void 0 ? void 0 : _c.reviewed_url) &&
|
|
7783
|
+
!!((_d = article === null || article === void 0 ? void 0 : article.meta) === null || _d === void 0 ? void 0 : _d.reviewed_avatar_thumbnail) &&
|
|
7784
|
+
!!((_e = article === null || article === void 0 ? void 0 : article.meta) === null || _e === void 0 ? void 0 : _e.category_url) &&
|
|
7785
|
+
!!((_f = article === null || article === void 0 ? void 0 : article.meta) === null || _f === void 0 ? void 0 : _f.category_name) && (React__default.createElement(SubotInlineIntentFinalCol, { width: "40%" },
|
|
7786
|
+
React__default.createElement(ArticleCard, { title: article === null || article === void 0 ? void 0 : article.title, uploadTime: dayjs((_g = article === null || article === void 0 ? void 0 : article.meta) === null || _g === void 0 ? void 0 : _g.post_modified).format('DD/MM/YYYY'), authorName: (_h = article === null || article === void 0 ? void 0 : article.meta) === null || _h === void 0 ? void 0 : _h.reviewed_display_name, authorLink: (_j = article === null || article === void 0 ? void 0 : article.meta) === null || _j === void 0 ? void 0 : _j.reviewed_url, avatarImg: React__default.createElement("img", { loading: "lazy", src: (_k = article === null || article === void 0 ? void 0 : article.meta) === null || _k === void 0 ? void 0 : _k.reviewed_avatar_thumbnail, alt: (_l = article === null || article === void 0 ? void 0 : article.meta) === null || _l === void 0 ? void 0 : _l.reviewed_display_name }), categoryLink: (_m = article === null || article === void 0 ? void 0 : article.meta) === null || _m === void 0 ? void 0 : _m.category_url, categoryName: (_o = article === null || article === void 0 ? void 0 : article.meta) === null || _o === void 0 ? void 0 : _o.category_name, banner: React__default.createElement("img", { loading: "lazy", src: article === null || article === void 0 ? void 0 : article.thumbnail, alt: article === null || article === void 0 ? void 0 : article.title }), text: "", size: "sm", direction: "vertical" })))));
|
|
7787
|
+
};
|
|
7788
|
+
//#endregion
|
|
7789
|
+
/*************************** END - NodeIntentType: 'bot-related-article' *******/
|
|
7790
|
+
/*******************************************************************************/
|
|
7791
|
+
/*******************************************************************************/
|
|
7792
|
+
/*************************** NodeIntentType: 'thank-you-image' *****************/
|
|
7793
|
+
//#region
|
|
7794
|
+
const SubotInlineIntentThankYouImage = ({ intent, }) => {
|
|
7795
|
+
if (!intent.url)
|
|
7796
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7797
|
+
return (React__default.createElement(SubotInlineIntentFinalCol, null,
|
|
7798
|
+
React__default.createElement(SubotInlineIntentImageContainer, null,
|
|
7799
|
+
React__default.createElement("img", { loading: "lazy", src: intent.url, alt: intent.label, className: `intent-img ${intent.label && 'has-label'}` }),
|
|
7800
|
+
intent.label && (React__default.createElement("h4", { className: "intent-img-label" },
|
|
7801
|
+
React__default.createElement(Markdown, null, intent.label))))));
|
|
7802
|
+
};
|
|
7803
|
+
//#endregion
|
|
7804
|
+
/*************************** END - NodeIntentType: 'thank-you-image' ***********/
|
|
7805
|
+
/*******************************************************************************/
|
|
7806
|
+
/*******************************************************************************/
|
|
7807
|
+
/*************************** NodeIntentType: 'thank-you-title' *****************/
|
|
7808
|
+
//#region
|
|
7809
|
+
const SubotInlineIntentThankYouTitle = ({ intent, }) => {
|
|
7810
|
+
if (!intent.label)
|
|
7811
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7812
|
+
return (React__default.createElement(SubotInlineIntentFinalCol, null,
|
|
7813
|
+
React__default.createElement(SubotInlineIntentTitle, null,
|
|
7814
|
+
React__default.createElement(Markdown, null, intent.label))));
|
|
7815
|
+
};
|
|
7816
|
+
//#endregion
|
|
7817
|
+
/*************************** END - NodeIntentType: 'thank-you-title' ***********/
|
|
7818
|
+
/*******************************************************************************/
|
|
7819
|
+
/*******************************************************************************/
|
|
7820
|
+
/*************************** NodeIntentType: 'thank-you-body' ******************/
|
|
7821
|
+
//#region
|
|
7822
|
+
const SubotInlineIntentThankYouBody = ({ intent, }) => {
|
|
7823
|
+
if (!intent.label)
|
|
7824
|
+
return React__default.createElement(React__default.Fragment, null);
|
|
7825
|
+
return (React__default.createElement(SubotInlineIntentFinalCol, null,
|
|
7826
|
+
React__default.createElement("div", { className: "intents__item markdown" },
|
|
7827
|
+
React__default.createElement(Markdown, null, intent.label))));
|
|
7828
|
+
};
|
|
7829
|
+
//#endregion
|
|
7830
|
+
/*************************** END - NodeIntentType: 'thank-you-body' ************/
|
|
7831
|
+
/*******************************************************************************/
|
|
7832
|
+
const SubotInlineIntentBase = {
|
|
7833
|
+
[NodeIntentType.BOT_TEXT]: SubotInlineIntentBotText,
|
|
7834
|
+
[NodeIntentType.BOT_IMAGE]: SubotInlineIntentBotImage,
|
|
7835
|
+
[NodeIntentType.BOT_BUTTON]: SubotInlineIntentBotButton,
|
|
7836
|
+
[NodeIntentType.BOT_URL]: SubotInlineIntentUrl,
|
|
7837
|
+
[NodeIntentType.BOT_RECALCULATE]: SubotInlineIntentBotRecalculate,
|
|
7838
|
+
[NodeIntentType.BOT_MAIN_TITLE]: SubotInlineIntentBotMainTitle,
|
|
7839
|
+
[NodeIntentType.BOT_MAIN_IMAGE]: SubotInlineIntentBotMainImage,
|
|
7840
|
+
[NodeIntentType.BOT_MAIN_BODY]: SubotInlineIntentBotMainBody,
|
|
7841
|
+
[NodeIntentType.BOT_MAIN_BUTTON]: SubotInlineIntentBotMainButton,
|
|
7842
|
+
[NodeIntentType.BOT_SUB_TITLE]: SubotInlineIntentBotMainTitle,
|
|
7843
|
+
[NodeIntentType.BOT_SUB_BODY]: SubotInlineIntentBotMainBody,
|
|
7844
|
+
[NodeIntentType.BOT_LANDING_PAGE_URL]: SubotInlineIntentBotText,
|
|
7845
|
+
[NodeIntentType.BOT_LANDING_PAGE_BUTTON]: SubotInlineIntentBotText,
|
|
7846
|
+
[NodeIntentType.BOT_RISK_SCREEN]: SubotInlineIntentBotRiskScreener,
|
|
7847
|
+
[NodeIntentType.BOT_RELATED_ARTICLE]: SubotInlineIntentBotRelatedArticle,
|
|
7848
|
+
[NodeIntentType.THANK_YOU_IMAGE]: SubotInlineIntentThankYouImage,
|
|
7849
|
+
[NodeIntentType.THANK_YOU_TITLE]: SubotInlineIntentThankYouTitle,
|
|
7850
|
+
[NodeIntentType.THANK_YOU_BODY]: SubotInlineIntentThankYouBody,
|
|
7851
|
+
/** intents fake for sso block */
|
|
7852
|
+
[NodeIntentType.SSO_INTENT]: SubotInlineIntentSSO,
|
|
7853
|
+
};
|
|
7854
|
+
|
|
7855
|
+
/***************** type: TEXT, IMAGE ***************/
|
|
7856
|
+
const SubotInlineNode = ({ node, indexNumber, }) => {
|
|
7857
|
+
const { formatMessage: f, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
|
|
7858
|
+
const { params, onChange, onSubmit, onPrev, onNext, nodes, activeId } = useContext(SubotInlineContext);
|
|
7859
|
+
const [value, setValue] = useState((node === null || node === void 0 ? void 0 : node._message) || {});
|
|
7860
|
+
const handleOnChangeNormal = (action) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7861
|
+
const _message = Object.assign(Object.assign(Object.assign(Object.assign({}, params), value), { action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key }), getCurrentTotalDynamicScore(nodes, activeId, action.id));
|
|
7862
|
+
delete _message.form_submit_meta;
|
|
7863
|
+
const res = yield subotInlineMessage(_message);
|
|
7864
|
+
if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
|
|
7865
|
+
const _a = res === null || res === void 0 ? void 0 : res._data, { node: _node } = _a, restData = __rest(_a, ["node"]);
|
|
7866
|
+
const _nextNode = Object.assign(Object.assign({}, _node), { _message: Object.assign(Object.assign({}, restData), { node_id: _node.id }) });
|
|
7867
|
+
delete _nextNode._message.form_submit_meta;
|
|
7868
|
+
onSubmit && onSubmit(_nextNode, _message);
|
|
7869
|
+
}
|
|
7870
|
+
});
|
|
7871
|
+
const handleOnChange = (action, formSubmitMeta) => __awaiter(void 0, void 0, void 0, function* () {
|
|
7872
|
+
if (!action)
|
|
7873
|
+
return;
|
|
7874
|
+
const actionWithOther = (action === null || action === void 0 ? void 0 : action.type) === NodeActionType.USER_CHOICE_TEXT_BY_INPUT ||
|
|
7875
|
+
(action === null || action === void 0 ? void 0 : action.type) === NodeActionType.POLL_CHOICE_TEXT_BY_INPUT;
|
|
7876
|
+
const newValue = Object.assign(Object.assign({}, value), { action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key, form_submit_meta: formSubmitMeta });
|
|
7877
|
+
if (actionWithOther) {
|
|
7878
|
+
setValue(newValue);
|
|
7879
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
7880
|
+
return;
|
|
7881
|
+
}
|
|
7882
|
+
delete newValue.form_submit_meta;
|
|
7883
|
+
setValue(newValue);
|
|
7884
|
+
handleOnChangeNormal(action);
|
|
7885
|
+
});
|
|
7886
|
+
const handleOnNext = () => {
|
|
7887
|
+
const newMessage = JSON.parse(JSON.stringify(Object.assign(Object.assign(Object.assign({}, params), node === null || node === void 0 ? void 0 : node._message), value)));
|
|
7888
|
+
if ((value === null || value === void 0 ? void 0 : value.action_id) &&
|
|
7889
|
+
(value === null || value === void 0 ? void 0 : value.action_value) === KEY_OF_TEXT_CHOICE_WITH_OTHER_FIELD) {
|
|
7890
|
+
onNext === null || onNext === void 0 ? void 0 : onNext(newMessage);
|
|
7891
|
+
return;
|
|
7892
|
+
}
|
|
7893
|
+
if (!(value === null || value === void 0 ? void 0 : value.action_id) || !(value === null || value === void 0 ? void 0 : value.action_value)) {
|
|
7894
|
+
pushNotifications({
|
|
7895
|
+
title: '',
|
|
7896
|
+
message: f({
|
|
7897
|
+
id: 'multiSelectError.required',
|
|
7898
|
+
defaultMessage: `There is no answer!`,
|
|
7899
|
+
}),
|
|
7900
|
+
type: 'warning', // "success" | "danger" | "info" | "warning"
|
|
7901
|
+
});
|
|
7902
|
+
}
|
|
7903
|
+
else {
|
|
7904
|
+
delete newMessage.form_submit_meta;
|
|
7905
|
+
onNext === null || onNext === void 0 ? void 0 : onNext(newMessage);
|
|
7906
|
+
}
|
|
7907
|
+
};
|
|
7908
|
+
return (React__default.createElement(SubotInlineContainer$1, null,
|
|
7909
|
+
React__default.createElement(SubotInlineHeader$1, null),
|
|
7910
|
+
React__default.createElement(SubotInlineWrapper$1, null,
|
|
7911
|
+
React__default.createElement(SubotInlineIntentContainer, null,
|
|
7912
|
+
React__default.createElement(SubotInlineIntent, { intents: (node === null || node === void 0 ? void 0 : node.intents) || [], indexNumber: indexNumber })),
|
|
7913
|
+
React__default.createElement(SubotInlineActionContainer, null,
|
|
7914
|
+
React__default.createElement(SubotInlineAction, { value: (value === null || value === void 0 ? void 0 : value.action_id) ? [value === null || value === void 0 ? void 0 : value.action_id] : [], actions: node === null || node === void 0 ? void 0 : node.actions, onChange: handleOnChange, formSubmitMeta: value === null || value === void 0 ? void 0 : value.form_submit_meta }))),
|
|
7915
|
+
React__default.createElement(SubotInlineFooter$1, { onBack: () => onPrev && onPrev(), backProps: { isDisabled: !!(indexNumber === 1) }, onNext: handleOnNext })));
|
|
7916
|
+
};
|
|
7917
|
+
|
|
7918
|
+
const SubotInlineNodeFinal = ({ node, }) => {
|
|
7919
|
+
var _a, _b;
|
|
7920
|
+
const fixHeight = 350;
|
|
7921
|
+
const { nodes } = useContext(SubotInlineContext);
|
|
7922
|
+
const { formatMessage: f } = useContext(TogetherComponentGlobalContext);
|
|
7923
|
+
const flag = useRef(null);
|
|
7924
|
+
const wrapper = useRef(null);
|
|
7925
|
+
const [height, setHeight] = useState(fixHeight);
|
|
7926
|
+
const [showMore, setShowMore] = useState(true);
|
|
7927
|
+
const [isMore, setIsMore] = useState(false);
|
|
7928
|
+
const handleOnClick = useCallback(() => {
|
|
7929
|
+
fastdom.measure(() => {
|
|
7930
|
+
var _a;
|
|
7931
|
+
if (wrapper.current) {
|
|
7932
|
+
const wrapperHeight = (_a = wrapper.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height;
|
|
7933
|
+
if (height && height < wrapperHeight) {
|
|
7934
|
+
setHeight(wrapperHeight);
|
|
7935
|
+
setIsMore(true);
|
|
7936
|
+
}
|
|
7937
|
+
else {
|
|
7938
|
+
setHeight(fixHeight);
|
|
7939
|
+
setIsMore(false);
|
|
7940
|
+
}
|
|
7941
|
+
flag.current &&
|
|
7942
|
+
flag.current.scrollIntoView({
|
|
7943
|
+
behavior: 'smooth',
|
|
7944
|
+
block: 'start',
|
|
7945
|
+
inline: 'start',
|
|
7946
|
+
});
|
|
7947
|
+
}
|
|
7948
|
+
});
|
|
7949
|
+
}, [height]);
|
|
7950
|
+
useLayoutEffect(() => {
|
|
7951
|
+
fastdom.measure(() => {
|
|
7952
|
+
if (wrapper.current) {
|
|
7953
|
+
setTimeout(() => {
|
|
7954
|
+
var _a;
|
|
7955
|
+
const wrapperHeight = (_a = wrapper.current) === null || _a === void 0 ? void 0 : _a.getBoundingClientRect().height;
|
|
7956
|
+
if (wrapperHeight && height > wrapperHeight) {
|
|
7957
|
+
setShowMore(false);
|
|
7958
|
+
setIsMore(false);
|
|
7959
|
+
}
|
|
7960
|
+
}, 400);
|
|
7961
|
+
}
|
|
7962
|
+
});
|
|
7963
|
+
}, []);
|
|
7964
|
+
const botItem = nodes[0];
|
|
7965
|
+
const botType = (_a = botItem === null || botItem === void 0 ? void 0 : botItem.extra_settings) === null || _a === void 0 ? void 0 : _a.subot_type;
|
|
7966
|
+
const suggestedServiceIntents = useMemo(() => {
|
|
7967
|
+
var _a;
|
|
7968
|
+
return (((_a = node === null || node === void 0 ? void 0 : node.intents) === null || _a === void 0 ? void 0 : _a.filter((i) => i.type === NodeIntentType.BOT_SUGGESTED_SERVICE)) || []);
|
|
7969
|
+
}, []);
|
|
7970
|
+
return (React__default.createElement(SubotInlineFinalContainer, null,
|
|
7971
|
+
React__default.createElement("div", { ref: flag, className: "hhg-flag", style: {
|
|
7972
|
+
position: 'absolute',
|
|
7973
|
+
top: -100,
|
|
7974
|
+
left: 0,
|
|
7975
|
+
pointerEvents: 'none',
|
|
7976
|
+
} }),
|
|
7977
|
+
React__default.createElement(SubotInlineFinalWrapper, { maxHeight: height, isMore: isMore },
|
|
7978
|
+
React__default.createElement("div", { ref: wrapper },
|
|
7979
|
+
React__default.createElement(SubotInlineIntentFinal, { intents: (node === null || node === void 0 ? void 0 : node.intents) || [] }),
|
|
7980
|
+
suggestedServiceIntents.length > 0 && (React__default.createElement("div", null, suggestedServiceIntents.map((intent) => {
|
|
7981
|
+
const NodeIntent = SubotInlineIntentBase$1[intent.type || ''];
|
|
7982
|
+
return (NodeIntent && React__default.createElement(NodeIntent, { key: intent.id, intent: intent }));
|
|
7983
|
+
}))))),
|
|
7984
|
+
showMore && (React__default.createElement(SubotInlineFinalMoreContainer, null,
|
|
7985
|
+
React__default.createElement(SubotInlineFinalButton, { size: "md", color: "secondary", onClick: handleOnClick }, !isMore ? (React__default.createElement(React__default.Fragment, null,
|
|
7986
|
+
f({ id: 'subotInline.showMore', defaultMessage: 'Show more' }),
|
|
7987
|
+
React__default.createElement(ArrowDown, { style: { marginLeft: 10 } }))) : (React__default.createElement(React__default.Fragment, null,
|
|
7988
|
+
f({ id: 'subotInline.showLess', defaultMessage: 'Show less' }),
|
|
7989
|
+
React__default.createElement(ArrowUp, { style: { marginLeft: 10 } })))))),
|
|
7990
|
+
botType === SubotType.voucherAcuvue && (React__default.createElement(SubotInlineVoucherLeftUI, { clientId: (_b = botItem.extra_settings) === null || _b === void 0 ? void 0 : _b.client_id, voucherAnswers: extractVoucherAnswers(nodes, botItem) }))));
|
|
7991
|
+
};
|
|
7992
|
+
|
|
7993
|
+
const SubotInlineResultButton = styled.span `
|
|
7994
|
+
display: inline-block;
|
|
7995
|
+
margin-top: 20px;
|
|
7996
|
+
color: ${theme.colors.primaryBase || '#2D87F3'};
|
|
7997
|
+
cursor: pointer;
|
|
7998
|
+
transition: 0.3 all ease;
|
|
7999
|
+
&:hover {
|
|
8000
|
+
color: ${theme.colors.primaryHover || '#2D87F3'};
|
|
8001
|
+
}
|
|
8002
|
+
${MediaQueries.tdDown} {
|
|
8003
|
+
margin-top: 16px;
|
|
8004
|
+
}
|
|
8005
|
+
${MediaQueries.mbDown} {
|
|
8006
|
+
margin-top: 12px;
|
|
8007
|
+
}
|
|
8008
|
+
`;
|
|
8009
|
+
const SubotInlineWrapper = styled.div `
|
|
8010
|
+
max-width: 430px;
|
|
8011
|
+
margin-right: auto;
|
|
8012
|
+
margin-left: auto;
|
|
8013
|
+
`;
|
|
8014
|
+
const SubotInlineContainer = styled.div `
|
|
8015
|
+
padding: 44px 16px 32px;
|
|
8016
|
+
background-color: ${theme.colors.neutral50 || '#F7F9FC'};
|
|
8017
|
+
border-radius: ${theme.borderRadius};
|
|
8018
|
+
position: relative;
|
|
8019
|
+
text-align: center;
|
|
8020
|
+
${MediaQueries.tdDown} {
|
|
8021
|
+
padding: 36px 16px 24px;
|
|
8022
|
+
}
|
|
8023
|
+
${MediaQueries.mbDown} {
|
|
8024
|
+
padding: 16px;
|
|
8025
|
+
border-radius: 0px;
|
|
8026
|
+
}
|
|
8027
|
+
`;
|
|
8028
|
+
const SubotInlineNodeFinalThankYou = ({ node, }) => {
|
|
8029
|
+
var _a;
|
|
8030
|
+
const { params, onNext } = useContext(SubotInlineContext);
|
|
8031
|
+
const resultButton = useMemo(() => {
|
|
8032
|
+
var _a;
|
|
8033
|
+
const _resultButton = (_a = node === null || node === void 0 ? void 0 : node.actions) === null || _a === void 0 ? void 0 : _a.find(({ type }) => type === NodeActionType.RESULT_BUTTON);
|
|
8034
|
+
if (_resultButton)
|
|
8035
|
+
return _resultButton;
|
|
8036
|
+
return null;
|
|
8037
|
+
}, [node === null || node === void 0 ? void 0 : node.actions]);
|
|
8038
|
+
const handleOnNext = useCallback(() => {
|
|
8039
|
+
onNext &&
|
|
8040
|
+
onNext(Object.assign(Object.assign(Object.assign({}, params), node === null || node === void 0 ? void 0 : node._message), { action_id: resultButton === null || resultButton === void 0 ? void 0 : resultButton.id, action_value: resultButton === null || resultButton === void 0 ? void 0 : resultButton.key }));
|
|
8041
|
+
}, [resultButton]);
|
|
8042
|
+
return (React__default.createElement(SubotInlineContainer, null,
|
|
8043
|
+
React__default.createElement(SubotInlineWrapper, null, (_a = node === null || node === void 0 ? void 0 : node.intents) === null || _a === void 0 ? void 0 :
|
|
8044
|
+
_a.map((intent) => {
|
|
8045
|
+
const NodeIntent = SubotInlineIntentBase[intent === null || intent === void 0 ? void 0 : intent.type];
|
|
8046
|
+
return NodeIntent && React__default.createElement(NodeIntent, { key: intent.id, intent: intent });
|
|
8047
|
+
}),
|
|
8048
|
+
resultButton && (React__default.createElement(SubotInlineResultButton, { onClick: handleOnNext }, resultButton === null || resultButton === void 0 ? void 0 : resultButton.label)))));
|
|
8049
|
+
};
|
|
8050
|
+
|
|
8051
|
+
const SubotInlineNodeForm = ({ node, indexNumber, }) => {
|
|
8052
|
+
var _a;
|
|
8053
|
+
const { data: { locale }, } = useContext(TogetherComponentGlobalContext);
|
|
8054
|
+
const { params, onPrev, onSubmit, trackingCommonInline, nodes, activeId } = useContext(SubotInlineContext);
|
|
8055
|
+
const handleSubmit = (data) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8056
|
+
const res = yield subotInlineMessage(Object.assign(Object.assign(Object.assign(Object.assign({}, params), node._message), data), getCurrentTotalDynamicScore(nodes, activeId, data.action_id, data.form_submit_meta)));
|
|
8057
|
+
if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
|
|
8058
|
+
const _b = res === null || res === void 0 ? void 0 : res._data, { node: _node } = _b, restData = __rest(_b, ["node"]);
|
|
8059
|
+
const _nextNode = Object.assign(Object.assign({}, _node), { _message: Object.assign(Object.assign({}, restData), { node_id: _node.id }) });
|
|
8060
|
+
onSubmit && onSubmit(_nextNode, Object.assign(Object.assign({}, node._message), data));
|
|
8061
|
+
}
|
|
8062
|
+
});
|
|
8063
|
+
return (React__default.createElement(SubotInlineContainer$1, null,
|
|
8064
|
+
React__default.createElement(SubotInlineHeader$1, null),
|
|
8065
|
+
React__default.createElement(SubotInlineWrapper$1, null,
|
|
8066
|
+
React__default.createElement(SubotInlineIntentContainer, null,
|
|
8067
|
+
React__default.createElement(SubotInlineIntent, { intents: (node === null || node === void 0 ? void 0 : node.intents) || [], indexNumber: indexNumber })),
|
|
8068
|
+
React__default.createElement(SubotInlineFormContainer, null,
|
|
8069
|
+
React__default.createElement(UserInfoForm, { botId: params.bot_id, nodeId: String(node === null || node === void 0 ? void 0 : node.id), className: "form", actions: (node === null || node === void 0 ? void 0 : node.actions) || [], formSubmitMeta: ((_a = node === null || node === void 0 ? void 0 : node._message) === null || _a === void 0 ? void 0 : _a.form_submit_meta) || null, callBack: handleSubmit, countryCode: (locale === null || locale === void 0 ? void 0 : locale.split('-')[1]) || 'PH', trackingSubmitBtn: Object.assign(Object.assign({}, trackingCommonInline), { 'data-event-action': 'Submit' }) }))),
|
|
8070
|
+
React__default.createElement(SubotInlineFooter$1, { onBack: () => onPrev && onPrev(), backProps: { isDisabled: !!(indexNumber === 1) }, hideNext: true })));
|
|
8071
|
+
};
|
|
8072
|
+
|
|
8073
|
+
const SubotInlineNodeImage = ({ node, indexNumber, }) => {
|
|
8074
|
+
const { formatMessage: f, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
|
|
8075
|
+
const { params, onSubmit, onPrev, onNext } = useContext(SubotInlineContext);
|
|
8076
|
+
const [value, setValue] = useState((node === null || node === void 0 ? void 0 : node._message) || {});
|
|
8077
|
+
const handleOnChange = (action) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8078
|
+
if (action) {
|
|
8079
|
+
setValue(Object.assign(Object.assign({}, value), { action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key }));
|
|
8080
|
+
const _message = Object.assign(Object.assign(Object.assign({}, params), value), { node_id: node.id, action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key });
|
|
8081
|
+
const res = yield subotInlineMessage(_message);
|
|
8082
|
+
if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
|
|
8083
|
+
const _a = res === null || res === void 0 ? void 0 : res._data, { node: _node } = _a, restData = __rest(_a, ["node"]);
|
|
8084
|
+
const _nextNode = Object.assign(Object.assign({}, _node), { _message: Object.assign(Object.assign({}, restData), { node_id: _node.id }) });
|
|
8085
|
+
onSubmit && onSubmit(_nextNode, _message);
|
|
8086
|
+
}
|
|
8087
|
+
}
|
|
8088
|
+
});
|
|
8089
|
+
const handleOnNext = () => {
|
|
8090
|
+
var _a;
|
|
8091
|
+
if (!(node === null || node === void 0 ? void 0 : node._message) || !((_a = node._message) === null || _a === void 0 ? void 0 : _a.action_id)) {
|
|
8092
|
+
pushNotifications({
|
|
8093
|
+
title: '',
|
|
8094
|
+
message: f({
|
|
8095
|
+
id: 'multiSelectError.required',
|
|
8096
|
+
defaultMessage: `There is no answer!`,
|
|
8097
|
+
}),
|
|
8098
|
+
type: 'warning', // "success" | "danger" | "info" | "warning"
|
|
8099
|
+
});
|
|
8100
|
+
}
|
|
8101
|
+
else {
|
|
8102
|
+
onNext && onNext(Object.assign(Object.assign(Object.assign({}, params), value), node === null || node === void 0 ? void 0 : node._message));
|
|
8103
|
+
}
|
|
8104
|
+
};
|
|
8105
|
+
return (React__default.createElement(SubotInlineContainer$1, null,
|
|
8106
|
+
React__default.createElement(SubotInlineHeader$1, null),
|
|
8107
|
+
React__default.createElement(SubotInlineWrapper$1, null,
|
|
8108
|
+
React__default.createElement(SubotInlineIntentContainer, null,
|
|
8109
|
+
React__default.createElement(SubotInlineIntent, { intents: (node === null || node === void 0 ? void 0 : node.intents) || [], indexNumber: indexNumber })),
|
|
8110
|
+
React__default.createElement(SubotInlineActionContainer, null,
|
|
8111
|
+
React__default.createElement(SubotInlineAction, { node_type: node === null || node === void 0 ? void 0 : node.type, value: (value === null || value === void 0 ? void 0 : value.action_id) ? [value === null || value === void 0 ? void 0 : value.action_id] : [], actions: node === null || node === void 0 ? void 0 : node.actions, onChange: handleOnChange }))),
|
|
8112
|
+
React__default.createElement(SubotInlineFooter$1, { onBack: () => onPrev && onPrev(), backProps: { isDisabled: !!(indexNumber === 1) }, onNext: handleOnNext })));
|
|
8113
|
+
};
|
|
8114
|
+
|
|
8115
|
+
const SubotInlineNodeMultiple = ({ node, indexNumber, }) => {
|
|
8116
|
+
const { params, onChange, onPrev, onNext } = useContext(SubotInlineContext);
|
|
8117
|
+
const { formatMessage: f, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
|
|
8118
|
+
const [value, setValue] = useState((node === null || node === void 0 ? void 0 : node._message) || {});
|
|
8119
|
+
const submitButton = useMemo(() => {
|
|
8120
|
+
var _a;
|
|
8121
|
+
const _submitButton = (_a = node === null || node === void 0 ? void 0 : node.actions) === null || _a === void 0 ? void 0 : _a.find(({ type }) => type == NodeActionType.ACTION_MULTIPLE_BUTTON);
|
|
8122
|
+
if (_submitButton)
|
|
8123
|
+
return _submitButton;
|
|
8124
|
+
return null;
|
|
8125
|
+
}, [node === null || node === void 0 ? void 0 : node.actions]);
|
|
8126
|
+
const activeActions = useMemo(() => {
|
|
8127
|
+
if (value === null || value === void 0 ? void 0 : value.selected_actions) {
|
|
8128
|
+
return Object.keys(value === null || value === void 0 ? void 0 : value.selected_actions);
|
|
8129
|
+
}
|
|
8130
|
+
return [];
|
|
8131
|
+
}, [value, value === null || value === void 0 ? void 0 : value.selected_actions]);
|
|
8132
|
+
const validateSelectActions = (selected_actions, callBack) => {
|
|
8133
|
+
const activeActions = Object.keys(selected_actions);
|
|
8134
|
+
if (!activeActions.length) {
|
|
8135
|
+
pushNotifications({
|
|
8136
|
+
title: '',
|
|
8137
|
+
message: f({
|
|
8138
|
+
id: 'multiSelectError.required',
|
|
8139
|
+
defaultMessage: `There is no answer!`,
|
|
8140
|
+
}),
|
|
8141
|
+
type: 'warning', // "success" | "danger" | "info" | "warning"
|
|
8142
|
+
});
|
|
8143
|
+
return;
|
|
8144
|
+
}
|
|
8145
|
+
else if ((node === null || node === void 0 ? void 0 : node.multi_select_option) === NodeMultipleOptions.RANGE &&
|
|
8146
|
+
activeActions.length < (node === null || node === void 0 ? void 0 : node.from)) {
|
|
8147
|
+
pushNotifications({
|
|
8148
|
+
title: '',
|
|
8149
|
+
message: f({
|
|
8150
|
+
id: 'multiSelectError.range',
|
|
8151
|
+
defaultMessage: 'You must choose from {from} to {to} answers (Ex: You must choose from 3 to 5 answers)',
|
|
8152
|
+
}, {
|
|
8153
|
+
from: node.from,
|
|
8154
|
+
to: node.to,
|
|
8155
|
+
}),
|
|
8156
|
+
type: 'warning', // "success" | "danger" | "info" | "warning"
|
|
8157
|
+
});
|
|
8158
|
+
return;
|
|
8159
|
+
}
|
|
8160
|
+
else if ((node === null || node === void 0 ? void 0 : node.multi_select_option) === NodeMultipleOptions.EXACT_NUMBER &&
|
|
8161
|
+
activeActions.length !== (node === null || node === void 0 ? void 0 : node.from)) {
|
|
8162
|
+
pushNotifications({
|
|
8163
|
+
message: f({
|
|
8164
|
+
id: 'multiSelectError.exactNumber',
|
|
8165
|
+
defaultMessage: 'You must choose {from} answers.',
|
|
8166
|
+
}, {
|
|
8167
|
+
from: node.from,
|
|
8168
|
+
}),
|
|
8169
|
+
type: 'warning', // "success" | "danger" | "info" | "warning"
|
|
8170
|
+
});
|
|
8171
|
+
return;
|
|
8172
|
+
}
|
|
8173
|
+
else {
|
|
8174
|
+
callBack();
|
|
8175
|
+
}
|
|
8176
|
+
};
|
|
8177
|
+
const handleOnClick = (action, formSubmitMeta) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8178
|
+
var _a, _b;
|
|
8179
|
+
if (action) {
|
|
8180
|
+
const _value = JSON.parse(JSON.stringify(Object.assign(Object.assign({}, value), { action_id: submitButton === null || submitButton === void 0 ? void 0 : submitButton.id, action_value: submitButton === null || submitButton === void 0 ? void 0 : submitButton.key, selected_actions: Object.assign({}, value === null || value === void 0 ? void 0 : value.selected_actions) })));
|
|
8181
|
+
if ((action === null || action === void 0 ? void 0 : action.type) === NodeActionType.POLL_CHOICE_TEXT_BY_INPUT ||
|
|
8182
|
+
(action === null || action === void 0 ? void 0 : action.type) === NodeActionType.USER_CHOICE_TEXT_BY_INPUT) {
|
|
8183
|
+
const isExistedPoll = (_value === null || _value === void 0 ? void 0 : _value.selected_actions) && action.id in _value.selected_actions;
|
|
8184
|
+
if (isExistedPoll) {
|
|
8185
|
+
if (formSubmitMeta) {
|
|
8186
|
+
_value.form_submit_meta = formSubmitMeta;
|
|
8187
|
+
}
|
|
8188
|
+
else {
|
|
8189
|
+
delete _value.form_submit_meta;
|
|
8190
|
+
(_a = _value.selected_actions) === null || _a === void 0 ? true : delete _a[action.id];
|
|
8191
|
+
}
|
|
8192
|
+
}
|
|
8193
|
+
else {
|
|
8194
|
+
if (action === null || action === void 0 ? void 0 : action.id) {
|
|
8195
|
+
_value.selected_actions = Object.assign(Object.assign({}, _value.selected_actions), { [action.id]: action.key || '' });
|
|
8196
|
+
}
|
|
8197
|
+
}
|
|
8198
|
+
setValue(_value);
|
|
8199
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(_value);
|
|
8200
|
+
return;
|
|
8201
|
+
}
|
|
8202
|
+
if (!((_b = _value.selected_actions) === null || _b === void 0 ? void 0 : _b[action.id])) {
|
|
8203
|
+
_value.selected_actions = Object.assign(Object.assign({}, _value.selected_actions), { [action.id]: action.key || '' });
|
|
8204
|
+
onChange && onChange(_value);
|
|
8205
|
+
setValue(_value);
|
|
8206
|
+
return;
|
|
8207
|
+
}
|
|
8208
|
+
if (_value.selected_actions[action.id]) {
|
|
8209
|
+
delete _value.selected_actions[action.id];
|
|
8210
|
+
onChange && onChange(_value);
|
|
8211
|
+
setValue(_value);
|
|
8212
|
+
return;
|
|
8213
|
+
}
|
|
8214
|
+
}
|
|
8215
|
+
});
|
|
8216
|
+
const handleOnNext = useCallback(() => {
|
|
8217
|
+
validateSelectActions((value === null || value === void 0 ? void 0 : value.selected_actions) || {}, () => {
|
|
8218
|
+
onNext &&
|
|
8219
|
+
onNext(Object.assign(Object.assign(Object.assign(Object.assign({}, params), node === null || node === void 0 ? void 0 : node._message), value), { node_id: node.id }));
|
|
8220
|
+
});
|
|
8221
|
+
}, [value, value === null || value === void 0 ? void 0 : value.selected_actions, onNext]);
|
|
8222
|
+
return (React__default.createElement(SubotInlineContainer$1, null,
|
|
8223
|
+
React__default.createElement(SubotInlineHeader$1, null),
|
|
8224
|
+
React__default.createElement(SubotInlineWrapper$1, null,
|
|
8225
|
+
React__default.createElement(SubotInlineIntentContainer, null,
|
|
8226
|
+
React__default.createElement(SubotInlineIntent, { intents: (node === null || node === void 0 ? void 0 : node.intents) || [], indexNumber: indexNumber })),
|
|
8227
|
+
React__default.createElement(SubotInlineActionContainer, null,
|
|
8228
|
+
React__default.createElement(SubotInlineAction, { value: activeActions, actions: node === null || node === void 0 ? void 0 : node.actions, onChange: handleOnClick, htmlType: "checkbox", formSubmitMeta: value === null || value === void 0 ? void 0 : value.form_submit_meta }))),
|
|
8229
|
+
React__default.createElement(SubotInlineFooter$1, { onBack: () => onPrev && onPrev(), backProps: { isDisabled: !!(indexNumber === 1) }, nextText: submitButton ? submitButton === null || submitButton === void 0 ? void 0 : submitButton.label : '', onNext: handleOnNext })));
|
|
8230
|
+
};
|
|
8231
|
+
|
|
8232
|
+
const OTPInfoForm = ({ className, style, actions, countryCode, phoneNumber, areaCode,
|
|
8233
|
+
// verified,
|
|
8234
|
+
callBack, }) => {
|
|
8235
|
+
const countRef = useRef();
|
|
8236
|
+
const [isFinishedCountDown, setIsFinishedCountDown] = useState(false);
|
|
8237
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
8238
|
+
const [isLoadingVerify, setIsLoadingVerify] = useState(false);
|
|
8239
|
+
const [sentOTP, setSentOTP] = useState(false);
|
|
8240
|
+
const { register, formState: { errors }, control, trigger, getValues, setValue, } = useForm();
|
|
8241
|
+
const { formatMessage: f, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
|
|
8242
|
+
// useEffect(() => {
|
|
8243
|
+
// const actionPhone = actions.find(
|
|
8244
|
+
// (action) => action.type === NodeActionType.USER_SUBMIT_PHONE,
|
|
8245
|
+
// )
|
|
8246
|
+
// actionPhone?.key && setValue(actionPhone.key, '+84343261825')
|
|
8247
|
+
// setSentOTP(true)
|
|
8248
|
+
// }, [])
|
|
8249
|
+
// const placeholderPhone = useMemo(() => {
|
|
8250
|
+
// return actions.find(({ type }) => type === NodeActionType.USER_SUBMIT_PHONE)
|
|
8251
|
+
// ?.label
|
|
8252
|
+
// }, [actions])
|
|
8253
|
+
// const placeholderOtp = useMemo(() => {
|
|
8254
|
+
// return actions.find(
|
|
8255
|
+
// ({ type }) => type === NodeActionType.USER_SUBMIT_NUMBER,
|
|
8256
|
+
// )?.label
|
|
8257
|
+
// }, [actions])
|
|
8258
|
+
// const labelBtnSendOtp = 'Gửi mã OTP'
|
|
8259
|
+
// const labelBtnVerifyOtp = useMemo(() => {
|
|
8260
|
+
// return (
|
|
8261
|
+
// actions.find(({ type }) => type === NodeActionType.USER_SUBMIT_SEND)
|
|
8262
|
+
// ?.label || 'Xác minh mã OTP'
|
|
8263
|
+
// )
|
|
8264
|
+
// }, [actions])
|
|
8265
|
+
// const labelBtnResendOtp = useMemo(() => {
|
|
8266
|
+
// return (
|
|
8267
|
+
// actions.find(({ type }) => type === NodeActionType.USER_SUBMIT_RESEND)
|
|
8268
|
+
// ?.label || 'Gửi lại mã OTP'
|
|
8269
|
+
// )
|
|
8270
|
+
// }, [actions])
|
|
8271
|
+
const handleSendOTP = (event) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8272
|
+
var _a;
|
|
8273
|
+
event.preventDefault();
|
|
8274
|
+
const data = getValues();
|
|
8275
|
+
const parsedPhone = parsePhoneNumber(data.phone || '');
|
|
8276
|
+
if (!(parsedPhone === null || parsedPhone === void 0 ? void 0 : parsedPhone.nationalNumber) || !(parsedPhone === null || parsedPhone === void 0 ? void 0 : parsedPhone.countryCallingCode)) {
|
|
8277
|
+
return;
|
|
8278
|
+
}
|
|
8279
|
+
setIsLoading(true);
|
|
8280
|
+
try {
|
|
8281
|
+
const result = yield callApi(getSubotApiPath(PATHS$1.POST_SEND_OTP), 'POST', {
|
|
8282
|
+
data: {
|
|
8283
|
+
phone_number: parsedPhone.nationalNumber,
|
|
8284
|
+
area_code: `+${parsedPhone.countryCallingCode}`,
|
|
8285
|
+
},
|
|
8286
|
+
});
|
|
8287
|
+
setIsLoading(false);
|
|
8288
|
+
if ((result === null || result === void 0 ? void 0 : result._status) === 1) {
|
|
8289
|
+
if (sentOTP) {
|
|
8290
|
+
setIsFinishedCountDown(false);
|
|
8291
|
+
countRef.current.reset();
|
|
8292
|
+
}
|
|
8293
|
+
setSentOTP(true);
|
|
8294
|
+
setTimeout(() => {
|
|
8295
|
+
const input = document.querySelector('.input-otp-code');
|
|
8296
|
+
if (input) {
|
|
8297
|
+
input.focus();
|
|
8298
|
+
input.scrollIntoView({ block: 'center' });
|
|
8299
|
+
}
|
|
8300
|
+
}, 100);
|
|
8301
|
+
return;
|
|
8302
|
+
}
|
|
8303
|
+
if ((result === null || result === void 0 ? void 0 : result._status) === 0 &&
|
|
8304
|
+
((_a = result === null || result === void 0 ? void 0 : result._messages) === null || _a === void 0 ? void 0 : _a[0]) === 'This phone number was verified') {
|
|
8305
|
+
// const { _messages } = result
|
|
8306
|
+
if (countRef.current) {
|
|
8307
|
+
countRef.current.cancel();
|
|
8308
|
+
}
|
|
8309
|
+
pushNotifications({
|
|
8310
|
+
title: '',
|
|
8311
|
+
message: 'Số điện thoại này đã được xác minh.',
|
|
8312
|
+
type: 'success',
|
|
8313
|
+
});
|
|
8314
|
+
const action = actions.find((action) => action.type === NodeActionType.USER_SUBMIT_SEND);
|
|
8315
|
+
action && callBack(action, data.phone);
|
|
8316
|
+
return;
|
|
8317
|
+
}
|
|
8318
|
+
throw new Error();
|
|
8319
|
+
}
|
|
8320
|
+
catch (error) {
|
|
8321
|
+
setIsLoading(false);
|
|
8322
|
+
if (countRef.current) {
|
|
8323
|
+
countRef.current.cancel();
|
|
8324
|
+
}
|
|
8325
|
+
showMessageSomethingWrong();
|
|
8326
|
+
}
|
|
8327
|
+
});
|
|
8328
|
+
const handleOnVerify = (event, action) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8329
|
+
event.preventDefault();
|
|
8330
|
+
setIsLoadingVerify(true);
|
|
8331
|
+
yield trigger();
|
|
8332
|
+
if (isEmpty(errors)) {
|
|
8333
|
+
const data = getValues();
|
|
8334
|
+
const { number } = data;
|
|
8335
|
+
const parsedPhone = parsePhoneNumber(data.phone || '');
|
|
8336
|
+
if (!(parsedPhone === null || parsedPhone === void 0 ? void 0 : parsedPhone.nationalNumber) || !(parsedPhone === null || parsedPhone === void 0 ? void 0 : parsedPhone.countryCallingCode)) {
|
|
8337
|
+
return;
|
|
8338
|
+
}
|
|
8339
|
+
try {
|
|
8340
|
+
const result = yield callApi(getSubotApiPath(PATHS$1.POST_VERIFY_OTP), 'POST', {
|
|
8341
|
+
data: {
|
|
8342
|
+
phone_number: parsedPhone.nationalNumber,
|
|
8343
|
+
area_code: `+${parsedPhone.countryCallingCode}`,
|
|
8344
|
+
code: number,
|
|
8345
|
+
},
|
|
8346
|
+
});
|
|
8347
|
+
setIsLoadingVerify(false);
|
|
8348
|
+
if ((result === null || result === void 0 ? void 0 : result._status) === 1) {
|
|
8349
|
+
pushNotifications({
|
|
8350
|
+
title: '',
|
|
8351
|
+
message: f({ id: 'subot.verifyOTP.success.message' }),
|
|
8352
|
+
type: 'success',
|
|
8353
|
+
});
|
|
8354
|
+
callBack(action, data.phone);
|
|
8355
|
+
return;
|
|
8356
|
+
}
|
|
8357
|
+
throw new Error();
|
|
8358
|
+
}
|
|
8359
|
+
catch (error) {
|
|
8360
|
+
pushNotifications({
|
|
8361
|
+
title: '',
|
|
8362
|
+
message: f({ id: 'validation.error.validOTP' }),
|
|
8363
|
+
type: 'danger',
|
|
8364
|
+
});
|
|
8365
|
+
setIsLoadingVerify(false);
|
|
8366
|
+
}
|
|
8367
|
+
}
|
|
8368
|
+
else {
|
|
8369
|
+
setIsLoadingVerify(false);
|
|
8370
|
+
}
|
|
8371
|
+
});
|
|
8372
|
+
const showMessageSomethingWrong = () => {
|
|
8373
|
+
pushNotifications({
|
|
8374
|
+
title: '',
|
|
8375
|
+
message: f({ id: 'notification.comment.somethingWrong' }),
|
|
8376
|
+
type: 'danger',
|
|
8377
|
+
});
|
|
8378
|
+
};
|
|
8379
|
+
const renderFormInput = (action) => {
|
|
8380
|
+
if (!action.key) {
|
|
8381
|
+
return null;
|
|
8382
|
+
}
|
|
8383
|
+
switch (action.type) {
|
|
8384
|
+
case NodeActionType.USER_SUBMIT_PHONE:
|
|
8385
|
+
return (React__default.createElement("div", { className: "input-row", key: action.id },
|
|
8386
|
+
React__default.createElement("label", { htmlFor: action.key }, action.label),
|
|
8387
|
+
React__default.createElement(Controller, { name: action.key, control: control, rules: {
|
|
8388
|
+
required: true,
|
|
8389
|
+
validate: (value) => isPossiblePhoneNumber(value),
|
|
8390
|
+
}, render: ({ field: { onChange, value } }) => {
|
|
8391
|
+
const disabledPhone = (!isFinishedCountDown && sentOTP) || isLoading;
|
|
8392
|
+
return (React__default.createElement(StyleWrapperPhoneInput, null,
|
|
8393
|
+
React__default.createElement(PhoneInputWithCode, { value: value, defaultValue: phoneNumber, onChange: onChange, defaultCountry: countryCode, id: action.id, className: `input-row ${action.id}`, name: action.key, disabled: disabledPhone, flagComponent: FlagComponent, placeholder: action.label }),
|
|
8394
|
+
disabledPhone && (React__default.createElement(IconEdit, { viewBox: "0 0 24 24", className: "icon-edit-phone", onClick: () => {
|
|
8395
|
+
var _a;
|
|
8396
|
+
onChange('');
|
|
8397
|
+
setSentOTP(false);
|
|
8398
|
+
setIsLoadingVerify(false);
|
|
8399
|
+
(_a = countRef.current) === null || _a === void 0 ? void 0 : _a.cancel();
|
|
8400
|
+
} })),
|
|
8401
|
+
action.key && errors[action.key] && (React__default.createElement("p", { className: "error-message" }, f({
|
|
8402
|
+
id: 'validation.error.validNumber',
|
|
8403
|
+
defaultMessage: 'Please enter a valid number.',
|
|
8404
|
+
}))),
|
|
8405
|
+
React__default.createElement("div", { className: "submit-btn-row", key: action.id },
|
|
8406
|
+
React__default.createElement(Button$1, { className: "submit-btn", size: "lg", onClick: handleSendOTP, isDisabled: (!isFinishedCountDown && sentOTP) || isLoading, isLoading: isLoading }, sentOTP ? (React__default.createElement(CountDown$1, { ref: countRef, isFinished: isFinishedCountDown, onFinish: setIsFinishedCountDown })) : (React__default.createElement("span", null, f({
|
|
8407
|
+
id: 'subot.sendOTP.button',
|
|
8408
|
+
defaultMessage: 'Send OTP',
|
|
8409
|
+
})))))));
|
|
8410
|
+
} })));
|
|
8411
|
+
case NodeActionType.USER_SUBMIT_NUMBER:
|
|
8412
|
+
if (!sentOTP) {
|
|
8413
|
+
return '';
|
|
8414
|
+
}
|
|
8415
|
+
return (React__default.createElement("div", { className: "input-row", key: action.id },
|
|
8416
|
+
React__default.createElement("label", { htmlFor: action.key }, action.label),
|
|
8417
|
+
React__default.createElement("input", Object.assign({ type: "tel", id: action.id, placeholder: action.label }, register(action.key, {
|
|
8418
|
+
required: true,
|
|
8419
|
+
pattern: /^[0-9]{0,6}$/,
|
|
8420
|
+
}), { className: "input-otp-code" })),
|
|
8421
|
+
errors[action.key] && (React__default.createElement("p", { className: "error-message" }, f({
|
|
8422
|
+
id: 'validation.error.validOTP',
|
|
8423
|
+
defaultMessage: 'Invalid OTP provided',
|
|
8424
|
+
})))));
|
|
8425
|
+
default:
|
|
8426
|
+
return '';
|
|
8427
|
+
}
|
|
8428
|
+
};
|
|
8429
|
+
const renderFormSubmitAndTerms = (action) => {
|
|
8430
|
+
switch (action.type) {
|
|
8431
|
+
case NodeActionType.USER_SUBMIT_SEND:
|
|
8432
|
+
if (!sentOTP)
|
|
8433
|
+
return '';
|
|
8434
|
+
return (React__default.createElement("div", { className: "submit-btn-row", key: action.id },
|
|
8435
|
+
React__default.createElement(Button$1, { className: "submit-btn", size: "lg", isDisabled: isLoadingVerify, isLoading: isLoadingVerify, onClick: (event) => handleOnVerify(event, action) }, action.label)));
|
|
8436
|
+
default:
|
|
8437
|
+
return '';
|
|
8438
|
+
}
|
|
8439
|
+
};
|
|
8440
|
+
useEffect(() => {
|
|
8441
|
+
if (phoneNumber) {
|
|
8442
|
+
const action = actions.find((action) => action.type === NodeActionType.USER_SUBMIT_PHONE);
|
|
8443
|
+
if (action && action.key) {
|
|
8444
|
+
setValue(action.key, `+${areaCode}${phoneNumber}`);
|
|
8445
|
+
}
|
|
8446
|
+
}
|
|
8447
|
+
}, [phoneNumber, areaCode]);
|
|
8448
|
+
return (React__default.createElement(StyledUserInfoFormContainer$1, { className: className, style: style },
|
|
8449
|
+
React__default.createElement("form", { className: "user-info-form" },
|
|
8450
|
+
actions.map((action) => renderFormInput(action)),
|
|
8451
|
+
actions.map((action) => renderFormSubmitAndTerms(action)))));
|
|
8452
|
+
};
|
|
8453
|
+
|
|
8454
|
+
const useVerifyPhoneNumber = () => {
|
|
8455
|
+
const userInfo = GlobalData === null || GlobalData === void 0 ? void 0 : GlobalData.userInfo;
|
|
8456
|
+
const [verifiedPhone, setVerifiedPhone] = useState(false);
|
|
8457
|
+
useEffect(() => {
|
|
8458
|
+
if (userInfo === null || userInfo === void 0 ? void 0 : userInfo.phone) {
|
|
8459
|
+
if (userInfo.phone_verified_at && userInfo.verify_phone_code) {
|
|
8460
|
+
setVerifiedPhone(true);
|
|
8461
|
+
}
|
|
8462
|
+
}
|
|
8463
|
+
}, [userInfo]);
|
|
8464
|
+
return verifiedPhone;
|
|
8465
|
+
};
|
|
8466
|
+
|
|
8467
|
+
const SubotInlineNodeOTP = ({ node, indexNumber, }) => {
|
|
8468
|
+
const { params, onPrev, onNext } = useContext(SubotInlineContext);
|
|
8469
|
+
const userInfo = GlobalData === null || GlobalData === void 0 ? void 0 : GlobalData.userInfo;
|
|
8470
|
+
const locale = GlobalData === null || GlobalData === void 0 ? void 0 : GlobalData.locale;
|
|
8471
|
+
const [value, setValue] = useState((node === null || node === void 0 ? void 0 : node._message) || {});
|
|
8472
|
+
const verifiedPhone = useVerifyPhoneNumber();
|
|
8473
|
+
const handleOnVerify = (action, phoneNumber) => {
|
|
8474
|
+
var _a;
|
|
8475
|
+
const actionPhone = (_a = node === null || node === void 0 ? void 0 : node.actions) === null || _a === void 0 ? void 0 : _a.find(({ type }) => type === NodeActionType.USER_SUBMIT_PHONE);
|
|
8476
|
+
if (!action || !actionPhone) {
|
|
8477
|
+
return;
|
|
8478
|
+
}
|
|
8479
|
+
const form_submit_meta = [
|
|
8480
|
+
{
|
|
8481
|
+
key: String(actionPhone.key),
|
|
8482
|
+
control: ELEMENT_CONTROL_INPUT_TYPE[NodeActionType.USER_SUBMIT_PHONE],
|
|
8483
|
+
value: phoneNumber,
|
|
8484
|
+
},
|
|
8485
|
+
];
|
|
8486
|
+
const newValue = Object.assign(Object.assign({}, value), { form_submit_meta, action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key });
|
|
8487
|
+
setValue(newValue);
|
|
8488
|
+
onNext && onNext(Object.assign(Object.assign(Object.assign({}, params), newValue), node === null || node === void 0 ? void 0 : node._message));
|
|
8489
|
+
};
|
|
8490
|
+
return (React__default.createElement(SubotInlineContainer$1, null,
|
|
8491
|
+
React__default.createElement(SubotInlineHeader$1, null),
|
|
8492
|
+
React__default.createElement(SubotInlineWrapper$1, null,
|
|
8493
|
+
React__default.createElement(SubotInlineIntentContainer, null,
|
|
8494
|
+
React__default.createElement(SubotInlineIntent, { intents: (node === null || node === void 0 ? void 0 : node.intents) || [], indexNumber: indexNumber })),
|
|
8495
|
+
React__default.createElement(SubotInlineActionContainer, null,
|
|
8496
|
+
React__default.createElement(OTPInfoForm, { phoneNumber: userInfo === null || userInfo === void 0 ? void 0 : userInfo.phone, verified: verifiedPhone, areaCode: userInfo === null || userInfo === void 0 ? void 0 : userInfo.area_code, callBack: handleOnVerify, actions: (node === null || node === void 0 ? void 0 : node.actions) || [], countryCode: (locale === null || locale === void 0 ? void 0 : locale.split('-')[1]) || 'PH' }))),
|
|
8497
|
+
React__default.createElement(SubotInlineFooter$1, { onBack: () => onPrev && onPrev(), backProps: { isDisabled: !!(indexNumber === 1) }, hideNext: true })));
|
|
8498
|
+
};
|
|
8499
|
+
|
|
8500
|
+
// Poll Message
|
|
8501
|
+
// {
|
|
8502
|
+
// form_meta: [
|
|
8503
|
+
// { key: "poll4", control: "formmeta", value: "", action_id: "action.id" },
|
|
8504
|
+
// { key: "poll2", control: "formmeta", value: "", action_id: "action.id" },
|
|
8505
|
+
// { key: "poll3", control: "formmeta", value: "", action_id: "action.id" },
|
|
8506
|
+
// { key: 'attribite-description', control:"formmeta-description", value: '', action_id: "action.id"}
|
|
8507
|
+
// ],
|
|
8508
|
+
// action_id: "button_id",
|
|
8509
|
+
// action_value: "button_attribute"
|
|
8510
|
+
// }
|
|
8511
|
+
const SubotInlineNodePoll = ({ node, indexNumber, }) => {
|
|
8512
|
+
var _a, _b;
|
|
8513
|
+
const { params, onChange, onPrev, onNext } = useContext(SubotInlineContext);
|
|
8514
|
+
const [value, setValue] = useState((node === null || node === void 0 ? void 0 : node._message) || {});
|
|
8515
|
+
const validation = useValidationMultiOption();
|
|
8516
|
+
const descriptionNode = useDescriptionPollNode({ node });
|
|
8517
|
+
const submitButton = useMemo(() => {
|
|
8518
|
+
var _a;
|
|
8519
|
+
const _submitButton = (_a = node === null || node === void 0 ? void 0 : node.actions) === null || _a === void 0 ? void 0 : _a.find(({ type }) => type == NodeActionType.POLL_BUTTON);
|
|
8520
|
+
if (_submitButton)
|
|
8521
|
+
return _submitButton;
|
|
8522
|
+
return null;
|
|
8523
|
+
}, [node === null || node === void 0 ? void 0 : node.actions]);
|
|
8524
|
+
const handleOnChange = (action, formSubmitMeta) => {
|
|
8525
|
+
var _a, _b, _c, _d, _e, _f, _g;
|
|
8526
|
+
const newValue = JSON.parse(JSON.stringify(Object.assign(Object.assign({}, value), { node_id: node.id, action_id: submitButton === null || submitButton === void 0 ? void 0 : submitButton.id, action_value: submitButton === null || submitButton === void 0 ? void 0 : submitButton.key, form_submit_meta: [...((value === null || value === void 0 ? void 0 : value.form_submit_meta) || [])] })));
|
|
8527
|
+
if ((action === null || action === void 0 ? void 0 : action.type) === NodeActionType.POLL_CHOICE_TEXT_BY_INPUT ||
|
|
8528
|
+
(action === null || action === void 0 ? void 0 : action.type) === NodeActionType.USER_CHOICE_TEXT_BY_INPUT) {
|
|
8529
|
+
const isExistedPoll = (_a = newValue.form_submit_meta) === null || _a === void 0 ? void 0 : _a.some(({ action_id }) => action_id === action.id);
|
|
8530
|
+
if (isExistedPoll) {
|
|
8531
|
+
newValue.form_submit_meta =
|
|
8532
|
+
typeof formSubmitMeta === 'undefined'
|
|
8533
|
+
? (_b = newValue.form_submit_meta) === null || _b === void 0 ? void 0 : _b.filter(({ action_id }) => action_id !== action.id)
|
|
8534
|
+
: (_c = newValue.form_submit_meta) === null || _c === void 0 ? void 0 : _c.filter(({ action_id }) => action_id !== action.id).concat(formSubmitMeta);
|
|
8535
|
+
}
|
|
8536
|
+
else {
|
|
8537
|
+
newValue.form_submit_meta = (_d = newValue.form_submit_meta) === null || _d === void 0 ? void 0 : _d.concat([
|
|
8538
|
+
{
|
|
8539
|
+
key: action === null || action === void 0 ? void 0 : action.key,
|
|
8540
|
+
control: ELEMENT_CONTROL_INPUT_TYPE[action === null || action === void 0 ? void 0 : action.type] || 'text',
|
|
8541
|
+
value: '',
|
|
8542
|
+
action_id: action === null || action === void 0 ? void 0 : action.id,
|
|
8543
|
+
},
|
|
8544
|
+
]);
|
|
8545
|
+
}
|
|
8546
|
+
setValue(newValue);
|
|
8547
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
8548
|
+
return;
|
|
8549
|
+
}
|
|
8550
|
+
const isPoll = (_e = newValue.form_submit_meta) === null || _e === void 0 ? void 0 : _e.some(({ action_id }) => action_id === (action === null || action === void 0 ? void 0 : action.action_id));
|
|
8551
|
+
if (isPoll) {
|
|
8552
|
+
newValue.form_submit_meta = (_f = newValue.form_submit_meta) === null || _f === void 0 ? void 0 : _f.filter(({ action_id }) => action_id !== (action === null || action === void 0 ? void 0 : action.action_id));
|
|
8553
|
+
}
|
|
8554
|
+
else {
|
|
8555
|
+
newValue.form_submit_meta = (_g = newValue.form_submit_meta) === null || _g === void 0 ? void 0 : _g.concat([action]);
|
|
8556
|
+
}
|
|
8557
|
+
setValue(newValue);
|
|
8558
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
8559
|
+
};
|
|
8560
|
+
const activeActions = useMemo(() => {
|
|
8561
|
+
if (value === null || value === void 0 ? void 0 : value.form_submit_meta) {
|
|
8562
|
+
return value === null || value === void 0 ? void 0 : value.form_submit_meta.map(({ action_id }) => action_id);
|
|
8563
|
+
}
|
|
8564
|
+
return [];
|
|
8565
|
+
}, [value, value === null || value === void 0 ? void 0 : value.form_submit_meta]);
|
|
8566
|
+
const handleOnNext = () => {
|
|
8567
|
+
const tmp = {};
|
|
8568
|
+
if (value.form_submit_meta && value.form_submit_meta.length) {
|
|
8569
|
+
tmp[node.id] = value.form_submit_meta.map((_v) => _v.action_id);
|
|
8570
|
+
}
|
|
8571
|
+
const newValue = Object.assign(Object.assign({}, value), { current_polls: tmp });
|
|
8572
|
+
validation.validateSelectActions(activeActions, node, () => {
|
|
8573
|
+
onNext && onNext(Object.assign(Object.assign(Object.assign({}, params), node === null || node === void 0 ? void 0 : node._message), newValue));
|
|
8574
|
+
});
|
|
8575
|
+
};
|
|
8576
|
+
return (React__default.createElement(SubotInlineContainer$1, null,
|
|
8577
|
+
React__default.createElement(SubotInlineHeader$1, null),
|
|
8578
|
+
React__default.createElement(SubotInlineWrapper$1, null,
|
|
8579
|
+
React__default.createElement(SubotInlineIntentContainer, null,
|
|
8580
|
+
React__default.createElement(SubotInlineIntent, { intents: (node === null || node === void 0 ? void 0 : node.intents) || [], indexNumber: indexNumber })),
|
|
8581
|
+
React__default.createElement(SubotInlineDescription$1, null, descriptionNode),
|
|
8582
|
+
React__default.createElement(SubotInlineActionContainer, null, (node === null || node === void 0 ? void 0 : node.actions) && !!((_a = node.actions) === null || _a === void 0 ? void 0 : _a.length) && (React__default.createElement(SubotInlineActionListContainer, null, (_b = node === null || node === void 0 ? void 0 : node.actions.filter(({ type }) => type !== NodeActionType.POLL_BUTTON)) === null || _b === void 0 ? void 0 : _b.map((action) => {
|
|
8583
|
+
const NodeAction = SubotInlineActionBase[action === null || action === void 0 ? void 0 : action.type];
|
|
8584
|
+
return (NodeAction && (React__default.createElement(NodeAction, { key: action.id, active: activeActions.includes(action.id), action: action, onChange: handleOnChange, htmlType: "checkbox", formSubmitMeta: value === null || value === void 0 ? void 0 : value.form_submit_meta })));
|
|
8585
|
+
}))))),
|
|
8586
|
+
React__default.createElement(SubotInlineFooter$1, { onBack: () => onPrev && onPrev(), backProps: { isDisabled: !!(indexNumber === 1) }, nextText: submitButton ? submitButton === null || submitButton === void 0 ? void 0 : submitButton.label : '', onNext: handleOnNext })));
|
|
8587
|
+
};
|
|
8588
|
+
|
|
8589
|
+
// Rating Message
|
|
8590
|
+
// {
|
|
8591
|
+
// form_meta: [
|
|
8592
|
+
// { key: "action.key", control: "star", value: "", action_id: 'action.id' },
|
|
8593
|
+
// { key: 'action.key', control: "text", value: '', action_id: 'action.id' }
|
|
8594
|
+
// ],
|
|
8595
|
+
// action_id: "button_id",
|
|
8596
|
+
// action_value: "button_attribute"
|
|
8597
|
+
// }
|
|
8598
|
+
const SubotInlineNodeRating = ({ node, indexNumber, }) => {
|
|
8599
|
+
var _a, _b;
|
|
8600
|
+
const { formatMessage: f, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
|
|
8601
|
+
const { params, onChange, onSubmit, onPrev, onNext } = useContext(SubotInlineContext);
|
|
8602
|
+
const [value, setValue] = useState((node === null || node === void 0 ? void 0 : node._message) || {});
|
|
8603
|
+
const [isSubmit, setIsSubmit] = useState(false);
|
|
8604
|
+
const ratingStarValue = useMemo(() => {
|
|
8605
|
+
var _a;
|
|
8606
|
+
const _ratingStar = (_a = node === null || node === void 0 ? void 0 : node.actions) === null || _a === void 0 ? void 0 : _a.find(({ type }) => type === NodeActionType.RATING_STAR);
|
|
8607
|
+
if (value.form_submit_meta && _ratingStar) {
|
|
8608
|
+
const formIndex = value === null || value === void 0 ? void 0 : value.form_submit_meta.findIndex(({ action_id }) => action_id === (_ratingStar === null || _ratingStar === void 0 ? void 0 : _ratingStar.id));
|
|
8609
|
+
if (formIndex !== -1)
|
|
8610
|
+
return parseInt(value === null || value === void 0 ? void 0 : value.form_submit_meta[formIndex].value);
|
|
8611
|
+
}
|
|
8612
|
+
return 0;
|
|
8613
|
+
}, [value === null || value === void 0 ? void 0 : value.form_submit_meta]);
|
|
8614
|
+
const submitButton = useMemo(() => {
|
|
8615
|
+
var _a;
|
|
8616
|
+
const _submitButton = (_a = node === null || node === void 0 ? void 0 : node.actions) === null || _a === void 0 ? void 0 : _a.find(({ type }) => type == NodeActionType.RATING_BUTTON);
|
|
8617
|
+
if (_submitButton)
|
|
8618
|
+
return _submitButton;
|
|
8619
|
+
return null;
|
|
8620
|
+
}, []);
|
|
8621
|
+
const handleOnChange = (formValue) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8622
|
+
if (formValue) {
|
|
8623
|
+
const _message = Object.assign(Object.assign(Object.assign({}, params), value), { node_id: node.id, action_id: submitButton === null || submitButton === void 0 ? void 0 : submitButton.id, action_value: submitButton === null || submitButton === void 0 ? void 0 : submitButton.key, form_submit_meta: (value === null || value === void 0 ? void 0 : value.form_submit_meta)
|
|
8624
|
+
? [...value === null || value === void 0 ? void 0 : value.form_submit_meta]
|
|
8625
|
+
: [] });
|
|
8626
|
+
const tmpFormSubmitMeta = [
|
|
8627
|
+
..._message === null || _message === void 0 ? void 0 : _message.form_submit_meta,
|
|
8628
|
+
];
|
|
8629
|
+
const formUpdateIndex = tmpFormSubmitMeta.findIndex(({ action_id }) => action_id === formValue.action_id);
|
|
8630
|
+
if (formUpdateIndex !== -1)
|
|
8631
|
+
tmpFormSubmitMeta[formUpdateIndex] = Object.assign({}, formValue);
|
|
8632
|
+
else
|
|
8633
|
+
tmpFormSubmitMeta.push(formValue);
|
|
8634
|
+
_message.form_submit_meta = [...tmpFormSubmitMeta];
|
|
8635
|
+
setValue(_message);
|
|
8636
|
+
onChange && onChange(_message);
|
|
8637
|
+
}
|
|
8638
|
+
});
|
|
8639
|
+
const handleOnNext = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
8640
|
+
if (!value.form_submit_meta || ratingStarValue === 0) {
|
|
8641
|
+
pushNotifications({
|
|
8642
|
+
title: '',
|
|
8643
|
+
message: f({
|
|
8644
|
+
id: 'multiSelectError.required',
|
|
8645
|
+
defaultMessage: `There is no answer!`,
|
|
8646
|
+
}),
|
|
8647
|
+
type: 'warning', // "success" | "danger" | "info" | "warning"
|
|
8648
|
+
});
|
|
8649
|
+
return;
|
|
8650
|
+
}
|
|
8651
|
+
if (!isSubmit) {
|
|
8652
|
+
const _message = Object.assign(Object.assign(Object.assign({}, params), node === null || node === void 0 ? void 0 : node._message), value);
|
|
8653
|
+
const res = yield subotInlineMessage(_message);
|
|
8654
|
+
if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
|
|
8655
|
+
const _c = res === null || res === void 0 ? void 0 : res._data, { node: _node } = _c, restData = __rest(_c, ["node"]);
|
|
8656
|
+
const _nextNode = Object.assign(Object.assign({}, _node), { _message: Object.assign(Object.assign({}, restData), { node_id: _node.id }) });
|
|
8657
|
+
onSubmit && onSubmit(_nextNode, _message);
|
|
8658
|
+
setIsSubmit(true);
|
|
8659
|
+
}
|
|
8660
|
+
}
|
|
8661
|
+
else {
|
|
8662
|
+
onNext && onNext(Object.assign(Object.assign(Object.assign({}, params), value), node === null || node === void 0 ? void 0 : node._message));
|
|
8663
|
+
}
|
|
8664
|
+
});
|
|
8665
|
+
return (React__default.createElement(SubotInlineContainer$1, null,
|
|
8666
|
+
React__default.createElement(SubotInlineHeader$1, null),
|
|
8667
|
+
React__default.createElement(SubotInlineWrapper$1, null,
|
|
8668
|
+
React__default.createElement(SubotInlineIntentContainer, null,
|
|
8669
|
+
React__default.createElement(SubotInlineIntent, { intents: (node === null || node === void 0 ? void 0 : node.intents) || [], indexNumber: indexNumber })),
|
|
8670
|
+
React__default.createElement(SubotInlineActionContainer, null, (node === null || node === void 0 ? void 0 : node.actions) && !!((_a = node.actions) === null || _a === void 0 ? void 0 : _a.length) && (React__default.createElement(SubotInlineActionListContainer, null, (_b = node === null || node === void 0 ? void 0 : node.actions.filter(({ type }) => type !== NodeActionType.RATING_BUTTON)) === null || _b === void 0 ? void 0 : _b.map((action) => {
|
|
8671
|
+
var _a;
|
|
8672
|
+
const NodeAction = SubotInlineActionBase[action === null || action === void 0 ? void 0 : action.type];
|
|
8673
|
+
return (NodeAction && (React__default.createElement(NodeAction, { key: action.id, action: action, onChange: handleOnChange, value: (value &&
|
|
8674
|
+
(value === null || value === void 0 ? void 0 : value.form_submit_meta) &&
|
|
8675
|
+
((_a = value.form_submit_meta) === null || _a === void 0 ? void 0 : _a.find(({ action_id }) => action_id === action.id))) })));
|
|
8676
|
+
}))))),
|
|
8677
|
+
React__default.createElement(SubotInlineFooter$1, { onBack: () => onPrev && onPrev(), backProps: { isDisabled: !!(indexNumber === 1) }, nextText: submitButton ? submitButton === null || submitButton === void 0 ? void 0 : submitButton.label : '', onNext: handleOnNext })));
|
|
8678
|
+
};
|
|
8679
|
+
|
|
8680
|
+
const SubotInlineNodeReaction = ({ node, indexNumber, }) => {
|
|
8681
|
+
const { formatMessage: f, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
|
|
8682
|
+
const { params, onSubmit, onPrev, onNext } = useContext(SubotInlineContext);
|
|
8683
|
+
const [value, setValue] = useState((node === null || node === void 0 ? void 0 : node._message) || {});
|
|
8684
|
+
const handleOnChange = (action) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8685
|
+
if (action) {
|
|
8686
|
+
setValue(Object.assign(Object.assign({}, value), { action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key }));
|
|
8687
|
+
const _message = Object.assign(Object.assign(Object.assign({}, params), value), { node_id: node.id, action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key });
|
|
8688
|
+
const res = yield subotInlineMessage(_message);
|
|
8689
|
+
if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
|
|
8690
|
+
const _a = res === null || res === void 0 ? void 0 : res._data, { node: _node } = _a, restData = __rest(_a, ["node"]);
|
|
8691
|
+
const _nextNode = Object.assign(Object.assign({}, _node), { _message: Object.assign(Object.assign({}, restData), { node_id: _node.id }) });
|
|
8692
|
+
onSubmit && onSubmit(_nextNode, _message);
|
|
8693
|
+
}
|
|
8694
|
+
}
|
|
8695
|
+
});
|
|
8696
|
+
const handleOnNext = () => {
|
|
8697
|
+
var _a;
|
|
8698
|
+
if (!(node === null || node === void 0 ? void 0 : node._message) || !((_a = node._message) === null || _a === void 0 ? void 0 : _a.action_id)) {
|
|
8699
|
+
pushNotifications({
|
|
8700
|
+
title: '',
|
|
8701
|
+
message: f({
|
|
8702
|
+
id: 'multiSelectError.required',
|
|
8703
|
+
defaultMessage: `There is no answer!`,
|
|
8704
|
+
}),
|
|
8705
|
+
type: 'warning', // "success" | "danger" | "info" | "warning"
|
|
8706
|
+
});
|
|
8707
|
+
}
|
|
8708
|
+
else {
|
|
8709
|
+
onNext && onNext(Object.assign(Object.assign(Object.assign({}, params), value), node === null || node === void 0 ? void 0 : node._message));
|
|
8710
|
+
}
|
|
8711
|
+
};
|
|
8712
|
+
return (React__default.createElement(SubotInlineContainer$1, null,
|
|
8713
|
+
React__default.createElement(SubotInlineHeader$1, null),
|
|
8714
|
+
React__default.createElement(SubotInlineWrapper$1, null,
|
|
8715
|
+
React__default.createElement(SubotInlineIntentContainer, null,
|
|
8716
|
+
React__default.createElement(SubotInlineIntent, { intents: (node === null || node === void 0 ? void 0 : node.intents) || [], indexNumber: indexNumber })),
|
|
8717
|
+
React__default.createElement(SubotInlineActionContainer, null,
|
|
8718
|
+
React__default.createElement(SubotInlineAction, { value: (value === null || value === void 0 ? void 0 : value.action_id) ? [value === null || value === void 0 ? void 0 : value.action_id] : [], actions: (node === null || node === void 0 ? void 0 : node.actions) || [], onChange: handleOnChange }))),
|
|
8719
|
+
React__default.createElement(SubotInlineFooter$1, { onBack: () => onPrev && onPrev(), backProps: { isDisabled: !!(indexNumber === 1) }, onNext: handleOnNext })));
|
|
8720
|
+
};
|
|
8721
|
+
|
|
8722
|
+
const SubotInlineNodeResultPoll = ({ node, }) => {
|
|
8723
|
+
var _a, _b;
|
|
8724
|
+
return (React__default.createElement(SubotInlineContainer$1, null,
|
|
8725
|
+
React__default.createElement(SubotInlineHeader$1, null),
|
|
8726
|
+
React__default.createElement(SubotInlineWrapper$1, null,
|
|
8727
|
+
React__default.createElement(SubotInlineIntentContainer, null,
|
|
8728
|
+
React__default.createElement(SubotInlineIntent, { intents: (node === null || node === void 0 ? void 0 : node.intents) || [] })),
|
|
8729
|
+
React__default.createElement(SubotInlineActionContainer, null, (node === null || node === void 0 ? void 0 : node.actions) && !!((_a = node.actions) === null || _a === void 0 ? void 0 : _a.length) && (React__default.createElement(SubotInlineActionListContainer, null, (_b = node === null || node === void 0 ? void 0 : node.actions.filter(({ type }) => type !== NodeActionType.POLL_BUTTON)) === null || _b === void 0 ? void 0 : _b.map((action) => {
|
|
8730
|
+
const NodeAction = SubotInlineActionBase[action === null || action === void 0 ? void 0 : action.type];
|
|
8731
|
+
return (NodeAction && (React__default.createElement(NodeAction, { key: action.id, action: action, htmlType: "checkbox", node_type: node === null || node === void 0 ? void 0 : node.type })));
|
|
8732
|
+
})))))));
|
|
8733
|
+
};
|
|
8734
|
+
|
|
8735
|
+
// Review Message
|
|
8736
|
+
// {
|
|
8737
|
+
// form_meta: [
|
|
8738
|
+
// { key: "review1", control: "formmeta", value: '', action_id: "action.id" },
|
|
8739
|
+
// { key: "review2", control: "formmeta", value: '', action_id: "action.id" },
|
|
8740
|
+
// { key: "review3", control: "formmeta", value: "" },
|
|
8741
|
+
// { key: "review4", control: "formmeta", value: "" },
|
|
8742
|
+
// { key: "review5", control: "formmeta", value: "" },
|
|
8743
|
+
// {key: 'attribite-description', control:"formmeta-description", value: ''}
|
|
8744
|
+
// ],
|
|
8745
|
+
// action_id: "button_id",
|
|
8746
|
+
// action_value: "button_attribute"
|
|
8747
|
+
// }
|
|
8748
|
+
const SubotInlineNodeReview = ({ node, indexNumber, }) => {
|
|
8749
|
+
const { formatMessage: f, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
|
|
8750
|
+
const { params, onChange, onSubmit, onPrev, onNext } = useContext(SubotInlineContext);
|
|
8751
|
+
const [value, setValue] = useState((node === null || node === void 0 ? void 0 : node._message) || {});
|
|
8752
|
+
const [isSubmit, setIsSubmit] = useState(false);
|
|
8753
|
+
const reviewChoices = useMemo(() => {
|
|
8754
|
+
var _a;
|
|
8755
|
+
return ((_a = node === null || node === void 0 ? void 0 : node.actions) === null || _a === void 0 ? void 0 : _a.filter(({ type }) => type === NodeActionType.REVIEW_CHOICE)) || [];
|
|
8756
|
+
}, [node === null || node === void 0 ? void 0 : node.actions]);
|
|
8757
|
+
const reviewDescriptions = useMemo(() => {
|
|
8758
|
+
var _a;
|
|
8759
|
+
return ((_a = node === null || node === void 0 ? void 0 : node.actions) === null || _a === void 0 ? void 0 : _a.filter(({ type }) => type === NodeActionType.REVIEW_DESCRIPTION)) || [];
|
|
8760
|
+
}, [node === null || node === void 0 ? void 0 : node.actions]);
|
|
8761
|
+
const submitButton = useMemo(() => {
|
|
8762
|
+
var _a;
|
|
8763
|
+
const _submitButton = (_a = node === null || node === void 0 ? void 0 : node.actions) === null || _a === void 0 ? void 0 : _a.find(({ type }) => type == NodeActionType.REVIEW_BUTTON);
|
|
8764
|
+
if (_submitButton)
|
|
8765
|
+
return _submitButton;
|
|
8766
|
+
return null;
|
|
8767
|
+
}, [node === null || node === void 0 ? void 0 : node.actions]);
|
|
8768
|
+
const activeActions = useMemo(() => {
|
|
8769
|
+
if (value === null || value === void 0 ? void 0 : value.form_submit_meta) {
|
|
8770
|
+
return value === null || value === void 0 ? void 0 : value.form_submit_meta.map(({ action_id }) => action_id).filter((action_id) => !!(reviewChoices === null || reviewChoices === void 0 ? void 0 : reviewChoices.map(({ id }) => id).includes(action_id)));
|
|
8771
|
+
}
|
|
8772
|
+
return [];
|
|
8773
|
+
}, [value, value === null || value === void 0 ? void 0 : value.form_submit_meta]);
|
|
8774
|
+
const handleOnClick = (formValue) => {
|
|
8775
|
+
if (formValue) {
|
|
8776
|
+
const _message = Object.assign(Object.assign(Object.assign({}, params), value), { node_id: node.id, action_id: submitButton === null || submitButton === void 0 ? void 0 : submitButton.id, action_value: submitButton === null || submitButton === void 0 ? void 0 : submitButton.key, form_submit_meta: (value === null || value === void 0 ? void 0 : value.form_submit_meta)
|
|
8777
|
+
? [...value === null || value === void 0 ? void 0 : value.form_submit_meta]
|
|
8778
|
+
: [] });
|
|
8779
|
+
let tmpFormSubmitMeta = [
|
|
8780
|
+
..._message === null || _message === void 0 ? void 0 : _message.form_submit_meta,
|
|
8781
|
+
];
|
|
8782
|
+
const formUpdateIndex = tmpFormSubmitMeta.findIndex(({ action_id }) => action_id === formValue.action_id);
|
|
8783
|
+
if (formUpdateIndex !== -1)
|
|
8784
|
+
tmpFormSubmitMeta = [
|
|
8785
|
+
...tmpFormSubmitMeta.slice(0, formUpdateIndex),
|
|
8786
|
+
...tmpFormSubmitMeta.slice(formUpdateIndex + 1),
|
|
8787
|
+
];
|
|
8788
|
+
else
|
|
8789
|
+
tmpFormSubmitMeta.push(formValue);
|
|
8790
|
+
_message.form_submit_meta = [...tmpFormSubmitMeta];
|
|
8791
|
+
setValue(_message);
|
|
8792
|
+
setIsSubmit(false);
|
|
8793
|
+
onChange && onChange(_message);
|
|
8794
|
+
}
|
|
8795
|
+
};
|
|
8796
|
+
const handleOnChange = (formValue) => {
|
|
8797
|
+
if (formValue) {
|
|
8798
|
+
const _message = Object.assign(Object.assign(Object.assign({}, params), value), { node_id: node.id, action_id: submitButton === null || submitButton === void 0 ? void 0 : submitButton.id, action_value: submitButton === null || submitButton === void 0 ? void 0 : submitButton.key, form_submit_meta: (value === null || value === void 0 ? void 0 : value.form_submit_meta)
|
|
8799
|
+
? [...value === null || value === void 0 ? void 0 : value.form_submit_meta]
|
|
8800
|
+
: [] });
|
|
8801
|
+
const tmpFormSubmitMeta = [
|
|
8802
|
+
..._message === null || _message === void 0 ? void 0 : _message.form_submit_meta,
|
|
8803
|
+
];
|
|
8804
|
+
const formUpdateIndex = tmpFormSubmitMeta.findIndex(({ action_id }) => action_id === formValue.action_id);
|
|
8805
|
+
if (formUpdateIndex !== -1)
|
|
8806
|
+
tmpFormSubmitMeta[formUpdateIndex] = Object.assign({}, formValue);
|
|
8807
|
+
else
|
|
8808
|
+
tmpFormSubmitMeta.push(formValue);
|
|
8809
|
+
_message.form_submit_meta = [...tmpFormSubmitMeta];
|
|
8810
|
+
setValue(_message);
|
|
8811
|
+
setIsSubmit(false);
|
|
8812
|
+
onChange && onChange(_message);
|
|
8813
|
+
}
|
|
8814
|
+
};
|
|
8815
|
+
const handleOnNext = () => __awaiter(void 0, void 0, void 0, function* () {
|
|
8816
|
+
var _a;
|
|
8817
|
+
if (!((_a = node === null || node === void 0 ? void 0 : node._message) === null || _a === void 0 ? void 0 : _a.form_submit_meta) || !activeActions.length) {
|
|
8818
|
+
pushNotifications({
|
|
8819
|
+
title: '',
|
|
8820
|
+
message: f({
|
|
8821
|
+
id: 'multiSelectError.required',
|
|
8822
|
+
defaultMessage: `There is no answer!`,
|
|
8823
|
+
}),
|
|
8824
|
+
type: 'warning', // "success" | "danger" | "info" | "warning"
|
|
8825
|
+
});
|
|
8826
|
+
return;
|
|
8827
|
+
}
|
|
8828
|
+
if (!isSubmit) {
|
|
8829
|
+
const _message = Object.assign(Object.assign(Object.assign({}, params), node === null || node === void 0 ? void 0 : node._message), value);
|
|
8830
|
+
const res = yield subotInlineMessage(_message);
|
|
8831
|
+
if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
|
|
8832
|
+
const _b = res === null || res === void 0 ? void 0 : res._data, { node: _node } = _b, restData = __rest(_b, ["node"]);
|
|
8833
|
+
const _nextNode = Object.assign(Object.assign({}, _node), { _message: Object.assign(Object.assign({}, restData), { node_id: _node.id }) });
|
|
8834
|
+
onSubmit && onSubmit(_nextNode, _message);
|
|
8835
|
+
setIsSubmit(true);
|
|
8836
|
+
}
|
|
8837
|
+
}
|
|
8838
|
+
else {
|
|
8839
|
+
onNext && onNext(Object.assign(Object.assign(Object.assign({}, params), value), node === null || node === void 0 ? void 0 : node._message));
|
|
8840
|
+
}
|
|
8841
|
+
});
|
|
8842
|
+
return (React__default.createElement(SubotInlineContainer$1, null,
|
|
8843
|
+
React__default.createElement(SubotInlineHeader$1, null),
|
|
8844
|
+
React__default.createElement(SubotInlineWrapper$1, null,
|
|
8845
|
+
React__default.createElement(SubotInlineIntentContainer, null,
|
|
8846
|
+
React__default.createElement(SubotInlineIntent, { intents: (node === null || node === void 0 ? void 0 : node.intents) || [], indexNumber: indexNumber })),
|
|
8847
|
+
React__default.createElement(SubotInlineActionContainer, null,
|
|
8848
|
+
!!reviewChoices.length && (React__default.createElement(SubotInlineReviewContainer, null,
|
|
8849
|
+
React__default.createElement(SubotInlineActionListContainer, { className: "review-container" }, reviewChoices.map((action) => {
|
|
8850
|
+
var _a;
|
|
8851
|
+
const NodeAction = SubotInlineActionBase[action === null || action === void 0 ? void 0 : action.type];
|
|
8852
|
+
return (NodeAction && (React__default.createElement(NodeAction, { key: action.id, action: action, onChange: handleOnClick, active: (value &&
|
|
8853
|
+
!!((_a = value === null || value === void 0 ? void 0 : value.form_submit_meta) === null || _a === void 0 ? void 0 : _a.find(({ action_id }) => action_id === action.id))) ||
|
|
8854
|
+
false })));
|
|
8855
|
+
})))),
|
|
8856
|
+
!!(reviewDescriptions === null || reviewDescriptions === void 0 ? void 0 : reviewDescriptions.length) && (React__default.createElement(SubotInlineActionListContainer, null, reviewDescriptions.map((action) => {
|
|
8857
|
+
var _a;
|
|
8858
|
+
const NodeAction = SubotInlineActionBase[action === null || action === void 0 ? void 0 : action.type];
|
|
8859
|
+
return (NodeAction && (React__default.createElement(NodeAction, { key: action.id, action: action, onChange: handleOnChange, value: (value &&
|
|
8860
|
+
(value === null || value === void 0 ? void 0 : value.form_submit_meta) &&
|
|
8861
|
+
((_a = value.form_submit_meta) === null || _a === void 0 ? void 0 : _a.find(({ action_id }) => action_id === action.id))) })));
|
|
8862
|
+
}))))),
|
|
8863
|
+
React__default.createElement(SubotInlineFooter$1, { onBack: () => onPrev && onPrev(), backProps: { isDisabled: !!(indexNumber === 1) }, nextText: submitButton ? submitButton === null || submitButton === void 0 ? void 0 : submitButton.label : '', onNext: handleOnNext })));
|
|
8864
|
+
};
|
|
8865
|
+
|
|
8866
|
+
const SubotInlineNodeSSO = ({ node, indexNumber, }) => {
|
|
8867
|
+
const refIsTrigger = useRef(false);
|
|
8868
|
+
const { params, onPrev, nodes, activeId, userInfo } = useContext(SubotInlineContext);
|
|
8869
|
+
useEffect(() => {
|
|
8870
|
+
var _a;
|
|
8871
|
+
const actionSSO = (_a = node === null || node === void 0 ? void 0 : node.actions) === null || _a === void 0 ? void 0 : _a.find((act) => act.type === NodeActionType.ACTION_SSO_REDIRECT);
|
|
8872
|
+
if ((userInfo === null || userInfo === void 0 ? void 0 : userInfo.id) && actionSSO && !refIsTrigger.current) {
|
|
8873
|
+
refIsTrigger.current = true;
|
|
8874
|
+
handleOnChange(actionSSO);
|
|
8875
|
+
}
|
|
8876
|
+
}, [userInfo === null || userInfo === void 0 ? void 0 : userInfo.id]);
|
|
8877
|
+
const { formatMessage: f } = useContext(TogetherComponentGlobalContext);
|
|
8878
|
+
const handleOnChange = (action) => {
|
|
8879
|
+
if (action && action.type === NodeActionType.ACTION_SSO_REDIRECT) {
|
|
8880
|
+
const currentState = {
|
|
8881
|
+
params: Object.assign(Object.assign(Object.assign({}, params), node === null || node === void 0 ? void 0 : node._message), { action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key, mode: 'inline' }),
|
|
8882
|
+
listNodes: nodes,
|
|
8883
|
+
activeId,
|
|
8884
|
+
createdAt: new Date().getTime(),
|
|
8885
|
+
botId: params.bot_id,
|
|
8886
|
+
};
|
|
8887
|
+
localStorage.setItem(STATE_SUBOT_INLINE_KEY, JSON.stringify(currentState));
|
|
8888
|
+
const urlObj = getURLwithSSOTracking(window.location.href, {
|
|
8889
|
+
botItem: nodes[0],
|
|
8890
|
+
});
|
|
8891
|
+
urlObj.searchParams.set('bot_id', String(params.bot_id));
|
|
8892
|
+
urlObj.searchParams.set('mode', 'inline');
|
|
8893
|
+
urlObj.searchParams.set('source', 'subot-inline');
|
|
8894
|
+
const returnUrl = urlObj.href;
|
|
8895
|
+
if (IS_SSOV2_ENABLED()) {
|
|
8896
|
+
useSSOV2Store.getState().triggerLogin({
|
|
8897
|
+
returnUrl,
|
|
8898
|
+
source: `subot-inline`,
|
|
8899
|
+
});
|
|
8900
|
+
}
|
|
8901
|
+
else {
|
|
8902
|
+
window.location.href = `${SSO_URL}?returnUrl=${encodeURIComponent(returnUrl)}`;
|
|
8903
|
+
}
|
|
8904
|
+
}
|
|
8905
|
+
};
|
|
8906
|
+
return (React__default.createElement(SubotInlineContainer$1, null,
|
|
8907
|
+
React__default.createElement(SubotInlineHeader$1, null),
|
|
8908
|
+
React__default.createElement(SubotInlineWrapper$1, null,
|
|
8909
|
+
React__default.createElement(SubotInlineIntentContainer, null,
|
|
8910
|
+
React__default.createElement(SubotInlineIntent, { intents: [
|
|
8911
|
+
...((node === null || node === void 0 ? void 0 : node.intents) || []),
|
|
8912
|
+
...ssoIntents(f),
|
|
8913
|
+
], indexNumber: indexNumber })),
|
|
8914
|
+
React__default.createElement(SubotInlineActionContainer, null,
|
|
8915
|
+
React__default.createElement(SubotInlineAction, { actions: node === null || node === void 0 ? void 0 : node.actions, onChange: handleOnChange }))),
|
|
8916
|
+
React__default.createElement(SubotInlineFooter$1, { onBack: () => onPrev && onPrev(), backProps: { isDisabled: !!(indexNumber === 1) }, hideNext: true })));
|
|
8917
|
+
};
|
|
8918
|
+
|
|
8919
|
+
const SubotInlineNodeText = ({ node, indexNumber, }) => {
|
|
8920
|
+
const { formatMessage: f, action: { pushNotifications }, } = useContext(TogetherComponentGlobalContext);
|
|
8921
|
+
const { nodes, activeId, params, onSubmit, onPrev, onNext, onChange } = useContext(SubotInlineContext);
|
|
8922
|
+
const [value, setValue] = useState((node === null || node === void 0 ? void 0 : node._message) || {});
|
|
8923
|
+
const handleOnChangeNormal = (action) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8924
|
+
const _message = Object.assign(Object.assign(Object.assign(Object.assign({}, params), value), { node_id: node.id, action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key }), getCurrentTotalDynamicScore(nodes, activeId, action.id));
|
|
8925
|
+
delete _message.form_submit_meta;
|
|
8926
|
+
const res = yield subotInlineMessage(_message);
|
|
8927
|
+
if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
|
|
8928
|
+
const _a = res === null || res === void 0 ? void 0 : res._data, { node: _node } = _a, restData = __rest(_a, ["node"]);
|
|
8929
|
+
const _nextNode = Object.assign(Object.assign({}, _node), { _message: Object.assign(Object.assign({}, restData), { node_id: _node.id }) });
|
|
8930
|
+
onSubmit && onSubmit(_nextNode, _message);
|
|
8931
|
+
}
|
|
8932
|
+
});
|
|
8933
|
+
const handleOnChange = (action, formSubmitMeta) => __awaiter(void 0, void 0, void 0, function* () {
|
|
8934
|
+
if (!action)
|
|
8935
|
+
return;
|
|
8936
|
+
const actionWithOther = (action === null || action === void 0 ? void 0 : action.type) === NodeActionType.USER_CHOICE_TEXT_BY_INPUT ||
|
|
8937
|
+
(action === null || action === void 0 ? void 0 : action.type) === NodeActionType.POLL_CHOICE_TEXT_BY_INPUT;
|
|
8938
|
+
const newValue = Object.assign(Object.assign({}, value), { action_id: action === null || action === void 0 ? void 0 : action.id, action_value: action === null || action === void 0 ? void 0 : action.key, form_submit_meta: formSubmitMeta });
|
|
8939
|
+
if (actionWithOther) {
|
|
8940
|
+
setValue(newValue);
|
|
8941
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(newValue);
|
|
8942
|
+
return;
|
|
8943
|
+
}
|
|
8944
|
+
delete newValue.form_submit_meta;
|
|
8945
|
+
setValue(newValue);
|
|
8946
|
+
handleOnChangeNormal(action);
|
|
8947
|
+
});
|
|
8948
|
+
const handleOnNext = () => {
|
|
8949
|
+
const newMessage = JSON.parse(JSON.stringify(Object.assign(Object.assign(Object.assign({}, params), node === null || node === void 0 ? void 0 : node._message), value)));
|
|
8950
|
+
if ((value === null || value === void 0 ? void 0 : value.action_id) &&
|
|
8951
|
+
(value === null || value === void 0 ? void 0 : value.action_value) === KEY_OF_TEXT_CHOICE_WITH_OTHER_FIELD) {
|
|
8952
|
+
onNext === null || onNext === void 0 ? void 0 : onNext(newMessage);
|
|
8953
|
+
return;
|
|
8954
|
+
}
|
|
8955
|
+
if (!(value === null || value === void 0 ? void 0 : value.action_id) || !(value === null || value === void 0 ? void 0 : value.action_value)) {
|
|
8956
|
+
pushNotifications({
|
|
8957
|
+
title: '',
|
|
8958
|
+
message: f({
|
|
8959
|
+
id: 'multiSelectError.required',
|
|
8960
|
+
defaultMessage: `There is no answer!`,
|
|
8961
|
+
}),
|
|
8962
|
+
type: 'warning', // "success" | "danger" | "info" | "warning"
|
|
8963
|
+
});
|
|
8964
|
+
}
|
|
8965
|
+
else {
|
|
8966
|
+
delete newMessage.form_submit_meta;
|
|
8967
|
+
onNext === null || onNext === void 0 ? void 0 : onNext(newMessage);
|
|
8968
|
+
}
|
|
8969
|
+
};
|
|
8970
|
+
return (React__default.createElement(SubotInlineContainer$1, null,
|
|
8971
|
+
React__default.createElement(SubotInlineHeader$1, null),
|
|
8972
|
+
React__default.createElement(SubotInlineWrapper$1, null,
|
|
8973
|
+
React__default.createElement(SubotInlineIntentContainer, null,
|
|
8974
|
+
React__default.createElement(SubotInlineIntent, { intents: (node === null || node === void 0 ? void 0 : node.intents) || [], indexNumber: indexNumber })),
|
|
8975
|
+
React__default.createElement(SubotInlineActionContainer, null,
|
|
8976
|
+
React__default.createElement(SubotInlineAction, { value: (value === null || value === void 0 ? void 0 : value.action_id) ? [value === null || value === void 0 ? void 0 : value.action_id] : [], actions: node === null || node === void 0 ? void 0 : node.actions, onChange: handleOnChange, formSubmitMeta: value === null || value === void 0 ? void 0 : value.form_submit_meta }))),
|
|
8977
|
+
React__default.createElement(SubotInlineFooter$1, { onBack: () => onPrev && onPrev(), backProps: { isDisabled: !!(indexNumber === 1) }, onNext: handleOnNext })));
|
|
8978
|
+
};
|
|
8979
|
+
|
|
8980
|
+
const SubotInlineNodeBase = {
|
|
8981
|
+
TEXT: SubotInlineNodeText,
|
|
8982
|
+
IMAGE: SubotInlineNodeImage,
|
|
8983
|
+
FORM: SubotInlineNodeForm,
|
|
8984
|
+
CONDITION: SubotInlineNode,
|
|
8985
|
+
FINAL_STANDARD: SubotInlineNodeFinal,
|
|
8986
|
+
FINAL: SubotInlineNodeFinal,
|
|
8987
|
+
FINAL_THANK_YOU: SubotInlineNodeFinalThankYou,
|
|
8988
|
+
SSO: SubotInlineNodeSSO,
|
|
8989
|
+
MULTIPLE: SubotInlineNodeMultiple,
|
|
8990
|
+
POLL: SubotInlineNodePoll,
|
|
8991
|
+
RATING: SubotInlineNodeRating,
|
|
8992
|
+
REACTION: SubotInlineNodeReaction,
|
|
8993
|
+
REVIEW: SubotInlineNodeReview,
|
|
8994
|
+
RESULT_POLL: SubotInlineNodeResultPoll,
|
|
8995
|
+
OTP: SubotInlineNodeOTP,
|
|
8996
|
+
// RESULT_RATING = 12,
|
|
8997
|
+
// RESULT_REACTION = 13,
|
|
8998
|
+
};
|
|
8999
|
+
|
|
9000
|
+
const SubotInlineButton = styled(Button$1) `
|
|
9001
|
+
margin-top: 24px;
|
|
9002
|
+
${MediaQueries.mbUp} {
|
|
9003
|
+
margin-top: 16px;
|
|
9004
|
+
}
|
|
9005
|
+
`;
|
|
9006
|
+
const SubotInlineDescription = styled.div `
|
|
9007
|
+
margin-top: 24px;
|
|
9008
|
+
`;
|
|
9009
|
+
const SubotInlineReview = styled(Text$1) `
|
|
9010
|
+
text-align: center;
|
|
9011
|
+
${MediaQueries.mbUp} {
|
|
9012
|
+
text-align: left;
|
|
9013
|
+
}
|
|
9014
|
+
`;
|
|
9015
|
+
const SubotInlineTitle = styled(Heading) `
|
|
9016
|
+
text-align: center;
|
|
9017
|
+
margin-bottom: 8px;
|
|
9018
|
+
|
|
9019
|
+
${MediaQueries.mbUp} {
|
|
9020
|
+
margin-bottom: 0;
|
|
9021
|
+
text-align: left;
|
|
9022
|
+
}
|
|
9023
|
+
`;
|
|
9024
|
+
const SubotInlineImage = styled.div `
|
|
9025
|
+
background-color: #ffffff;
|
|
9026
|
+
border-radius: 50%;
|
|
9027
|
+
width: 120px;
|
|
9028
|
+
height: 120px;
|
|
9029
|
+
object-fit: contain;
|
|
9030
|
+
overflow: hidden;
|
|
9031
|
+
flex-shrink: 0;
|
|
9032
|
+
|
|
9033
|
+
img {
|
|
9034
|
+
width: 100%;
|
|
9035
|
+
height: 100%;
|
|
9036
|
+
object-fit: cover;
|
|
9037
|
+
}
|
|
9038
|
+
`;
|
|
9039
|
+
const SubotInlineContent = styled.div `
|
|
9040
|
+
flex-grow: 1;
|
|
9041
|
+
${MediaQueries.tdDown} {
|
|
9042
|
+
width: 100%;
|
|
9043
|
+
margin-left: 0;
|
|
9044
|
+
}
|
|
9045
|
+
`;
|
|
9046
|
+
const SubotInlineStartWrapper = styled.div `
|
|
9047
|
+
position: relative;
|
|
9048
|
+
display: flex;
|
|
9049
|
+
gap: 24px;
|
|
9050
|
+
${MediaQueries.mbDown} {
|
|
9051
|
+
flex-wrap: wrap;
|
|
9052
|
+
justify-content: center;
|
|
9053
|
+
}
|
|
9054
|
+
`;
|
|
9055
|
+
const SubotInlineStartContainer = styled.div `
|
|
9056
|
+
position: relative;
|
|
9057
|
+
overflow: hidden;
|
|
9058
|
+
background-color: ${theme.colors.primary50};
|
|
9059
|
+
padding: 32px;
|
|
9060
|
+
border-radius: ${theme.borderRadius};
|
|
9061
|
+
background-image: url('/images/subot-bg-transparent.png');
|
|
9062
|
+
background-size: contain;
|
|
9063
|
+
background-repeat: repeat-y;
|
|
9064
|
+
${MediaQueries.mbDown} {
|
|
9065
|
+
padding: 24px;
|
|
9066
|
+
}
|
|
9067
|
+
`;
|
|
9068
|
+
const SubotInlineNodeStart = ({ node, setLoading, }) => {
|
|
9069
|
+
const startRef = useRef({
|
|
9070
|
+
impress: false,
|
|
9071
|
+
});
|
|
9072
|
+
const userInfo = GlobalData === null || GlobalData === void 0 ? void 0 : GlobalData.userInfo;
|
|
9073
|
+
const { params, onNext, trackingCommonInline, isMobile } = useContext(SubotInlineContext);
|
|
9074
|
+
const handleOnClick = (isCountClick = true) => () => {
|
|
9075
|
+
if (isCountClick) {
|
|
9076
|
+
const queryParams = {
|
|
9077
|
+
cookie_id: params.cookie_id,
|
|
9078
|
+
window_id: params.window_id,
|
|
9079
|
+
bot_id: params.bot_id,
|
|
9080
|
+
title_url: params.title_url,
|
|
9081
|
+
url: params.url,
|
|
9082
|
+
gtm_id: params.gtm_id,
|
|
9083
|
+
ga_client_id: params.ga_client_id,
|
|
9084
|
+
device_id: checkMobile(window.navigator.userAgent) ? 2 : 1,
|
|
9085
|
+
account_id: params.account_id || (userInfo === null || userInfo === void 0 ? void 0 : userInfo.id) || null,
|
|
9086
|
+
};
|
|
9087
|
+
subotInlineClick(queryParams);
|
|
9088
|
+
}
|
|
9089
|
+
onNext && onNext();
|
|
9090
|
+
};
|
|
9091
|
+
useEffect(() => {
|
|
9092
|
+
const inViewport = (element, callback, options = {}) => {
|
|
9093
|
+
if (!!window.IntersectionObserver && !startRef.current.impress) {
|
|
9094
|
+
const observer = new IntersectionObserver((entries, observer) => {
|
|
9095
|
+
entries.forEach((entry) => callback(entry, observer));
|
|
9096
|
+
}, options);
|
|
9097
|
+
observer.observe(element);
|
|
9098
|
+
}
|
|
9099
|
+
};
|
|
9100
|
+
const eventScrollImpress = () => {
|
|
9101
|
+
if (startRef.current.element) {
|
|
9102
|
+
inViewport(startRef.current.element, (element, observer) => {
|
|
9103
|
+
/** Not in viewport */
|
|
9104
|
+
if (!element.isIntersecting) {
|
|
9105
|
+
if (startRef.current.impress) {
|
|
9106
|
+
startRef.current.impress = false;
|
|
9107
|
+
}
|
|
9108
|
+
return;
|
|
9109
|
+
}
|
|
9110
|
+
if (!startRef.current.impress) {
|
|
9111
|
+
startRef.current.impress = true;
|
|
9112
|
+
if (startRef.current.debounce) {
|
|
9113
|
+
clearTimeout(startRef.current.debounce);
|
|
9114
|
+
}
|
|
9115
|
+
if (!(node === null || node === void 0 ? void 0 : node.inline_start_button)) {
|
|
9116
|
+
setLoading(true);
|
|
9117
|
+
}
|
|
9118
|
+
startRef.current.debounce = setTimeout(() => {
|
|
9119
|
+
const queryParams = {
|
|
9120
|
+
cookie_id: params.cookie_id,
|
|
9121
|
+
window_id: params.window_id,
|
|
9122
|
+
bot_id: params.bot_id,
|
|
9123
|
+
title_url: params.title_url,
|
|
9124
|
+
url: params.url,
|
|
9125
|
+
gtm_id: params.gtm_id,
|
|
9126
|
+
ga_client_id: params.ga_client_id,
|
|
9127
|
+
device_id: checkMobile(window.navigator.userAgent) ? 2 : 1,
|
|
9128
|
+
account_id: params.account_id || (userInfo === null || userInfo === void 0 ? void 0 : userInfo.id) || null,
|
|
9129
|
+
};
|
|
9130
|
+
queryParams && subotInlineImpression(queryParams);
|
|
9131
|
+
/** Auto skip the starting node in the case
|
|
9132
|
+
* CTA Start value is not contributed on Subot Admin */
|
|
9133
|
+
if (!(node === null || node === void 0 ? void 0 : node.inline_start_button)) {
|
|
9134
|
+
handleOnClick(false)();
|
|
9135
|
+
}
|
|
9136
|
+
}, 400);
|
|
9137
|
+
startRef.current.element &&
|
|
9138
|
+
(observer === null || observer === void 0 ? void 0 : observer.unobserve(startRef.current.element));
|
|
9139
|
+
}
|
|
9140
|
+
}, {
|
|
9141
|
+
rootMargin: '1000px',
|
|
9142
|
+
});
|
|
9143
|
+
}
|
|
9144
|
+
};
|
|
9145
|
+
eventScrollImpress();
|
|
9146
|
+
window.addEventListener('scroll', eventScrollImpress, { passive: true });
|
|
9147
|
+
return () => window.removeEventListener('scroll', eventScrollImpress);
|
|
9148
|
+
}, [onNext]);
|
|
9149
|
+
if (!node)
|
|
9150
|
+
return null;
|
|
9151
|
+
return (React__default.createElement(SubotInlineStartContainer, null,
|
|
9152
|
+
React__default.createElement(SubotInlineStartWrapper, { ref: (ref) => (startRef.current.element = ref) },
|
|
9153
|
+
node.inline_image && (React__default.createElement(SubotInlineImage, null,
|
|
9154
|
+
React__default.createElement("img", { loading: "lazy", src: node.inline_image, alt: "" }))),
|
|
9155
|
+
React__default.createElement(SubotInlineContent, null,
|
|
9156
|
+
node.inline_title || node.inline_headline ? (React__default.createElement(SubotInlineTitle, { tag: "h3", fontWeight: "bold", color: theme.colors.secondaryBase },
|
|
9157
|
+
React__default.createElement(Markdown, null, node.inline_title || node.inline_headline))) : null,
|
|
9158
|
+
node.inline_review && (React__default.createElement(SubotInlineReview, { size: "s4", color: theme.colors.gray600,
|
|
9159
|
+
// fix error html, div is not allowed as child of p
|
|
9160
|
+
as: 'div' },
|
|
9161
|
+
React__default.createElement(Markdown, null, node.inline_review))),
|
|
9162
|
+
node.inline_start_button && (React__default.createElement(SubotInlineButton, Object.assign({ size: "md", isBlock: isMobile, onClick: handleOnClick(true), className: "pointer-event-child-none" }, trackingCommonInline, { "data-event-action": "Start" }), node.inline_start_button)))),
|
|
9163
|
+
React__default.createElement(SubotInlineDescription, null,
|
|
9164
|
+
React__default.createElement(Markdown, null, node.inline_description))));
|
|
9165
|
+
};
|
|
9166
|
+
|
|
9167
|
+
const SubotInlineLoading = styled.div `
|
|
9168
|
+
position: absolute;
|
|
9169
|
+
z-index: 2;
|
|
9170
|
+
top: 0;
|
|
9171
|
+
right: 0;
|
|
9172
|
+
bottom: 0;
|
|
9173
|
+
left: 0;
|
|
9174
|
+
display: flex;
|
|
9175
|
+
flex-direction: column;
|
|
9176
|
+
align-items: center;
|
|
9177
|
+
justify-content: center;
|
|
9178
|
+
color: ${theme.colors.gray800};
|
|
9179
|
+
opacity: 0;
|
|
9180
|
+
pointer-events: none;
|
|
9181
|
+
&:before {
|
|
9182
|
+
position: absolute;
|
|
9183
|
+
z-index: -1;
|
|
9184
|
+
top: 0;
|
|
9185
|
+
right: 0;
|
|
9186
|
+
bottom: 0;
|
|
9187
|
+
left: 0;
|
|
9188
|
+
background-color: ${theme.colors.neutral50 || '#F7F9FC'};
|
|
9189
|
+
content: '';
|
|
9190
|
+
opacity: 1;
|
|
9191
|
+
}
|
|
9192
|
+
${({ isLoading }) => isLoading && ` opacity: 1; pointer-events: auto; `};
|
|
9193
|
+
`;
|
|
9194
|
+
const SubotInlineLoadingContainer = styled.div `
|
|
9195
|
+
position: relative;
|
|
9196
|
+
z-index: 1;
|
|
9197
|
+
line-height: 1.5;
|
|
9198
|
+
transition: 0.25s all linear;
|
|
9199
|
+
margin-block: 16px;
|
|
9200
|
+
content-visibility: auto;
|
|
9201
|
+
contain-intrinsic-size: 500px;
|
|
9202
|
+
&.hhg-subot-style {
|
|
9203
|
+
min-height: 100px;
|
|
9204
|
+
}
|
|
9205
|
+
${MediaQueries.mbDown} {
|
|
9206
|
+
margin-right: -1rem;
|
|
9207
|
+
margin-left: -1rem;
|
|
9208
|
+
}
|
|
9209
|
+
`;
|
|
9210
|
+
const SubotInline = ({ id, isMobile, articleLink }) => {
|
|
9211
|
+
const currentUrl = useCurrentUrl();
|
|
9212
|
+
const refAccountIdFromLogs = useRef(null);
|
|
9213
|
+
const flag = useRef(null);
|
|
9214
|
+
const [loading, setLoading] = useState(true);
|
|
9215
|
+
const [state, setState] = useState({
|
|
9216
|
+
activeId: '',
|
|
9217
|
+
params: {},
|
|
9218
|
+
nodes: [],
|
|
9219
|
+
getParams: () => ({}),
|
|
9220
|
+
});
|
|
9221
|
+
const userInfo = GlobalData === null || GlobalData === void 0 ? void 0 : GlobalData.userInfo;
|
|
9222
|
+
const currentNode = useMemo(() => {
|
|
9223
|
+
return state.nodes.find((n) => n.id == state.activeId);
|
|
9224
|
+
}, [state.nodes, state.activeId]);
|
|
9225
|
+
const trackingCommonInline = useMemo(() => ({
|
|
9226
|
+
'data-event-category': 'Subot',
|
|
9227
|
+
'data-event-label': currentUrl,
|
|
9228
|
+
'data-bot-id': state.params.bot_id,
|
|
9229
|
+
'data-bot-type': 'Inline',
|
|
9230
|
+
'data-question-id': typeof (currentNode === null || currentNode === void 0 ? void 0 : currentNode.id) === 'string' ? currentNode === null || currentNode === void 0 ? void 0 : currentNode.id : null,
|
|
9231
|
+
}), [currentNode, currentUrl, state.params.bot_id]);
|
|
9232
|
+
/** Get Params */
|
|
9233
|
+
const getParams = useCallback(() => {
|
|
9234
|
+
var _a, _b, _c, _d;
|
|
9235
|
+
const gaData = window.gaData;
|
|
9236
|
+
const _url = window.location.origin +
|
|
9237
|
+
basePath +
|
|
9238
|
+
(GlobalData.locale === 'tl-PH'
|
|
9239
|
+
? articleLink.replace('fil/', '')
|
|
9240
|
+
: articleLink);
|
|
9241
|
+
const params = {
|
|
9242
|
+
bot_id: id,
|
|
9243
|
+
account_id: ((_a = getUserInfoFromCookie()) === null || _a === void 0 ? void 0 : _a.id) || null,
|
|
9244
|
+
action_id: '',
|
|
9245
|
+
action_value: '',
|
|
9246
|
+
cookie_id: getSubotCookieId((_c = (_b = GlobalData === null || GlobalData === void 0 ? void 0 : GlobalData.router) === null || _b === void 0 ? void 0 : _b.query) === null || _c === void 0 ? void 0 : _c.cookie_id),
|
|
9247
|
+
current_score: 0,
|
|
9248
|
+
current_keys: [],
|
|
9249
|
+
current_selected: [],
|
|
9250
|
+
form_submit_meta: [],
|
|
9251
|
+
gtm_id: gaData ? Object.keys(gaData)[0] : '',
|
|
9252
|
+
ga_client_id: Cookies.get('_ga') || '',
|
|
9253
|
+
is_new: false,
|
|
9254
|
+
mode: 'inline',
|
|
9255
|
+
node_id: '',
|
|
9256
|
+
selected_actions: {},
|
|
9257
|
+
title_url: document.title || '',
|
|
9258
|
+
// url: _url,
|
|
9259
|
+
// Keep this commnent line to test on local
|
|
9260
|
+
url: _url
|
|
9261
|
+
.replace('http://localhost', 'https://discover.hellobacsi.com')
|
|
9262
|
+
.replace('dev.', 'discover.'),
|
|
9263
|
+
window_id: getWindowId(),
|
|
9264
|
+
};
|
|
9265
|
+
return overrideParamsByQuery(params, (_d = GlobalData === null || GlobalData === void 0 ? void 0 : GlobalData.router) === null || _d === void 0 ? void 0 : _d.query);
|
|
9266
|
+
}, []);
|
|
9267
|
+
const elementScrollIntoView = () => {
|
|
9268
|
+
flag.current &&
|
|
9269
|
+
flag.current.scrollIntoView({
|
|
9270
|
+
behavior: 'smooth',
|
|
9271
|
+
block: 'start',
|
|
9272
|
+
inline: 'start',
|
|
9273
|
+
});
|
|
9274
|
+
};
|
|
9275
|
+
const onChange = (message) => {
|
|
9276
|
+
setState((state) => {
|
|
9277
|
+
var _a;
|
|
9278
|
+
if (message && (message === null || message === void 0 ? void 0 : message.node_id) && (message === null || message === void 0 ? void 0 : message.node_id) == (state === null || state === void 0 ? void 0 : state.activeId)) {
|
|
9279
|
+
const nodeActiveIndex = state.nodes.findIndex(({ id }) => id == (state === null || state === void 0 ? void 0 : state.activeId));
|
|
9280
|
+
if (nodeActiveIndex !== -1) {
|
|
9281
|
+
const tmpNode = Object.assign(Object.assign({}, state.nodes[nodeActiveIndex]), { _message: Object.assign(Object.assign({}, (_a = state.nodes[nodeActiveIndex]) === null || _a === void 0 ? void 0 : _a._message), message) });
|
|
9282
|
+
state.nodes[nodeActiveIndex] = tmpNode;
|
|
9283
|
+
}
|
|
9284
|
+
}
|
|
9285
|
+
return Object.assign({}, state);
|
|
9286
|
+
});
|
|
9287
|
+
};
|
|
9288
|
+
const onSubmit = (nextNode, message) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9289
|
+
/**
|
|
9290
|
+
* Skip the OTP Node if user's phone number is verified.
|
|
9291
|
+
*/
|
|
9292
|
+
// if (nextNode) {
|
|
9293
|
+
// const isNextNodeOTP = nextNode.type === NodeType.OTP
|
|
9294
|
+
// if (isNextNodeOTP && verifiedPhone) {
|
|
9295
|
+
// const actionOTPSubmit = nextNode.actions?.find(
|
|
9296
|
+
// (action) => action.type === NodeActionType.USER_SUBMIT_SEND,
|
|
9297
|
+
// )
|
|
9298
|
+
// const blockOTPMessage: SubotMessage = {
|
|
9299
|
+
// ...state.params,
|
|
9300
|
+
// node_id: nextNode.id,
|
|
9301
|
+
// action_id: actionOTPSubmit?.id,
|
|
9302
|
+
// action_value: actionOTPSubmit?.key,
|
|
9303
|
+
// }
|
|
9304
|
+
// const res = await subotInlineMessage(blockOTPMessage)
|
|
9305
|
+
// if (res?._status === 1) {
|
|
9306
|
+
// const { node: _node, ...restData } = res?._data
|
|
9307
|
+
// const nextNodeAfterOTP = {
|
|
9308
|
+
// ..._node,
|
|
9309
|
+
// _message: { ...restData, node_id: _node.id },
|
|
9310
|
+
// }
|
|
9311
|
+
// onSubmit && onSubmit(nextNodeAfterOTP, message)
|
|
9312
|
+
// return
|
|
9313
|
+
// }
|
|
9314
|
+
// pushNotifications({
|
|
9315
|
+
// title: '',
|
|
9316
|
+
// message: f({ id: 'notification.comment.somethingWrong' }),
|
|
9317
|
+
// type: 'danger',
|
|
9318
|
+
// })
|
|
9319
|
+
// return
|
|
9320
|
+
// }
|
|
9321
|
+
// }
|
|
9322
|
+
const _state = Object.assign(Object.assign({}, state), { nodes: [...state.nodes] });
|
|
9323
|
+
if (message && (message === null || message === void 0 ? void 0 : message.node_id)) {
|
|
9324
|
+
const updateNodeIndex = _state.nodes.findIndex(({ id }) => id == message.node_id);
|
|
9325
|
+
if (updateNodeIndex !== -1) {
|
|
9326
|
+
_state.nodes[updateNodeIndex]._message = Object.assign(Object.assign({}, _state.nodes[updateNodeIndex]._message), message);
|
|
9327
|
+
_state.nodes = [..._state.nodes.slice(0, updateNodeIndex + 1)];
|
|
9328
|
+
}
|
|
9329
|
+
}
|
|
9330
|
+
setLoading(true);
|
|
9331
|
+
if (nextNode) {
|
|
9332
|
+
const nextNodeFindIndex = _state.nodes.findIndex(({ id }) => id == (nextNode === null || nextNode === void 0 ? void 0 : nextNode.id));
|
|
9333
|
+
if (nextNodeFindIndex === -1) {
|
|
9334
|
+
_state.nodes = [..._state.nodes, Object.assign({}, nextNode)];
|
|
9335
|
+
}
|
|
9336
|
+
else {
|
|
9337
|
+
const tmpNode = Object.assign(Object.assign(Object.assign({}, _state.nodes[nextNodeFindIndex]), nextNode), { _message: Object.assign(Object.assign({}, _state.nodes[nextNodeFindIndex]._message), nextNode === null || nextNode === void 0 ? void 0 : nextNode._message) });
|
|
9338
|
+
_state.nodes = [
|
|
9339
|
+
..._state.nodes.slice(0, nextNodeFindIndex),
|
|
9340
|
+
Object.assign({}, tmpNode),
|
|
9341
|
+
..._state.nodes.slice(nextNodeFindIndex + 1),
|
|
9342
|
+
];
|
|
9343
|
+
}
|
|
9344
|
+
_state.activeId = nextNode.id;
|
|
9345
|
+
}
|
|
9346
|
+
setTimeout(() => {
|
|
9347
|
+
setState(_state);
|
|
9348
|
+
setLoading(false);
|
|
9349
|
+
_state.activeId &&
|
|
9350
|
+
saveSubotInlineLogs({
|
|
9351
|
+
nodes: _state.nodes,
|
|
9352
|
+
activeId: _state.activeId,
|
|
9353
|
+
params: _state.params,
|
|
9354
|
+
accountIdFromLogs: refAccountIdFromLogs.current,
|
|
9355
|
+
});
|
|
9356
|
+
}, 250);
|
|
9357
|
+
elementScrollIntoView();
|
|
9358
|
+
});
|
|
9359
|
+
const onPrev = () => {
|
|
9360
|
+
var _a;
|
|
9361
|
+
const _state = Object.assign({}, state);
|
|
9362
|
+
const nodeActiveIndex = (_a = _state === null || _state === void 0 ? void 0 : _state.nodes) === null || _a === void 0 ? void 0 : _a.findIndex(({ id }) => id == (_state === null || _state === void 0 ? void 0 : _state.activeId));
|
|
9363
|
+
if (nodeActiveIndex && nodeActiveIndex !== -1 && nodeActiveIndex > 1) {
|
|
9364
|
+
const prevNode = _state.nodes[nodeActiveIndex - 1];
|
|
9365
|
+
if (prevNode)
|
|
9366
|
+
_state.activeId = prevNode.id;
|
|
9367
|
+
}
|
|
9368
|
+
elementScrollIntoView();
|
|
9369
|
+
setState(Object.assign({}, _state));
|
|
9370
|
+
_state.activeId &&
|
|
9371
|
+
saveSubotInlineLogs({
|
|
9372
|
+
nodes: _state.nodes,
|
|
9373
|
+
activeId: _state.activeId,
|
|
9374
|
+
params: _state.params,
|
|
9375
|
+
accountIdFromLogs: refAccountIdFromLogs.current,
|
|
9376
|
+
});
|
|
9377
|
+
};
|
|
9378
|
+
const onNext = (message) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9379
|
+
if (message && (message === null || message === void 0 ? void 0 : message.node_id)) {
|
|
9380
|
+
const newMessage = Object.assign(Object.assign({}, message), getCurrentTotalDynamicScore(state.nodes, state.activeId, message.action_id));
|
|
9381
|
+
const res = yield subotInlineMessage(newMessage);
|
|
9382
|
+
setLoading(false);
|
|
9383
|
+
if ((res === null || res === void 0 ? void 0 : res._status) === 1) {
|
|
9384
|
+
const _a = res === null || res === void 0 ? void 0 : res._data, { node: _node } = _a, restData = __rest(_a, ["node"]);
|
|
9385
|
+
const _nextNode = Object.assign(Object.assign({}, _node), { _message: Object.assign(Object.assign({}, restData), { node_id: _node.id }) });
|
|
9386
|
+
const nextNodeFindIndex = state.nodes.findIndex(({ id }) => id === _nextNode.id);
|
|
9387
|
+
if (nextNodeFindIndex !== -1) {
|
|
9388
|
+
onSubmit(_nextNode);
|
|
9389
|
+
}
|
|
9390
|
+
else {
|
|
9391
|
+
onSubmit(_nextNode, message);
|
|
9392
|
+
}
|
|
9393
|
+
return;
|
|
9394
|
+
}
|
|
9395
|
+
}
|
|
9396
|
+
const nodeActive = state.nodes.find(({ id }) => id == (state === null || state === void 0 ? void 0 : state.activeId));
|
|
9397
|
+
if (nodeActive && !nodeActive.hasOwnProperty('type')) {
|
|
9398
|
+
setLoading(true);
|
|
9399
|
+
if (state.nodes[0].id == (state === null || state === void 0 ? void 0 : state.activeId)) {
|
|
9400
|
+
// elementScrollIntoView()
|
|
9401
|
+
setTimeout(() => {
|
|
9402
|
+
setState(Object.assign(Object.assign({}, state), { activeId: state.nodes[1].id.toString() }));
|
|
9403
|
+
setLoading(false);
|
|
9404
|
+
saveSubotInlineLogs({
|
|
9405
|
+
nodes: state.nodes,
|
|
9406
|
+
activeId: state.nodes[1].id.toString(),
|
|
9407
|
+
params: getParams(),
|
|
9408
|
+
accountIdFromLogs: refAccountIdFromLogs.current,
|
|
9409
|
+
});
|
|
9410
|
+
}, 250);
|
|
9411
|
+
}
|
|
9412
|
+
}
|
|
9413
|
+
});
|
|
9414
|
+
const onReset = () => {
|
|
9415
|
+
setLoading(true);
|
|
9416
|
+
setState((state) => {
|
|
9417
|
+
state.nodes = state.nodes.slice(0, 2);
|
|
9418
|
+
state.nodes[1] = Object.assign(Object.assign({}, state.nodes[1]), { _message: undefined });
|
|
9419
|
+
state.activeId = state.nodes[0].id.toString();
|
|
9420
|
+
return Object.assign({}, state);
|
|
9421
|
+
});
|
|
9422
|
+
setTimeout(() => {
|
|
9423
|
+
setLoading(false);
|
|
9424
|
+
}, 250);
|
|
9425
|
+
elementScrollIntoView();
|
|
9426
|
+
};
|
|
9427
|
+
const getFirstAPI = (params) => __awaiter(void 0, void 0, void 0, function* () {
|
|
9428
|
+
var _b;
|
|
9429
|
+
if ((params === null || params === void 0 ? void 0 : params.url) && (params === null || params === void 0 ? void 0 : params.bot_id)) {
|
|
9430
|
+
let activeId = '';
|
|
9431
|
+
let nodes = [];
|
|
9432
|
+
setLoading(true);
|
|
9433
|
+
const resFirst = yield subotInlineFirstNode(params.bot_id);
|
|
9434
|
+
if ((resFirst === null || resFirst === void 0 ? void 0 : resFirst._status) === 1) {
|
|
9435
|
+
activeId = resFirst === null || resFirst === void 0 ? void 0 : resFirst._data.id.toString();
|
|
9436
|
+
nodes.push(resFirst === null || resFirst === void 0 ? void 0 : resFirst._data, resFirst === null || resFirst === void 0 ? void 0 : resFirst._data.first_node);
|
|
9437
|
+
}
|
|
9438
|
+
const subotLogs = yield getSubotInlineLogs(nodes[0]);
|
|
9439
|
+
if (subotLogs) {
|
|
9440
|
+
const lastNode = subotLogs.nodes[subotLogs.nodes.length - 1];
|
|
9441
|
+
const isComplete = [
|
|
9442
|
+
NodeType.FINAL,
|
|
9443
|
+
NodeType.FINAL_THANK_YOU,
|
|
9444
|
+
NodeType.FINAL_STANDARD,
|
|
9445
|
+
].includes(lastNode.type);
|
|
9446
|
+
if (!isComplete) {
|
|
9447
|
+
nodes = subotLogs.nodes;
|
|
9448
|
+
activeId = subotLogs.activeId;
|
|
9449
|
+
refAccountIdFromLogs.current = ((_b = subotLogs.params) === null || _b === void 0 ? void 0 : _b.account_id) || 0;
|
|
9450
|
+
}
|
|
9451
|
+
}
|
|
9452
|
+
/** [Subot Inline] Show result page after redirect from SSO */
|
|
9453
|
+
const previousState = getPreviousStateFromStorage(params.bot_id, {
|
|
9454
|
+
getParams,
|
|
9455
|
+
});
|
|
9456
|
+
if (previousState &&
|
|
9457
|
+
previousState.params.action_id &&
|
|
9458
|
+
previousState.params.action_value) {
|
|
9459
|
+
const resResultInline = yield subotInlineMessage(previousState.params);
|
|
9460
|
+
if ((resResultInline === null || resResultInline === void 0 ? void 0 : resResultInline._status) === 1 && (resResultInline === null || resResultInline === void 0 ? void 0 : resResultInline._data.node)) {
|
|
9461
|
+
activeId = resResultInline === null || resResultInline === void 0 ? void 0 : resResultInline._data.node.id;
|
|
9462
|
+
nodes = previousState.listNodes;
|
|
9463
|
+
nodes[nodes.length - 1] = resResultInline === null || resResultInline === void 0 ? void 0 : resResultInline._data.node;
|
|
9464
|
+
saveSubotInlineLogs({
|
|
9465
|
+
nodes,
|
|
9466
|
+
activeId: activeId,
|
|
9467
|
+
params: previousState.params,
|
|
9468
|
+
accountIdFromLogs: refAccountIdFromLogs.current,
|
|
9469
|
+
});
|
|
9470
|
+
setTimeout(() => {
|
|
9471
|
+
elementScrollIntoView();
|
|
9472
|
+
}, 100);
|
|
9473
|
+
}
|
|
9474
|
+
}
|
|
9475
|
+
const newParams = (previousState === null || previousState === void 0 ? void 0 : previousState.params) || (subotLogs === null || subotLogs === void 0 ? void 0 : subotLogs.params) || params;
|
|
9476
|
+
const _state = Object.assign(Object.assign({}, state), { params: newParams, activeId, nodes: nodes });
|
|
9477
|
+
setLoading(false);
|
|
9478
|
+
setState(_state);
|
|
9479
|
+
}
|
|
9480
|
+
});
|
|
9481
|
+
useEffect(() => {
|
|
9482
|
+
var _a;
|
|
9483
|
+
if (!!((_a = state === null || state === void 0 ? void 0 : state.nodes) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
9484
|
+
console.log('Subot Already Loaded');
|
|
9485
|
+
return () => undefined;
|
|
9486
|
+
}
|
|
9487
|
+
if (!Cookies.get(GA_TOKEN_COOKIE)) {
|
|
9488
|
+
checkUntilFinished({
|
|
9489
|
+
condition: () => Boolean(Cookies.get(GA_TOKEN_COOKIE)),
|
|
9490
|
+
finished: () => {
|
|
9491
|
+
const params = getParams();
|
|
9492
|
+
getFirstAPI(params);
|
|
9493
|
+
},
|
|
9494
|
+
});
|
|
9495
|
+
}
|
|
9496
|
+
else {
|
|
9497
|
+
const params = getParams();
|
|
9498
|
+
getFirstAPI(params);
|
|
9499
|
+
}
|
|
9500
|
+
}, []);
|
|
9501
|
+
if (state.nodes.length && !state.nodes[0].inline_active) {
|
|
9502
|
+
return null;
|
|
9503
|
+
}
|
|
9504
|
+
return (React__default.createElement(SubotInlineContext.Provider, { value: Object.assign(Object.assign({}, state), { isMobile,
|
|
9505
|
+
getParams,
|
|
9506
|
+
onChange,
|
|
9507
|
+
onSubmit,
|
|
9508
|
+
onPrev,
|
|
9509
|
+
onNext,
|
|
9510
|
+
onReset,
|
|
9511
|
+
trackingCommonInline,
|
|
9512
|
+
userInfo }) },
|
|
9513
|
+
React__default.createElement(SubotInlineLoadingContainer, { className: classNames('hhg-subot', `hhg-subot-${id}`, !!state.nodes.length && 'hhg-subot-style') }, !!state.nodes.length && (React__default.createElement(React__default.Fragment, null,
|
|
9514
|
+
React__default.createElement("div", { ref: flag, className: "hhg-flag", style: {
|
|
9515
|
+
position: 'absolute',
|
|
9516
|
+
top: -150,
|
|
9517
|
+
left: 0,
|
|
9518
|
+
pointerEvents: 'none',
|
|
9519
|
+
} }),
|
|
9520
|
+
React__default.createElement(SubotInlineLoading, { isLoading: !!loading },
|
|
9521
|
+
React__default.createElement(Loading, null),
|
|
9522
|
+
"Verifying..."),
|
|
9523
|
+
state.nodes.map((node, index) => {
|
|
9524
|
+
if (node.id.toString() === (state === null || state === void 0 ? void 0 : state.activeId)) {
|
|
9525
|
+
if (node.hasOwnProperty('type')) {
|
|
9526
|
+
let NodeComponent;
|
|
9527
|
+
switch (node === null || node === void 0 ? void 0 : node.position) {
|
|
9528
|
+
case NodePosition.SSO:
|
|
9529
|
+
NodeComponent =
|
|
9530
|
+
SubotInlineNodeBase[NodePosition[node === null || node === void 0 ? void 0 : node.position].valueOf()];
|
|
9531
|
+
break;
|
|
9532
|
+
default:
|
|
9533
|
+
NodeComponent =
|
|
9534
|
+
SubotInlineNodeBase[NodeType[node === null || node === void 0 ? void 0 : node.type].valueOf()];
|
|
9535
|
+
}
|
|
9536
|
+
if (node.is_multi_select &&
|
|
9537
|
+
node.type !== NodeType.POLL)
|
|
9538
|
+
NodeComponent = SubotInlineNodeBase['MULTIPLE'];
|
|
9539
|
+
return (NodeComponent && (React__default.createElement(NodeComponent, { key: index.toString(), indexNumber: index, node: node })));
|
|
9540
|
+
}
|
|
9541
|
+
else {
|
|
9542
|
+
return (React__default.createElement(SubotInlineNodeStart, { key: index.toString(), node: node, setLoading: setLoading }));
|
|
9543
|
+
}
|
|
9544
|
+
}
|
|
9545
|
+
return null;
|
|
9546
|
+
}))))));
|
|
9547
|
+
};
|
|
9548
|
+
|
|
6422
9549
|
// subot.sendOTP.button
|
|
6423
9550
|
// subot.resendOTP.button
|
|
6424
9551
|
// subot.verifyOTP.button
|
|
@@ -6458,6 +9585,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
6458
9585
|
Markdown: Markdown,
|
|
6459
9586
|
hexRgb: hexRgb,
|
|
6460
9587
|
SubotInlineVoucherLeftUI: SubotInlineVoucherLeftUI,
|
|
9588
|
+
SubotInline: SubotInline,
|
|
6461
9589
|
overrideParamsByQuery: overrideParamsByQuery,
|
|
6462
9590
|
ssoIntents: ssoIntents,
|
|
6463
9591
|
checkUntilFinished: checkUntilFinished,
|
|
@@ -6473,11 +9601,11 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
6473
9601
|
isFakeEmail: isFakeEmail,
|
|
6474
9602
|
formatUrlWithEncrypedGa: formatUrlWithEncrypedGa,
|
|
6475
9603
|
getSubotApiPath: getSubotApiPath,
|
|
6476
|
-
subotInlineMessage: subotInlineMessage,
|
|
6477
|
-
computeExtraSettingsForBot: computeExtraSettingsForBot,
|
|
6478
|
-
subotInlineFirstNode: subotInlineFirstNode,
|
|
6479
|
-
subotInlineClick: subotInlineClick,
|
|
6480
|
-
subotInlineImpression: subotInlineImpression,
|
|
9604
|
+
subotInlineMessage: subotInlineMessage$1,
|
|
9605
|
+
computeExtraSettingsForBot: computeExtraSettingsForBot$1,
|
|
9606
|
+
subotInlineFirstNode: subotInlineFirstNode$1,
|
|
9607
|
+
subotInlineClick: subotInlineClick$1,
|
|
9608
|
+
subotInlineImpression: subotInlineImpression$1,
|
|
6481
9609
|
PATHS: PATHS$1,
|
|
6482
9610
|
getPreviousStateFromStorage: getPreviousStateFromStorage,
|
|
6483
9611
|
getSubotInlineLogs: getSubotInlineLogs,
|
|
@@ -6488,7 +9616,7 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
6488
9616
|
detectToSkipNodeStart: detectToSkipNodeStart,
|
|
6489
9617
|
KEY_OF_TEXT_CHOICE_WITH_OTHER_FIELD: KEY_OF_TEXT_CHOICE_WITH_OTHER_FIELD,
|
|
6490
9618
|
SubotInlineIntentBaseTarget: SubotInlineIntentBaseTarget,
|
|
6491
|
-
SubotInlineIntentBase: SubotInlineIntentBase,
|
|
9619
|
+
SubotInlineIntentBase: SubotInlineIntentBase$1,
|
|
6492
9620
|
checkSyncDataOnFrisoCampaign: checkSyncDataOnFrisoCampaign,
|
|
6493
9621
|
handleFrisoRedirecition: handleFrisoRedirecition,
|
|
6494
9622
|
getDynamicScore: getDynamicScore,
|
|
@@ -6496,4 +9624,4 @@ var index = /*#__PURE__*/Object.freeze({
|
|
|
6496
9624
|
replaceTextWithVariables: replaceTextWithVariables
|
|
6497
9625
|
});
|
|
6498
9626
|
|
|
6499
|
-
export { KEY_OF_TEXT_CHOICE_WITH_OTHER_FIELD, Markdown, PATHS$1 as PATHS, SubotInlineIntentBase, SubotInlineIntentBaseTarget, SubotInlineRevampWithTheme, SubotInlineVoucherLeftUI, UserInfoForm, checkSyncDataOnFrisoCampaign, computeExtraSettingsForBot, ContainerWithProvider as default, detectToSkipNodeStart, extractUnifiedAnswers, extractVoucherAnswers, getColorWithOpacity, getCurrentTotalDynamicScore, getDynamicScore, getPreviousStateFromStorage, getSubotApiPath, getSubotInlineLogs, handleFrisoRedirecition, hexRgb, replaceTextWithVariables, saveSubotInlineLogs, subotInlineClick, subotInlineFirstNode, subotInlineImpression, subotInlineMessage };
|
|
9627
|
+
export { KEY_OF_TEXT_CHOICE_WITH_OTHER_FIELD, Markdown, PATHS$1 as PATHS, SubotInline, SubotInlineIntentBase$1 as SubotInlineIntentBase, SubotInlineIntentBaseTarget, SubotInlineRevampWithTheme, SubotInlineVoucherLeftUI, UserInfoForm, checkSyncDataOnFrisoCampaign, computeExtraSettingsForBot$1 as computeExtraSettingsForBot, ContainerWithProvider as default, detectToSkipNodeStart, extractUnifiedAnswers, extractVoucherAnswers, getColorWithOpacity, getCurrentTotalDynamicScore, getDynamicScore, getPreviousStateFromStorage, getSubotApiPath, getSubotInlineLogs, handleFrisoRedirecition, hexRgb, replaceTextWithVariables, saveSubotInlineLogs, subotInlineClick$1 as subotInlineClick, subotInlineFirstNode$1 as subotInlineFirstNode, subotInlineImpression$1 as subotInlineImpression, subotInlineMessage$1 as subotInlineMessage };
|