@cryptlex/web-components 1.3.2 → 1.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.
Files changed (60) hide show
  1. package/dist/components/data-table/column-picker.es.js +81 -0
  2. package/dist/components/data-table/column-picker.es.js.map +1 -0
  3. package/dist/components/data-table/data-table.es.js +197 -0
  4. package/dist/components/data-table/data-table.es.js.map +1 -0
  5. package/dist/components/data-table/page-size.es.js +23 -0
  6. package/dist/components/data-table/page-size.es.js.map +1 -0
  7. package/dist/components/data-table/paginator.es.js +63 -0
  8. package/dist/components/data-table/paginator.es.js.map +1 -0
  9. package/dist/components/data-table/table-actions.es.js +82 -0
  10. package/dist/components/data-table/table-actions.es.js.map +1 -0
  11. package/dist/components/data-table/table-commons.es.js +55 -0
  12. package/dist/components/data-table/table-commons.es.js.map +1 -0
  13. package/dist/components/data-table/table-content.es.js +46 -0
  14. package/dist/components/data-table/table-content.es.js.map +1 -0
  15. package/dist/components/data-table/table-utils/constants.es.js +274 -0
  16. package/dist/components/data-table/table-utils/constants.es.js.map +1 -0
  17. package/dist/components/data-table/table-utils/createTableFetchFn.es.js +25 -0
  18. package/dist/components/data-table/table-utils/createTableFetchFn.es.js.map +1 -0
  19. package/dist/components/data-table/table-utils/date.es.js +12 -0
  20. package/dist/components/data-table/table-utils/date.es.js.map +1 -0
  21. package/dist/components/data-table/table-utils/fetch.es.js +40 -0
  22. package/dist/components/data-table/table-utils/fetch.es.js.map +1 -0
  23. package/dist/components/data-table/table-utils/link-display.es.js +21 -0
  24. package/dist/components/data-table/table-utils/link-display.es.js.map +1 -0
  25. package/dist/components/data-table/table-utils/string.es.js +19 -0
  26. package/dist/components/data-table/table-utils/string.es.js.map +1 -0
  27. package/dist/components/data-table/table-utils/types.es.js +5 -0
  28. package/dist/components/data-table/table-utils/types.es.js.map +1 -0
  29. package/dist/components/info-card/info-card.es.js +74 -0
  30. package/dist/components/info-card/info-card.es.js.map +1 -0
  31. package/dist/components/sidebar/app-layout.es.js +86 -0
  32. package/dist/components/sidebar/app-layout.es.js.map +1 -0
  33. package/dist/components/sidebar/nav-main.es.js +76 -0
  34. package/dist/components/sidebar/nav-main.es.js.map +1 -0
  35. package/dist/components/sidebar/sidebar.es.js +10 -0
  36. package/dist/components/sidebar/sidebar.es.js.map +1 -0
  37. package/dist/components/static-data-table/data-table.es.js +30 -0
  38. package/dist/components/static-data-table/data-table.es.js.map +1 -0
  39. package/dist/components/ui/button.es.js +12 -22
  40. package/dist/components/ui/button.es.js.map +1 -1
  41. package/dist/components/ui/drawer.es.js +13 -12
  42. package/dist/components/ui/drawer.es.js.map +1 -1
  43. package/dist/components/ui/dynamic-input.es.js +141 -0
  44. package/dist/components/ui/dynamic-input.es.js.map +1 -0
  45. package/dist/components/ui/mutli-select.es.js +197 -0
  46. package/dist/components/ui/mutli-select.es.js.map +1 -0
  47. package/dist/components/ui/search-input.es.js +41 -0
  48. package/dist/components/ui/search-input.es.js.map +1 -0
  49. package/dist/components/ui/sheet.es.js +11 -37
  50. package/dist/components/ui/sheet.es.js.map +1 -1
  51. package/dist/components/ui/sidebar.es.js +286 -264
  52. package/dist/components/ui/sidebar.es.js.map +1 -1
  53. package/dist/components/ui/table-page-layout.es.js +14 -0
  54. package/dist/components/ui/table-page-layout.es.js.map +1 -0
  55. package/dist/index.es.d.ts +303 -2
  56. package/dist/index.es.js +264 -208
  57. package/dist/index.es.js.map +1 -1
  58. package/dist/utils/index.es.js +13 -8
  59. package/dist/utils/index.es.js.map +1 -1
  60. package/package.json +10 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table-content.es.js","sources":["../../../lib/components/data-table/table-content.tsx"],"sourcesContent":["import {\n Table as CxTable,\n TableBody,\n TableCell,\n TableFooter,\n TableHeader,\n TableRow,\n} from '@/components/ui/table';\nimport { ColumnDef, Table, flexRender } from '@tanstack/react-table';\n\nexport function TableContent<TData, TValue>({\n table,\n isFetching,\n columns,\n}: {\n table: Table<TData>;\n isFetching: boolean;\n columns: ColumnDef<TData, TValue>[];\n}) {\n return (\n <CxTable className=\"relative h-full w-full\">\n <TableHeader className=\"sticky top-0 z-10\">\n {table.getHeaderGroups().map((headerGroup, index) => (\n <TableRow key={index} className=\"border-b\">\n {headerGroup.headers.map((header) => (\n <TableCell\n key={header.id}\n className={`\n px-4 py-2 text-left text-sm font-medium cursor-pointer whitespace-nowrap \n bg-card \n ${header.id === 'actions' ? 'sticky right-0 z-50 bg-card' : ''}\n `}\n onClick={header.column.getToggleSortingHandler()}\n >\n {header.isPlaceholder\n ? null\n : flexRender(header.column.columnDef.header, header.getContext())}\n {{\n asc: '↑',\n desc: '↓',\n }[header.column.getIsSorted() as string] ?? null}\n </TableCell>\n ))}\n </TableRow>\n ))}\n </TableHeader>\n <TableBody className=\"flex-1 overflow-y-auto\">\n {table.getRowModel().rows.length ? (\n table.getRowModel().rows.map((row) => (\n <TableRow key={row.id} data-state={row.getIsSelected() && 'selected'}>\n {row.getVisibleCells().map((cell) => (\n <TableCell\n key={cell.id}\n className={`\n px-4 py-2 text-left text-sm whitespace-nowrap \n ${cell.column.id === 'actions' ? 'sticky right-0 bg-card text-center shadow-2xl' : ''}\n `}\n >\n {flexRender(cell.column.columnDef.cell, cell.getContext())}\n </TableCell>\n ))}\n </TableRow>\n ))\n ) : (\n <TableRow>\n {!isFetching && (\n <TableCell colSpan={columns.length} className=\"px-4 py-2 text-center text-sm\">\n No results.\n </TableCell>\n )}\n </TableRow>\n )}\n </TableBody>\n {/* Loader positioned to cover entire table viewport */}\n {isFetching && (\n <TableFooter className=\"absolute inset-0 z-20 flex justify-center items-center bg-card/80\" />\n )}\n </CxTable>\n );\n}\n"],"names":["TableContent","table","isFetching","columns","jsxs","CxTable","jsx","TableHeader","headerGroup","index","TableRow","header","TableCell","flexRender","TableBody","row","cell","TableFooter"],"mappings":";;;AAUO,SAASA,EAA4B;AAAA,EAC1C,OAAAC;AAAA,EACA,YAAAC;AAAA,EACA,SAAAC;AACF,GAIG;AA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Q,QAAQ,WAAU,iCAAgC,UAAA,cAAA,CAE9E,EAEJ,CAAA,GAEJ;AAAA,IAECD,KACC,gBAAAI,EAACW,GAAY,EAAA,WAAU,oEAAoE,CAAA;AAAA,EAAA,GAE/F;AAEJ;"}
