@spiffcommerce/core 26.26.1 → 26.27.0
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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +13 -5
- package/dist/index.js +10 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -24
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -9766,10 +9766,14 @@ const Fs = y`
|
|
|
9766
9766
|
}
|
|
9767
9767
|
}
|
|
9768
9768
|
`, Ts = y`
|
|
9769
|
-
query GetProductCollectionForFilteredProducts(
|
|
9769
|
+
query GetProductCollectionForFilteredProducts(
|
|
9770
|
+
$id: String!
|
|
9771
|
+
$filters: ProductCollectionProductFilterInput
|
|
9772
|
+
$tags: ProductCollectionProductTagFilterInput
|
|
9773
|
+
) {
|
|
9770
9774
|
productCollections(ids: [$id]) {
|
|
9771
9775
|
id
|
|
9772
|
-
productCollectionProducts(filters: $filters) {
|
|
9776
|
+
productCollectionProducts(filters: $filters, tags: $tags) {
|
|
9773
9777
|
id
|
|
9774
9778
|
product {
|
|
9775
9779
|
id
|
|
@@ -9784,10 +9788,11 @@ const Fs = y`
|
|
|
9784
9788
|
$limit: Int
|
|
9785
9789
|
$offset: Int
|
|
9786
9790
|
$filters: ProductCollectionProductFilterInput
|
|
9791
|
+
$tags: ProductCollectionProductTagFilterInput
|
|
9787
9792
|
) {
|
|
9788
9793
|
productCollections(ids: [$id]) {
|
|
9789
9794
|
id
|
|
9790
|
-
productCollectionProductsFeed(filters: $filters, limit: $limit, offset: $offset) {
|
|
9795
|
+
productCollectionProductsFeed(filters: $filters, tags: $tags, limit: $limit, offset: $offset) {
|
|
9791
9796
|
items {
|
|
9792
9797
|
...ProductCollectionProductFields
|
|
9793
9798
|
}
|
|
@@ -13967,46 +13972,52 @@ class Xo {
|
|
|
13967
13972
|
return t || (this.fullFetched = !0), this.collection.productCollectionProducts = e.data.productCollections[0].productCollectionProducts || [], this.collection.productCollectionProducts.filter((a) => !!a.product).map((a) => new se(a));
|
|
13968
13973
|
}
|
|
13969
13974
|
/**
|
|
13970
|
-
* Returns a list of collections products matching the associated metafield filters.
|
|
13971
|
-
* @param filters A list of filters to apply.
|
|
13975
|
+
* Returns a list of collections products matching the associated metafield/tag filters.
|
|
13976
|
+
* @param filters A list of metafield filters to apply.
|
|
13977
|
+
* @param tags An object of tag filters to apply.
|
|
13972
13978
|
*/
|
|
13973
|
-
async filterProducts(t) {
|
|
13974
|
-
var
|
|
13975
|
-
const
|
|
13979
|
+
async filterProducts(t, e) {
|
|
13980
|
+
var s, o;
|
|
13981
|
+
const a = await b.getShadowGraphqlClient().query({
|
|
13976
13982
|
query: Ts,
|
|
13977
13983
|
errorPolicy: "all",
|
|
13978
13984
|
variables: {
|
|
13979
13985
|
id: this.getId(),
|
|
13980
|
-
filters: {
|
|
13986
|
+
filters: t ? {
|
|
13981
13987
|
link: "And",
|
|
13982
13988
|
metafields: t
|
|
13983
|
-
}
|
|
13989
|
+
} : void 0,
|
|
13990
|
+
tags: e ? {
|
|
13991
|
+
include: e.include ?? [],
|
|
13992
|
+
exclude: e.exclude ?? []
|
|
13993
|
+
} : void 0
|
|
13984
13994
|
}
|
|
13985
13995
|
});
|
|
13986
|
-
if (!((
|
|
13996
|
+
if (!((s = a.data) != null && s.productCollections) || ((o = a.data) == null ? void 0 : o.productCollections.length) === 0)
|
|
13987
13997
|
throw new Error("Failed to filter product collection products.");
|
|
13988
|
-
const
|
|
13989
|
-
(
|
|
13998
|
+
const n = this.getProducts(), i = a.data.productCollections[0].productCollectionProducts.map(
|
|
13999
|
+
(l) => l.product.id
|
|
13990
14000
|
);
|
|
13991
|
-
return
|
|
14001
|
+
return n.filter((l) => i.includes(l.getId()));
|
|
13992
14002
|
}
|
|
13993
14003
|
/**
|
|
13994
14004
|
* Fetches a paginated feed of products.
|
|
13995
14005
|
* @param offset The zero-based start index.
|
|
13996
14006
|
* @param limit The maximum number of products to return.
|
|
13997
|
-
* @param filters Optional filters to apply to the query.
|
|
14007
|
+
* @param filters Optional metafield filters to apply to the query.
|
|
14008
|
+
* @param tags Optional object of tag filters to apply.
|
|
13998
14009
|
* @returns
|
|
13999
14010
|
*/
|
|
14000
|
-
async fetchProductsFeed(t, e, a) {
|
|
14001
|
-
var
|
|
14011
|
+
async fetchProductsFeed(t, e, a, n) {
|
|
14012
|
+
var o, l, c, d, A, u;
|
|
14002
14013
|
if (this.fullFetched) {
|
|
14003
|
-
const
|
|
14014
|
+
const h = await (a ? this.filterProducts(a) : this.fetchProducts());
|
|
14004
14015
|
return {
|
|
14005
|
-
total:
|
|
14006
|
-
items:
|
|
14016
|
+
total: h.length,
|
|
14017
|
+
items: h.slice(t, t + e)
|
|
14007
14018
|
};
|
|
14008
14019
|
}
|
|
14009
|
-
const
|
|
14020
|
+
const i = await b.getShadowGraphqlClient().query({
|
|
14010
14021
|
query: Qs,
|
|
14011
14022
|
variables: {
|
|
14012
14023
|
id: this.getId(),
|
|
@@ -14015,13 +14026,17 @@ class Xo {
|
|
|
14015
14026
|
filters: a ? {
|
|
14016
14027
|
link: "And",
|
|
14017
14028
|
metafields: a
|
|
14029
|
+
} : void 0,
|
|
14030
|
+
tags: n ? {
|
|
14031
|
+
include: n.include ?? [],
|
|
14032
|
+
exclude: n.exclude ?? []
|
|
14018
14033
|
} : void 0
|
|
14019
14034
|
},
|
|
14020
14035
|
errorPolicy: "all"
|
|
14021
14036
|
});
|
|
14022
14037
|
return {
|
|
14023
|
-
items: ((
|
|
14024
|
-
total: ((
|
|
14038
|
+
items: ((c = (l = (o = i == null ? void 0 : i.data) == null ? void 0 : o.productCollections) == null ? void 0 : l[0].productCollectionProductsFeed) == null ? void 0 : c.items.filter((h) => !!h.product).map((h) => new se(h))) || [],
|
|
14039
|
+
total: ((u = (A = (d = i == null ? void 0 : i.data) == null ? void 0 : d.productCollections) == null ? void 0 : A[0].productCollectionProductsFeed) == null ? void 0 : u.total) ?? 0
|
|
14025
14040
|
};
|
|
14026
14041
|
}
|
|
14027
14042
|
getTransformCollection() {
|
|
@@ -15363,7 +15378,7 @@ class Nc {
|
|
|
15363
15378
|
} catch (a) {
|
|
15364
15379
|
throw console.error(a), new ut("Critical - Unable to synchronize workflow state with server.");
|
|
15365
15380
|
}
|
|
15366
|
-
}, this.options = t, this.options.applicationKey && Fr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.
|
|
15381
|
+
}, this.options = t, this.options.applicationKey && Fr(this.options.applicationKey), console.debug("------------------------"), console.debug("Spiff Commerce Core SDK"), console.debug("Version: 26.27.0"), console.debug(`Application Key Provided: ${!!this.options.applicationKey}`), console.debug("------------------------");
|
|
15367
15382
|
}
|
|
15368
15383
|
configure(t) {
|
|
15369
15384
|
wt.setHubUrl(t.hubUrl), wt.setServerUrl(t.serverUrl), wt.setServicesApiUrl(t.servicesApiUrl), this.marketplaceThemeInstallId = t.marketplaceThemeInstallId, this.marketplaceThemeInstallConfigurationId = t.marketplaceThemeInstallConfigurationId, t.bearerAuthenticationToken && kr(t.bearerAuthenticationToken), this.options.applicationKey && this.getIntegration();
|