@veloceapps/sdk 7.0.2-72 → 7.0.2-74

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 (50) hide show
  1. package/cms/components/preview/preview.component.d.ts +6 -9
  2. package/cms/components/preview/preview.types.d.ts +5 -0
  3. package/cms/services/resources.service.d.ts +9 -0
  4. package/cms/utils/encoding.utils.d.ts +2 -0
  5. package/cms/vendor-map.d.ts +2 -1
  6. package/core/modules/configuration/index.d.ts +1 -0
  7. package/core/modules/configuration/services/configuration-runtime.service.d.ts +4 -3
  8. package/core/modules/configuration/services/configuration.service.d.ts +6 -4
  9. package/core/modules/configuration/services/configuration.state.d.ts +30 -0
  10. package/core/modules/configuration/services/runtime-context.service.d.ts +1 -1
  11. package/core/types/runtime.types.d.ts +2 -2
  12. package/esm2020/cms/components/preview/preview.component.mjs +17 -37
  13. package/esm2020/cms/components/preview/preview.types.mjs +1 -1
  14. package/esm2020/cms/services/resources.service.mjs +19 -1
  15. package/esm2020/cms/utils/element.utils.mjs +8 -8
  16. package/esm2020/cms/utils/encoding.utils.mjs +28 -0
  17. package/esm2020/cms/vendor-map.mjs +3 -2
  18. package/esm2020/core/modules/configuration/configuration.module.mjs +4 -1
  19. package/esm2020/core/modules/configuration/index.mjs +2 -1
  20. package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +27 -19
  21. package/esm2020/core/modules/configuration/services/configuration.service.mjs +41 -29
  22. package/esm2020/core/modules/configuration/services/configuration.state.mjs +142 -0
  23. package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +10 -11
  24. package/esm2020/core/services/quote-draft.service.mjs +1 -1
  25. package/esm2020/core/types/runtime.types.mjs +1 -1
  26. package/esm2020/src/components/doc-gen/doc-gen.component.mjs +1 -1
  27. package/esm2020/src/components/guided-selling/guided-selling.component.mjs +1 -1
  28. package/esm2020/src/pages/assets/assets.component.mjs +1 -1
  29. package/esm2020/src/pages/catalog/catalog.component.mjs +1 -1
  30. package/esm2020/src/pages/legacy-product/legacy-product.component.mjs +4 -4
  31. package/esm2020/src/pages/product/product.component.mjs +50 -66
  32. package/esm2020/src/pages/remote/remote.component.mjs +19 -19
  33. package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +1 -1
  34. package/esm2020/src/types/flow-customization.types.mjs +1 -1
  35. package/fesm2015/veloceapps-sdk-cms.mjs +79 -50
  36. package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
  37. package/fesm2015/veloceapps-sdk-core.mjs +214 -59
  38. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  39. package/fesm2015/veloceapps-sdk.mjs +67 -80
  40. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  41. package/fesm2020/veloceapps-sdk-cms.mjs +76 -50
  42. package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
  43. package/fesm2020/veloceapps-sdk-core.mjs +206 -55
  44. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  45. package/fesm2020/veloceapps-sdk.mjs +64 -76
  46. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  47. package/package.json +1 -1
  48. package/src/pages/product/product.component.d.ts +10 -21
  49. package/src/pages/remote/remote.component.d.ts +3 -4
  50. package/src/types/flow-customization.types.d.ts +3 -3
@@ -2,18 +2,17 @@ import { __decorate, __param, __metadata, __rest } from 'tslib';
2
2
  import * as i0 from '@angular/core';
3
3
  import { InjectionToken, Component, ChangeDetectionStrategy, Inject, Injector, Injectable, ViewContainerRef, SkipSelf, ViewChild, Input, ViewEncapsulation, NgModule, inject, ElementRef, Directive, ApplicationRef, createComponent, createNgModule } from '@angular/core';
4
4
  import * as rxjs from 'rxjs';
