@oxy.so/core 7.21.1 → 7.22.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.
@@ -20,8 +20,9 @@ class BillingApi {
20
20
  constructor(ctx) {
21
21
  this.ctx = ctx;
22
22
  }
23
- async renewProductSubscription(request) {
24
- return (0, client_1.parseContract)(client_1.personalPlanCheckoutResultCheck, await this.ctx.request('POST', '/billing/product-subscriptions/renew', (0, client_1.parseContract)(client_1.productSubscriptionRenewalRequestCheck, request), { cache: false }));
23
+ /** The payment provider's customer portal for one named source the caller pays for. */
24
+ async openProductSubscriptionPortal(request) {
25
+ return (0, client_1.parseContract)(client_1.productSubscriptionPortalResponseCheck, await this.ctx.request('POST', '/billing/product-subscriptions/portal', (0, client_1.parseContract)(client_1.productSubscriptionPortalRequestCheck, request), { cache: false }));
25
26
  }
26
27
  async startProductPlanCheckout(request) {
27
28
  return (0, client_1.parseContract)(client_1.personalPlanCheckoutResultCheck, await this.ctx.request('POST', '/billing/checkout/product-plan', (0, client_1.parseContract)(client_1.productPlanCheckoutRequestCheck, request), { cache: false }));
@@ -9,7 +9,7 @@
9
9
  * `payment.controller`, `wallet.routes` in `packages/api`); `Date` columns
10
10
  * arrive as ISO-8601 strings.
11
11
  */
12
- import { cancelProductSubscriptionCheck, parseContract, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productPlanCatalogueCheck, productPlanCheckoutRequestCheck, productSubscriptionCancellationResultCheck, productSubscriptionRenewalRequestCheck, productSubscriptionsResponseCheck, subjectProductAccessCheck, subjectProductAccessQueryCheck, subscriptionCreditGrantsResponseCheck, } from '@oxy.so/contracts/client';
12
+ import { cancelProductSubscriptionCheck, parseContract, personalPlanCatalogueCheck, personalPlanCheckoutRequestCheck, personalPlanCheckoutResultCheck, productPlanCatalogueCheck, productPlanCheckoutRequestCheck, productSubscriptionCancellationResultCheck, productSubscriptionPortalRequestCheck, productSubscriptionPortalResponseCheck, productSubscriptionsResponseCheck, subjectProductAccessCheck, subjectProductAccessQueryCheck, subscriptionCreditGrantsResponseCheck, } from '@oxy.so/contracts/client';
13
13
  const enc = encodeURIComponent;
14
14
  const SUBSCRIPTION_TTL = 2 * 60 * 1000;
15
15
  const WALLET_TTL = 60 * 1000;
@@ -17,8 +17,9 @@ export class BillingApi {
17
17
  constructor(ctx) {
18
18
  this.ctx = ctx;
19
19
  }
20
- async renewProductSubscription(request) {
21
- return parseContract(personalPlanCheckoutResultCheck, await this.ctx.request('POST', '/billing/product-subscriptions/renew', parseContract(productSubscriptionRenewalRequestCheck, request), { cache: false }));
20
+ /** The payment provider's customer portal for one named source the caller pays for. */
21
+ async openProductSubscriptionPortal(request) {
22
+ return parseContract(productSubscriptionPortalResponseCheck, await this.ctx.request('POST', '/billing/product-subscriptions/portal', parseContract(productSubscriptionPortalRequestCheck, request), { cache: false }));
22
23
  }
23
24
  async startProductPlanCheckout(request) {
24
25
  return parseContract(personalPlanCheckoutResultCheck, await this.ctx.request('POST', '/billing/checkout/product-plan', parseContract(productPlanCheckoutRequestCheck, request), { cache: false }));
@@ -9,7 +9,7 @@
9
9
  * `payment.controller`, `wallet.routes` in `packages/api`); `Date` columns
10
10
  * arrive as ISO-8601 strings.
11
11
  */
12
- import type { PersonalPlanCatalogue, PersonalPlanCheckoutRequest, PersonalPlanCheckoutResult, ProductPlanCatalogue, ProductPlanCheckoutRequest, ProductSubscriptionCancellationResult, ProductSubscriptionRenewalRequest, ProductSubscriptionSummary, SubjectProductAccess, SubjectProductAccessQuery, SubscriptionCreditGrant } from '@oxy.so/contracts';
12
+ import type { PersonalPlanCatalogue, PersonalPlanCheckoutRequest, PersonalPlanCheckoutResult, ProductPlanCatalogue, ProductPlanCheckoutRequest, ProductSubscriptionCancellationResult, ProductSubscriptionPortalRequest, ProductSubscriptionPortalResponse, ProductSubscriptionSummary, SubjectProductAccess, SubjectProductAccessQuery, SubscriptionCreditGrant } from '@oxy.so/contracts';
13
13
  import type { OxyContext } from '../client/context';
14
14
  /** Subscription tier. */
15
15
  export type SubscriptionPlan = 'basic' | 'pro' | 'business';
@@ -98,7 +98,8 @@ export interface WalletTransactionsPage {
98
98
  export declare class BillingApi {
99
99
  protected readonly ctx: OxyContext;
100
100
  constructor(ctx: OxyContext);
101
- renewProductSubscription(request: ProductSubscriptionRenewalRequest): Promise<PersonalPlanCheckoutResult>;
101
+ /** The payment provider's customer portal for one named source the caller pays for. */
102
+ openProductSubscriptionPortal(request: ProductSubscriptionPortalRequest): Promise<ProductSubscriptionPortalResponse>;
102
103
  startProductPlanCheckout(request: ProductPlanCheckoutRequest): Promise<PersonalPlanCheckoutResult>;
103
104
  productPlans(productId: string): Promise<ProductPlanCatalogue>;
104
105
  startPersonalPlanCheckout(request: PersonalPlanCheckoutRequest): Promise<PersonalPlanCheckoutResult>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@oxy.so/core",
3
- "version": "7.21.1",
3
+ "version": "7.22.0",
4
4
  "description": "OxyHQ SDK Foundation — API client, authentication, cryptographic identity, and shared utilities",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",
@@ -181,7 +181,7 @@
181
181
  "dependencies": {
182
182
  "@noble/ciphers": "^2.4.0",
183
183
  "@noble/hashes": "^2.4.0",
184
- "@oxy.so/contracts": "6.8.0",
184
+ "@oxy.so/contracts": "6.9.0",
185
185
  "@oxy.so/protocol": "^1.6.1",
186
186
  "@oxy.so/telemetry": "^2.1.0",
187
187
  "@scure/bip39": "^2.4.0",
@@ -17,7 +17,8 @@ import type {
17
17
  ProductPlanCatalogue,
18
18
  ProductPlanCheckoutRequest,
19
19
  ProductSubscriptionCancellationResult,
20
- ProductSubscriptionRenewalRequest,
20
+ ProductSubscriptionPortalRequest,
21
+ ProductSubscriptionPortalResponse,
21
22
  ProductSubscriptionSummary,
22
23
  SubjectProductAccess,
23
24
  SubjectProductAccessQuery,
@@ -32,7 +33,8 @@ import {
32
33
  productPlanCatalogueCheck,
33
34
  productPlanCheckoutRequestCheck,
34
35
  productSubscriptionCancellationResultCheck,
35
- productSubscriptionRenewalRequestCheck,
36
+ productSubscriptionPortalRequestCheck,
37
+ productSubscriptionPortalResponseCheck,
36
38
  productSubscriptionsResponseCheck,
37
39
  subjectProductAccessCheck,
38
40
  subjectProductAccessQueryCheck,
@@ -136,15 +138,16 @@ export interface WalletTransactionsPage {
136
138
  export class BillingApi {
137
139
  constructor(protected readonly ctx: OxyContext) {}
138
140
 
139
- async renewProductSubscription(
140
- request: ProductSubscriptionRenewalRequest,
141
- ): Promise<PersonalPlanCheckoutResult> {
141
+ /** The payment provider's customer portal for one named source the caller pays for. */
142
+ async openProductSubscriptionPortal(
143
+ request: ProductSubscriptionPortalRequest,
144
+ ): Promise<ProductSubscriptionPortalResponse> {
142
145
  return parseContract(
143
- personalPlanCheckoutResultCheck,
146
+ productSubscriptionPortalResponseCheck,
144
147
  await this.ctx.request<unknown>(
145
148
  'POST',
146
- '/billing/product-subscriptions/renew',
147
- parseContract(productSubscriptionRenewalRequestCheck, request),
149
+ '/billing/product-subscriptions/portal',
150
+ parseContract(productSubscriptionPortalRequestCheck, request),
148
151
  { cache: false },
149
152
  ),
150
153
  );