@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.cjs CHANGED
@@ -866,7 +866,8 @@ var RESOURCE_CLONE_PROPS = Object.freeze([
866
866
  "_swell",
867
867
  "_params",
868
868
  "_id",
869
- "_resourceName"
869
+ "_resourceName",
870
+ "_result"
870
871
  ]);
871
872
  function cloneStorefrontResource(input) {
872
873
  const resourceName = input._resourceName || input.constructor?.name;
@@ -16283,8 +16284,15 @@ function convertToShopifySorting(value) {
16283
16284
  function getProducts(instance, object, mapper) {
16284
16285
  return deferWith(object, (object2) => {
16285
16286
  const { page, limit: limit2 } = instance.swell.queryParams;
16286
- const categoryFilter = object2.id && object2.id !== "all" ? object2.id : void 0;
16287
- const productQuery = categoryFilter ? { category: categoryFilter, $variants: true } : { $variants: true };
16287
+ const productQuery = {
16288
+ $variants: true
16289
+ };
16290
+ if (typeof object2.id === "string" && object2.id !== "all") {
16291
+ productQuery.category = object2.id;
16292
+ }
16293
+ if (object2.performed && typeof object2.query === "string") {
16294
+ productQuery.search = object2.query;
16295
+ }
16288
16296
  const filterQuery = productQueryWithFilters(instance.swell, productQuery);
16289
16297
  const products = new SwellStorefrontCollection(
16290
16298
  instance.swell,
@@ -17100,11 +17108,11 @@ function ShopifySearch(instance, search) {
17100
17108
  (filter) => ShopifyFilter(instance, filter)
17101
17109
  );
17102
17110
  }),
17103
- performed: defer(() => search.performed),
17111
+ performed: deferWith(search, (search2) => search2.performed),
17104
17112
  results: defer(async () => (await resolveProducts())?.results ?? []),
17105
17113
  results_count: defer(async () => (await resolveProducts())?.count || 0),
17106
17114
  sort_by: defer(() => search.sort),
17107
- sort_options: defer(() => search.sort_options),
17115
+ sort_options: deferWith(search, (search2) => search2.sort_options),
17108
17116
  terms: defer(() => search.query),
17109
17117
  types: ["product"]
17110
17118
  });