@eetech-commerce/cart-react 0.4.1 → 0.4.3
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/index.d.ts +44 -6
- package/dist/index.js +38 -13
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -22,6 +22,48 @@ interface CartContextValue {
|
|
|
22
22
|
}
|
|
23
23
|
declare function useCartContext(): CartContextValue;
|
|
24
24
|
|
|
25
|
+
type ShippingSelection = {
|
|
26
|
+
/**
|
|
27
|
+
* Seller UUID this selection applies to
|
|
28
|
+
*/
|
|
29
|
+
sellerId: string;
|
|
30
|
+
/**
|
|
31
|
+
* Selected delivery method UUID from MarketPush
|
|
32
|
+
*/
|
|
33
|
+
deliveryMethodId: string;
|
|
34
|
+
/**
|
|
35
|
+
* Delivery method display name
|
|
36
|
+
*/
|
|
37
|
+
deliveryMethodName: string;
|
|
38
|
+
/**
|
|
39
|
+
* Selected carrier UUID from MarketPush
|
|
40
|
+
*/
|
|
41
|
+
carrierId: string;
|
|
42
|
+
/**
|
|
43
|
+
* Carrier display name
|
|
44
|
+
*/
|
|
45
|
+
carrierName: string;
|
|
46
|
+
/**
|
|
47
|
+
* Carrier API key for order submission
|
|
48
|
+
*/
|
|
49
|
+
carrierKey: string;
|
|
50
|
+
/**
|
|
51
|
+
* MarketPush shipping rate ID used for this selection
|
|
52
|
+
*/
|
|
53
|
+
shippingRateId: string;
|
|
54
|
+
/**
|
|
55
|
+
* Calculated shipping cost in cents (integer)
|
|
56
|
+
*/
|
|
57
|
+
shippingCostCents: number;
|
|
58
|
+
/**
|
|
59
|
+
* Optional carrier account identifier (max 50 chars)
|
|
60
|
+
*/
|
|
61
|
+
carrierAccount?: string;
|
|
62
|
+
/**
|
|
63
|
+
* Timestamp when selection was made (ISO 8601)
|
|
64
|
+
*/
|
|
65
|
+
selectedAt: string;
|
|
66
|
+
};
|
|
25
67
|
type TaxJurisdictionDto = {
|
|
26
68
|
/**
|
|
27
69
|
* ISO 3166-1 alpha-2 country code
|
|
@@ -267,9 +309,7 @@ type CartResponseDto = {
|
|
|
267
309
|
* Shipping selections by seller ID - present when shipping methods selected
|
|
268
310
|
*/
|
|
269
311
|
shippingSelections?: {
|
|
270
|
-
[key: string]:
|
|
271
|
-
[key: string]: unknown;
|
|
272
|
-
};
|
|
312
|
+
[key: string]: ShippingSelection;
|
|
273
313
|
} | null;
|
|
274
314
|
/**
|
|
275
315
|
* Purchase order number
|
|
@@ -489,9 +529,7 @@ type ShippingSelectionsResponseDto = {
|
|
|
489
529
|
* Shipping selections by seller ID
|
|
490
530
|
*/
|
|
491
531
|
shippingSelections: {
|
|
492
|
-
[key: string]:
|
|
493
|
-
[key: string]: unknown;
|
|
494
|
-
};
|
|
532
|
+
[key: string]: ShippingSelection;
|
|
495
533
|
};
|
|
496
534
|
};
|
|
497
535
|
type PaymentSessionResponseDto = {
|
package/dist/index.js
CHANGED
|
@@ -41,7 +41,10 @@ import { queryOptions } from "@tanstack/react-query";
|
|
|
41
41
|
|
|
42
42
|
// src/generated/core/bodySerializer.gen.ts
|
|
43
43
|
var jsonBodySerializer = {
|
|
44
|
-
bodySerializer: (body) => JSON.stringify(
|
|
44
|
+
bodySerializer: (body) => JSON.stringify(
|
|
45
|
+
body,
|
|
46
|
+
(_key, value) => typeof value === "bigint" ? value.toString() : value
|
|
47
|
+
)
|
|
45
48
|
};
|
|
46
49
|
|
|
47
50
|
// src/generated/core/params.gen.ts
|
|
@@ -94,7 +97,10 @@ var createSseClient = ({
|
|
|
94
97
|
}
|
|
95
98
|
const _fetch = options.fetch ?? globalThis.fetch;
|
|
96
99
|
const response = await _fetch(request);
|
|
97
|
-
if (!response.ok)
|
|
100
|
+
if (!response.ok)
|
|
101
|
+
throw new Error(
|
|
102
|
+
`SSE failed: ${response.status} ${response.statusText}`
|
|
103
|
+
);
|
|
98
104
|
if (!response.body) throw new Error("No body in SSE response");
|
|
99
105
|
const reader = response.body.pipeThrough(new TextDecoderStream()).getReader();
|
|
100
106
|
let buffer = "";
|
|
@@ -124,7 +130,10 @@ var createSseClient = ({
|
|
|
124
130
|
} else if (line.startsWith("id:")) {
|
|
125
131
|
lastEventId = line.replace(/^id:\s*/, "");
|
|
126
132
|
} else if (line.startsWith("retry:")) {
|
|
127
|
-
const parsed = Number.parseInt(
|
|
133
|
+
const parsed = Number.parseInt(
|
|
134
|
+
line.replace(/^retry:\s*/, ""),
|
|
135
|
+
10
|
|
136
|
+
);
|
|
128
137
|
if (!Number.isNaN(parsed)) {
|
|
129
138
|
retryDelay = parsed;
|
|
130
139
|
}
|
|
@@ -170,7 +179,10 @@ var createSseClient = ({
|
|
|
170
179
|
if (sseMaxRetryAttempts !== void 0 && attempt >= sseMaxRetryAttempts) {
|
|
171
180
|
break;
|
|
172
181
|
}
|
|
173
|
-
const backoff = Math.min(
|
|
182
|
+
const backoff = Math.min(
|
|
183
|
+
retryDelay * 2 ** (attempt - 1),
|
|
184
|
+
sseMaxRetryDelay ?? 3e4
|
|
185
|
+
);
|
|
174
186
|
await sleep(backoff);
|
|
175
187
|
}
|
|
176
188
|
}
|
|
@@ -278,7 +290,11 @@ var serializeObjectParam = ({
|
|
|
278
290
|
if (style !== "deepObject" && !explode) {
|
|
279
291
|
let values = [];
|
|
280
292
|
Object.entries(value).forEach(([key, v]) => {
|
|
281
|
-
values = [
|
|
293
|
+
values = [
|
|
294
|
+
...values,
|
|
295
|
+
key,
|
|
296
|
+
allowReserved ? v : encodeURIComponent(v)
|
|
297
|
+
];
|
|
282
298
|
});
|
|
283
299
|
const joinedValues2 = values.join(",");
|
|
284
300
|
switch (style) {
|
|
@@ -329,7 +345,10 @@ var defaultPathSerializer = ({ path, url: _url }) => {
|
|
|
329
345
|
continue;
|
|
330
346
|
}
|
|
331
347
|
if (Array.isArray(value)) {
|
|
332
|
-
url = url.replace(
|
|
348
|
+
url = url.replace(
|
|
349
|
+
match,
|
|
350
|
+
serializeArrayParam({ explode, name, style, value })
|
|
351
|
+
);
|
|
333
352
|
continue;
|
|
334
353
|
}
|
|
335
354
|
if (typeof value === "object") {
|
|
@@ -477,7 +496,9 @@ var getParseAs = (contentType) => {
|
|
|
477
496
|
if (cleanContent === "multipart/form-data") {
|
|
478
497
|
return "formData";
|
|
479
498
|
}
|
|
480
|
-
if (["application/", "audio/", "image/", "video/"].some(
|
|
499
|
+
if (["application/", "audio/", "image/", "video/"].some(
|
|
500
|
+
(type) => cleanContent.startsWith(type)
|
|
501
|
+
)) {
|
|
481
502
|
return "blob";
|
|
482
503
|
}
|
|
483
504
|
if (cleanContent.startsWith("text/")) {
|
|
@@ -689,7 +710,12 @@ var createClient = (config = {}) => {
|
|
|
689
710
|
let finalError2 = error2;
|
|
690
711
|
for (const fn of interceptors.error.fns) {
|
|
691
712
|
if (fn) {
|
|
692
|
-
finalError2 = await fn(
|
|
713
|
+
finalError2 = await fn(
|
|
714
|
+
error2,
|
|
715
|
+
void 0,
|
|
716
|
+
request2,
|
|
717
|
+
opts
|
|
718
|
+
);
|
|
693
719
|
}
|
|
694
720
|
}
|
|
695
721
|
finalError2 = finalError2 || {};
|
|
@@ -949,10 +975,7 @@ var paymentControllerGetPaymentSessionV1 = (options) => {
|
|
|
949
975
|
|
|
950
976
|
// src/generated/@tanstack/react-query.gen.ts
|
|
951
977
|
var createQueryKey = (id, options, infinite, tags) => {
|
|
952
|
-
const params = {
|
|
953
|
-
_id: id,
|
|
954
|
-
baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl
|
|
955
|
-
};
|
|
978
|
+
const params = { _id: id, baseUrl: options?.baseUrl || (options?.client ?? client).getConfig().baseUrl };
|
|
956
979
|
if (infinite) {
|
|
957
980
|
params._infinite = infinite;
|
|
958
981
|
}
|
|
@@ -971,7 +994,9 @@ var createQueryKey = (id, options, infinite, tags) => {
|
|
|
971
994
|
if (options?.query) {
|
|
972
995
|
params.query = options.query;
|
|
973
996
|
}
|
|
974
|
-
return [
|
|
997
|
+
return [
|
|
998
|
+
params
|
|
999
|
+
];
|
|
975
1000
|
};
|
|
976
1001
|
var cartControllerCreateCartV1Mutation = (options) => {
|
|
977
1002
|
const mutationOptions = {
|