@veloceapps/sdk 8.0.0-101 → 8.0.0-103
Sign up to get free protection for your applications and to get access to all the features.
- package/cms/utils/index.d.ts +1 -0
- package/core/services/flow-info.service.d.ts +4 -2
- package/core/services/flow-state.service.d.ts +6 -3
- package/core/types/flow-customization.types.d.ts +22 -0
- package/core/types/index.d.ts +1 -0
- package/esm2020/cms/utils/elements-resolver.mjs +8 -2
- package/esm2020/cms/utils/index.mjs +2 -1
- package/esm2020/core/services/flow-info.service.mjs +20 -8
- package/esm2020/core/services/flow-state.service.mjs +32 -11
- package/esm2020/core/types/flow-customization.types.mjs +3 -0
- package/esm2020/core/types/index.mjs +2 -1
- package/esm2020/src/components/doc-gen/doc-gen.component.mjs +14 -25
- package/esm2020/src/components/flow-header/flow-header.component.mjs +16 -26
- package/esm2020/src/components/guided-selling/guided-selling.component.mjs +16 -26
- package/esm2020/src/pages/assets/assets.component.mjs +20 -29
- package/esm2020/src/pages/catalog/catalog.component.mjs +20 -28
- package/esm2020/src/pages/product/product.component.mjs +2 -3
- package/esm2020/src/pages/shopping-cart/shopping-cart.component.mjs +21 -29
- package/esm2020/src/types/index.mjs +1 -2
- package/fesm2015/veloceapps-sdk-cms.mjs +8 -2
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +60 -20
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +92 -171
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +8 -2
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +69 -37
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +92 -171
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +5 -3
- package/src/components/doc-gen/doc-gen.component.d.ts +3 -5
- package/src/components/flow-header/flow-header.component.d.ts +3 -5
- package/src/components/guided-selling/guided-selling.component.d.ts +3 -5
- package/src/pages/assets/assets.component.d.ts +3 -5
- package/src/pages/catalog/catalog.component.d.ts +3 -5
- package/src/pages/product/product.component.d.ts +1 -2
- package/src/pages/shopping-cart/shopping-cart.component.d.ts +3 -5
- package/src/types/index.d.ts +0 -1
- package/esm2020/src/types/flow-customization.types.mjs +0 -3
- package/src/types/flow-customization.types.d.ts +0 -12
@@ -1,7 +1,7 @@
|
|
1
1
|
import * as i0 from '@angular/core';
|
2
|
-
import { InjectionToken, Injectable, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
|
3
|
-
import { UUID, ConfigurationContextMode, ConfigurationContext, UITemplateType, EntityUtil, isDefined, ChargeGroupUtils, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMALS_COUNT, getSupportedDateFormats, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, DEFAULT_ACTION_CODE_LABELS, parseJsonSafely, ConfigurationMode, ConfigurationTranslatorUtils, RuntimeModel, isNotLegacyUIDefinition, SalesforceIdUtils, DEFAULT_TIME_FORMAT, formatNumber } from '@veloceapps/core';
|
4
|
-
import { BehaviorSubject, tap as tap$1, switchMap, map as map$1, noop, catchError, throwError, of, Subject, filter as filter$1, zip, combineLatest,
|
2
|
+
import { InjectionToken, Injectable, Optional, Inject, NgModule, inject, Directive, Input, LOCALE_ID, Pipe } from '@angular/core';
|
3
|
+
import { UUID, ConfigurationContextMode, ConfigurationContext, UITemplateType, ConfigurationProcessorTypes, EntityUtil, isDefined, ChargeGroupUtils, DEFAULT_CURRENCY_ISO_CODE, DEFAULT_CURRENCY_SYMBOL, validateDateFormat, DEFAULT_DATE_FORMAT, DEFAULT_DECIMALS_COUNT, getSupportedDateFormats, DEFAULT_DECIMAL_SEPARATOR, DEFAULT_THOUSANDS_SEPARATOR, DEFAULT_ACTION_CODE_LABELS, parseJsonSafely, ConfigurationMode, ConfigurationTranslatorUtils, RuntimeModel, isNotLegacyUIDefinition, SalesforceIdUtils, DEFAULT_TIME_FORMAT, formatNumber } from '@veloceapps/core';
|
4
|
+
import { BehaviorSubject, tap as tap$1, switchMap, map as map$1, noop, catchError, throwError, of, forkJoin, Subject, filter as filter$1, zip, combineLatest, shareReplay as shareReplay$1, take as take$1, distinctUntilChanged } from 'rxjs';
|
5
5
|
import { map, filter, tap, switchMap as switchMap$1, skip, take, shareReplay, catchError as catchError$1, finalize, first } from 'rxjs/operators';
|
6
6
|
import * as i1 from '@veloceapps/api';
|
7
7
|
import { PriceApiService, ContextApiService, ProductModelApiService, ConfigurationApiService } from '@veloceapps/api';
|
@@ -49,6 +49,8 @@ const getGuidedSellingConfigurationRequest = (data, context) => {
|
|
49
49
|
};
|
50
50
|
};
|
51
51
|
|
52
|
+
const FLOW_CUSTOMIZATION = new InjectionToken('FLOW_CUSTOMIZATION');
|
53
|
+
|
52
54
|
const FORMATTING_SETTINGS_TOKEN = new InjectionToken('Summary of formatting settings for variant types of data, e.g. numbers, text, dates, etc');
|
53
55
|
|
54
56
|
var RuntimeMode;
|
@@ -132,9 +134,10 @@ class FlowInfoService {
|
|
132
134
|
set flow(value) {
|
133
135
|
this.flowSubj$.next(value);
|
134
136
|
}
|
135
|
-
constructor(flowsApiService, templatesApiService) {
|
137
|
+
constructor(flowsApiService, templatesApiService, customizationService) {
|
136
138
|
this.flowsApiService = flowsApiService;
|
137
139
|
this.templatesApiService = templatesApiService;
|
140
|
+
this.customizationService = customizationService;
|
138
141
|
this.templates = {};
|
139
142
|
this.flowSubj$ = new BehaviorSubject(null);
|
140
143
|
this.flow$ = this.flowSubj$.asObservable();
|
@@ -152,14 +155,20 @@ class FlowInfoService {
|
|
152
155
|
this.templates = {};
|
153
156
|
}
|
154
157
|
initFlowTemplates$(flow) {
|
158
|
+
var _a, _b, _c;
|
155
159
|
if (isEmpty(flow.properties.templates)) {
|
156
160
|
return of(undefined);
|
157
161
|
}
|
158
|
-
return
|
162
|
+
return forkJoin([
|
163
|
+
this.templatesApiService.fetchTemplates$(),
|
164
|
+
(_c = (_b = (_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplates) === null || _b === void 0 ? void 0 : _b.call(_a)) !== null && _c !== void 0 ? _c : of([]),
|
165
|
+
]).pipe(map$1(([templates, localTemplates]) => {
|
159
166
|
Object.entries(flow.properties.templates).forEach(([key, name]) => {
|
167
|
+
var _a;
|
160
168
|
const type = this.remapTemplateName(key);
|
161
169
|
if (type) {
|
162
|
-
this.templates[type] =
|
170
|
+
this.templates[type] =
|
171
|
+
(_a = localTemplates.find(template => template.name === name && template.type === type)) !== null && _a !== void 0 ? _a : templates.find(template => template.name === name && template.type === type);
|
163
172
|
}
|
164
173
|
});
|
165
174
|
}));
|
@@ -183,12 +192,19 @@ class FlowInfoService {
|
|
183
192
|
}
|
184
193
|
}
|
185
194
|
}
|
186
|
-
FlowInfoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, deps: [{ token: i1.FlowsApiService }, { token: i1.UITemplatesApiService }], target: i0.ɵɵFactoryTarget.Injectable });
|
195
|
+
FlowInfoService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, deps: [{ token: i1.FlowsApiService }, { token: i1.UITemplatesApiService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
187
196
|
FlowInfoService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, providedIn: 'root' });
|
188
197
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowInfoService, decorators: [{
|
189
198
|
type: Injectable,
|
190
199
|
args: [{ providedIn: 'root' }]
|
191
|
-
}], ctorParameters: function () {
|
200
|
+
}], ctorParameters: function () {
|
201
|
+
return [{ type: i1.FlowsApiService }, { type: i1.UITemplatesApiService }, { type: undefined, decorators: [{
|
202
|
+
type: Optional
|
203
|
+
}, {
|
204
|
+
type: Inject,
|
205
|
+
args: [FLOW_CUSTOMIZATION]
|
206
|
+
}] }];
|
207
|
+
} });
|
192
208
|
|
193
209
|
const findLineItem = (id, lineItems) => {
|
194
210
|
return findLineItemWithComparator(lineItems, (li) => li.id === id);
|
@@ -673,7 +689,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
673
689
|
}], ctorParameters: function () { return [{ type: ContextService }, { type: i1.QuoteApiService }, { type: i1.PriceApiService }, { type: IntegrationState }]; } });
|
674
690
|
|
675
691
|
class FlowStateService {
|
676
|
-
constructor(contextService, quoteDraftService, flowInfoService, flowConfiguration, processorsApiService, flowStateApiService, quoteApiService, toastService) {
|
692
|
+
constructor(contextService, quoteDraftService, flowInfoService, flowConfiguration, processorsApiService, flowStateApiService, quoteApiService, toastService, customizationService) {
|
677
693
|
this.contextService = contextService;
|
678
694
|
this.quoteDraftService = quoteDraftService;
|
679
695
|
this.flowInfoService = flowInfoService;
|
@@ -682,6 +698,7 @@ class FlowStateService {
|
|
682
698
|
this.flowStateApiService = flowStateApiService;
|
683
699
|
this.quoteApiService = quoteApiService;
|
684
700
|
this.toastService = toastService;
|
701
|
+
this.customizationService = customizationService;
|
685
702
|
this.NOT_INITIALIZED = Symbol();
|
686
703
|
this.stateId$ = new BehaviorSubject(null);
|
687
704
|
this.processors = {};
|
@@ -840,13 +857,15 @@ class FlowStateService {
|
|
840
857
|
}));
|
841
858
|
}
|
842
859
|
initStateful$() {
|
843
|
-
|
844
|
-
|
845
|
-
.init({
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
860
|
+
return this.getLocalProcessors$().pipe(switchMap(processors => {
|
861
|
+
var _a;
|
862
|
+
return this.flowStateApiService.init({
|
863
|
+
quoteId: this.contextService.resolve().headerId,
|
864
|
+
params: (_a = this.flowInfoService.params) !== null && _a !== void 0 ? _a : {},
|
865
|
+
actionsOverride: processors === null || processors === void 0 ? void 0 : processors.filter(processor => processor.type === ConfigurationProcessorTypes.ACTION),
|
866
|
+
selectorsOverride: processors === null || processors === void 0 ? void 0 : processors.filter(processor => processor.type === ConfigurationProcessorTypes.SELECTOR),
|
867
|
+
});
|
868
|
+
}), map$1(({ stateId }) => {
|
850
869
|
this.stateId$.next(stateId);
|
851
870
|
}));
|
852
871
|
}
|
@@ -930,10 +949,12 @@ class FlowStateService {
|
|
930
949
|
initProcessors$() {
|
931
950
|
const owners$ = Object.values(this.flowInfoService.templates)
|
932
951
|
.map(template => {
|
952
|
+
var _a, _b, _c;
|
933
953
|
if (!template) {
|
934
954
|
return;
|
935
955
|
}
|
936
|
-
|
956
|
+
const localProcessors$ = (_c = (_b = (_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplateConfigurationProcessors) === null || _b === void 0 ? void 0 : _b.call(_a, template.name)) !== null && _c !== void 0 ? _c : of(null);
|
957
|
+
return localProcessors$.pipe(switchMap(processors => processors ? of(processors) : this.processorsApiService.fetchConfigurationProcessors$(template.id)), tap$1(processors => {
|
937
958
|
const processorsMap = processors.reduce((acc, p) => {
|
938
959
|
acc[p.apiName] = p;
|
939
960
|
return acc;
|
@@ -944,6 +965,18 @@ class FlowStateService {
|
|
944
965
|
.filter(isDefined);
|
945
966
|
return forkJoin(owners$).pipe(map$1(noop));
|
946
967
|
}
|
968
|
+
getLocalProcessors$() {
|
969
|
+
const processorsPerTemplate$ = Object.values(this.flowInfoService.templates).map(template => { var _a, _b, _c; return (_c = (_b = (_a = this.customizationService) === null || _a === void 0 ? void 0 : _a.getTemplateConfigurationProcessors) === null || _b === void 0 ? void 0 : _b.call(_a, template.name)) !== null && _c !== void 0 ? _c : of(null); });
|
970
|
+
return forkJoin(processorsPerTemplate$).pipe(map$1(processors => {
|
971
|
+
const definedProcessors = processors.filter(isDefined);
|
972
|
+
if (definedProcessors.length) {
|
973
|
+
return flatten(definedProcessors);
|
974
|
+
}
|
975
|
+
else {
|
976
|
+
return null;
|
977
|
+
}
|
978
|
+
}));
|
979
|
+
}
|
947
980
|
executeActionScript(request, executable) {
|
948
981
|
var _a, _b;
|
949
982
|
const script = (_b = (_a = this.processors[executable.ownerId]) === null || _a === void 0 ? void 0 : _a[executable.apiName]) === null || _b === void 0 ? void 0 : _b.script;
|
@@ -971,12 +1004,19 @@ class FlowStateService {
|
|
971
1004
|
});
|
972
1005
|
}
|
973
1006
|
}
|
974
|
-
FlowStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, deps: [{ token: ContextService }, { token: QuoteDraftService }, { token: FlowInfoService }, { token: FlowConfigurationService }, { token: i1.ConfigurationProcessorsApiService }, { token: i1.FlowStateApiService }, { token: i1.QuoteApiService }, { token: i6.ToastService }], target: i0.ɵɵFactoryTarget.Injectable });
|
1007
|
+
FlowStateService.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, deps: [{ token: ContextService }, { token: QuoteDraftService }, { token: FlowInfoService }, { token: FlowConfigurationService }, { token: i1.ConfigurationProcessorsApiService }, { token: i1.FlowStateApiService }, { token: i1.QuoteApiService }, { token: i6.ToastService }, { token: FLOW_CUSTOMIZATION, optional: true }], target: i0.ɵɵFactoryTarget.Injectable });
|
975
1008
|
FlowStateService.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, providedIn: 'root' });
|
976
1009
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: FlowStateService, decorators: [{
|
977
1010
|
type: Injectable,
|
978
1011
|
args: [{ providedIn: 'root' }]
|
979
|
-
}], ctorParameters: function () {
|
1012
|
+
}], ctorParameters: function () {
|
1013
|
+
return [{ type: ContextService }, { type: QuoteDraftService }, { type: FlowInfoService }, { type: FlowConfigurationService }, { type: i1.ConfigurationProcessorsApiService }, { type: i1.FlowStateApiService }, { type: i1.QuoteApiService }, { type: i6.ToastService }, { type: undefined, decorators: [{
|
1014
|
+
type: Optional
|
1015
|
+
}, {
|
1016
|
+
type: Inject,
|
1017
|
+
args: [FLOW_CUSTOMIZATION]
|
1018
|
+
}] }];
|
1019
|
+
} });
|
980
1020
|
|
981
1021
|
function calculateMetricByMethod(lineItems, metric, method) {
|
982
1022
|
const items = getLineItemsByMethod(lineItems, method);
|
@@ -2224,5 +2264,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2224
2264
|
* Generated bundle index. Do not edit.
|
2225
2265
|
*/
|
2226
2266
|
|
2227
|
-
export { ActionCodePipe, CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationState, ContextService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FORMATTING_SETTINGS_TOKEN, FlowConfigurationModule, FlowConfigurationService, FlowInfoService, FlowStateService, FlowUpdateService, IntegrationState, LineItemWorker, MetricsCalculationService, NumberPipe, PricePipe, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeSettingsService, RuntimeStep, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, filterOutTechnicalAttributes, findLineItem, findLineItemWithComparator, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getGuidedSellingConfigurationRequest, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, isTechnicalAttribute, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
2267
|
+
export { ActionCodePipe, CalendarDirective, ConfigurationRuntimeService, ConfigurationService, ConfigurationState, ContextService, DEFAULT_FORMATTING_SETTINGS, DatePipe, FLOW_CUSTOMIZATION, FORMATTING_SETTINGS_TOKEN, FlowConfigurationModule, FlowConfigurationService, FlowInfoService, FlowStateService, FlowUpdateService, IntegrationState, LineItemWorker, MetricsCalculationService, NumberPipe, PricePipe, ProductImagesService, QuoteDraftService, RuntimeMode, RuntimeOperation, RuntimeSettingsService, RuntimeStep, SdkCoreModule, SdkDirectivesModule, SdkPipesModule, UI_DEFINITION_VERSION, calculateCardinalityVariables, extractMetadata, filterOutTechnicalAttributes, findLineItem, findLineItemWithComparator, generateLineItem, generateModifiedAssetsMap, getAttributeValue, getAttributes, getDefaultLineItem, getGuidedSellingConfigurationRequest, getOriginParent, getRecommendedPrices, insertLineItem, isLineItemModified, isTechnicalAttribute, lineItem_utils as lineItemUtils, mapAttributes, multiplyLineItems, patchAttributes, recalculateCardinalityVariables, removeLineItem, replaceLineItem, upsertAttributes };
|
2228
2268
|
//# sourceMappingURL=veloceapps-sdk-core.mjs.map
|