@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,441 @@
|
|
|
1
|
+
import { ChangeType } from "../constants.js";
|
|
2
|
+
import { propertySpy, ShipperHelper } from "./utils.js";
|
|
3
|
+
import { originalOf } from "../../proxy.js";
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class Mutations extends ShipperHelper {
|
|
9
|
+
init() {
|
|
10
|
+
this.observer = new MutationObserver(this.onMutations);
|
|
11
|
+
this.observeElement(this.document);
|
|
12
|
+
this.createAttachShadowSpy();
|
|
13
|
+
this.observeExistingShadowRoots(this.document);
|
|
14
|
+
}
|
|
15
|
+
cleanup() {
|
|
16
|
+
var _this_observer;
|
|
17
|
+
(_this_observer = this.observer) == null ? void 0 : _this_observer.disconnect();
|
|
18
|
+
this.observer = null;
|
|
19
|
+
}
|
|
20
|
+
observeElement(element) {
|
|
21
|
+
this.observer.observe(element, {
|
|
22
|
+
childList: true,
|
|
23
|
+
characterData: true,
|
|
24
|
+
attributes: true,
|
|
25
|
+
subtree: true
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
// Shadow root handling
|
|
29
|
+
observeExistingShadowRoots(root, param) {
|
|
30
|
+
let { skipRoot = false } = param === void 0 ? {} : param;
|
|
31
|
+
const walker = this.document.createTreeWalker(root, this.window.NodeFilter.SHOW_ELEMENT);
|
|
32
|
+
let current = skipRoot ? walker.nextNode() : walker.currentNode;
|
|
33
|
+
while(current){
|
|
34
|
+
this.observeShadowRootNode(current);
|
|
35
|
+
current = walker.nextNode();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
createAttachShadowSpy() {
|
|
39
|
+
this.callOnDispose(propertySpy(this.window.Element, "attachShadow", "value", this.onAttachShadow, {
|
|
40
|
+
timing: "after",
|
|
41
|
+
async: true
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
constructor(...args){
|
|
45
|
+
super(...args), this.onMutations = (mutations)=>{
|
|
46
|
+
let enqueuedChange = false;
|
|
47
|
+
for(let i = 0; i < mutations.length; i++){
|
|
48
|
+
const mutationRecord = mutations[i];
|
|
49
|
+
const { type, target } = mutationRecord;
|
|
50
|
+
switch(type){
|
|
51
|
+
case "childList":
|
|
52
|
+
{
|
|
53
|
+
const { nextSibling, addedNodes, removedNodes } = mutationRecord;
|
|
54
|
+
this.changeQueue.nodeTreeChanged(target, removedNodes, nextSibling, addedNodes);
|
|
55
|
+
addedNodes.forEach(this.observeShadowRootNode);
|
|
56
|
+
enqueuedChange = true;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
case "attributes":
|
|
60
|
+
{
|
|
61
|
+
const { attributeName } = mutationRecord;
|
|
62
|
+
this.changeQueue.nodeAttributeChanged(target, attributeName);
|
|
63
|
+
enqueuedChange = true;
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case "characterData":
|
|
67
|
+
{
|
|
68
|
+
this.changeQueue.nodeDataChanged(target);
|
|
69
|
+
enqueuedChange = true;
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (enqueuedChange) {
|
|
75
|
+
this.shipper.sendFrame();
|
|
76
|
+
}
|
|
77
|
+
}, this.observeShadowRootNode = (node)=>{
|
|
78
|
+
const shadowRoot = node instanceof this.window.ShadowRoot ? node : node.shadowRoot;
|
|
79
|
+
if (shadowRoot) {
|
|
80
|
+
this.observeElement(shadowRoot);
|
|
81
|
+
// Look for nested shadow roots
|
|
82
|
+
this.observeExistingShadowRoots(shadowRoot, {
|
|
83
|
+
skipRoot: true
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}, // Trigger a fake mutation since mutation observer doesn't fire for shadow roots
|
|
87
|
+
this.onAttachShadow = (element)=>{
|
|
88
|
+
if (element.shadowRoot) {
|
|
89
|
+
this.onMutations([
|
|
90
|
+
{
|
|
91
|
+
type: "childList",
|
|
92
|
+
target: element,
|
|
93
|
+
addedNodes: [
|
|
94
|
+
element.shadowRoot
|
|
95
|
+
],
|
|
96
|
+
removedNodes: [],
|
|
97
|
+
nextSibling: null
|
|
98
|
+
}
|
|
99
|
+
]);
|
|
100
|
+
}
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
class InputValueObserver extends ShipperHelper {
|
|
105
|
+
init() {
|
|
106
|
+
this.addPassiveDocumentListener("input", this.onInputEvent);
|
|
107
|
+
}
|
|
108
|
+
constructor(shipper){
|
|
109
|
+
super(shipper), this.onInputEvent = (event)=>{
|
|
110
|
+
const { target } = event;
|
|
111
|
+
if (target.tagName === "INPUT" || target.tagName === "TEXTAREA") {
|
|
112
|
+
this.onInputValueChange(target);
|
|
113
|
+
}
|
|
114
|
+
}, this.onInputValueChange = (element)=>{
|
|
115
|
+
this.changeQueue.nodePropertyChanged(element, "value");
|
|
116
|
+
this.shipper.sendFrame();
|
|
117
|
+
};
|
|
118
|
+
// Unlike other handlers, these need to be installed early because if
|
|
119
|
+
// there's other code (e.g. React) that overrides the same property
|
|
120
|
+
// descriptors we want to make sure that they pick up our overrides
|
|
121
|
+
if (this.shipper.observeInputValue) {
|
|
122
|
+
[
|
|
123
|
+
this.window.HTMLInputElement,
|
|
124
|
+
this.window.HTMLTextAreaElement
|
|
125
|
+
].forEach((constructor)=>{
|
|
126
|
+
this.callOnDispose(propertySpy(constructor, "value", "set", this.onInputValueChange, {
|
|
127
|
+
timing: "after",
|
|
128
|
+
async: true
|
|
129
|
+
}));
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
class StylesheetRulesObserver extends ShipperHelper {
|
|
135
|
+
init() {
|
|
136
|
+
const { CSSStyleSheet } = this.window;
|
|
137
|
+
[
|
|
138
|
+
"insertRule",
|
|
139
|
+
"deleteRule"
|
|
140
|
+
].forEach((property)=>{
|
|
141
|
+
this.callOnDispose(propertySpy(CSSStyleSheet, property, "value", this.onCSSRuleChange, {
|
|
142
|
+
timing: "after",
|
|
143
|
+
async: true
|
|
144
|
+
}));
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
constructor(...args){
|
|
148
|
+
super(...args), this.onCSSRuleChange = (element)=>{
|
|
149
|
+
const styleNode = element == null ? void 0 : element.ownerNode, textNode = styleNode == null ? void 0 : styleNode.childNodes[0];
|
|
150
|
+
if (styleNode && textNode) {
|
|
151
|
+
this.changeQueue.nodeDataChanged(textNode);
|
|
152
|
+
this.shipper.sendFrame();
|
|
153
|
+
}
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
class MediaStateObserver extends ShipperHelper {
|
|
158
|
+
init() {
|
|
159
|
+
this.addPassiveDocumentListener("play", this.onPlayStateChange, true);
|
|
160
|
+
this.addPassiveDocumentListener("pause", this.onPlayStateChange, true);
|
|
161
|
+
}
|
|
162
|
+
constructor(...args){
|
|
163
|
+
super(...args), this.onPlayStateChange = (event)=>{
|
|
164
|
+
if (event.target) {
|
|
165
|
+
this.changeQueue.nodePropertyChanged(event.target, "paused");
|
|
166
|
+
this.changeQueue.nodePropertyChanged(event.target, "currentTime");
|
|
167
|
+
this.shipper.sendFrame();
|
|
168
|
+
}
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
class GlobalState extends ShipperHelper {
|
|
173
|
+
changed() {
|
|
174
|
+
this.changeQueue.globalChanged(this);
|
|
175
|
+
this.shipper.sendFrame();
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
GlobalState.includedInKeyframe = true;
|
|
179
|
+
class ScrollListener extends ShipperHelper {
|
|
180
|
+
init() {
|
|
181
|
+
this.addPassiveDocumentListener("scroll", this.onScroll, true);
|
|
182
|
+
}
|
|
183
|
+
constructor(shipper, onDocumentScroll){
|
|
184
|
+
super(shipper), this.onScroll = (event)=>{
|
|
185
|
+
const element = event.target;
|
|
186
|
+
if (!element || element === this.document) {
|
|
187
|
+
this.onDocumentScroll();
|
|
188
|
+
} else {
|
|
189
|
+
this.changeQueue.nodePropertyChanged(element, "scrollLeft");
|
|
190
|
+
this.changeQueue.nodePropertyChanged(element, "scrollTop");
|
|
191
|
+
this.shipper.sendFrame();
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
this.onDocumentScroll = onDocumentScroll;
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
class DocumentScroll extends GlobalState {
|
|
198
|
+
init() {
|
|
199
|
+
this.scrollListener.init();
|
|
200
|
+
}
|
|
201
|
+
cleanup() {
|
|
202
|
+
this.scrollListener.dispose();
|
|
203
|
+
super.cleanup();
|
|
204
|
+
}
|
|
205
|
+
serialize() {
|
|
206
|
+
// Standard window scroll, viewer and visitors might use HTML vs BODY for
|
|
207
|
+
// scrollingElement (Edge vs Chrome), so we set this as global state, so the Receiver
|
|
208
|
+
// choses according to their browser.
|
|
209
|
+
const scroller = this.document.scrollingElement || this.document.documentElement;
|
|
210
|
+
return [
|
|
211
|
+
ChangeType.DocumentScroll,
|
|
212
|
+
scroller ? [
|
|
213
|
+
scroller.scrollLeft,
|
|
214
|
+
scroller.scrollTop
|
|
215
|
+
] : [
|
|
216
|
+
0,
|
|
217
|
+
0
|
|
218
|
+
]
|
|
219
|
+
];
|
|
220
|
+
}
|
|
221
|
+
constructor(shipper){
|
|
222
|
+
super(shipper), this.onScroll = ()=>{
|
|
223
|
+
this.changed();
|
|
224
|
+
};
|
|
225
|
+
this.scrollListener = new ScrollListener(shipper, this.onScroll);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
class MousePosition extends GlobalState {
|
|
229
|
+
init() {
|
|
230
|
+
this.addPassiveDocumentListener("mousemove", this.onMouseMove);
|
|
231
|
+
this.addPassiveDocumentListener("mouseleave", this.onMouseLeave);
|
|
232
|
+
}
|
|
233
|
+
serialize() {
|
|
234
|
+
return [
|
|
235
|
+
ChangeType.Mouse,
|
|
236
|
+
[
|
|
237
|
+
this.x,
|
|
238
|
+
this.y,
|
|
239
|
+
this.target ? this.serializer.nodeToId(this.target) : 0
|
|
240
|
+
]
|
|
241
|
+
];
|
|
242
|
+
}
|
|
243
|
+
constructor(...args){
|
|
244
|
+
super(...args), this.x = -1, this.y = -1, this.target = null, this.onMouseMove = (event)=>{
|
|
245
|
+
this.x = event.clientX;
|
|
246
|
+
this.y = event.clientY;
|
|
247
|
+
this.target = event.target;
|
|
248
|
+
this.changed();
|
|
249
|
+
}, this.onMouseLeave = ()=>{
|
|
250
|
+
this.x = this.y = -1;
|
|
251
|
+
this.target = null;
|
|
252
|
+
this.changed();
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
class MouseClick extends ShipperHelper {
|
|
257
|
+
init() {
|
|
258
|
+
this.addPassiveDocumentListener("mousedown", this.onMouseDown, true);
|
|
259
|
+
}
|
|
260
|
+
constructor(...args){
|
|
261
|
+
super(...args), this.onMouseDown = (event)=>{
|
|
262
|
+
this.changeQueue.eventHappened([
|
|
263
|
+
ChangeType.Click,
|
|
264
|
+
[
|
|
265
|
+
event.clientX,
|
|
266
|
+
event.clientY
|
|
267
|
+
]
|
|
268
|
+
]);
|
|
269
|
+
this.shipper.sendFrame();
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
class Dimensions extends GlobalState {
|
|
274
|
+
init() {
|
|
275
|
+
this.addPassiveWindowListener("resize", this.onResize);
|
|
276
|
+
}
|
|
277
|
+
serialize() {
|
|
278
|
+
// Docking intentionally proxies innerWidth/innerHeight to the host content area (viewport
|
|
279
|
+
// minus the docked panel) for customer layout code. Liveview must send the real browser
|
|
280
|
+
// viewport or the receiver applies the docked shrink a second time, so read through the
|
|
281
|
+
// pre-patch view (a no-op on pages where docking never patched anything).
|
|
282
|
+
const viewport = originalOf(this.window);
|
|
283
|
+
return [
|
|
284
|
+
ChangeType.Dimensions,
|
|
285
|
+
[
|
|
286
|
+
viewport.innerWidth,
|
|
287
|
+
viewport.innerHeight
|
|
288
|
+
]
|
|
289
|
+
];
|
|
290
|
+
}
|
|
291
|
+
constructor(...args){
|
|
292
|
+
super(...args), this.onResize = ()=>{
|
|
293
|
+
this.changed();
|
|
294
|
+
};
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
class Visibility extends GlobalState {
|
|
298
|
+
init() {
|
|
299
|
+
this.addPassiveDocumentListener("visibilitychange", this.onVisibilityChange);
|
|
300
|
+
this.addPassiveWindowListener("pagehide", this.onPageHide);
|
|
301
|
+
}
|
|
302
|
+
get isVisible() {
|
|
303
|
+
return this.document.visibilityState === "visible";
|
|
304
|
+
}
|
|
305
|
+
serialize() {
|
|
306
|
+
return [
|
|
307
|
+
ChangeType.Visibility,
|
|
308
|
+
[
|
|
309
|
+
this.isVisible | 0
|
|
310
|
+
]
|
|
311
|
+
];
|
|
312
|
+
}
|
|
313
|
+
constructor(...args){
|
|
314
|
+
super(...args), this.navigating = false, this.onVisibilityChange = ()=>{
|
|
315
|
+
if (!this.navigating) {
|
|
316
|
+
this.changed();
|
|
317
|
+
}
|
|
318
|
+
}, // On navigation, browser will set visibility to hidden, but we don't want the receiver to get
|
|
319
|
+
// that because the tab isn't really hidden, it's just transitioning. pagehide comes before
|
|
320
|
+
// that visibilitychange.
|
|
321
|
+
this.onPageHide = ()=>{
|
|
322
|
+
this.navigating = true;
|
|
323
|
+
};
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
class WindowFocus extends GlobalState {
|
|
327
|
+
init() {
|
|
328
|
+
this.addPassiveWindowListener("focus", this.onWindowFocus);
|
|
329
|
+
this.addPassiveWindowListener("blur", this.onWindowBlur);
|
|
330
|
+
}
|
|
331
|
+
serialize() {
|
|
332
|
+
return [
|
|
333
|
+
ChangeType.WindowFocus,
|
|
334
|
+
[
|
|
335
|
+
this.document.hasFocus() | 0
|
|
336
|
+
]
|
|
337
|
+
];
|
|
338
|
+
}
|
|
339
|
+
constructor(...args){
|
|
340
|
+
super(...args), this.onWindowFocus = ()=>{
|
|
341
|
+
this.changed();
|
|
342
|
+
}, this.onWindowBlur = ()=>{
|
|
343
|
+
this.changed();
|
|
344
|
+
};
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
class Selection extends GlobalState {
|
|
348
|
+
init() {
|
|
349
|
+
this.addPassiveDocumentListener("selectionchange", this.onSelectionChange);
|
|
350
|
+
}
|
|
351
|
+
serialize() {
|
|
352
|
+
const selection = this.document.getSelection();
|
|
353
|
+
if (selection && selection.rangeCount !== 0 && !selection.isCollapsed) {
|
|
354
|
+
const range = selection.getRangeAt(0);
|
|
355
|
+
return [
|
|
356
|
+
ChangeType.Selection,
|
|
357
|
+
[
|
|
358
|
+
this.serializer.nodeToId(range.startContainer),
|
|
359
|
+
range.startOffset,
|
|
360
|
+
this.serializer.nodeToId(range.endContainer),
|
|
361
|
+
range.endOffset
|
|
362
|
+
]
|
|
363
|
+
];
|
|
364
|
+
} else {
|
|
365
|
+
return [
|
|
366
|
+
ChangeType.Selection,
|
|
367
|
+
[
|
|
368
|
+
0
|
|
369
|
+
]
|
|
370
|
+
];
|
|
371
|
+
}
|
|
372
|
+
}
|
|
373
|
+
constructor(...args){
|
|
374
|
+
super(...args), this.onSelectionChange = ()=>{
|
|
375
|
+
this.changed();
|
|
376
|
+
};
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
class ElementFocus extends GlobalState {
|
|
380
|
+
init() {
|
|
381
|
+
this.addPassiveDocumentListener("focus", this.onFocus, true);
|
|
382
|
+
this.addPassiveDocumentListener("blur", this.onBlur, true);
|
|
383
|
+
}
|
|
384
|
+
serialize() {
|
|
385
|
+
return [
|
|
386
|
+
ChangeType.ElementFocus,
|
|
387
|
+
[
|
|
388
|
+
this.target ? this.serializer.nodeToId(this.target) : 0
|
|
389
|
+
]
|
|
390
|
+
];
|
|
391
|
+
}
|
|
392
|
+
constructor(...args){
|
|
393
|
+
super(...args), this.target = null // TODO: Or document.activeElement != null or body?
|
|
394
|
+
, this.onFocus = (event)=>{
|
|
395
|
+
this.target = event.target;
|
|
396
|
+
this.changed();
|
|
397
|
+
}, this.onBlur = ()=>{
|
|
398
|
+
this.target = null;
|
|
399
|
+
this.changed();
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
class Location extends GlobalState {
|
|
404
|
+
init() {
|
|
405
|
+
this.updateBaseLocation();
|
|
406
|
+
}
|
|
407
|
+
serialize() {
|
|
408
|
+
return [
|
|
409
|
+
ChangeType.Location,
|
|
410
|
+
[
|
|
411
|
+
this.baseLocation,
|
|
412
|
+
this.document.location.href
|
|
413
|
+
]
|
|
414
|
+
];
|
|
415
|
+
}
|
|
416
|
+
constructor(...args){
|
|
417
|
+
super(...args), this.onLocationChange = ()=>{
|
|
418
|
+
// Callback fn but called by page_mirror.ts when it detects a location change at sendMessage.
|
|
419
|
+
// This is currently not an event listener's callback because an appropriate event listener is not available:
|
|
420
|
+
// - Navigation API is not yet available in Firefox/Safari.
|
|
421
|
+
// - History API does not extend an event listener for pushState and we'd like to avoid monkey patching it.
|
|
422
|
+
this.updateBaseLocation();
|
|
423
|
+
this.changed();
|
|
424
|
+
}, this.updateBaseLocation = ()=>{
|
|
425
|
+
this.baseLocation = (this.document.getElementsByTagName("base")[0] || {}).href || // Existing <base> tag
|
|
426
|
+
this.document.location.href.match(/^(.*\/)[^/]*$/)[1];
|
|
427
|
+
};
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
class DocumentTree extends GlobalState {
|
|
431
|
+
serialize() {
|
|
432
|
+
return [
|
|
433
|
+
ChangeType.DocumentTree,
|
|
434
|
+
[
|
|
435
|
+
this.serializer.idTree(this.document)
|
|
436
|
+
]
|
|
437
|
+
];
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
export { Dimensions, DocumentScroll, DocumentTree, ElementFocus, InputValueObserver, Location, MediaStateObserver, MouseClick, MousePosition, Mutations, Selection, StylesheetRulesObserver, Visibility, WindowFocus };
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { __webpack_require__ } from "../../../js/runtime.js";
|
|
2
|
+
import { addEventListener } from "../../dom.js";
|
|
3
|
+
import "../../../widget/utils/native_globals.js";
|
|
4
|
+
import { Disposable } from "../../mixins/disposable.js";
|
|
5
|
+
|
|
6
|
+
/* provided dependency */ var utils_setTimeout = __webpack_require__(68034).pS;
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
// Add a spy that gets called each time an object's property is invoked.
|
|
10
|
+
// Returns a disposer that removes the spy.
|
|
11
|
+
//
|
|
12
|
+
function propertySpy(constructor, property, descriptorAttribute, callback, param) {
|
|
13
|
+
let { // Callback options:
|
|
14
|
+
timing = "after", async = true } = param;
|
|
15
|
+
const proto = constructor.prototype;
|
|
16
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, property);
|
|
17
|
+
const originalAttribute = descriptor[descriptorAttribute];
|
|
18
|
+
// Old Safari's won't let us observe certain setters.
|
|
19
|
+
if (!descriptor || typeof originalAttribute !== "function") {
|
|
20
|
+
return ()=>{};
|
|
21
|
+
}
|
|
22
|
+
const runCallback = async ? function() {
|
|
23
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
24
|
+
args[_key] = arguments[_key];
|
|
25
|
+
}
|
|
26
|
+
try {
|
|
27
|
+
utils_setTimeout(()=>callback(...args), 0);
|
|
28
|
+
} catch (e) {
|
|
29
|
+
/* IGNORED */ }
|
|
30
|
+
} : function() {
|
|
31
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
32
|
+
args[_key] = arguments[_key];
|
|
33
|
+
}
|
|
34
|
+
try {
|
|
35
|
+
callback(...args);
|
|
36
|
+
} catch (e) {
|
|
37
|
+
/* IGNORED */ }
|
|
38
|
+
};
|
|
39
|
+
let newAttribute;
|
|
40
|
+
if (timing === "before") {
|
|
41
|
+
newAttribute = function newAttribute() {
|
|
42
|
+
runCallback(this, ...arguments); // eslint-disable-line prefer-rest-params
|
|
43
|
+
return originalAttribute.apply(this, arguments); // eslint-disable-line prefer-rest-params
|
|
44
|
+
};
|
|
45
|
+
} else {
|
|
46
|
+
newAttribute = function newAttribute() {
|
|
47
|
+
const ret = originalAttribute.apply(this, arguments); // eslint-disable-line prefer-rest-params
|
|
48
|
+
runCallback(this, ...arguments); // eslint-disable-line prefer-rest-params
|
|
49
|
+
return ret;
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
descriptor[descriptorAttribute] = newAttribute;
|
|
53
|
+
Object.defineProperty(proto, property, descriptor);
|
|
54
|
+
return ()=>{
|
|
55
|
+
// Refetch in case anything's changed in the meantime.
|
|
56
|
+
const proto = constructor.prototype;
|
|
57
|
+
const descriptor = Object.getOwnPropertyDescriptor(proto, property);
|
|
58
|
+
descriptor[descriptorAttribute] = originalAttribute;
|
|
59
|
+
Object.defineProperty(proto, property, descriptor);
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
// Base class for helper classes controlled by Shipper.
|
|
63
|
+
class ShipperHelper extends Disposable(Object) {
|
|
64
|
+
init() {}
|
|
65
|
+
addPassiveDocumentListener(event, listener, capture) {
|
|
66
|
+
if (capture === void 0) capture = false;
|
|
67
|
+
this.callOnDispose(addEventListener(this.shipper.document, event, listener, {
|
|
68
|
+
capture,
|
|
69
|
+
passive: true
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
addPassiveWindowListener(event, listener, capture) {
|
|
73
|
+
if (capture === void 0) capture = false;
|
|
74
|
+
this.callOnDispose(addEventListener(this.shipper.window, event, listener, {
|
|
75
|
+
capture,
|
|
76
|
+
passive: true
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
// Delegations to shipper
|
|
80
|
+
get document() {
|
|
81
|
+
return this.shipper.document;
|
|
82
|
+
}
|
|
83
|
+
get window() {
|
|
84
|
+
return this.shipper.window;
|
|
85
|
+
}
|
|
86
|
+
get changeQueue() {
|
|
87
|
+
return this.shipper.changeQueue;
|
|
88
|
+
}
|
|
89
|
+
get serializer() {
|
|
90
|
+
return this.shipper.serializer;
|
|
91
|
+
}
|
|
92
|
+
constructor(shipper){
|
|
93
|
+
super();
|
|
94
|
+
this.shipper = shipper;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
export { ShipperHelper, propertySpy };
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { _class_private_field_loose_base, _class_private_field_loose_key } from "../../js/4101.js";
|
|
2
|
+
import { forEachCatchErrors } from "../arrays.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
// Mixin for classes that require a disposal lifecycle. Classes should implement a "cleanup" method
|
|
8
|
+
// which is called by dispose.
|
|
9
|
+
//
|
|
10
|
+
function Disposable(superclass) {
|
|
11
|
+
var _disposerQueue;
|
|
12
|
+
return _disposerQueue = /*#__PURE__*/ _class_private_field_loose_key("_disposerQueue"), class extends superclass {
|
|
13
|
+
// Classes should override this method to do their cleanup
|
|
14
|
+
cleanup() {}
|
|
15
|
+
// External callers use this to initiate the disposal process.
|
|
16
|
+
dispose() {
|
|
17
|
+
if (!this.isDisposed) {
|
|
18
|
+
// In case the queue callbacks somehow call dispose of this object again, we mark right away.
|
|
19
|
+
this.isDisposed = true;
|
|
20
|
+
const errors = forEachCatchErrors(_class_private_field_loose_base(this, _disposerQueue)[_disposerQueue], (disposer)=>disposer());
|
|
21
|
+
_class_private_field_loose_base(this, _disposerQueue)[_disposerQueue] = [];
|
|
22
|
+
this.cleanup == null ? void 0 : this.cleanup.call(this);
|
|
23
|
+
super.dispose == null ? void 0 : super.dispose.call(this);
|
|
24
|
+
if (errors.length > 0) {
|
|
25
|
+
throw new Error("Dispose errors: " + errors.join(", "));
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
// Best-effort cleanup
|
|
30
|
+
tryDispose() {
|
|
31
|
+
try {
|
|
32
|
+
this.dispose();
|
|
33
|
+
} catch (unused) {
|
|
34
|
+
/* IGNORE */ }
|
|
35
|
+
}
|
|
36
|
+
// Call the given function when the object is disposed.
|
|
37
|
+
// (Analagous to mobx-utils's disposeOnUnmount for React components.)
|
|
38
|
+
callOnDispose(func) {
|
|
39
|
+
_class_private_field_loose_base(this, _disposerQueue)[_disposerQueue].push(func);
|
|
40
|
+
}
|
|
41
|
+
constructor(...args){
|
|
42
|
+
super(...args), Object.defineProperty(this, _disposerQueue, {
|
|
43
|
+
writable: true,
|
|
44
|
+
value: void 0
|
|
45
|
+
}), this.isDisposed = false, _class_private_field_loose_base(this, _disposerQueue)[_disposerQueue] = [];
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
// Method decorator for ignoring invocations if the object is disposed. Useful
|
|
50
|
+
// for async event handlers.
|
|
51
|
+
//
|
|
52
|
+
// Examples:
|
|
53
|
+
//
|
|
54
|
+
// @ignoreIfDisposed sendMessage() { ... }
|
|
55
|
+
// @ignoreIfDisposed onEvent = (event) => { ... }
|
|
56
|
+
//
|
|
57
|
+
function ignoreIfDisposed(target, property, descriptor) {
|
|
58
|
+
// Support legacy TypeScript property decorators which provide no descriptor
|
|
59
|
+
if (!descriptor) {
|
|
60
|
+
const prop = property;
|
|
61
|
+
Object.defineProperty(target, prop, {
|
|
62
|
+
configurable: true,
|
|
63
|
+
get () {
|
|
64
|
+
var _this = this;
|
|
65
|
+
const own = Object.getOwnPropertyDescriptor(this, prop);
|
|
66
|
+
const original = own == null ? void 0 : own.value;
|
|
67
|
+
if (typeof original !== "function") return original;
|
|
68
|
+
const wrapped = function wrapped() {
|
|
69
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
70
|
+
args[_key] = arguments[_key];
|
|
71
|
+
}
|
|
72
|
+
if (!_this.isDisposed) {
|
|
73
|
+
return original.apply(_this, args);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
Object.defineProperty(this, prop, {
|
|
77
|
+
value: wrapped,
|
|
78
|
+
configurable: true,
|
|
79
|
+
writable: true
|
|
80
|
+
});
|
|
81
|
+
return wrapped;
|
|
82
|
+
},
|
|
83
|
+
set (value) {
|
|
84
|
+
Object.defineProperty(this, prop, {
|
|
85
|
+
value,
|
|
86
|
+
configurable: true,
|
|
87
|
+
writable: true
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (descriptor.value) {
|
|
94
|
+
// Method descriptor
|
|
95
|
+
const method = descriptor.value;
|
|
96
|
+
descriptor.value = function() {
|
|
97
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
98
|
+
args[_key] = arguments[_key];
|
|
99
|
+
}
|
|
100
|
+
if (!this.isDisposed) {
|
|
101
|
+
return method.apply(this, args);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
} else if (descriptor.initializer) {
|
|
105
|
+
// Property descriptor. Assuming the initializer returns a function.
|
|
106
|
+
const { initializer } = descriptor;
|
|
107
|
+
descriptor.initializer = function() {
|
|
108
|
+
var _this = this;
|
|
109
|
+
const method = initializer.call(this);
|
|
110
|
+
return function() {
|
|
111
|
+
for(var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++){
|
|
112
|
+
args[_key] = arguments[_key];
|
|
113
|
+
}
|
|
114
|
+
if (!_this.isDisposed) {
|
|
115
|
+
return method.apply(_this, args);
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
};
|
|
119
|
+
} else {
|
|
120
|
+
throw new Error("Bad descriptor.");
|
|
121
|
+
}
|
|
122
|
+
return descriptor;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export { Disposable, ignoreIfDisposed };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createPropertyDecorator } from "../decorators.js";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
// Mixin for classes following DI conventions.
|
|
5
|
+
//
|
|
6
|
+
function Injectable(superclass) {
|
|
7
|
+
return class extends superclass {
|
|
8
|
+
constructor(...args){
|
|
9
|
+
super(...args);
|
|
10
|
+
// Objects passed to this mixin are expected to be used via Container
|
|
11
|
+
const { container, name, singleton } = args[0];
|
|
12
|
+
this.container = container;
|
|
13
|
+
if (singleton) {
|
|
14
|
+
container.set(name, this);
|
|
15
|
+
}
|
|
16
|
+
// Since this is a base class, @inject on properties will run after this constructor but before
|
|
17
|
+
// the derived class constructor. That's important to how @inject's initializer works.
|
|
18
|
+
// See https://www.typescriptlang.org/docs/handbook/2/classes.html#initialization-order
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
// Annotate fields for an Injectable class with @inject or @inject("dependencyName") to
|
|
23
|
+
// automatically resolve dependencies.
|
|
24
|
+
//
|
|
25
|
+
// If no dependency name is given, the field's name is used as dependency name.
|
|
26
|
+
const inject = createPropertyDecorator((dependency, _target, property, descriptor)=>{
|
|
27
|
+
const name = dependency != null ? dependency : property;
|
|
28
|
+
// Use a lazy getter to work reliably with SWC legacy decorators
|
|
29
|
+
// This avoids relying on initializer semantics that can differ across compilers
|
|
30
|
+
// and ensures resolution happens after the container is available.
|
|
31
|
+
descriptor.get = function() {
|
|
32
|
+
return this.container.resolve(name);
|
|
33
|
+
};
|
|
34
|
+
return descriptor;
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export { Injectable, inject };
|