@drmhse/sso-sdk 0.3.1 → 0.3.3

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/README.md CHANGED
@@ -210,6 +210,45 @@ await sso.organizations.setSmtp('acme-corp', {
210
210
  });
211
211
  ```
212
212
 
213
+ ## Subscription & Billing
214
+
215
+ The SDK provides provider-agnostic billing integration that works with both Stripe and Polar.
216
+
217
+ ```typescript
218
+ // Check billing status
219
+ const billingInfo = await sso.organizations.billing.getInfo('acme-corp');
220
+ console.log(billingInfo.has_billing_account); // true/false
221
+ console.log(billingInfo.provider); // "stripe" or "polar"
222
+
223
+ // Open billing portal for subscription management
224
+ const portal = await sso.organizations.billing.createPortalSession('acme-corp', {
225
+ return_url: 'https://app.acme.com/settings/billing'
226
+ });
227
+ // Redirect user to manage their subscription
228
+ window.location.href = portal.url;
229
+ ```
230
+
231
+ ### BYOP - Bring Your Own Payment
232
+
233
+ Organizations can configure their own billing provider credentials to charge their end-users:
234
+
235
+ ```typescript
236
+ // Configure organization's own Stripe credentials
237
+ await sso.organizations.billingCredentials.set('acme-corp', 'stripe', {
238
+ api_key: 'sk_live_...',
239
+ webhook_secret: 'whsec_...',
240
+ mode: 'live' // or 'test'
241
+ });
242
+
243
+ // Check credential status
244
+ const status = await sso.organizations.billingCredentials.get('acme-corp', 'stripe');
245
+ console.log(status.configured); // true
246
+ console.log(status.mode); // "live"
247
+
248
+ // Remove credentials
249
+ await sso.organizations.billingCredentials.delete('acme-corp', 'stripe');
250
+ ```
251
+
213
252
  ## Services & API Keys
214
253
 
215
254
  ```typescript
package/dist/index.d.mts CHANGED
@@ -3688,6 +3688,124 @@ declare class OrganizationsModule {
3688
3688
  */
3689
3689
  test: (orgSlug: string, configId: string) => Promise<TestConnectionResponse>;
3690
3690
  };
