checkout-intents 0.2.0 → 0.4.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/CHANGELOG.md +32 -0
- package/README.md +94 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts.map +1 -1
- package/client.js +18 -1
- package/client.js.map +1 -1
- package/client.mjs +18 -1
- package/client.mjs.map +1 -1
- package/core/error.d.mts +17 -0
- package/core/error.d.mts.map +1 -1
- package/core/error.d.ts +17 -0
- package/core/error.d.ts.map +1 -1
- package/core/error.js +18 -1
- package/core/error.js.map +1 -1
- package/core/error.mjs +16 -0
- package/core/error.mjs.map +1 -1
- package/index.d.mts +1 -1
- package/index.d.mts.map +1 -1
- package/index.d.ts +1 -1
- package/index.d.ts.map +1 -1
- package/index.js +2 -1
- package/index.js.map +1 -1
- package/index.mjs +1 -1
- package/index.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/checkout-intents.d.mts +124 -1
- package/resources/checkout-intents.d.mts.map +1 -1
- package/resources/checkout-intents.d.ts +124 -1
- package/resources/checkout-intents.d.ts.map +1 -1
- package/resources/checkout-intents.js +180 -0
- package/resources/checkout-intents.js.map +1 -1
- package/resources/checkout-intents.mjs +180 -0
- package/resources/checkout-intents.mjs.map +1 -1
- package/src/client.ts +23 -1
- package/src/core/error.ts +43 -0
- package/src/index.ts +1 -0
- package/src/resources/checkout-intents.ts +246 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/index.d.mts
CHANGED
|
@@ -2,5 +2,5 @@ export { CheckoutIntents as default } from "./client.mjs";
|
|
|
2
2
|
export { type Uploadable, toFile } from "./core/uploads.mjs";
|
|
3
3
|
export { APIPromise } from "./core/api-promise.mjs";
|
|
4
4
|
export { CheckoutIntents, type ClientOptions } from "./client.mjs";
|
|
5
|
-
export { CheckoutIntentsError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
|
|
5
|
+
export { CheckoutIntentsError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, PollTimeoutError, } from "./core/error.mjs";
|
|
6
6
|
//# sourceMappingURL=index.d.mts.map
|
package/index.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,IAAI,OAAO,EAAE;OAE9B,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE;OACvC,EACL,oBAAoB,EACpB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,IAAI,OAAO,EAAE;OAE9B,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE;OACvC,EACL,oBAAoB,EACpB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,GACjB"}
|
package/index.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ export { CheckoutIntents as default } from "./client.js";
|
|
|
2
2
|
export { type Uploadable, toFile } from "./core/uploads.js";
|
|
3
3
|
export { APIPromise } from "./core/api-promise.js";
|
|
4
4
|
export { CheckoutIntents, type ClientOptions } from "./client.js";
|
|
5
|
-
export { CheckoutIntentsError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.js";
|
|
5
|
+
export { CheckoutIntentsError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, PollTimeoutError, } from "./core/error.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
package/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,IAAI,OAAO,EAAE;OAE9B,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE;OACvC,EACL,oBAAoB,EACpB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"OAEO,EAAE,eAAe,IAAI,OAAO,EAAE;OAE9B,EAAE,KAAK,UAAU,EAAE,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,eAAe,EAAE,KAAK,aAAa,EAAE;OACvC,EACL,oBAAoB,EACpB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,GACjB"}
|
package/index.js
CHANGED
|
@@ -4,7 +4,7 @@ exports = module.exports = function (...args) {
|
|
|
4
4
|
return new exports.default(...args)
|
|
5
5
|
}
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.CheckoutIntentsError = exports.CheckoutIntents = exports.APIPromise = exports.toFile = exports.default = void 0;
|
|
7
|
+
exports.PollTimeoutError = exports.UnprocessableEntityError = exports.PermissionDeniedError = exports.InternalServerError = exports.AuthenticationError = exports.BadRequestError = exports.RateLimitError = exports.ConflictError = exports.NotFoundError = exports.APIUserAbortError = exports.APIConnectionTimeoutError = exports.APIConnectionError = exports.APIError = exports.CheckoutIntentsError = exports.CheckoutIntents = exports.APIPromise = exports.toFile = exports.default = void 0;
|
|
8
8
|
var client_1 = require("./client.js");
|
|
9
9
|
Object.defineProperty(exports, "default", { enumerable: true, get: function () { return client_1.CheckoutIntents; } });
|
|
10
10
|
var uploads_1 = require("./core/uploads.js");
|
|
@@ -27,4 +27,5 @@ Object.defineProperty(exports, "AuthenticationError", { enumerable: true, get: f
|
|
|
27
27
|
Object.defineProperty(exports, "InternalServerError", { enumerable: true, get: function () { return error_1.InternalServerError; } });
|
|
28
28
|
Object.defineProperty(exports, "PermissionDeniedError", { enumerable: true, get: function () { return error_1.PermissionDeniedError; } });
|
|
29
29
|
Object.defineProperty(exports, "UnprocessableEntityError", { enumerable: true, get: function () { return error_1.UnprocessableEntityError; } });
|
|
30
|
+
Object.defineProperty(exports, "PollTimeoutError", { enumerable: true, get: function () { return error_1.PollTimeoutError; } });
|
|
30
31
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAAsD;AAA7C,iGAAA,eAAe,OAAW;AAEnC,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAA+D;AAAtD,yGAAA,eAAe,OAAA;AACxB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAAsD;AAA7C,iGAAA,eAAe,OAAW;AAEnC,6CAAyD;AAA/B,iGAAA,MAAM,OAAA;AAChC,qDAAgD;AAAvC,yGAAA,UAAU,OAAA;AACnB,sCAA+D;AAAtD,yGAAA,eAAe,OAAA;AACxB,yCAesB;AAdpB,6GAAA,oBAAoB,OAAA;AACpB,iGAAA,QAAQ,OAAA;AACR,2GAAA,kBAAkB,OAAA;AAClB,kHAAA,yBAAyB,OAAA;AACzB,0GAAA,iBAAiB,OAAA;AACjB,sGAAA,aAAa,OAAA;AACb,sGAAA,aAAa,OAAA;AACb,uGAAA,cAAc,OAAA;AACd,wGAAA,eAAe,OAAA;AACf,4GAAA,mBAAmB,OAAA;AACnB,4GAAA,mBAAmB,OAAA;AACnB,8GAAA,qBAAqB,OAAA;AACrB,iHAAA,wBAAwB,OAAA;AACxB,yGAAA,gBAAgB,OAAA"}
|
package/index.mjs
CHANGED
|
@@ -3,5 +3,5 @@ export { CheckoutIntents as default } from "./client.mjs";
|
|
|
3
3
|
export { toFile } from "./core/uploads.mjs";
|
|
4
4
|
export { APIPromise } from "./core/api-promise.mjs";
|
|
5
5
|
export { CheckoutIntents } from "./client.mjs";
|
|
6
|
-
export { CheckoutIntentsError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, } from "./core/error.mjs";
|
|
6
|
+
export { CheckoutIntentsError, APIError, APIConnectionError, APIConnectionTimeoutError, APIUserAbortError, NotFoundError, ConflictError, RateLimitError, BadRequestError, AuthenticationError, InternalServerError, PermissionDeniedError, UnprocessableEntityError, PollTimeoutError, } from "./core/error.mjs";
|
|
7
7
|
//# sourceMappingURL=index.mjs.map
|
package/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,eAAe,IAAI,OAAO,EAAE;OAE9B,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,eAAe,EAAsB;OACvC,EACL,oBAAoB,EACpB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["src/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,eAAe,IAAI,OAAO,EAAE;OAE9B,EAAmB,MAAM,EAAE;OAC3B,EAAE,UAAU,EAAE;OACd,EAAE,eAAe,EAAsB;OACvC,EACL,oBAAoB,EACpB,QAAQ,EACR,kBAAkB,EAClB,yBAAyB,EACzB,iBAAiB,EACjB,aAAa,EACb,aAAa,EACb,cAAc,EACd,eAAe,EACf,mBAAmB,EACnB,mBAAmB,EACnB,qBAAqB,EACrB,wBAAwB,EACxB,gBAAgB,GACjB"}
|
package/package.json
CHANGED
|
@@ -2,6 +2,19 @@ import { APIResource } from "../core/resource.mjs";
|
|
|
2
2
|
import * as CheckoutIntentsAPI from "./checkout-intents.mjs";
|
|
3
3
|
import { APIPromise } from "../core/api-promise.mjs";
|
|
4
4
|
import { RequestOptions } from "../internal/request-options.mjs";
|
|
5
|
+
/**
|
|
6
|
+
* Options for polling operations.
|
|
7
|
+
*/
|
|
8
|
+
export interface PollOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The interval in milliseconds between polling attempts.
|
|
11
|
+
*/
|
|
12
|
+
pollIntervalMs?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The maximum number of polling attempts before timing out.
|
|
15
|
+
*/
|
|
16
|
+
maxAttempts?: number;
|
|
17
|
+
}
|
|
5
18
|
export declare class CheckoutIntentsResource extends APIResource {
|
|
6
19
|
/**
|
|
7
20
|
* Create a checkout intent with the given request body.
|
|
@@ -73,6 +86,116 @@ export declare class CheckoutIntentsResource extends APIResource {
|
|
|
73
86
|
* ```
|
|
74
87
|
*/
|
|
75
88
|
confirm(id: string, body: CheckoutIntentConfirmParams, options?: RequestOptions): APIPromise<CheckoutIntent>;
|
|
89
|
+
/**
|
|
90
|
+
* A helper to poll a checkout intent until a specific condition is met.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* // Poll until completed or failed
|
|
95
|
+
* const checkoutIntent = await client.checkoutIntents.pollUntil(
|
|
96
|
+
* 'id',
|
|
97
|
+
* (intent) => intent.state === 'completed' || intent.state === 'failed'
|
|
98
|
+
* );
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
private pollUntil;
|
|
102
|
+
/**
|
|
103
|
+
* A helper to poll a checkout intent until it reaches a completed state
|
|
104
|
+
* (completed or failed).
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const checkoutIntent = await client.checkoutIntents.pollUntilCompleted('id');
|
|
109
|
+
* if (checkoutIntent.state === 'completed') {
|
|
110
|
+
* console.log('Order placed successfully!');
|
|
111
|
+
* } else if (checkoutIntent.state === 'failed') {
|
|
112
|
+
* console.log('Order failed:', checkoutIntent.failureReason);
|
|
113
|
+
* }
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
pollUntilCompleted(id: string, options?: RequestOptions & PollOptions): Promise<CheckoutIntent.CompletedCheckoutIntent | CheckoutIntent.FailedCheckoutIntent>;
|
|
117
|
+
/**
|
|
118
|
+
* A helper to poll a checkout intent until it's ready for confirmation
|
|
119
|
+
* (awaiting_confirmation state) or has failed. This is typically used after
|
|
120
|
+
* creating a checkout intent to wait for the offer to be retrieved from the merchant.
|
|
121
|
+
*
|
|
122
|
+
* The intent can reach awaiting_confirmation (success - ready to confirm) or failed
|
|
123
|
+
* (offer retrieval failed). Always check the state after polling.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* const intent = await client.checkoutIntents.pollUntilAwaitingConfirmation('id');
|
|
128
|
+
*
|
|
129
|
+
* if (intent.state === 'awaiting_confirmation') {
|
|
130
|
+
* // Review the offer before confirming
|
|
131
|
+
* console.log('Total:', intent.offer.cost.total);
|
|
132
|
+
* } else if (intent.state === 'failed') {
|
|
133
|
+
* // Handle failure (e.g., offer retrieval failed, product out of stock)
|
|
134
|
+
* console.log('Failed:', intent.failureReason);
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
pollUntilAwaitingConfirmation(id: string, options?: RequestOptions & PollOptions): Promise<CheckoutIntent.AwaitingConfirmationCheckoutIntent | CheckoutIntent.FailedCheckoutIntent>;
|
|
139
|
+
/**
|
|
140
|
+
* A helper to create a checkout intent and poll until it's ready for confirmation.
|
|
141
|
+
* This follows the Rye documented flow: create → poll until awaiting_confirmation.
|
|
142
|
+
*
|
|
143
|
+
* After this method completes, you should review the offer (pricing, shipping, taxes)
|
|
144
|
+
* with the user before calling confirm().
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* // Phase 1: Create and wait for offer
|
|
149
|
+
* const intent = await client.checkoutIntents.createAndPoll({
|
|
150
|
+
* buyer: {
|
|
151
|
+
* address1: '123 Main St',
|
|
152
|
+
* city: 'New York',
|
|
153
|
+
* country: 'United States',
|
|
154
|
+
* email: 'john.doe@example.com',
|
|
155
|
+
* firstName: 'John',
|
|
156
|
+
* lastName: 'Doe',
|
|
157
|
+
* phone: '+1234567890',
|
|
158
|
+
* postalCode: '10001',
|
|
159
|
+
* province: 'NY',
|
|
160
|
+
* },
|
|
161
|
+
* productUrl: 'https://example.com/product',
|
|
162
|
+
* quantity: 1,
|
|
163
|
+
* });
|
|
164
|
+
*
|
|
165
|
+
* // Review the offer with the user
|
|
166
|
+
* console.log('Total:', intent.offer.cost.total);
|
|
167
|
+
*
|
|
168
|
+
* // Phase 2: Confirm with payment
|
|
169
|
+
* const completed = await client.checkoutIntents.confirmAndPoll(intent.id, {
|
|
170
|
+
* paymentMethod: { type: 'stripe_token', stripeToken: 'tok_visa' }
|
|
171
|
+
* });
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
createAndPoll(body: CheckoutIntentCreateParams, options?: RequestOptions & PollOptions): Promise<CheckoutIntent.AwaitingConfirmationCheckoutIntent | CheckoutIntent.FailedCheckoutIntent>;
|
|
175
|
+
/**
|
|
176
|
+
* A helper to confirm a checkout intent and poll until it reaches a completed state
|
|
177
|
+
* (completed or failed).
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* const checkoutIntent = await client.checkoutIntents.confirmAndPoll(
|
|
182
|
+
* 'id',
|
|
183
|
+
* {
|
|
184
|
+
* paymentMethod: {
|
|
185
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
186
|
+
* type: 'stripe_token',
|
|
187
|
+
* },
|
|
188
|
+
* }
|
|
189
|
+
* );
|
|
190
|
+
*
|
|
191
|
+
* if (checkoutIntent.state === 'completed') {
|
|
192
|
+
* console.log('Order placed successfully!');
|
|
193
|
+
* } else if (checkoutIntent.state === 'failed') {
|
|
194
|
+
* console.log('Order failed:', checkoutIntent.failureReason);
|
|
195
|
+
* }
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
confirmAndPoll(id: string, body: CheckoutIntentConfirmParams, options?: RequestOptions & PollOptions): Promise<CheckoutIntent.CompletedCheckoutIntent | CheckoutIntent.FailedCheckoutIntent>;
|
|
76
199
|
}
|
|
77
200
|
export interface BaseCheckoutIntent {
|
|
78
201
|
id: string;
|
|
@@ -192,6 +315,6 @@ export interface CheckoutIntentConfirmParams {
|
|
|
192
315
|
paymentMethod: PaymentMethod;
|
|
193
316
|
}
|
|
194
317
|
export declare namespace CheckoutIntentsResource {
|
|
195
|
-
export { type BaseCheckoutIntent as BaseCheckoutIntent, type Buyer as Buyer, type CheckoutIntent as CheckoutIntent, type Money as Money, type Offer as Offer, type PaymentMethod as PaymentMethod, type VariantSelection as VariantSelection, type CheckoutIntentCreateParams as CheckoutIntentCreateParams, type CheckoutIntentAddPaymentParams as CheckoutIntentAddPaymentParams, type CheckoutIntentConfirmParams as CheckoutIntentConfirmParams, };
|
|
318
|
+
export { type BaseCheckoutIntent as BaseCheckoutIntent, type Buyer as Buyer, type CheckoutIntent as CheckoutIntent, type Money as Money, type Offer as Offer, type PaymentMethod as PaymentMethod, type PollOptions as PollOptions, type VariantSelection as VariantSelection, type CheckoutIntentCreateParams as CheckoutIntentCreateParams, type CheckoutIntentAddPaymentParams as CheckoutIntentAddPaymentParams, type CheckoutIntentConfirmParams as CheckoutIntentConfirmParams, };
|
|
196
319
|
}
|
|
197
320
|
//# sourceMappingURL=checkout-intents.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout-intents.d.mts","sourceRoot":"","sources":["../src/resources/checkout-intents.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,kBAAkB;
|
|
1
|
+
{"version":3,"file":"checkout-intents.d.mts","sourceRoot":"","sources":["../src/resources/checkout-intents.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,kBA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AAW,0BAA0B;IACzC,KAAK,EAAE,KAAK,CAAC;IAEb,UAAU,EAAE,MAAM,CAAC;IAEnB,QAAQ,EAAE,MAAM,CAAC;IAEjB,iBAAiB,CAAC,EAAE,KAAK,CAAC,gBAAgB,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,8BAA8B;IAC7C,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,WAAW,2BAA2B;IAC1C,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,MAAM,CAAC,OAAO,WAAW,uBAAuB,CAAC;IAC/C,OAAO,EACL,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,KAAK,IAAI,KAAK,EACnB,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,KAAK,IAAI,KAAK,EACnB,KAAK,KAAK,IAAI,KAAK,EACnB,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,2BAA2B,IAAI,2BAA2B,GAChE,CAAC;CACH"}
|
|
@@ -2,6 +2,19 @@ import { APIResource } from "../core/resource.js";
|
|
|
2
2
|
import * as CheckoutIntentsAPI from "./checkout-intents.js";
|
|
3
3
|
import { APIPromise } from "../core/api-promise.js";
|
|
4
4
|
import { RequestOptions } from "../internal/request-options.js";
|
|
5
|
+
/**
|
|
6
|
+
* Options for polling operations.
|
|
7
|
+
*/
|
|
8
|
+
export interface PollOptions {
|
|
9
|
+
/**
|
|
10
|
+
* The interval in milliseconds between polling attempts.
|
|
11
|
+
*/
|
|
12
|
+
pollIntervalMs?: number;
|
|
13
|
+
/**
|
|
14
|
+
* The maximum number of polling attempts before timing out.
|
|
15
|
+
*/
|
|
16
|
+
maxAttempts?: number;
|
|
17
|
+
}
|
|
5
18
|
export declare class CheckoutIntentsResource extends APIResource {
|
|
6
19
|
/**
|
|
7
20
|
* Create a checkout intent with the given request body.
|
|
@@ -73,6 +86,116 @@ export declare class CheckoutIntentsResource extends APIResource {
|
|
|
73
86
|
* ```
|
|
74
87
|
*/
|
|
75
88
|
confirm(id: string, body: CheckoutIntentConfirmParams, options?: RequestOptions): APIPromise<CheckoutIntent>;
|
|
89
|
+
/**
|
|
90
|
+
* A helper to poll a checkout intent until a specific condition is met.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* // Poll until completed or failed
|
|
95
|
+
* const checkoutIntent = await client.checkoutIntents.pollUntil(
|
|
96
|
+
* 'id',
|
|
97
|
+
* (intent) => intent.state === 'completed' || intent.state === 'failed'
|
|
98
|
+
* );
|
|
99
|
+
* ```
|
|
100
|
+
*/
|
|
101
|
+
private pollUntil;
|
|
102
|
+
/**
|
|
103
|
+
* A helper to poll a checkout intent until it reaches a completed state
|
|
104
|
+
* (completed or failed).
|
|
105
|
+
*
|
|
106
|
+
* @example
|
|
107
|
+
* ```ts
|
|
108
|
+
* const checkoutIntent = await client.checkoutIntents.pollUntilCompleted('id');
|
|
109
|
+
* if (checkoutIntent.state === 'completed') {
|
|
110
|
+
* console.log('Order placed successfully!');
|
|
111
|
+
* } else if (checkoutIntent.state === 'failed') {
|
|
112
|
+
* console.log('Order failed:', checkoutIntent.failureReason);
|
|
113
|
+
* }
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
pollUntilCompleted(id: string, options?: RequestOptions & PollOptions): Promise<CheckoutIntent.CompletedCheckoutIntent | CheckoutIntent.FailedCheckoutIntent>;
|
|
117
|
+
/**
|
|
118
|
+
* A helper to poll a checkout intent until it's ready for confirmation
|
|
119
|
+
* (awaiting_confirmation state) or has failed. This is typically used after
|
|
120
|
+
* creating a checkout intent to wait for the offer to be retrieved from the merchant.
|
|
121
|
+
*
|
|
122
|
+
* The intent can reach awaiting_confirmation (success - ready to confirm) or failed
|
|
123
|
+
* (offer retrieval failed). Always check the state after polling.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```ts
|
|
127
|
+
* const intent = await client.checkoutIntents.pollUntilAwaitingConfirmation('id');
|
|
128
|
+
*
|
|
129
|
+
* if (intent.state === 'awaiting_confirmation') {
|
|
130
|
+
* // Review the offer before confirming
|
|
131
|
+
* console.log('Total:', intent.offer.cost.total);
|
|
132
|
+
* } else if (intent.state === 'failed') {
|
|
133
|
+
* // Handle failure (e.g., offer retrieval failed, product out of stock)
|
|
134
|
+
* console.log('Failed:', intent.failureReason);
|
|
135
|
+
* }
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
pollUntilAwaitingConfirmation(id: string, options?: RequestOptions & PollOptions): Promise<CheckoutIntent.AwaitingConfirmationCheckoutIntent | CheckoutIntent.FailedCheckoutIntent>;
|
|
139
|
+
/**
|
|
140
|
+
* A helper to create a checkout intent and poll until it's ready for confirmation.
|
|
141
|
+
* This follows the Rye documented flow: create → poll until awaiting_confirmation.
|
|
142
|
+
*
|
|
143
|
+
* After this method completes, you should review the offer (pricing, shipping, taxes)
|
|
144
|
+
* with the user before calling confirm().
|
|
145
|
+
*
|
|
146
|
+
* @example
|
|
147
|
+
* ```ts
|
|
148
|
+
* // Phase 1: Create and wait for offer
|
|
149
|
+
* const intent = await client.checkoutIntents.createAndPoll({
|
|
150
|
+
* buyer: {
|
|
151
|
+
* address1: '123 Main St',
|
|
152
|
+
* city: 'New York',
|
|
153
|
+
* country: 'United States',
|
|
154
|
+
* email: 'john.doe@example.com',
|
|
155
|
+
* firstName: 'John',
|
|
156
|
+
* lastName: 'Doe',
|
|
157
|
+
* phone: '+1234567890',
|
|
158
|
+
* postalCode: '10001',
|
|
159
|
+
* province: 'NY',
|
|
160
|
+
* },
|
|
161
|
+
* productUrl: 'https://example.com/product',
|
|
162
|
+
* quantity: 1,
|
|
163
|
+
* });
|
|
164
|
+
*
|
|
165
|
+
* // Review the offer with the user
|
|
166
|
+
* console.log('Total:', intent.offer.cost.total);
|
|
167
|
+
*
|
|
168
|
+
* // Phase 2: Confirm with payment
|
|
169
|
+
* const completed = await client.checkoutIntents.confirmAndPoll(intent.id, {
|
|
170
|
+
* paymentMethod: { type: 'stripe_token', stripeToken: 'tok_visa' }
|
|
171
|
+
* });
|
|
172
|
+
* ```
|
|
173
|
+
*/
|
|
174
|
+
createAndPoll(body: CheckoutIntentCreateParams, options?: RequestOptions & PollOptions): Promise<CheckoutIntent.AwaitingConfirmationCheckoutIntent | CheckoutIntent.FailedCheckoutIntent>;
|
|
175
|
+
/**
|
|
176
|
+
* A helper to confirm a checkout intent and poll until it reaches a completed state
|
|
177
|
+
* (completed or failed).
|
|
178
|
+
*
|
|
179
|
+
* @example
|
|
180
|
+
* ```ts
|
|
181
|
+
* const checkoutIntent = await client.checkoutIntents.confirmAndPoll(
|
|
182
|
+
* 'id',
|
|
183
|
+
* {
|
|
184
|
+
* paymentMethod: {
|
|
185
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
186
|
+
* type: 'stripe_token',
|
|
187
|
+
* },
|
|
188
|
+
* }
|
|
189
|
+
* );
|
|
190
|
+
*
|
|
191
|
+
* if (checkoutIntent.state === 'completed') {
|
|
192
|
+
* console.log('Order placed successfully!');
|
|
193
|
+
* } else if (checkoutIntent.state === 'failed') {
|
|
194
|
+
* console.log('Order failed:', checkoutIntent.failureReason);
|
|
195
|
+
* }
|
|
196
|
+
* ```
|
|
197
|
+
*/
|
|
198
|
+
confirmAndPoll(id: string, body: CheckoutIntentConfirmParams, options?: RequestOptions & PollOptions): Promise<CheckoutIntent.CompletedCheckoutIntent | CheckoutIntent.FailedCheckoutIntent>;
|
|
76
199
|
}
|
|
77
200
|
export interface BaseCheckoutIntent {
|
|
78
201
|
id: string;
|
|
@@ -192,6 +315,6 @@ export interface CheckoutIntentConfirmParams {
|
|
|
192
315
|
paymentMethod: PaymentMethod;
|
|
193
316
|
}
|
|
194
317
|
export declare namespace CheckoutIntentsResource {
|
|
195
|
-
export { type BaseCheckoutIntent as BaseCheckoutIntent, type Buyer as Buyer, type CheckoutIntent as CheckoutIntent, type Money as Money, type Offer as Offer, type PaymentMethod as PaymentMethod, type VariantSelection as VariantSelection, type CheckoutIntentCreateParams as CheckoutIntentCreateParams, type CheckoutIntentAddPaymentParams as CheckoutIntentAddPaymentParams, type CheckoutIntentConfirmParams as CheckoutIntentConfirmParams, };
|
|
318
|
+
export { type BaseCheckoutIntent as BaseCheckoutIntent, type Buyer as Buyer, type CheckoutIntent as CheckoutIntent, type Money as Money, type Offer as Offer, type PaymentMethod as PaymentMethod, type PollOptions as PollOptions, type VariantSelection as VariantSelection, type CheckoutIntentCreateParams as CheckoutIntentCreateParams, type CheckoutIntentAddPaymentParams as CheckoutIntentAddPaymentParams, type CheckoutIntentConfirmParams as CheckoutIntentConfirmParams, };
|
|
196
319
|
}
|
|
197
320
|
//# sourceMappingURL=checkout-intents.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout-intents.d.ts","sourceRoot":"","sources":["../src/resources/checkout-intents.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,kBAAkB;
|
|
1
|
+
{"version":3,"file":"checkout-intents.d.ts","sourceRoot":"","sources":["../src/resources/checkout-intents.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,kBAAkB;OAEvB,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAMzB;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,qBAAa,uBAAwB,SAAQ,WAAW;IACtD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,IAAI,EAAE,0BAA0B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;IAI9F;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BAAkB,IAAI,kBAAkB,EAC7C,KAAK,KAAK,IAAI,KAAK,EACnB,KAAK,cAAc,IAAI,cAAc,EACrC,KAAK,KAAK,IAAI,KAAK,EACnB,KAAK,KAAK,IAAI,KAAK,EACnB,KAAK,aAAa,IAAI,aAAa,EACnC,KAAK,WAAW,IAAI,WAAW,EAC/B,KAAK,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,2BAA2B,IAAI,2BAA2B,GAChE,CAAC;CACH"}
|
|
@@ -3,7 +3,11 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
4
|
exports.CheckoutIntentsResource = void 0;
|
|
5
5
|
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const error_1 = require("../core/error.js");
|
|
6
7
|
const path_1 = require("../internal/utils/path.js");
|
|
8
|
+
const sleep_1 = require("../internal/utils/sleep.js");
|
|
9
|
+
const headers_1 = require("../internal/headers.js");
|
|
10
|
+
const log_1 = require("../internal/utils/log.js");
|
|
7
11
|
class CheckoutIntentsResource extends resource_1.APIResource {
|
|
8
12
|
/**
|
|
9
13
|
* Create a checkout intent with the given request body.
|
|
@@ -83,6 +87,182 @@ class CheckoutIntentsResource extends resource_1.APIResource {
|
|
|
83
87
|
confirm(id, body, options) {
|
|
84
88
|
return this._client.post((0, path_1.path) `/api/v1/checkout-intents/${id}/confirm`, { body, ...options });
|
|
85
89
|
}
|
|
90
|
+
/**
|
|
91
|
+
* A helper to poll a checkout intent until a specific condition is met.
|
|
92
|
+
*
|
|
93
|
+
* @example
|
|
94
|
+
* ```ts
|
|
95
|
+
* // Poll until completed or failed
|
|
96
|
+
* const checkoutIntent = await client.checkoutIntents.pollUntil(
|
|
97
|
+
* 'id',
|
|
98
|
+
* (intent) => intent.state === 'completed' || intent.state === 'failed'
|
|
99
|
+
* );
|
|
100
|
+
* ```
|
|
101
|
+
*/
|
|
102
|
+
async pollUntil(id, condition, options) {
|
|
103
|
+
let maxAttempts = options?.maxAttempts ?? 120; // Default: 120 attempts
|
|
104
|
+
const pollIntervalMs = options?.pollIntervalMs ?? 5000; // Default: 5 seconds
|
|
105
|
+
if (maxAttempts < 1) {
|
|
106
|
+
(0, log_1.loggerFor)(this._client).warn(`[Checkout Intents SDK] Invalid maxAttempts value: ${maxAttempts}. maxAttempts must be >= 1. Defaulting to 1 to ensure at least one polling attempt.`);
|
|
107
|
+
maxAttempts = 1;
|
|
108
|
+
}
|
|
109
|
+
const headers = (0, headers_1.buildHeaders)([
|
|
110
|
+
options?.headers,
|
|
111
|
+
{
|
|
112
|
+
'X-Stainless-Poll-Helper': 'true',
|
|
113
|
+
'X-Stainless-Custom-Poll-Interval': pollIntervalMs.toString(),
|
|
114
|
+
},
|
|
115
|
+
]);
|
|
116
|
+
let intent;
|
|
117
|
+
let attempts = 0;
|
|
118
|
+
while (attempts < maxAttempts) {
|
|
119
|
+
const { data, response } = await this.retrieve(id, {
|
|
120
|
+
...options,
|
|
121
|
+
headers: { ...options?.headers, ...headers.values },
|
|
122
|
+
}).withResponse();
|
|
123
|
+
intent = data;
|
|
124
|
+
// Check if condition is met
|
|
125
|
+
if (condition(intent)) {
|
|
126
|
+
return intent;
|
|
127
|
+
}
|
|
128
|
+
attempts++;
|
|
129
|
+
// If we've reached max attempts, throw an error
|
|
130
|
+
if (attempts >= maxAttempts) {
|
|
131
|
+
throw new error_1.PollTimeoutError({
|
|
132
|
+
intentId: intent.id,
|
|
133
|
+
attempts,
|
|
134
|
+
maxAttempts,
|
|
135
|
+
pollIntervalMs,
|
|
136
|
+
message: `Polling timeout: condition not met after ${maxAttempts} attempts (${(maxAttempts * pollIntervalMs) / 1000}s)`,
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
// Check if server suggests a polling interval
|
|
140
|
+
let sleepInterval = pollIntervalMs;
|
|
141
|
+
const headerInterval = response.headers.get('retry-after-ms');
|
|
142
|
+
if (headerInterval) {
|
|
143
|
+
const headerIntervalMs = parseInt(headerInterval);
|
|
144
|
+
if (!isNaN(headerIntervalMs)) {
|
|
145
|
+
sleepInterval = headerIntervalMs;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
await (0, sleep_1.sleep)(sleepInterval);
|
|
149
|
+
}
|
|
150
|
+
// This should never be reached due to the throw above, but TypeScript needs it
|
|
151
|
+
throw new error_1.PollTimeoutError({
|
|
152
|
+
intentId: intent.id,
|
|
153
|
+
attempts,
|
|
154
|
+
maxAttempts,
|
|
155
|
+
pollIntervalMs,
|
|
156
|
+
message: `Polling timeout: condition not met after ${maxAttempts} attempts`,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* A helper to poll a checkout intent until it reaches a completed state
|
|
161
|
+
* (completed or failed).
|
|
162
|
+
*
|
|
163
|
+
* @example
|
|
164
|
+
* ```ts
|
|
165
|
+
* const checkoutIntent = await client.checkoutIntents.pollUntilCompleted('id');
|
|
166
|
+
* if (checkoutIntent.state === 'completed') {
|
|
167
|
+
* console.log('Order placed successfully!');
|
|
168
|
+
* } else if (checkoutIntent.state === 'failed') {
|
|
169
|
+
* console.log('Order failed:', checkoutIntent.failureReason);
|
|
170
|
+
* }
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
async pollUntilCompleted(id, options) {
|
|
174
|
+
return this.pollUntil(id, (intent) => intent.state === 'completed' || intent.state === 'failed', options);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* A helper to poll a checkout intent until it's ready for confirmation
|
|
178
|
+
* (awaiting_confirmation state) or has failed. This is typically used after
|
|
179
|
+
* creating a checkout intent to wait for the offer to be retrieved from the merchant.
|
|
180
|
+
*
|
|
181
|
+
* The intent can reach awaiting_confirmation (success - ready to confirm) or failed
|
|
182
|
+
* (offer retrieval failed). Always check the state after polling.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```ts
|
|
186
|
+
* const intent = await client.checkoutIntents.pollUntilAwaitingConfirmation('id');
|
|
187
|
+
*
|
|
188
|
+
* if (intent.state === 'awaiting_confirmation') {
|
|
189
|
+
* // Review the offer before confirming
|
|
190
|
+
* console.log('Total:', intent.offer.cost.total);
|
|
191
|
+
* } else if (intent.state === 'failed') {
|
|
192
|
+
* // Handle failure (e.g., offer retrieval failed, product out of stock)
|
|
193
|
+
* console.log('Failed:', intent.failureReason);
|
|
194
|
+
* }
|
|
195
|
+
* ```
|
|
196
|
+
*/
|
|
197
|
+
async pollUntilAwaitingConfirmation(id, options) {
|
|
198
|
+
return this.pollUntil(id, (intent) => intent.state === 'awaiting_confirmation' || intent.state === 'failed', options);
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* A helper to create a checkout intent and poll until it's ready for confirmation.
|
|
202
|
+
* This follows the Rye documented flow: create → poll until awaiting_confirmation.
|
|
203
|
+
*
|
|
204
|
+
* After this method completes, you should review the offer (pricing, shipping, taxes)
|
|
205
|
+
* with the user before calling confirm().
|
|
206
|
+
*
|
|
207
|
+
* @example
|
|
208
|
+
* ```ts
|
|
209
|
+
* // Phase 1: Create and wait for offer
|
|
210
|
+
* const intent = await client.checkoutIntents.createAndPoll({
|
|
211
|
+
* buyer: {
|
|
212
|
+
* address1: '123 Main St',
|
|
213
|
+
* city: 'New York',
|
|
214
|
+
* country: 'United States',
|
|
215
|
+
* email: 'john.doe@example.com',
|
|
216
|
+
* firstName: 'John',
|
|
217
|
+
* lastName: 'Doe',
|
|
218
|
+
* phone: '+1234567890',
|
|
219
|
+
* postalCode: '10001',
|
|
220
|
+
* province: 'NY',
|
|
221
|
+
* },
|
|
222
|
+
* productUrl: 'https://example.com/product',
|
|
223
|
+
* quantity: 1,
|
|
224
|
+
* });
|
|
225
|
+
*
|
|
226
|
+
* // Review the offer with the user
|
|
227
|
+
* console.log('Total:', intent.offer.cost.total);
|
|
228
|
+
*
|
|
229
|
+
* // Phase 2: Confirm with payment
|
|
230
|
+
* const completed = await client.checkoutIntents.confirmAndPoll(intent.id, {
|
|
231
|
+
* paymentMethod: { type: 'stripe_token', stripeToken: 'tok_visa' }
|
|
232
|
+
* });
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
async createAndPoll(body, options) {
|
|
236
|
+
const intent = await this.create(body, options);
|
|
237
|
+
return this.pollUntilAwaitingConfirmation(intent.id, options);
|
|
238
|
+
}
|
|
239
|
+
/**
|
|
240
|
+
* A helper to confirm a checkout intent and poll until it reaches a completed state
|
|
241
|
+
* (completed or failed).
|
|
242
|
+
*
|
|
243
|
+
* @example
|
|
244
|
+
* ```ts
|
|
245
|
+
* const checkoutIntent = await client.checkoutIntents.confirmAndPoll(
|
|
246
|
+
* 'id',
|
|
247
|
+
* {
|
|
248
|
+
* paymentMethod: {
|
|
249
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
250
|
+
* type: 'stripe_token',
|
|
251
|
+
* },
|
|
252
|
+
* }
|
|
253
|
+
* );
|
|
254
|
+
*
|
|
255
|
+
* if (checkoutIntent.state === 'completed') {
|
|
256
|
+
* console.log('Order placed successfully!');
|
|
257
|
+
* } else if (checkoutIntent.state === 'failed') {
|
|
258
|
+
* console.log('Order failed:', checkoutIntent.failureReason);
|
|
259
|
+
* }
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
async confirmAndPoll(id, body, options) {
|
|
263
|
+
const intent = await this.confirm(id, body, options);
|
|
264
|
+
return this.pollUntilCompleted(intent.id, options);
|
|
265
|
+
}
|
|
86
266
|
}
|
|
87
267
|
exports.CheckoutIntentsResource = CheckoutIntentsResource;
|
|
88
268
|
//# sourceMappingURL=checkout-intents.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkout-intents.js","sourceRoot":"","sources":["../src/resources/checkout-intents.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;
|
|
1
|
+
{"version":3,"file":"checkout-intents.js","sourceRoot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