@vicacha-devs/strapi-plugin-broadcasts 0.0.0-stage → 0.1.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.
Files changed (87) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +15 -2
  3. package/dist/admin/BroadcastsHomePage-CM_N_spo.mjs +1210 -0
  4. package/dist/admin/BroadcastsHomePage-DQueM7nj.js +1228 -0
  5. package/dist/admin/SettingsPage-TawvAAiv.js +1187 -0
  6. package/dist/admin/SettingsPage-ikcb0cfh.mjs +1169 -0
  7. package/dist/admin/ar-vwekVqfp.js +232 -0
  8. package/dist/admin/ar-wZTCd3Za.mjs +232 -0
  9. package/dist/admin/de-IZicxuvv.mjs +232 -0
  10. package/dist/admin/de-Qa2SQQfY.js +232 -0
  11. package/dist/admin/en-B-HnZo8U.mjs +232 -0
  12. package/dist/admin/en-D1byrK0s.js +232 -0
  13. package/dist/admin/es-Co7PmAj8.mjs +232 -0
  14. package/dist/admin/es-Dgylqagv.js +232 -0
  15. package/dist/admin/fr-B9zZn3z1.mjs +232 -0
  16. package/dist/admin/fr-C7-MIWnw.js +232 -0
  17. package/dist/admin/index-CApLw9Uu.mjs +1036 -0
  18. package/dist/admin/index-Dw6J7U1v.js +1053 -0
  19. package/dist/admin/index.js +6 -0
  20. package/dist/admin/index.mjs +6 -0
  21. package/dist/admin/it-DJU9iBqT.mjs +232 -0
  22. package/dist/admin/it-D_mulZtx.js +232 -0
  23. package/dist/admin/pt-B9swwjPu.js +232 -0
  24. package/dist/admin/pt-Dr8u5we0.mjs +232 -0
  25. package/dist/admin/ru-B0NNiMNA.js +232 -0
  26. package/dist/admin/ru-Bd4cEKDV.mjs +232 -0
  27. package/dist/admin/selectOptions-BlvNrhvc.mjs +150 -0
  28. package/dist/admin/selectOptions-DuHQ0KK3.js +149 -0
  29. package/dist/admin/src/components/AutomationAndLogsTabs.d.ts +16 -0
  30. package/dist/admin/src/components/BridgesSandboxTab.d.ts +8 -0
  31. package/dist/admin/src/components/CampaignComposerForm.d.ts +26 -0
  32. package/dist/admin/src/components/CampaignsTableSection.d.ts +27 -0
  33. package/dist/admin/src/components/DeliveryLedgerSection.d.ts +17 -0
  34. package/dist/admin/src/components/Initializer.d.ts +6 -0
  35. package/dist/admin/src/components/OrganizationEmailTab.d.ts +10 -0
  36. package/dist/admin/src/components/PluginIcon.d.ts +3 -0
  37. package/dist/admin/src/components/WhatsAppTransportTab.d.ts +11 -0
  38. package/dist/admin/src/index.d.ts +24 -0
  39. package/dist/admin/src/pages/BroadcastsHomePage.d.ts +2 -0
  40. package/dist/admin/src/pages/SettingsPage.d.ts +3 -0
  41. package/dist/admin/src/permissions.d.ts +30 -0
  42. package/dist/admin/src/pluginId.d.ts +2 -0
  43. package/dist/admin/src/translations/cmLabels.d.ts +1 -0
  44. package/dist/admin/src/translations/cmLabelsExtra.d.ts +1 -0
  45. package/dist/admin/src/translations/cmPlaceholders.d.ts +1 -0
  46. package/dist/admin/src/translations/cmPlaceholdersExtra.d.ts +1 -0
  47. package/dist/admin/src/utils/extractApiError.d.ts +1 -0
  48. package/dist/admin/src/utils/selectOptions.d.ts +21 -0
  49. package/dist/admin/tr-Cc-ItZUP.js +232 -0
  50. package/dist/admin/tr-DlyHa2Vk.mjs +232 -0
  51. package/dist/admin/zh-CLzJ7x3y.mjs +232 -0
  52. package/dist/admin/zh-CaqwZk-p.js +232 -0
  53. package/dist/server/index.js +3399 -0
  54. package/dist/server/index.mjs +3399 -0
  55. package/dist/server/src/bootstrap.d.ts +5 -0
  56. package/dist/server/src/config/index.d.ts +5 -0
  57. package/dist/server/src/content-types/automation-rule/index.d.ts +90 -0
  58. package/dist/server/src/content-types/automation-rule/schema.json.d.ts +90 -0
  59. package/dist/server/src/content-types/campaign/index.d.ts +118 -0
  60. package/dist/server/src/content-types/campaign/schema.json.d.ts +118 -0
  61. package/dist/server/src/content-types/delivery-log/index.d.ts +71 -0
  62. package/dist/server/src/content-types/delivery-log/schema.json.d.ts +71 -0
  63. package/dist/server/src/content-types/index.d.ts +279 -0
  64. package/dist/server/src/controllers/broadcastController.d.ts +32 -0
  65. package/dist/server/src/controllers/index.d.ts +22 -0
  66. package/dist/server/src/destroy.d.ts +5 -0
  67. package/dist/server/src/eventHubRegistry.d.ts +5 -0
  68. package/dist/server/src/index.d.ts +463 -0
  69. package/dist/server/src/register.d.ts +5 -0
  70. package/dist/server/src/routes/admin.d.ts +17 -0
  71. package/dist/server/src/routes/content-api.d.ts +13 -0
  72. package/dist/server/src/routes/index.d.ts +31 -0
  73. package/dist/server/src/services/automationService.d.ts +33 -0
  74. package/dist/server/src/services/campaignChannelDispatch.d.ts +20 -0
  75. package/dist/server/src/services/campaignHelpers.d.ts +20 -0
  76. package/dist/server/src/services/campaignLifecycle.d.ts +23 -0
  77. package/dist/server/src/services/campaignService.d.ts +54 -0
  78. package/dist/server/src/services/deliveryLedger.d.ts +18 -0
  79. package/dist/server/src/services/emailDesignerBridge.d.ts +30 -0
  80. package/dist/server/src/services/idempotency.d.ts +5 -0
  81. package/dist/server/src/services/index.d.ts +119 -0
  82. package/dist/server/src/services/settings.d.ts +12 -0
  83. package/dist/server/src/services/transportService.d.ts +70 -0
  84. package/dist/shared/index.d.ts +1 -0
  85. package/dist/shared/index.js +825 -0
  86. package/dist/shared/index.mjs +823 -0
  87. package/package.json +109 -3
