@joai/sdk 14.0.1 → 14.0.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.mts +10 -1
- package/dist/index.mjs +14 -0
- package/package.json +3 -3
package/dist/index.d.mts
CHANGED
|
@@ -208,6 +208,12 @@ declare class ReturnsResource {
|
|
|
208
208
|
resolution?: number;
|
|
209
209
|
returnShippingCostPayer?: number;
|
|
210
210
|
}): Promise<_$_joai_core0.IAppResponse<Return>>;
|
|
211
|
+
withdraw(data: {
|
|
212
|
+
orderId: string;
|
|
213
|
+
email: string;
|
|
214
|
+
name: string;
|
|
215
|
+
statement?: string;
|
|
216
|
+
}): Promise<_$_joai_core0.IAppResponse<Return>>;
|
|
211
217
|
}
|
|
212
218
|
//#endregion
|
|
213
219
|
//#region src/commerce/shipping.d.ts
|
|
@@ -299,7 +305,10 @@ declare function createGuestCommerceStorage(options: GuestCommerceStorageOptions
|
|
|
299
305
|
accessToken
|
|
300
306
|
}: GuestOrderAccess): void;
|
|
301
307
|
readOrderAccess(orderId: string): string | null;
|
|
302
|
-
listOrderAccess(): GuestOrderAccess[]; /**
|
|
308
|
+
listOrderAccess(): GuestOrderAccess[]; /** Remember the order being paid so a gateway return without `?order=` can reopen it. */
|
|
309
|
+
savePendingOrderReturn(orderId: string): void;
|
|
310
|
+
readPendingOrderReturn(): string | null;
|
|
311
|
+
clearPendingOrderReturn(): void; /** Absolute shop URL from a path or full URL (e.g. orders page). */
|
|
303
312
|
shopUrl(ordersPage: string): string; /** Thank-you → shop handoff URL with capability token query params. */
|
|
304
313
|
orderReturnUrl(ordersPage: string, orderId: string, accessToken: string): string; /** Persist `order` + `orderAccessToken` from the shop handoff query, then strip the token. */
|
|
305
314
|
claimOrderReturn(): GuestOrderAccess | null;
|
package/dist/index.mjs
CHANGED
|
@@ -220,6 +220,9 @@ var ReturnsResource = class {
|
|
|
220
220
|
update(id, data) {
|
|
221
221
|
return this.http.patch(`returns/${id}`, data);
|
|
222
222
|
}
|
|
223
|
+
withdraw(data) {
|
|
224
|
+
return this.http.post("withdrawals", data);
|
|
225
|
+
}
|
|
223
226
|
};
|
|
224
227
|
//#endregion
|
|
225
228
|
//#region src/commerce/shipping.ts
|
|
@@ -286,6 +289,7 @@ const orderAccessPrefix = "joai:order-access:";
|
|
|
286
289
|
const checkoutKey = (namespace) => `joai:guest-checkout:${namespace}`;
|
|
287
290
|
const ordersKey = (namespace) => `joai:guest-orders:${namespace}`;
|
|
288
291
|
const orderAccessKey = (namespace, orderId) => `${orderAccessPrefix}${namespace}:${orderId}`;
|
|
292
|
+
const pendingOrderReturnKey = (namespace) => `joai:guest-pending-order-return:${namespace}`;
|
|
289
293
|
const safeGet$1 = (key) => {
|
|
290
294
|
if (typeof localStorage === "undefined") return null;
|
|
291
295
|
try {
|
|
@@ -397,6 +401,16 @@ function createGuestCommerceStorage(options) {
|
|
|
397
401
|
accessToken: entry.accessToken || safeGet$1(orderAccessKey(options.namespace, entry.orderId))
|
|
398
402
|
}));
|
|
399
403
|
},
|
|
404
|
+
/** Remember the order being paid so a gateway return without `?order=` can reopen it. */
|
|
405
|
+
savePendingOrderReturn(orderId) {
|
|
406
|
+
safeSet$1(pendingOrderReturnKey(options.namespace), orderId);
|
|
407
|
+
},
|
|
408
|
+
readPendingOrderReturn() {
|
|
409
|
+
return safeGet$1(pendingOrderReturnKey(options.namespace));
|
|
410
|
+
},
|
|
411
|
+
clearPendingOrderReturn() {
|
|
412
|
+
safeRemove$1(pendingOrderReturnKey(options.namespace));
|
|
413
|
+
},
|
|
400
414
|
/** Absolute shop URL from a path or full URL (e.g. orders page). */
|
|
401
415
|
shopUrl(ordersPage) {
|
|
402
416
|
return absoluteOrdersPageUrl(ordersPage);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@joai/sdk",
|
|
3
|
-
"version": "14.0.
|
|
3
|
+
"version": "14.0.3",
|
|
4
4
|
"description": "JoAi public API SDK — build with your AI agents",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -35,11 +35,11 @@
|
|
|
35
35
|
"test": "jest --config jest.config.js"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@joai/core": "^5.4.
|
|
38
|
+
"@joai/core": "^5.4.9",
|
|
39
39
|
"@joai/warps": "*"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
|
-
"@joai/core": "^5.4.
|
|
42
|
+
"@joai/core": "^5.4.9"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"tsdown": "^0.21.0",
|