@cryptlex/web-components 6.6.6-alpha50 → 6.6.6-alpha53

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 (39) hide show
  1. package/dist/components/checkbox.js +1 -1
  2. package/dist/components/checkbox.js.map +1 -1
  3. package/dist/components/{table-actions.js → data-table-actions.js} +1 -1
  4. package/dist/components/data-table-actions.js.map +1 -0
  5. package/dist/components/data-table-filter.d.ts +1 -1
  6. package/dist/components/data-table-filter.js +1 -1
  7. package/dist/components/data-table.d.ts +11 -25
  8. package/dist/components/data-table.js +1 -1
  9. package/dist/components/data-table.js.map +1 -1
  10. package/dist/components/date-picker.js +1 -1
  11. package/dist/components/date-picker.js.map +1 -1
  12. package/dist/components/duration-field.js +1 -1
  13. package/dist/components/duration-field.js.map +1 -1
  14. package/dist/components/id-search.d.ts +4 -4
  15. package/dist/components/id-search.js +1 -1
  16. package/dist/components/id-search.js.map +1 -1
  17. package/dist/components/multi-select.js +1 -1
  18. package/dist/components/multi-select.js.map +1 -1
  19. package/dist/components/numberfield.js +1 -1
  20. package/dist/components/numberfield.js.map +1 -1
  21. package/dist/components/select-options.d.ts +1 -0
  22. package/dist/components/select-options.js +1 -1
  23. package/dist/components/select-options.js.map +1 -1
  24. package/dist/components/select.js +1 -1
  25. package/dist/components/select.js.map +1 -1
  26. package/dist/components/textfield.js +1 -1
  27. package/dist/components/textfield.js.map +1 -1
  28. package/dist/components/toast.d.ts +4 -8
  29. package/dist/components/toast.js +1 -1
  30. package/dist/components/toast.js.map +1 -1
  31. package/dist/utilities/form-context.d.ts +3 -1
  32. package/dist/utilities/form-context.js +1 -1
  33. package/dist/utilities/form-context.js.map +1 -1
  34. package/dist/utilities/resources.d.ts +9 -7
  35. package/dist/utilities/resources.js +1 -1
  36. package/dist/utilities/resources.js.map +1 -1
  37. package/package.json +1 -1
  38. package/dist/components/table-actions.js.map +0 -1
  39. /package/dist/components/{table-actions.d.ts → data-table-actions.d.ts} +0 -0
