@spiffcommerce/core 26.38.0-beta.f7be796e-77fe-56a9-b635-19a1193f5fc6 → 26.38.0-beta.f8c7765d-9b97-5bb1-b23f-04f257a5f0da

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/dist/index.mjs CHANGED
@@ -347,8 +347,9 @@ class $r {
347
347
  headers: l
348
348
  };
349
349
  }), a = cr(({ operation: i, graphQLErrors: s, networkError: o }) => {
350
- const l = s || [];
351
- o && console.log("GraphQL Network error"), l.forEach(() => console.log("GraphQL Error: " + i.operationName));
350
+ var d, A;
351
+ const l = s || [], c = i.getContext();
352
+ o && !((A = (d = c == null ? void 0 : c.fetchOptions) == null ? void 0 : d.signal) != null && A.aborted) && console.log("GraphQL Network error"), l.forEach(() => console.log("GraphQL Error: " + i.operationName));
352
353
  }), n = Ar();
353
354
  return new ir({
354
355
  link: sr([n, a, e, t]),
@@ -14181,13 +14182,13 @@ class Zn {
14181
14182
  */
14182
14183
  async fetchProductsFeed(t, e, a, n, i, s) {
14183
14184
  if (this.fullFetched) {
14184
- const l = await (a ? this.filterProducts(a) : this.fetchProducts());
14185
+ const d = await (a ? this.filterProducts(a) : this.fetchProducts());
14185
14186
  return {
14186
- total: l.length,
14187
- items: l.slice(t, t + e)
14187
+ total: d.length,
14188
+ items: d.slice(t, t + e)
14188
14189
  };
14189
14190
  }
14190
- const o = b.getShadowGraphqlClient().watchQuery({
14191
+ const o = new AbortController(), { signal: l } = o, c = b.getShadowGraphqlClient().watchQuery({
14191
14192
  query: $s,
14192
14193
  variables: {
14193
14194
  id: this.getId(),
@@ -14206,25 +14207,30 @@ class Zn {
14206
14207
  },
14207
14208
  errorPolicy: "all",
14208
14209
  fetchPolicy: "cache-first",
14209
- returnPartialData: !0
14210
+ returnPartialData: !0,
14211
+ context: {
14212
+ fetchOptions: {
14213
+ signal: l
14214
+ }
14215
+ }
14210
14216
  });
14211
- return new Promise((l) => {
14212
- let c, d = !1;
14213
- o.subscribe({
14214
- start(A) {
14215
- d ? A.unsubscribe() : c = A;
14216
- },
14217
- next(A) {
14218
- var h, m, g, p;
14219
- d = !0, c && c.unsubscribe();
14220
- const u = ((m = (h = A.data.productCollections) == null ? void 0 : h[0].productCollectionProductsFeed) == null ? void 0 : m.items.filter((f) => !!f.product).map((f) => new le(f))) || [];
14221
- l({
14222
- items: St(u),
14223
- total: ((p = (g = A.data.productCollections) == null ? void 0 : g[0].productCollectionProductsFeed) == null ? void 0 : p.total) ?? 0
14217
+ return new Promise((d) => {
14218
+ let A = !1;
14219
+ const u = c.subscribe({
14220
+ next(h) {
14221
+ var g, p, f, C, w, v;
14222
+ if (h.partial && (!h.data.productCollections || h.data.productCollections.length === 0 || !((g = h.data.productCollections[0].productCollectionProductsFeed) != null && g.items) || ((p = h.data.productCollections[0].productCollectionProductsFeed) == null ? void 0 : p.items.length) === 0))
14223
+ return;
14224
+ o.abort(), A = !0, u.unsubscribe();
14225
+ const m = ((C = (f = h.data.productCollections) == null ? void 0 : f[0].productCollectionProductsFeed) == null ? void 0 : C.items.filter((S) => !!S.product).map((S) => new le(S))) || [];
14226
+ d({
14227
+ items: St(m),
14228
+ // Clone items because it could be cached data (immutable)
14229
+ total: ((v = (w = h.data.productCollections) == null ? void 0 : w[0].productCollectionProductsFeed) == null ? void 0 : v.total) ?? 0
14224
14230
  });
14225
14231
  },
14226
14232
  error() {
14227
- d = !0, c && c.unsubscribe(), l({ items: [], total: 0 });
14233
+ A || (A = !0, u.unsubscribe(), d({ items: [], total: 0 }));
14228
14234
  }
14229
14235
  });
14230
14236
  });
@@ -15615,7 +15621,7 @@ class _c {
15615
15621
  } catch (a) {
15616
15622
  throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
15617
15623
  }
15618
- }, this.options = t, this.options.applicationKey && Mr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.38.0-beta.c075b660-81f1-5d25-b159-274e43a604e0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15624
+ }, this.options = t, this.options.applicationKey && Mr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.38.0-beta.95db9919-4320-51f8-986e-5467ea068975"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
15619
15625
  }
15620
15626
  configure(t) {
15621
15627
  mt.setHubUrl(t.hubUrl), mt.setServerUrl(t.serverUrl), mt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, t.bearerAuthenticationToken && Qr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration();