@spree/next 0.6.9 → 0.7.1
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/actions/addresses.d.ts +5 -5
- package/dist/actions/addresses.js +9 -9
- package/dist/actions/addresses.js.map +1 -1
- package/dist/actions/auth.d.ts +3 -3
- package/dist/actions/auth.js +10 -10
- package/dist/actions/auth.js.map +1 -1
- package/dist/actions/cart.d.ts +7 -7
- package/dist/actions/cart.js +10 -10
- package/dist/actions/cart.js.map +1 -1
- package/dist/actions/checkout.d.ts +10 -10
- package/dist/actions/checkout.js +11 -11
- package/dist/actions/checkout.js.map +1 -1
- package/dist/actions/credit-cards.d.ts +2 -2
- package/dist/actions/credit-cards.js +6 -6
- package/dist/actions/credit-cards.js.map +1 -1
- package/dist/actions/gift-cards.d.ts +3 -3
- package/dist/actions/gift-cards.js +6 -6
- package/dist/actions/gift-cards.js.map +1 -1
- package/dist/actions/locale.js +2 -2
- package/dist/actions/locale.js.map +1 -1
- package/dist/actions/orders.d.ts +3 -3
- package/dist/actions/orders.js +6 -6
- package/dist/actions/orders.js.map +1 -1
- package/dist/actions/payment-sessions.d.ts +5 -5
- package/dist/actions/payment-sessions.js +6 -6
- package/dist/actions/payment-sessions.js.map +1 -1
- package/dist/actions/payment-setup-sessions.d.ts +4 -4
- package/dist/actions/payment-setup-sessions.js +7 -7
- package/dist/actions/payment-setup-sessions.js.map +1 -1
- package/dist/config.d.ts +3 -3
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/data/countries.d.ts +3 -3
- package/dist/data/countries.js +4 -4
- package/dist/data/countries.js.map +1 -1
- package/dist/data/currencies.d.ts +2 -2
- package/dist/data/currencies.js +3 -3
- package/dist/data/currencies.js.map +1 -1
- package/dist/data/locales.d.ts +2 -2
- package/dist/data/locales.js +3 -3
- package/dist/data/locales.js.map +1 -1
- package/dist/data/markets.d.ts +6 -6
- package/dist/data/markets.js +7 -7
- package/dist/data/markets.js.map +1 -1
- package/dist/data/products.d.ts +3 -3
- package/dist/data/products.js +5 -5
- package/dist/data/products.js.map +1 -1
- package/dist/data/taxonomies.d.ts +3 -3
- package/dist/data/taxonomies.js +4 -4
- package/dist/data/taxonomies.js.map +1 -1
- package/dist/data/taxons.d.ts +4 -4
- package/dist/data/taxons.js +5 -5
- package/dist/data/taxons.js.map +1 -1
- package/dist/index.d.ts +35 -35
- package/dist/index.js +62 -62
- package/dist/index.js.map +1 -1
- package/dist/locale.js +2 -2
- package/dist/locale.js.map +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createClient, SpreeError } from '@spree/sdk';
|
|
2
2
|
import { cookies } from 'next/headers';
|
|
3
3
|
import { revalidateTag } from 'next/cache';
|
|
4
4
|
|
|
@@ -7,7 +7,7 @@ var _client = null;
|
|
|
7
7
|
var _config = null;
|
|
8
8
|
function initSpreeNext(config) {
|
|
9
9
|
_config = config;
|
|
10
|
-
_client =
|
|
10
|
+
_client = createClient({
|
|
11
11
|
baseUrl: config.baseUrl,
|
|
12
12
|
publishableKey: config.publishableKey
|
|
13
13
|
});
|
|
@@ -49,83 +49,83 @@ async function getLocaleOptions() {
|
|
|
49
49
|
// src/data/products.ts
|
|
50
50
|
async function listProducts(params, options) {
|
|
51
51
|
const resolved = options ?? await getLocaleOptions();
|
|
52
|
-
return getClient().
|
|
52
|
+
return getClient().products.list(params, resolved);
|
|
53
53
|
}
|
|
54
54
|
async function getProduct(slugOrId, params, options) {
|
|
55
55
|
const resolved = options ?? await getLocaleOptions();
|
|
56
|
-
return getClient().
|
|
56
|
+
return getClient().products.get(slugOrId, params, resolved);
|
|
57
57
|
}
|
|
58
58
|
async function getProductFilters(params, options) {
|
|
59
59
|
const resolved = options ?? await getLocaleOptions();
|
|
60
|
-
return getClient().
|
|
60
|
+
return getClient().products.filters(params, resolved);
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// src/data/taxons.ts
|
|
64
64
|
async function listTaxons(params, options) {
|
|
65
65
|
const resolved = options ?? await getLocaleOptions();
|
|
66
|
-
return getClient().
|
|
66
|
+
return getClient().taxons.list(params, resolved);
|
|
67
67
|
}
|
|
68
68
|
async function getTaxon(idOrPermalink, params, options) {
|
|
69
69
|
const resolved = options ?? await getLocaleOptions();
|
|
70
|
-
return getClient().
|
|
70
|
+
return getClient().taxons.get(idOrPermalink, params, resolved);
|
|
71
71
|
}
|
|
72
72
|
async function listTaxonProducts(taxonId, params, options) {
|
|
73
73
|
const resolved = options ?? await getLocaleOptions();
|
|
74
|
-
return getClient().
|
|
74
|
+
return getClient().taxons.products.list(taxonId, params, resolved);
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
// src/data/taxonomies.ts
|
|
78
78
|
async function listTaxonomies(params, options) {
|
|
79
79
|
const resolved = options ?? await getLocaleOptions();
|
|
80
|
-
return getClient().
|
|
80
|
+
return getClient().taxonomies.list(params, resolved);
|
|
81
81
|
}
|
|
82
82
|
async function getTaxonomy(id, params, options) {
|
|
83
83
|
const resolved = options ?? await getLocaleOptions();
|
|
84
|
-
return getClient().
|
|
84
|
+
return getClient().taxonomies.get(id, params, resolved);
|
|
85
85
|
}
|
|
86
86
|
|
|
87
87
|
// src/data/countries.ts
|
|
88
88
|
async function listCountries(options) {
|
|
89
89
|
const resolved = options ?? await getLocaleOptions();
|
|
90
|
-
return getClient().
|
|
90
|
+
return getClient().countries.list(resolved);
|
|
91
91
|
}
|
|
92
92
|
async function getCountry(iso, params, options) {
|
|
93
93
|
const resolved = options ?? await getLocaleOptions();
|
|
94
|
-
return getClient().
|
|
94
|
+
return getClient().countries.get(iso, params, resolved);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
// src/data/currencies.ts
|
|
98
98
|
async function listCurrencies(options) {
|
|
99
99
|
const resolved = options ?? await getLocaleOptions();
|
|
100
|
-
return getClient().
|
|
100
|
+
return getClient().currencies.list(resolved);
|
|
101
101
|
}
|
|
102
102
|
|
|
103
103
|
// src/data/locales.ts
|
|
104
104
|
async function listLocales(options) {
|
|
105
105
|
const resolved = options ?? await getLocaleOptions();
|
|
106
|
-
return getClient().
|
|
106
|
+
return getClient().locales.list(resolved);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
// src/data/markets.ts
|
|
110
110
|
async function listMarkets(options) {
|
|
111
111
|
const resolved = options ?? await getLocaleOptions();
|
|
112
|
-
return getClient().
|
|
112
|
+
return getClient().markets.list(resolved);
|
|
113
113
|
}
|
|
114
114
|
async function getMarket(id, options) {
|
|
115
115
|
const resolved = options ?? await getLocaleOptions();
|
|
116
|
-
return getClient().
|
|
116
|
+
return getClient().markets.get(id, resolved);
|
|
117
117
|
}
|
|
118
118
|
async function resolveMarket(country, options) {
|
|
119
119
|
const resolved = options ?? await getLocaleOptions();
|
|
120
|
-
return getClient().
|
|
120
|
+
return getClient().markets.resolve(country, resolved);
|
|
121
121
|
}
|
|
122
122
|
async function listMarketCountries(marketId, options) {
|
|
123
123
|
const resolved = options ?? await getLocaleOptions();
|
|
124
|
-
return getClient().
|
|
124
|
+
return getClient().markets.countries.list(marketId, resolved);
|
|
125
125
|
}
|
|
126
126
|
async function getMarketCountry(marketId, iso, params, options) {
|
|
127
127
|
const resolved = options ?? await getLocaleOptions();
|
|
128
|
-
return getClient().
|
|
128
|
+
return getClient().markets.countries.get(marketId, iso, params, resolved);
|
|
129
129
|
}
|
|
130
130
|
var DEFAULT_CART_COOKIE = "_spree_cart_token";
|
|
131
131
|
var DEFAULT_ACCESS_TOKEN_COOKIE = "_spree_jwt";
|
|
@@ -194,7 +194,7 @@ async function getCart() {
|
|
|
194
194
|
const token = await getAccessToken();
|
|
195
195
|
if (!orderToken && !token) return null;
|
|
196
196
|
try {
|
|
197
|
-
return await getClient().
|
|
197
|
+
return await getClient().cart.get({ orderToken, token });
|
|
198
198
|
} catch {
|
|
199
199
|
if (orderToken) {
|
|
200
200
|
await clearCartToken();
|
|
@@ -207,7 +207,7 @@ async function getOrCreateCart(params) {
|
|
|
207
207
|
if (existing) return existing;
|
|
208
208
|
const token = await getAccessToken();
|
|
209
209
|
const cartParams = params && Object.keys(params).length > 0 ? params : void 0;
|
|
210
|
-
const cart = await getClient().
|
|
210
|
+
const cart = await getClient().cart.create(cartParams, token ? { token } : void 0);
|
|
211
211
|
if (cart.token) {
|
|
212
212
|
await setCartToken(cart.token);
|
|
213
213
|
}
|
|
@@ -218,7 +218,7 @@ async function addItem(variantId, quantity = 1, metadata) {
|
|
|
218
218
|
const cart = await getOrCreateCart();
|
|
219
219
|
const orderToken = cart.token;
|
|
220
220
|
const token = await getAccessToken();
|
|
221
|
-
const order = await getClient().
|
|
221
|
+
const order = await getClient().orders.lineItems.create(
|
|
222
222
|
cart.id,
|
|
223
223
|
{ variant_id: variantId, quantity, metadata },
|
|
224
224
|
{ orderToken, token }
|
|
@@ -230,8 +230,8 @@ async function updateItem(lineItemId, params) {
|
|
|
230
230
|
const orderToken = await getCartToken();
|
|
231
231
|
const token = await getAccessToken();
|
|
232
232
|
if (!orderToken && !token) throw new Error("No cart found");
|
|
233
|
-
const cart = await getClient().
|
|
234
|
-
const order = await getClient().
|
|
233
|
+
const cart = await getClient().cart.get({ orderToken, token });
|
|
234
|
+
const order = await getClient().orders.lineItems.update(
|
|
235
235
|
cart.id,
|
|
236
236
|
lineItemId,
|
|
237
237
|
params,
|
|
@@ -244,8 +244,8 @@ async function removeItem(lineItemId) {
|
|
|
244
244
|
const orderToken = await getCartToken();
|
|
245
245
|
const token = await getAccessToken();
|
|
246
246
|
if (!orderToken && !token) throw new Error("No cart found");
|
|
247
|
-
const cart = await getClient().
|
|
248
|
-
const order = await getClient().
|
|
247
|
+
const cart = await getClient().cart.get({ orderToken, token });
|
|
248
|
+
const order = await getClient().orders.lineItems.delete(cart.id, lineItemId, {
|
|
249
249
|
orderToken,
|
|
250
250
|
token
|
|
251
251
|
});
|
|
@@ -261,7 +261,7 @@ async function associateCart() {
|
|
|
261
261
|
const token = await getAccessToken();
|
|
262
262
|
if (!orderToken || !token) return null;
|
|
263
263
|
try {
|
|
264
|
-
const result = await getClient().
|
|
264
|
+
const result = await getClient().cart.associate({ orderToken, token });
|
|
265
265
|
revalidateTag("cart");
|
|
266
266
|
return result;
|
|
267
267
|
} catch {
|
|
@@ -277,7 +277,7 @@ async function getCheckoutOptions() {
|
|
|
277
277
|
}
|
|
278
278
|
async function getCheckout(orderId) {
|
|
279
279
|
const options = await getCheckoutOptions();
|
|
280
|
-
return getClient().
|
|
280
|
+
return getClient().orders.get(
|
|
281
281
|
orderId,
|
|
282
282
|
{ expand: ["line_items", "shipments", "ship_address", "bill_address"] },
|
|
283
283
|
options
|
|
@@ -285,29 +285,29 @@ async function getCheckout(orderId) {
|
|
|
285
285
|
}
|
|
286
286
|
async function updateOrder(orderId, params) {
|
|
287
287
|
const options = await getCheckoutOptions();
|
|
288
|
-
const result = await getClient().
|
|
288
|
+
const result = await getClient().orders.update(orderId, params, options);
|
|
289
289
|
revalidateTag("checkout");
|
|
290
290
|
return result;
|
|
291
291
|
}
|
|
292
292
|
async function advance(orderId) {
|
|
293
293
|
const options = await getCheckoutOptions();
|
|
294
|
-
const result = await getClient().
|
|
294
|
+
const result = await getClient().orders.advance(orderId, options);
|
|
295
295
|
revalidateTag("checkout");
|
|
296
296
|
return result;
|
|
297
297
|
}
|
|
298
298
|
async function next(orderId) {
|
|
299
299
|
const options = await getCheckoutOptions();
|
|
300
|
-
const result = await getClient().
|
|
300
|
+
const result = await getClient().orders.next(orderId, options);
|
|
301
301
|
revalidateTag("checkout");
|
|
302
302
|
return result;
|
|
303
303
|
}
|
|
304
304
|
async function getShipments(orderId) {
|
|
305
305
|
const options = await getCheckoutOptions();
|
|
306
|
-
return getClient().
|
|
306
|
+
return getClient().orders.shipments.list(orderId, options);
|
|
307
307
|
}
|
|
308
308
|
async function selectShippingRate(orderId, shipmentId, shippingRateId) {
|
|
309
309
|
const options = await getCheckoutOptions();
|
|
310
|
-
const result = await getClient().
|
|
310
|
+
const result = await getClient().orders.shipments.update(
|
|
311
311
|
orderId,
|
|
312
312
|
shipmentId,
|
|
313
313
|
{ selected_shipping_rate_id: shippingRateId },
|
|
@@ -318,21 +318,21 @@ async function selectShippingRate(orderId, shipmentId, shippingRateId) {
|
|
|
318
318
|
}
|
|
319
319
|
async function applyCoupon(orderId, code) {
|
|
320
320
|
const options = await getCheckoutOptions();
|
|
321
|
-
const result = await getClient().
|
|
321
|
+
const result = await getClient().orders.couponCodes.apply(orderId, code, options);
|
|
322
322
|
revalidateTag("checkout");
|
|
323
323
|
revalidateTag("cart");
|
|
324
324
|
return result;
|
|
325
325
|
}
|
|
326
326
|
async function removeCoupon(orderId, promotionId) {
|
|
327
327
|
const options = await getCheckoutOptions();
|
|
328
|
-
const result = await getClient().
|
|
328
|
+
const result = await getClient().orders.couponCodes.remove(orderId, promotionId, options);
|
|
329
329
|
revalidateTag("checkout");
|
|
330
330
|
revalidateTag("cart");
|
|
331
331
|
return result;
|
|
332
332
|
}
|
|
333
333
|
async function complete(orderId) {
|
|
334
334
|
const options = await getCheckoutOptions();
|
|
335
|
-
const result = await getClient().
|
|
335
|
+
const result = await getClient().orders.complete(orderId, options);
|
|
336
336
|
revalidateTag("checkout");
|
|
337
337
|
revalidateTag("cart");
|
|
338
338
|
return result;
|
|
@@ -348,7 +348,7 @@ async function getAuthOptions() {
|
|
|
348
348
|
const now = Math.floor(Date.now() / 1e3);
|
|
349
349
|
if (exp && exp - now < 3600) {
|
|
350
350
|
try {
|
|
351
|
-
const refreshed = await getClient().
|
|
351
|
+
const refreshed = await getClient().auth.refresh({ token });
|
|
352
352
|
await setAccessToken(refreshed.token);
|
|
353
353
|
return { token: refreshed.token };
|
|
354
354
|
} catch {
|
|
@@ -368,7 +368,7 @@ async function withAuthRefresh(fn) {
|
|
|
368
368
|
} catch (error) {
|
|
369
369
|
if (error instanceof SpreeError && error.status === 401) {
|
|
370
370
|
try {
|
|
371
|
-
const refreshed = await getClient().
|
|
371
|
+
const refreshed = await getClient().auth.refresh({ token: options.token });
|
|
372
372
|
await setAccessToken(refreshed.token);
|
|
373
373
|
return await fn({ token: refreshed.token });
|
|
374
374
|
} catch {
|
|
@@ -383,12 +383,12 @@ async function withAuthRefresh(fn) {
|
|
|
383
383
|
// src/actions/auth.ts
|
|
384
384
|
async function login(email, password) {
|
|
385
385
|
try {
|
|
386
|
-
const result = await getClient().
|
|
386
|
+
const result = await getClient().auth.login({ email, password });
|
|
387
387
|
await setAccessToken(result.token);
|
|
388
388
|
const cartToken = await getCartToken();
|
|
389
389
|
if (cartToken) {
|
|
390
390
|
try {
|
|
391
|
-
await getClient().
|
|
391
|
+
await getClient().cart.associate({
|
|
392
392
|
token: result.token,
|
|
393
393
|
orderToken: cartToken
|
|
394
394
|
});
|
|
@@ -407,7 +407,7 @@ async function login(email, password) {
|
|
|
407
407
|
}
|
|
408
408
|
async function register(email, password, passwordConfirmation) {
|
|
409
409
|
try {
|
|
410
|
-
const result = await getClient().
|
|
410
|
+
const result = await getClient().auth.register({
|
|
411
411
|
email,
|
|
412
412
|
password,
|
|
413
413
|
password_confirmation: passwordConfirmation
|
|
@@ -416,7 +416,7 @@ async function register(email, password, passwordConfirmation) {
|
|
|
416
416
|
const cartToken = await getCartToken();
|
|
417
417
|
if (cartToken) {
|
|
418
418
|
try {
|
|
419
|
-
await getClient().
|
|
419
|
+
await getClient().cart.associate({
|
|
420
420
|
token: result.token,
|
|
421
421
|
orderToken: cartToken
|
|
422
422
|
});
|
|
@@ -445,7 +445,7 @@ async function getCustomer() {
|
|
|
445
445
|
if (!token) return null;
|
|
446
446
|
try {
|
|
447
447
|
return await withAuthRefresh(async (options) => {
|
|
448
|
-
return getClient().
|
|
448
|
+
return getClient().customer.get(options);
|
|
449
449
|
});
|
|
450
450
|
} catch {
|
|
451
451
|
await clearAccessToken();
|
|
@@ -454,38 +454,38 @@ async function getCustomer() {
|
|
|
454
454
|
}
|
|
455
455
|
async function updateCustomer(data) {
|
|
456
456
|
const result = await withAuthRefresh(async (options) => {
|
|
457
|
-
return getClient().
|
|
457
|
+
return getClient().customer.update(data, options);
|
|
458
458
|
});
|
|
459
459
|
revalidateTag("customer");
|
|
460
460
|
return result;
|
|
461
461
|
}
|
|
462
462
|
async function listAddresses() {
|
|
463
463
|
return withAuthRefresh(async (options) => {
|
|
464
|
-
return getClient().
|
|
464
|
+
return getClient().customer.addresses.list(void 0, options);
|
|
465
465
|
});
|
|
466
466
|
}
|
|
467
467
|
async function getAddress(id) {
|
|
468
468
|
return withAuthRefresh(async (options) => {
|
|
469
|
-
return getClient().
|
|
469
|
+
return getClient().customer.addresses.get(id, options);
|
|
470
470
|
});
|
|
471
471
|
}
|
|
472
472
|
async function createAddress(params) {
|
|
473
473
|
const result = await withAuthRefresh(async (options) => {
|
|
474
|
-
return getClient().
|
|
474
|
+
return getClient().customer.addresses.create(params, options);
|
|
475
475
|
});
|
|
476
476
|
revalidateTag("addresses");
|
|
477
477
|
return result;
|
|
478
478
|
}
|
|
479
479
|
async function updateAddress(id, params) {
|
|
480
480
|
const result = await withAuthRefresh(async (options) => {
|
|
481
|
-
return getClient().
|
|
481
|
+
return getClient().customer.addresses.update(id, params, options);
|
|
482
482
|
});
|
|
483
483
|
revalidateTag("addresses");
|
|
484
484
|
return result;
|
|
485
485
|
}
|
|
486
486
|
async function deleteAddress(id) {
|
|
487
487
|
await withAuthRefresh(async (options) => {
|
|
488
|
-
return getClient().
|
|
488
|
+
return getClient().customer.addresses.delete(id, options);
|
|
489
489
|
});
|
|
490
490
|
revalidateTag("addresses");
|
|
491
491
|
}
|
|
@@ -493,12 +493,12 @@ async function deleteAddress(id) {
|
|
|
493
493
|
// src/actions/orders.ts
|
|
494
494
|
async function listOrders(params) {
|
|
495
495
|
return withAuthRefresh(async (options) => {
|
|
496
|
-
return getClient().
|
|
496
|
+
return getClient().customer.orders.list(params, options);
|
|
497
497
|
});
|
|
498
498
|
}
|
|
499
499
|
async function getOrder(idOrNumber, params) {
|
|
500
500
|
return withAuthRefresh(async (options) => {
|
|
501
|
-
return getClient().
|
|
501
|
+
return getClient().orders.get(idOrNumber, params, options);
|
|
502
502
|
});
|
|
503
503
|
}
|
|
504
504
|
async function setLocale(params) {
|
|
@@ -520,12 +520,12 @@ async function setLocale(params) {
|
|
|
520
520
|
}
|
|
521
521
|
async function listCreditCards() {
|
|
522
522
|
return withAuthRefresh(async (options) => {
|
|
523
|
-
return getClient().
|
|
523
|
+
return getClient().customer.creditCards.list(void 0, options);
|
|
524
524
|
});
|
|
525
525
|
}
|
|
526
526
|
async function deleteCreditCard(id) {
|
|
527
527
|
await withAuthRefresh(async (options) => {
|
|
528
|
-
return getClient().
|
|
528
|
+
return getClient().customer.creditCards.delete(id, options);
|
|
529
529
|
});
|
|
530
530
|
revalidateTag("credit-cards");
|
|
531
531
|
}
|
|
@@ -533,12 +533,12 @@ async function deleteCreditCard(id) {
|
|
|
533
533
|
// src/actions/gift-cards.ts
|
|
534
534
|
async function listGiftCards() {
|
|
535
535
|
return withAuthRefresh(async (options) => {
|
|
536
|
-
return getClient().
|
|
536
|
+
return getClient().customer.giftCards.list(void 0, options);
|
|
537
537
|
});
|
|
538
538
|
}
|
|
539
539
|
async function getGiftCard(id) {
|
|
540
540
|
return withAuthRefresh(async (options) => {
|
|
541
|
-
return getClient().
|
|
541
|
+
return getClient().customer.giftCards.get(id, options);
|
|
542
542
|
});
|
|
543
543
|
}
|
|
544
544
|
async function getCheckoutOptions2() {
|
|
@@ -548,23 +548,23 @@ async function getCheckoutOptions2() {
|
|
|
548
548
|
}
|
|
549
549
|
async function createPaymentSession(orderId, params) {
|
|
550
550
|
const options = await getCheckoutOptions2();
|
|
551
|
-
const result = await getClient().
|
|
551
|
+
const result = await getClient().orders.paymentSessions.create(orderId, params, options);
|
|
552
552
|
revalidateTag("checkout");
|
|
553
553
|
return result;
|
|
554
554
|
}
|
|
555
555
|
async function getPaymentSession(orderId, sessionId) {
|
|
556
556
|
const options = await getCheckoutOptions2();
|
|
557
|
-
return getClient().
|
|
557
|
+
return getClient().orders.paymentSessions.get(orderId, sessionId, options);
|
|
558
558
|
}
|
|
559
559
|
async function updatePaymentSession(orderId, sessionId, params) {
|
|
560
560
|
const options = await getCheckoutOptions2();
|
|
561
|
-
const result = await getClient().
|
|
561
|
+
const result = await getClient().orders.paymentSessions.update(orderId, sessionId, params, options);
|
|
562
562
|
revalidateTag("checkout");
|
|
563
563
|
return result;
|
|
564
564
|
}
|
|
565
565
|
async function completePaymentSession(orderId, sessionId, params) {
|
|
566
566
|
const options = await getCheckoutOptions2();
|
|
567
|
-
const result = await getClient().
|
|
567
|
+
const result = await getClient().orders.paymentSessions.complete(orderId, sessionId, params, options);
|
|
568
568
|
revalidateTag("checkout");
|
|
569
569
|
return result;
|
|
570
570
|
}
|
|
@@ -572,17 +572,17 @@ async function completePaymentSession(orderId, sessionId, params) {
|
|
|
572
572
|
// src/actions/payment-setup-sessions.ts
|
|
573
573
|
async function createPaymentSetupSession(params) {
|
|
574
574
|
return withAuthRefresh(async (options) => {
|
|
575
|
-
return getClient().
|
|
575
|
+
return getClient().customer.paymentSetupSessions.create(params, options);
|
|
576
576
|
});
|
|
577
577
|
}
|
|
578
578
|
async function getPaymentSetupSession(id) {
|
|
579
579
|
return withAuthRefresh(async (options) => {
|
|
580
|
-
return getClient().
|
|
580
|
+
return getClient().customer.paymentSetupSessions.get(id, options);
|
|
581
581
|
});
|
|
582
582
|
}
|
|
583
583
|
async function completePaymentSetupSession(id, params) {
|
|
584
584
|
return withAuthRefresh(async (options) => {
|
|
585
|
-
return getClient().
|
|
585
|
+
return getClient().customer.paymentSetupSessions.complete(id, params, options);
|
|
586
586
|
});
|
|
587
587
|
}
|
|
588
588
|
|