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
@@ -1 +0,0 @@
1
- {"version":3,"file":"api.mjs","sourceRoot":"","sources":["../src/resources/api.ts"],"names":[],"mappings":"AAAA,sFAAsF"}
@@ -1,17 +0,0 @@
1
- import { APIResource } from "../core/resource.mjs";
2
- import { APIPromise } from "../core/api-promise.mjs";
3
- import { RequestOptions } from "../internal/request-options.mjs";
4
- export declare class Health extends APIResource {
5
- /**
6
- * Simple check to confirm the API is running and accessible.
7
- */
8
- check(options?: RequestOptions): APIPromise<HealthCheckResponse>;
9
- }
10
- export interface HealthCheckResponse {
11
- message: string;
12
- status: string;
13
- }
14
- export declare namespace Health {
15
- export { type HealthCheckResponse as HealthCheckResponse };
16
- }
17
- //# sourceMappingURL=health.d.mts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"health.d.mts","sourceRoot":"","sources":["../src/resources/health.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;CAGjE;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAEhB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;CAC5D"}
@@ -1,17 +0,0 @@
1
- import { APIResource } from "../core/resource.js";
2
- import { APIPromise } from "../core/api-promise.js";
3
- import { RequestOptions } from "../internal/request-options.js";
4
- export declare class Health extends APIResource {
5
- /**
6
- * Simple check to confirm the API is running and accessible.
7
- */
8
- check(options?: RequestOptions): APIPromise<HealthCheckResponse>;
9
- }
10
- export interface HealthCheckResponse {
11
- message: string;
12
- status: string;
13
- }
14
- export declare namespace Health {
15
- export { type HealthCheckResponse as HealthCheckResponse };
16
- }
17
- //# sourceMappingURL=health.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"health.d.ts","sourceRoot":"","sources":["../src/resources/health.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,KAAK,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,mBAAmB,CAAC;CAGjE;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,MAAM,CAAC;IAEhB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,CAAC,OAAO,WAAW,MAAM,CAAC;IAC9B,OAAO,EAAE,KAAK,mBAAmB,IAAI,mBAAmB,EAAE,CAAC;CAC5D"}
@@ -1,15 +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.Health = void 0;
5
- const resource_1 = require("../core/resource.js");
6
- class Health extends resource_1.APIResource {
7
- /**
8
- * Simple check to confirm the API is running and accessible.
9
- */
10
- check(options) {
11
- return this._client.get('/health', options);
12
- }
13
- }
14
- exports.Health = Health;
15
- //# sourceMappingURL=health.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"health.js","sourceRoot":"","sources":["../src/resources/health.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAI/C,MAAa,MAAO,SAAQ,sBAAW;IACrC;;OAEG;IACH,KAAK,CAAC,OAAwB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF;AAPD,wBAOC"}
@@ -1,11 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
- import { APIResource } from "../core/resource.mjs";
3
- export class Health extends APIResource {
4
- /**
5
- * Simple check to confirm the API is running and accessible.
6
- */
7
- check(options) {
8
- return this._client.get('/health', options);
9
- }
10
- }
11
- //# sourceMappingURL=health.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"health.mjs","sourceRoot":"","sources":["../src/resources/health.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;AAItB,MAAM,OAAO,MAAO,SAAQ,WAAW;IACrC;;OAEG;IACH,KAAK,CAAC,OAAwB;QAC5B,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC9C,CAAC;CACF"}
@@ -1,15 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../../core/resource';
4
- import * as V1API from './v1/v1';
5
- import { V1 } from './v1/v1';
6
-
7
- export class API extends APIResource {
8
- v1: V1API.V1 = new V1API.V1(this._client);
9
- }
10
-
11
- API.V1 = V1;
12
-
13
- export declare namespace API {
14
- export { V1 as V1 };
15
- }
@@ -1,4 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export { API } from './api';
4
- export { V1 } from './v1/index';
@@ -1,207 +0,0 @@
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
-
9
- export class CheckoutIntents extends APIResource {
10
- /**
11
- * Create a checkout intent with the given request body.
12
- */
13
- create(body: CheckoutIntentCreateParams, options?: RequestOptions): APIPromise<CheckoutIntent> {
14
- return this._client.post('/api/v1/checkout-intents', { body, ...options });
15
- }
16
-
17
- /**
18
- * Retrieve a checkout intent by id
19
- *
20
- * Returns checkout intent information if the lookup succeeds.
21
- */
22
- retrieve(id: string, options?: RequestOptions): APIPromise<CheckoutIntent> {
23
- return this._client.get(path`/api/v1/checkout-intents/${id}`, options);
24
- }
25
-
26
- /**
27
- * Confirm a checkout intent with provided payment information
28
- *
29
- * Confirm means we have buyer's name, address and payment info, so we can move
30
- * forward to place the order.
31
- */
32
- confirm(
33
- id: string,
34
- body: CheckoutIntentConfirmParams,
35
- options?: RequestOptions,
36
- ): APIPromise<CheckoutIntent> {
37
- return this._client.post(path`/api/v1/checkout-intents/${id}/confirm`, { body, ...options });
38
- }
39
- }
40
-
41
- export interface BaseCheckoutIntent {
42
- id: string;
43
-
44
- buyer: Buyer;
45
-
46
- createdAt: string;
47
-
48
- productUrl: string;
49
-
50
- quantity: number;
51
- }
52
-
53
- export interface Buyer {
54
- address1: string;
55
-
56
- city: string;
57
-
58
- country: string;
59
-
60
- email: string;
61
-
62
- firstName: string;
63
-
64
- lastName: string;
65
-
66
- phone: string;
67
-
68
- postalCode: string;
69
-
70
- province: string;
71
-
72
- address2?: string;
73
- }
74
-
75
- export type CheckoutIntent =
76
- | CheckoutIntent.RetrievingOfferCheckoutIntent
77
- | CheckoutIntent.AwaitingConfirmationCheckoutIntent
78
- | CheckoutIntent.PlacingOrderCheckoutIntent
79
- | CheckoutIntent.CompletedCheckoutIntent
80
- | CheckoutIntent.FailedCheckoutIntent;
81
-
82
- export namespace CheckoutIntent {
83
- export interface RetrievingOfferCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
84
- state: 'retrieving_offer';
85
- }
86
-
87
- export interface AwaitingConfirmationCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
88
- offer: CheckoutIntentsAPI.Offer;
89
-
90
- state: 'awaiting_confirmation';
91
- }
92
-
93
- export interface PlacingOrderCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
94
- offer: CheckoutIntentsAPI.Offer;
95
-
96
- paymentMethod: CheckoutIntentsAPI.StripeTokenPaymentMethod;
97
-
98
- state: 'placing_order';
99
- }
100
-
101
- export interface CompletedCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
102
- offer: CheckoutIntentsAPI.Offer;
103
-
104
- paymentMethod: CheckoutIntentsAPI.StripeTokenPaymentMethod;
105
-
106
- state: 'completed';
107
- }
108
-
109
- export interface FailedCheckoutIntent extends CheckoutIntentsAPI.BaseCheckoutIntent {
110
- failureReason: FailedCheckoutIntent.FailureReason;
111
-
112
- state: 'failed';
113
-
114
- offer?: CheckoutIntentsAPI.Offer;
115
-
116
- paymentMethod?: CheckoutIntentsAPI.StripeTokenPaymentMethod;
117
- }
118
-
119
- export namespace FailedCheckoutIntent {
120
- export interface FailureReason {
121
- code:
122
- | 'checkout_intent_expired'
123
- | 'payment_failed'
124
- | 'insufficient_stock'
125
- | 'product_out_of_stock'
126
- | 'offer_retrieval_failed'
127
- | 'order_placement_failed'
128
- | 'developer_not_found'
129
- | 'missing_shipping_method'
130
- | 'unsupported_currency'
131
- | 'unsupported_store_no_guest_checkout';
132
-
133
- message: string;
134
- }
135
- }
136
- }
137
-
138
- export interface Money {
139
- amountSubunits: number;
140
-
141
- currencyCode: string;
142
- }
143
-
144
- export interface Offer {
145
- cost: Offer.Cost;
146
-
147
- shipping: Offer.Shipping;
148
- }
149
-
150
- export namespace Offer {
151
- export interface Cost {
152
- subtotal: CheckoutIntentsAPI.Money;
153
-
154
- total: CheckoutIntentsAPI.Money;
155
-
156
- discount?: CheckoutIntentsAPI.Money;
157
-
158
- shipping?: CheckoutIntentsAPI.Money;
159
-
160
- tax?: CheckoutIntentsAPI.Money;
161
- }
162
-
163
- export interface Shipping {
164
- availableOptions: Array<Shipping.AvailableOption>;
165
-
166
- selectedOptionId?: string;
167
- }
168
-
169
- export namespace Shipping {
170
- export interface AvailableOption {
171
- id: string;
172
-
173
- cost: CheckoutIntentsAPI.Money;
174
- }
175
- }
176
- }
177
-
178
- export interface StripeTokenPaymentMethod {
179
- stripeToken: string;
180
-
181
- type: 'stripe_token';
182
- }
183
-
184
- export interface CheckoutIntentCreateParams {
185
- buyer: Buyer;
186
-
187
- productUrl: string;
188
-
189
- quantity: number;
190
- }
191
-
192
- export interface CheckoutIntentConfirmParams {
193
- paymentMethod: StripeTokenPaymentMethod;
194
- }
195
-
196
- export declare namespace CheckoutIntents {
197
- export {
198
- type BaseCheckoutIntent as BaseCheckoutIntent,
199
- type Buyer as Buyer,
200
- type CheckoutIntent as CheckoutIntent,
201
- type Money as Money,
202
- type Offer as Offer,
203
- type StripeTokenPaymentMethod as StripeTokenPaymentMethod,
204
- type CheckoutIntentCreateParams as CheckoutIntentCreateParams,
205
- type CheckoutIntentConfirmParams as CheckoutIntentConfirmParams,
206
- };
207
- }
@@ -1,15 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export { Brands, type BrandRetrieveByDomainResponse } from './brands';
4
- export {
5
- CheckoutIntents,
6
- type BaseCheckoutIntent,
7
- type Buyer,
8
- type CheckoutIntent,
9
- type Money,
10
- type Offer,
11
- type StripeTokenPaymentMethod,
12
- type CheckoutIntentCreateParams,
13
- type CheckoutIntentConfirmParams,
14
- } from './checkout-intents';
15
- export { V1 } from './v1';
@@ -1,41 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../../../core/resource';
4
- import * as BrandsAPI from './brands';
5
- import { BrandRetrieveByDomainResponse, Brands } from './brands';
6
- import * as CheckoutIntentsAPI from './checkout-intents';
7
- import {
8
- BaseCheckoutIntent,
9
- Buyer,
10
- CheckoutIntent,
11
- CheckoutIntentConfirmParams,
12
- CheckoutIntentCreateParams,
13
- CheckoutIntents,
14
- Money,
15
- Offer,
16
- StripeTokenPaymentMethod,
17
- } from './checkout-intents';
18
-
19
- export class V1 extends APIResource {
20
- brands: BrandsAPI.Brands = new BrandsAPI.Brands(this._client);
21
- checkoutIntents: CheckoutIntentsAPI.CheckoutIntents = new CheckoutIntentsAPI.CheckoutIntents(this._client);
22
- }
23
-
24
- V1.Brands = Brands;
25
- V1.CheckoutIntents = CheckoutIntents;
26
-
27
- export declare namespace V1 {
28
- export { Brands as Brands, type BrandRetrieveByDomainResponse as BrandRetrieveByDomainResponse };
29
-
30
- export {
31
- CheckoutIntents as CheckoutIntents,
32
- type BaseCheckoutIntent as BaseCheckoutIntent,
33
- type Buyer as Buyer,
34
- type CheckoutIntent as CheckoutIntent,
35
- type Money as Money,
36
- type Offer as Offer,
37
- type StripeTokenPaymentMethod as StripeTokenPaymentMethod,
38
- type CheckoutIntentCreateParams as CheckoutIntentCreateParams,
39
- type CheckoutIntentConfirmParams as CheckoutIntentConfirmParams,
40
- };
41
- }
@@ -1,3 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export * from './v1/index';
@@ -1,3 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- export * from './api/index';
@@ -1,24 +0,0 @@
1
- // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
-
3
- import { APIResource } from '../core/resource';
4
- import { APIPromise } from '../core/api-promise';
5
- import { RequestOptions } from '../internal/request-options';
6
-
7
- export class Health extends APIResource {
8
- /**
9
- * Simple check to confirm the API is running and accessible.
10
- */
11
- check(options?: RequestOptions): APIPromise<HealthCheckResponse> {
12
- return this._client.get('/health', options);
13
- }
14
- }
15
-
16
- export interface HealthCheckResponse {
17
- message: string;
18
-
19
- status: string;
20
- }
21
-
22
- export declare namespace Health {
23
- export { type HealthCheckResponse as HealthCheckResponse };
24
- }