@veloceapps/sdk 11.0.0-98 → 12.0.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.
Files changed (41) hide show
  1. package/cms/vendor-map.d.ts +6 -2
  2. package/core/modules/configuration/services/configuration-state.service.d.ts +3 -2
  3. package/core/modules/configuration/services/guided-selling.service.d.ts +1 -1
  4. package/core/modules/configuration/services/test-mode-configuration.service.d.ts +4 -1
  5. package/core/modules/configuration/types/configuration.types.d.ts +4 -0
  6. package/core/services/flow-info.service.d.ts +5 -5
  7. package/core/services/flow-state-configuration.service.d.ts +7 -2
  8. package/core/utils/index.d.ts +1 -0
  9. package/core/utils/pcm.utils.d.ts +5 -0
  10. package/core/utils/transaction-item.utils.d.ts +5 -2
  11. package/esm2020/cms/vendor-map.mjs +7 -3
  12. package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +21 -18
  13. package/esm2020/core/modules/configuration/services/configuration.service.mjs +4 -6
  14. package/esm2020/core/modules/configuration/services/guided-selling.service.mjs +9 -9
  15. package/esm2020/core/modules/configuration/services/test-mode-configuration.service.mjs +34 -11
  16. package/esm2020/core/modules/configuration/types/configuration.types.mjs +1 -1
  17. package/esm2020/core/services/flow-info.service.mjs +14 -14
  18. package/esm2020/core/services/flow-state-configuration.service.mjs +70 -33
  19. package/esm2020/core/utils/index.mjs +2 -1
  20. package/esm2020/core/utils/pcm.utils.mjs +15 -0
  21. package/esm2020/core/utils/transaction-item.utils.mjs +82 -6
  22. package/esm2020/src/guards/product-unload.guard.mjs +4 -2
  23. package/esm2020/src/pages/product/product.component.mjs +37 -10
  24. package/esm2020/src/resolvers/ui-definition.resolver.mjs +7 -5
  25. package/esm2020/src/services/flow-router.service.mjs +10 -10
  26. package/fesm2015/veloceapps-sdk-cms.mjs +5 -1
  27. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  28. package/fesm2015/veloceapps-sdk-core.mjs +221 -77
  29. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  30. package/fesm2015/veloceapps-sdk.mjs +49 -19
  31. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  32. package/fesm2020/veloceapps-sdk-cms.mjs +5 -1
  33. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  34. package/fesm2020/veloceapps-sdk-core.mjs +231 -84
  35. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  36. package/fesm2020/veloceapps-sdk.mjs +48 -19
  37. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  38. package/package.json +4 -4
  39. package/src/pages/product/product.component.d.ts +12 -3
  40. package/src/resolvers/ui-definition.resolver.d.ts +1 -1
  41. package/src/services/flow-router.service.d.ts +3 -3
@@ -456,6 +456,15 @@ class FlowRouterService {
456
456
  this.integrationState.dispatch(FlowAction.CloseGuidedSelling({ keepState: true }));
457
457
  });
458
458
  }
