@norbix.ai/react-redux 1.4.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +97 -14
- package/dist/index.cjs +40 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -155,13 +155,13 @@ A _curated_ set of hooks for the most common endpoints. Every hook is end-to-end
|
|
|
155
155
|
|
|
156
156
|
| Hook | Wraps | Cache tags |
|
|
157
157
|
| ---------------------------------- | --------------------------------------- | ---------------------------------------------- |
|
|
158
|
-
| `useGetAccountProfileQuery` | `hub.account.getAccountProfile` | provides `
|
|
159
|
-
| `useGetAccountStatusQuery` | `hub.account.getAccountStatus` | provides `
|
|
160
|
-
| `useUpdateAccountProfileMutation` | `hub.account.updateAccountProfile` | invalidates `
|
|
161
|
-
| `useGetProjectsQuery` | `hub.account.getProjects` | provides `
|
|
162
|
-
| `useGetProjectQuery` | `hub.account.getProject` | provides `
|
|
163
|
-
| `useCreateProjectMutation` | `hub.account.createProject` | invalidates `
|
|
164
|
-
| `useDeleteProjectMutation` | `hub.account.deleteProject` | invalidates `
|
|
158
|
+
| `useGetAccountProfileQuery` | `hub.account.getAccountProfile` | provides `Account` |
|
|
159
|
+
| `useGetAccountStatusQuery` | `hub.account.getAccountStatus` | provides `Account` |
|
|
160
|
+
| `useUpdateAccountProfileMutation` | `hub.account.updateAccountProfile` | invalidates `Account` |
|
|
161
|
+
| `useGetProjectsQuery` | `hub.account.getProjects` | provides `Projects` |
|
|
162
|
+
| `useGetProjectQuery` | `hub.account.getProject` | provides `Projects` |
|
|
163
|
+
| `useCreateProjectMutation` | `hub.account.createProject` | invalidates `Projects` |
|
|
164
|
+
| `useDeleteProjectMutation` | `hub.account.deleteProject` | invalidates `Projects` |
|
|
165
165
|
| `useListRegionsQuery` | `hub.regions.list` | provides `Regions` |
|
|
166
166
|
| `useUpdateProjectRegionsMutation` | `hub.regions.updateProjectRegions` | invalidates `Regions` + `Projects` |
|
|
167
167
|
| `useGetDatabaseSchemasQuery` | `hub.database.getDatabaseSchemas` | provides `Schema/LIST` |
|
|
@@ -224,6 +224,57 @@ For a signed-in project user. `useStartEndUserChatTurnMutation` answers at once
|
|
|
224
224
|
| `useTestEmbeddingIntegrationMutation` | `hub.ai.testEmbeddingIntegration` | invalidates `Ai` |
|
|
225
225
|
| `useSetLlmIntegrationAsDefaultMutation` | `hub.ai.setLlmIntegrationAsDefault` | invalidates `Ai` |
|
|
226
226
|
|
|
227
|
+
### Project settings, CORS, languages, admin portal, legal, AI service users — `norbix.hub.account`
|
|
228
|
+
|
|
229
|
+
Every call takes the `projectId` (or the `norbix-project-id` header your client sets) plus the field it changes. Queries provide `Projects`; mutations invalidate `Projects`, so an open `useGetProjectQuery` refetches after a change. AI settings, assistants and usage are in the table above; LLM / MCP integrations are `hub.ai` (`useGetLlmIntegrationsQuery`, `useSaveLlmIntegrationMutation`, `useSetLlmIntegrationAsDefaultMutation`, …). Regions: `useUpdateProjectRegionsMutation` is served by `hub.regions` (it is spread after `hub.account`).
|
|
230
|
+
|
|
231
|
+
| Hook | SDK method | Cache |
|
|
232
|
+
| ----------------------------------------- | ------------------------------------------ | ---------------------- |
|
|
233
|
+
| `useGetProjectsQuery` | `hub.account.getProjects` | provides `Projects` |
|
|
234
|
+
| `useGetProjectQuery` | `hub.account.getProject` | provides `Projects` |
|
|
235
|
+
| `useGetProjectTokensQuery` | `hub.account.getProjectTokens` | provides `Projects` |
|
|
236
|
+
| `useCreateProjectMutation` | `hub.account.createProject` | invalidates `Projects` |
|
|
237
|
+
| `useEnableProjectMutation` | `hub.account.enableProject` | invalidates `Projects` |
|
|
238
|
+
| `useDisableProjectMutation` | `hub.account.disableProject` | invalidates `Projects` |
|
|
239
|
+
| `useDeleteProjectMutation` | `hub.account.deleteProject` | invalidates `Projects` |
|
|
240
|
+
| `useUpdateProjectNameMutation` | `hub.account.updateProjectName` | invalidates `Projects` |
|
|
241
|
+
| `useUpdateProjectDescriptionMutation` | `hub.account.updateProjectDescription` | invalidates `Projects` |
|
|
242
|
+
| `useUpdateProjectUrlMutation` | `hub.account.updateProjectUrl` | invalidates `Projects` |
|
|
243
|
+
| `useUpdateProjectLogoMutation` | `hub.account.updateProjectLogo` | invalidates `Projects` |
|
|
244
|
+
| `useUpdateProjectIconMutation` | `hub.account.updateProjectIcon` | invalidates `Projects` |
|
|
245
|
+
| `useUpdateProjectMainColorMutation` | `hub.account.updateProjectMainColor` | invalidates `Projects` |
|
|
246
|
+
| `useUpdateProjectAccentColorMutation` | `hub.account.updateProjectAccentColor` | invalidates `Projects` |
|
|
247
|
+
| `useUpdateProjectAllowedOriginsMutation` | `hub.account.updateProjectAllowedOrigins` | invalidates `Projects` |
|
|
248
|
+
| `useUpdateProjectLanguagesMutation` | `hub.account.updateProjectLanguages` | invalidates `Projects` |
|
|
249
|
+
| `useUpdateProjectDefaultLanguageMutation` | `hub.account.updateProjectDefaultLanguage` | invalidates `Projects` |
|
|
250
|
+
| `useUpdateProjectAdminUrlMutation` | `hub.account.updateProjectAdminUrl` | invalidates `Projects` |
|
|
251
|
+
| `useUpdateProjectLegalDocumentsMutation` | `hub.account.updateProjectLegalDocuments` | invalidates `Projects` |
|
|
252
|
+
| `useUpdateProjectExposeLegalMutation` | `hub.account.updateProjectExposeLegal` | invalidates `Projects` |
|
|
253
|
+
| `useGetAdminPortalStructureQuery` | `hub.account.getAdminPortalStructure` | provides `Projects` |
|
|
254
|
+
| `useAssignAdminPortalServiceUserMutation` | `hub.account.assignAdminPortalServiceUser` | invalidates `Projects` |
|
|
255
|
+
| `useCreateAiServiceUserMutation` | `hub.account.createAiServiceUser` | invalidates `Projects` |
|
|
256
|
+
| `useListAiServiceUsersQuery` | `hub.account.listAiServiceUsers` | provides `Projects` |
|
|
257
|
+
| `useDeleteAiServiceUserMutation` | `hub.account.deleteAiServiceUser` | invalidates `Projects` |
|
|
258
|
+
| `useRotateAiServiceUserKeyMutation` | `hub.account.rotateAiServiceUserKey` | invalidates `Projects` |
|
|
259
|
+
| `useRevokeAiServiceUserKeyMutation` | `hub.account.revokeAiServiceUserKey` | invalidates `Projects` |
|
|
260
|
+
|
|
261
|
+
`useCreateAiServiceUserMutation` and `useRotateAiServiceUserKeyMutation` return the new key **once** — show it, then drop it from state. The developer MCP endpoint (`hub.account.mcp`, `/account/mcp`) is a JSON-RPC stream for MCP clients and has no hook; call it with `useNorbix()` if you need it.
|
|
262
|
+
|
|
263
|
+
```tsx
|
|
264
|
+
const { data: project } = useGetProjectQuery({ projectId });
|
|
265
|
+
const [setOrigins] = useUpdateProjectAllowedOriginsMutation();
|
|
266
|
+
await setOrigins({ projectId, origins: ['https://app.example.com'] }).unwrap();
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
### Public project config and legal — `norbix.api.public` (no sign-in)
|
|
270
|
+
|
|
271
|
+
| Hook | SDK method | Cache |
|
|
272
|
+
| -------------------------------- | ----------------------------------- | ------------------------------ |
|
|
273
|
+
| `useGetPublicProjectConfigQuery` | `api.public.getPublicProjectConfig` | provides `Config/PUBLIC` |
|
|
274
|
+
| `useGetPublicProjectLegalQuery` | `api.public.getPublicProjectLegal` | provides `Config/LEGAL:<kind>` |
|
|
275
|
+
|
|
276
|
+
The legal document is served only when the project exposes it (`useUpdateProjectExposeLegalMutation`).
|
|
277
|
+
|
|
227
278
|
## Public file links
|
|
228
279
|
|
|
229
280
|
A file, or a whole folder prefix, can be made readable by anyone holding its
|
|
@@ -285,13 +336,13 @@ Every SMS Hub endpoint (35) has a hook, 1:1 with `norbix.hub.notifications`.
|
|
|
285
336
|
Queries provide a tag, mutations invalidate it, so a list re-reads after a
|
|
286
337
|
write without any manual refetch:
|
|
287
338
|
|
|
288
|
-
| Area
|
|
289
|
-
|
|
290
|
-
| Module switch
|
|
291
|
-
| Integrations (providers) | `useGetSmsIntegrationsQuery`, `useGetSmsIntegrationQuery`, `useSaveSmsIntegrationMutation`, `useTestSmsIntegrationMutation`, `useConfirmSmsIntegrationHumanDeliveryMutation`, `useDeleteSmsIntegrationMutation`, `useSetSmsIntegrationAsDefaultMutation`, `useEnableSmsIntegrationMutation`, `useDisableSmsIntegrationMutation`
|
|
292
|
-
| Templates
|
|
293
|
-
| Campaigns
|
|
294
|
-
| Preview
|
|
339
|
+
| Area | Hooks | Cache tag |
|
|
340
|
+
| ------------------------ | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------- |
|
|
341
|
+
| Module switch | `useEnableSmsMutation`, `useDisableSmsMutation`, `useGetSmsDisableDependenciesQuery` (what a switch-off would affect — read it before disabling), `useGetSmsSettingsQuery` | `Sms`, `SmsSettings` |
|
|
342
|
+
| Integrations (providers) | `useGetSmsIntegrationsQuery`, `useGetSmsIntegrationQuery`, `useSaveSmsIntegrationMutation`, `useTestSmsIntegrationMutation`, `useConfirmSmsIntegrationHumanDeliveryMutation`, `useDeleteSmsIntegrationMutation`, `useSetSmsIntegrationAsDefaultMutation`, `useEnableSmsIntegrationMutation`, `useDisableSmsIntegrationMutation` | `SmsIntegrations` |
|
|
343
|
+
| Templates | `useGetSmsTemplatesQuery`, `useGetSmsTemplateQuery`, `useCreateSmsTemplateMutation`, `useUpdateSmsTemplateMutation`, `useDeleteSmsTemplateMutation`, `useArchiveSmsTemplateMutation`, `useUnArchiveSmsTemplateMutation`, `useCloneSmsTemplateMutation`, `useGetSmsMessageContentTokensQuery`, `useRenderSmsMutation` | `SmsTemplates`, `Sms` |
|
|
344
|
+
| Campaigns | `useGetSmsCampaignsQuery`, `useCreateSmsCampaignMutation`, `useGetSmsCampaignQuery`, `useDeleteSmsCampaignMutation`, `useStopSmsCampaignMutation`, `useGetSmsCampaignStatisticsQuery`, `useGetSmsCampaignBatchesQuery`, `useGetSmsCampaignBatchNotificationsQuery`, `useGetSmsCampaignBatchNotificationQuery`, `useGetSmsCampaignMessagesQuery`, `useGetSmsCampaignMessageQuery` | `SmsCampaigns` |
|
|
345
|
+
| Preview | `usePreviewSmsNotificationQuery` (opens with the signed link `hash`, no sign-in — see above) | `Sms` |
|
|
295
346
|
|
|
296
347
|
```tsx
|
|
297
348
|
const [stop, { isLoading }] = useStopSmsCampaignMutation();
|
|
@@ -315,6 +366,38 @@ it is a mutation only so a render is never served from the cache. The
|
|
|
315
366
|
integration hooks can also be produced by `buildIntegrationsEndpoints` (next
|
|
316
367
|
section) — the shipped ones above are the typed variants.
|
|
317
368
|
|
|
369
|
+
## Scheduler
|
|
370
|
+
|
|
371
|
+
Every scheduler Hub endpoint (8) has a hook, 1:1 with `norbix.hub.scheduler`.
|
|
372
|
+
A task runs on a 5-field cron in UTC; only `EmailCampaign` tasks exist today.
|
|
373
|
+
|
|
374
|
+
| Area | Hooks | Cache tag |
|
|
375
|
+
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
376
|
+
| Module switch | `useEnableSchedulerModuleMutation`, `useDisableSchedulerModuleMutation` (`PUT` on the wire from `@norbix.ai/ts` 4.6.0) | invalidates `Account`, `Projects`, `Scheduler` |
|
|
377
|
+
| Tasks | `useGetSchedulerTasksQuery`, `useGetSchedulerTaskQuery`, `useSaveSchedulerTaskMutation`, `useEnableSchedulerTaskMutation`, `useDisableSchedulerTaskMutation`, `useDeleteSchedulerTaskMutation` | provides / invalidates `Scheduler/LIST` and `Scheduler/<id>` |
|
|
378
|
+
|
|
379
|
+
```tsx
|
|
380
|
+
const [save, { isLoading }] = useSaveSchedulerTaskMutation();
|
|
381
|
+
|
|
382
|
+
// Every Monday 09:00 UTC, send template tpl_123 to all users.
|
|
383
|
+
// initiatorUserId is the user the task runs as: you, or a project service user.
|
|
384
|
+
await save({
|
|
385
|
+
name: 'Weekly digest',
|
|
386
|
+
cron: '0 9 * * 1',
|
|
387
|
+
initiatorUserId: 'usr_123',
|
|
388
|
+
isEnabled: true,
|
|
389
|
+
stopOnError: false,
|
|
390
|
+
task: {
|
|
391
|
+
type: 'EmailCampaign',
|
|
392
|
+
campaign: { source: 'AllUsers', templateId: 'tpl_123' },
|
|
393
|
+
},
|
|
394
|
+
});
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
The typed `task` body (plain `'EmailCampaign'` / `'AllUsers'` strings, no
|
|
398
|
+
cast) comes from `@norbix.ai/ts` 4.6.0. Full method reference: the core SDK's
|
|
399
|
+
`docs/hub/scheduler.md`.
|
|
400
|
+
|
|
318
401
|
## Working with terms
|
|
319
402
|
|
|
320
403
|
A **taxonomy** is a named tree of **terms** (labels). A term can have one parent (a clean hierarchy) or several parents (the same item under many categories). There is one read hook per scenario — pick the one that matches what you want:
|
package/dist/index.cjs
CHANGED
|
@@ -719,6 +719,46 @@ var hubAccount = (b) => ({
|
|
|
719
719
|
setAdminPortalEnabled: b.mutation({
|
|
720
720
|
query: (args) => (norbix) => norbix.hub.account.setAdminPortalEnabled(args),
|
|
721
721
|
invalidatesTags: ["Projects"]
|
|
722
|
+
}),
|
|
723
|
+
updateProjectAdminUrl: b.mutation({
|
|
724
|
+
query: (args) => (norbix) => norbix.hub.account.updateProjectAdminUrl(args),
|
|
725
|
+
invalidatesTags: ["Projects"]
|
|
726
|
+
}),
|
|
727
|
+
updateProjectLegalDocuments: b.mutation({
|
|
728
|
+
query: (args) => (norbix) => norbix.hub.account.updateProjectLegalDocuments(args),
|
|
729
|
+
invalidatesTags: ["Projects"]
|
|
730
|
+
}),
|
|
731
|
+
updateProjectExposeLegal: b.mutation({
|
|
732
|
+
query: (args) => (norbix) => norbix.hub.account.updateProjectExposeLegal(args),
|
|
733
|
+
invalidatesTags: ["Projects"]
|
|
734
|
+
}),
|
|
735
|
+
getAdminPortalStructure: b.query({
|
|
736
|
+
query: (args) => (norbix) => norbix.hub.account.getAdminPortalStructure(args),
|
|
737
|
+
providesTags: ["Projects"]
|
|
738
|
+
}),
|
|
739
|
+
assignAdminPortalServiceUser: b.mutation({
|
|
740
|
+
query: (args) => (norbix) => norbix.hub.account.assignAdminPortalServiceUser(args),
|
|
741
|
+
invalidatesTags: ["Projects"]
|
|
742
|
+
}),
|
|
743
|
+
createAiServiceUser: b.mutation({
|
|
744
|
+
query: (args) => (norbix) => norbix.hub.account.createAiServiceUser(args),
|
|
745
|
+
invalidatesTags: ["Projects"]
|
|
746
|
+
}),
|
|
747
|
+
listAiServiceUsers: b.query({
|
|
748
|
+
query: (args) => (norbix) => norbix.hub.account.listAiServiceUsers(args),
|
|
749
|
+
providesTags: ["Projects"]
|
|
750
|
+
}),
|
|
751
|
+
deleteAiServiceUser: b.mutation({
|
|
752
|
+
query: (args) => (norbix) => norbix.hub.account.deleteAiServiceUser(args),
|
|
753
|
+
invalidatesTags: ["Projects"]
|
|
754
|
+
}),
|
|
755
|
+
rotateAiServiceUserKey: b.mutation({
|
|
756
|
+
query: (args) => (norbix) => norbix.hub.account.rotateAiServiceUserKey(args),
|
|
757
|
+
invalidatesTags: ["Projects"]
|
|
758
|
+
}),
|
|
759
|
+
revokeAiServiceUserKey: b.mutation({
|
|
760
|
+
query: (args) => (norbix) => norbix.hub.account.revokeAiServiceUserKey(args),
|
|
761
|
+
invalidatesTags: ["Projects"]
|
|
722
762
|
})
|
|
723
763
|
});
|
|
724
764
|
|