@plasmicpkgs/commerce-saleor 0.0.11
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/LICENSE.md +21 -0
- package/README.md +1 -0
- package/dist/cart/index.d.ts +4 -0
- package/dist/cart/use-add-item.d.ts +5 -0
- package/dist/cart/use-cart.d.ts +13 -0
- package/dist/cart/use-remove-item.d.ts +11 -0
- package/dist/cart/use-update-item.d.ts +20 -0
- package/dist/commerce-saleor.cjs.development.js +2165 -0
- package/dist/commerce-saleor.cjs.development.js.map +1 -0
- package/dist/commerce-saleor.cjs.production.min.js +2 -0
- package/dist/commerce-saleor.cjs.production.min.js.map +1 -0
- package/dist/commerce-saleor.esm.js +2155 -0
- package/dist/commerce-saleor.esm.js.map +1 -0
- package/dist/const.d.ts +4 -0
- package/dist/fetcher.d.ts +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +8 -0
- package/dist/product/use-price.d.ts +2 -0
- package/dist/product/use-product.d.ts +13 -0
- package/dist/product/use-search.d.ts +30 -0
- package/dist/provider.d.ts +63 -0
- package/dist/registerCommerceProvider.d.ts +10 -0
- package/dist/registerable.d.ts +6 -0
- package/dist/saleor.d.ts +4 -0
- package/dist/site/use-brands.d.ts +11 -0
- package/dist/site/use-categories.d.ts +11 -0
- package/dist/types/cart.d.ts +22 -0
- package/dist/types/site.d.ts +7 -0
- package/dist/types.d.ts +24 -0
- package/dist/utils/checkout-attach.d.ts +2 -0
- package/dist/utils/checkout-create.d.ts +3 -0
- package/dist/utils/checkout-to-cart.d.ts +9 -0
- package/dist/utils/customer-token.d.ts +7 -0
- package/dist/utils/fragments/checkout-details.d.ts +1 -0
- package/dist/utils/fragments/index.d.ts +2 -0
- package/dist/utils/fragments/product.d.ts +1 -0
- package/dist/utils/get-categories.d.ts +3 -0
- package/dist/utils/get-checkout-id.d.ts +5 -0
- package/dist/utils/get-search-variables.d.ts +14 -0
- package/dist/utils/get-sort-variables.d.ts +1 -0
- package/dist/utils/get-vendors.d.ts +11 -0
- package/dist/utils/handle-fetch-response.d.ts +5 -0
- package/dist/utils/handle-login.d.ts +5 -0
- package/dist/utils/index.d.ts +13 -0
- package/dist/utils/mutations/account-create.d.ts +1 -0
- package/dist/utils/mutations/checkout-attach.d.ts +1 -0
- package/dist/utils/mutations/checkout-create.d.ts +1 -0
- package/dist/utils/mutations/checkout-line-add.d.ts +1 -0
- package/dist/utils/mutations/checkout-line-remove.d.ts +1 -0
- package/dist/utils/mutations/checkout-line-update.d.ts +1 -0
- package/dist/utils/mutations/index.d.ts +8 -0
- package/dist/utils/mutations/session-create.d.ts +1 -0
- package/dist/utils/mutations/session-destroy.d.ts +1 -0
- package/dist/utils/normalize.d.ts +7 -0
- package/dist/utils/queries/checkout-one.d.ts +1 -0
- package/dist/utils/queries/collection-many.d.ts +1 -0
- package/dist/utils/queries/collection-one.d.ts +1 -0
- package/dist/utils/queries/customer-current.d.ts +1 -0
- package/dist/utils/queries/customer-one.d.ts +1 -0
- package/dist/utils/queries/get-all-product-vendors-query.d.ts +1 -0
- package/dist/utils/queries/get-all-products-paths-query.d.ts +1 -0
- package/dist/utils/queries/index.d.ts +11 -0
- package/dist/utils/queries/page-many.d.ts +1 -0
- package/dist/utils/queries/page-one.d.ts +1 -0
- package/dist/utils/queries/product-many.d.ts +1 -0
- package/dist/utils/queries/product-one-by-id.d.ts +1 -0
- package/dist/utils/queries/product-one-by-slug.d.ts +1 -0
- package/dist/utils/throw-user-errors.d.ts +5 -0
- package/package.json +49 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getSortVariables: (sort?: string | undefined, isCategory?: boolean) => {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare type Brand = {
|
|
2
|
+
entityId: string;
|
|
3
|
+
name: string;
|
|
4
|
+
path: string;
|
|
5
|
+
};
|
|
6
|
+
export declare type BrandEdge = {
|
|
7
|
+
node: Brand;
|
|
8
|
+
};
|
|
9
|
+
export declare type Brands = BrandEdge[];
|
|
10
|
+
declare const getVendors: (config: any) => Promise<BrandEdge[]>;
|
|
11
|
+
export default getVendors;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FetcherError } from '@plasmicpkgs/commerce';
|
|
2
|
+
export declare function getError(errors: any[], status: number): FetcherError;
|
|
3
|
+
export declare function getAsyncError(res: Response): Promise<FetcherError>;
|
|
4
|
+
declare const handleFetchResponse: (res: Response) => Promise<any>;
|
|
5
|
+
export default handleFetchResponse;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { FetcherOptions } from '@plasmicpkgs/commerce';
|
|
2
|
+
import { CreateToken, MutationTokenCreateArgs } from '../schema';
|
|
3
|
+
declare const handleLogin: (data: CreateToken) => string | null | undefined;
|
|
4
|
+
export declare const handleAutomaticLogin: (fetch: <T = any, B = Body>(options: FetcherOptions<B>) => Promise<T>, input: MutationTokenCreateArgs) => Promise<void>;
|
|
5
|
+
export default handleLogin;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { getSortVariables } from './get-sort-variables';
|
|
2
|
+
export { default as handleFetchResponse } from './handle-fetch-response';
|
|
3
|
+
export { default as getSearchVariables } from './get-search-variables';
|
|
4
|
+
export { default as getCheckoutId } from './get-checkout-id';
|
|
5
|
+
export { default as checkoutCreate } from './checkout-create';
|
|
6
|
+
export { checkoutAttach } from './checkout-attach';
|
|
7
|
+
export { default as checkoutToCart } from './checkout-to-cart';
|
|
8
|
+
export { default as handleLogin, handleAutomaticLogin } from './handle-login';
|
|
9
|
+
export { default as throwUserErrors } from './throw-user-errors';
|
|
10
|
+
export * from './queries';
|
|
11
|
+
export * from './mutations';
|
|
12
|
+
export * from './normalize';
|
|
13
|
+
export * from './customer-token';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const AccountCreate = "\n mutation AccountCreate($input: AccountRegisterInput!) {\n accountRegister(input: $input) {\n errors {\n code\n field\n message\n }\n user {\n email\n isActive\n }\n }\n }\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CheckoutAttach = "\n mutation CheckoutAttach($checkoutId: ID!) {\n checkoutCustomerAttach(checkoutId: $checkoutId) {\n errors {\n message\n }\n checkout {\n id\n }\n }\n }\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CheckoutCreate: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CheckoutLineAdd: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CheckoutLineDelete: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CheckoutLineUpdate: string;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { AccountCreate } from './account-create';
|
|
2
|
+
export { CheckoutCreate } from './checkout-create';
|
|
3
|
+
export { CheckoutLineAdd } from './checkout-line-add';
|
|
4
|
+
export { CheckoutLineUpdate } from './checkout-line-update';
|
|
5
|
+
export { CheckoutLineDelete } from './checkout-line-remove';
|
|
6
|
+
export { SessionCreate } from './session-create';
|
|
7
|
+
export { SessionDestroy } from './session-destroy';
|
|
8
|
+
export { CheckoutAttach } from './checkout-attach';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SessionCreate = "\n mutation SessionCreate($email: String!, $password: String!) {\n tokenCreate(email: $email, password: $password) {\n token\n refreshToken\n csrfToken\n errors {\n code\n field\n message\n }\n }\n }\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const SessionDestroy = "\n mutation SessionDestroy {\n tokensDeactivateAll {\n errors {\n field\n message\n }\n }\n }\n";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Product } from '@plasmicpkgs/commerce';
|
|
2
|
+
import { Product as SaleorProduct, Checkout, Collection } from '../schema';
|
|
3
|
+
import { Category } from '../types/site';
|
|
4
|
+
import type { Cart } from '../types';
|
|
5
|
+
export declare function normalizeProduct(productNode: SaleorProduct): Product;
|
|
6
|
+
export declare function normalizeCart(checkout: Checkout): Cart;
|
|
7
|
+
export declare const normalizeCategory: ({ name, slug, id, }: Collection) => Category;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CheckoutOne: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CollectionMany = "\n query CollectionMany( $channel: String = \"default-channel\") {\n collections(first:100, channel: $channel) {\n edges {\n node {\n id\n name\n slug\n }\n }\n }\n }\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CollectionOne: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CustomerCurrent = "\n query CustomerCurrent {\n me {\n id\n email\n firstName\n lastName\n dateJoined\n }\n }\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const CustomerOne = "\n query CustomerOne($customerAccessToken: String!) {\n customer(customerAccessToken: $customerAccessToken) {\n id\n }\n }\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getAllProductVendors = "\n query getAllProductVendors($cursor: String, $channel: String = \"default-channel\") {\n products(first:100,channel: $channel, after: $cursor) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n slug\n }\n cursor\n }\n }\n }\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getAllProductsPathsQuery = "\n query getAllProductPaths($cursor: String, $channel: String = \"default-channel\") {\n products(first: 100, after: $cursor, channel: $channel) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n slug\n }\n cursor\n }\n }\n }\n";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { CollectionMany } from './collection-many';
|
|
2
|
+
export { ProductOneBySlug } from './product-one-by-slug';
|
|
3
|
+
export { ProductMany } from './product-many';
|
|
4
|
+
export { CollectionOne } from './collection-one';
|
|
5
|
+
export { CheckoutOne } from './checkout-one';
|
|
6
|
+
export { PageMany } from './page-many';
|
|
7
|
+
export { PageOne } from './page-one';
|
|
8
|
+
export { CustomerCurrent } from './customer-current';
|
|
9
|
+
export { CustomerOne } from './customer-one';
|
|
10
|
+
export { getAllProductsPathsQuery } from './get-all-products-paths-query';
|
|
11
|
+
export { getAllProductVendors } from './get-all-product-vendors-query';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PageMany = "\n query PageMany($first: Int = 100) {\n pages(first: $first) {\n edges {\n node {\n id\n title\n slug\n }\n }\n }\n }\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const PageOne = "\n query PageOne($id: ID!) {\n page(id: $id) {\n id\n title\n slug\n }\n }\n";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ProductMany: string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ProductOneById = "\n query ProductOneById($id: ID!, $channel: String = \"default-channel\") {\n product(id: $id, channel: $channel) {\n\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const ProductOneBySlug = "\n query ProductOneBySlug($slug: String!, $channel: String = \"default-channel\") {\n product(slug: $slug, channel: $channel) {\n id\n slug\n name\n description\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n variants {\n id\n name\n attributes {\n attribute {\n name\n }\n values {\n name\n }\n }\n pricing {\n price {\n net {\n amount\n currency\n }\n }\n }\n }\n media {\n url\n alt\n }\n }\n }\n";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CheckoutError, CheckoutErrorCode, AppError, AccountError, AccountErrorCode } from '../schema';
|
|
2
|
+
export declare type UserErrors = Array<CheckoutError | AccountError | AppError>;
|
|
3
|
+
export declare type UserErrorCode = CheckoutErrorCode | AccountErrorCode | null | undefined;
|
|
4
|
+
export declare const throwUserErrors: (errors?: UserErrors | undefined) => void;
|
|
5
|
+
export default throwUserErrors;
|
package/package.json
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@plasmicpkgs/commerce-saleor",
|
|
3
|
+
"version": "0.0.11",
|
|
4
|
+
"description": "Plasmic registration calls for saleor commerce provider",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"module": "dist/commerce-saleor.esm.js",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsdx build",
|
|
13
|
+
"start": "tsdx watch",
|
|
14
|
+
"test": "tsdx test --passWithNoTests",
|
|
15
|
+
"lint": "tsdx lint",
|
|
16
|
+
"prepare": "tsdx build",
|
|
17
|
+
"size": "size-limit",
|
|
18
|
+
"analyze": "size-limit --why"
|
|
19
|
+
},
|
|
20
|
+
"dependencies": {
|
|
21
|
+
"@plasmicpkgs/commerce": "^0.0.53",
|
|
22
|
+
"lodash-es": "^4.17.21",
|
|
23
|
+
"lodash.debounce": "^4.0.8",
|
|
24
|
+
"tsdx": "^0.14.1"
|
|
25
|
+
},
|
|
26
|
+
"peerDependencies": {
|
|
27
|
+
"next": "^12",
|
|
28
|
+
"react": "^17",
|
|
29
|
+
"react-dom": "^17"
|
|
30
|
+
},
|
|
31
|
+
"devDependencies": {
|
|
32
|
+
"@plasmicapp/host": "^1.0.67",
|
|
33
|
+
"@size-limit/preset-small-lib": "^7.0.8",
|
|
34
|
+
"@types/lodash.debounce": "^4.0.6",
|
|
35
|
+
"@types/node": "^17.0.8",
|
|
36
|
+
"@types/react": "^17.0.38",
|
|
37
|
+
"next": "^12.0.8",
|
|
38
|
+
"prettier": "^2.5.1",
|
|
39
|
+
"react": "^17.0.2",
|
|
40
|
+
"react-dom": "^17.0.2",
|
|
41
|
+
"size-limit": "^7.0.8",
|
|
42
|
+
"tsdx": "^0.14.1",
|
|
43
|
+
"typescript": "^4.5.4"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"gitHead": "89022a440c8e3580e06c4f96952765dca8e655c7"
|
|
49
|
+
}
|