@kotao/storefront 0.2.0
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 +21 -0
- package/README.md +34 -0
- package/dist/cart-documents-CwwRTvm8.d.ts +21 -0
- package/dist/cart-documents.d.ts +2 -0
- package/dist/cart-documents.js +3 -0
- package/dist/cart-documents.js.map +1 -0
- package/dist/chunk-2IWNUDSZ.js +104 -0
- package/dist/chunk-2IWNUDSZ.js.map +1 -0
- package/dist/chunk-3YQXJNR7.js +70 -0
- package/dist/chunk-3YQXJNR7.js.map +1 -0
- package/dist/chunk-5QOFKGKD.js +51 -0
- package/dist/chunk-5QOFKGKD.js.map +1 -0
- package/dist/chunk-GCQI6OKH.js +239 -0
- package/dist/chunk-GCQI6OKH.js.map +1 -0
- package/dist/chunk-ISAFEOR2.js +214 -0
- package/dist/chunk-ISAFEOR2.js.map +1 -0
- package/dist/chunk-MYDKIJRH.js +81 -0
- package/dist/chunk-MYDKIJRH.js.map +1 -0
- package/dist/chunk-OGWYTYYS.js +72 -0
- package/dist/chunk-OGWYTYYS.js.map +1 -0
- package/dist/chunk-PXZ737N3.js +439 -0
- package/dist/chunk-PXZ737N3.js.map +1 -0
- package/dist/chunk-QOEEUTHQ.js +110 -0
- package/dist/chunk-QOEEUTHQ.js.map +1 -0
- package/dist/chunk-U5677AEA.js +1690 -0
- package/dist/chunk-U5677AEA.js.map +1 -0
- package/dist/chunk-XMTWFJCZ.js +138 -0
- package/dist/chunk-XMTWFJCZ.js.map +1 -0
- package/dist/client-D9YYA2w6.d.ts +159 -0
- package/dist/customer-account-api-types.d.ts +144 -0
- package/dist/customer-account-api-types.js +3 -0
- package/dist/customer-account-api-types.js.map +1 -0
- package/dist/editor.d.ts +112 -0
- package/dist/editor.js +3 -0
- package/dist/editor.js.map +1 -0
- package/dist/image.d.ts +89 -0
- package/dist/image.js +3 -0
- package/dist/image.js.map +1 -0
- package/dist/index.d.ts +183 -0
- package/dist/index.js +208 -0
- package/dist/index.js.map +1 -0
- package/dist/pagination-CPgH3fAa.d.ts +77 -0
- package/dist/product.d.ts +105 -0
- package/dist/product.js +4 -0
- package/dist/product.js.map +1 -0
- package/dist/react-router.d.ts +29 -0
- package/dist/react-router.js +33 -0
- package/dist/react-router.js.map +1 -0
- package/dist/react.d.ts +299 -0
- package/dist/react.js +1813 -0
- package/dist/react.js.map +1 -0
- package/dist/routing-BfUp49o8.d.ts +302 -0
- package/dist/seo.d.ts +155 -0
- package/dist/seo.js +4 -0
- package/dist/seo.js.map +1 -0
- package/dist/settings.d.ts +87 -0
- package/dist/settings.js +3 -0
- package/dist/settings.js.map +1 -0
- package/dist/shop-DkQmro-Y.d.ts +202 -0
- package/dist/store-DQK1nhob.d.ts +67 -0
- package/dist/storefront-api-types.d.ts +312 -0
- package/dist/storefront-api-types.js +3 -0
- package/dist/storefront-api-types.js.map +1 -0
- package/dist/types-BDhHWZsP.d.ts +77 -0
- package/dist/types-Df3bGbKU.d.ts +167 -0
- package/package.json +82 -0
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
declare const CART_FORM_ACTIONS: Readonly<{
|
|
2
|
+
readonly LinesAdd: "LinesAdd";
|
|
3
|
+
readonly LinesUpdate: "LinesUpdate";
|
|
4
|
+
readonly LinesRemove: "LinesRemove";
|
|
5
|
+
readonly DiscountCodesUpdate: "DiscountCodesUpdate";
|
|
6
|
+
readonly GiftCardCodesAdd: "GiftCardCodesAdd";
|
|
7
|
+
readonly GiftCardCodesRemove: "GiftCardCodesRemove";
|
|
8
|
+
readonly BuyerIdentityUpdate: "BuyerIdentityUpdate";
|
|
9
|
+
readonly NoteUpdate: "NoteUpdate";
|
|
10
|
+
readonly AttributesUpdate: "AttributesUpdate";
|
|
11
|
+
readonly MetafieldsSet: "MetafieldsSet";
|
|
12
|
+
readonly MetafieldsDelete: "MetafieldsDelete";
|
|
13
|
+
readonly DeliveryAddressesReplace: "DeliveryAddressesReplace";
|
|
14
|
+
readonly SelectedDeliveryOptionsUpdate: "SelectedDeliveryOptionsUpdate";
|
|
15
|
+
}>;
|
|
16
|
+
type CartFormAction = (typeof CART_FORM_ACTIONS)[keyof typeof CART_FORM_ACTIONS];
|
|
17
|
+
|
|
18
|
+
interface CartAttribute {
|
|
19
|
+
readonly key: string;
|
|
20
|
+
readonly value: string | null;
|
|
21
|
+
}
|
|
22
|
+
interface CartLineInput {
|
|
23
|
+
readonly merchandiseId: string;
|
|
24
|
+
readonly quantity?: number | null;
|
|
25
|
+
readonly attributes?: readonly CartAttribute[] | null;
|
|
26
|
+
}
|
|
27
|
+
interface CartLineUpdateInput {
|
|
28
|
+
readonly id: string;
|
|
29
|
+
readonly merchandiseId?: string | null;
|
|
30
|
+
readonly quantity?: number | null;
|
|
31
|
+
readonly attributes?: readonly CartAttribute[] | null;
|
|
32
|
+
}
|
|
33
|
+
interface CartBuyerIdentityInput {
|
|
34
|
+
readonly email?: string | null;
|
|
35
|
+
readonly phone?: string | null;
|
|
36
|
+
readonly countryCode?: string | null;
|
|
37
|
+
readonly customerAccessToken?: string | null;
|
|
38
|
+
}
|
|
39
|
+
interface CartMetafield {
|
|
40
|
+
readonly namespace: string;
|
|
41
|
+
readonly key: string;
|
|
42
|
+
readonly type: string;
|
|
43
|
+
readonly value: string;
|
|
44
|
+
}
|
|
45
|
+
interface CartMetafieldIdentifier {
|
|
46
|
+
readonly namespace: string;
|
|
47
|
+
readonly key: string;
|
|
48
|
+
}
|
|
49
|
+
interface CartDeliveryAddress {
|
|
50
|
+
readonly id: string;
|
|
51
|
+
readonly firstName?: string | null;
|
|
52
|
+
readonly lastName?: string | null;
|
|
53
|
+
readonly address1: string;
|
|
54
|
+
readonly address2?: string | null;
|
|
55
|
+
readonly city: string;
|
|
56
|
+
readonly provinceCode?: string | null;
|
|
57
|
+
readonly countryCode: string;
|
|
58
|
+
readonly postalCode: string;
|
|
59
|
+
readonly phone?: string | null;
|
|
60
|
+
}
|
|
61
|
+
interface CartSelectedDeliveryOption {
|
|
62
|
+
readonly deliveryAddressId: string;
|
|
63
|
+
readonly handle: string;
|
|
64
|
+
}
|
|
65
|
+
interface Money {
|
|
66
|
+
readonly amount: number | string;
|
|
67
|
+
readonly currencyCode: string;
|
|
68
|
+
}
|
|
69
|
+
interface CartLineCost {
|
|
70
|
+
readonly amountPerQuantity: Money;
|
|
71
|
+
readonly subtotalAmount: Money;
|
|
72
|
+
readonly totalAmount: Money;
|
|
73
|
+
}
|
|
74
|
+
interface CartTaxLine {
|
|
75
|
+
readonly ratePercent: number;
|
|
76
|
+
readonly net: Money;
|
|
77
|
+
readonly tax: Money;
|
|
78
|
+
readonly gross: Money;
|
|
79
|
+
}
|
|
80
|
+
interface CartDiscountAllocation {
|
|
81
|
+
readonly code: string;
|
|
82
|
+
readonly amount: Money;
|
|
83
|
+
}
|
|
84
|
+
interface CartCost {
|
|
85
|
+
readonly subtotalAmount: Money;
|
|
86
|
+
readonly totalAmount: Money;
|
|
87
|
+
readonly totalTaxAmount: Money;
|
|
88
|
+
readonly discountTotal: Money;
|
|
89
|
+
readonly taxLines: readonly CartTaxLine[];
|
|
90
|
+
readonly discountAllocations: readonly CartDiscountAllocation[];
|
|
91
|
+
}
|
|
92
|
+
interface CartLine {
|
|
93
|
+
readonly id: string;
|
|
94
|
+
readonly quantity: number;
|
|
95
|
+
readonly merchandise: {
|
|
96
|
+
readonly id: string;
|
|
97
|
+
readonly title?: string | null;
|
|
98
|
+
readonly price?: Money | null;
|
|
99
|
+
};
|
|
100
|
+
readonly cost?: CartLineCost;
|
|
101
|
+
readonly attributes: readonly CartAttribute[];
|
|
102
|
+
}
|
|
103
|
+
interface CartBuyerIdentity {
|
|
104
|
+
readonly email: string | null;
|
|
105
|
+
readonly phone: string | null;
|
|
106
|
+
readonly countryCode: string | null;
|
|
107
|
+
}
|
|
108
|
+
interface Cart {
|
|
109
|
+
readonly id: string;
|
|
110
|
+
readonly checkoutUrl: string;
|
|
111
|
+
readonly totalQuantity: number;
|
|
112
|
+
readonly lines: readonly CartLine[];
|
|
113
|
+
readonly cost: CartCost;
|
|
114
|
+
readonly buyerIdentity: CartBuyerIdentity;
|
|
115
|
+
readonly note: string | null;
|
|
116
|
+
readonly attributes: readonly CartAttribute[];
|
|
117
|
+
readonly discountCodes: readonly string[];
|
|
118
|
+
readonly giftCardCodes: readonly string[];
|
|
119
|
+
readonly metafields: readonly CartMetafield[];
|
|
120
|
+
readonly deliveryAddresses: readonly CartDeliveryAddress[];
|
|
121
|
+
readonly selectedDeliveryOptions: readonly CartSelectedDeliveryOption[];
|
|
122
|
+
}
|
|
123
|
+
interface CartUserError {
|
|
124
|
+
readonly field?: readonly string[] | null;
|
|
125
|
+
readonly message: string;
|
|
126
|
+
readonly code?: string | null;
|
|
127
|
+
}
|
|
128
|
+
interface CartMutationResult {
|
|
129
|
+
readonly cart: Cart | null;
|
|
130
|
+
readonly userErrors: readonly CartUserError[];
|
|
131
|
+
readonly headers: Headers;
|
|
132
|
+
}
|
|
133
|
+
interface HydrogenCartCreateInput {
|
|
134
|
+
readonly lines?: readonly CartLineInput[];
|
|
135
|
+
readonly discountCodes?: readonly string[];
|
|
136
|
+
readonly note?: string | null;
|
|
137
|
+
readonly attributes?: readonly CartAttribute[];
|
|
138
|
+
readonly buyerIdentity?: CartBuyerIdentityInput;
|
|
139
|
+
}
|
|
140
|
+
interface HydrogenCartMutationResult extends CartMutationResult {
|
|
141
|
+
readonly errors?: readonly unknown[];
|
|
142
|
+
}
|
|
143
|
+
interface HydrogenCart {
|
|
144
|
+
get(): Promise<Cart | null>;
|
|
145
|
+
create(input?: HydrogenCartCreateInput): Promise<HydrogenCartMutationResult>;
|
|
146
|
+
addLines(lines: readonly CartLineInput[]): Promise<HydrogenCartMutationResult>;
|
|
147
|
+
updateLines(lines: readonly CartLineUpdateInput[]): Promise<HydrogenCartMutationResult>;
|
|
148
|
+
removeLines(lineIds: readonly string[]): Promise<HydrogenCartMutationResult>;
|
|
149
|
+
updateDiscountCodes(discountCodes: readonly string[]): Promise<HydrogenCartMutationResult>;
|
|
150
|
+
updateBuyerIdentity(buyerIdentity: CartBuyerIdentityInput): Promise<HydrogenCartMutationResult>;
|
|
151
|
+
setCartId(cartId: string): Headers;
|
|
152
|
+
}
|
|
153
|
+
interface HydrogenSessionData {
|
|
154
|
+
readonly cartId?: string | null;
|
|
155
|
+
}
|
|
156
|
+
interface HydrogenSession {
|
|
157
|
+
readonly isPending?: boolean;
|
|
158
|
+
readonly has: (name: string) => boolean;
|
|
159
|
+
readonly get: (name: string) => unknown;
|
|
160
|
+
readonly flash: (name: string, value?: unknown) => unknown;
|
|
161
|
+
readonly unset: (name: string) => void;
|
|
162
|
+
readonly set: (name: string, value: unknown) => void;
|
|
163
|
+
destroy(): string | Promise<string>;
|
|
164
|
+
commit(): string | Promise<string>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export { type CartFormAction as C, type HydrogenSession as H, type Cart as a, type CartLineInput as b, type CartAttribute as c, type CartBuyerIdentityInput as d, type CartMutationResult as e, type CartLineUpdateInput as f, type CartMetafield as g, type CartMetafieldIdentifier as h, type CartDeliveryAddress as i, type CartSelectedDeliveryOption as j, CART_FORM_ACTIONS as k, type CartBuyerIdentity as l, type CartLine as m, type CartUserError as n, type HydrogenCart as o, type HydrogenCartCreateInput as p, type HydrogenCartMutationResult as q, type HydrogenSessionData as r };
|
package/package.json
ADDED
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@kotao/storefront",
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"description": "Kotao Storefronts theme SDK — framework-agnostic server runtime (storefront client, SWR isolated cache, signed geo) + React Router 7 binding. Mirrors Hydrogen's API (ADR-0003). Leaf package (ADR-0006).",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/kotao-org/monorepo.git",
|
|
10
|
+
"directory": "packages/storefront"
|
|
11
|
+
},
|
|
12
|
+
"exports": {
|
|
13
|
+
".": {
|
|
14
|
+
"types": "./dist/index.d.ts",
|
|
15
|
+
"import": "./dist/index.js"
|
|
16
|
+
},
|
|
17
|
+
"./cart-documents": {
|
|
18
|
+
"types": "./dist/cart-documents.d.ts",
|
|
19
|
+
"import": "./dist/cart-documents.js"
|
|
20
|
+
},
|
|
21
|
+
"./customer-account-api-types": {
|
|
22
|
+
"types": "./dist/customer-account-api-types.d.ts",
|
|
23
|
+
"import": "./dist/customer-account-api-types.js"
|
|
24
|
+
},
|
|
25
|
+
"./editor": {
|
|
26
|
+
"types": "./dist/editor.d.ts",
|
|
27
|
+
"import": "./dist/editor.js"
|
|
28
|
+
},
|
|
29
|
+
"./image": {
|
|
30
|
+
"types": "./dist/image.d.ts",
|
|
31
|
+
"import": "./dist/image.js"
|
|
32
|
+
},
|
|
33
|
+
"./product": {
|
|
34
|
+
"types": "./dist/product.d.ts",
|
|
35
|
+
"import": "./dist/product.js"
|
|
36
|
+
},
|
|
37
|
+
"./react": {
|
|
38
|
+
"types": "./dist/react.d.ts",
|
|
39
|
+
"import": "./dist/react.js"
|
|
40
|
+
},
|
|
41
|
+
"./react-router": {
|
|
42
|
+
"types": "./dist/react-router.d.ts",
|
|
43
|
+
"import": "./dist/react-router.js"
|
|
44
|
+
},
|
|
45
|
+
"./seo": {
|
|
46
|
+
"types": "./dist/seo.d.ts",
|
|
47
|
+
"import": "./dist/seo.js"
|
|
48
|
+
},
|
|
49
|
+
"./settings": {
|
|
50
|
+
"types": "./dist/settings.d.ts",
|
|
51
|
+
"import": "./dist/settings.js"
|
|
52
|
+
},
|
|
53
|
+
"./storefront-api-types": {
|
|
54
|
+
"types": "./dist/storefront-api-types.d.ts",
|
|
55
|
+
"import": "./dist/storefront-api-types.js"
|
|
56
|
+
}
|
|
57
|
+
},
|
|
58
|
+
"files": [
|
|
59
|
+
"dist",
|
|
60
|
+
"LICENSE"
|
|
61
|
+
],
|
|
62
|
+
"dependencies": {
|
|
63
|
+
"@kotao/storefront-contracts": "^0.2.0"
|
|
64
|
+
},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"react": "^18.2.0 || ^19.0.0",
|
|
67
|
+
"react-router": "^7.16.0"
|
|
68
|
+
},
|
|
69
|
+
"peerDependenciesMeta": {
|
|
70
|
+
"react": {
|
|
71
|
+
"optional": true
|
|
72
|
+
},
|
|
73
|
+
"react-router": {
|
|
74
|
+
"optional": true
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
"main": "./dist/index.js",
|
|
78
|
+
"types": "./dist/index.d.ts",
|
|
79
|
+
"publishConfig": {
|
|
80
|
+
"access": "public"
|
|
81
|
+
}
|
|
82
|
+
}
|