@raystack/frontier 0.8.35 → 0.8.37

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.
@@ -277,6 +277,7 @@ interface FrontierClientBillingOptions {
277
277
  successUrl?: string;
278
278
  cancelUrl?: string;
279
279
  hideDecimals?: boolean;
280
+ cancelAfterTrial?: boolean;
280
281
  }
281
282
  interface FrontierClientOptions {
282
283
  endpoint?: string;
@@ -285,6 +286,7 @@ interface FrontierClientOptions {
285
286
  redirectMagicLinkVerify?: string;
286
287
  callbackUrl?: string;
287
288
  dateFormat?: string;
289
+ shortDateFormat?: string;
288
290
  billing?: FrontierClientBillingOptions;
289
291
  }
290
292
  interface InitialState {
@@ -528,11 +530,14 @@ interface V1Beta1BillingAccountRequestBody {
528
530
  interface V1Beta1BillingTransaction {
529
531
  id?: string;
530
532
  customer_id?: string;
533
+ /** additional metadata for storing event/service that triggered this usage */
531
534
  source?: string;
532
535
  /** @format int64 */
533
536
  amount?: string;
534
537
  type?: string;
535
538
  description?: string;
539
+ /** user_id is the user that triggered this usage */
540
+ user_id?: string;
536
541
  metadata?: object;
537
542
  /** @format date-time */
538
543
  created_at?: string;
@@ -542,6 +547,18 @@ interface V1Beta1BillingTransaction {
542
547
  interface V1Beta1ChangeSubscriptionResponse {
543
548
  phase?: SubscriptionPhase;
544
549
  }
550
+ interface V1Beta1CheckFeatureEntitlementRequest {
551
+ org_id?: string;
552
+ /** ID of the billing account to update the subscription for */
553
+ billing_id?: string;
554
+ /**
555
+ * either provide billing_id of the org or API can infer the default
556
+ * billing ID from either org_id or project_id, not both
557
+ */
558
+ project_id?: string;
559
+ /** feature or product name */
560
+ feature?: string;
561
+ }
545
562
  interface V1Beta1CheckFeatureEntitlementResponse {
546
563
  status?: boolean;
547
564
  }
@@ -600,6 +617,18 @@ interface V1Beta1CreateBillingAccountResponse {
600
617
  /** Created billing account */
601
618
  billing_account?: V1Beta1BillingAccount;
602
619
  }
620
+ interface V1Beta1CreateBillingUsageRequest {
621
+ org_id?: string;
622
+ /** ID of the billing account to update the subscription for */
623
+ billing_id?: string;
624
+ /**
625
+ * either provide billing_id of the org or API can infer the default
626
+ * billing ID from either org_id or project_id, not both
627
+ */
628
+ project_id?: string;
629
+ /** Usage to create */
630
+ usages?: V1Beta1Usage[];
631
+ }
603
632
  interface V1Beta1CreateCheckoutResponse {
604
633
  /** Checkout session */
605
634
  checkout_session?: V1Beta1CheckoutSession;
@@ -610,6 +639,14 @@ interface V1Beta1CreateCurrentUserPreferencesRequest {
610
639
  interface V1Beta1CreateCurrentUserPreferencesResponse {
611
640
  preferences?: V1Beta1Preference[];
612
641
  }
642
+ interface V1Beta1CreateFeatureRequest {
643
+ /** Feature to create */
644
+ body?: V1Beta1FeatureRequestBody;
645
+ }
646
+ interface V1Beta1CreateFeatureResponse {
647
+ /** Created feature */
648
+ feature?: V1Beta1Feature;
649
+ }
613
650
  interface V1Beta1CreateGroupPreferencesResponse {
614
651
  preferences?: V1Beta1Preference[];
615
652
  }
@@ -761,6 +798,14 @@ interface V1Beta1Feature {
761
798
  /** @format date-time */
762
799
  updated_at?: string;
763
800
  }
801
+ interface V1Beta1FeatureRequestBody {
802
+ /** machine friendly name */
803
+ name?: string;
804
+ /** human friendly title */
805
+ title?: string;
806
+ product_ids?: string[];
807
+ metadata?: object;
808
+ }
764
809
  interface V1Beta1GetBillingAccountResponse {
765
810
  /** Billing account */
766
811
  billing_account?: V1Beta1BillingAccount;
@@ -775,6 +820,10 @@ interface V1Beta1GetCurrentUserResponse {
775
820
  user?: V1Beta1User;
776
821
  serviceuser?: V1Beta1ServiceUser;
777
822
  }
823
+ interface V1Beta1GetFeatureResponse {
824
+ /** Feature */
825
+ feature?: V1Beta1Feature;
826
+ }
778
827
  interface V1Beta1GetGroupResponse {
779
828
  group?: V1Beta1Group;
780
829
  }
@@ -876,6 +925,10 @@ interface V1Beta1GroupRequestBody {
876
925
  /** Metadata object for groups that can hold key value pairs defined in Group Metaschema. The metadata object can be used to store arbitrary information about the group such as labels, descriptions etc. The default Group Metaschema contains labels and descripton fields. Update the Group Metaschema to add more fields.<br/>*Example:*`{"labels": {"key": "value"}, "description": "Group description"}` */
877
926
  metadata?: object;
878
927
  }
928
+ interface V1Beta1HasTrialedResponse {
929
+ /** Has the billing account trialed the plan */
930
+ trialed?: boolean;
931
+ }
879
932
  interface V1Beta1Invitation {
880
933
  /**
881
934
  * The unique invitation identifier.
@@ -1728,6 +1781,10 @@ interface V1Beta1UpdateBillingAccountResponse {
1728
1781
  interface V1Beta1UpdateCurrentUserResponse {
1729
1782
  user?: V1Beta1User;
1730
1783
  }
1784
+ interface V1Beta1UpdateFeatureResponse {
1785
+ /** Updated feature */
1786
+ feature?: V1Beta1Feature;
1787
+ }
1731
1788
  interface V1Beta1UpdateGroupResponse {
1732
1789
  group?: V1Beta1Group;
1733
1790
  }
@@ -1771,13 +1828,22 @@ interface V1Beta1UpdateUserResponse {
1771
1828
  user?: V1Beta1User;
1772
1829
  }
1773
1830
  interface V1Beta1Usage {
1831
+ /** uuid used as an idempotent key */
1774
1832
  id?: string;
1775
1833
  customer_id?: string;
1834
+ /** additional metadata for storing event/service that triggered this usage */
1776
1835
  source?: string;
1777
1836
  description?: string;
1837
+ /**
1838
+ * Type is the type of usage, it can be credit or feature
1839
+ * if credit, the amount is the amount of credits that were consumed
1840
+ * if feature, the amount is the amount of features that were used
1841
+ */
1778
1842
  type?: string;
1779
1843
  /** @format int64 */
1780
1844
  amount?: string;
1845
+ /** user_id is the user that triggered this usage */
1846
+ user_id?: string;
1781
1847
  metadata?: object;
1782
1848
  /** @format date-time */
1783
1849
  created_at?: string;
@@ -2201,6 +2267,39 @@ declare class V1Beta1<SecurityDataType = unknown> extends HttpClient<SecurityDat
2201
2267
  * @secure
2202
2268
  */
2203
2269
  frontierServiceListFeatures: (params?: RequestParams) => Promise<HttpResponse<V1Beta1ListFeaturesResponse, RpcStatus>>;
2270
+ /**
2271
+ * @description Create a new feature for platform.
2272
+ *
2273
+ * @tags Feature
2274
+ * @name FrontierServiceCreateFeature
2275
+ * @summary Create feature
2276
+ * @request POST:/v1beta1/billing/features
2277
+ * @secure
2278
+ */
2279
+ frontierServiceCreateFeature: (body: V1Beta1CreateFeatureRequest, params?: RequestParams) => Promise<HttpResponse<V1Beta1CreateFeatureResponse, RpcStatus>>;
2280
+ /**
2281
+ * @description Get a feature by ID.
2282
+ *
2283
+ * @tags Feature
2284
+ * @name FrontierServiceGetFeature
2285
+ * @summary Get feature
2286
+ * @request GET:/v1beta1/billing/features/{id}
2287
+ * @secure
2288
+ */
2289
+ frontierServiceGetFeature: (id: string, params?: RequestParams) => Promise<HttpResponse<V1Beta1GetFeatureResponse, RpcStatus>>;
2290
+ /**
2291
+ * @description Update a feature by ID.
2292
+ *
2293
+ * @tags Feature
2294
+ * @name FrontierServiceUpdateFeature
2295
+ * @summary Update feature
2296
+ * @request PUT:/v1beta1/billing/features/{id}
2297
+ * @secure
2298
+ */
2299
+ frontierServiceUpdateFeature: (id: string, body: {
2300
+ /** Feature to update */
2301
+ body?: V1Beta1FeatureRequestBody | undefined;
2302
+ }, params?: RequestParams) => Promise<HttpResponse<V1Beta1UpdateFeatureResponse, RpcStatus>>;
2204
2303
  /**
2205
2304
  * @description List all plans.
2206
2305
  *
@@ -2631,6 +2730,11 @@ declare class V1Beta1<SecurityDataType = unknown> extends HttpClient<SecurityDat
2631
2730
  * @secure
2632
2731
  */
2633
2732
  frontierServiceCheckFeatureEntitlement: (orgId: string, billingId: string, body: {
2733
+ /**
2734
+ * either provide billing_id of the org or API can infer the default
2735
+ * billing ID from either org_id or project_id, not both
2736
+ */
2737
+ project_id?: string;
2634
2738
  /** feature or product name */
2635
2739
  feature?: string;
2636
2740
  }, params?: RequestParams) => Promise<HttpResponse<V1Beta1CheckFeatureEntitlementResponse, RpcStatus>>;
@@ -2777,6 +2881,11 @@ declare class V1Beta1<SecurityDataType = unknown> extends HttpClient<SecurityDat
2777
2881
  * @secure
2778
2882
  */
2779
2883
  frontierServiceCreateBillingUsage: (orgId: string, billingId: string, body: {
2884
+ /**
2885
+ * either provide billing_id of the org or API can infer the default
2886
+ * billing ID from either org_id or project_id, not both
2887
+ */
2888
+ project_id?: string;
2780
2889
  /** Usage to create */
2781
2890
  usages?: V1Beta1Usage[];
2782
2891
  }, params?: RequestParams) => Promise<HttpResponse<object, RpcStatus>>;
@@ -2825,6 +2934,42 @@ declare class V1Beta1<SecurityDataType = unknown> extends HttpClient<SecurityDat
2825
2934
  * @secure
2826
2935
  */
2827
2936
  frontierServiceGetBillingBalance: (orgId: string, id: string, params?: RequestParams) => Promise<HttpResponse<V1Beta1GetBillingBalanceResponse, RpcStatus>>;
2937
+ /**
2938
+ * @description Check if a billing account has trialed.
2939
+ *
2940
+ * @tags Billing
2941
+ * @name FrontierServiceHasTrialed
2942
+ * @summary Has trialed
2943
+ * @request GET:/v1beta1/organizations/{org_id}/billing/{id}/plans/{plan_id}/trialed
2944
+ * @secure
2945
+ */
2946
+ frontierServiceHasTrialed: (orgId: string, id: string, planId: string, params?: RequestParams) => Promise<HttpResponse<V1Beta1HasTrialedResponse, RpcStatus>>;
2947
+ /**
2948
+ * @description List all invoices of a billing account.
2949
+ *
2950
+ * @tags Invoice
2951
+ * @name FrontierServiceListInvoices2
2952
+ * @summary List invoices
2953
+ * @request GET:/v1beta1/organizations/{org_id}/billing/invoices
2954
+ * @secure
2955
+ */
2956
+ frontierServiceListInvoices2: (orgId: string, query?: {
2957
+ /** ID of the billing account to list invoices for */
2958
+ billing_id?: string;
2959
+ }, params?: RequestParams) => Promise<HttpResponse<V1Beta1ListInvoicesResponse, RpcStatus>>;
2960
+ /**
2961
+ * @description Get the upcoming invoice of a billing account.
2962
+ *
2963
+ * @tags Invoice
2964
+ * @name FrontierServiceGetUpcomingInvoice2
2965
+ * @summary Get upcoming invoice
2966
+ * @request GET:/v1beta1/organizations/{org_id}/billing/invoices/upcoming
2967
+ * @secure
2968
+ */
2969
+ frontierServiceGetUpcomingInvoice2: (orgId: string, query?: {
2970
+ /** ID of the billing account to get the upcoming invoice for */
2971
+ billing_id?: string;
2972
+ }, params?: RequestParams) => Promise<HttpResponse<V1Beta1GetUpcomingInvoiceResponse, RpcStatus>>;
2828
2973
  /**
2829
2974
  * @description Returns all domains whitelisted for an organization (both pending and verified if no filters are provided for the state). The verified domains allow users email with the org's whitelisted domain to join the organization without invitation.
2830
2975
  *
@@ -3116,6 +3261,26 @@ declare class V1Beta1<SecurityDataType = unknown> extends HttpClient<SecurityDat
3116
3261
  * @secure
3117
3262
  */
3118
3263
  frontierServiceUpdateOrganizationRole: (orgId: string, id: string, body: V1Beta1RoleRequestBody, params?: RequestParams) => Promise<HttpResponse<V1Beta1UpdateOrganizationRoleResponse, RpcStatus>>;
3264
+ /**
3265
+ * @description Check if a billing account is entitled to a feature.
3266
+ *
3267
+ * @tags Entitlement
3268
+ * @name FrontierServiceCheckFeatureEntitlement2
3269
+ * @summary Check entitlement
3270
+ * @request POST:/v1beta1/organizations/billing/check
3271
+ * @secure
3272
+ */
3273
+ frontierServiceCheckFeatureEntitlement2: (body: V1Beta1CheckFeatureEntitlementRequest, params?: RequestParams) => Promise<HttpResponse<V1Beta1CheckFeatureEntitlementResponse, RpcStatus>>;
3274
+ /**
3275
+ * @description Report a new billing usage for a billing account.
3276
+ *
3277
+ * @tags Usage
3278
+ * @name FrontierServiceCreateBillingUsage2
3279
+ * @summary Create billing usage
3280
+ * @request POST:/v1beta1/organizations/billing/usages
3281
+ * @secure
3282
+ */
3283
+ frontierServiceCreateBillingUsage2: (body: V1Beta1CreateBillingUsageRequest, params?: RequestParams) => Promise<HttpResponse<object, RpcStatus>>;
3119
3284
  /**
3120
3285
  * No description
3121
3286
  *
@@ -3919,6 +4084,7 @@ interface FrontierContextProviderProps {
3919
4084
  setIsBillingAccountLoading: Dispatch<SetStateAction<boolean>>;
3920
4085
  activeSubscription: V1Beta1Subscription | undefined;
3921
4086
  setActiveSubscription: Dispatch<SetStateAction<V1Beta1Subscription | undefined>>;
4087
+ subscriptions: V1Beta1Subscription[];
3922
4088
  isActiveSubscriptionLoading: boolean;
3923
4089
  setIsActiveSubscriptionLoading: Dispatch<SetStateAction<boolean>>;
3924
4090
  activePlan: V1Beta1Plan | undefined;