@byline/ui 2.4.0 → 2.4.1

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 (95) hide show
  1. package/dist/react.d.ts +10 -18
  2. package/dist/react.js +2 -15
  3. package/dist/{admin/components/collections → widgets/diff-viewer}/diff-modal.d.ts +8 -1
  4. package/dist/{admin/components/collections → widgets/diff-viewer}/diff-modal.js +4 -6
  5. package/dist/widgets/diff-viewer/diff-modal.module.js +14 -0
  6. package/dist/{admin/components/collections → widgets/diff-viewer}/diff-modal_module.css +9 -9
  7. package/dist/{admin/components/collections → widgets/status-badge}/status-badge.js +1 -1
  8. package/dist/{admin/components/collections → widgets/status-badge}/status-badge.module.js +3 -3
  9. package/dist/{admin/components/collections → widgets/status-badge}/status-badge_module.css +3 -3
  10. package/package.json +2 -4
  11. package/src/react.ts +12 -34
  12. package/src/{admin/components/collections → widgets/diff-viewer}/diff-modal.tsx +16 -5
  13. package/src/{admin/components/collections → widgets/status-badge}/status-badge.tsx +1 -1
  14. package/dist/admin/components/admin-account/change-password.d.ts +0 -8
  15. package/dist/admin/components/admin-account/change-password.js +0 -192
  16. package/dist/admin/components/admin-account/change-password.module.js +0 -8
  17. package/dist/admin/components/admin-account/change-password_module.css +0 -27
  18. package/dist/admin/components/admin-account/container.d.ts +0 -29
  19. package/dist/admin/components/admin-account/container.js +0 -299
  20. package/dist/admin/components/admin-account/container.module.js +0 -28
  21. package/dist/admin/components/admin-account/container_module.css +0 -106
  22. package/dist/admin/components/admin-account/update.d.ts +0 -8
  23. package/dist/admin/components/admin-account/update.js +0 -207
  24. package/dist/admin/components/admin-account/update.module.js +0 -8
  25. package/dist/admin/components/admin-account/update_module.css +0 -27
  26. package/dist/admin/components/admin-permissions/inspector.d.ts +0 -4
  27. package/dist/admin/components/admin-permissions/inspector.js +0 -284
  28. package/dist/admin/components/admin-permissions/inspector.module.js +0 -56
  29. package/dist/admin/components/admin-permissions/inspector_module.css +0 -238
  30. package/dist/admin/components/admin-roles/create.d.ts +0 -7
  31. package/dist/admin/components/admin-roles/create.js +0 -177
  32. package/dist/admin/components/admin-roles/create.module.js +0 -8
  33. package/dist/admin/components/admin-roles/create_module.css +0 -27
  34. package/dist/admin/components/admin-roles/permissions.d.ts +0 -10
  35. package/dist/admin/components/admin-roles/permissions.js +0 -303
  36. package/dist/admin/components/admin-roles/permissions.module.js +0 -44
  37. package/dist/admin/components/admin-roles/permissions_module.css +0 -192
  38. package/dist/admin/components/admin-roles/update.d.ts +0 -8
  39. package/dist/admin/components/admin-roles/update.js +0 -166
  40. package/dist/admin/components/admin-roles/update.module.js +0 -8
  41. package/dist/admin/components/admin-roles/update_module.css +0 -27
  42. package/dist/admin/components/admin-users/create.d.ts +0 -8
  43. package/dist/admin/components/admin-users/create.js +0 -268
  44. package/dist/admin/components/admin-users/create.module.js +0 -10
  45. package/dist/admin/components/admin-users/create_module.css +0 -45
  46. package/dist/admin/components/admin-users/roles.d.ts +0 -11
  47. package/dist/admin/components/admin-users/roles.js +0 -148
  48. package/dist/admin/components/admin-users/roles.module.js +0 -18
  49. package/dist/admin/components/admin-users/roles_module.css +0 -75
  50. package/dist/admin/components/admin-users/set-password.d.ts +0 -8
  51. package/dist/admin/components/admin-users/set-password.js +0 -170
  52. package/dist/admin/components/admin-users/set-password.module.js +0 -9
  53. package/dist/admin/components/admin-users/set-password_module.css +0 -31
  54. package/dist/admin/components/admin-users/update.d.ts +0 -8
  55. package/dist/admin/components/admin-users/update.js +0 -254
  56. package/dist/admin/components/admin-users/update.module.js +0 -9
  57. package/dist/admin/components/admin-users/update_module.css +0 -34
  58. package/dist/admin/components/auth/sign-in-form.d.ts +0 -12
  59. package/dist/admin/components/auth/sign-in-form.js +0 -115
  60. package/dist/admin/components/auth/sign-in-form.module.js +0 -12
  61. package/dist/admin/components/auth/sign-in-form_module.css +0 -41
  62. package/dist/admin/components/collections/diff-modal.module.js +0 -14
  63. package/dist/services/admin-services-context.d.ts +0 -16
  64. package/dist/services/admin-services-context.js +0 -13
  65. package/dist/services/admin-services-types.d.ts +0 -129
  66. package/dist/services/admin-services-types.js +0 -1
  67. package/src/admin/components/admin-account/change-password.module.css +0 -40
  68. package/src/admin/components/admin-account/change-password.tsx +0 -232
  69. package/src/admin/components/admin-account/container.module.css +0 -158
  70. package/src/admin/components/admin-account/container.tsx +0 -230
  71. package/src/admin/components/admin-account/update.module.css +0 -40
  72. package/src/admin/components/admin-account/update.tsx +0 -263
  73. package/src/admin/components/admin-permissions/inspector.module.css +0 -326
  74. package/src/admin/components/admin-permissions/inspector.tsx +0 -298
  75. package/src/admin/components/admin-roles/create.module.css +0 -40
  76. package/src/admin/components/admin-roles/create.tsx +0 -218
  77. package/src/admin/components/admin-roles/permissions.module.css +0 -279
  78. package/src/admin/components/admin-roles/permissions.tsx +0 -396
  79. package/src/admin/components/admin-roles/update.module.css +0 -40
  80. package/src/admin/components/admin-roles/update.tsx +0 -218
  81. package/src/admin/components/admin-users/create.module.css +0 -63
  82. package/src/admin/components/admin-users/create.tsx +0 -323
  83. package/src/admin/components/admin-users/roles.module.css +0 -119
  84. package/src/admin/components/admin-users/roles.tsx +0 -172
  85. package/src/admin/components/admin-users/set-password.module.css +0 -46
  86. package/src/admin/components/admin-users/set-password.tsx +0 -199
  87. package/src/admin/components/admin-users/update.module.css +0 -49
  88. package/src/admin/components/admin-users/update.tsx +0 -328
  89. package/src/admin/components/auth/sign-in-form.module.css +0 -62
  90. package/src/admin/components/auth/sign-in-form.tsx +0 -132
  91. package/src/services/admin-services-context.tsx +0 -35
  92. package/src/services/admin-services-types.ts +0 -177
  93. /package/dist/{admin/components/collections → widgets/status-badge}/status-badge.d.ts +0 -0
  94. /package/src/{admin/components/collections → widgets/diff-viewer}/diff-modal.module.css +0 -0
  95. /package/src/{admin/components/collections → widgets/status-badge}/status-badge.module.css +0 -0