5
- import { BehaviorSubject, Subject, filter, map, distinctUntilChanged, of, tap, switchMap, startWith, ReplaySubject, noop, take, Observable, takeUntil, combineLatest, forkJoin, catchError } from 'rxjs';
5
+ import { BehaviorSubject, Subject, filter, map, distinctUntilChanged, of, tap, switchMap, startWith, ReplaySubject, noop, take, Observable, takeUntil, combineLatest, catchError } from 'rxjs';
6
+ import * as i3 from '@veloceapps/components';
7
+ import { ToastType, LetDirectiveModule, LoaderModule, ToastService } from '@veloceapps/components';
6
8
  import lodash, { compact, cloneDeep, isArray, pull, merge, omit, flatten, set, kebabCase } from 'lodash';
7
9
  import { getCollectionUniqueName, UUID, isDefined, Operator, Predicate, parseJsonSafely, CoreModule } from '@veloceapps/core';
8
10
  import { applyPatch } from 'rfc6902';
9
- import * as i2 from '@veloceapps/sdk/core';
10
- import { ConfigurationService, QuoteDraftService, FlowConfigurationService, LineItemWorker, ProductImagesService, ContextService, RuntimeSettingsService, lineItemUtils, generateLineItem, getAttributeValue, SdkPipesModule, SdkCoreModule, UI_DEFINITION_VERSION } from '@veloceapps/sdk/core';
11
- import * as i3 from 'primeng/api';
11
+ import * as i4 from '@veloceapps/sdk/core';
12
+ import { ConfigurationService, ConfigurationState, QuoteDraftService, FlowConfigurationService, LineItemWorker, ProductImagesService, ContextService, RuntimeSettingsService, lineItemUtils, generateLineItem, getAttributeValue, SdkPipesModule, SdkCoreModule, UI_DEFINITION_VERSION } from '@veloceapps/sdk/core';
12
13
  import * as i5 from '@angular/common';
13
14
  import { CommonModule, DOCUMENT } from '@angular/common';
14
- import * as i1 from '@veloceapps/components';
15
- import { LetDirectiveModule, LoaderModule, ToastService, ToastType } from '@veloceapps/components';
16
- import * as i2$1 from 'ngx-drag-drop';
15
+ import * as i2 from 'ngx-drag-drop';
17
16
  import { DndModule } from 'ngx-drag-drop';
18
17
  import { SalesforceApiService, QuoteApiService, DocumentTemplatesApiService, DocumentAttachmentApiService, RampApiService, CatalogApiService, DeltaApiService, PicklistsApiService, PriceApiService, ShoppingCartSettingsApiService, ConfigurationSettingsApiService, GuidedSellingApiService, ApiModule } from '@veloceapps/api';
19
18
  import { DialogService } from 'primeng/dynamicdialog';
@@ -852,7 +851,11 @@ class ResourcesService {
852
851
  this.scripts.set(url, false);
853
852
  const script = document.createElement('script');
854
853
  script.src = url;
854
+ // Hacky fix
855
+ this.persistAMDLoader();
855
856
  script.onload = () => {
857
+ // Hacky fix
858
+ this.restoreAMDLoader();
856
859
  this.scripts.set(url, true);
857
860
  this.loaded$.next();
858
861
  };
@@ -877,6 +880,21 @@ class ResourcesService {
877
880
  rootEl.appendChild(link);
878
881
  });
879
882
  }
883
+ persistAMDLoader() {
884
+ var _a;
885
+ // Do nothing if AMD loader is not defined
886
+ if (!((_a = window.define) === null || _a === void 0 ? void 0 : _a.amd)) {
887
+ return;
888
+ }
889
+ this.amd = window.define.amd;
890
+ window.define.amd = undefined;
891
+ }
892
+ restoreAMDLoader() {
893
+ if (window.define && this.amd) {
894
+ window.define.amd = this.amd;
895
+ this.amd = undefined;
896
+ }
897
+ }
880
898
  }
881
899
  ResourcesService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ResourcesService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
882
900
  ResourcesService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ResourcesService, providedIn: 'root' });
@@ -1040,7 +1058,7 @@ class ElementRendererComponent {
1040
1058
  this.refs = {};
1041
1059
  }
1042
1060
  }
