@swell/apps-sdk 1.0.156 → 1.0.157

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.js CHANGED
@@ -8188,28 +8188,6 @@
8188
8188
  }
8189
8189
  };
8190
8190
 
8191
- // src/resources/blog_category.ts
8192
- var SwellBlogCategory = class extends SwellStorefrontRecord {
8193
- constructor(swell, id, query) {
8194
- super(swell, "content/blog-categories", id, query, async function() {
8195
- const category = await this._defaultGetter().call(this);
8196
- if (!category) {
8197
- return null;
8198
- }
8199
- category.blogs = new SwellStorefrontCollection(
8200
- this._swell,
8201
- "content/blogs",
8202
- {
8203
- category_id: category.id,
8204
- expand: "author"
8205
- }
8206
- );
8207
- return category;
8208
- });
8209
- return this._getProxy();
8210
- }
8211
- };
8212
-
8213
8191
  // src/resources/blog.ts
8214
8192
  var SwellBlog = class extends SwellStorefrontRecord {
8215
8193
  constructor(swell, blogId, categoryId, query) {
@@ -8232,6 +8210,28 @@
8232
8210
  }
8233
8211
  };
8234
8212
 
8213
+ // src/resources/blog_category.ts
8214
+ var SwellBlogCategory = class extends SwellStorefrontRecord {
8215
+ constructor(swell, id, query) {
8216
+ super(swell, "content/blog-categories", id, query, async function() {
8217
+ const category = await this._defaultGetter().call(this);
8218
+ if (!category) {
8219
+ return null;
8220
+ }
8221
+ category.blogs = new SwellStorefrontCollection(
8222
+ this._swell,
8223
+ "content/blogs",
8224
+ {
8225
+ category_id: category.id,
8226
+ expand: "author"
8227
+ }
8228
+ );
8229
+ return category;
8230
+ });
8231
+ return this._getProxy();
8232
+ }
8233
+ };
8234
+
8235
8235
  // src/resources/cart.ts
8236
8236
  var SwellCart = class extends SwellStorefrontSingleton {
8237
8237
  constructor(swell) {
@@ -8240,35 +8240,6 @@
8240
8240
  }
8241
8241
  };
8242
8242
 
8243
- // src/resources/categories.ts
8244
- var SwellCategories = class extends SwellStorefrontCollection {
8245
- constructor(swell, query) {
8246
- super(
8247
- swell,
8248
- "categories",
8249
- {
8250
- limit: 100,
8251
- top_id: null,
8252
- ...query
8253
- },
8254
- async function() {
8255
- const categories = await this._defaultGetter().call(this);
8256
- if (!categories) {
8257
- return null;
8258
- }
8259
- for (const category of categories.results) {
8260
- category.products = new SwellStorefrontCollection(
8261
- this._swell,
8262
- "products",
8263
- { category: category.id }
8264
- );
8265
- }
8266
- return categories;
8267
- }
8268
- );
8269
- }
8270
- };
8271
-
8272
8243
  // src/resources/product_helpers.ts
8273
8244
  function isGiftcard(product) {
8274
8245
  return product.type === "giftcard";
@@ -8519,6 +8490,35 @@
8519
8490
  }
8520
8491
  };
8521
8492
 
8493
+ // src/resources/categories.ts
8494
+ var SwellCategories = class extends SwellStorefrontCollection {
8495
+ constructor(swell, query) {
8496
+ super(
8497
+ swell,
8498
+ "categories",
8499
+ {
8500
+ limit: 100,
8501
+ top_id: null,
8502
+ ...query
8503
+ },
8504
+ async function() {
8505
+ const categories = await this._defaultGetter().call(this);
8506
+ if (!categories) {
8507
+ return null;
8508
+ }
8509
+ for (const category of categories.results) {
8510
+ category.products = new SwellStorefrontCollection(
8511
+ this._swell,
8512
+ "products",
8513
+ { category: category.id }
8514
+ );
8515
+ }
8516
+ return categories;
8517
+ }
8518
+ );
8519
+ }
8520
+ };
8521
+
8522
8522
  // src/resources/order.ts
