@usehercules/sdk 1.10.1 → 1.11.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 +9 -0
- package/README.md +7 -7
- package/package.json +1 -1
- package/resources/beta/commerce/commerce.d.mts +31 -11
- package/resources/beta/commerce/commerce.d.mts.map +1 -1
- package/resources/beta/commerce/commerce.d.ts +31 -11
- package/resources/beta/commerce/commerce.d.ts.map +1 -1
- package/resources/beta/commerce/commerce.js +4 -0
- package/resources/beta/commerce/commerce.js.map +1 -1
- package/resources/beta/commerce/commerce.mjs +4 -0
- package/resources/beta/commerce/commerce.mjs.map +1 -1
- package/resources/beta/commerce/coupons.d.mts +7 -184
- package/resources/beta/commerce/coupons.d.mts.map +1 -1
- package/resources/beta/commerce/coupons.d.ts +7 -184
- package/resources/beta/commerce/coupons.d.ts.map +1 -1
- package/resources/beta/commerce/coupons.js +1 -4
- package/resources/beta/commerce/coupons.js.map +1 -1
- package/resources/beta/commerce/coupons.mjs +1 -4
- package/resources/beta/commerce/coupons.mjs.map +1 -1
- package/resources/beta/commerce/customers.d.mts +24 -239
- package/resources/beta/commerce/customers.d.mts.map +1 -1
- package/resources/beta/commerce/customers.d.ts +24 -239
- package/resources/beta/commerce/customers.d.ts.map +1 -1
- package/resources/beta/commerce/customers.js +1 -4
- package/resources/beta/commerce/customers.js.map +1 -1
- package/resources/beta/commerce/customers.mjs +1 -4
- package/resources/beta/commerce/customers.mjs.map +1 -1
- package/resources/beta/commerce/features.d.mts +127 -0
- package/resources/beta/commerce/features.d.mts.map +1 -0
- package/resources/beta/commerce/features.d.ts +127 -0
- package/resources/beta/commerce/features.d.ts.map +1 -0
- package/resources/beta/commerce/features.js +49 -0
- package/resources/beta/commerce/features.js.map +1 -0
- package/resources/beta/commerce/features.mjs +45 -0
- package/resources/beta/commerce/features.mjs.map +1 -0
- package/resources/beta/commerce/index.d.mts +4 -3
- package/resources/beta/commerce/index.d.mts.map +1 -1
- package/resources/beta/commerce/index.d.ts +4 -3
- package/resources/beta/commerce/index.d.ts.map +1 -1
- package/resources/beta/commerce/index.js +3 -1
- package/resources/beta/commerce/index.js.map +1 -1
- package/resources/beta/commerce/index.mjs +1 -0
- package/resources/beta/commerce/index.mjs.map +1 -1
- package/resources/beta/commerce/products/index.d.mts +2 -2
- package/resources/beta/commerce/products/index.d.mts.map +1 -1
- package/resources/beta/commerce/products/index.d.ts +2 -2
- package/resources/beta/commerce/products/index.d.ts.map +1 -1
- package/resources/beta/commerce/products/index.js.map +1 -1
- package/resources/beta/commerce/products/index.mjs.map +1 -1
- package/resources/beta/commerce/products/products.d.mts +17 -673
- package/resources/beta/commerce/products/products.d.mts.map +1 -1
- package/resources/beta/commerce/products/products.d.ts +17 -673
- package/resources/beta/commerce/products/products.d.ts.map +1 -1
- package/resources/beta/commerce/products/products.js +1 -4
- package/resources/beta/commerce/products/products.js.map +1 -1
- package/resources/beta/commerce/products/products.mjs +1 -4
- package/resources/beta/commerce/products/products.mjs.map +1 -1
- package/resources/beta/commerce/products/variants.d.mts +12 -540
- package/resources/beta/commerce/products/variants.d.mts.map +1 -1
- package/resources/beta/commerce/products/variants.d.ts +12 -540
- package/resources/beta/commerce/products/variants.d.ts.map +1 -1
- package/resources/beta/commerce/products/variants.js +4 -1
- package/resources/beta/commerce/products/variants.js.map +1 -1
- package/resources/beta/commerce/products/variants.mjs +4 -1
- package/resources/beta/commerce/products/variants.mjs.map +1 -1
- package/src/resources/beta/commerce/commerce.ts +57 -35
- package/src/resources/beta/commerce/coupons.ts +9 -231
- package/src/resources/beta/commerce/customers.ts +27 -291
- package/src/resources/beta/commerce/features.ts +175 -0
- package/src/resources/beta/commerce/index.ts +15 -15
- package/src/resources/beta/commerce/products/index.ts +4 -12
- package/src/resources/beta/commerce/products/products.ts +21 -800
- package/src/resources/beta/commerce/products/variants.ts +17 -658
- 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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.11.0 (2026-01-12)
|
|
4
|
+
|
|
5
|
+
Full Changelog: [v1.10.1...v1.11.0](https://github.com/withzeusai/hercules-sdk-typescript/compare/v1.10.1...v1.11.0)
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
* **api:** update api ([97f2ca0](https://github.com/withzeusai/hercules-sdk-typescript/commit/97f2ca0e6177a7e5d40f5c8a3d5ca5611540ce86))
|
|
10
|
+
* **api:** update api ([d40608f](https://github.com/withzeusai/hercules-sdk-typescript/commit/d40608f78b0074b4fa67b077cb486c5925523f29))
|
|
11
|
+
|
|
3
12
|
## 1.10.1 (2026-01-12)
|
|
4
13
|
|
|
5
14
|
Full Changelog: [v1.10.0...v1.10.1](https://github.com/withzeusai/hercules-sdk-typescript/compare/v1.10.0...v1.10.1)
|
package/README.md
CHANGED
|
@@ -151,16 +151,16 @@ List methods in the Hercules API are paginated.
|
|
|
151
151
|
You can use the `for await … of` syntax to iterate through items across all pages:
|
|
152
152
|
|
|
153
153
|
```ts
|
|
154
|
-
async function
|
|
155
|
-
const
|
|
154
|
+
async function fetchAllCustomers(params) {
|
|
155
|
+
const allCustomers = [];
|
|
156
156
|
// Automatically fetches more pages as needed.
|
|
157
|
-
for await (const
|
|
157
|
+
for await (const customer of client.beta.commerce.customers.list({
|
|
158
158
|
limit: 100,
|
|
159
159
|
starting_after: 'id_123',
|
|
160
160
|
})) {
|
|
161
|
-
|
|
161
|
+
allCustomers.push(customer);
|
|
162
162
|
}
|
|
163
|
-
return
|
|
163
|
+
return allCustomers;
|
|
164
164
|
}
|
|
165
165
|
```
|
|
166
166
|
|
|
@@ -168,8 +168,8 @@ Alternatively, you can request a single page at a time:
|
|
|
168
168
|
|
|
169
169
|
```ts
|
|
170
170
|
let page = await client.beta.commerce.customers.list({ limit: 100, starting_after: 'id_123' });
|
|
171
|
-
for (const
|
|
172
|
-
console.log(
|
|
171
|
+
for (const customer of page.data) {
|
|
172
|
+
console.log(customer);
|
|
173
173
|
}
|
|
174
174
|
|
|
175
175
|
// Convenience methods are provided for manually paginating:
|
package/package.json
CHANGED
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { APIResource } from "../../../core/resource.mjs";
|
|
2
2
|
import * as CouponsAPI from "./coupons.mjs";
|
|
3
|
-
import {
|
|
3
|
+
import { Coupon, CouponCreateParams, CouponListParams, CouponUpdateParams, Coupons, CouponsCursorIDPage } from "./coupons.mjs";
|
|
4
4
|
import * as CustomersAPI from "./customers.mjs";
|
|
5
|
-
import { CustomerBillingPortalParams, CustomerBillingPortalResponse, CustomerCreateParams,
|
|
5
|
+
import { Customer, CustomerAddress, CustomerBillingPortalParams, CustomerBillingPortalResponse, CustomerCreateParams, CustomerGetResponse, CustomerListParams, CustomerUpdateParams, Customers, CustomersCursorIDPage } from "./customers.mjs";
|
|
6
|
+
import * as FeaturesAPI from "./features.mjs";
|
|
7
|
+
import { Feature, FeatureCreateParams, FeatureListParams, FeatureUpdateParams, Features, FeaturesCursorIDPage } from "./features.mjs";
|
|
6
8
|
import * as ProductsAPI from "./products/products.mjs";
|
|
7
|
-
import {
|
|
9
|
+
import { Product, ProductCreateParams, ProductListParams, ProductUpdateParams, Products, ProductsCursorIDPage } from "./products/products.mjs";
|
|
8
10
|
import { APIPromise } from "../../../core/api-promise.mjs";
|
|
9
11
|
import { RequestOptions } from "../../../internal/request-options.mjs";
|
|
10
12
|
export declare class Commerce extends APIResource {
|
|
11
13
|
customers: CustomersAPI.Customers;
|
|
12
14
|
products: ProductsAPI.Products;
|
|
13
15
|
coupons: CouponsAPI.Coupons;
|
|
16
|
+
features: FeaturesAPI.Features;
|
|
14
17
|
/**
|
|
15
18
|
* Cancels a customer's subscription. By default, the subscription remains active
|
|
16
19
|
* until the end of the current billing period. Set cancellation_timing to
|
|
@@ -155,10 +158,13 @@ export interface CommerceCheckoutParams {
|
|
|
155
158
|
*/
|
|
156
159
|
customer_id: string;
|
|
157
160
|
/**
|
|
158
|
-
*
|
|
159
|
-
* subscription or one-time payment.
|
|
161
|
+
* List of items to purchase. Each item specifies a variant and quantity.
|
|
160
162
|
*/
|
|
161
|
-
|
|
163
|
+
line_items: Array<CommerceCheckoutParams.LineItem>;
|
|
164
|
+
/**
|
|
165
|
+
* URL to redirect on success
|
|
166
|
+
*/
|
|
167
|
+
success_url: string;
|
|
162
168
|
/**
|
|
163
169
|
* Optional custom ID for the subscription or payment. If not provided, one will be
|
|
164
170
|
* generated.
|
|
@@ -192,15 +198,29 @@ export interface CommerceCheckoutParams {
|
|
|
192
198
|
* subscription group's configured default.
|
|
193
199
|
*/
|
|
194
200
|
proration_behavior?: 'none' | 'prorate' | 'full_difference';
|
|
201
|
+
}
|
|
202
|
+
export declare namespace CommerceCheckoutParams {
|
|
195
203
|
/**
|
|
196
|
-
*
|
|
204
|
+
* A line item in the checkout
|
|
197
205
|
*/
|
|
198
|
-
|
|
206
|
+
interface LineItem {
|
|
207
|
+
/**
|
|
208
|
+
* The variant ID to purchase. Determines pricing and whether this is a
|
|
209
|
+
* subscription or one-time payment.
|
|
210
|
+
*/
|
|
211
|
+
variant_id: string;
|
|
212
|
+
/**
|
|
213
|
+
* Quantity of this item. For subscriptions, this typically represents seat count.
|
|
214
|
+
* Defaults to 1.
|
|
215
|
+
*/
|
|
216
|
+
quantity?: number;
|
|
217
|
+
}
|
|
199
218
|
}
|
|
200
219
|
export declare namespace Commerce {
|
|
201
220
|
export { type CommerceCancelResponse as CommerceCancelResponse, type CommerceCheckResponse as CommerceCheckResponse, type CommerceCheckoutResponse as CommerceCheckoutResponse, type CommerceCancelParams as CommerceCancelParams, type CommerceCheckParams as CommerceCheckParams, type CommerceCheckoutParams as CommerceCheckoutParams, };
|
|
202
|
-
export { Customers as Customers, type
|
|
203
|
-
export { Products as Products, type
|
|
204
|
-
export { Coupons as Coupons, type
|
|
221
|
+
export { Customers as Customers, type Customer as Customer, type CustomerAddress as CustomerAddress, type CustomerBillingPortalResponse as CustomerBillingPortalResponse, type CustomerGetResponse as CustomerGetResponse, type CustomersCursorIDPage as CustomersCursorIDPage, type CustomerCreateParams as CustomerCreateParams, type CustomerUpdateParams as CustomerUpdateParams, type CustomerListParams as CustomerListParams, type CustomerBillingPortalParams as CustomerBillingPortalParams, };
|
|
222
|
+
export { Products as Products, type Product as Product, type ProductsCursorIDPage as ProductsCursorIDPage, type ProductCreateParams as ProductCreateParams, type ProductUpdateParams as ProductUpdateParams, type ProductListParams as ProductListParams, };
|
|
223
|
+
export { Coupons as Coupons, type Coupon as Coupon, type CouponsCursorIDPage as CouponsCursorIDPage, type CouponCreateParams as CouponCreateParams, type CouponUpdateParams as CouponUpdateParams, type CouponListParams as CouponListParams, };
|
|
224
|
+
export { Features as Features, type Feature as Feature, type FeaturesCursorIDPage as FeaturesCursorIDPage, type FeatureCreateParams as FeatureCreateParams, type FeatureUpdateParams as FeatureUpdateParams, type FeatureListParams as FeatureListParams, };
|
|
205
225
|
}
|
|
206
226
|
//# sourceMappingURL=commerce.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commerce.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/commerce/commerce.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EACL,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"commerce.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/commerce/commerce.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EACL,MAAM,EACN,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,EACP,mBAAmB,EACpB;OACM,KAAK,YAAY;OACjB,EACL,QAAQ,EACR,eAAe,EACf,2BAA2B,EAC3B,6BAA6B,EAC7B,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EACl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I,QAAQ,EACpB,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;IAEF,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;IAEF,OAAO,EACL,QAAQ,IAAI,QAAQ,EACpB,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { APIResource } from "../../../core/resource.js";
|
|
2
2
|
import * as CouponsAPI from "./coupons.js";
|
|
3
|
-
import {
|
|
3
|
+
import { Coupon, CouponCreateParams, CouponListParams, CouponUpdateParams, Coupons, CouponsCursorIDPage } from "./coupons.js";
|
|
4
4
|
import * as CustomersAPI from "./customers.js";
|
|
5
|
-
import { CustomerBillingPortalParams, CustomerBillingPortalResponse, CustomerCreateParams,
|
|
5
|
+
import { Customer, CustomerAddress, CustomerBillingPortalParams, CustomerBillingPortalResponse, CustomerCreateParams, CustomerGetResponse, CustomerListParams, CustomerUpdateParams, Customers, CustomersCursorIDPage } from "./customers.js";
|
|
6
|
+
import * as FeaturesAPI from "./features.js";
|
|
7
|
+
import { Feature, FeatureCreateParams, FeatureListParams, FeatureUpdateParams, Features, FeaturesCursorIDPage } from "./features.js";
|
|
6
8
|
import * as ProductsAPI from "./products/products.js";
|
|
7
|
-
import {
|
|
9
|
+
import { Product, ProductCreateParams, ProductListParams, ProductUpdateParams, Products, ProductsCursorIDPage } from "./products/products.js";
|
|
8
10
|
import { APIPromise } from "../../../core/api-promise.js";
|
|
9
11
|
import { RequestOptions } from "../../../internal/request-options.js";
|
|
10
12
|
export declare class Commerce extends APIResource {
|
|
11
13
|
customers: CustomersAPI.Customers;
|
|
12
14
|
products: ProductsAPI.Products;
|
|
13
15
|
coupons: CouponsAPI.Coupons;
|
|
16
|
+
features: FeaturesAPI.Features;
|
|
14
17
|
/**
|
|
15
18
|
* Cancels a customer's subscription. By default, the subscription remains active
|
|
16
19
|
* until the end of the current billing period. Set cancellation_timing to
|
|
@@ -155,10 +158,13 @@ export interface CommerceCheckoutParams {
|
|
|
155
158
|
*/
|
|
156
159
|
customer_id: string;
|
|
157
160
|
/**
|
|
158
|
-
*
|
|
159
|
-
* subscription or one-time payment.
|
|
161
|
+
* List of items to purchase. Each item specifies a variant and quantity.
|
|
160
162
|
*/
|
|
161
|
-
|
|
163
|
+
line_items: Array<CommerceCheckoutParams.LineItem>;
|
|
164
|
+
/**
|
|
165
|
+
* URL to redirect on success
|
|
166
|
+
*/
|
|
167
|
+
success_url: string;
|
|
162
168
|
/**
|
|
163
169
|
* Optional custom ID for the subscription or payment. If not provided, one will be
|
|
164
170
|
* generated.
|
|
@@ -192,15 +198,29 @@ export interface CommerceCheckoutParams {
|
|
|
192
198
|
* subscription group's configured default.
|
|
193
199
|
*/
|
|
194
200
|
proration_behavior?: 'none' | 'prorate' | 'full_difference';
|
|
201
|
+
}
|
|
202
|
+
export declare namespace CommerceCheckoutParams {
|
|
195
203
|
/**
|
|
196
|
-
*
|
|
204
|
+
* A line item in the checkout
|
|
197
205
|
*/
|
|
198
|
-
|
|
206
|
+
interface LineItem {
|
|
207
|
+
/**
|
|
208
|
+
* The variant ID to purchase. Determines pricing and whether this is a
|
|
209
|
+
* subscription or one-time payment.
|
|
210
|
+
*/
|
|
211
|
+
variant_id: string;
|
|
212
|
+
/**
|
|
213
|
+
* Quantity of this item. For subscriptions, this typically represents seat count.
|
|
214
|
+
* Defaults to 1.
|
|
215
|
+
*/
|
|
216
|
+
quantity?: number;
|
|
217
|
+
}
|
|
199
218
|
}
|
|
200
219
|
export declare namespace Commerce {
|
|
201
220
|
export { type CommerceCancelResponse as CommerceCancelResponse, type CommerceCheckResponse as CommerceCheckResponse, type CommerceCheckoutResponse as CommerceCheckoutResponse, type CommerceCancelParams as CommerceCancelParams, type CommerceCheckParams as CommerceCheckParams, type CommerceCheckoutParams as CommerceCheckoutParams, };
|
|
202
|
-
export { Customers as Customers, type
|
|
203
|
-
export { Products as Products, type
|
|
204
|
-
export { Coupons as Coupons, type
|
|
221
|
+
export { Customers as Customers, type Customer as Customer, type CustomerAddress as CustomerAddress, type CustomerBillingPortalResponse as CustomerBillingPortalResponse, type CustomerGetResponse as CustomerGetResponse, type CustomersCursorIDPage as CustomersCursorIDPage, type CustomerCreateParams as CustomerCreateParams, type CustomerUpdateParams as CustomerUpdateParams, type CustomerListParams as CustomerListParams, type CustomerBillingPortalParams as CustomerBillingPortalParams, };
|
|
222
|
+
export { Products as Products, type Product as Product, type ProductsCursorIDPage as ProductsCursorIDPage, type ProductCreateParams as ProductCreateParams, type ProductUpdateParams as ProductUpdateParams, type ProductListParams as ProductListParams, };
|
|
223
|
+
export { Coupons as Coupons, type Coupon as Coupon, type CouponsCursorIDPage as CouponsCursorIDPage, type CouponCreateParams as CouponCreateParams, type CouponUpdateParams as CouponUpdateParams, type CouponListParams as CouponListParams, };
|
|
224
|
+
export { Features as Features, type Feature as Feature, type FeaturesCursorIDPage as FeaturesCursorIDPage, type FeatureCreateParams as FeatureCreateParams, type FeatureUpdateParams as FeatureUpdateParams, type FeatureListParams as FeatureListParams, };
|
|
205
225
|
}
|
|
206
226
|
//# sourceMappingURL=commerce.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commerce.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/commerce/commerce.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EACL,kBAAkB,EAClB,
|
|
1
|
+
{"version":3,"file":"commerce.d.ts","sourceRoot":"","sources":["../../../src/resources/beta/commerce/commerce.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EACL,MAAM,EACN,kBAAkB,EAClB,gBAAgB,EAChB,kBAAkB,EAClB,OAAO,EACP,mBAAmB,EACpB;OACM,KAAK,YAAY;OACjB,EACL,QAAQ,EACR,eAAe,EACf,2BAA2B,EAC3B,6BAA6B,EAC7B,oBAAoB,EACpB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,SAAS,EACT,qBAAqB,EACtB;OACM,KAAK,WAAW;OAChB,EACL,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,oBAAoB,EACrB;OACM,KAAK,WAAW;OAChB,EACL,OAAO,EACP,mBAAmB,EACnB,iBAAiB,EACjB,mBAAmB,EACnB,QAAQ,EACR,oBAAoB,EACrB;OACM,EAAE,UAAU,EAAE;OACd,EAAE,cAAc,EAAE;AAEzB,qBAAa,QAAS,SAAQ,WAAW;IACvC,SAAS,EAAE,YAAY,CAAC,SAAS,CAA4C;IAC7E,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAA0C;IACxE,OAAO,EAAE,UAAU,CAAC,OAAO,CAAwC;IACnE,QAAQ,EAAE,WAAW,CAAC,QAAQ,CAA0C;IAExE;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,oBAAoB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,sBAAsB,CAAC;IAIhG;;;;;OAKG;IACH,KAAK,CAAC,IAAI,EAAE,mBAAmB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,qBAAqB,CAAC;IAI7F;;;;OAIG;IACH,QAAQ,CA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mB,IAAI,mBAAmB,EAC/C,KAAK,sBAAsB,IAAI,sBAAsB,GACtD,CAAC;IAEF,OAAO,EACL,SAAS,IAAI,SAAS,EACtB,KAAK,QAAQ,IAAI,QAAQ,EACzB,KAAK,eAAe,IAAI,eAAe,EACvC,KAAK,6BAA6B,IAAI,6BAA6B,EACnE,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,qBAAqB,IAAI,qBAAqB,EACnD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,2BAA2B,IAAI,2BAA2B,GAChE,CAAC;IAEF,OAAO,EACL,QAAQ,IAAI,QAAQ,EACpB,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;IAEF,OAAO,EACL,OAAO,IAAI,OAAO,EAClB,KAAK,MAAM,IAAI,MAAM,EACrB,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,kBAAkB,IAAI,kBAAkB,EAC7C,KAAK,gBAAgB,IAAI,gBAAgB,GAC1C,CAAC;IAEF,OAAO,EACL,QAAQ,IAAI,QAAQ,EACpB,KAAK,OAAO,IAAI,OAAO,EACvB,KAAK,oBAAoB,IAAI,oBAAoB,EACjD,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,mBAAmB,IAAI,mBAAmB,EAC/C,KAAK,iBAAiB,IAAI,iBAAiB,GAC5C,CAAC;CACH"}
|
|
@@ -8,6 +8,8 @@ const CouponsAPI = tslib_1.__importStar(require("./coupons.js"));
|
|
|
8
8
|
const coupons_1 = require("./coupons.js");
|
|
9
9
|
const CustomersAPI = tslib_1.__importStar(require("./customers.js"));
|
|
10
10
|
const customers_1 = require("./customers.js");
|
|
11
|
+
const FeaturesAPI = tslib_1.__importStar(require("./features.js"));
|
|
12
|
+
const features_1 = require("./features.js");
|
|
11
13
|
const ProductsAPI = tslib_1.__importStar(require("./products/products.js"));
|
|
12
14
|
const products_1 = require("./products/products.js");
|
|
13
15
|
class Commerce extends resource_1.APIResource {
|
|
@@ -16,6 +18,7 @@ class Commerce extends resource_1.APIResource {
|
|
|
16
18
|
this.customers = new CustomersAPI.Customers(this._client);
|
|
17
19
|
this.products = new ProductsAPI.Products(this._client);
|
|
18
20
|
this.coupons = new CouponsAPI.Coupons(this._client);
|
|
21
|
+
this.features = new FeaturesAPI.Features(this._client);
|
|
19
22
|
}
|
|
20
23
|
/**
|
|
21
24
|
* Cancels a customer's subscription. By default, the subscription remains active
|
|
@@ -47,4 +50,5 @@ exports.Commerce = Commerce;
|
|
|
47
50
|
Commerce.Customers = customers_1.Customers;
|
|
48
51
|
Commerce.Products = products_1.Products;
|
|
49
52
|
Commerce.Coupons = coupons_1.Coupons;
|
|
53
|
+
Commerce.Features = features_1.Features;
|
|
50
54
|
//# sourceMappingURL=commerce.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commerce.js","sourceRoot":"","sources":["../../../src/resources/beta/commerce/commerce.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AACrD,iEAAwC;AACxC,
|
|
1
|
+
{"version":3,"file":"commerce.js","sourceRoot":"","sources":["../../../src/resources/beta/commerce/commerce.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;;AAEtF,wDAAqD;AACrD,iEAAwC;AACxC,0CAOmB;AACnB,qEAA4C;AAC5C,8CAWqB;AACrB,mEAA0C;AAC1C,4CAOoB;AACpB,4EAAmD;AACnD,qDAO6B;AAI7B,MAAa,QAAS,SAAQ,sBAAW;IAAzC;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7E,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA6B1E,CAAC;IA3BC;;;;OAIG;IACH,MAAM,CAAC,IAA0B,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAyB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,IAA4B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF;AAjCD,4BAiCC;AAyND,QAAQ,CAAC,SAAS,GAAG,qBAAS,CAAC;AAC/B,QAAQ,CAAC,QAAQ,GAAG,mBAAQ,CAAC;AAC7B,QAAQ,CAAC,OAAO,GAAG,iBAAO,CAAC;AAC3B,QAAQ,CAAC,QAAQ,GAAG,mBAAQ,CAAC"}
|
|
@@ -4,6 +4,8 @@ import * as CouponsAPI from "./coupons.mjs";
|
|
|
4
4
|
import { Coupons, } from "./coupons.mjs";
|
|
5
5
|
import * as CustomersAPI from "./customers.mjs";
|
|
6
6
|
import { Customers, } from "./customers.mjs";
|
|
7
|
+
import * as FeaturesAPI from "./features.mjs";
|
|
8
|
+
import { Features, } from "./features.mjs";
|
|
7
9
|
import * as ProductsAPI from "./products/products.mjs";
|
|
8
10
|
import { Products, } from "./products/products.mjs";
|
|
9
11
|
export class Commerce extends APIResource {
|
|
@@ -12,6 +14,7 @@ export class Commerce extends APIResource {
|
|
|
12
14
|
this.customers = new CustomersAPI.Customers(this._client);
|
|
13
15
|
this.products = new ProductsAPI.Products(this._client);
|
|
14
16
|
this.coupons = new CouponsAPI.Coupons(this._client);
|
|
17
|
+
this.features = new FeaturesAPI.Features(this._client);
|
|
15
18
|
}
|
|
16
19
|
/**
|
|
17
20
|
* Cancels a customer's subscription. By default, the subscription remains active
|
|
@@ -42,4 +45,5 @@ export class Commerce extends APIResource {
|
|
|
42
45
|
Commerce.Customers = Customers;
|
|
43
46
|
Commerce.Products = Products;
|
|
44
47
|
Commerce.Coupons = Coupons;
|
|
48
|
+
Commerce.Features = Features;
|
|
45
49
|
//# sourceMappingURL=commerce.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"commerce.mjs","sourceRoot":"","sources":["../../../src/resources/beta/commerce/commerce.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,
|
|
1
|
+
{"version":3,"file":"commerce.mjs","sourceRoot":"","sources":["../../../src/resources/beta/commerce/commerce.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OACf,KAAK,UAAU;OACf,EAKL,OAAO,GAER;OACM,KAAK,YAAY;OACjB,EASL,SAAS,GAEV;OACM,KAAK,WAAW;OAChB,EAKL,QAAQ,GAET;OACM,KAAK,WAAW;OAChB,EAKL,QAAQ,GAET;AAID,MAAM,OAAO,QAAS,SAAQ,WAAW;IAAzC;;QACE,cAAS,GAA2B,IAAI,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC7E,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACxE,YAAO,GAAuB,IAAI,UAAU,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QACnE,aAAQ,GAAyB,IAAI,WAAW,CAAC,QAAQ,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IA6B1E,CAAC;IA3BC;;;;OAIG;IACH,MAAM,CAAC,IAA0B,EAAE,OAAwB;QACzD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,qBAAqB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACxE,CAAC;IAED;;;;;OAKG;IACH,KAAK,CAAC,IAAyB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,oBAAoB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACvE,CAAC;IAED;;;;OAIG;IACH,QAAQ,CAAC,IAA4B,EAAE,OAAwB;QAC7D,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,uBAAuB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAC1E,CAAC;CACF;AAyND,QAAQ,CAAC,SAAS,GAAG,SAAS,CAAC;AAC/B,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC;AAC7B,QAAQ,CAAC,OAAO,GAAG,OAAO,CAAC;AAC3B,QAAQ,CAAC,QAAQ,GAAG,QAAQ,CAAC"}
|
|
@@ -8,17 +8,17 @@ export declare class Coupons extends APIResource {
|
|
|
8
8
|
* fixed-amount discounts and can be limited by redemption count or expiration
|
|
9
9
|
* date. Customers can apply coupons during checkout.
|
|
10
10
|
*/
|
|
11
|
-
create(body: CouponCreateParams, options?: RequestOptions): APIPromise<
|
|
11
|
+
create(body: CouponCreateParams, options?: RequestOptions): APIPromise<Coupon>;
|
|
12
12
|
/**
|
|
13
13
|
* Updates an existing coupon. Use this to modify the display name or deactivate
|
|
14
14
|
* the coupon. Discount amounts and codes cannot be changed after creation.
|
|
15
15
|
*/
|
|
16
|
-
update(couponID: string, body?: CouponUpdateParams | null | undefined, options?: RequestOptions): APIPromise<
|
|
16
|
+
update(couponID: string, body?: CouponUpdateParams | null | undefined, options?: RequestOptions): APIPromise<Coupon>;
|
|
17
17
|
/**
|
|
18
18
|
* Retrieves a paginated list of all coupons. Coupons provide discounts that
|
|
19
19
|
* customers can apply during checkout using a promo code.
|
|
20
20
|
*/
|
|
21
|
-
list(query?: CouponListParams | null | undefined, options?: RequestOptions): PagePromise<
|
|
21
|
+
list(query?: CouponListParams | null | undefined, options?: RequestOptions): PagePromise<CouponsCursorIDPage, Coupon>;
|
|
22
22
|
/**
|
|
23
23
|
* Permanently deletes a coupon. The promo code can no longer be used. Existing
|
|
24
24
|
* discounts applied to active subscriptions are not affected.
|
|
@@ -28,190 +28,13 @@ export declare class Coupons extends APIResource {
|
|
|
28
28
|
* Retrieves a coupon by ID. Returns the coupon object including discount details
|
|
29
29
|
* and redemption statistics.
|
|
30
30
|
*/
|
|
31
|
-
get(couponID: string, options?: RequestOptions): APIPromise<
|
|
31
|
+
get(couponID: string, options?: RequestOptions): APIPromise<Coupon>;
|
|
32
32
|
}
|
|
33
|
-
export type
|
|
33
|
+
export type CouponsCursorIDPage = CursorIDPage<Coupon>;
|
|
34
34
|
/**
|
|
35
35
|
* A discount coupon that customers can apply during checkout using a promo code
|
|
36
36
|
*/
|
|
37
|
-
export interface
|
|
38
|
-
/**
|
|
39
|
-
* Unique identifier for the topic subscription
|
|
40
|
-
*/
|
|
41
|
-
id: string;
|
|
42
|
-
/**
|
|
43
|
-
* Whether the coupon is currently active and can be redeemed
|
|
44
|
-
*/
|
|
45
|
-
active: boolean;
|
|
46
|
-
/**
|
|
47
|
-
* The promo code customers enter to apply the discount
|
|
48
|
-
*/
|
|
49
|
-
code: string;
|
|
50
|
-
/**
|
|
51
|
-
* Timestamp when the coupon was created
|
|
52
|
-
*/
|
|
53
|
-
created: string;
|
|
54
|
-
/**
|
|
55
|
-
* How long the discount applies: once (first payment only), repeating (for
|
|
56
|
-
* duration_in_months), or forever
|
|
57
|
-
*/
|
|
58
|
-
duration: 'once' | 'repeating' | 'forever';
|
|
59
|
-
/**
|
|
60
|
-
* Number of times this coupon has been successfully redeemed
|
|
61
|
-
*/
|
|
62
|
-
times_redeemed: number;
|
|
63
|
-
/**
|
|
64
|
-
* Fixed discount amount in the smallest currency unit (e.g., cents). Mutually
|
|
65
|
-
* exclusive with percent_off.
|
|
66
|
-
*/
|
|
67
|
-
amount_off?: number | null;
|
|
68
|
-
/**
|
|
69
|
-
* Three-letter ISO currency code for amount_off discounts
|
|
70
|
-
*/
|
|
71
|
-
currency?: string | null;
|
|
72
|
-
/**
|
|
73
|
-
* Number of months the discount applies when duration is 'repeating'
|
|
74
|
-
*/
|
|
75
|
-
duration_in_months?: number | null;
|
|
76
|
-
/**
|
|
77
|
-
* Maximum number of times this coupon can be redeemed across all customers
|
|
78
|
-
*/
|
|
79
|
-
max_redemptions?: number | null;
|
|
80
|
-
/**
|
|
81
|
-
* Display name for the coupon (shown to customers)
|
|
82
|
-
*/
|
|
83
|
-
name?: string | null;
|
|
84
|
-
/**
|
|
85
|
-
* Percentage discount (1-100). Mutually exclusive with amount_off.
|
|
86
|
-
*/
|
|
87
|
-
percent_off?: number | null;
|
|
88
|
-
/**
|
|
89
|
-
* Expiration date after which the coupon can no longer be redeemed
|
|
90
|
-
*/
|
|
91
|
-
redeem_by?: string | null;
|
|
92
|
-
}
|
|
93
|
-
/**
|
|
94
|
-
* A discount coupon that customers can apply during checkout using a promo code
|
|
95
|
-
*/
|
|
96
|
-
export interface CouponUpdateResponse {
|
|
97
|
-
/**
|
|
98
|
-
* Unique identifier for the topic subscription
|
|
99
|
-
*/
|
|
100
|
-
id: string;
|
|
101
|
-
/**
|
|
102
|
-
* Whether the coupon is currently active and can be redeemed
|
|
103
|
-
*/
|
|
104
|
-
active: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* The promo code customers enter to apply the discount
|
|
107
|
-
*/
|
|
108
|
-
code: string;
|
|
109
|
-
/**
|
|
110
|
-
* Timestamp when the coupon was created
|
|
111
|
-
*/
|
|
112
|
-
created: string;
|
|
113
|
-
/**
|
|
114
|
-
* How long the discount applies: once (first payment only), repeating (for
|
|
115
|
-
* duration_in_months), or forever
|
|
116
|
-
*/
|
|
117
|
-
duration: 'once' | 'repeating' | 'forever';
|
|
118
|
-
/**
|
|
119
|
-
* Number of times this coupon has been successfully redeemed
|
|
120
|
-
*/
|
|
121
|
-
times_redeemed: number;
|
|
122
|
-
/**
|
|
123
|
-
* Fixed discount amount in the smallest currency unit (e.g., cents). Mutually
|
|
124
|
-
* exclusive with percent_off.
|
|
125
|
-
*/
|
|
126
|
-
amount_off?: number | null;
|
|
127
|
-
/**
|
|
128
|
-
* Three-letter ISO currency code for amount_off discounts
|
|
129
|
-
*/
|
|
130
|
-
currency?: string | null;
|
|
131
|
-
/**
|
|
132
|
-
* Number of months the discount applies when duration is 'repeating'
|
|
133
|
-
*/
|
|
134
|
-
duration_in_months?: number | null;
|
|
135
|
-
/**
|
|
136
|
-
* Maximum number of times this coupon can be redeemed across all customers
|
|
137
|
-
*/
|
|
138
|
-
max_redemptions?: number | null;
|
|
139
|
-
/**
|
|
140
|
-
* Display name for the coupon (shown to customers)
|
|
141
|
-
*/
|
|
142
|
-
name?: string | null;
|
|
143
|
-
/**
|
|
144
|
-
* Percentage discount (1-100). Mutually exclusive with amount_off.
|
|
145
|
-
*/
|
|
146
|
-
percent_off?: number | null;
|
|
147
|
-
/**
|
|
148
|
-
* Expiration date after which the coupon can no longer be redeemed
|
|
149
|
-
*/
|
|
150
|
-
redeem_by?: string | null;
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* A discount coupon that customers can apply during checkout using a promo code
|
|
154
|
-
*/
|
|
155
|
-
export interface CouponListResponse {
|
|
156
|
-
/**
|
|
157
|
-
* Unique identifier for the topic subscription
|
|
158
|
-
*/
|
|
159
|
-
id: string;
|
|
160
|
-
/**
|
|
161
|
-
* Whether the coupon is currently active and can be redeemed
|
|
162
|
-
*/
|
|
163
|
-
active: boolean;
|
|
164
|
-
/**
|
|
165
|
-
* The promo code customers enter to apply the discount
|
|
166
|
-
*/
|
|
167
|
-
code: string;
|
|
168
|
-
/**
|
|
169
|
-
* Timestamp when the coupon was created
|
|
170
|
-
*/
|
|
171
|
-
created: string;
|
|
172
|
-
/**
|
|
173
|
-
* How long the discount applies: once (first payment only), repeating (for
|
|
174
|
-
* duration_in_months), or forever
|
|
175
|
-
*/
|
|
176
|
-
duration: 'once' | 'repeating' | 'forever';
|
|
177
|
-
/**
|
|
178
|
-
* Number of times this coupon has been successfully redeemed
|
|
179
|
-
*/
|
|
180
|
-
times_redeemed: number;
|
|
181
|
-
/**
|
|
182
|
-
* Fixed discount amount in the smallest currency unit (e.g., cents). Mutually
|
|
183
|
-
* exclusive with percent_off.
|
|
184
|
-
*/
|
|
185
|
-
amount_off?: number | null;
|
|
186
|
-
/**
|
|
187
|
-
* Three-letter ISO currency code for amount_off discounts
|
|
188
|
-
*/
|
|
189
|
-
currency?: string | null;
|
|
190
|
-
/**
|
|
191
|
-
* Number of months the discount applies when duration is 'repeating'
|
|
192
|
-
*/
|
|
193
|
-
duration_in_months?: number | null;
|
|
194
|
-
/**
|
|
195
|
-
* Maximum number of times this coupon can be redeemed across all customers
|
|
196
|
-
*/
|
|
197
|
-
max_redemptions?: number | null;
|
|
198
|
-
/**
|
|
199
|
-
* Display name for the coupon (shown to customers)
|
|
200
|
-
*/
|
|
201
|
-
name?: string | null;
|
|
202
|
-
/**
|
|
203
|
-
* Percentage discount (1-100). Mutually exclusive with amount_off.
|
|
204
|
-
*/
|
|
205
|
-
percent_off?: number | null;
|
|
206
|
-
/**
|
|
207
|
-
* Expiration date after which the coupon can no longer be redeemed
|
|
208
|
-
*/
|
|
209
|
-
redeem_by?: string | null;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* A discount coupon that customers can apply during checkout using a promo code
|
|
213
|
-
*/
|
|
214
|
-
export interface CouponGetResponse {
|
|
37
|
+
export interface Coupon {
|
|
215
38
|
/**
|
|
216
39
|
* Unique identifier for the topic subscription
|
|
217
40
|
*/
|
|
@@ -329,6 +152,6 @@ export interface CouponListParams extends CursorIDPageParams {
|
|
|
329
152
|
active?: boolean;
|
|
330
153
|
}
|
|
331
154
|
export declare namespace Coupons {
|
|
332
|
-
export { type
|
|
155
|
+
export { type Coupon as Coupon, type CouponsCursorIDPage as CouponsCursorIDPage, type CouponCreateParams as CouponCreateParams, type CouponUpdateParams as CouponUpdateParams, type CouponListParams as CouponListParams, };
|
|
333
156
|
}
|
|
334
157
|
//# sourceMappingURL=coupons.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"coupons.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/commerce/coupons.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE;OAEtD,EAAE,cAAc,EAAE;AAGzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,
|
|
1
|
+
{"version":3,"file":"coupons.d.mts","sourceRoot":"","sources":["../../../src/resources/beta/commerce/coupons.ts"],"names":[],"mappings":"OAEO,EAAE,WAAW,EAAE;OACf,EAAE,UAAU,EAAE;OACd,EAAE,YAAY,EAAE,KAAK,kBAAkB,EAAE,WAAW,EAAE;OAEtD,EAAE,cAAc,EAAE;AAGzB,qBAAa,OAAQ,SAAQ,WAAW;IACtC;;;;OAIG;IACH,MAAM,CAAC,IAAI,EAAE,kBAAkB,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,UAAU,CAAC,MAAM,CAAC;IAI9E;;;OAGG;IACH,MAAM,CAC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