@veloceapps/sdk 11.0.0-99 → 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 (39) 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/test-mode-configuration.service.d.ts +4 -1
  4. package/core/modules/configuration/types/configuration.types.d.ts +4 -0
  5. package/core/services/flow-info.service.d.ts +5 -5
  6. package/core/services/flow-state-configuration.service.d.ts +7 -2
  7. package/core/utils/index.d.ts +1 -0
  8. package/core/utils/pcm.utils.d.ts +5 -0
  9. package/core/utils/transaction-item.utils.d.ts +5 -2
  10. package/esm2020/cms/vendor-map.mjs +7 -3
  11. package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +21 -18
  12. package/esm2020/core/modules/configuration/services/configuration.service.mjs +3 -5
  13. package/esm2020/core/modules/configuration/services/test-mode-configuration.service.mjs +32 -9
  14. package/esm2020/core/modules/configuration/types/configuration.types.mjs +1 -1
  15. package/esm2020/core/services/flow-info.service.mjs +14 -14
  16. package/esm2020/core/services/flow-state-configuration.service.mjs +70 -33
  17. package/esm2020/core/utils/index.mjs +2 -1
  18. package/esm2020/core/utils/pcm.utils.mjs +15 -0
  19. package/esm2020/core/utils/transaction-item.utils.mjs +82 -6
  20. package/esm2020/src/guards/product-unload.guard.mjs +4 -2
  21. package/esm2020/src/pages/product/product.component.mjs +37 -10
  22. package/esm2020/src/resolvers/ui-definition.resolver.mjs +7 -5
  23. package/esm2020/src/services/flow-router.service.mjs +10 -10
  24. package/fesm2015/veloceapps-sdk-cms.mjs +5 -1
  25. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  26. package/fesm2015/veloceapps-sdk-core.mjs +211 -67
  27. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  28. package/fesm2015/veloceapps-sdk.mjs +49 -19
  29. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  30. package/fesm2020/veloceapps-sdk-cms.mjs +5 -1
  31. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  32. package/fesm2020/veloceapps-sdk-core.mjs +221 -74
  33. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  34. package/fesm2020/veloceapps-sdk.mjs +48 -19
  35. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  36. package/package.json +4 -4
  37. package/src/pages/product/product.component.d.ts +12 -3
  38. package/src/resolvers/ui-definition.resolver.d.ts +1 -1
  39. package/src/services/flow-router.service.d.ts +3 -3
@@ -383,6 +383,15 @@ class FlowRouterService {
383
383
  this.integrationState.dispatch(FlowAction.CloseGuidedSelling({ keepState: true }));
384
384
  });
385
385
  }
