@raystack/frontier 0.120.0 → 0.121.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.
@@ -1,7 +1,7 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import React, { ComponentProps, ReactNode, ComponentPropsWithRef, Dispatch, SetStateAction } from 'react';
3
3
  import { Flex, ThemeProviderProps } from '@raystack/apsara';
4
- import { ConsentDocument, FlowIntent, Plan, ServiceUserToken, Organization, Group, User, BillingAccount, Subscription, PaymentMethod, OrganizationKyc, BillingAccountDetails } from '@raystack/proton/frontier';
4
+ import { Plan, ConsentDocument, FlowIntent, ServiceUserToken, Organization, Group, User, BillingAccount, Subscription, PaymentMethod, OrganizationKyc, BillingAccountDetails } from '@raystack/proton/frontier';
5
5
  import * as yup from 'yup';
6
6
  import { QueryClient, UseQueryResult, UseMutationResult } from '@tanstack/react-query';
7
7
  import { ConnectError } from '@connectrpc/connect';
@@ -48,6 +48,130 @@ type AuthHeaderProps = ComponentPropsWithRef<'div'> & {
48
48
  };
49
49
  declare const AuthHeader: ({ title, logo }: AuthHeaderProps) => react_jsx_runtime.JSX.Element;
50
50
 
51
+ interface BasePlan extends Omit<Plan, 'title'> {
52
+ features?: Record<string, string>;
53
+ title: string;
54
+ }
55
+
56
+ /**
57
+ * A render-prop slot: receives a context object (shape defined per view/slot)
58
+ * and returns the node to render. Lets a consumer override an internal element
59
+ * of a view while keeping the customisation on their side.
60
+ *
61
+ * @example
62
+ * interface ViewSlots {
63
+ * addButton?: Slot<{ onClick: () => void; disabled: boolean }>;
64
+ * }
65
+ */
66
+ type Slot<TContext> = (context: TContext) => React.ReactNode;
67
+ interface FrontierClientBillingOptions {
68
+ supportEmail?: string;
69
+ successUrl?: string;
70
+ cancelUrl?: string;
71
+ hideDecimals?: boolean;
72
+ cancelAfterTrial?: boolean;
73
+ showPerMonthPrice?: boolean;
74
+ tokenProductId?: string;
75
+ basePlan?: BasePlan;
76
+ }
77
+ interface EntityTerminologies {
78
+ singular: string;
79
+ plural: string;
80
+ }
81
+ interface FrontierClientCustomizationOptions {
82
+ terminology?: {
83
+ organization?: EntityTerminologies;
84
+ project?: EntityTerminologies;
85
+ team?: EntityTerminologies;
86
+ member?: EntityTerminologies;
87
+ user?: EntityTerminologies;
88
+ appName?: string;
89
+ };
90
+ messages?: {
91
+ billing?: {
92
+ plan_change?: Record<string, string>;
93
+ };
94
+ general?: Record<string, string>;
95
+ };
96
+ }
97
+ interface FrontierClientOptions {
98
+ locale?: string;
99
+ connectEndpoint?: string;
100
+ redirectSignup?: string;
101
+ redirectLogin?: string;
102
+ redirectMagicLinkVerify?: string;
103
+ callbackUrl?: string;
104
+ dateFormat?: string;
105
+ shortDateFormat?: string;
106
+ billing?: FrontierClientBillingOptions;
107
+ customization?: FrontierClientCustomizationOptions;
108
+ }
109
+ interface InitialState {
110
+ sessionId?: string | null;
111
+ }
112
+ type CustomHeaderValue = string | (() => string);
113
+ interface DeleteBlocker {
114
+ type: string;
115
+ subject: string;
116
+ count?: number;
117
+ }
118
+ type DeleteBlockedPayload = {
119
+ entity: 'organization' | 'project';
120
+ blockers: DeleteBlocker[];
121
+ } | {
122
+ entity: 'user';
123
+ organizationsToDelete: {
124
+ id: string;
125
+ title: string;
126
+ blockers: DeleteBlocker[];
127
+ }[];
128
+ soleOwnerOf: {
129
+ id: string;
130
+ title: string;
131
+ }[];
132
+ };
133
+ type DeleteBlockedContext = DeleteBlockedPayload & {
134
+ entityLabel: string;
135
+ close: () => void;
136
+ };
137
+ interface FrontierProviderSlots {
138
+ deleteBlockedDialog?: Slot<DeleteBlockedContext>;
139
+ }
140
+ interface FrontierProviderProps {
141
+ config: FrontierClientOptions;
142
+ children: React.ReactNode;
143
+ initialState?: InitialState;
144
+ customHeaders?: Record<string, CustomHeaderValue>;
145
+ theme?: ThemeProviderProps;
146
+ renderToastProvider?: boolean;
147
+ renderThemeProvider?: boolean;
148
+ slots?: FrontierProviderSlots;
149
+ }
150
+
151
+ interface DeleteBlockedDialogProps {
152
+ title?: string;
153
+ description?: string;
154
+ blockers?: DeleteBlocker[];
155
+ messages?: Record<string, string>;
156
+ }
157
+ declare function DeleteBlockedDialog({ title, description, blockers, messages }: DeleteBlockedDialogProps): react_jsx_runtime.JSX.Element;
158
+
159
+ interface DeleteUserDialogHandle {
160
+ open: () => void;
161
+ }
162
+ interface DeleteUserDialogProps {
163
+ trigger?: Slot<{
164
+ onClick: () => void;
165
+ loading: boolean;
166
+ }>;
167
+ handle?: DeleteUserDialogHandle;
168
+ onDeleted: () => void;
169
+ }
170
+ declare function DeleteUserDialog({ trigger, handle, onDeleted }: DeleteUserDialogProps): react_jsx_runtime.JSX.Element;
171
+ declare namespace DeleteUserDialog {
172
+ var createHandle: () => DeleteUserDialogHandle;
173
+ }
174
+
51
175
  type AuthRejection = {
52
176
  message: string;
53
177
  strategy?: string;
@@ -180,7 +304,11 @@ interface PreferenceRowProps extends ComponentProps<typeof Flex> {
180
304
  }
181
305
  declare function PreferenceRow({ title, description, isLoading, children, className, contentProps, ...props }: PreferenceRowProps): react_jsx_runtime.JSX.Element;
182
306
 
183
- declare function ProfileView(): react_jsx_runtime.JSX.Element;
307
+ interface ProfileViewProps {
308
+ enableUserDelete?: boolean;
309
+ onDeleteSuccess?: () => void;
310
+ }
311
+ declare function ProfileView({ enableUserDelete, onDeleteSuccess }?: ProfileViewProps): react_jsx_runtime.JSX.Element;
184
312
 
185
313
  interface SessionsViewProps {
186
314
  onLogout?: () => void;
@@ -235,78 +363,6 @@ interface TeamDetailsViewProps {
235
363
  }
236
364
  declare function TeamDetailsView({ teamId, teamsLabel, onNavigateToTeams, onDeleteSuccess }: TeamDetailsViewProps): react_jsx_runtime.JSX.Element;
237
365
 
238
- interface BasePlan extends Omit<Plan, 'title'> {
239
- features?: Record<string, string>;
240
- title: string;
241
- }
242
-
243
- /**
244
- * A render-prop slot: receives a context object (shape defined per view/slot)
245
- * and returns the node to render. Lets a consumer override an internal element
246
- * of a view while keeping the customisation on their side.
247
- *
248
- * @example
249
- * interface ViewSlots {
250
- * addButton?: Slot<{ onClick: () => void; disabled: boolean }>;
251
- * }
252
- */
253
- type Slot<TContext> = (context: TContext) => React.ReactNode;
254
- interface FrontierClientBillingOptions {
255
- supportEmail?: string;
256
- successUrl?: string;
257
- cancelUrl?: string;
258
- hideDecimals?: boolean;
259
- cancelAfterTrial?: boolean;
260
- showPerMonthPrice?: boolean;
261
- tokenProductId?: string;
262
- basePlan?: BasePlan;
263
- }
264
- interface EntityTerminologies {
265
- singular: string;
266
- plural: string;
267
- }
268
- interface FrontierClientCustomizationOptions {
269
- terminology?: {
270
- organization?: EntityTerminologies;
271
- project?: EntityTerminologies;
272
- team?: EntityTerminologies;
273
- member?: EntityTerminologies;
274
- user?: EntityTerminologies;
275
- appName?: string;
276
- };
277
- messages?: {
278
- billing?: {
279
- plan_change?: Record<string, string>;
280
- };
281
- general?: Record<string, string>;
282
- };
283
- }
284
- interface FrontierClientOptions {
285
- locale?: string;
286
- connectEndpoint?: string;
287
- redirectSignup?: string;
288
- redirectLogin?: string;
289
- redirectMagicLinkVerify?: string;
290
- callbackUrl?: string;
291
- dateFormat?: string;
292
- shortDateFormat?: string;
293
- billing?: FrontierClientBillingOptions;
294
- customization?: FrontierClientCustomizationOptions;
295
- }
296
- interface InitialState {
297
- sessionId?: string | null;
298
- }
299
- type CustomHeaderValue = string | (() => string);
300
- interface FrontierProviderProps {
301
- config: FrontierClientOptions;
302
- children: React.ReactNode;
303
- initialState?: InitialState;
304
- customHeaders?: Record<string, CustomHeaderValue>;
305
- theme?: ThemeProviderProps;
306
- renderToastProvider?: boolean;
307
- renderThemeProvider?: boolean;
308
- }
309
-
310
366
  interface ServiceAccountsViewProps {
311
367
  onServiceAccountClick?: (id: string) => void;
312
368
  slots?: {
@@ -361,6 +417,7 @@ declare const CreateOrganizationView: ({ title, description, ...props }: CreateO
361
417
 
362
418
  interface FrontierContextProviderProps {
363
419
  config: FrontierClientOptions;
420
+ slots: FrontierProviderSlots;
364
421
  organizations: Organization[];
365
422
  groups: Group[];
366
423
  user: User | undefined;
@@ -434,10 +491,7 @@ interface UseTokensReturn {
434
491
  isTokensFetching: boolean;
435
492
  fetchTokenBalance: () => Promise<any>;
436
493
  }
437
- interface UseTokensOptions {
438
- enabled?: boolean;
439
- }
440
- declare const useTokens: (options?: UseTokensOptions) => UseTokensReturn;
494
+ declare const useTokens: () => UseTokensReturn;
441
495
 
442
496
  declare const useBillingPermission: () => {
443
497
  isFetching: boolean;
@@ -500,4 +554,4 @@ declare function timestampToDayjs(timestamp?: Timestamp): Dayjs | null;
500
554
  declare function isNullTimestamp(timestamp?: Timestamp): boolean;
501
555
  type TimeStamp = Timestamp;
502
556
 
503
- export { AuthContainer, AuthHeader, AuthRejection, BillingView, CreateOrganizationView, CustomizationProvider, FrontierClientBillingOptions, FrontierClientCustomizationOptions, FrontierClientOptions, FrontierProvider, GeneralView, ImageUpload, MagicLinkVerifyView, MagicLinkView, MembersView, PATDetailsView, PREFERENCE_OPTIONS, PatsView, PlansView, PreferenceRow, PreferencesView, ProfileView, ProjectDetailsView, ProjectsView, SecurityView, ServiceAccountDetailsView, ServiceAccountsView, SessionsView, SignInView, SignUpView, SubscribeView, TeamDetailsView, TeamsView, TimeStamp, TokensView, UpdatesView, ViewContainer, ViewHeader, describeAuthError, isNullTimestamp, queryClient, timestampToDate, timestampToDayjs, useBillingPermission, useConnectQueryPolling, useFrontier, usePreferences, useTerminology, useTokens };
557
+ export { AuthContainer, AuthHeader, AuthRejection, BillingView, CreateOrganizationView, CustomizationProvider, DeleteBlockedContext, DeleteBlockedDialog, DeleteBlockedDialogProps, DeleteBlocker, DeleteUserDialog, DeleteUserDialogHandle, DeleteUserDialogProps, FrontierClientBillingOptions, FrontierClientCustomizationOptions, FrontierClientOptions, FrontierProvider, FrontierProviderSlots, GeneralView, ImageUpload, MagicLinkVerifyView, MagicLinkView, MembersView, PATDetailsView, PREFERENCE_OPTIONS, PatsView, PlansView, PreferenceRow, PreferencesView, ProfileView, ProjectDetailsView, ProjectsView, SecurityView, ServiceAccountDetailsView, ServiceAccountsView, SessionsView, SignInView, SignUpView, SubscribeView, TeamDetailsView, TeamsView, TimeStamp, TokensView, UpdatesView, ViewContainer, ViewHeader, describeAuthError, isNullTimestamp, queryClient, timestampToDate, timestampToDayjs, useBillingPermission, useConnectQueryPolling, useFrontier, usePreferences, useTerminology, useTokens };