@veloceapps/sdk 7.0.2-0 → 7.0.2-2

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,12 +7,12 @@ import * as i2 from '@veloceapps/sdk/core';
7
7
  import { ConfigurationService, LineItemWorker, generateLineItem, getAttributeValue, QuoteDraftService, FlowConfigurationService, ProductImagesService, ContextService, lineItemUtils, SdkCoreModule, UI_DEFINITION_VERSION } from '@veloceapps/sdk/core';
8
8
  import * as i3 from 'primeng/api';
9
9
  import { applyPatch } from 'rfc6902';
10
+ import { getCollectionUniqueName, UUID, isDefined, Operator, Predicate, parseJsonSafely, CoreModule } from '@veloceapps/core';
10
11
  import lodash, { compact, isArray, pull, merge, omit, flatten, set, kebabCase, cloneDeep } from 'lodash';
11
12
  import * as i5 from '@angular/common';
12
13
  import { CommonModule, DOCUMENT } from '@angular/common';
13
14
  import * as i1 from '@veloceapps/components';
14
15
  import { LetDirectiveModule, LoaderModule, ToastService, ToastType } from '@veloceapps/components';
15
- import { UUID, isDefined, Operator, Predicate, parseJsonSafely, CoreModule } from '@veloceapps/core';
16
16
  import * as i2$1 from 'ngx-drag-drop';
17
17
  import { DndModule } from 'ngx-drag-drop';
18
18
  import { SalesforceApiService, QuoteApiService, DocumentTemplatesApiService, DocumentAttachmentApiService, RampApiService, CatalogApiService, DeltaApiService, PicklistsApiService, PriceApiService, ShoppingCartSettingsApiService, ConfigurationSettingsApiService, GuidedSellingApiService, ApiModule } from '@veloceapps/api';
@@ -168,24 +168,9 @@ ElementComponent = __decorate([
168
168
  __metadata("design:paramtypes", [Injector])
169
169
  ], ElementComponent);
170
170
 
