@chrt-inc/typescript-sdk 1.647.0 → 1.651.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 (61) hide show
  1. package/README.md +8 -8
  2. package/dist/cjs/Client.js +2 -2
  3. package/dist/cjs/api/resources/billing/resources/rateSheetMappings/client/Client.d.ts +19 -0
  4. package/dist/cjs/api/resources/billing/resources/rateSheetMappings/client/Client.js +79 -0
  5. package/dist/cjs/api/resources/billing/resources/rateSheetMappings/client/requests/RateSheetMappingsListRateSheetIdsByCounterpartyV1Request.d.ts +18 -0
  6. package/dist/cjs/api/resources/billing/resources/rateSheetMappings/client/requests/index.d.ts +1 -0
  7. package/dist/cjs/api/resources/billing/resources/stripe/client/Client.d.ts +7 -6
  8. package/dist/cjs/api/resources/billing/resources/stripe/client/Client.js +11 -10
  9. package/dist/cjs/api/resources/billing/resources/stripe/client/requests/CreateCheckoutSessionReq.d.ts +4 -3
  10. package/dist/cjs/api/resources/orgs/client/Client.d.ts +5 -5
  11. package/dist/cjs/api/resources/orgs/client/Client.js +8 -8
  12. package/dist/cjs/api/resources/orgs/{resources/publicData/client/requests/CreateOrgPublicDataReq.d.ts → client/requests/SetupOrgReq.d.ts} +6 -2
  13. package/dist/cjs/api/resources/orgs/client/requests/index.d.ts +1 -1
  14. package/dist/cjs/api/resources/orgs/resources/publicData/client/Client.d.ts +0 -13
  15. package/dist/cjs/api/resources/orgs/resources/publicData/client/Client.js +0 -62
  16. package/dist/cjs/api/resources/orgs/resources/publicData/client/requests/index.d.ts +0 -1
  17. package/dist/cjs/api/types/CreateCustomerPortalSessionRes.d.ts +6 -0
  18. package/dist/cjs/api/types/OrgPrivateData1.d.ts +1 -0
  19. package/dist/cjs/api/types/UserPrivateData1.d.ts +0 -1
  20. package/dist/cjs/api/types/index.d.ts +1 -2
  21. package/dist/cjs/api/types/index.js +1 -2
  22. package/dist/cjs/version.d.ts +1 -1
  23. package/dist/cjs/version.js +1 -1
  24. package/dist/esm/Client.mjs +2 -2
  25. package/dist/esm/api/resources/billing/resources/rateSheetMappings/client/Client.d.mts +19 -0
  26. package/dist/esm/api/resources/billing/resources/rateSheetMappings/client/Client.mjs +79 -0
  27. package/dist/esm/api/resources/billing/resources/rateSheetMappings/client/requests/RateSheetMappingsListRateSheetIdsByCounterpartyV1Request.d.mts +18 -0
  28. package/dist/esm/api/resources/billing/resources/rateSheetMappings/client/requests/index.d.mts +1 -0
  29. package/dist/esm/api/resources/billing/resources/stripe/client/Client.d.mts +7 -6
  30. package/dist/esm/api/resources/billing/resources/stripe/client/Client.mjs +11 -10
  31. package/dist/esm/api/resources/billing/resources/stripe/client/requests/CreateCheckoutSessionReq.d.mts +4 -3
  32. package/dist/esm/api/resources/orgs/client/Client.d.mts +5 -5
  33. package/dist/esm/api/resources/orgs/client/Client.mjs +8 -8
  34. package/dist/esm/api/resources/orgs/{resources/publicData/client/requests/CreateOrgPublicDataReq.d.mts → client/requests/SetupOrgReq.d.mts} +6 -2
  35. package/dist/esm/api/resources/orgs/client/requests/index.d.mts +1 -1
  36. package/dist/esm/api/resources/orgs/resources/publicData/client/Client.d.mts +0 -13
  37. package/dist/esm/api/resources/orgs/resources/publicData/client/Client.mjs +0 -62
  38. package/dist/esm/api/resources/orgs/resources/publicData/client/requests/index.d.mts +0 -1
  39. package/dist/esm/api/types/CreateCustomerPortalSessionRes.d.mts +6 -0
  40. package/dist/esm/api/types/OrgPrivateData1.d.mts +1 -0
  41. package/dist/esm/api/types/UserPrivateData1.d.mts +0 -1
  42. package/dist/esm/api/types/index.d.mts +1 -2
  43. package/dist/esm/api/types/index.mjs +1 -2
  44. package/dist/esm/version.d.mts +1 -1
  45. package/dist/esm/version.mjs +1 -1
  46. package/package.json +1 -1
  47. package/reference.md +86 -72
  48. package/dist/cjs/api/resources/orgs/client/requests/SetOrgTypeReq.d.ts +0 -13
  49. package/dist/cjs/api/types/CreateOrgPublicDataRes.d.ts +0 -7
  50. package/dist/cjs/api/types/PriceNameEnum.d.ts +0 -9
  51. package/dist/cjs/api/types/PriceNameEnum.js +0 -11
  52. package/dist/esm/api/resources/orgs/client/requests/SetOrgTypeReq.d.mts +0 -13
  53. package/dist/esm/api/types/CreateOrgPublicDataRes.d.mts +0 -7
  54. package/dist/esm/api/types/PriceNameEnum.d.mts +0 -9
  55. package/dist/esm/api/types/PriceNameEnum.mjs +0 -8
  56. /package/dist/cjs/api/resources/{orgs/client/requests/SetOrgTypeReq.js → billing/resources/rateSheetMappings/client/requests/RateSheetMappingsListRateSheetIdsByCounterpartyV1Request.js} +0 -0
  57. /package/dist/cjs/api/resources/orgs/{resources/publicData/client/requests/CreateOrgPublicDataReq.js → client/requests/SetupOrgReq.js} +0 -0
  58. /package/dist/cjs/api/types/{CreateOrgPublicDataRes.js → CreateCustomerPortalSessionRes.js} +0 -0
  59. /package/dist/esm/api/resources/{orgs/client/requests/SetOrgTypeReq.mjs → billing/resources/rateSheetMappings/client/requests/RateSheetMappingsListRateSheetIdsByCounterpartyV1Request.mjs} +0 -0
  60. /package/dist/esm/api/resources/orgs/{resources/publicData/client/requests/CreateOrgPublicDataReq.mjs → client/requests/SetupOrgReq.mjs} +0 -0
  61. /package/dist/esm/api/types/{CreateOrgPublicDataRes.mjs → CreateCustomerPortalSessionRes.mjs} +0 -0
