@norbix.ai/react-redux 1.1.0 → 1.3.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 CHANGED
@@ -239,6 +239,42 @@ the storage, and a failed delete step leaves its file behind — and
239
239
  `FilesIntegrations`, because the gateway records the last test result on the
240
240
  integration.
241
241
 
242
+ ## SMS
243
+
244
+ Every SMS Hub endpoint (35) has a hook, 1:1 with `norbix.hub.notifications`.
245
+ Queries provide a tag, mutations invalidate it, so a list re-reads after a
246
+ write without any manual refetch:
247
+
248
+ | Area | Hooks | Cache tag |
249
+ |---|---|---|
250
+ | Module switch | `useEnableSmsMutation`, `useDisableSmsMutation`, `useGetSmsDisableDependenciesQuery` (what a switch-off would affect — read it before disabling), `useGetSmsSettingsQuery` | `Sms`, `SmsSettings` |
251
+ | Integrations (providers) | `useGetSmsIntegrationsQuery`, `useGetSmsIntegrationQuery`, `useSaveSmsIntegrationMutation`, `useTestSmsIntegrationMutation`, `useConfirmSmsIntegrationHumanDeliveryMutation`, `useDeleteSmsIntegrationMutation`, `useSetSmsIntegrationAsDefaultMutation`, `useEnableSmsIntegrationMutation`, `useDisableSmsIntegrationMutation` | `SmsIntegrations` |
252
+ | Templates | `useGetSmsTemplatesQuery`, `useGetSmsTemplateQuery`, `useCreateSmsTemplateMutation`, `useUpdateSmsTemplateMutation`, `useDeleteSmsTemplateMutation`, `useArchiveSmsTemplateMutation`, `useUnArchiveSmsTemplateMutation`, `useCloneSmsTemplateMutation`, `useGetSmsMessageContentTokensQuery`, `useRenderSmsMutation` | `SmsTemplates`, `Sms` |
253
+ | Campaigns | `useGetSmsCampaignsQuery`, `useCreateSmsCampaignMutation`, `useGetSmsCampaignQuery`, `useDeleteSmsCampaignMutation`, `useStopSmsCampaignMutation`, `useGetSmsCampaignStatisticsQuery`, `useGetSmsCampaignBatchesQuery`, `useGetSmsCampaignBatchNotificationsQuery`, `useGetSmsCampaignBatchNotificationQuery`, `useGetSmsCampaignMessagesQuery`, `useGetSmsCampaignMessageQuery` | `SmsCampaigns` |
254
+ | Preview | `usePreviewSmsNotificationQuery` (opens with the signed link `hash`, no sign-in — see above) | `Sms` |
255
+
256
+ ```tsx
257
+ const [stop, { isLoading }] = useStopSmsCampaignMutation();
258
+ const [render] = useRenderSmsMutation();
259
+
260
+ // Stop a running campaign — no further messages go out; this cannot be undone.
261
+ await stop({ id: 'cmp_1' });
262
+
263
+ // Render a template's Razor code with token values before saving it.
264
+ const { data } = await render({
265
+ code: 'Hi @Model.FirstName, your code is @Model.Code',
266
+ tokens: [
267
+ { name: 'FirstName', value: 'Ada' },
268
+ { name: 'Code', value: '4242' },
269
+ ],
270
+ });
271
+ ```
272
+
273
+ `useRenderSmsMutation` saves nothing on the server, so it invalidates nothing;
274
+ it is a mutation only so a render is never served from the cache. The
275
+ integration hooks can also be produced by `buildIntegrationsEndpoints` (next
276
+ section) — the shipped ones above are the typed variants.
277
+
242
278
  ## Working with terms
243
279
 
244
280
  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
@@ -109,13 +109,6 @@ var apiAuth = (b) => ({
109
109
  })
110
110
  });
111
111
 
112
- // src/hooks/api/chat.ts
113
- var apiChat = (b) => ({
114
- askChat: b.mutation({
115
- query: (args) => (norbix) => norbix.api.chat.askChat(args)
116
- })
117
- });
118
-
119
112
  // src/hooks/api/database.ts
120
113
  var apiDatabase = (b) => ({
121
114
  // ---- Collections — Read ----
@@ -630,10 +623,6 @@ var hubAccount = (b) => ({
630
623
  getLicenses: b.query({
631
624
  query: (args) => (norbix) => norbix.hub.account.getLicenses(args),
632
625
  providesTags: ["Billing"]
633
- }),
634
- askAccountChat: b.mutation({
635
- query: (args) => (norbix) => norbix.hub.account.askChat(args),
636
- invalidatesTags: ["Account"]
637
626
  })
638
627
  });
639
628
 
@@ -1507,6 +1496,24 @@ var hubNotifications = (b) => ({
1507
1496
  query: (args) => (norbix) => norbix.hub.notifications.getSmsCampaignMessages(args),
1508
1497
  providesTags: ["SmsCampaigns"]
1509
1498
  }),
1499
+ // Stops a scheduled or running campaign (cannot be undone). The campaign
1500
+ // and its lists change status, so the SmsCampaigns reads re-fetch.
1501
+ stopSmsCampaign: b.mutation({
1502
+ query: (args) => (norbix) => norbix.hub.notifications.stopSmsCampaign(args),
1503
+ invalidatesTags: ["SmsCampaigns"]
1504
+ }),
1505
+ // What disabling the SMS module would affect (running campaigns,
1506
+ // integrations) — read it before disableSms to warn the user.
1507
+ getSmsDisableDependencies: b.query({
1508
+ query: (args) => (norbix) => norbix.hub.notifications.getSmsDisableDependencies(args),
1509
+ providesTags: ["Sms"]
1510
+ }),
1511
+ // Renders a Razor SMS template with token values. It saves nothing, so it
1512
+ // invalidates nothing; it is a mutation only so a render is never served
1513
+ // from the cache (the same template code with other tokens is a new answer).
1514
+ renderSms: b.mutation({
1515
+ query: (args) => (norbix) => norbix.hub.notifications.renderSms(args)
1516
+ }),
1510
1517
  disablePush: b.mutation({
1511
1518
  query: (args) => (norbix) => norbix.hub.notifications.disablePush(args),
1512
1519
  invalidatesTags: ["Push"]
@@ -1877,7 +1884,6 @@ function buildEndpoints(builder) {
1877
1884
  ...apiMembership(builder),
1878
1885
  ...apiDatabase(builder),
1879
1886
  ...apiApikeys(builder),
1880
- ...apiChat(builder),
1881
1887
  ...apiFiles(builder),
1882
1888
  ...apiPublic(builder),
1883
1889
  // Hub surface (control plane)