@@ -0,0 +1,1187 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const designSystem = require("@strapi/design-system");
5
+ const admin = require("@strapi/strapi/admin");
6
+ const React = require("react");
7
+ const reactIntl = require("react-intl");
8
+ const index = require("./index-Dw6J7U1v.js");
9
+ const selectOptions = require("./selectOptions-DuHQ0KK3.js");
10
+ function _interopNamespace(e) {
11
+ if (e && e.__esModule) return e;
12
+ const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
13
+ if (e) {
14
+ for (const k in e) {
15
+ if (k !== "default") {
16
+ const d = Object.getOwnPropertyDescriptor(e, k);
17
+ Object.defineProperty(n, k, d.get ? d : {
18
+ enumerable: true,
19
+ get: () => e[k]
20
+ });
21
+ }
22
+ }
23
+ }
24
+ n.default = e;
25
+ return Object.freeze(n);
26
+ }
27
+ const React__namespace = /* @__PURE__ */ _interopNamespace(React);
28
+ const orgEmailCardBorderStyle = {
29
+ border: "1px solid rgba(128, 128, 128, 0.22)",
30
+ borderTopLeftRadius: 0,
31
+ borderTopRightRadius: 0
32
+ };
33
+ const OrganizationEmailTab = ({
34
+ settings,
35
+ setSettings,
36
+ t
37
+ }) => {
38
+ const localeOpts = index.mergeSelectOptions(
39
+ index.LOCALE_OPTIONS,
40
+ settings.supportedLocales
41
+ );
42
+ const topicOpts = index.mergeSelectOptions(
43
+ selectOptions.getBroadcastTopicOptions(t),
44
+ settings.availableTopics
45
+ );
46
+ return /* @__PURE__ */ jsxRuntime.jsxs(
47
+ designSystem.Box,
48
+ {
49
+ padding: 6,
50
+ background: "neutral0",
51
+ hasRadius: true,
52
+ shadow: "filterShadow",
53
+ style: orgEmailCardBorderStyle,
54
+ children: [
55
+ /* @__PURE__ */ jsxRuntime.jsxs(
56
+ designSystem.Flex,
57
+ {
58
+ justifyContent: "space-between",
59
+ alignItems: "center",
60
+ paddingBottom: 2,
61
+ wrap: "wrap",
62
+ gap: 2,
63
+ children: [
64
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
65
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", children: t(
66
+ "settings.ui.1_organization_multi_language_email_hijri_calend",
67
+ "Organization, Multi-Language & Email"
68
+ ) }),
69
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
70
+ "settings.ui.configure_organization_identity_sender_reply_to_",
71
+ "Configure organization identity, sender/reply-to email addresses, supported locales, and broadcast topic segments."
72
+ ) })
73
+ ] }),
74
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { children: [
75
+ (settings.supportedLocales || []).length,
76
+ " ",
77
+ t("settings.ui.active_locales_label", "Active Locales")
78
+ ] })
79
+ ]
80
+ }
81
+ ),
82
+ /* @__PURE__ */ jsxRuntime.jsxs(
83
+ designSystem.Box,
84
+ {
85
+ paddingTop: 4,
86
+ style: {
87
+ display: "grid",
88
+ gridTemplateColumns: "repeat(3, minmax(0, 1fr))",
89
+ gap: 20
90
+ },
91
+ children: [
92
+ /* @__PURE__ */ jsxRuntime.jsxs(
93
+ designSystem.Field.Root,
94
+ {
95
+ name: "organizationName",
96
+ hint: t(
97
+ "settings.ui.organization_name_hint",
98
+ "Injected into broadcast templates via the '{{organizationName}}' variable."
99
+ ),
100
+ children: [
101
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("field.organization_name", "Organization Name") }),
102
+ /* @__PURE__ */ jsxRuntime.jsx(
103
+ designSystem.TextInput,
104
+ {
105
+ name: "organizationName",
106
+ placeholder: t(
107
+ "placeholder.e_g_mezquita_central_abu_bakr_as_siddiq_bogot",
108
+ "e.g., Abu Bakr As-Siddiq Central Mosque — Bogotá"
109
+ ),
110
+ value: settings.organizationName || "",
111
+ onChange: (e) => setSettings({ ...settings, organizationName: e.target.value })
112
+ }
113
+ ),
114
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
115
+ ]
116
+ }
117
+ ),
118
+ /* @__PURE__ */ jsxRuntime.jsxs(
119
+ designSystem.Field.Root,
120
+ {
121
+ name: "siteBaseUrl",
122
+ hint: t(
123
+ "settings.ui.site_base_url_hint",
124
+ "Base URL used for CTA links, 1-click unsubscribe links, and '{{siteBaseUrl}}' placeholders."
125
+ ),
126
+ children: [
127
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("field.public_site_base_url", "Public Site Base URL") }),
128
+ /* @__PURE__ */ jsxRuntime.jsx(
129
+ designSystem.TextInput,
130
+ {
131
+ name: "siteBaseUrl",
132
+ placeholder: t(
133
+ "placeholder.e_g_https_mezquitabogota_org",
134
+ "e.g., https://mezquitabogota.org"
135
+ ),
136
+ value: settings.siteBaseUrl || "",
137
+ onChange: (e) => setSettings({ ...settings, siteBaseUrl: e.target.value })
138
+ }
139
+ ),
140
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
141
+ ]
142
+ }
143
+ ),
144
+ /* @__PURE__ */ jsxRuntime.jsxs(
145
+ designSystem.Field.Root,
146
+ {
147
+ name: "emailFromAddress",
148
+ hint: t(
149
+ "settings.ui.verified_sender_address_used_when_dispatching_em",
150
+ "Verified sender address used when dispatching email newsletters and bulletins."
151
+ ),
152
+ children: [
153
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t(
154
+ "field.email_sender_from_address",
155
+ "Email Sender (From Address)"
156
+ ) }),
157
+ /* @__PURE__ */ jsxRuntime.jsx(
158
+ designSystem.TextInput,
159
+ {
160
+ name: "emailFromAddress",
161
+ placeholder: t(
162
+ "placeholder.e_g_no_reply_mezquitabogota_org",
163
+ "e.g., no-reply@mezquitabogota.org"
164
+ ),
165
+ value: settings.emailFromAddress || "",
166
+ onChange: (e) => setSettings({ ...settings, emailFromAddress: e.target.value })
167
+ }
168
+ ),
169
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
170
+ ]
171
+ }
172
+ ),
173
+ /* @__PURE__ */ jsxRuntime.jsxs(
174
+ designSystem.Field.Root,
175
+ {
176
+ name: "emailReplyToAddress",
177
+ hint: t(
178
+ "settings.ui.reply_to_inbox_where_community_members_can_respo",
179
+ "Reply-to inbox where community members can respond to email broadcasts."
180
+ ),
181
+ children: [
182
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("field.email_reply_to_address", "Email Reply-To Address") }),
183
+ /* @__PURE__ */ jsxRuntime.jsx(
184
+ designSystem.TextInput,
185
+ {
186
+ name: "emailReplyToAddress",
187
+ placeholder: t(
188
+ "placeholder.e_g_info_mezquitabogota_org",
189
+ "e.g., info@mezquitabogota.org"
190
+ ),
191
+ value: settings.emailReplyToAddress || "",
192
+ onChange: (e) => setSettings({ ...settings, emailReplyToAddress: e.target.value })
193
+ }
194
+ ),
195
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
196
+ ]
197
+ }
198
+ ),
199
+ /* @__PURE__ */ jsxRuntime.jsxs(
200
+ designSystem.Field.Root,
201
+ {
202
+ name: "defaultLocale",
203
+ hint: t(
204
+ "settings.ui.fallback_language_when_a_recipient_does_not_have",
205
+ "Fallback language when a recipient does not have a preferred locale on file."
206
+ ),
207
+ children: [
208
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("field.default_broadcast_locale", "Default Broadcast Locale") }),
209
+ /* @__PURE__ */ jsxRuntime.jsx(
210
+ designSystem.SingleSelect,
211
+ {
212
+ placeholder: t(
213
+ "placeholder.select_default_locale",
214
+ "Select default locale"
215
+ ),
216
+ value: settings.defaultLocale || "es",
217
+ onChange: (val) => setSettings({ ...settings, defaultLocale: String(val) }),
218
+ children: localeOpts.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: opt.value, children: opt.label }, opt.value))
219
+ }
220
+ ),
221
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
222
+ ]
223
+ }
224
+ ),
225
+ /* @__PURE__ */ jsxRuntime.jsxs(
226
+ designSystem.Field.Root,
227
+ {
228
+ name: "supportedLocales",
229
+ hint: t(
230
+ "settings.ui.languages_enabled_for_localized_campaign_subject",
231
+ "Languages enabled for localized campaign subject/body templates."
232
+ ),
233
+ children: [
234
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("field.supported_locales", "Supported Locales") }),
235
+ /* @__PURE__ */ jsxRuntime.jsx(
236
+ designSystem.MultiSelect,
237
+ {
238
+ name: "supportedLocales",
239
+ withTags: true,
240
+ placeholder: t(
241
+ "placeholder.select_supported_locales",
242
+ "Select supported locales..."
243
+ ),
244
+ value: settings.supportedLocales || ["es", "en", "ar", "tr"],
245
+ onChange: (nextValues) => setSettings({
246
+ ...settings,
247
+ supportedLocales: nextValues.length > 0 ? nextValues : ["es"]
248
+ }),
249
+ onClear: () => setSettings({
250
+ ...settings,
251
+ supportedLocales: ["es"]
252
+ }),
253
+ children: localeOpts.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.MultiSelectOption, { value: opt.value, children: opt.label }, opt.value))
254
+ }
255
+ ),
256
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
257
+ ]
258
+ }
259
+ ),
260
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { gridColumn: "span 2" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
261
+ designSystem.Field.Root,
262
+ {
263
+ name: "availableTopics",
264
+ hint: t(
265
+ "settings.ui.topic_segments_used_to_target_confirmed_subscrib",
266
+ "Topic segments used to target confirmed subscribers and Telegram forum threads."
267
+ ),
268
+ children: [
269
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("field.broadcast_topic_segments", "Broadcast Topic Segments") }),
270
+ /* @__PURE__ */ jsxRuntime.jsx(
271
+ designSystem.MultiSelect,
272
+ {
273
+ name: "availableTopics",
274
+ withTags: true,
275
+ placeholder: t(
276
+ "placeholder.select_broadcast_topic_segments",
277
+ "Select broadcast topic segments..."
278
+ ),
279
+ value: settings.availableTopics || ["announcements"],
280
+ onChange: (nextValues) => setSettings({
281
+ ...settings,
282
+ availableTopics: nextValues.length > 0 ? nextValues : ["announcements"]
283
+ }),
284
+ onClear: () => setSettings({
285
+ ...settings,
286
+ availableTopics: ["announcements"]
287
+ }),
288
+ children: topicOpts.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.MultiSelectOption, { value: opt.value, children: opt.label }, opt.value))
289
+ }
290
+ ),
291
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
292
+ ]
293
+ }
294
+ ) }),
295
+ /* @__PURE__ */ jsxRuntime.jsxs(
296
+ designSystem.Field.Root,
297
+ {
298
+ name: "defaultEmailTemplateRef",
299
+ hint: t(
300
+ "settings.ui.default_email_template_ref_hint",
301
+ "Optional default Email Designer 5 template ID or base name used when a campaign does not specify its own template."
302
+ ),
303
+ children: [
304
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t(
305
+ "field.default_email_template_ref",
306
+ "Default Email Designer Template Ref (optional)"
307
+ ) }),
308
+ /* @__PURE__ */ jsxRuntime.jsx(
309
+ designSystem.TextInput,
310
+ {
311
+ name: "defaultEmailTemplateRef",
312
+ placeholder: t(
313
+ "placeholder.e_g_401_or_broadcastnewsletter",
314
+ "e.g., 401 or broadcastNewsletter"
315
+ ),
316
+ value: settings.defaultEmailTemplateRef || "",
317
+ onChange: (e) => setSettings({
318
+ ...settings,
319
+ defaultEmailTemplateRef: e.target.value
320
+ })
321
+ }
322
+ ),
323
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
324
+ ]
325
+ }
326
+ )
327
+ ]
328
+ }
329
+ )
330
+ ]
331
+ }
332
+ );
333
+ };
334
+ const cardBorderStyle$2 = {
335
+ border: "1px solid rgba(128, 128, 128, 0.22)",
336
+ borderTopLeftRadius: 0,
337
+ borderTopRightRadius: 0
338
+ };
339
+ const subCardStyle = {
340
+ border: "1px solid rgba(128, 128, 128, 0.22)",
341
+ display: "flex",
342
+ flexDirection: "column",
343
+ justifyContent: "space-between"
344
+ };
345
+ const BridgesSandboxTab = ({
346
+ settings,
347
+ setSettings,
348
+ t
349
+ }) => {
350
+ const enabledText = t("common.enabled", "Enabled");
351
+ const disabledText = t("common.disabled", "Disabled");
352
+ return /* @__PURE__ */ jsxRuntime.jsxs(
353
+ designSystem.Box,
354
+ {
355
+ padding: 6,
356
+ background: "neutral0",
357
+ hasRadius: true,
358
+ shadow: "filterShadow",
359
+ style: cardBorderStyle$2,
360
+ children: [
361
+ /* @__PURE__ */ jsxRuntime.jsxs(
362
+ designSystem.Flex,
363
+ {
364
+ justifyContent: "space-between",
365
+ alignItems: "center",
366
+ paddingBottom: 2,
367
+ wrap: "wrap",
368
+ gap: 2,
369
+ children: [
370
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
371
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", children: t(
372
+ "settings.ui.4_ecosystem_bridges_sandbox_mode",
373
+ "Ecosystem Bridges & Sandbox Mode"
374
+ ) }),
375
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
376
+ "settings.ui.bridges_sandbox_subtitle",
377
+ "Control dry-run simulation mode, subscriber segmentation from @vicacha-devs/strapi-plugin-inbox, Email Designer 5 HTML templates, and automatic EventHub triggers."
378
+ ) })
379
+ ] }),
380
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: settings.dryRun ? t("settings.ui.sandbox_mode_active", "Sandbox Mode Active") : t("settings.ui.live_production_mode", "Live Production Mode") })
381
+ ]
382
+ }
383
+ ),
384
+ /* @__PURE__ */ jsxRuntime.jsxs(
385
+ designSystem.Box,
386
+ {
387
+ paddingTop: 4,
388
+ style: {
389
+ display: "grid",
390
+ gridTemplateColumns: "repeat(auto-fit, minmax(260px, 1fr))",
391
+ gap: 16
392
+ },
393
+ children: [
394
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, background: "neutral100", hasRadius: true, style: subCardStyle, children: [
395
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
396
+ /* @__PURE__ */ jsxRuntime.jsxs(
397
+ designSystem.Flex,
398
+ {
399
+ justifyContent: "space-between",
400
+ alignItems: "center",
401
+ paddingBottom: 2,
402
+ children: [
403
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: t("settings.ui.dry_run_sandbox_mode", "Dry-Run Sandbox Mode") }),
404
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: settings.dryRun ? t("settings.ui.simulated", "Simulated") : t("settings.ui.live", "Live") })
405
+ ]
406
+ }
407
+ ),
408
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
409
+ "settings.ui.dry_run_description",
410
+ "Records full delivery logs and idempotency keys with status simulated without calling external Email, Telegram, or WhatsApp APIs."
411
+ ) })
412
+ ] }),
413
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 3, children: /* @__PURE__ */ jsxRuntime.jsx(
414
+ designSystem.Checkbox,
415
+ {
416
+ checked: Boolean(settings.dryRun),
417
+ onCheckedChange: (checked) => setSettings({ ...settings, dryRun: Boolean(checked) }),
418
+ children: t(
419
+ "checkbox.enable_dry_run_sandbox_mode",
420
+ "Enable Dry-Run Sandbox Mode"
421
+ )
422
+ }
423
+ ) })
424
+ ] }),
425
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, background: "neutral100", hasRadius: true, style: subCardStyle, children: [
426
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
427
+ /* @__PURE__ */ jsxRuntime.jsxs(
428
+ designSystem.Flex,
429
+ {
430
+ justifyContent: "space-between",
431
+ alignItems: "center",
432
+ paddingBottom: 2,
433
+ children: [
434
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: t(
435
+ "settings.ui.inbox_subscriber_bridge",
436
+ "Inbox Subscriber Bridge"
437
+ ) }),
438
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: settings.enableInboxSubscriberBridge ? enabledText : disabledText })
439
+ ]
440
+ }
441
+ ),
442
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
443
+ "settings.ui.inbox_bridge_description",
444
+ "Automatically queries confirmed double opt-in subscribers from @vicacha-devs/strapi-plugin-inbox segmented by topic and locale."
445
+ ) })
446
+ ] }),
447
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 3, children: /* @__PURE__ */ jsxRuntime.jsx(
448
+ designSystem.Checkbox,
449
+ {
450
+ checked: Boolean(settings.enableInboxSubscriberBridge),
451
+ onCheckedChange: (checked) => setSettings({
452
+ ...settings,
453
+ enableInboxSubscriberBridge: Boolean(checked)
454
+ }),
455
+ children: t(
456
+ "checkbox.segment_confirmed_subscribers_via_inbox_bridge",
457
+ "Segment confirmed subscribers via Inbox Bridge"
458
+ )
459
+ }
460
+ ) })
461
+ ] }),
462
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, background: "neutral100", hasRadius: true, style: subCardStyle, children: [
463
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
464
+ /* @__PURE__ */ jsxRuntime.jsxs(
465
+ designSystem.Flex,
466
+ {
467
+ justifyContent: "space-between",
468
+ alignItems: "center",
469
+ paddingBottom: 2,
470
+ children: [
471
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: t(
472
+ "settings.ui.eventhub_auto_broadcasts",
473
+ "EventHub Auto-Broadcasts"
474
+ ) }),
475
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: settings.enableEventHubAutomations ? enabledText : disabledText })
476
+ ]
477
+ }
478
+ ),
479
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
480
+ "settings.ui.eventhub_bridge_description",
481
+ "Listens for Strapi EventHub events (e.g., inbox.alert.published, event.published) and triggers matching automation rules automatically."
482
+ ) })
483
+ ] }),
484
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 3, children: /* @__PURE__ */ jsxRuntime.jsx(
485
+ designSystem.Checkbox,
486
+ {
487
+ checked: Boolean(settings.enableEventHubAutomations),
488
+ onCheckedChange: (checked) => setSettings({
489
+ ...settings,
490
+ enableEventHubAutomations: Boolean(checked)
491
+ }),
492
+ children: t(
493
+ "checkbox.enable_eventhub_auto_broadcast_triggers",
494
+ "Enable EventHub Auto-Broadcast Triggers"
495
+ )
496
+ }
497
+ ) })
498
+ ] }),
499
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 4, background: "neutral100", hasRadius: true, style: subCardStyle, children: [
500
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
501
+ /* @__PURE__ */ jsxRuntime.jsxs(
502
+ designSystem.Flex,
503
+ {
504
+ justifyContent: "space-between",
505
+ alignItems: "center",
506
+ paddingBottom: 2,
507
+ children: [
508
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "bold", children: t(
509
+ "settings.ui.email_designer_html_templates",
510
+ "Email Designer 5 HTML Templates"
511
+ ) }),
512
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: settings.enableEmailDesignerBridge !== false ? enabledText : disabledText })
513
+ ]
514
+ }
515
+ ),
516
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
517
+ "settings.ui.email_designer_bridge_description",
518
+ "Optionally renders email broadcasts through strapi-plugin-email-designer-5 with automatic locale matching (es/en/ar/tr) and fallback to inline HTML."
519
+ ) })
520
+ ] }),
521
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 3, children: /* @__PURE__ */ jsxRuntime.jsx(
522
+ designSystem.Checkbox,
523
+ {
524
+ checked: settings.enableEmailDesignerBridge !== false,
525
+ onCheckedChange: (checked) => setSettings({
526
+ ...settings,
527
+ enableEmailDesignerBridge: Boolean(checked)
528
+ }),
529
+ children: t(
530
+ "checkbox.enable_email_designer_5_html_template_bridge",
531
+ "Enable Email Designer 5 HTML Template Bridge"
532
+ )
533
+ }
534
+ ) })
535
+ ] })
536
+ ]
537
+ }
538
+ )
539
+ ]
540
+ }
541
+ );
542
+ };
543
+ const cardBorderStyle$1 = {
544
+ border: "1px solid rgba(128, 128, 128, 0.22)",
545
+ borderTopLeftRadius: 0,
546
+ borderTopRightRadius: 0
547
+ };
548
+ const WhatsAppDefaultRecipientsField = ({
549
+ settings,
550
+ setSettings,
551
+ t
552
+ }) => {
553
+ const canonicalRecipients = (settings.whatsappDefaultRecipients || []).join(
554
+ ", "
555
+ );
556
+ const [recipientsDraft, setRecipientsDraft] = React__namespace.useState(canonicalRecipients);
557
+ React__namespace.useEffect(() => {
558
+ setRecipientsDraft(
559
+ (prev) => index.parseCsvList(prev).join(", ") === canonicalRecipients ? prev : canonicalRecipients
560
+ );
561
+ }, [canonicalRecipients]);
562
+ return /* @__PURE__ */ jsxRuntime.jsxs(
563
+ designSystem.Field.Root,
564
+ {
565
+ name: "whatsappDefaultRecipients",
566
+ hint: t(
567
+ "settings.ui.whatsapp_default_recipients_hint",
568
+ "WhatsApp Group JIDs (@g.us), Channel JIDs (@newsletter), or E.164 phone numbers that receive WhatsApp broadcasts alongside topic subscribers."
569
+ ),
570
+ children: [
571
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t(
572
+ "field.whatsapp_default_recipients",
573
+ "Default WhatsApp Groups / Channels / Numbers (comma-separated)"
574
+ ) }),
575
+ /* @__PURE__ */ jsxRuntime.jsx(
576
+ designSystem.TextInput,
577
+ {
578
+ name: "whatsappDefaultRecipients",
579
+ placeholder: t(
580
+ "placeholder.whatsapp_default_recipients",
581
+ "e.g., 120363025891234567@g.us, 120363099999999999@newsletter, +573101234567"
582
+ ),
583
+ value: recipientsDraft,
584
+ onChange: (e) => {
585
+ const nextRaw = e.target.value;
586
+ setRecipientsDraft(nextRaw);
587
+ setSettings({
588
+ ...settings,
589
+ whatsappDefaultRecipients: index.parseCsvList(nextRaw)
590
+ });
591
+ },
592
+ onBlur: () => setRecipientsDraft(canonicalRecipients)
593
+ }
594
+ ),
595
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
596
+ ]
597
+ }
598
+ );
599
+ };
600
+ const WhatsAppTransportTab = ({
601
+ settings,
602
+ setSettings,
603
+ t
604
+ }) => {
605
+ const driverOptions = selectOptions.getWhatsAppDriverOptions(t);
606
+ return /* @__PURE__ */ jsxRuntime.jsxs(
607
+ designSystem.Box,
608
+ {
609
+ padding: 6,
610
+ background: "neutral0",
611
+ hasRadius: true,
612
+ shadow: "filterShadow",
613
+ style: cardBorderStyle$1,
614
+ children: [
615
+ /* @__PURE__ */ jsxRuntime.jsxs(
616
+ designSystem.Flex,
617
+ {
618
+ justifyContent: "space-between",
619
+ alignItems: "center",
620
+ paddingBottom: 2,
621
+ wrap: "wrap",
622
+ gap: 2,
623
+ children: [
624
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
625
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", children: t(
626
+ "settings.ui.3_whatsapp_transport_meta_cloud_api_evolution_op",
627
+ "WhatsApp Transport (Meta Cloud API / Evolution / OpenWA)"
628
+ ) }),
629
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
630
+ "settings.ui.configure_official_meta_whatsapp_business_cloud_",
631
+ "Configure official Meta WhatsApp Business Cloud API (WABA) or self-hosted Evolution / OpenWA gateways with SSRF protection."
632
+ ) })
633
+ ] }),
634
+ /* @__PURE__ */ jsxRuntime.jsx(
635
+ designSystem.Checkbox,
636
+ {
637
+ checked: Boolean(settings.whatsappEnabled),
638
+ onCheckedChange: (checked) => setSettings({ ...settings, whatsappEnabled: Boolean(checked) }),
639
+ children: t("checkbox.enable_whatsapp_transport", "Enable WhatsApp Transport")
640
+ }
641
+ )
642
+ ]
643
+ }
644
+ ),
645
+ /* @__PURE__ */ jsxRuntime.jsxs(
646
+ designSystem.Box,
647
+ {
648
+ paddingTop: 4,
649
+ style: {
650
+ display: "grid",
651
+ gridTemplateColumns: "repeat(3, minmax(0, 1fr))",
652
+ gap: 20
653
+ },
654
+ children: [
655
+ /* @__PURE__ */ jsxRuntime.jsxs(
656
+ designSystem.Field.Root,
657
+ {
658
+ name: "whatsappDriver",
659
+ hint: t(
660
+ "settings.ui.choose_meta_cloud_api_for_official_templates_or_",
661
+ "Choose Meta Cloud API for official templates or Evolution/OpenWA for self-hosted gateways."
662
+ ),
663
+ children: [
664
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("field.whatsapp_transport_driver", "WhatsApp Transport Driver") }),
665
+ /* @__PURE__ */ jsxRuntime.jsx(
666
+ designSystem.SingleSelect,
667
+ {
668
+ placeholder: t(
669
+ "placeholder.select_whatsapp_driver",
670
+ "Select WhatsApp driver"
671
+ ),
672
+ value: settings.whatsappDriver || "meta-cloud",
673
+ onChange: (val) => setSettings({
674
+ ...settings,
675
+ whatsappDriver: String(val)
676
+ }),
677
+ children: driverOptions.map((opt) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: opt.value, children: opt.label }, opt.value))
678
+ }
679
+ ),
680
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
681
+ ]
682
+ }
683
+ ),
684
+ /* @__PURE__ */ jsxRuntime.jsxs(
685
+ designSystem.Field.Root,
686
+ {
687
+ name: "whatsappPhoneNumberId",
688
+ hint: t(
689
+ "settings.ui.meta_phone_number_id_hint",
690
+ "Numeric Phone Number ID from Meta Developer Console (used when driver is meta-cloud)."
691
+ ),
692
+ children: [
693
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("field.meta_waba_phone_number_id", "Meta WABA Phone Number ID") }),
694
+ /* @__PURE__ */ jsxRuntime.jsx(
695
+ designSystem.TextInput,
696
+ {
697
+ name: "whatsappPhoneNumberId",
698
+ placeholder: t(
699
+ "placeholder.e_g_109876543210123",
700
+ "e.g., 109876543210123"
701
+ ),
702
+ value: settings.whatsappPhoneNumberId || "",
703
+ onChange: (e) => setSettings({
704
+ ...settings,
705
+ whatsappPhoneNumberId: e.target.value
706
+ })
707
+ }
708
+ ),
709
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
710
+ ]
711
+ }
712
+ ),
713
+ /* @__PURE__ */ jsxRuntime.jsxs(
714
+ designSystem.Field.Root,
715
+ {
716
+ name: "whatsappAccessToken",
717
+ hint: t(
718
+ "settings.ui.system_user_bearer_token_for_graph_facebook_com_",
719
+ "System user bearer token for graph.facebook.com WABA message dispatch."
720
+ ),
721
+ children: [
722
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t(
723
+ "field.meta_cloud_api_permanent_access_token",
724
+ "Meta Cloud API Permanent Access Token"
725
+ ) }),
726
+ /* @__PURE__ */ jsxRuntime.jsx(
727
+ designSystem.TextInput,
728
+ {
729
+ name: "whatsappAccessToken",
730
+ type: "password",
731
+ placeholder: t(
732
+ "placeholder.e_g_eaagm0px4zcpsba",
733
+ "e.g., EAAGm0PX4ZCpsBA..."
734
+ ),
735
+ value: settings.whatsappAccessToken || "",
736
+ onChange: (e) => setSettings({
737
+ ...settings,
738
+ whatsappAccessToken: e.target.value
739
+ })
740
+ }
741
+ ),
742
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
743
+ ]
744
+ }
745
+ ),
746
+ /* @__PURE__ */ jsxRuntime.jsxs(
747
+ designSystem.Field.Root,
748
+ {
749
+ name: "whatsappGatewayUrl",
750
+ hint: t(
751
+ "settings.ui.https_base_url_of_your_evolution_api_or_openwa_i",
752
+ "HTTPS base URL of your Evolution API or OpenWA instance (validated against SSRF rules)."
753
+ ),
754
+ children: [
755
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t(
756
+ "field.self_hosted_gateway_url_evolution_openwa",
757
+ "Self-Hosted Gateway URL (Evolution / OpenWA)"
758
+ ) }),
759
+ /* @__PURE__ */ jsxRuntime.jsx(
760
+ designSystem.TextInput,
761
+ {
762
+ name: "whatsappGatewayUrl",
763
+ placeholder: t(
764
+ "placeholder.e_g_https_wa_gateway_mezquitabogota_org",
765
+ "e.g., https://wa-gateway.mezquitabogota.org"
766
+ ),
767
+ value: settings.whatsappGatewayUrl || "",
768
+ onChange: (e) => setSettings({ ...settings, whatsappGatewayUrl: e.target.value })
769
+ }
770
+ ),
771
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
772
+ ]
773
+ }
774
+ ),
775
+ /* @__PURE__ */ jsxRuntime.jsxs(
776
+ designSystem.Field.Root,
777
+ {
778
+ name: "whatsappGatewaySession",
779
+ hint: t(
780
+ "settings.ui.session_or_instance_identifier_on_the_self_hoste",
781
+ "Session or instance identifier on the self-hosted WhatsApp gateway."
782
+ ),
783
+ children: [
784
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t(
785
+ "field.gateway_instance_session_name",
786
+ "Gateway Instance / Session Name"
787
+ ) }),
788
+ /* @__PURE__ */ jsxRuntime.jsx(
789
+ designSystem.TextInput,
790
+ {
791
+ name: "whatsappGatewaySession",
792
+ placeholder: t(
793
+ "placeholder.e_g_default_or_mezquita_bogota",
794
+ "e.g., default or mezquita-bogota"
795
+ ),
796
+ value: settings.whatsappGatewaySession || "",
797
+ onChange: (e) => setSettings({
798
+ ...settings,
799
+ whatsappGatewaySession: e.target.value
800
+ })
801
+ }
802
+ ),
803
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
804
+ ]
805
+ }
806
+ ),
807
+ /* @__PURE__ */ jsxRuntime.jsxs(
808
+ designSystem.Field.Root,
809
+ {
810
+ name: "whatsappGatewayApiKey",
811
+ hint: t(
812
+ "settings.ui.api_key_sent_via_apikey_authorization_header_to_",
813
+ "API key sent via apikey / Authorization header to the self-hosted gateway."
814
+ ),
815
+ children: [
816
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t(
817
+ "field.gateway_api_key_evolution_openwa",
818
+ "Gateway API Key (Evolution / OpenWA)"
819
+ ) }),
820
+ /* @__PURE__ */ jsxRuntime.jsx(
821
+ designSystem.TextInput,
822
+ {
823
+ name: "whatsappGatewayApiKey",
824
+ type: "password",
825
+ placeholder: t(
826
+ "placeholder.e_g_evo_live_key",
827
+ "e.g., evo_live_key_..."
828
+ ),
829
+ value: settings.whatsappGatewayApiKey || "",
830
+ onChange: (e) => setSettings({
831
+ ...settings,
832
+ whatsappGatewayApiKey: e.target.value
833
+ })
834
+ }
835
+ ),
836
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
837
+ ]
838
+ }
839
+ ),
840
+ /* @__PURE__ */ jsxRuntime.jsx(
841
+ WhatsAppDefaultRecipientsField,
842
+ {
843
+ settings,
844
+ setSettings,
845
+ t
846
+ }
847
+ )
848
+ ]
849
+ }
850
+ )
851
+ ]
852
+ }
853
+ );
854
+ };
855
+ const cardBorderStyle = {
856
+ border: "1px solid rgba(128, 128, 128, 0.22)",
857
+ borderTopLeftRadius: 0,
858
+ borderTopRightRadius: 0
859
+ };
860
+ const TelegramTransportTab = ({
861
+ settings,
862
+ setSettings,
863
+ t
864
+ }) => /* @__PURE__ */ jsxRuntime.jsxs(
865
+ designSystem.Box,
866
+ {
867
+ padding: 6,
868
+ background: "neutral0",
869
+ hasRadius: true,
870
+ shadow: "filterShadow",
871
+ style: cardBorderStyle,
872
+ children: [
873
+ /* @__PURE__ */ jsxRuntime.jsxs(
874
+ designSystem.Flex,
875
+ {
876
+ justifyContent: "space-between",
877
+ alignItems: "center",
878
+ paddingBottom: 2,
879
+ wrap: "wrap",
880
+ gap: 2,
881
+ children: [
882
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
883
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", children: t(
884
+ "settings.ui.2_telegram_bot_channel_forum_topic_configuration",
885
+ "Telegram Bot & Channel / Forum Topic Configuration"
886
+ ) }),
887
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
888
+ "settings.ui.dispatch_announcements_to_your_official_telegram",
889
+ "Dispatch announcements to your official Telegram channel or supergroup forum topics via the Telegram Bot API."
890
+ ) })
891
+ ] }),
892
+ /* @__PURE__ */ jsxRuntime.jsx(
893
+ designSystem.Checkbox,
894
+ {
895
+ checked: Boolean(settings.telegramEnabled),
896
+ onCheckedChange: (checked) => setSettings({ ...settings, telegramEnabled: Boolean(checked) }),
897
+ children: t("checkbox.enable_telegram_transport", "Enable Telegram Transport")
898
+ }
899
+ )
900
+ ]
901
+ }
902
+ ),
903
+ /* @__PURE__ */ jsxRuntime.jsxs(
904
+ designSystem.Box,
905
+ {
906
+ paddingTop: 4,
907
+ style: {
908
+ display: "grid",
909
+ gridTemplateColumns: "repeat(2, minmax(0, 1fr))",
910
+ gap: 20
911
+ },
912
+ children: [
913
+ /* @__PURE__ */ jsxRuntime.jsxs(
914
+ designSystem.Field.Root,
915
+ {
916
+ name: "telegramDefaultChatId",
917
+ hint: t(
918
+ "settings.ui.public_channel_handle_mezquitacentralbogota_or_n",
919
+ "Public channel handle (@MezquitaCentralBogota) or numeric supergroup ID (-100...)."
920
+ ),
921
+ children: [
922
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t(
923
+ "field.default_channel_handle_or_supergroup_chat_id",
924
+ "Default Channel Handle or Supergroup Chat ID"
925
+ ) }),
926
+ /* @__PURE__ */ jsxRuntime.jsx(
927
+ designSystem.TextInput,
928
+ {
929
+ name: "telegramDefaultChatId",
930
+ placeholder: t(
931
+ "placeholder.e_g_mezquitacentralbogota_or_1001234567890",
932
+ "e.g., @MezquitaCentralBogota or -1001234567890"
933
+ ),
934
+ value: settings.telegramDefaultChatId || "",
935
+ onChange: (e) => setSettings({
936
+ ...settings,
937
+ telegramDefaultChatId: e.target.value
938
+ })
939
+ }
940
+ ),
941
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
942
+ ]
943
+ }
944
+ ),
945
+ /* @__PURE__ */ jsxRuntime.jsxs(
946
+ designSystem.Field.Root,
947
+ {
948
+ name: "telegramBotToken",
949
+ hint: t(
950
+ "settings.ui.bot_token_with_administrator_permission_to_post_",
951
+ "Bot token with administrator permission to post messages in the target channel/supergroup."
952
+ ),
953
+ children: [
954
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t(
955
+ "field.telegram_bot_api_token_from_botfather",
956
+ "Telegram Bot API Token (from @BotFather)"
957
+ ) }),
958
+ /* @__PURE__ */ jsxRuntime.jsx(
959
+ designSystem.TextInput,
960
+ {
961
+ name: "telegramBotToken",
962
+ type: "password",
963
+ placeholder: t(
964
+ "placeholder.e_g_123456789_abcdefghijklmnopqrstuvwxyz",
965
+ "e.g., 123456789:ABCdefGhIJKlmNoPQRsTUVwxyZ"
966
+ ),
967
+ value: settings.telegramBotToken || "",
968
+ onChange: (e) => setSettings({ ...settings, telegramBotToken: e.target.value })
969
+ }
970
+ ),
971
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
972
+ ]
973
+ }
974
+ )
975
+ ]
976
+ }
977
+ )
978
+ ]
979
+ }
980
+ );
981
+ const SettingsPage = () => {
982
+ const { formatMessage } = reactIntl.useIntl();
983
+ const t = (id, defaultMessage) => formatMessage({ id: `${index.PLUGIN_ID}.${id}`, defaultMessage });
984
+ const { get, put } = admin.useFetchClient();
985
+ const [settings, setSettings] = React__namespace.useState(
986
+ index.DEFAULT_BROADCAST_SETTINGS
987
+ );
988
+ const [savedNotice, setSavedNotice] = React__namespace.useState("");
989
+ const [noticeIsError, setNoticeIsError] = React__namespace.useState(false);
990
+ const [isSaving, setIsSaving] = React__namespace.useState(false);
991
+ React__namespace.useEffect(() => {
992
+ let isMounted = true;
993
+ const fetchSettings = async () => {
994
+ try {
995
+ const res = await get(
996
+ `/${index.PLUGIN_ID}/settings`
997
+ );
998
+ if (isMounted && res?.data?.data) {
999
+ setSettings({
1000
+ ...index.DEFAULT_BROADCAST_SETTINGS,
1001
+ ...res.data.data
1002
+ });
1003
+ }
1004
+ } catch {
1005
+ }
1006
+ };
1007
+ void fetchSettings();
1008
+ return () => {
1009
+ isMounted = false;
1010
+ };
1011
+ }, [get]);
1012
+ const handleSave = async () => {
1013
+ if (isSaving) return;
1014
+ setIsSaving(true);
1015
+ setNoticeIsError(false);
1016
+ try {
1017
+ const res = await put(
1018
+ `/${index.PLUGIN_ID}/settings`,
1019
+ settings
1020
+ );
1021
+ if (res?.data?.data) {
1022
+ setSettings({
1023
+ ...index.DEFAULT_BROADCAST_SETTINGS,
1024
+ ...res.data.data
1025
+ });
1026
+ }
1027
+ setSavedNotice(
1028
+ t(
1029
+ "settings.ui.settings_saved_notice",
1030
+ "Omnichannel Broadcast transport & channel settings saved successfully."
1031
+ )
1032
+ );
1033
+ } catch (err) {
1034
+ setNoticeIsError(true);
1035
+ setSavedNotice(
1036
+ selectOptions.extractApiErrorMessage(
1037
+ err,
1038
+ t("settings.ui.save_failed", "Failed to save broadcast settings.")
1039
+ )
1040
+ );
1041
+ } finally {
1042
+ setIsSaving(false);
1043
+ }
1044
+ };
1045
+ const handleResetDefaults = () => {
1046
+ if (isSaving) return;
1047
+ setSettings(index.DEFAULT_BROADCAST_SETTINGS);
1048
+ setNoticeIsError(false);
1049
+ setSavedNotice(
1050
+ t(
1051
+ "settings.ui.settings_reset_notice",
1052
+ 'Settings reset to defaults in editor. Click "Save Settings" to persist.'
1053
+ )
1054
+ );
1055
+ };
1056
+ const enabledText = t("common.enabled", "Enabled");
1057
+ const disabledText = t("common.disabled", "Disabled");
1058
+ const tgStatus = settings.telegramEnabled ? enabledText : disabledText;
1059
+ const waStatus = settings.whatsappEnabled ? settings.whatsappDriver : disabledText;
1060
+ const modeStatus = settings.dryRun ? t("settings.ui.dry_run_sandbox", "Dry-Run Sandbox") : t("settings.ui.live_dispatch", "Live Dispatch");
1061
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Main, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 8, children: [
1062
+ /* @__PURE__ */ jsxRuntime.jsxs(
1063
+ designSystem.Flex,
1064
+ {
1065
+ justifyContent: "space-between",
1066
+ alignItems: "flex-start",
1067
+ paddingBottom: 6,
1068
+ wrap: "wrap",
1069
+ gap: 4,
1070
+ children: [
1071
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
1072
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "alpha", tag: "h1", children: t(
1073
+ "settings.ui.broadcast_transport_channel_settings",
1074
+ "Broadcast Transport & Channel Settings"
1075
+ ) }),
1076
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", textColor: "neutral600", children: t(
1077
+ "settings.ui.configure_email_newsletters_telegram_bot_forum_t",
1078
+ "Configure Email newsletters, Telegram Bot & Forum Topics, WhatsApp Cloud API / Gateways, and EventHub auto-triggers"
1079
+ ) }) }),
1080
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, paddingTop: 3, wrap: "wrap", children: [
1081
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { children: [
1082
+ (settings.supportedLocales || []).length,
1083
+ " ",
1084
+ t("settings.ui.active_locales_label", "Active Locales")
1085
+ ] }),
1086
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { children: [
1087
+ t("settings.ui.telegram_badge_prefix", "Telegram:"),
1088
+ " ",
1089
+ tgStatus
1090
+ ] }),
1091
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { children: [
1092
+ t("settings.ui.whatsapp_badge_prefix", "WhatsApp:"),
1093
+ " ",
1094
+ waStatus
1095
+ ] }),
1096
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Badge, { children: [
1097
+ t("settings.ui.mode_badge_prefix", "Mode:"),
1098
+ " ",
1099
+ modeStatus
1100
+ ] })
1101
+ ] })
1102
+ ] }),
1103
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
1104
+ /* @__PURE__ */ jsxRuntime.jsx(
1105
+ designSystem.Button,
1106
+ {
1107
+ variant: "tertiary",
1108
+ disabled: isSaving,
1109
+ onClick: handleResetDefaults,
1110
+ children: t("settings.ui.reset_to_defaults", "Reset to Defaults")
1111
+ }
1112
+ ),
1113
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { loading: isSaving, disabled: isSaving, onClick: handleSave, children: t("settings.ui.save_settings", "Save Settings") })
1114
+ ] })
1115
+ ]
1116
+ }
1117
+ ),
1118
+ savedNotice && /* @__PURE__ */ jsxRuntime.jsx(
1119
+ designSystem.Box,
1120
+ {
1121
+ padding: 3,
1122
+ marginBottom: 4,
1123
+ background: noticeIsError ? "danger100" : "success100",
1124
+ hasRadius: true,
1125
+ role: noticeIsError ? "alert" : "status",
1126
+ children: /* @__PURE__ */ jsxRuntime.jsx(
1127
+ designSystem.Typography,
1128
+ {
1129
+ textColor: noticeIsError ? "danger700" : "success700",
1130
+ fontWeight: "semiBold",
1131
+ children: savedNotice
1132
+ }
1133
+ )
1134
+ }
1135
+ ),
1136
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tabs.Root, { defaultValue: "organization", children: [
1137
+ /* @__PURE__ */ jsxRuntime.jsxs(
1138
+ designSystem.Tabs.List,
1139
+ {
1140
+ "aria-label": t(
1141
+ "settings.ui.broadcast_transport_channel_settings",
1142
+ "Broadcast Transport & Channel Settings"
1143
+ ),
1144
+ children: [
1145
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "organization", children: t("settings.tab.organization", "Organization, Locales & Email") }),
1146
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "telegram", children: t("settings.tab.telegram", "Telegram Bot & Channel") }),
1147
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "whatsapp", children: t("settings.tab.whatsapp", "WhatsApp Transport") }),
1148
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Trigger, { value: "bridges", children: t("settings.tab.bridges", "Ecosystem Bridges & Sandbox") })
1149
+ ]
1150
+ }
1151
+ ),
1152
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "organization", children: /* @__PURE__ */ jsxRuntime.jsx(
1153
+ OrganizationEmailTab,
1154
+ {
1155
+ settings,
1156
+ setSettings,
1157
+ t
1158
+ }
1159
+ ) }),
1160
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "telegram", children: /* @__PURE__ */ jsxRuntime.jsx(
1161
+ TelegramTransportTab,
1162
+ {
1163
+ settings,
1164
+ setSettings,
1165
+ t
1166
+ }
1167
+ ) }),
1168
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "whatsapp", children: /* @__PURE__ */ jsxRuntime.jsx(
1169
+ WhatsAppTransportTab,
1170
+ {
1171
+ settings,
1172
+ setSettings,
1173
+ t
1174
+ }
1175
+ ) }),
1176
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tabs.Content, { value: "bridges", children: /* @__PURE__ */ jsxRuntime.jsx(
1177
+ BridgesSandboxTab,
1178
+ {
1179
+ settings,
1180
+ setSettings,
1181
+ t
1182
+ }
1183
+ ) })
1184
+ ] })
1185
+ ] }) });
1186
+ };
1187
+ exports.SettingsPage = SettingsPage;