@claspo/renderer 16.7.0-theme.13 → 17.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CompositionRoot.d.ts +2 -35
- package/CompositionRoot.js +1 -1
- package/RouterEvent.d.ts +4 -3
- package/StaticEntryModule.d.ts +21 -18
- package/StaticEntryModule.js +1 -1
- package/UpdatingEntryModule.d.ts +10 -14
- package/UpdatingEntryModule.js +1 -1
- package/ViewRouter.d.ts +8 -7
- package/action/ActionFactory.d.ts +10 -10
- package/action/ActionRegister.d.ts +24 -7
- package/action/InAppActionFactory.d.ts +1 -1
- package/action/SysActionTypes.d.ts +12 -12
- package/action/actions/ActionCategory.d.ts +4 -4
- package/action/actions/BaseRequestAction.d.ts +9 -9
- package/action/actions/BaseRequestAction.js +1 -1
- package/action/actions/CloseWidgetAction.d.ts +5 -5
- package/action/actions/CloseWidgetAction.js +1 -1
- package/action/actions/DispatchEventAction.d.ts +2 -2
- package/action/actions/GoToNextViewAction.d.ts +2 -2
- package/action/actions/GoToNextViewAction.js +1 -1
- package/action/actions/GoToPreviousViewAction.d.ts +2 -2
- package/action/actions/GoToPreviousViewAction.js +1 -1
- package/action/actions/GoToViewAction.d.ts +3 -4
- package/action/actions/GoToViewAction.js +1 -1
- package/action/actions/InAppOpenLinkAction.d.ts +2 -2
- package/action/actions/OpenLinkAction.d.ts +7 -7
- package/action/actions/OpenLinkAction.js +1 -1
- package/action/actions/RequestAction.d.ts +3 -1
- package/action/actions/ShowWidgetAction.d.ts +2 -2
- package/action/actions/SubscribeContactAction.d.ts +4 -1
- package/action/asyncAction.d.ts +2 -2
- package/backward-compatibility/deprecatedCheckboxVariablesMap.d.ts +1 -1
- package/color-libs/color-convert.d.ts +1 -1
- package/color-libs/color-string.d.ts +4 -14
- package/color-libs/color.d.ts +1 -13
- package/color-libs/conversions.d.ts +10 -8
- package/color-libs/rgb.d.ts +1 -1
- package/color-libs/route.d.ts +1 -1
- package/color-libs/simple-swizzle.d.ts +1 -4
- package/common/ConfigService.d.ts +5 -3
- package/common/ConfigService.js +1 -1
- package/common/DefaultState.d.ts +7 -4
- package/common/SysEventTypes.d.ts +6 -6
- package/common/WaitForKeyboardHide.d.ts +1 -1
- package/document-model/ComponentPropsExtractor.d.ts +1 -1
- package/document-model/DocumentModelService.d.ts +32 -0
- package/document-model/{DocumentModel.js → DocumentModelService.js} +1 -1
- package/document-model/DocumentService.d.ts +3 -3
- package/document-model/DocumentService.js +1 -1
- package/document-model/MergeAdaptiveStylesWithEnvIndependentStyles.d.ts +2 -1
- package/document-model/MergeAdaptiveStylesWithEnvIndependentStyles.js +1 -1
- package/document-model/ViewEntryType.d.ts +13 -13
- package/document-model/systemResultStateNames.d.ts +1 -1
- package/form/FormControl.d.ts +22 -25
- package/form/FormControl.interface.d.ts +19 -0
- package/form/FormControl.interface.js +1 -0
- package/form/FormControl.js +1 -1
- package/form/FormControlEvents.d.ts +7 -5
- package/form/FormControlValidator.d.ts +9 -8
- package/form/FormControlValidator.interface.d.ts +23 -0
- package/form/FormControlValidator.interface.js +1 -0
- package/form/FormGroup.d.ts +18 -13
- package/form/FormGroup.interface.d.ts +7 -0
- package/form/FormGroup.interface.js +1 -0
- package/form/FormGroup.js +1 -1
- package/form/FormGroupEvents.d.ts +10 -7
- package/generateRandomValue.d.ts +1 -1
- package/handler/ClickHandler.d.ts +8 -8
- package/handler/ComponentEventHandler.d.ts +1 -1
- package/handler/HandlerFactory.d.ts +3 -3
- package/i18n/TranslateUtils.d.ts +22 -7
- package/i18n/TranslateUtils.js +1 -1
- package/package.json +2 -2
- package/prize-pool/PrizePool.d.ts +1 -1
- package/prize-pool/PrizePoolEvents.d.ts +6 -4
- package/prize-pool/PrizePoolFactory.d.ts +2 -2
- package/renderer/DragEventListener.d.ts +1 -1
- package/renderer/RenderConstants.d.ts +6 -6
- package/renderer/ViewRendererActionType.d.ts +15 -15
- package/renderer/style/ClDocumentResizeListener.d.ts +5 -4
- package/renderer/style/ClDocumentResizeListener.js +1 -1
- package/renderer/style/ColorSchemaListener.d.ts +38 -23
- package/renderer/style/ColorSchemaListener.js +1 -1
- package/renderer/style/CommonStylesService.d.ts +4 -3
- package/renderer/style/DefaultMediaQueryListener.d.ts +15 -9
- package/renderer/style/DefaultMediaQueryListener.js +1 -1
- package/renderer/style/LoopAnimationStylesService.d.ts +1 -1
- package/renderer/style/MobileDeviceOrientationListener.d.ts +19 -6
- package/renderer/style/MobileDeviceOrientationListener.js +1 -1
- package/resource-management/ComponentResourceManager.d.ts +12 -10
- package/resource-management/Counter.d.ts +3 -2
- package/resource-management/ViewResourcesManager.d.ts +2 -2
- package/sdk/ColorUtils.d.ts +7 -7
- package/sdk/ComponentType.d.ts +9 -9
- package/sdk/FormUtils.d.ts +3 -3
- package/sdk/FormUtils.js +1 -1
- package/sdk/HtmlStyleUtils.d.ts +27 -7
- package/sdk/HtmlStyleUtils.js +1 -1
- package/sdk/ModelStyleUtils.d.ts +11 -9
- package/sdk/ModelStyleUtils.js +1 -1
- package/sdk/OverlayUtils.d.ts +44 -28
- package/sdk/OverlayUtils.js +1 -1
- package/sdk/PreviewMode.d.ts +6 -5
- package/sdk/TooltipUtils.d.ts +10 -4
- package/sdk/TooltipUtils.js +1 -1
- package/sdk/TranslationUtils.d.ts +9 -4
- package/sdk/TranslationUtils.js +1 -1
- package/sdk/WcControlledElement.d.ts +48 -23
- package/sdk/WcControlledElement.js +1 -1
- package/sdk/WcElement.d.ts +123 -56
- package/sdk/WcElement.js +1 -1
- package/sdk/context/ContextData.d.ts +26 -7
- package/sdk/context/ContextEvents.d.ts +6 -5
- package/sdk/context/ContextSDK.d.ts +26 -13
- package/sdk/context/Record.d.ts +7 -6
- package/sdk/getComponentCountOnView.d.ts +2 -1
- package/sdk/merge-tags/AbstractMergeTagsProcessor.d.ts +20 -8
- package/sdk/merge-tags/AbstractMergeTagsProcessor.js +1 -1
- package/sdk/merge-tags/MergeTagsProcessorFactory.d.ts +9 -8
- package/sdk/merge-tags/StaticMergeTagsProcessor.d.ts +2 -1
- package/sdk/merge-tags/UpdatingMergeTagsProcessor.d.ts +5 -3
- package/sdk/merge-tags/UpdatingMergeTagsProcessor.js +1 -1
- package/sdk/source/Source.d.ts +14 -6
- package/sdk/source/SourceRegistry.d.ts +15 -7
- package/sdk/source/sources/DataLayerSource.d.ts +24 -9
- package/sdk/source/sources/DataLayerSource.js +1 -1
- package/sdk/source/sources/FormSource.d.ts +6 -4
- package/sdk/source/sources/JSApiVariablesSource.d.ts +28 -10
- package/sdk/source/sources/JSApiVariablesSource.js +1 -1
- package/sdk/source/sources/UrlQueryParamsSource.d.ts +23 -10
- package/sdk/source/sources/UrlQueryParamsSource.js +1 -1
- package/sdk/validators/required.d.ts +4 -4
- package/sdk.d.ts +3 -3
- package/sdk.js +1 -1
- package/wc-renderer/WcFactory.d.ts +17 -17
- package/wc-renderer/WcFactory.js +1 -1
- package/wc-renderer/WcRegister.d.ts +15 -9
- package/wc-renderer/WcRegister.js +1 -1
- package/wc-renderer/WcResolver.d.ts +24 -13
- package/wc-renderer/WcResolver.js +1 -1
- package/wc-renderer/WcViewRenderer.d.ts +4 -5
- package/wc-renderer/WcViewRenderer.js +1 -1
- package/wc-renderer/decorators/wcStaticDecorator.d.ts +4 -7
- package/wc-renderer/decorators/wcStaticDecorator.js +1 -1
- package/wc-renderer/decorators/wcUpdatingDecorator.d.ts +8 -8
- package/wc-renderer/icons/feedbackIcons.d.ts +10 -23
- package/wc-renderer/icons/promoCodeCopyIcons.d.ts +1 -1
- package/wc-renderer/icons/promoCodeStrokeIcons.d.ts +1 -1
- package/wc-renderer/observers/createObservers.d.ts +6 -4
- package/wc-renderer/observers/observerType.d.ts +5 -5
- package/wc-renderer/subscriptions/createSubscriptions.d.ts +7 -4
- package/wc-renderer/utils/platforms.d.ts +5 -5
- package/action/actions/TrackClick.d.ts +0 -5
- package/action/actions/TrackClick.js +0 -1
- package/document-model/DocumentModel.d.ts +0 -30
- package/sdk/ComponentLifeCycleContainerType.d.ts +0 -5
- package/sdk/ComponentLifeCycleContainerType.js +0 -1
- package/sdk/TranslationUtils.spec.d.ts +0 -1
- package/sdk/TranslationUtils.spec.js +0 -1
- package/sdk/context/ContextSDK.spec.d.ts +0 -1
- package/sdk/context/ContextSDK.spec.js +0 -1
- package/wc-renderer/WcFactory.spec.d.ts +0 -1
- package/wc-renderer/WcFactory.spec.js +0 -1
- package/wc-renderer/WcRegister.spec.d.ts +0 -1
- package/wc-renderer/WcRegister.spec.js +0 -1
package/CompositionRoot.d.ts
CHANGED
|
@@ -1,38 +1,5 @@
|
|
|
1
1
|
export default class CompositionRoot {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
documentService: DocumentService;
|
|
5
|
-
documentModel: DocumentModel;
|
|
6
|
-
state: DefaultState;
|
|
7
|
-
form: FormGroup;
|
|
8
|
-
eventEmitter: any;
|
|
9
|
-
config: ConfigService;
|
|
10
|
-
resizeListener: ClDocumentResizeListener | DefaultMediaQueryListener;
|
|
11
|
-
mobileDeviceOrientationListener: MobileDeviceOrientationListener;
|
|
12
|
-
componentFactory: WcFactory;
|
|
13
|
-
viewRenderer: WcViewRenderer;
|
|
14
|
-
commonStylesService: CommonStylesService;
|
|
15
|
-
tracking: any;
|
|
16
|
-
actionFactory: any;
|
|
17
|
-
actionRegister: ActionRegister;
|
|
18
|
-
prizePoolFactory: PrizePoolFactory;
|
|
19
|
-
context: ContextSDK;
|
|
20
|
-
mergeTagsProcessorFactory: MergeTagsProcessorFactory;
|
|
21
|
-
};
|
|
2
|
+
services: any;
|
|
3
|
+
constructor(json: any, config: any, trackingService: any, containerElement: any, componentCommonStyles: any, layoutType: any, renderMode: any, componentRegister: any, htmlDocumentObject: any);
|
|
22
4
|
destroy(): void;
|
|
23
5
|
}
|
|
24
|
-
import DocumentService from "./document-model/DocumentService";
|
|
25
|
-
import DocumentModel from "./document-model/DocumentModel";
|
|
26
|
-
import DefaultState from "./common/DefaultState";
|
|
27
|
-
import FormGroup from "./form/FormGroup";
|
|
28
|
-
import ConfigService from "./common/ConfigService";
|
|
29
|
-
import ClDocumentResizeListener from "./renderer/style/ClDocumentResizeListener";
|
|
30
|
-
import DefaultMediaQueryListener from "./renderer/style/DefaultMediaQueryListener";
|
|
31
|
-
import MobileDeviceOrientationListener from "./renderer/style/MobileDeviceOrientationListener";
|
|
32
|
-
import WcFactory from "./wc-renderer/WcFactory";
|
|
33
|
-
import WcViewRenderer from "./wc-renderer/WcViewRenderer";
|
|
34
|
-
import CommonStylesService from "./renderer/style/CommonStylesService";
|
|
35
|
-
import { ActionRegister } from "./action/ActionRegister";
|
|
36
|
-
import PrizePoolFactory from "./prize-pool/PrizePoolFactory";
|
|
37
|
-
import ContextSDK from "./sdk/context/ContextSDK";
|
|
38
|
-
import { MergeTagsProcessorFactory } from "./sdk/merge-tags/MergeTagsProcessorFactory";
|
package/CompositionRoot.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import DefaultState from"./common/DefaultState";import FormGroup from"./form/FormGroup";import DefaultEventEmitter from"@claspo/common/DefaultEventEmitter";import
|
|
1
|
+
import DefaultState from"./common/DefaultState";import FormGroup from"./form/FormGroup";import DefaultEventEmitter from"@claspo/common/DefaultEventEmitter";import DocumentModelService from"./document-model/DocumentModelService";import ConfigService from"./common/ConfigService";import ClDocumentResizeListener from"./renderer/style/ClDocumentResizeListener";import MobileDeviceOrientationListener from"./renderer/style/MobileDeviceOrientationListener";import DefaultMediaQueryListener from"./renderer/style/DefaultMediaQueryListener";import DocumentService from"./document-model/DocumentService";import CommonStylesService from"./renderer/style/CommonStylesService";import WcFactory from"./wc-renderer/WcFactory";import WcViewRenderer from"./wc-renderer/WcViewRenderer";import ActionFactory from"./action/ActionFactory";import PrizePoolFactory from"./prize-pool/PrizePoolFactory";import httpClient from"@claspo/common/network/HttpClient";import{ActionRegister}from"./action/ActionRegister";import ContextSDK from"./sdk/context/ContextSDK";import{MergeTagsProcessorFactory}from"./sdk/merge-tags/MergeTagsProcessorFactory";import SourceRegistry from"./sdk/source/SourceRegistry";import ContextData from"./sdk/context/ContextData";export default class CompositionRoot{constructor(e,t,o,r,i,n,c,s,m){var a;const l=new DocumentModelService(e),y=!r,f=y?new DefaultMediaQueryListener(l,t):new ClDocumentResizeListener(l,r),u=new DefaultState,p=new ConfigService(t),v=new MobileDeviceOrientationListener(l,p),d=new CommonStylesService;d.setStyles(i);const S=new DefaultEventEmitter,D=new FormGroup(o),g=new SourceRegistry(D,t),w=new ContextData,F=new ContextSDK(g,w,y),C=new(null!==(a=t.actionFactoryClass)&&void 0!==a?a:ActionFactory)(S,D,p,o,u,F,()=>this.services),R=new ActionRegister(S,()=>this.services),M=new PrizePoolFactory(httpClient,p),L=new MergeTagsProcessorFactory(y,F,p),P=new WcFactory({state:u,eventEmitter:S,form:D,documentModel:l,resizeListener:f,config:p,commonStylesService:d,trackingService:o,layoutType:n,actionFactory:C,actionRegister:R,prizePoolFactory:M,context:F,mergeTagsProcessorFactory:L,mobileDeviceOrientationListener:v,componentRegister:s,htmlDocumentObject:m}),h=new WcViewRenderer(l,f,t,P,S),x=new DocumentService(l,h,c);this.services={documentService:x,documentModel:l,state:u,form:D,eventEmitter:S,config:p,resizeListener:f,mobileDeviceOrientationListener:v,componentFactory:P,viewRenderer:h,commonStylesService:d,tracking:o,actionFactory:C,actionRegister:R,prizePoolFactory:M,context:F,mergeTagsProcessorFactory:L}}destroy(){Object.keys(this.services).filter(e=>"viewRenderer"!==e).forEach(e=>this.services[e]&&this.services[e].destroy&&this.services[e].destroy())}}
|
package/RouterEvent.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
declare const SysRouterEvent: {
|
|
2
|
+
readonly NAVIGATION_END: "NAVIGATION_END";
|
|
3
|
+
};
|
|
4
|
+
export type SysRouterEventT = typeof SysRouterEvent[keyof typeof SysRouterEvent];
|
|
1
5
|
export default SysRouterEvent;
|
|
2
|
-
declare namespace SysRouterEvent {
|
|
3
|
-
const NAVIGATION_END: string;
|
|
4
|
-
}
|
package/StaticEntryModule.d.ts
CHANGED
|
@@ -1,23 +1,26 @@
|
|
|
1
|
+
import CompositionRoot from "./CompositionRoot";
|
|
2
|
+
import ViewRouter from "./ViewRouter";
|
|
3
|
+
import { RenderModeT } from "@claspo/common/RenderMode";
|
|
4
|
+
import WcResolver from "./wc-renderer/WcResolver";
|
|
5
|
+
import { WcRegister } from "./wc-renderer/WcRegister";
|
|
6
|
+
import { ClDocumentI } from '@claspo/common/document/Document.interface';
|
|
7
|
+
import { WidgetInitConfigI, TrackingServiceI } from '@claspo/common/WidgetInitConfig.interface';
|
|
1
8
|
export default class StaticEntryModule {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
};
|
|
9
|
-
documentJson: any;
|
|
10
|
-
translations: any;
|
|
9
|
+
renderMode: RenderModeT;
|
|
10
|
+
componentResolver: WcResolver;
|
|
11
|
+
componentRegister: WcRegister;
|
|
12
|
+
config: WidgetInitConfigI;
|
|
13
|
+
documentJson: ClDocumentI;
|
|
14
|
+
translations: string | null | undefined;
|
|
11
15
|
compositionRoot: CompositionRoot | null;
|
|
12
|
-
viewRenderer:
|
|
16
|
+
viewRenderer: Record<string, unknown> | null;
|
|
13
17
|
viewRouter: ViewRouter | null;
|
|
14
|
-
trackingService:
|
|
15
|
-
layoutType:
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
trackingService: TrackingServiceI;
|
|
19
|
+
layoutType: string | undefined;
|
|
20
|
+
componentFactory: Record<string, unknown> | null;
|
|
21
|
+
constructor(documentJson: ClDocumentI, componentResolver: WcResolver, componentRegister: WcRegister, config: WidgetInitConfigI, translations: string | null | undefined, trackingService: TrackingServiceI | undefined, layoutType?: string);
|
|
22
|
+
init(htmlDocumentObject?: Document): HTMLDivElement;
|
|
18
23
|
destroy(): void;
|
|
19
|
-
performAction(type:
|
|
20
|
-
listenAction(actionType:
|
|
24
|
+
performAction(type: string, payload: unknown): unknown;
|
|
25
|
+
listenAction(actionType: string, callback: (payload: unknown, eventName: string) => void): void;
|
|
21
26
|
}
|
|
22
|
-
import CompositionRoot from "./CompositionRoot";
|
|
23
|
-
import ViewRouter from "./ViewRouter";
|
package/StaticEntryModule.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import CompositionRoot from"./CompositionRoot";import ViewRouter from"./ViewRouter";import TranslateUtils from"./i18n/TranslateUtils";import{DocumentModelUpdateType}from"./document-model/
|
|
1
|
+
import CompositionRoot from"./CompositionRoot";import ViewRouter from"./ViewRouter";import TranslateUtils from"./i18n/TranslateUtils";import{DocumentModelUpdateType}from"./document-model/DocumentModelService";import CssVarsOperations from"@claspo/common/element/CssVarsOperations";import wcStaticDecorator from"./wc-renderer/decorators/wcStaticDecorator";import RenderMode from"@claspo/common/RenderMode";export default class StaticEntryModule{constructor(e,o,t,s,i,r,n){this.renderMode=RenderMode.STATIC,this.componentResolver=o,this.componentRegister=t,this.config=Object.assign(Object.assign({},s),{renderMode:this.renderMode}),this.documentJson=e,this.translations=i,this.compositionRoot=null,this.viewRenderer=null,this.viewRouter=null,this.trackingService=r||{send:()=>{},trackClick:()=>{},trackTargetAction:()=>{}},this.layoutType=n,this.componentFactory=null,t.register(wcStaticDecorator,this.renderMode)}init(e){const o=e||document;this.documentJson=TranslateUtils.applyTranslationObjectToComponentsIfNeeded(JSON.parse(JSON.stringify(this.documentJson)),this.componentResolver.getComponentManifests(),this.translations);const t=new CompositionRoot(this.documentJson,this.config,this.trackingService,null,"",this.layoutType,this.renderMode,this.componentRegister,o),s=new ViewRouter(t.services.eventEmitter,t.services.documentModel,t.services.viewRenderer,this.config&&this.config.optionalDocumentStyles,t.services);t.services.viewRouter=s,this.compositionRoot=t,this.viewRenderer=t.services.viewRenderer,this.componentFactory=t.services.componentFactory,this.viewRouter=s;const i=this.compositionRoot.services.documentModel.getShared().cssVars;return Promise.resolve().then(()=>CssVarsOperations.override(i,this.viewRouter.getDocumentContainer())),s.start(this.config.viewIndex)}destroy(){var e,o;null===(e=this.viewRouter)||void 0===e||e.destroy(),null===(o=this.compositionRoot)||void 0===o||o.destroy()}performAction(e,o){const t=this.compositionRoot.services.documentService.handleModelUpdate(e,o);switch(e){case DocumentModelUpdateType.COLOR_SCHEMA_UPDATE:{const e=this.compositionRoot.services.documentModel.getShared().cssVars;CssVarsOperations.override(e,this.viewRouter.getDocumentContainer());break}}return t}listenAction(e,o){this.compositionRoot.services.eventEmitter.on(e,(e,t)=>{o(e,t)})}}
|
package/UpdatingEntryModule.d.ts
CHANGED
|
@@ -1,27 +1,23 @@
|
|
|
1
1
|
export default class UpdatingEntryModule {
|
|
2
|
-
|
|
3
|
-
entryModuleType: string;
|
|
2
|
+
renderMode: any;
|
|
4
3
|
documentJson: any;
|
|
5
4
|
componentResolver: any;
|
|
6
5
|
componentRegister: any;
|
|
7
6
|
componentCommonStyles: any;
|
|
8
|
-
config:
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
viewRenderer: import("./wc-renderer/WcViewRenderer").default | null;
|
|
13
|
-
viewComponents: any[];
|
|
7
|
+
config: any;
|
|
8
|
+
compositionRoot: any;
|
|
9
|
+
viewRenderer: any;
|
|
10
|
+
viewComponents: any;
|
|
14
11
|
layoutType: any;
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
12
|
+
componentFactory: any;
|
|
13
|
+
dragEventListener: any;
|
|
14
|
+
constructor(documentJson: any, componentResolver: any, componentRegister: any, componentCommonStyles: any, config: {}, layoutType: any);
|
|
15
|
+
init(containerElement: any): any;
|
|
18
16
|
destroy(): void;
|
|
19
|
-
performAction(type: any, payload: any): Promise<any
|
|
17
|
+
performAction(type: any, payload: any): Promise<any>;
|
|
20
18
|
listenAction(actionType: any, callback: any): void;
|
|
21
19
|
getHostElementById(id: any): any;
|
|
22
20
|
getHostElementByPath(path: any): any;
|
|
23
21
|
getContextRecordsMap(): any;
|
|
24
22
|
listenContextAction(actionType: any, callback: any): void;
|
|
25
23
|
}
|
|
26
|
-
import CompositionRoot from "./CompositionRoot";
|
|
27
|
-
import DragEventListener from "./renderer/DragEventListener";
|
package/UpdatingEntryModule.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import CompositionRoot from"./CompositionRoot";import{DocumentModelUpdateType}from"./document-model/
|
|
1
|
+
import CompositionRoot from"./CompositionRoot";import{DocumentModelUpdateType}from"./document-model/DocumentModelService";import DocumentUtils from"@claspo/common/document/DocumentUtils";import CssVarsOperations from"@claspo/common/element/CssVarsOperations";import DragEventListener from"./renderer/DragEventListener";import RenderMode from"@claspo/common/RenderMode";import wcUpdatingDecorator from"./wc-renderer/decorators/wcUpdatingDecorator";import{asyncActionEmitter}from"./action/asyncAction";export default class UpdatingEntryModule{constructor(e,o,t,s,n={},i){this.renderMode=RenderMode.UPDATING,this.documentJson=JSON.parse(JSON.stringify(e)),this.componentResolver=o,this.componentRegister=t,this.componentCommonStyles=s,this.config=Object.assign(Object.assign({},n),{renderMode:this.renderMode}),this.compositionRoot=null,this.viewRenderer=null,this.viewComponents=[],this.layoutType=i,t.register(wcUpdatingDecorator,this.renderMode)}init(e){const o=new CompositionRoot(this.documentJson,this.config,{send:()=>{}},e,this.componentCommonStyles,this.layoutType,this.renderMode,this.componentRegister,document);return this.compositionRoot=o,this.viewRenderer=o.services.viewRenderer,this.componentFactory=o.services.componentFactory,this.dragEventListener=new DragEventListener(this.compositionRoot.services.eventEmitter,this.compositionRoot.services.documentModel),this.viewComponents=this.compositionRoot.services.documentModel.getViews().map((e,o)=>this.viewRenderer.render(e,o,this.config.renderMode)),this.viewComponents.forEach(e=>{const o=this.compositionRoot.services.documentModel.getShared().cssVars;CssVarsOperations.override(o,e)}),this.viewComponents}destroy(){var e,o;this.viewComponents.forEach(e=>e.remove()),null===(e=this.dragEventListener)||void 0===e||e.destroy(),null===(o=this.compositionRoot)||void 0===o||o.destroy()}performAction(e,o){switch(e){case DocumentModelUpdateType.COMPONENT_REMOVE:case DocumentModelUpdateType.COMPONENT_MOVE:case DocumentModelUpdateType.COMPONENT_INSERT:case DocumentModelUpdateType.COMPONENT_PROPS_UPDATE:case DocumentModelUpdateType.COMPONENT_UPDATE:case DocumentModelUpdateType.MOBILE_BREAKPOINT_UPDATE:case DocumentModelUpdateType.ENVIRONMENT_UPDATE:case DocumentModelUpdateType.TEXT_CLASS_ADDED:case DocumentModelUpdateType.TEXT_CLASS_UPDATED:case DocumentModelUpdateType.TEXT_CLASS_REMOVED:case DocumentModelUpdateType.HEADER_FONT_FAMILY_UPDATE:case DocumentModelUpdateType.TEXT_FONT_FAMILY_UPDATE:case DocumentModelUpdateType.SHARED_UPDATE:return asyncActionEmitter(this.compositionRoot.services.eventEmitter.emit.bind(this.compositionRoot.services.eventEmitter))(this.compositionRoot.services.documentService.handleModelUpdate.bind(this.compositionRoot.services.documentService),e)(e,o);case DocumentModelUpdateType.COLOR_SCHEMA_UPDATE:{const e=this.compositionRoot.services.documentModel.getShared().cssVars;this.viewComponents.forEach(o=>{CssVarsOperations.override(e,o)});break}default:this.compositionRoot.services.eventEmitter.emit(e,o)}}listenAction(e,o){this.compositionRoot.services.eventEmitter.on(e,(e,t)=>{o(e,t)})}getHostElementById(e){const o=DocumentUtils.getNodeById(this.viewComponents.map(e=>e.getModel()),e);return o&&o.componentRef}getHostElementByPath(e){const o=DocumentUtils.getNodeByPath(this.viewComponents.map(e=>e.getModel()),e);return o&&o.componentRef}getContextRecordsMap(){var e;return(null===(e=this.compositionRoot)||void 0===e?void 0:e.services.context.getRecordsMap())||{}}listenContextAction(e,o){this.compositionRoot.services.context.on(e,(e,t)=>{o(e,t)})}}
|
package/ViewRouter.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import DefaultEventEmitter from '@claspo/common/DefaultEventEmitter';
|
|
2
|
+
export default class ViewRouter extends DefaultEventEmitter {
|
|
3
3
|
eventEmitter: any;
|
|
4
4
|
documentModel: any;
|
|
5
5
|
viewRenderer: any;
|
|
@@ -7,15 +7,16 @@ export default class ViewRouter {
|
|
|
7
7
|
services: any;
|
|
8
8
|
currentViewIndex: any;
|
|
9
9
|
currentViewComponentRef: any;
|
|
10
|
-
transitions: any
|
|
10
|
+
transitions: any;
|
|
11
|
+
documentContainer: any;
|
|
12
|
+
contactDataSubmitted: any;
|
|
13
|
+
constructor(eventEmitter: any, documentModel: any, viewRenderer: any, optionalDocumentStyles: any, services: any);
|
|
11
14
|
getCurrentViewIndex(): any;
|
|
12
|
-
start(viewIndex: any):
|
|
13
|
-
documentContainer: HTMLDivElement | undefined;
|
|
14
|
-
contactDataSubmitted: boolean | undefined;
|
|
15
|
+
start(viewIndex: any): any;
|
|
15
16
|
destroy(): void;
|
|
16
17
|
navigate(index: any, routeState?: {}, previousViewDestroyedCb?: () => void): void;
|
|
17
18
|
viewDestroy(): void;
|
|
18
|
-
getDocumentContainer():
|
|
19
|
+
getDocumentContainer(): any;
|
|
19
20
|
getLastTransition(): any;
|
|
20
21
|
_previousViewDestroyedCb(): void;
|
|
21
22
|
}
|
|
@@ -1,5 +1,13 @@
|
|
|
1
|
+
import SubscribeContactAction from "./actions/SubscribeContactAction";
|
|
2
|
+
import RequestAction from "./actions/RequestAction";
|
|
3
|
+
import DispatchEventAction from "./actions/DispatchEventAction";
|
|
4
|
+
import GoToPreviousViewAction from "./actions/GoToPreviousViewAction";
|
|
5
|
+
import GoToNextViewAction from "./actions/GoToNextViewAction";
|
|
6
|
+
import GoToViewAction from "./actions/GoToViewAction";
|
|
7
|
+
import ShowWidgetAction from './actions/ShowWidgetAction';
|
|
8
|
+
import OpenLinkAction from './actions/OpenLinkAction';
|
|
9
|
+
import CloseWidgetAction from "./actions/CloseWidgetAction";
|
|
1
10
|
export default class ActionFactory {
|
|
2
|
-
constructor(eventEmitter: any, form: any, config: any, tracking: any, state: any, context: any, getServices: any);
|
|
3
11
|
eventEmitter: any;
|
|
4
12
|
form: any;
|
|
5
13
|
configService: any;
|
|
@@ -7,14 +15,6 @@ export default class ActionFactory {
|
|
|
7
15
|
stateService: any;
|
|
8
16
|
context: any;
|
|
9
17
|
getServices: any;
|
|
18
|
+
constructor(eventEmitter: any, form: any, config: any, tracking: any, state: any, context: any, getServices: any);
|
|
10
19
|
get(action: any): SubscribeContactAction | RequestAction | DispatchEventAction | GoToPreviousViewAction | GoToNextViewAction | GoToViewAction | ShowWidgetAction | OpenLinkAction | CloseWidgetAction;
|
|
11
20
|
}
|
|
12
|
-
import SubscribeContactAction from "./actions/SubscribeContactAction";
|
|
13
|
-
import RequestAction from "./actions/RequestAction";
|
|
14
|
-
import DispatchEventAction from "./actions/DispatchEventAction";
|
|
15
|
-
import GoToPreviousViewAction from "./actions/GoToPreviousViewAction";
|
|
16
|
-
import GoToNextViewAction from "./actions/GoToNextViewAction";
|
|
17
|
-
import GoToViewAction from "./actions/GoToViewAction";
|
|
18
|
-
import ShowWidgetAction from "./actions/ShowWidgetAction";
|
|
19
|
-
import OpenLinkAction from "./actions/OpenLinkAction";
|
|
20
|
-
import CloseWidgetAction from "./actions/CloseWidgetAction";
|
|
@@ -1,8 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import DefaultEventEmitter from "@claspo/common/DefaultEventEmitter";
|
|
2
|
+
import ViewRouter from '../ViewRouter';
|
|
3
|
+
export interface RegisteredActionI {
|
|
4
|
+
execute(event?: Event, target?: HTMLElement, isComplete?: boolean, overrideParams?: Record<string, any>): void;
|
|
5
|
+
category?: string;
|
|
6
|
+
registeredAtViewIndex?: number;
|
|
7
|
+
[key: string]: any;
|
|
8
|
+
}
|
|
9
|
+
export interface ActionRegisterServicesI {
|
|
10
|
+
viewRouter: ViewRouter;
|
|
11
|
+
[key: string]: any;
|
|
12
|
+
}
|
|
13
|
+
export type GetServicesT = () => ActionRegisterServicesI;
|
|
14
|
+
export interface ExecuteActionByPredicateParamsI {
|
|
15
|
+
predicate: (action: RegisteredActionI) => boolean;
|
|
16
|
+
overrideParams?: Record<string, any>;
|
|
17
|
+
}
|
|
18
|
+
export declare class ActionRegister {
|
|
19
|
+
eventEmitter: DefaultEventEmitter;
|
|
20
|
+
getServices: GetServicesT;
|
|
21
|
+
registeredActions: RegisteredActionI[];
|
|
22
|
+
constructor(eventEmitter: DefaultEventEmitter, getServices: GetServicesT);
|
|
23
|
+
register(actionInstance: RegisteredActionI): void;
|
|
24
|
+
getRegisteredActions(): RegisteredActionI[];
|
|
8
25
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
|
+
declare const SysActionTypes: {
|
|
2
|
+
SUBSCRIBE_CONTACT: string;
|
|
3
|
+
REQUEST: string;
|
|
4
|
+
DISPATCH_EVENT: string;
|
|
5
|
+
GO_TO_VIEW: string;
|
|
6
|
+
GO_TO_PREVIOUS_VIEW: string;
|
|
7
|
+
GO_TO_NEXT_VIEW: string;
|
|
8
|
+
SHOW_WIDGET: string;
|
|
9
|
+
OPEN_LINK: string;
|
|
10
|
+
CLOSE_WIDGET: string;
|
|
11
|
+
CLICK: string;
|
|
12
|
+
};
|
|
1
13
|
export default SysActionTypes;
|
|
2
|
-
declare namespace SysActionTypes {
|
|
3
|
-
const SUBSCRIBE_CONTACT: string;
|
|
4
|
-
const REQUEST: string;
|
|
5
|
-
const DISPATCH_EVENT: string;
|
|
6
|
-
const GO_TO_VIEW: string;
|
|
7
|
-
const GO_TO_PREVIOUS_VIEW: string;
|
|
8
|
-
const GO_TO_NEXT_VIEW: string;
|
|
9
|
-
const SHOW_WIDGET: string;
|
|
10
|
-
const OPEN_LINK: string;
|
|
11
|
-
const CLOSE_WIDGET: string;
|
|
12
|
-
const CLICK: string;
|
|
13
|
-
}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
export
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
}
|
|
1
|
+
export declare const RequestStatus: {
|
|
2
|
+
SUCCESS: string;
|
|
3
|
+
ALREADY_SUBSCRIBED: string;
|
|
4
|
+
ERROR: string;
|
|
5
|
+
TOO_MANY_REQUESTS: string;
|
|
6
|
+
};
|
|
7
7
|
export default class BaseRequestAction {
|
|
8
|
-
constructor(eventEmitter: any, form: any, config: any, httpClient: any, configService: any, tracking: any, state: any, context: any, getServices: any);
|
|
9
8
|
id: any;
|
|
10
9
|
params: any;
|
|
11
10
|
form: any;
|
|
@@ -17,11 +16,12 @@ export default class BaseRequestAction {
|
|
|
17
16
|
stateService: any;
|
|
18
17
|
context: any;
|
|
19
18
|
getServices: any;
|
|
20
|
-
category:
|
|
19
|
+
category: any;
|
|
20
|
+
constructor(eventEmitter: any, form: any, config: any, httpClient: any, configService: any, tracking: any, state: any, context: any, getServices: any);
|
|
21
21
|
skipHttpRequest: boolean;
|
|
22
22
|
getTrackingMessageBeforeSentData(): string;
|
|
23
23
|
getTrackingMessageByStatus(_: any): string;
|
|
24
|
-
execute(isSubmitQueuedAfterPending: any, outerResolve: any, force: any, overrideParams: any): Promise<
|
|
24
|
+
execute(isSubmitQueuedAfterPending: any, outerResolve: any, force: any, overrideParams: any): Promise<unknown>;
|
|
25
25
|
submit(resolve: any, force: any, overrideParams: any): void;
|
|
26
26
|
constructDataToSent({ contextValue, formValue, utmParams }: {
|
|
27
27
|
contextValue: any;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SysActionTypes from"../SysActionTypes";import SysEventTypes from"../../common/SysEventTypes";import HttpStatus from"@claspo/common/network/HttpStatus";import ActionCategory from"./ActionCategory";import systemResultStateNames from"../../document-model/systemResultStateNames";import DocumentUtils from"@claspo/common/document/DocumentUtils";import getComponentCountOnView from"../../sdk/getComponentCountOnView";import
|
|
1
|
+
import SysActionTypes from"../SysActionTypes";import SysEventTypes from"../../common/SysEventTypes";import HttpStatus from"@claspo/common/network/HttpStatus";import ActionCategory from"./ActionCategory";import systemResultStateNames from"../../document-model/systemResultStateNames";import DocumentUtils from"@claspo/common/document/DocumentUtils";import getComponentCountOnView from"../../sdk/getComponentCountOnView";import UTMParamsExtractor from"../UTMParamsExtractor";function componentModelHasSubmitAction(t){var e,s;try{return!!(null===(s=null===(e=t.props)||void 0===e?void 0:e.handlers)||void 0===s?void 0:s.find(t=>{var e;return null===(e=null==t?void 0:t.actions)||void 0===e?void 0:e.find(t=>[SysActionTypes.REQUEST,SysActionTypes.SUBSCRIBE_CONTACT].includes(t.type))}))}catch(t){return!1}}function viewHasControls(t){if(!t)return!1;let e=0;return DocumentUtils.iterateDepthFirst(t,t=>{(["INPUT","MULTIPLE_INPUT","PRIZE_BASED_GAMING"].includes(t.type)||componentModelHasSubmitAction(t))&&e++}),e>0}function isSystemView(t){return t&&systemResultStateNames.includes(t.label)}export const RequestStatus={SUCCESS:"SUCCESS",ALREADY_SUBSCRIBED:"ALREADY_SUBSCRIBED",ERROR:"ERROR",TOO_MANY_REQUESTS:"TOO_MANY_REQUESTS"};export default class BaseRequestAction{constructor(t,e,s,i,n,o,r,a,c){this.skipHttpRequest=!0,this.id=s.id,this.params=s.params,this.form=e,this.eventEmitter=t,this.httpClient=i,this.configService=n,this.formEventsListener=null,this.tracking=o,this.stateService=r,this.context=a,this.getServices=c,this.category=ActionCategory.SUBMIT}getTrackingMessageBeforeSentData(){return""}getTrackingMessageByStatus(t){return""}execute(t,e,s,i){if(this.formEventsListener&&this.formEventsListener.off(),!this.form.submitQueuedAfterPending||!0===t){if(!this.form.preventSubmit)return new Promise(n=>{if(!this.form.isPending()){this.form.submitQueuedAfterPending=!1;const o=!0===t?e:n;return this.submit(o,s,i)}this.form.submitQueuedAfterPending=!0,setTimeout(()=>this.execute(!0,n,s,i),500)});this.form.submitQueuedAfterPending=!1}}submit(t,e,s){const i=this.getServices().viewRouter.getCurrentViewIndex(),n=this.getServices().documentModel.getViews().slice(i+1).filter(t=>!systemResultStateNames.includes(t.label)).length>0,o=Object.assign(Object.assign({},this.params),s);if(this.form.markAsTouched(),this.stateService.getState().emitActionOnSubmit&&this.eventEmitter.emit(this.stateService.getState().emitActionOnSubmit.eventName),this.stateService.getState().interceptSubmitActions&&!e)return;if(!this.form.isValid()&&!o.skipValidation)return this.eventEmitter.emit("INVALID_CONTACT_DATA_SUBMIT_ATTEMPT"),void t(!1);const r=this.stateService,a=r.getState().conditionalRedirectViewId,c=o.conditionalRedirectViewId||a;a&&(o.conditionalRedirectViewId=a,r.setState({conditionalRedirectViewId:null}));let u=this.getServices().documentModel.getViews()[i+1];const m=this.getServices().documentModel.getViews()[i];if(c&&getComponentCountOnView(m,"SysNetPromoterScoreComponent")+getComponentCountOnView(m,"SysFeedbackComponent")===1&&(u=this.getServices().documentModel.getViews().find(t=>t.id===o.conditionalRedirectViewId),viewHasControls(u)||isSystemView(u)))return this.goToView(u.path[0],o),void t(!0);const S=this.form.getControlsMap(),d=this.context.getKVMap();if(n&&(viewHasControls(u)||!Object.keys(S).length&&!Object.keys(d).length))return this.goToView(i+1,o),void t(!0);if(!Object.keys(S).length&&!Object.keys(d).length)return void t(!0);const l=UTMParamsExtractor.extractUtmParams(this.context),g=this.constructRequestPayload({contextValue:d,formValue:S,utmParams:l});this.eventEmitter.emit("CONTACT_DATA_SUBMIT",g);this.getTrackingMessageBeforeSentData()&&this.tracking.send("FormFinish_[Name]"),this.configService.getConfig("isBot")?t():this.sendRequest(g).then(t=>t.json().then(e=>t.status===HttpStatus.TOO_MANY_REQUESTS?{state:RequestStatus.TOO_MANY_REQUESTS}:{contactId:e.contactId,state:e&&e.next&&e.next.type}),()=>({state:RequestStatus.ERROR})).then(e=>{const s=this.getTrackingMessageByStatus(e.state);switch(e.state){case RequestStatus.SUCCESS:s&&this.tracking.send(s),this.goToView(n&&u?u.path[0]:this.getServices().documentModel.getViews().findIndex(t=>"DOCUMENT_VIEW_TYPE_SUCCESS"===t.label||"DOCUMENT_VIEW_TYPE_SUCCESSFUL_REQUEST"===t.label||"REQUEST_FORM_VIEW_TYPE_SUCCESS"===t.label));break;case RequestStatus.ALREADY_SUBSCRIBED:s&&this.tracking.send(s),this.goToView(c&&u?u.path[0]:this.getServices().documentModel.getViews().findIndex(t=>"DOCUMENT_VIEW_TYPE_SUBSCRIBED"===t.label));break;case RequestStatus.ERROR:s&&this.tracking.send(s),this.goToView(c&&u?u.path[0]:this.getServices().documentModel.getViews().findIndex(t=>"DOCUMENT_VIEW_TYPE_ERROR"===t.label));break;case RequestStatus.TOO_MANY_REQUESTS:s&&this.tracking.send(s),this.goToView(c&&u?u.path[0]:this.getServices().documentModel.getViews().findIndex(t=>"DOCUMENT_VIEW_TYPE_ERROR"===t.label)),this.eventEmitter.emit(SysEventTypes.TOO_MANY_REQUESTS)}e.contactId&&"0"!==e.contactId&&this.eventEmitter.emit("CONTACT_ID_WAS_RECEIVED",e.contactId),t(e.state===RequestStatus.SUCCESS||e.state===RequestStatus.ALREADY_SUBSCRIBED)}).catch(()=>{this.goToView(this.getServices().documentModel.getViews().findIndex(t=>"DOCUMENT_VIEW_TYPE_ERROR"===t.label)),t(!1)})}constructDataToSent({contextValue:t,formValue:e,utmParams:s}){const i=Object.assign({},t);return i.tracking=s,Object.keys(e).forEach(t=>{if(t.startsWith("clConsentId")){if(t.endsWith("_label"))return;const s={value:e[t]};e[`${t}_label`]&&(s.text=e[`${t}_label`]),i.consents?i.consents[t]=s:i.consents={[t]:s}}else i[t]=e[t]}),i}constructRequestPayload({contextValue:t,formValue:e,utmParams:s}){let i={data:this.constructDataToSent({contextValue:t,formValue:e,utmParams:s}),referrer:window.location.href,triggeredBy:this.configService.getConfig("triggeredBy")};return this.configService.getConfig("widgetDebugMode")&&(i.ignoreTracking=!0),i}constructRequestHeaders(){const t={},e=this.configService.getConfig("clCustomerId");return e&&Object.assign(t,{"cl-customer-id":e}),t}goToView(t,e){this.eventEmitter.emit(SysActionTypes.GO_TO_VIEW,t,e)}sendRequest(t){return this.skipHttpRequest?Promise.resolve({status:200,json:()=>Promise.resolve({next:{type:RequestStatus.SUCCESS}})}):this.httpClient.execute(this.configService.getConfig("subscribeContactUrl"),"POST",t,this.constructRequestHeaders())}}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export default class CloseWidgetAction
|
|
2
|
-
constructor(eventEmitter: any, actionConfig: any, configService: any, tracking: any);
|
|
3
|
-
type: string;
|
|
1
|
+
export default class CloseWidgetAction {
|
|
4
2
|
params: any;
|
|
5
3
|
eventEmitter: any;
|
|
4
|
+
configService: any;
|
|
6
5
|
tracking: any;
|
|
7
|
-
|
|
6
|
+
type: string;
|
|
7
|
+
constructor(eventEmitter: any, actionConfig: any, configService: any, tracking: any);
|
|
8
|
+
execute(): Promise<unknown>;
|
|
8
9
|
}
|
|
9
|
-
import TrackClick from "./TrackClick";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import SysActionTypes from"../SysActionTypes";export default class CloseWidgetAction{constructor(t,i,s,e){this.type=SysActionTypes.CLOSE_WIDGET,this.params=i.params,this.eventEmitter=t,this.configService=s,this.tracking=e}execute(){return new Promise(t=>{this.eventEmitter.emit(this.type,()=>{t(!0)}),this.tracking.trackClick({params:this.params.trackClickParams,countAsTargetAction:this.params.countAsTargetAction}),this.tracking.trackTargetAction(this.params.countAsTargetAction)})}}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export default class GoToNextViewAction {
|
|
2
|
-
constructor(eventEmitter: any, form: any, config: any, tracking: any);
|
|
3
|
-
type: string;
|
|
4
2
|
eventEmitter: any;
|
|
5
3
|
form: any;
|
|
6
4
|
config: any;
|
|
7
5
|
tracking: any;
|
|
6
|
+
type: string;
|
|
7
|
+
constructor(eventEmitter: any, form: any, config: any, tracking: any);
|
|
8
8
|
execute(): Promise<boolean>;
|
|
9
9
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SysActionTypes from"../SysActionTypes";export default class GoToNextViewAction{constructor(t,i,
|
|
1
|
+
import SysActionTypes from"../SysActionTypes";export default class GoToNextViewAction{constructor(t,e,i,s){this.type=SysActionTypes.GO_TO_NEXT_VIEW,this.eventEmitter=t,this.form=e,this.config=i,this.tracking=s}execute(){return this.form.markAsTouched(),this.form.getControlsAsArray().length&&!this.form.isValid()?(this.eventEmitter.emit("INVALID_CONTACT_DATA_SUBMIT_ATTEMPT"),Promise.resolve(!1)):(this.eventEmitter.emit(this.type),Promise.resolve(!0))}}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default class GoToPreviousViewAction {
|
|
2
|
-
constructor(eventEmitter: any, config: any, tracking: any);
|
|
3
|
-
type: string;
|
|
4
2
|
eventEmitter: any;
|
|
5
3
|
config: any;
|
|
6
4
|
tracking: any;
|
|
5
|
+
type: string;
|
|
6
|
+
constructor(eventEmitter: any, config: any, tracking: any);
|
|
7
7
|
execute(): Promise<boolean>;
|
|
8
8
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SysActionTypes from"../SysActionTypes";export default class GoToPreviousViewAction{constructor(t,i
|
|
1
|
+
import SysActionTypes from"../SysActionTypes";export default class GoToPreviousViewAction{constructor(t,e,i){this.type=SysActionTypes.GO_TO_PREVIOUS_VIEW,this.eventEmitter=t,this.config=e,this.tracking=i}execute(){return this.eventEmitter.emit(this.type),Promise.resolve(!0)}}
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
export default class GoToViewAction
|
|
2
|
-
constructor(eventEmitter: any, actionConfig: any, configService: any, form: any, viewRouter: any, documentModel: any, tracking: any);
|
|
3
|
-
type: string;
|
|
1
|
+
export default class GoToViewAction {
|
|
4
2
|
eventEmitter: any;
|
|
5
3
|
config: any;
|
|
6
4
|
form: any;
|
|
7
5
|
viewRouter: any;
|
|
8
6
|
documentModel: any;
|
|
9
7
|
tracking: any;
|
|
8
|
+
type: string;
|
|
9
|
+
constructor(eventEmitter: any, actionConfig: any, configService: any, form: any, viewRouter: any, documentModel: any, tracking: any);
|
|
10
10
|
execute(): Promise<boolean>;
|
|
11
11
|
}
|
|
12
|
-
import TrackClick from "./TrackClick";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SysActionTypes from"../SysActionTypes";
|
|
1
|
+
import SysActionTypes from"../SysActionTypes";export default class GoToViewAction{constructor(t,i,e,s,o,r,c){this.type=SysActionTypes.GO_TO_VIEW,this.eventEmitter=t,this.config=i,this.form=s,this.viewRouter=o,this.documentModel=r,this.tracking=c}execute(){this.form.markAsTouched();let t=!1;const i=this.viewRouter.getCurrentViewIndex();if(this.config.params.viewId){t=i<this.documentModel.getViews().findIndex(t=>t.id===this.config.params.viewId)}else t=i<this.config.params.viewIndex;return t&&!this.form.isValid()?(this.eventEmitter.emit("INVALID_CONTACT_DATA_SUBMIT_ATTEMPT"),Promise.resolve(!1)):(this.eventEmitter.emit(this.type,this.config.params.viewId||this.config.params.viewIndex),this.config.params.trackClick&&this.tracking.trackClick({params:this.config.params.trackClickParams,countAsTargetAction:this.config.params.countAsTargetAction}),Promise.resolve(!0))}}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default class InAppOpenLinkAction {
|
|
2
|
-
constructor(eventEmitter: any, action: any);
|
|
3
|
-
type: string;
|
|
4
2
|
params: any;
|
|
5
3
|
eventEmitter: any;
|
|
4
|
+
type: string;
|
|
5
|
+
constructor(eventEmitter: any, action: any);
|
|
6
6
|
execute(state: any, event: any): Promise<boolean>;
|
|
7
7
|
constructCustomData(customData: any): any;
|
|
8
8
|
}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
export default class OpenLinkAction
|
|
1
|
+
export default class OpenLinkAction {
|
|
2
|
+
params: any;
|
|
3
|
+
configService: any;
|
|
4
|
+
tracking: any;
|
|
5
|
+
type: string;
|
|
6
|
+
constructor(actionConfig: any, configService: any, tracking: any);
|
|
7
|
+
execute(state: any, event: any): Promise<boolean>;
|
|
2
8
|
static appendQueryParamsToLink(link: any, queryParams: any): string;
|
|
3
9
|
static getUtmTags(utmTagConfig: any, dynamicParamsMap: any): {};
|
|
4
10
|
static getDynamicUtmParamsMap(configService: any): Map<string, string>;
|
|
5
11
|
static normalizeUtmParam(value: any): string;
|
|
6
|
-
constructor(actionConfig: any, configService: any, tracking: any);
|
|
7
|
-
type: string;
|
|
8
|
-
params: any;
|
|
9
|
-
tracking: any;
|
|
10
|
-
execute(state: any, event: any): Promise<boolean>;
|
|
11
12
|
}
|
|
12
|
-
import TrackClick from "./TrackClick";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import SysActionTypes from"../SysActionTypes";import sanitizeUrl from"@claspo/common/url/sanitizeUrl";export default class OpenLinkAction{constructor(t,a,e){this.type=SysActionTypes.OPEN_LINK,this.params=t.params,this.configService=a,this.tracking=e}execute(t,a){a.stopPropagation(),this.tracking.send("FormClick_[Name]"),this.tracking.trackTargetAction(this.params.countAsTargetAction),this.tracking.trackClick({params:this.params.trackClickParams,countAsTargetAction:this.params.countAsTargetAction});let e=this.params.link;const n=this.configService.getConfig("utmTag");if(this.params.tagsEnabled&&(null==n?void 0:n.enabled)){const t=OpenLinkAction.getDynamicUtmParamsMap(this.configService),a=OpenLinkAction.getUtmTags(n,t);e=OpenLinkAction.appendQueryParamsToLink(this.params.link,a)}return window.open(sanitizeUrl(e),this.params.target),Promise.resolve(!0)}static appendQueryParamsToLink(t,a){const e=new URL(t);return Object.keys(a).forEach(t=>{e.searchParams.has(t)||e.searchParams.append(t,a[t])}),e.href}static getUtmTags(t,a){const e={},n=new Map([["utmSource","utm_source"],["utmMedium","utm_medium"],["utmCampaign","utm_campaign"],["utmContent","utm_content"],["utmTerm","utm_term"]]);return["utmSource","utmMedium","utmCampaign","utmContent","utmTerm"].filter(a=>void 0!==(null==t?void 0:t[a])).forEach(i=>{const o=n.get(i),s=a.has(t[i])?a.get(t[i]):encodeURIComponent(t[i]);e[o]=s}),(null==t?void 0:t.customTagsEnabled)&&Object.keys((null==t?void 0:t.utmCustomTags)||{}).filter(a=>{var e;return void 0!==(null===(e=null==t?void 0:t.utmCustomTags)||void 0===e?void 0:e[a])}).forEach(n=>{e[n]=a.has(t.utmCustomTags[n])?a.get(t.utmCustomTags[n]):encodeURIComponent(t.utmCustomTags[n])}),e}static getDynamicUtmParamsMap(t){const a=a=>OpenLinkAction.normalizeUtmParam(t.getConfig(a));return new Map([["$widgetId",a("widgetId")],["$widgetName",encodeURIComponent(a("widgetName"))],["$widgetType",a("layoutType")],["$widgetLang",a("browserLanguage")],["$contactId",encodeURIComponent(a("clContactId"))]])}static normalizeUtmParam(t){return null==t?"":String(t)}}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import BaseRequestAction from "./BaseRequestAction";
|
|
1
2
|
export default class RequestAction extends BaseRequestAction {
|
|
2
3
|
type: string;
|
|
4
|
+
getTrackingMessageBeforeSentData(): string;
|
|
5
|
+
getTrackingMessageByStatus(status: any): string;
|
|
3
6
|
}
|
|
4
|
-
import BaseRequestAction from "./BaseRequestAction";
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export default class ShowWidgetAction {
|
|
2
|
-
constructor(eventEmitter: any, action: any, tracking: any);
|
|
3
|
-
type: string;
|
|
4
2
|
params: any;
|
|
5
3
|
eventEmitter: any;
|
|
6
4
|
tracking: any;
|
|
5
|
+
type: string;
|
|
6
|
+
constructor(eventEmitter: any, action: any, tracking: any);
|
|
7
7
|
execute(): Promise<boolean>;
|
|
8
8
|
}
|
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import BaseRequestAction from "./BaseRequestAction";
|
|
1
2
|
export default class SubscribeContactAction extends BaseRequestAction {
|
|
3
|
+
formEventsListener: any;
|
|
2
4
|
type: string;
|
|
3
5
|
formDataValidation(formValue: any): boolean;
|
|
6
|
+
getTrackingMessageBeforeSentData(): string;
|
|
7
|
+
getTrackingMessageByStatus(status: any): string;
|
|
4
8
|
}
|
|
5
|
-
import BaseRequestAction from "./BaseRequestAction";
|
package/action/asyncAction.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export function asyncAction(dispatch: any): (action: any, type: any) => (...args: any[]) => Promise<any>;
|
|
2
|
-
export function asyncActionEmitter(emit: any): (action: any, type: any) => (...args: any[]) => Promise<any>;
|
|
1
|
+
export declare function asyncAction(dispatch: any): (action: any, type: any) => (...args: any[]) => Promise<any>;
|
|
2
|
+
export declare function asyncActionEmitter(emit: any): (action: any, type: any) => (...args: any[]) => Promise<any>;
|
|
@@ -1,15 +1,5 @@
|
|
|
1
|
+
declare var colorString: {
|
|
2
|
+
to: {};
|
|
3
|
+
get: {};
|
|
4
|
+
};
|
|
1
5
|
export default colorString;
|
|
2
|
-
declare namespace colorString {
|
|
3
|
-
function get(string: any): {
|
|
4
|
-
model: string;
|
|
5
|
-
value: any;
|
|
6
|
-
} | null;
|
|
7
|
-
namespace get {
|
|
8
|
-
function rgb(string: any): number[] | null;
|
|
9
|
-
function hsl(string: any): number[] | null;
|
|
10
|
-
}
|
|
11
|
-
namespace to {
|
|
12
|
-
function rgb(...args: any[]): string;
|
|
13
|
-
function hsl(...args: any[]): string;
|
|
14
|
-
}
|
|
15
|
-
}
|