@@ -1,2 +1,2 @@
1
- import{jsx as s}from"react/jsx-runtime";import{createContext as i,use as r}from"react";import{toTitleCase as l}from"./string.js";import"lodash-es";const t={"product.displayName":"Product",product_displayName:"Product"},g=["access-token","account","activation","activation-log","admin-role","audit-log","automated-email","automated-email-event-log","card","entitlement-set","feature-flag","feature","invoice","license","license-template","maintenance-policy","organization","plan","product","product-version","profile","release","release-channel","release-file","release-platform","role","role-claim","saml-configuration","segment","sending-domain","tag","trial","trial-policy","user","user-group","webhook","webhook-event-log","webhook-event","reseller","oidc-configuration","tenant-database-cluster"],a={id:"ID",createdAt:"Creation Date",scopes:"Permissions",updatedAt:"Last Updated",expiresAt:"Expiration Date",lastSeenAt:"Last Seen",os:"OS",osVersion:"OS Version",key:"License Key",vmName:"VM Name",container:"Container",allowedIpRange:"Allowed IP Range",allowedIpRanges:"Allowed IP Ranges",allowedIpAddresses:"Allowed IP Addresses",disallowedIpAddresses:"Disallowed IP Addresses",allowVmActivation:"Allow VM Activation",disableGeoLocation:"Disable Geolocation","user.id":"User ID",userId:"User",productId:"Product",downloads:"Total Downloads",claims:"Permissions",googleSsoEnabled:"Google Login Enabled",lastAttemptedAt:"Last Attempt Date",url:"URL","trialPolicy.name":"Trial Policy Name","licensePolicy.name":"License Template Name",licensePolicy:"License Template",eventLog:"Audit Log",cc:"CC Recepients",bcc:"BCC Recepients",ipAddress:"IP Address",resellerId:"Reseller",productVersionId:"Product Version",releaseId:"Release",maintenancePolicyId:"Maintenance Policy",webhookId:"Webhook",automatedEmailId:"Automated Email","location.countryName":"Country","location.ipAddress":"IP Address","location.countryCode":"Country",organizationId:"Organization","address.country":"Country","address.addressLine1":"Address Line 1","address.addressLine2":"Address Line 2",responseStatusCode:"HTTP Status Code",resourceId:"Resource ID",Sso:"SAML SSO 2.0","reseller.name":"Reseller",sendingDomain:"Email Sending Domain"};function d(e,o){return o!=="admin-portal"&&e in t?t[e]:e in a?a[e]:l(e)}const n=i("admin-portal");function A({projectName:e,children:o}){return s(n.Provider,{value:e,children:o})}function c(){return r(n)}const f={"access-token":"/v3/personal-access-tokens",account:"/v3/admin/accounts",activation:"/v3/activations","activation-log":"/v3/activation-logs","admin-role":"/v3/roles","audit-log":"/v3/event-logs","automated-email":"/v3/automated-emails","automated-email-event-log":"/v3/automated-email-event-logs","entitlement-set":"/v3/entitlement-sets","feature-flag":"/v3/feature-flags",feature:"/v3/features",license:"/v3/licenses","license-template":"/v3/license-templates","maintenance-policy":"/v3/maintenance-policies",organization:"/v3/organizations",plan:"/v3/plans",product:"/v3/products","product-version":"/v3/product-versions",release:"/v3/releases","release-channel":"/v3/release-channels","release-file":"/v3/release-files","release-platform":"/v3/release-platforms",reseller:"/v3/resellers",role:"/v3/roles",segment:"/v3/segments","sending-domain":"/v3/sending-domains",tag:"/v3/tags",trial:"/v3/trial-activations","trial-policy":"/v3/trial-policies",user:"/v3/users","user-group":"/v3/organizations/{organizationId}/user-groups",webhook:"/v3/webhooks","webhook-event-log":"/v3/webhook-event-logs",card:"/v3/billing/payment-methods/cards",invoice:"/v3/billing/invoices",profile:"/v3/me","role-claim":"/v3/roles/claims","saml-configuration":"/v3/accounts/{id}/saml-configuration","webhook-event":"/v3/webhooks/events","oidc-configuration":"/v3/accounts/{id}/oidc-configuration","tenant-database-cluster":"/v3/admin/tenant-database-clusters"};function P(){const e=c();return o=>d(o,e)}function w(e){const o=e.expiresAt&&new Date(e.expiresAt)<new Date;switch(!0){case(e.revoked&&e.suspended&&o):return"Revoked, Suspended, Expired";case(e.revoked&&e.suspended):return"Revoked, Suspended";case(e.revoked&&o):return"Revoked, Expired";case(e.suspended&&o):return"Suspended, Expired";case e.suspended:return"Suspended";case e.revoked:return"Revoked";case o:return"Expired";default:return"Active"}}const S={windows:"Windows",macos:"macOS",linux:"Linux",ios:"iOS",android:"Android"};export{S as ALL_OS,A as ProjectProvider,f as RESOURCE_ENDPOINT_MAP,g as RESOURCE_NAMES,w as getLicenseStatus,c as useProjectName,P as useResourceFormatter};
1
+ import{jsx as r}from"react/jsx-runtime";import{createContext as s,use as d}from"react";import{toTitleCase as i}from"./string.js";import"lodash-es";const t={"product.displayName":"Product",product_displayName:"Product"},g=["access-token","account","activation","activation-log","admin-role","audit-log","automated-email","automated-email-event-log","card","entitlement-set","feature-flag","feature","invoice","license","license-template","maintenance-policy","organization","plan","product","product-version","profile","release","release-channel","release-file","release-platform","role","role-claim","saml-configuration","segment","sending-domain","tag","trial","trial-policy","user","user-group","webhook","webhook-event-log","webhook-event","reseller","oidc-configuration","tenant-database-cluster"],a={id:"ID",createdAt:"Creation Date",scopes:"Permissions",updatedAt:"Last Updated",expiresAt:"Expiration Date",lastSeenAt:"Last Seen",os:"OS",osVersion:"OS Version",key:"License Key",vmName:"VM Name",container:"Container",allowedIpRange:"Allowed IP Range",allowedIpRanges:"Allowed IP Ranges",allowedIpAddresses:"Allowed IP Addresses",disallowedIpAddresses:"Disallowed IP Addresses",allowVmActivation:"Allow VM Activation",disableGeoLocation:"Disable Geolocation","user.id":"User ID",userId:"User",productId:"Product",downloads:"Total Downloads",claims:"Permissions",googleSsoEnabled:"Google Login Enabled",lastAttemptedAt:"Last Attempt Date",url:"URL","trialPolicy.name":"Trial Policy Name","licensePolicy.name":"License Template Name",licensePolicy:"License Template",eventLog:"Audit Log",cc:"CC Recepients",bcc:"BCC Recepients",ipAddress:"IP Address",resellerId:"Reseller",productVersionId:"Product Version",releaseId:"Release",maintenancePolicyId:"Maintenance Policy",webhookId:"Webhook",automatedEmailId:"Automated Email","location.countryName":"Country","location.ipAddress":"IP Address","location.countryCode":"Country",organizationId:"Organization","address.country":"Country","address.addressLine1":"Address Line 1","address.addressLine2":"Address Line 2",responseStatusCode:"HTTP Status Code",resourceId:"Resource ID",Sso:"SAML SSO 2.0","reseller.name":"Reseller",sendingDomain:"Email Sending Domain"};function l(e,o){return o!=="admin-portal"&&e in t?t[e]:e in a?a[e]:i(e)}const n=s("admin-portal");function P({projectName:e,children:o}){return r(n.Provider,{value:e,children:o})}function c(){return d(n)}function S(){const e=c();return o=>l(o,e)}function I(e){const o=e.expiresAt&&new Date(e.expiresAt)<new Date;switch(!0){case(e.revoked&&e.suspended&&o):return"Revoked, Suspended, Expired";case(e.revoked&&e.suspended):return"Revoked, Suspended";case(e.revoked&&o):return"Revoked, Expired";case(e.suspended&&o):return"Suspended, Expired";case e.suspended:return"Suspended";case e.revoked:return"Revoked";case o:return"Expired";default:return"Active"}}const v={windows:"Windows",macos:"macOS",linux:"Linux",ios:"iOS",android:"Android"};export{v as ALL_OS,P as ProjectProvider,g as RESOURCE_NAMES,I as getLicenseStatus,c as useProjectName,S as useResourceFormatter};
2
2
  //# sourceMappingURL=resources.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resources.js","sources":["../../lib/utilities/resources.tsx"],"sourcesContent":["import type { components, operations } from '@cryptlex/web-api-types/develop';\nimport type { ClientPathsWithMethod } from 'openapi-fetch';\nimport { createContext, use } from 'react';\nimport type { CtxClientType } from './ctx-client';\nimport { toTitleCase } from './string';\n\nexport type ApiSchema<T extends keyof components['schemas']> = components['schemas'][T];\nexport type ApiQuery<T extends keyof operations> = NonNullable<operations[T]['parameters']['query']>;\nexport type ApiFilter<T extends keyof operations> = Omit<ApiQuery<T>, 'page' | 'limit' | 'sort' | 'search'>;\nexport type ApiFilters<T extends keyof operations> = NonNullable<ApiFilter<T>>;\nexport type CtxPortals = 'customer-portal' | 'system-portal' | 'reseller-portal' | 'admin-portal';\n// Display names specific to customer and reseller portal\nconst OTHER_PORTALS_DISPLAY_NAME: Record<string, string> = {\n 'product.displayName': 'Product',\n // TanStack Table converts . -> _ TODO\n product_displayName: 'Product',\n};\n\n// TODO, this drifts quite a lot from the API, should be updated\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 'entitlement-set',\n 'feature-flag',\n 'feature',\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 'role',\n 'role-claim',\n 'saml-configuration',\n 'segment',\n 'sending-domain',\n 'tag',\n 'trial',\n 'trial-policy',\n 'user',\n 'user-group',\n 'webhook',\n 'webhook-event-log',\n 'webhook-event',\n 'reseller',\n 'oidc-configuration',\n 'tenant-database-cluster',\n] as const;\nexport type CtxResourceName = (typeof RESOURCE_NAMES)[number];\n\n// TODO, use OpenAPI spec for resource definitions\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};\n\nfunction getResourceDisplayName(resourceName: string, portal: CtxPortals) {\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 toTitleCase(resourceName);\n }\n}\n\nconst ProjectContext = createContext<CtxPortals>('admin-portal');\n\nexport function ProjectProvider({ projectName, children }: { projectName: CtxPortals; children: React.ReactNode }) {\n return <ProjectContext.Provider value={projectName}>{children}</ProjectContext.Provider>;\n}\n\nexport function useProjectName(): CtxPortals {\n const projectName = use(ProjectContext);\n return projectName;\n}\n\n/**\n * Mapping from resource names to their API endpoint paths.\n * Based on the OpenAPI spec paths.\n */\nexport const RESOURCE_ENDPOINT_MAP: Record<CtxResourceName, ClientPathsWithMethod<CtxClientType, 'get'>> = {\n 'access-token': '/v3/personal-access-tokens',\n account: '/v3/admin/accounts',\n activation: '/v3/activations',\n 'activation-log': '/v3/activation-logs',\n 'admin-role': '/v3/roles',\n 'audit-log': '/v3/event-logs',\n 'automated-email': '/v3/automated-emails',\n 'automated-email-event-log': '/v3/automated-email-event-logs',\n 'entitlement-set': '/v3/entitlement-sets',\n 'feature-flag': '/v3/feature-flags',\n feature: '/v3/features',\n license: '/v3/licenses',\n 'license-template': '/v3/license-templates',\n 'maintenance-policy': '/v3/maintenance-policies',\n organization: '/v3/organizations',\n plan: '/v3/plans',\n product: '/v3/products',\n 'product-version': '/v3/product-versions',\n release: '/v3/releases',\n 'release-channel': '/v3/release-channels',\n 'release-file': '/v3/release-files',\n 'release-platform': '/v3/release-platforms',\n reseller: '/v3/resellers',\n role: '/v3/roles',\n segment: '/v3/segments',\n 'sending-domain': '/v3/sending-domains',\n tag: '/v3/tags',\n trial: '/v3/trial-activations',\n 'trial-policy': '/v3/trial-policies',\n user: '/v3/users',\n 'user-group': '/v3/organizations/{organizationId}/user-groups',\n webhook: '/v3/webhooks',\n 'webhook-event-log': '/v3/webhook-event-logs',\n card: '/v3/billing/payment-methods/cards',\n invoice: '/v3/billing/invoices',\n /** This one is an exception, it does not return an array. DO NOT USE WITH IdSearch. */\n profile: '/v3/me',\n 'role-claim': '/v3/roles/claims',\n 'saml-configuration': '/v3/accounts/{id}/saml-configuration',\n 'webhook-event': '/v3/webhooks/events',\n 'oidc-configuration': '/v3/accounts/{id}/oidc-configuration',\n 'tenant-database-cluster': '/v3/admin/tenant-database-clusters',\n};\n\nexport function useResourceFormatter(): (resourceName: string) => string {\n const portal = useProjectName();\n return (resourceName: string) => getResourceDisplayName(resourceName, portal);\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}\ntype OsType = ApiSchema<'ActivationCreateRequestModel'>['os'];\nexport const ALL_OS: Record<OsType, string> = {\n windows: 'Windows',\n macos: 'macOS',\n linux: 'Linux',\n ios: 'iOS',\n android: 'Android',\n};\n"],"names":["OTHER_PORTALS_DISPLAY_NAME","RESOURCE_NAMES","RESOURCE_DISPLAY_NAMES","getResourceDisplayName","resourceName","portal","toTitleCase","ProjectContext","createContext","ProjectProvider","projectName","children","useProjectName","use","RESOURCE_ENDPOINT_MAP","useResourceFormatter","getLicenseStatus","license","licenseExpired","ALL_OS"],"mappings":"mJAYA,MAAMA,EAAqD,CACvD,sBAAuB,UAEvB,oBAAqB,SACzB,EAIaC,EAAiB,CAC1B,eACA,UACA,aACA,iBACA,aACA,YACA,kBACA,4BACA,OACA,kBACA,eACA,UACA,UACA,UACA,mBACA,qBACA,eACA,OACA,UACA,kBACA,UACA,UACA,kBACA,eACA,mBACA,OACA,aACA,qBACA,UACA,iBACA,MACA,QACA,eACA,OACA,aACA,UACA,oBACA,gBACA,WACA,qBACA,yBACJ,EAKMC,EAAiD,CACnD,GAAI,KACJ,UAAW,gBACX,OAAQ,cACR,UAAW,eACX,UAAW,kBACX,WAAY,YACZ,GAAI,KACJ,UAAW,aACX,IAAK,cACL,OAAQ,UACR,UAAW,YACX,eAAgB,mBAChB,gBAAiB,oBACjB,mBAAoB,uBACpB,sBAAuB,0BACvB,kBAAmB,sBACnB,mBAAoB,sBACpB,UAAW,UACX,OAAQ,OACR,UAAW,UACX,UAAW,kBACX,OAAQ,cACR,iBAAkB,uBAClB,gBAAiB,oBACjB,IAAK,MACL,mBAAoB,oBACpB,qBAAsB,wBACtB,cAAe,mBACf,SAAU,YACV,GAAI,gBACJ,IAAK,iBACL,UAAW,aACX,WAAY,WACZ,iBAAkB,kBAClB,UAAW,UACX,oBAAqB,qBACrB,UAAW,UACX,iBAAkB,kBAClB,uBAAwB,UACxB,qBAAsB,aACtB,uBAAwB,UACxB,eAAgB,eAChB,kBAAmB,UACnB,uBAAwB,iBACxB,uBAAwB,iBACxB,mBAAoB,mBACpB,WAAY,cACZ,IAAK,eACL,gBAAiB,WACjB,cAAe,sBACnB,EAEA,SAASC,EAAuBC,EAAsBC,EAAoB,CACtE,OAAIA,IAAW,gBAAkBD,KAAgBJ,EACtCA,EAA2BI,CAAY,EACvCA,KAAgBF,EAChBA,EAAuBE,CAAY,EAEnCE,EAAYF,CAAY,CAEvC,CAEA,MAAMG,EAAiBC,EAA0B,cAAc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,QACI,MAAO,QAAA,CAEnB,CAEO,MAAMC,EAAiC,CAC1C,QAAS,UACT,MAAO,QACP,MAAO,QACP,IAAK,MACL,QAAS,SACb"}