@@ -0,0 +1,274 @@
1
+ import { intervalToDuration as i } from "date-fns";
2
+ import { convertCamelCaseToTitleCase as l } from "./string.es.js";
3
+ const m = [
4
+ "objectString",
5
+ "string",
6
+ "number",
7
+ "objectNumber",
8
+ "boolean",
9
+ "objectDate",
10
+ "licenseType",
11
+ "product",
12
+ "product-version",
13
+ "user",
14
+ "webhook",
15
+ "automated-email",
16
+ "organization",
17
+ "country",
18
+ "tag",
19
+ "resource",
20
+ "resourceId",
21
+ "reseller",
22
+ "role"
23
+ ], p = {
24
+ createdAt: "objectDate",
25
+ updatedAt: "objectDate"
26
+ }, g = [
27
+ "eq",
28
+ "ne",
29
+ "cn",
30
+ "nc",
31
+ "sw",
32
+ "ew",
33
+ "in",
34
+ "nin",
35
+ "gt",
36
+ "gte",
37
+ "lt",
38
+ "lte"
39
+ ], f = {
40
+ eq: "equal to",
41
+ ne: "not equal to",
42
+ cn: "contains",
43
+ nc: "does not contain",
44
+ sw: "starts with",
45
+ ew: "ends with",
46
+ in: "includes",
47
+ nin: "does not include",
48
+ gt: "greater than",
49
+ gte: "greater than or equal to",
50
+ lt: "less than",
51
+ lte: "less than or equal to"
52
+ }, h = {
53
+ objectString: ["eq", "ne", "cn", "nc", "sw", "ew", "in", "nin"],
54
+ objectDate: ["gt", "lt", "eq"],
55
+ objectNumber: ["eq", "ne", "gt", "gte", "lt", "lte"],
56
+ tag: ["in", "nin"],
57
+ string: ["eq"],
58
+ number: ["eq"],
59
+ boolean: ["eq"],
60
+ licenseType: ["in", "nin"],
61
+ product: ["in", "nin"],
62
+ "product-version": ["in", "nin"],
63
+ user: ["eq"],
64
+ reseller: ["eq"],
65
+ webhook: ["in", "nin"],
66
+ "automated-email": ["in", "nin"],
67
+ organization: ["eq"],
68
+ country: ["in", "nin"],
69
+ resource: ["in", "nin"],
70
+ resourceId: ["eq", "ne", "in", "nin"],
71
+ role: ["in", "nin"]
72
+ }, n = {
73
+ "product.displayName": "Product"
74
+ }, y = [
75
+ "access-token",
76
+ "account",
77
+ "activation",
78
+ "activation-log",
79
+ "admin-role",
80
+ "audit-log",
81
+ "automated-email",
82
+ "automated-email-event-log",
83
+ "card",
84
+ "feature-flag",
85
+ "invoice",
86
+ "license",
87
+ "license-template",
88
+ "maintenance-policy",
89
+ "organization",
90
+ "plan",
91
+ "product",
92
+ "product-version",
93
+ "profile",
94
+ "release",
95
+ "release-channel",
96
+ "release-file",
97
+ "release-platform",
98
+ "report",
99
+ "role",
100
+ "role-claim",
101
+ "saml-configuration",
102
+ "segment",
103
+ "sending-domain",
104
+ "setting",
105
+ "tag",
106
+ "team-member",
107
+ "trial",
108
+ "trial-policy",
109
+ "user",
110
+ "user-group",
111
+ "webhook",
112
+ "webhook-event-log",
113
+ "webhook-trigger",
114
+ "reseller",
115
+ "oidc-configuration",
116
+ "organization-claim",
117
+ "reseller-claim"
118
+ ], A = {
119
+ account: "Your organization account.",
120
+ product: "Products are the software products you want to license",
121
+ license: "Licenses represent a purchase of your software. These can be linked to customers, and the license key is required to use the product.",
122
+ "access-token": "Access Tokens are used to authenticate your API requests.",
123
+ activation: "Activations, also known as devices/machines/seats are the devices consuming licenses.",
124
+ "activation-log": "Activation Log is a log entry of activation/deactivation of a particular license.",
125
+ trial: "Trial/Trial Activation is a device that has activated a trial of your product.",
126
+ "audit-log": "Audit logs contain all the changes made to your account.",
127
+ "automated-email": "Automated Email allow you to send marketing emails based on events on the linked product.",
128
+ "automated-email-event-log": "Automated email event log is the log of all the automated email events for your product.",
129
+ card: "The payment card for your account.",
130
+ "feature-flag": "Feature flags define features that make up tiers for your products.",
131
+ invoice: "",
132
+ "license-template": "License templates are a blueprint for the licenses you create for your customers and prevent repetition when creating licenses.",
133
+ "maintenance-policy": "Maintenance policies represent support contracts and can be linked to licenses.",
134
+ plan: "",
135
+ "product-version": "Product Versions are sets of Feature Flags that define the tiers of your products.",
136
+ "release-channel": "Release channel is the release channel for your product.",
137
+ "release-file": "Release files are files within your created releases.",
138
+ "release-platform": 'Release Platforms differentiate the target platform for your release. Common platforms include "Windows", "macOS", and "Linux".',
139
+ release: "Releases help you to manage different versions of your app, and secure distribute it to licensed users.",
140
+ report: "Analytics data for your account",
141
+ "role-claim": "",
142
+ role: "Roles define permissions for your team.",
143
+ "saml-configuration": "",
144
+ segment: "Sets of filters that can be saved to filter resources.",
145
+ "trial-policy": "Trial policies are templates for creating trials for your products.",
146
+ "webhook-event-log": "Webhook Event Logs are logs of events that have occured on webhooks.",
147
+ "webhook-trigger": "",
148
+ webhook: "Webhooks are HTTP callbacks which are triggered by specific events.",
149
+ organization: "",
150
+ profile: "",
151
+ setting: "",
152
+ tag: "Tags allow you to manage your licenses and customers on the dashboard.",
153
+ "team-member": "Team members can access the account based on their roles.",
154
+ user: "A user refers to your customer whom you want to license your product.",
155
+ "sending-domain": "Allows Cryptlex to send emails on your behalf using your From Email address",
156
+ "admin-role": "Roles that have type admin",
157
+ "user-group": "Groups of users that you can assign licenses to.",
158
+ reseller: "Resellers allow you to delegate user management to third parties or partners",
159
+ "oidc-configuration": "",
160
+ "organization-claim": "",
161
+ "reseller-claim": ""
162
+ }, r = {
163
+ id: "ID",
164
+ createdAt: "Creation Date",
165
+ scopes: "Permissions",
166
+ updatedAt: "Last Updated",
167
+ expiresAt: "Expiration Date",
168
+ lastSeenAt: "Last Seen",
169
+ os: "OS",
170
+ osVersion: "OS Version",
171
+ key: "License Key",
172
+ vmName: "VM Name",
173
+ container: "Container",
174
+ allowedIpRange: "Allowed IP Range",
175
+ allowedIpRanges: "Allowed IP Ranges",
176
+ allowedIpAddresses: "Allowed IP Addresses",
177
+ disallowedIpAddresses: "Disallowed IP Addresses",
178
+ allowVmActivation: "Allow VM Activation",
179
+ disableGeoLocation: "Disable Geolocation",
180
+ "user.id": "User ID",
181
+ userId: "User",
182
+ productId: "Product",
183
+ downloads: "Total Downloads",
184
+ claims: "Permissions",
185
+ googleSsoEnabled: "Google Login Enabled",
186
+ lastAttemptedAt: "Last Attempt Date",
187
+ url: "URL",
188
+ "trialPolicy.name": "Trial Policy Name",
189
+ "licensePolicy.name": "License Template Name",
190
+ licensePolicy: "License Template",
191
+ eventLog: "Audit Log",
192
+ cc: "CC Recepients",
193
+ bcc: "BCC Recepients",
194
+ ipAddress: "IP Address",
195
+ resellerId: "Reseller",
196
+ productVersionId: "Product Version",
197
+ releaseId: "Release",
198
+ maintenancePolicyId: "Maintenance Policy",
199
+ webhookId: "Webhook",
200
+ automatedEmailId: "Automated Email",
201
+ "location.countryName": "Country",
202
+ "location.ipAddress": "IP Address",
203
+ "location.countryCode": "Country",
204
+ organizationId: "Organization",
205
+ "address.country": "Country",
206
+ "address.addressLine1": "Address Line 1",
207
+ "address.addressLine2": "Address Line 2",
208
+ responseStatusCode: "HTTP Status Code",
209
+ resourceId: "Resource ID",
210
+ Sso: "SAML SSO 2.0",
211
+ "reseller.name": "Reseller",
212
+ sendingDomain: "Email Sending Domain"
213
+ };
214
+ function w(e, t) {
215
+ return t !== "admin-portal" && e in n ? n[e] : e in r ? r[e] : l(e);
216
+ }
217
+ function b(e) {
218
+ const t = e.expiresAt && new Date(e.expiresAt) < /* @__PURE__ */ new Date();
219
+ switch (!0) {
220
+ case (e.revoked && e.suspended && t):
221
+ return "Revoked, Suspended, Expired";
222
+ case (e.revoked && e.suspended):
223
+ return "Revoked, Suspended";
224
+ case (e.revoked && t):
225
+ return "Revoked, Expired";
226
+ case (e.suspended && t):
227
+ return "Suspended, Expired";
228
+ case e.suspended:
229
+ return "Suspended";
230
+ case e.revoked:
231
+ return "Revoked";
232
+ case t:
233
+ return "Expired";
234
+ default:
235
+ return "Active";
236
+ }
237
+ }
238
+ function v(e) {
239
+ return e === 0 || !e ? "Lifetime" : c(e);
240
+ }
241
+ function c(e) {
242
+ const t = i({
243
+ start: 0,
244
+ end: e * 1e3
245
+ });
246
+ return [
247
+ t.years && `${t.years}y`,
248
+ t.months && `${t.months}m`,
249
+ t.days && `${t.days}d`,
250
+ t.hours && `${t.hours}h`
251
+ ].filter(Boolean).join(" ").trim();
252
+ }
253
+ function R(e, t) {
254
+ const a = t.toString().split(".");
255
+ let o = e;
256
+ for (const s of a)
257
+ o = o == null ? void 0 : o[s];
258
+ return o;
259
+ }
260
+ export {
261
+ f as COMPARISON_OPERATOR_LABELS,
262
+ p as DEFAULT_FILTERABLE_FIELDS,
263
+ m as FILTERABLE_PROPERTY_TYPES,
264
+ g as FILTER_COMPARISON_OPERATORS,
265
+ h as OPERATORS_FOR_FILTER_TYPE,
266
+ A as RESOURCE_DEFINITIONS,
267
+ y as RESOURCE_NAMES,
268
+ b as getLicenseStatus,
269
+ w as getResourceDisplayName,
270
+ v as getValidityDisplay,
271
+ R as getValueFromData,
272
+ c as secondsToDuration
273
+ };
274
+ //# sourceMappingURL=constants.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.es.js","sources":["../../../../lib/components/data-table/table-utils/constants.ts"],"sourcesContent":["import { intervalToDuration } from 'date-fns';\nimport { convertCamelCaseToTitleCase } from './string';\n\nexport const FILTERABLE_PROPERTY_TYPES = [\n 'objectString',\n 'string',\n 'number',\n 'objectNumber',\n 'boolean',\n 'objectDate',\n 'licenseType',\n 'product',\n 'product-version',\n 'user',\n 'webhook',\n 'automated-email',\n 'organization',\n 'country',\n 'tag',\n 'resource',\n 'resourceId',\n 'reseller',\n 'role',\n] as const;\nexport type FilterablePropertyType = (typeof FILTERABLE_PROPERTY_TYPES)[number];\nexport type FilterableProperties = {\n [filterProperty: string]: FilterablePropertyType;\n};\n\nexport const DEFAULT_FILTERABLE_FIELDS: FilterableProperties = {\n createdAt: 'objectDate',\n updatedAt: 'objectDate',\n};\nexport const FILTER_COMPARISON_OPERATORS = [\n 'eq',\n 'ne',\n 'cn',\n 'nc',\n 'sw',\n 'ew',\n 'in',\n 'nin',\n 'gt',\n 'gte',\n 'lt',\n 'lte',\n] as const;\nexport type FilterComparisonOperator = (typeof FILTER_COMPARISON_OPERATORS)[number];\nexport type OperatorsForFilterType = Record<FilterablePropertyType, FilterComparisonOperator[]>;\nexport const COMPARISON_OPERATOR_LABELS: Record<FilterComparisonOperator, string> = {\n eq: 'equal to',\n ne: 'not equal to',\n cn: 'contains',\n nc: 'does not contain',\n sw: 'starts with',\n ew: 'ends with',\n in: 'includes',\n nin: 'does not include',\n gt: 'greater than',\n gte: 'greater than or equal to',\n lt: 'less than',\n lte: 'less than or equal to',\n};\n\nexport const OPERATORS_FOR_FILTER_TYPE: OperatorsForFilterType = {\n 'objectString': ['eq', 'ne', 'cn', 'nc', 'sw', 'ew', 'in', 'nin'],\n 'objectDate': ['gt', 'lt', 'eq'],\n 'objectNumber': ['eq', 'ne', 'gt', 'gte', 'lt', 'lte'],\n 'tag': ['in', 'nin'],\n 'string': ['eq'],\n 'number': ['eq'],\n 'boolean': ['eq'],\n 'licenseType': ['in', 'nin'],\n 'product': ['in', 'nin'],\n 'product-version': ['in', 'nin'],\n 'user': ['eq'],\n 'reseller': ['eq'],\n 'webhook': ['in', 'nin'],\n 'automated-email': ['in', 'nin'],\n 'organization': ['eq'],\n 'country': ['in', 'nin'],\n 'resource': ['in', 'nin'],\n 'resourceId': ['eq', 'ne', 'in', 'nin'],\n 'role': ['in', 'nin'],\n};\n\n/** Application Names */\nexport type CtxProjectName =\n | 'admin-portal'\n | 'customer-portal'\n | 'internal-portal'\n | 'reseller-portal';\n// Display names specific to customer and reseller portal\nconst OTHER_PORTALS_DISPLAY_NAME: Record<string, string> = {\n 'product.displayName': 'Product',\n};\n\n/** Resource Name should ALWAYS be in singular form */\nexport const RESOURCE_NAMES = [\n 'access-token',\n 'account',\n 'activation',\n 'activation-log',\n 'admin-role',\n 'audit-log',\n 'automated-email',\n 'automated-email-event-log',\n 'card',\n 'feature-flag',\n 'invoice',\n 'license',\n 'license-template',\n 'maintenance-policy',\n 'organization',\n 'plan',\n 'product',\n 'product-version',\n 'profile',\n 'release',\n 'release-channel',\n 'release-file',\n 'release-platform',\n 'report',\n 'role',\n 'role-claim',\n 'saml-configuration',\n 'segment',\n 'sending-domain',\n 'setting',\n 'tag',\n 'team-member',\n 'trial',\n 'trial-policy',\n 'user',\n 'user-group',\n 'webhook',\n 'webhook-event-log',\n 'webhook-trigger',\n 'reseller',\n 'oidc-configuration',\n 'organization-claim',\n 'reseller-claim',\n] as const;\nexport type ResourceName = (typeof RESOURCE_NAMES)[number];\nexport const RESOURCE_DEFINITIONS: Record<ResourceName, string> = {\n 'account': 'Your organization account.',\n 'product': 'Products are the software products you want to license',\n 'license':\n 'Licenses represent a purchase of your software. These can be linked to customers, and the license key is required to use the product.',\n 'access-token': 'Access Tokens are used to authenticate your API requests.',\n 'activation':\n 'Activations, also known as devices/machines/seats are the devices consuming licenses.',\n 'activation-log':\n 'Activation Log is a log entry of activation/deactivation of a particular license.',\n 'trial': 'Trial/Trial Activation is a device that has activated a trial of your product.',\n 'audit-log': 'Audit logs contain all the changes made to your account.',\n 'automated-email':\n 'Automated Email allow you to send marketing emails based on events on the linked product.',\n 'automated-email-event-log':\n 'Automated email event log is the log of all the automated email events for your product.',\n 'card': 'The payment card for your account.',\n 'feature-flag': 'Feature flags define features that make up tiers for your products.',\n 'invoice': '',\n 'license-template':\n 'License templates are a blueprint for the licenses you create for your customers and prevent repetition when creating licenses.',\n 'maintenance-policy':\n 'Maintenance policies represent support contracts and can be linked to licenses.',\n 'plan': '',\n 'product-version':\n 'Product Versions are sets of Feature Flags that define the tiers of your products.',\n 'release-channel': 'Release channel is the release channel for your product.',\n 'release-file': 'Release files are files within your created releases.',\n 'release-platform':\n 'Release Platforms differentiate the target platform for your release. Common platforms include \"Windows\", \"macOS\", and \"Linux\".',\n 'release':\n 'Releases help you to manage different versions of your app, and secure distribute it to licensed users.',\n 'report': 'Analytics data for your account',\n 'role-claim': '',\n 'role': 'Roles define permissions for your team.',\n 'saml-configuration': '',\n 'segment': 'Sets of filters that can be saved to filter resources.',\n 'trial-policy': 'Trial policies are templates for creating trials for your products.',\n 'webhook-event-log': 'Webhook Event Logs are logs of events that have occured on webhooks.',\n 'webhook-trigger': '',\n 'webhook': 'Webhooks are HTTP callbacks which are triggered by specific events.',\n 'organization': '',\n 'profile': '',\n 'setting': '',\n 'tag': 'Tags allow you to manage your licenses and customers on the dashboard.',\n 'team-member': 'Team members can access the account based on their roles.',\n 'user': 'A user refers to your customer whom you want to license your product.',\n 'sending-domain': 'Allows Cryptlex to send emails on your behalf using your From Email address',\n 'admin-role': 'Roles that have type admin',\n 'user-group': 'Groups of users that you can assign licenses to.',\n 'reseller': 'Resellers allow you to delegate user management to third parties or partners',\n 'oidc-configuration': '',\n 'organization-claim': '',\n 'reseller-claim': '',\n};\n\nconst RESOURCE_DISPLAY_NAMES: Record<string, string> = {\n 'id': 'ID',\n 'createdAt': 'Creation Date',\n 'scopes': 'Permissions',\n 'updatedAt': 'Last Updated',\n 'expiresAt': 'Expiration Date',\n 'lastSeenAt': 'Last Seen',\n 'os': 'OS',\n 'osVersion': 'OS Version',\n 'key': 'License Key',\n 'vmName': 'VM Name',\n 'container': 'Container',\n 'allowedIpRange': 'Allowed IP Range',\n 'allowedIpRanges': 'Allowed IP Ranges',\n 'allowedIpAddresses': 'Allowed IP Addresses',\n 'disallowedIpAddresses': 'Disallowed IP Addresses',\n 'allowVmActivation': 'Allow VM Activation',\n 'disableGeoLocation': 'Disable Geolocation',\n 'user.id': 'User ID',\n 'userId': 'User',\n 'productId': 'Product',\n 'downloads': 'Total Downloads',\n 'claims': 'Permissions',\n 'googleSsoEnabled': 'Google Login Enabled',\n 'lastAttemptedAt': 'Last Attempt Date',\n 'url': 'URL',\n 'trialPolicy.name': 'Trial Policy Name',\n 'licensePolicy.name': 'License Template Name',\n 'licensePolicy': 'License Template',\n 'eventLog': 'Audit Log',\n 'cc': 'CC Recepients',\n 'bcc': 'BCC Recepients',\n 'ipAddress': 'IP Address',\n 'resellerId': 'Reseller',\n 'productVersionId': 'Product Version',\n 'releaseId': 'Release',\n 'maintenancePolicyId': 'Maintenance Policy',\n 'webhookId': 'Webhook',\n 'automatedEmailId': 'Automated Email',\n 'location.countryName': 'Country',\n 'location.ipAddress': 'IP Address',\n 'location.countryCode': 'Country',\n 'organizationId': 'Organization',\n 'address.country': 'Country',\n 'address.addressLine1': 'Address Line 1',\n 'address.addressLine2': 'Address Line 2',\n 'responseStatusCode': 'HTTP Status Code',\n 'resourceId': 'Resource ID',\n 'Sso': 'SAML SSO 2.0',\n 'reseller.name': 'Reseller',\n 'sendingDomain': 'Email Sending Domain',\n};\nexport function getResourceDisplayName(resourceName: string, portal: CtxProjectName) {\n if (portal !== 'admin-portal' && resourceName in OTHER_PORTALS_DISPLAY_NAME) {\n return OTHER_PORTALS_DISPLAY_NAME[resourceName];\n } else if (resourceName in RESOURCE_DISPLAY_NAMES) {\n return RESOURCE_DISPLAY_NAMES[resourceName];\n } else {\n return convertCamelCaseToTitleCase(resourceName);\n }\n}\n\n/**\n * Format multiple license parameters (expired, suspended, revoked) into a single status\n */\nexport function getLicenseStatus(license: any): string {\n const licenseExpired = license.expiresAt && new Date(license.expiresAt) < new Date();\n // Status Column\n switch (true) {\n case license.revoked && license.suspended && licenseExpired:\n return 'Revoked, Suspended, Expired';\n case license.revoked && license.suspended:\n return 'Revoked, Suspended';\n case license.revoked && licenseExpired:\n return 'Revoked, Expired';\n case license.suspended && licenseExpired:\n return 'Suspended, Expired';\n case license.suspended:\n return 'Suspended';\n case license.revoked:\n return 'Revoked';\n case licenseExpired:\n return 'Expired';\n default:\n return 'Active';\n }\n}\n\nexport function getValidityDisplay(validity: number | undefined) {\n if (validity === 0 || !validity) {\n return 'Lifetime';\n } else {\n return secondsToDuration(validity);\n }\n}\nexport function secondsToDuration(seconds: number): string {\n const duration = intervalToDuration({\n start: 0,\n end: seconds * 1000,\n });\n\n const parts = [\n duration.years && `${duration.years}y`,\n duration.months && `${duration.months}m`,\n duration.days && `${duration.days}d`,\n duration.hours && `${duration.hours}h`,\n ];\n\n // Filter out undefined values and join\n return parts.filter(Boolean).join(' ').trim();\n}\n\nexport function getValueFromData(data: any, accessor: string | number | symbol) {\n const accessors = accessor.toString().split('.');\n let value = data;\n for (const acc of accessors) {\n value = value?.[acc];\n }\n return value;\n}\n"],"names":["FILTERABLE_PROPERTY_TYPES","DEFAULT_FILTERABLE_FIELDS","FILTER_COMPARISON_OPERATORS","COMPARISON_OPERATOR_LABELS","OPERATORS_FOR_FILTER_TYPE","OTHER_PORTALS_DISPLAY_NAME","RESOURCE_NAMES","RESOURCE_DEFINITIONS","RESOURCE_DISPLAY_NAMES","getResourceDisplayName","resourceName","portal","convertCamelCaseToTitleCase","getLicenseStatus","license","licenseExpired","getValidityDisplay","validity","secondsToDuration","seconds","duration","intervalToDuration","getValueFromData","data","accessor","accessors","value","acc"],"mappings":";;AAGO,MAAMA,IAA4B;AAAA,EACvC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAMaC,IAAkD;AAAA,EAC7D,WAAW;AAAA,EACX,WAAW;AACb,GACaC,IAA8B;AAAA,EACzC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAGaC,IAAuE;AAAA,EAClF,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,IAAI;AAAA,EACJ,KAAK;AAAA,EACL,IAAI;AAAA,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EAAmBC,GAA8B;AAC3D,SAAAA,MAAa,KAAK,CAACA,IACd,aAEAC,EAAkBD,CAAQ;AAErC;AACO,SAASC,EAAkBC,GAAyB;AACzD,QAAMC,IAAWC,EAAmB;AAAA,IAClC,OAAO;AAAA,IACP,KAAKF,IAAU;AAAA,EAAA,CAChB;AAUD,SARc;AAAA,IACZC,EAAS,SAAS,GAAGA,EAAS,KAAK;AAAA,IACnCA,EAAS,UAAU,GAAGA,EAAS,MAAM;AAAA,IACrCA,EAAS,QAAQ,GAAGA,EAAS,IAAI;AAAA,IACjCA,EAAS,SAAS,GAAGA,EAAS,KAAK;AAAA,EACrC,EAGa,OAAO,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK;AAC9C;AAEgB,SAAAE,EAAiBC,GAAWC,GAAoC;AAC9E,QAAMC,IAAYD,EAAS,SAAS,EAAE,MAAM,GAAG;AAC/C,MAAIE,IAAQH;AACZ,aAAWI,KAAOF;AAChB,IAAAC,IAAQA,KAAA,gBAAAA,EAAQC;AAEX,SAAAD;AACT;"}
@@ -0,0 +1,25 @@
1
+ import { merge as u } from "lodash";
2
+ import { ctxClient as m } from "./fetch.es.js";
3
+ function f(e, a) {
4
+ return async (t, o, c, i) => {
5
+ const r = {
6
+ params: {
7
+ query: {
8
+ page: t.pageIndex + 1,
9
+ limit: t.pageSize,
10
+ sort: p(o[0]),
11
+ query: c,
12
+ ...i
13
+ }
14
+ }
15
+ }, s = u(r, a);
16
+ return console.log(s), m.GET(e, r).then((n) => ({ total: parseInt(n.response.headers.get("Pagination-Count") || "0"), data: n.data }));
17
+ };
18
+ }
19
+ function p(e) {
20
+ return e ? e.desc ? `-${e.id}` : `+${e.id}` : "-createdAt";
21
+ }
22
+ export {
23
+ f as createTableFetchFn
24
+ };
25
+ //# sourceMappingURL=createTableFetchFn.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createTableFetchFn.es.js","sources":["../../../../lib/components/data-table/table-utils/createTableFetchFn.ts"],"sourcesContent":["import { merge } from 'lodash';\nimport { ParamsOption } from 'openapi-fetch';\nimport { ctxClient } from './fetch';\nimport { type TableFetchFn } from './types';\ninterface Params {\n query: Record<string, string | number | boolean | Record<string, string | number | boolean>>;\n}\n\nexport function createTableFetchFn<_any, Return>(\n path: Parameters<typeof ctxClient.GET>[0],\n params: ParamsOption<any>,\n): TableFetchFn<Return> {\n return async (pagination, sorting, searching, filtering) => {\n // TODO merge with params\n const ab: { params: Params } = {\n params: {\n query: {\n page: pagination.pageIndex + 1,\n limit: pagination.pageSize,\n sort: generateSortParam(sorting[0]),\n query: searching,\n ...filtering,\n },\n },\n };\n // deep merge using lodash\n //TODO: Fix type error here when pathParams is used in the GET\n const pathParams = merge(ab, params);\n console.log(pathParams);\n return ctxClient.GET(path, ab).then((value) => {\n const rowCount = parseInt(value.response.headers.get('Pagination-Count') || '0');\n return { total: rowCount, data: value.data };\n });\n };\n}\n\nfunction generateSortParam(sort: { id: string; desc: boolean } | undefined): string {\n if (sort) {\n if (sort.desc) {\n return `-${sort.id}`;\n } else {\n return `+${sort.id}`;\n }\n } else {\n return '-createdAt';\n }\n}\n"],"names":["createTableFetchFn","path","params","pagination","sorting","searching","filtering","ab","generateSortParam","pathParams","merge","ctxClient","value","sort"],"mappings":";;AAQgB,SAAAA,EACdC,GACAC,GACsB;AACtB,SAAO,OAAOC,GAAYC,GAASC,GAAWC,MAAc;AAE1D,UAAMC,IAAyB;AAAA,MAC7B,QAAQ;AAAA,QACN,OAAO;AAAA,UACL,MAAMJ,EAAW,YAAY;AAAA,UAC7B,OAAOA,EAAW;AAAA,UAClB,MAAMK,EAAkBJ,EAAQ,CAAC,CAAC;AAAA,UAClC,OAAOC;AAAA,UACP,GAAGC;AAAA,QAAA;AAAA,MACL;AAAA,IAEJ,GAGMG,IAAaC,EAAMH,GAAIL,CAAM;AACnC,mBAAQ,IAAIO,CAAU,GACfE,EAAU,IAAIV,GAAMM,CAAE,EAAE,KAAK,CAACK,OAE5B,EAAE,OADQ,SAASA,EAAM,SAAS,QAAQ,IAAI,kBAAkB,KAAK,GAAG,GACrD,MAAMA,EAAM,KAAK,EAC5C;AAAA,EACH;AACF;AAEA,SAASJ,EAAkBK,GAAyD;AAClF,SAAIA,IACEA,EAAK,OACA,IAAIA,EAAK,EAAE,KAEX,IAAIA,EAAK,EAAE,KAGb;AAEX;"}
@@ -0,0 +1,12 @@
1
+ function n(t) {
2
+ if (!t) return null;
3
+ const e = new Date(t);
4
+ return new Intl.DateTimeFormat(void 0, {
5
+ dateStyle: "medium",
6
+ timeStyle: "short"
7
+ }).format(e);
8
+ }
9
+ export {
10
+ n as FormatDate
11
+ };
12
+ //# sourceMappingURL=date.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"date.es.js","sources":["../../../../lib/components/data-table/table-utils/date.ts"],"sourcesContent":["export function FormatDate(date: string | null | undefined) {\n if (!date) return null;\n const _date = new Date(date);\n return new Intl.DateTimeFormat(undefined, {\n dateStyle: 'medium',\n timeStyle: 'short',\n }).format(_date);\n}\n"],"names":["FormatDate","date","_date"],"mappings":"AAAO,SAASA,EAAWC,GAAiC;AACtD,MAAA,CAACA,EAAa,QAAA;AACZ,QAAAC,IAAQ,IAAI,KAAKD,CAAI;AACpB,SAAA,IAAI,KAAK,eAAe,QAAW;AAAA,IACxC,WAAW;AAAA,IACX,WAAW;AAAA,EAAA,CACZ,EAAE,OAAOC,CAAK;AACjB;"}
@@ -0,0 +1,40 @@
1
+ import i from "openapi-fetch";
2
+ const c = "AT";
3
+ function n() {
4
+ return localStorage.getItem(c);
5
+ }
6
+ const a = localStorage.getItem("apiBaseUrl") ?? "https://api.dev.cryptlex.com", h = async (t, s, o) => {
7
+ const e = await fetch(`${a}${t}`, {
8
+ method: s,
9
+ headers: {
10
+ "Content-Type": "application/json",
11
+ Authorization: `Bearer ${n()}`
12
+ },
13
+ body: o ? JSON.stringify(o) : null
14
+ });
15
+ if (e.ok) return await e.json();
16
+ throw await e.json();
17
+ }, r = i({
18
+ baseUrl: a
19
+ // TODO Telemetry signal
20
+ // headers: {}
21
+ }), l = {
22
+ async onRequest(t) {
23
+ return t.headers.set("Authorization", `Bearer ${n()}`), t;
24
+ }
25
+ }, u = {
26
+ async onResponse(t) {
27
+ if (!t.ok)
28
+ throw await t.json();
29
+ return t;
30
+ }
31
+ };
32
+ r.use(l);
33
+ r.use(u);
34
+ export {
35
+ a as US_BASE_URL,
36
+ r as ctxClient,
37
+ h as fetchClient,
38
+ n as getAccessToken
39
+ };
40
+ //# sourceMappingURL=fetch.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetch.es.js","sources":["../../../../lib/components/data-table/table-utils/fetch.ts"],"sourcesContent":["import type { paths } from '@cryptlex/web-api-types';\nimport createClient, { Middleware } from 'openapi-fetch';\nconst ACCESS_TOKEN = 'AT';\n\nexport function getAccessToken() {\n return localStorage.getItem(ACCESS_TOKEN);\n}\n// TODO: Use different urls for diff envs\nexport const US_BASE_URL = localStorage.getItem('apiBaseUrl') ?? 'https://api.dev.cryptlex.com';\ntype Methods = 'GET' | 'POST' | 'PATCH' | 'PUT';\n/**\n *\n * @param url\n * @param method\n * @param body\n * @returns\n */\nexport const fetchClient = async (url: string, method: Methods, body?: any) => {\n const response = await fetch(`${US_BASE_URL}${url}`, {\n method,\n headers: {\n 'Content-Type': 'application/json',\n 'Authorization': `Bearer ${getAccessToken()}`,\n },\n body: body ? JSON.stringify(body) : null,\n });\n if (response.ok) return await response.json();\n throw await response.json();\n};\n\nexport const ctxClient = createClient<paths>({\n baseUrl: US_BASE_URL,\n // TODO Telemetry signal\n // headers: {}\n});\n\nconst authMiddleware: Middleware = {\n async onRequest(req) {\n req.headers.set('Authorization', `Bearer ${getAccessToken()}`);\n return req;\n },\n};\n\nconst errorMiddleware: Middleware = {\n async onResponse(res) {\n if (!res.ok) {\n throw await res.json();\n }\n return res;\n },\n};\n\nctxClient.use(authMiddleware);\nctxClient.use(errorMiddleware);\n"],"names":["ACCESS_TOKEN","getAccessToken","US_BASE_URL","fetchClient","url","method","body","response","ctxClient","createClient","authMiddleware","req","errorMiddleware","res"],"mappings":";AAEA,MAAMA,IAAe;AAEd,SAASC,IAAiB;AACxB,SAAA,aAAa,QAAQD,CAAY;AAC1C;AAEO,MAAME,IAAc,aAAa,QAAQ,YAAY,KAAK,gCASpDC,IAAc,OAAOC,GAAaC,GAAiBC,MAAe;AAC7E,QAAMC,IAAW,MAAM,MAAM,GAAGL,CAAW,GAAGE,CAAG,IAAI;AAAA,IACnD,QAAAC;AAAA,IACA,SAAS;AAAA,MACP,gBAAgB;AAAA,MAChB,eAAiB,UAAUJ,GAAgB;AAAA,IAC7C;AAAA,IACA,MAAMK,IAAO,KAAK,UAAUA,CAAI,IAAI;AAAA,EAAA,CACrC;AACD,MAAIC,EAAS,GAAW,QAAA,MAAMA,EAAS,KAAK;AACtC,QAAA,MAAMA,EAAS,KAAK;AAC5B,GAEaC,IAAYC,EAAoB;AAAA,EAC3C,SAASP;AAAA;AAAA;AAGX,CAAC,GAEKQ,IAA6B;AAAA,EACjC,MAAM,UAAUC,GAAK;AACnB,WAAAA,EAAI,QAAQ,IAAI,iBAAiB,UAAUV,EAAgB,CAAA,EAAE,GACtDU;AAAA,EAAA;AAEX,GAEMC,IAA8B;AAAA,EAClC,MAAM,WAAWC,GAAK;AAChB,QAAA,CAACA,EAAI;AACD,YAAA,MAAMA,EAAI,KAAK;AAEhB,WAAAA;AAAA,EAAA;AAEX;AAEAL,EAAU,IAAIE,CAAc;AAC5BF,EAAU,IAAII,CAAe;"}
@@ -0,0 +1,21 @@
1
+ import { jsx as o } from "react/jsx-runtime";
2
+ import { Link as i } from "@tanstack/react-router";
3
+ function a(t, r, e) {
4
+ const n = {
5
+ key: "",
6
+ stateData: e
7
+ };
8
+ return /* @__PURE__ */ o(
9
+ i,
10
+ {
11
+ to: `/${r}`,
12
+ state: n,
13
+ className: "text-primary underline font-bold",
14
+ children: t
15
+ }
16
+ );
17
+ }
18
+ export {
19
+ a as getLinkDisplay
20
+ };
21
+ //# sourceMappingURL=link-display.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"link-display.es.js","sources":["../../../../lib/components/data-table/table-utils/link-display.tsx"],"sourcesContent":["import { Link } from '@tanstack/react-router';\n\n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n/**\n * This helps in passing the state data from one page to another, showing different text for a link\n * @param display String that needs to be displayed\n * @param url actual url for the a tag\n * @param stateData data to be passed to the next page\n * @returns\n */\nexport function getLinkDisplay(display: string, url: string, stateData?: any) {\n // including key, because the state overwrites the key in the state.\n const state = {\n key: '',\n stateData,\n };\n\n return (\n <Link\n to={`/${url}`}\n state={state} // Spread the row object to preserve its key\n className=\"text-primary underline font-bold\"\n >\n {display}\n </Link>\n );\n}\n"],"names":["getLinkDisplay","display","url","stateData","state","jsx","Link"],"mappings":";;AAUgB,SAAAA,EAAeC,GAAiBC,GAAaC,GAAiB;AAE5E,QAAMC,IAAQ;AAAA,IACZ,KAAK;AAAA,IACL,WAAAD;AAAA,EACF;AAGE,SAAA,gBAAAE;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,IAAI,IAAIJ,CAAG;AAAA,MACX,OAAAE;AAAA,MACA,WAAU;AAAA,MAET,UAAAH;AAAA,IAAA;AAAA,EACH;AAEJ;"}
@@ -0,0 +1,19 @@
1
+ function a(e) {
2
+ return e.replace(/([A-Z])/g, " $1").trim().split(" ").map((t) => t.charAt(0).toUpperCase() + t.slice(1).toLowerCase()).join(" ");
3
+ }
4
+ function n(e, t) {
5
+ return t > 1 ? /y$/.test(e) ? e === "Day" ? "Days" : e.replace(/y$/, "ies") : e.concat("s") : e;
6
+ }
7
+ function c(e) {
8
+ if (e) {
9
+ const t = e.replace(/([A-Z])/g, " $1");
10
+ return t.charAt(0).toUpperCase().concat(t.slice(1)).replace(/\.[a-z]/, (r) => r.replace(".", " ").toUpperCase());
11
+ } else
12
+ return e;
13
+ }
14
+ export {
15
+ c as convertCamelCaseToTitleCase,
16
+ a as convertToTitleCase,
17
+ n as pluralizeTimes
18
+ };
19
+ //# sourceMappingURL=string.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"string.es.js","sources":["../../../../lib/components/data-table/table-utils/string.ts"],"sourcesContent":["/**\n *\n * @param input camelCase\n * @returns title case for the camelCase string\n */\nexport function convertToTitleCase(input: string): string {\n return input\n .replace(/([A-Z])/g, ' $1') // Insert space before capital letters\n .trim() // Remove any leading/trailing spaces\n .split(' ') // Split into words\n .map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()) // Capitalize each word\n .join(' '); // Join back into a single string\n}\nexport function pluralizeTimes(resourceName: string, count: number) {\n if (count > 1) {\n if (/y$/.test(resourceName)) {\n if (resourceName === 'Day') return 'Days';\n return resourceName.replace(/y$/, 'ies');\n } else {\n return resourceName.concat('s');\n }\n } else return resourceName;\n}\n\n/**\n * Converts a string from 'camelCase' to 'Title Case'\n * @param string String to convert to `Title Case`\n */\nexport function convertCamelCaseToTitleCase(string: string) {\n if (string) {\n const spacedString = string.replace(/([A-Z])/g, ' $1');\n return spacedString\n .charAt(0)\n .toUpperCase()\n .concat(spacedString.slice(1))\n .replace(/\\.[a-z]/, (substr: string) => {\n return substr.replace('.', ' ').toUpperCase();\n });\n } else {\n return string;\n }\n}\n"],"names":["convertToTitleCase","input","word","pluralizeTimes","resourceName","count","convertCamelCaseToTitleCase","string","spacedString","substr"],"mappings":"AAKO,SAASA,EAAmBC,GAAuB;AACjD,SAAAA,EACJ,QAAQ,YAAY,KAAK,EACzB,KAAK,EACL,MAAM,GAAG,EACT,IAAI,CAACC,MAASA,EAAK,OAAO,CAAC,EAAE,YAAY,IAAIA,EAAK,MAAM,CAAC,EAAE,YAAY,CAAC,EACxE,KAAK,GAAG;AACb;AACgB,SAAAC,EAAeC,GAAsBC,GAAe;AAClE,SAAIA,IAAQ,IACN,KAAK,KAAKD,CAAY,IACpBA,MAAiB,QAAc,SAC5BA,EAAa,QAAQ,MAAM,KAAK,IAEhCA,EAAa,OAAO,GAAG,IAEpBA;AAChB;AAMO,SAASE,EAA4BC,GAAgB;AAC1D,MAAIA,GAAQ;AACV,UAAMC,IAAeD,EAAO,QAAQ,YAAY,KAAK;AACrD,WAAOC,EACJ,OAAO,CAAC,EACR,YACA,EAAA,OAAOA,EAAa,MAAM,CAAC,CAAC,EAC5B,QAAQ,WAAW,CAACC,MACZA,EAAO,QAAQ,KAAK,GAAG,EAAE,YAAY,CAC7C;AAAA,EAAA;AAEI,WAAAF;AAEX;"}
@@ -0,0 +1,5 @@
1
+ var L = /* @__PURE__ */ ((r) => (r[r.USER = 0] = "USER", r[r.ORGANIZATION = 1] = "ORGANIZATION", r[r.RESELLER = 2] = "RESELLER", r))(L || {});
2
+ export {
3
+ L as DYNAMIC_INPUT_TARGET
4
+ };
5
+ //# sourceMappingURL=types.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.es.js","sources":["../../../../lib/components/data-table/table-utils/types.ts"],"sourcesContent":["import { components } from '@cryptlex/web-api-types';\nimport { PaginationState, SortingState } from '@tanstack/react-table';\n// export type RoutePath = RoutePaths<typeof routeTree>;\nexport type fieldsToDisplay = {\n display: string;\n accessor: string;\n};\n[];\nexport enum DYNAMIC_INPUT_TARGET {\n USER,\n ORGANIZATION,\n RESELLER,\n}\nexport type VisibilityState<T> = {\n [K in keyof T]?: boolean;\n};\nexport type TableActions = {\n /** True if reading this resource is allowed. */\n read: boolean;\n\n /** True if creation of resource from dashboard is allowed. */\n create: boolean;\n\n /** True if the resource can be updated */\n update: boolean;\n\n /** True if the resource can be deleted */\n delete: boolean;\n\n /** True if the resource can be exported */\n export: boolean;\n\n /** True if the resource can be linked to tags. */\n tag: boolean;\n\n /** True if searching is supported. Search is defined by the `query` QueryParameter in the Web API */\n search: boolean;\n\n /** True if selection using checkboxes is allowed */\n selection: boolean;\n\n /** True if the resource has support for segments */\n segments: boolean;\n};\n\nexport type JwtDecode = {\n aud: string;\n email: string;\n exp: number;\n iat: number;\n jti: string;\n region: string;\n role: string;\n role_type: string;\n scope: string[];\n sub: string;\n teat: number;\n tenantid: string;\n token_usage: string;\n sadmin?: string;\n};\n\nexport type Portals = 'customer-portal' | 'system-portal' | 'reseller-portal' | 'admin-portal';\nexport type MetadataDto = components['schemas']['MetadataDto'];\n\nexport type TableFetchFn<TData> = (\n p: PaginationState,\n s: SortingState,\n q: string,\n f: any,\n) => Promise<{\n total: number;\n data: TData[] | undefined;\n}>;\n/*** Type for hide some of the columns based on the dto of the particular page\n ** `id`, `updatedAt` are by default hidden\n */\nexport type DefaultVisibilityState<T> = {\n [K in keyof T]?: boolean;\n};\n"],"names":["DYNAMIC_INPUT_TARGET","DYNAMIC_INPUT_TARGET2"],"mappings":"AAQY,IAAAA,sBAAAA,OACVA,EAAAC,EAAA,OAAA,CAAA,IAAA,QACAD,EAAAC,EAAA,eAAA,CAAA,IAAA,gBACAD,EAAAC,EAAA,WAAA,CAAA,IAAA,YAHUD,IAAAA,KAAA,CAAA,CAAA;"}
@@ -0,0 +1,74 @@
1
+ import { jsxs as a, jsx as o } from "react/jsx-runtime";
2
+ import { Badge as l } from "../ui/badge.es.js";
3
+ import "../ui/accordion.es.js";
4
+ import "../ui/avatar.es.js";
5
+ import "../ui/breadcrumb.es.js";
6
+ import "../ui/button.es.js";
7
+ import "../ui/calendar.es.js";
8
+ import { Card as c, CardHeader as d, CardTitle as f, CardContent as u } from "../ui/card.es.js";
9
+ import "../ui/chart.es.js";
10
+ import "../ui/checkbox.es.js";
11
+ import "@radix-ui/react-collapsible";
12
+ import "../ui/command.es.js";
13
+ import "../ui/dialog.es.js";
14
+ import "../ui/drawer.es.js";
15
+ import "../ui/dropdown-menu.es.js";
16
+ import "../ui/form.es.js";
17
+ import "../ui/input.es.js";
18
+ import "../ui/input-otp.es.js";
19
+ import "../ui/label.es.js";
20
+ import "lucide-react";
21
+ import "../ui/mutli-select.es.js";
22
+ import "../ui/navigation-menu.es.js";
23
+ import "../ui/pagination.es.js";
24
+ import "../ui/password-input.es.js";
25
+ import "../ui/popover.es.js";
26
+ import "../ui/radio-group.es.js";
27
+ import "react";
28
+ import "../ui/select.es.js";
29
+ import "../ui/separator.es.js";
30
+ import "../ui/sheet.es.js";
31
+ import "../ui/sidebar.es.js";
32
+ import { Skeleton as x } from "../ui/skeleton.es.js";
33
+ import "sonner";
34
+ import "../ui/table.es.js";
35
+ import "../ui/tabs.es.js";
36
+ import "../ui/tooltip.es.js";
37
+ import "@tanstack/react-query";
38
+ import "cmdk";
39
+ import "use-debounce";
40
+ const tr = ({ data: p, label: s, fields: e }) => {
41
+ const n = (r, t) => {
42
+ if (r.transform)
43
+ return r.transform(t);
44
+ switch (r.type) {
45
+ case "badge":
46
+ return /* @__PURE__ */ o("div", { className: "flex flex-wrap gap-1", children: Array.isArray(t) ? t.map((i, m) => /* @__PURE__ */ o(l, { variant: "secondary", children: typeof i == "object" ? i.name || i.id : i }, m)) : t });
47
+ case "boolean":
48
+ return t.toString();
49
+ default:
50
+ return t ?? "";
51
+ }
52
+ };
53
+ return /* @__PURE__ */ a(c, { children: [
54
+ /* @__PURE__ */ o(d, { children: /* @__PURE__ */ o(f, { children: s }) }),
55
+ /* @__PURE__ */ o(u, { children: /* @__PURE__ */ o("div", { className: "flex flex-col gap-1", children: p ? e.map((r) => {
56
+ const t = r.accessor ? r.accessor.split(".").reduce((i, m) => i == null ? void 0 : i[m], p) : null;
57
+ return /* @__PURE__ */ a(
58
+ "div",
59
+ {
60
+ className: "flex w-full justify-between first:pt-0 last:pb-0",
61
+ children: [
62
+ /* @__PURE__ */ o("p", { className: "text-sm flex w-full justify-start font-semibold text-muted-foreground col-span-1", children: r.display }),
63
+ /* @__PURE__ */ o("div", { className: "text-sm flex w-full justify-start text-wrap overflow-auto", children: n(r, t) })
64
+ ]
65
+ },
66
+ r.display
67
+ );
68
+ }) : e.map((r, t) => /* @__PURE__ */ o(x, { className: "h-12 w-full" }, t)) }) })
69
+ ] });
70
+ };
71
+ export {
72
+ tr as InfoCard
73
+ };
74
+ //# sourceMappingURL=info-card.es.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"info-card.es.js","sources":["../../../lib/components/info-card/info-card.tsx"],"sourcesContent":["import { Badge } from '@/components/ui/badge';\nimport { Card, CardContent, CardHeader, CardTitle, Skeleton } from '@/index';\n\nexport type DisplayField = {\n display: string;\n accessor: string;\n type?: 'text' | 'badge' | 'boolean';\n transform?: (value: any) => React.ReactNode;\n};\n\nexport interface InfoCardProps {\n data: Record<string, any>;\n label: string;\n fields: DisplayField[];\n className?: string;\n}\n\nexport const InfoCard: React.FC<InfoCardProps> = ({ data, label, fields }) => {\n const renderValue = (field: DisplayField, value: any) => {\n // Custom transform if provided\n if (field.transform) {\n return field.transform(value);\n }\n\n // Handle specific types\n switch (field.type) {\n case 'badge':\n return (\n <div className=\"flex flex-wrap gap-1\">\n {Array.isArray(value)\n ? value.map((item, index) => (\n <Badge key={index} variant=\"secondary\">\n {typeof item === 'object' ? item.name || item.id : item}\n </Badge>\n ))\n : value}\n </div>\n );\n\n case 'boolean':\n return value.toString();\n default:\n return value ?? '';\n }\n };\n\n return (\n <Card>\n <CardHeader>\n <CardTitle>{label}</CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"flex flex-col gap-1\">\n {data\n ? fields.map((field) => {\n const value = field.accessor\n ? field.accessor.split('.').reduce((obj, key) => obj?.[key], data)\n : null;\n\n return (\n <div\n key={field.display}\n className=\"flex w-full justify-between first:pt-0 last:pb-0\"\n >\n <p className=\"text-sm flex w-full justify-start font-semibold text-muted-foreground col-span-1\">\n {field.display}\n </p>\n <div className=\"text-sm flex w-full justify-start text-wrap overflow-auto\">\n {renderValue(field, value)}\n </div>\n </div>\n );\n })\n : fields.map((_, index) => <Skeleton key={index} className=\"h-12 w-full\" />)}\n </div>\n </CardContent>\n </Card>\n );\n};\n"],"names":["InfoCard","data","label","fields","renderValue","field","value","jsx","item","index","Badge","Card","CardHeader","CardTitle","CardContent","obj","key","jsxs","_","Skeleton"],"mappings":";;;;;;;;;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