@qualified-salesforce/web 0.0.1-oidc-bootstrap
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/41842993ec71d6628e4949e9a22b146b.svg +3 -0
- package/7271f3433ed82fc7f56adcd9e30275f4.svg +17 -0
- package/LICENSE.txt +82 -0
- package/components/helpers/entriesStringValidations.js +69 -0
- package/components/helpers/languages.js +32 -0
- package/components/shared/assertUnreachable.js +5 -0
- package/components/shared/controls/imageCropperHelpers.js +43 -0
- package/components/shared/meetingLoadingProgressSpec.js +116 -0
- package/constants.generated.js +9883 -0
- package/css/widget/multimodal_v2/host.split-css.css +162 -0
- package/css/widget/multimodal_v2/index.split-css.panda.css +5240 -0
- package/css/widget/widget.split-css.css +100 -0
- package/fonts/inter/Inter-Black.woff +0 -0
- package/fonts/inter/Inter-Black.woff2 +0 -0
- package/fonts/inter/Inter-BlackItalic.woff +0 -0
- package/fonts/inter/Inter-BlackItalic.woff2 +0 -0
- package/fonts/inter/Inter-Bold.woff +0 -0
- package/fonts/inter/Inter-Bold.woff2 +0 -0
- package/fonts/inter/Inter-BoldItalic.woff +0 -0
- package/fonts/inter/Inter-BoldItalic.woff2 +0 -0
- package/fonts/inter/Inter-ExtraBold.woff +0 -0
- package/fonts/inter/Inter-ExtraBold.woff2 +0 -0
- package/fonts/inter/Inter-ExtraBoldItalic.woff +0 -0
- package/fonts/inter/Inter-ExtraBoldItalic.woff2 +0 -0
- package/fonts/inter/Inter-ExtraLight.woff +0 -0
- package/fonts/inter/Inter-ExtraLight.woff2 +0 -0
- package/fonts/inter/Inter-ExtraLightItalic.woff +0 -0
- package/fonts/inter/Inter-ExtraLightItalic.woff2 +0 -0
- package/fonts/inter/Inter-Italic.woff +0 -0
- package/fonts/inter/Inter-Italic.woff2 +0 -0
- package/fonts/inter/Inter-Light.woff +0 -0
- package/fonts/inter/Inter-Light.woff2 +0 -0
- package/fonts/inter/Inter-LightItalic.woff +0 -0
- package/fonts/inter/Inter-LightItalic.woff2 +0 -0
- package/fonts/inter/Inter-Medium.woff +0 -0
- package/fonts/inter/Inter-Medium.woff2 +0 -0
- package/fonts/inter/Inter-MediumItalic.woff +0 -0
- package/fonts/inter/Inter-MediumItalic.woff2 +0 -0
- package/fonts/inter/Inter-Regular.woff +0 -0
- package/fonts/inter/Inter-Regular.woff2 +0 -0
- package/fonts/inter/Inter-SemiBold.woff +0 -0
- package/fonts/inter/Inter-SemiBold.woff2 +0 -0
- package/fonts/inter/Inter-SemiBoldItalic.woff +0 -0
- package/fonts/inter/Inter-SemiBoldItalic.woff2 +0 -0
- package/fonts/inter/Inter-Thin.woff +0 -0
- package/fonts/inter/Inter-Thin.woff2 +0 -0
- package/fonts/inter/Inter-ThinItalic.woff +0 -0
- package/fonts/inter/Inter-ThinItalic.woff2 +0 -0
- package/fonts/inter/Inter-italic.var.woff2 +0 -0
- package/fonts/inter/Inter-roman.var.woff2 +0 -0
- package/images/close.js +63 -0
- package/images/logo.js +22 -0
- package/js/4101.js +19721 -0
- package/js/daily-esm.js +9948 -0
- package/js/date-fns.js +427 -0
- package/js/multimodal_v2.js +1653 -0
- package/js/runtime.js +109 -0
- package/media/Inter-Black.796be8d8bf.woff2 +0 -0
- package/media/Inter-Black.b254104c56.woff +0 -0
- package/media/Inter-BlackItalic.70306b0eae.woff +0 -0
- package/media/Inter-BlackItalic.752f1e0aaa.woff2 +0 -0
- package/media/Inter-Bold.579e0f95ca.woff2 +0 -0
- package/media/Inter-Bold.b1234477a5.woff +0 -0
- package/media/Inter-BoldItalic.3d0d804323.woff +0 -0
- package/media/Inter-BoldItalic.828a494e04.woff2 +0 -0
- package/media/Inter-ExtraBold.208a9e6c99.woff +0 -0
- package/media/Inter-ExtraBold.d65f028165.woff2 +0 -0
- package/media/Inter-ExtraBoldItalic.30429962ec.woff +0 -0
- package/media/Inter-ExtraBoldItalic.8c7eac5ce3.woff2 +0 -0
- package/media/Inter-ExtraLight.15c082a57d.woff +0 -0
- package/media/Inter-ExtraLight.6824177d1e.woff2 +0 -0
- package/media/Inter-ExtraLightItalic.05138dddf3.woff2 +0 -0
- package/media/Inter-ExtraLightItalic.3beee54f59.woff +0 -0
- package/media/Inter-Italic.9beab78452.woff +0 -0
- package/media/Inter-Italic.d593a8df79.woff2 +0 -0
- package/media/Inter-Light.27083fa637.woff2 +0 -0
- package/media/Inter-Light.91dfddd842.woff +0 -0
- package/media/Inter-LightItalic.0a783b89b3.woff2 +0 -0
- package/media/Inter-LightItalic.f8ccf2813f.woff +0 -0
- package/media/Inter-Medium.dc792b508e.woff2 +0 -0
- package/media/Inter-Medium.ec7dd2d9d8.woff +0 -0
- package/media/Inter-MediumItalic.17301e5b40.woff +0 -0
- package/media/Inter-MediumItalic.84d3493a9f.woff2 +0 -0
- package/media/Inter-Regular.f1f0c35b32.woff2 +0 -0
- package/media/Inter-Regular.f356e84aa0.woff +0 -0
- package/media/Inter-SemiBold.55027e4724.woff +0 -0
- package/media/Inter-SemiBold.fcb100c760.woff2 +0 -0
- package/media/Inter-SemiBoldItalic.ab9105ed3b.woff +0 -0
- package/media/Inter-SemiBoldItalic.d90f295d0c.woff2 +0 -0
- package/media/Inter-Thin.16325d9b0f.woff +0 -0
- package/media/Inter-Thin.dafaa44d99.woff2 +0 -0
- package/media/Inter-ThinItalic.4fc662b3cf.woff2 +0 -0
- package/media/Inter-ThinItalic.d3d8994788.woff +0 -0
- package/media/Inter-italic.var.958a0b9742.woff2 +0 -0
- package/media/Inter-roman.var.b2129c009c.woff2 +0 -0
- package/package.json +20 -0
- package/packs/widget/api/docking/docking_host.js +97 -0
- package/packs/widget/api/docking/index.js +294 -0
- package/packs/widget/api/docking/shared.js +164 -0
- package/packs/widget/api/docking/viewport_lock.js +488 -0
- package/packs/widget/api/docking/viewport_resize.js +1203 -0
- package/packs/widget/esm/fonts/Inter-Black.796be8d8bf.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-Black.b254104c56.woff +0 -0
- package/packs/widget/esm/fonts/Inter-BlackItalic.70306b0eae.woff +0 -0
- package/packs/widget/esm/fonts/Inter-BlackItalic.752f1e0aaa.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-Bold.579e0f95ca.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-Bold.b1234477a5.woff +0 -0
- package/packs/widget/esm/fonts/Inter-BoldItalic.3d0d804323.woff +0 -0
- package/packs/widget/esm/fonts/Inter-BoldItalic.828a494e04.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-ExtraBold.208a9e6c99.woff +0 -0
- package/packs/widget/esm/fonts/Inter-ExtraBold.d65f028165.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-ExtraBoldItalic.30429962ec.woff +0 -0
- package/packs/widget/esm/fonts/Inter-ExtraBoldItalic.8c7eac5ce3.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-ExtraLight.15c082a57d.woff +0 -0
- package/packs/widget/esm/fonts/Inter-ExtraLight.6824177d1e.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-ExtraLightItalic.05138dddf3.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-ExtraLightItalic.3beee54f59.woff +0 -0
- package/packs/widget/esm/fonts/Inter-Italic.9beab78452.woff +0 -0
- package/packs/widget/esm/fonts/Inter-Italic.d593a8df79.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-Light.27083fa637.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-Light.91dfddd842.woff +0 -0
- package/packs/widget/esm/fonts/Inter-LightItalic.0a783b89b3.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-LightItalic.f8ccf2813f.woff +0 -0
- package/packs/widget/esm/fonts/Inter-Medium.dc792b508e.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-Medium.ec7dd2d9d8.woff +0 -0
- package/packs/widget/esm/fonts/Inter-MediumItalic.17301e5b40.woff +0 -0
- package/packs/widget/esm/fonts/Inter-MediumItalic.84d3493a9f.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-Regular.f1f0c35b32.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-Regular.f356e84aa0.woff +0 -0
- package/packs/widget/esm/fonts/Inter-SemiBold.55027e4724.woff +0 -0
- package/packs/widget/esm/fonts/Inter-SemiBold.fcb100c760.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-SemiBoldItalic.ab9105ed3b.woff +0 -0
- package/packs/widget/esm/fonts/Inter-SemiBoldItalic.d90f295d0c.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-Thin.16325d9b0f.woff +0 -0
- package/packs/widget/esm/fonts/Inter-Thin.dafaa44d99.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-ThinItalic.4fc662b3cf.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-ThinItalic.d3d8994788.woff +0 -0
- package/packs/widget/esm/fonts/Inter-italic.var.958a0b9742.woff2 +0 -0
- package/packs/widget/esm/fonts/Inter-roman.var.b2129c009c.woff2 +0 -0
- package/packs/widget/esm/index.js +183 -0
- package/packs/widget/esm/qualified.css +5502 -0
- package/routes/app/offers/scripts/OfferMainScript.js +154 -0
- package/routes/app/offers/scripts/constants.js +71 -0
- package/routes/app/offers/scripts/main/ButtonManager.js +65 -0
- package/routes/app/offers/scripts/main/FormManager.js +325 -0
- package/routes/app/offers/scripts/main/MainContext.js +19 -0
- package/routes/app/offers/scripts/main/OfferManager.js +91 -0
- package/routes/app/offers/scripts/main/TriggerManager.js +125 -0
- package/routes/app/offers/scripts/rendering/ContentManager.js +53 -0
- package/routes/app/offers/scripts/rendering/LocationManager.js +83 -0
- package/routes/app/offers/scripts/rendering/RenderedOffer.js +188 -0
- package/routes/app/offers/scripts/rendering/Renderer.js +69 -0
- package/routes/app/offers/scripts/rendering/RenderingInitializer.js +62 -0
- package/routes/app/offers/scripts/rendering/animations/AnimationManager.js +31 -0
- package/routes/app/offers/scripts/rendering/animations/AnimationManagerFooter.js +81 -0
- package/routes/app/offers/scripts/rendering/animations/AnimationManagerHeader.js +81 -0
- package/routes/app/offers/scripts/rendering/animations/AnimationManagerModal.js +117 -0
- package/routes/app/offers/scripts/rendering/animations/AnimationManagerSidebar.js +75 -0
- package/routes/app/offers/scripts/rendering/animations/AnimationResult.js +43 -0
- package/routes/app/offers/scripts/rendering/animations/Animator.js +78 -0
- package/routes/app/offers/scripts/rendering/animations/BaseAnimationManager.js +25 -0
- package/routes/app/offers/scripts/rendering/lib/BaseComponent.js +106 -0
- package/routes/app/offers/scripts/rendering/lib/FormComponent.js +134 -0
- package/routes/app/offers/scripts/rendering/lib/OfferComponent.js +144 -0
- package/routes/app/offers/scripts/rendering/lib/ScrollbarWidth.js +27 -0
- package/routes/app/offers/scripts/rendering/lib/decorators.js +20 -0
- package/routes/app/offers/scripts/rendering/locations/CSSVarsManager.js +66 -0
- package/routes/app/offers/scripts/rendering/locations/ElementResizeObserver.js +49 -0
- package/routes/app/offers/scripts/rendering/locations/footer.js +53 -0
- package/routes/app/offers/scripts/rendering/locations/header/AsyncBatchProcessor.js +70 -0
- package/routes/app/offers/scripts/rendering/locations/header/CSSTransitionObserver.js +182 -0
- package/routes/app/offers/scripts/rendering/locations/header/ElementStyleChangeObserver.js +138 -0
- package/routes/app/offers/scripts/rendering/locations/header/ExternalStyleManager.js +110 -0
- package/routes/app/offers/scripts/rendering/locations/header/Header.js +353 -0
- package/routes/app/offers/scripts/rendering/locations/header/InlineStyleManager.js +105 -0
- package/routes/app/offers/scripts/rendering/locations/header/MatchingElementsObserver.js +107 -0
- package/routes/app/offers/scripts/rendering/locations/header/NewElementsObserver.js +129 -0
- package/routes/app/offers/scripts/rendering/locations/header/RuleWrapper.js +46 -0
- package/routes/app/offers/scripts/rendering/locations/header/SelectorObservable.js +23 -0
- package/routes/app/offers/scripts/rendering/locations/header/SelectorObserver.js +61 -0
- package/routes/app/offers/scripts/rendering/locations/header/ShiftedElementsManager.js +45 -0
- package/routes/app/offers/scripts/rendering/locations/header/StyleElementManager.js +37 -0
- package/routes/app/offers/scripts/rendering/locations/header/StyleElementWrapper.js +62 -0
- package/routes/app/offers/scripts/rendering/locations/header/StyleSelectorObserver/ObservedSelectorValue.js +45 -0
- package/routes/app/offers/scripts/rendering/locations/header/StyleSelectorObserver/ObservedSelectors.js +62 -0
- package/routes/app/offers/scripts/rendering/locations/header/StyleSelectorObserver/StyleSelectorObserver.js +294 -0
- package/routes/app/offers/scripts/rendering/locations/header/StyleSelectorObserver/constants.js +21 -0
- package/routes/app/offers/scripts/rendering/locations/header/WindowResizeObserver.js +43 -0
- package/routes/app/offers/scripts/rendering/locations/header/utils.js +25 -0
- package/routes/app/offers/scripts/rendering/locations/popup.js +66 -0
- package/routes/app/offers/scripts/rendering/locations/sidebar.js +21 -0
- package/routes/app/offers/scripts/rendering/variations/ButtonBanner.js +105 -0
- package/routes/app/offers/scripts/rendering/variations/ButtonModal.js +114 -0
- package/routes/app/offers/scripts/rendering/variations/FormBanner.js +214 -0
- package/routes/app/offers/scripts/rendering/variations/FormModal.js +325 -0
- package/routes/app/offers/scripts/rendering/variations/LinkBanner.js +105 -0
- package/routes/app/offers/scripts/rendering/variations/components/Body.js +29 -0
- package/routes/app/offers/scripts/rendering/variations/components/Button.js +128 -0
- package/routes/app/offers/scripts/rendering/variations/components/DismissButton.js +39 -0
- package/routes/app/offers/scripts/rendering/variations/components/ForegroundImageBanner.js +110 -0
- package/routes/app/offers/scripts/rendering/variations/components/ForegroundImageModal.js +128 -0
- package/routes/app/offers/scripts/rendering/variations/components/Headline.js +94 -0
- package/routes/app/offers/scripts/rendering/variations/components/MultiFieldForm.js +302 -0
- package/routes/app/offers/scripts/rendering/variations/components/Tooltip.js +74 -0
- package/routes/app/offers/scripts/rendering/variations/icons.js +15 -0
- package/routes/app/offers/scripts/utils.js +115 -0
- package/routes/app/offers/utils/HTMLUtils.js +10 -0
- package/routes/app/offers/utils/createTypeGuard.js +32 -0
- package/routes/app/offers/utils/promise-utils.js +22 -0
- package/routes/app/websiteBuilder/stores/storeHelpers.js +18 -0
- package/sounds/message-initial.mp3 +0 -0
- package/sounds/message-received.mp3 +0 -0
- package/sounds/message-sent.mp3 +0 -0
- package/src/arrays.js +15 -0
- package/src/audio.js +106 -0
- package/src/bounded-set.js +16 -0
- package/src/bounding_box_observer.js +129 -0
- package/src/decorators.js +29 -0
- package/src/dom.js +128 -0
- package/src/dom_roots.js +26 -0
- package/src/embedded_forms/EmbeddedForm.js +638 -0
- package/src/embedded_forms/QualifiedEmbeddedForm.js +51 -0
- package/src/embedded_forms/QualifiedFormField.js +137 -0
- package/src/embedded_forms/utils.js +17 -0
- package/src/graphql-types.js +1686 -0
- package/src/iframes.js +86 -0
- package/src/localstorage.js +43 -0
- package/src/mirror/Shipper.js +133 -0
- package/src/mirror/constants.generated.js +13 -0
- package/src/mirror/constants.js +238 -0
- package/src/mirror/shipper/ChangeQueue.js +155 -0
- package/src/mirror/shipper/DOMSerializer.js +392 -0
- package/src/mirror/shipper/observers.js +441 -0
- package/src/mirror/shipper/utils.js +98 -0
- package/src/mixins/disposable.js +125 -0
- package/src/mixins/injectable.js +37 -0
- package/src/personalizations/personalization-manager.js +110 -0
- package/src/personalizations/strategies/node-freezing-strategy.js +174 -0
- package/src/personalizations/utils.js +187 -0
- package/src/promises.js +107 -0
- package/src/proxy.js +144 -0
- package/src/qualified_root.js +35 -0
- package/src/query_params.js +55 -0
- package/src/shadow-dom-helper.js +63 -0
- package/src/singleton_host.js +39 -0
- package/src/smart_website/trigger.js +49 -0
- package/src/smart_website/utils.js +149 -0
- package/src/string.js +53 -0
- package/src/timezone.js +57 -0
- package/src/timing.js +49 -0
- package/src/type-utils.js +76 -0
- package/src/url-utils.js +102 -0
- package/src/url.js +50 -0
- package/src/utils.js +72 -0
- package/src/validation.js.js +29 -0
- package/src/validation_ts.js +6 -0
- package/vendor/actioncable/adapters.js +6 -0
- package/vendor/actioncable/connection.js +204 -0
- package/vendor/actioncable/connection_monitor.js +129 -0
- package/vendor/actioncable/consumer.js +91 -0
- package/vendor/actioncable/index.js +34 -0
- package/vendor/actioncable/internal.js +22 -0
- package/vendor/actioncable/logger.js +28 -0
- package/vendor/actioncable/subscription.js +93 -0
- package/vendor/actioncable/subscriptions.js +89 -0
- package/vendor/open-telemetry-idgenerator.js +43 -0
- package/widget/analytics/facebook_tracker.js +8 -0
- package/widget/analytics/google_analytics_tracker.js +83 -0
- package/widget/analytics/google_tag_manager_tracker.js +22 -0
- package/widget/analytics.js +58 -0
- package/widget/api_handler/api_handler.js +730 -0
- package/widget/api_handler/base_api_handler.js +249 -0
- package/widget/booker_intent_tracker.js +391 -0
- package/widget/booker_outcome_tracker.js +329 -0
- package/widget/capture_widget_exceptions.js +150 -0
- package/widget/channel.js +282 -0
- package/widget/composite_experience_adapter.js +101 -0
- package/widget/constants.generated.js +350 -0
- package/widget/constants.js +21 -0
- package/widget/container.js +193 -0
- package/widget/content_activity_emitter.js +36 -0
- package/widget/data360_visitor.js +67 -0
- package/widget/date_provider.js +11 -0
- package/widget/debug_mode_state.js +175 -0
- package/widget/dummy_module.js +9 -0
- package/widget/eloqua_visitor.js +17 -0
- package/widget/form_cta_booker_intent.js +246 -0
- package/widget/hubspot_visitor.js +39 -0
- package/widget/inline_meeting_booker_page.js +90 -0
- package/widget/local_state/abstract_local_state.js +38 -0
- package/widget/local_state/debug_state/abstract_debug_flow.js +29 -0
- package/widget/local_state/debug_state/custom_form_flow.js +14 -0
- package/widget/local_state/debug_state/hubspot_form_flow.js +19 -0
- package/widget/local_state/debug_state/hubspot_v4_form_flow.js +19 -0
- package/widget/local_state/debug_state/marketo_form_flow.js +20 -0
- package/widget/local_state/debug_state/pardot_form_flow.js +18 -0
- package/widget/local_state/debug_state.js +362 -0
- package/widget/local_state/trace_state.js +20 -0
- package/widget/location_provider.js +9 -0
- package/widget/marketo_visitor.js +39 -0
- package/widget/meetings/tracing/buttons_forms_triggering_tracer.js +124 -0
- package/widget/meetings/tracing/spans/button_spans.js +18 -0
- package/widget/meetings/tracing/spans/form_spans.js +11 -0
- package/widget/multimodal_v2/assets_preloader.js +97 -0
- package/widget/multimodal_v2/components/AppLayout.js +93 -0
- package/widget/multimodal_v2/components/CursorOverlay.js +93 -0
- package/widget/multimodal_v2/components/PointerRectOverlay.js +74 -0
- package/widget/multimodal_v2/components/app/Artifact.js +109 -0
- package/widget/multimodal_v2/components/app/Background.js +27 -0
- package/widget/multimodal_v2/components/app/CalendarLoadingContent.js +255 -0
- package/widget/multimodal_v2/components/app/Chat.js +39 -0
- package/widget/multimodal_v2/components/app/CookieConsentModal.js +149 -0
- package/widget/multimodal_v2/components/app/Foreground.js +48 -0
- package/widget/multimodal_v2/components/app/HiddenInput.js +41 -0
- package/widget/multimodal_v2/components/app/Input.js +72 -0
- package/widget/multimodal_v2/components/app/LightboxExperience.js +769 -0
- package/widget/multimodal_v2/components/app/LoadingOverlay.js +97 -0
- package/widget/multimodal_v2/components/app/Main.js +985 -0
- package/widget/multimodal_v2/components/app/MessengerButton.js +160 -0
- package/widget/multimodal_v2/components/app/Multimodal.js +17 -0
- package/widget/multimodal_v2/components/app/OverlayControls.js +79 -0
- package/widget/multimodal_v2/components/app/Preview.js +32 -0
- package/widget/multimodal_v2/components/app/PrivacyDisclosure.js +57 -0
- package/widget/multimodal_v2/components/app/RotateDeviceOverlay.js +70 -0
- package/widget/multimodal_v2/components/app/Toolbar.js +156 -0
- package/widget/multimodal_v2/components/chat/ChatComposer.js +129 -0
- package/widget/multimodal_v2/components/chat/ChatInputForm.js +398 -0
- package/widget/multimodal_v2/components/chat/ColdStartQuestions.js +354 -0
- package/widget/multimodal_v2/components/chat/ComposerErrorBanner.js +62 -0
- package/widget/multimodal_v2/components/chat/PostCallSurvey.js +359 -0
- package/widget/multimodal_v2/components/chat/preview/FieldRequestRenderer.js +41 -0
- package/widget/multimodal_v2/components/chat/preview/PreviewMessageRenderer.js +60 -0
- package/widget/multimodal_v2/components/chat/preview/SharedOfferRenderer.js +143 -0
- package/widget/multimodal_v2/components/chat/preview/TextRenderer.js +27 -0
- package/widget/multimodal_v2/components/chat/preview/TimelinePreview.js +254 -0
- package/widget/multimodal_v2/components/chat/timeline/CalendarEventOfferRenderer.js +103 -0
- package/widget/multimodal_v2/components/chat/timeline/CalendarEventPickRenderer.js +148 -0
- package/widget/multimodal_v2/components/chat/timeline/FieldEntryRenderer.js +84 -0
- package/widget/multimodal_v2/components/chat/timeline/FieldRequestRenderer.js +56 -0
- package/widget/multimodal_v2/components/chat/timeline/InlinePrivacyDisclosure.js +66 -0
- package/widget/multimodal_v2/components/chat/timeline/LinkPreviewCard.js +70 -0
- package/widget/multimodal_v2/components/chat/timeline/MessageEntry.js +88 -0
- package/widget/multimodal_v2/components/chat/timeline/PresentContentRenderer.js +30 -0
- package/widget/multimodal_v2/components/chat/timeline/PresentDeckRenderer.js +279 -0
- package/widget/multimodal_v2/components/chat/timeline/PresentVideoRenderer.js +131 -0
- package/widget/multimodal_v2/components/chat/timeline/ShareContentRenderer.js +59 -0
- package/widget/multimodal_v2/components/chat/timeline/SharedOfferRenderer.js +131 -0
- package/widget/multimodal_v2/components/chat/timeline/SystemRenderer.js +82 -0
- package/widget/multimodal_v2/components/chat/timeline/TextRenderer.js +66 -0
- package/widget/multimodal_v2/components/chat/timeline/Timeline.js +158 -0
- package/widget/multimodal_v2/components/debug/DebugMultimodalPanel.js +327 -0
- package/widget/multimodal_v2/components/decks/index.js +160 -0
- package/widget/multimodal_v2/components/field_request/BooleanField.js +77 -0
- package/widget/multimodal_v2/components/field_request/FieldComponents.js +69 -0
- package/widget/multimodal_v2/components/field_request/Form.js +87 -0
- package/widget/multimodal_v2/components/field_request/MultiPicklistField.js +240 -0
- package/widget/multimodal_v2/components/field_request/PicklistField.js +166 -0
- package/widget/multimodal_v2/components/field_request/SingleLineInputField.js +69 -0
- package/widget/multimodal_v2/components/field_request/TextField.js +37 -0
- package/widget/multimodal_v2/components/field_request/index.js +170 -0
- package/widget/multimodal_v2/components/helpers/AutoScroll.js +37 -0
- package/widget/multimodal_v2/components/helpers/ErrorBoundary.js +53 -0
- package/widget/multimodal_v2/components/helpers/FocusTrapDialog.js +26 -0
- package/widget/multimodal_v2/components/helpers/ImpressionTracker.js +94 -0
- package/widget/multimodal_v2/components/helpers/ListRenderer.js +37 -0
- package/widget/multimodal_v2/components/helpers/Localization.js +76 -0
- package/widget/multimodal_v2/components/helpers/Persisted.js +166 -0
- package/widget/multimodal_v2/components/helpers/RichText.js +358 -0
- package/widget/multimodal_v2/components/helpers/ScreenReaderHeading.js +17 -0
- package/widget/multimodal_v2/components/helpers/Thumbnail.js +190 -0
- package/widget/multimodal_v2/components/helpers/VisuallyHidden.js +41 -0
- package/widget/multimodal_v2/components/helpers/content_click_payloads.js +58 -0
- package/widget/multimodal_v2/components/helpers/useDraggable.js +103 -0
- package/widget/multimodal_v2/components/helpers/useTextOverflow.js +44 -0
- package/widget/multimodal_v2/components/lightbox_gather/index.js +741 -0
- package/widget/multimodal_v2/components/meetings/ArtifactEntryPoint.js +252 -0
- package/widget/multimodal_v2/components/meetings/MeetingAdditionalAttendees.js +325 -0
- package/widget/multimodal_v2/components/meetings/MeetingBookerEntry.js +100 -0
- package/widget/multimodal_v2/components/meetings/MeetingDetailsCard.js +99 -0
- package/widget/multimodal_v2/components/meetings/MeetingErrorBanner.js +62 -0
- package/widget/multimodal_v2/components/meetings/MeetingOfferEmailStep.js +239 -0
- package/widget/multimodal_v2/components/meetings/MeetingOfferFooter.js +104 -0
- package/widget/multimodal_v2/components/meetings/MeetingOfferSelectionStep.js +60 -0
- package/widget/multimodal_v2/components/meetings/MeetingRepHeader.js +222 -0
- package/widget/multimodal_v2/components/meetings/MeetingStepShell.js +92 -0
- package/widget/multimodal_v2/components/meetings/MeetingSummaryRail.js +515 -0
- package/widget/multimodal_v2/components/meetings/MeetingTimeSelector.js +603 -0
- package/widget/multimodal_v2/components/meetings/MonthDatePicker.js +422 -0
- package/widget/multimodal_v2/components/meetings/NavigationButtons.js +76 -0
- package/widget/multimodal_v2/components/meetings/TimeSlotHeader.js +357 -0
- package/widget/multimodal_v2/components/meetings/WeekViewHeader.js +20 -0
- package/widget/multimodal_v2/components/meetings/constants.js +7 -0
- package/widget/multimodal_v2/components/meetings/index.js +47 -0
- package/widget/multimodal_v2/components/meetings/utils.js +328 -0
- package/widget/multimodal_v2/components/multimodal/Audio.js +28 -0
- package/widget/multimodal_v2/components/multimodal/Controls.js +188 -0
- package/widget/multimodal_v2/components/multimodal/LiveVideo.js +63 -0
- package/widget/multimodal_v2/components/multimodal/MultiModalComponent.js +424 -0
- package/widget/multimodal_v2/components/multimodal/MultimodalAvatar.js +36 -0
- package/widget/multimodal_v2/components/multimodal/OrbAvatar.js +326 -0
- package/widget/multimodal_v2/components/multimodal/Status.js +220 -0
- package/widget/multimodal_v2/components/multimodal/VideoAvatar.js +24 -0
- package/widget/multimodal_v2/components/multimodal/VideoPreview.js +114 -0
- package/widget/multimodal_v2/components/multimodal/useAudioLevelMonitoring.js +96 -0
- package/widget/multimodal_v2/components/multimodal/useMultimodal.js +434 -0
- package/widget/multimodal_v2/components/presentations/index.js +372 -0
- package/widget/multimodal_v2/components/shared/Avatar.js +92 -0
- package/widget/multimodal_v2/components/shared/AvatarGroup.js +135 -0
- package/widget/multimodal_v2/components/shared/Button.js +245 -0
- package/widget/multimodal_v2/components/shared/ButtonGroup.js +133 -0
- package/widget/multimodal_v2/components/shared/ComposerForm.js +98 -0
- package/widget/multimodal_v2/components/shared/SpeakingIndicator.js +239 -0
- package/widget/multimodal_v2/components/shared/ThinkingAnimation.js +165 -0
- package/widget/multimodal_v2/components/shared/Tooltip.js +266 -0
- package/widget/multimodal_v2/components/shared/controls/Dropdown.js +79 -0
- package/widget/multimodal_v2/components/shared/controls/PillToggle.js +142 -0
- package/widget/multimodal_v2/components/shared/controls/TextArea.js +114 -0
- package/widget/multimodal_v2/components/shared/toolCallLabels.js +12 -0
- package/widget/multimodal_v2/components/slides/SlidesThumbnail.js +47 -0
- package/widget/multimodal_v2/components/slides/index.js +61 -0
- package/widget/multimodal_v2/constants.js +88 -0
- package/widget/multimodal_v2/host.split-css.js +2 -0
- package/widget/multimodal_v2/host.string.js +96 -0
- package/widget/multimodal_v2/images/icons.js +582 -0
- package/widget/multimodal_v2/images/posters/piper_low_res.jpg +0 -0
- package/widget/multimodal_v2/index.js +23 -0
- package/widget/multimodal_v2/index.panda.js +28 -0
- package/widget/multimodal_v2/index.split-css.panda.js +2 -0
- package/widget/multimodal_v2/inline_meeting_booker.js +182 -0
- package/widget/multimodal_v2/locales/cs.js +196 -0
- package/widget/multimodal_v2/locales/da.js +196 -0
- package/widget/multimodal_v2/locales/de.js +196 -0
- package/widget/multimodal_v2/locales/en.js +196 -0
- package/widget/multimodal_v2/locales/en_AU.js +197 -0
- package/widget/multimodal_v2/locales/en_GB.js +197 -0
- package/widget/multimodal_v2/locales/es.js +197 -0
- package/widget/multimodal_v2/locales/es_LA.js +196 -0
- package/widget/multimodal_v2/locales/fi.js +196 -0
- package/widget/multimodal_v2/locales/fr.js +197 -0
- package/widget/multimodal_v2/locales/fr_CA.js +196 -0
- package/widget/multimodal_v2/locales/id.js +196 -0
- package/widget/multimodal_v2/locales/index.js +48 -0
- package/widget/multimodal_v2/locales/it.js +196 -0
- package/widget/multimodal_v2/locales/ja.js +196 -0
- package/widget/multimodal_v2/locales/ko.js +196 -0
- package/widget/multimodal_v2/locales/nb.js +196 -0
- package/widget/multimodal_v2/locales/nl.js +196 -0
- package/widget/multimodal_v2/locales/pl.js +196 -0
- package/widget/multimodal_v2/locales/pt_BR.js +196 -0
- package/widget/multimodal_v2/locales/ru.js +196 -0
- package/widget/multimodal_v2/locales/sv.js +196 -0
- package/widget/multimodal_v2/locales/th.js +196 -0
- package/widget/multimodal_v2/locales/tr.js +196 -0
- package/widget/multimodal_v2/locales/vi.js +196 -0
- package/widget/multimodal_v2/locales/zh_CN.js +196 -0
- package/widget/multimodal_v2/locales/zh_TW.js +196 -0
- package/widget/multimodal_v2/multimodal.js +633 -0
- package/widget/multimodal_v2/multimodal_channel.js +195 -0
- package/widget/multimodal_v2/signals/active_conversation_signal.js +33 -0
- package/widget/multimodal_v2/signals/allowed_conversation_mode_signal.js +38 -0
- package/widget/multimodal_v2/signals/artifact_signal.js +22 -0
- package/widget/multimodal_v2/signals/layout_signal.js +98 -0
- package/widget/multimodal_v2/signals/messages_signal.js +207 -0
- package/widget/multimodal_v2/signals/ui_state_signal.js +128 -0
- package/widget/multimodal_v2/stable_bundle_src.js +44 -0
- package/widget/multimodal_v2/stores/ai_conversation_store.js +221 -0
- package/widget/multimodal_v2/stores/artifact_store.js +205 -0
- package/widget/multimodal_v2/stores/base_store.js +16 -0
- package/widget/multimodal_v2/stores/call_store.js +770 -0
- package/widget/multimodal_v2/stores/call_ui_adapter.js +225 -0
- package/widget/multimodal_v2/stores/debug_multimodal_scenario_store.js +471 -0
- package/widget/multimodal_v2/stores/decks_store.js +285 -0
- package/widget/multimodal_v2/stores/device_store.js +63 -0
- package/widget/multimodal_v2/stores/docking_store.js +62 -0
- package/widget/multimodal_v2/stores/field_request_store.js +326 -0
- package/widget/multimodal_v2/stores/meeting_store.js +477 -0
- package/widget/multimodal_v2/stores/participant_store.js +73 -0
- package/widget/multimodal_v2/stores/post_call_survey_store.js +160 -0
- package/widget/multimodal_v2/stores/pounce_tracking_store.js +163 -0
- package/widget/multimodal_v2/stores/pounce_tracking_store_v2.js +511 -0
- package/widget/multimodal_v2/stores/presentations_store.js +111 -0
- package/widget/multimodal_v2/stores/root_store.js +1919 -0
- package/widget/multimodal_v2/stores/screen_share_store.js +217 -0
- package/widget/multimodal_v2/stores/slides_store.js +21 -0
- package/widget/multimodal_v2/stores/translation_store.js +185 -0
- package/widget/multimodal_v2/stores/ui_store.js +496 -0
- package/widget/multimodal_v2/stores/waiting_store.js +159 -0
- package/widget/multimodal_v2/stores/website_navigation_store.js +767 -0
- package/widget/multimodal_v2/styled-system/css/conditions.js +34 -0
- package/widget/multimodal_v2/styled-system/css/css.js +48 -0
- package/widget/multimodal_v2/styled-system/css/cva.js +96 -0
- package/widget/multimodal_v2/styled-system/css/cx.js +13 -0
- package/widget/multimodal_v2/styled-system/css/index.js +15 -0
- package/widget/multimodal_v2/styled-system/css/sva.js +69 -0
- package/widget/multimodal_v2/styled-system/helpers.js +384 -0
- package/widget/multimodal_v2/styled-system/jsx/create-style-context.js +96 -0
- package/widget/multimodal_v2/styled-system/jsx/factory-helper.js +19 -0
- package/widget/multimodal_v2/styled-system/jsx/factory.js +111 -0
- package/widget/multimodal_v2/styled-system/jsx/index.js +12 -0
- package/widget/multimodal_v2/styled-system/jsx/is-valid-prop.js +22 -0
- package/widget/multimodal_v2/types.js +105 -0
- package/widget/multimodal_v2/utils/auto_scroller.js +157 -0
- package/widget/multimodal_v2/utils/flip_animation.js +124 -0
- package/widget/multimodal_v2/utils/focus_gate.js +237 -0
- package/widget/multimodal_v2/utils/locale.js +16 -0
- package/widget/multimodal_v2/utils/media_queries.js +30 -0
- package/widget/multimodal_v2/utils/multimodal_cache.js +19 -0
- package/widget/multimodal_v2/utils/mutation_effect.js +14 -0
- package/widget/multimodal_v2/utils/navigation_interceptor.js +205 -0
- package/widget/multimodal_v2/utils/navigation_strategies/dom_swap.js +393 -0
- package/widget/multimodal_v2/utils/navigation_strategies/index.js +12 -0
- package/widget/multimodal_v2/utils/navigation_strategies/lwr.js +61 -0
- package/widget/multimodal_v2/utils/navigation_strategies/navigation_utils.js +46 -0
- package/widget/multimodal_v2/utils/navigation_strategies/next_js.js +24 -0
- package/widget/multimodal_v2/utils/navigation_strategies/wouter_v3.js +15 -0
- package/widget/multimodal_v2/utils/objects_map.js +38 -0
- package/widget/multimodal_v2/utils/perceived_voice_turn_tracker.js +345 -0
- package/widget/multimodal_v2/utils/sanitize_html.js +132 -0
- package/widget/multimodal_v2/utils/signals.js +97 -0
- package/widget/multimodal_v2/utils/slide_zoom.js +114 -0
- package/widget/multimodal_v2/utils/theme_styles.js +137 -0
- package/widget/multimodal_v2/utils/url_observer.js +52 -0
- package/widget/multimodal_v2/utils/voice_onset_detector.js +127 -0
- package/widget/page_mirror.js +89 -0
- package/widget/page_view_activity_emitter.js +71 -0
- package/widget/pardot_visitor.js +137 -0
- package/widget/personalization_observer.js +96 -0
- package/widget/personalizations_config.js +160 -0
- package/widget/qualified_form/constants.js +23 -0
- package/widget/qualified_form/phone_utils.js +38 -0
- package/widget/qualified_form/qualified_form_action.js +91 -0
- package/widget/qualified_form/qualified_form_action_orchestrator.js +21 -0
- package/widget/qualified_form/qualified_form_api.js +471 -0
- package/widget/scroll_disabler.js +109 -0
- package/widget/server-logger.js +156 -0
- package/widget/smart_website_config.js +112 -0
- package/widget/telemetry/context.js +75 -0
- package/widget/telemetry/index.js +16 -0
- package/widget/telemetry/messenger_uptime.js +80 -0
- package/widget/telemetry/metrics.js +120 -0
- package/widget/telemetry/span.js +82 -0
- package/widget/telemetry/telemetry.js +180 -0
- package/widget/telemetry/tracer.js +41 -0
- package/widget/telemetry/tracing_store.js +310 -0
- package/widget/tracker.js +916 -0
- package/widget/utils/native_globals.js +129 -0
- package/widget/v1_adapter.js +50 -0
- package/widget/v2_adapter.js +368 -0
- package/widget/visitor/base_visitor_state.js +11 -0
- package/widget/visitor/cookie_visitor_state.js +128 -0
- package/widget/visitor/in_memory_visitor_state.js +29 -0
- package/widget/visitor/visitor_state.js +384 -0
- package/widget/visitor.js +356 -0
- package/widget/widget/linked_widget_v2.js +227 -0
- package/widget/widget/page_mirror_factory.js +22 -0
- package/widget/widget/sentry.js +130 -0
- package/widget/widget/widget.js +1698 -0
- package/widget/widget.split-css.js +2 -0
- package/widget/widget_bootstrap.js +97 -0
- package/widget/widget_object.js +73 -0
|
@@ -0,0 +1,638 @@
|
|
|
1
|
+
import { __webpack_require__ } from "../../js/runtime.js";
|
|
2
|
+
import { URL_REGEX } from "../validation_ts.js";
|
|
3
|
+
import { QualifiedFormApi } from "../../widget/qualified_form/qualified_form_api.js";
|
|
4
|
+
import { QualifiedFormField, ClassNames } from "./QualifiedFormField.js";
|
|
5
|
+
import { getElementWithMostText } from "../personalizations/utils.js";
|
|
6
|
+
import { getLoadingSpinnerHTMLForEmbeddedForm } from "./utils.js";
|
|
7
|
+
import { _extends } from "../../js/4101.js";
|
|
8
|
+
import "../../widget/utils/native_globals.js";
|
|
9
|
+
|
|
10
|
+
/* provided dependency */ var EmbeddedForm_setTimeout = __webpack_require__(68034).pS;
|
|
11
|
+
|
|
12
|
+
/* eslint-disable rulesdir/css-units */
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
var EmbeddedForm_FormEvent = /*#__PURE__*/ (/* unused pure expression or super */ null && (function(FormEvent) {
|
|
18
|
+
FormEvent["EmailSubmit"] = "qualifiedFormEmailSubmit";
|
|
19
|
+
FormEvent["FollowUpQuestionsSubmit"] = "qualifiedFormFollowUpQuestionsSubmit";
|
|
20
|
+
FormEvent["Success"] = "qualifiedFormSuccess";
|
|
21
|
+
return FormEvent;
|
|
22
|
+
}({})));
|
|
23
|
+
var EmbeddedForm_FormError = function(FormError) {
|
|
24
|
+
FormError[FormError["EmailBusinessRequired"] = (/* inlined export .EmailError.NON_BUSINESS */"non_business")] = "EmailBusinessRequired";
|
|
25
|
+
FormError[FormError["EmailInvalid"] = (/* inlined export .EmailError.INVALID */"invalid")] = "EmailInvalid";
|
|
26
|
+
return FormError;
|
|
27
|
+
}(EmbeddedForm_FormError || {});
|
|
28
|
+
var EmbeddedForm_FormState = /*#__PURE__*/ function(FormState) {
|
|
29
|
+
FormState["EmailPending"] = "emailPending";
|
|
30
|
+
FormState["EmailReady"] = "emailReady";
|
|
31
|
+
FormState["FollowUpQuestionsPending"] = "followUpQuestionsPending";
|
|
32
|
+
FormState["FollowUpQuestionsReady"] = "followUpQuestionsReady";
|
|
33
|
+
FormState["Success"] = "success";
|
|
34
|
+
return FormState;
|
|
35
|
+
}({});
|
|
36
|
+
/**
|
|
37
|
+
* Factory that returns a custom element class for use with `window.customElements.define()`. The
|
|
38
|
+
* class implements the abstract `EmbeddedForm` class, and binds info for server communication.
|
|
39
|
+
*/ function createEmbeddedFormClass(param) {
|
|
40
|
+
let { channel, iframeManager } = param;
|
|
41
|
+
return class extends EmbeddedForm {
|
|
42
|
+
/**
|
|
43
|
+
* Defines the form's DOM and base CSS. Customers can customize the form's appearance by
|
|
44
|
+
* targeting the form's class names.
|
|
45
|
+
*/ get template() {
|
|
46
|
+
// TODO (WEB-873): Move `template()` to a separate file when stable
|
|
47
|
+
//
|
|
48
|
+
// Embedded forms provide two sets of starter CSS:
|
|
49
|
+
//
|
|
50
|
+
// 1. The base CSS in this template focuses on making the embedded form render like a plain
|
|
51
|
+
// `<div>`, as well as providing other common styles that most customers would need.
|
|
52
|
+
// 2. The snippet CSS (in `EmbeddedFormSnippet.ts`) provides aesthetic styles that the
|
|
53
|
+
// customer can choose to completely delete.
|
|
54
|
+
//
|
|
55
|
+
// By default, add new class names to this base CSS. This reduces the chances that a customer
|
|
56
|
+
// will mention it in their custom styles, which would make it harder for us to change or
|
|
57
|
+
// remove the class name later. If we want to make a class name more obviously customizable,
|
|
58
|
+
// we can move it to the snippet CSS in `EmbeddedFormSnippet.ts`.
|
|
59
|
+
const template = document.createElement("template");
|
|
60
|
+
const emailInputId = "qualified-form-" + this.instanceId + "-email-input";
|
|
61
|
+
template.innerHTML = '\n <style>\n /* Functional/layout styles */\n\n qualified-form {\n display: block;\n container-type: inline-size; /* Let website use container queries */\n }\n\n qualified-form[hidden],\n .QualifiedForm-formError[hidden] {\n display: none;\n }\n\n .QualifiedForm-successContainer[hidden] {\n display: none !important; /* Override `display: flex` in starter CSS */\n }\n\n /* Cosmetic styles; could move to snippet for discoverability */\n\n .QualifiedForm-followUpQuestionsContainer .QualifiedForm-formField {\n margin-block-start: 16px;\n }\n\n .QualifiedForm-formControlContainer {\n margin-block-start: 8px;\n }\n\n .QualifiedForm-formField--checkbox .QualifiedForm-formControlContainer {\n display: inline-block;\n margin-block-start: 0;\n }\n\n\n .QualifiedForm-formControl--textarea {\n resize: vertical;\n }\n\n .QualifiedForm-formErrorsContainer {\n margin-block-start: 8px;\n }\n\n .QualifiedForm-formError {\n color: #E4251B;\n }\n\n .QualifiedForm-formError::before {\n content: "⚠️ ";\n }\n\n .QualifiedForm-followUpQuestionsContainer {\n height: auto;\n }\n\n .QualifiedForm-followUpQuestionsContainer[aria-hidden] {\n height: 0;\n overflow: hidden;\n }\n\n .QualifiedForm-submitButtonContainer {\n margin-block-start: 16px;\n }\n\n qualified-form[data-form-state="emailPending"] .QualifiedForm-submitButton,\n qualified-form[data-form-state="followUpQuestionsPending"] .QualifiedForm-submitButton {\n cursor: wait;\n }\n\n @media (prefers-reduced-motion: no-preference) {\n @supports (interpolate-size: allow-keywords) {\n .QualifiedForm-followUpQuestionsContainer {\n interpolate-size: allow-keywords;\n transition: height 0.5s ease;\n }\n }\n }\n .QualifiedForm-visuallyHidden {\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: 1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n border: 0;\n }\n </style>\n \n <section class="QualifiedForm-root">\n <form aria-label="Qualified Form" class="QualifiedForm-form">\n <div class="QualifiedForm-emailFieldContainer QualifiedForm-formField">\n <label class="QualifiedForm-formLabel" for="' + emailInputId + '">Email</label>\n <div class="QualifiedForm-formControlContainer">\n <input\n class="' + ClassNames.FORM_CONTROL + " " + ClassNames.FORM_CONTROL_TEXT_INPUT + '"\n id="' + emailInputId + '"\n name="email"\n required\n type="email"\n />\n </div>\n <div class="QualifiedForm-formErrorsContainer" role="alert">\n <div class="QualifiedForm-formError QualifiedForm-formError--emailInvalid" hidden>\n Please enter a valid email address.\n </div>\n <div class="QualifiedForm-formError QualifiedForm-formError--emailBusinessRequired" hidden>\n Please enter a business email address.\n </div>\n </div>\n </div>\n <div aria-hidden="true" class="QualifiedForm-followUpQuestionsContainer"></div>\n <div class="QualifiedForm-submitButtonContainer">\n <button class="' + EmbeddedForm.SUBMIT_BUTTON_CLASS_NAME + '" type="submit" aria-label="submit">\n Submit\n </button>\n </div>\n </form>\n ' + '\n <div role="status">\n <div class="QualifiedForm-successContainer" hidden>\n <div class="QualifiedForm-successMessage">Thank you for your submission!</div>\n </div>\n </div>\n </section>\n ';
|
|
62
|
+
return template;
|
|
63
|
+
}
|
|
64
|
+
constructor(...args){
|
|
65
|
+
super(...args), this.channel = channel, this.iframeManager = iframeManager, this.qualifiedFormApi = null;
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Defines a custom element, `<qualified-form>`, which we use to embed a Qualified Form on a
|
|
71
|
+
* customer's website. The form's snippet provides:
|
|
72
|
+
*
|
|
73
|
+
* - A `<script>` element that uses `window.qualified("showForm", ...)` to render a
|
|
74
|
+
* `<qualified-form>` element.
|
|
75
|
+
* - Starter CSS that the customer can customize to match their website's visual language.
|
|
76
|
+
*
|
|
77
|
+
* This custom element and its HTML attributes are an internal implementation detail. For the
|
|
78
|
+
* customer-facing public API, refer to the `window.qualified("showForm", ...)` implementation.
|
|
79
|
+
*/ class EmbeddedForm extends HTMLElement {
|
|
80
|
+
connectedCallback() {
|
|
81
|
+
this.appendChild(this.template.content.cloneNode(true));
|
|
82
|
+
// Render content
|
|
83
|
+
this.setFormState("emailReady");
|
|
84
|
+
this.validateAttributes();
|
|
85
|
+
this.renderElements();
|
|
86
|
+
// Set up event handling
|
|
87
|
+
const emailInput = this.getElement("emailInput");
|
|
88
|
+
const form = this.getElement("form");
|
|
89
|
+
emailInput == null ? void 0 : emailInput.addEventListener("input", this.handleEmailInputInput);
|
|
90
|
+
form == null ? void 0 : form.addEventListener("submit", this.handleFormSubmit);
|
|
91
|
+
this.qualifiedFormApi = this.createQualifiedFormApi();
|
|
92
|
+
}
|
|
93
|
+
attributeChangedCallback(name, oldValue, newValue) {
|
|
94
|
+
this.validateAttributes([
|
|
95
|
+
name
|
|
96
|
+
]);
|
|
97
|
+
this.renderElements();
|
|
98
|
+
}
|
|
99
|
+
printError(message) {
|
|
100
|
+
// eslint-disable-next-line no-console
|
|
101
|
+
console.error("[Qualified] Embedded form: " + message);
|
|
102
|
+
}
|
|
103
|
+
renderElements() {
|
|
104
|
+
this.renderEmailInput();
|
|
105
|
+
this.renderSubmitButton();
|
|
106
|
+
this.renderSuccessMessage();
|
|
107
|
+
}
|
|
108
|
+
createQualifiedFormApi() {
|
|
109
|
+
if (this.formExperienceApiName == null) {
|
|
110
|
+
this.printError("`formExperienceApiName` property is required");
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
return new QualifiedFormApi({
|
|
114
|
+
channel: this.channel,
|
|
115
|
+
config: {
|
|
116
|
+
validateBusinessEmail: this.validateBusinessEmail === "true"
|
|
117
|
+
},
|
|
118
|
+
formApiName: this.formExperienceApiName,
|
|
119
|
+
iframeManager: this.iframeManager,
|
|
120
|
+
source: (/* inlined export .QualifiedFormSource.EMBEDDED */"embedded")
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
/* Attributes/properties */ // Reflect attributes and properties so we can configure the custom element via either HTML or JS,
|
|
124
|
+
// similar to built-in elements. Treat attributes as the source of truth, and property accessors
|
|
125
|
+
// as JS convenience methods.
|
|
126
|
+
//
|
|
127
|
+
// Caution: Because this component extends the native `HTMLElement`, it might override future
|
|
128
|
+
// additions to the `HTMLElement` prototype.
|
|
129
|
+
setOrRemoveAttribute(name, value) {
|
|
130
|
+
if (value != null) {
|
|
131
|
+
this.setAttribute(name, value);
|
|
132
|
+
} else {
|
|
133
|
+
this.removeAttribute(name);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
get emailInputLabelText() {
|
|
137
|
+
return this.getAttribute(EmbeddedForm.EMAIL_INPUT_LABEL_TEXT_ATTRIBUTE);
|
|
138
|
+
}
|
|
139
|
+
set emailInputLabelText(value) {
|
|
140
|
+
this.setOrRemoveAttribute(EmbeddedForm.EMAIL_INPUT_LABEL_TEXT_ATTRIBUTE, value);
|
|
141
|
+
}
|
|
142
|
+
get emailInputPlaceholderText() {
|
|
143
|
+
return this.getAttribute(EmbeddedForm.EMAIL_INPUT_PLACEHOLDER_TEXT_ATTRIBUTE);
|
|
144
|
+
}
|
|
145
|
+
set emailInputPlaceholderText(value) {
|
|
146
|
+
this.setOrRemoveAttribute(EmbeddedForm.EMAIL_INPUT_PLACEHOLDER_TEXT_ATTRIBUTE, value);
|
|
147
|
+
}
|
|
148
|
+
get emailSubmitButtonInnerHtml() {
|
|
149
|
+
return this.getAttribute(EmbeddedForm.EMAIL_SUBMIT_BUTTON_INNER_HTML_ATTRIBUTE);
|
|
150
|
+
}
|
|
151
|
+
set emailSubmitButtonInnerHtml(value) {
|
|
152
|
+
this.setOrRemoveAttribute(EmbeddedForm.EMAIL_SUBMIT_BUTTON_INNER_HTML_ATTRIBUTE, value);
|
|
153
|
+
}
|
|
154
|
+
get formControlCheckboxClassName() {
|
|
155
|
+
return this.getAttribute(EmbeddedForm.FORM_CONTROL_CHECKBOX_CLASS_NAME_ATTRIBUTE);
|
|
156
|
+
}
|
|
157
|
+
set formControlCheckboxClassName(value) {
|
|
158
|
+
this.setOrRemoveAttribute(EmbeddedForm.FORM_CONTROL_CHECKBOX_CLASS_NAME_ATTRIBUTE, value);
|
|
159
|
+
}
|
|
160
|
+
get formControlTextareaClassName() {
|
|
161
|
+
return this.getAttribute(EmbeddedForm.FORM_CONTROL_TEXTAREA_CLASS_NAME_ATTRIBUTE);
|
|
162
|
+
}
|
|
163
|
+
set formControlTextareaClassName(value) {
|
|
164
|
+
this.setOrRemoveAttribute(EmbeddedForm.FORM_CONTROL_TEXTAREA_CLASS_NAME_ATTRIBUTE, value);
|
|
165
|
+
}
|
|
166
|
+
get formControlTextInputClassName() {
|
|
167
|
+
return this.getAttribute(EmbeddedForm.FORM_CONTROL_TEXT_INPUT_CLASS_NAME_ATTRIBUTE);
|
|
168
|
+
}
|
|
169
|
+
set formControlTextInputClassName(value) {
|
|
170
|
+
this.setOrRemoveAttribute(EmbeddedForm.FORM_CONTROL_TEXT_INPUT_CLASS_NAME_ATTRIBUTE, value);
|
|
171
|
+
}
|
|
172
|
+
get formControlFormLabelClassName() {
|
|
173
|
+
return this.getAttribute(EmbeddedForm.FORM_CONTROL_FORM_LABEL_CLASS_NAME_ATTRIBUTE);
|
|
174
|
+
}
|
|
175
|
+
set formControlFormLabelClassName(value) {
|
|
176
|
+
this.setOrRemoveAttribute(EmbeddedForm.FORM_CONTROL_FORM_LABEL_CLASS_NAME_ATTRIBUTE, value);
|
|
177
|
+
}
|
|
178
|
+
get formControlFormLabelOptionalClassName() {
|
|
179
|
+
return this.getAttribute(EmbeddedForm.FORM_CONTROL_FORM_LABEL_OPTIONAL_CLASS_NAME_ATTRIBUTE);
|
|
180
|
+
}
|
|
181
|
+
set formControlFormLabelOptionalClassName(value) {
|
|
182
|
+
this.setOrRemoveAttribute(EmbeddedForm.FORM_CONTROL_FORM_LABEL_OPTIONAL_CLASS_NAME_ATTRIBUTE, value);
|
|
183
|
+
}
|
|
184
|
+
get formControlSelectClassName() {
|
|
185
|
+
return this.getAttribute(EmbeddedForm.FORM_CONTROL_SELECT_CLASS_NAME_ATTRIBUTE);
|
|
186
|
+
}
|
|
187
|
+
set formControlSelectClassName(value) {
|
|
188
|
+
this.setOrRemoveAttribute(EmbeddedForm.FORM_CONTROL_SELECT_CLASS_NAME_ATTRIBUTE, value);
|
|
189
|
+
}
|
|
190
|
+
get formExperienceApiName() {
|
|
191
|
+
return this.getAttribute(EmbeddedForm.FORM_EXPERIENCE_API_NAME_ATTRIBUTE);
|
|
192
|
+
}
|
|
193
|
+
set formExperienceApiName(value) {
|
|
194
|
+
this.setOrRemoveAttribute(EmbeddedForm.FORM_EXPERIENCE_API_NAME_ATTRIBUTE, value);
|
|
195
|
+
}
|
|
196
|
+
get submitButtonClassName() {
|
|
197
|
+
return this.getAttribute(EmbeddedForm.SUBMIT_BUTTON_CLASS_NAME_ATTRIBUTE);
|
|
198
|
+
}
|
|
199
|
+
set submitButtonClassName(value) {
|
|
200
|
+
this.setOrRemoveAttribute(EmbeddedForm.SUBMIT_BUTTON_CLASS_NAME_ATTRIBUTE, value);
|
|
201
|
+
}
|
|
202
|
+
get successMessageInnerHtml() {
|
|
203
|
+
return this.getAttribute(EmbeddedForm.SUCCESS_MESSAGE_INNER_HTML_ATTRIBUTE);
|
|
204
|
+
}
|
|
205
|
+
set successMessageInnerHtml(value) {
|
|
206
|
+
this.setOrRemoveAttribute(EmbeddedForm.SUCCESS_MESSAGE_INNER_HTML_ATTRIBUTE, value);
|
|
207
|
+
}
|
|
208
|
+
get successRedirectUrl() {
|
|
209
|
+
const url = this.getAttribute(EmbeddedForm.SUCCESS_REDIRECT_URL_ATTRIBUTE);
|
|
210
|
+
return url != null && URL_REGEX.test(url) ? url : null;
|
|
211
|
+
}
|
|
212
|
+
set successRedirectUrl(value) {
|
|
213
|
+
if (value == null || URL_REGEX.test(value)) {
|
|
214
|
+
this.setOrRemoveAttribute(EmbeddedForm.SUCCESS_REDIRECT_URL_ATTRIBUTE, value);
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
get validateBusinessEmail() {
|
|
218
|
+
return this.getAttribute(EmbeddedForm.VALIDATE_BUSINESS_EMAIL_ATTRIBUTE);
|
|
219
|
+
}
|
|
220
|
+
set validateBusinessEmail(value) {
|
|
221
|
+
this.setOrRemoveAttribute(EmbeddedForm.VALIDATE_BUSINESS_EMAIL_ATTRIBUTE, value);
|
|
222
|
+
}
|
|
223
|
+
get version() {
|
|
224
|
+
return this.getAttribute(EmbeddedForm.VERSION_ATTRIBUTE);
|
|
225
|
+
}
|
|
226
|
+
set version(value) {
|
|
227
|
+
this.setOrRemoveAttribute(EmbeddedForm.VERSION_ATTRIBUTE, value);
|
|
228
|
+
}
|
|
229
|
+
validateAttributes(attributeNames) {
|
|
230
|
+
if (attributeNames === void 0) attributeNames = EmbeddedForm.observedAttributes;
|
|
231
|
+
if (attributeNames.includes(EmbeddedForm.FORM_EXPERIENCE_API_NAME_ATTRIBUTE)) {
|
|
232
|
+
if (this.formExperienceApiName == null || this.formExperienceApiName === "") {
|
|
233
|
+
this.printError("The `" + EmbeddedForm.FORM_EXPERIENCE_API_NAME_ATTRIBUTE + "` attribute is required");
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
if (attributeNames.includes(EmbeddedForm.VALIDATE_BUSINESS_EMAIL_ATTRIBUTE)) {
|
|
237
|
+
if (this.validateBusinessEmail != null && this.validateBusinessEmail !== "true") {
|
|
238
|
+
this.printError("Invalid `" + EmbeddedForm.VALIDATE_BUSINESS_EMAIL_ATTRIBUTE + "` attribute value: " + this.validateBusinessEmail);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
if (attributeNames.includes(EmbeddedForm.VERSION_ATTRIBUTE)) {
|
|
242
|
+
if (this.version == null || this.version === "") {
|
|
243
|
+
this.printError("The `q-version` attribute is required");
|
|
244
|
+
} else if (this.version !== "0") {
|
|
245
|
+
this.printError("Invalid `" + EmbeddedForm.VERSION_ATTRIBUTE + "` attribute value: " + this.version);
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
/* Rendering */ getElement(elementName) {
|
|
250
|
+
let selector;
|
|
251
|
+
if (elementName === "emailInput") {
|
|
252
|
+
selector = ".QualifiedForm-emailFieldContainer ." + ClassNames.FORM_CONTROL;
|
|
253
|
+
} else if (elementName === "emailInputLabel") {
|
|
254
|
+
selector = ".QualifiedForm-emailFieldContainer .QualifiedForm-formLabel";
|
|
255
|
+
} else if (elementName === "followUpQuestionsContainer") {
|
|
256
|
+
selector = ".QualifiedForm-followUpQuestionsContainer";
|
|
257
|
+
} else if (elementName === "form") {
|
|
258
|
+
selector = ".QualifiedForm-form";
|
|
259
|
+
} else if (elementName === "formErrorEmailBusinessRequired") {
|
|
260
|
+
selector = ".QualifiedForm-formError--emailBusinessRequired";
|
|
261
|
+
} else if (elementName === "formErrorEmailInvalid") {
|
|
262
|
+
selector = ".QualifiedForm-formError--emailInvalid";
|
|
263
|
+
} else if (elementName === "submitButton") {
|
|
264
|
+
selector = "." + EmbeddedForm.SUBMIT_BUTTON_CLASS_NAME;
|
|
265
|
+
} else if (elementName === "successContainer") {
|
|
266
|
+
selector = ".QualifiedForm-successContainer";
|
|
267
|
+
} else if (elementName === "successMessage") {
|
|
268
|
+
selector = ".QualifiedForm-successMessage";
|
|
269
|
+
}
|
|
270
|
+
if (selector != null) {
|
|
271
|
+
return this.querySelector(selector);
|
|
272
|
+
} else {
|
|
273
|
+
throw new Error("Unknown element name: " + elementName);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
getFormState() {
|
|
277
|
+
const state = this.getAttribute(EmbeddedForm.FORM_STATE_ATTRIBUTE);
|
|
278
|
+
if (!Object.values(EmbeddedForm_FormState).includes(state)) {
|
|
279
|
+
throw new Error("Unknown form state: " + state);
|
|
280
|
+
}
|
|
281
|
+
return state;
|
|
282
|
+
}
|
|
283
|
+
setFormState(formState) {
|
|
284
|
+
// If this method grows to affect more elements, consider replacing it with an observer pattern.
|
|
285
|
+
const emailInput = this.getElement("emailInput");
|
|
286
|
+
const form = this.getElement("form");
|
|
287
|
+
const followUpQuestionsContainer = this.getElement("followUpQuestionsContainer");
|
|
288
|
+
const submitButton = this.getElement("submitButton");
|
|
289
|
+
const successContainer = this.getElement("successContainer");
|
|
290
|
+
// Let the customer apply form-wide styling based on the form state
|
|
291
|
+
this.setAttribute(EmbeddedForm.FORM_STATE_ATTRIBUTE, formState);
|
|
292
|
+
// Accessibility caveat: If the user had focus on the email input or submit button, then we
|
|
293
|
+
// disable that element, focus might be lost. The customer may want to handle this by tracking
|
|
294
|
+
// the current/next focusable elements on the page, then advancing focus when this form is
|
|
295
|
+
// submitted. We may not want this form to manage focus for elements outside of itself.
|
|
296
|
+
if (emailInput) {
|
|
297
|
+
emailInput.disabled = formState === "emailPending" || formState === "success";
|
|
298
|
+
}
|
|
299
|
+
if (followUpQuestionsContainer) {
|
|
300
|
+
if (formState === "followUpQuestionsReady") {
|
|
301
|
+
followUpQuestionsContainer.removeAttribute("aria-hidden");
|
|
302
|
+
} else {
|
|
303
|
+
followUpQuestionsContainer.setAttribute("aria-hidden", "true");
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
if (form) {
|
|
307
|
+
if (formState === "success") {
|
|
308
|
+
// We use the form's natural size to prop open `successContainer` to the same dimensions.
|
|
309
|
+
// When `successContainer` is visible (as an overlay in the starter CSS), the form uses
|
|
310
|
+
// `aria-hidden` — not `hidden` — to hide it from screen readers but still prop open
|
|
311
|
+
// `successContainer` to the original size.
|
|
312
|
+
form.setAttribute("aria-hidden", "true");
|
|
313
|
+
} else {
|
|
314
|
+
form.removeAttribute("aria-hidden");
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (submitButton) {
|
|
318
|
+
submitButton.disabled = formState === "emailPending" || formState === "success";
|
|
319
|
+
if (formState === "emailReady" || formState === "followUpQuestionsPending" || formState === "followUpQuestionsReady") {
|
|
320
|
+
// TODO (WEB-1248): Support customizing the submit button text for follow-up questions
|
|
321
|
+
submitButton.innerHTML = "Submit";
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
if (successContainer) {
|
|
325
|
+
successContainer.hidden = formState !== "success";
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
renderEmailInput() {
|
|
329
|
+
var _this_emailInputPlaceholderText;
|
|
330
|
+
const emailInput = this.getElement("emailInput");
|
|
331
|
+
const emailInputLabel = this.getElement("emailInputLabel");
|
|
332
|
+
if (!emailInput || !emailInputLabel) {
|
|
333
|
+
return;
|
|
334
|
+
}
|
|
335
|
+
// apply custom class names to email text input label
|
|
336
|
+
const formLabelClassName = this.formControlFormLabelClassName;
|
|
337
|
+
if (formLabelClassName != null) {
|
|
338
|
+
const formLabelClassNames = formLabelClassName.split(/\s+/);
|
|
339
|
+
emailInputLabel.className = [
|
|
340
|
+
ClassNames.FORM_CONTROL_FORM_LABEL,
|
|
341
|
+
...formLabelClassNames
|
|
342
|
+
].join(" ");
|
|
343
|
+
}
|
|
344
|
+
// apply custom class names to email text input
|
|
345
|
+
const textInputclassName = this.formControlTextInputClassName;
|
|
346
|
+
const defaultPlaceholderText = this.validateBusinessEmail === "true" ? "Business email" : "Email";
|
|
347
|
+
const placeholderText = (_this_emailInputPlaceholderText = this.emailInputPlaceholderText) != null ? _this_emailInputPlaceholderText : defaultPlaceholderText;
|
|
348
|
+
if (textInputclassName != null) {
|
|
349
|
+
const textInputclassNames = textInputclassName.split(/\s+/);
|
|
350
|
+
emailInput.className = [
|
|
351
|
+
ClassNames.FORM_CONTROL,
|
|
352
|
+
ClassNames.FORM_CONTROL_TEXT_INPUT,
|
|
353
|
+
...textInputclassNames
|
|
354
|
+
].join(" ");
|
|
355
|
+
}
|
|
356
|
+
emailInput.setAttribute("placeholder", placeholderText);
|
|
357
|
+
}
|
|
358
|
+
renderSubmitButton() {
|
|
359
|
+
const submitButton = this.getElement("submitButton");
|
|
360
|
+
if (!submitButton) {
|
|
361
|
+
return;
|
|
362
|
+
}
|
|
363
|
+
const currentFormState = this.getFormState();
|
|
364
|
+
if ([
|
|
365
|
+
"emailPending",
|
|
366
|
+
"followUpQuestionsPending"
|
|
367
|
+
].includes(currentFormState)) {
|
|
368
|
+
// get color attribute for loading spinner icon
|
|
369
|
+
const submitButtonTextElement = getElementWithMostText(submitButton);
|
|
370
|
+
const { color } = getComputedStyle(submitButtonTextElement || submitButton);
|
|
371
|
+
submitButton.innerHTML = getLoadingSpinnerHTMLForEmbeddedForm(color, 11);
|
|
372
|
+
return;
|
|
373
|
+
}
|
|
374
|
+
const className = this.submitButtonClassName;
|
|
375
|
+
if (className != null) {
|
|
376
|
+
const newClassNames = className.split(" ");
|
|
377
|
+
submitButton.className = [
|
|
378
|
+
EmbeddedForm.SUBMIT_BUTTON_CLASS_NAME,
|
|
379
|
+
...newClassNames
|
|
380
|
+
].join(" ");
|
|
381
|
+
}
|
|
382
|
+
const innerHtml = this.emailSubmitButtonInnerHtml;
|
|
383
|
+
if (innerHtml != null) {
|
|
384
|
+
submitButton.innerHTML = innerHtml;
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
renderSuccessMessage() {
|
|
388
|
+
const successMessage = this.getElement("successMessage");
|
|
389
|
+
if (!successMessage) {
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
const innerHtml = this.successMessageInnerHtml;
|
|
393
|
+
if (innerHtml != null) {
|
|
394
|
+
successMessage.innerHTML = innerHtml;
|
|
395
|
+
}
|
|
396
|
+
}
|
|
397
|
+
getFormData() {
|
|
398
|
+
const form = this.getElement("form");
|
|
399
|
+
const formData = new FormData(form);
|
|
400
|
+
const formDataKeys = Array.from(new Set(formData.keys()));
|
|
401
|
+
// The form may eventually accept custom HTML for additional controls, such as captcha
|
|
402
|
+
// validation. Don't include these input values; find only our expected controls.
|
|
403
|
+
const followUpQuestionEntries = formDataKeys.reduce((entries, key)=>{
|
|
404
|
+
if (key.startsWith("followUpQuestions[")) {
|
|
405
|
+
var _formData_getAll_at;
|
|
406
|
+
// Checkboxes (boolean fields) can have multiple values in the DOM: `false` as the
|
|
407
|
+
// default, and `true` when checked. Use the last value.
|
|
408
|
+
const value = (_formData_getAll_at = formData.getAll(key).at(-1)) != null ? _formData_getAll_at : "";
|
|
409
|
+
return entries.concat([
|
|
410
|
+
[
|
|
411
|
+
key,
|
|
412
|
+
value
|
|
413
|
+
]
|
|
414
|
+
]);
|
|
415
|
+
}
|
|
416
|
+
return entries;
|
|
417
|
+
}, []);
|
|
418
|
+
const result = {
|
|
419
|
+
email: formData.get("email")
|
|
420
|
+
};
|
|
421
|
+
if (followUpQuestionEntries.length > 0) {
|
|
422
|
+
result.followUpQuestions = followUpQuestionEntries;
|
|
423
|
+
}
|
|
424
|
+
return result;
|
|
425
|
+
}
|
|
426
|
+
applyFollowUpQuestionFormFieldClasses(followUpQuestionsContainer, followUpQuestionElementsSelector, classesToApply) {
|
|
427
|
+
var _ref;
|
|
428
|
+
const classNames = (_ref = classesToApply == null ? void 0 : classesToApply.split(/\s+/)) != null ? _ref : [];
|
|
429
|
+
followUpQuestionsContainer.querySelectorAll("." + followUpQuestionElementsSelector).forEach((element)=>{
|
|
430
|
+
element.classList.add(...classNames);
|
|
431
|
+
});
|
|
432
|
+
}
|
|
433
|
+
renderFollowUpQuestions(questionsForm) {
|
|
434
|
+
const { inputFields } = questionsForm;
|
|
435
|
+
const formFields = inputFields.map((inputFieldData)=>{
|
|
436
|
+
const formControl = new QualifiedFormField(inputFieldData, {
|
|
437
|
+
fieldNamespace: "followUpQuestions"
|
|
438
|
+
});
|
|
439
|
+
return formControl.toHtml();
|
|
440
|
+
});
|
|
441
|
+
const formFieldsHtml = formFields.join("");
|
|
442
|
+
const followUpQuestionsContainer = this.getElement("followUpQuestionsContainer");
|
|
443
|
+
if (followUpQuestionsContainer) {
|
|
444
|
+
followUpQuestionsContainer.innerHTML = formFieldsHtml;
|
|
445
|
+
this.applyFollowUpQuestionFormFieldClasses(followUpQuestionsContainer, ClassNames.FORM_CONTROL_TEXT_INPUT, this.formControlTextInputClassName);
|
|
446
|
+
this.applyFollowUpQuestionFormFieldClasses(followUpQuestionsContainer, ClassNames.FORM_CONTROL_TEXTAREA, this.formControlTextareaClassName);
|
|
447
|
+
this.applyFollowUpQuestionFormFieldClasses(followUpQuestionsContainer, ClassNames.FORM_FIELD_CHECKBOX, this.formControlCheckboxClassName);
|
|
448
|
+
this.applyFollowUpQuestionFormFieldClasses(followUpQuestionsContainer, ClassNames.FORM_CONTROL_FORM_LABEL, this.formControlFormLabelClassName);
|
|
449
|
+
this.applyFollowUpQuestionFormFieldClasses(followUpQuestionsContainer, ClassNames.FORM_CONTROL_FORM_LABEL_OPTIONAL, this.formControlFormLabelOptionalClassName);
|
|
450
|
+
this.applyFollowUpQuestionFormFieldClasses(followUpQuestionsContainer, ClassNames.FORM_CONTROL_SELECT, this.formControlSelectClassName);
|
|
451
|
+
}
|
|
452
|
+
}
|
|
453
|
+
showErrorMessage(errorKey) {
|
|
454
|
+
let errorElement;
|
|
455
|
+
let invalidElement;
|
|
456
|
+
if (errorKey === EmbeddedForm_FormError.EmailBusinessRequired) {
|
|
457
|
+
errorElement = this.getElement("formErrorEmailBusinessRequired");
|
|
458
|
+
invalidElement = this.getElement("emailInput");
|
|
459
|
+
} else if (errorKey === EmbeddedForm_FormError.EmailInvalid) {
|
|
460
|
+
errorElement = this.getElement("formErrorEmailInvalid");
|
|
461
|
+
invalidElement = this.getElement("emailInput");
|
|
462
|
+
}
|
|
463
|
+
if (errorElement && invalidElement) {
|
|
464
|
+
errorElement.removeAttribute("hidden");
|
|
465
|
+
invalidElement.setAttribute("aria-invalid", "true");
|
|
466
|
+
} else {
|
|
467
|
+
this.printError("Unknown error key: " + errorKey);
|
|
468
|
+
}
|
|
469
|
+
}
|
|
470
|
+
hideErrorMessages() {
|
|
471
|
+
var _this_querySelectorAll;
|
|
472
|
+
const errorElements = (_this_querySelectorAll = this.querySelectorAll("." + EmbeddedForm.FORM_ERROR_CLASS_NAME)) != null ? _this_querySelectorAll : [];
|
|
473
|
+
for (const errorElement of errorElements){
|
|
474
|
+
errorElement.setAttribute("hidden", "true");
|
|
475
|
+
}
|
|
476
|
+
this.querySelectorAll("[aria-invalid]").forEach((element)=>{
|
|
477
|
+
element.removeAttribute("aria-invalid");
|
|
478
|
+
});
|
|
479
|
+
}
|
|
480
|
+
/** Either show the `Success` state or redirect to a customer-defined URL. */ doSuccessStep(formData) {
|
|
481
|
+
// If the form will redirect after success, don't flash the success message, since its
|
|
482
|
+
// contents might not match the target page.
|
|
483
|
+
if (!this.successRedirectUrl) {
|
|
484
|
+
this.setFormState("success");
|
|
485
|
+
}
|
|
486
|
+
// Even if the form will redirect after success, first trigger a success event so customers
|
|
487
|
+
// have a brief chance to run custom logic, such as calling an analytics service.
|
|
488
|
+
this.triggerEvent("qualifiedFormSuccess", {
|
|
489
|
+
formData
|
|
490
|
+
});
|
|
491
|
+
if (this.successRedirectUrl) {
|
|
492
|
+
window.location.href = this.successRedirectUrl;
|
|
493
|
+
}
|
|
494
|
+
}
|
|
495
|
+
/* Events */ triggerEvent(eventName, eventData) {
|
|
496
|
+
const detail = _extends({
|
|
497
|
+
formExperienceApiName: this.formExperienceApiName
|
|
498
|
+
}, eventData);
|
|
499
|
+
const event = new CustomEvent(eventName, {
|
|
500
|
+
bubbles: true,
|
|
501
|
+
detail
|
|
502
|
+
});
|
|
503
|
+
this.dispatchEvent(event);
|
|
504
|
+
}
|
|
505
|
+
constructor(...args){
|
|
506
|
+
super(...args), this.instanceId = EmbeddedForm.instanceId++, this.handleEmailInputInput = ()=>{
|
|
507
|
+
if (this.getFormState() === "emailReady") {
|
|
508
|
+
return;
|
|
509
|
+
}
|
|
510
|
+
const followUpQuestionsContainer = this.getElement("followUpQuestionsContainer");
|
|
511
|
+
if (!followUpQuestionsContainer) {
|
|
512
|
+
return;
|
|
513
|
+
}
|
|
514
|
+
this.setFormState("emailReady");
|
|
515
|
+
// Clear follow-up questions after CSS transition ends
|
|
516
|
+
EmbeddedForm_setTimeout(()=>{
|
|
517
|
+
followUpQuestionsContainer.innerHTML = "";
|
|
518
|
+
}, 500);
|
|
519
|
+
}, this.handleFormSubmit = async (event)=>{
|
|
520
|
+
// Don't do a normal form submission; we submit form data via the WebSocket channel instead.
|
|
521
|
+
event.preventDefault();
|
|
522
|
+
const formState = this.getFormState();
|
|
523
|
+
if (formState === "emailReady") {
|
|
524
|
+
this.handleFormEmailSubmit(event);
|
|
525
|
+
} else if (formState === "followUpQuestionsReady") {
|
|
526
|
+
this.handleFormFollowUpQuestionsSubmit(event);
|
|
527
|
+
} else {
|
|
528
|
+
throw new Error("Invalid form state: " + formState);
|
|
529
|
+
}
|
|
530
|
+
}, this.handleFormEmailSubmit = async (event)=>{
|
|
531
|
+
const formData = this.getFormData();
|
|
532
|
+
if (formData.email == null || this.qualifiedFormApi == null) {
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
this.triggerEvent("qualifiedFormEmailSubmit", {
|
|
536
|
+
formData
|
|
537
|
+
});
|
|
538
|
+
// Read `formData` first, *then* set the form state to `EmailPending`, because the latter
|
|
539
|
+
// disables form controls and excludes them from `formData`.
|
|
540
|
+
this.setFormState("emailPending");
|
|
541
|
+
this.hideErrorMessages();
|
|
542
|
+
const response = this.qualifiedFormApi.submitEmail(formData.email);
|
|
543
|
+
if (response.success) {
|
|
544
|
+
const result = await response.result;
|
|
545
|
+
if (result.form) {
|
|
546
|
+
this.renderFollowUpQuestions(result.form);
|
|
547
|
+
this.setFormState("followUpQuestionsReady");
|
|
548
|
+
} else {
|
|
549
|
+
this.doSuccessStep(formData);
|
|
550
|
+
}
|
|
551
|
+
} else {
|
|
552
|
+
// `response.error` is an `EmailError`, which intersects with `FormError`. Cast it to a
|
|
553
|
+
// `FormError` and let `showErrorMessage()` handle it if the value is not part of `FormError`.
|
|
554
|
+
this.showErrorMessage(response.error);
|
|
555
|
+
this.setFormState("emailReady");
|
|
556
|
+
}
|
|
557
|
+
}, this.handleFormFollowUpQuestionsSubmit = async (event)=>{
|
|
558
|
+
const formData = this.getFormData();
|
|
559
|
+
const followUpQuestionEntries = formData.followUpQuestions;
|
|
560
|
+
const followUpQuestionValues = followUpQuestionEntries.map((param)=>{
|
|
561
|
+
let [, value] = param;
|
|
562
|
+
return value;
|
|
563
|
+
});
|
|
564
|
+
if (followUpQuestionValues.length === 0 || this.qualifiedFormApi == null) {
|
|
565
|
+
return;
|
|
566
|
+
}
|
|
567
|
+
// TODO (WEB-1201): Write unit test for `QualifiedEmbeddedForm` -> `onFollowUpQuestionsSubmit`
|
|
568
|
+
this.triggerEvent("qualifiedFormFollowUpQuestionsSubmit", {
|
|
569
|
+
formData
|
|
570
|
+
});
|
|
571
|
+
// Read `formData` first, *then* set the form state to `FollowUpQuestionsPending`, because the
|
|
572
|
+
// latter disables form controls and excludes them from `formData`.
|
|
573
|
+
this.setFormState("followUpQuestionsPending");
|
|
574
|
+
this.hideErrorMessages();
|
|
575
|
+
const response = this.qualifiedFormApi.submitFollowUpQuestions(followUpQuestionValues);
|
|
576
|
+
if (response.success) {
|
|
577
|
+
this.doSuccessStep(formData);
|
|
578
|
+
} else if (response.errors) {
|
|
579
|
+
Object.entries(response.errors).forEach((param)=>{
|
|
580
|
+
let [fieldName, error] = param;
|
|
581
|
+
const formField = this.querySelector('[data-qualified-form-field-name="' + fieldName + '"]');
|
|
582
|
+
const formFieldControl = formField == null ? void 0 : formField.querySelector("input, select");
|
|
583
|
+
const formFieldError = formField == null ? void 0 : formField.querySelector(".QualifiedForm-formError--" + error.type);
|
|
584
|
+
formFieldControl == null ? void 0 : formFieldControl.setAttribute("aria-invalid", "true");
|
|
585
|
+
formFieldError == null ? void 0 : formFieldError.removeAttribute("hidden");
|
|
586
|
+
});
|
|
587
|
+
this.setFormState("followUpQuestionsReady");
|
|
588
|
+
}
|
|
589
|
+
};
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
EmbeddedForm.instanceId = 0;
|
|
593
|
+
// These HTML attributes are for internal use only. Customers should use the
|
|
594
|
+
// `window.qualified("showForm", ...)` public API instead.
|
|
595
|
+
EmbeddedForm.EMAIL_INPUT_LABEL_TEXT_ATTRIBUTE = "q-email-input-label-text";
|
|
596
|
+
EmbeddedForm.EMAIL_INPUT_PLACEHOLDER_TEXT_ATTRIBUTE = "q-email-input-placeholder-text";
|
|
597
|
+
EmbeddedForm.EMAIL_SUBMIT_BUTTON_INNER_HTML_ATTRIBUTE = "q-email-submit-button-inner-html";
|
|
598
|
+
EmbeddedForm.FORM_CONTROL_CHECKBOX_CLASS_NAME_ATTRIBUTE = "q-checkbox-class-name";
|
|
599
|
+
EmbeddedForm.FORM_CONTROL_FORM_LABEL_CLASS_NAME_ATTRIBUTE = "q-form-label-class-name";
|
|
600
|
+
EmbeddedForm.FORM_CONTROL_FORM_LABEL_OPTIONAL_CLASS_NAME_ATTRIBUTE = "q-form-label-optional-class-name";
|
|
601
|
+
EmbeddedForm.FORM_CONTROL_TEXTAREA_CLASS_NAME_ATTRIBUTE = "q-textarea-class-name";
|
|
602
|
+
EmbeddedForm.FORM_CONTROL_TEXT_INPUT_CLASS_NAME_ATTRIBUTE = "q-text-input-class-name";
|
|
603
|
+
EmbeddedForm.FORM_CONTROL_SELECT_CLASS_NAME_ATTRIBUTE = "q-select-class-name";
|
|
604
|
+
EmbeddedForm.FORM_EXPERIENCE_API_NAME_ATTRIBUTE = "q-form-experience-api-name";
|
|
605
|
+
EmbeddedForm.FORM_STATE_ATTRIBUTE = "data-form-state";
|
|
606
|
+
EmbeddedForm.SUBMIT_BUTTON_CLASS_NAME_ATTRIBUTE = "q-submit-button-class-name";
|
|
607
|
+
EmbeddedForm.SUCCESS_MESSAGE_INNER_HTML_ATTRIBUTE = "q-success-message-inner-html";
|
|
608
|
+
EmbeddedForm.SUCCESS_REDIRECT_URL_ATTRIBUTE = "q-success-redirect-url";
|
|
609
|
+
EmbeddedForm.VALIDATE_BUSINESS_EMAIL_ATTRIBUTE = "q-validate-business-email";
|
|
610
|
+
EmbeddedForm.VERSION_ATTRIBUTE = "q-version";
|
|
611
|
+
// SUIT naming conventions:
|
|
612
|
+
// https://github.com/suitcss/suit/blob/master/doc/naming-conventions.md
|
|
613
|
+
EmbeddedForm.FORM_ERROR_CLASS_NAME = "QualifiedForm-formError";
|
|
614
|
+
EmbeddedForm.SUBMIT_BUTTON_CLASS_NAME = "QualifiedForm-submitButton";
|
|
615
|
+
// Attributes that trigger `attributeChangedCallback()` when changed
|
|
616
|
+
EmbeddedForm.observedAttributes = [
|
|
617
|
+
EmbeddedForm.FORM_CONTROL_CHECKBOX_CLASS_NAME_ATTRIBUTE,
|
|
618
|
+
EmbeddedForm.FORM_CONTROL_FORM_LABEL_CLASS_NAME_ATTRIBUTE,
|
|
619
|
+
EmbeddedForm.FORM_CONTROL_FORM_LABEL_OPTIONAL_CLASS_NAME_ATTRIBUTE,
|
|
620
|
+
EmbeddedForm.FORM_CONTROL_TEXTAREA_CLASS_NAME_ATTRIBUTE,
|
|
621
|
+
EmbeddedForm.FORM_CONTROL_TEXT_INPUT_CLASS_NAME_ATTRIBUTE,
|
|
622
|
+
EmbeddedForm.FORM_CONTROL_SELECT_CLASS_NAME_ATTRIBUTE,
|
|
623
|
+
EmbeddedForm.EMAIL_INPUT_LABEL_TEXT_ATTRIBUTE,
|
|
624
|
+
EmbeddedForm.EMAIL_INPUT_PLACEHOLDER_TEXT_ATTRIBUTE,
|
|
625
|
+
EmbeddedForm.EMAIL_SUBMIT_BUTTON_INNER_HTML_ATTRIBUTE,
|
|
626
|
+
EmbeddedForm.FORM_EXPERIENCE_API_NAME_ATTRIBUTE,
|
|
627
|
+
EmbeddedForm.SUBMIT_BUTTON_CLASS_NAME_ATTRIBUTE,
|
|
628
|
+
EmbeddedForm.SUCCESS_MESSAGE_INNER_HTML_ATTRIBUTE,
|
|
629
|
+
EmbeddedForm.SUCCESS_REDIRECT_URL_ATTRIBUTE,
|
|
630
|
+
EmbeddedForm.VALIDATE_BUSINESS_EMAIL_ATTRIBUTE,
|
|
631
|
+
EmbeddedForm.VERSION_ATTRIBUTE,
|
|
632
|
+
EmbeddedForm.FORM_STATE_ATTRIBUTE
|
|
633
|
+
];
|
|
634
|
+
|
|
635
|
+
var EmbeddedForm_EmbeddedForm = /* unused export */ undefined;
|
|
636
|
+
var embedded_forms_EmbeddedForm_FormEvent = /* unused export */ undefined;
|
|
637
|
+
var embedded_forms_EmbeddedForm_FormState = /* unused export */ undefined;
|
|
638
|
+
export { EmbeddedForm_EmbeddedForm as EmbeddedForm, createEmbeddedFormClass, embedded_forms_EmbeddedForm_FormEvent as FormEvent, embedded_forms_EmbeddedForm_FormState as FormState };
|