@claspo/renderer 18.9.2 → 18.9.3
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/action/ActionFactory.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import SysActionTypes from"./SysActionTypes";import SubscribeContactAction from"./actions/SubscribeContactAction";import RequestAction from"./actions/RequestAction";import DispatchEventAction from"./actions/DispatchEventAction";import GoToPreviousViewAction from"./actions/GoToPreviousViewAction";import GoToNextViewAction from"./actions/GoToNextViewAction";import GoToViewAction from"./actions/GoToViewAction";import HttpClient from"@claspo/common/network/HttpClient";import ShowWidgetAction from"./actions/ShowWidgetAction";import OpenLinkAction from"./actions/OpenLinkAction";import CloseWidgetAction from"./actions/CloseWidgetAction";export default class ActionFactory{constructor(t,i,e,o,n,c,s){this.eventEmitter=t,this.form=i,this.configService=e,this.tracking=o,this.stateService=n,this.context=c,this.getServices=s}get(t){switch(t.type){case SysActionTypes.SUBSCRIBE_CONTACT:return new SubscribeContactAction(this.eventEmitter,this.form,t,HttpClient,this.configService,this.tracking,this.stateService,this.context,this.getServices);case SysActionTypes.REQUEST:return new RequestAction(this.eventEmitter,this.form,t,HttpClient,this.configService,this.tracking,this.stateService,this.context,this.getServices);case SysActionTypes.DISPATCH_EVENT:return new DispatchEventAction(this.eventEmitter,t);case SysActionTypes.GO_TO_VIEW:return new GoToViewAction(this.eventEmitter,t,this.configService,this.form,this.getServices().viewRouter,this.getServices().documentModel,this.tracking,this.getServices().activePathTracker);case SysActionTypes.GO_TO_PREVIOUS_VIEW:return new GoToPreviousViewAction(this.eventEmitter,t,this.tracking,this.getServices().activePathTracker);case SysActionTypes.GO_TO_NEXT_VIEW:return new GoToNextViewAction(this.eventEmitter,this.form,t,this.tracking);case SysActionTypes.SHOW_WIDGET:return new ShowWidgetAction(this.eventEmitter,t,this.tracking);case SysActionTypes.OPEN_LINK:return new OpenLinkAction(t,this.configService,this.tracking);case SysActionTypes.CLOSE_WIDGET:return new CloseWidgetAction(this.eventEmitter,t,this.configService,this.tracking);default:throw new Error(`Not supported action type ${t.type}`)}}}
|
|
1
|
+
import SysActionTypes from"./SysActionTypes";import SubscribeContactAction from"./actions/SubscribeContactAction";import RequestAction from"./actions/RequestAction";import DispatchEventAction from"./actions/DispatchEventAction";import GoToPreviousViewAction from"./actions/GoToPreviousViewAction";import GoToNextViewAction from"./actions/GoToNextViewAction";import GoToViewAction from"./actions/GoToViewAction";import HttpClient from"@claspo/common/network/HttpClient";import ShowWidgetAction from"./actions/ShowWidgetAction";import OpenLinkAction from"./actions/OpenLinkAction";import CloseWidgetAction from"./actions/CloseWidgetAction";export default class ActionFactory{constructor(t,i,e,o,n,c,s){this.eventEmitter=t,this.form=i,this.configService=e,this.tracking=o,this.stateService=n,this.context=c,this.getServices=s}get(t){switch(t.type){case SysActionTypes.SUBSCRIBE_CONTACT:return new SubscribeContactAction(this.eventEmitter,this.form,t,HttpClient,this.configService,this.tracking,this.stateService,this.context,this.getServices);case SysActionTypes.REQUEST:return new RequestAction(this.eventEmitter,this.form,t,HttpClient,this.configService,this.tracking,this.stateService,this.context,this.getServices);case SysActionTypes.DISPATCH_EVENT:return new DispatchEventAction(this.eventEmitter,t,this.form,this.configService,this.context);case SysActionTypes.GO_TO_VIEW:return new GoToViewAction(this.eventEmitter,t,this.configService,this.form,this.getServices().viewRouter,this.getServices().documentModel,this.tracking,this.getServices().activePathTracker);case SysActionTypes.GO_TO_PREVIOUS_VIEW:return new GoToPreviousViewAction(this.eventEmitter,t,this.tracking,this.getServices().activePathTracker);case SysActionTypes.GO_TO_NEXT_VIEW:return new GoToNextViewAction(this.eventEmitter,this.form,t,this.tracking);case SysActionTypes.SHOW_WIDGET:return new ShowWidgetAction(this.eventEmitter,t,this.tracking);case SysActionTypes.OPEN_LINK:return new OpenLinkAction(t,this.configService,this.tracking);case SysActionTypes.CLOSE_WIDGET:return new CloseWidgetAction(this.eventEmitter,t,this.configService,this.tracking);default:throw new Error(`Not supported action type ${t.type}`)}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SysActionTypes from"./SysActionTypes";import DispatchEventAction from"./actions/DispatchEventAction";import InAppOpenLinkAction from"./actions/InAppOpenLinkAction";import ActionFactory from"./ActionFactory";export default class InAppActionFactory extends ActionFactory{executeAction(t,{params:e}={}){return{execute:(n,i)=>{var s;return this.eventEmitter.emit(t,Object.assign(Object.assign({},e),{targetComponentId:null===(s=null==i?void 0:i.target)||void 0===s?void 0:s.getAttribute("cl-id")})),Promise.resolve(!0)}}}get(t){switch(t.type){case SysActionTypes.DISPATCH_EVENT:return new DispatchEventAction(this.eventEmitter,t);case SysActionTypes.OPEN_LINK:return new InAppOpenLinkAction(this.eventEmitter,t);case SysActionTypes.CLOSE_WIDGET:return this.executeAction(SysActionTypes.CLOSE_WIDGET,t);case SysActionTypes.CLICK:return this.executeAction(SysActionTypes.CLICK,t);case SysActionTypes.GO_TO_VIEW:case SysActionTypes.GO_TO_NEXT_VIEW:case SysActionTypes.GO_TO_PREVIOUS_VIEW:return super.get(t);default:throw new Error(`Not supported action type ${t.type}`)}}}
|
|
1
|
+
import SysActionTypes from"./SysActionTypes";import DispatchEventAction from"./actions/DispatchEventAction";import InAppOpenLinkAction from"./actions/InAppOpenLinkAction";import ActionFactory from"./ActionFactory";export default class InAppActionFactory extends ActionFactory{executeAction(t,{params:e}={}){return{execute:(n,i)=>{var s;return this.eventEmitter.emit(t,Object.assign(Object.assign({},e),{targetComponentId:null===(s=null==i?void 0:i.target)||void 0===s?void 0:s.getAttribute("cl-id")})),Promise.resolve(!0)}}}get(t){switch(t.type){case SysActionTypes.DISPATCH_EVENT:return new DispatchEventAction(this.eventEmitter,t,this.form,this.configService,this.context);case SysActionTypes.OPEN_LINK:return new InAppOpenLinkAction(this.eventEmitter,t);case SysActionTypes.CLOSE_WIDGET:return this.executeAction(SysActionTypes.CLOSE_WIDGET,t);case SysActionTypes.CLICK:return this.executeAction(SysActionTypes.CLICK,t);case SysActionTypes.GO_TO_VIEW:case SysActionTypes.GO_TO_NEXT_VIEW:case SysActionTypes.GO_TO_PREVIOUS_VIEW:return super.get(t);default:throw new Error(`Not supported action type ${t.type}`)}}}
|
|
@@ -2,7 +2,10 @@ import SysActionTypes from "../SysActionTypes";
|
|
|
2
2
|
export default class DispatchEventAction {
|
|
3
3
|
eventEmitter: any;
|
|
4
4
|
config: any;
|
|
5
|
+
form: any;
|
|
6
|
+
configService: any;
|
|
7
|
+
context: any;
|
|
5
8
|
type: SysActionTypes;
|
|
6
|
-
constructor(eventEmitter: any, config: any);
|
|
9
|
+
constructor(eventEmitter: any, config: any, form: any, configService: any, context: any);
|
|
7
10
|
execute(payload: any): Promise<boolean>;
|
|
8
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import SysActionTypes from"../SysActionTypes";export default class DispatchEventAction{constructor(t,e){this.type=SysActionTypes.DISPATCH_EVENT,this.eventEmitter=t,this.config=e}execute(t){return this.eventEmitter.emit(this.config.params.eventName,
|
|
1
|
+
import SysActionTypes from"../SysActionTypes";import UTMParamsExtractor from"../UTMParamsExtractor";import{constructRequestPayload,extractContextValue}from"../RequestPayloadBuilder";export default class DispatchEventAction{constructor(t,e,o,i,r){this.type=SysActionTypes.DISPATCH_EVENT,this.eventEmitter=t,this.config=e,this.form=o,this.configService=i,this.context=r}execute(t){var e,o,i,r,s,a,c;const n=constructRequestPayload({contextValue:this.context?extractContextValue(this.context):{},formValue:null!==(i=null===(o=null===(e=this.form)||void 0===e?void 0:e.getControlsMap)||void 0===o?void 0:o.call(e))&&void 0!==i?i:{},utmParams:this.context?UTMParamsExtractor.extractTrackingParams(this.context):{},referrer:window.location.href,triggeredBy:null===(s=null===(r=this.configService)||void 0===r?void 0:r.getConfig)||void 0===s?void 0:s.call(r,"triggeredBy"),widgetDebugMode:null===(c=null===(a=this.configService)||void 0===a?void 0:a.getConfig)||void 0===c?void 0:c.call(a,"widgetDebugMode")});return this.eventEmitter.emit(this.config.params.eventName,n),Promise.resolve(!0)}}
|
package/common/ConfigService.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export default class ConfigService{constructor(
|
|
1
|
+
export default class ConfigService{constructor(i){this.config=Object.assign(Object.assign({},{subscribeContactUrl:"",submitOnClose:{enabled:!1,skipValidation:!0}}),i)}getConfig(i){return i?this.config[i]:this.config}}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@claspo/renderer",
|
|
3
|
-
"version": "18.9.
|
|
3
|
+
"version": "18.9.3",
|
|
4
4
|
"scripts": {
|
|
5
5
|
"dev": " tsc --project tsconfig.json --watch",
|
|
6
6
|
"build": "rm -rf out && tsc --project tsconfig.json && npm run minify",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
"node": ">=18.16.0"
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@claspo/common": "7.5.
|
|
18
|
+
"@claspo/common": "7.5.2",
|
|
19
19
|
"@testing-library/dom": "^10.4.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|