@claspo/renderer 18.10.2-gbx3 → 18.10.2

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.
@@ -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,s,c,n){this.eventEmitter=t,this.form=i,this.configService=e,this.tracking=o,this.stateService=s,this.context=c,this.getServices=n}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,this.stateService);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,this.stateService);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}`)}}}
@@ -4,8 +4,7 @@ export default class GoToNextViewAction {
4
4
  form: any;
5
5
  config: any;
6
6
  tracking: any;
7
- stateService: any;
8
7
  type: SysActionTypes;
9
- constructor(eventEmitter: any, form: any, config: any, tracking: any, stateService?: any);
10
- execute(_state?: any, _event?: any, force?: boolean): Promise<boolean>;
8
+ constructor(eventEmitter: any, form: any, config: any, tracking: any);
9
+ execute(): Promise<boolean>;
11
10
  }
@@ -1 +1 @@
1
- import SysActionTypes from"../SysActionTypes";import interceptForwardNavigation from"./interceptForwardNavigation";export default class GoToNextViewAction{constructor(t,i,e,r,o){this.type=SysActionTypes.GO_TO_NEXT_VIEW,this.eventEmitter=t,this.form=i,this.config=e,this.tracking=r,this.stateService=o}async execute(t,i,e=!1){if(this.form.markAsTouched(),interceptForwardNavigation(this.stateService,this.eventEmitter,e))return!1;if(this.form.getControlsAsArray().length){if(!await this.form.waitForPendingValidationAndCheckIfValid())return this.eventEmitter.emit("INVALID_CONTACT_DATA_SUBMIT_ATTEMPT"),!1}return this.eventEmitter.emit(this.type),!0}}
1
+ import SysActionTypes from"../SysActionTypes";export default class GoToNextViewAction{constructor(t,i,e,s){this.type=SysActionTypes.GO_TO_NEXT_VIEW,this.eventEmitter=t,this.form=i,this.config=e,this.tracking=s}async execute(){if(this.form.markAsTouched(),this.form.getControlsAsArray().length){if(!await this.form.waitForPendingValidationAndCheckIfValid())return this.eventEmitter.emit("INVALID_CONTACT_DATA_SUBMIT_ATTEMPT"),!1}return this.eventEmitter.emit(this.type),!0}}
@@ -7,10 +7,9 @@ export default class GoToViewAction {
7
7
  documentModel: any;
8
8
  tracking: any;
9
9
  activePathTracker: any;
10
- stateService: any;
11
10
  type: SysActionTypes;
12
- constructor(eventEmitter: any, actionConfig: any, configService: any, form: any, viewRouter: any, documentModel: any, tracking: any, activePathTracker: any, stateService?: any);
13
- execute(_state?: any, _event?: any, force?: boolean): Promise<boolean>;
11
+ constructor(eventEmitter: any, actionConfig: any, configService: any, form: any, viewRouter: any, documentModel: any, tracking: any, activePathTracker: any);
12
+ execute(): Promise<boolean>;
14
13
  private getTargetViewIndex;
15
14
  private isForwardNavigation;
16
15
  }
@@ -1 +1 @@
1
- import SysActionTypes from"../SysActionTypes";import ErrorLogger from"../../error/ErrorLogger";import interceptForwardNavigation from"./interceptForwardNavigation";export default class GoToViewAction{constructor(t,i,e,r,a,o,n,s,c){this.type=SysActionTypes.GO_TO_VIEW,this.eventEmitter=t,this.config=i,this.form=r,this.viewRouter=a,this.documentModel=o,this.tracking=n,this.activePathTracker=s,this.stateService=c}async execute(t,i,e=!1){var r;try{this.form.markAsTouched();const t=this.isForwardNavigation(this.getTargetViewIndex());if(t&&interceptForwardNavigation(this.stateService,this.eventEmitter,e))return!1;if(t&&(null===(r=this.config.params.validateForm)||void 0===r||r)){if(!await this.form.waitForPendingValidationAndCheckIfValid())return this.eventEmitter.emit("INVALID_CONTACT_DATA_SUBMIT_ATTEMPT"),!1}return this.eventEmitter.emit(this.type,this.config.params.viewId||this.config.params.viewIndex,{isForward:t}),this.config.params.trackClick&&this.tracking.trackClick({params:this.config.params.trackClickParams,countAsTargetAction:this.config.params.countAsTargetAction}),!0}catch(t){return ErrorLogger.log(`GoToViewAction.execute failed: ${(null==t?void 0:t.stack)||t}`),!1}}getTargetViewIndex(){return this.config.params.viewId?this.documentModel.getViews().findIndex(t=>t.id===this.config.params.viewId):this.config.params.viewIndex}isForwardNavigation(t){var i,e,r;if("number"!=typeof t||t<0)return!1;const a=null!==(r=null===(e=null===(i=this.activePathTracker)||void 0===i?void 0:i.getActivePath)||void 0===e?void 0:e.call(i))&&void 0!==r?r:[];return a.length?!a.includes(t):this.viewRouter.getCurrentViewIndex()<t}}
1
+ import SysActionTypes from"../SysActionTypes";import ErrorLogger from"../../error/ErrorLogger";export default class GoToViewAction{constructor(t,i,e,r,o,a,s,n){this.type=SysActionTypes.GO_TO_VIEW,this.eventEmitter=t,this.config=i,this.form=r,this.viewRouter=o,this.documentModel=a,this.tracking=s,this.activePathTracker=n}async execute(){var t;try{this.form.markAsTouched();const i=this.isForwardNavigation(this.getTargetViewIndex());if(i&&(null===(t=this.config.params.validateForm)||void 0===t||t)){if(!await this.form.waitForPendingValidationAndCheckIfValid())return this.eventEmitter.emit("INVALID_CONTACT_DATA_SUBMIT_ATTEMPT"),!1}return this.eventEmitter.emit(this.type,this.config.params.viewId||this.config.params.viewIndex,{isForward:i}),this.config.params.trackClick&&this.tracking.trackClick({params:this.config.params.trackClickParams,countAsTargetAction:this.config.params.countAsTargetAction}),!0}catch(t){return ErrorLogger.log(`GoToViewAction.execute failed: ${(null==t?void 0:t.stack)||t}`),!1}}getTargetViewIndex(){return this.config.params.viewId?this.documentModel.getViews().findIndex(t=>t.id===this.config.params.viewId):this.config.params.viewIndex}isForwardNavigation(t){var i,e,r;if("number"!=typeof t||t<0)return!1;const o=null!==(r=null===(e=null===(i=this.activePathTracker)||void 0===i?void 0:i.getActivePath)||void 0===e?void 0:e.call(i))&&void 0!==r?r:[];return o.length?!o.includes(t):this.viewRouter.getCurrentViewIndex()<t}}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claspo/renderer",
3
- "version": "18.10.2-gbx3",
3
+ "version": "18.10.2",
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.4-gbx3",
18
+ "@claspo/common": "7.5.4",
19
19
  "@testing-library/dom": "^10.4.0"
20
20
  },
21
21
  "devDependencies": {
@@ -1 +0,0 @@
1
- export default function interceptForwardNavigation(stateService: any, eventEmitter: any, force: boolean): boolean;
@@ -1 +0,0 @@
1
- export default function interceptForwardNavigation(t,i,n){var o,e;const a=(null===(o=null==t?void 0:t.getState)||void 0===o?void 0:o.call(t))||{};if(!a.interceptForwardNavigationActions||n)return!1;const r=null===(e=a.emitActionOnForwardNavigation)||void 0===e?void 0:e.eventName;return r&&i.emit(r),!0}