@swell/apps-sdk 1.0.159 → 1.0.160

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
@@ -720,7 +720,8 @@ var RESOURCE_CLONE_PROPS = Object.freeze([
720
720
  "_swell",
721
721
  "_params",
722
722
  "_id",
723
- "_resourceName"
723
+ "_resourceName",
724
+ "_result"
724
725
  ]);
725
726
  function cloneStorefrontResource(input) {
726
727
  const resourceName = input._resourceName || input.constructor?.name;
@@ -16137,8 +16138,15 @@ function convertToShopifySorting(value) {
16137
16138
  function getProducts(instance, object, mapper) {
16138
16139
  return deferWith(object, (object2) => {
16139
16140
  const { page, limit: limit2 } = instance.swell.queryParams;
16140
- const categoryFilter = object2.id && object2.id !== "all" ? object2.id : void 0;
16141
- const productQuery = categoryFilter ? { category: categoryFilter, $variants: true } : { $variants: true };
16141
+ const productQuery = {
16142
+ $variants: true
16143
+ };
16144
+ if (typeof object2.id === "string" && object2.id !== "all") {
16145
+ productQuery.category = object2.id;
16146
+ }
16147
+ if (object2.performed && typeof object2.query === "string") {
16148
+ productQuery.search = object2.query;
16149
+ }
16142
16150
  const filterQuery = productQueryWithFilters(instance.swell, productQuery);
16143
16151
  const products = new SwellStorefrontCollection(
16144
16152
  instance.swell,
@@ -16954,11 +16962,11 @@ function ShopifySearch(instance, search) {
16954
16962
  (filter) => ShopifyFilter(instance, filter)
16955
16963
  );
16956
16964
  }),
16957
- performed: defer(() => search.performed),
16965
+ performed: deferWith(search, (search2) => search2.performed),
16958
16966
  results: defer(async () => (await resolveProducts())?.results ?? []),
16959
16967
  results_count: defer(async () => (await resolveProducts())?.count || 0),
16960
16968
  sort_by: defer(() => search.sort),
16961
- sort_options: defer(() => search.sort_options),
16969
+ sort_options: deferWith(search, (search2) => search2.sort_options),
16962
16970
  terms: defer(() => search.query),
16963
16971
  types: ["product"]
16964
16972
  });