@plasmicpkgs/commerce 0.0.148 → 0.0.149
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/commerce.cjs.development.js +154 -45
- package/dist/commerce.cjs.development.js.map +1 -1
- package/dist/commerce.cjs.production.min.js +1 -1
- package/dist/commerce.cjs.production.min.js.map +1 -1
- package/dist/commerce.esm.js +150 -46
- package/dist/commerce.esm.js.map +1 -1
- package/dist/contexts.d.ts +44 -0
- package/dist/index.d.ts +2 -0
- package/dist/registerCartProvider.d.ts +6 -0
- package/dist/types/cart.d.ts +15 -15
- package/package.json +2 -2
package/dist/contexts.d.ts
CHANGED
|
@@ -19,3 +19,47 @@ export declare function ProductMediaProvider({ mediaIndex, onClick, children, }:
|
|
|
19
19
|
onClick?: () => void;
|
|
20
20
|
}): JSX.Element;
|
|
21
21
|
export declare const useProductMediaContext: () => number | undefined;
|
|
22
|
+
export declare function CartActionsProvider(props: React.PropsWithChildren<{
|
|
23
|
+
globalContextName: string;
|
|
24
|
+
}>): JSX.Element;
|
|
25
|
+
export declare const globalActionsRegistrations: {
|
|
26
|
+
addItem: {
|
|
27
|
+
displayName: string;
|
|
28
|
+
parameters: {
|
|
29
|
+
productId: {
|
|
30
|
+
displayName: string;
|
|
31
|
+
type: string;
|
|
32
|
+
};
|
|
33
|
+
variantId: {
|
|
34
|
+
displayName: string;
|
|
35
|
+
type: string;
|
|
36
|
+
};
|
|
37
|
+
quantity: {
|
|
38
|
+
displayName: string;
|
|
39
|
+
type: string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
updateItem: {
|
|
44
|
+
displayName: string;
|
|
45
|
+
parameters: {
|
|
46
|
+
lineItemId: {
|
|
47
|
+
displayName: string;
|
|
48
|
+
type: string;
|
|
49
|
+
};
|
|
50
|
+
quantity: {
|
|
51
|
+
displayName: string;
|
|
52
|
+
type: string;
|
|
53
|
+
};
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
removeItem: {
|
|
57
|
+
displayName: string;
|
|
58
|
+
parameters: {
|
|
59
|
+
lineItemId: {
|
|
60
|
+
displayName: string;
|
|
61
|
+
type: string;
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
};
|
package/dist/index.d.ts
CHANGED
|
@@ -16,6 +16,7 @@ export { default as useSearch } from "./product/use-search";
|
|
|
16
16
|
export * from "./registerable";
|
|
17
17
|
export * from "./registerAddToCartButton";
|
|
18
18
|
export * from "./registerCart";
|
|
19
|
+
export * from "./registerCartProvider";
|
|
19
20
|
export * from "./registerCategoryCollection";
|
|
20
21
|
export * from "./registerCategoryField";
|
|
21
22
|
export * from "./registerCategoryLink";
|
|
@@ -41,4 +42,5 @@ export * as SiteTypes from "./types/site";
|
|
|
41
42
|
export { defaultProduct as ProductPlaceholder } from "./utils/default-product";
|
|
42
43
|
export * from "./utils/errors";
|
|
43
44
|
export * from "./utils/types";
|
|
45
|
+
export { globalActionsRegistrations, CartActionsProvider } from "./contexts";
|
|
44
46
|
export declare function registerAll(loader?: Registerable): void;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ComponentMeta } from "@plasmicapp/host/registerComponent";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Registerable } from "./registerable";
|
|
4
|
+
export declare const cartProviderMeta: ComponentMeta<React.PropsWithChildren<object>>;
|
|
5
|
+
export declare function CartProvider(props: React.PropsWithChildren<object>): JSX.Element;
|
|
6
|
+
export declare function registerCartProvider(loader?: Registerable, customCartProviderMeta?: ComponentMeta<React.PropsWithChildren<object>>): void;
|
package/dist/types/cart.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { Discount, Measurement, Image } from
|
|
1
|
+
import type { Discount, Measurement, Image } from "./common";
|
|
2
2
|
export declare type SelectedOption = {
|
|
3
3
|
id?: string;
|
|
4
4
|
name: string;
|
|
@@ -68,7 +68,7 @@ export declare type CartHooks<T extends CartTypes = CartTypes> = {
|
|
|
68
68
|
removeItem: RemoveItemHook<T>;
|
|
69
69
|
};
|
|
70
70
|
export declare type GetCartHook<T extends CartTypes = CartTypes> = {
|
|
71
|
-
data: T[
|
|
71
|
+
data: T["cart"] | null;
|
|
72
72
|
input: {};
|
|
73
73
|
fetcherInput: {
|
|
74
74
|
cartId?: string;
|
|
@@ -78,36 +78,36 @@ export declare type GetCartHook<T extends CartTypes = CartTypes> = {
|
|
|
78
78
|
};
|
|
79
79
|
};
|
|
80
80
|
export declare type AddItemHook<T extends CartTypes = CartTypes> = {
|
|
81
|
-
data: T[
|
|
82
|
-
input?: T[
|
|
83
|
-
fetcherInput: T[
|
|
81
|
+
data: T["cart"];
|
|
82
|
+
input?: T["itemBody"];
|
|
83
|
+
fetcherInput: T["itemBody"];
|
|
84
84
|
body: {
|
|
85
|
-
item: T[
|
|
85
|
+
item: T["itemBody"];
|
|
86
86
|
};
|
|
87
|
-
actionInput: T[
|
|
87
|
+
actionInput: T["itemBody"];
|
|
88
88
|
};
|
|
89
89
|
export declare type UpdateItemHook<T extends CartTypes = CartTypes> = {
|
|
90
|
-
data: T[
|
|
90
|
+
data: T["cart"] | null;
|
|
91
91
|
input: {
|
|
92
|
-
item?: T[
|
|
92
|
+
item?: T["item"];
|
|
93
93
|
wait?: number;
|
|
94
94
|
};
|
|
95
95
|
fetcherInput: {
|
|
96
96
|
itemId: string;
|
|
97
|
-
item: T[
|
|
97
|
+
item: Partial<T["itemBody"]>;
|
|
98
98
|
};
|
|
99
99
|
body: {
|
|
100
100
|
itemId: string;
|
|
101
|
-
item: T[
|
|
101
|
+
item: Partial<T["itemBody"]>;
|
|
102
102
|
};
|
|
103
|
-
actionInput: T[
|
|
103
|
+
actionInput: Partial<T["itemBody"]> & {
|
|
104
104
|
id: string;
|
|
105
105
|
};
|
|
106
106
|
};
|
|
107
107
|
export declare type RemoveItemHook<T extends CartTypes = CartTypes> = {
|
|
108
|
-
data: T[
|
|
108
|
+
data: T["cart"] | null;
|
|
109
109
|
input: {
|
|
110
|
-
item?: T[
|
|
110
|
+
item?: T["item"];
|
|
111
111
|
};
|
|
112
112
|
fetcherInput: {
|
|
113
113
|
itemId: string;
|
|
@@ -145,7 +145,7 @@ export declare type AddItemHandler<T extends CartTypes = CartTypes> = AddItemHoo
|
|
|
145
145
|
};
|
|
146
146
|
};
|
|
147
147
|
export declare type UpdateItemHandler<T extends CartTypes = CartTypes> = UpdateItemHook<T> & {
|
|
148
|
-
data: T[
|
|
148
|
+
data: T["cart"];
|
|
149
149
|
body: {
|
|
150
150
|
cartId: string;
|
|
151
151
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@plasmicpkgs/commerce",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.149",
|
|
4
4
|
"description": "Plasmic registration calls for commerce components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"react-hook-form": "^7.28.0",
|
|
45
45
|
"swr": "^1.2.2"
|
|
46
46
|
},
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "e3f13d75d61fb16c49f9166dca3b7e744e754c09"
|
|
48
48
|
}
|