package/README.md CHANGED
@@ -41,7 +41,7 @@ Instantiate and use the client with the following:
41
41
  import { ChrtClient } from "@chrt-inc/typescript-sdk";
42
42
 
43
43
  const client = new ChrtClient({ token: "YOUR_TOKEN" });
44
- await client.orgs.setOrgTypeV1({
44
+ await client.orgs.setupOrgV1({
45
45
  org_type: "provider",
46
46
  });
47
47
  ```
@@ -68,7 +68,7 @@ will be thrown.
68
68
  import { ChrtError } from "@chrt-inc/typescript-sdk";
69
69
 
70
70
  try {
71
- await client.orgs.setOrgTypeV1(...);
71
+ await client.orgs.setupOrgV1(...);
72
72
  } catch (err) {
73
73
  if (err instanceof ChrtError) {
74
74
  console.log(err.statusCode);
@@ -476,7 +476,7 @@ const text = new TextDecoder().decode(bytes);
476
476
  If you would like to send additional headers as part of the request, use the `headers` request option.
477
477
 
478
478
  ```typescript
479
- const response = await client.orgs.setOrgTypeV1(..., {
479
+ const response = await client.orgs.setupOrgV1(..., {
480
480
  headers: {
481
481
  'X-Custom-Header': 'custom value'
482
482
  }
@@ -488,7 +488,7 @@ const response = await client.orgs.setOrgTypeV1(..., {
488
488
  If you would like to send additional query string parameters as part of the request, use the `queryParams` request option.
489
489
 
490
490
  ```typescript
491
- const response = await client.orgs.setOrgTypeV1(..., {
491
+ const response = await client.orgs.setupOrgV1(..., {
492
492
  queryParams: {
493
493
  'customQueryParamKey': 'custom query param value'
494
494
  }
@@ -510,7 +510,7 @@ A request is deemed retryable when any of the following HTTP status codes is ret
510
510
  Use the `maxRetries` request option to configure this behavior.
511
511
 
512
512
  ```typescript
513
- const response = await client.orgs.setOrgTypeV1(..., {
513
+ const response = await client.orgs.setupOrgV1(..., {
514
514
  maxRetries: 0 // override maxRetries at the request level
515
515
  });
516
516
  ```
@@ -520,7 +520,7 @@ const response = await client.orgs.setOrgTypeV1(..., {
520
520
  The SDK defaults to a 60 second timeout. Use the `timeoutInSeconds` option to configure this behavior.
521
521
 
522
522
  ```typescript
523
- const response = await client.orgs.setOrgTypeV1(..., {
523
+ const response = await client.orgs.setupOrgV1(..., {
524
524
  timeoutInSeconds: 30 // override timeout to 30s
525
525
  });
526
526
  ```
@@ -531,7 +531,7 @@ The SDK allows users to abort requests at any point by passing in an abort signa
531
531
 
532
532
  ```typescript
533
533
  const controller = new AbortController();
534
- const response = await client.orgs.setOrgTypeV1(..., {
534
+ const response = await client.orgs.setupOrgV1(..., {
535
535
  abortSignal: controller.signal
536
536
  });
537
537
  controller.abort(); // aborts the request
@@ -543,7 +543,7 @@ The SDK provides access to raw response data, including headers, through the `.w
543
543
  The `.withRawResponse()` method returns a promise that results to an object with a `data` and a `rawResponse` property.
544
544
 
545
545
  ```typescript
546
- const { data, rawResponse } = await client.orgs.setOrgTypeV1(...).withRawResponse();
546
+ const { data, rawResponse } = await client.orgs.setupOrgV1(...).withRawResponse();
547
547
 
548
548
  console.log(data);
549
549
  console.log(rawResponse.headers['X-My-Header']);
@@ -56,8 +56,8 @@ class ChrtClient {
56
56
  this._options = Object.assign(Object.assign({}, _options), { headers: (0, headers_js_1.mergeHeaders)({
57
57
  "X-Fern-Language": "JavaScript",
58
58
  "X-Fern-SDK-Name": "@chrt-inc/typescript-sdk",
59
- "X-Fern-SDK-Version": "1.647.0",
60
- "User-Agent": "@chrt-inc/typescript-sdk/1.647.0",
59
+ "X-Fern-SDK-Version": "1.651.0",
60
+ "User-Agent": "@chrt-inc/typescript-sdk/1.651.0",
61
61
  "X-Fern-Runtime": core.RUNTIME.type,
62
62
  "X-Fern-Runtime-Version": core.RUNTIME.version,
63
63
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });
@@ -59,6 +59,25 @@ export declare class RateSheetMappings {
59
59
  */
60
60
  listV1(request?: Chrt.billing.RateSheetMappingsListV1Request, requestOptions?: RateSheetMappings.RequestOptions): core.HttpResponsePromise<Chrt.RateSheetMappingListRes>;
61
61
  private __listV1;
62
+ /**
63
+ * Lists rate sheet IDs mapped to a counterparty for the requested task group type. | authz: allowed_org_types=[provider], min_org_role=operator | () -> (list[PydanticObjectId])
64
+ *
65
+ * @param {Chrt.TaskGroupTypeEnum1} tgType
66
+ * @param {Chrt.billing.RateSheetMappingsListRateSheetIdsByCounterpartyV1Request} request
67
+ * @param {RateSheetMappings.RequestOptions} requestOptions - Request-specific configuration.
68
+ *
69
+ * @throws {@link Chrt.UnprocessableEntityError}
70
+ *
71
+ * @example
72
+ * await client.billing.rateSheetMappings.listRateSheetIdsByCounterpartyV1("chrt_ground_provider", {
73
+ * counterparty_org_id: "counterparty_org_id",
74
+ * counterparty_driver_id: "counterparty_driver_id",
75
+ * counterparty_off_chrt_provider_org_id: "counterparty_off_chrt_provider_org_id",
76
+ * counterparty_off_chrt_shipper_org_id: "counterparty_off_chrt_shipper_org_id"
77
+ * })
78
+ */
79
+ listRateSheetIdsByCounterpartyV1(tgType: Chrt.TaskGroupTypeEnum1, request?: Chrt.billing.RateSheetMappingsListRateSheetIdsByCounterpartyV1Request, requestOptions?: RateSheetMappings.RequestOptions): core.HttpResponsePromise<string[]>;
80
+ private __listRateSheetIdsByCounterpartyV1;
62
81
  /**
63
82
  * Creates a rate sheet mapping owned by the caller's org. The caller becomes `owned_by_org_id`. Body must set exactly one of `counterparty_org_id` / `counterparty_driver_id` (XOR). | authz: allowed_org_types=[provider], min_org_role=operator | (RateSheetMappingClientCreate1) -> (PydanticObjectId)
64
83
  *
@@ -184,6 +184,85 @@ class RateSheetMappings {
184
184
  }
185
185
  });
186
186
  }
187
+ /**
188
+ * Lists rate sheet IDs mapped to a counterparty for the requested task group type. | authz: allowed_org_types=[provider], min_org_role=operator | () -> (list[PydanticObjectId])
189
+ *
190
+ * @param {Chrt.TaskGroupTypeEnum1} tgType
191
+ * @param {Chrt.billing.RateSheetMappingsListRateSheetIdsByCounterpartyV1Request} request
192
+ * @param {RateSheetMappings.RequestOptions} requestOptions - Request-specific configuration.
193
+ *
194
+ * @throws {@link Chrt.UnprocessableEntityError}
195
+ *
196
+ * @example
197
+ * await client.billing.rateSheetMappings.listRateSheetIdsByCounterpartyV1("chrt_ground_provider", {
198
+ * counterparty_org_id: "counterparty_org_id",
199
+ * counterparty_driver_id: "counterparty_driver_id",
200
+ * counterparty_off_chrt_provider_org_id: "counterparty_off_chrt_provider_org_id",
201
+ * counterparty_off_chrt_shipper_org_id: "counterparty_off_chrt_shipper_org_id"
202
+ * })
203
+ */
204
+ listRateSheetIdsByCounterpartyV1(tgType, request = {}, requestOptions) {
205
+ return core.HttpResponsePromise.fromPromise(this.__listRateSheetIdsByCounterpartyV1(tgType, request, requestOptions));
206
+ }
207
+ __listRateSheetIdsByCounterpartyV1(tgType_1) {
208
+ return __awaiter(this, arguments, void 0, function* (tgType, request = {}, requestOptions) {
209
+ var _a, _b, _c, _d;
210
+ const { counterparty_org_id: counterpartyOrgId, counterparty_driver_id: counterpartyDriverId, counterparty_off_chrt_provider_org_id: counterpartyOffChrtProviderOrgId, counterparty_off_chrt_shipper_org_id: counterpartyOffChrtShipperOrgId, } = request;
211
+ const _queryParams = {};
212
+ if (counterpartyOrgId !== undefined) {
213
+ _queryParams["counterparty_org_id"] = counterpartyOrgId;
214
+ }
215
+ if (counterpartyDriverId !== undefined) {
216
+ _queryParams["counterparty_driver_id"] = counterpartyDriverId;
217
+ }
218
+ if (counterpartyOffChrtProviderOrgId !== undefined) {
219
+ _queryParams["counterparty_off_chrt_provider_org_id"] = counterpartyOffChrtProviderOrgId;
220
+ }
221
+ if (counterpartyOffChrtShipperOrgId !== undefined) {
222
+ _queryParams["counterparty_off_chrt_shipper_org_id"] = counterpartyOffChrtShipperOrgId;
223
+ }
224
+ let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
225
+ const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
226
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, `billing/rate_sheet_mappings/rate_sheet_ids/by_counterparty/v1/${encodeURIComponent(tgType)}`),
227
+ method: "GET",
228
+ headers: _headers,
229
+ queryParameters: Object.assign(Object.assign({}, _queryParams), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams),
230
+ timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
231
+ maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
232
+ abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
233
+ });
234
+ if (_response.ok) {
235
+ return { data: _response.body, rawResponse: _response.rawResponse };
236
+ }
237
+ if (_response.error.reason === "status-code") {
238
+ switch (_response.error.statusCode) {
239
+ case 422:
240
+ throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
241
+ default:
242
+ throw new errors.ChrtError({
243
+ statusCode: _response.error.statusCode,
244
+ body: _response.error.body,
245
+ rawResponse: _response.rawResponse,
246
+ });
247
+ }
248
+ }
249
+ switch (_response.error.reason) {
250
+ case "non-json":
251
+ throw new errors.ChrtError({
252
+ statusCode: _response.error.statusCode,
253
+ body: _response.error.rawBody,
254
+ rawResponse: _response.rawResponse,
255
+ });
256
+ case "timeout":
257
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /billing/rate_sheet_mappings/rate_sheet_ids/by_counterparty/v1/{tg_type}.");
258
+ case "unknown":
259
+ throw new errors.ChrtError({
260
+ message: _response.error.errorMessage,
261
+ rawResponse: _response.rawResponse,
262
+ });
263
+ }
264
+ });
265
+ }
187
266
  /**
188
267
  * Creates a rate sheet mapping owned by the caller's org. The caller becomes `owned_by_org_id`. Body must set exactly one of `counterparty_org_id` / `counterparty_driver_id` (XOR). | authz: allowed_org_types=[provider], min_org_role=operator | (RateSheetMappingClientCreate1) -> (PydanticObjectId)
189
268
  *
@@ -0,0 +1,18 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ /**
5
+ * @example
6
+ * {
7
+ * counterparty_org_id: "counterparty_org_id",
8
+ * counterparty_driver_id: "counterparty_driver_id",
9
+ * counterparty_off_chrt_provider_org_id: "counterparty_off_chrt_provider_org_id",
10
+ * counterparty_off_chrt_shipper_org_id: "counterparty_off_chrt_shipper_org_id"
11
+ * }
12
+ */
13
+ export interface RateSheetMappingsListRateSheetIdsByCounterpartyV1Request {
14
+ counterparty_org_id?: string | null;
15
+ counterparty_driver_id?: string | null;
16
+ counterparty_off_chrt_provider_org_id?: string | null;
17
+ counterparty_off_chrt_shipper_org_id?: string | null;
18
+ }
@@ -1,2 +1,3 @@
1
1
  export { type RateSheetMappingsListV1Request } from "./RateSheetMappingsListV1Request.js";
2
+ export { type RateSheetMappingsListRateSheetIdsByCounterpartyV1Request } from "./RateSheetMappingsListRateSheetIdsByCounterpartyV1Request.js";
2
3
  export { type RateSheetMappingClientCreate1 } from "./RateSheetMappingClientCreate1.js";
@@ -31,7 +31,7 @@ export declare class Stripe {
31
31
  protected readonly _options: Stripe.Options;
32
32
  constructor(_options?: Stripe.Options);
33
33
  /**
34
- * Creates a Stripe checkout session for a subscription with pricing based on the selected plan. | (CreateCheckoutSessionReq) -> (CreateCheckoutSessionRes)
34
+ * Creates a Stripe checkout session for a subscription against the Stripe product+price chosen by the frontend. Stripe rejects unknown/archived/mode-mismatched price IDs. Returns 409 `use_create_customer_portal_session` if the org already has an active subscription in Stripe (source of truth -- bypasses any JWT staleness). FE should route those users to POST /billing/create-customer-portal-session/v1 to manage. authz: allowed_org_types=[provider] (shippers cannot subscribe -- they are never gated, paying would be a no-op), min_org_role=administrator (committing the company to recurring charges is a finance decision, not an operator one). | (CreateCheckoutSessionReq) -> (CreateCheckoutSessionRes)
35
35
  *
36
36
  * @param {Chrt.billing.CreateCheckoutSessionReq} request
37
37
  * @param {Stripe.RequestOptions} requestOptions - Request-specific configuration.
@@ -40,20 +40,21 @@ export declare class Stripe {
40
40
  *
41
41
  * @example
42
42
  * await client.billing.stripe.createCheckoutSessionV1({
43
- * price_name: "courier_ops_100_usd_per_month"
43
+ * product_id: "product_id",
44
+ * price_id: "price_id"
44
45
  * })
45
46
  */
46
47
  createCheckoutSessionV1(request: Chrt.billing.CreateCheckoutSessionReq, requestOptions?: Stripe.RequestOptions): core.HttpResponsePromise<Chrt.CreateCheckoutSessionRes>;
47
48
  private __createCheckoutSessionV1;
48
49
  /**
49
- * Synchronizes subscription data from Stripe to the authentication service for the current user. | () -> (bool)
50
+ * Creates a Stripe customer-portal session so the org's admin can self-serve update card / view invoices / cancel subscription. authz: allowed_org_types=[provider], min_org_role=administrator (same gate as create-checkout-session — cancelling/updating-card has the same financial weight as subscribing). Returns 404 `use_create_checkout_session` if the org has no Stripe customer. POST /billing/create-checkout-session/v1 first. | (no body) -> (CreateCustomerPortalSessionRes)
50
51
  *
51
52
  * @param {Stripe.RequestOptions} requestOptions - Request-specific configuration.
52
53
  *
53
54
  * @example
54
- * await client.billing.stripe.syncStripeToClerkV1()
55
+ * await client.billing.stripe.createCustomerPortalSessionV1()
55
56
  */
56
- syncStripeToClerkV1(requestOptions?: Stripe.RequestOptions): core.HttpResponsePromise<boolean>;
57
- private __syncStripeToClerkV1;
57
+ createCustomerPortalSessionV1(requestOptions?: Stripe.RequestOptions): core.HttpResponsePromise<Chrt.CreateCustomerPortalSessionRes>;
58
+ private __createCustomerPortalSessionV1;
58
59
  protected _getAuthorizationHeader(): Promise<string | undefined>;
59
60
  }
@@ -56,7 +56,7 @@ class Stripe {
56
56
  this._options = _options;
57
57
  }
58
58
  /**
59
- * Creates a Stripe checkout session for a subscription with pricing based on the selected plan. | (CreateCheckoutSessionReq) -> (CreateCheckoutSessionRes)
59
+ * Creates a Stripe checkout session for a subscription against the Stripe product+price chosen by the frontend. Stripe rejects unknown/archived/mode-mismatched price IDs. Returns 409 `use_create_customer_portal_session` if the org already has an active subscription in Stripe (source of truth -- bypasses any JWT staleness). FE should route those users to POST /billing/create-customer-portal-session/v1 to manage. authz: allowed_org_types=[provider] (shippers cannot subscribe -- they are never gated, paying would be a no-op), min_org_role=administrator (committing the company to recurring charges is a finance decision, not an operator one). | (CreateCheckoutSessionReq) -> (CreateCheckoutSessionRes)
60
60
  *
61
61
  * @param {Chrt.billing.CreateCheckoutSessionReq} request
62
62
  * @param {Stripe.RequestOptions} requestOptions - Request-specific configuration.
@@ -65,7 +65,8 @@ class Stripe {
65
65
  *
66
66
  * @example
67
67
  * await client.billing.stripe.createCheckoutSessionV1({
68
- * price_name: "courier_ops_100_usd_per_month"
68
+ * product_id: "product_id",
69
+ * price_id: "price_id"
69
70
  * })
70
71
  */
71
72
  createCheckoutSessionV1(request, requestOptions) {
@@ -120,23 +121,23 @@ class Stripe {
120
121
  });
121
122
  }
122
123
  /**
123
- * Synchronizes subscription data from Stripe to the authentication service for the current user. | () -> (bool)
124
+ * Creates a Stripe customer-portal session so the org's admin can self-serve update card / view invoices / cancel subscription. authz: allowed_org_types=[provider], min_org_role=administrator (same gate as create-checkout-session — cancelling/updating-card has the same financial weight as subscribing). Returns 404 `use_create_checkout_session` if the org has no Stripe customer. POST /billing/create-checkout-session/v1 first. | (no body) -> (CreateCustomerPortalSessionRes)
124
125
  *
125
126
  * @param {Stripe.RequestOptions} requestOptions - Request-specific configuration.
126
127
  *
127
128
  * @example
128
- * await client.billing.stripe.syncStripeToClerkV1()
129
+ * await client.billing.stripe.createCustomerPortalSessionV1()
129
130
  */
130
- syncStripeToClerkV1(requestOptions) {
131
- return core.HttpResponsePromise.fromPromise(this.__syncStripeToClerkV1(requestOptions));
131
+ createCustomerPortalSessionV1(requestOptions) {
132
+ return core.HttpResponsePromise.fromPromise(this.__createCustomerPortalSessionV1(requestOptions));
132
133
  }
133
- __syncStripeToClerkV1(requestOptions) {
134
+ __createCustomerPortalSessionV1(requestOptions) {
134
135
  return __awaiter(this, void 0, void 0, function* () {
135
136
  var _a, _b, _c, _d;
136
137
  let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
137
138
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
138
- url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "billing/sync_stripe_to_clerk/v1"),
139
- method: "GET",
139
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "billing/create-customer-portal-session/v1"),
140
+ method: "POST",
140
141
  headers: _headers,
141
142
  queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
142
143
  timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
@@ -161,7 +162,7 @@ class Stripe {
161
162
  rawResponse: _response.rawResponse,
162
163
  });
163
164
  case "timeout":
164
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling GET /billing/sync_stripe_to_clerk/v1.");
165
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /billing/create-customer-portal-session/v1.");
165
166
  case "unknown":
166
167
  throw new errors.ChrtError({
167
168
  message: _response.error.errorMessage,
@@ -1,13 +1,14 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
- import * as Chrt from "../../../../../../index.js";
5
4
  /**
6
5
  * @example
7
6
  * {
8
- * price_name: "courier_ops_100_usd_per_month"
7
+ * product_id: "product_id",
8
+ * price_id: "price_id"
9
9
  * }
10
10
  */
11
11
  export interface CreateCheckoutSessionReq {
12
- price_name: Chrt.PriceNameEnum;
12
+ product_id: string;
13
+ price_id: string;
13
14
  }
@@ -81,20 +81,20 @@ export declare class Orgs {
81
81
  listMembersV1(request?: Chrt.OrgsListMembersV1Request, requestOptions?: Orgs.RequestOptions): core.HttpResponsePromise<Chrt.OrgMemberListRes>;
82
82
  private __listMembersV1;
83
83
  /**
84
- * Sets the org_type in Clerk's JWT public metadata. Returns True if already set and matching, sets it if not present, or raises exception if conflicting. | (SetOrgTypeReq) -> (bool)
84
+ * Single onboarding entry point. Sets `org_type` in Clerk's JWT public metadata (immutable once set) and idempotently creates `org_private_data` + `org_public_data` for the caller's organization. Optional `handle` and `company_name` populate the public doc on first call; later updates go through PATCH /orgs/org_public_data/v1. Returns True on success (including idempotent retries), 400 on org_type conflict or handle collision. | (SetupOrgReq) -> (bool)
85
85
  *
86
- * @param {Chrt.SetOrgTypeReq} request
86
+ * @param {Chrt.SetupOrgReq} request
87
87
  * @param {Orgs.RequestOptions} requestOptions - Request-specific configuration.
88
88
  *
89
89
  * @throws {@link Chrt.UnprocessableEntityError}
90
90
  *
91
91
  * @example
92
- * await client.orgs.setOrgTypeV1({
92
+ * await client.orgs.setupOrgV1({
93
93
  * org_type: "provider"
94
94
  * })
95
95
  */
96
- setOrgTypeV1(request: Chrt.SetOrgTypeReq, requestOptions?: Orgs.RequestOptions): core.HttpResponsePromise<boolean>;
97
- private __setOrgTypeV1;
96
+ setupOrgV1(request: Chrt.SetupOrgReq, requestOptions?: Orgs.RequestOptions): core.HttpResponsePromise<boolean>;
97
+ private __setupOrgV1;
98
98
  /**
99
99
  * Retrieves the Stripe Connect account ID for the caller's organization. Returns 404 if not set. | () -> (str)
100
100
  *
@@ -232,27 +232,27 @@ class Orgs {
232
232
  });
233
233
  }
234
234
  /**
235
- * Sets the org_type in Clerk's JWT public metadata. Returns True if already set and matching, sets it if not present, or raises exception if conflicting. | (SetOrgTypeReq) -> (bool)
235
+ * Single onboarding entry point. Sets `org_type` in Clerk's JWT public metadata (immutable once set) and idempotently creates `org_private_data` + `org_public_data` for the caller's organization. Optional `handle` and `company_name` populate the public doc on first call; later updates go through PATCH /orgs/org_public_data/v1. Returns True on success (including idempotent retries), 400 on org_type conflict or handle collision. | (SetupOrgReq) -> (bool)
236
236
  *
237
- * @param {Chrt.SetOrgTypeReq} request
237
+ * @param {Chrt.SetupOrgReq} request
238
238
  * @param {Orgs.RequestOptions} requestOptions - Request-specific configuration.
239
239
  *
240
240
  * @throws {@link Chrt.UnprocessableEntityError}
241
241
  *
242
242
  * @example
243
- * await client.orgs.setOrgTypeV1({
243
+ * await client.orgs.setupOrgV1({
244
244
  * org_type: "provider"
245
245
  * })
246
246
  */
247
- setOrgTypeV1(request, requestOptions) {
248
- return core.HttpResponsePromise.fromPromise(this.__setOrgTypeV1(request, requestOptions));
247
+ setupOrgV1(request, requestOptions) {
248
+ return core.HttpResponsePromise.fromPromise(this.__setupOrgV1(request, requestOptions));
249
249
  }
250
- __setOrgTypeV1(request, requestOptions) {
250
+ __setupOrgV1(request, requestOptions) {
251
251
  return __awaiter(this, void 0, void 0, function* () {
252
252
  var _a, _b, _c, _d;
253
253
  let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
254
254
  const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
255
- url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "orgs/set_org_type/v1"),
255
+ url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "orgs/setup_org/v1"),
256
256
  method: "POST",
257
257
  headers: _headers,
258
258
  contentType: "application/json",
@@ -286,7 +286,7 @@ class Orgs {
286
286
  rawResponse: _response.rawResponse,
287
287
  });
288
288
  case "timeout":
289
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /orgs/set_org_type/v1.");
289
+ throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /orgs/setup_org/v1.");
290
290
  case "unknown":
291
291
  throw new errors.ChrtError({
292
292
  message: _response.error.errorMessage,
@@ -1,11 +1,15 @@
1
1
  /**
2
2
  * This file was auto-generated by Fern from our API Definition.
3
3
  */
4
+ import * as Chrt from "../../../../index.js";
4
5
  /**
5
6
  * @example
6
- * {}
7
+ * {
8
+ * org_type: "provider"
9
+ * }
7
10
  */
8
- export interface CreateOrgPublicDataReq {
11
+ export interface SetupOrgReq {
12
+ org_type: Chrt.OrgTypeEnum;
9
13
  /** Must be a string starting with `@`. May only contain a-z, A-Z, 0-9, _, -. May not be longer than 30 characters. */
10
14
  handle?: string | null;
11
15
  company_name?: string | null;
@@ -1,2 +1,2 @@
1
1
  export { type OrgsListMembersV1Request } from "./OrgsListMembersV1Request.js";
2
- export { type SetOrgTypeReq } from "./SetOrgTypeReq.js";
2
+ export { type SetupOrgReq } from "./SetupOrgReq.js";
@@ -40,19 +40,6 @@ export declare class PublicData {
40
40
  */
41
41
  getV1(requestOptions?: PublicData.RequestOptions): core.HttpResponsePromise<Chrt.OrgPublicData1>;
42
42
  private __getV1;
43
- /**
44
- * Creates org_public_data and org_private_data documents for the caller's organization using org_type from JWT. | (CreateOrgPublicDataReq) -> (CreateOrgPublicDataRes)
45
- *
46
- * @param {Chrt.orgs.CreateOrgPublicDataReq} request
47
- * @param {PublicData.RequestOptions} requestOptions - Request-specific configuration.
48
- *
49
- * @throws {@link Chrt.UnprocessableEntityError}
50
- *
51
- * @example
52
- * await client.orgs.publicData.createV1()
53
- */
54
- createV1(request?: Chrt.orgs.CreateOrgPublicDataReq, requestOptions?: PublicData.RequestOptions): core.HttpResponsePromise<Chrt.CreateOrgPublicDataRes>;
55
- private __createV1;
56
43
  /**
57
44
  * Updates the handle and/or company_name for the caller's organization. | (UpdateOrgPublicDataReq) -> (bool)
58
45
  *
@@ -106,68 +106,6 @@ class PublicData {
106
106
  }
107
107
  });
108
108
  }
109
- /**
110
- * Creates org_public_data and org_private_data documents for the caller's organization using org_type from JWT. | (CreateOrgPublicDataReq) -> (CreateOrgPublicDataRes)
111
- *
112
- * @param {Chrt.orgs.CreateOrgPublicDataReq} request
113
- * @param {PublicData.RequestOptions} requestOptions - Request-specific configuration.
114
- *
115
- * @throws {@link Chrt.UnprocessableEntityError}
116
- *
117
- * @example
118
- * await client.orgs.publicData.createV1()
119
- */
120
- createV1(request = {}, requestOptions) {
121
- return core.HttpResponsePromise.fromPromise(this.__createV1(request, requestOptions));
122
- }
123
- __createV1() {
124
- return __awaiter(this, arguments, void 0, function* (request = {}, requestOptions) {
125
- var _a, _b, _c, _d;
126
- let _headers = (0, headers_js_1.mergeHeaders)((_a = this._options) === null || _a === void 0 ? void 0 : _a.headers, (0, headers_js_1.mergeOnlyDefinedHeaders)({ Authorization: yield this._getAuthorizationHeader() }), requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.headers);
127
- const _response = yield ((_b = this._options.fetcher) !== null && _b !== void 0 ? _b : core.fetcher)({
128
- url: core.url.join((_d = (_c = (yield core.Supplier.get(this._options.baseUrl))) !== null && _c !== void 0 ? _c : (yield core.Supplier.get(this._options.environment))) !== null && _d !== void 0 ? _d : environments.ChrtEnvironment.Local, "orgs/org_public_data/v1"),
129
- method: "POST",
130
- headers: _headers,
131
- contentType: "application/json",
132
- queryParameters: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.queryParams,
133
- requestType: "json",
134
- body: request,
135
- timeoutMs: (requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.timeoutInSeconds) != null ? requestOptions.timeoutInSeconds * 1000 : 60000,
136
- maxRetries: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.maxRetries,
137
- abortSignal: requestOptions === null || requestOptions === void 0 ? void 0 : requestOptions.abortSignal,
138
- });
139
- if (_response.ok) {
140
- return { data: _response.body, rawResponse: _response.rawResponse };
141
- }
142
- if (_response.error.reason === "status-code") {
143
- switch (_response.error.statusCode) {
144
- case 422:
145
- throw new Chrt.UnprocessableEntityError(_response.error.body, _response.rawResponse);
146
- default:
147
- throw new errors.ChrtError({
148
- statusCode: _response.error.statusCode,
149
- body: _response.error.body,
150
- rawResponse: _response.rawResponse,
151
- });
152
- }
153
- }
154
- switch (_response.error.reason) {
155
- case "non-json":
156
- throw new errors.ChrtError({
157
- statusCode: _response.error.statusCode,
158
- body: _response.error.rawBody,
159
- rawResponse: _response.rawResponse,
160
- });
161
- case "timeout":
162
- throw new errors.ChrtTimeoutError("Timeout exceeded when calling POST /orgs/org_public_data/v1.");
163
- case "unknown":
164
- throw new errors.ChrtError({
165
- message: _response.error.errorMessage,
166
- rawResponse: _response.rawResponse,
167
- });
168
- }
169
- });
170
- }
171
109
  /**
172
110
  * Updates the handle and/or company_name for the caller's organization. | (UpdateOrgPublicDataReq) -> (bool)
173
111
  *
@@ -1,2 +1 @@
1
- export { type CreateOrgPublicDataReq } from "./CreateOrgPublicDataReq.js";
2
1
  export { type UpdateOrgPublicDataReq } from "./UpdateOrgPublicDataReq.js";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * This file was auto-generated by Fern from our API Definition.
3
+ */
4
+ export interface CreateCustomerPortalSessionRes {
5
+ url: string;
6
+ }
@@ -7,6 +7,7 @@ export interface OrgPrivateData1 {
7
7
  org_type: Chrt.OrgTypeEnum;
8
8
  /** Must be a string starting with `org_` */
9
9
  org_id: string;
10
+ stripe_customer_id?: string | null;
10
11
  stripe_connect_account_id?: string | null;
11
12
  webhook_enabled?: boolean;
12
13
  svix_app_id?: string | null;
@@ -6,7 +6,6 @@ export interface UserPrivateData1 {
6
6
  schema_version: number;
7
7
  created_at_timestamp: string;
8
8
  user_id: string;
9
- stripe_customer_id?: string | null;
10
9
  primary_email_address?: string | null;
11
10
  phone_number?: string | null;
12
11
  firebase_cloud_messaging_token_data?: Chrt.FirebaseCloudMessagingTokenData1[];
@@ -101,8 +101,8 @@ export * from "./ChrtGroundProviderTaskActionEnum1.js";
101
101
  export * from "./ClerkOrgData.js";
102
102
  export * from "./CreateCheckoutSessionRes.js";
103
103
  export * from "./CreateConnectionReq.js";
104
+ export * from "./CreateCustomerPortalSessionRes.js";
104
105
  export * from "./CreateLigFromRateSheetForVectorClientReq.js";
105
- export * from "./CreateOrgPublicDataRes.js";
106
106
  export * from "./CreateStripeConnectAccountRes.js";
107
107
  export * from "./CredentialInfoRes.js";
108
108
  export * from "./Department1.js";
@@ -227,7 +227,6 @@ export * from "./Point.js";
227
227
  export * from "./Polygon.js";
228
228
  export * from "./Position2D.js";
229
229
  export * from "./Position3D.js";
230
- export * from "./PriceNameEnum.js";
231
230
  export * from "./ProFormaLineItem1.js";
232
231
  export * from "./ProviderConnectionListRes.js";
233
232
  export * from "./ProviderConnectionRes.js";
@@ -117,8 +117,8 @@ __exportStar(require("./ChrtGroundProviderTaskActionEnum1.js"), exports);
117
117
  __exportStar(require("./ClerkOrgData.js"), exports);
118
118
  __exportStar(require("./CreateCheckoutSessionRes.js"), exports);
119
119
  __exportStar(require("./CreateConnectionReq.js"), exports);
120
+ __exportStar(require("./CreateCustomerPortalSessionRes.js"), exports);
120
121
  __exportStar(require("./CreateLigFromRateSheetForVectorClientReq.js"), exports);
121
- __exportStar(require("./CreateOrgPublicDataRes.js"), exports);
122
122
  __exportStar(require("./CreateStripeConnectAccountRes.js"), exports);
123
123
  __exportStar(require("./CredentialInfoRes.js"), exports);
124
124
  __exportStar(require("./Department1.js"), exports);
@@ -243,7 +243,6 @@ __exportStar(require("./Point.js"), exports);
243
243
  __exportStar(require("./Polygon.js"), exports);
244
244
  __exportStar(require("./Position2D.js"), exports);
245
245
  __exportStar(require("./Position3D.js"), exports);
246
- __exportStar(require("./PriceNameEnum.js"), exports);
247
246
  __exportStar(require("./ProFormaLineItem1.js"), exports);
248
247
  __exportStar(require("./ProviderConnectionListRes.js"), exports);
249
248
  __exportStar(require("./ProviderConnectionRes.js"), exports);
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "1.647.0";
1
+ export declare const SDK_VERSION = "1.651.0";
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.SDK_VERSION = void 0;
4
- exports.SDK_VERSION = "1.647.0";
4
+ exports.SDK_VERSION = "1.651.0";
@@ -20,8 +20,8 @@ export class ChrtClient {
20
20
  this._options = Object.assign(Object.assign({}, _options), { headers: mergeHeaders({
21
21
  "X-Fern-Language": "JavaScript",
22
22
  "X-Fern-SDK-Name": "@chrt-inc/typescript-sdk",
23
- "X-Fern-SDK-Version": "1.647.0",
24
- "User-Agent": "@chrt-inc/typescript-sdk/1.647.0",
23
+ "X-Fern-SDK-Version": "1.651.0",
24
+ "User-Agent": "@chrt-inc/typescript-sdk/1.651.0",
25
25
  "X-Fern-Runtime": core.RUNTIME.type,
26
26
  "X-Fern-Runtime-Version": core.RUNTIME.version,
27
27
  }, _options === null || _options === void 0 ? void 0 : _options.headers) });