@norbix.ai/react-redux 1.2.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
@@ -1496,6 +1496,24 @@ var hubNotifications = (b) => ({
1496
1496
  query: (args) => (norbix) => norbix.hub.notifications.getSmsCampaignMessages(args),
1497
1497
  providesTags: ["SmsCampaigns"]
1498
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
+ }),
1499
1517
  disablePush: b.mutation({
1500
1518
  query: (args) => (norbix) => norbix.hub.notifications.disablePush(args),
1501
1519
  invalidatesTags: ["Push"]