1043
- ElementRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementRendererComponent, deps: [{ token: i0.Injector, skipSelf: true }, { token: RuntimeService }, { token: ElementContextService }, { token: IOProviderService }, { token: i2.ConfigurationService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1061
+ ElementRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementRendererComponent, deps: [{ token: i0.Injector, skipSelf: true }, { token: RuntimeService }, { token: ElementContextService }, { token: IOProviderService }, { token: i4.ConfigurationService }, { token: i0.ElementRef }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
1044
1062
  ElementRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: { meta: "meta" }, providers: [ElementContextService], viewQueries: [{ propertyName: "el", first: true, predicate: ["el"], descendants: true, read: ViewContainerRef, static: true }], ngImport: i0, template: "<ng-template #el></ng-template>\n", styles: [":host{display:contents}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1045
1063
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementRendererComponent, decorators: [{
1046
1064
  type: Component,
@@ -1048,7 +1066,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
1048
1066
  }], ctorParameters: function () {
1049
1067
  return [{ type: i0.Injector, decorators: [{
1050
1068
  type: SkipSelf
1051
- }] }, { type: RuntimeService }, { type: ElementContextService }, { type: IOProviderService }, { type: i2.ConfigurationService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }];
1069
+ }] }, { type: RuntimeService }, { type: ElementContextService }, { type: IOProviderService }, { type: i4.ConfigurationService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }];
1052
1070
  }, propDecorators: { el: [{
1053
1071
  type: ViewChild,
1054
1072
  args: ['el', { read: ViewContainerRef, static: true }]
@@ -1057,11 +1075,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
1057
1075
  }] } });
1058
1076
 
