checkout-intents 0.1.0 → 0.3.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.
Files changed (135) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/LICENSE +4 -198
  3. package/README.md +155 -21
  4. package/client.d.mts +21 -7
  5. package/client.d.mts.map +1 -1
  6. package/client.d.ts +21 -7
  7. package/client.d.ts.map +1 -1
  8. package/client.js +37 -10
  9. package/client.js.map +1 -1
  10. package/client.mjs +37 -10
  11. package/client.mjs.map +1 -1
  12. package/internal/to-file.d.mts +1 -1
  13. package/internal/to-file.d.ts +1 -1
  14. package/internal/to-file.js +1 -1
  15. package/internal/to-file.mjs +1 -1
  16. package/internal/tslib.js +17 -17
  17. package/internal/utils/values.js +3 -3
  18. package/internal/utils/values.js.map +1 -1
  19. package/internal/utils/values.mjs +3 -3
  20. package/internal/utils/values.mjs.map +1 -1
  21. package/package.json +3 -3
  22. package/resources/brands.d.mts +31 -0
  23. package/resources/brands.d.mts.map +1 -0
  24. package/resources/brands.d.ts +31 -0
  25. package/resources/brands.d.ts.map +1 -0
  26. package/resources/{api/v1/brands.js → brands.js} +5 -5
  27. package/resources/brands.js.map +1 -0
  28. package/resources/brands.mjs +15 -0
  29. package/resources/brands.mjs.map +1 -0
  30. package/resources/checkout-intents.d.mts +320 -0
  31. package/resources/checkout-intents.d.mts.map +1 -0
  32. package/resources/checkout-intents.d.ts +320 -0
  33. package/resources/checkout-intents.d.ts.map +1 -0
  34. package/resources/checkout-intents.js +248 -0
  35. package/resources/checkout-intents.js.map +1 -0
  36. package/resources/checkout-intents.mjs +244 -0
  37. package/resources/checkout-intents.mjs.map +1 -0
  38. package/resources/index.d.mts +2 -2
  39. package/resources/index.d.mts.map +1 -1
  40. package/resources/index.d.ts +2 -2
  41. package/resources/index.d.ts.map +1 -1
  42. package/resources/index.js +5 -5
  43. package/resources/index.js.map +1 -1
  44. package/resources/index.mjs +2 -2
  45. package/resources/index.mjs.map +1 -1
  46. package/src/client.ts +84 -14
  47. package/src/internal/to-file.ts +1 -1
  48. package/src/internal/utils/values.ts +3 -3
  49. package/src/resources/{api/v1/brands.ts → brands.ts} +9 -9
  50. package/src/resources/checkout-intents.ts +531 -0
  51. package/src/resources/index.ts +14 -2
  52. package/src/version.ts +1 -1
  53. package/version.d.mts +1 -1
  54. package/version.d.ts +1 -1
  55. package/version.js +1 -1
  56. package/version.mjs +1 -1
  57. package/resources/api/api.d.mts +0 -10
  58. package/resources/api/api.d.mts.map +0 -1
  59. package/resources/api/api.d.ts +0 -10
  60. package/resources/api/api.d.ts.map +0 -1
  61. package/resources/api/api.js +0 -17
  62. package/resources/api/api.js.map +0 -1
  63. package/resources/api/api.mjs +0 -12
  64. package/resources/api/api.mjs.map +0 -1
  65. package/resources/api/index.d.mts +0 -3
  66. package/resources/api/index.d.mts.map +0 -1
  67. package/resources/api/index.d.ts +0 -3
  68. package/resources/api/index.d.ts.map +0 -1
  69. package/resources/api/index.js +0 -9
  70. package/resources/api/index.js.map +0 -1
  71. package/resources/api/index.mjs +0 -4
  72. package/resources/api/index.mjs.map +0 -1
  73. package/resources/api/v1/brands.d.mts +0 -31
  74. package/resources/api/v1/brands.d.mts.map +0 -1
  75. package/resources/api/v1/brands.d.ts +0 -31
  76. package/resources/api/v1/brands.d.ts.map +0 -1
  77. package/resources/api/v1/brands.js.map +0 -1
  78. package/resources/api/v1/brands.mjs +0 -15
  79. package/resources/api/v1/brands.mjs.map +0 -1
  80. package/resources/api/v1/checkout-intents.d.mts +0 -117
  81. package/resources/api/v1/checkout-intents.d.mts.map +0 -1
  82. package/resources/api/v1/checkout-intents.d.ts +0 -117
  83. package/resources/api/v1/checkout-intents.d.ts.map +0 -1
  84. package/resources/api/v1/checkout-intents.js +0 -33
  85. package/resources/api/v1/checkout-intents.js.map +0 -1
  86. package/resources/api/v1/checkout-intents.mjs +0 -29
  87. package/resources/api/v1/checkout-intents.mjs.map +0 -1
  88. package/resources/api/v1/index.d.mts +0 -4
  89. package/resources/api/v1/index.d.mts.map +0 -1
  90. package/resources/api/v1/index.d.ts +0 -4
  91. package/resources/api/v1/index.d.ts.map +0 -1
  92. package/resources/api/v1/index.js +0 -11
  93. package/resources/api/v1/index.js.map +0 -1
  94. package/resources/api/v1/index.mjs +0 -5
  95. package/resources/api/v1/index.mjs.map +0 -1
  96. package/resources/api/v1/v1.d.mts +0 -14
  97. package/resources/api/v1/v1.d.mts.map +0 -1
  98. package/resources/api/v1/v1.d.ts +0 -14
  99. package/resources/api/v1/v1.d.ts.map +0 -1
  100. package/resources/api/v1/v1.js +0 -21
  101. package/resources/api/v1/v1.js.map +0 -1
  102. package/resources/api/v1/v1.mjs +0 -16
  103. package/resources/api/v1/v1.mjs.map +0 -1
  104. package/resources/api/v1.d.mts +0 -2
  105. package/resources/api/v1.d.mts.map +0 -1
  106. package/resources/api/v1.d.ts +0 -2
  107. package/resources/api/v1.d.ts.map +0 -1
  108. package/resources/api/v1.js +0 -6
  109. package/resources/api/v1.js.map +0 -1
  110. package/resources/api/v1.mjs +0 -3
  111. package/resources/api/v1.mjs.map +0 -1
  112. package/resources/api.d.mts +0 -2
  113. package/resources/api.d.mts.map +0 -1
  114. package/resources/api.d.ts +0 -2
  115. package/resources/api.d.ts.map +0 -1
  116. package/resources/api.js +0 -6
  117. package/resources/api.js.map +0 -1
  118. package/resources/api.mjs +0 -3
  119. package/resources/api.mjs.map +0 -1
  120. package/resources/health.d.mts +0 -17
  121. package/resources/health.d.mts.map +0 -1
  122. package/resources/health.d.ts +0 -17
  123. package/resources/health.d.ts.map +0 -1
  124. package/resources/health.js +0 -15
  125. package/resources/health.js.map +0 -1
  126. package/resources/health.mjs +0 -11
  127. package/resources/health.mjs.map +0 -1
  128. package/src/resources/api/api.ts +0 -15
  129. package/src/resources/api/index.ts +0 -4
  130. package/src/resources/api/v1/checkout-intents.ts +0 -207
  131. package/src/resources/api/v1/index.ts +0 -15
  132. package/src/resources/api/v1/v1.ts +0 -41
  133. package/src/resources/api/v1.ts +0 -3
  134. package/src/resources/api.ts +0 -3
  135. package/src/resources/health.ts +0 -24