3691
+ /**
3692
+ * Billing and subscription management methods
3693
+ */
3694
+ billing: {
3695
+ /**
3696
+ * Get billing information for an organization.
3697
+ * Returns whether a billing account exists and which provider is being used.
3698
+ * Requires 'owner' or 'admin' role.
3699
+ *
3700
+ * @param orgSlug Organization slug
3701
+ * @returns Billing information
3702
+ *
3703
+ * @example
3704
+ * ```typescript
3705
+ * const info = await sso.organizations.billing.getInfo('acme-corp');
3706
+ * if (info.has_billing_account) {
3707
+ * console.log('Billing provider:', info.provider);
3708
+ * }
3709
+ * ```
3710
+ */
3711
+ getInfo: (orgSlug: string) => Promise<{
3712
+ has_billing_account: boolean;
3713
+ provider: string | null;
3714
+ }>;
3715
+ /**
3716
+ * Create a billing portal session.
3717
+ * Redirects the user to the billing provider's self-service portal to manage their subscription,
3718
+ * update payment methods, view invoices, etc.
3719
+ * Requires 'owner' role.
3720
+ *
3721
+ * @param orgSlug Organization slug
3722
+ * @param returnUrl URL to redirect the user to after they leave the portal
3723
+ * @returns Object containing the portal session URL
3724
+ *
3725
+ * @example
3726
+ * ```typescript
3727
+ * const session = await sso.organizations.billing.createPortalSession('acme-corp', {
3728
+ * return_url: 'https://app.acme.com/billing'
3729
+ * });
3730
+ * // Redirect user to billing portal
3731
+ * window.location.href = session.url;
3732
+ * ```
3733
+ */
3734
+ createPortalSession: (orgSlug: string, payload: {
3735
+ return_url: string;
3736
+ }) => Promise<{
3737
+ url: string;
3738
+ }>;
3739
+ };
3740
+ /**
3741
+ * BYOP (Bring Your Own Payment) credential management.
3742
+ * Allows organizations to configure their own billing provider credentials
3743
+ * to charge their end-users directly.
3744
+ */
3745
+ billingCredentials: {
3746
+ /**
3747
+ * Get the status of billing credentials for a provider.
3748
+ * Returns whether credentials are configured and the mode (test/live).
3749
+ * Requires 'owner' role.
3750
+ *
3751
+ * @param orgSlug Organization slug
3752
+ * @param provider Billing provider ('stripe' or 'polar')
3753
+ * @returns Credential configuration status
3754
+ *
3755
+ * @example
3756
+ * ```typescript
3757
+ * const status = await sso.organizations.billingCredentials.get('acme-corp', 'stripe');
3758
+ * if (status.configured) {
3759
+ * console.log('Mode:', status.mode); // 'test' or 'live'
3760
+ * console.log('Enabled:', status.enabled);
3761
+ * }
3762
+ * ```
3763
+ */
3764
+ get: (orgSlug: string, provider: "stripe" | "polar") => Promise<{
3765
+ configured: boolean;
3766
+ provider: string;
3767
+ mode: "test" | "live" | null;
3768
+ enabled: boolean;
3769
+ }>;
3770
+ /**
3771
+ * Set or update billing credentials for a provider.
3772
+ * Enables the organization to charge their end-users using their own
3773
+ * payment provider account.
3774
+ * Requires 'owner' role.
3775
+ *
3776
+ * @param orgSlug Organization slug
3777
+ * @param provider Billing provider ('stripe' or 'polar')
3778
+ * @param payload Billing credentials
3779
+ *
3780
+ * @example
3781
+ * ```typescript
3782
+ * await sso.organizations.billingCredentials.set('acme-corp', 'stripe', {
3783
+ * api_key: 'sk_live_...',
3784
+ * webhook_secret: 'whsec_...',
3785
+ * mode: 'live'
3786
+ * });
3787
+ * ```
3788
+ */
3789
+ set: (orgSlug: string, provider: "stripe" | "polar", payload: {
3790
+ api_key: string;
3791
+ webhook_secret: string;
3792
+ mode: "test" | "live";
3793
+ }) => Promise<void>;
3794
+ /**
3795
+ * Delete billing credentials for a provider.
3796
+ * The organization will no longer be able to charge end-users directly.
3797
+ * Requires 'owner' role.
3798
+ *
3799
+ * @param orgSlug Organization slug
3800
+ * @param provider Billing provider ('stripe' or 'polar')
3801
+ *
3802
+ * @example
3803
+ * ```typescript
3804
+ * await sso.organizations.billingCredentials.delete('acme-corp', 'stripe');
3805
+ * ```
3806
+ */
3807
+ delete: (orgSlug: string, provider: "stripe" | "polar") => Promise<void>;
3808
+ };
3691
3809
  }
3692
3810
 
3693
3811
  /**
@@ -4348,6 +4466,32 @@ declare class PlatformModule {
4348
4466
  * ```
4349
4467
  */
4350
4468
  updateTier: (orgId: string, payload: UpdateOrganizationTierPayload) => Promise<Organization>;
4469
+ /**
4470
+ * Update an organization's feature overrides.
4471
+ *
4472
+ * @param orgId Organization ID
4473
+ * @param payload Feature override flags
4474
+ * @returns Updated organization
4475
+ *
4476
+ * @example
4477
+ * ```typescript
4478
+ * await sso.platform.organizations.updateFeatures('org-id', {
4479
+ * allow_saml: true,
4480
+ * allow_scim: false,
4481
+ * allow_custom_domain: true,
4482
+ * allow_custom_branding: false
4483
+ * });
4484
+ * ```
4485
+ */
4486
+ updateFeatures: (orgId: string, payload: {
4487
+ allow_saml?: boolean;
4488
+ allow_scim?: boolean;
4489
+ allow_custom_domain?: boolean;
4490
+ allow_custom_branding?: boolean;
4491
+ allow_advanced_risk_engine?: boolean;
4492
+ allow_siem_integration?: boolean;
4493
+ allow_webhooks?: boolean;
4494
+ }) => Promise<Organization>;
4351
4495
  /**
4352
4496
  * Delete an organization and all its associated data.
4353
4497
  * This is a destructive operation that cannot be undone.
package/dist/index.d.ts CHANGED
@@ -3688,6 +3688,124 @@ declare class OrganizationsModule {
3688
3688
  */