1059
1077
  class PreviewComponent {
1060
- constructor(runtimeService, configurationService, messageService, configurationRuntimeService, integrationState) {
1078
+ constructor(runtimeService, configurationState, toastService, integrationState) {
1061
1079
  this.runtimeService = runtimeService;
1062
- this.configurationService = configurationService;
1063
- this.messageService = messageService;
1064
- this.configurationRuntimeService = configurationRuntimeService;
1080
+ this.configurationState = configurationState;
1081
+ this.toastService = toastService;
1065
1082
  this.integrationState = integrationState;
1066
1083
  this.state$ = new BehaviorSubject({ loading: true, failure: false });
1067
1084
  this.destroy$ = new Subject();
@@ -1088,38 +1105,23 @@ class PreviewComponent {
1088
1105
  ngOnDestroy() {
1089
1106
  this.destroy$.next();
1090
1107
  this.destroy$.complete();
1091
- this.configurationService.reset();
1108
+ this.configurationState.cleanup();
1092
1109
  this.runtimeService.clear();
1093
1110
  }
1094
1111
  trackBy(_, el) {
1095
1112
  return el;
1096
1113
  }
1097
- initializeConfiguration$() {
1098
- const isAlreadyInitialized = this.configurationRuntimeService.isInitialized;
1099
- if (!this.uiDefinition || this.uiDefinition.type !== 'CONFIGURATION' || isAlreadyInitialized) {
1100
- return of({});
1101
- }
1102
- if (!this.modelId) {
1103
- console.warn(`No modelId is given for uiDefinition with '${this.uiDefinition.type}' type`);
1104
- return of({});
1105
- }
1106
- // If still not initialized - init configuration in Test mode
1107
- return this.configurationRuntimeService
1108
- .initTestMode(this.modelId, this.uiDefinition)
1109
- .pipe(switchMap(() => this.configurationService.configure()));
1110
- }
1111
1114
  startPreview() {
1112
- if (!this.uiDefinition) {
1113
- return;
1114
- }
1115
- forkJoin([this.runtimeService.initialize$(this.uiDefinition, this.config), this.initializeConfiguration$()])
1116
- .pipe(tap(() => {
1115
+ var _a, _b, _c;
1116
+ const customInit$ = (_c = (_b = (_a = this.config) === null || _a === void 0 ? void 0 : _a.init$) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : of(undefined);
1117
+ customInit$
1118
+ .pipe(switchMap(() => this.runtimeService.initialize$(this.uiDefinition, this.config)), tap(() => {
1117
1119
  this.state$.next({ loading: false, failure: false });
1118
1120
  }), catchError(error => {
1119
1121
  var _a, _b;
1120
1122
  console.error(error);
1121
1123
  if (!((_b = (_a = this.uiDefinition) === null || _a === void 0 ? void 0 : _a.properties) === null || _b === void 0 ? void 0 : _b.suppressToastMessages)) {
1122
- this.messageService.add({ severity: 'error', summary: error });
1124
+ this.toastService.add({ severity: ToastType.error, summary: error });
1123
1125
  }
1124
1126
  this.state$.next({ loading: false, failure: true });
1125
1127
  return of();
@@ -1135,14 +1137,12 @@ class PreviewComponent {
1135
1137
  }));
1136
1138
  }
1137
1139
  }
1138
- PreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PreviewComponent, deps: [{ token: RuntimeService }, { token: i2.ConfigurationService }, { token: i3.MessageService }, { token: i2.ConfigurationRuntimeService }, { token: IntegrationState }], target: i0.ɵɵFactoryTarget.Component });
1139
- PreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: PreviewComponent, selector: "vl-cms-preview", inputs: { modelId: "modelId", uiDefinition: "uiDefinition", config: "config" }, providers: [IOProviderService, TemplatesService], ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-element-renderer\n *ngFor=\"let el of elements$ | async; trackBy: trackBy\"\n [meta]=\"el\"\n ></vl-cms-element-renderer>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [":host{flex-grow:1;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "component", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
1140
+ PreviewComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PreviewComponent, deps: [{ token: RuntimeService }, { token: i4.ConfigurationState }, { token: i3.ToastService }, { token: IntegrationState }], target: i0.ɵɵFactoryTarget.Component });
1141
+ PreviewComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: PreviewComponent, selector: "vl-cms-preview", inputs: { uiDefinition: "uiDefinition", config: "config" }, providers: [IOProviderService, TemplatesService], ngImport: i0, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-element-renderer\n *ngFor=\"let el of elements$ | async; trackBy: trackBy\"\n [meta]=\"el\"\n ></vl-cms-element-renderer>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [":host{flex-grow:1;display:flex;flex-direction:column;height:100%}\n"], dependencies: [{ kind: "directive", type: i5.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "component", type: ElementRendererComponent, selector: "vl-cms-element-renderer", inputs: ["meta"] }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.ShadowDom });
1140
1142
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: PreviewComponent, decorators: [{
1141
1143
  type: Component,
1142
1144
  args: [{ selector: 'vl-cms-preview', changeDetection: ChangeDetectionStrategy.OnPush, providers: [IOProviderService, TemplatesService], encapsulation: ViewEncapsulation.ShadowDom, template: "<ng-container *ngIf=\"state$ | async as state\">\n <vl-loader *ngIf=\"state.loading; else content\" [label]=\"'Loading UI'\"></vl-loader>\n\n <ng-template #content>\n <ng-container *ngIf=\"!state.failure\">\n <vl-cms-element-renderer\n *ngFor=\"let el of elements$ | async; trackBy: trackBy\"\n [meta]=\"el\"\n ></vl-cms-element-renderer>\n </ng-container>\n </ng-template>\n</ng-container>\n", styles: [":host{flex-grow:1;display:flex;flex-direction:column;height:100%}\n"] }]
1143
- }], ctorParameters: function () { return [{ type: RuntimeService }, { type: i2.ConfigurationService }, { type: i3.MessageService }, { type: i2.ConfigurationRuntimeService }, { type: IntegrationState }]; }, propDecorators: { modelId: [{
1144
- type: Input
1145
- }], uiDefinition: [{
1145
+ }], ctorParameters: function () { return [{ type: RuntimeService }, { type: i4.ConfigurationState }, { type: i3.ToastService }, { type: IntegrationState }]; }, propDecorators: { uiDefinition: [{
1146
1146
  type: Input
1147
1147
  }], config: [{
1148
1148
  type: Input
@@ -1186,7 +1186,7 @@ class ElementDropHandleComponent {
1186
1186
  }
1187
1187
  }
1188
1188
  ElementDropHandleComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementDropHandleComponent, deps: [{ token: RuntimeEditorService }], target: i0.ɵɵFactoryTarget.Component });
1189
- ElementDropHandleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: ElementDropHandleComponent, selector: "vl-element-drop-handle", inputs: { index: "index", parentPath: "parentPath" }, ngImport: i0, template: "<div class=\"container\" dndDropzone (dndDrop)=\"handleDrop($event)\">\n <div class=\"handle\"></div>\n</div>\n", styles: [":host{width:0;position:relative}.container{width:40px;height:100%;position:absolute;transform:translate(-50%);display:flex;justify-content:center;align-items:center}.handle{display:none;background:red;height:calc(100% - 10px);width:2px;pointer-events:none}.container.dndDragover .handle{display:block}\n"], dependencies: [{ kind: "directive", type: i2$1.DndDropzoneDirective, selector: "[dndDropzone]", inputs: ["dndDropzone", "dndEffectAllowed", "dndAllowExternal", "dndHorizontal", "dndDragoverClass", "dndDropzoneDisabledClass", "dndDisableIf", "dndDisableDropIf"], outputs: ["dndDragover", "dndDrop"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1189
+ ElementDropHandleComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: ElementDropHandleComponent, selector: "vl-element-drop-handle", inputs: { index: "index", parentPath: "parentPath" }, ngImport: i0, template: "<div class=\"container\" dndDropzone (dndDrop)=\"handleDrop($event)\">\n <div class=\"handle\"></div>\n</div>\n", styles: [":host{width:0;position:relative}.container{width:40px;height:100%;position:absolute;transform:translate(-50%);display:flex;justify-content:center;align-items:center}.handle{display:none;background:red;height:calc(100% - 10px);width:2px;pointer-events:none}.container.dndDragover .handle{display:block}\n"], dependencies: [{ kind: "directive", type: i2.DndDropzoneDirective, selector: "[dndDropzone]", inputs: ["dndDropzone", "dndEffectAllowed", "dndAllowExternal", "dndHorizontal", "dndDragoverClass", "dndDropzoneDisabledClass", "dndDisableIf", "dndDisableDropIf"], outputs: ["dndDragover", "dndDrop"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
1190
1190
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: ElementDropHandleComponent, decorators: [{
1191
1191
  type: Component,
1192
1192
  args: [{ selector: 'vl-element-drop-handle', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div class=\"container\" dndDropzone (dndDrop)=\"handleDrop($event)\">\n <div class=\"handle\"></div>\n</div>\n", styles: [":host{width:0;position:relative}.container{width:40px;height:100%;position:absolute;transform:translate(-50%);display:flex;justify-content:center;align-items:center}.handle{display:none;background:red;height:calc(100% - 10px);width:2px;pointer-events:none}.container.dndDragover .handle{display:block}\n"] }]
@@ -1641,6 +1641,7 @@ const VELOCE_LIBS = {
1641
1641
  GuidedSellingApiService,
1642
1642
  },
1643
1643
  '@veloceapps/sdk/core': Object.assign({ ConfigurationService,
1644
+ ConfigurationState,
1644
1645
  QuoteDraftService,
1645
1646
  FlowConfigurationService,
1646
1647
  LineItemWorker,
@@ -1767,6 +1768,34 @@ const CONFIG = {
1767
1768
  },
1768
1769
  };
1769
1770
 
1771
+ function btoaSafe(str) {
1772
+ if (!str) {
1773
+ return '';
1774
+ }
1775
+ try {
1776
+ const encoder = new TextEncoder();
1777
+ const charCodes = encoder.encode(str);
1778
+ return window.btoa(String.fromCharCode(...charCodes)) || '';
1779
+ }
1780
+ catch (e) {
1781
+ return '';
1782
+ }
1783
+ }
1784
+ function atobSafe(str) {
1785
+ if (!str) {
1786
+ return '';
1787
+ }
1788
+ try {
1789
+ const binary = window.atob(str);
1790
+ const bytes = Uint8Array.from({ length: binary.length }, (_, index) => binary.charCodeAt(index));
1791
+ const decoder = new TextDecoder('utf-8');
1792
+ return decoder.decode(bytes);
1793
+ }
1794
+ catch (e) {
1795
+ return '';
1796
+ }
1797
+ }
1798
+
1770
1799
  const EXPORTED_CLASS_REGEX = /export class (\S+)/;
1771
1800
  const METADATA_DECORATOR_REGEX = /@ElementDefinition\(([\s\S]+)\)(\n|\r\n|.)*export class/g;
1772
1801
  class UiBuildError extends Error {
@@ -1778,9 +1807,9 @@ class UiBuildError extends Error {
1778
1807
  }
1779
1808
  const elementToMetadata = (el, parentPath) => {
1780
1809
  var _a;
1781
- const script = el.script && window.atob(el.script);
1782
- const template = el.template && window.atob(el.template);
1783
- const styles = el.styles && window.atob(el.styles);
1810
+ const script = atobSafe(el.script);
1811
+ const template = atobSafe(el.template);
1812
+ const styles = atobSafe(el.styles);
1784
1813
  const exportedClassName = script && ((_a = EXPORTED_CLASS_REGEX.exec(script)) !== null && _a !== void 0 ? _a : [])[1];
1785
1814
  if (!exportedClassName) {
1786
1815
  throw new Error("Script doesn't have exported class");
@@ -1791,6 +1820,7 @@ const elementToMetadata = (el, parentPath) => {
1791
1820
  styles, children: el.children.map(child => elementToMetadata(child, path)) });
1792
1821
  };
1793
1822
  const metadataToElement = (metadata, recursive = true) => {
1823
+ var _a;
1794
1824
  const cleanMetadata = omit(metadata, [
1795
1825
  'path',
1796
1826
  'template',
@@ -1803,10 +1833,9 @@ const metadataToElement = (metadata, recursive = true) => {
1803
1833
  if (!metadata.script || !EXPORTED_CLASS_REGEX.test(metadata.script)) {
1804
1834
  throw new UiBuildError(`'${metadata.name}' component script is missing an exported class`, metadata);
1805
1835
  }
1806
- const script = metadata.script &&
1807
- window.btoa(metadata.script.replace(EXPORTED_CLASS_REGEX, `@ElementDefinition(${stringifyElementMetadata(normalizedElMetadata)})\nexport class Script`));
1808
- const template = metadata.template && window.btoa(metadata.template);
1809
- const styles = metadata.styles && window.btoa(metadata.styles);
1836
+ const script = btoaSafe((_a = metadata.script) === null || _a === void 0 ? void 0 : _a.replace(EXPORTED_CLASS_REGEX, `@ElementDefinition(${stringifyElementMetadata(normalizedElMetadata)})\nexport class Script`));
1837
+ const template = btoaSafe(metadata.template);
1838
+ const styles = btoaSafe(metadata.styles);
1810
1839
  return {
1811
1840
  script,
1812
1841
  template,
@@ -2293,7 +2322,7 @@ class FederatedComponent {
2293
2322
  }
2294
2323
  }
2295
2324
  FederatedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FederatedComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
2296
- FederatedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "host", first: true, predicate: FederatedHostDirective, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<ng-template vlFederatedHost></ng-template>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "directive", type: FederatedHostDirective, selector: "[vlFederatedHost]" }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2325
+ FederatedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "host", first: true, predicate: FederatedHostDirective, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<ng-template vlFederatedHost></ng-template>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i3.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "directive", type: FederatedHostDirective, selector: "[vlFederatedHost]" }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2297
2326
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FederatedComponent, decorators: [{
2298
2327
  type: Component,
2299
2328
  args: [{ selector: 'veloce-host-federated', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-template vlFederatedHost></ng-template>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"] }]
@@ -2482,12 +2511,12 @@ class MigrationsService {
2482
2511
  }
2483
2512
  }
2484
2513
  }
2485
- MigrationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MigrationsService, deps: [{ token: i1.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
2514
+ MigrationsService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MigrationsService, deps: [{ token: i3.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
2486
2515
  MigrationsService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MigrationsService, providedIn: 'root' });
2487
2516
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: MigrationsService, decorators: [{
2488
2517
  type: Injectable,
2489
2518
  args: [{ providedIn: 'root' }]
2490
- }], ctorParameters: function () { return [{ type: i1.ToastService }]; } });
2519
+ }], ctorParameters: function () { return [{ type: i3.ToastService }]; } });
2491
2520
 
2492
2521
  class MigrationsModule {
2493
2522
  }