@veloceapps/sdk 8.0.0-102 → 8.0.0-103

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. package/cms/utils/index.d.ts +1 -0
  2. package/core/services/flow-info.service.d.ts +4 -2
  3. package/core/services/flow-state.service.d.ts +6 -3
  4. package/core/types/flow-customization.types.d.ts +22 -0
  5. package/core/types/index.d.ts +1 -0
  6. package/esm2020/cms/utils/index.mjs +2 -1
  7. package/esm2020/core/services/flow-info.service.mjs +20 -8
  8. package/esm2020/core/services/flow-state.service.mjs +32 -11
  9. package/esm2020/core/types/flow-customization.types.mjs +3 -0
  10. package/esm2020/core/types/index.mjs +2 -1
  11. package/esm2020/src/components/doc-gen/doc-gen.component.mjs +14 -25
  12. package/esm2020/src/components/flow-header/flow-header.component.mjs +16 -26
  13. package/esm2020/src/components/guided-selling/guided-selling.component.mjs +16 -26
  14. package/esm2020/src/pages/assets/assets.component.mjs +20 -29
  15. package/esm2020/src/pages/catalog/catalog.component.mjs +20 -28
  16. package/esm2020/src/pages/product/product.component.mjs +2 -3
  17. package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +21 -29
  18. package/esm2020/src/types/index.mjs +1 -2
  19. package/fesm2015/veloceapps-sdk-cms.mjs +1 -1
  20. package/fesm2015/veloceapps-sdk-core.mjs +60 -20
  21. package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
  22. package/fesm2015/veloceapps-sdk.mjs +92 -171
  23. package/fesm2015/veloceapps-sdk.mjs.map +1 -1
  24. package/fesm2020/veloceapps-sdk-cms.mjs +1 -1
  25. package/fesm2020/veloceapps-sdk-core.mjs +69 -37
  26. package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
  27. package/fesm2020/veloceapps-sdk.mjs +92 -171
  28. package/fesm2020/veloceapps-sdk.mjs.map +1 -1
  29. package/package.json +1 -1
  30. package/src/components/doc-gen/doc-gen.component.d.ts +3 -5
  31. package/src/components/flow-header/flow-header.component.d.ts +3 -5
  32. package/src/components/guided-selling/guided-selling.component.d.ts +3 -5
  33. package/src/pages/assets/assets.component.d.ts +3 -5
  34. package/src/pages/catalog/catalog.component.d.ts +3 -5
  35. package/src/pages/product/product.component.d.ts +1 -2
  36. package/src/pages/shopping-cart/shopping-cart.component.d.ts +3 -5
  37. package/src/types/index.d.ts +0 -1
  38. package/esm2020/src/types/flow-customization.types.mjs +0 -3
  39. package/src/types/flow-customization.types.d.ts +0 -12
@@ -1,22 +1,22 @@
1
1
  import * as i4 from '@angular/common';
2
2
  import { CommonModule } from '@angular/common';
3
3
  import * as i0 from '@angular/core';
4
- import { Component, ChangeDetectionStrategy, NgModule, InjectionToken, Optional, Inject, Injectable, inject } from '@angular/core';
4
+ import { Component, ChangeDetectionStrategy, NgModule, Optional, Inject, Injectable, inject } from '@angular/core';
5
5
  import * as i1$1 from '@veloceapps/api';
6
6
  import { ApiModule } from '@veloceapps/api';
7
7
  import * as i2$1 from '@veloceapps/components';
8
8
  import { ToastType, LoaderModule, EmptyStateModule, LetDirectiveModule } from '@veloceapps/components';
9
9
  import * as i5 from '@veloceapps/sdk/cms';
10
- import { extractElementMetadata, extendElementMetadata, PreviewModule, FlowAction, LauncherModule } from '@veloceapps/sdk/cms';
10
+ import { extractElementMetadata, extendElementMetadata, btoaSafe, PreviewModule, FlowAction, LauncherModule } from '@veloceapps/sdk/cms';
11
11
  import * as i2 from '@veloceapps/sdk/core';