@@ -0,0 +1,531 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import * as CheckoutIntentsAPI from './checkout-intents';
5
+ import { APIPromise } from '../core/api-promise';
6
+ import { RequestOptions } from '../internal/request-options';
7
+ import { path } from '../internal/utils/path';
8
+ import { sleep } from '../internal/utils/sleep';
9
+ import { buildHeaders } from '../internal/headers';
10
+
11
+ /**
12
+ * Options for polling operations.
13
+ */
14
+ export interface PollOptions {
15
+ /**
16
+ * The interval in milliseconds between polling attempts.
17
+ */
18
+ pollIntervalMs?: number;
19
+
20
+ /**
21
+ * The maximum number of polling attempts before timing out.
22
+ */
23
+ maxAttempts?: number;
24
+ }
25
+
26
+ export class CheckoutIntentsResource extends APIResource {
27
+ /**
28
+ * Create a checkout intent with the given request body.
29
+ *
30
+ * @example
31
+ * ```ts
32
+ * const checkoutIntent = await client.checkoutIntents.create({
33
+ * buyer: {
34
+ * address1: '123 Main St',
35
+ * city: 'New York',
36
+ * country: 'United States',
37
+ * email: 'john.doe@example.com',
38
+ * firstName: 'John',
39
+ * lastName: 'Doe',
40
+ * phone: '+1234567890',
41
+ * postalCode: '10001',
42
+ * province: 'NY',
43
+ * },
44
+ * productUrl: 'productUrl',
45
+ * quantity: 1,
46
+ * });
47
+ * ```
48
+ */
49
+ create(body: CheckoutIntentCreateParams, options?: RequestOptions): APIPromise<CheckoutIntent> {
50
+ return this._client.post('/api/v1/checkout-intents', { body, ...options });
51
+ }
52
+
53
+ /**
54
+ * Retrieve a checkout intent by id
55
+ *
56
+ * Returns checkout intent information if the lookup succeeds.
57
+ *
58
+ * @example
59
+ * ```ts
60
+ * const checkoutIntent =
61
+ * await client.checkoutIntents.retrieve('id');
62
+ * ```
63
+ */
64
+ retrieve(id: string, options?: RequestOptions): APIPromise<CheckoutIntent> {
65
+ return this._client.get(path`/api/v1/checkout-intents/${id}`, options);
66
+ }
67
+
68
+ /**
69
+ * Add payment details to a checkout intent
70
+ *
71
+ * @example
72
+ * ```ts
73
+ * const checkoutIntent =
74
+ * await client.checkoutIntents.addPayment('id', {
75
+ * paymentMethod: {
76
+ * stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
77
+ * type: 'stripe_token',
78
+ * },
79
+ * });
80
+ * ```
81
+ */
82
+ addPayment(
83
+ id: string,
84
+ body: CheckoutIntentAddPaymentParams,
85
+ options?: RequestOptions,
86
+ ): APIPromise<CheckoutIntent> {
87
+ return this._client.post(path`/api/v1/checkout-intents/${id}/payment`, { body, ...options });
88
+ }
89
+
90
+ /**
91
+ * Confirm a checkout intent with provided payment information
92
+ *
93
+ * Confirm means we have buyer's name, address and payment info, so we can move
94
+ * forward to place the order.
95
+ *
96
+ * @example
97
+ * ```ts
98
+ * const checkoutIntent = await client.checkoutIntents.confirm(
99
+ * 'id',
100
+ * {
101
+ * paymentMethod: {
102
+ * stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
103
+ * type: 'stripe_token',
104
+ * },
105
+ * },
106
+ * );
107
+ * ```
108
+ */
109
+ confirm(
110
+ id: string,
111
+ body: CheckoutIntentConfirmParams,
112
+ options?: RequestOptions,
113
+ ): APIPromise<CheckoutIntent> {
114
+ return this._client.post(path`/api/v1/checkout-intents/${id}/confirm`, { body, ...options });
115
+ }
116
+
117
+ /**
118
+ * A helper to poll a checkout intent until a specific condition is met.
119
+ *
120
+ * @example
121
+ * ```ts
122
+ * // Poll until completed or failed
123
+ * const checkoutIntent = await client.checkoutIntents.pollUntil(
124
+ * 'id',
125
+ * (intent) => intent.state === 'completed' || intent.state === 'failed'
126
+ * );
127
+ * ```
128
+ */
129
+ private async pollUntil<T extends CheckoutIntent = CheckoutIntent>(
130
+ id: string,
131
+ condition: (intent: CheckoutIntent) => intent is T,
132
+ options?: RequestOptions & PollOptions,
133
+ ): Promise<T> {
134
+ const maxAttempts = options?.maxAttempts ?? 120; // Default: 120 attempts
135
+ const pollIntervalMs = options?.pollIntervalMs ?? 5000; // Default: 5 seconds
136
+ let attempts = 0;
137
+
138
+ const headers = buildHeaders([
139
+ options?.headers,
140
+ {
141
+ 'X-Stainless-Poll-Helper': 'true',
142
+ 'X-Stainless-Custom-Poll-Interval': pollIntervalMs.toString(),
143
+ },
144
+ ]);
145
+
146
+ while (attempts < maxAttempts) {
147
+ const { data: intent, response } = await this.retrieve(id, {
148
+ ...options,
149
+ headers: { ...options?.headers, ...headers.values },
150
+ }).withResponse();
151
+
152
+ // Check if condition is met
153
+ if (condition(intent)) {
154
+ return intent;
155
+ }
156
+
157
+ attempts++;
158
+
159
+ // If we've reached max attempts, throw an error
160
+ if (attempts >= maxAttempts) {
161
+ throw new Error(
162
+ `Polling timeout: condition not met after ${maxAttempts} attempts (${
163
+ (maxAttempts * pollIntervalMs) / 1000
164
+ }s)`,
165
+ );
166
+ }
167
+
168
+ // Check if server suggests a polling interval
169
+ let sleepInterval = pollIntervalMs;
170
+ const headerInterval = response.headers.get('retry-after-ms');
171
+ if (headerInterval) {
172
+ const headerIntervalMs = parseInt(headerInterval);
173
+ if (!isNaN(headerIntervalMs)) {
174
+ sleepInterval = headerIntervalMs;
175
+ }
176
+ }
177
+
178
+ await sleep(sleepInterval);
179
+ }
180
+
181
+ // This should never be reached due to the throw above, but TypeScript needs it
182
+ throw new Error(`Polling timeout: condition not met after ${maxAttempts} attempts`);
183
+ }
184
+
185
+ /**
186
+ * A helper to poll a checkout intent until it reaches a completed state
187
+ * (completed or failed).
188
+ *
189
+ * @example
190
+ * ```ts
191
+ * const checkoutIntent = await client.checkoutIntents.pollUntilCompleted('id');
192
+ * if (checkoutIntent.state === 'completed') {
193
+ * console.log('Order placed successfully!');
194
+ * } else if (checkoutIntent.state === 'failed') {
195
+ * console.log('Order failed:', checkoutIntent.failureReason);
196
+ * }
197
+ * ```
198
+ */
199
+ async pollUntilCompleted(
200
+ id: string,
201
+ options?: RequestOptions & PollOptions,
202
+ ): Promise<CheckoutIntent.CompletedCheckoutIntent | CheckoutIntent.FailedCheckoutIntent> {
203
+ return this.pollUntil(
204
+ id,
205
+ (intent): intent is CheckoutIntent.CompletedCheckoutIntent | CheckoutIntent.FailedCheckoutIntent =>
206
+ intent.state === 'completed' || intent.state === 'failed',
207
+ options,
208
+ );
209
+ }
210
+
211
+ /**
212
+ * A helper to poll a checkout intent until it's ready for confirmation
213
+ * (awaiting_confirmation state) or has failed. This is typically used after
214
+ * creating a checkout intent to wait for the offer to be retrieved from the merchant.
215
+ *
216
+ * The intent can reach awaiting_confirmation (success - ready to confirm) or failed
217
+ * (offer retrieval failed). Always check the state after polling.
218
+ *
219
+ * @example
220
+ * ```ts
221
+ * const intent = await client.checkoutIntents.pollUntilAwaitingConfirmation('id');
222
+ *
223
+ * if (intent.state === 'awaiting_confirmation') {
224
+ * // Review the offer before confirming
225
+ * console.log('Total:', intent.offer.cost.total);
226
+ * } else if (intent.state === 'failed') {
227
+ * // Handle failure (e.g., offer retrieval failed, product out of stock)
228
+ * console.log('Failed:', intent.failureReason);
229
+ * }
230
+ * ```
231
+ */
232
+ async pollUntilAwaitingConfirmation(
233
+ id: string,
234
+ options?: RequestOptions & PollOptions,
235
+ ): Promise<CheckoutIntent.AwaitingConfirmationCheckoutIntent | CheckoutIntent.FailedCheckoutIntent> {
236
+ return this.pollUntil(
237
+ id,
238
+ (
239
+ intent,
240
+ ): intent is CheckoutIntent.AwaitingConfirmationCheckoutIntent | CheckoutIntent.FailedCheckoutIntent =>
241
+ intent.state === 'awaiting_confirmation' || intent.state === 'failed',
242
+ options,
243
+ );
244
+ }
245
+
246
+ /**
247
+ * A helper to create a checkout intent and poll until it's ready for confirmation.
248
+ * This follows the Rye documented flow: create → poll until awaiting_confirmation.
249
+ *
250
+ * After this method completes, you should review the offer (pricing, shipping, taxes)
251
+ * with the user before calling confirm().
252
+ *
253
+ * @example
254
+ * ```ts
255
+ * // Phase 1: Create and wait for offer
256
+ * const intent = await client.checkoutIntents.createAndPoll({
257
+ * buyer: {
258
+ * address1: '123 Main St',
259
+ * city: 'New York',
260
+ * country: 'United States',
261
+ * email: 'john.doe@example.com',
262
+ * firstName: 'John',
263
+ * lastName: 'Doe',
264
+ * phone: '+1234567890',
265
+ * postalCode: '10001',
266
+ * province: 'NY',
267
+ * },
268
+ * productUrl: 'https://example.com/product',
269
+ * quantity: 1,
270
+ * });
271
+ *
272
+ * // Review the offer with the user
273
+ * console.log('Total:', intent.offer.cost.total);
274
+ *
275
+ * // Phase 2: Confirm with payment
276
+ * const completed = await client.checkoutIntents.confirmAndPoll(intent.id, {
277
+ * paymentMethod: { type: 'stripe_token', stripeToken: 'tok_visa' }
278
+ * });
279
+ * ```
280
+ */
281
+ async createAndPoll(
282
+ body: CheckoutIntentCreateParams,
283
+ options?: RequestOptions & PollOptions,
284
+ ): Promise<CheckoutIntent.AwaitingConfirmationCheckoutIntent | CheckoutIntent.FailedCheckoutIntent> {
285
+ const intent = await this.create(body, options);
286
+ return this.pollUntilAwaitingConfirmation(intent.id, options);
287
+ }
288
+
289
+ /**
290
+ * A helper to confirm a checkout intent and poll until it reaches a completed state
291
+ * (completed or failed).
292
+ *
293
+ * @example
294
+ * ```ts
295
+ * const checkoutIntent = await client.checkoutIntents.confirmAndPoll(
296
+ * 'id',
297
+ * {
298
+ * paymentMethod: {
299
+ * stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
300
+ * type: 'stripe_token',
301
+ * },
302
+ * }
303
+ * );
304
+ *
305
+ * if (checkoutIntent.state === 'completed') {
306
+ * console.log('Order placed successfully!');
307
+ * } else if (checkoutIntent.state === 'failed') {
308
+ * console.log('Order failed:', checkoutIntent.failureReason);
309
+ * }
310
+ * ```
311
+ */
312
+ async confirmAndPoll(
313
+ id: string,
314
+ body: CheckoutIntentConfirmParams,
315
+ options?: RequestOptions & PollOptions,
316
+ ): Promise<CheckoutIntent.CompletedCheckoutIntent | CheckoutIntent.FailedCheckoutIntent> {
317
+ const intent = await this.confirm(id, body, options);
318
+ return this.pollUntilCompleted(intent.id, options);
319
+ }
320
+ }
321
+
322
+ export interface BaseCheckoutIntent {
323
+ id: string;
324
+
325
+ buyer: Buyer;
326
+
327
+ createdAt: string;
328
+
329
+ productUrl: string;
330
+
331
+ quantity: number;
332
+
333
+ variantSelections?: Array<VariantSelection>;
334
+ }
335
+
336
+ export interface Buyer {
337
+ address1: string;
338
+
339
+ city: string;
340
+
341
+ country: string;
342
+
343
+ email: string;
344
+
345
+ firstName: string;
346
+
347
+ lastName: string;
348
+
349
+ phone: string;
350
+
351
+ postalCode: string;
352
+
353
+ province: string;
354
+
355
+ address2?: string;
356
+ }
357
+
358
+ export type CheckoutIntent =
359
+ | CheckoutIntent.RetrievingOfferCheckoutIntent
360
+ | CheckoutIntent.AwaitingConfirmationCheckoutIntent
361
+ | CheckoutIntent.PlacingOrderCheckoutIntent
362
+ | CheckoutIntent.CompletedCheckoutIntent
363
+ | CheckoutIntent.FailedCheckoutIntent;
364
+
365
+ export namespace CheckoutIntent {
366
+ export interface RetrievingOfferCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
367
+ state: 'retrieving_offer';
368
+ }
369
+
370
+ export interface AwaitingConfirmationCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
371
+ offer: CheckoutIntentsAPI.Offer;
372
+
373
+ state: 'awaiting_confirmation';
374
+
375
+ paymentMethod?: CheckoutIntentsAPI.PaymentMethod;
376
+ }
377
+
378
+ export interface PlacingOrderCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
379
+ offer: CheckoutIntentsAPI.Offer;
380
+
381
+ paymentMethod: CheckoutIntentsAPI.PaymentMethod;
382
+
383
+ state: 'placing_order';
384
+ }
385
+
386
+ export interface CompletedCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
387
+ offer: CheckoutIntentsAPI.Offer;
388
+
389
+ paymentMethod: CheckoutIntentsAPI.PaymentMethod;
390
+
391
+ state: 'completed';
392
+ }
393
+
394
+ export interface FailedCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
395
+ failureReason: FailedCheckoutIntent.FailureReason;
396
+
397
+ state: 'failed';
398
+
399
+ offer?: CheckoutIntentsAPI.Offer;
400
+
401
+ paymentMethod?: CheckoutIntentsAPI.PaymentMethod;
402
+ }
403
+
404
+ export namespace FailedCheckoutIntent {
405
+ export interface FailureReason {
406
+ code:
407
+ | 'checkout_intent_expired'
408
+ | 'payment_failed'
409
+ | 'insufficient_stock'
410
+ | 'product_out_of_stock'
411
+ | 'offer_retrieval_failed'
412
+ | 'order_placement_failed'
413
+ | 'developer_not_found'
414
+ | 'missing_shipping_method'
415
+ | 'unsupported_currency'
416
+ | 'unsupported_store_no_guest_checkout';
417
+
418
+ message: string;
419
+ }
420
+ }
421
+ }
422
+
423
+ export interface Money {
424
+ amountSubunits: number;
425
+
426
+ currencyCode: string;
427
+ }
428
+
429
+ export interface Offer {
430
+ cost: Offer.Cost;
431
+
432
+ shipping: Offer.Shipping;
433
+ }
434
+
435
+ export namespace Offer {
436
+ export interface Cost {
437
+ subtotal: CheckoutIntentsAPI.Money;
438
+
439
+ total: CheckoutIntentsAPI.Money;
440
+
441
+ discount?: CheckoutIntentsAPI.Money;
442
+
443
+ shipping?: CheckoutIntentsAPI.Money;
444
+
445
+ tax?: CheckoutIntentsAPI.Money;
446
+ }
447
+
448
+ export interface Shipping {
449
+ availableOptions: Array<Shipping.AvailableOption>;
450
+
451
+ selectedOptionId?: string;
452
+ }
453
+
454
+ export namespace Shipping {
455
+ export interface AvailableOption {
456
+ id: string;
457
+
458
+ cost: CheckoutIntentsAPI.Money;
459
+ }
460
+ }
461
+ }
462
+
463
+ export type PaymentMethod =
464
+ | PaymentMethod.StripeTokenPaymentMethod
465
+ | PaymentMethod.BasisTheoryPaymentMethod
466
+ | PaymentMethod.NekudaPaymentMethod;
467
+
468
+ export namespace PaymentMethod {
469
+ export interface StripeTokenPaymentMethod {
470
+ stripeToken: string;
471
+
472
+ type: 'stripe_token';
473
+ }
474
+
475
+ export interface BasisTheoryPaymentMethod {
476
+ basisTheoryToken: string;
477
+
478
+ type: 'basis_theory_token';
479
+ }
480
+
481
+ export interface NekudaPaymentMethod {
482
+ nekudaUserId: string;
483
+
484
+ type: 'nekuda_token';
485
+
486
+ /**
487
+ * Construct a type with a set of properties K of type T
488
+ */
489
+ nekudaMandateData?: { [key: string]: string | number };
490
+ }
491
+ }
492
+
493
+ export interface VariantSelection {
494
+ label: string;
495
+
496
+ value: string | number;
497
+ }
498
+
499
+ export interface CheckoutIntentCreateParams {
500
+ buyer: Buyer;
501
+
502
+ productUrl: string;
503
+
504
+ quantity: number;
505
+
506
+ variantSelections?: Array<VariantSelection>;
507
+ }
508
+
509
+ export interface CheckoutIntentAddPaymentParams {
510
+ paymentMethod: PaymentMethod;
511
+ }
512
+
513
+ export interface CheckoutIntentConfirmParams {
514
+ paymentMethod: PaymentMethod;
515
+ }
516
+
517
+ export declare namespace CheckoutIntentsResource {
518
+ export {
519
+ type BaseCheckoutIntent as BaseCheckoutIntent,
520
+ type Buyer as Buyer,
521
+ type CheckoutIntent as CheckoutIntent,
522
+ type Money as Money,
523
+ type Offer as Offer,
524
+ type PaymentMethod as PaymentMethod,
525
+ type PollOptions as PollOptions,
526
+ type VariantSelection as VariantSelection,
527
+ type CheckoutIntentCreateParams as CheckoutIntentCreateParams,
528
+ type CheckoutIntentAddPaymentParams as CheckoutIntentAddPaymentParams,
529
+ type CheckoutIntentConfirmParams as CheckoutIntentConfirmParams,
530
+ };
531
+ }
@@ -1,4 +1,16 @@
1
1
  // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