459
+ get route$() {
460
+ return this.lastChildRoute$;
461
+ }
462
+ get params$() {
463
+ return this.lastChildParams$;
464
+ }
465
+ get params() {
466
+ return this.getLastChildParams(this.route.snapshot);
467
+ }
459
468
  getFlowRootRoute(route) {
460
469
  const path = [...route.pathFromRoot];
461
470
  while (path.length) {
@@ -480,15 +489,6 @@ class FlowRouterService {
480
489
  .join('/');
481
490
  return '/' + path;
482
491
  }
483
- get route$() {
484
- return this.lastChildRoute$;
485
- }
486
- get params$() {
487
- return this.lastChildParams$;
488
- }
489
- get params() {
490
- return this.getLastChildParams(this.route.snapshot);
491
- }
492
492
  isConfigurationRoute$() {
493
493
  return this.getFlowSubpath$().pipe(map(url => url.startsWith('product')));
494
494
  }
@@ -756,7 +756,9 @@ class ProductUnloadGuard {
756
756
  return observable.pipe(map(unload => {
757
757
  if (unload) {
758
758
  this.configurationService.reset();
759
- if (!nextState || currentState.url === nextState.url) {
759
+ const currentUrl = currentState.url.split('?')[0];
760
+ const nextUrl = (nextState?.url ?? '').split('?')[0];
761
+ if (!nextState || currentUrl === nextUrl) {
760
762
  return true;
761
763
  }
762
764
  // clear obsolete queryParams
@@ -1106,25 +1108,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1106
1108
  }] });
1107
1109
 
1108
1110
  class ProductComponent {
1109
- constructor(configurationRuntimeService, configurationStateService) {
1111
+ constructor(configurationRuntimeService, configurationStateService, flowService, route) {
1110
1112
  this.configurationRuntimeService = configurationRuntimeService;
1111
1113
  this.configurationStateService = configurationStateService;
1114
+ this.flowService = flowService;
1115
+ this.route = route;
1112
1116
  this.uiDefinitionContainer$ = new BehaviorSubject(null);
1117
+ this.showNotFound$ = new BehaviorSubject(false);
1118
+ this.isInitialized$ = new BehaviorSubject(true);
1119
+ this.destroy$ = new Subject();
1113
1120
  this.uiDefinitionContainer$.next(this.configurationRuntimeService.uiDefinitionContainer);
1114
1121
  this.config = {
1115
1122
  init$: () => this.init$(),
1116
1123
  };
1117
1124
  }
1125
+ ngOnInit() {
1126
+ let prevParams;
1127
+ this.route.queryParams
1128
+ .pipe(tap(params => {
1129
+ if (prevParams && prevParams['productId'] !== params['productId']) {
1130
+ this.isInitialized$.next(false);
1131
+ setTimeout(() => {
1132
+ this.isInitialized$.next(true);
1133
+ }, 0);
1134
+ }
1135
+ prevParams = params;
1136
+ }))
1137
+ .subscribe();
1138
+ }
1139
+ ngOnDestroy() {
1140
+ this.destroy$.next();
1141
+ this.destroy$.complete();
1142
+ }
1118
1143
  init$() {
1119
- return this.configurationStateService.init$();
1144
+ return this.configurationStateService.init$().pipe(tap(() => {
1145
+ this.showNotFound$.next(Boolean(!this.uiDefinitionContainer$.value));
1146
+ }));
1120
1147
  }
1121
1148
  }
1122
- ProductComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, deps: [{ token: i3$1.ConfigurationRuntimeService }, { token: i3$1.ConfigurationStateService }], target: i0.ɵɵFactoryTarget.Component });
1123
- ProductComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ProductComponent, selector: "vl-flow-product", ngImport: i0, template: "<vl-cms-preview [uiDefinition]=\"(uiDefinitionContainer$ | async)?.source\" [config]=\"config\"></vl-cms-preview>\n", styles: [""], dependencies: [{ kind: "component", type: i5.PreviewComponent, selector: "vl-cms-preview", inputs: ["uiDefinition", "config"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1149
+ ProductComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, deps: [{ token: i3$1.ConfigurationRuntimeService }, { token: i3$1.ConfigurationStateService }, { token: i3$1.FlowInfoService }, { token: i1$2.ActivatedRoute }], target: i0.ɵɵFactoryTarget.Component });
1150
+ ProductComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", type: ProductComponent, selector: "vl-flow-product", ngImport: i0, template: "<vl-cms-preview\n *ngIf=\"isInitialized$ | async\"\n [uiDefinition]=\"(uiDefinitionContainer$ | async)?.source\"\n [config]=\"config\"\n></vl-cms-preview>\n\n<div *ngIf=\"showNotFound$ | async\" class=\"not-found-wrapper\">\n <div class=\"not-found\">\n <div class=\"icon\"></div>\n <div class=\"message\">\n This product doesn't have a linked Configuration UI. <br />\n Please contact your system administrator for further assistance.\n </div>\n </div>\n</div>\n", styles: [".not-found-wrapper{position:absolute;top:0;display:flex;width:100%;height:100%;justify-content:center;align-items:center;background-color:#fff;z-index:1000}.not-found{display:flex;align-items:center;padding:16px;border-radius:8px;gap:8px;background-color:#f5f5f5}.not-found .icon{width:48px;height:42px;background-image:url(\"data:image/svg+xml,%3Csvg width='48' height='42' viewBox='0 0 48 42' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cellipse cx='24.0798' cy='32.6052' rx='2.85714' ry='2.63158' fill='%231F2029'/%3E%3Cpath d='M22.285 3.35831C23.0618 2.06363 24.9382 2.06363 25.715 3.35831L46.1826 37.471C46.9824 38.8041 46.0222 40.5 44.4676 40.5L3.53238 40.5C1.97779 40.5 1.01757 38.8041 1.8174 37.471L22.285 3.35831Z' stroke='%23141414' stroke-width='2'/%3E%3Cpath d='M24 17.342V26.8157' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E%0A\")}.not-found .message{font-size:14px;color:#141414;font-weight:300}\n"], dependencies: [{ kind: "directive", type: i4.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i5.PreviewComponent, selector: "vl-cms-preview", inputs: ["uiDefinition", "config"] }, { kind: "pipe", type: i4.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1124
1151
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, decorators: [{
1125
1152
  type: Component,
1126
- args: [{ selector: 'vl-flow-product', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-cms-preview [uiDefinition]=\"(uiDefinitionContainer$ | async)?.source\" [config]=\"config\"></vl-cms-preview>\n" }]
1127
- }], ctorParameters: function () { return [{ type: i3$1.ConfigurationRuntimeService }, { type: i3$1.ConfigurationStateService }]; } });
1153
+ args: [{ selector: 'vl-flow-product', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-cms-preview\n *ngIf=\"isInitialized$ | async\"\n [uiDefinition]=\"(uiDefinitionContainer$ | async)?.source\"\n [config]=\"config\"\n></vl-cms-preview>\n\n<div *ngIf=\"showNotFound$ | async\" class=\"not-found-wrapper\">\n <div class=\"not-found\">\n <div class=\"icon\"></div>\n <div class=\"message\">\n This product doesn't have a linked Configuration UI. <br />\n Please contact your system administrator for further assistance.\n </div>\n </div>\n</div>\n", styles: [".not-found-wrapper{position:absolute;top:0;display:flex;width:100%;height:100%;justify-content:center;align-items:center;background-color:#fff;z-index:1000}.not-found{display:flex;align-items:center;padding:16px;border-radius:8px;gap:8px;background-color:#f5f5f5}.not-found .icon{width:48px;height:42px;background-image:url(\"data:image/svg+xml,%3Csvg width='48' height='42' viewBox='0 0 48 42' fill='none' xmlns='http://www.w3.org/2000/svg'%3E%3Cellipse cx='24.0798' cy='32.6052' rx='2.85714' ry='2.63158' fill='%231F2029'/%3E%3Cpath d='M22.285 3.35831C23.0618 2.06363 24.9382 2.06363 25.715 3.35831L46.1826 37.471C46.9824 38.8041 46.0222 40.5 44.4676 40.5L3.53238 40.5C1.97779 40.5 1.01757 38.8041 1.8174 37.471L22.285 3.35831Z' stroke='%23141414' stroke-width='2'/%3E%3Cpath d='M24 17.342V26.8157' stroke='black' stroke-width='3' stroke-linecap='round'/%3E%3C/svg%3E%0A\")}.not-found .message{font-size:14px;color:#141414;font-weight:300}\n"] }]
1154
+ }], ctorParameters: function () { return [{ type: i3$1.ConfigurationRuntimeService }, { type: i3$1.ConfigurationStateService }, { type: i3$1.FlowInfoService }, { type: i1$2.ActivatedRoute }]; } });
1128
1155
 
