@plasmicpkgs/commerce-swell 0.0.257 → 0.0.259
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/cart/index.d.ts +3 -3
- package/dist/cart/use-add-item.d.ts +5 -5
- package/dist/cart/use-cart.d.ts +6 -6
- package/dist/cart/use-remove-item.d.ts +21 -21
- package/dist/cart/use-update-item.d.ts +33 -33
- package/dist/cart/utils/checkout-create.d.ts +2 -2
- package/dist/cart/utils/checkout-to-cart.d.ts +5 -5
- package/dist/cart/utils/index.d.ts +2 -2
- package/dist/commerce-swell.cjs.development.js +36 -35
- package/dist/commerce-swell.cjs.development.js.map +1 -1
- package/dist/commerce-swell.cjs.production.min.js +1 -1
- package/dist/commerce-swell.cjs.production.min.js.map +1 -1
- package/dist/commerce-swell.esm.js +36 -35
- package/dist/commerce-swell.esm.js.map +1 -1
- package/dist/const.d.ts +4 -4
- package/dist/fetcher.d.ts +3 -3
- package/dist/index.d.ts +7 -7
- package/dist/product/index.d.ts +2 -2
- package/dist/product/use-price.d.ts +2 -2
- package/dist/product/use-product.d.ts +7 -7
- package/dist/product/use-search.d.ts +15 -15
- package/dist/provider.d.ts +132 -81
- package/dist/registerCommerceProvider.d.ts +12 -12
- package/dist/registerable.d.ts +6 -6
- package/dist/site/use-brands.d.ts +5 -5
- package/dist/site/use-categories.d.ts +5 -5
- package/dist/swell.d.ts +9 -9
- package/dist/types/cart.d.ts +18 -18
- package/dist/types/checkout.d.ts +1 -1
- package/dist/types/common.d.ts +1 -1
- package/dist/types/customer.d.ts +1 -1
- package/dist/types/index.d.ts +12 -12
- package/dist/types/login.d.ts +8 -8
- package/dist/types/logout.d.ts +1 -1
- package/dist/types/page.d.ts +1 -1
- package/dist/types/product.d.ts +14 -14
- package/dist/types/signup.d.ts +1 -1
- package/dist/types/site.d.ts +8 -8
- package/dist/types/wishlist.d.ts +1 -1
- package/dist/types.d.ts +98 -98
- package/dist/utils/category-tree.d.ts +3 -3
- package/dist/utils/common.d.ts +2 -2
- package/dist/utils/customer-token.d.ts +3 -3
- package/dist/utils/fetch-swell-api.d.ts +2 -2
- package/dist/utils/get-categories.d.ts +4 -4
- package/dist/utils/get-checkout-id.d.ts +2 -2
- package/dist/utils/get-search-variables.d.ts +6 -6
- package/dist/utils/get-sort-variables.d.ts +2 -2
- package/dist/utils/get-vendors.d.ts +17 -17
- package/dist/utils/handle-fetch-response.d.ts +8 -8
- package/dist/utils/handle-login.d.ts +2 -2
- package/dist/utils/index.d.ts +8 -8
- package/dist/utils/normalize.d.ts +7 -7
- package/dist/utils/storage.d.ts +2 -2
- package/package.json +8 -8
package/dist/types.d.ts
CHANGED
|
@@ -1,98 +1,98 @@
|
|
|
1
|
-
import { CartType as Core } from '@plasmicpkgs/commerce';
|
|
2
|
-
import { CheckoutLineItem } from './schema';
|
|
3
|
-
export
|
|
4
|
-
file: {
|
|
5
|
-
url: String;
|
|
6
|
-
height: Number;
|
|
7
|
-
width: Number;
|
|
8
|
-
};
|
|
9
|
-
id: string;
|
|
10
|
-
};
|
|
11
|
-
export
|
|
12
|
-
id: string;
|
|
13
|
-
product: SwellProduct;
|
|
14
|
-
price: number;
|
|
15
|
-
variant: {
|
|
16
|
-
name: string | null;
|
|
17
|
-
sku: string | null;
|
|
18
|
-
id: string;
|
|
19
|
-
};
|
|
20
|
-
quantity: number;
|
|
21
|
-
};
|
|
22
|
-
export
|
|
23
|
-
id: string;
|
|
24
|
-
account_id: number;
|
|
25
|
-
currency: string;
|
|
26
|
-
tax_included_total: number;
|
|
27
|
-
sub_total: number;
|
|
28
|
-
grand_total: number;
|
|
29
|
-
discount_total: number;
|
|
30
|
-
quantity: number;
|
|
31
|
-
items: CartLineItem[];
|
|
32
|
-
date_created: string;
|
|
33
|
-
discounts?: {
|
|
34
|
-
id: number;
|
|
35
|
-
amount: number;
|
|
36
|
-
}[] | null;
|
|
37
|
-
};
|
|
38
|
-
export
|
|
39
|
-
id: string;
|
|
40
|
-
option_value_ids: string[];
|
|
41
|
-
name: string;
|
|
42
|
-
price?: number;
|
|
43
|
-
stock_status?: string;
|
|
44
|
-
__type?: 'MultipleChoiceOption' | undefined;
|
|
45
|
-
};
|
|
46
|
-
export interface SwellProductOptionValue {
|
|
47
|
-
id: string;
|
|
48
|
-
label: string;
|
|
49
|
-
hexColors?: string[];
|
|
50
|
-
}
|
|
51
|
-
export interface ProductOptionValue {
|
|
52
|
-
label: string;
|
|
53
|
-
hexColors?: string[];
|
|
54
|
-
}
|
|
55
|
-
export
|
|
56
|
-
id: string;
|
|
57
|
-
name: string;
|
|
58
|
-
variant: boolean;
|
|
59
|
-
values: ProductOptionValue[];
|
|
60
|
-
required: boolean;
|
|
61
|
-
active: boolean;
|
|
62
|
-
attribute_id: string;
|
|
63
|
-
};
|
|
64
|
-
export interface SwellProduct {
|
|
65
|
-
id: string;
|
|
66
|
-
description: string;
|
|
67
|
-
name: string;
|
|
68
|
-
slug: string;
|
|
69
|
-
currency: string;
|
|
70
|
-
price: number;
|
|
71
|
-
images: any[];
|
|
72
|
-
options: any[];
|
|
73
|
-
variants: any;
|
|
74
|
-
}
|
|
75
|
-
export
|
|
76
|
-
export
|
|
77
|
-
id: string;
|
|
78
|
-
webUrl: string;
|
|
79
|
-
lineItems: CheckoutLineItem[];
|
|
80
|
-
};
|
|
81
|
-
export interface Cart extends Core.Cart {
|
|
82
|
-
id: string;
|
|
83
|
-
lineItems: LineItem[];
|
|
84
|
-
}
|
|
85
|
-
export interface LineItem extends Core.LineItem {
|
|
86
|
-
options?: any[];
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Cart mutations
|
|
90
|
-
*/
|
|
91
|
-
export
|
|
92
|
-
option_id: number;
|
|
93
|
-
option_value: number | string;
|
|
94
|
-
};
|
|
95
|
-
export
|
|
96
|
-
productId: string;
|
|
97
|
-
optionSelections?: OptionSelections;
|
|
98
|
-
};
|
|
1
|
+
import { CartType as Core } from '@plasmicpkgs/commerce';
|
|
2
|
+
import { CheckoutLineItem } from './schema';
|
|
3
|
+
export type SwellImage = {
|
|
4
|
+
file: {
|
|
5
|
+
url: String;
|
|
6
|
+
height: Number;
|
|
7
|
+
width: Number;
|
|
8
|
+
};
|
|
9
|
+
id: string;
|
|
10
|
+
};
|
|
11
|
+
export type CartLineItem = {
|
|
12
|
+
id: string;
|
|
13
|
+
product: SwellProduct;
|
|
14
|
+
price: number;
|
|
15
|
+
variant: {
|
|
16
|
+
name: string | null;
|
|
17
|
+
sku: string | null;
|
|
18
|
+
id: string;
|
|
19
|
+
};
|
|
20
|
+
quantity: number;
|
|
21
|
+
};
|
|
22
|
+
export type SwellCart = {
|
|
23
|
+
id: string;
|
|
24
|
+
account_id: number;
|
|
25
|
+
currency: string;
|
|
26
|
+
tax_included_total: number;
|
|
27
|
+
sub_total: number;
|
|
28
|
+
grand_total: number;
|
|
29
|
+
discount_total: number;
|
|
30
|
+
quantity: number;
|
|
31
|
+
items: CartLineItem[];
|
|
32
|
+
date_created: string;
|
|
33
|
+
discounts?: {
|
|
34
|
+
id: number;
|
|
35
|
+
amount: number;
|
|
36
|
+
}[] | null;
|
|
37
|
+
};
|
|
38
|
+
export type SwellVariant = {
|
|
39
|
+
id: string;
|
|
40
|
+
option_value_ids: string[];
|
|
41
|
+
name: string;
|
|
42
|
+
price?: number;
|
|
43
|
+
stock_status?: string;
|
|
44
|
+
__type?: 'MultipleChoiceOption' | undefined;
|
|
45
|
+
};
|
|
46
|
+
export interface SwellProductOptionValue {
|
|
47
|
+
id: string;
|
|
48
|
+
label: string;
|
|
49
|
+
hexColors?: string[];
|
|
50
|
+
}
|
|
51
|
+
export interface ProductOptionValue {
|
|
52
|
+
label: string;
|
|
53
|
+
hexColors?: string[];
|
|
54
|
+
}
|
|
55
|
+
export type ProductOptions = {
|
|
56
|
+
id: string;
|
|
57
|
+
name: string;
|
|
58
|
+
variant: boolean;
|
|
59
|
+
values: ProductOptionValue[];
|
|
60
|
+
required: boolean;
|
|
61
|
+
active: boolean;
|
|
62
|
+
attribute_id: string;
|
|
63
|
+
};
|
|
64
|
+
export interface SwellProduct {
|
|
65
|
+
id: string;
|
|
66
|
+
description: string;
|
|
67
|
+
name: string;
|
|
68
|
+
slug: string;
|
|
69
|
+
currency: string;
|
|
70
|
+
price: number;
|
|
71
|
+
images: any[];
|
|
72
|
+
options: any[];
|
|
73
|
+
variants: any;
|
|
74
|
+
}
|
|
75
|
+
export type SwellCustomer = any;
|
|
76
|
+
export type SwellCheckout = {
|
|
77
|
+
id: string;
|
|
78
|
+
webUrl: string;
|
|
79
|
+
lineItems: CheckoutLineItem[];
|
|
80
|
+
};
|
|
81
|
+
export interface Cart extends Core.Cart {
|
|
82
|
+
id: string;
|
|
83
|
+
lineItems: LineItem[];
|
|
84
|
+
}
|
|
85
|
+
export interface LineItem extends Core.LineItem {
|
|
86
|
+
options?: any[];
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Cart mutations
|
|
90
|
+
*/
|
|
91
|
+
export type OptionSelections = {
|
|
92
|
+
option_id: number;
|
|
93
|
+
option_value: number | string;
|
|
94
|
+
};
|
|
95
|
+
export type CartItemBody = Core.CartItemBody & {
|
|
96
|
+
productId: string;
|
|
97
|
+
optionSelections?: OptionSelections;
|
|
98
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import { Category } from "../types/site";
|
|
2
|
-
export declare const walkCategoryTree: (category?:
|
|
3
|
-
export declare const topologicalSortForCategoryTree: (categories: Category[]) => import("@plasmicpkgs/commerce/dist/types/site").Category[];
|
|
1
|
+
import { Category } from "../types/site";
|
|
2
|
+
export declare const walkCategoryTree: (category?: Category, categories?: Category[]) => import("@plasmicpkgs/commerce/dist/types/site").Category[];
|
|
3
|
+
export declare const topologicalSortForCategoryTree: (categories: Category[]) => import("@plasmicpkgs/commerce/dist/types/site").Category[];
|
package/dist/utils/common.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare function ensure<T>(x: T | null | undefined, msg?: string): T;
|
|
2
|
-
export declare const ensureNoNilFields: (o: Record<string, any>) => Record<string, any>;
|
|
1
|
+
export declare function ensure<T>(x: T | null | undefined, msg?: string): T;
|
|
2
|
+
export declare const ensureNoNilFields: (o: Record<string, any>) => Record<string, any>;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import
|
|
2
|
-
export declare const getCustomerToken: () => string | undefined;
|
|
3
|
-
export declare const setCustomerToken: (token: string | null, options?:
|
|
1
|
+
import { CookieAttributes } from 'js-cookie';
|
|
2
|
+
export declare const getCustomerToken: () => string | undefined;
|
|
3
|
+
export declare const setCustomerToken: (token: string | null, options?: CookieAttributes) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const fetchApi: (query: string, method: string, variables?: []) => Promise<any>;
|
|
2
|
-
export default fetchApi;
|
|
1
|
+
declare const fetchApi: (query: string, method: string, variables?: []) => Promise<any>;
|
|
2
|
+
export default fetchApi;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { SwellConfig } from '..';
|
|
2
|
-
import { Category } from '../types/site';
|
|
3
|
-
declare const getCategories: (config: SwellConfig) => Promise<Category[]>;
|
|
4
|
-
export default getCategories;
|
|
1
|
+
import { SwellConfig } from '..';
|
|
2
|
+
import { Category } from '../types/site';
|
|
3
|
+
declare const getCategories: (config: SwellConfig) => Promise<Category[]>;
|
|
4
|
+
export default getCategories;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const getCheckoutId: (id?: string
|
|
2
|
-
export default getCheckoutId;
|
|
1
|
+
declare const getCheckoutId: (id?: string) => string | undefined;
|
|
2
|
+
export default getCheckoutId;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { SearchProductsInput } from '../product/use-search';
|
|
2
|
-
export declare const getSearchVariables: ({ brandId, search, categoryId, sort, }: SearchProductsInput) => {
|
|
3
|
-
categoryId: string | undefined;
|
|
4
|
-
query: string;
|
|
5
|
-
};
|
|
6
|
-
export default getSearchVariables;
|
|
1
|
+
import type { SearchProductsInput } from '../product/use-search';
|
|
2
|
+
export declare const getSearchVariables: ({ brandId, search, categoryId, sort, }: SearchProductsInput) => {
|
|
3
|
+
categoryId: string | undefined;
|
|
4
|
+
query: string;
|
|
5
|
+
};
|
|
6
|
+
export default getSearchVariables;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const getSortVariables: (sort?: string
|
|
2
|
-
export default getSortVariables;
|
|
1
|
+
declare const getSortVariables: (sort?: string, isCategory?: boolean) => {};
|
|
2
|
+
export default getSortVariables;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { SwellConfig } from '..';
|
|
2
|
-
export
|
|
3
|
-
name: string;
|
|
4
|
-
path: string;
|
|
5
|
-
};
|
|
6
|
-
export
|
|
7
|
-
node: BrandNode;
|
|
8
|
-
};
|
|
9
|
-
export
|
|
10
|
-
declare const getVendors: (config: SwellConfig) => Promise<{
|
|
11
|
-
node: {
|
|
12
|
-
entityId: string;
|
|
13
|
-
name: string;
|
|
14
|
-
path: string;
|
|
15
|
-
};
|
|
16
|
-
}[]>;
|
|
17
|
-
export default getVendors;
|
|
1
|
+
import { SwellConfig } from '..';
|
|
2
|
+
export type BrandNode = {
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
};
|
|
6
|
+
export type BrandEdge = {
|
|
7
|
+
node: BrandNode;
|
|
8
|
+
};
|
|
9
|
+
export type Brands = BrandEdge[];
|
|
10
|
+
declare const getVendors: (config: SwellConfig) => Promise<{
|
|
11
|
+
node: {
|
|
12
|
+
entityId: string;
|
|
13
|
+
name: string;
|
|
14
|
+
path: string;
|
|
15
|
+
};
|
|
16
|
+
}[]>;
|
|
17
|
+
export default getVendors;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
error: {
|
|
3
|
-
message: string;
|
|
4
|
-
code?: string;
|
|
5
|
-
};
|
|
6
|
-
};
|
|
7
|
-
declare const handleFetchResponse: (res: SwellFetchResponse) => Promise<SwellFetchResponse | null>;
|
|
8
|
-
export default handleFetchResponse;
|
|
1
|
+
type SwellFetchResponse = {
|
|
2
|
+
error: {
|
|
3
|
+
message: string;
|
|
4
|
+
code?: string;
|
|
5
|
+
};
|
|
6
|
+
};
|
|
7
|
+
declare const handleFetchResponse: (res: SwellFetchResponse) => Promise<SwellFetchResponse | null>;
|
|
8
|
+
export default handleFetchResponse;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const handleLogin: (data: any) => any;
|
|
2
|
-
export default handleLogin;
|
|
1
|
+
declare const handleLogin: (data: any) => any;
|
|
2
|
+
export default handleLogin;
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { default as handleFetchResponse } from './handle-fetch-response';
|
|
2
|
-
export { default as getSearchVariables } from './get-search-variables';
|
|
3
|
-
export { default as getSortVariables } from './get-sort-variables';
|
|
4
|
-
export { default as getVendors } from './get-vendors';
|
|
5
|
-
export { default as getCategories } from './get-categories';
|
|
6
|
-
export { default as getCheckoutId } from './get-checkout-id';
|
|
7
|
-
export * from './normalize';
|
|
8
|
-
export * from './customer-token';
|
|
1
|
+
export { default as handleFetchResponse } from './handle-fetch-response';
|
|
2
|
+
export { default as getSearchVariables } from './get-search-variables';
|
|
3
|
+
export { default as getSortVariables } from './get-sort-variables';
|
|
4
|
+
export { default as getVendors } from './get-vendors';
|
|
5
|
+
export { default as getCategories } from './get-categories';
|
|
6
|
+
export { default as getCheckoutId } from './get-checkout-id';
|
|
7
|
+
export * from './normalize';
|
|
8
|
+
export * from './customer-token';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { Cart, SwellCart, SwellProduct } from "../types";
|
|
2
|
-
import { Product } from "../types/product";
|
|
3
|
-
import { Category, SwellCategoryChildren } from "../types/site";
|
|
4
|
-
export declare function normalizeProduct(swellProduct: SwellProduct): Product;
|
|
5
|
-
export declare function normalizeCart({ id, account_id, date_created, currency, tax_included_total, items, sub_total, grand_total, discounts, }: SwellCart): Cart;
|
|
6
|
-
export declare function normalizeChildren(children: SwellCategoryChildren): string[];
|
|
7
|
-
export declare function normalizeCategory({ id, name, slug, products, images, depth, children, parent_id, }: any): Category;
|
|
1
|
+
import type { Cart, SwellCart, SwellProduct } from "../types";
|
|
2
|
+
import { Product } from "../types/product";
|
|
3
|
+
import { Category, SwellCategoryChildren } from "../types/site";
|
|
4
|
+
export declare function normalizeProduct(swellProduct: SwellProduct): Product;
|
|
5
|
+
export declare function normalizeCart({ id, account_id, date_created, currency, tax_included_total, items, sub_total, grand_total, discounts, }: SwellCart): Cart;
|
|
6
|
+
export declare function normalizeChildren(children: SwellCategoryChildren): string[];
|
|
7
|
+
export declare function normalizeCategory({ id, name, slug, products, images, depth, children, parent_id, }: any): Category;
|
package/dist/utils/storage.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const getCheckoutIdFromStorage: (token: string) => string | null;
|
|
2
|
-
export declare const setCheckoutIdInStorage: (token: string, id: string | number) => void;
|
|
1
|
+
export declare const getCheckoutIdFromStorage: (token: string) => string | null;
|
|
2
|
+
export declare const setCheckoutIdInStorage: (token: string, id: string | number) => void;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/commerce-swell",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.259",
|
|
4
4
|
"description": "Plasmic registration calls for swell commerce provider",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -11,17 +11,17 @@
|
|
|
11
11
|
"scripts": {
|
|
12
12
|
"build": "tsdx build",
|
|
13
13
|
"start": "tsdx watch",
|
|
14
|
-
"test": "TEST_CWD=`pwd`
|
|
14
|
+
"test": "TEST_CWD=`pwd` pnpm -w test --passWithNoTests",
|
|
15
15
|
"lint": "tsdx lint",
|
|
16
16
|
"prepublishOnly": "npm run build",
|
|
17
17
|
"size": "size-limit",
|
|
18
18
|
"analyze": "size-limit --why"
|
|
19
19
|
},
|
|
20
20
|
"devDependencies": {
|
|
21
|
-
"@plasmicapp/host": "2.0.
|
|
22
|
-
"@types/debounce": "^1.2.
|
|
23
|
-
"@types/js-cookie": "^3.0.
|
|
24
|
-
"@types/node": "^14.
|
|
21
|
+
"@plasmicapp/host": "2.0.8",
|
|
22
|
+
"@types/debounce": "^1.2.4",
|
|
23
|
+
"@types/js-cookie": "^3.0.6",
|
|
24
|
+
"@types/node": "^14.18.63",
|
|
25
25
|
"@types/react": "^18",
|
|
26
26
|
"react": "^18.2.0",
|
|
27
27
|
"react-dom": "^18.2.0",
|
|
@@ -32,10 +32,10 @@
|
|
|
32
32
|
"react": ">=16.8.0"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@plasmicpkgs/commerce": "0.0.
|
|
35
|
+
"@plasmicpkgs/commerce": "0.0.249",
|
|
36
36
|
"debounce": "^1.2.1",
|
|
37
37
|
"js-cookie": "^3.0.5",
|
|
38
38
|
"swell-js": "^3.13.0"
|
|
39
39
|
},
|
|
40
|
-
"gitHead": "
|
|
40
|
+
"gitHead": "f2542f3c07f280e033323f363580af5dd8dc534b"
|
|
41
41
|
}
|