1
+ {"version":3,"file":"resources.js","sources":["../../lib/utilities/resources.tsx"],"sourcesContent":["import type { components, operations } from '@cryptlex/web-api-types/develop';\nimport { createContext, use } from 'react';\nimport { toTitleCase } from './string';\n\nexport type ApiSchema<T extends keyof components['schemas']> = components['schemas'][T];\nexport type ApiResponseBody<T extends keyof operations> = operations[T] extends {\n responses: { 200: { content: { 'application/json': infer R } } };\n}\n ? R extends Array<infer U>\n ? U\n : R\n : never;\nexport type ApiQuery<T extends keyof operations> = NonNullable<operations[T]['parameters']['query']>;\nexport type ApiFilter<T extends keyof operations> = Omit<ApiQuery<T>, 'page' | 'limit' | 'sort' | 'search'>;\nexport type ApiFilters<T extends keyof operations> = NonNullable<ApiFilter<T>>;\nexport type CtxPortals = 'customer-portal' | 'system-portal' | 'reseller-portal' | 'admin-portal';\n// Display names specific to customer and reseller portal\nconst OTHER_PORTALS_DISPLAY_NAME: Record<string, string> = {\n 'product.displayName': 'Product',\n // TanStack Table converts . -> _ TODO\n product_displayName: 'Product',\n};\n\n// TODO, delegate to openapi.json\n// TODO, this drifts quite a lot from the API, should be updated\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 'entitlement-set',\n 'feature-flag',\n 'feature',\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 'role',\n 'role-claim',\n 'saml-configuration',\n 'segment',\n 'sending-domain',\n 'tag',\n 'trial',\n 'trial-policy',\n 'user',\n 'user-group',\n 'webhook',\n 'webhook-event-log',\n 'webhook-event',\n 'reseller',\n 'oidc-configuration',\n 'tenant-database-cluster',\n] as const;\nexport type CtxResourceName = (typeof RESOURCE_NAMES)[number];\n\n// TODO, use OpenAPI spec for resource definitions\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};\n\nfunction getResourceDisplayName(resourceName: string, portal: CtxPortals) {\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 toTitleCase(resourceName);\n }\n}\n\nconst ProjectContext = createContext<CtxPortals>('admin-portal');\n\nexport function ProjectProvider({ projectName, children }: { projectName: CtxPortals; children: React.ReactNode }) {\n return <ProjectContext.Provider value={projectName}>{children}</ProjectContext.Provider>;\n}\n\nexport function useProjectName(): CtxPortals {\n const projectName = use(ProjectContext);\n return projectName;\n}\n\nexport function useResourceFormatter(): (resourceName: string) => string {\n const portal = useProjectName();\n return (resourceName: string) => getResourceDisplayName(resourceName, portal);\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}\ntype OsType = ApiSchema<'ActivationCreateRequestModel'>['os'];\nexport const ALL_OS: Record<OsType, string> = {\n windows: 'Windows',\n macos: 'macOS',\n linux: 'Linux',\n ios: 'iOS',\n android: 'Android',\n};\n"],"names":["OTHER_PORTALS_DISPLAY_NAME","RESOURCE_NAMES","RESOURCE_DISPLAY_NAMES","getResourceDisplayName","resourceName","portal","toTitleCase","ProjectContext","createContext","ProjectProvider","projectName","children","useProjectName","use","useResourceFormatter","getLicenseStatus","license","licenseExpired","ALL_OS"],"mappings":"mJAiBA,MAAMA,EAAqD,CACvD,sBAAuB,UAEvB,oBAAqB,SACzB,EAKaC,EAAiB,CAC1B,eACA,UACA,aACA,iBACA,aAC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CAAc,CAE1C,CAEO,SAASO,GAAyD,CACrE,MAAMT,EAASO,EAAA,EACf,OAAQR,GAAyBD,EAAuBC,EAAcC,CAAM,CAChF,CAKO,SAASU,EAAiBC,EAAsB,CACnD,MAAMC,EAAiBD,EAAQ,WAAa,IAAI,KAAKA,EAAQ,SAAS,EAAI,IAAI,KAE9E,OAAQ,GAAA,CACJ,KAAKA,EAAQ,SAAWA,EAAQ,WAAaC,GACzC,MAAO,8BACX,KAAKD,EAAQ,SAAWA,EAAQ,WAC5B,MAAO,qBACX,KAAKA,EAAQ,SAAWC,GACpB,MAAO,mBACX,KAAKD,EAAQ,WAAaC,GACtB,MAAO,qBACX,KAAKD,EAAQ,UACT,MAAO,YACX,KAAKA,EAAQ,QACT,MAAO,UACX,KAAKC,EACD,MAAO,UACX,QACI,MAAO,QAAA,CAEnB,CAEO,MAAMC,EAAiC,CAC1C,QAAS,UACT,MAAO,QACP,MAAO,QACP,IAAK,MACL,QAAS,SACb"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cryptlex/web-components",
3
- "version": "6.6.6-alpha50",
3
+ "version": "6.6.6-alpha53",
4
4
  "description": "React component library for Cryptlex web applications",
5
5
  "author": "Cryptlex",
6
6
  "type": "module",
@@ -1 +0,0 @@
1
- {"version":3,"file":"table-actions.js","sources":["../../lib/components/table-actions.tsx"],"sourcesContent":["'use client';\nimport type React from 'react';\nimport type { PressEvent } from 'react-aria-components';\nimport { normalizeLabel } from '../utilities/string';\nimport { Button } from './button';\nimport { DialogActionRenderer, findItemByNormalizedLabel, useDialogState } from './dialog-action-utils';\nimport type { CtxIcon } from './icons';\n\nexport type TableActionDialogContentProps<T> = {\n /** Callback to close the dialog */\n close: () => void;\n /** The data passed to the dialog - array of selected rows */\n data: T[];\n /** Flag to identify table action dialogs */\n tableAction: true;\n};\n\n/** Base properties shared by all table actions */\nexport type TableActionBase<T> = {\n label: string;\n /** Optional function to determine if the action is disabled. Receives the rows and returns a boolean. Defaults to false if not provided */\n isDisabled?: (rows: T[]) => boolean;\n icon: CtxIcon;\n bulk: boolean;\n tooltip?: string;\n /** Optional button variant to pass through to Button (defaults to neutral) */\n variant?: React.ComponentProps<typeof Button>['variant'];\n};\n\n/** Action that triggers a callback */\nexport type TableActionAction<T> = TableActionBase<T> & {\n type: 'action';\n /** Callback triggered when the action is pressed. Receives the press event and selected rows as parameters */\n onClick: (e: PressEvent, rows: T[]) => void;\n};\n\n/** Action that opens a dialog */\nexport type TableActionDialog<T> = TableActionBase<T> & {\n type: 'dialog';\n /** Component to render in the dialog */\n component: React.ComponentType<TableActionDialogContentProps<T>>;\n};\n\n/** Common table action type that works for both action and dialog types */\nexport type TableAction<T> = TableActionAction<T> | TableActionDialog<T>;\n\nfunction isTableActionAction<T>(item: TableAction<T>): item is TableActionAction<T> {\n return item.type === 'action';\n}\n\nfunction isTableActionDialog<T>(item: TableAction<T>): item is TableActionDialog<T> {\n return item.type === 'dialog';\n}\n\nfunction getTableActionIsDisabled<T>(item: TableAction<T>, rows: T[]): boolean {\n return item.isDisabled ? item.isDisabled(rows) : false;\n}\n\nexport type TableActionsProps<T> = {\n /** Array of table actions to render */\n readonly items: TableAction<T>[];\n /** Array of selected rows */\n readonly rowsSelected: T[];\n /** Whether the table is currently fetching data */\n readonly isFetching?: boolean;\n};\n\nexport function TableActions<T>({ items, rowsSelected, isFetching }: TableActionsProps<T>) {\n const { openKey, setOpenKey } = useDialogState();\n\n return (\n <>\n {items.map((item, i) => {\n const id = normalizeLabel(item.label);\n const Icon = item.icon;\n const isDisabled = getTableActionIsDisabled(item, rowsSelected) || isFetching;\n\n return (\n <Button\n key={`${id}-${i}`}\n aria-label={item.label}\n type=\"button\"\n isDisabled={isDisabled}\n className=\"animate-in fade-in slide-in-from-left-15 duration-300 transition-transform\"\n onPress={e => {\n if (isDisabled) return;\n\n if (isTableActionAction(item)) {\n item.onClick(e, rowsSelected);\n } else if (isTableActionDialog(item)) {\n setOpenKey(id);\n }\n }}\n variant={item.variant ?? 'neutral'}\n >\n <Icon />\n <span>{item.label}</span>\n </Button>\n );\n })}\n\n <DialogActionRenderer<TableActionDialogContentProps<T>>\n openKey={openKey}\n onOpenChange={open => {\n if (!open) setOpenKey(null);\n }}\n findItem={key => {\n const item = findItemByNormalizedLabel(items, key);\n if (!item || !isTableActionDialog(item)) return null;\n return { component: item.component };\n }}\n getDialogProps={close => ({ data: rowsSelected, tableAction: true, close })}\n />\n </>\n );\n}\n"],"names":["isTableActionAction","item","isTableActionDialog","getTableActionIsDisabled","rows","TableActions","items","rowsSelected","isFetching","openKey","setOpenKey","useDialogState","jsxs","Fragment","i","id","normalizeLabel","Icon","isDisabled","Button","e","jsx","DialogActionRenderer","open","key","findItemByNormalizedLabel","close"],"mappings":"keA8CA,SAASA,EAAuBC,EAAoD,CAChF,OAAOA,EAAK,OAAS,QACzB,CAEA,SAASC,EAAuBD,EAAoD,CAChF,OAAOA,EAAK,OAAS,QACzB,CAEA,SAASE,EAA4BF,EAAsBG,EAAoB,CAC3E,OAAOH,EAAK,WAAaA,EAAK,WAAWG,CAAI,EAAI,EACrD,CAWO,SAASC,EAAgB,CAAE,MAAAC,EAAO,aAAAC,EAAc,WAAAC,GAAoC,CACvF,KAAM,CAAE,QAAAC,EAAS,WAAAC,CAAA,EAAeC,EAAA,EAEhC,OACIC,EAAAC,EAAA,CACK,SAAA,CAAAP,EAAM,IAAI,CAACL,EAAMa,IAAM,CACpB,MAAMC,EAAKC,EAAef,EAAK,KAAK,EAC9BgB,EAAOhB,EAAK,KACZiB,EAAaf,EAAyBF,EAAMM,CAAY,GAAKC,EAEnE,OACII,EAACO,EAAA,CAEG,aAAYlB,EAAK,MACjB,KAAK,SACL,WAAAiB,EACA,UAAU,6EACV,QAASE,GAAK,CACNF,IAEAlB,EAAoBC,CAAI,EACxBA,EAAK,QAAQmB,EAAGb,CAAY,EACrBL,EAAoBD,CAAI,GAC/BS,EAAWK,CAAE,EAErB,EACA,QAASd,EAAK,SAAW,UA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