checkout-intents 0.1.0 → 0.2.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 +35 -0
- package/LICENSE +4 -198
- package/README.md +103 -22
- package/client.d.mts +21 -7
- package/client.d.mts.map +1 -1
- package/client.d.ts +21 -7
- package/client.d.ts.map +1 -1
- package/client.js +20 -10
- package/client.js.map +1 -1
- package/client.mjs +20 -10
- package/client.mjs.map +1 -1
- package/internal/to-file.d.mts +1 -1
- package/internal/to-file.d.ts +1 -1
- package/internal/to-file.js +1 -1
- package/internal/to-file.mjs +1 -1
- package/internal/tslib.js +17 -17
- package/internal/utils/values.js +3 -3
- package/internal/utils/values.js.map +1 -1
- package/internal/utils/values.mjs +3 -3
- package/internal/utils/values.mjs.map +1 -1
- package/package.json +3 -3
- package/resources/brands.d.mts +31 -0
- package/resources/brands.d.mts.map +1 -0
- package/resources/brands.d.ts +31 -0
- package/resources/brands.d.ts.map +1 -0
- package/resources/{api/v1/brands.js → brands.js} +5 -5
- package/resources/brands.js.map +1 -0
- package/resources/brands.mjs +15 -0
- package/resources/brands.mjs.map +1 -0
- package/resources/{api/v1/checkout-intents.d.mts → checkout-intents.d.mts} +93 -13
- package/resources/checkout-intents.d.mts.map +1 -0
- package/resources/{api/v1/checkout-intents.d.ts → checkout-intents.d.ts} +93 -13
- package/resources/checkout-intents.d.ts.map +1 -0
- package/resources/checkout-intents.js +88 -0
- package/resources/checkout-intents.js.map +1 -0
- package/resources/checkout-intents.mjs +84 -0
- package/resources/checkout-intents.mjs.map +1 -0
- package/resources/index.d.mts +2 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +5 -5
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +2 -2
- package/resources/index.mjs.map +1 -1
- package/src/client.ts +62 -14
- package/src/internal/to-file.ts +1 -1
- package/src/internal/utils/values.ts +3 -3
- package/src/resources/{api/v1/brands.ts → brands.ts} +9 -9
- package/src/resources/{api/v1/checkout-intents.ts → checkout-intents.ts} +116 -14
- package/src/resources/index.ts +14 -2
- 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/resources/api/api.d.mts +0 -10
- package/resources/api/api.d.mts.map +0 -1
- package/resources/api/api.d.ts +0 -10
- package/resources/api/api.d.ts.map +0 -1
- package/resources/api/api.js +0 -17
- package/resources/api/api.js.map +0 -1
- package/resources/api/api.mjs +0 -12
- package/resources/api/api.mjs.map +0 -1
- package/resources/api/index.d.mts +0 -3
- package/resources/api/index.d.mts.map +0 -1
- package/resources/api/index.d.ts +0 -3
- package/resources/api/index.d.ts.map +0 -1
- package/resources/api/index.js +0 -9
- package/resources/api/index.js.map +0 -1
- package/resources/api/index.mjs +0 -4
- package/resources/api/index.mjs.map +0 -1
- package/resources/api/v1/brands.d.mts +0 -31
- package/resources/api/v1/brands.d.mts.map +0 -1
- package/resources/api/v1/brands.d.ts +0 -31
- package/resources/api/v1/brands.d.ts.map +0 -1
- package/resources/api/v1/brands.js.map +0 -1
- package/resources/api/v1/brands.mjs +0 -15
- package/resources/api/v1/brands.mjs.map +0 -1
- package/resources/api/v1/checkout-intents.d.mts.map +0 -1
- package/resources/api/v1/checkout-intents.d.ts.map +0 -1
- package/resources/api/v1/checkout-intents.js +0 -33
- package/resources/api/v1/checkout-intents.js.map +0 -1
- package/resources/api/v1/checkout-intents.mjs +0 -29
- package/resources/api/v1/checkout-intents.mjs.map +0 -1
- package/resources/api/v1/index.d.mts +0 -4
- package/resources/api/v1/index.d.mts.map +0 -1
- package/resources/api/v1/index.d.ts +0 -4
- package/resources/api/v1/index.d.ts.map +0 -1
- package/resources/api/v1/index.js +0 -11
- package/resources/api/v1/index.js.map +0 -1
- package/resources/api/v1/index.mjs +0 -5
- package/resources/api/v1/index.mjs.map +0 -1
- package/resources/api/v1/v1.d.mts +0 -14
- package/resources/api/v1/v1.d.mts.map +0 -1
- package/resources/api/v1/v1.d.ts +0 -14
- package/resources/api/v1/v1.d.ts.map +0 -1
- package/resources/api/v1/v1.js +0 -21
- package/resources/api/v1/v1.js.map +0 -1
- package/resources/api/v1/v1.mjs +0 -16
- package/resources/api/v1/v1.mjs.map +0 -1
- package/resources/api/v1.d.mts +0 -2
- package/resources/api/v1.d.mts.map +0 -1
- package/resources/api/v1.d.ts +0 -2
- package/resources/api/v1.d.ts.map +0 -1
- package/resources/api/v1.js +0 -6
- package/resources/api/v1.js.map +0 -1
- package/resources/api/v1.mjs +0 -3
- package/resources/api/v1.mjs.map +0 -1
- package/resources/api.d.mts +0 -2
- package/resources/api.d.mts.map +0 -1
- package/resources/api.d.ts +0 -2
- package/resources/api.d.ts.map +0 -1
- package/resources/api.js +0 -6
- package/resources/api.js.map +0 -1
- package/resources/api.mjs +0 -3
- package/resources/api.mjs.map +0 -1
- package/resources/health.d.mts +0 -17
- package/resources/health.d.mts.map +0 -1
- package/resources/health.d.ts +0 -17
- package/resources/health.d.ts.map +0 -1
- package/resources/health.js +0 -15
- package/resources/health.js.map +0 -1
- package/resources/health.mjs +0 -11
- package/resources/health.mjs.map +0 -1
- package/src/resources/api/api.ts +0 -15
- package/src/resources/api/index.ts +0 -4
- package/src/resources/api/v1/index.ts +0 -15
- package/src/resources/api/v1/v1.ts +0 -41
- package/src/resources/api/v1.ts +0 -3
- package/src/resources/api.ts +0 -3
- package/src/resources/health.ts +0 -24
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brands.js","sourceRoot":"","sources":["../src/resources/brands.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAG/C,oDAA8C;AAE9C,MAAa,MAAO,SAAQ,sBAAW;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,MAAc,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,yBAAyB,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;CACF;AAVD,wBAUC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { path } from "../internal/utils/path.mjs";
|
|
4
|
+
export class Brands extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Retrieve brand information by domain name
|
|
7
|
+
*
|
|
8
|
+
* Look up a brand by its domain name (e.g. "aloyoga.com" or "www.amazon.com").
|
|
9
|
+
* Returns brand information including the marketplace type if the lookup succeeds.
|
|
10
|
+
*/
|
|
11
|
+
retrieve(domain, options) {
|
|
12
|
+
return this._client.get(path `/api/v1/brands/domain/${domain}`, options);
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=brands.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"brands.mjs","sourceRoot":"","sources":["../src/resources/brands.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAGf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;;;;OAKG;IACH,QAAQ,CAAC,MAAc,EAAE,OAAwB;QAC/C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,yBAAyB,MAAM,EAAE,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;CACF"}
|
|
@@ -1,23 +1,76 @@
|
|
|
1
|
-
import { APIResource } from "
|
|
1
|
+
import { APIResource } from "../core/resource.mjs";
|
|
2
2
|
import * as CheckoutIntentsAPI from "./checkout-intents.mjs";
|
|
3
|
-
import { APIPromise } from "
|
|
4
|
-
import { RequestOptions } from "
|
|
5
|
-
export declare class
|
|
3
|
+
import { APIPromise } from "../core/api-promise.mjs";
|
|
4
|
+
import { RequestOptions } from "../internal/request-options.mjs";
|
|
5
|
+
export declare class CheckoutIntentsResource extends APIResource {
|
|
6
6
|
/**
|
|
7
7
|
* Create a checkout intent with the given request body.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const checkoutIntent = await client.checkoutIntents.create({
|
|
12
|
+
* buyer: {
|
|
13
|
+
* address1: '123 Main St',
|
|
14
|
+
* city: 'New York',
|
|
15
|
+
* country: 'United States',
|
|
16
|
+
* email: 'john.doe@example.com',
|
|
17
|
+
* firstName: 'John',
|
|
18
|
+
* lastName: 'Doe',
|
|
19
|
+
* phone: '+1234567890',
|
|
20
|
+
* postalCode: '10001',
|
|
21
|
+
* province: 'NY',
|
|
22
|
+
* },
|
|
23
|
+
* productUrl: 'productUrl',
|
|
24
|
+
* quantity: 1,
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
8
27
|
*/
|
|
9
28
|
create(body: CheckoutIntentCreateParams, options?: RequestOptions): APIPromise<CheckoutIntent>;
|
|
10
29
|
/**
|
|
11
30
|
* Retrieve a checkout intent by id
|
|
12
31
|
*
|
|
13
32
|
* Returns checkout intent information if the lookup succeeds.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const checkoutIntent =
|
|
37
|
+
* await client.checkoutIntents.retrieve('id');
|
|
38
|
+
* ```
|
|
14
39
|
*/
|
|
15
40
|
retrieve(id: string, options?: RequestOptions): APIPromise<CheckoutIntent>;
|
|
41
|
+
/**
|
|
42
|
+
* Add payment details to a checkout intent
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const checkoutIntent =
|
|
47
|
+
* await client.checkoutIntents.addPayment('id', {
|
|
48
|
+
* paymentMethod: {
|
|
49
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
50
|
+
* type: 'stripe_token',
|
|
51
|
+
* },
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
addPayment(id: string, body: CheckoutIntentAddPaymentParams, options?: RequestOptions): APIPromise<CheckoutIntent>;
|
|
16
56
|
/**
|
|
17
57
|
* Confirm a checkout intent with provided payment information
|
|
18
58
|
*
|
|
19
59
|
* Confirm means we have buyer's name, address and payment info, so we can move
|
|
20
60
|
* forward to place the order.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const checkoutIntent = await client.checkoutIntents.confirm(
|
|
65
|
+
* 'id',
|
|
66
|
+
* {
|
|
67
|
+
* paymentMethod: {
|
|
68
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
69
|
+
* type: 'stripe_token',
|
|
70
|
+
* },
|
|
71
|
+
* },
|
|
72
|
+
* );
|
|
73
|
+
* ```
|
|
21
74
|
*/
|
|
22
75
|
confirm(id: string, body: CheckoutIntentConfirmParams, options?: RequestOptions): APIPromise<CheckoutIntent>;
|
|
23
76
|
}
|
|
@@ -27,6 +80,7 @@ export interface BaseCheckoutIntent {
|
|
|
27
80
|
createdAt: string;
|
|
28
81
|
productUrl: string;
|
|
29
82
|
quantity: number;
|
|
83
|
+
variantSelections?: Array<VariantSelection>;
|
|
30
84
|
}
|
|
31
85
|
export interface Buyer {
|
|
32
86
|
address1: string;
|
|
@@ -48,22 +102,23 @@ export declare namespace CheckoutIntent {
|
|
|
48
102
|
interface AwaitingConfirmationCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
|
|
49
103
|
offer: CheckoutIntentsAPI.Offer;
|
|
50
104
|
state: 'awaiting_confirmation';
|
|
105
|
+
paymentMethod?: CheckoutIntentsAPI.PaymentMethod;
|
|
51
106
|
}
|
|
52
107
|
interface PlacingOrderCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
|
|
53
108
|
offer: CheckoutIntentsAPI.Offer;
|
|
54
|
-
paymentMethod: CheckoutIntentsAPI.
|
|
109
|
+
paymentMethod: CheckoutIntentsAPI.PaymentMethod;
|
|
55
110
|
state: 'placing_order';
|
|
56
111
|
}
|
|
57
112
|
interface CompletedCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
|
|
58
113
|
offer: CheckoutIntentsAPI.Offer;
|
|
59
|
-
paymentMethod: CheckoutIntentsAPI.
|
|
114
|
+
paymentMethod: CheckoutIntentsAPI.PaymentMethod;
|
|
60
115
|
state: 'completed';
|
|
61
116
|
}
|
|
62
117
|
interface FailedCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
|
|
63
118
|
failureReason: FailedCheckoutIntent.FailureReason;
|
|
64
119
|
state: 'failed';
|
|
65
120
|
offer?: CheckoutIntentsAPI.Offer;
|
|
66
|
-
paymentMethod?: CheckoutIntentsAPI.
|
|
121
|
+
paymentMethod?: CheckoutIntentsAPI.PaymentMethod;
|
|
67
122
|
}
|
|
68
123
|
namespace FailedCheckoutIntent {
|
|
69
124
|
interface FailureReason {
|
|
@@ -99,19 +154,44 @@ export declare namespace Offer {
|
|
|
99
154
|
}
|
|
100
155
|
}
|
|
101
156
|
}
|
|
102
|
-
export
|
|
103
|
-
|
|
104
|
-
|
|
157
|
+
export type PaymentMethod = PaymentMethod.StripeTokenPaymentMethod | PaymentMethod.BasisTheoryPaymentMethod | PaymentMethod.NekudaPaymentMethod;
|
|
158
|
+
export declare namespace PaymentMethod {
|
|
159
|
+
interface StripeTokenPaymentMethod {
|
|
160
|
+
stripeToken: string;
|
|
161
|
+
type: 'stripe_token';
|
|
162
|
+
}
|
|
163
|
+
interface BasisTheoryPaymentMethod {
|
|
164
|
+
basisTheoryToken: string;
|
|
165
|
+
type: 'basis_theory_token';
|
|
166
|
+
}
|
|
167
|
+
interface NekudaPaymentMethod {
|
|
168
|
+
nekudaUserId: string;
|
|
169
|
+
type: 'nekuda_token';
|
|
170
|
+
/**
|
|
171
|
+
* Construct a type with a set of properties K of type T
|
|
172
|
+
*/
|
|
173
|
+
nekudaMandateData?: {
|
|
174
|
+
[key: string]: string | number;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
export interface VariantSelection {
|
|
179
|
+
label: string;
|
|
180
|
+
value: string | number;
|
|
105
181
|
}
|
|
106
182
|
export interface CheckoutIntentCreateParams {
|
|
107
183
|
buyer: Buyer;
|
|
108
184
|
productUrl: string;
|
|
109
185
|
quantity: number;
|
|
186
|
+
variantSelections?: Array<VariantSelection>;
|
|
187
|
+
}
|
|
188
|
+
export interface CheckoutIntentAddPaymentParams {
|
|
189
|
+
paymentMethod: PaymentMethod;
|
|
110
190
|
}
|
|
111
191
|
export interface CheckoutIntentConfirmParams {
|
|
112
|
-
paymentMethod:
|
|
192
|
+
paymentMethod: PaymentMethod;
|
|
113
193
|
}
|
|
114
|
-
export declare namespace
|
|
115
|
-
export { type BaseCheckoutIntent as BaseCheckoutIntent, type Buyer as Buyer, type CheckoutIntent as CheckoutIntent, type Money as Money, type Offer as Offer, type
|
|
194
|
+
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, };
|
|
116
196
|
}
|
|
117
197
|
//# sourceMappingURL=checkout-intents.d.mts.map
|
|
@@ -0,0 +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;OACvB,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,uBAAwB,SAAQ,WAAW;IACtD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAA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E,CAAC;KACxD;CACF;AAED,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,MAAM,CAAC;IAEd,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,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,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,2BAA2B,IAAI,2BAA2B,GAChE,CAAC;CACH"}
|
|
@@ -1,23 +1,76 @@
|
|
|
1
|
-
import { APIResource } from "
|
|
1
|
+
import { APIResource } from "../core/resource.js";
|
|
2
2
|
import * as CheckoutIntentsAPI from "./checkout-intents.js";
|
|
3
|
-
import { APIPromise } from "
|
|
4
|
-
import { RequestOptions } from "
|
|
5
|
-
export declare class
|
|
3
|
+
import { APIPromise } from "../core/api-promise.js";
|
|
4
|
+
import { RequestOptions } from "../internal/request-options.js";
|
|
5
|
+
export declare class CheckoutIntentsResource extends APIResource {
|
|
6
6
|
/**
|
|
7
7
|
* Create a checkout intent with the given request body.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```ts
|
|
11
|
+
* const checkoutIntent = await client.checkoutIntents.create({
|
|
12
|
+
* buyer: {
|
|
13
|
+
* address1: '123 Main St',
|
|
14
|
+
* city: 'New York',
|
|
15
|
+
* country: 'United States',
|
|
16
|
+
* email: 'john.doe@example.com',
|
|
17
|
+
* firstName: 'John',
|
|
18
|
+
* lastName: 'Doe',
|
|
19
|
+
* phone: '+1234567890',
|
|
20
|
+
* postalCode: '10001',
|
|
21
|
+
* province: 'NY',
|
|
22
|
+
* },
|
|
23
|
+
* productUrl: 'productUrl',
|
|
24
|
+
* quantity: 1,
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
8
27
|
*/
|
|
9
28
|
create(body: CheckoutIntentCreateParams, options?: RequestOptions): APIPromise<CheckoutIntent>;
|
|
10
29
|
/**
|
|
11
30
|
* Retrieve a checkout intent by id
|
|
12
31
|
*
|
|
13
32
|
* Returns checkout intent information if the lookup succeeds.
|
|
33
|
+
*
|
|
34
|
+
* @example
|
|
35
|
+
* ```ts
|
|
36
|
+
* const checkoutIntent =
|
|
37
|
+
* await client.checkoutIntents.retrieve('id');
|
|
38
|
+
* ```
|
|
14
39
|
*/
|
|
15
40
|
retrieve(id: string, options?: RequestOptions): APIPromise<CheckoutIntent>;
|
|
41
|
+
/**
|
|
42
|
+
* Add payment details to a checkout intent
|
|
43
|
+
*
|
|
44
|
+
* @example
|
|
45
|
+
* ```ts
|
|
46
|
+
* const checkoutIntent =
|
|
47
|
+
* await client.checkoutIntents.addPayment('id', {
|
|
48
|
+
* paymentMethod: {
|
|
49
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
50
|
+
* type: 'stripe_token',
|
|
51
|
+
* },
|
|
52
|
+
* });
|
|
53
|
+
* ```
|
|
54
|
+
*/
|
|
55
|
+
addPayment(id: string, body: CheckoutIntentAddPaymentParams, options?: RequestOptions): APIPromise<CheckoutIntent>;
|
|
16
56
|
/**
|
|
17
57
|
* Confirm a checkout intent with provided payment information
|
|
18
58
|
*
|
|
19
59
|
* Confirm means we have buyer's name, address and payment info, so we can move
|
|
20
60
|
* forward to place the order.
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```ts
|
|
64
|
+
* const checkoutIntent = await client.checkoutIntents.confirm(
|
|
65
|
+
* 'id',
|
|
66
|
+
* {
|
|
67
|
+
* paymentMethod: {
|
|
68
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
69
|
+
* type: 'stripe_token',
|
|
70
|
+
* },
|
|
71
|
+
* },
|
|
72
|
+
* );
|
|
73
|
+
* ```
|
|
21
74
|
*/
|
|
22
75
|
confirm(id: string, body: CheckoutIntentConfirmParams, options?: RequestOptions): APIPromise<CheckoutIntent>;
|
|
23
76
|
}
|
|
@@ -27,6 +80,7 @@ export interface BaseCheckoutIntent {
|
|
|
27
80
|
createdAt: string;
|
|
28
81
|
productUrl: string;
|
|
29
82
|
quantity: number;
|
|
83
|
+
variantSelections?: Array<VariantSelection>;
|
|
30
84
|
}
|
|
31
85
|
export interface Buyer {
|
|
32
86
|
address1: string;
|
|
@@ -48,22 +102,23 @@ export declare namespace CheckoutIntent {
|
|
|
48
102
|
interface AwaitingConfirmationCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
|
|
49
103
|
offer: CheckoutIntentsAPI.Offer;
|
|
50
104
|
state: 'awaiting_confirmation';
|
|
105
|
+
paymentMethod?: CheckoutIntentsAPI.PaymentMethod;
|
|
51
106
|
}
|
|
52
107
|
interface PlacingOrderCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
|
|
53
108
|
offer: CheckoutIntentsAPI.Offer;
|
|
54
|
-
paymentMethod: CheckoutIntentsAPI.
|
|
109
|
+
paymentMethod: CheckoutIntentsAPI.PaymentMethod;
|
|
55
110
|
state: 'placing_order';
|
|
56
111
|
}
|
|
57
112
|
interface CompletedCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
|
|
58
113
|
offer: CheckoutIntentsAPI.Offer;
|
|
59
|
-
paymentMethod: CheckoutIntentsAPI.
|
|
114
|
+
paymentMethod: CheckoutIntentsAPI.PaymentMethod;
|
|
60
115
|
state: 'completed';
|
|
61
116
|
}
|
|
62
117
|
interface FailedCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
|
|
63
118
|
failureReason: FailedCheckoutIntent.FailureReason;
|
|
64
119
|
state: 'failed';
|
|
65
120
|
offer?: CheckoutIntentsAPI.Offer;
|
|
66
|
-
paymentMethod?: CheckoutIntentsAPI.
|
|
121
|
+
paymentMethod?: CheckoutIntentsAPI.PaymentMethod;
|
|
67
122
|
}
|
|
68
123
|
namespace FailedCheckoutIntent {
|
|
69
124
|
interface FailureReason {
|
|
@@ -99,19 +154,44 @@ export declare namespace Offer {
|
|
|
99
154
|
}
|
|
100
155
|
}
|
|
101
156
|
}
|
|
102
|
-
export
|
|
103
|
-
|
|
104
|
-
|
|
157
|
+
export type PaymentMethod = PaymentMethod.StripeTokenPaymentMethod | PaymentMethod.BasisTheoryPaymentMethod | PaymentMethod.NekudaPaymentMethod;
|
|
158
|
+
export declare namespace PaymentMethod {
|
|
159
|
+
interface StripeTokenPaymentMethod {
|
|
160
|
+
stripeToken: string;
|
|
161
|
+
type: 'stripe_token';
|
|
162
|
+
}
|
|
163
|
+
interface BasisTheoryPaymentMethod {
|
|
164
|
+
basisTheoryToken: string;
|
|
165
|
+
type: 'basis_theory_token';
|
|
166
|
+
}
|
|
167
|
+
interface NekudaPaymentMethod {
|
|
168
|
+
nekudaUserId: string;
|
|
169
|
+
type: 'nekuda_token';
|
|
170
|
+
/**
|
|
171
|
+
* Construct a type with a set of properties K of type T
|
|
172
|
+
*/
|
|
173
|
+
nekudaMandateData?: {
|
|
174
|
+
[key: string]: string | number;
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
export interface VariantSelection {
|
|
179
|
+
label: string;
|
|
180
|
+
value: string | number;
|
|
105
181
|
}
|
|
106
182
|
export interface CheckoutIntentCreateParams {
|
|
107
183
|
buyer: Buyer;
|
|
108
184
|
productUrl: string;
|
|
109
185
|
quantity: number;
|
|
186
|
+
variantSelections?: Array<VariantSelection>;
|
|
187
|
+
}
|
|
188
|
+
export interface CheckoutIntentAddPaymentParams {
|
|
189
|
+
paymentMethod: PaymentMethod;
|
|
110
190
|
}
|
|
111
191
|
export interface CheckoutIntentConfirmParams {
|
|
112
|
-
paymentMethod:
|
|
192
|
+
paymentMethod: PaymentMethod;
|
|
113
193
|
}
|
|
114
|
-
export declare namespace
|
|
115
|
-
export { type BaseCheckoutIntent as BaseCheckoutIntent, type Buyer as Buyer, type CheckoutIntent as CheckoutIntent, type Money as Money, type Offer as Offer, type
|
|
194
|
+
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, };
|
|
116
196
|
}
|
|
117
197
|
//# sourceMappingURL=checkout-intents.d.ts.map
|
|
@@ -0,0 +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;OACvB,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAGzB,qBAAa,uBAAwB,SAAQ,WAAW;IACtD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,IAAI,EAAE,0BAA0B,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,cAAc,CAAC;IAI9F;;;;;;;;;;OAUG;IACH,QAAQ,CAAC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AAED,MAAM,WAAW,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,gBAAgB,IAAI,gBAAgB,EACzC,KAAK,0BAA0B,IAAI,0BAA0B,EAC7D,KAAK,8BAA8B,IAAI,8BAA8B,EACrE,KAAK,2BAA2B,IAAI,2BAA2B,GAChE,CAAC;CACH"}
|
|
@@ -0,0 +1,88 @@
|
|
|
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.CheckoutIntentsResource = void 0;
|
|
5
|
+
const resource_1 = require("../core/resource.js");
|
|
6
|
+
const path_1 = require("../internal/utils/path.js");
|
|
7
|
+
class CheckoutIntentsResource extends resource_1.APIResource {
|
|
8
|
+
/**
|
|
9
|
+
* Create a checkout intent with the given request body.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const checkoutIntent = await client.checkoutIntents.create({
|
|
14
|
+
* buyer: {
|
|
15
|
+
* address1: '123 Main St',
|
|
16
|
+
* city: 'New York',
|
|
17
|
+
* country: 'United States',
|
|
18
|
+
* email: 'john.doe@example.com',
|
|
19
|
+
* firstName: 'John',
|
|
20
|
+
* lastName: 'Doe',
|
|
21
|
+
* phone: '+1234567890',
|
|
22
|
+
* postalCode: '10001',
|
|
23
|
+
* province: 'NY',
|
|
24
|
+
* },
|
|
25
|
+
* productUrl: 'productUrl',
|
|
26
|
+
* quantity: 1,
|
|
27
|
+
* });
|
|
28
|
+
* ```
|
|
29
|
+
*/
|
|
30
|
+
create(body, options) {
|
|
31
|
+
return this._client.post('/api/v1/checkout-intents', { body, ...options });
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve a checkout intent by id
|
|
35
|
+
*
|
|
36
|
+
* Returns checkout intent information if the lookup succeeds.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const checkoutIntent =
|
|
41
|
+
* await client.checkoutIntents.retrieve('id');
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
44
|
+
retrieve(id, options) {
|
|
45
|
+
return this._client.get((0, path_1.path) `/api/v1/checkout-intents/${id}`, options);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Add payment details to a checkout intent
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```ts
|
|
52
|
+
* const checkoutIntent =
|
|
53
|
+
* await client.checkoutIntents.addPayment('id', {
|
|
54
|
+
* paymentMethod: {
|
|
55
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
56
|
+
* type: 'stripe_token',
|
|
57
|
+
* },
|
|
58
|
+
* });
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
addPayment(id, body, options) {
|
|
62
|
+
return this._client.post((0, path_1.path) `/api/v1/checkout-intents/${id}/payment`, { body, ...options });
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Confirm a checkout intent with provided payment information
|
|
66
|
+
*
|
|
67
|
+
* Confirm means we have buyer's name, address and payment info, so we can move
|
|
68
|
+
* forward to place the order.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const checkoutIntent = await client.checkoutIntents.confirm(
|
|
73
|
+
* 'id',
|
|
74
|
+
* {
|
|
75
|
+
* paymentMethod: {
|
|
76
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
77
|
+
* type: 'stripe_token',
|
|
78
|
+
* },
|
|
79
|
+
* },
|
|
80
|
+
* );
|
|
81
|
+
* ```
|
|
82
|
+
*/
|
|
83
|
+
confirm(id, body, options) {
|
|
84
|
+
return this._client.post((0, path_1.path) `/api/v1/checkout-intents/${id}/confirm`, { body, ...options });
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
exports.CheckoutIntentsResource = CheckoutIntentsResource;
|
|
88
|
+
//# sourceMappingURL=checkout-intents.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout-intents.js","sourceRoot":"","sources":["../src/resources/checkout-intents.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,oDAA8C;AAE9C,MAAa,uBAAwB,SAAQ,sBAAW;IACtD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,IAAgC,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,4BAA4B,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,UAAU,CACR,EAAU,EACV,IAAoC,EACpC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,4BAA4B,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CACL,EAAU,EACV,IAAiC,EACjC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,4BAA4B,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;CACF;AA1FD,0DA0FC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
+
import { APIResource } from "../core/resource.mjs";
|
|
3
|
+
import { path } from "../internal/utils/path.mjs";
|
|
4
|
+
export class CheckoutIntentsResource extends APIResource {
|
|
5
|
+
/**
|
|
6
|
+
* Create a checkout intent with the given request body.
|
|
7
|
+
*
|
|
8
|
+
* @example
|
|
9
|
+
* ```ts
|
|
10
|
+
* const checkoutIntent = await client.checkoutIntents.create({
|
|
11
|
+
* buyer: {
|
|
12
|
+
* address1: '123 Main St',
|
|
13
|
+
* city: 'New York',
|
|
14
|
+
* country: 'United States',
|
|
15
|
+
* email: 'john.doe@example.com',
|
|
16
|
+
* firstName: 'John',
|
|
17
|
+
* lastName: 'Doe',
|
|
18
|
+
* phone: '+1234567890',
|
|
19
|
+
* postalCode: '10001',
|
|
20
|
+
* province: 'NY',
|
|
21
|
+
* },
|
|
22
|
+
* productUrl: 'productUrl',
|
|
23
|
+
* quantity: 1,
|
|
24
|
+
* });
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
create(body, options) {
|
|
28
|
+
return this._client.post('/api/v1/checkout-intents', { body, ...options });
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Retrieve a checkout intent by id
|
|
32
|
+
*
|
|
33
|
+
* Returns checkout intent information if the lookup succeeds.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const checkoutIntent =
|
|
38
|
+
* await client.checkoutIntents.retrieve('id');
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
41
|
+
retrieve(id, options) {
|
|
42
|
+
return this._client.get(path `/api/v1/checkout-intents/${id}`, options);
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Add payment details to a checkout intent
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
49
|
+
* const checkoutIntent =
|
|
50
|
+
* await client.checkoutIntents.addPayment('id', {
|
|
51
|
+
* paymentMethod: {
|
|
52
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
53
|
+
* type: 'stripe_token',
|
|
54
|
+
* },
|
|
55
|
+
* });
|
|
56
|
+
* ```
|
|
57
|
+
*/
|
|
58
|
+
addPayment(id, body, options) {
|
|
59
|
+
return this._client.post(path `/api/v1/checkout-intents/${id}/payment`, { body, ...options });
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Confirm a checkout intent with provided payment information
|
|
63
|
+
*
|
|
64
|
+
* Confirm means we have buyer's name, address and payment info, so we can move
|
|
65
|
+
* forward to place the order.
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* const checkoutIntent = await client.checkoutIntents.confirm(
|
|
70
|
+
* 'id',
|
|
71
|
+
* {
|
|
72
|
+
* paymentMethod: {
|
|
73
|
+
* stripeToken: 'tok_1RkrWWHGDlstla3f1Fc7ZrhH',
|
|
74
|
+
* type: 'stripe_token',
|
|
75
|
+
* },
|
|
76
|
+
* },
|
|
77
|
+
* );
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
confirm(id, body, options) {
|
|
81
|
+
return this._client.post(path `/api/v1/checkout-intents/${id}/confirm`, { body, ...options });
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=checkout-intents.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"checkout-intents.mjs","sourceRoot":"","sources":["../src/resources/checkout-intents.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAIf,EAAE,IAAI,EAAE;AAEf,MAAM,OAAO,uBAAwB,SAAQ,WAAW;IACtD;;;;;;;;;;;;;;;;;;;;;OAqBG;IACH,MAAM,CAAC,IAAgC,EAAE,OAAwB;QAC/D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,0BAA0B,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC7E,CAAC;IAED;;;;;;;;;;OAUG;IACH,QAAQ,CAAC,EAAU,EAAE,OAAwB;QAC3C,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,4BAA4B,EAAE,EAAE,EAAE,OAAO,CAAC,CAAC;IACzE,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,UAAU,CACR,EAAU,EACV,IAAoC,EACpC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,4BAA4B,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,OAAO,CACL,EAAU,EACV,IAAiC,EACjC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,4BAA4B,EAAE,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC/F,CAAC;CACF"}
|
package/resources/index.d.mts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { Brands, type BrandRetrieveResponse } from "./brands.mjs";
|
|
2
|
+
export { CheckoutIntentsResource, type BaseCheckoutIntent, type Buyer, type CheckoutIntent, type Money, type Offer, type PaymentMethod, type VariantSelection, type CheckoutIntentCreateParams, type CheckoutIntentAddPaymentParams, type CheckoutIntentConfirmParams, } from "./checkout-intents.mjs";
|
|
3
3
|
//# sourceMappingURL=index.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EAAE,MAAM,EAAE,KAAK,qBAAqB,EAAE;OACtC,EACL,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,KAAK,EACV,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,2BAA2B,GACjC"}
|
package/resources/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { Brands, type BrandRetrieveResponse } from "./brands.js";
|
|
2
|
+
export { CheckoutIntentsResource, type BaseCheckoutIntent, type Buyer, type CheckoutIntent, type Money, type Offer, type PaymentMethod, type VariantSelection, type CheckoutIntentCreateParams, type CheckoutIntentAddPaymentParams, type CheckoutIntentConfirmParams, } from "./checkout-intents.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/resources/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"OAEO,EAAE,MAAM,EAAE,KAAK,qBAAqB,EAAE;OACtC,EACL,uBAAuB,EACvB,KAAK,kBAAkB,EACvB,KAAK,KAAK,EACV,KAAK,cAAc,EACnB,KAAK,KAAK,EACV,KAAK,KAAK,EACV,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACrB,KAAK,0BAA0B,EAC/B,KAAK,8BAA8B,EACnC,KAAK,2BAA2B,GACjC"}
|
package/resources/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
5
|
-
var
|
|
6
|
-
Object.defineProperty(exports, "
|
|
7
|
-
var
|
|
8
|
-
Object.defineProperty(exports, "
|
|
4
|
+
exports.CheckoutIntentsResource = exports.Brands = void 0;
|
|
5
|
+
var brands_1 = require("./brands.js");
|
|
6
|
+
Object.defineProperty(exports, "Brands", { enumerable: true, get: function () { return brands_1.Brands; } });
|
|
7
|
+
var checkout_intents_1 = require("./checkout-intents.js");
|
|
8
|
+
Object.defineProperty(exports, "CheckoutIntentsResource", { enumerable: true, get: function () { return checkout_intents_1.CheckoutIntentsResource; } });
|
|
9
9
|
//# sourceMappingURL=index.js.map
|
package/resources/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,sCAA8D;AAArD,gGAAA,MAAM,OAAA;AACf,0DAY4B;AAX1B,2HAAA,uBAAuB,OAAA"}
|
package/resources/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export { Brands } from "./brands.mjs";
|
|
3
|
+
export { CheckoutIntentsResource, } from "./checkout-intents.mjs";
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|
package/resources/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/resources/index.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,MAAM,EAA8B;OACtC,EACL,uBAAuB,GAWxB"}
|