@swell/apps-sdk 1.0.150 → 1.0.151
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 +353 -105
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +335 -105
- package/dist/index.js.map +4 -4
- package/dist/index.mjs +344 -105
- package/dist/index.mjs.map +4 -4
- package/dist/src/compatibility/drops/all_products.d.ts +1 -1
- package/dist/src/compatibility/drops/articles.d.ts +1 -1
- package/dist/src/compatibility/drops/blogs.d.ts +1 -1
- package/dist/src/compatibility/drops/collections.d.ts +2 -3
- package/dist/src/compatibility/drops/images.d.ts +1 -1
- package/dist/src/compatibility/drops/pages.d.ts +2 -3
- package/dist/src/compatibility/shopify-objects/collections.d.ts +2 -2
- package/dist/src/content.d.ts +3 -3
- package/dist/src/liquid/filters/shopify/default_pagination.d.ts +1 -1
- package/dist/src/resources/account.d.ts +4 -4
- package/dist/src/resources/addresses.d.ts +7 -0
- package/dist/src/resources/blog.d.ts +5 -4
- package/dist/src/resources/blog_category.d.ts +5 -4
- package/dist/src/resources/cart.d.ts +4 -4
- package/dist/src/resources/categories.d.ts +7 -0
- package/dist/src/resources/category.d.ts +5 -4
- package/dist/src/resources/index.d.ts +18 -9
- package/dist/src/resources/order.d.ts +5 -4
- package/dist/src/resources/orders.d.ts +7 -0
- package/dist/src/resources/page.d.ts +5 -4
- package/dist/src/resources/predictive_search.d.ts +6 -0
- package/dist/src/resources/product.d.ts +5 -19
- package/dist/src/resources/product_helpers.d.ts +12 -2
- package/dist/src/resources/product_recommendations.d.ts +6 -0
- package/dist/src/resources/search.d.ts +6 -0
- package/dist/src/resources/subscription.d.ts +7 -0
- package/dist/src/resources/subscriptions.d.ts +7 -0
- package/dist/src/resources/swell_types.d.ts +66 -9
- package/dist/src/resources/variant.d.ts +8 -8
- package/dist/src/resources.d.ts +11 -12
- package/dist/types/shopify.d.ts +2 -2
- package/dist/types/swell.d.ts +3 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Drop } from 'liquidjs';
|
|
2
|
-
import { ShopifyResource } from '../shopify-objects';
|
|
2
|
+
import { type ShopifyResource } from '../shopify-objects';
|
|
3
3
|
import type { ShopifyCompatibility } from '../shopify';
|
|
4
4
|
import type { ShopifyProduct as ShopifyProductType } from 'types/shopify';
|
|
5
5
|
export default class AllProductsDrop extends Drop {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Drop } from 'liquidjs';
|
|
2
|
-
import { ShopifyResource } from '../shopify-objects';
|
|
2
|
+
import { type ShopifyResource } from '../shopify-objects';
|
|
3
3
|
import type { ShopifyCompatibility } from '../shopify';
|
|
4
4
|
import type { ShopifyArticle as ShopifyArticleType } from 'types/shopify';
|
|
5
5
|
export default class ArticlesDrop extends Drop {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Drop } from 'liquidjs';
|
|
2
|
-
import { ShopifyResource } from '../shopify-objects';
|
|
2
|
+
import { type ShopifyResource } from '../shopify-objects';
|
|
3
3
|
import type { ShopifyCompatibility } from '../shopify';
|
|
4
4
|
import type { ShopifyBlog as ShopifyBlogType } from 'types/shopify';
|
|
5
5
|
export default class BlogsDrop extends Drop {
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { Drop } from 'liquidjs';
|
|
2
2
|
import { SwellStorefrontCollection } from '@/resources';
|
|
3
|
-
import { ShopifyResource } from '../shopify-objects';
|
|
3
|
+
import { type ShopifyResource } from '../shopify-objects';
|
|
4
4
|
import type { ShopifyCompatibility } from '../shopify';
|
|
5
|
-
import type { SwellCollection } from 'types/swell';
|
|
6
5
|
import type { ShopifyCollection as ShopifyCollectionType } from 'types/shopify';
|
|
7
6
|
declare class CollectionsDrop extends Drop {
|
|
8
7
|
#private;
|
|
@@ -10,7 +9,7 @@ declare class CollectionsDrop extends Drop {
|
|
|
10
9
|
liquidMethodMissing(key: unknown): unknown;
|
|
11
10
|
getCollection(slug: string): ShopifyResource<ShopifyCollectionType>;
|
|
12
11
|
}
|
|
13
|
-
export default class Collections extends SwellStorefrontCollection<
|
|
12
|
+
export default class Collections extends SwellStorefrontCollection<ShopifyCollectionType> {
|
|
14
13
|
#private;
|
|
15
14
|
constructor(instance: ShopifyCompatibility);
|
|
16
15
|
toLiquid(): CollectionsDrop;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Drop } from 'liquidjs';
|
|
2
|
-
import { ShopifyResource } from '../shopify-objects';
|
|
3
2
|
import type { ShopifyCompatibility } from '../shopify';
|
|
3
|
+
import type { ShopifyResource } from '../shopify-objects';
|
|
4
4
|
import type { ShopifyImage as ShopifyImageType } from 'types/shopify';
|
|
5
5
|
export default class ImagesDrop extends Drop {
|
|
6
6
|
#private;
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { Drop } from 'liquidjs';
|
|
2
2
|
import { SwellStorefrontCollection } from '@/resources';
|
|
3
|
-
import { ShopifyResource } from '../shopify-objects';
|
|
3
|
+
import { type ShopifyResource } from '../shopify-objects';
|
|
4
4
|
import type { ShopifyCompatibility } from '../shopify';
|
|
5
5
|
import type { ShopifyPageObject } from 'types/shopify';
|
|
6
|
-
import type { SwellCollection } from 'types/swell';
|
|
7
6
|
declare class PagesDrop extends Drop {
|
|
8
7
|
#private;
|
|
9
8
|
constructor(instance: ShopifyCompatibility);
|
|
10
9
|
liquidMethodMissing(key: unknown): unknown;
|
|
11
10
|
getPage(slug: string): ShopifyResource<ShopifyPageObject>;
|
|
12
11
|
}
|
|
13
|
-
export default class Pages extends SwellStorefrontCollection<
|
|
12
|
+
export default class Pages extends SwellStorefrontCollection<ShopifyPageObject> {
|
|
14
13
|
#private;
|
|
15
14
|
constructor(instance: ShopifyCompatibility);
|
|
16
15
|
toLiquid(): PagesDrop;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SwellStorefrontCollection } from '@/resources';
|
|
2
2
|
import type { ShopifyResource } from './resource';
|
|
3
3
|
import type { ShopifyCompatibility } from '../shopify';
|
|
4
|
-
import type { SwellCollection } from 'types/swell';
|
|
5
4
|
import type { ShopifyCollection as ShopifyCollectionType } from 'types/shopify';
|
|
6
|
-
|
|
5
|
+
import type { SwellRecord } from 'types/swell';
|
|
6
|
+
export default function ShopifyCollections<T extends SwellRecord = SwellRecord>(instance: ShopifyCompatibility, categories: SwellStorefrontCollection<T>): SwellStorefrontCollection<ShopifyResource<ShopifyCollectionType>>;
|
package/dist/src/content.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Swell, SwellStorefrontCollection, SwellStorefrontRecord } from './api';
|
|
2
|
-
import type {
|
|
2
|
+
import type { SwellData } from 'types/swell';
|
|
3
3
|
export declare function getContentModel(swell: Swell, name: string): Promise<SwellData | undefined>;
|
|
4
|
-
export declare function getContentList(swell: Swell, type: string, query?: SwellData): SwellStorefrontCollection<
|
|
4
|
+
export declare function getContentList(swell: Swell, type: string, query?: SwellData): SwellStorefrontCollection<SwellData>;
|
|
5
5
|
export declare function getContentEntry(swell: Swell, type: string, id: string, query?: SwellData): SwellStorefrontRecord<SwellData>;
|
|
6
6
|
export declare function getPage(swell: Swell, id: string, query?: object): SwellStorefrontRecord<SwellData>;
|
|
7
|
-
export declare function getBlogs(swell: Swell, query?: SwellData): SwellStorefrontCollection<
|
|
7
|
+
export declare function getBlogs(swell: Swell, query?: SwellData): SwellStorefrontCollection<SwellData>;
|
|
8
8
|
export declare function getBlog(swell: Swell, id: string, query?: object): SwellStorefrontRecord<SwellData>;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Swell } from '@/api';
|
|
2
1
|
import { SwellStorefrontSingleton } from '@/resources';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellAccount as SwellAccountType } from './swell_types';
|
|
4
|
+
export default class SwellAccount extends SwellStorefrontSingleton<SwellAccountType> {
|
|
5
|
+
constructor(swell: Swell);
|
|
6
6
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SwellStorefrontCollection } from '@/resources';
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellData } from 'types/swell';
|
|
4
|
+
import type { SwellAddress } from './swell_types';
|
|
5
|
+
export default class SwellAddresses extends SwellStorefrontCollection<SwellAddress> {
|
|
6
|
+
constructor(swell: Swell, query?: SwellData);
|
|
7
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Swell } from '@/api';
|
|
2
1
|
import { SwellStorefrontRecord } from '@/resources';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellData } from 'types/swell';
|
|
4
|
+
import type { SwellBlog as SwellBlogType } from './swell_types';
|
|
5
|
+
export default class SwellBlog extends SwellStorefrontRecord<SwellBlogType> {
|
|
6
|
+
constructor(swell: Swell, blogId: string, categoryId?: string, query?: SwellData);
|
|
6
7
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Swell } from '@/api';
|
|
2
1
|
import { SwellStorefrontRecord } from '@/resources';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellData } from 'types/swell';
|
|
4
|
+
import type { SwellBlogCategory as SwellBlogCategoryType } from './swell_types';
|
|
5
|
+
export default class SwellBlogCategory extends SwellStorefrontRecord<SwellBlogCategoryType> {
|
|
6
|
+
constructor(swell: Swell, id: string, query?: SwellData);
|
|
6
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Swell } from '@/api';
|
|
2
1
|
import { SwellStorefrontSingleton } from '@/resources';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellCart as SwellCartType } from './swell_types';
|
|
4
|
+
export default class SwellCart extends SwellStorefrontSingleton<SwellCartType> {
|
|
5
|
+
constructor(swell: Swell);
|
|
6
6
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SwellStorefrontCollection } from '@/resources';
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellData } from 'types/swell';
|
|
4
|
+
import type { SwellCategory } from './swell_types';
|
|
5
|
+
export default class SwellCategories extends SwellStorefrontCollection<SwellCategory> {
|
|
6
|
+
constructor(swell: Swell, query?: SwellData);
|
|
7
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Swell } from '@/api';
|
|
2
1
|
import { SwellStorefrontRecord } from '@/resources';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellData } from 'types/swell';
|
|
4
|
+
import type { SwellCategory as SwellCategoryType } from './swell_types';
|
|
5
|
+
export default class SwellCategory extends SwellStorefrontRecord<SwellCategoryType> {
|
|
6
|
+
constructor(swell: Swell, id: string, query?: SwellData);
|
|
6
7
|
}
|
|
@@ -1,9 +1,18 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
|
|
1
|
+
import SwellAccount from './account';
|
|
2
|
+
import SwellAddresses from './addresses';
|
|
3
|
+
import SwellBlogCategory from './blog_category';
|
|
4
|
+
import SwellBlog from './blog';
|
|
5
|
+
import SwellCart from './cart';
|
|
6
|
+
import SwellCategories from './categories';
|
|
7
|
+
import SwellCategory from './category';
|
|
8
|
+
import SwellOrder from './order';
|
|
9
|
+
import SwellOrders from './orders';
|
|
10
|
+
import SwellPage from './page';
|
|
11
|
+
import SwellPredictiveSearch from './predictive_search';
|
|
12
|
+
import SwellProduct from './product';
|
|
13
|
+
import SwellProductRecommendations from './product_recommendations';
|
|
14
|
+
import SwellSearch from './search';
|
|
15
|
+
import SwellSubscription from './subscription';
|
|
16
|
+
import SwellSubscriptions from './subscriptions';
|
|
17
|
+
import SwellVariant from './variant';
|
|
18
|
+
export { SwellAccount, SwellAddresses, SwellBlogCategory, SwellBlog, SwellCart, SwellCategories, SwellCategory, SwellOrder, SwellOrders, SwellPage, SwellPredictiveSearch, SwellProduct, SwellProductRecommendations, SwellSearch, SwellSubscription, SwellSubscriptions, SwellVariant, };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Swell } from '@/api';
|
|
2
1
|
import { SwellStorefrontRecord } from '@/resources';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellOrder as SwellOrderType } from './swell_types';
|
|
4
|
+
import type { SwellData } from 'types/swell';
|
|
5
|
+
export default class SwellOrder extends SwellStorefrontRecord<SwellOrderType> {
|
|
6
|
+
constructor(swell: Swell, id: string, query?: SwellData);
|
|
6
7
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SwellStorefrontCollection } from '@/resources';
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellOrder } from './swell_types';
|
|
4
|
+
import type { SwellData } from 'types/swell';
|
|
5
|
+
export default class SwellOrders extends SwellStorefrontCollection<SwellOrder> {
|
|
6
|
+
constructor(swell: Swell, query?: SwellData);
|
|
7
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import type { Swell } from '@/api';
|
|
2
1
|
import { SwellStorefrontRecord } from '@/resources';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellData } from 'types/swell';
|
|
4
|
+
import type { SwellPage as SwellPageType } from './swell_types';
|
|
5
|
+
export default class SwellPage extends SwellStorefrontRecord<SwellPageType> {
|
|
6
|
+
constructor(swell: Swell, id: string, query?: SwellData);
|
|
6
7
|
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StorefrontResource } from '@/resources';
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellPredictiveSearch as SwellPredictiveSearchType } from './swell_types';
|
|
4
|
+
export default class SwellPredictiveSearch extends StorefrontResource<SwellPredictiveSearchType> {
|
|
5
|
+
constructor(swell: Swell, query?: string);
|
|
6
|
+
}
|
|
@@ -1,21 +1,7 @@
|
|
|
1
|
-
import type { Swell } from '@/api';
|
|
2
1
|
import { SwellStorefrontRecord } from '@/resources';
|
|
3
|
-
import type {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
query?:
|
|
8
|
-
} | {
|
|
9
|
-
value: string;
|
|
10
|
-
name: string;
|
|
11
|
-
query: string;
|
|
12
|
-
})[];
|
|
13
|
-
export declare class SwellProduct<T extends SwellData = SwellRecord> extends SwellStorefrontRecord<T> {
|
|
14
|
-
_params: SwellData;
|
|
15
|
-
constructor(swell: Swell, id: string, query?: SwellData, getter?: StorefrontResourceGetter<T>);
|
|
16
|
-
_transformResult(result?: T | null): T | null | undefined;
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellData } from 'types/swell';
|
|
4
|
+
import type { SwellProduct as SwellProductType } from './swell_types';
|
|
5
|
+
export default class SwellProduct extends SwellStorefrontRecord<SwellProductType> {
|
|
6
|
+
constructor(swell: Swell, id: string, query?: SwellData);
|
|
17
7
|
}
|
|
18
|
-
export declare function productQueryWithFilters(swell: Swell, query?: SwellData): {
|
|
19
|
-
sort: string | undefined;
|
|
20
|
-
$filters: any;
|
|
21
|
-
};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import type { SwellData } from 'types/swell';
|
|
2
|
-
import type { SwellProduct, SwellProductOption, SwellProductOptionValue, SwellProductPurchaseOptions, SwellVariant } from './swell_types';
|
|
1
|
+
import type { SwellData, SwellProductFilter } from 'types/swell';
|
|
2
|
+
import type { SwellProduct, SwellProductOption, SwellProductOptionValue, SwellProductPurchaseOptions, SwellSortOption, SwellVariant } from './swell_types';
|
|
3
|
+
import type { Swell } from '@/api';
|
|
3
4
|
export declare function isGiftcard(product: SwellProduct): boolean;
|
|
4
5
|
export declare function isOptionAvailable(product: SwellProduct, option: SwellProductOption): boolean;
|
|
5
6
|
export declare function isProductAvailable(product: SwellProduct, variant?: SwellVariant): boolean;
|
|
@@ -9,3 +10,12 @@ export declare function isOptionValueSelected(option: SwellProductOption, value:
|
|
|
9
10
|
export declare function getSelectedVariant(product: SwellProduct, queryParams: SwellData): SwellVariant | undefined;
|
|
10
11
|
export declare function getSelectedVariantOptionValues(product: SwellProduct, queryParams: SwellData, variant?: SwellVariant): string[];
|
|
11
12
|
export declare function getPurchaseOptions(product: SwellProduct, queryParams: SwellData): SwellProductPurchaseOptions | null;
|
|
13
|
+
export declare function getProductFilters(swell: Swell, productQuery?: SwellData): Promise<{
|
|
14
|
+
filter_options: SwellProductFilter[];
|
|
15
|
+
sort: string | undefined;
|
|
16
|
+
sort_options: SwellSortOption[];
|
|
17
|
+
}>;
|
|
18
|
+
export declare function productQueryWithFilters(swell: Swell, query?: SwellData): {
|
|
19
|
+
sort: string | undefined;
|
|
20
|
+
$filters: Record<string, unknown>;
|
|
21
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { StorefrontResource } from '@/resources';
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellSearch as SwellSearchType } from './swell_types';
|
|
4
|
+
export default class SwellSearch extends StorefrontResource<SwellSearchType> {
|
|
5
|
+
constructor(swell: Swell, query?: string);
|
|
6
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SwellStorefrontRecord } from '@/resources';
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellSubscription as SwellSubscriptionType } from './swell_types';
|
|
4
|
+
import type { SwellData } from 'types/swell';
|
|
5
|
+
export default class SwellSubscription extends SwellStorefrontRecord<SwellSubscriptionType> {
|
|
6
|
+
constructor(swell: Swell, id: string, query?: SwellData);
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { SwellStorefrontCollection } from '@/resources';
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellSubscription } from './swell_types';
|
|
4
|
+
import type { SwellData } from 'types/swell';
|
|
5
|
+
export default class SwellSubscriptions extends SwellStorefrontCollection<SwellSubscription> {
|
|
6
|
+
constructor(swell: Swell, query?: SwellData);
|
|
7
|
+
}
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
import type { SwellStorefrontCollection } from '@/resources';
|
|
2
|
+
import type { SwellCollection, SwellFile, SwellProductFilter } from 'types/swell';
|
|
3
|
+
import type { Cart, Order, Subscription, Account, Address } from 'swell-js';
|
|
1
4
|
export declare enum ScheduleInterval {
|
|
2
5
|
Daily = "daily",
|
|
3
6
|
Weekly = "weekly",
|
|
@@ -68,9 +71,16 @@ export interface SwellProduct {
|
|
|
68
71
|
purchase_options?: SwellProductPurchaseOptions;
|
|
69
72
|
stock_purchasable?: boolean;
|
|
70
73
|
stock_status?: string;
|
|
71
|
-
variants:
|
|
72
|
-
|
|
73
|
-
|
|
74
|
+
variants: SwellCollection<SwellVariant>;
|
|
75
|
+
}
|
|
76
|
+
export interface SwellCategory {
|
|
77
|
+
id: string;
|
|
78
|
+
slug: string;
|
|
79
|
+
name: string;
|
|
80
|
+
products?: SwellStorefrontCollection<SwellProduct>;
|
|
81
|
+
filter_options: SwellProductFilter[];
|
|
82
|
+
sort?: string;
|
|
83
|
+
sort_options: SwellSortOption[];
|
|
74
84
|
}
|
|
75
85
|
export interface SwellBlogAuthor {
|
|
76
86
|
id: string;
|
|
@@ -81,22 +91,69 @@ export interface SwellBlogCategory {
|
|
|
81
91
|
id: string;
|
|
82
92
|
title: string;
|
|
83
93
|
slug: string;
|
|
84
|
-
|
|
85
|
-
|
|
94
|
+
blogs?: SwellCollection<SwellBlog>;
|
|
95
|
+
meta_title?: string;
|
|
96
|
+
meta_description?: string;
|
|
97
|
+
meta_keywords?: string;
|
|
86
98
|
date_created: string;
|
|
99
|
+
date_updated?: string;
|
|
87
100
|
}
|
|
88
101
|
export interface SwellBlog {
|
|
89
102
|
id: string;
|
|
90
103
|
title: string;
|
|
91
104
|
slug: string;
|
|
92
105
|
published: boolean;
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
106
|
+
date_published?: string;
|
|
107
|
+
content?: string;
|
|
108
|
+
summary?: string;
|
|
109
|
+
image?: SwellFile;
|
|
110
|
+
meta_title?: string;
|
|
111
|
+
meta_description?: string;
|
|
112
|
+
meta_keywords?: string;
|
|
96
113
|
author_id: string;
|
|
97
114
|
category_id: string;
|
|
98
|
-
tags
|
|
115
|
+
tags?: string[];
|
|
116
|
+
theme_template?: string;
|
|
99
117
|
date_created: string;
|
|
118
|
+
date_updated?: string;
|
|
100
119
|
category?: SwellBlogCategory;
|
|
101
120
|
author?: SwellBlogAuthor;
|
|
102
121
|
}
|
|
122
|
+
export interface SwellPage {
|
|
123
|
+
id: string;
|
|
124
|
+
/** @deprecated */
|
|
125
|
+
name: string;
|
|
126
|
+
title: string;
|
|
127
|
+
slug: string;
|
|
128
|
+
content?: string;
|
|
129
|
+
published: boolean;
|
|
130
|
+
date_published?: string;
|
|
131
|
+
meta_title?: string;
|
|
132
|
+
meta_description?: string;
|
|
133
|
+
meta_keywords?: string;
|
|
134
|
+
theme_template?: string;
|
|
135
|
+
date_created: string;
|
|
136
|
+
date_updated?: string;
|
|
137
|
+
}
|
|
138
|
+
export interface SwellSortOption {
|
|
139
|
+
value: string;
|
|
140
|
+
name: string;
|
|
141
|
+
query?: string;
|
|
142
|
+
}
|
|
143
|
+
export interface SwellSearch {
|
|
144
|
+
query?: string;
|
|
145
|
+
performed: boolean;
|
|
146
|
+
filter_options: SwellProductFilter[];
|
|
147
|
+
sort?: string;
|
|
148
|
+
sort_options: SwellSortOption[];
|
|
149
|
+
}
|
|
150
|
+
export interface SwellPredictiveSearch {
|
|
151
|
+
query?: string;
|
|
152
|
+
performed: boolean;
|
|
153
|
+
products?: SwellStorefrontCollection<SwellProduct>;
|
|
154
|
+
}
|
|
155
|
+
export type SwellAddress = Address;
|
|
156
|
+
export type SwellAccount = Account;
|
|
157
|
+
export type SwellCart = Cart;
|
|
158
|
+
export type SwellOrder = Order;
|
|
159
|
+
export type SwellSubscription = Subscription;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { SwellStorefrontRecord } from '@/resources';
|
|
2
|
+
import type { Swell } from '@/api';
|
|
3
|
+
import type { SwellProduct, SwellVariant as SwellVariantType } from './swell_types';
|
|
1
4
|
import type { SwellData } from 'types/swell';
|
|
2
|
-
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
id: string;
|
|
6
|
-
|
|
7
|
-
option_value_ids: string[];
|
|
8
|
-
price?: number;
|
|
9
|
-
};
|
|
5
|
+
export declare function transformSwellVariant(params: SwellData, product: SwellProduct, variant: SwellVariantType): SwellVariantType;
|
|
6
|
+
export default class SwellVariant extends SwellStorefrontRecord<SwellVariantType> {
|
|
7
|
+
product: SwellStorefrontRecord<SwellProduct>;
|
|
8
|
+
constructor(swell: Swell, product: SwellStorefrontRecord<SwellProduct>, id: string, query?: SwellData);
|
|
9
|
+
}
|
package/dist/src/resources.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Swell } from './api';
|
|
2
2
|
import type { ShopifyCompatibility } from './compatibility/shopify';
|
|
3
|
-
import type { SwellData, SwellRecord, SwellCollection, InferSwellCollection, SwellCollectionPages, StorefrontResourceGetter, StorefrontCollectionGetter } from '../types/swell';
|
|
3
|
+
import type { SwellData, SwellRecord, SwellCollection, InferSwellCollection, SwellCollectionPages, StorefrontResourceGetter, StorefrontCollectionGetter, StorefrontSingletonGetter, StorefrontRecordGetter } from '../types/swell';
|
|
4
4
|
export declare const MAX_QUERY_PAGE_LIMIT = 100;
|
|
5
5
|
export declare const DEFAULT_QUERY_PAGE_LIMIT = 15;
|
|
6
6
|
export declare class StorefrontResource<T extends SwellData = SwellData> {
|
|
@@ -12,7 +12,6 @@ export declare class StorefrontResource<T extends SwellData = SwellData> {
|
|
|
12
12
|
constructor(getter?: StorefrontResourceGetter<T>);
|
|
13
13
|
_getProxy(): StorefrontResource<T>;
|
|
14
14
|
_getCollectionResultOrProp(instance: StorefrontResource<T>, prop: string | number): unknown;
|
|
15
|
-
_transformResult(result?: T | null): T | null | undefined;
|
|
16
15
|
_get(..._args: unknown[]): Promise<T | null | undefined>;
|
|
17
16
|
_setGetter(getter: StorefrontResourceGetter<T>): void;
|
|
18
17
|
_resolve(): Promise<T | null>;
|
|
@@ -50,9 +49,9 @@ export declare class SwellStorefrontResource<T extends SwellData = SwellData> ex
|
|
|
50
49
|
_getProxy(): SwellStorefrontResource<T>;
|
|
51
50
|
getResourceObject(): StorefrontResourceFetcher<T>;
|
|
52
51
|
}
|
|
53
|
-
export declare class SwellStorefrontCollection<T extends
|
|
52
|
+
export declare class SwellStorefrontCollection<T extends SwellData = SwellData> extends SwellStorefrontResource<SwellCollection<T>> {
|
|
54
53
|
length: number;
|
|
55
|
-
results?:
|
|
54
|
+
results?: T[];
|
|
56
55
|
count?: number;
|
|
57
56
|
page?: number;
|
|
58
57
|
pages?: SwellCollectionPages;
|
|
@@ -62,30 +61,30 @@ export declare class SwellStorefrontCollection<T extends SwellCollection<SwellDa
|
|
|
62
61
|
constructor(swell: Swell, collection: string, query?: SwellData, getter?: StorefrontCollectionGetter<T>);
|
|
63
62
|
_getProxy(): SwellStorefrontCollection<T>;
|
|
64
63
|
_initQuery(query: SwellData): SwellData;
|
|
65
|
-
_defaultGetter(): StorefrontResourceGetter<T
|
|
66
|
-
_get(query?: SwellData): Promise<T | null | undefined>;
|
|
64
|
+
_defaultGetter(): StorefrontResourceGetter<SwellCollection<T>>;
|
|
65
|
+
_get(query?: SwellData): Promise<SwellCollection<T> | null | undefined>;
|
|
67
66
|
get size(): Promise<number> | number;
|
|
68
|
-
[Symbol.iterator](): ArrayIterator<
|
|
69
|
-
iterator(): ArrayIterator<
|
|
67
|
+
[Symbol.iterator](): ArrayIterator<T> | Promise<ArrayIterator<T>>;
|
|
68
|
+
iterator(): ArrayIterator<T> | Promise<ArrayIterator<T>>;
|
|
70
69
|
private makeIterator;
|
|
71
70
|
_clone(newProps?: SwellData): SwellStorefrontCollection<T>;
|
|
72
|
-
_cloneWithCompatibilityResult<R extends
|
|
71
|
+
_cloneWithCompatibilityResult<R extends SwellData = SwellData>(compatibilityGetter: (result: SwellCollection<T>) => SwellCollection<R>): SwellStorefrontCollection<R>;
|
|
73
72
|
}
|
|
74
73
|
export declare class SwellStorefrontRecord<T extends SwellData = SwellRecord> extends SwellStorefrontResource<T> {
|
|
75
74
|
_id: string;
|
|
76
75
|
_params: SwellData;
|
|
77
|
-
constructor(swell: Swell, collection: string, id: string, query?: SwellData, getter?:
|
|
76
|
+
constructor(swell: Swell, collection: string, id: string, query?: SwellData, getter?: StorefrontRecordGetter<T>);
|
|
78
77
|
_getProxy(): SwellStorefrontRecord<T>;
|
|
79
78
|
_defaultGetter(): StorefrontResourceGetter<T>;
|
|
80
79
|
_get(id: string, query?: SwellData): Promise<T | null | undefined>;
|
|
81
80
|
}
|
|
82
81
|
export declare class SwellStorefrontSingleton<T extends SwellData = SwellData> extends SwellStorefrontResource<T> {
|
|
83
|
-
constructor(swell: Swell, collection: string, getter?:
|
|
82
|
+
constructor(swell: Swell, collection: string, getter?: StorefrontSingletonGetter<T>);
|
|
84
83
|
_getProxy(): SwellStorefrontSingleton<T>;
|
|
85
84
|
_defaultGetter(): StorefrontResourceGetter<T>;
|
|
86
85
|
_get(): Promise<T | null | undefined>;
|
|
87
86
|
}
|
|
88
|
-
export declare class SwellStorefrontPagination<T extends
|
|
87
|
+
export declare class SwellStorefrontPagination<T extends SwellData = SwellData> {
|
|
89
88
|
_resource: SwellStorefrontCollection<T>;
|
|
90
89
|
count: number;
|
|
91
90
|
page: number;
|
package/dist/types/shopify.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SwellData,
|
|
1
|
+
import type { SwellData, ThemeSectionEnabledDisabled } from './swell';
|
|
2
2
|
import type { ShopifyResource } from '../src/compatibility/shopify-objects/resource';
|
|
3
3
|
import type { ShopifyCompatibility } from '../src/compatibility/shopify';
|
|
4
4
|
import type { StorefrontResource, SwellStorefrontCollection } from '../src/resources';
|
|
@@ -446,7 +446,7 @@ export interface ShopifyCollection {
|
|
|
446
446
|
metafields: Record<string, unknown>;
|
|
447
447
|
next_product?: ShopifyProduct;
|
|
448
448
|
previous_product?: ShopifyProduct;
|
|
449
|
-
products: SwellStorefrontCollection<
|
|
449
|
+
products: SwellStorefrontCollection<ShopifyResource<ShopifyProduct>>;
|
|
450
450
|
products_count: number;
|
|
451
451
|
published_at: string;
|
|
452
452
|
sort_by?: string;
|
package/dist/types/swell.d.ts
CHANGED
|
@@ -245,7 +245,9 @@ export interface SwellMenuItem {
|
|
|
245
245
|
}
|
|
246
246
|
export type QueryParams = import('qs').ParsedQs;
|
|
247
247
|
export type StorefrontResourceGetter<T extends SwellData = SwellData> = (this: SwellStorefrontResource<T>) => Promise<T | null> | T | null;
|
|
248
|
-
export type
|
|
248
|
+
export type StorefrontRecordGetter<T extends SwellData = SwellData> = (this: SwellStorefrontRecord<T>) => Promise<T | null> | T | null;
|
|
249
|
+
export type StorefrontSingletonGetter<T extends SwellData = SwellData> = (this: SwellStorefrontSingleton<T>) => Promise<T | null> | T | null;
|
|
250
|
+
export type StorefrontCollectionGetter<T extends SwellData = SwellData> = (this: SwellStorefrontCollection<T>) => Promise<SwellCollection<T> | null> | SwellCollection<T> | null;
|
|
249
251
|
export interface ThemeSettings {
|
|
250
252
|
[key: string]: any;
|
|
251
253
|
}
|