171
- function getElementUniqueName(collection, name, comparator) {
172
- let result = '';
173
- let index = 0;
174
- while (!result) {
175
- const candidate = name + (index ? ` (${index})` : '');
176
- const exists = collection.some(comparator(candidate));
177
- if (!exists) {
178
- result = candidate;
179
- }
180
- else {
181
- index++;
182
- }
183
- }
184
- return result;
185
- }
186
171
  const insertElementAt = (source, target, parentPath, index) => {
187
172
  const result = [...source];
188
- const name = getElementUniqueName(result, target.name, (name) => (el) => el.name === name);
173
+ const name = getCollectionUniqueName(result, target.name, (name) => (el) => el.name === name);
189
174
  const path = parentPath ? `${parentPath}/${name}` : name;
190
175
  result.splice(index, 0, { ...target, path, name });
191
176
  return result;
@@ -1845,7 +1830,11 @@ class FederatedComponent {
1845
1830
  if (!remoteEntry || !exposedModule) {
1846
1831
  return;
1847
1832
  }
1848
- loadRemoteModule({ type: 'module', remoteEntry, exposedModule }).then(federated => {
1833
+ loadRemoteModule({
1834
+ type: 'module',
1835
+ remoteEntry: this.normalizeRemoteEntry(remoteEntry),
1836
+ exposedModule,
1837
+ }).then(federated => {
1849
1838
  const moduleRef = createNgModule(federated[exposedModule], this.injector);
1850
1839
  const componentRef = this.host.viewContainerRef.createComponent(federated[exposedModule].rootComponent, { ngModuleRef: moduleRef });
1851
1840
  componentRef.instance.data = this.data;
@@ -1853,6 +1842,13 @@ class FederatedComponent {
1853
1842
  this.isLoading$.next(false);
1854
1843
  });
1855
1844
  }
1845
+ normalizeRemoteEntry(value) {
1846
+ const { proxyTargetUrl, VELO_API } = window;
1847
+ if (proxyTargetUrl && VELO_API) {
1848
+ return value.replace(proxyTargetUrl, VELO_API);
1849
+ }
1850
+ return value;
1851
+ }
1856
1852
  }
1857
1853
  FederatedComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.8", ngImport: i0, type: FederatedComponent, deps: [{ token: i0.Injector }], target: i0.ɵɵFactoryTarget.Component });
1858
1854
  FederatedComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.8", type: FederatedComponent, selector: "veloce-host-federated", inputs: { remoteEntry: "remoteEntry", remoteName: "remoteName", exposedModule: "exposedModule", data: "data", options: "options" }, viewQueries: [{ propertyName: "host", first: true, predicate: FederatedHostDirective, descendants: true, static: true }], usesOnChanges: true, ngImport: i0, template: "<ng-template vlFederatedHost></ng-template>\n\n<vl-loader *ngIf=\"!suppressLoading && (isLoading$ | async)\" [label]=\"loadingLabel\"></vl-loader>\n", styles: [":host{display:block}div{height:100%}\n"], dependencies: [{ kind: "directive", type: i5.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }, { kind: "component", type: i1.LoaderComponent, selector: "vl-loader", inputs: ["label", "overlayVisible"] }, { kind: "directive", type: FederatedHostDirective, selector: "[vlFederatedHost]" }, { kind: "pipe", type: i5.AsyncPipe, name: "async" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -2064,5 +2060,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.8", ngImpor
2064
2060
  * Generated bundle index. Do not edit.
2065
2061
  */
2066
2062
 
2067
- export { ApplyProductConfigurationAction, CloseDocGenAction, CmsAction, ConfigureProductAction, DEFAULT_PLUGINS_TOKEN, ELEMENT_CONFIG, ELEMENT_METADATA, ElementComponent, ElementDefinition, ElementsResolver, FlowAction, IntegrationState, LauncherModule, MigrationsModule, MigrationsService, NavigateBackAction, NavigateToCatalogAction, OpenDocGenAction, PreviewComponent, PreviewModule, RemoteApplyAction, RemoteCancelAction, ResourcesService, RuntimeEditorService, RuntimeModule, SHARED_ELEMENT_METADATA, SwitchObjectAction, TemplatesService, UI_DEFINITION_METADATA, UiBuildError, VENDOR_MAP, doesElementSupportIO, elementToMetadata, extendElementMetadata, extractElementMetadata, findElementByModule, findElementByPath, flattenElements, getAbsolutePath, getElementConfig, getElementUniqueName, insertElement, isSharedElement, isValidScript, metadataToElement, normalizeElementMetadata, parseBoundPath, parsePath, removeElement, stringifyElementMetadata };
2063
+ export { ApplyProductConfigurationAction, CloseDocGenAction, CmsAction, ConfigureProductAction, DEFAULT_PLUGINS_TOKEN, ELEMENT_CONFIG, ELEMENT_METADATA, ElementComponent, ElementDefinition, ElementsResolver, FlowAction, IntegrationState, LauncherModule, MigrationsModule, MigrationsService, NavigateBackAction, NavigateToCatalogAction, OpenDocGenAction, PreviewComponent, PreviewModule, RemoteApplyAction, RemoteCancelAction, ResourcesService, RuntimeEditorService, RuntimeModule, SHARED_ELEMENT_METADATA, SwitchObjectAction, TemplatesService, UI_DEFINITION_METADATA, UiBuildError, VENDOR_MAP, doesElementSupportIO, elementToMetadata, extendElementMetadata, extractElementMetadata, findElementByModule, findElementByPath, flattenElements, getAbsolutePath, getElementConfig, insertElement, isSharedElement, isValidScript, metadataToElement, normalizeElementMetadata, parseBoundPath, parsePath, removeElement, stringifyElementMetadata };
2068
2064
  //# sourceMappingURL=veloceapps-sdk-cms.mjs.map