3689
3689
  test: (orgSlug: string, configId: string) => Promise<TestConnectionResponse>;
3690
3690
  };
3691
+ /**
3692
+ * Billing and subscription management methods
3693
+ */
3694
+ billing: {
3695
+ /**
3696
+ * Get billing information for an organization.
3697
+ * Returns whether a billing account exists and which provider is being used.
3698
+ * Requires 'owner' or 'admin' role.
3699
+ *
3700
+ * @param orgSlug Organization slug
3701
+ * @returns Billing information
3702
+ *
3703
+ * @example
3704
+ * ```typescript
3705
+ * const info = await sso.organizations.billing.getInfo('acme-corp');
3706
+ * if (info.has_billing_account) {
3707
+ * console.log('Billing provider:', info.provider);
3708
+ * }
3709
+ * ```
3710
+ */
3711
+ getInfo: (orgSlug: string) => Promise<{
3712
+ has_billing_account: boolean;
3713
+ provider: string | null;
3714
+ }>;
3715
+ /**
3716
+ * Create a billing portal session.
3717
+ * Redirects the user to the billing provider's self-service portal to manage their subscription,
3718
+ * update payment methods, view invoices, etc.
3719
+ * Requires 'owner' role.
3720
+ *
3721
+ * @param orgSlug Organization slug
3722
+ * @param returnUrl URL to redirect the user to after they leave the portal
3723
+ * @returns Object containing the portal session URL
3724
+ *
3725
+ * @example
3726
+ * ```typescript
3727
+ * const session = await sso.organizations.billing.createPortalSession('acme-corp', {
3728
+ * return_url: 'https://app.acme.com/billing'
3729
+ * });
3730
+ * // Redirect user to billing portal
3731
+ * window.location.href = session.url;
3732
+ * ```
3733
+ */
3734
+ createPortalSession: (orgSlug: string, payload: {
3735
+ return_url: string;
3736
+ }) => Promise<{
3737
+ url: string;
3738
+ }>;
3739
+ };
3740
+ /**
3741
+ * BYOP (Bring Your Own Payment) credential management.
3742
+ * Allows organizations to configure their own billing provider credentials
3743
+ * to charge their end-users directly.
3744
+ */
3745
+ billingCredentials: {
3746
+ /**
3747
+ * Get the status of billing credentials for a provider.
3748
+ * Returns whether credentials are configured and the mode (test/live).
3749
+ * Requires 'owner' role.
3750
+ *
3751
+ * @param orgSlug Organization slug
3752
+ * @param provider Billing provider ('stripe' or 'polar')
3753
+ * @returns Credential configuration status
3754
+ *
3755
+ * @example
3756
+ * ```typescript
3757
+ * const status = await sso.organizations.billingCredentials.get('acme-corp', 'stripe');
3758
+ * if (status.configured) {
3759
+ * console.log('Mode:', status.mode); // 'test' or 'live'
3760
+ * console.log('Enabled:', status.enabled);
3761
+ * }
3762
+ * ```
3763
+ */
3764
+ get: (orgSlug: string, provider: "stripe" | "polar") => Promise<{
3765
+ configured: boolean;
3766
+ provider: string;
3767
+ mode: "test" | "live" | null;
3768
+ enabled: boolean;
3769
+ }>;
3770
+ /**
3771
+ * Set or update billing credentials for a provider.
3772
+ * Enables the organization to charge their end-users using their own
3773
+ * payment provider account.
3774
+ * Requires 'owner' role.
3775
+ *
3776
+ * @param orgSlug Organization slug
3777
+ * @param provider Billing provider ('stripe' or 'polar')
3778
+ * @param payload Billing credentials
3779
+ *
3780
+ * @example
3781
+ * ```typescript
3782
+ * await sso.organizations.billingCredentials.set('acme-corp', 'stripe', {
3783
+ * api_key: 'sk_live_...',
3784
+ * webhook_secret: 'whsec_...',
3785
+ * mode: 'live'
3786
+ * });
3787
+ * ```
3788
+ */
3789
+ set: (orgSlug: string, provider: "stripe" | "polar", payload: {
3790
+ api_key: string;
3791
+ webhook_secret: string;
3792
+ mode: "test" | "live";
3793
+ }) => Promise<void>;
3794
+ /**
3795
+ * Delete billing credentials for a provider.
3796
+ * The organization will no longer be able to charge end-users directly.
3797
+ * Requires 'owner' role.
3798
+ *
3799
+ * @param orgSlug Organization slug
3800
+ * @param provider Billing provider ('stripe' or 'polar')
3801
+ *
3802
+ * @example
3803
+ * ```typescript
3804
+ * await sso.organizations.billingCredentials.delete('acme-corp', 'stripe');
3805
+ * ```
3806
+ */
3807
+ delete: (orgSlug: string, provider: "stripe" | "polar") => Promise<void>;
3808
+ };
3691
3809
  }