8523
8523
  var SwellOrder = class extends SwellStorefrontRecord {
8524
8524
  constructor(swell, id, query) {
@@ -8627,13 +8627,6 @@
8627
8627
  }
8628
8628
  };
8629
8629
 
8630
- // src/resources/product_recommendations.ts
8631
- var SwellProductRecommendations = class extends SwellProduct {
8632
- constructor(swell, id, query) {
8633
- super(swell, id, { ...query, $recommendations: true });
8634
- }
8635
- };
8636
-
8637
8630
  // src/resources/search.ts
8638
8631
  var SwellSearch = class extends StorefrontResource {
8639
8632
  constructor(swell, query) {
@@ -8661,6 +8654,40 @@
8661
8654
  }
8662
8655
  };
8663
8656
 
8657
+ // src/resources/index.ts
8658
+ var AccountResource = class extends SwellAccount {
8659
+ };
8660
+ var AccountAddressesResource = class extends SwellAddresses {
8661
+ };
8662
+ var BlogResource = class extends SwellBlog {
8663
+ };
8664
+ var BlogCategoryResource = class extends SwellBlogCategory {
8665
+ };
8666
+ var CartResource = class extends SwellCart {
8667
+ };
8668
+ var CategoryResource = class extends SwellCategory {
8669
+ };
8670
+ var CategoriesResource = class extends SwellCategories {
8671
+ };
8672
+ var AccountOrderResource = class extends SwellOrder {
8673
+ };
8674
+ var AccountOrdersResource = class extends SwellOrders {
8675
+ };
8676
+ var PageResource = class extends SwellPage {
8677
+ };
8678
+ var PredictiveSearchResource = class extends SwellPredictiveSearch {
8679
+ };
8680
+ var ProductResource = class extends SwellProduct {
8681
+ };
8682
+ var SearchResource = class extends SwellSearch {
8683
+ };
8684
+ var AccountSubscriptionResource = class extends SwellSubscription {
8685
+ };
8686
+ var AccountSubscriptionsResource = class extends SwellSubscriptions {
8687
+ };
8688
+ var VariantResource = class extends SwellVariant {
8689
+ };
8690
+
8664
8691
  // src/api.ts
8665
8692
  var DEFAULT_API_HOST = "https://api.schema.io";
8666
8693
  var resourceCaches = /* @__PURE__ */ new Map();
@@ -21173,8 +21200,8 @@ ${injects.join("\n")}<\/script>`;
21173
21200
  return result ?? defaultValue();
21174
21201
  }
21175
21202
  async fetchCart() {
21176
- const CartResource = this.resources?.singletons?.cart;
21177
- const cart = CartResource ? new CartResource(this.swell) : new SwellStorefrontSingleton(this.swell, "cart");
21203
+ const CartResource2 = this.resources?.singletons?.cart;
21204
+ const cart = CartResource2 ? new CartResource2(this.swell) : new SwellStorefrontSingleton(this.swell, "cart");
21178
21205
  cart._isEmpty = function() {
21179
21206
  return !this._result?.items?.length;
21180
21207
  };
@@ -21186,8 +21213,8 @@ ${injects.join("\n")}<\/script>`;
21186
21213
  return cart;
21187
21214
  }
21188
21215
  async fetchAccount() {
21189
- const AccountResource = this.resources?.singletons?.account;
21190
- const account = AccountResource ? new AccountResource(this.swell) : new SwellStorefrontSingleton(this.swell, "account");
21216
+ const AccountResource2 = this.resources?.singletons?.account;
21217
+ const account = AccountResource2 ? new AccountResource2(this.swell) : new SwellStorefrontSingleton(this.swell, "account");
21191
21218
  await account.id;
21192
21219
  if (!account?.id) {
21193
21220
  return null;