2
 
3
- export { API } from './api/api';
4
- export { Health, type HealthCheckResponse } from './health';
3
+ export { Brands, type BrandRetrieveResponse } from './brands';
4
+ export {
5
+ CheckoutIntentsResource,
6
+ type BaseCheckoutIntent,
7
+ type Buyer,
8
+ type CheckoutIntent,
9
+ type Money,
10
+ type Offer,
11
+ type PaymentMethod,
12
+ type VariantSelection,
13
+ type CheckoutIntentCreateParams,
14
+ type CheckoutIntentAddPaymentParams,
15
+ type CheckoutIntentConfirmParams,
16
+ } from './checkout-intents';
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '0.1.0'; // x-release-please-version
1
+ export const VERSION = '0.3.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0";
1
+ export declare const VERSION = "0.3.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "0.1.0";
1
+ export declare const VERSION = "0.3.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '0.1.0'; // x-release-please-version
4
+ exports.VERSION = '0.3.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '0.1.0'; // x-release-please-version
1
+ export const VERSION = '0.3.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map
@@ -1,10 +0,0 @@
1
- import { APIResource } from "../../core/resource.mjs";
2
- import * as V1API from "./v1/v1.mjs";
3
- import { V1 } from "./v1/v1.mjs";
4
- export declare class API extends APIResource {
5
- v1: V1API.V1;
6
- }
7
- export declare namespace API {
8
- export { V1 as V1 };
9
- }
10
- //# sourceMappingURL=api.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.mts","sourceRoot":"","sources":["../../src/resources/api/api.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,KAAK;OACV,EAAE,EAAE,EAAE;AAEb,qBAAa,GAAI,SAAQ,WAAW;IAClC,EAAE,EAAE,KAAK,CAAC,EAAE,CAA8B;CAC3C;AAID,MAAM,CAAC,OAAO,WAAW,GAAG,CAAC;IAC3B,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;CACrB"}
@@ -1,10 +0,0 @@
1
- import { APIResource } from "../../core/resource.js";
2
- import * as V1API from "./v1/v1.js";
3
- import { V1 } from "./v1/v1.js";
4
- export declare class API extends APIResource {
5
- v1: V1API.V1;
6
- }
7
- export declare namespace API {
8
- export { V1 as V1 };
9
- }
10
- //# sourceMappingURL=api.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../src/resources/api/api.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,KAAK;OACV,EAAE,EAAE,EAAE;AAEb,qBAAa,GAAI,SAAQ,WAAW;IAClC,EAAE,EAAE,KAAK,CAAC,EAAE,CAA8B;CAC3C;AAID,MAAM,CAAC,OAAO,WAAW,GAAG,CAAC;IAC3B,OAAO,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;CACrB"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.API = void 0;
5
- const tslib_1 = require("../../internal/tslib.js");
6
- const resource_1 = require("../../core/resource.js");
7
- const V1API = tslib_1.__importStar(require("./v1/v1.js"));
8
- const v1_1 = require("./v1/v1.js");
9
- class API extends resource_1.APIResource {
10
- constructor() {
11
- super(...arguments);
12
- this.v1 = new V1API.V1(this._client);
13
- }
14
- }
15
- exports.API = API;
16
- API.V1 = v1_1.V1;
17
- //# sourceMappingURL=api.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/resources/api/api.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,qDAAkD;AAClD,0DAAiC;AACjC,mCAA6B;AAE7B,MAAa,GAAI,SAAQ,sBAAW;IAApC;;QACE,OAAE,GAAa,IAAI,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;CAAA;AAFD,kBAEC;AAED,GAAG,CAAC,EAAE,GAAG,OAAE,CAAC"}
@@ -1,12 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../../core/resource.mjs";
3
- import * as V1API from "./v1/v1.mjs";
4
- import { V1 } from "./v1/v1.mjs";
5
- export class API extends APIResource {
6
- constructor() {
7
- super(...arguments);
8
- this.v1 = new V1API.V1(this._client);
9
- }
10
- }
11
- API.V1 = V1;
12
- //# sourceMappingURL=api.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.mjs","sourceRoot":"","sources":["../../src/resources/api/api.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,KAAK;OACV,EAAE,EAAE,EAAE;AAEb,MAAM,OAAO,GAAI,SAAQ,WAAW;IAApC;;QACE,OAAE,GAAa,IAAI,KAAK,CAAC,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC5C,CAAC;CAAA;AAED,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC"}
@@ -1,3 +0,0 @@
1
- export { API } from "./api.mjs";
2
- export { V1 } from "./v1/index.mjs";
3
- //# sourceMappingURL=index.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../src/resources/api/index.ts"],"names":[],"mappings":"OAEO,EAAE,GAAG,EAAE;OACP,EAAE,EAAE,EAAE"}
@@ -1,3 +0,0 @@
1
- export { API } from "./api.js";
2
- export { V1 } from "./v1/index.js";
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/resources/api/index.ts"],"names":[],"mappings":"OAEO,EAAE,GAAG,EAAE;OACP,EAAE,EAAE,EAAE"}
@@ -1,9 +0,0 @@
1
- "use strict";
2
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.V1 = exports.API = void 0;
5
- var api_1 = require("./api.js");
6
- Object.defineProperty(exports, "API", { enumerable: true, get: function () { return api_1.API; } });
7
- var index_1 = require("./v1/index.js");
8
- Object.defineProperty(exports, "V1", { enumerable: true, get: function () { return index_1.V1; } });
9
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/resources/api/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,gCAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,uCAAgC;AAAvB,2FAAA,EAAE,OAAA"}
@@ -1,4 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- export { API } from "./api.mjs";
3
- export { V1 } from "./v1/index.mjs";
4
- //# sourceMappingURL=index.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../src/resources/api/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,GAAG,EAAE;OACP,EAAE,EAAE,EAAE"}