3692
3810
 
3693
3811
  /**
@@ -4348,6 +4466,32 @@ declare class PlatformModule {
4348
4466
  * ```
4349
4467
  */
4350
4468
  updateTier: (orgId: string, payload: UpdateOrganizationTierPayload) => Promise<Organization>;
4469
+ /**
4470
+ * Update an organization's feature overrides.
4471
+ *
4472
+ * @param orgId Organization ID
4473
+ * @param payload Feature override flags
4474
+ * @returns Updated organization
4475
+ *
4476
+ * @example
4477
+ * ```typescript
4478
+ * await sso.platform.organizations.updateFeatures('org-id', {
4479
+ * allow_saml: true,
4480
+ * allow_scim: false,
4481
+ * allow_custom_domain: true,
4482
+ * allow_custom_branding: false
4483
+ * });
4484
+ * ```
4485
+ */
4486
+ updateFeatures: (orgId: string, payload: {
4487
+ allow_saml?: boolean;
4488
+ allow_scim?: boolean;
4489
+ allow_custom_domain?: boolean;
4490
+ allow_custom_branding?: boolean;
4491
+ allow_advanced_risk_engine?: boolean;
4492
+ allow_siem_integration?: boolean;
4493
+ allow_webhooks?: boolean;
4494
+ }) => Promise<Organization>;
4351
4495
  /**
4352
4496
  * Delete an organization and all its associated data.
4353
4497
  * This is a destructive operation that cannot be undone.
package/dist/index.js CHANGED
@@ -1986,6 +1986,137 @@ var OrganizationsModule = class {
1986
1986
  return response.data;
1987
1987
  }
1988
1988
  };
1989
+ // ============================================================================
1990
+ // BILLING
1991
+ // ============================================================================
1992
+ /**
1993
+ * Billing and subscription management methods
1994
+ */
1995
+ this.billing = {
1996
+ /**
1997
+ * Get billing information for an organization.
1998
+ * Returns whether a billing account exists and which provider is being used.
1999
+ * Requires 'owner' or 'admin' role.
2000
+ *
2001
+ * @param orgSlug Organization slug
2002
+ * @returns Billing information
2003
+ *
2004
+ * @example
2005
+ * ```typescript
2006
+ * const info = await sso.organizations.billing.getInfo('acme-corp');
2007
+ * if (info.has_billing_account) {
2008
+ * console.log('Billing provider:', info.provider);
2009
+ * }
2010
+ * ```
2011
+ */
2012
+ getInfo: async (orgSlug) => {
2013
+ const response = await this.http.get(
2014
+ `/api/organizations/${orgSlug}/billing/info`
2015
+ );
2016
+ return response.data;
2017
+ },
2018
+ /**
2019
+ * Create a billing portal session.
2020
+ * Redirects the user to the billing provider's self-service portal to manage their subscription,
2021
+ * update payment methods, view invoices, etc.
2022
+ * Requires 'owner' role.
2023
+ *
2024
+ * @param orgSlug Organization slug
2025
+ * @param returnUrl URL to redirect the user to after they leave the portal
2026
+ * @returns Object containing the portal session URL
2027
+ *
2028
+ * @example
2029
+ * ```typescript
2030
+ * const session = await sso.organizations.billing.createPortalSession('acme-corp', {
2031
+ * return_url: 'https://app.acme.com/billing'
2032
+ * });
2033
+ * // Redirect user to billing portal
2034
+ * window.location.href = session.url;
2035
+ * ```
2036
+ */
2037
+ createPortalSession: async (orgSlug, payload) => {
2038
+ const response = await this.http.post(
2039
+ `/api/organizations/${orgSlug}/billing/portal`,
2040
+ payload
2041
+ );
2042
+ return response.data;
2043
+ }
2044
+ };
2045
+ // ============================================================================
2046
+ // BYOP - BRING YOUR OWN PAYMENT
2047
+ // ============================================================================
2048
+ /**
2049
+ * BYOP (Bring Your Own Payment) credential management.
2050
+ * Allows organizations to configure their own billing provider credentials
2051
+ * to charge their end-users directly.
2052
+ */
2053
+ this.billingCredentials = {
2054
+ /**
2055
+ * Get the status of billing credentials for a provider.
2056
+ * Returns whether credentials are configured and the mode (test/live).
2057
+ * Requires 'owner' role.
2058
+ *
2059
+ * @param orgSlug Organization slug
2060
+ * @param provider Billing provider ('stripe' or 'polar')
2061
+ * @returns Credential configuration status
2062
+ *
2063
+ * @example
2064
+ * ```typescript
2065
+ * const status = await sso.organizations.billingCredentials.get('acme-corp', 'stripe');
2066
+ * if (status.configured) {
2067
+ * console.log('Mode:', status.mode); // 'test' or 'live'
2068
+ * console.log('Enabled:', status.enabled);
2069
+ * }
2070
+ * ```
2071
+ */
2072
+ get: async (orgSlug, provider) => {
2073
+ const response = await this.http.get(`/api/organizations/${orgSlug}/billing-credentials/${provider}`);
2074
+ return response.data;
2075
+ },
2076
+ /**
2077
+ * Set or update billing credentials for a provider.
2078
+ * Enables the organization to charge their end-users using their own
2079
+ * payment provider account.
2080
+ * Requires 'owner' role.
2081
+ *
2082
+ * @param orgSlug Organization slug
2083
+ * @param provider Billing provider ('stripe' or 'polar')
2084
+ * @param payload Billing credentials
2085
+ *
2086
+ * @example
2087
+ * ```typescript
2088
+ * await sso.organizations.billingCredentials.set('acme-corp', 'stripe', {
2089
+ * api_key: 'sk_live_...',
2090
+ * webhook_secret: 'whsec_...',
2091
+ * mode: 'live'
2092
+ * });
2093
+ * ```
2094
+ */
2095
+ set: async (orgSlug, provider, payload) => {
2096
+ await this.http.post(
2097
+ `/api/organizations/${orgSlug}/billing-credentials/${provider}`,
2098
+ payload
2099
+ );
2100
+ },
2101
+ /**
2102
+ * Delete billing credentials for a provider.
2103
+ * The organization will no longer be able to charge end-users directly.
2104
+ * Requires 'owner' role.
2105
+ *
2106
+ * @param orgSlug Organization slug
2107
+ * @param provider Billing provider ('stripe' or 'polar')
2108
+ *
2109
+ * @example
2110
+ * ```typescript
2111
+ * await sso.organizations.billingCredentials.delete('acme-corp', 'stripe');
2112
+ * ```
2113
+ */
2114
+ delete: async (orgSlug, provider) => {
2115
+ await this.http.delete(
2116
+ `/api/organizations/${orgSlug}/billing-credentials/${provider}`
2117
+ );
2118
+ }
2119
+ };
1989
2120
  this.auditLogs = new AuditLogsModule(http);
