@cmssy/react 1.0.0 → 2.0.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/dist/client.cjs +53 -3
- package/dist/client.d.cts +22 -4
- package/dist/client.d.ts +22 -4
- package/dist/client.js +53 -4
- package/dist/{commerce-queries-BReujpXO.d.cts → commerce-queries-fR6ZKQ3r.d.cts} +55 -8
- package/dist/{commerce-queries-BReujpXO.d.ts → commerce-queries-fR6ZKQ3r.d.ts} +55 -8
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/package.json +1 -1
package/dist/client.cjs
CHANGED
|
@@ -1023,13 +1023,18 @@ function CmssyCommerceProvider({
|
|
|
1023
1023
|
() => runCart("remove-discount", {}),
|
|
1024
1024
|
[runCart]
|
|
1025
1025
|
);
|
|
1026
|
+
const setShippingMethod = react.useCallback(
|
|
1027
|
+
(shippingMethodId) => runCart("set-shipping", { shippingMethodId }),
|
|
1028
|
+
[runCart]
|
|
1029
|
+
);
|
|
1030
|
+
const merge = react.useCallback(() => runCart("merge", {}), [runCart]);
|
|
1026
1031
|
const checkout = react.useCallback(
|
|
1027
|
-
async (
|
|
1032
|
+
async (input) => {
|
|
1028
1033
|
const gen = ++generation.current;
|
|
1029
1034
|
setError(null);
|
|
1030
1035
|
try {
|
|
1031
1036
|
const data = await post("checkout", {
|
|
1032
|
-
|
|
1037
|
+
...input
|
|
1033
1038
|
});
|
|
1034
1039
|
if (gen === generation.current) setCart(null);
|
|
1035
1040
|
return data.order;
|
|
@@ -1063,6 +1068,8 @@ function CmssyCommerceProvider({
|
|
|
1063
1068
|
clearCart,
|
|
1064
1069
|
applyDiscount,
|
|
1065
1070
|
removeDiscount,
|
|
1071
|
+
setShippingMethod,
|
|
1072
|
+
merge,
|
|
1066
1073
|
checkout,
|
|
1067
1074
|
refresh,
|
|
1068
1075
|
fetchProduct
|
|
@@ -1077,6 +1084,8 @@ function CmssyCommerceProvider({
|
|
|
1077
1084
|
clearCart,
|
|
1078
1085
|
applyDiscount,
|
|
1079
1086
|
removeDiscount,
|
|
1087
|
+
setShippingMethod,
|
|
1088
|
+
merge,
|
|
1080
1089
|
checkout,
|
|
1081
1090
|
refresh,
|
|
1082
1091
|
fetchProduct
|
|
@@ -1457,7 +1466,7 @@ function CheckoutComponent({ content }) {
|
|
|
1457
1466
|
setBusy(true);
|
|
1458
1467
|
setError(null);
|
|
1459
1468
|
try {
|
|
1460
|
-
setOrder(await checkout(email.trim()));
|
|
1469
|
+
setOrder(await checkout({ customerEmail: email.trim() }));
|
|
1461
1470
|
} catch (err) {
|
|
1462
1471
|
setError(err instanceof Error ? err.message : "Checkout failed");
|
|
1463
1472
|
} finally {
|
|
@@ -1558,6 +1567,46 @@ function useCmssyOrders(options = {}) {
|
|
|
1558
1567
|
}, [load]);
|
|
1559
1568
|
return { orders, total, hasMore, loading, error, refresh: load };
|
|
1560
1569
|
}
|
|
1570
|
+
function useCmssyOrder(id, options = {}) {
|
|
1571
|
+
const base = (options.basePath ?? "/api/cmssy/orders").replace(/\/+$/, "");
|
|
1572
|
+
const [order, setOrder] = react.useState(null);
|
|
1573
|
+
const [loading, setLoading] = react.useState(Boolean(id));
|
|
1574
|
+
const [error, setError] = react.useState(null);
|
|
1575
|
+
const load = react.useCallback(async () => {
|
|
1576
|
+
if (!id) {
|
|
1577
|
+
setOrder(null);
|
|
1578
|
+
setLoading(false);
|
|
1579
|
+
return;
|
|
1580
|
+
}
|
|
1581
|
+
setLoading(true);
|
|
1582
|
+
setError(null);
|
|
1583
|
+
try {
|
|
1584
|
+
const qs = new URLSearchParams({ id });
|
|
1585
|
+
const res = await fetch(`${base}?${qs.toString()}`, {
|
|
1586
|
+
credentials: "same-origin",
|
|
1587
|
+
cache: "no-store"
|
|
1588
|
+
});
|
|
1589
|
+
if (res.status === 401) {
|
|
1590
|
+
setOrder(null);
|
|
1591
|
+
return;
|
|
1592
|
+
}
|
|
1593
|
+
if (!res.ok) {
|
|
1594
|
+
const body = await res.json().catch(() => ({}));
|
|
1595
|
+
throw new Error(body.message ?? `Order request failed (${res.status})`);
|
|
1596
|
+
}
|
|
1597
|
+
const data = await res.json();
|
|
1598
|
+
setOrder(data.order ?? null);
|
|
1599
|
+
} catch (e) {
|
|
1600
|
+
setError(e instanceof Error ? e.message : "Could not load the order");
|
|
1601
|
+
} finally {
|
|
1602
|
+
setLoading(false);
|
|
1603
|
+
}
|
|
1604
|
+
}, [base, id]);
|
|
1605
|
+
react.useEffect(() => {
|
|
1606
|
+
void load();
|
|
1607
|
+
}, [load]);
|
|
1608
|
+
return { order, loading, error, refresh: load };
|
|
1609
|
+
}
|
|
1561
1610
|
|
|
1562
1611
|
exports.CmssyAuthProvider = CmssyAuthProvider;
|
|
1563
1612
|
exports.CmssyCommerceProvider = CmssyCommerceProvider;
|
|
@@ -1575,6 +1624,7 @@ exports.productBlock = productBlock;
|
|
|
1575
1624
|
exports.toMinorUnits = toMinorUnits;
|
|
1576
1625
|
exports.useCart = useCart;
|
|
1577
1626
|
exports.useCmssyLocale = useCmssyLocale;
|
|
1627
|
+
exports.useCmssyOrder = useCmssyOrder;
|
|
1578
1628
|
exports.useCmssyOrders = useCmssyOrders;
|
|
1579
1629
|
exports.useCmssyUser = useCmssyUser;
|
|
1580
1630
|
exports.useEditBridge = useEditBridge;
|
package/dist/client.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as
|
|
3
|
-
export {
|
|
2
|
+
import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyAddress, g as CmssyCart, h as CmssyOrder, i as CmssyProduct } from './commerce-queries-fR6ZKQ3r.cjs';
|
|
3
|
+
export { j as CmssyCartDiscount, k as CmssyCartItem, l as CmssyCartItemSnapshot, m as CmssyOrderItem, n as CmssyProductVariant } from './commerce-queries-fR6ZKQ3r.cjs';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
import '@cmssy/types';
|
|
6
6
|
|
|
@@ -127,6 +127,12 @@ interface CmssyAddToCartOptions {
|
|
|
127
127
|
variantSelections?: Record<string, string>;
|
|
128
128
|
notes?: string;
|
|
129
129
|
}
|
|
130
|
+
interface CmssyCheckoutInput {
|
|
131
|
+
customerEmail: string;
|
|
132
|
+
poNumber?: string | null;
|
|
133
|
+
customerNote?: string | null;
|
|
134
|
+
shippingAddress?: CmssyAddress | null;
|
|
135
|
+
}
|
|
130
136
|
interface CmssyCommerceState {
|
|
131
137
|
cart: CmssyCart | null;
|
|
132
138
|
loading: boolean;
|
|
@@ -137,7 +143,9 @@ interface CmssyCommerceState {
|
|
|
137
143
|
clearCart(): Promise<void>;
|
|
138
144
|
applyDiscount(code: string): Promise<void>;
|
|
139
145
|
removeDiscount(): Promise<void>;
|
|
140
|
-
|
|
146
|
+
setShippingMethod(shippingMethodId: string | null): Promise<void>;
|
|
147
|
+
merge(): Promise<void>;
|
|
148
|
+
checkout(input: CmssyCheckoutInput): Promise<CmssyOrder>;
|
|
141
149
|
refresh(): Promise<void>;
|
|
142
150
|
fetchProduct(modelSlug: string, filter: Record<string, unknown>): Promise<CmssyProduct | null>;
|
|
143
151
|
}
|
|
@@ -168,10 +176,20 @@ interface UseCmssyOrdersOptions {
|
|
|
168
176
|
limit?: number;
|
|
169
177
|
}
|
|
170
178
|
declare function useCmssyOrders(options?: UseCmssyOrdersOptions): CmssyOrdersState;
|
|
179
|
+
interface CmssyOrderState {
|
|
180
|
+
order: CmssyOrder | null;
|
|
181
|
+
loading: boolean;
|
|
182
|
+
error: string | null;
|
|
183
|
+
refresh(): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
interface UseCmssyOrderOptions {
|
|
186
|
+
basePath?: string;
|
|
187
|
+
}
|
|
188
|
+
declare function useCmssyOrder(id: string | null | undefined, options?: UseCmssyOrderOptions): CmssyOrderState;
|
|
171
189
|
|
|
172
190
|
declare function fractionDigits(currency: string): number;
|
|
173
191
|
declare function fromMinorUnits(minor: number, currency: string): number;
|
|
174
192
|
declare function toMinorUnits(amount: number, currency: string): number;
|
|
175
193
|
declare function formatPrice(minor: number, currency: string | null | undefined): string;
|
|
176
194
|
|
|
177
|
-
export { type CmssyAddToCartOptions, type CmssyAuthActionResult, CmssyAuthProvider, type CmssyAuthProviderProps, type CmssyAuthState, type CmssyAuthUser, CmssyCart, CmssyCommerceProvider, type CmssyCommerceProviderProps, type CmssyCommerceState, CmssyEditableLayout, type CmssyEditableLayoutProps, CmssyEditablePage, type CmssyEditablePageProps, CmssyLazyEditor, type CmssyLazyEditorProps, CmssyLazyLayout, type CmssyLazyLayoutProps, CmssyLocaleProvider, type CmssyLocaleProviderProps, CmssyOrder, type CmssyOrdersState, CmssyProduct, type EditBridgeConfig, type EditBridgeState, type PatchMap, type UseCmssyOrdersOptions, cartBlock, checkoutBlock, formatPrice, fractionDigits, fromMinorUnits, productBlock, toMinorUnits, useCart, useCmssyLocale, useCmssyOrders, useCmssyUser, useEditBridge };
|
|
195
|
+
export { type CmssyAddToCartOptions, type CmssyAuthActionResult, CmssyAuthProvider, type CmssyAuthProviderProps, type CmssyAuthState, type CmssyAuthUser, CmssyCart, type CmssyCheckoutInput, CmssyCommerceProvider, type CmssyCommerceProviderProps, type CmssyCommerceState, CmssyEditableLayout, type CmssyEditableLayoutProps, CmssyEditablePage, type CmssyEditablePageProps, CmssyLazyEditor, type CmssyLazyEditorProps, CmssyLazyLayout, type CmssyLazyLayoutProps, CmssyLocaleProvider, type CmssyLocaleProviderProps, CmssyOrder, type CmssyOrderState, type CmssyOrdersState, CmssyProduct, type EditBridgeConfig, type EditBridgeState, type PatchMap, type UseCmssyOrderOptions, type UseCmssyOrdersOptions, cartBlock, checkoutBlock, formatPrice, fractionDigits, fromMinorUnits, productBlock, toMinorUnits, useCart, useCmssyLocale, useCmssyOrder, useCmssyOrders, useCmssyUser, useEditBridge };
|
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as
|
|
3
|
-
export {
|
|
2
|
+
import { B as BlockSchema, a as BlockMeta, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, d as CmssyLayoutGroup, e as CmssyLocaleContext, f as CmssyAddress, g as CmssyCart, h as CmssyOrder, i as CmssyProduct } from './commerce-queries-fR6ZKQ3r.js';
|
|
3
|
+
export { j as CmssyCartDiscount, k as CmssyCartItem, l as CmssyCartItemSnapshot, m as CmssyOrderItem, n as CmssyProductVariant } from './commerce-queries-fR6ZKQ3r.js';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
import '@cmssy/types';
|
|
6
6
|
|
|
@@ -127,6 +127,12 @@ interface CmssyAddToCartOptions {
|
|
|
127
127
|
variantSelections?: Record<string, string>;
|
|
128
128
|
notes?: string;
|
|
129
129
|
}
|
|
130
|
+
interface CmssyCheckoutInput {
|
|
131
|
+
customerEmail: string;
|
|
132
|
+
poNumber?: string | null;
|
|
133
|
+
customerNote?: string | null;
|
|
134
|
+
shippingAddress?: CmssyAddress | null;
|
|
135
|
+
}
|
|
130
136
|
interface CmssyCommerceState {
|
|
131
137
|
cart: CmssyCart | null;
|
|
132
138
|
loading: boolean;
|
|
@@ -137,7 +143,9 @@ interface CmssyCommerceState {
|
|
|
137
143
|
clearCart(): Promise<void>;
|
|
138
144
|
applyDiscount(code: string): Promise<void>;
|
|
139
145
|
removeDiscount(): Promise<void>;
|
|
140
|
-
|
|
146
|
+
setShippingMethod(shippingMethodId: string | null): Promise<void>;
|
|
147
|
+
merge(): Promise<void>;
|
|
148
|
+
checkout(input: CmssyCheckoutInput): Promise<CmssyOrder>;
|
|
141
149
|
refresh(): Promise<void>;
|
|
142
150
|
fetchProduct(modelSlug: string, filter: Record<string, unknown>): Promise<CmssyProduct | null>;
|
|
143
151
|
}
|
|
@@ -168,10 +176,20 @@ interface UseCmssyOrdersOptions {
|
|
|
168
176
|
limit?: number;
|
|
169
177
|
}
|
|
170
178
|
declare function useCmssyOrders(options?: UseCmssyOrdersOptions): CmssyOrdersState;
|
|
179
|
+
interface CmssyOrderState {
|
|
180
|
+
order: CmssyOrder | null;
|
|
181
|
+
loading: boolean;
|
|
182
|
+
error: string | null;
|
|
183
|
+
refresh(): Promise<void>;
|
|
184
|
+
}
|
|
185
|
+
interface UseCmssyOrderOptions {
|
|
186
|
+
basePath?: string;
|
|
187
|
+
}
|
|
188
|
+
declare function useCmssyOrder(id: string | null | undefined, options?: UseCmssyOrderOptions): CmssyOrderState;
|
|
171
189
|
|
|
172
190
|
declare function fractionDigits(currency: string): number;
|
|
173
191
|
declare function fromMinorUnits(minor: number, currency: string): number;
|
|
174
192
|
declare function toMinorUnits(amount: number, currency: string): number;
|
|
175
193
|
declare function formatPrice(minor: number, currency: string | null | undefined): string;
|
|
176
194
|
|
|
177
|
-
export { type CmssyAddToCartOptions, type CmssyAuthActionResult, CmssyAuthProvider, type CmssyAuthProviderProps, type CmssyAuthState, type CmssyAuthUser, CmssyCart, CmssyCommerceProvider, type CmssyCommerceProviderProps, type CmssyCommerceState, CmssyEditableLayout, type CmssyEditableLayoutProps, CmssyEditablePage, type CmssyEditablePageProps, CmssyLazyEditor, type CmssyLazyEditorProps, CmssyLazyLayout, type CmssyLazyLayoutProps, CmssyLocaleProvider, type CmssyLocaleProviderProps, CmssyOrder, type CmssyOrdersState, CmssyProduct, type EditBridgeConfig, type EditBridgeState, type PatchMap, type UseCmssyOrdersOptions, cartBlock, checkoutBlock, formatPrice, fractionDigits, fromMinorUnits, productBlock, toMinorUnits, useCart, useCmssyLocale, useCmssyOrders, useCmssyUser, useEditBridge };
|
|
195
|
+
export { type CmssyAddToCartOptions, type CmssyAuthActionResult, CmssyAuthProvider, type CmssyAuthProviderProps, type CmssyAuthState, type CmssyAuthUser, CmssyCart, type CmssyCheckoutInput, CmssyCommerceProvider, type CmssyCommerceProviderProps, type CmssyCommerceState, CmssyEditableLayout, type CmssyEditableLayoutProps, CmssyEditablePage, type CmssyEditablePageProps, CmssyLazyEditor, type CmssyLazyEditorProps, CmssyLazyLayout, type CmssyLazyLayoutProps, CmssyLocaleProvider, type CmssyLocaleProviderProps, CmssyOrder, type CmssyOrderState, type CmssyOrdersState, CmssyProduct, type EditBridgeConfig, type EditBridgeState, type PatchMap, type UseCmssyOrderOptions, type UseCmssyOrdersOptions, cartBlock, checkoutBlock, formatPrice, fractionDigits, fromMinorUnits, productBlock, toMinorUnits, useCart, useCmssyLocale, useCmssyOrder, useCmssyOrders, useCmssyUser, useEditBridge };
|
package/dist/client.js
CHANGED
|
@@ -1021,13 +1021,18 @@ function CmssyCommerceProvider({
|
|
|
1021
1021
|
() => runCart("remove-discount", {}),
|
|
1022
1022
|
[runCart]
|
|
1023
1023
|
);
|
|
1024
|
+
const setShippingMethod = useCallback(
|
|
1025
|
+
(shippingMethodId) => runCart("set-shipping", { shippingMethodId }),
|
|
1026
|
+
[runCart]
|
|
1027
|
+
);
|
|
1028
|
+
const merge = useCallback(() => runCart("merge", {}), [runCart]);
|
|
1024
1029
|
const checkout = useCallback(
|
|
1025
|
-
async (
|
|
1030
|
+
async (input) => {
|
|
1026
1031
|
const gen = ++generation.current;
|
|
1027
1032
|
setError(null);
|
|
1028
1033
|
try {
|
|
1029
1034
|
const data = await post("checkout", {
|
|
1030
|
-
|
|
1035
|
+
...input
|
|
1031
1036
|
});
|
|
1032
1037
|
if (gen === generation.current) setCart(null);
|
|
1033
1038
|
return data.order;
|
|
@@ -1061,6 +1066,8 @@ function CmssyCommerceProvider({
|
|
|
1061
1066
|
clearCart,
|
|
1062
1067
|
applyDiscount,
|
|
1063
1068
|
removeDiscount,
|
|
1069
|
+
setShippingMethod,
|
|
1070
|
+
merge,
|
|
1064
1071
|
checkout,
|
|
1065
1072
|
refresh,
|
|
1066
1073
|
fetchProduct
|
|
@@ -1075,6 +1082,8 @@ function CmssyCommerceProvider({
|
|
|
1075
1082
|
clearCart,
|
|
1076
1083
|
applyDiscount,
|
|
1077
1084
|
removeDiscount,
|
|
1085
|
+
setShippingMethod,
|
|
1086
|
+
merge,
|
|
1078
1087
|
checkout,
|
|
1079
1088
|
refresh,
|
|
1080
1089
|
fetchProduct
|
|
@@ -1455,7 +1464,7 @@ function CheckoutComponent({ content }) {
|
|
|
1455
1464
|
setBusy(true);
|
|
1456
1465
|
setError(null);
|
|
1457
1466
|
try {
|
|
1458
|
-
setOrder(await checkout(email.trim()));
|
|
1467
|
+
setOrder(await checkout({ customerEmail: email.trim() }));
|
|
1459
1468
|
} catch (err) {
|
|
1460
1469
|
setError(err instanceof Error ? err.message : "Checkout failed");
|
|
1461
1470
|
} finally {
|
|
@@ -1556,5 +1565,45 @@ function useCmssyOrders(options = {}) {
|
|
|
1556
1565
|
}, [load]);
|
|
1557
1566
|
return { orders, total, hasMore, loading, error, refresh: load };
|
|
1558
1567
|
}
|
|
1568
|
+
function useCmssyOrder(id, options = {}) {
|
|
1569
|
+
const base = (options.basePath ?? "/api/cmssy/orders").replace(/\/+$/, "");
|
|
1570
|
+
const [order, setOrder] = useState(null);
|
|
1571
|
+
const [loading, setLoading] = useState(Boolean(id));
|
|
1572
|
+
const [error, setError] = useState(null);
|
|
1573
|
+
const load = useCallback(async () => {
|
|
1574
|
+
if (!id) {
|
|
1575
|
+
setOrder(null);
|
|
1576
|
+
setLoading(false);
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1579
|
+
setLoading(true);
|
|
1580
|
+
setError(null);
|
|
1581
|
+
try {
|
|
1582
|
+
const qs = new URLSearchParams({ id });
|
|
1583
|
+
const res = await fetch(`${base}?${qs.toString()}`, {
|
|
1584
|
+
credentials: "same-origin",
|
|
1585
|
+
cache: "no-store"
|
|
1586
|
+
});
|
|
1587
|
+
if (res.status === 401) {
|
|
1588
|
+
setOrder(null);
|
|
1589
|
+
return;
|
|
1590
|
+
}
|
|
1591
|
+
if (!res.ok) {
|
|
1592
|
+
const body = await res.json().catch(() => ({}));
|
|
1593
|
+
throw new Error(body.message ?? `Order request failed (${res.status})`);
|
|
1594
|
+
}
|
|
1595
|
+
const data = await res.json();
|
|
1596
|
+
setOrder(data.order ?? null);
|
|
1597
|
+
} catch (e) {
|
|
1598
|
+
setError(e instanceof Error ? e.message : "Could not load the order");
|
|
1599
|
+
} finally {
|
|
1600
|
+
setLoading(false);
|
|
1601
|
+
}
|
|
1602
|
+
}, [base, id]);
|
|
1603
|
+
useEffect(() => {
|
|
1604
|
+
void load();
|
|
1605
|
+
}, [load]);
|
|
1606
|
+
return { order, loading, error, refresh: load };
|
|
1607
|
+
}
|
|
1559
1608
|
|
|
1560
|
-
export { CmssyAuthProvider, CmssyCommerceProvider, CmssyEditableLayout, CmssyEditablePage, CmssyLazyEditor, CmssyLazyLayout, CmssyLocaleProvider, cartBlock, checkoutBlock, formatPrice, fractionDigits, fromMinorUnits, productBlock, toMinorUnits, useCart, useCmssyLocale, useCmssyOrders, useCmssyUser, useEditBridge };
|
|
1609
|
+
export { CmssyAuthProvider, CmssyCommerceProvider, CmssyEditableLayout, CmssyEditablePage, CmssyLazyEditor, CmssyLazyLayout, CmssyLocaleProvider, cartBlock, checkoutBlock, formatPrice, fractionDigits, fromMinorUnits, productBlock, toMinorUnits, useCart, useCmssyLocale, useCmssyOrder, useCmssyOrders, useCmssyUser, useEditBridge };
|
|
@@ -396,12 +396,17 @@ declare function blocksToMeta(blocks: BlockDefinition[], defaults?: {
|
|
|
396
396
|
category?: string;
|
|
397
397
|
}): Record<string, BlockMeta>;
|
|
398
398
|
|
|
399
|
+
interface CmssyPriceTier {
|
|
400
|
+
minQty: number;
|
|
401
|
+
price: number;
|
|
402
|
+
}
|
|
399
403
|
interface CmssyCartItemSnapshot {
|
|
400
404
|
name: string;
|
|
401
405
|
price: number;
|
|
402
406
|
currency: string;
|
|
403
407
|
imageUrl: string | null;
|
|
404
408
|
sku: string | null;
|
|
409
|
+
tiers: CmssyPriceTier[];
|
|
405
410
|
}
|
|
406
411
|
interface CmssyCartItem {
|
|
407
412
|
id: string;
|
|
@@ -409,9 +414,35 @@ interface CmssyCartItem {
|
|
|
409
414
|
quantity: number;
|
|
410
415
|
variantSelections: Record<string, string> | null;
|
|
411
416
|
snapshot: CmssyCartItemSnapshot;
|
|
417
|
+
unitPrice: number;
|
|
412
418
|
currentPrice: number | null;
|
|
413
419
|
priceMismatch: boolean;
|
|
414
420
|
}
|
|
421
|
+
interface CmssyShippingMethod {
|
|
422
|
+
id: string;
|
|
423
|
+
label: string;
|
|
424
|
+
price: number;
|
|
425
|
+
etaLabel: string | null;
|
|
426
|
+
}
|
|
427
|
+
interface CmssyTaxSummaryLine {
|
|
428
|
+
rateId: string | null;
|
|
429
|
+
name: string | null;
|
|
430
|
+
rate: number;
|
|
431
|
+
base: number;
|
|
432
|
+
amount: number;
|
|
433
|
+
}
|
|
434
|
+
interface CmssyAddress {
|
|
435
|
+
name: string;
|
|
436
|
+
company?: string | null;
|
|
437
|
+
line1: string;
|
|
438
|
+
line2?: string | null;
|
|
439
|
+
postalCode: string;
|
|
440
|
+
city: string;
|
|
441
|
+
region?: string | null;
|
|
442
|
+
country: string;
|
|
443
|
+
phone?: string | null;
|
|
444
|
+
vatId?: string | null;
|
|
445
|
+
}
|
|
415
446
|
interface CmssyCartDiscount {
|
|
416
447
|
code: string;
|
|
417
448
|
type: string;
|
|
@@ -427,6 +458,13 @@ interface CmssyCart {
|
|
|
427
458
|
currency: string | null;
|
|
428
459
|
appliedDiscount: CmssyCartDiscount | null;
|
|
429
460
|
discountedTotal: number;
|
|
461
|
+
tax: number;
|
|
462
|
+
taxSummary: CmssyTaxSummaryLine[];
|
|
463
|
+
totalGross: number;
|
|
464
|
+
pricesIncludeTax: boolean;
|
|
465
|
+
shippingMethod: CmssyShippingMethod | null;
|
|
466
|
+
shippingTotal: number;
|
|
467
|
+
availableShippingMethods: CmssyShippingMethod[];
|
|
430
468
|
}
|
|
431
469
|
interface CmssyProductVariant {
|
|
432
470
|
id: string;
|
|
@@ -437,15 +475,19 @@ interface CmssyProductVariant {
|
|
|
437
475
|
name: string;
|
|
438
476
|
value: string;
|
|
439
477
|
}>;
|
|
478
|
+
tiers: CmssyPriceTier[];
|
|
440
479
|
}
|
|
441
480
|
interface CmssyProduct {
|
|
442
481
|
id: string;
|
|
443
482
|
data: Record<string, unknown>;
|
|
444
483
|
variants: CmssyProductVariant[];
|
|
484
|
+
priceTiers: CmssyPriceTier[];
|
|
445
485
|
}
|
|
446
486
|
interface CmssyOrderItem {
|
|
447
487
|
name: string;
|
|
448
488
|
price: number;
|
|
489
|
+
listPrice?: number | null;
|
|
490
|
+
tierMinQty?: number | null;
|
|
449
491
|
currency: string;
|
|
450
492
|
quantity: number;
|
|
451
493
|
sku: string | null;
|
|
@@ -456,13 +498,7 @@ interface CmssyOrderPayment {
|
|
|
456
498
|
provider: string | null;
|
|
457
499
|
at: string;
|
|
458
500
|
}
|
|
459
|
-
|
|
460
|
-
rateId: string | null;
|
|
461
|
-
name: string | null;
|
|
462
|
-
rate: number;
|
|
463
|
-
base: number;
|
|
464
|
-
amount: number;
|
|
465
|
-
}
|
|
501
|
+
type CmssyOrderTaxSummaryLine = CmssyTaxSummaryLine;
|
|
466
502
|
interface CmssyOrder {
|
|
467
503
|
id: string;
|
|
468
504
|
status: string;
|
|
@@ -490,6 +526,17 @@ interface CmssyOrder {
|
|
|
490
526
|
paidAt?: string | null;
|
|
491
527
|
fulfilledAt?: string | null;
|
|
492
528
|
createdAt?: string;
|
|
529
|
+
orderNumber?: number | null;
|
|
530
|
+
poNumber?: string | null;
|
|
531
|
+
customerNote?: string | null;
|
|
532
|
+
shippingAddress?: CmssyAddress | null;
|
|
533
|
+
shippingMethod?: {
|
|
534
|
+
id: string;
|
|
535
|
+
label: string;
|
|
536
|
+
price: number;
|
|
537
|
+
} | null;
|
|
538
|
+
shippingTotal?: number;
|
|
539
|
+
accessToken?: string | null;
|
|
493
540
|
}
|
|
494
541
|
|
|
495
|
-
export {
|
|
542
|
+
export { type ParentReadyMessage as $, type AppToEditorMessage as A, type BlockSchema as B, type CmssyPageData as C, type CmssyBranding as D, type EditorToAppMessage as E, type FieldDefinition as F, type CmssyFormField as G, type CmssyFormSettings as H, type CmssyFormSubmitResponse as I, type CmssyLocalizedValue as J, type CmssyModelDefinition as K, type CmssyModelRecord as L, type CmssyOrderTaxSummaryLine as M, type CmssyPageMeta as N, type CmssyPageSummary as O, type CmssyPriceTier as P, type CmssyRecordList as Q, type RawBlock as R, type CmssyShippingMethod as S, type CmssyTaxSummaryLine as T, DEFAULT_CMSSY_API_URL as U, FORM_QUERY as V, type FetchLikeResponse as W, type FetchPageOptions as X, MODEL_DEFINITIONS_QUERY as Y, MODEL_RECORDS_QUERY as Z, PROTOCOL_VERSION as _, type BlockMeta as a, type PatchMessage as a0, type RawLayoutBlock as a1, type ReadyMessage as a2, SITE_CONFIG_QUERY as a3, SUBMIT_FORM_MUTATION as a4, type SelectMessage as a5, type SubmitFormInput as a6, blocksToMeta as a7, blocksToSchemas as a8, buildBlockContext as a9, buildBlockMap as aa, defineBlock as ab, fetchLayouts as ac, fetchPage as ad, fetchPageById as ae, fetchPageMeta as af, fetchPages as ag, isProtocolCompatible as ah, normalizeSlug as ai, resolveApiUrl as aj, resolvePublicUrl as ak, type BlockDefinition as b, type CmssyFormDefinition as c, type CmssyLayoutGroup as d, type CmssyLocaleContext as e, type CmssyAddress as f, type CmssyCart as g, type CmssyOrder as h, type CmssyProduct as i, type CmssyCartDiscount as j, type CmssyCartItem as k, type CmssyCartItemSnapshot as l, type CmssyOrderItem as m, type CmssyProductVariant as n, type CmssyBlockAuthContext as o, type CmssyBlockWorkspace as p, type FetchLike as q, type CmssyClientConfig as r, type CmssySiteConfig as s, type BlockMap as t, type CmssyBlockContext as u, type BlockRect as v, type BoundsMessage as w, type BuildBlockContextExtra as x, type ClickMessage as y, type CmssyBlockMember as z };
|
|
@@ -396,12 +396,17 @@ declare function blocksToMeta(blocks: BlockDefinition[], defaults?: {
|
|
|
396
396
|
category?: string;
|
|
397
397
|
}): Record<string, BlockMeta>;
|
|
398
398
|
|
|
399
|
+
interface CmssyPriceTier {
|
|
400
|
+
minQty: number;
|
|
401
|
+
price: number;
|
|
402
|
+
}
|
|
399
403
|
interface CmssyCartItemSnapshot {
|
|
400
404
|
name: string;
|
|
401
405
|
price: number;
|
|
402
406
|
currency: string;
|
|
403
407
|
imageUrl: string | null;
|
|
404
408
|
sku: string | null;
|
|
409
|
+
tiers: CmssyPriceTier[];
|
|
405
410
|
}
|
|
406
411
|
interface CmssyCartItem {
|
|
407
412
|
id: string;
|
|
@@ -409,9 +414,35 @@ interface CmssyCartItem {
|
|
|
409
414
|
quantity: number;
|
|
410
415
|
variantSelections: Record<string, string> | null;
|
|
411
416
|
snapshot: CmssyCartItemSnapshot;
|
|
417
|
+
unitPrice: number;
|
|
412
418
|
currentPrice: number | null;
|
|
413
419
|
priceMismatch: boolean;
|
|
414
420
|
}
|
|
421
|
+
interface CmssyShippingMethod {
|
|
422
|
+
id: string;
|
|
423
|
+
label: string;
|
|
424
|
+
price: number;
|
|
425
|
+
etaLabel: string | null;
|
|
426
|
+
}
|
|
427
|
+
interface CmssyTaxSummaryLine {
|
|
428
|
+
rateId: string | null;
|
|
429
|
+
name: string | null;
|
|
430
|
+
rate: number;
|
|
431
|
+
base: number;
|
|
432
|
+
amount: number;
|
|
433
|
+
}
|
|
434
|
+
interface CmssyAddress {
|
|
435
|
+
name: string;
|
|
436
|
+
company?: string | null;
|
|
437
|
+
line1: string;
|
|
438
|
+
line2?: string | null;
|
|
439
|
+
postalCode: string;
|
|
440
|
+
city: string;
|
|
441
|
+
region?: string | null;
|
|
442
|
+
country: string;
|
|
443
|
+
phone?: string | null;
|
|
444
|
+
vatId?: string | null;
|
|
445
|
+
}
|
|
415
446
|
interface CmssyCartDiscount {
|
|
416
447
|
code: string;
|
|
417
448
|
type: string;
|
|
@@ -427,6 +458,13 @@ interface CmssyCart {
|
|
|
427
458
|
currency: string | null;
|
|
428
459
|
appliedDiscount: CmssyCartDiscount | null;
|
|
429
460
|
discountedTotal: number;
|
|
461
|
+
tax: number;
|
|
462
|
+
taxSummary: CmssyTaxSummaryLine[];
|
|
463
|
+
totalGross: number;
|
|
464
|
+
pricesIncludeTax: boolean;
|
|
465
|
+
shippingMethod: CmssyShippingMethod | null;
|
|
466
|
+
shippingTotal: number;
|
|
467
|
+
availableShippingMethods: CmssyShippingMethod[];
|
|
430
468
|
}
|
|
431
469
|
interface CmssyProductVariant {
|
|
432
470
|
id: string;
|
|
@@ -437,15 +475,19 @@ interface CmssyProductVariant {
|
|
|
437
475
|
name: string;
|
|
438
476
|
value: string;
|
|
439
477
|
}>;
|
|
478
|
+
tiers: CmssyPriceTier[];
|
|
440
479
|
}
|
|
441
480
|
interface CmssyProduct {
|
|
442
481
|
id: string;
|
|
443
482
|
data: Record<string, unknown>;
|
|
444
483
|
variants: CmssyProductVariant[];
|
|
484
|
+
priceTiers: CmssyPriceTier[];
|
|
445
485
|
}
|
|
446
486
|
interface CmssyOrderItem {
|
|
447
487
|
name: string;
|
|
448
488
|
price: number;
|
|
489
|
+
listPrice?: number | null;
|
|
490
|
+
tierMinQty?: number | null;
|
|
449
491
|
currency: string;
|
|
450
492
|
quantity: number;
|
|
451
493
|
sku: string | null;
|
|
@@ -456,13 +498,7 @@ interface CmssyOrderPayment {
|
|
|
456
498
|
provider: string | null;
|
|
457
499
|
at: string;
|
|
458
500
|
}
|
|
459
|
-
|
|
460
|
-
rateId: string | null;
|
|
461
|
-
name: string | null;
|
|
462
|
-
rate: number;
|
|
463
|
-
base: number;
|
|
464
|
-
amount: number;
|
|
465
|
-
}
|
|
501
|
+
type CmssyOrderTaxSummaryLine = CmssyTaxSummaryLine;
|
|
466
502
|
interface CmssyOrder {
|
|
467
503
|
id: string;
|
|
468
504
|
status: string;
|
|
@@ -490,6 +526,17 @@ interface CmssyOrder {
|
|
|
490
526
|
paidAt?: string | null;
|
|
491
527
|
fulfilledAt?: string | null;
|
|
492
528
|
createdAt?: string;
|
|
529
|
+
orderNumber?: number | null;
|
|
530
|
+
poNumber?: string | null;
|
|
531
|
+
customerNote?: string | null;
|
|
532
|
+
shippingAddress?: CmssyAddress | null;
|
|
533
|
+
shippingMethod?: {
|
|
534
|
+
id: string;
|
|
535
|
+
label: string;
|
|
536
|
+
price: number;
|
|
537
|
+
} | null;
|
|
538
|
+
shippingTotal?: number;
|
|
539
|
+
accessToken?: string | null;
|
|
493
540
|
}
|
|
494
541
|
|
|
495
|
-
export {
|
|
542
|
+
export { type ParentReadyMessage as $, type AppToEditorMessage as A, type BlockSchema as B, type CmssyPageData as C, type CmssyBranding as D, type EditorToAppMessage as E, type FieldDefinition as F, type CmssyFormField as G, type CmssyFormSettings as H, type CmssyFormSubmitResponse as I, type CmssyLocalizedValue as J, type CmssyModelDefinition as K, type CmssyModelRecord as L, type CmssyOrderTaxSummaryLine as M, type CmssyPageMeta as N, type CmssyPageSummary as O, type CmssyPriceTier as P, type CmssyRecordList as Q, type RawBlock as R, type CmssyShippingMethod as S, type CmssyTaxSummaryLine as T, DEFAULT_CMSSY_API_URL as U, FORM_QUERY as V, type FetchLikeResponse as W, type FetchPageOptions as X, MODEL_DEFINITIONS_QUERY as Y, MODEL_RECORDS_QUERY as Z, PROTOCOL_VERSION as _, type BlockMeta as a, type PatchMessage as a0, type RawLayoutBlock as a1, type ReadyMessage as a2, SITE_CONFIG_QUERY as a3, SUBMIT_FORM_MUTATION as a4, type SelectMessage as a5, type SubmitFormInput as a6, blocksToMeta as a7, blocksToSchemas as a8, buildBlockContext as a9, buildBlockMap as aa, defineBlock as ab, fetchLayouts as ac, fetchPage as ad, fetchPageById as ae, fetchPageMeta as af, fetchPages as ag, isProtocolCompatible as ah, normalizeSlug as ai, resolveApiUrl as aj, resolvePublicUrl as ak, type BlockDefinition as b, type CmssyFormDefinition as c, type CmssyLayoutGroup as d, type CmssyLocaleContext as e, type CmssyAddress as f, type CmssyCart as g, type CmssyOrder as h, type CmssyProduct as i, type CmssyCartDiscount as j, type CmssyCartItem as k, type CmssyCartItemSnapshot as l, type CmssyOrderItem as m, type CmssyProductVariant as n, type CmssyBlockAuthContext as o, type CmssyBlockWorkspace as p, type FetchLike as q, type CmssyClientConfig as r, type CmssySiteConfig as s, type BlockMap as t, type CmssyBlockContext as u, type BlockRect as v, type BoundsMessage as w, type BuildBlockContextExtra as x, type ClickMessage as y, type CmssyBlockMember as z };
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition,
|
|
2
|
-
export { a as BlockMeta,
|
|
1
|
+
import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, o as CmssyBlockAuthContext, p as CmssyBlockWorkspace, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, q as FetchLike, r as CmssyClientConfig, s as CmssySiteConfig, R as RawBlock, e as CmssyLocaleContext, t as BlockMap, u as CmssyBlockContext } from './commerce-queries-fR6ZKQ3r.cjs';
|
|
2
|
+
export { a as BlockMeta, v as BlockRect, B as BlockSchema, w as BoundsMessage, x as BuildBlockContextExtra, y as ClickMessage, f as CmssyAddress, z as CmssyBlockMember, D as CmssyBranding, g as CmssyCart, j as CmssyCartDiscount, k as CmssyCartItem, l as CmssyCartItemSnapshot, G as CmssyFormField, H as CmssyFormSettings, I as CmssyFormSubmitResponse, J as CmssyLocalizedValue, K as CmssyModelDefinition, L as CmssyModelRecord, h as CmssyOrder, m as CmssyOrderItem, M as CmssyOrderTaxSummaryLine, N as CmssyPageMeta, O as CmssyPageSummary, P as CmssyPriceTier, i as CmssyProduct, n as CmssyProductVariant, Q as CmssyRecordList, S as CmssyShippingMethod, T as CmssyTaxSummaryLine, U as DEFAULT_CMSSY_API_URL, V as FORM_QUERY, W as FetchLikeResponse, X as FetchPageOptions, Y as MODEL_DEFINITIONS_QUERY, Z as MODEL_RECORDS_QUERY, _ as PROTOCOL_VERSION, $ as ParentReadyMessage, a0 as PatchMessage, a1 as RawLayoutBlock, a2 as ReadyMessage, a3 as SITE_CONFIG_QUERY, a4 as SUBMIT_FORM_MUTATION, a5 as SelectMessage, a6 as SubmitFormInput, a7 as blocksToMeta, a8 as blocksToSchemas, a9 as buildBlockContext, aa as buildBlockMap, ab as defineBlock, ac as fetchLayouts, ad as fetchPage, ae as fetchPageById, af as fetchPageMeta, ag as fetchPages, ah as isProtocolCompatible, ai as normalizeSlug, aj as resolveApiUrl, ak as resolvePublicUrl } from './commerce-queries-fR6ZKQ3r.cjs';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
export { FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldType, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
5
5
|
import 'react';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition,
|
|
2
|
-
export { a as BlockMeta,
|
|
1
|
+
import { F as FieldDefinition, C as CmssyPageData, b as BlockDefinition, c as CmssyFormDefinition, o as CmssyBlockAuthContext, p as CmssyBlockWorkspace, d as CmssyLayoutGroup, E as EditorToAppMessage, A as AppToEditorMessage, q as FetchLike, r as CmssyClientConfig, s as CmssySiteConfig, R as RawBlock, e as CmssyLocaleContext, t as BlockMap, u as CmssyBlockContext } from './commerce-queries-fR6ZKQ3r.js';
|
|
2
|
+
export { a as BlockMeta, v as BlockRect, B as BlockSchema, w as BoundsMessage, x as BuildBlockContextExtra, y as ClickMessage, f as CmssyAddress, z as CmssyBlockMember, D as CmssyBranding, g as CmssyCart, j as CmssyCartDiscount, k as CmssyCartItem, l as CmssyCartItemSnapshot, G as CmssyFormField, H as CmssyFormSettings, I as CmssyFormSubmitResponse, J as CmssyLocalizedValue, K as CmssyModelDefinition, L as CmssyModelRecord, h as CmssyOrder, m as CmssyOrderItem, M as CmssyOrderTaxSummaryLine, N as CmssyPageMeta, O as CmssyPageSummary, P as CmssyPriceTier, i as CmssyProduct, n as CmssyProductVariant, Q as CmssyRecordList, S as CmssyShippingMethod, T as CmssyTaxSummaryLine, U as DEFAULT_CMSSY_API_URL, V as FORM_QUERY, W as FetchLikeResponse, X as FetchPageOptions, Y as MODEL_DEFINITIONS_QUERY, Z as MODEL_RECORDS_QUERY, _ as PROTOCOL_VERSION, $ as ParentReadyMessage, a0 as PatchMessage, a1 as RawLayoutBlock, a2 as ReadyMessage, a3 as SITE_CONFIG_QUERY, a4 as SUBMIT_FORM_MUTATION, a5 as SelectMessage, a6 as SubmitFormInput, a7 as blocksToMeta, a8 as blocksToSchemas, a9 as buildBlockContext, aa as buildBlockMap, ab as defineBlock, ac as fetchLayouts, ad as fetchPage, ae as fetchPageById, af as fetchPageMeta, ag as fetchPages, ah as isProtocolCompatible, ai as normalizeSlug, aj as resolveApiUrl, ak as resolvePublicUrl } from './commerce-queries-fR6ZKQ3r.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
export { FieldCondition, FieldConditionGroup, FieldConditionLogic, FieldType, evaluateFieldConditionGroup } from '@cmssy/types';
|
|
5
5
|
import 'react';
|