@raystack/frontier 0.91.1-test5 → 0.92.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.
@@ -6,30 +6,43 @@ import * as _bufbuild_protobuf from '@bufbuild/protobuf';
6
6
  import { DataTableQuery } from '@raystack/apsara';
7
7
 
8
8
  type RolesViewProps = {
9
+ /** When set, opens the detail sheet for this role. */
9
10
  selectedRoleId?: string;
11
+ /** Called when a user clicks a role row. Use to update the URL or local state. */
10
12
  onSelectRole?: (roleId: string) => void;
13
+ /** Called when the detail sheet is closed. Use to clear the selected role from URL/state. */
11
14
  onCloseDetail?: () => void;
15
+ /** App name displayed in the page title. */
12
16
  appName?: string;
13
17
  };
14
18
  declare function RolesView({ selectedRoleId: controlledRoleId, onSelectRole, onCloseDetail, appName, }?: RolesViewProps): react_jsx_runtime.JSX.Element;
15
19
 
16
20
  type InvoicesViewProps = {
21
+ /** App name displayed in the page title. */
17
22
  appName?: string;
18
23
  };
19
24
  declare function InvoicesView({ appName }?: InvoicesViewProps): react_jsx_runtime.JSX.Element;
20
25
 
21
26
  type ProductsViewProps = {
27
+ /** When set, opens the detail sheet for this product. */
22
28
  selectedProductId?: string;
29
+ /** Called when a user clicks a product row. Use to update the URL or local state. */
23
30
  onSelectProduct?: (productId: string) => void;
31
+ /** Called when the detail sheet is closed. Use to clear the selected product. */
24
32
  onCloseDetail?: () => void;
33
+ /** Called when "View Prices" is clicked. Use to navigate to the prices page for this product. */
25
34
  onNavigateToPrices?: (productId: string) => void;
35
+ /** App name displayed in the page title. */
26
36
  appName?: string;
27
37
  };
28
38
  declare function ProductsView({ selectedProductId, onSelectProduct, onCloseDetail, onNavigateToPrices, appName, }?: ProductsViewProps): react_jsx_runtime.JSX.Element;
29
39
 