1990
2121
  this.webhooks = new WebhooksModule(http);
1991
2122
  }
@@ -3122,6 +3253,30 @@ var PlatformModule = class {
3122
3253
  );
3123
3254
  return response.data;
3124
3255
  },
3256
+ /**
3257
+ * Update an organization's feature overrides.
3258
+ *
3259
+ * @param orgId Organization ID
3260
+ * @param payload Feature override flags
3261
+ * @returns Updated organization
3262
+ *
3263
+ * @example
3264
+ * ```typescript
3265
+ * await sso.platform.organizations.updateFeatures('org-id', {
3266
+ * allow_saml: true,
3267
+ * allow_scim: false,
3268
+ * allow_custom_domain: true,
3269
+ * allow_custom_branding: false
3270
+ * });
3271
+ * ```
3272
+ */
3273
+ updateFeatures: async (orgId, payload) => {
3274
+ const response = await this.http.patch(
3275
+ `/api/platform/organizations/${orgId}/features`,
3276
+ payload
3277
+ );
3278
+ return response.data;
3279
+ },
3125
3280
  /**
3126
3281
  * Delete an organization and all its associated data.
3127
3282
  * This is a destructive operation that cannot be undone.
package/dist/index.mjs CHANGED
@@ -1943,6 +1943,137 @@ var OrganizationsModule = class {
1943
1943
  return response.data;
1944
1944
  }
1945
1945
  };
1946
+ // ============================================================================
1947
+ // BILLING
1948
+ // ============================================================================
1949
+ /**
1950
+ * Billing and subscription management methods
1951
+ */
1952
+ this.billing = {
1953
+ /**
1954
+ * Get billing information for an organization.
1955
+ * Returns whether a billing account exists and which provider is being used.
1956
+ * Requires 'owner' or 'admin' role.
1957
+ *
1958
+ * @param orgSlug Organization slug
1959
+ * @returns Billing information
1960
+ *
1961
+ * @example
1962
+ * ```typescript
1963
+ * const info = await sso.organizations.billing.getInfo('acme-corp');
1964
+ * if (info.has_billing_account) {
1965
+ * console.log('Billing provider:', info.provider);
1966
+ * }
1967
+ * ```
1968
+ */
1969
+ getInfo: async (orgSlug) => {
1970
+ const response = await this.http.get(
1971
+ `/api/organizations/${orgSlug}/billing/info`
1972
+ );
1973
+ return response.data;
1974
+ },
1975
+ /**
1976
+ * Create a billing portal session.
1977
+ * Redirects the user to the billing provider's self-service portal to manage their subscription,
1978
+ * update payment methods, view invoices, etc.
1979
+ * Requires 'owner' role.
1980
+ *
1981
+ * @param orgSlug Organization slug
1982
+ * @param returnUrl URL to redirect the user to after they leave the portal
1983
+ * @returns Object containing the portal session URL
1984
+ *
1985
+ * @example
1986
+ * ```typescript
1987
+ * const session = await sso.organizations.billing.createPortalSession('acme-corp', {
1988
+ * return_url: 'https://app.acme.com/billing'
1989
+ * });
1990
+ * // Redirect user to billing portal
1991
+ * window.location.href = session.url;
1992
+ * ```
1993
+ */
1994
+ createPortalSession: async (orgSlug, payload) => {
1995
+ const response = await this.http.post(
1996
+ `/api/organizations/${orgSlug}/billing/portal`,
1997
+ payload
1998
+ );
1999
+ return response.data;
2000
+ }
2001
+ };
2002
+ // ============================================================================
2003
+ // BYOP - BRING YOUR OWN PAYMENT
2004
+ // ============================================================================
2005
+ /**
2006
+ * BYOP (Bring Your Own Payment) credential management.
2007
+ * Allows organizations to configure their own billing provider credentials
2008
+ * to charge their end-users directly.
2009
+ */
2010
+ this.billingCredentials = {
2011
+ /**
2012
+ * Get the status of billing credentials for a provider.
2013
+ * Returns whether credentials are configured and the mode (test/live).
2014
+ * Requires 'owner' role.
2015
+ *
2016
+ * @param orgSlug Organization slug
2017
+ * @param provider Billing provider ('stripe' or 'polar')
2018
+ * @returns Credential configuration status
2019
+ *
2020
+ * @example
2021
+ * ```typescript
2022
+ * const status = await sso.organizations.billingCredentials.get('acme-corp', 'stripe');
2023
+ * if (status.configured) {
2024
+ * console.log('Mode:', status.mode); // 'test' or 'live'
2025
+ * console.log('Enabled:', status.enabled);
2026
+ * }
2027
+ * ```
2028
+ */
2029
+ get: async (orgSlug, provider) => {
2030
+ const response = await this.http.get(`/api/organizations/${orgSlug}/billing-credentials/${provider}`);
2031
+ return response.data;
2032
+ },
2033
+ /**
2034
+ * Set or update billing credentials for a provider.
2035
+ * Enables the organization to charge their end-users using their own
2036
+ * payment provider account.
2037
+ * Requires 'owner' role.
2038
+ *
2039
+ * @param orgSlug Organization slug
2040
+ * @param provider Billing provider ('stripe' or 'polar')
2041
+ * @param payload Billing credentials
2042
+ *
2043
+ * @example
2044
+ * ```typescript
2045
+ * await sso.organizations.billingCredentials.set('acme-corp', 'stripe', {
2046
+ * api_key: 'sk_live_...',
2047
+ * webhook_secret: 'whsec_...',
2048
+ * mode: 'live'
2049
+ * });
2050
+ * ```
2051
+ */
2052
+ set: async (orgSlug, provider, payload) => {
2053
+ await this.http.post(
2054
+ `/api/organizations/${orgSlug}/billing-credentials/${provider}`,
2055
+ payload
2056
+ );
2057
+ },
2058
+ /**
2059
+ * Delete billing credentials for a provider.
2060
+ * The organization will no longer be able to charge end-users directly.
2061
+ * Requires 'owner' role.
2062
+ *
2063
+ * @param orgSlug Organization slug
2064
+ * @param provider Billing provider ('stripe' or 'polar')
2065
+ *
2066
+ * @example
2067
+ * ```typescript
2068
+ * await sso.organizations.billingCredentials.delete('acme-corp', 'stripe');
2069
+ * ```
2070
+ */
2071
+ delete: async (orgSlug, provider) => {
2072
+ await this.http.delete(
2073
+ `/api/organizations/${orgSlug}/billing-credentials/${provider}`
2074
+ );
2075
+ }
2076
+ };
1946
2077
  this.auditLogs = new AuditLogsModule(http);
