@norbix.ai/react-redux 1.5.0 → 1.7.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 +64 -8
- package/dist/index.cjs +14 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +14 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -332,17 +332,17 @@ integration.
|
|
|
332
332
|
|
|
333
333
|
## SMS
|
|
334
334
|
|
|
335
|
-
Every SMS Hub endpoint (
|
|
335
|
+
Every SMS Hub endpoint (34) has a hook, 1:1 with `norbix.hub.notifications`.
|
|
336
336
|
Queries provide a tag, mutations invalidate it, so a list re-reads after a
|
|
337
337
|
write without any manual refetch:
|
|
338
338
|
|
|
339
|
-
| Area | Hooks
|
|
340
|
-
| ------------------------ |
|
|
341
|
-
| Module switch | `useEnableSmsMutation`, `useDisableSmsMutation`, `useGetSmsDisableDependenciesQuery` (what a switch-off would affect — read it before disabling), `useGetSmsSettingsQuery`
|
|
342
|
-
| Integrations (providers) | `useGetSmsIntegrationsQuery`, `useGetSmsIntegrationQuery`, `useSaveSmsIntegrationMutation`, `useTestSmsIntegrationMutation`, `useConfirmSmsIntegrationHumanDeliveryMutation`, `useDeleteSmsIntegrationMutation`, `useSetSmsIntegrationAsDefaultMutation`, `useEnableSmsIntegrationMutation`, `useDisableSmsIntegrationMutation`
|
|
343
|
-
| Templates | `useGetSmsTemplatesQuery`, `useGetSmsTemplateQuery`, `useCreateSmsTemplateMutation`, `useUpdateSmsTemplateMutation`, `useDeleteSmsTemplateMutation`, `useArchiveSmsTemplateMutation`, `useUnArchiveSmsTemplateMutation`, `useCloneSmsTemplateMutation`, `useGetSmsMessageContentTokensQuery`, `useRenderSmsMutation`
|
|
344
|
-
| Campaigns | `useGetSmsCampaignsQuery`, `useCreateSmsCampaignMutation`, `useGetSmsCampaignQuery`, `useDeleteSmsCampaignMutation`, `useStopSmsCampaignMutation`, `useGetSmsCampaignStatisticsQuery`, `useGetSmsCampaignBatchesQuery`, `useGetSmsCampaignBatchNotificationsQuery`, `useGetSmsCampaignBatchNotificationQuery`, `useGetSmsCampaignMessagesQuery
|
|
345
|
-
| Preview | `usePreviewSmsNotificationQuery` (opens with the signed link `hash`, no sign-in — see above)
|
|
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` | `SmsCampaigns` |
|
|
345
|
+
| Preview | `usePreviewSmsNotificationQuery` (opens with the signed link `hash`, no sign-in — see above) | `Sms` |
|
|
346
346
|
|
|
347
347
|
```tsx
|
|
348
348
|
const [stop, { isLoading }] = useStopSmsCampaignMutation();
|
|
@@ -366,6 +366,62 @@ it is a mutation only so a render is never served from the cache. The
|
|
|
366
366
|
integration hooks can also be produced by `buildIntegrationsEndpoints` (next
|
|
367
367
|
section) — the shipped ones above are the typed variants.
|
|
368
368
|
|
|
369
|
+
### Your own profile and phone — `norbix.hub.account` (core SDK 4.8.0)
|
|
370
|
+
|
|
371
|
+
An "Account users" SMS campaign (`accountUsers` on `useCreateSmsCampaignMutation`,
|
|
372
|
+
the ids of the account owner / team members) sends to each member's own phone.
|
|
373
|
+
A member reads and sets it with two hooks; members without a phone are skipped.
|
|
374
|
+
|
|
375
|
+
| Hook | SDK method | Wire | Cache |
|
|
376
|
+
| ------------------------------------- | -------------------------------------- | ----------------------- | --------------------- |
|
|
377
|
+
| `useGetMyAccountUserProfileQuery` | `hub.account.getMyAccountUserProfile` | `GET /account/me` | provides `Account` |
|
|
378
|
+
| `useUpdateMyAccountUserPhoneMutation` | `hub.account.updateMyAccountUserPhone` | `PUT /account/me/phone` | invalidates `Account` |
|
|
379
|
+
|
|
380
|
+
```tsx
|
|
381
|
+
const { data } = useGetMyAccountUserProfileQuery();
|
|
382
|
+
const [setPhone] = useUpdateMyAccountUserPhoneMutation();
|
|
383
|
+
|
|
384
|
+
// E.164: + and the country code, then digits. An empty string clears it.
|
|
385
|
+
await setPhone({ phone: '+37060000000' }).unwrap();
|
|
386
|
+
```
|
|
387
|
+
|
|
388
|
+
The team list (`useGetAccountCollaboratorsQuery`) also provides `Account`, so it
|
|
389
|
+
re-reads after a phone change. It now pages with flat `startingAfter`,
|
|
390
|
+
`endingBefore` and `pageSize` (default 20), and `projectId` without
|
|
391
|
+
`includeAccountOwner` lists only that project's collaborators.
|
|
392
|
+
|
|
393
|
+
## Scheduler
|
|
394
|
+
|
|
395
|
+
Every scheduler Hub endpoint (8) has a hook, 1:1 with `norbix.hub.scheduler`.
|
|
396
|
+
A task runs on a 5-field cron in UTC; only `EmailCampaign` tasks exist today.
|
|
397
|
+
|
|
398
|
+
| Area | Hooks | Cache tag |
|
|
399
|
+
| ------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------ |
|
|
400
|
+
| Module switch | `useEnableSchedulerModuleMutation`, `useDisableSchedulerModuleMutation` (`PUT` on the wire from `@norbix.ai/ts` 4.6.0) | invalidates `Account`, `Projects`, `Scheduler` |
|
|
401
|
+
| Tasks | `useGetSchedulerTasksQuery`, `useGetSchedulerTaskQuery`, `useSaveSchedulerTaskMutation`, `useEnableSchedulerTaskMutation`, `useDisableSchedulerTaskMutation`, `useDeleteSchedulerTaskMutation` | provides / invalidates `Scheduler/LIST` and `Scheduler/<id>` |
|
|
402
|
+
|
|
403
|
+
```tsx
|
|
404
|
+
const [save, { isLoading }] = useSaveSchedulerTaskMutation();
|
|
405
|
+
|
|
406
|
+
// Every Monday 09:00 UTC, send template tpl_123 to all users.
|
|
407
|
+
// initiatorUserId is the user the task runs as: you, or a project service user.
|
|
408
|
+
await save({
|
|
409
|
+
name: 'Weekly digest',
|
|
410
|
+
cron: '0 9 * * 1',
|
|
411
|
+
initiatorUserId: 'usr_123',
|
|
412
|
+
isEnabled: true,
|
|
413
|
+
stopOnError: false,
|
|
414
|
+
task: {
|
|
415
|
+
type: 'EmailCampaign',
|
|
416
|
+
campaign: { source: 'AllUsers', templateId: 'tpl_123' },
|
|
417
|
+
},
|
|
418
|
+
});
|
|
419
|
+
```
|
|
420
|
+
|
|
421
|
+
The typed `task` body (plain `'EmailCampaign'` / `'AllUsers'` strings, no
|
|
422
|
+
cast) comes from `@norbix.ai/ts` 4.6.0. Full method reference: the core SDK's
|
|
423
|
+
`docs/hub/scheduler.md`.
|
|
424
|
+
|
|
369
425
|
## Working with terms
|
|
370
426
|
|
|
371
427
|
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
|
@@ -684,6 +684,20 @@ var hubAccount = (b) => ({
|
|
|
684
684
|
query: (args) => (norbix) => norbix.hub.account.getAccountCollaborators(args),
|
|
685
685
|
providesTags: ["Account"]
|
|
686
686
|
}),
|
|
687
|
+
/** `GET /account/me` — the signed-in owner or team member's own profile, phone included. */
|
|
688
|
+
getMyAccountUserProfile: b.query({
|
|
689
|
+
query: (args) => (norbix) => norbix.hub.account.getMyAccountUserProfile(args),
|
|
690
|
+
providesTags: ["Account"]
|
|
691
|
+
}),
|
|
692
|
+
/**
|
|
693
|
+
* `PUT /account/me/phone` — set (E.164, e.g. `+37060000000`) or clear (empty)
|
|
694
|
+
* your own phone. "Account users" SMS campaigns send to it, so the team list
|
|
695
|
+
* (`getAccountCollaborators`, also tagged `Account`) re-reads after a change.
|
|
696
|
+
*/
|
|
697
|
+
updateMyAccountUserPhone: b.mutation({
|
|
698
|
+
query: (args) => (norbix) => norbix.hub.account.updateMyAccountUserPhone(args),
|
|
699
|
+
invalidatesTags: ["Account"]
|
|
700
|
+
}),
|
|
687
701
|
sendInviteToTeamMember: b.mutation({
|
|
688
702
|
query: (args) => (norbix) => norbix.hub.account.sendInviteToTeamMember(args),
|
|
689
703
|
invalidatesTags: ["Account"]
|