@veloceapps/sdk 6.0.0-62 → 6.0.0-64

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/README.md CHANGED
@@ -1,3 +1,7 @@
1
1
  # Sdk library
2
2
 
3
+ ##### `@veloceapps/sdk`
4
+
5
+ <br>
6
+
3
7
  TBD
@@ -911,6 +911,55 @@
911
911
  args: [{ providedIn: 'root' }]
912
912
  }] });
913
913
 
914
+ var ResourcesService = /** @class */ (function () {
915
+ function ResourcesService() {
916
+ this.scripts = new Map();
917
+ this.loaded$ = new rxjs.ReplaySubject();
918
+ }
919
+ ResourcesService.prototype.loadScript = function (url) {
920
+ var _this = this;
921
+ var loaded = this.scripts.get(url);
922
+ if (loaded === true) {
923
+ return rxjs.of(rxjs.noop());
924
+ }
925
+ if (loaded == null) {
926
+ this.scripts.set(url, false);
927
+ var script = document.createElement('script');
928
+ script.src = url;
929
+ script.onload = function () {
930
+ _this.scripts.set(url, true);
931
+ _this.loaded$.next();
932
+ };
933
+ document.body.appendChild(script);
934
+ }
935
+ return this.loaded$.pipe(rxjs.filter(function () { return _this.scripts.get(url) === true; }), rxjs.take(1));
936
+ };
937
+ ResourcesService.prototype.loadStyles = function (url) {
938
+ var _a, _b;
939
+ var previewEl = document.querySelector('vl-cms-preview');
940
+ var rootEl = (_b = (_a = previewEl === null || previewEl === void 0 ? void 0 : previewEl.shadowRoot) !== null && _a !== void 0 ? _a : previewEl) !== null && _b !== void 0 ? _b : document.body;
941
+ return new rxjs.Observable(function (subscriber) {
942
+ var link = document.createElement('link');
943
+ link.rel = 'stylesheet';
944
+ link.type = 'text/css';
945
+ link.href = url;
946
+ link.media = 'all';
947
+ link.onload = function () {
948
+ subscriber.next();
949
+ subscriber.complete();
950
+ };
951
+ rootEl.appendChild(link);
952
+ });
953
+ };
954
+ return ResourcesService;
955
+ }());
956
+ ResourcesService.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ResourcesService, deps: [], target: i0__namespace.ɵɵFactoryTarget.Injectable });
957
+ ResourcesService.ɵprov = i0__namespace.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ResourcesService, providedIn: 'root' });
958
+ i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: ResourcesService, decorators: [{
959
+ type: i0.Injectable,
960
+ args: [{ providedIn: 'root' }]
961
+ }] });
962
+
914
963
  var ElementContextService = /** @class */ (function () {
915
964
  function ElementContextService() {
916
965
  }
@@ -1796,7 +1845,7 @@
1796
1845
  ConfigurationSettingsApiService: api.ConfigurationSettingsApiService,
1797
1846
  },
1798
1847
  '@veloceapps/sdk/core': Object.assign({ ConfigurationService: i2.ConfigurationService, QuoteDraftService: i2.QuoteDraftService, FlowConfigurationService: i2.FlowConfigurationService, LineItemWorker: i2.LineItemWorker, ProductImagesService: i2.ProductImagesService, ContextService: i2.ContextService }, i2.lineItemUtils),
1799
- '@veloceapps/sdk/cms': Object.assign(Object.assign(Object.assign({}, cmsInjectionTokens), cmsActions), { TemplatesService: TemplatesService, IntegrationState: IntegrationState }),
1848
+ '@veloceapps/sdk/cms': Object.assign(Object.assign(Object.assign({}, cmsInjectionTokens), cmsActions), { TemplatesService: TemplatesService, IntegrationState: IntegrationState, ResourcesService: ResourcesService }),
1800
1849
  };
1801
1850
  var VELOCE_LIBS_BACKWARDS_COMPATIBLE = Object.entries(VELOCE_LIBS).reduce(function (trunk, _a) {
1802
1851
  var _b;
@@ -2252,12 +2301,12 @@
2252
2301
  }());
2253
2302
  LauncherModule.ɵfac = i0__namespace.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, deps: [], target: i0__namespace.ɵɵFactoryTarget.NgModule });
2254
2303
  LauncherModule.ɵmod = i0__namespace.ɵɵngDeclareNgModule({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule], exports: [PreviewModule] });
2255
- LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, providers: [IntegrationState, dynamicdialog.DialogService], imports: [[i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule], PreviewModule] });
2304
+ LauncherModule.ɵinj = i0__namespace.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, providers: [IntegrationState, dynamicdialog.DialogService, ResourcesService], imports: [[i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule], PreviewModule] });
2256
2305
  i0__namespace.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "12.2.17", ngImport: i0__namespace, type: LauncherModule, decorators: [{
2257
2306
  type: i0.NgModule,
2258
2307
  args: [{
2259
2308
  imports: [i7.CommonModule, core.CoreModule, api.ApiModule, i2.SdkCoreModule, RuntimeModule, PreviewModule],
2260
- providers: [IntegrationState, dynamicdialog.DialogService],
2309
+ providers: [IntegrationState, dynamicdialog.DialogService, ResourcesService],
2261
2310
  exports: [PreviewModule],
2262
2311
  }]
2263
2312
  }] });
@@ -2359,6 +2408,7 @@
2359
2408
  exports.PreviewModule = PreviewModule;
2360
2409
  exports.RemoteApplyAction = RemoteApplyAction;
2361
2410
  exports.RemoteCancelAction = RemoteCancelAction;
2411
+ exports.ResourcesService = ResourcesService;
2362
2412
  exports.RuntimeEditorService = RuntimeEditorService;
2363
2413
  exports.RuntimeModule = RuntimeModule;
2364
2414
  exports.SHARED_ELEMENT_METADATA = SHARED_ELEMENT_METADATA;