@swell/apps-sdk 1.0.156 → 1.0.158
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 +146 -105
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +114 -71
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +130 -88
- package/dist/index.mjs.map +4 -4
- package/dist/src/resources/index.d.ts +34 -4
- package/dist/types/shopify.d.ts +1 -1
- package/package.json +1 -1
- package/dist/src/resources/product_recommendations.d.ts +0 -6
package/dist/index.cjs
CHANGED
|
@@ -30,7 +30,18 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
30
30
|
// src/index.ts
|
|
31
31
|
var index_exports = {};
|
|
32
32
|
__export(index_exports, {
|
|
33
|
+
AccountAddressesResource: () => AccountAddressesResource,
|
|
34
|
+
AccountOrderResource: () => AccountOrderResource,
|
|
35
|
+
AccountOrdersResource: () => AccountOrdersResource,
|
|
36
|
+
AccountResource: () => AccountResource,
|
|
37
|
+
AccountSubscriptionResource: () => AccountSubscriptionResource,
|
|
38
|
+
AccountSubscriptionsResource: () => AccountSubscriptionsResource,
|
|
39
|
+
BlogCategoryResource: () => BlogCategoryResource,
|
|
40
|
+
BlogResource: () => BlogResource,
|
|
33
41
|
CURRENCY_COUNTRIES: () => CURRENCY_COUNTRIES,
|
|
42
|
+
CartResource: () => CartResource,
|
|
43
|
+
CategoriesResource: () => CategoriesResource,
|
|
44
|
+
CategoryResource: () => CategoryResource,
|
|
34
45
|
DEFAULT_QUERY_PAGE_LIMIT: () => DEFAULT_QUERY_PAGE_LIMIT,
|
|
35
46
|
DeferredShopifyResource: () => DeferredShopifyResource,
|
|
36
47
|
FILE_DATA_INCLUDE_QUERY: () => FILE_DATA_INCLUDE_QUERY,
|
|
@@ -42,7 +53,11 @@ __export(index_exports, {
|
|
|
42
53
|
MockRecordSingleton: () => MockRecordSingleton,
|
|
43
54
|
PageError: () => PageError,
|
|
44
55
|
PageNotFound: () => PageNotFound,
|
|
56
|
+
PageResource: () => PageResource,
|
|
57
|
+
PredictiveSearchResource: () => PredictiveSearchResource,
|
|
58
|
+
ProductResource: () => ProductResource,
|
|
45
59
|
SECTION_GROUP_CONTENT: () => SECTION_GROUP_CONTENT,
|
|
60
|
+
SearchResource: () => SearchResource,
|
|
46
61
|
ShopifyArticle: () => ShopifyArticle,
|
|
47
62
|
ShopifyBlog: () => ShopifyBlog,
|
|
48
63
|
ShopifyCart: () => ShopifyCart,
|
|
@@ -65,35 +80,19 @@ __export(index_exports, {
|
|
|
65
80
|
ShopifyVariant: () => ShopifyVariant,
|
|
66
81
|
StorefrontResource: () => StorefrontResource,
|
|
67
82
|
Swell: () => Swell,
|
|
68
|
-
SwellAccount: () => SwellAccount,
|
|
69
|
-
SwellAddresses: () => SwellAddresses,
|
|
70
83
|
SwellBackendAPI: () => SwellBackendAPI,
|
|
71
|
-
SwellBlog: () => SwellBlog,
|
|
72
|
-
SwellBlogCategory: () => SwellBlogCategory,
|
|
73
|
-
SwellCart: () => SwellCart,
|
|
74
|
-
SwellCategories: () => SwellCategories,
|
|
75
|
-
SwellCategory: () => SwellCategory,
|
|
76
84
|
SwellError: () => SwellError,
|
|
77
|
-
SwellOrder: () => SwellOrder,
|
|
78
|
-
SwellOrders: () => SwellOrders,
|
|
79
|
-
SwellPage: () => SwellPage,
|
|
80
|
-
SwellPredictiveSearch: () => SwellPredictiveSearch,
|
|
81
|
-
SwellProduct: () => SwellProduct,
|
|
82
|
-
SwellProductRecommendations: () => SwellProductRecommendations,
|
|
83
|
-
SwellSearch: () => SwellSearch,
|
|
84
85
|
SwellStorefrontCollection: () => SwellStorefrontCollection,
|
|
85
86
|
SwellStorefrontPagination: () => SwellStorefrontPagination,
|
|
86
87
|
SwellStorefrontRecord: () => SwellStorefrontRecord,
|
|
87
88
|
SwellStorefrontResource: () => SwellStorefrontResource,
|
|
88
89
|
SwellStorefrontSingleton: () => SwellStorefrontSingleton,
|
|
89
|
-
SwellSubscription: () => SwellSubscription,
|
|
90
|
-
SwellSubscriptions: () => SwellSubscriptions,
|
|
91
90
|
SwellTheme: () => SwellTheme3,
|
|
92
|
-
SwellVariant: () => SwellVariant,
|
|
93
91
|
ThemeColor: () => ThemeColor,
|
|
94
92
|
ThemeFont: () => ThemeFont,
|
|
95
93
|
ThemeForm: () => ThemeForm,
|
|
96
94
|
ThemeFormErrors: () => ThemeFormErrors,
|
|
95
|
+
VariantResource: () => VariantResource,
|
|
97
96
|
WorkerHtmlCache: () => WorkerHtmlCache,
|
|
98
97
|
adaptShopifyFontData: () => adaptShopifyFontData,
|
|
99
98
|
adaptShopifyFormData: () => adaptShopifyFormData,
|
|
@@ -865,7 +864,6 @@ var RESOURCE_CLONE_PROPS = Object.freeze([
|
|
|
865
864
|
"_getResourceObject",
|
|
866
865
|
"_collection",
|
|
867
866
|
"_swell",
|
|
868
|
-
"_query",
|
|
869
867
|
"_params",
|
|
870
868
|
"_id",
|
|
871
869
|
"_resourceName"
|
|
@@ -8308,28 +8306,6 @@ var SwellAccount = class extends SwellStorefrontSingleton {
|
|
|
8308
8306
|
}
|
|
8309
8307
|
};
|
|
8310
8308
|
|
|
8311
|
-
// src/resources/blog_category.ts
|
|
8312
|
-
var SwellBlogCategory = class extends SwellStorefrontRecord {
|
|
8313
|
-
constructor(swell, id, query) {
|
|
8314
|
-
super(swell, "content/blog-categories", id, query, async function() {
|
|
8315
|
-
const category = await this._defaultGetter().call(this);
|
|
8316
|
-
if (!category) {
|
|
8317
|
-
return null;
|
|
8318
|
-
}
|
|
8319
|
-
category.blogs = new SwellStorefrontCollection(
|
|
8320
|
-
this._swell,
|
|
8321
|
-
"content/blogs",
|
|
8322
|
-
{
|
|
8323
|
-
category_id: category.id,
|
|
8324
|
-
expand: "author"
|
|
8325
|
-
}
|
|
8326
|
-
);
|
|
8327
|
-
return category;
|
|
8328
|
-
});
|
|
8329
|
-
return this._getProxy();
|
|
8330
|
-
}
|
|
8331
|
-
};
|
|
8332
|
-
|
|
8333
8309
|
// src/resources/blog.ts
|
|
8334
8310
|
var SwellBlog = class extends SwellStorefrontRecord {
|
|
8335
8311
|
constructor(swell, blogId, categoryId, query) {
|
|
@@ -8352,6 +8328,28 @@ var SwellBlog = class extends SwellStorefrontRecord {
|
|
|
8352
8328
|
}
|
|
8353
8329
|
};
|
|
8354
8330
|
|
|
8331
|
+
// src/resources/blog_category.ts
|
|
8332
|
+
var SwellBlogCategory = class extends SwellStorefrontRecord {
|
|
8333
|
+
constructor(swell, id, query) {
|
|
8334
|
+
super(swell, "content/blog-categories", id, query, async function() {
|
|
8335
|
+
const category = await this._defaultGetter().call(this);
|
|
8336
|
+
if (!category) {
|
|
8337
|
+
return null;
|
|
8338
|
+
}
|
|
8339
|
+
category.blogs = new SwellStorefrontCollection(
|
|
8340
|
+
this._swell,
|
|
8341
|
+
"content/blogs",
|
|
8342
|
+
{
|
|
8343
|
+
category_id: category.id,
|
|
8344
|
+
expand: "author"
|
|
8345
|
+
}
|
|
8346
|
+
);
|
|
8347
|
+
return category;
|
|
8348
|
+
});
|
|
8349
|
+
return this._getProxy();
|
|
8350
|
+
}
|
|
8351
|
+
};
|
|
8352
|
+
|
|
8355
8353
|
// src/resources/cart.ts
|
|
8356
8354
|
var SwellCart = class extends SwellStorefrontSingleton {
|
|
8357
8355
|
constructor(swell) {
|
|
@@ -8360,35 +8358,6 @@ var SwellCart = class extends SwellStorefrontSingleton {
|
|
|
8360
8358
|
}
|
|
8361
8359
|
};
|
|
8362
8360
|
|
|
8363
|
-
// src/resources/categories.ts
|
|
8364
|
-
var SwellCategories = class extends SwellStorefrontCollection {
|
|
8365
|
-
constructor(swell, query) {
|
|
8366
|
-
super(
|
|
8367
|
-
swell,
|
|
8368
|
-
"categories",
|
|
8369
|
-
{
|
|
8370
|
-
limit: 100,
|
|
8371
|
-
top_id: null,
|
|
8372
|
-
...query
|
|
8373
|
-
},
|
|
8374
|
-
async function() {
|
|
8375
|
-
const categories = await this._defaultGetter().call(this);
|
|
8376
|
-
if (!categories) {
|
|
8377
|
-
return null;
|
|
8378
|
-
}
|
|
8379
|
-
for (const category of categories.results) {
|
|
8380
|
-
category.products = new SwellStorefrontCollection(
|
|
8381
|
-
this._swell,
|
|
8382
|
-
"products",
|
|
8383
|
-
{ category: category.id }
|
|
8384
|
-
);
|
|
8385
|
-
}
|
|
8386
|
-
return categories;
|
|
8387
|
-
}
|
|
8388
|
-
);
|
|
8389
|
-
}
|
|
8390
|
-
};
|
|
8391
|
-
|
|
8392
8361
|
// src/resources/product_helpers.ts
|
|
8393
8362
|
function isGiftcard(product) {
|
|
8394
8363
|
return product.type === "giftcard";
|
|
@@ -8639,6 +8608,35 @@ var SwellCategory = class extends SwellStorefrontRecord {
|
|
|
8639
8608
|
}
|
|
8640
8609
|
};
|
|
8641
8610
|
|
|
8611
|
+
// src/resources/categories.ts
|
|
8612
|
+
var SwellCategories = class extends SwellStorefrontCollection {
|
|
8613
|
+
constructor(swell, query) {
|
|
8614
|
+
super(
|
|
8615
|
+
swell,
|
|
8616
|
+
"categories",
|
|
8617
|
+
{
|
|
8618
|
+
limit: 100,
|
|
8619
|
+
top_id: null,
|
|
8620
|
+
...query
|
|
8621
|
+
},
|
|
8622
|
+
async function() {
|
|
8623
|
+
const categories = await this._defaultGetter().call(this);
|
|
8624
|
+
if (!categories) {
|
|
8625
|
+
return null;
|
|
8626
|
+
}
|
|
8627
|
+
for (const category of categories.results) {
|
|
8628
|
+
category.products = new SwellStorefrontCollection(
|
|
8629
|
+
this._swell,
|
|
8630
|
+
"products",
|
|
8631
|
+
{ category: category.id }
|
|
8632
|
+
);
|
|
8633
|
+
}
|
|
8634
|
+
return categories;
|
|
8635
|
+
}
|
|
8636
|
+
);
|
|
8637
|
+
}
|
|
8638
|
+
};
|
|
8639
|
+
|
|
8642
8640
|
// src/resources/order.ts
|
|
8643
8641
|
var SwellOrder = class extends SwellStorefrontRecord {
|
|
8644
8642
|
constructor(swell, id, query) {
|
|
@@ -8747,13 +8745,6 @@ var SwellProduct = class extends SwellStorefrontRecord {
|
|
|
8747
8745
|
}
|
|
8748
8746
|
};
|
|
8749
8747
|
|
|
8750
|
-
// src/resources/product_recommendations.ts
|
|
8751
|
-
var SwellProductRecommendations = class extends SwellProduct {
|
|
8752
|
-
constructor(swell, id, query) {
|
|
8753
|
-
super(swell, id, { ...query, $recommendations: true });
|
|
8754
|
-
}
|
|
8755
|
-
};
|
|
8756
|
-
|
|
8757
8748
|
// src/resources/search.ts
|
|
8758
8749
|
var SwellSearch = class extends StorefrontResource {
|
|
8759
8750
|
constructor(swell, query) {
|
|
@@ -8781,6 +8772,40 @@ var SwellSubscription = class extends SwellStorefrontRecord {
|
|
|
8781
8772
|
}
|
|
8782
8773
|
};
|
|
8783
8774
|
|
|
8775
|
+
// src/resources/index.ts
|
|
8776
|
+
var AccountResource = class extends SwellAccount {
|
|
8777
|
+
};
|
|
8778
|
+
var AccountAddressesResource = class extends SwellAddresses {
|
|
8779
|
+
};
|
|
8780
|
+
var BlogResource = class extends SwellBlog {
|
|
8781
|
+
};
|
|
8782
|
+
var BlogCategoryResource = class extends SwellBlogCategory {
|
|
8783
|
+
};
|
|
8784
|
+
var CartResource = class extends SwellCart {
|
|
8785
|
+
};
|
|
8786
|
+
var CategoryResource = class extends SwellCategory {
|
|
8787
|
+
};
|
|
8788
|
+
var CategoriesResource = class extends SwellCategories {
|
|
8789
|
+
};
|
|
8790
|
+
var AccountOrderResource = class extends SwellOrder {
|
|
8791
|
+
};
|
|
8792
|
+
var AccountOrdersResource = class extends SwellOrders {
|
|
8793
|
+
};
|
|
8794
|
+
var PageResource = class extends SwellPage {
|
|
8795
|
+
};
|
|
8796
|
+
var PredictiveSearchResource = class extends SwellPredictiveSearch {
|
|
8797
|
+
};
|
|
8798
|
+
var ProductResource = class extends SwellProduct {
|
|
8799
|
+
};
|
|
8800
|
+
var SearchResource = class extends SwellSearch {
|
|
8801
|
+
};
|
|
8802
|
+
var AccountSubscriptionResource = class extends SwellSubscription {
|
|
8803
|
+
};
|
|
8804
|
+
var AccountSubscriptionsResource = class extends SwellSubscriptions {
|
|
8805
|
+
};
|
|
8806
|
+
var VariantResource = class extends SwellVariant {
|
|
8807
|
+
};
|
|
8808
|
+
|
|
8784
8809
|
// src/api.ts
|
|
8785
8810
|
var DEFAULT_API_HOST = "https://api.schema.io";
|
|
8786
8811
|
var resourceCaches = /* @__PURE__ */ new Map();
|
|
@@ -15386,15 +15411,32 @@ function ShopifyBlog(instance, blogCategory) {
|
|
|
15386
15411
|
return new ShopifyResource({
|
|
15387
15412
|
all_tags: allTags,
|
|
15388
15413
|
articles: deferWith(blogCategory, (blogCategory2) => {
|
|
15389
|
-
|
|
15390
|
-
|
|
15391
|
-
|
|
15392
|
-
|
|
15393
|
-
|
|
15394
|
-
|
|
15395
|
-
|
|
15414
|
+
const { page, limit: limit2 } = instance.swell.queryParams;
|
|
15415
|
+
const categoryBlogs = new SwellStorefrontCollection(
|
|
15416
|
+
instance.swell,
|
|
15417
|
+
"content/blogs",
|
|
15418
|
+
{
|
|
15419
|
+
page,
|
|
15420
|
+
limit: limit2,
|
|
15421
|
+
category_id: blogCategory2.id,
|
|
15422
|
+
expand: "author"
|
|
15423
|
+
},
|
|
15424
|
+
async function() {
|
|
15425
|
+
return this._defaultGetter().call(this);
|
|
15396
15426
|
}
|
|
15397
|
-
)
|
|
15427
|
+
);
|
|
15428
|
+
return categoryBlogs._cloneWithCompatibilityResult((blogs) => {
|
|
15429
|
+
return {
|
|
15430
|
+
...blogs,
|
|
15431
|
+
results: blogs?.results?.map(
|
|
15432
|
+
(blog) => ShopifyArticle(
|
|
15433
|
+
instance,
|
|
15434
|
+
blog,
|
|
15435
|
+
blogCategory2
|
|
15436
|
+
)
|
|
15437
|
+
)
|
|
15438
|
+
};
|
|
15439
|
+
}) || [];
|
|
15398
15440
|
}),
|
|
15399
15441
|
articles_count: deferWith(blogCategory.blogs, (blogs) => blogs?.count || 0),
|
|
15400
15442
|
handle: defer(() => blogCategory.slug),
|
|
@@ -21293,8 +21335,8 @@ var SwellTheme3 = class {
|
|
|
21293
21335
|
return result ?? defaultValue();
|
|
21294
21336
|
}
|
|
21295
21337
|
async fetchCart() {
|
|
21296
|
-
const
|
|
21297
|
-
const cart =
|
|
21338
|
+
const CartResource2 = this.resources?.singletons?.cart;
|
|
21339
|
+
const cart = CartResource2 ? new CartResource2(this.swell) : new SwellStorefrontSingleton(this.swell, "cart");
|
|
21298
21340
|
cart._isEmpty = function() {
|
|
21299
21341
|
return !this._result?.items?.length;
|
|
21300
21342
|
};
|
|
@@ -21306,8 +21348,8 @@ var SwellTheme3 = class {
|
|
|
21306
21348
|
return cart;
|
|
21307
21349
|
}
|
|
21308
21350
|
async fetchAccount() {
|
|
21309
|
-
const
|
|
21310
|
-
const account =
|
|
21351
|
+
const AccountResource2 = this.resources?.singletons?.account;
|
|
21352
|
+
const account = AccountResource2 ? new AccountResource2(this.swell) : new SwellStorefrontSingleton(this.swell, "account");
|
|
21311
21353
|
await account.id;
|
|
21312
21354
|
if (!account?.id) {
|
|
21313
21355
|
return null;
|
|
@@ -22897,7 +22939,18 @@ function getResourceQuery(slug, query) {
|
|
|
22897
22939
|
}
|
|
22898
22940
|
// Annotate the CommonJS export names for ESM import in node:
|
|
22899
22941
|
0 && (module.exports = {
|
|
22942
|
+
AccountAddressesResource,
|
|
22943
|
+
AccountOrderResource,
|
|
22944
|
+
AccountOrdersResource,
|
|
22945
|
+
AccountResource,
|
|
22946
|
+
AccountSubscriptionResource,
|
|
22947
|
+
AccountSubscriptionsResource,
|
|
22948
|
+
BlogCategoryResource,
|
|
22949
|
+
BlogResource,
|
|
22900
22950
|
CURRENCY_COUNTRIES,
|
|
22951
|
+
CartResource,
|
|
22952
|
+
CategoriesResource,
|
|
22953
|
+
CategoryResource,
|
|
22901
22954
|
DEFAULT_QUERY_PAGE_LIMIT,
|
|
22902
22955
|
DeferredShopifyResource,
|
|
22903
22956
|
FILE_DATA_INCLUDE_QUERY,
|
|
@@ -22909,7 +22962,11 @@ function getResourceQuery(slug, query) {
|
|
|
22909
22962
|
MockRecordSingleton,
|
|
22910
22963
|
PageError,
|
|
22911
22964
|
PageNotFound,
|
|
22965
|
+
PageResource,
|
|
22966
|
+
PredictiveSearchResource,
|
|
22967
|
+
ProductResource,
|
|
22912
22968
|
SECTION_GROUP_CONTENT,
|
|
22969
|
+
SearchResource,
|
|
22913
22970
|
ShopifyArticle,
|
|
22914
22971
|
ShopifyBlog,
|
|
22915
22972
|
ShopifyCart,
|
|
@@ -22932,35 +22989,19 @@ function getResourceQuery(slug, query) {
|
|
|
22932
22989
|
ShopifyVariant,
|
|
22933
22990
|
StorefrontResource,
|
|
22934
22991
|
Swell,
|
|
22935
|
-
SwellAccount,
|
|
22936
|
-
SwellAddresses,
|
|
22937
22992
|
SwellBackendAPI,
|
|
22938
|
-
SwellBlog,
|
|
22939
|
-
SwellBlogCategory,
|
|
22940
|
-
SwellCart,
|
|
22941
|
-
SwellCategories,
|
|
22942
|
-
SwellCategory,
|
|
22943
22993
|
SwellError,
|
|
22944
|
-
SwellOrder,
|
|
22945
|
-
SwellOrders,
|
|
22946
|
-
SwellPage,
|
|
22947
|
-
SwellPredictiveSearch,
|
|
22948
|
-
SwellProduct,
|
|
22949
|
-
SwellProductRecommendations,
|
|
22950
|
-
SwellSearch,
|
|
22951
22994
|
SwellStorefrontCollection,
|
|
22952
22995
|
SwellStorefrontPagination,
|
|
22953
22996
|
SwellStorefrontRecord,
|
|
22954
22997
|
SwellStorefrontResource,
|
|
22955
22998
|
SwellStorefrontSingleton,
|
|
22956
|
-
SwellSubscription,
|
|
22957
|
-
SwellSubscriptions,
|
|
22958
22999
|
SwellTheme,
|
|
22959
|
-
SwellVariant,
|
|
22960
23000
|
ThemeColor,
|
|
22961
23001
|
ThemeFont,
|
|
22962
23002
|
ThemeForm,
|
|
22963
23003
|
ThemeFormErrors,
|
|
23004
|
+
VariantResource,
|
|
22964
23005
|
WorkerHtmlCache,
|
|
22965
23006
|
adaptShopifyFontData,
|
|
22966
23007
|
adaptShopifyFormData,
|