30
40
  type ProductPricesViewProps = {
41
+ /** The product ID whose prices are displayed. */
31
42
  productId: string;
43
+ /** App name displayed in the page title. */
32
44
  appName?: string;
45
+ /** Called when a breadcrumb item is clicked. Use to navigate back (e.g. to products list). */
33
46
  onBreadcrumbClick?: (item: {
34
47
  name: string;
35
48
  href?: string;
@@ -38,8 +51,11 @@ type ProductPricesViewProps = {
38
51
  declare function ProductPricesView({ productId, appName, onBreadcrumbClick, }: ProductPricesViewProps): react_jsx_runtime.JSX.Element;
39
52
 
40
53
  type AuditLogsViewProps = {
54
+ /** App name displayed in the page title. */
41
55
  appName?: string;
56
+ /** Callback to export audit logs as CSV with the current query filters applied. */
42
57
  onExportCsv?: (query: RQLRequest) => Promise<void>;
58
+ /** Navigation callback for links within audit log entries (e.g. to org/user pages). */
43
59
  onNavigate?: (path: string) => void;
44
60
  };
45
61
  declare function AuditLogsView({ appName, onExportCsv, onNavigate }?: AuditLogsViewProps): react_jsx_runtime.JSX.Element;
@@ -50,83 +66,125 @@ type AdminsViewProps = {
50
66
  declare function AdminsView({ onNavigateToOrg }?: AdminsViewProps): react_jsx_runtime.JSX.Element;
51
67
 
52
68
  type PlansViewProps = {
69
+ /** When set, opens the detail sheet for this plan. */
53
70
  selectedPlanId?: string;
71
+ /** Called when the detail sheet is closed. Use to clear the selected plan. */
54
72
  onCloseDetail?: () => void;
73
+ /** Called when a plan is selected. Use to open the detail sheet. */
55
74
  onSelectPlan?: (planId: string) => void;
75
+ /** App name displayed in the page title. */
56
76
  appName?: string;
57
77
  };
58
78
  declare function PlansView({ selectedPlanId, onCloseDetail, onSelectPlan, appName, }?: PlansViewProps): react_jsx_runtime.JSX.Element;
59
79
 
60
80
  type WebhooksViewProps = {
81
+ /** When set, opens the update panel for this webhook. */
61
82
  selectedWebhookId?: string;
83
+ /** When true, opens the create webhook panel. */
62
84
  createOpen?: boolean;
85
+ /** Called when the detail/create panel is closed. */
63
86
  onCloseDetail?: () => void;
87
+ /** Called when a user clicks a webhook row. Use to update the URL or local state. */
64
88
  onSelectWebhook?: (id: string) => void;
89
+ /** Called when the "Create" button is clicked. Use to update the URL or open the create panel. */
65
90
  onOpenCreate?: () => void;
91
+ /** When true, shows the delete option for webhooks. Defaults to `false`. */
66
92
  enableDelete?: boolean;
67
93
  };
68
94
  declare function WebhooksView({ selectedWebhookId, createOpen, onCloseDetail, onSelectWebhook, onOpenCreate, enableDelete, }?: WebhooksViewProps): react_jsx_runtime.JSX.Element;
69
95
 
70
96
  type PreferencesViewProps = {
97
+ /** When set, opens the detail panel for this preference (matched by name). */
71
98
  selectedPreferenceName?: string;
99
+ /** Called when the detail panel is closed. Use to clear the selected preference. */
72
100
  onCloseDetail?: () => void;
73
101
  onSelectPreference?: (name: string) => void;
74
102
  };
75
103
  declare function PreferencesView({ selectedPreferenceName, onCloseDetail, onSelectPreference, }?: PreferencesViewProps): react_jsx_runtime.JSX.Element;
76
104
 
77
105
  type UsersViewProps = {
106
+ /** When set, renders the user detail view for this user ID instead of the list. */
78
107
  selectedUserId?: string;
108
+ /** Called when the detail view is closed. Use to navigate back to the users list. */
79
109
  onCloseDetail?: () => void;
110
+ /** Callback to export users list as CSV. Shown in navbar when provided. */
80
111
  onExportUsers?: () => Promise<void>;
112
+ /** Called when a user row is clicked. Use to navigate to the user detail page. */
81
113
  onNavigateToUser?: (userId: string) => void;
82
114
  currentPath?: string;
83
115
  onNavigate?: (path: string) => void;
84
116
  };
85
117
  declare function UsersView({ selectedUserId, onCloseDetail, onExportUsers, onNavigateToUser, currentPath, onNavigate, }?: UsersViewProps): react_jsx_runtime.JSX.Element;
86
118
 
87
- type OrganizationListProps = {
119
+ type OrganizationListViewProps = {
120
+ /** App name displayed in the page title (e.g. "Frontier Admin"). */
88
121
  appName?: string;
122
+ /** Called when a user clicks on an organization row. Use to navigate to the org detail page. */
89
123
  onNavigateToOrg?: (id: string) => void;
124
+ /** Callback to export organizations list as CSV. Shown in navbar when provided. */
90
125
  onExportCsv?: () => Promise<void>;
126
+ /** List of allowed organization types for filtering / creation. */
91
127
  organizationTypes?: string[];
128
+ /** Base URL of the consumer app, used for generating links. */
92
129
  appUrl?: string;
130
+ /** List of country names for KYC country selector during org creation. */
93
131
  countries?: string[];
94
132
  };
95
- declare const OrganizationList: ({ appName, onNavigateToOrg, onExportCsv, organizationTypes, appUrl, countries, }?: OrganizationListProps) => react_jsx_runtime.JSX.Element;
133
+ declare const OrganizationListView: ({ appName, onNavigateToOrg, onExportCsv, organizationTypes, appUrl, countries, }?: OrganizationListViewProps) => react_jsx_runtime.JSX.Element;
96
134
 
97
- type OrganizationDetailsProps = {
135
+ type OrganizationDetailsViewProps = {
136
+ /** The organization ID, typically from route params (e.g. `useParams`). */
98
137
  organizationId: string | undefined;
138
+ /** Callback to export organization members as CSV. Shown in the action menu when provided. */
99
139
  onExportMembers?: () => Promise<void>;
140
+ /** Callback to export organization projects as CSV. Shown in the action menu when provided. */
100
141
  onExportProjects?: () => Promise<void>;
142
+ /** Callback to export organization tokens as CSV. Shown in the action menu when provided. */
101
143
  onExportTokens?: () => Promise<void>;
144
+ /** Base URL of the consumer app, used for generating links (e.g. invitation emails). */
102
145
  appUrl?: string;
146
+ /** Product ID used for token-related billing operations. */
103
147
  tokenProductId?: string;
148
+ /** List of country names for KYC country selector. */
104
149
  countries?: string[];
150
+ /** List of allowed organization types for the organization type selector. */
105
151
  organizationTypes?: string[];
152
+ /** Current browser path (e.g. `location.pathname`) for highlighting active nav tabs. */
106
153
  currentPath: string;
154
+ /** Navigation callback for tab switches (e.g. `useNavigate()` from react-router-dom). */
107
155
  onNavigate: (path: string) => void;
108
156
  children?: React.ReactNode;
109
157
  };
110
- declare const OrganizationDetails: ({ organizationId, onExportMembers, onExportProjects, onExportTokens, appUrl, tokenProductId, countries, organizationTypes, currentPath, onNavigate, children, }: OrganizationDetailsProps) => react_jsx_runtime.JSX.Element;
158
+ declare const OrganizationDetailsView: ({ organizationId, onExportMembers, onExportProjects, onExportTokens, appUrl, tokenProductId, countries, organizationTypes, currentPath, onNavigate, children, }: OrganizationDetailsViewProps) => react_jsx_runtime.JSX.Element;
111
159
 
112
160
  declare const OrganizationSecurity: () => react_jsx_runtime.JSX.Element;
113
161
 
114
- declare function OrganizationMembersPage(): react_jsx_runtime.JSX.Element;
162
+ declare function OrganizationMembersView(): react_jsx_runtime.JSX.Element;
115
163
 
116
- declare function OrganizationProjectssPage(): react_jsx_runtime.JSX.Element;
164
+ declare function OrganizationProjectsView(): react_jsx_runtime.JSX.Element;
117
165
 
118
- declare function OrganizationInvoicesPage(): react_jsx_runtime.JSX.Element;
166
+ declare function OrganizationInvoicesView(): react_jsx_runtime.JSX.Element;
119
167
 
120
- declare function OrganizationTokensPage(): react_jsx_runtime.JSX.Element;
168
+ declare function OrganizationTokensView(): react_jsx_runtime.JSX.Element;
121
169
 
122
- declare function OrganizationApisPage(): react_jsx_runtime.JSX.Element;
170
+ declare function OrganizationApisView(): react_jsx_runtime.JSX.Element;
123
171
 
172
+ /** Default page size used for paginated RQL queries. */
124
173
  declare const DEFAULT_PAGE_SIZE = 50;
174
+ /** Shape of a Connect RPC response that includes pagination and group metadata. */
125
175
  type ConnectRPCPaginatedResponse = {
126
176
  pagination?: RQLQueryPaginationResponse;
127
177
  group?: RQLQueryGroupResponse;
128
178
  [key: string]: unknown;
129
179
  };
180
+ /**
181
+ * Returns the next page params for `useInfiniteQuery` based on the last page's pagination metadata.
182
+ * Returns `undefined` when there are no more pages.
183
+ *
184
+ * @param lastPage - The most recent page returned by the query.
185
+ * @param queryParams - The current query params (contains the RQLRequest).
186
+ * @param itemsKey - The key in the response that holds the list of items (defaults to `"organizations"`).
187
+ */
130
188
  declare function getConnectNextPageParam<T extends ConnectRPCPaginatedResponse>(lastPage: T, queryParams: {
131
189
  query: RQLRequest;
132
190
  }, itemsKey?: string): {
@@ -139,6 +197,10 @@ declare function getConnectNextPageParam<T extends ConnectRPCPaginatedResponse>(
139
197
  search: string;
140
198
  sort: _raystack_proton_frontier.RQLSort[];
141
199
  } | undefined;
200
+ /**
201
+ * Extracts group-by count map from the first page of an infinite query.
202
+ * Returns a nested map: `{ [groupName]: { [value]: count } }`.
203
+ */
142
204
  declare function getGroupCountMapFromFirstPage<T extends ConnectRPCPaginatedResponse>(infiniteData?: {
143
205
  pages: T[];
144
206
  }): Record<string, Record<string, number>>;
@@ -149,8 +211,16 @@ interface TransformOptions {
149
211
  * @default 50
150
212
  */
151
213
  defaultLimit?: number;
214
+ /**
215
+ * Maps DataTable field names to RQL field names.
216
+ * E.g. `{ createdAt: "created_at" }` transforms the DataTable column name to the backend field.
217
+ */
152
218
  fieldNameMapping?: Record<string, string>;
153
219
  }
220
+ /**
221
+ * Converts an Apsara `DataTableQuery` (search, filters, sort, pagination) into
222
+ * a Frontier `RQLRequest` that can be passed to Connect RPC query hooks.
223
+ */
154
224
  declare function transformDataTableQueryToRQLRequest(query: DataTableQuery, options?: TransformOptions): RQLRequest;
155
225
 
156
- export { AdminsView, AuditLogsView, ConnectRPCPaginatedResponse, DEFAULT_PAGE_SIZE, InvoicesView, OrganizationApisPage, OrganizationDetails, OrganizationDetailsProps, OrganizationInvoicesPage, OrganizationList, OrganizationListProps, OrganizationMembersPage, OrganizationProjectssPage, OrganizationSecurity, OrganizationTokensPage, PlansView, PreferencesView, ProductPricesView, ProductsView, RolesView, TransformOptions, UsersView, WebhooksView, getConnectNextPageParam, getGroupCountMapFromFirstPage, transformDataTableQueryToRQLRequest };
226
+ export { AdminsView, AuditLogsView, ConnectRPCPaginatedResponse, DEFAULT_PAGE_SIZE, InvoicesView, OrganizationApisView, OrganizationDetailsView, OrganizationDetailsViewProps, OrganizationInvoicesView, OrganizationListView, OrganizationListViewProps, OrganizationMembersView, OrganizationProjectsView, OrganizationSecurity, OrganizationTokensView, PlansView, PreferencesView, ProductPricesView, ProductsView, RolesView, TransformOptions, UsersView, WebhooksView, getConnectNextPageParam, getGroupCountMapFromFirstPage, transformDataTableQueryToRQLRequest };