12
- import { ContextService, FlowStateService, FlowInfoService, QuoteDraftService, ConfigurationService, IntegrationState, SdkCoreModule } from '@veloceapps/sdk/core';
12
+ import { FLOW_CUSTOMIZATION, ContextService, FlowStateService, FlowInfoService, QuoteDraftService, ConfigurationService, IntegrationState, SdkCoreModule } from '@veloceapps/sdk/core';
13
13
  import * as i3 from 'primeng/button';
14
14
  import { ButtonModule } from 'primeng/button';
15
15
  import * as i1 from 'primeng/dynamicdialog';
16
- import { BehaviorSubject, Subject, filter, first, tap, takeUntil, catchError, of, map, switchMap, forkJoin, shareReplay, startWith, distinctUntilChanged, from, take, combineLatest, throwError } from 'rxjs';
16
+ import { BehaviorSubject, Subject, filter, first, tap, takeUntil, catchError, of, map, switchMap, shareReplay, startWith, distinctUntilChanged, from, take, combineLatest, forkJoin, throwError } from 'rxjs';
17
17
  import * as i1$2 from '@angular/router';
18
18
  import { NavigationEnd, NavigationStart, NavigationCancel, NavigationError, RouterModule } from '@angular/router';
19
- import { SalesforceIdUtils, ConfigurationContextMode, UITemplateComponentType, UUID } from '@veloceapps/core';
19
+ import { SalesforceIdUtils, ConfigurationContextMode, UUID } from '@veloceapps/core';
20
20
  import { HttpErrorResponse, HttpParams } from '@angular/common/http';
21
21
  import * as i5$1 from '@angular/forms';
22
22
  import { FormGroup, FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
@@ -75,36 +75,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
75
75
  }]
76
76
  }] });
77
77
 
78
- function btoaSafe(str) {
79
- if (!str) {
80
- return '';
81
- }
82
- try {
83
- const encoder = new TextEncoder();
84
- const charCodes = encoder.encode(str);
85
- return window.btoa(String.fromCharCode(...charCodes)) || '';
86
- }
87
- catch (e) {
88
- return '';
89
- }
90
- }
91
- function atobSafe(str) {
92
- if (!str) {
93
- return '';
94
- }
95
- try {
96
- const binary = window.atob(str);
97
- const bytes = Uint8Array.from({ length: binary.length }, (_, index) => binary.charCodeAt(index));
98
- const decoder = new TextDecoder('utf-8');
99
- return decoder.decode(bytes);
100
- }
101
- catch (e) {
102
- return '';
103
- }
104
- }
105
-
106
- const FLOW_CUSTOMIZATION = new InjectionToken('FLOW_CUSTOMIZATION');
107
-
108
78
  class DocGenComponent {
109
79
  constructor(templatesApi, contextService, flowStateService, flowInfo, toastService, customizationService) {
110
80
  this.templatesApi = templatesApi;
@@ -141,14 +111,11 @@ class DocGenComponent {
141
111
  }), takeUntil(this.destroy$))
142
112
  .subscribe();
143
113
  }
