@plasmicpkgs/commerce-saleor 0.0.210 → 0.0.212
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 +4 -4
- package/dist/cart/use-add-item.d.ts +5 -5
- package/dist/cart/use-cart.d.ts +6 -5
- package/dist/cart/use-remove-item.d.ts +15 -15
- package/dist/cart/use-update-item.d.ts +27 -27
- package/dist/commerce-saleor.cjs.development.js +77 -76
- package/dist/commerce-saleor.cjs.development.js.map +1 -1
- package/dist/commerce-saleor.cjs.production.min.js +1 -1
- package/dist/commerce-saleor.cjs.production.min.js.map +1 -1
- package/dist/commerce-saleor.esm.js +77 -76
- package/dist/commerce-saleor.esm.js.map +1 -1
- package/dist/const.d.ts +4 -4
- package/dist/fetcher.d.ts +2 -2
- package/dist/index.d.ts +6 -6
- package/dist/product/use-price.d.ts +2 -2
- package/dist/product/use-product.d.ts +9 -9
- package/dist/product/use-search.d.ts +16 -16
- package/dist/provider.d.ts +68 -68
- package/dist/registerCommerceProvider.d.ts +11 -11
- package/dist/registerable.d.ts +6 -6
- package/dist/saleor.d.ts +5 -5
- package/dist/site/use-brands.d.ts +5 -5
- package/dist/site/use-categories.d.ts +5 -5
- package/dist/types/cart.d.ts +22 -22
- package/dist/types/site.d.ts +7 -7
- package/dist/types.d.ts +24 -24
- package/dist/utils/checkout-attach.d.ts +2 -2
- package/dist/utils/checkout-create.d.ts +3 -3
- package/dist/utils/checkout-to-cart.d.ts +9 -9
- package/dist/utils/customer-token.d.ts +7 -7
- package/dist/utils/fragments/checkout-details.d.ts +1 -1
- package/dist/utils/fragments/index.d.ts +2 -2
- package/dist/utils/fragments/product.d.ts +1 -1
- package/dist/utils/get-categories.d.ts +3 -3
- package/dist/utils/get-checkout-id.d.ts +5 -5
- package/dist/utils/get-search-variables.d.ts +14 -14
- package/dist/utils/get-sort-variables.d.ts +1 -1
- package/dist/utils/get-vendors.d.ts +11 -11
- package/dist/utils/handle-fetch-response.d.ts +5 -5
- package/dist/utils/handle-login.d.ts +5 -5
- package/dist/utils/index.d.ts +13 -13
- package/dist/utils/mutations/account-create.d.ts +1 -1
- package/dist/utils/mutations/checkout-attach.d.ts +1 -1
- package/dist/utils/mutations/checkout-create.d.ts +1 -1
- package/dist/utils/mutations/checkout-line-add.d.ts +1 -1
- package/dist/utils/mutations/checkout-line-remove.d.ts +1 -1
- package/dist/utils/mutations/checkout-line-update.d.ts +1 -1
- package/dist/utils/mutations/index.d.ts +8 -8
- package/dist/utils/mutations/session-create.d.ts +1 -1
- package/dist/utils/mutations/session-destroy.d.ts +1 -1
- package/dist/utils/normalize.d.ts +7 -7
- package/dist/utils/queries/checkout-one.d.ts +1 -1
- package/dist/utils/queries/collection-many.d.ts +1 -1
- package/dist/utils/queries/collection-one.d.ts +1 -1
- package/dist/utils/queries/customer-current.d.ts +1 -1
- package/dist/utils/queries/customer-one.d.ts +1 -1
- package/dist/utils/queries/get-all-product-vendors-query.d.ts +1 -1
- package/dist/utils/queries/get-all-products-paths-query.d.ts +1 -1
- package/dist/utils/queries/index.d.ts +11 -11
- package/dist/utils/queries/page-many.d.ts +1 -1
- package/dist/utils/queries/page-one.d.ts +1 -1
- package/dist/utils/queries/product-many.d.ts +1 -1
- package/dist/utils/queries/product-one-by-id.d.ts +1 -1
- package/dist/utils/queries/product-one-by-slug.d.ts +1 -1
- package/dist/utils/throw-user-errors.d.ts +5 -5
- package/package.json +5 -5
package/dist/cart/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { default as useCart } from './use-cart';
|
|
2
|
-
export { default as useAddItem } from './use-add-item';
|
|
3
|
-
export { default as useUpdateItem } from './use-update-item';
|
|
4
|
-
export { default as useRemoveItem } from './use-remove-item';
|
|
1
|
+
export { default as useCart } from './use-cart';
|
|
2
|
+
export { default as useAddItem } from './use-add-item';
|
|
3
|
+
export { default as useUpdateItem } from './use-update-item';
|
|
4
|
+
export { default as useRemoveItem } from './use-remove-item';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { MutationHook } from "@plasmicpkgs/commerce";
|
|
2
|
-
import { AddItemHook } from "../types/cart";
|
|
3
|
-
declare const _default: () => (input: import("@plasmicpkgs/commerce/dist/types/cart").CartItemBody) => import("@plasmicpkgs/commerce/dist/types/cart").Cart | Promise<import("@plasmicpkgs/commerce/dist/types/cart").Cart | undefined> | undefined;
|
|
4
|
-
export default _default;
|
|
5
|
-
export declare const handler: MutationHook<AddItemHook>;
|
|
1
|
+
import type { MutationHook } from "@plasmicpkgs/commerce";
|
|
2
|
+
import { AddItemHook } from "../types/cart";
|
|
3
|
+
declare const _default: () => (input: import("@plasmicpkgs/commerce/dist/types/cart").CartItemBody) => import("@plasmicpkgs/commerce/dist/types/cart").Cart | Promise<import("@plasmicpkgs/commerce/dist/types/cart").Cart | undefined> | undefined;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const handler: MutationHook<AddItemHook>;
|
package/dist/cart/use-cart.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
1
|
+
import { UseCart } from "@plasmicpkgs/commerce";
|
|
2
|
+
import { SWRHook } from "@plasmicpkgs/commerce";
|
|
3
|
+
import { GetCartHook } from "../types/cart";
|
|
4
|
+
declare const _default: UseCart<typeof handler>;
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const handler: SWRHook<GetCartHook>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import type { HookFetcherContext, MutationHookContext } from "@plasmicpkgs/commerce";
|
|
2
|
-
import { RemoveItemHook } from "../types/cart";
|
|
3
|
-
declare const _default: <T extends import("@plasmicpkgs/commerce/dist/types/cart").LineItem | undefined = undefined>() => (input: {
|
|
4
|
-
id: string;
|
|
5
|
-
}) => Promise<import("@plasmicpkgs/commerce/dist/types/cart").Cart | null | undefined>;
|
|
6
|
-
export default _default;
|
|
7
|
-
export declare const handler: {
|
|
8
|
-
fetchOptions: {
|
|
9
|
-
query: string;
|
|
10
|
-
};
|
|
11
|
-
fetcher({ input: { itemId }, options, fetch, }: HookFetcherContext<RemoveItemHook>): Promise<import("../types").Cart | undefined>;
|
|
12
|
-
useHook: ({ fetch }: MutationHookContext<RemoveItemHook>) => <T extends import("@plasmicpkgs/commerce/dist/types/cart").LineItem | undefined = undefined>() => (input: {
|
|
13
|
-
id: string;
|
|
14
|
-
}) => Promise<import("@plasmicpkgs/commerce/dist/types/cart").Cart | null | undefined>;
|
|
15
|
-
};
|
|
1
|
+
import type { HookFetcherContext, MutationHookContext } from "@plasmicpkgs/commerce";
|
|
2
|
+
import { RemoveItemHook } from "../types/cart";
|
|
3
|
+
declare const _default: <T extends import("@plasmicpkgs/commerce/dist/types/cart").LineItem | undefined = undefined>() => (input: {
|
|
4
|
+
id: string;
|
|
5
|
+
}) => Promise<import("@plasmicpkgs/commerce/dist/types/cart").Cart | null | undefined>;
|
|
6
|
+
export default _default;
|
|
7
|
+
export declare const handler: {
|
|
8
|
+
fetchOptions: {
|
|
9
|
+
query: string;
|
|
10
|
+
};
|
|
11
|
+
fetcher({ input: { itemId }, options, fetch, }: HookFetcherContext<RemoveItemHook>): Promise<import("../types").Cart | undefined>;
|
|
12
|
+
useHook: ({ fetch }: MutationHookContext<RemoveItemHook>) => <T extends import("@plasmicpkgs/commerce/dist/types/cart").LineItem | undefined = undefined>() => (input: {
|
|
13
|
+
id: string;
|
|
14
|
+
}) => Promise<import("@plasmicpkgs/commerce/dist/types/cart").Cart | null | undefined>;
|
|
15
|
+
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import type { HookFetcherContext, MutationHookContext } from "@plasmicpkgs/commerce";
|
|
2
|
-
import type { LineItem } from "../types/cart";
|
|
3
|
-
import type { UpdateItemHook } from "../types/cart";
|
|
4
|
-
export
|
|
5
|
-
declare const _default: <T extends import("@plasmicpkgs/commerce/dist/types/cart").LineItem | undefined = undefined>(ctx?: {
|
|
6
|
-
item?: T | undefined;
|
|
7
|
-
wait?: number | undefined;
|
|
8
|
-
}) => ((input: UpdateItemActionInput<T>) => Promise<import("@plasmicpkgs/commerce/dist/types/cart").Cart | null | undefined>) & {
|
|
9
|
-
clear(): void;
|
|
10
|
-
} & {
|
|
11
|
-
flush(): void;
|
|
12
|
-
};
|
|
13
|
-
export default _default;
|
|
14
|
-
export declare const handler: {
|
|
15
|
-
fetchOptions: {
|
|
16
|
-
query: string;
|
|
17
|
-
};
|
|
18
|
-
fetcher({ input: { itemId, item }, options, fetch, }: HookFetcherContext<UpdateItemHook>): Promise<import("../types").Cart | undefined>;
|
|
19
|
-
useHook: ({ fetch }: MutationHookContext<UpdateItemHook>) => <T extends import("@plasmicpkgs/commerce/dist/types/cart").LineItem | undefined = undefined>(ctx?: {
|
|
20
|
-
item?: T | undefined;
|
|
21
|
-
wait?: number | undefined;
|
|
22
|
-
}) => ((input: UpdateItemActionInput<T>) => Promise<import("@plasmicpkgs/commerce/dist/types/cart").Cart | null | undefined>) & {
|
|
23
|
-
clear(): void;
|
|
24
|
-
} & {
|
|
25
|
-
flush(): void;
|
|
26
|
-
};
|
|
27
|
-
};
|
|
1
|
+
import type { HookFetcherContext, MutationHookContext } from "@plasmicpkgs/commerce";
|
|
2
|
+
import type { LineItem } from "../types/cart";
|
|
3
|
+
import type { UpdateItemHook } from "../types/cart";
|
|
4
|
+
export type UpdateItemActionInput<T = any> = T extends LineItem ? Partial<UpdateItemHook["actionInput"]> : UpdateItemHook["actionInput"];
|
|
5
|
+
declare const _default: <T extends import("@plasmicpkgs/commerce/dist/types/cart").LineItem | undefined = undefined>(ctx?: {
|
|
6
|
+
item?: T | undefined;
|
|
7
|
+
wait?: number | undefined;
|
|
8
|
+
}) => ((input: UpdateItemActionInput<T>) => Promise<import("@plasmicpkgs/commerce/dist/types/cart").Cart | null | undefined>) & {
|
|
9
|
+
clear(): void;
|
|
10
|
+
} & {
|
|
11
|
+
flush(): void;
|
|
12
|
+
};
|
|
13
|
+
export default _default;
|
|
14
|
+
export declare const handler: {
|
|
15
|
+
fetchOptions: {
|
|
16
|
+
query: string;
|
|
17
|
+
};
|
|
18
|
+
fetcher({ input: { itemId, item }, options, fetch, }: HookFetcherContext<UpdateItemHook>): Promise<import("../types").Cart | undefined>;
|
|
19
|
+
useHook: ({ fetch }: MutationHookContext<UpdateItemHook>) => <T extends import("@plasmicpkgs/commerce/dist/types/cart").LineItem | undefined = undefined>(ctx?: {
|
|
20
|
+
item?: T | undefined;
|
|
21
|
+
wait?: number | undefined;
|
|
22
|
+
}) => ((input: UpdateItemActionInput<T>) => Promise<import("@plasmicpkgs/commerce/dist/types/cart").Cart | null | undefined>) & {
|
|
23
|
+
clear(): void;
|
|
24
|
+
} & {
|
|
25
|
+
flush(): void;
|
|
26
|
+
};
|
|
27
|
+
};
|
|
@@ -163,16 +163,16 @@ function _regeneratorDefine(e, r, n, t) {
|
|
|
163
163
|
}, _regeneratorDefine(e, r, n, t);
|
|
164
164
|
}
|
|
165
165
|
|
|
166
|
-
/*
|
|
167
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
168
|
-
Changes: Removed api_url
|
|
166
|
+
/*
|
|
167
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
168
|
+
Changes: Removed api_url
|
|
169
169
|
*/
|
|
170
170
|
var CHECKOUT_ID_COOKIE = 'saleor.CheckoutID';
|
|
171
171
|
var SALEOR_TOKEN = 'saleor.Token';
|
|
172
172
|
|
|
173
|
-
/*
|
|
174
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
175
|
-
Changes: None
|
|
173
|
+
/*
|
|
174
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
175
|
+
Changes: None
|
|
176
176
|
*/
|
|
177
177
|
var getSortVariables = function getSortVariables(sort, isCategory) {
|
|
178
178
|
var output = {};
|
|
@@ -290,9 +290,9 @@ var getSearchVariables = function getSearchVariables(_ref) {
|
|
|
290
290
|
};
|
|
291
291
|
};
|
|
292
292
|
|
|
293
|
-
/*
|
|
294
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
295
|
-
Changes: None
|
|
293
|
+
/*
|
|
294
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
295
|
+
Changes: None
|
|
296
296
|
*/
|
|
297
297
|
var getCheckoutId = function getCheckoutId(id) {
|
|
298
298
|
var _Cookies$get;
|
|
@@ -303,39 +303,39 @@ var getCheckoutId = function getCheckoutId(id) {
|
|
|
303
303
|
};
|
|
304
304
|
};
|
|
305
305
|
|
|
306
|
-
/*
|
|
307
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
308
|
-
Changes: None
|
|
306
|
+
/*
|
|
307
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
308
|
+
Changes: None
|
|
309
309
|
*/
|
|
310
310
|
var ProductConnection = /* GraphQL */"\n fragment ProductConnection on ProductCountableConnection {\n pageInfo {\n hasNextPage\n hasPreviousPage\n }\n edges {\n node {\n id\n name\n description\n slug\n pricing {\n priceRange {\n start {\n net {\n amount\n }\n }\n }\n }\n media {\n url\n alt\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 }\n }\n }\n";
|
|
311
311
|
|
|
312
|
-
/*
|
|
313
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
314
|
-
Changes: None
|
|
312
|
+
/*
|
|
313
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
314
|
+
Changes: None
|
|
315
315
|
*/
|
|
316
316
|
var CheckoutDetails = /* GraphQL */"\n fragment CheckoutDetails on Checkout {\n id\n token\n created\n totalPrice {\n currency\n gross {\n amount\n }\n }\n subtotalPrice {\n currency\n gross {\n amount\n }\n }\n\n lines {\n id\n variant {\n id\n name\n sku\n product {\n name\n slug\n id\n }\n media {\n url\n }\n pricing {\n price {\n gross {\n amount\n }\n }\n }\n }\n quantity\n totalPrice {\n currency\n gross {\n amount\n }\n }\n }\n }\n";
|
|
317
317
|
|
|
318
|
-
/*
|
|
319
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
320
|
-
Changes: None
|
|
318
|
+
/*
|
|
319
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
320
|
+
Changes: None
|
|
321
321
|
*/
|
|
322
322
|
var CheckoutCreate = /* GraphQL */"\n mutation CheckoutCreate {\n checkoutCreate(input: { email: \"customer@example.com\", lines: [], channel: \"default-channel\" }) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
323
323
|
|
|
324
|
-
/*
|
|
325
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
326
|
-
Changes: None
|
|
324
|
+
/*
|
|
325
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
326
|
+
Changes: None
|
|
327
327
|
*/
|
|
328
328
|
var CheckoutLineAdd = /* GraphQL */"\n mutation CheckoutLineAdd($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesAdd(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
329
329
|
|
|
330
|
-
/*
|
|
331
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
332
|
-
Changes: None
|
|
330
|
+
/*
|
|
331
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
332
|
+
Changes: None
|
|
333
333
|
*/
|
|
334
334
|
var CheckoutLineUpdate = /* GraphQL */"\n mutation CheckoutLineUpdate($checkoutId: ID!, $lineItems: [CheckoutLineInput!]!) {\n checkoutLinesUpdate(checkoutId: $checkoutId, lines: $lineItems) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
335
335
|
|
|
336
|
-
/*
|
|
337
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
338
|
-
Changes: None
|
|
336
|
+
/*
|
|
337
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
338
|
+
Changes: None
|
|
339
339
|
*/
|
|
340
340
|
var CheckoutLineDelete = /* GraphQL */"\n mutation CheckoutLineDelete($checkoutId: ID!, $lineId: ID!) {\n checkoutLineDelete(checkoutId: $checkoutId, lineId: $lineId) {\n errors {\n code\n field\n message\n }\n checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
341
341
|
|
|
@@ -375,9 +375,9 @@ var checkoutCreate = /*#__PURE__*/function () {
|
|
|
375
375
|
|
|
376
376
|
var _excluded = ["id", "name", "media", "variants", "description", "slug", "pricing"];
|
|
377
377
|
/* eslint-disable */
|
|
378
|
-
/*
|
|
379
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
380
|
-
Changes: None
|
|
378
|
+
/*
|
|
379
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
380
|
+
Changes: None
|
|
381
381
|
*/
|
|
382
382
|
// TODO: Check nextjs-commerce bug if no images are added for a product
|
|
383
383
|
var placeholderImg = "/product-img-placeholder.svg";
|
|
@@ -528,9 +528,9 @@ var normalizeCategory = function normalizeCategory(_ref4) {
|
|
|
528
528
|
};
|
|
529
529
|
};
|
|
530
530
|
|
|
531
|
-
/*
|
|
532
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
533
|
-
Changes: None
|
|
531
|
+
/*
|
|
532
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
533
|
+
Changes: None
|
|
534
534
|
*/
|
|
535
535
|
var throwUserErrors = function throwUserErrors(errors) {
|
|
536
536
|
if (errors && errors.length) {
|
|
@@ -547,9 +547,9 @@ var throwUserErrors = function throwUserErrors(errors) {
|
|
|
547
547
|
}
|
|
548
548
|
};
|
|
549
549
|
|
|
550
|
-
/*
|
|
551
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
552
|
-
Changes: None
|
|
550
|
+
/*
|
|
551
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
552
|
+
Changes: None
|
|
553
553
|
*/
|
|
554
554
|
var checkoutToCart = function checkoutToCart(checkoutPayload) {
|
|
555
555
|
var _checkoutPayload$erro;
|
|
@@ -574,50 +574,51 @@ var checkoutToCart = function checkoutToCart(checkoutPayload) {
|
|
|
574
574
|
return normalizeCart(checkout);
|
|
575
575
|
};
|
|
576
576
|
|
|
577
|
-
/*
|
|
578
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
579
|
-
Changes: None
|
|
577
|
+
/*
|
|
578
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
579
|
+
Changes: None
|
|
580
580
|
*/
|
|
581
581
|
var getToken = function getToken() {
|
|
582
582
|
return Cookies.get(SALEOR_TOKEN);
|
|
583
583
|
};
|
|
584
584
|
|
|
585
|
-
/*
|
|
586
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
587
|
-
Changes: None
|
|
585
|
+
/*
|
|
586
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
587
|
+
Changes: None
|
|
588
588
|
*/
|
|
589
589
|
var CollectionMany = /* GraphQL */"\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";
|
|
590
590
|
|
|
591
|
-
/*
|
|
592
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
593
|
-
Changes: None
|
|
591
|
+
/*
|
|
592
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
593
|
+
Changes: None
|
|
594
594
|
*/
|
|
595
595
|
var ProductOneBySlug = /* GraphQL */"\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";
|
|
596
596
|
|
|
597
|
-
/*
|
|
598
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
599
|
-
Changes: None
|
|
597
|
+
/*
|
|
598
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
599
|
+
Changes: None
|
|
600
600
|
*/
|
|
601
601
|
var ProductMany = /* GraphQL */"\n query ProductMany(\n $first: Int = 100\n $filter: ProductFilterInput\n $sortBy: ProductOrder\n $channel: String = \"default-channel\"\n ) {\n products(first: $first, channel: $channel, filter: $filter, sortBy: $sortBy) {\n ...ProductConnection\n }\n }\n " + ProductConnection + "\n";
|
|
602
602
|
|
|
603
|
-
/*
|
|
604
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
605
|
-
Changes: None
|
|
603
|
+
/*
|
|
604
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
605
|
+
Changes: None
|
|
606
606
|
*/
|
|
607
607
|
var CollectionOne = /* GraphQL */"\n query getProductsFromCollection($categoryId: ID!, $first: Int = 100, $channel: String = \"default-channel\") {\n collection(id: $categoryId, channel: $channel) {\n id\n name\n slug\n products(first: $first) {\n ...ProductConnection\n }\n }\n }\n " + ProductConnection + "\n";
|
|
608
608
|
|
|
609
|
-
/*
|
|
610
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
611
|
-
Changes: None
|
|
609
|
+
/*
|
|
610
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
611
|
+
Changes: None
|
|
612
612
|
*/
|
|
613
613
|
var CheckoutOne = /* GraphQL */"\n query CheckoutOne($checkoutId: UUID!) {\n checkout(token: $checkoutId) {\n ... on Checkout {\n ...CheckoutDetails\n }\n }\n }\n " + CheckoutDetails + "\n";
|
|
614
614
|
|
|
615
|
-
/*
|
|
616
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
617
|
-
Changes: None
|
|
615
|
+
/*
|
|
616
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
617
|
+
Changes: None
|
|
618
618
|
*/
|
|
619
619
|
var getAllProductVendors = /* GraphQL */"\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";
|
|
620
620
|
|
|
621
|
+
var _default = commerce.useCart;
|
|
621
622
|
var handler = {
|
|
622
623
|
fetchOptions: {
|
|
623
624
|
query: CheckoutOne
|
|
@@ -625,7 +626,7 @@ var handler = {
|
|
|
625
626
|
fetcher: function fetcher(_ref) {
|
|
626
627
|
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
627
628
|
var _checkout;
|
|
628
|
-
var checkoutId, options, fetch, checkout,
|
|
629
|
+
var checkoutId, options, fetch, checkout, checkoutToken, data;
|
|
629
630
|
return _regenerator().w(function (_context) {
|
|
630
631
|
while (1) switch (_context.n) {
|
|
631
632
|
case 0:
|
|
@@ -634,11 +635,11 @@ var handler = {
|
|
|
634
635
|
_context.n = 2;
|
|
635
636
|
break;
|
|
636
637
|
}
|
|
637
|
-
|
|
638
|
+
checkoutToken = getCheckoutId().checkoutToken;
|
|
638
639
|
_context.n = 1;
|
|
639
640
|
return fetch(_extends({}, options, {
|
|
640
641
|
variables: {
|
|
641
|
-
checkoutId:
|
|
642
|
+
checkoutId: checkoutToken
|
|
642
643
|
}
|
|
643
644
|
}));
|
|
644
645
|
case 1:
|
|
@@ -723,7 +724,7 @@ var handler$1 = {
|
|
|
723
724
|
useHook: function useHook(_ref2) {
|
|
724
725
|
var fetch = _ref2.fetch;
|
|
725
726
|
return function () {
|
|
726
|
-
var _useCart =
|
|
727
|
+
var _useCart = _default(),
|
|
727
728
|
mutate = _useCart.mutate;
|
|
728
729
|
return React.useCallback(/*#__PURE__*/function () {
|
|
729
730
|
var _addItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
|
|
@@ -791,7 +792,7 @@ var handler$2 = {
|
|
|
791
792
|
useHook: function useHook(_ref2) {
|
|
792
793
|
var fetch = _ref2.fetch;
|
|
793
794
|
return function () {
|
|
794
|
-
var _useCart =
|
|
795
|
+
var _useCart = _default(),
|
|
795
796
|
mutate = _useCart.mutate;
|
|
796
797
|
return React.useCallback(/*#__PURE__*/function () {
|
|
797
798
|
var _removeItem = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
|
|
@@ -889,7 +890,7 @@ var handler$3 = {
|
|
|
889
890
|
}
|
|
890
891
|
var _ctx = ctx,
|
|
891
892
|
item = _ctx.item;
|
|
892
|
-
var _useCart =
|
|
893
|
+
var _useCart = _default(),
|
|
893
894
|
mutate = _useCart.mutate;
|
|
894
895
|
return React.useCallback(debounce(/*#__PURE__*/function () {
|
|
895
896
|
var _ref3 = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee2(input) {
|
|
@@ -972,7 +973,7 @@ var handler$4 = {
|
|
|
972
973
|
});
|
|
973
974
|
case 3:
|
|
974
975
|
_data = _context.v;
|
|
975
|
-
return _context.a(2,
|
|
976
|
+
return _context.a(2, _data != null && _data.collection ? [normalizeCategory(_data == null ? void 0 : _data.collection)] : []);
|
|
976
977
|
case 4:
|
|
977
978
|
return _context.a(2);
|
|
978
979
|
}
|
|
@@ -1007,7 +1008,7 @@ var handler$5 = {
|
|
|
1007
1008
|
fetchOptions: {
|
|
1008
1009
|
query: getAllProductVendors
|
|
1009
1010
|
},
|
|
1010
|
-
fetcher: function fetcher(
|
|
1011
|
+
fetcher: function fetcher() {
|
|
1011
1012
|
return _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee() {
|
|
1012
1013
|
return _regenerator().w(function (_context) {
|
|
1013
1014
|
while (1) switch (_context.n) {
|
|
@@ -1017,8 +1018,8 @@ var handler$5 = {
|
|
|
1017
1018
|
}, _callee);
|
|
1018
1019
|
}))();
|
|
1019
1020
|
},
|
|
1020
|
-
useHook: function useHook(
|
|
1021
|
-
var useData =
|
|
1021
|
+
useHook: function useHook(_ref) {
|
|
1022
|
+
var useData = _ref.useData;
|
|
1022
1023
|
return function (input) {
|
|
1023
1024
|
var response = useData({
|
|
1024
1025
|
swrOptions: _extends({
|
|
@@ -1199,11 +1200,11 @@ var getFetcher = function getFetcher(saleorApiUrl) {
|
|
|
1199
1200
|
}();
|
|
1200
1201
|
};
|
|
1201
1202
|
|
|
1202
|
-
/*
|
|
1203
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1204
|
-
Changes:
|
|
1205
|
-
- Removed customer and auth hooks.
|
|
1206
|
-
- Added saleor_api_url parameters.
|
|
1203
|
+
/*
|
|
1204
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1205
|
+
Changes:
|
|
1206
|
+
- Removed customer and auth hooks.
|
|
1207
|
+
- Added saleor_api_url parameters.
|
|
1207
1208
|
*/
|
|
1208
1209
|
var getSaleorProvider = function getSaleorProvider(saleorApiUrl) {
|
|
1209
1210
|
return {
|
|
@@ -1227,10 +1228,10 @@ var getSaleorProvider = function getSaleorProvider(saleorApiUrl) {
|
|
|
1227
1228
|
};
|
|
1228
1229
|
};
|
|
1229
1230
|
|
|
1230
|
-
/*
|
|
1231
|
-
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1232
|
-
Changes:
|
|
1233
|
-
- Added saleor_api_url parameter.
|
|
1231
|
+
/*
|
|
1232
|
+
Forked from https://github.com/vercel/commerce/tree/main/packages/saleor/src
|
|
1233
|
+
Changes:
|
|
1234
|
+
- Added saleor_api_url parameter.
|
|
1234
1235
|
*/
|
|
1235
1236
|
var useCommerce = function useCommerce() {
|
|
1236
1237
|
return commerce.useCommerce();
|