@veloceapps/sdk 11.0.0-16 → 11.0.0-17
Sign up to get free protection for your applications and to get access to all the features.
- package/cms/cms.actions.d.ts +98 -22
- package/cms/components/element-renderer/element-renderer.component.d.ts +3 -10
- package/cms/services/element-context.service.d.ts +0 -1
- package/cms/types/common.types.d.ts +2 -0
- package/cms/types/index.d.ts +0 -1
- package/cms/utils/path.utils.d.ts +1 -2
- package/cms/vendor-map.d.ts +4 -27
- package/core/index.d.ts +0 -1
- package/core/modules/configuration/index.d.ts +1 -4
- package/core/modules/configuration/services/configuration-runtime.service.d.ts +3 -20
- package/core/modules/configuration/services/configuration-state.service.d.ts +3 -3
- package/core/modules/configuration/services/configuration.service.d.ts +23 -46
- package/core/modules/flow-configuration/index.d.ts +0 -3
- package/core/modules/flow-configuration/services/flow-configuration.service.d.ts +5 -13
- package/core/services/flow-info.service.d.ts +3 -2
- package/core/services/flow-state-configuration.service.d.ts +2 -8
- package/core/services/flow-state.service.d.ts +6 -12
- package/core/services/index.d.ts +0 -1
- package/core/services/integration.state.d.ts +1 -1
- package/core/services/sales-transaction.service.d.ts +4 -2
- package/core/types/index.d.ts +0 -1
- package/core/utils/index.d.ts +2 -2
- package/core/utils/transaction-item.utils.d.ts +7 -0
- package/core/utils/transaction-item.worker.d.ts +8 -0
- package/esm2020/cms/cms.actions.mjs +99 -65
- package/esm2020/cms/cms.default.mjs +2 -3
- package/esm2020/cms/components/element-renderer/element-renderer.component.mjs +7 -64
- package/esm2020/cms/components/preview/preview.component.mjs +3 -3
- package/esm2020/cms/services/element-context.service.mjs +1 -1
- package/esm2020/cms/types/common.types.mjs +1 -1
- package/esm2020/cms/types/index.mjs +1 -2
- package/esm2020/cms/utils/element.utils.mjs +3 -3
- package/esm2020/cms/utils/path.utils.mjs +1 -10
- package/esm2020/cms/vendor-map.mjs +4 -5
- package/esm2020/core/core.module.mjs +4 -5
- package/esm2020/core/index.mjs +1 -2
- package/esm2020/core/modules/configuration/configuration.module.mjs +3 -4
- package/esm2020/core/modules/configuration/index.mjs +2 -5
- package/esm2020/core/modules/configuration/services/configuration-runtime.service.mjs +9 -67
- package/esm2020/core/modules/configuration/services/configuration-state.service.mjs +46 -54
- package/esm2020/core/modules/configuration/services/configuration.service.mjs +96 -226
- package/esm2020/core/modules/flow-configuration/flow-configuration.module.mjs +3 -4
- package/esm2020/core/modules/flow-configuration/index.mjs +1 -4
- package/esm2020/core/modules/flow-configuration/services/flow-configuration.service.mjs +15 -32
- package/esm2020/core/services/flow-info.service.mjs +9 -3
- package/esm2020/core/services/flow-state-configuration.service.mjs +10 -25
- package/esm2020/core/services/flow-state.service.mjs +25 -58
- package/esm2020/core/services/index.mjs +1 -2
- package/esm2020/core/services/integration.state.mjs +2 -2
- package/esm2020/core/services/sales-transaction.service.mjs +11 -5
- package/esm2020/core/types/index.mjs +1 -2
- package/esm2020/core/utils/index.mjs +3 -3
- package/esm2020/core/utils/transaction-item.utils.mjs +60 -0
- package/esm2020/core/utils/transaction-item.worker.mjs +16 -0
- package/esm2020/src/flow-routing.module.mjs +8 -8
- package/esm2020/src/guards/flow.guard.mjs +5 -7
- package/esm2020/src/guards/product-unload.guard.mjs +7 -7
- package/esm2020/src/index.mjs +1 -2
- package/esm2020/src/pages/debug/debug.component.mjs +10 -15
- package/esm2020/src/pages/product/product.component.mjs +11 -14
- package/esm2020/src/pages/record-not-found/record-not-found.component.mjs +5 -6
- package/esm2020/src/resolvers/sales-transaction.resolver.mjs +83 -0
- package/esm2020/src/resolvers/ui-definition.resolver.mjs +5 -4
- package/esm2020/src/services/flow-dialog.service.mjs +1 -1
- package/esm2020/src/services/flow-router.service.mjs +17 -24
- package/esm2020/src/services/flow.service.mjs +5 -13
- package/esm2020/src/types/index.mjs +2 -3
- package/esm2020/src/types/route.types.mjs +1 -1
- package/fesm2015/veloceapps-sdk-cms.mjs +116 -252
- package/fesm2015/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk-core.mjs +318 -1116
- package/fesm2015/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2015/veloceapps-sdk.mjs +87 -120
- package/fesm2015/veloceapps-sdk.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-cms.mjs +112 -244
- package/fesm2020/veloceapps-sdk-cms.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk-core.mjs +366 -1162
- package/fesm2020/veloceapps-sdk-core.mjs.map +1 -1
- package/fesm2020/veloceapps-sdk.mjs +87 -120
- package/fesm2020/veloceapps-sdk.mjs.map +1 -1
- package/package.json +1 -1
- package/src/guards/product-unload.guard.d.ts +3 -3
- package/src/index.d.ts +0 -1
- package/src/pages/debug/debug.component.d.ts +1 -3
- package/src/pages/product/product.component.d.ts +3 -4
- package/src/pages/record-not-found/record-not-found.component.d.ts +2 -3
- package/src/resolvers/sales-transaction.resolver.d.ts +18 -0
- package/src/services/flow-dialog.service.d.ts +2 -1
- package/src/services/flow-router.service.d.ts +5 -5
- package/src/services/flow.service.d.ts +0 -1
- package/src/types/index.d.ts +1 -2
- package/src/types/route.types.d.ts +0 -5
- package/cms/plugins/configuration.plugin.d.ts +0 -23
- package/cms/types/configuration.types.d.ts +0 -21
- package/core/modules/configuration/helpers.d.ts +0 -7
- package/core/modules/configuration/services/runtime-context.service.d.ts +0 -12
- package/core/modules/configuration/types/configuration-runtime.types.d.ts +0 -8
- package/core/modules/flow-configuration/services/flow-update.service.d.ts +0 -13
- package/core/modules/flow-configuration/types/update.types.d.ts +0 -12
- package/core/services/quote-draft.service.d.ts +0 -50
- package/core/types/runtime.types.d.ts +0 -30
- package/core/utils/line-item.utils.d.ts +0 -25
- package/core/utils/line-item.worker.d.ts +0 -9
- package/esm2020/cms/plugins/configuration.plugin.mjs +0 -109
- package/esm2020/cms/types/configuration.types.mjs +0 -2
- package/esm2020/core/modules/configuration/helpers.mjs +0 -67
- package/esm2020/core/modules/configuration/services/runtime-context.service.mjs +0 -45
- package/esm2020/core/modules/configuration/types/configuration-runtime.types.mjs +0 -2
- package/esm2020/core/modules/flow-configuration/services/flow-update.service.mjs +0 -138
- package/esm2020/core/modules/flow-configuration/types/update.types.mjs +0 -2
- package/esm2020/core/services/quote-draft.service.mjs +0 -174
- package/esm2020/core/types/runtime.types.mjs +0 -16
- package/esm2020/core/utils/line-item.utils.mjs +0 -187
- package/esm2020/core/utils/line-item.worker.mjs +0 -19
- package/esm2020/src/resolvers/quote.resolver.mjs +0 -82
- package/esm2020/src/types/context-route.types.mjs +0 -2
- package/esm2020/src/types/metrics.types.mjs +0 -2
- package/esm2020/src/utils/flow.utils.mjs +0 -14
- package/esm2020/src/utils/index.mjs +0 -2
- package/src/resolvers/quote.resolver.d.ts +0 -18
- package/src/types/context-route.types.d.ts +0 -5
- package/src/types/metrics.types.d.ts +0 -5
- package/src/utils/flow.utils.d.ts +0 -1
- package/src/utils/index.d.ts +0 -1
@@ -1,15 +1,15 @@
|
|
1
1
|
import * as i2 from '@veloceapps/sdk/core';
|
2
|
-
import { IntegrationState, ConfigurationService, ConfigurationStateService,
|
2
|
+
import { IntegrationState, ConfigurationService, ConfigurationStateService, FlowConfigurationService, FlowStateService, FlowStateConfigurationService, TransactionItemWorker, ProductImagesService, RuntimeSettingsService, ActionCodePipe, DatePipe, NumberPipe, PricePipe, SalesTransactionService, SdkPipesModule, SdkCoreModule, UI_DEFINITION_VERSION } from '@veloceapps/sdk/core';
|
3
3
|
export { IntegrationState } from '@veloceapps/sdk/core';
|
4
4
|
import { __decorate, __param, __metadata, __awaiter, __rest } from 'tslib';
|
5
5
|
import * as i0 from '@angular/core';
|
6
|
-
import { InjectionToken, Component, ChangeDetectionStrategy, Inject, Injector, Injectable, ViewContainerRef,
|
6
|
+
import { InjectionToken, Component, ChangeDetectionStrategy, Inject, Injector, Injectable, ViewContainerRef, ViewChild, Input, ViewEncapsulation, NgModule, inject, ElementRef, Directive, ApplicationRef, createComponent, EventEmitter, createNgModule } from '@angular/core';
|
7
7
|
import * as rxjs from 'rxjs';
|
8
8
|
import { BehaviorSubject, Subject, map, distinctUntilChanged, of, tap, switchMap, startWith, takeUntil, combineLatest, catchError, ReplaySubject, noop, filter, take, Observable, from } from 'rxjs';
|
9
9
|
import * as i3 from '@veloceapps/components';
|
10
10
|
import { ToastType, LetDirectiveModule, LoaderModule, ToastService, HiddenTextTooltipModule, ErrorTooltipModule } from '@veloceapps/components';
|
11
|
-
import lodash, { compact, cloneDeep, isArray, pull, merge, omit, flatten, kebabCase, set } from 'lodash';
|
12
11
|
import { getCollectionUniqueName, UUID, isDefined, Operator, Predicate, parseJsonSafely, parseJwt, TokenInfoService, CoreModule } from '@veloceapps/core';
|
12
|
+
import lodash, { cloneDeep, isArray, pull, merge, omit, flatten, kebabCase, set } from 'lodash';
|
13
13
|
import { applyPatch } from 'rfc6902';
|
14
14
|
import * as i4 from '@angular/common';
|
15
15
|
import { CommonModule, DOCUMENT } from '@angular/common';
|
@@ -45,52 +45,74 @@ var FlowAction;
|
|
45
45
|
FlowAction.SUBMIT_GUIDED_SELLING = '[FLOW]_SUBMIT_GUIDED_SELLING';
|
46
46
|
FlowAction.CLOSE_GUIDED_SELLING = '[FLOW]_CLOSE_GUIDED_SELLING';
|
47
47
|
FlowAction.OPEN_DIALOG = '[FLOW]_OPEN_DIALOG';
|
48
|
-
FlowAction.ConfigureProductAction = ({
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
48
|
+
FlowAction.ConfigureProductAction = ({ transactionItemId, productId, }) => {
|
49
|
+
return {
|
50
|
+
type: FlowAction.FLOW_CONFIGURE_PRODUCT,
|
51
|
+
payload: { transactionItemId, productId },
|
52
|
+
};
|
53
|
+
};
|
54
|
+
FlowAction.NavigateBackAction = () => {
|
55
|
+
return {
|
56
|
+
type: FlowAction.FLOW_NAVIGATE_BACK,
|
57
|
+
};
|
58
|
+
};
|
59
|
+
FlowAction.NavigateToAction = (path, productId, transactionItemId) => ({
|
56
60
|
type: FlowAction.FLOW_NAVIGATE_TO,
|
57
|
-
payload: { path, productId,
|
61
|
+
payload: { path, productId, transactionItemId },
|
58
62
|
});
|
59
63
|
FlowAction.NavigateToCatalogAction = () => ({
|
60
64
|
type: FlowAction.FLOW_NAVIGATE_TO_CATALOG,
|
61
65
|
});
|
62
|
-
FlowAction.NavigateToShoppingCartAction = () =>
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
}
|
82
|
-
FlowAction.
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
}
|
66
|
+
FlowAction.NavigateToShoppingCartAction = () => {
|
67
|
+
return {
|
68
|
+
type: FlowAction.FLOW_NAVIGATE_TO_SHOPPING_CART,
|
69
|
+
};
|
70
|
+
};
|
71
|
+
FlowAction.ApplyProductConfigurationAction = () => {
|
72
|
+
return {
|
73
|
+
type: FlowAction.FLOW_APPLY_PRODUCT_CONFIGURATION,
|
74
|
+
};
|
75
|
+
};
|
76
|
+
FlowAction.RemoteApplyAction = () => {
|
77
|
+
return {
|
78
|
+
type: FlowAction.REMOTE_APPLY,
|
79
|
+
};
|
80
|
+
};
|
81
|
+
FlowAction.RemoteCancelAction = () => {
|
82
|
+
return {
|
83
|
+
type: FlowAction.REMOTE_CANCEL,
|
84
|
+
};
|
85
|
+
};
|
86
|
+
FlowAction.SwitchObjectAction = (payload) => {
|
87
|
+
return {
|
88
|
+
type: FlowAction.FLOW_SWITCH_OBJECT,
|
89
|
+
payload,
|
90
|
+
};
|
91
|
+
};
|
92
|
+
FlowAction.OpenGuidedSelling = (payload) => {
|
93
|
+
return {
|
94
|
+
type: FlowAction.OPEN_GUIDED_SELLING,
|
95
|
+
payload,
|
96
|
+
};
|
97
|
+
};
|
98
|
+
FlowAction.CloseGuidedSelling = (payload) => {
|
99
|
+
return {
|
100
|
+
type: FlowAction.CLOSE_GUIDED_SELLING,
|
101
|
+
payload,
|
102
|
+
};
|
103
|
+
};
|
104
|
+
FlowAction.SubmitGuidedSelling = (payload) => {
|
105
|
+
return {
|
106
|
+
type: FlowAction.SUBMIT_GUIDED_SELLING,
|
107
|
+
payload,
|
108
|
+
};
|
109
|
+
};
|
110
|
+
FlowAction.OpenDialog = (dialog) => {
|
111
|
+
return {
|
112
|
+
type: FlowAction.OPEN_DIALOG,
|
113
|
+
payload: { dialog },
|
114
|
+
};
|
115
|
+
};
|
94
116
|
})(FlowAction || (FlowAction = {}));
|
95
117
|
var CmsAction;
|
96
118
|
(function (CmsAction) {
|
@@ -105,56 +127,68 @@ var CmsAction;
|
|
105
127
|
*
|
106
128
|
* @param pageName name of the page
|
107
129
|
*/
|
108
|
-
CmsAction.GoToPage = (pageName) =>
|
109
|
-
|
110
|
-
|
111
|
-
|
130
|
+
CmsAction.GoToPage = (pageName) => {
|
131
|
+
return {
|
132
|
+
type: CmsAction.GO_TO_PAGE,
|
133
|
+
payload: { pageName },
|
134
|
+
};
|
135
|
+
};
|
112
136
|
/**
|
113
137
|
* Update UI definition customization state
|
114
138
|
*
|
115
139
|
* @param pageName name of the page
|
116
140
|
*/
|
117
|
-
CmsAction.UpdateCustomization = (value) =>
|
118
|
-
|
119
|
-
|
120
|
-
|
141
|
+
CmsAction.UpdateCustomization = (value) => {
|
142
|
+
return {
|
143
|
+
type: CmsAction.UPDATE_CUSTOMIZATION,
|
144
|
+
payload: { value },
|
145
|
+
};
|
146
|
+
};
|
121
147
|
/**
|
122
148
|
* Emit customization page changes
|
123
149
|
*
|
124
150
|
* @param changes - object with customization page changes
|
125
151
|
*/
|
126
|
-
CmsAction.EmitCustomizationChanges = (changes) =>
|
127
|
-
|
128
|
-
|
129
|
-
|
152
|
+
CmsAction.EmitCustomizationChanges = (changes) => {
|
153
|
+
return {
|
154
|
+
type: CmsAction.EMIT_CUSTOMIZATION_CHANGES,
|
155
|
+
payload: { changes },
|
156
|
+
};
|
157
|
+
};
|
130
158
|
/**
|
131
159
|
* Show an Overlay on the selected page
|
132
160
|
*
|
133
161
|
* @param name - name of the overlay
|
134
162
|
* @returns void
|
135
163
|
*/
|
136
|
-
CmsAction.ShowOverlay = (name) =>
|
137
|
-
|
138
|
-
|
139
|
-
|
164
|
+
CmsAction.ShowOverlay = (name) => {
|
165
|
+
return {
|
166
|
+
type: CmsAction.SHOW_OVERLAY,
|
167
|
+
payload: { name },
|
168
|
+
};
|
169
|
+
};
|
140
170
|
/**
|
141
171
|
* Hide an Overlay on the selected page
|
142
172
|
*
|
143
173
|
* @param name - name of the overlay
|
144
174
|
* @returns void
|
145
175
|
*/
|
146
|
-
CmsAction.HideOverlay = (name) =>
|
147
|
-
|
148
|
-
|
149
|
-
|
176
|
+
CmsAction.HideOverlay = (name) => {
|
177
|
+
return {
|
178
|
+
type: CmsAction.HIDE_OVERLAY,
|
179
|
+
payload: { name },
|
180
|
+
};
|
181
|
+
};
|
150
182
|
/**
|
151
183
|
* Hide all Overlays on the selected page
|
152
184
|
*
|
153
185
|
* @returns void
|
154
186
|
*/
|
155
|
-
CmsAction.HideAllOverlays = () =>
|
156
|
-
|
157
|
-
|
187
|
+
CmsAction.HideAllOverlays = () => {
|
188
|
+
return {
|
189
|
+
type: CmsAction.HIDE_ALL_OVERLAYS,
|
190
|
+
};
|
191
|
+
};
|
158
192
|
})(CmsAction || (CmsAction = {}));
|
159
193
|
|
160
194
|
var cmsActions = /*#__PURE__*/Object.freeze({
|
@@ -552,15 +586,6 @@ const findElement = (source, comparatorFn) => {
|
|
552
586
|
return;
|
553
587
|
};
|
554
588
|
|
555
|
-
const parseBoundPath = (path) => {
|
556
|
-
var _a, _b;
|
557
|
-
const regexp = new RegExp(`(?:\\/)(?:\\w+)(?:\\/)(?:ports|attributes)(?:\\/)(?:\\w+)|(?:\\/)(?:\\w+)`, 'g');
|
558
|
-
const blocks = (_b = (_a = path.match(regexp)) === null || _a === void 0 ? void 0 : _a.map(match => {
|
559
|
-
const [type, property, name] = compact(match.split('/'));
|
560
|
-
return { type: type !== null && type !== void 0 ? type : '', property, name };
|
561
|
-
})) !== null && _b !== void 0 ? _b : [];
|
562
|
-
return blocks;
|
563
|
-
};
|
564
589
|
const parsePath = (path) => {
|
565
590
|
var _a, _b, _c, _d;
|
566
591
|
const segments = path.split('/');
|
@@ -797,13 +822,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
797
822
|
}] });
|
798
823
|
|
799
824
|
class ElementRendererComponent {
|
800
|
-
constructor(
|
801
|
-
this.parentInjector = parentInjector;
|
825
|
+
constructor(runtimeService, elementContext, ioProviderService, cdr) {
|
802
826
|
this.runtimeService = runtimeService;
|
803
827
|
this.elementContext = elementContext;
|
804
828
|
this.ioProviderService = ioProviderService;
|
805
|
-
this.configurationService = configurationService;
|
806
|
-
this.elementRef = elementRef;
|
807
829
|
this.cdr = cdr;
|
808
830
|
this.refs = {};
|
809
831
|
this.destroy$ = new Subject();
|
@@ -827,10 +849,7 @@ class ElementRendererComponent {
|
|
827
849
|
this.refs[UUID.UUID()] = this.createComponent();
|
828
850
|
return;
|
829
851
|
}
|
830
|
-
if (modelMeta.
|
831
|
-
this.createFromLineItem(modelMeta.lineItem);
|
832
|
-
}
|
833
|
-
else if (modelMeta.path) {
|
852
|
+
if (modelMeta.path) {
|
834
853
|
this.createFromPath(modelMeta.path);
|
835
854
|
}
|
836
855
|
}
|
@@ -843,45 +862,6 @@ class ElementRendererComponent {
|
|
843
862
|
this.processChildren(children);
|
844
863
|
});
|
845
864
|
}
|
846
|
-
getModelComponent() {
|
847
|
-
let component = null;
|
848
|
-
let injector = this.parentInjector;
|
849
|
-
while (!component) {
|
850
|
-
const parentComp = injector.get(ElementRendererComponent, null);
|
851
|
-
if (parentComp === null || parentComp === void 0 ? void 0 : parentComp.meta.model) {
|
852
|
-
component = parentComp;
|
853
|
-
break;
|
854
|
-
}
|
855
|
-
if (parentComp) {
|
856
|
-
injector = parentComp.parentInjector;
|
857
|
-
}
|
858
|
-
else {
|
859
|
-
break;
|
860
|
-
}
|
861
|
-
}
|
862
|
-
return component;
|
863
|
-
}
|
864
|
-
createFromLineItem(path) {
|
865
|
-
var _a, _b;
|
866
|
-
const parentComp = this.getModelComponent();
|
867
|
-
const parentPath = (_a = parentComp === null || parentComp === void 0 ? void 0 : parentComp.meta.model) === null || _a === void 0 ? void 0 : _a.lineItem;
|
868
|
-
const pathBlocks = parseBoundPath(path).reverse();
|
869
|
-
const { property, name } = (_b = pathBlocks[1]) !== null && _b !== void 0 ? _b : {};
|
870
|
-
const finalPath = pathBlocks[0];
|
871
|
-
const children$ = this.getParentLineItem$(parentComp).pipe(map(model => {
|
872
|
-
var _a;
|
873
|
-
if (!model) {
|
874
|
-
return [];
|
875
|
-
}
|
876
|
-
if (property === 'ports' && !(finalPath === null || finalPath === void 0 ? void 0 : finalPath.property) && parentPath !== path) {
|
877
|
-
return (_a = model.lineItems.filter(({ port }) => port === name)) !== null && _a !== void 0 ? _a : [];
|
878
|
-
}
|
879
|
-
return [model];
|
880
|
-
}));
|
881
|
-
children$.pipe(takeUntil(this.destroy$)).subscribe(children => {
|
882
|
-
this.processChildren(children);
|
883
|
-
});
|
884
|
-
}
|
885
865
|
processChildren(children) {
|
886
866
|
var _a;
|
887
867
|
(_a = this.runtimeService.moduleRefs[0]) === null || _a === void 0 ? void 0 : _a.injector.runInContext(() => {
|
@@ -904,16 +884,6 @@ class ElementRendererComponent {
|
|
904
884
|
this.cdr.detectChanges();
|
905
885
|
});
|
906
886
|
}
|
907
|
-
getParentLineItem$(parentComp) {
|
908
|
-
var _a;
|
909
|
-
const parentRefs = Object.values((_a = parentComp === null || parentComp === void 0 ? void 0 : parentComp.refs) !== null && _a !== void 0 ? _a : {});
|
910
|
-
const parentRef = parentRefs.find(ref => { var _a; return (_a = ref === null || ref === void 0 ? void 0 : ref.location.nativeElement) === null || _a === void 0 ? void 0 : _a.contains(this.elementRef.nativeElement); });
|
911
|
-
let parentModel$;
|
912
|
-
if ((parentRef === null || parentRef === void 0 ? void 0 : parentRef.instance) instanceof ElementComponent) {
|
913
|
-
parentModel$ = parentRef === null || parentRef === void 0 ? void 0 : parentRef.instance.model$;
|
914
|
-
}
|
915
|
-
return parentModel$ !== null && parentModel$ !== void 0 ? parentModel$ : this.configurationService.get();
|
916
|
-
}
|
917
887
|
createComponent(data, index) {
|
918
888
|
var _a;
|
919
889
|
if (!this.type) {
|
@@ -948,16 +918,12 @@ class ElementRendererComponent {
|
|
948
918
|
this.refs = {};
|
949
919
|
}
|
950
920
|
}
|
951
|
-
ElementRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ElementRendererComponent, deps: [{ token:
|
921
|
+
ElementRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ElementRendererComponent, deps: [{ token: RuntimeService }, { token: ElementContextService }, { token: IOProviderService }, { token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
|
952
922
|
ElementRendererComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.9", 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 });
|
953
923
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ElementRendererComponent, decorators: [{
|
954
924
|
type: Component,
|
955
925
|
args: [{ selector: 'vl-cms-element-renderer', changeDetection: ChangeDetectionStrategy.OnPush, providers: [ElementContextService], template: "<ng-template #el></ng-template>\n", styles: [":host{display:contents}\n"] }]
|
956
|
-
}], ctorParameters: function () {
|
957
|
-
return [{ type: i0.Injector, decorators: [{
|
958
|
-
type: SkipSelf
|
959
|
-
}] }, { type: RuntimeService }, { type: ElementContextService }, { type: IOProviderService }, { type: i2.ConfigurationService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }];
|
960
|
-
}, propDecorators: { el: [{
|
926
|
+
}], ctorParameters: function () { return [{ type: RuntimeService }, { type: ElementContextService }, { type: IOProviderService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { el: [{
|
961
927
|
type: ViewChild,
|
962
928
|
args: ['el', { read: ViewContainerRef, static: true }]
|
963
929
|
}], meta: [{
|
@@ -988,7 +954,7 @@ class PreviewComponent {
|
|
988
954
|
ngOnInit() {
|
989
955
|
var _a;
|
990
956
|
if ((_a = this.config) === null || _a === void 0 ? void 0 : _a.clearStateOnInit) {
|
991
|
-
this.integrationState.
|
957
|
+
this.integrationState.reset();
|
992
958
|
}
|
993
959
|
this.startPreview();
|
994
960
|
}
|
@@ -1636,20 +1602,22 @@ const vendorMap = {
|
|
1636
1602
|
'@veloceapps/api/v2': {
|
1637
1603
|
SalesTransactionApiService,
|
1638
1604
|
},
|
1639
|
-
'@veloceapps/sdk/core':
|
1605
|
+
'@veloceapps/sdk/core': {
|
1606
|
+
ConfigurationService,
|
1640
1607
|
ConfigurationStateService,
|
1641
|
-
QuoteDraftService,
|
1642
1608
|
FlowConfigurationService,
|
1643
1609
|
IntegrationState,
|
1644
1610
|
FlowStateService,
|
1645
1611
|
FlowStateConfigurationService,
|
1646
|
-
|
1612
|
+
TransactionItemWorker,
|
1647
1613
|
ProductImagesService,
|
1648
1614
|
RuntimeSettingsService,
|
1649
1615
|
ActionCodePipe,
|
1650
1616
|
DatePipe,
|
1651
1617
|
NumberPipe,
|
1652
|
-
PricePipe
|
1618
|
+
PricePipe,
|
1619
|
+
SalesTransactionService,
|
1620
|
+
},
|
1653
1621
|
'@veloceapps/sdk/cms': Object.assign(Object.assign(Object.assign({}, cmsInjectionTokens), cmsActions), { TemplatesService,
|
1654
1622
|
IntegrationState,
|
1655
1623
|
ResourcesService,
|
@@ -1861,8 +1829,8 @@ const normalizeElementMetadata = (elementMetadata) => {
|
|
1861
1829
|
var _a, _b, _c, _d;
|
1862
1830
|
const metadata = Object.assign({}, elementMetadata);
|
1863
1831
|
// model
|
1864
|
-
const {
|
1865
|
-
const model =
|
1832
|
+
const { path } = (_a = metadata.model) !== null && _a !== void 0 ? _a : {};
|
1833
|
+
const model = path ? { path } : undefined;
|
1866
1834
|
if (model) {
|
1867
1835
|
metadata.model = model;
|
1868
1836
|
}
|
@@ -2019,112 +1987,8 @@ class ElementMetadataWorker {
|
|
2019
1987
|
}
|
2020
1988
|
}
|
2021
1989
|
|
2022
|
-
class ConfigurationPlugin {
|
2023
|
-
constructor(host) {
|
2024
|
-
var _a, _b;
|
2025
|
-
this.host = host;
|
2026
|
-
this.destroy$ = new Subject();
|
2027
|
-
this.elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
2028
|
-
this.configurationService = this.host.injector.get(ConfigurationService);
|
2029
|
-
if ((_a = this.elementMetadata.model) === null || _a === void 0 ? void 0 : _a.lineItem) {
|
2030
|
-
this.host.model$.pipe(takeUntil(this.destroy$)).subscribe(model => (this.modelSnapshot = model));
|
2031
|
-
const pathBlocks = parseBoundPath((_b = this.elementMetadata.model) === null || _b === void 0 ? void 0 : _b.lineItem);
|
2032
|
-
const firstPathBlock = pathBlocks.reverse()[0];
|
2033
|
-
if (!firstPathBlock) {
|
2034
|
-
return;
|
2035
|
-
}
|
2036
|
-
const { type, property, name } = firstPathBlock;
|
2037
|
-
this.host.boundName = name !== null && name !== void 0 ? name : type;
|
2038
|
-
this.register(type, property, name);
|
2039
|
-
}
|
2040
|
-
}
|
2041
|
-
ngOnDestroy() {
|
2042
|
-
this.destroy$.next();
|
2043
|
-
this.destroy$.complete();
|
2044
|
-
}
|
2045
|
-
register(type, property, name) {
|
2046
|
-
if (!type) {
|
2047
|
-
return;
|
2048
|
-
}
|
2049
|
-
if (!property) {
|
2050
|
-
this.registerType();
|
2051
|
-
}
|
2052
|
-
else if (property === 'ports' && name) {
|
2053
|
-
this.registerPort(name);
|
2054
|
-
}
|
2055
|
-
else if (property === 'attributes' && name) {
|
2056
|
-
this.registerAttribute(name);
|
2057
|
-
}
|
2058
|
-
}
|
2059
|
-
registerType() {
|
2060
|
-
const remove = () => {
|
2061
|
-
const rootLineItem = this.configurationService.getSnapshot();
|
2062
|
-
if (!rootLineItem || !this.modelSnapshot) {
|
2063
|
-
return;
|
2064
|
-
}
|
2065
|
-
this.configurationService.patch(new LineItemWorker(rootLineItem).remove(this.modelSnapshot.id).li);
|
2066
|
-
};
|
2067
|
-
const updateQty = (qty) => {
|
2068
|
-
const rootLineItem = this.configurationService.getSnapshot();
|
2069
|
-
if (!rootLineItem || !this.modelSnapshot) {
|
2070
|
-
return;
|
2071
|
-
}
|
2072
|
-
this.configurationService.patch(new LineItemWorker(rootLineItem).replace(Object.assign(Object.assign({}, this.modelSnapshot), { qty })).li);
|
2073
|
-
};
|
2074
|
-
this.typeHost.remove = remove;
|
2075
|
-
this.typeHost.updateQty = updateQty;
|
2076
|
-
}
|
2077
|
-
registerPort(name) {
|
2078
|
-
const model$ = this.host.model$;
|
2079
|
-
const portItems$ = model$.pipe(map(model => { var _a; return (_a = model === null || model === void 0 ? void 0 : model.lineItems.filter(li => li.port === this.host.boundName)) !== null && _a !== void 0 ? _a : []; }));
|
2080
|
-
const portDomain$ = model$.pipe(map(model => model === null || model === void 0 ? void 0 : model.portDomains[this.host.boundName]));
|
2081
|
-
const add = (type, attributes = []) => {
|
2082
|
-
if (!this.modelSnapshot) {
|
2083
|
-
return;
|
2084
|
-
}
|
2085
|
-
const portDomain = this.modelSnapshot.portDomains[name];
|
2086
|
-
if (!portDomain) {
|
2087
|
-
return;
|
2088
|
-
}
|
2089
|
-
const generated = generateLineItem(portDomain.name, type, this.modelSnapshot.id, attributes);
|
2090
|
-
this.configurationService.patch(new LineItemWorker(this.modelSnapshot).insert(this.modelSnapshot.id, generated).li);
|
2091
|
-
};
|
2092
|
-
this.portHost.portItems$ = portItems$;
|
2093
|
-
this.portHost.portDomain$ = portDomain$;
|
2094
|
-
this.portHost.addPortItem = add;
|
2095
|
-
}
|
2096
|
-
registerAttribute(name) {
|
2097
|
-
if (!this.host.model$) {
|
2098
|
-
return;
|
2099
|
-
}
|
2100
|
-
const value$ = this.host.model$.pipe(map(model => { var _a; return getAttributeValue((_a = model === null || model === void 0 ? void 0 : model.attributes) !== null && _a !== void 0 ? _a : [], name); }));
|
2101
|
-
const patch = (value) => {
|
2102
|
-
if (!this.modelSnapshot) {
|
2103
|
-
return;
|
2104
|
-
}
|
2105
|
-
this.configurationService.patch(new LineItemWorker(this.modelSnapshot).patchAttribute([{ name, value }]).li);
|
2106
|
-
};
|
2107
|
-
this.attributeHost.value$ = value$;
|
2108
|
-
this.attributeHost.patch = patch;
|
2109
|
-
}
|
2110
|
-
get attributeHost() {
|
2111
|
-
return this.host;
|
2112
|
-
}
|
2113
|
-
get typeHost() {
|
2114
|
-
return this.host;
|
2115
|
-
}
|
2116
|
-
get portHost() {
|
2117
|
-
return this.host;
|
2118
|
-
}
|
2119
|
-
}
|
2120
|
-
ConfigurationPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationPlugin, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
2121
|
-
ConfigurationPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: ConfigurationPlugin, ngImport: i0 });
|
2122
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationPlugin, decorators: [{
|
2123
|
-
type: Directive
|
2124
|
-
}], ctorParameters: function () { return [{ type: undefined }]; } });
|
2125
|
-
|
2126
1990
|
const DEFAULT_PLUGINS = {
|
2127
|
-
CONFIGURATION: [
|
1991
|
+
CONFIGURATION: [],
|
2128
1992
|
DEFAULT: [],
|
2129
1993
|
};
|
2130
1994
|
|
@@ -2653,5 +2517,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
2653
2517
|
* Generated bundle index. Do not edit.
|
2654
2518
|
*/
|
2655
2519
|
|
2656
|
-
export { CmsAction, DEFAULT_ELEMENT, DEFAULT_PLUGINS_TOKEN, ELEMENT_CONFIG, ELEMENT_METADATA, ElementComponent, ElementDefinition, ElementMetadataWorker, ElementsResolver, FlowAction, LAYOUT, LauncherModule, MigrationsModule, MigrationsService, PreviewComponent, PreviewModule, ResourcesService, RuntimeEditorService, RuntimeModule, RuntimeService, SHARED_ELEMENT_METADATA, STARTING_PAGE_LAYOUT, STARTING_PAGE_NAME, STARTING_PAGE_STYLES, STARTING_PAGE_TYPE, TemplatesService, TranspilationWorker, UI_DEFINITION_METADATA, UiBuildError, atobSafe, btoaSafe, cmsInject, constructPage, constructPageChildren, constructRegion, doesElementSupportIO, elementToMetadata, extendElementMetadata, extractElementMetadata, findElement, findElementByModule, findElementByPath, flattenElements, getAbsolutePath, getElementAngularIOs, getElementConfig, insertElement, isElementAngularIO, isSharedElement, isValidScript, metadataToElement, normalizeElementMetadata,
|
2520
|
+
export { CmsAction, DEFAULT_ELEMENT, DEFAULT_PLUGINS_TOKEN, ELEMENT_CONFIG, ELEMENT_METADATA, ElementComponent, ElementDefinition, ElementMetadataWorker, ElementsResolver, FlowAction, LAYOUT, LauncherModule, MigrationsModule, MigrationsService, PreviewComponent, PreviewModule, ResourcesService, RuntimeEditorService, RuntimeModule, RuntimeService, SHARED_ELEMENT_METADATA, STARTING_PAGE_LAYOUT, STARTING_PAGE_NAME, STARTING_PAGE_STYLES, STARTING_PAGE_TYPE, TemplatesService, TranspilationWorker, UI_DEFINITION_METADATA, UiBuildError, atobSafe, btoaSafe, cmsInject, constructPage, constructPageChildren, constructRegion, doesElementSupportIO, elementToMetadata, extendElementMetadata, extractElementMetadata, findElement, findElementByModule, findElementByPath, flattenElements, getAbsolutePath, getElementAngularIOs, getElementConfig, insertElement, isElementAngularIO, isSharedElement, isValidScript, metadataToElement, normalizeElementMetadata, parsePath, removeElement, stringifyElementMetadata, toElementAngularIO };
|
2657
2521
|
//# sourceMappingURL=veloceapps-sdk-cms.mjs.map
|