@veloceapps/sdk 11.0.0-16 → 11.0.0-17
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.
- 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,14 +1,14 @@
|
|
|
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 } 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, { cloneDeep,
|
|
11
|
+
import lodash, { cloneDeep, isArray, pull, merge, omit, flatten, kebabCase, set } from 'lodash';
|
|
12
12
|
import { applyPatch } from 'rfc6902';
|
|
13
13
|
import { getCollectionUniqueName, UUID, isDefined, Operator, Predicate, parseJsonSafely, parseJwt, TokenInfoService, CoreModule } from '@veloceapps/core';
|
|
14
14
|
import * as i4 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({
|
|
@@ -665,14 +699,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
665
699
|
type: Injectable
|
|
666
700
|
}], ctorParameters: function () { return [{ type: i0.Injector }, { type: i2.IntegrationState }]; } });
|
|
667
701
|
|
|
668
|
-
const parseBoundPath = (path) => {
|
|
669
|
-
const regexp = new RegExp(`(?:\\/)(?:\\w+)(?:\\/)(?:ports|attributes)(?:\\/)(?:\\w+)|(?:\\/)(?:\\w+)`, 'g');
|
|
670
|
-
const blocks = path.match(regexp)?.map(match => {
|
|
671
|
-
const [type, property, name] = compact(match.split('/'));
|
|
672
|
-
return { type: type ?? '', property, name };
|
|
673
|
-
}) ?? [];
|
|
674
|
-
return blocks;
|
|
675
|
-
};
|
|
676
702
|
const parsePath = (path) => {
|
|
677
703
|
const segments = path.split('/');
|
|
678
704
|
let module;
|
|
@@ -801,13 +827,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
801
827
|
}] });
|
|
802
828
|
|
|
803
829
|
class ElementRendererComponent {
|
|
804
|
-
constructor(
|
|
805
|
-
this.parentInjector = parentInjector;
|
|
830
|
+
constructor(runtimeService, elementContext, ioProviderService, cdr) {
|
|
806
831
|
this.runtimeService = runtimeService;
|
|
807
832
|
this.elementContext = elementContext;
|
|
808
833
|
this.ioProviderService = ioProviderService;
|
|
809
|
-
this.configurationService = configurationService;
|
|
810
|
-
this.elementRef = elementRef;
|
|
811
834
|
this.cdr = cdr;
|
|
812
835
|
this.refs = {};
|
|
813
836
|
this.destroy$ = new Subject();
|
|
@@ -831,10 +854,7 @@ class ElementRendererComponent {
|
|
|
831
854
|
this.refs[UUID.UUID()] = this.createComponent();
|
|
832
855
|
return;
|
|
833
856
|
}
|
|
834
|
-
if (modelMeta.
|
|
835
|
-
this.createFromLineItem(modelMeta.lineItem);
|
|
836
|
-
}
|
|
837
|
-
else if (modelMeta.path) {
|
|
857
|
+
if (modelMeta.path) {
|
|
838
858
|
this.createFromPath(modelMeta.path);
|
|
839
859
|
}
|
|
840
860
|
}
|
|
@@ -847,43 +867,6 @@ class ElementRendererComponent {
|
|
|
847
867
|
this.processChildren(children);
|
|
848
868
|
});
|
|
849
869
|
}
|
|
850
|
-
getModelComponent() {
|
|
851
|
-
let component = null;
|
|
852
|
-
let injector = this.parentInjector;
|
|
853
|
-
while (!component) {
|
|
854
|
-
const parentComp = injector.get(ElementRendererComponent, null);
|
|
855
|
-
if (parentComp?.meta.model) {
|
|
856
|
-
component = parentComp;
|
|
857
|
-
break;
|
|
858
|
-
}
|
|
859
|
-
if (parentComp) {
|
|
860
|
-
injector = parentComp.parentInjector;
|
|
861
|
-
}
|
|
862
|
-
else {
|
|
863
|
-
break;
|
|
864
|
-
}
|
|
865
|
-
}
|
|
866
|
-
return component;
|
|
867
|
-
}
|
|
868
|
-
createFromLineItem(path) {
|
|
869
|
-
const parentComp = this.getModelComponent();
|
|
870
|
-
const parentPath = parentComp?.meta.model?.lineItem;
|
|
871
|
-
const pathBlocks = parseBoundPath(path).reverse();
|
|
872
|
-
const { property, name } = pathBlocks[1] ?? {};
|
|
873
|
-
const finalPath = pathBlocks[0];
|
|
874
|
-
const children$ = this.getParentLineItem$(parentComp).pipe(map(model => {
|
|
875
|
-
if (!model) {
|
|
876
|
-
return [];
|
|
877
|
-
}
|
|
878
|
-
if (property === 'ports' && !finalPath?.property && parentPath !== path) {
|
|
879
|
-
return model.lineItems.filter(({ port }) => port === name) ?? [];
|
|
880
|
-
}
|
|
881
|
-
return [model];
|
|
882
|
-
}));
|
|
883
|
-
children$.pipe(takeUntil(this.destroy$)).subscribe(children => {
|
|
884
|
-
this.processChildren(children);
|
|
885
|
-
});
|
|
886
|
-
}
|
|
887
870
|
processChildren(children) {
|
|
888
871
|
this.runtimeService.moduleRefs[0]?.injector.runInContext(() => {
|
|
889
872
|
const refs = children.reduce((acc, data, index) => {
|
|
@@ -904,15 +887,6 @@ class ElementRendererComponent {
|
|
|
904
887
|
this.cdr.detectChanges();
|
|
905
888
|
});
|
|
906
889
|
}
|
|
907
|
-
getParentLineItem$(parentComp) {
|
|
908
|
-
const parentRefs = Object.values(parentComp?.refs ?? {});
|
|
909
|
-
const parentRef = parentRefs.find(ref => ref?.location.nativeElement?.contains(this.elementRef.nativeElement));
|
|
910
|
-
let parentModel$;
|
|
911
|
-
if (parentRef?.instance instanceof ElementComponent) {
|
|
912
|
-
parentModel$ = parentRef?.instance.model$;
|
|
913
|
-
}
|
|
914
|
-
return parentModel$ ?? this.configurationService.get();
|
|
915
|
-
}
|
|
916
890
|
createComponent(data, index) {
|
|
917
891
|
if (!this.type) {
|
|
918
892
|
return;
|
|
@@ -945,14 +919,12 @@ class ElementRendererComponent {
|
|
|
945
919
|
this.refs = {};
|
|
946
920
|
}
|
|
947
921
|
}
|
|
948
|
-
ElementRendererComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ElementRendererComponent, deps: [{ token:
|
|
922
|
+
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 });
|
|
949
923
|
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 });
|
|
950
924
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ElementRendererComponent, decorators: [{
|
|
951
925
|
type: Component,
|
|
952
926
|
args: [{ selector: 'vl-cms-element-renderer', changeDetection: ChangeDetectionStrategy.OnPush, providers: [ElementContextService], template: "<ng-template #el></ng-template>\n", styles: [":host{display:contents}\n"] }]
|
|
953
|
-
}], ctorParameters: function () { return [{ type: i0.
|
|
954
|
-
type: SkipSelf
|
|
955
|
-
}] }, { type: RuntimeService }, { type: ElementContextService }, { type: IOProviderService }, { type: i2.ConfigurationService }, { type: i0.ElementRef }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { el: [{
|
|
927
|
+
}], ctorParameters: function () { return [{ type: RuntimeService }, { type: ElementContextService }, { type: IOProviderService }, { type: i0.ChangeDetectorRef }]; }, propDecorators: { el: [{
|
|
956
928
|
type: ViewChild,
|
|
957
929
|
args: ['el', { read: ViewContainerRef, static: true }]
|
|
958
930
|
}], meta: [{
|
|
@@ -981,7 +953,7 @@ class PreviewComponent {
|
|
|
981
953
|
}
|
|
982
954
|
ngOnInit() {
|
|
983
955
|
if (this.config?.clearStateOnInit) {
|
|
984
|
-
this.integrationState.
|
|
956
|
+
this.integrationState.reset();
|
|
985
957
|
}
|
|
986
958
|
this.startPreview();
|
|
987
959
|
}
|
|
@@ -1620,19 +1592,18 @@ const vendorMap = {
|
|
|
1620
1592
|
'@veloceapps/sdk/core': {
|
|
1621
1593
|
ConfigurationService,
|
|
1622
1594
|
ConfigurationStateService,
|
|
1623
|
-
QuoteDraftService,
|
|
1624
1595
|
FlowConfigurationService,
|
|
1625
1596
|
IntegrationState,
|
|
1626
1597
|
FlowStateService,
|
|
1627
1598
|
FlowStateConfigurationService,
|
|
1628
|
-
|
|
1599
|
+
TransactionItemWorker,
|
|
1629
1600
|
ProductImagesService,
|
|
1630
1601
|
RuntimeSettingsService,
|
|
1631
1602
|
ActionCodePipe,
|
|
1632
1603
|
DatePipe,
|
|
1633
1604
|
NumberPipe,
|
|
1634
1605
|
PricePipe,
|
|
1635
|
-
|
|
1606
|
+
SalesTransactionService,
|
|
1636
1607
|
},
|
|
1637
1608
|
'@veloceapps/sdk/cms': {
|
|
1638
1609
|
...cmsInjectionTokens,
|
|
@@ -1853,8 +1824,8 @@ const metadataToElement = (metadata, recursive = true) => {
|
|
|
1853
1824
|
const normalizeElementMetadata = (elementMetadata) => {
|
|
1854
1825
|
const metadata = { ...elementMetadata };
|
|
1855
1826
|
// model
|
|
1856
|
-
const {
|
|
1857
|
-
const model =
|
|
1827
|
+
const { path } = metadata.model ?? {};
|
|
1828
|
+
const model = path ? { path } : undefined;
|
|
1858
1829
|
if (model) {
|
|
1859
1830
|
metadata.model = model;
|
|
1860
1831
|
}
|
|
@@ -2003,111 +1974,8 @@ class ElementMetadataWorker {
|
|
|
2003
1974
|
}
|
|
2004
1975
|
}
|
|
2005
1976
|
|
|
2006
|
-
class ConfigurationPlugin {
|
|
2007
|
-
constructor(host) {
|
|
2008
|
-
this.host = host;
|
|
2009
|
-
this.destroy$ = new Subject();
|
|
2010
|
-
this.elementMetadata = this.host.injector.get(ELEMENT_METADATA);
|
|
2011
|
-
this.configurationService = this.host.injector.get(ConfigurationService);
|
|
2012
|
-
if (this.elementMetadata.model?.lineItem) {
|
|
2013
|
-
this.host.model$.pipe(takeUntil(this.destroy$)).subscribe(model => (this.modelSnapshot = model));
|
|
2014
|
-
const pathBlocks = parseBoundPath(this.elementMetadata.model?.lineItem);
|
|
2015
|
-
const firstPathBlock = pathBlocks.reverse()[0];
|
|
2016
|
-
if (!firstPathBlock) {
|
|
2017
|
-
return;
|
|
2018
|
-
}
|
|
2019
|
-
const { type, property, name } = firstPathBlock;
|
|
2020
|
-
this.host.boundName = name ?? type;
|
|
2021
|
-
this.register(type, property, name);
|
|
2022
|
-
}
|
|
2023
|
-
}
|
|
2024
|
-
ngOnDestroy() {
|
|
2025
|
-
this.destroy$.next();
|
|
2026
|
-
this.destroy$.complete();
|
|
2027
|
-
}
|
|
2028
|
-
register(type, property, name) {
|
|
2029
|
-
if (!type) {
|
|
2030
|
-
return;
|
|
2031
|
-
}
|
|
2032
|
-
if (!property) {
|
|
2033
|
-
this.registerType();
|
|
2034
|
-
}
|
|
2035
|
-
else if (property === 'ports' && name) {
|
|
2036
|
-
this.registerPort(name);
|
|
2037
|
-
}
|
|
2038
|
-
else if (property === 'attributes' && name) {
|
|
2039
|
-
this.registerAttribute(name);
|
|
2040
|
-
}
|
|
2041
|
-
}
|
|
2042
|
-
registerType() {
|
|
2043
|
-
const remove = () => {
|
|
2044
|
-
const rootLineItem = this.configurationService.getSnapshot();
|
|
2045
|
-
if (!rootLineItem || !this.modelSnapshot) {
|
|
2046
|
-
return;
|
|
2047
|
-
}
|
|
2048
|
-
this.configurationService.patch(new LineItemWorker(rootLineItem).remove(this.modelSnapshot.id).li);
|
|
2049
|
-
};
|
|
2050
|
-
const updateQty = (qty) => {
|
|
2051
|
-
const rootLineItem = this.configurationService.getSnapshot();
|
|
2052
|
-
if (!rootLineItem || !this.modelSnapshot) {
|
|
2053
|
-
return;
|
|
2054
|
-
}
|
|
2055
|
-
this.configurationService.patch(new LineItemWorker(rootLineItem).replace({ ...this.modelSnapshot, qty }).li);
|
|
2056
|
-
};
|
|
2057
|
-
this.typeHost.remove = remove;
|
|
2058
|
-
this.typeHost.updateQty = updateQty;
|
|
2059
|
-
}
|
|
2060
|
-
registerPort(name) {
|
|
2061
|
-
const model$ = this.host.model$;
|
|
2062
|
-
const portItems$ = model$.pipe(map(model => model?.lineItems.filter(li => li.port === this.host.boundName) ?? []));
|
|
2063
|
-
const portDomain$ = model$.pipe(map(model => model?.portDomains[this.host.boundName]));
|
|
2064
|
-
const add = (type, attributes = []) => {
|
|
2065
|
-
if (!this.modelSnapshot) {
|
|
2066
|
-
return;
|
|
2067
|
-
}
|
|
2068
|
-
const portDomain = this.modelSnapshot.portDomains[name];
|
|
2069
|
-
if (!portDomain) {
|
|
2070
|
-
return;
|
|
2071
|
-
}
|
|
2072
|
-
const generated = generateLineItem(portDomain.name, type, this.modelSnapshot.id, attributes);
|
|
2073
|
-
this.configurationService.patch(new LineItemWorker(this.modelSnapshot).insert(this.modelSnapshot.id, generated).li);
|
|
2074
|
-
};
|
|
2075
|
-
this.portHost.portItems$ = portItems$;
|
|
2076
|
-
this.portHost.portDomain$ = portDomain$;
|
|
2077
|
-
this.portHost.addPortItem = add;
|
|
2078
|
-
}
|
|
2079
|
-
registerAttribute(name) {
|
|
2080
|
-
if (!this.host.model$) {
|
|
2081
|
-
return;
|
|
2082
|
-
}
|
|
2083
|
-
const value$ = this.host.model$.pipe(map(model => getAttributeValue(model?.attributes ?? [], name)));
|
|
2084
|
-
const patch = (value) => {
|
|
2085
|
-
if (!this.modelSnapshot) {
|
|
2086
|
-
return;
|
|
2087
|
-
}
|
|
2088
|
-
this.configurationService.patch(new LineItemWorker(this.modelSnapshot).patchAttribute([{ name, value }]).li);
|
|
2089
|
-
};
|
|
2090
|
-
this.attributeHost.value$ = value$;
|
|
2091
|
-
this.attributeHost.patch = patch;
|
|
2092
|
-
}
|
|
2093
|
-
get attributeHost() {
|
|
2094
|
-
return this.host;
|
|
2095
|
-
}
|
|
2096
|
-
get typeHost() {
|
|
2097
|
-
return this.host;
|
|
2098
|
-
}
|
|
2099
|
-
get portHost() {
|
|
2100
|
-
return this.host;
|
|
2101
|
-
}
|
|
2102
|
-
}
|
|
2103
|
-
ConfigurationPlugin.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationPlugin, deps: "invalid", target: i0.ɵɵFactoryTarget.Directive });
|
|
2104
|
-
ConfigurationPlugin.ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "15.2.9", type: ConfigurationPlugin, ngImport: i0 });
|
|
2105
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImport: i0, type: ConfigurationPlugin, decorators: [{
|
|
2106
|
-
type: Directive
|
|
2107
|
-
}], ctorParameters: function () { return [{ type: undefined }]; } });
|
|
2108
|
-
|
|
2109
1977
|
const DEFAULT_PLUGINS = {
|
|
2110
|
-
CONFIGURATION: [
|
|
1978
|
+
CONFIGURATION: [],
|
|
2111
1979
|
DEFAULT: [],
|
|
2112
1980
|
};
|
|
2113
1981
|
|
|
@@ -2747,5 +2615,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.9", ngImpor
|
|
|
2747
2615
|
* Generated bundle index. Do not edit.
|
|
2748
2616
|
*/
|
|
2749
2617
|
|
|
2750
|
-
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,
|
|
2618
|
+
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 };
|
|
2751
2619
|
//# sourceMappingURL=veloceapps-sdk-cms.mjs.map
|