1129
1156
  class ProductModule {
1130
1157
  }
@@ -1406,13 +1433,15 @@ const resolveUIDefinition = () => {
1406
1433
  return of(uiDefContainer);
1407
1434
  }
1408
1435
  if (flowInfoService.context.requiredUIDefinitionId) {
1409
- return uiDefinitionsAdminApiService.fetch$(flowInfoService.context.requiredUIDefinitionId);
1436
+ return uiDefinitionsAdminApiService.fetch$(flowInfoService.context.requiredUIDefinitionId, {
1437
+ skipErrorHandler: true,
1438
+ });
1410
1439
  }
1411
1440
  return uiDefinitionsAdminApiService
1412
1441
  .fetchAll$({
1413
1442
  productId,
1414
1443
  defaultUIDefinitionId: flowInfoService.context.defaultUIDefinitionId,
1415
- })
1444
+ }, { skipErrorHandler: true })
1416
1445
  .pipe(map((uiDefinitionContainers) => {
1417
1446
  const uiDefContainer = uiDefinitionContainers[0];
1418
1447
  if (!uiDefContainer) {
@@ -1420,7 +1449,7 @@ const resolveUIDefinition = () => {
1420
1449
  }
1421
1450
  return uiDefContainer;
1422
1451
  }));
1423
- }), tap(uiDefContainer => (configurationRuntimeService.uiDefinitionContainer = uiDefContainer)));
1452
+ }), catchError(() => of(null)), tap(uiDefContainer => (configurationRuntimeService.uiDefinitionContainer = uiDefContainer)));
1424
1453
  };
1425
1454
 
1426
1455
  const rootRoute = {