144
- getTemplateRootComponent$(template) {
145
- return this.templatesApi.fetchComponents$(template.id);
146
- }
147
- getLocalTemplateComponentMeta$() {
148
- if (!this.customizationService?.getTemplateComponent) {
114
+ getLocalMeta$() {
115
+ if (!this.customizationService?.getTemplateComponents) {
149
116
  return of(undefined);
150
117
  }
151
- return this.customizationService?.getTemplateComponent(this.templateApiName).pipe(map(components => {
118
+ return this.customizationService?.getTemplateComponents(this.templateApiName).pipe(map(components => {
152
119
  if (!components) {
153
120
  return;
154
121
  }
@@ -160,29 +127,23 @@ class DocGenComponent {
160
127
  }));
161
128
  }));
162
129
  }
163
- getDocGenComponentMeta$() {
130
+ getOrgMeta$() {
164
131
  const template = this.flowInfo.templates.DOCGEN;
165
132
  if (!template) {
166
133
  return of(undefined);
167
134
  }
168
- return this.getTemplateRootComponent$(template).pipe(switchMap(components => components
169
- ? forkJoin([
170
- ...components.map(component => {
171
- return this.templatesApi.fetchComponentAttachments$(component.uiTemplateId, component);
172
- }),
173
- ])
174
- : of(undefined)));
135
+ return this.templatesApi.fetchComponentsAttachments$(template.id);
175
136
  }
176
137
  generateUIDefinition$() {
177
138
  return of(undefined).pipe(tap(() => {
178
139
  if (!this.templateApiName) {
179
- throw new Error("Flow Query parameter 'docGenTemplateApiName' is missing.");
140
+ throw new Error("Flow 'docGen' template is not defined.");
180
141
  }
181
- }), switchMap(() => this.getLocalTemplateComponentMeta$()), switchMap(children => (children ? of(children) : this.getDocGenComponentMeta$())), map(children => {
182
- if (!children) {
142
+ }), switchMap(() => this.getLocalMeta$()), switchMap(metaList => (metaList ? of(metaList) : this.getOrgMeta$())), map(metaList => {
143
+ if (!metaList) {
183
144
  return;
184
145
  }
185
- const meta = children?.[0] ?? children;
146
+ const meta = metaList?.[0] ?? metaList;
186
147
  const headerId = this.contextService.resolve().properties.Id ?? null;
187
148
  let script = meta.js;
188
149
  if (script) {
@@ -200,7 +161,7 @@ class DocGenComponent {
200
161
  primary: true,
201
162
  type: 'DEFAULT',
202
163
  version: 2,
203
- children: children.map(child => ({
164
+ children: metaList.map(child => ({
204
165
  children: [],
205
166
  template: child.html && btoaSafe(child.html),
206
167
  script: child.js && btoaSafe(child.js),
@@ -272,14 +233,11 @@ class GuidedSellingComponent {
272
233
  }), takeUntil(this.destroy$))
273
234
  .subscribe();
274
235
  }
275
- getTemplateRootComponent$(template) {
276
- return this.templatesApi.fetchComponents$(template.id);
277
- }
278
- getLocalTemplateComponentMeta$() {
279
- if (!this.customizationService?.getTemplateComponent) {
236
+ getLocalMeta$() {
237
+ if (!this.customizationService?.getTemplateComponents) {
280
238
  return of(undefined);
281
239
  }
282
- return this.customizationService?.getTemplateComponent(this.templateApiName).pipe(map(components => {
240
+ return this.customizationService?.getTemplateComponents(this.templateApiName).pipe(map(components => {
283
241
  if (!components) {
284
242
  return;
285
243
  }
@@ -291,26 +249,20 @@ class GuidedSellingComponent {
291
249
  }));
292
250
  }));
293
251
  }
294
- getGuidedSellingComponentMeta$() {
252
+ getOrgMeta$() {
295
253
  const template = this.flowInfo.templates.GUIDED_SELLING;
296
254
  if (!template) {
297
255
  return of(undefined);
298
256
  }
299
- return this.getTemplateRootComponent$(template).pipe(switchMap(components => components
300
- ? forkJoin([
301
- ...components.map(component => {
302
- return this.templatesApi.fetchComponentAttachments$(component.uiTemplateId, component);
303
- }),
304
- ])
305
- : of(undefined)));
257
+ return this.templatesApi.fetchComponentsAttachments$(template.id);
306
258
  }
307
259
  generateUIDefinition$() {
308
260
  return of(undefined).pipe(tap(() => {
309
261
  if (!this.templateApiName) {
310
- throw new Error("Flow Query parameter 'guidedSellingTemplateApiName' is missing.");
262
+ throw new Error("Flow 'guidedSelling' template is not defined.");
311
263
  }
312
- }), switchMap(() => this.getLocalTemplateComponentMeta$()), switchMap(children => (children ? of(children) : this.getGuidedSellingComponentMeta$())), map(children => {
313
- if (!children) {
264
+ }), switchMap(() => this.getLocalMeta$()), switchMap(metaList => (metaList ? of(metaList) : this.getOrgMeta$())), map(metaList => {
265
+ if (!metaList) {
314
266
  return;
315
267
  }
316
268
  const uiDef = {
@@ -319,11 +271,11 @@ class GuidedSellingComponent {
319
271
  primary: true,
320
272
  type: 'DEFAULT',
321
273
  version: 2,
322
- children: children.map(child => ({
274
+ children: metaList.map(meta => ({
323
275
  children: [],
324
- template: child.html && btoaSafe(child.html),
325
- script: child.js && btoaSafe(child.js),
326
- styles: child.css && btoaSafe(child.css),
276
+ template: meta.html && btoaSafe(meta.html),
277
+ script: meta.js && btoaSafe(meta.js),
278
+ styles: meta.css && btoaSafe(meta.css),
327
279
  })),
328
280
  };
329
281
  return uiDef;
@@ -391,14 +343,11 @@ class FlowHeaderComponent {
391
343
  }), takeUntil(this.destroy$))
392
344
  .subscribe();
393
345
  }
394
- getTemplateRootComponent$(template) {
395
- return this.templatesApi.fetchComponents$(template.id);
396
- }
397
- getLocalTemplateComponentMeta$() {
398
- if (!this.customizationService?.getTemplateComponent) {
346
+ getLocalMeta$() {
347
+ if (!this.customizationService?.getTemplateComponents) {
399
348
  return of(undefined);
400
349
  }
401
- return this.customizationService?.getTemplateComponent(this.templateApiName).pipe(map(components => {
350
+ return this.customizationService?.getTemplateComponents(this.templateApiName).pipe(map(components => {
402
351
  if (!components) {
403
352
  return;
404
353
  }
@@ -410,26 +359,20 @@ class FlowHeaderComponent {
410
359
  }));
411
360
  }));
412
361
  }
413
- getFlowHeaderComponentMeta$() {
362
+ getOrgMeta$() {
414
363
  const template = this.flowInfo.templates.FLOW_HEADER;
415
364
  if (!template) {
416
365
  return of(undefined);
417
366
  }
418
- return this.getTemplateRootComponent$(template).pipe(switchMap(components => components
419
- ? forkJoin([
420
- ...components.map(component => {
421
- return this.templatesApi.fetchComponentAttachments$(component.uiTemplateId, component);
422
- }),
423
- ])
424
- : of(undefined)));
367
+ return this.templatesApi.fetchComponentsAttachments$(template.id);
425
368
  }
426
369
  generateUIDefinition$() {
427
370
  return of(undefined).pipe(tap(() => {
428
371
  if (!this.templateApiName) {
429
- throw new Error("Flow Query parameter 'flowHeaderTemplateApiName' is missing.");
372
+ throw new Error("Flow 'flowHeader' template is not defined.");
430
373
  }
431
- }), switchMap(() => this.getLocalTemplateComponentMeta$()), switchMap(children => (children ? of(children) : this.getFlowHeaderComponentMeta$())), map(children => {
432
- if (!children) {
374
+ }), switchMap(() => this.getLocalMeta$()), switchMap(metaList => (metaList ? of(metaList) : this.getOrgMeta$())), map(metaList => {
375
+ if (!metaList) {
433
376
  return;
434
377
  }
435
378
  const uiDef = {
@@ -438,11 +381,11 @@ class FlowHeaderComponent {
438
381
  primary: true,
439
382
  type: 'DEFAULT',
440
383
  version: 2,
441
- children: children.map(child => ({
384
+ children: metaList.map(meta => ({
442
385
  children: [],
443
- template: child.html && btoaSafe(child.html),
444
- script: child.js && btoaSafe(child.js),
445
- styles: child.css && btoaSafe(child.css),
386
+ template: meta.html && btoaSafe(meta.html),
387
+ script: meta.js && btoaSafe(meta.js),
388
+ styles: meta.css && btoaSafe(meta.css),
446
389
  })),
447
390
  };
448
391
  return uiDef;
@@ -1151,42 +1094,36 @@ class AssetsComponent {
1151
1094
  this.destroyed$.next();
1152
1095
  this.destroyed$.complete();
1153
1096
  }
1154
- getTemplateRootComponent$(template) {
1155
- return this.templatesApi
1156
- .fetchComponents$(template.id)
1157
- .pipe(map(components => components.find(c => c.type === UITemplateComponentType.ROOT) ?? undefined));
1158
- }
1159
- getLocalAssetsComponentMeta$() {
1160
- if (!this.customizationService?.getAssetsComponent) {
1097
+ getLocalMeta$() {
1098
+ if (!this.customizationService?.getTemplateComponents) {
1161
1099
  return of(undefined);
1162
1100
  }
1163
- return this.customizationService?.getAssetsComponent(this.templateApiName).pipe(map(component => {
1164
- if (!component) {
1101
+ return this.customizationService?.getTemplateComponents(this.templateApiName).pipe(map(components => {
1102
+ if (!components) {
1165
1103
  return;
1166
1104
  }
1167
- return {
1105
+ return components.map(component => ({
1168
1106
  html: component.html,
1169
1107
  css: component.css,
1170
1108
  js: component.js,
1171
1109
  json: component.json,
1172
- };
1110
+ }));
1173
1111
  }));
1174
1112
  }
1175
- getAssetsComponentMeta$() {
1176
- // No Assets template at the moment
1113
+ getOrgMeta$() {
1177
1114
  const template = this.flowInfo.templates.SHOPPING_CART;
1178
1115
  if (!template) {
1179
1116
  return of(undefined);
1180
1117
  }
1181
- return this.getTemplateRootComponent$(template).pipe(switchMap(component => component ? this.templatesApi.fetchComponentAttachments$(component.uiTemplateId, component) : of(undefined)));
1118
+ return this.templatesApi.fetchComponentsAttachments$(template.id);
1182
1119
  }
1183
1120
  generateUIDefinition$() {
1184
1121
  return of(undefined).pipe(tap(() => {
1185
1122
  if (!this.templateApiName) {
1186
- throw new Error("Flow Query parameter 'assetsTemplateApiName' is missing.");
1123
+ throw new Error("Flow 'assets' template is not defined.");
1187
1124
  }
1188
- }), switchMap(() => this.getLocalAssetsComponentMeta$()), switchMap(meta => (meta ? of(meta) : this.getAssetsComponentMeta$())), map(meta => {
1189
- if (!meta) {
1125
+ }), switchMap(() => this.getLocalMeta$()), switchMap(metaList => (metaList ? of(metaList) : this.getOrgMeta$())), map(metaList => {
1126
+ if (!metaList) {
1190
1127
  return;
1191
1128
  }
1192
1129
  const uiDef = {
@@ -1195,14 +1132,12 @@ class AssetsComponent {
1195
1132
  primary: true,
1196
1133
  type: 'DEFAULT',
1197
1134
  version: 2,
1198
- children: [
1199
- {
1200
- children: [],
1201
- template: meta.html && btoa(meta.html),
1202
- script: meta.js && btoa(meta.js),
1203
- styles: meta.css && btoa(meta.css),
1204
- },
1205
- ],
1135
+ children: metaList.map(meta => ({
1136
+ children: [],
1137
+ template: meta.html && btoaSafe(meta.html),
1138
+ script: meta.js && btoaSafe(meta.js),
1139
+ styles: meta.css && btoaSafe(meta.css),
1140
+ })),
1206
1141
  };
1207
1142
  return uiDef;
1208
1143
  }));
@@ -1268,41 +1203,36 @@ class CatalogComponent {
1268
1203
  this.destroyed$.next();
1269
1204
  this.destroyed$.complete();
1270
1205
  }
1271
- getTemplateRootComponent$(template) {
1272
- return this.templatesApi
1273
- .fetchComponents$(template.id)
1274
- .pipe(map(components => components.find(c => c.type === UITemplateComponentType.ROOT) ?? undefined));
1275
- }
1276
- getLocalCatalogComponentMeta$() {
1277
- if (!this.customizationService?.getCatalogComponent) {
1206
+ getLocalMeta$() {
1207
+ if (!this.customizationService?.getTemplateComponents) {
1278
1208
  return of(undefined);
1279
1209
  }
1280
- return this.customizationService?.getCatalogComponent(this.templateApiName).pipe(map(component => {
1281
- if (!component) {
1210
+ return this.customizationService?.getTemplateComponents(this.templateApiName).pipe(map(components => {
1211
+ if (!components) {
1282
1212
  return;
1283
1213
  }
1284
- return {
1214
+ return components.map(component => ({
1285
1215
  html: component.html,
1286
1216
  css: component.css,
1287
1217
  js: component.js,
1288
1218
  json: component.json,
1289
- };
1219
+ }));
1290
1220
  }));
1291
1221
  }
1292
- getCatalogComponentMeta$() {
1222
+ getOrgMeta$() {
1293
1223
  const template = this.flowInfo.templates.CATALOG;
1294
1224
  if (!template) {
1295
1225
  return of(undefined);
1296
1226
  }
1297
- return this.getTemplateRootComponent$(template).pipe(switchMap(component => component ? this.templatesApi.fetchComponentAttachments$(component.uiTemplateId, component) : of(undefined)));
1227
+ return this.templatesApi.fetchComponentsAttachments$(template.id);
1298
1228
  }
1299
1229
  generateUIDefinition$() {
1300
1230
  return of(undefined).pipe(tap(() => {
1301
1231
  if (!this.templateApiName) {
1302
- throw new Error("Flow Query parameter 'catalogTemplateApiName' is missing.");
1232
+ throw new Error("Flow 'catalog' template is not defined.");
1303
1233
  }
1304
- }), switchMap(() => this.getLocalCatalogComponentMeta$()), switchMap(meta => (meta ? of(meta) : this.getCatalogComponentMeta$())), map(meta => {
1305
- if (!meta) {
1234
+ }), switchMap(() => this.getLocalMeta$()), switchMap(metaList => (metaList ? of(metaList) : this.getOrgMeta$())), map(metaList => {
1235
+ if (!metaList) {
1306
1236
  return;
1307
1237
  }
1308
1238
  const uiDef = {
@@ -1311,14 +1241,12 @@ class CatalogComponent {
1311
1241
  primary: true,
1312
1242
  type: 'DEFAULT',
1313
1243
  version: 2,
1314
- children: [
1315
- {
1316
- children: [],
1317
- template: meta.html && btoa(meta.html),
1318
- script: meta.js && btoa(meta.js),
1319
- styles: meta.css && btoa(meta.css),
1320
- },
1321
- ],
1244
+ children: metaList.map(meta => ({
1245
+ children: [],
1246
+ template: meta.html && btoaSafe(meta.html),
1247
+ script: meta.js && btoaSafe(meta.js),
1248
+ styles: meta.css && btoaSafe(meta.css),
1249
+ })),
1322
1250
  };
1323
1251
  return uiDef;
1324
1252
  }));
@@ -1936,7 +1864,7 @@ class ShoppingCartComponent {
1936
1864
  this.uiDefinition = uiDef;
1937
1865
  this.state$.next({ loading: false, failure: false });
1938
1866
  }), catchError(err => {
1939
- const message = 'Failed to resolve Shopping cart component. ' + (err.message ?? '');
1867
+ const message = 'Failed to resolve Shopping Cart component. ' + (err.message ?? '');
1940
1868
  this.toastService.add({ severity: ToastType.error, summary: message, sticky: true });
1941
1869
  this.uiDefinition = undefined;
1942
1870
  this.state$.next({ loading: false, failure: true });
@@ -1948,41 +1876,36 @@ class ShoppingCartComponent {
1948
1876
  this.destroyed$.next();
1949
1877
  this.destroyed$.complete();
1950
1878
  }
1951
- getTemplateRootComponent$(template) {
1952
- return this.templatesApi
1953
- .fetchComponents$(template.id)
1954
- .pipe(map(components => components.find(c => c.type === UITemplateComponentType.ROOT) ?? undefined));
1955
- }
1956
- getLocalShoppingCartComponentMeta$() {
1957
- if (!this.customizationService?.getShoppingCartComponent) {
1879
+ getLocalMeta$() {
1880
+ if (!this.customizationService?.getTemplateComponents) {
1958
1881
  return of(undefined);
1959
1882
  }
1960
- return this.customizationService?.getShoppingCartComponent(this.templateApiName).pipe(map(component => {
1961
- if (!component) {
1883
+ return this.customizationService?.getTemplateComponents(this.templateApiName).pipe(map(components => {
1884
+ if (!components) {
1962
1885
  return;
1963
1886
  }
1964
- return {
1887
+ return components.map(component => ({
1965
1888
  html: component.html,
1966
1889
  css: component.css,
1967
1890
  js: component.js,
1968
1891
  json: component.json,
1969
- };
1892
+ }));
1970
1893
  }));
1971
1894
  }
1972
- getShoppingCartComponentMeta$() {
1895
+ getOrgMeta$() {
1973
1896
  const template = this.flowInfo.templates.SHOPPING_CART;
1974
1897
  if (!template) {
1975
1898
  return of(undefined);
1976
1899
  }
1977
- return this.getTemplateRootComponent$(template).pipe(switchMap(component => component ? this.templatesApi.fetchComponentAttachments$(component.uiTemplateId, component) : of(undefined)));
1900
+ return this.templatesApi.fetchComponentsAttachments$(template.id);
1978
1901
  }
1979
1902
  generateUIDefinition$() {
1980
1903
  return of(undefined).pipe(tap(() => {
1981
1904
  if (!this.templateApiName) {
1982
- throw new Error("Flow Query parameter 'cartTemplateApiName' is missing.");
1905
+ throw new Error("Flow 'shoppingCart' template is not defined.");
1983
1906
  }
1984
- }), switchMap(() => this.getLocalShoppingCartComponentMeta$()), switchMap(meta => (meta ? of(meta) : this.getShoppingCartComponentMeta$())), map(meta => {
1985
- if (!meta) {
1907
+ }), switchMap(() => this.getLocalMeta$()), switchMap(metaList => (metaList ? of(metaList) : this.getOrgMeta$())), map(metaList => {
1908
+ if (!metaList) {
1986
1909
  return;
1987
1910
  }
1988
1911
  const uiDef = {
@@ -1991,14 +1914,12 @@ class ShoppingCartComponent {
1991
1914
  primary: true,
1992
1915
  type: 'DEFAULT',
1993
1916
  version: 2,
1994
- children: [
1995
- {
1996
- children: [],
1997
- template: meta.html && btoa(meta.html),
1998
- script: meta.js && btoa(meta.js),
1999
- styles: meta.css && btoa(meta.css),
2000
- },
2001
- ],
1917
+ children: metaList.map(meta => ({
1918
+ children: [],
1919
+ template: meta.html && btoaSafe(meta.html),
1920
+ script: meta.js && btoaSafe(meta.js),
1921
+ styles: meta.css && btoaSafe(meta.css),
1922
+ })),
2002
1923
  };
2003
1924
  return uiDef;
2004
1925
  }));
@@ -2351,5 +2272,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
2351
2272
  * Generated bundle index. Do not edit.
2352
2273
  */
2353
2274
 
2354
- export { ContextGuard, FLOW_CUSTOMIZATION, FlowDialogService, FlowModule, FlowRouterService, FlowService, VELOCE_FLOW_ROOT_ROUTE, getDefaultProperties, getFlowObjectIdPropertyName };
2275
+ export { ContextGuard, FlowDialogService, FlowModule, FlowRouterService, FlowService, VELOCE_FLOW_ROOT_ROUTE, getDefaultProperties, getFlowObjectIdPropertyName };
2355
2276
  //# sourceMappingURL=veloceapps-sdk.mjs.map