@@ -1,177 +0,0 @@
1
- /**
2
- * This Source Code is subject to the terms of the Mozilla Public
3
- * License, v. 2.0. If a copy of the MPL was not distributed with this
4
- * file, You can obtain one at http://mozilla.org/MPL/2.0/.
5
- *
6
- * Copyright (c) Infonomic Company Limited
7
- */
8
-
9
- /**
10
- * Framework-neutral function contracts that admin UI components in
11
- * `@byline/ui` need from the host application. The host wires concrete
12
- * implementations via `BylineAdminServicesProvider` — typically thin
13
- * adapters around TanStack Start server functions, Next.js server
14
- * actions, or any other RPC-style transport.
15
- *
16
- * The call shape `(args: { data: TInput }) => Promise<TOutput>` mirrors
17
- * TanStack Start's `createServerFn().handler()` calling convention so a
18
- * webapp host can pass its server fns through as-is. Other transports
19
- * just need a tiny adapter.
20
- *
21
- * Scope: Phase 2.1 covers the framework-neutral admin UI components
22
- * only — the 15 forms, modals, and inner widgets that don't touch
23
- * TanStack Router. Page containers (list/edit/delete pages) keep using
24
- * server fns directly today and move into `@byline/host-tanstack-start`
25
- * in Phase 3 along with the route factories.
26
- */
27
-
28
- import type {
29
- AccountResponse,
30
- ChangeAccountPasswordRequest,
31
- UpdateAccountRequest,
32
- } from '@byline/admin/admin-account'
33
- import type {
34
- SetRoleAbilitiesResponse,
35
- WhoHasAbilityResponse,
36
- } from '@byline/admin/admin-permissions'
37
- import type { AdminRoleResponse, UserRolesResponse } from '@byline/admin/admin-roles'
38
- import type { AdminUserResponse } from '@byline/admin/admin-users'
39
-
40
- /**
41
- * The TanStack Start `createServerFn(...).handler(...)` calling shape:
42
- * `fn({ data: input }) → Promise<output>`. Hosts using a different
43
- * transport supply small adapters that match this shape.
44
- */
45
- export type AdminServiceCall<TInput, TOutput> = (args: { data: TInput }) => Promise<TOutput>
46
-
47
- // --- Auth -----------------------------------------------------------------
48
-
49
- export interface SignInInput {
50
- email: string
51
- password: string
52
- }
53
-
54
- /**
55
- * The admin UI's sign-in form does not consume the `SignInResult`
56
- * payload directly — on success it navigates via `window.location`. The
57
- * shape is left as `unknown` here so each host's session provider can
58
- * supply whatever envelope it produces without forcing a public type.
59
- */
60
- export type SignInResult = unknown
61
-
62
- // --- Account self-service -------------------------------------------------
63
-
64
- /** Same shape as `UpdateAccountRequest` from `@byline/admin/admin-account`. */
65
- export type UpdateAccountInput = UpdateAccountRequest
66
-
67
- /** Same shape as `ChangeAccountPasswordRequest` from `@byline/admin/admin-account`. */
68
- export type ChangeAccountPasswordInput = ChangeAccountPasswordRequest
69
-
70
- // --- Admin users ----------------------------------------------------------
71
-
72
- export interface CreateAdminUserInput {
73
- email: string
74
- password: string
75
- given_name?: string | null
76
- family_name?: string | null
77
- username?: string | null
78
- is_super_admin: boolean
79
- is_enabled: boolean
80
- is_email_verified: boolean
81
- }
82
-
83
- export interface UpdateAdminUserInput {
84
- id: string
85
- vid: number
86
- patch: {
87
- email?: string
88
- given_name?: string | null
89
- family_name?: string | null
90
- username?: string | null
91
- is_super_admin?: boolean
92
- is_enabled?: boolean
93
- is_email_verified?: boolean
94
- }
95
- }
96
-
97
- export interface SetAdminUserPasswordInput {
98
- id: string
99
- vid: number
100
- password: string
101
- }
102
-
103
- export interface SetUserRolesInput {
104
- userId: string
105
- roleIds: string[]
106
- }
107
-
108
- // --- Admin roles ----------------------------------------------------------
109
-
110
- export interface CreateAdminRoleInput {
111
- name: string
112
- machine_name: string
113
- description: string | null
114
- }
115
-
116
- export interface UpdateAdminRoleInput {
117
- id: string
118
- vid: number
119
- patch: {
120
- name?: string
121
- description?: string | null
122
- }
123
- }
124
-
125
- // --- Permissions ----------------------------------------------------------
126
-
127
- export interface SetRoleAbilitiesInput {
128
- id: string
129
- abilities: string[]
130
- }
131
-
132
- export interface WhoHasAbilityInput {
133
- ability: string
134
- }
135
-
136
- // --- Service contract -----------------------------------------------------
137
-
138
- export interface BylineAdminServices {
139
- // Auth
140
- adminSignIn: AdminServiceCall<SignInInput, SignInResult>
141
-
142
- // Account self-service
143
- updateAccount: AdminServiceCall<UpdateAccountInput, AccountResponse>
144
- changeAccountPassword: AdminServiceCall<ChangeAccountPasswordInput, AccountResponse>
145
-
146
- // Admin user writes (page-container reads stay in the host for now)
147
- createAdminUser: AdminServiceCall<CreateAdminUserInput, AdminUserResponse>
148
- updateAdminUser: AdminServiceCall<UpdateAdminUserInput, AdminUserResponse>
149
- setAdminUserPassword: AdminServiceCall<SetAdminUserPasswordInput, AdminUserResponse>
150
- setUserRoles: AdminServiceCall<SetUserRolesInput, UserRolesResponse>
151
-
152
- // Admin role writes
153
- createAdminRole: AdminServiceCall<CreateAdminRoleInput, AdminRoleResponse>
154
- updateAdminRole: AdminServiceCall<UpdateAdminRoleInput, AdminRoleResponse>
155
-
156
- // Permissions
157
- setRoleAbilities: AdminServiceCall<SetRoleAbilitiesInput, SetRoleAbilitiesResponse>
158
- whoHasAbility: AdminServiceCall<WhoHasAbilityInput, WhoHasAbilityResponse>
159
-
160
- /**
161
- * Diff helper. Loads a specific historical version of a document so
162
- * the diff modal can compare it against the current version. Returns
163
- * the same shape as the regular document loader — the diff modal
164
- * consumes only `doc.fields` (or strips known meta keys when an
165
- * older flat-shape doc is encountered).
166
- *
167
- * Positional-args shape rather than `{ data }` because this helper
168
- * predates the contract and is consumed only by `DiffModal`. Hosts
169
- * adapt their server fn into this call signature.
170
- */
171
- getCollectionDocumentVersion: (
172
- collection: string,
173
- documentId: string,
174
- versionId: string,
175
- locale: string | undefined
176
- ) => Promise<Record<string, unknown>>
177
- }