@openrails/billing-ui 0.250.0 → 0.251.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 +16 -0
- package/README.md +19 -1
- package/dist/client/generated/error-codes.d.ts +1 -1
- package/dist/client/generated/routes.d.ts +3 -3
- package/dist/client/generated/wire.d.ts +1 -0
- package/dist/client/types.d.ts +6 -0
- package/dist/{client-HWr09qpX.js → client-imFR1UCe.js} +82 -81
- package/dist/client-imFR1UCe.js.map +1 -0
- package/dist/client.js +2 -2
- package/dist/hooks-C9JkHcRt.js +553 -0
- package/dist/hooks-C9JkHcRt.js.map +1 -0
- package/dist/index.js +778 -745
- package/dist/index.js.map +1 -1
- package/dist/react/config.d.ts +12 -3
- package/dist/react/provider.d.ts +14 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
- package/dist/client-HWr09qpX.js.map +0 -1
- package/dist/hooks-D9MR20BY.js +0 -537
- package/dist/hooks-D9MR20BY.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## The host supplies the configuration
|
|
4
|
+
|
|
5
|
+
- `BillingProvider` takes `config` (`GET /config`'s document; Go:
|
|
6
|
+
`Engine.PublicConfig` or `Client.GetPublicConfig`) and `customerConfig`
|
|
7
|
+
(`GET /me/config`'s; Go: `Engine.CustomerConfig`) from the host's own page
|
|
8
|
+
response. Supplied, billing-ui does not request them to load; a retry still
|
|
9
|
+
reads the server's copy. `useConfig()`, `useCurrencyScales()` and
|
|
10
|
+
`useCustomerConfig()` read them.
|
|
11
|
+
|
|
12
|
+
## Fallback PSPs
|
|
13
|
+
|
|
14
|
+
- `OrderPayment` offers a payment option marked `fallback` (CCBill once the
|
|
15
|
+
card PSP failed or is unavailable) under "Card payment isn't working?", and
|
|
16
|
+
a customer back from a PSP's page before it reported continues there.
|
|
17
|
+
`OrderPaymentOption` gains `fallback`.
|
|
18
|
+
|
|
3
19
|
## An order and its pay URL
|
|
4
20
|
|
|
5
21
|
- Breaking: "checkout" is gone. `EmbeddedCheckout` is `EmbeddedPayment`,
|
package/README.md
CHANGED
|
@@ -144,7 +144,10 @@ customer's browser, which pays it signed in:
|
|
|
144
144
|
```
|
|
145
145
|
|
|
146
146
|
`onSettled` follows a complete order, or one processing on an asynchronous
|
|
147
|
-
rail. A subscription line names its subscription once paid.
|
|
147
|
+
rail. A subscription line names its subscription once paid. A fallback PSP
|
|
148
|
+
the order lists (CCBill once the card PSP has failed or is unavailable) is
|
|
149
|
+
offered under "Card payment isn't working?"; a customer back from a PSP's
|
|
150
|
+
page before it reported is offered to continue there.
|
|
148
151
|
|
|
149
152
|
## Account billing
|
|
150
153
|
|
|
@@ -182,6 +185,21 @@ deployment's (`GET /config`), whose currency registry amounts use over the
|
|
|
182
185
|
pinned copy. `useCustomerConfig()`, `useConfig()` and `useCurrencyScales()`
|
|
183
186
|
read the same copies for host components.
|
|
184
187
|
|
|
188
|
+
A page your server renders can carry both documents in its own response, so
|
|
189
|
+
the page loads from that one response: `config` in `GET /config`'s shape (Go:
|
|
190
|
+
`engine.PublicConfig(routes)` with the `Routes` you mount, or a remote client's
|
|
191
|
+
`GetPublicConfig`) and `customerConfig` in `GET /me/config`'s (Go:
|
|
192
|
+
`engine.CustomerConfig(routes, r)`, `r` your own signed-in request). billing-ui
|
|
193
|
+
then does not request them to load; a retry still reads the server's copy:
|
|
194
|
+
|
|
195
|
+
```tsx
|
|
196
|
+
<BillingProvider
|
|
197
|
+
client={billing}
|
|
198
|
+
config={page.billingConfig}
|
|
199
|
+
customerConfig={page.customerBillingConfig}
|
|
200
|
+
>
|
|
201
|
+
```
|
|
202
|
+
|
|
185
203
|
## Staff administration
|
|
186
204
|
|
|
187
205
|
Install the admin entry's optional peer with `pnpm add @tanstack/react-query`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export type OpenRailsErrorCode = "admission_captured" | "admission_not_found" | "already_owned" | "application_required" | "as_of_required" | "authentication_required" | "authentication_unavailable" | "authorization_unavailable" | "billing_archive_integrity" | "billing_archive_invalid_artifact" | "billing_archive_merchant_mismatch" | "billing_archive_not_empty" | "billing_archive_platform_cards" | "billing_archive_unavailable" | "billing_archive_unsupported_state" | "billing_policy_not_found" | "cancel_unsupported_on_rail" | "captcha_invalid" | "captcha_required" | "card_attempts_blocked" | "card_custody_reserved" | "card_declined" | "card_not_saved" | "card_requires_https" | "catalog_benefit_overlap" | "catalog_revision_conflict" | "credential_expired" | "credential_revoked" | "credit_grant_held" | "credit_grant_not_found" | "credit_grant_unavailable" | "csrf_origin_denied" | "currency_unsupported" | "custodian_capture_unavailable" | "customer_action_required" | "customer_email_required" | "customer_issuer_mismatch" | "customer_not_found" | "customer_payment_unsupported" | "customer_session_required" | "dashboard_invalid" | "database_busy" | "default_payment_method_invalid" | "default_payment_method_required" | "default_rate_card_not_found" | "destructive_actions_held" | "embed_origins_required" | "entitlement_required" | "finding_action_failed" | "finding_not_actionable" | "finding_requires_merchant_config" | "hold_not_found" | "host_event_not_found" | "host_principal_invalid" | "idempotency_key_in_use" | "idempotency_key_required" | "idempotency_key_reused" | "insufficient_credits" | "insufficient_funds" | "internal_error" | "invalid_cursor" | "invalid_customer_id" | "invalid_host_event_request" | "invalid_param" | "invalid_payment_method" | "invalid_psp_reference" | "invalid_query" | "invalid_request_body" | "invalid_settlement_status_request" | "invoker_scoped_principal" | "merchant_config_read_only" | "merchant_mismatch" | "merchant_unresolved" | "meter_in_use" | "meter_rate_card_conflict" | "method_not_allowed" | "metrics_query_invalid" | "model_unavailable" | "network_account_linked" | "network_link_challenge_invalid" | "network_link_conflict" | "network_link_in_use" | "network_terms_required" | "order_action_not_allowed" | "order_attempt_closed" | "order_attempt_expired" | "order_has_recurring_line" | "order_line_unavailable" | "order_not_cancelable" | "order_not_payable" | "order_payment_in_progress" | "order_total_changed" | "pay_url_attempts_exhausted" | "pay_url_expired" | "pay_url_not_found" | "pay_url_unavailable" | "payment_duplicate_refused" | "payment_exceeds_due" | "payment_failed" | "payment_idempotency_conflict" | "payment_in_progress" | "payment_method_delete_failed" | "payment_method_delete_unsupported" | "payment_method_not_psp_vaulted" | "payment_method_not_usable" | "payment_method_psp_mismatch" | "payment_method_required" | "payment_method_same_vault" | "payment_method_stale" | "payment_method_update_failed" | "payment_method_update_unsupported" | "payment_not_found" | "payment_not_refundable" | "payment_not_retryable" | "payment_option_unavailable" | "payment_provider_rejected" | "permission_required" | "platform_vault_unavailable" | "platform_vault_unreachable" | "price_change_currency_mismatch" | "price_change_target_archived" | "price_increase_notice_too_short" | "price_key_cadence_conflict" | "price_key_not_found" | "price_migration_not_found" | "price_not_found" | "price_not_sellable" | "product_in_use" | "product_not_found" | "product_tier_group_conflict" | "product_tier_group_in_use" | "provider_cancel_held" | "provider_outcome_unknown" | "provider_writes_held" | "psp_claim_requires_proof" | "psp_credentials_rejected" | "psp_exists" | "psp_key_taken" | "psp_last_active" | "psp_not_found" | "purchase_review_resolved" | "quantity_not_allowed" | "rate_card_product_not_found" | "rate_limit_exceeded" | "rebill_terms_committed" | "refund_failed" | "refund_rail_unavailable" | "refund_unsupported" | "request_body_too_large" | "resource_access_denied" | "resource_conflict" | "resource_not_found" | "revision_mismatch" | "route_not_found" | "running_charge_not_found" | "scheduled_change_exists" | "service_credential_customer_scope_denied" | "service_unavailable" | "solana_rpc_unavailable" | "solana_transaction_refused" | "step_up_required" | "step_up_unavailable" | "stored_credential_required" | "subscription_change_already_scheduled" | "subscription_change_cadence_unsupported" | "subscription_change_credit_exceeds_price" | "subscription_change_cycle_unknown" | "subscription_change_idempotency_conflict" | "subscription_change_idempotency_key_required" | "subscription_change_in_flight" | "subscription_change_period_unknown" | "subscription_change_provider_conflict" | "subscription_change_refused" | "subscription_change_renewal_due" | "subscription_change_requires_linked_plan" | "subscription_change_target_inactive" | "subscription_change_unsupported_on_rail" | "subscription_not_active" | "subscription_not_found" | "subscription_paid_through" | "subscription_resumable" | "trial_unsupported_on_rail" | "unknown_field" | "unsupported_media_type" | "usage_meter_invalid" | "usage_meter_not_found" | "usage_not_priced" | "usage_rate_card_invalid" | "webhook_account_mismatch" | "webhook_invalid";
|
|
1
|
+
export type OpenRailsErrorCode = "admission_captured" | "admission_not_found" | "already_owned" | "application_required" | "as_of_required" | "authentication_required" | "authentication_unavailable" | "authorization_unavailable" | "billing_archive_integrity" | "billing_archive_invalid_artifact" | "billing_archive_merchant_mismatch" | "billing_archive_not_empty" | "billing_archive_platform_cards" | "billing_archive_unavailable" | "billing_archive_unsupported_state" | "billing_policy_not_found" | "cancel_unsupported_on_rail" | "captcha_invalid" | "captcha_required" | "card_attempts_blocked" | "card_custody_reserved" | "card_declined" | "card_not_saved" | "card_requires_https" | "catalog_benefit_overlap" | "catalog_revision_conflict" | "credential_expired" | "credential_revoked" | "credit_grant_held" | "credit_grant_not_found" | "credit_grant_unavailable" | "csrf_origin_denied" | "currency_unsupported" | "custodian_capture_unavailable" | "customer_action_required" | "customer_email_required" | "customer_issuer_mismatch" | "customer_not_found" | "customer_payment_unsupported" | "customer_session_required" | "dashboard_invalid" | "database_busy" | "default_payment_method_invalid" | "default_payment_method_required" | "default_rate_card_not_found" | "destructive_actions_held" | "embed_origins_required" | "entitlement_required" | "finding_action_failed" | "finding_not_actionable" | "finding_requires_merchant_config" | "hold_not_found" | "host_event_not_found" | "host_principal_invalid" | "idempotency_key_in_use" | "idempotency_key_required" | "idempotency_key_reused" | "insufficient_credits" | "insufficient_funds" | "internal_error" | "invalid_cursor" | "invalid_customer_id" | "invalid_host_event_request" | "invalid_param" | "invalid_payment_method" | "invalid_psp_reference" | "invalid_query" | "invalid_request_body" | "invalid_settlement_status_request" | "invoker_scoped_principal" | "merchant_config_read_only" | "merchant_mismatch" | "merchant_unresolved" | "meter_in_use" | "meter_rate_card_conflict" | "method_not_allowed" | "metrics_query_invalid" | "model_unavailable" | "network_account_linked" | "network_link_challenge_invalid" | "network_link_conflict" | "network_link_in_use" | "network_terms_required" | "order_action_not_allowed" | "order_attempt_closed" | "order_attempt_expired" | "order_has_recurring_line" | "order_line_unavailable" | "order_not_cancelable" | "order_not_payable" | "order_payment_in_progress" | "order_total_changed" | "pay_url_attempts_exhausted" | "pay_url_expired" | "pay_url_not_found" | "pay_url_unavailable" | "payment_duplicate_refused" | "payment_exceeds_due" | "payment_failed" | "payment_idempotency_conflict" | "payment_in_progress" | "payment_method_delete_failed" | "payment_method_delete_unsupported" | "payment_method_not_psp_vaulted" | "payment_method_not_usable" | "payment_method_psp_mismatch" | "payment_method_required" | "payment_method_same_vault" | "payment_method_stale" | "payment_method_update_failed" | "payment_method_update_unsupported" | "payment_not_found" | "payment_not_refundable" | "payment_not_retryable" | "payment_option_unavailable" | "payment_option_withheld" | "payment_provider_rejected" | "permission_required" | "platform_vault_unavailable" | "platform_vault_unreachable" | "price_change_currency_mismatch" | "price_change_target_archived" | "price_increase_notice_too_short" | "price_key_cadence_conflict" | "price_key_not_found" | "price_migration_not_found" | "price_not_found" | "price_not_sellable" | "product_in_use" | "product_not_found" | "product_tier_group_conflict" | "product_tier_group_in_use" | "provider_cancel_held" | "provider_outcome_unknown" | "provider_writes_held" | "psp_claim_requires_proof" | "psp_credentials_rejected" | "psp_exists" | "psp_key_taken" | "psp_last_active" | "psp_not_found" | "purchase_review_resolved" | "quantity_not_allowed" | "rate_card_product_not_found" | "rate_limit_exceeded" | "rebill_terms_committed" | "refund_failed" | "refund_rail_unavailable" | "refund_unsupported" | "request_body_too_large" | "resource_access_denied" | "resource_conflict" | "resource_not_found" | "revision_mismatch" | "route_not_found" | "running_charge_not_found" | "scheduled_change_exists" | "service_credential_customer_scope_denied" | "service_unavailable" | "solana_rpc_unavailable" | "solana_transaction_refused" | "step_up_required" | "step_up_unavailable" | "stored_credential_required" | "subscription_change_already_scheduled" | "subscription_change_cadence_unsupported" | "subscription_change_credit_exceeds_price" | "subscription_change_cycle_unknown" | "subscription_change_idempotency_conflict" | "subscription_change_idempotency_key_required" | "subscription_change_in_flight" | "subscription_change_period_unknown" | "subscription_change_provider_conflict" | "subscription_change_refused" | "subscription_change_renewal_due" | "subscription_change_requires_linked_plan" | "subscription_change_target_inactive" | "subscription_change_unsupported_on_rail" | "subscription_not_active" | "subscription_not_found" | "subscription_paid_through" | "subscription_resumable" | "trial_unsupported_on_rail" | "unknown_field" | "unsupported_media_type" | "usage_meter_invalid" | "usage_meter_not_found" | "usage_not_priced" | "usage_rate_card_invalid" | "webhook_account_mismatch" | "webhook_invalid";
|
|
2
2
|
export type OpenRailsErrorType = "api_error" | "authentication_error" | "authorization_error" | "card_error" | "invalid_request_error" | "rate_limit_error";
|
|
3
3
|
export declare const OPENRAILS_ERROR_CODES: Readonly<Record<OpenRailsErrorCode, {
|
|
4
4
|
status: number;
|
|
@@ -98,7 +98,7 @@ export declare const OPENRAILS_ROUTES: readonly [{
|
|
|
98
98
|
readonly 200: "Order";
|
|
99
99
|
readonly 201: "Order";
|
|
100
100
|
};
|
|
101
|
-
readonly errors: readonly ["already_owned", "card_attempts_blocked", "card_declined", "customer_action_required", "customer_session_required", "embed_origins_required", "entitlement_required", "idempotency_key_in_use", "idempotency_key_required", "idempotency_key_reused", "invalid_param", "order_line_unavailable", "order_not_payable", "order_payment_in_progress", "order_total_changed", "pay_url_unavailable", "payment_failed", "payment_method_stale", "payment_option_unavailable", "payment_provider_rejected", "quantity_not_allowed", "resource_conflict", "resource_not_found", "service_unavailable"];
|
|
101
|
+
readonly errors: readonly ["already_owned", "card_attempts_blocked", "card_declined", "customer_action_required", "customer_email_required", "customer_session_required", "embed_origins_required", "entitlement_required", "idempotency_key_in_use", "idempotency_key_required", "idempotency_key_reused", "invalid_param", "order_line_unavailable", "order_not_payable", "order_payment_in_progress", "order_total_changed", "pay_url_unavailable", "payment_failed", "payment_method_stale", "payment_option_unavailable", "payment_option_withheld", "payment_provider_rejected", "quantity_not_allowed", "resource_conflict", "resource_not_found", "service_unavailable"];
|
|
102
102
|
readonly errorSets: readonly ["tier:customer", "request"];
|
|
103
103
|
}, {
|
|
104
104
|
readonly method: "GET";
|
|
@@ -140,7 +140,7 @@ export declare const OPENRAILS_ROUTES: readonly [{
|
|
|
140
140
|
readonly responses: {
|
|
141
141
|
readonly 200: "Order";
|
|
142
142
|
};
|
|
143
|
-
readonly errors: readonly ["card_attempts_blocked", "card_declined", "customer_action_required", "entitlement_required", "idempotency_key_in_use", "idempotency_key_required", "idempotency_key_reused", "invalid_param", "order_not_payable", "order_payment_in_progress", "order_total_changed", "payment_failed", "payment_method_stale", "payment_option_unavailable", "payment_provider_rejected", "resource_conflict", "resource_not_found", "service_unavailable"];
|
|
143
|
+
readonly errors: readonly ["card_attempts_blocked", "card_declined", "customer_action_required", "customer_email_required", "entitlement_required", "idempotency_key_in_use", "idempotency_key_required", "idempotency_key_reused", "invalid_param", "order_not_payable", "order_payment_in_progress", "order_total_changed", "payment_failed", "payment_method_stale", "payment_option_unavailable", "payment_option_withheld", "payment_provider_rejected", "resource_conflict", "resource_not_found", "service_unavailable"];
|
|
144
144
|
readonly errorSets: readonly ["tier:customer", "request"];
|
|
145
145
|
}, {
|
|
146
146
|
readonly method: "POST";
|
|
@@ -2593,7 +2593,7 @@ export declare const OPENRAILS_ROUTES: readonly [{
|
|
|
2593
2593
|
readonly responses: {
|
|
2594
2594
|
readonly 200: "Order";
|
|
2595
2595
|
};
|
|
2596
|
-
readonly errors: readonly ["card_attempts_blocked", "card_declined", "customer_action_required", "entitlement_required", "idempotency_key_in_use", "idempotency_key_required", "idempotency_key_reused", "invalid_param", "order_not_payable", "order_payment_in_progress", "order_total_changed", "payment_failed", "payment_method_stale", "payment_option_unavailable", "payment_provider_rejected", "resource_conflict", "resource_not_found", "service_unavailable"];
|
|
2596
|
+
readonly errors: readonly ["card_attempts_blocked", "card_declined", "customer_action_required", "customer_email_required", "entitlement_required", "idempotency_key_in_use", "idempotency_key_required", "idempotency_key_reused", "invalid_param", "order_not_payable", "order_payment_in_progress", "order_total_changed", "payment_failed", "payment_method_stale", "payment_option_unavailable", "payment_option_withheld", "payment_provider_rejected", "resource_conflict", "resource_not_found", "service_unavailable"];
|
|
2597
2597
|
readonly errorSets: readonly ["tier:network", "request"];
|
|
2598
2598
|
}, {
|
|
2599
2599
|
readonly method: "POST";
|
package/dist/client/types.d.ts
CHANGED
|
@@ -413,14 +413,17 @@ export declare const orderSchema: z.ZodObject<{
|
|
|
413
413
|
psp_id: z.ZodString;
|
|
414
414
|
rail: z.ZodString;
|
|
415
415
|
accepts: z.ZodArray<z.ZodString>;
|
|
416
|
+
fallback: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>, z.ZodTransform<boolean, boolean | null | undefined>>;
|
|
416
417
|
}, z.core.$strip>>>>, z.ZodTransform<{
|
|
417
418
|
psp_id: string;
|
|
418
419
|
rail: string;
|
|
419
420
|
accepts: string[];
|
|
421
|
+
fallback: boolean;
|
|
420
422
|
}[], {
|
|
421
423
|
psp_id: string;
|
|
422
424
|
rail: string;
|
|
423
425
|
accepts: string[];
|
|
426
|
+
fallback: boolean;
|
|
424
427
|
}[] | null | undefined>>;
|
|
425
428
|
pay_url: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
426
429
|
pay_url_expires_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -514,14 +517,17 @@ export declare const cartSchema: z.ZodObject<{
|
|
|
514
517
|
psp_id: z.ZodString;
|
|
515
518
|
rail: z.ZodString;
|
|
516
519
|
accepts: z.ZodArray<z.ZodString>;
|
|
520
|
+
fallback: z.ZodPipe<z.ZodOptional<z.ZodNullable<z.ZodBoolean>>, z.ZodTransform<boolean, boolean | null | undefined>>;
|
|
517
521
|
}, z.core.$strip>>>>, z.ZodTransform<{
|
|
518
522
|
psp_id: string;
|
|
519
523
|
rail: string;
|
|
520
524
|
accepts: string[];
|
|
525
|
+
fallback: boolean;
|
|
521
526
|
}[], {
|
|
522
527
|
psp_id: string;
|
|
523
528
|
rail: string;
|
|
524
529
|
accepts: string[];
|
|
530
|
+
fallback: boolean;
|
|
525
531
|
}[] | null | undefined>>;
|
|
526
532
|
last_changed_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
527
533
|
expires_at: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
@@ -227,11 +227,11 @@ function O(e, t, n, r) {
|
|
|
227
227
|
var k = e.string().refine(C, "amount must be an int64 string"), A = e.string(), j = (t) => e.object({
|
|
228
228
|
data: e.array(t).nullish().transform((e) => e ?? []),
|
|
229
229
|
next_cursor: e.string().nullish().transform((e) => e ?? null)
|
|
230
|
-
}), ie = e.string(),
|
|
230
|
+
}), ie = e.string(), ae = e.object({
|
|
231
231
|
status: e.string(),
|
|
232
232
|
ids: e.record(e.string(), e.string()).nullish(),
|
|
233
233
|
sync_status: e.string().nullish()
|
|
234
|
-
}),
|
|
234
|
+
}), M = e.object({
|
|
235
235
|
id: e.string(),
|
|
236
236
|
key: e.string(),
|
|
237
237
|
revision: e.number().int().nonnegative().optional(),
|
|
@@ -248,10 +248,10 @@ var k = e.string().refine(C, "amount must be an int64 string"), A = e.string(),
|
|
|
248
248
|
billing_interval_hours: e.number().nullable(),
|
|
249
249
|
trial_unit_amount: k.nullable(),
|
|
250
250
|
trial_duration_hours: e.number().nullable(),
|
|
251
|
-
psps: e.record(e.string(),
|
|
251
|
+
psps: e.record(e.string(), ae).nullish(),
|
|
252
252
|
created_at: A,
|
|
253
253
|
updated_at: A
|
|
254
|
-
}),
|
|
254
|
+
}), N = e.object({
|
|
255
255
|
id: e.string(),
|
|
256
256
|
key: e.string().nullish(),
|
|
257
257
|
revision: e.number().int().nonnegative().optional(),
|
|
@@ -259,30 +259,30 @@ var k = e.string().refine(C, "amount must be an int64 string"), A = e.string(),
|
|
|
259
259
|
description: e.string().nullish(),
|
|
260
260
|
tier_group: e.string().nullish(),
|
|
261
261
|
tier_rank: e.number().nullish()
|
|
262
|
-
}),
|
|
262
|
+
}), P = e.object({
|
|
263
263
|
brand: e.string().nullish(),
|
|
264
264
|
last4: e.string().nullish(),
|
|
265
265
|
exp_month: e.number().nullish(),
|
|
266
266
|
exp_year: e.number().nullish()
|
|
267
|
-
}),
|
|
267
|
+
}), oe = e.object({
|
|
268
268
|
last_failure_reason: e.string().nullish(),
|
|
269
269
|
retryable: e.boolean(),
|
|
270
270
|
blocked_reason: e.string().nullish(),
|
|
271
271
|
order_id: e.string().nullish()
|
|
272
|
-
}),
|
|
272
|
+
}), F = e.object({
|
|
273
273
|
type: e.string(),
|
|
274
274
|
url: e.string().nullish(),
|
|
275
275
|
psp_id: e.string().nullish(),
|
|
276
276
|
transactions: e.array(e.string()).nullish(),
|
|
277
277
|
payload: e.record(e.string(), e.string()).nullish()
|
|
278
|
-
}),
|
|
278
|
+
}), se = e.object({
|
|
279
279
|
attempts: e.number(),
|
|
280
280
|
retries_left: e.number().nullish(),
|
|
281
281
|
next_retry_at: A.nullish(),
|
|
282
282
|
final_retry_at: A.nullish(),
|
|
283
283
|
waiting_for_new_card: e.boolean(),
|
|
284
284
|
last_failure_reason: e.string().nullish()
|
|
285
|
-
}),
|
|
285
|
+
}), I = e.object({
|
|
286
286
|
id: e.string(),
|
|
287
287
|
status: ie,
|
|
288
288
|
rail: e.string().nullish(),
|
|
@@ -306,23 +306,23 @@ var k = e.string().refine(C, "amount must be an int64 string"), A = e.string(),
|
|
|
306
306
|
starts_at: A,
|
|
307
307
|
ends_at: A.nullish()
|
|
308
308
|
}).nullish(),
|
|
309
|
-
dunning:
|
|
310
|
-
price:
|
|
311
|
-
product:
|
|
309
|
+
dunning: se.nullish(),
|
|
310
|
+
price: M.nullish(),
|
|
311
|
+
product: N.nullish(),
|
|
312
312
|
scheduled_change: e.object({
|
|
313
313
|
price_id: e.string(),
|
|
314
314
|
quantity: e.number().nullish(),
|
|
315
315
|
effective_at: A,
|
|
316
316
|
source: e.string(),
|
|
317
|
-
price:
|
|
318
|
-
product:
|
|
317
|
+
price: M.nullish(),
|
|
318
|
+
product: N.nullish()
|
|
319
319
|
}).nullish(),
|
|
320
|
-
card:
|
|
321
|
-
recovery:
|
|
322
|
-
next_action:
|
|
320
|
+
card: P.nullish(),
|
|
321
|
+
recovery: oe.nullish(),
|
|
322
|
+
next_action: F.nullish(),
|
|
323
323
|
created_at: A.nullish(),
|
|
324
324
|
updated_at: A.nullish()
|
|
325
|
-
}),
|
|
325
|
+
}), ce = e.object({
|
|
326
326
|
name: e.string().nullish(),
|
|
327
327
|
email: e.string().nullish(),
|
|
328
328
|
phone: e.string().nullish(),
|
|
@@ -334,7 +334,7 @@ var k = e.string().refine(C, "amount must be an int64 string"), A = e.string(),
|
|
|
334
334
|
postal_code: e.string().nullish(),
|
|
335
335
|
country: e.string().nullish()
|
|
336
336
|
}).nullish()
|
|
337
|
-
}),
|
|
337
|
+
}), L = e.object({
|
|
338
338
|
id: e.string(),
|
|
339
339
|
status: e.string().nullish(),
|
|
340
340
|
next_action: e.object({
|
|
@@ -344,8 +344,8 @@ var k = e.string().refine(C, "amount must be an int64 string"), A = e.string(),
|
|
|
344
344
|
}).nullish(),
|
|
345
345
|
rail: e.string().nullish(),
|
|
346
346
|
psp_id: e.string().nullish(),
|
|
347
|
-
card:
|
|
348
|
-
billing_details:
|
|
347
|
+
card: P.nullish(),
|
|
348
|
+
billing_details: ce.nullish(),
|
|
349
349
|
reusable: e.boolean().nullish(),
|
|
350
350
|
health: e.object({
|
|
351
351
|
expiry_status: e.string().nullish(),
|
|
@@ -359,11 +359,11 @@ var k = e.string().refine(C, "amount must be an int64 string"), A = e.string(),
|
|
|
359
359
|
})).nullish(),
|
|
360
360
|
default_currencies: e.array(e.string()).nullish(),
|
|
361
361
|
created_at: A.nullish()
|
|
362
|
-
}),
|
|
362
|
+
}), R = e.object({
|
|
363
363
|
reason: e.string(),
|
|
364
364
|
message: e.string(),
|
|
365
365
|
field: e.string().nullish()
|
|
366
|
-
}),
|
|
366
|
+
}), z = e.object({
|
|
367
367
|
id: e.string(),
|
|
368
368
|
price_id: e.string().nullish(),
|
|
369
369
|
product_id: e.string().nullish(),
|
|
@@ -376,7 +376,7 @@ var k = e.string().refine(C, "amount must be an int64 string"), A = e.string(),
|
|
|
376
376
|
access_duration_hours: e.number().nullish(),
|
|
377
377
|
subscription_id: e.string().nullish(),
|
|
378
378
|
product_access_id: e.string().nullish()
|
|
379
|
-
}),
|
|
379
|
+
}), B = e.object({
|
|
380
380
|
id: e.string(),
|
|
381
381
|
customer_id: e.string(),
|
|
382
382
|
origin: e.string(),
|
|
@@ -394,18 +394,19 @@ var k = e.string().refine(C, "amount must be an int64 string"), A = e.string(),
|
|
|
394
394
|
number: e.string().nullish(),
|
|
395
395
|
currency: e.string(),
|
|
396
396
|
total: k,
|
|
397
|
-
lines: e.array(
|
|
397
|
+
lines: e.array(z),
|
|
398
398
|
payment: e.object({
|
|
399
399
|
status: e.string(),
|
|
400
|
-
next_action:
|
|
401
|
-
last_payment_error:
|
|
400
|
+
next_action: F.nullish(),
|
|
401
|
+
last_payment_error: R.nullish(),
|
|
402
402
|
payment_method_id: e.string().nullish(),
|
|
403
403
|
payment_id: e.string().nullish()
|
|
404
404
|
}),
|
|
405
405
|
payment_options: e.array(e.object({
|
|
406
406
|
psp_id: e.string(),
|
|
407
407
|
rail: e.string(),
|
|
408
|
-
accepts: e.array(e.string())
|
|
408
|
+
accepts: e.array(e.string()),
|
|
409
|
+
fallback: e.boolean().nullish().transform((e) => e ?? !1)
|
|
409
410
|
})).nullish().transform((e) => e ?? []),
|
|
410
411
|
pay_url: e.string().nullish(),
|
|
411
412
|
pay_url_expires_at: A.nullish(),
|
|
@@ -438,13 +439,13 @@ var k = e.string().refine(C, "amount must be an int64 string"), A = e.string(),
|
|
|
438
439
|
voided_at: A.nullish(),
|
|
439
440
|
uncollectible_at: A.nullish(),
|
|
440
441
|
created_at: A
|
|
441
|
-
}),
|
|
442
|
+
}), V = e.object({
|
|
442
443
|
code: e.string(),
|
|
443
444
|
message: e.string(),
|
|
444
445
|
owned_by: e.string().nullish(),
|
|
445
446
|
hint: e.string().nullish(),
|
|
446
447
|
missing: e.array(e.string()).optional()
|
|
447
|
-
}),
|
|
448
|
+
}), H = e.object({
|
|
448
449
|
price_id: e.string(),
|
|
449
450
|
product_id: e.string(),
|
|
450
451
|
description: e.string(),
|
|
@@ -454,12 +455,12 @@ var k = e.string().refine(C, "amount must be an int64 string"), A = e.string(),
|
|
|
454
455
|
ownership: e.string(),
|
|
455
456
|
billing_interval_hours: e.number().nullish(),
|
|
456
457
|
access_duration_hours: e.number().nullish(),
|
|
457
|
-
refusal:
|
|
458
|
-
}),
|
|
458
|
+
refusal: V.nullish()
|
|
459
|
+
}), U = e.object({
|
|
459
460
|
currency: e.string(),
|
|
460
461
|
total: k,
|
|
461
|
-
lines: e.array(
|
|
462
|
-
payment_options:
|
|
462
|
+
lines: e.array(H),
|
|
463
|
+
payment_options: B.shape.payment_options,
|
|
463
464
|
last_changed_at: A.nullish(),
|
|
464
465
|
expires_at: A.nullish()
|
|
465
466
|
});
|
|
@@ -480,11 +481,11 @@ e.object({
|
|
|
480
481
|
tier_group: e.string().nullable(),
|
|
481
482
|
tier_rank: e.number(),
|
|
482
483
|
archived: e.boolean(),
|
|
483
|
-
prices: e.array(
|
|
484
|
+
prices: e.array(M).nullish().transform((e) => e ?? []),
|
|
484
485
|
created_at: A,
|
|
485
486
|
updated_at: A
|
|
486
487
|
});
|
|
487
|
-
var
|
|
488
|
+
var W = e.object({
|
|
488
489
|
id: e.string(),
|
|
489
490
|
kind: e.string(),
|
|
490
491
|
status: e.string(),
|
|
@@ -496,17 +497,17 @@ var K = e.object({
|
|
|
496
497
|
channel: e.string().nullish(),
|
|
497
498
|
rail: e.string().nullish(),
|
|
498
499
|
created_at: A,
|
|
499
|
-
card:
|
|
500
|
+
card: P.nullish(),
|
|
500
501
|
failure: e.object({
|
|
501
502
|
reason: e.string(),
|
|
502
503
|
message: e.string(),
|
|
503
504
|
field: e.string().nullish()
|
|
504
505
|
}).nullish()
|
|
505
|
-
}),
|
|
506
|
+
}), G = e.object({
|
|
506
507
|
customer_id: e.string(),
|
|
507
508
|
entitlement: e.string(),
|
|
508
509
|
quantity: e.number().int().nullable()
|
|
509
|
-
}),
|
|
510
|
+
}), le = e.object({
|
|
510
511
|
currency: e.string(),
|
|
511
512
|
billing_mode: e.string(),
|
|
512
513
|
balance_amount: k,
|
|
@@ -517,7 +518,7 @@ var K = e.object({
|
|
|
517
518
|
accrual_rate_per_hour: k,
|
|
518
519
|
as_of: e.string(),
|
|
519
520
|
depletes_at: e.string().nullable()
|
|
520
|
-
}),
|
|
521
|
+
}), K = e.object({
|
|
521
522
|
currency: e.string(),
|
|
522
523
|
amount: k,
|
|
523
524
|
runway_hours: e.number().int(),
|
|
@@ -526,34 +527,34 @@ var K = e.object({
|
|
|
526
527
|
"merchant",
|
|
527
528
|
"default"
|
|
528
529
|
])
|
|
529
|
-
}),
|
|
530
|
+
}), ue = e.object({
|
|
530
531
|
id: e.string(),
|
|
531
|
-
balances: e.array(
|
|
532
|
+
balances: e.array(le),
|
|
532
533
|
default_payment_methods: e.array(e.object({
|
|
533
534
|
currency: e.string(),
|
|
534
535
|
payment_method_id: e.string()
|
|
535
536
|
})),
|
|
536
|
-
low_balance_lines: e.array(
|
|
537
|
-
}),
|
|
537
|
+
low_balance_lines: e.array(K)
|
|
538
|
+
}), de = e.object({
|
|
538
539
|
key: e.string(),
|
|
539
540
|
cell: e.string().nullish(),
|
|
540
541
|
event_count: e.number(),
|
|
541
542
|
amount: k,
|
|
542
543
|
quantity: e.number().nullish(),
|
|
543
544
|
dimensions: e.record(e.string(), e.number()).nullish()
|
|
544
|
-
}),
|
|
545
|
+
}), fe = e.object({
|
|
545
546
|
customer_id: e.string(),
|
|
546
547
|
currency: e.string(),
|
|
547
548
|
from: A,
|
|
548
549
|
to: A,
|
|
549
550
|
group_by: e.string(),
|
|
550
|
-
rows: e.array(
|
|
551
|
+
rows: e.array(de),
|
|
551
552
|
next_cursor: e.string().nullish().transform((e) => e ?? null)
|
|
552
|
-
}),
|
|
553
|
+
}), pe = e.object({
|
|
553
554
|
code: e.string(),
|
|
554
555
|
decimals: e.number(),
|
|
555
556
|
minor_decimals: e.number().nullish()
|
|
556
|
-
}),
|
|
557
|
+
}), me = e.object({
|
|
557
558
|
price_id: e.string(),
|
|
558
559
|
quantity: e.number().nullish(),
|
|
559
560
|
rail: e.string().nullish(),
|
|
@@ -564,20 +565,20 @@ var K = e.object({
|
|
|
564
565
|
effective: e.string(),
|
|
565
566
|
is_estimate: e.boolean().nullish(),
|
|
566
567
|
message: e.string().nullish()
|
|
567
|
-
}),
|
|
568
|
+
}), q = e.object({
|
|
568
569
|
status: e.string(),
|
|
569
570
|
effective: e.string().nullish(),
|
|
570
571
|
price_id: e.string().nullish(),
|
|
571
572
|
quantity: e.number().nullish(),
|
|
572
573
|
subscription_id: e.string().nullish(),
|
|
573
|
-
next_action:
|
|
574
|
+
next_action: F.nullish(),
|
|
574
575
|
delayed_start: A.nullish(),
|
|
575
576
|
currency: e.string().nullish(),
|
|
576
577
|
amount_due_now: k.nullish(),
|
|
577
578
|
next_charge_amount: k.nullish(),
|
|
578
579
|
next_charge_date: A.nullish(),
|
|
579
580
|
message: e.string().nullish()
|
|
580
|
-
}),
|
|
581
|
+
}), he = e.object({
|
|
581
582
|
psps: e.array(d).nullish().transform((e) => e ?? []),
|
|
582
583
|
solana: e.object({
|
|
583
584
|
network: e.string(),
|
|
@@ -592,31 +593,31 @@ var K = e.object({
|
|
|
592
593
|
recurring_eligible: e.boolean().nullish()
|
|
593
594
|
})).nullish().transform((e) => e ?? [])
|
|
594
595
|
}).nullish()
|
|
595
|
-
}),
|
|
596
|
+
}), ge = e.object({
|
|
596
597
|
provider: e.string(),
|
|
597
598
|
site_key: e.string(),
|
|
598
599
|
script_url: e.string(),
|
|
599
600
|
action: e.string(),
|
|
600
601
|
token_header: e.string()
|
|
601
|
-
}),
|
|
602
|
+
}), _e = e.object({
|
|
602
603
|
display_name: e.string(),
|
|
603
604
|
logo_url: e.string().nullish(),
|
|
604
605
|
support_url: e.string().nullish(),
|
|
605
606
|
embed_origins: e.array(e.string()).nullish().transform((e) => e ?? [])
|
|
606
|
-
}),
|
|
607
|
+
}), J = e.object({
|
|
607
608
|
capabilities: e.object({
|
|
608
609
|
route_groups: e.record(e.string(), e.boolean()),
|
|
609
610
|
features: e.record(e.string(), e.boolean())
|
|
610
611
|
}),
|
|
611
|
-
currencies: e.array(
|
|
612
|
-
captcha:
|
|
612
|
+
currencies: e.array(pe).nullish().transform((e) => e ?? []),
|
|
613
|
+
captcha: ge.nullish(),
|
|
613
614
|
network: e.object({
|
|
614
615
|
issuer: e.string(),
|
|
615
616
|
client_id: e.string()
|
|
616
617
|
}).nullish()
|
|
617
|
-
}),
|
|
618
|
-
payment:
|
|
619
|
-
merchant:
|
|
618
|
+
}), Y = e.object({
|
|
619
|
+
payment: he,
|
|
620
|
+
merchant: _e
|
|
620
621
|
}), ve = e.object({
|
|
621
622
|
id: e.string(),
|
|
622
623
|
nonce: e.string(),
|
|
@@ -738,16 +739,16 @@ function De(e = {}) {
|
|
|
738
739
|
if (!o.success) throw i("invalid_response", `${t}: ${o.error.issues[0]?.path.join(".")} ${o.error.issues[0]?.message}`);
|
|
739
740
|
return o.data;
|
|
740
741
|
}
|
|
741
|
-
let f = (e) => encodeURIComponent(e), p = j(
|
|
742
|
+
let f = (e) => encodeURIComponent(e), p = j(I), m = j(L), h = j(W), g = j(B), _ = j(G), v = (e, t) => ({
|
|
742
743
|
limit: e.limit ?? t,
|
|
743
744
|
cursor: e.cursor ?? void 0
|
|
744
745
|
});
|
|
745
746
|
async function y(e, t) {
|
|
746
747
|
try {
|
|
747
|
-
return { order: await d(
|
|
748
|
+
return { order: await d(B, e, t) };
|
|
748
749
|
} catch (e) {
|
|
749
750
|
if (n(e) && e.status === 402 && e.order) {
|
|
750
|
-
let t =
|
|
751
|
+
let t = B.safeParse(e.order);
|
|
751
752
|
if (t.success) return {
|
|
752
753
|
order: t.data,
|
|
753
754
|
error: e
|
|
@@ -768,10 +769,10 @@ function De(e = {}) {
|
|
|
768
769
|
});
|
|
769
770
|
},
|
|
770
771
|
getSubscription(e, t) {
|
|
771
|
-
return d(
|
|
772
|
+
return d(I, `/me/subscriptions/${f(e)}`, { signal: t });
|
|
772
773
|
},
|
|
773
774
|
cancelSubscription(e, t) {
|
|
774
|
-
return d(
|
|
775
|
+
return d(I, `/me/subscriptions/${f(e)}/cancel`, {
|
|
775
776
|
method: "POST",
|
|
776
777
|
body: {
|
|
777
778
|
reason: t.reason.trim(),
|
|
@@ -780,19 +781,19 @@ function De(e = {}) {
|
|
|
780
781
|
});
|
|
781
782
|
},
|
|
782
783
|
resumeSubscription(e) {
|
|
783
|
-
return d(
|
|
784
|
+
return d(I, `/me/subscriptions/${f(e)}/resume`, {
|
|
784
785
|
method: "POST",
|
|
785
786
|
body: {}
|
|
786
787
|
});
|
|
787
788
|
},
|
|
788
789
|
setSubscriptionPaymentMethod(e, t) {
|
|
789
|
-
return d(
|
|
790
|
+
return d(I, `/me/subscriptions/${f(e)}/payment-method`, {
|
|
790
791
|
method: "PUT",
|
|
791
792
|
body: { payment_method_id: t }
|
|
792
793
|
});
|
|
793
794
|
},
|
|
794
795
|
previewSubscriptionChange(e, t, n) {
|
|
795
|
-
return d(
|
|
796
|
+
return d(me, `/me/subscriptions/${f(e)}/change/preview`, {
|
|
796
797
|
method: "POST",
|
|
797
798
|
body: {
|
|
798
799
|
price_id: t.priceId,
|
|
@@ -802,13 +803,13 @@ function De(e = {}) {
|
|
|
802
803
|
});
|
|
803
804
|
},
|
|
804
805
|
confirmSubscriptionChange(e) {
|
|
805
|
-
return d(
|
|
806
|
+
return d(q, `/me/subscriptions/${f(e)}/confirm`, {
|
|
806
807
|
method: "POST",
|
|
807
808
|
body: {}
|
|
808
809
|
});
|
|
809
810
|
},
|
|
810
811
|
changeSubscription(e, t) {
|
|
811
|
-
return d(
|
|
812
|
+
return d(q, `/me/subscriptions/${f(e)}/change`, {
|
|
812
813
|
method: "POST",
|
|
813
814
|
body: {
|
|
814
815
|
price_id: t.priceId,
|
|
@@ -825,17 +826,17 @@ function De(e = {}) {
|
|
|
825
826
|
});
|
|
826
827
|
},
|
|
827
828
|
addPaymentMethod(e, t) {
|
|
828
|
-
return d(
|
|
829
|
+
return d(L, "/me/payment-methods", {
|
|
829
830
|
method: "POST",
|
|
830
831
|
body: e,
|
|
831
832
|
headers: t ? { "Idempotency-Key": t } : void 0
|
|
832
833
|
});
|
|
833
834
|
},
|
|
834
835
|
getCart(e) {
|
|
835
|
-
return d(
|
|
836
|
+
return d(U, "/me/cart", { signal: e });
|
|
836
837
|
},
|
|
837
838
|
setCartLine(e, t = {}) {
|
|
838
|
-
return d(
|
|
839
|
+
return d(U, `/me/cart/lines/${f(e)}`, {
|
|
839
840
|
method: "PUT",
|
|
840
841
|
body: t
|
|
841
842
|
});
|
|
@@ -872,7 +873,7 @@ function De(e = {}) {
|
|
|
872
873
|
});
|
|
873
874
|
},
|
|
874
875
|
getOrder(e, t) {
|
|
875
|
-
return d(
|
|
876
|
+
return d(B, `/me/orders/${f(e)}`, { signal: t });
|
|
876
877
|
},
|
|
877
878
|
payOrder(e, t) {
|
|
878
879
|
return y(`/me/orders/${f(e)}/pay`, {
|
|
@@ -892,7 +893,7 @@ function De(e = {}) {
|
|
|
892
893
|
});
|
|
893
894
|
},
|
|
894
895
|
confirmPaymentMethod(e, t) {
|
|
895
|
-
return d(
|
|
896
|
+
return d(L, `/me/payment-methods/${f(e)}/confirm`, {
|
|
896
897
|
method: "POST",
|
|
897
898
|
body: t ? { capture: t } : {}
|
|
898
899
|
});
|
|
@@ -926,10 +927,10 @@ function De(e = {}) {
|
|
|
926
927
|
});
|
|
927
928
|
},
|
|
928
929
|
getAccount(e) {
|
|
929
|
-
return d(
|
|
930
|
+
return d(ue, "/me", { signal: e });
|
|
930
931
|
},
|
|
931
932
|
setLowBalanceLine(e) {
|
|
932
|
-
return d(
|
|
933
|
+
return d(K, `/me/low-balance-lines/${f(e.currency.toUpperCase())}`, {
|
|
933
934
|
method: "PUT",
|
|
934
935
|
body: {
|
|
935
936
|
amount: e.amount,
|
|
@@ -938,7 +939,7 @@ function De(e = {}) {
|
|
|
938
939
|
});
|
|
939
940
|
},
|
|
940
941
|
getUsage(e) {
|
|
941
|
-
return d(
|
|
942
|
+
return d(fe, "/me/usage", {
|
|
942
943
|
query: {
|
|
943
944
|
currency: e.currency,
|
|
944
945
|
group_by: e.groupBy,
|
|
@@ -966,13 +967,13 @@ function De(e = {}) {
|
|
|
966
967
|
});
|
|
967
968
|
},
|
|
968
969
|
getConfig(e) {
|
|
969
|
-
return d(
|
|
970
|
+
return d(J, "/config", {
|
|
970
971
|
signal: e,
|
|
971
972
|
public: !0
|
|
972
973
|
});
|
|
973
974
|
},
|
|
974
975
|
getCustomerConfig(e) {
|
|
975
|
-
return d(
|
|
976
|
+
return d(Y, "/me/config", { signal: e });
|
|
976
977
|
},
|
|
977
978
|
currencies: o
|
|
978
979
|
};
|
|
@@ -982,6 +983,6 @@ function Oe(e) {
|
|
|
982
983
|
}
|
|
983
984
|
var $ = (e) => e instanceof X || e instanceof Error && e.name === "WalletRejectedError" || e instanceof t && e.code === "wallet_rejected";
|
|
984
985
|
//#endregion
|
|
985
|
-
export {
|
|
986
|
+
export { o as A, u as C, r as D, n as E, i as O, f as S, t as T, y as _, De as a, _ as b, Ce as c, T as d, te as f, C as g, O as h, X as i, a as k, Y as l, re as m, be as n, Se as o, ne as p, we as r, $ as s, xe as t, J as u, v, c as w, d as x, m as y };
|
|
986
987
|
|
|
987
|
-
//# sourceMappingURL=client-
|
|
988
|
+
//# sourceMappingURL=client-imFR1UCe.js.map
|