1947
2078
  this.webhooks = new WebhooksModule(http);
1948
2079
  }
@@ -3079,6 +3210,30 @@ var PlatformModule = class {
3079
3210
  );
3080
3211
  return response.data;
3081
3212
  },
3213
+ /**
3214
+ * Update an organization's feature overrides.
3215
+ *
3216
+ * @param orgId Organization ID
3217
+ * @param payload Feature override flags
3218
+ * @returns Updated organization
3219
+ *
3220
+ * @example
3221
+ * ```typescript
3222
+ * await sso.platform.organizations.updateFeatures('org-id', {
3223
+ * allow_saml: true,
3224
+ * allow_scim: false,
3225
+ * allow_custom_domain: true,
3226
+ * allow_custom_branding: false
3227
+ * });
3228
+ * ```
3229
+ */
3230
+ updateFeatures: async (orgId, payload) => {
3231
+ const response = await this.http.patch(
3232
+ `/api/platform/organizations/${orgId}/features`,
3233
+ payload
3234
+ );
3235
+ return response.data;
3236
+ },
3082
3237
  /**
3083
3238
  * Delete an organization and all its associated data.
3084
3239
  * This is a destructive operation that cannot be undone.
package/package.json CHANGED
@@ -1,10 +1,22 @@
1
1
  {
2
2
  "name": "@drmhse/sso-sdk",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Zero-dependency TypeScript SDK for AuthOS, the multi-tenant authentication platform",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",
7
7
  "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": {
11
+ "types": "./dist/index.d.mts",
12
+ "default": "./dist/index.mjs"
13
+ },
14
+ "require": {
15
+ "types": "./dist/index.d.ts",
16
+ "default": "./dist/index.js"
17
+ }
18
+ }
19
+ },
8
20
  "files": [
9
21
  "dist"
10
22
  ],