386
+ get route$() {
387
+ return this.lastChildRoute$;
388
+ }
389
+ get params$() {
390
+ return this.lastChildParams$;
391
+ }
392
+ get params() {
393
+ return this.getLastChildParams(this.route.snapshot);
394
+ }
386
395
  getFlowRootRoute(route) {
387
396
  var _a;
388
397
  const path = [...route.pathFromRoot];
@@ -408,15 +417,6 @@ class FlowRouterService {
408
417
  .join('/');
409
418
  return '/' + path;
410
419
  }
411
- get route$() {
412
- return this.lastChildRoute$;
413
- }
414
- get params$() {
415
- return this.lastChildParams$;
416
- }
417
- get params() {
418
- return this.getLastChildParams(this.route.snapshot);
419
- }
420
420
  isConfigurationRoute$() {
421
421
  return this.getFlowSubpath$().pipe(map(url => url.startsWith('product')));
422
422
  }
@@ -766,9 +766,12 @@ class ProductUnloadGuard {
766
766
  observable = this.flowDialogService.showUnsavedChangesDialog();
767
767
  }
768
768
  return observable.pipe(map(unload => {
769
+ var _a;
769
770
  if (unload) {
770
771
  this.configurationService.reset();
771
- if (!nextState || currentState.url === nextState.url) {
772
+ const currentUrl = currentState.url.split('?')[0];
773
+ const nextUrl = ((_a = nextState === null || nextState === void 0 ? void 0 : nextState.url) !== null && _a !== void 0 ? _a : '').split('?')[0];
774
+ if (!nextState || currentUrl === nextUrl) {
772
775
  return true;
773
776
  }
774
777
  // clear obsolete queryParams
@@ -1124,25 +1127,50 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
1124
1127
  }] });
1125
1128
 
1126
1129
  class ProductComponent {
1127
- constructor(configurationRuntimeService, configurationStateService) {
1130
+ constructor(configurationRuntimeService, configurationStateService, flowService, route) {
1128
1131
  this.configurationRuntimeService = configurationRuntimeService;
1129
1132
  this.configurationStateService = configurationStateService;
1133
+ this.flowService = flowService;
1134
+ this.route = route;
1130
1135
  this.uiDefinitionContainer$ = new BehaviorSubject(null);
1136
+ this.showNotFound$ = new BehaviorSubject(false);
1137
+ this.isInitialized$ = new BehaviorSubject(true);
1138
+ this.destroy$ = new Subject();
1131
1139
  this.uiDefinitionContainer$.next(this.configurationRuntimeService.uiDefinitionContainer);
1132
1140
  this.config = {
1133
1141
  init$: () => this.init$(),
1134
1142
  };
1135
1143
  }
1144
+ ngOnInit() {
1145
+ let prevParams;
1146
+ this.route.queryParams
1147
+ .pipe(tap(params => {
1148
+ if (prevParams && prevParams['productId'] !== params['productId']) {
1149
+ this.isInitialized$.next(false);
1150
+ setTimeout(() => {
1151
+ this.isInitialized$.next(true);
1152
+ }, 0);
1153
+ }
1154
+ prevParams = params;
1155
+ }))
1156
+ .subscribe();
1157
+ }
1158
+ ngOnDestroy() {
1159
+ this.destroy$.next();
1160
+ this.destroy$.complete();
1161
+ }
1136
1162
  init$() {
1137
- return this.configurationStateService.init$();
1163
+ return this.configurationStateService.init$().pipe(tap(() => {
1164
+ this.showNotFound$.next(Boolean(!this.uiDefinitionContainer$.value));
1165
+ }));
1138
1166
  }
1139
1167
  }
1140
- 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 });
1141
- 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 });
1168
+ 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 });
1169
+ 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 });
1142
1170
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ProductComponent, decorators: [{
1143
1171
  type: Component,
1144
- args: [{ selector: 'vl-flow-product', changeDetection: ChangeDetectionStrategy.OnPush, template: "<vl-cms-preview [uiDefinition]=\"(uiDefinitionContainer$ | async)?.source\" [config]=\"config\"></vl-cms-preview>\n" }]
1145
- }], ctorParameters: function () { return [{ type: i3$1.ConfigurationRuntimeService }, { type: i3$1.ConfigurationStateService }]; } });
1172
+ 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"] }]
1173
+ }], ctorParameters: function () { return [{ type: i3$1.ConfigurationRuntimeService }, { type: i3$1.ConfigurationStateService }, { type: i3$1.FlowInfoService }, { type: i1$2.ActivatedRoute }]; } });
1146
1174
 
1147
1175
  class ProductModule {
1148
1176
  }
@@ -1426,13 +1454,15 @@ const resolveUIDefinition = () => {
1426
1454
  return of(uiDefContainer);
1427
1455
  }
1428
1456
  if (flowInfoService.context.requiredUIDefinitionId) {
1429
- return uiDefinitionsAdminApiService.fetch$(flowInfoService.context.requiredUIDefinitionId);
1457
+ return uiDefinitionsAdminApiService.fetch$(flowInfoService.context.requiredUIDefinitionId, {
1458
+ skipErrorHandler: true,
1459
+ });
1430
1460
  }
1431
1461
  return uiDefinitionsAdminApiService
1432
1462
  .fetchAll$({
1433
1463
  productId,
1434
1464
  defaultUIDefinitionId: flowInfoService.context.defaultUIDefinitionId,
1435
- })
1465
+ }, { skipErrorHandler: true })
1436
1466
  .pipe(map((uiDefinitionContainers) => {
1437
1467
  const uiDefContainer = uiDefinitionContainers[0];
1438
1468
  if (!uiDefContainer) {
@@ -1440,7 +1470,7 @@ const resolveUIDefinition = () => {
1440
1470
  }
1441
1471
  return uiDefContainer;
1442
1472
  }));
1443
- }), tap(uiDefContainer => (configurationRuntimeService.uiDefinitionContainer = uiDefContainer)));
1473
+ }), catchError(() => of(null)), tap(uiDefContainer => (configurationRuntimeService.uiDefinitionContainer = uiDefContainer)));
1444
1474
  };
1445
1475
 
1446
1476
  const rootRoute = {