@vicacha-devs/medusa-plugin-notifications 0.0.0-stage → 0.0.1

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 (241) hide show
  1. package/.medusa/server/src/admin/index.cjs +4215 -0
  2. package/.medusa/server/src/admin/index.js +4193 -0
  3. package/.medusa/server/src/api/admin/mpn/broadcasts/route.js +99 -0
  4. package/.medusa/server/src/api/admin/mpn/channels/route.js +109 -0
  5. package/.medusa/server/src/api/admin/mpn/logs/route.js +33 -0
  6. package/.medusa/server/src/api/admin/mpn/mappings/[id]/route.js +33 -0
  7. package/.medusa/server/src/api/admin/mpn/mappings/route.js +51 -0
  8. package/.medusa/server/src/api/admin/mpn/render-template/route.js +37 -0
  9. package/.medusa/server/src/api/admin/mpn/sandbox/route.js +36 -0
  10. package/.medusa/server/src/api/admin/mpn/send/route.js +135 -0
  11. package/.medusa/server/src/api/admin/mpn/templates/[id]/route.js +77 -0
  12. package/.medusa/server/src/api/admin/mpn/templates/route.js +71 -0
  13. package/.medusa/server/src/api/admin/plugin/route.js +4 -0
  14. package/.medusa/server/src/api/middlewares.js +28 -0
  15. package/.medusa/server/src/api/store/mpn/consent/route.js +37 -0
  16. package/.medusa/server/src/api/store/mpn/webhooks/[provider]/route.js +97 -0
  17. package/.medusa/server/src/api/store/plugin/route.js +4 -0
  18. package/.medusa/server/src/api/validators.js +118 -0
  19. package/.medusa/server/src/hooks/index.js +7 -0
  20. package/.medusa/server/src/hooks/use-mpn-channels.js +13 -0
  21. package/.medusa/server/src/hooks/use-mpn-dispatch.js +45 -0
  22. package/.medusa/server/src/hooks/use-mpn-mappings.js +21 -0
  23. package/.medusa/server/src/hooks/use-mpn-templates.js +34 -0
  24. package/.medusa/server/src/hooks/use-order-notifications-widget-state.js +79 -0
  25. package/.medusa/server/src/hooks/use-sdk-primitives.js +113 -0
  26. package/.medusa/server/src/index.js +14 -0
  27. package/.medusa/server/src/integrations/automations-action-handler.js +112 -0
  28. package/.medusa/server/src/jobs/abandoned-cart-recovery.js +123 -0
  29. package/.medusa/server/src/jobs/log-retention-and-broadcasts.js +15 -0
  30. package/.medusa/server/src/modules/notifications/i18n/index.js +65 -0
  31. package/.medusa/server/src/modules/notifications/i18n/locales/ar.js +76 -0
  32. package/.medusa/server/src/modules/notifications/i18n/locales/de.js +76 -0
  33. package/.medusa/server/src/modules/notifications/i18n/locales/en.js +76 -0
  34. package/.medusa/server/src/modules/notifications/i18n/locales/es.js +76 -0
  35. package/.medusa/server/src/modules/notifications/i18n/locales/fr.js +76 -0
  36. package/.medusa/server/src/modules/notifications/i18n/locales/it.js +76 -0
  37. package/.medusa/server/src/modules/notifications/i18n/locales/nl.js +76 -0
  38. package/.medusa/server/src/modules/notifications/i18n/locales/pl.js +76 -0
  39. package/.medusa/server/src/modules/notifications/i18n/locales/pt.js +76 -0
  40. package/.medusa/server/src/modules/notifications/i18n/locales/tr.js +76 -0
  41. package/.medusa/server/src/modules/notifications/i18n/types.js +2 -0
  42. package/.medusa/server/src/modules/notifications/index.js +9 -0
  43. package/.medusa/server/src/modules/notifications/integrations/documents-and-b2b-resolver.js +129 -0
  44. package/.medusa/server/src/modules/notifications/migrations/Migration20261010000000.js +184 -0
  45. package/.medusa/server/src/modules/notifications/models/index.js +118 -0
  46. package/.medusa/server/src/modules/notifications/renderer/block-helpers.js +36 -0
  47. package/.medusa/server/src/modules/notifications/renderer/email.js +161 -0
  48. package/.medusa/server/src/modules/notifications/renderer/index.js +240 -0
  49. package/.medusa/server/src/modules/notifications/renderer/slack.js +114 -0
  50. package/.medusa/server/src/modules/notifications/renderer/telegram.js +99 -0
  51. package/.medusa/server/src/modules/notifications/renderer/whatsapp.js +91 -0
  52. package/.medusa/server/src/modules/notifications/service-helpers/channel-config.js +45 -0
  53. package/.medusa/server/src/modules/notifications/service-helpers/consent.js +65 -0
  54. package/.medusa/server/src/modules/notifications/service-helpers/delivery-log.js +29 -0
  55. package/.medusa/server/src/modules/notifications/service-helpers/event-conditions.js +46 -0
  56. package/.medusa/server/src/modules/notifications/service-helpers/external-templates.js +80 -0
  57. package/.medusa/server/src/modules/notifications/service-helpers/recipient-resolution.js +85 -0
  58. package/.medusa/server/src/modules/notifications/service-helpers/sender-profiles.js +29 -0
  59. package/.medusa/server/src/modules/notifications/service-helpers/template-blocks.js +81 -0
  60. package/.medusa/server/src/modules/notifications/service-helpers/template-catalog.js +129 -0
  61. package/.medusa/server/src/modules/notifications/service-helpers/template-render.js +65 -0
  62. package/.medusa/server/src/modules/notifications/service.js +340 -0
  63. package/.medusa/server/src/modules/notifications/types.js +2 -0
  64. package/.medusa/server/src/modules/notifications/utils/auth-presets.js +140 -0
  65. package/.medusa/server/src/modules/notifications/utils/interpolation.js +178 -0
  66. package/.medusa/server/src/modules/notifications/utils/security.js +312 -0
  67. package/.medusa/server/src/modules/notifications/utils/system-presets.js +651 -0
  68. package/.medusa/server/src/modules/notifications/utils/transformers.js +358 -0
  69. package/.medusa/server/src/providers/dummy-sandbox/index.js +96 -0
  70. package/.medusa/server/src/providers/email-smtp/index.js +187 -0
  71. package/.medusa/server/src/providers/index.js +7 -0
  72. package/.medusa/server/src/providers/slack/index.js +54 -0
  73. package/.medusa/server/src/providers/sms/index.js +254 -0
  74. package/.medusa/server/src/providers/telegram/index.js +119 -0
  75. package/.medusa/server/src/providers/whatsapp/index.js +371 -0
  76. package/.medusa/server/src/rbac.js +109 -0
  77. package/.medusa/server/src/sdk/client.js +186 -0
  78. package/.medusa/server/src/sdk/index.js +3 -0
  79. package/.medusa/server/src/sdk/query-keys.js +61 -0
  80. package/.medusa/server/src/subscribers/customer-and-document-events.js +33 -0
  81. package/.medusa/server/src/subscribers/fulfillment-and-inventory-events.js +30 -0
  82. package/.medusa/server/src/subscribers/order-events.js +28 -0
  83. package/.medusa/server/src/types/constants.js +129 -0
  84. package/.medusa/server/src/types/core.js +2 -0
  85. package/.medusa/server/src/types/domain.js +2 -0
  86. package/.medusa/server/src/types/enums.js +53 -0
  87. package/.medusa/server/src/types/errors.js +28 -0
  88. package/.medusa/server/src/types/hooks.js +2 -0
  89. package/.medusa/server/src/types/index.js +12 -0
  90. package/.medusa/server/src/types/providers.js +2 -0
  91. package/.medusa/server/src/types/records.js +2 -0
  92. package/.medusa/server/src/types/render.js +2 -0
  93. package/.medusa/server/src/types/sdk-api.js +2 -0
  94. package/.medusa/server/src/types/translations.js +2 -0
  95. package/.medusa/server/src/workflows/index.js +461 -0
  96. package/LICENSE +21 -0
  97. package/README.md +389 -2
  98. package/package.json +133 -3
  99. package/src/admin/README.md +123 -0
  100. package/src/admin/components/mpn/broadcast-consent-section.tsx +62 -0
  101. package/src/admin/components/mpn/broadcasts-tab.tsx +208 -0
  102. package/src/admin/components/mpn/channels-main-section.tsx +205 -0
  103. package/src/admin/components/mpn/channels-side-section.tsx +88 -0
  104. package/src/admin/components/mpn/channels-tab.tsx +130 -0
  105. package/src/admin/components/mpn/constants.ts +8 -0
  106. package/src/admin/components/mpn/delivery-logs-tab.tsx +70 -0
  107. package/src/admin/components/mpn/event-mapping-form.tsx +191 -0
  108. package/src/admin/components/mpn/event-mappings-tab.tsx +165 -0
  109. package/src/admin/components/mpn/header-bar.tsx +35 -0
  110. package/src/admin/components/mpn/index.ts +17 -0
  111. package/src/admin/components/mpn/overview-cards.tsx +103 -0
  112. package/src/admin/components/mpn/sandbox-tab.tsx +93 -0
  113. package/src/admin/components/mpn/template-editor-section.tsx +203 -0
  114. package/src/admin/components/mpn/template-preview-section.tsx +122 -0
  115. package/src/admin/components/mpn/templates-list-section.tsx +115 -0
  116. package/src/admin/components/mpn/templates-tab.tsx +188 -0
  117. package/src/admin/components/mpn/use-notification-studio.ts +84 -0
  118. package/src/admin/components/rbac-guard.tsx +153 -0
  119. package/src/admin/i18n/README.md +134 -0
  120. package/src/admin/i18n/index.ts +23 -0
  121. package/src/admin/i18n/json/ar.json +157 -0
  122. package/src/admin/i18n/json/de.json +157 -0
  123. package/src/admin/i18n/json/en.json +157 -0
  124. package/src/admin/i18n/json/es.json +157 -0
  125. package/src/admin/i18n/json/fr.json +157 -0
  126. package/src/admin/i18n/json/it.json +157 -0
  127. package/src/admin/i18n/json/nl.json +157 -0
  128. package/src/admin/i18n/json/pl.json +157 -0
  129. package/src/admin/i18n/json/pt.json +157 -0
  130. package/src/admin/i18n/json/tr.json +157 -0
  131. package/src/admin/routes/mpn/broadcasts/page.tsx +75 -0
  132. package/src/admin/routes/mpn/channels/page.tsx +66 -0
  133. package/src/admin/routes/mpn/logs/page.tsx +50 -0
  134. package/src/admin/routes/mpn/mappings/page.tsx +62 -0
  135. package/src/admin/routes/mpn/page.tsx +200 -0
  136. package/src/admin/routes/mpn/sandbox/page.tsx +53 -0
  137. package/src/admin/routes/mpn/templates/page.tsx +55 -0
  138. package/src/admin/tsconfig.json +23 -0
  139. package/src/admin/vite-env.d.ts +1 -0
  140. package/src/admin/widgets/order-notifications-widget.tsx +178 -0
  141. package/src/api/README.md +98 -0
  142. package/src/api/admin/mpn/broadcasts/route.ts +130 -0
  143. package/src/api/admin/mpn/channels/route.ts +143 -0
  144. package/src/api/admin/mpn/logs/route.ts +41 -0
  145. package/src/api/admin/mpn/mappings/[id]/route.ts +45 -0
  146. package/src/api/admin/mpn/mappings/route.ts +68 -0
  147. package/src/api/admin/mpn/render-template/route.ts +46 -0
  148. package/src/api/admin/mpn/sandbox/route.ts +51 -0
  149. package/src/api/admin/mpn/send/route.ts +163 -0
  150. package/src/api/admin/mpn/templates/[id]/route.ts +101 -0
  151. package/src/api/admin/mpn/templates/route.ts +99 -0
  152. package/src/api/admin/plugin/route.ts +5 -0
  153. package/src/api/middlewares.ts +42 -0
  154. package/src/api/store/mpn/consent/route.ts +45 -0
  155. package/src/api/store/mpn/webhooks/[provider]/route.ts +119 -0
  156. package/src/api/store/plugin/route.ts +5 -0
  157. package/src/api/validators.ts +149 -0
  158. package/src/hooks/index.ts +14 -0
  159. package/src/hooks/use-mpn-channels.ts +43 -0
  160. package/src/hooks/use-mpn-dispatch.ts +149 -0
  161. package/src/hooks/use-mpn-mappings.ts +75 -0
  162. package/src/hooks/use-mpn-templates.ts +120 -0
  163. package/src/hooks/use-order-notifications-widget-state.ts +103 -0
  164. package/src/hooks/use-sdk-primitives.ts +157 -0
  165. package/src/index.ts +16 -0
  166. package/src/integrations/automations-action-handler.ts +156 -0
  167. package/src/jobs/README.md +41 -0
  168. package/src/jobs/abandoned-cart-recovery.ts +152 -0
  169. package/src/jobs/log-retention-and-broadcasts.ts +23 -0
  170. package/src/links/README.md +52 -0
  171. package/src/modules/README.md +99 -0
  172. package/src/modules/notifications/i18n/index.ts +83 -0
  173. package/src/modules/notifications/i18n/locales/ar.ts +84 -0
  174. package/src/modules/notifications/i18n/locales/de.ts +83 -0
  175. package/src/modules/notifications/i18n/locales/en.ts +84 -0
  176. package/src/modules/notifications/i18n/locales/es.ts +84 -0
  177. package/src/modules/notifications/i18n/locales/fr.ts +82 -0
  178. package/src/modules/notifications/i18n/locales/it.ts +82 -0
  179. package/src/modules/notifications/i18n/locales/nl.ts +83 -0
  180. package/src/modules/notifications/i18n/locales/pl.ts +84 -0
  181. package/src/modules/notifications/i18n/locales/pt.ts +82 -0
  182. package/src/modules/notifications/i18n/locales/tr.ts +86 -0
  183. package/src/modules/notifications/i18n/types.ts +1 -0
  184. package/src/modules/notifications/index.ts +10 -0
  185. package/src/modules/notifications/integrations/documents-and-b2b-resolver.ts +168 -0
  186. package/src/modules/notifications/migrations/Migration20261010000000.ts +185 -0
  187. package/src/modules/notifications/models/index.ts +125 -0
  188. package/src/modules/notifications/renderer/block-helpers.ts +51 -0
  189. package/src/modules/notifications/renderer/email.ts +281 -0
  190. package/src/modules/notifications/renderer/index.ts +301 -0
  191. package/src/modules/notifications/renderer/slack.ts +168 -0
  192. package/src/modules/notifications/renderer/telegram.ts +161 -0
  193. package/src/modules/notifications/renderer/whatsapp.ts +156 -0
  194. package/src/modules/notifications/service-helpers/channel-config.ts +65 -0
  195. package/src/modules/notifications/service-helpers/consent.ts +88 -0
  196. package/src/modules/notifications/service-helpers/delivery-log.ts +56 -0
  197. package/src/modules/notifications/service-helpers/event-conditions.ts +66 -0
  198. package/src/modules/notifications/service-helpers/external-templates.ts +127 -0
  199. package/src/modules/notifications/service-helpers/recipient-resolution.ts +124 -0
  200. package/src/modules/notifications/service-helpers/sender-profiles.ts +34 -0
  201. package/src/modules/notifications/service-helpers/template-blocks.ts +116 -0
  202. package/src/modules/notifications/service-helpers/template-catalog.ts +170 -0
  203. package/src/modules/notifications/service-helpers/template-render.ts +113 -0
  204. package/src/modules/notifications/service.ts +589 -0
  205. package/src/modules/notifications/types.ts +1 -0
  206. package/src/modules/notifications/utils/auth-presets.ts +145 -0
  207. package/src/modules/notifications/utils/interpolation.ts +231 -0
  208. package/src/modules/notifications/utils/security.ts +378 -0
  209. package/src/modules/notifications/utils/system-presets.ts +695 -0
  210. package/src/modules/notifications/utils/transformers.ts +456 -0
  211. package/src/providers/README.md +92 -0
  212. package/src/providers/dummy-sandbox/index.ts +143 -0
  213. package/src/providers/email-smtp/index.ts +257 -0
  214. package/src/providers/index.ts +38 -0
  215. package/src/providers/slack/index.ts +82 -0
  216. package/src/providers/sms/index.ts +342 -0
  217. package/src/providers/telegram/index.ts +181 -0
  218. package/src/providers/whatsapp/index.ts +505 -0
  219. package/src/rbac.ts +123 -0
  220. package/src/sdk/client.ts +319 -0
  221. package/src/sdk/index.ts +48 -0
  222. package/src/sdk/query-keys.ts +89 -0
  223. package/src/subscribers/README.md +50 -0
  224. package/src/subscribers/customer-and-document-events.ts +36 -0
  225. package/src/subscribers/fulfillment-and-inventory-events.ts +35 -0
  226. package/src/subscribers/order-events.ts +31 -0
  227. package/src/types/constants.ts +143 -0
  228. package/src/types/core.ts +96 -0
  229. package/src/types/domain.ts +84 -0
  230. package/src/types/enums.ts +73 -0
  231. package/src/types/errors.ts +32 -0
  232. package/src/types/hooks.ts +48 -0
  233. package/src/types/index.ts +11 -0
  234. package/src/types/providers.ts +96 -0
  235. package/src/types/records.ts +100 -0
  236. package/src/types/render.ts +74 -0
  237. package/src/types/sdk-api.ts +228 -0
  238. package/src/types/translations.ts +75 -0
  239. package/src/workflows/README.md +67 -0
  240. package/src/workflows/index.ts +619 -0
  241. package/tsconfig.json +40 -0
@@ -0,0 +1,4193 @@
1
+ import { defineRouteConfig, defineWidgetConfig } from "@medusajs/admin-sdk";
2
+ import { Form, KeyboundForm, LayoutComposer, SectionRow } from "@medusajs/dashboard/components";
3
+ import { Badge, Button, Container, Heading, Input, Label, Select, Skeleton, StatusBadge, Switch, Table, Text, Textarea, Toaster, clx, toast } from "@medusajs/ui";
4
+ import { useCallback, useEffect, useRef, useState } from "react";
5
+ import { useTranslation } from "react-i18next";
6
+ import { MedusaError } from "@medusajs/framework/utils";
7
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
8
+ import { CORE_LAYOUT_IDS } from "@medusajs/admin-shared";
9
+ import { ArrowPath, ChatBubbleLeftRight, CheckCircle, CogSixTooth, DocumentText, EnvelopeSolid, Megaphone, Tag } from "@medusajs/icons";
10
+ import { useNavigate } from "react-router-dom";
11
+ import { useForm } from "react-hook-form";
12
+ // src/sdk/query-keys.ts
13
+ var NOTIFICATIONS_QUERY_KEY = "notifications";
14
+ var invalidationListeners = /* @__PURE__ */ new Set();
15
+ /**
16
+ * Hierarchical query key factory for `medusa-plugin-notifications`.
17
+ * Follows the same factory conventions as `boldQueryKeys` in `vicacha-medusa-plugins`.
18
+ */
19
+ var notificationsQueryKeys = {
20
+ all: [NOTIFICATIONS_QUERY_KEY],
21
+ studio: () => [...notificationsQueryKeys.all, "studio"],
22
+ templatesAll: () => [...notificationsQueryKeys.all, "templates"],
23
+ templates: (params) => params ? [...notificationsQueryKeys.templatesAll(), params] : notificationsQueryKeys.templatesAll(),
24
+ template: (id) => [
25
+ ...notificationsQueryKeys.templatesAll(),
26
+ "detail",
27
+ id
28
+ ],
29
+ mappingsAll: () => [...notificationsQueryKeys.all, "mappings"],
30
+ mappings: (params) => params ? [...notificationsQueryKeys.mappingsAll(), params] : notificationsQueryKeys.mappingsAll(),
31
+ channels: () => [...notificationsQueryKeys.all, "channels"],
32
+ logsAll: () => [...notificationsQueryKeys.all, "logs"],
33
+ logs: (params) => params ? [...notificationsQueryKeys.logsAll(), params] : notificationsQueryKeys.logsAll(),
34
+ orderLogs: (orderId) => [
35
+ ...notificationsQueryKeys.logsAll(),
36
+ "order",
37
+ orderId
38
+ ],
39
+ broadcasts: () => [...notificationsQueryKeys.all, "broadcasts"],
40
+ sandbox: (params) => params ? [
41
+ ...notificationsQueryKeys.all,
42
+ "sandbox",
43
+ params
44
+ ] : [...notificationsQueryKeys.all, "sandbox"]
45
+ };
46
+ function matchesNotificationsQueryKeyPrefix(candidateKey, prefixKey) {
47
+ if (prefixKey.length > candidateKey.length) return false;
48
+ for (let i = 0; i < prefixKey.length; i++) {
49
+ const a = candidateKey[i];
50
+ const b = prefixKey[i];
51
+ if (a === b) continue;
52
+ if (typeof a === "object" && a !== null && typeof b === "object" && b !== null) {
53
+ if (JSON.stringify(a) === JSON.stringify(b)) continue;
54
+ }
55
+ return false;
56
+ }
57
+ return true;
58
+ }
59
+ function invalidateNotificationsQueries(keyPrefix = notificationsQueryKeys.all) {
60
+ for (const listener of invalidationListeners) listener(keyPrefix);
61
+ }
62
+ function subscribeNotificationsQueryInvalidation(listener) {
63
+ invalidationListeners.add(listener);
64
+ return () => {
65
+ invalidationListeners.delete(listener);
66
+ };
67
+ }
68
+ // src/hooks/use-sdk-primitives.ts
69
+ function useNotificationsQuery(queryKey, queryFn, options) {
70
+ const enabled = options?.enabled ?? true;
71
+ const [data, setData] = useState(void 0);
72
+ const [isLoading, setIsLoading] = useState(enabled);
73
+ const [isFetching, setIsFetching] = useState(false);
74
+ const [error, setError] = useState(null);
75
+ const queryFnRef = useRef(queryFn);
76
+ queryFnRef.current = queryFn;
77
+ const optionsRef = useRef(options);
78
+ optionsRef.current = options;
79
+ const serializedKey = JSON.stringify(queryKey);
80
+ const keyRef = useRef(queryKey);
81
+ keyRef.current = queryKey;
82
+ const execute = useCallback(async () => {
83
+ setIsFetching(true);
84
+ setError(null);
85
+ try {
86
+ const result = await queryFnRef.current();
87
+ setData(result);
88
+ optionsRef.current?.onSuccess?.(result);
89
+ return result;
90
+ } catch (err) {
91
+ const normalized = err instanceof Error ? err : new Error(String(err || "Unknown error"));
92
+ setError(normalized);
93
+ optionsRef.current?.onError?.(normalized);
94
+ return;
95
+ } finally {
96
+ setIsLoading(false);
97
+ setIsFetching(false);
98
+ }
99
+ }, []);
100
+ useEffect(() => {
101
+ if (!enabled) {
102
+ setIsLoading(false);
103
+ return;
104
+ }
105
+ setIsLoading(true);
106
+ execute();
107
+ }, [
108
+ enabled,
109
+ serializedKey,
110
+ execute
111
+ ]);
112
+ useEffect(() => {
113
+ if (!enabled) return;
114
+ return subscribeNotificationsQueryInvalidation((invalidatedPrefix) => {
115
+ if (matchesNotificationsQueryKeyPrefix(keyRef.current, invalidatedPrefix)) execute();
116
+ });
117
+ }, [enabled, execute]);
118
+ return {
119
+ data,
120
+ isLoading,
121
+ isFetching,
122
+ error,
123
+ refetch: execute
124
+ };
125
+ }
126
+ function useNotificationsMutation(mutationFn, options, defaultInvalidateKey = notificationsQueryKeys.all) {
127
+ const [isPending, setIsPending] = useState(false);
128
+ const [error, setError] = useState(null);
129
+ const [data, setData] = useState(void 0);
130
+ const mutationFnRef = useRef(mutationFn);
131
+ mutationFnRef.current = mutationFn;
132
+ const optionsRef = useRef(options);
133
+ optionsRef.current = options;
134
+ const mutateAsync = useCallback(async (variables) => {
135
+ setIsPending(true);
136
+ setError(null);
137
+ try {
138
+ const result = await mutationFnRef.current(variables);
139
+ setData(result);
140
+ invalidateNotificationsQueries(optionsRef.current?.queryKey ?? defaultInvalidateKey);
141
+ optionsRef.current?.onSuccess?.(result, variables);
142
+ return result;
143
+ } catch (err) {
144
+ const normalized = err instanceof Error ? err : new Error(String(err || "Unknown error"));
145
+ setError(normalized);
146
+ optionsRef.current?.onError?.(normalized, variables);
147
+ throw normalized;
148
+ } finally {
149
+ setIsPending(false);
150
+ }
151
+ }, [defaultInvalidateKey]);
152
+ return {
153
+ mutate: useCallback((variables, callOptions) => {
154
+ mutateAsync(variables).then((res) => {
155
+ callOptions?.onSuccess?.(res, variables);
156
+ }).catch((err) => {
157
+ callOptions?.onError?.(err, variables);
158
+ });
159
+ }, [mutateAsync]),
160
+ mutateAsync,
161
+ isPending,
162
+ error,
163
+ data,
164
+ reset: useCallback(() => {
165
+ setError(null);
166
+ setData(void 0);
167
+ setIsPending(false);
168
+ }, [])
169
+ };
170
+ }
171
+ // src/sdk/client.ts
172
+ function buildQueryString(params) {
173
+ if (!params) return "";
174
+ const search = new URLSearchParams();
175
+ for (const [key, value] of Object.entries(params)) {
176
+ if (value === void 0 || value === null || value === "") continue;
177
+ search.set(key, String(value));
178
+ }
179
+ const str = search.toString();
180
+ return str ? `?${str}` : "";
181
+ }
182
+ /**
183
+ * Typed SDK client for `medusa-plugin-notifications` (MPN).
184
+ * Supports both `/admin` and `/store` routes with automatic JSON parsing
185
+ * and standard Medusa error extraction.
186
+ */
187
+ var NotificationsApiClient = class {
188
+ baseUrl;
189
+ prefix;
190
+ options;
191
+ constructor(prefix = "/store", baseUrl = "", options = {}) {
192
+ this.prefix = prefix;
193
+ this.baseUrl = baseUrl.replace(/\/$/, "");
194
+ this.options = options;
195
+ }
196
+ resolveUrl(endpoint, params) {
197
+ const normalizedEndpoint = endpoint.startsWith("/") ? endpoint : `/${endpoint}`;
198
+ return `${this.baseUrl}${this.prefix}${normalizedEndpoint}${buildQueryString(params)}`;
199
+ }
200
+ buildHeaders(customHeaders, hasJsonBody = true) {
201
+ const headers = {
202
+ ...hasJsonBody ? { "Content-Type": "application/json" } : {},
203
+ ...this.options.headers
204
+ };
205
+ if (this.options.publishableApiKey) headers["x-publishable-api-key"] = this.options.publishableApiKey;
206
+ if (customHeaders) {
207
+ if (customHeaders instanceof Headers) customHeaders.forEach((v, k) => {
208
+ headers[k] = v;
209
+ });
210
+ else if (Array.isArray(customHeaders)) for (const [k, v] of customHeaders) headers[k] = v;
211
+ else Object.assign(headers, customHeaders);
212
+ }
213
+ return headers;
214
+ }
215
+ async fetch(endpoint, options, queryParams) {
216
+ const url = this.resolveUrl(endpoint, queryParams);
217
+ const fetchFn = this.options.fetchImpl ?? globalThis.fetch;
218
+ const hasJsonBody = options?.body !== void 0 && !(options.body instanceof FormData);
219
+ const response = await fetchFn(url, {
220
+ credentials: this.options.credentials ?? "include",
221
+ ...options,
222
+ headers: this.buildHeaders(options?.headers, hasJsonBody)
223
+ });
224
+ if (response.status === 204) return {};
225
+ const data = await response.json().catch(() => ({}));
226
+ if (!response.ok) throw new MedusaError(MedusaError.Types.UNEXPECTED_STATE, data.message || data.detail || `Request failed with status ${response.status}`);
227
+ return data;
228
+ }
229
+ async listTemplates(params) {
230
+ return this.fetch("/mpn/templates", { method: "GET" }, params);
231
+ }
232
+ async getTemplate(id) {
233
+ return this.fetch(`/mpn/templates/${encodeURIComponent(id)}`, { method: "GET" });
234
+ }
235
+ async createOrCloneTemplate(payload) {
236
+ return this.fetch("/mpn/templates", {
237
+ method: "POST",
238
+ body: JSON.stringify(payload)
239
+ });
240
+ }
241
+ async updateTemplate(id, payload) {
242
+ return this.fetch(`/mpn/templates/${encodeURIComponent(id)}`, {
243
+ method: "POST",
244
+ body: JSON.stringify(payload)
245
+ });
246
+ }
247
+ async deleteTemplate(id) {
248
+ return this.fetch(`/mpn/templates/${encodeURIComponent(id)}`, { method: "DELETE" });
249
+ }
250
+ async renderTemplatePreview(payload) {
251
+ return this.fetch("/mpn/render-template", {
252
+ method: "POST",
253
+ body: JSON.stringify(payload)
254
+ });
255
+ }
256
+ async listMappings() {
257
+ return this.fetch("/mpn/mappings", { method: "GET" });
258
+ }
259
+ async createMapping(payload) {
260
+ return this.fetch("/mpn/mappings", {
261
+ method: "POST",
262
+ body: JSON.stringify(payload)
263
+ });
264
+ }
265
+ async updateMapping(id, payload) {
266
+ return this.fetch(`/mpn/mappings/${encodeURIComponent(id)}`, {
267
+ method: "POST",
268
+ body: JSON.stringify(payload)
269
+ });
270
+ }
271
+ async deleteMapping(id) {
272
+ return this.fetch(`/mpn/mappings/${encodeURIComponent(id)}`, { method: "DELETE" });
273
+ }
274
+ async listChannels() {
275
+ return this.fetch("/mpn/channels", { method: "GET" });
276
+ }
277
+ async saveOrVerifyChannel(payload) {
278
+ return this.fetch("/mpn/channels", {
279
+ method: "POST",
280
+ body: JSON.stringify(payload)
281
+ });
282
+ }
283
+ async listLogs(params) {
284
+ return this.fetch("/mpn/logs", { method: "GET" }, params);
285
+ }
286
+ async listBroadcasts() {
287
+ return this.fetch("/mpn/broadcasts", { method: "GET" });
288
+ }
289
+ async createBroadcast(payload) {
290
+ return this.fetch("/mpn/broadcasts", {
291
+ method: "POST",
292
+ body: JSON.stringify(payload)
293
+ });
294
+ }
295
+ async listSandboxMessages(params) {
296
+ return this.fetch("/mpn/sandbox", { method: "GET" }, params);
297
+ }
298
+ async clearSandboxMessages() {
299
+ return this.fetch("/mpn/sandbox", { method: "DELETE" });
300
+ }
301
+ async sendNotification(payload) {
302
+ return this.fetch("/mpn/send", {
303
+ method: "POST",
304
+ body: JSON.stringify(payload)
305
+ });
306
+ }
307
+ async updateConsent(payload) {
308
+ return this.fetch("/mpn/consent", {
309
+ method: "POST",
310
+ body: JSON.stringify(payload)
311
+ });
312
+ }
313
+ };
314
+ var notificationsAdminSdk = new NotificationsApiClient("/admin");
315
+ new NotificationsApiClient("/store");
316
+ // src/hooks/use-mpn-templates.ts
317
+ function useMpnTemplates(params, options) {
318
+ const client = options?.client ?? notificationsAdminSdk;
319
+ return useNotificationsQuery(options?.queryKey ?? notificationsQueryKeys.templates(params), () => client.listTemplates(params), options);
320
+ }
321
+ function useCreateOrCloneMpnTemplate(options) {
322
+ const client = options?.client ?? notificationsAdminSdk;
323
+ return useNotificationsMutation((payload) => client.createOrCloneTemplate(payload), options, notificationsQueryKeys.templatesAll());
324
+ }
325
+ function useUpdateMpnTemplate(options) {
326
+ const client = options?.client ?? notificationsAdminSdk;
327
+ return useNotificationsMutation(({ id, payload }) => client.updateTemplate(id, payload), options, notificationsQueryKeys.templatesAll());
328
+ }
329
+ function useRenderMpnTemplatePreview(options) {
330
+ const client = options?.client ?? notificationsAdminSdk;
331
+ return useNotificationsMutation((payload) => client.renderTemplatePreview(payload), options, notificationsQueryKeys.templatesAll());
332
+ }
333
+ // src/hooks/use-mpn-mappings.ts
334
+ function useMpnMappings(options) {
335
+ const client = options?.client ?? notificationsAdminSdk;
336
+ return useNotificationsQuery(options?.queryKey ?? notificationsQueryKeys.mappings(), () => client.listMappings(), options);
337
+ }
338
+ function useCreateMpnMapping(options) {
339
+ const client = options?.client ?? notificationsAdminSdk;
340
+ return useNotificationsMutation((payload) => client.createMapping(payload), options, notificationsQueryKeys.mappingsAll());
341
+ }
342
+ function useDeleteMpnMapping(options) {
343
+ const client = options?.client ?? notificationsAdminSdk;
344
+ return useNotificationsMutation(({ id }) => client.deleteMapping(id), options, notificationsQueryKeys.mappingsAll());
345
+ }
346
+ // src/hooks/use-mpn-channels.ts
347
+ function useMpnChannels(options) {
348
+ const client = options?.client ?? notificationsAdminSdk;
349
+ return useNotificationsQuery(options?.queryKey ?? notificationsQueryKeys.channels(), () => client.listChannels(), options);
350
+ }
351
+ function useSaveOrVerifyMpnChannel(options) {
352
+ const client = options?.client ?? notificationsAdminSdk;
353
+ return useNotificationsMutation((payload) => client.saveOrVerifyChannel(payload), options, notificationsQueryKeys.channels());
354
+ }
355
+ // src/hooks/use-mpn-dispatch.ts
356
+ function useMpnLogs(params, options) {
357
+ const client = options?.client ?? notificationsAdminSdk;
358
+ return useNotificationsQuery(options?.queryKey ?? notificationsQueryKeys.logs(params), () => client.listLogs(params), options);
359
+ }
360
+ function useMpnOrderLogs(orderId, options) {
361
+ const client = options?.client ?? notificationsAdminSdk;
362
+ return useNotificationsQuery(options?.queryKey ?? notificationsQueryKeys.orderLogs(orderId || ""), () => client.listLogs({
363
+ entity_id: orderId,
364
+ limit: 15
365
+ }), {
366
+ ...options,
367
+ enabled: Boolean(orderId) && (options?.enabled ?? true)
368
+ });
369
+ }
370
+ function useMpnBroadcasts(options) {
371
+ const client = options?.client ?? notificationsAdminSdk;
372
+ return useNotificationsQuery(options?.queryKey ?? notificationsQueryKeys.broadcasts(), () => client.listBroadcasts(), options);
373
+ }
374
+ function useCreateMpnBroadcast(options) {
375
+ const client = options?.client ?? notificationsAdminSdk;
376
+ return useNotificationsMutation((payload) => client.createBroadcast(payload), options, notificationsQueryKeys.broadcasts());
377
+ }
378
+ function useMpnSandboxMessages(params, options) {
379
+ const client = options?.client ?? notificationsAdminSdk;
380
+ return useNotificationsQuery(options?.queryKey ?? notificationsQueryKeys.sandbox(params), () => client.listSandboxMessages(params), options);
381
+ }
382
+ function useClearMpnSandbox(options) {
383
+ const client = options?.client ?? notificationsAdminSdk;
384
+ return useNotificationsMutation(() => client.clearSandboxMessages(), options, notificationsQueryKeys.sandbox());
385
+ }
386
+ function useSendMpnNotification(options) {
387
+ const client = options?.client ?? notificationsAdminSdk;
388
+ return useNotificationsMutation((payload) => client.sendNotification(payload), options, notificationsQueryKeys.logsAll());
389
+ }
390
+ // src/hooks/use-order-notifications-widget-state.ts
391
+ function useOrderNotificationsWidgetState({ order, client = notificationsAdminSdk, t = (key) => key }) {
392
+ const orderId = order?.id;
393
+ const [selectedChannel, setSelectedChannel] = useState("email");
394
+ const [selectedTemplateId, setSelectedTemplateId] = useState("system_email_order_placed");
395
+ const [attachInvoicePdf, setAttachInvoicePdf] = useState(true);
396
+ const [statusMessage, setStatusMessage] = useState(null);
397
+ const orderLogsQueryKey = notificationsQueryKeys.orderLogs(orderId || "");
398
+ const { data: logsData, refetch: refetchOrderLogs } = useMpnOrderLogs(orderId, {
399
+ client,
400
+ queryKey: orderLogsQueryKey
401
+ });
402
+ const { data: templatesData } = useMpnTemplates(void 0, {
403
+ client,
404
+ enabled: Boolean(orderId)
405
+ });
406
+ const logs = logsData?.logs || [];
407
+ const templates = templatesData?.templates || [];
408
+ const sendMutation = useSendMpnNotification({
409
+ client,
410
+ queryKey: orderLogsQueryKey
411
+ });
412
+ const handleSendOrderNotification = useCallback(async () => {
413
+ if (!orderId) return;
414
+ setStatusMessage(null);
415
+ try {
416
+ const recipient = selectedChannel === "email" ? order?.email || "customer@example.com" : selectedChannel === "whatsapp" || selectedChannel === "sms" ? order?.shipping_address?.phone || order?.billing_address?.phone || "+14155552671" : order?.metadata?.telegram_chat_id || "-1001234567890";
417
+ await sendMutation.mutateAsync({
418
+ channel: selectedChannel,
419
+ recipient,
420
+ template_id: selectedTemplateId,
421
+ order_id: orderId,
422
+ context_type: "order",
423
+ data: order,
424
+ attach_invoice_pdf: attachInvoicePdf
425
+ });
426
+ setStatusMessage(t("widget.dispatchedSuccess", { channel: selectedChannel }));
427
+ } catch (err) {
428
+ setStatusMessage(err?.message || t("widget.dispatchFailed"));
429
+ }
430
+ }, [
431
+ orderId,
432
+ order,
433
+ selectedChannel,
434
+ selectedTemplateId,
435
+ attachInvoicePdf,
436
+ sendMutation,
437
+ t
438
+ ]);
439
+ return {
440
+ orderId,
441
+ logs,
442
+ templates,
443
+ selectedChannel,
444
+ setSelectedChannel,
445
+ selectedTemplateId,
446
+ setSelectedTemplateId,
447
+ attachInvoicePdf,
448
+ setAttachInvoicePdf,
449
+ sending: sendMutation.isPending,
450
+ statusMessage,
451
+ setStatusMessage,
452
+ loadOrderActivity: refetchOrderLogs,
453
+ handleSendOrderNotification
454
+ };
455
+ }
456
+ // src/admin/widgets/order-notifications-widget.tsx
457
+ var OrderNotificationsActivityWidget = ({ data }) => {
458
+ const { t, i18n } = useTranslation();
459
+ const { orderId, logs, templates, selectedChannel, setSelectedChannel, selectedTemplateId, setSelectedTemplateId, attachInvoicePdf, setAttachInvoicePdf, sending, statusMessage, setStatusMessage, handleSendOrderNotification } = useOrderNotificationsWidgetState({
460
+ order: data,
461
+ t
462
+ });
463
+ useEffect(() => {
464
+ if (!statusMessage) return;
465
+ if (statusMessage.toLowerCase().includes(t("widget.dispatchFailed").toLowerCase())) toast.error(statusMessage);
466
+ else toast.success(statusMessage);
467
+ setStatusMessage(null);
468
+ }, [
469
+ statusMessage,
470
+ setStatusMessage,
471
+ t
472
+ ]);
473
+ if (!orderId) return null;
474
+ const isRtl = (i18n.resolvedLanguage || i18n.language || "").startsWith("ar");
475
+ return /* @__PURE__ */ jsxs(Container, {
476
+ className: "divide-y p-0",
477
+ dir: isRtl ? "rtl" : "ltr",
478
+ children: [
479
+ /* @__PURE__ */ jsx(Toaster, {}),
480
+ /* @__PURE__ */ jsxs("div", {
481
+ className: "flex items-center justify-between px-6 py-4",
482
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Heading, {
483
+ level: "h2",
484
+ children: t("widget.title", { count: logs.length })
485
+ }), /* @__PURE__ */ jsx(Text, {
486
+ className: "text-ui-fg-subtle text-xs mt-1",
487
+ children: t("widget.subtitle")
488
+ })] }), /* @__PURE__ */ jsx(StatusBadge, {
489
+ color: "green",
490
+ children: logs.length
491
+ })]
492
+ }),
493
+ /* @__PURE__ */ jsx(SectionRow, {
494
+ title: t("widget.colChannel"),
495
+ value: selectedChannel
496
+ }),
497
+ /* @__PURE__ */ jsxs("div", {
498
+ className: "flex flex-wrap items-center gap-3 px-6 py-4",
499
+ children: [
500
+ /* @__PURE__ */ jsx("div", {
501
+ className: "w-40",
502
+ children: /* @__PURE__ */ jsxs(Select, {
503
+ size: "small",
504
+ value: selectedChannel,
505
+ onValueChange: setSelectedChannel,
506
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, { placeholder: t("widget.channelPlaceholder") }) }), /* @__PURE__ */ jsxs(Select.Content, { children: [
507
+ /* @__PURE__ */ jsx(Select.Item, {
508
+ value: "email",
509
+ children: "EMAIL"
510
+ }),
511
+ /* @__PURE__ */ jsx(Select.Item, {
512
+ value: "whatsapp",
513
+ children: "WHATSAPP / OPENWA"
514
+ }),
515
+ /* @__PURE__ */ jsx(Select.Item, {
516
+ value: "telegram",
517
+ children: "TELEGRAM"
518
+ }),
519
+ /* @__PURE__ */ jsx(Select.Item, {
520
+ value: "sms",
521
+ children: "SMS"
522
+ }),
523
+ /* @__PURE__ */ jsx(Select.Item, {
524
+ value: "dummy",
525
+ children: "DUMMY SANDBOX"
526
+ })
527
+ ] })]
528
+ })
529
+ }),
530
+ /* @__PURE__ */ jsx("div", {
531
+ className: "w-64",
532
+ children: /* @__PURE__ */ jsxs(Select, {
533
+ size: "small",
534
+ value: selectedTemplateId,
535
+ onValueChange: setSelectedTemplateId,
536
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, { placeholder: t("widget.templatePlaceholder") }) }), /* @__PURE__ */ jsx(Select.Content, { children: templates.map((tpl) => /* @__PURE__ */ jsxs(Select.Item, {
537
+ value: tpl.id,
538
+ children: [
539
+ "[",
540
+ tpl.channel.toUpperCase(),
541
+ "] ",
542
+ tpl.label
543
+ ]
544
+ }, tpl.id)) })]
545
+ })
546
+ }),
547
+ /* @__PURE__ */ jsxs("div", {
548
+ className: "flex items-center gap-x-2",
549
+ children: [/* @__PURE__ */ jsx(Switch, {
550
+ checked: attachInvoicePdf,
551
+ onCheckedChange: setAttachInvoicePdf
552
+ }), /* @__PURE__ */ jsx(Text, {
553
+ className: "text-xs",
554
+ children: t("widget.attachInvoiceLabel")
555
+ })]
556
+ }),
557
+ /* @__PURE__ */ jsx(Button, {
558
+ size: "small",
559
+ variant: "primary",
560
+ disabled: sending,
561
+ isLoading: sending,
562
+ onClick: () => void handleSendOrderNotification(),
563
+ children: sending ? t("widget.sending") : t("widget.sendResendButton")
564
+ })
565
+ ]
566
+ }),
567
+ /* @__PURE__ */ jsxs(Table, { children: [/* @__PURE__ */ jsx(Table.Header, { children: /* @__PURE__ */ jsxs(Table.Row, { children: [
568
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("widget.colChannel") }),
569
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("widget.colEventTemplate") }),
570
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("widget.colRecipient") }),
571
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("widget.colStatus") })
572
+ ] }) }), /* @__PURE__ */ jsx(Table.Body, { children: logs.map((row) => /* @__PURE__ */ jsxs(Table.Row, { children: [
573
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Badge, {
574
+ size: "2xsmall",
575
+ color: "blue",
576
+ children: row.channel
577
+ }) }),
578
+ /* @__PURE__ */ jsxs(Table.Cell, { children: [
579
+ row.event_name,
580
+ " (",
581
+ row.template_id || "—",
582
+ ")"
583
+ ] }),
584
+ /* @__PURE__ */ jsx(Table.Cell, { children: row.recipient_masked }),
585
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(StatusBadge, {
586
+ color: row.status === "sent" || row.status === "delivered" ? "green" : "orange",
587
+ children: row.status
588
+ }) })
589
+ ] }, row.id)) })] })
590
+ ]
591
+ });
592
+ };
593
+ defineWidgetConfig({ zone: "order.details.after" });
594
+ // src/admin/components/mpn/broadcast-consent-section.tsx
595
+ var BroadcastConsentSection = ({ consentSummary }) => {
596
+ const { t } = useTranslation();
597
+ return /* @__PURE__ */ jsxs(Container, {
598
+ className: "divide-y p-0",
599
+ children: [
600
+ /* @__PURE__ */ jsx("div", {
601
+ className: "flex items-center justify-between px-6 py-4",
602
+ children: /* @__PURE__ */ jsx(Heading, {
603
+ level: "h2",
604
+ children: t("tabs.broadcasts")
605
+ })
606
+ }),
607
+ /* @__PURE__ */ jsx(SectionRow, {
608
+ title: "SMS",
609
+ value: /* @__PURE__ */ jsx(StatusBadge, {
610
+ color: "green",
611
+ children: t("broadcasts.smsOptedIn", { count: consentSummary?.opted_in_sms ?? 0 })
612
+ })
613
+ }),
614
+ /* @__PURE__ */ jsx(SectionRow, {
615
+ title: "WhatsApp",
616
+ value: /* @__PURE__ */ jsx(StatusBadge, {
617
+ color: "green",
618
+ children: t("broadcasts.whatsappOptedIn", { count: consentSummary?.opted_in_whatsapp ?? 0 })
619
+ })
620
+ }),
621
+ /* @__PURE__ */ jsx(SectionRow, {
622
+ title: "Telegram",
623
+ value: /* @__PURE__ */ jsx(Badge, {
624
+ size: "2xsmall",
625
+ color: "blue",
626
+ children: t("broadcasts.telegramLinked", { count: consentSummary?.opted_in_telegram ?? 0 })
627
+ })
628
+ }),
629
+ /* @__PURE__ */ jsx(SectionRow, {
630
+ title: "STOP",
631
+ value: /* @__PURE__ */ jsx(StatusBadge, {
632
+ color: "red",
633
+ children: t("broadcasts.optedOut", { count: consentSummary?.opted_out_total ?? 0 })
634
+ })
635
+ })
636
+ ]
637
+ });
638
+ };
639
+ // src/admin/components/mpn/broadcasts-tab.tsx
640
+ var BroadcastsConsentTab = ({ broadcasts, consentSummary, templates, onRefresh, onStatus, section = "all" }) => {
641
+ const { t } = useTranslation();
642
+ const [broadcastName, setBroadcastName] = useState("");
643
+ const [broadcastChannel, setBroadcastChannel] = useState("sms");
644
+ const [broadcastTemplateId, setBroadcastTemplateId] = useState("system_sms_order_placed");
645
+ const form = useForm({ defaultValues: {
646
+ name: "",
647
+ channel: "sms",
648
+ template_id: "system_sms_order_placed"
649
+ } });
650
+ const createBroadcastMutation = useCreateMpnBroadcast();
651
+ const handleSendBroadcast = async () => {
652
+ if (!broadcastName.trim()) return;
653
+ try {
654
+ await createBroadcastMutation.mutateAsync({
655
+ name: broadcastName,
656
+ channel: broadcastChannel,
657
+ template_id: broadcastTemplateId,
658
+ send_now: true
659
+ });
660
+ setBroadcastName("");
661
+ const msg = t("messages.broadcastSentSuccess");
662
+ toast.success(msg);
663
+ onStatus?.({
664
+ type: "success",
665
+ text: msg
666
+ });
667
+ await onRefresh();
668
+ } catch (err) {
669
+ toast.error(err?.message || t("messages.loadStudioError"));
670
+ }
671
+ };
672
+ const mainSection = /* @__PURE__ */ jsxs(Container, {
673
+ className: "divide-y p-0",
674
+ children: [
675
+ /* @__PURE__ */ jsxs("div", {
676
+ className: "flex items-center justify-between px-6 py-4",
677
+ children: [/* @__PURE__ */ jsx(Heading, {
678
+ level: "h2",
679
+ children: t("broadcasts.title")
680
+ }), /* @__PURE__ */ jsx(StatusBadge, {
681
+ color: "green",
682
+ children: broadcasts.length
683
+ })]
684
+ }),
685
+ /* @__PURE__ */ jsx(Form, {
686
+ ...form,
687
+ children: /* @__PURE__ */ jsx(KeyboundForm, {
688
+ onSubmit: (e) => {
689
+ e.preventDefault();
690
+ handleSendBroadcast();
691
+ },
692
+ className: "px-6 py-4",
693
+ children: /* @__PURE__ */ jsxs("div", {
694
+ className: "grid grid-cols-1 gap-4 md:grid-cols-4",
695
+ children: [
696
+ /* @__PURE__ */ jsxs("div", {
697
+ className: "flex flex-col gap-y-2",
698
+ children: [/* @__PURE__ */ jsx(Label, {
699
+ size: "small",
700
+ children: t("broadcasts.campaignNameLabel")
701
+ }), /* @__PURE__ */ jsx(Input, {
702
+ size: "small",
703
+ placeholder: t("broadcasts.campaignNamePlaceholder"),
704
+ value: broadcastName,
705
+ onChange: (e) => setBroadcastName(e.target.value)
706
+ })]
707
+ }),
708
+ /* @__PURE__ */ jsxs("div", {
709
+ className: "flex flex-col gap-y-2",
710
+ children: [/* @__PURE__ */ jsx(Label, {
711
+ size: "small",
712
+ children: t("broadcasts.channelLabel")
713
+ }), /* @__PURE__ */ jsxs(Select, {
714
+ size: "small",
715
+ value: broadcastChannel,
716
+ onValueChange: setBroadcastChannel,
717
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }), /* @__PURE__ */ jsxs(Select.Content, { children: [
718
+ /* @__PURE__ */ jsx(Select.Item, {
719
+ value: "sms",
720
+ children: "SMS"
721
+ }),
722
+ /* @__PURE__ */ jsx(Select.Item, {
723
+ value: "whatsapp",
724
+ children: "WhatsApp"
725
+ }),
726
+ /* @__PURE__ */ jsx(Select.Item, {
727
+ value: "telegram",
728
+ children: "Telegram"
729
+ })
730
+ ] })]
731
+ })]
732
+ }),
733
+ /* @__PURE__ */ jsxs("div", {
734
+ className: "flex flex-col gap-y-2",
735
+ children: [/* @__PURE__ */ jsx(Label, {
736
+ size: "small",
737
+ children: t("broadcasts.templateLabel")
738
+ }), /* @__PURE__ */ jsxs(Select, {
739
+ size: "small",
740
+ value: broadcastTemplateId,
741
+ onValueChange: setBroadcastTemplateId,
742
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }), /* @__PURE__ */ jsx(Select.Content, { children: templates.map((tpl) => /* @__PURE__ */ jsxs(Select.Item, {
743
+ value: tpl.id,
744
+ children: [
745
+ "[",
746
+ tpl.channel,
747
+ "] ",
748
+ tpl.label
749
+ ]
750
+ }, tpl.id)) })]
751
+ })]
752
+ }),
753
+ /* @__PURE__ */ jsx("div", {
754
+ className: "flex items-end",
755
+ children: /* @__PURE__ */ jsx(Button, {
756
+ size: "small",
757
+ variant: "primary",
758
+ type: "submit",
759
+ isLoading: createBroadcastMutation.isPending,
760
+ children: t("broadcasts.sendNowButton")
761
+ })
762
+ })
763
+ ]
764
+ })
765
+ })
766
+ }),
767
+ /* @__PURE__ */ jsxs(Table, { children: [/* @__PURE__ */ jsx(Table.Header, { children: /* @__PURE__ */ jsxs(Table.Row, { children: [
768
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("broadcasts.colCampaign") }),
769
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("broadcasts.colChannel") }),
770
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("broadcasts.colStatus") }),
771
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("broadcasts.colSentTotal") })
772
+ ] }) }), /* @__PURE__ */ jsx(Table.Body, { children: broadcasts.map((b) => /* @__PURE__ */ jsxs(Table.Row, { children: [
773
+ /* @__PURE__ */ jsx(Table.Cell, { children: b.name }),
774
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Badge, {
775
+ size: "2xsmall",
776
+ color: "blue",
777
+ children: b.channel
778
+ }) }),
779
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(StatusBadge, {
780
+ color: "green",
781
+ children: b.status
782
+ }) }),
783
+ /* @__PURE__ */ jsxs(Table.Cell, { children: [
784
+ b.sent_count,
785
+ " / ",
786
+ b.total_recipients
787
+ ] })
788
+ ] }, b.id)) })] })
789
+ ]
790
+ });
791
+ const sideSection = /* @__PURE__ */ jsx(BroadcastConsentSection, { consentSummary });
792
+ if (section === "main") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Toaster, {}), mainSection] });
793
+ if (section === "side") return sideSection;
794
+ return /* @__PURE__ */ jsxs("div", {
795
+ className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
796
+ children: [
797
+ /* @__PURE__ */ jsx(Toaster, {}),
798
+ /* @__PURE__ */ jsx("div", {
799
+ className: "lg:col-span-2",
800
+ children: mainSection
801
+ }),
802
+ /* @__PURE__ */ jsx("div", { children: sideSection })
803
+ ]
804
+ });
805
+ };
806
+ // src/admin/components/mpn/channels-main-section.tsx
807
+ var ChannelsMainSection = ({ whatsappDriverInput, openWaUrlInput, telegramChannelInput, tgVerified, verifyCooldown, isPending, onWhatsappDriverChange, onOpenWaUrlChange, onTelegramChannelChange, onSaveOrVerify }) => {
808
+ const { t } = useTranslation();
809
+ const form = useForm({ defaultValues: {
810
+ whatsapp_driver: whatsappDriverInput,
811
+ gateway_url: openWaUrlInput,
812
+ merchant_channel_id: telegramChannelInput
813
+ } });
814
+ return /* @__PURE__ */ jsxs("div", {
815
+ className: "flex flex-col gap-y-4",
816
+ children: [/* @__PURE__ */ jsxs(Container, {
817
+ className: "divide-y p-0",
818
+ children: [
819
+ /* @__PURE__ */ jsxs("div", {
820
+ className: "flex items-center justify-between px-6 py-4",
821
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Heading, {
822
+ level: "h2",
823
+ children: t("channels.whatsappTitle")
824
+ }), /* @__PURE__ */ jsx(Text, {
825
+ className: "text-ui-fg-subtle text-xs mt-1",
826
+ children: t("channels.whatsappSubtitle")
827
+ })] }), /* @__PURE__ */ jsx(Badge, {
828
+ size: "2xsmall",
829
+ color: "blue",
830
+ children: whatsappDriverInput
831
+ })]
832
+ }),
833
+ /* @__PURE__ */ jsx(SectionRow, {
834
+ title: t("channels.activeDriverLabel"),
835
+ value: whatsappDriverInput
836
+ }),
837
+ /* @__PURE__ */ jsx(Form, {
838
+ ...form,
839
+ children: /* @__PURE__ */ jsxs(KeyboundForm, {
840
+ onSubmit: (e) => {
841
+ e.preventDefault();
842
+ onSaveOrVerify("whatsapp", whatsappDriverInput, { gateway_url: openWaUrlInput }, "save");
843
+ },
844
+ className: "flex flex-col gap-y-3 px-6 py-4",
845
+ children: [
846
+ /* @__PURE__ */ jsxs("div", {
847
+ className: "flex flex-col gap-y-2",
848
+ children: [/* @__PURE__ */ jsx(Label, {
849
+ size: "small",
850
+ children: t("channels.activeDriverLabel")
851
+ }), /* @__PURE__ */ jsxs(Select, {
852
+ size: "small",
853
+ value: whatsappDriverInput,
854
+ onValueChange: onWhatsappDriverChange,
855
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }), /* @__PURE__ */ jsxs(Select.Content, { children: [
856
+ /* @__PURE__ */ jsx(Select.Item, {
857
+ value: "meta-cloud",
858
+ children: t("channels.driverMetaCloud")
859
+ }),
860
+ /* @__PURE__ */ jsx(Select.Item, {
861
+ value: "openwa",
862
+ children: t("channels.driverOpenWa")
863
+ }),
864
+ /* @__PURE__ */ jsx(Select.Item, {
865
+ value: "waha",
866
+ children: t("channels.driverWaha")
867
+ }),
868
+ /* @__PURE__ */ jsx(Select.Item, {
869
+ value: "evolution",
870
+ children: t("channels.driverEvolution")
871
+ })
872
+ ] })]
873
+ })]
874
+ }),
875
+ /* @__PURE__ */ jsxs("div", {
876
+ className: "flex flex-col gap-y-2",
877
+ children: [/* @__PURE__ */ jsx(Label, {
878
+ size: "small",
879
+ children: t("channels.gatewayUrlLabel")
880
+ }), /* @__PURE__ */ jsx(Input, {
881
+ size: "small",
882
+ placeholder: "http://127.0.0.1:8082",
883
+ value: openWaUrlInput,
884
+ onChange: (e) => onOpenWaUrlChange(e.target.value)
885
+ })]
886
+ }),
887
+ /* @__PURE__ */ jsx("div", {
888
+ className: "flex justify-end",
889
+ children: /* @__PURE__ */ jsx(Button, {
890
+ size: "small",
891
+ variant: "primary",
892
+ type: "submit",
893
+ isLoading: isPending,
894
+ children: t("channels.saveWhatsappButton")
895
+ })
896
+ })
897
+ ]
898
+ })
899
+ })
900
+ ]
901
+ }), /* @__PURE__ */ jsxs(Container, {
902
+ className: "divide-y p-0",
903
+ children: [
904
+ /* @__PURE__ */ jsxs("div", {
905
+ className: "flex items-center justify-between px-6 py-4",
906
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Heading, {
907
+ level: "h2",
908
+ children: t("channels.telegramTitle")
909
+ }), /* @__PURE__ */ jsx(Text, {
910
+ className: "text-ui-fg-subtle text-xs mt-1",
911
+ children: t("channels.telegramSubtitle")
912
+ })] }), /* @__PURE__ */ jsx(StatusBadge, {
913
+ color: tgVerified ? "green" : "orange",
914
+ children: tgVerified ? t("channels.verifiedBadge") : t("channels.unverifiedBadge")
915
+ })]
916
+ }),
917
+ /* @__PURE__ */ jsx(SectionRow, {
918
+ title: t("channels.merchantChannelLabel"),
919
+ value: telegramChannelInput || "—"
920
+ }),
921
+ /* @__PURE__ */ jsxs("div", {
922
+ className: "flex flex-col gap-y-3 px-6 py-4",
923
+ children: [/* @__PURE__ */ jsxs("div", {
924
+ className: "flex flex-col gap-y-2",
925
+ children: [/* @__PURE__ */ jsx(Label, {
926
+ size: "small",
927
+ children: t("channels.merchantChannelLabel")
928
+ }), /* @__PURE__ */ jsx(Input, {
929
+ size: "small",
930
+ placeholder: t("channels.merchantChannelPlaceholder"),
931
+ value: telegramChannelInput,
932
+ onChange: (e) => onTelegramChannelChange(e.target.value)
933
+ })]
934
+ }), /* @__PURE__ */ jsxs("div", {
935
+ className: "flex justify-end gap-x-2",
936
+ children: [/* @__PURE__ */ jsx(Button, {
937
+ size: "small",
938
+ variant: "secondary",
939
+ isLoading: isPending,
940
+ onClick: () => onSaveOrVerify("telegram", "telegram-bot", { merchant_channel_id: telegramChannelInput }, "save"),
941
+ children: t("channels.saveChannelIdButton")
942
+ }), /* @__PURE__ */ jsx(Button, {
943
+ size: "small",
944
+ variant: "primary",
945
+ disabled: verifyCooldown,
946
+ isLoading: isPending,
947
+ onClick: () => onSaveOrVerify("telegram", "telegram-bot", { merchant_channel_id: telegramChannelInput }, "verify"),
948
+ children: t("channels.sendTestButton")
949
+ })]
950
+ })]
951
+ })
952
+ ]
953
+ })]
954
+ });
955
+ };
956
+ // src/admin/components/mpn/channels-side-section.tsx
957
+ var ChannelsSideSection = ({ smsDriverInput, isPending, onSmsDriverChange, onSaveSms }) => {
958
+ const { t } = useTranslation();
959
+ return /* @__PURE__ */ jsxs(Container, {
960
+ className: "divide-y p-0",
961
+ children: [
962
+ /* @__PURE__ */ jsxs("div", {
963
+ className: "flex items-center justify-between px-6 py-4",
964
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Heading, {
965
+ level: "h2",
966
+ children: t("channels.smsTitle")
967
+ }), /* @__PURE__ */ jsx(Text, {
968
+ className: "text-ui-fg-subtle text-xs mt-1",
969
+ children: t("channels.smsSubtitle")
970
+ })] }), /* @__PURE__ */ jsx(Badge, {
971
+ size: "2xsmall",
972
+ color: "blue",
973
+ children: smsDriverInput
974
+ })]
975
+ }),
976
+ /* @__PURE__ */ jsx(SectionRow, {
977
+ title: t("channels.smsDriverLabel"),
978
+ value: smsDriverInput
979
+ }),
980
+ /* @__PURE__ */ jsxs("div", {
981
+ className: "flex flex-col gap-y-3 px-6 py-4",
982
+ children: [/* @__PURE__ */ jsxs("div", {
983
+ className: "flex flex-col gap-y-2",
984
+ children: [/* @__PURE__ */ jsx(Label, {
985
+ size: "small",
986
+ children: t("channels.smsDriverLabel")
987
+ }), /* @__PURE__ */ jsxs(Select, {
988
+ size: "small",
989
+ value: smsDriverInput,
990
+ onValueChange: onSmsDriverChange,
991
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }), /* @__PURE__ */ jsxs(Select.Content, { children: [
992
+ /* @__PURE__ */ jsx(Select.Item, {
993
+ value: "twilio",
994
+ children: t("channels.driverTwilio")
995
+ }),
996
+ /* @__PURE__ */ jsx(Select.Item, {
997
+ value: "signalhouse",
998
+ children: t("channels.driverSignalHouse")
999
+ }),
1000
+ /* @__PURE__ */ jsx(Select.Item, {
1001
+ value: "msg91",
1002
+ children: t("channels.driverMsg91")
1003
+ }),
1004
+ /* @__PURE__ */ jsx(Select.Item, {
1005
+ value: "smsapi",
1006
+ children: t("channels.driverSmsApi")
1007
+ }),
1008
+ /* @__PURE__ */ jsx(Select.Item, {
1009
+ value: "dummy",
1010
+ children: t("channels.driverDummy")
1011
+ })
1012
+ ] })]
1013
+ })]
1014
+ }), /* @__PURE__ */ jsx("div", {
1015
+ className: "flex justify-end",
1016
+ children: /* @__PURE__ */ jsx(Button, {
1017
+ size: "small",
1018
+ variant: "primary",
1019
+ isLoading: isPending,
1020
+ onClick: onSaveSms,
1021
+ children: t("channels.saveSmsButton")
1022
+ })
1023
+ })]
1024
+ })
1025
+ ]
1026
+ });
1027
+ };
1028
+ // src/admin/components/mpn/channels-tab.tsx
1029
+ var ChannelsConfigTab = ({ channelsConfig, onRefresh, onStatus, section = "all" }) => {
1030
+ const { t } = useTranslation();
1031
+ const [telegramChannelInput, setTelegramChannelInput] = useState("");
1032
+ const [openWaUrlInput, setOpenWaUrlInput] = useState("");
1033
+ const [whatsappDriverInput, setWhatsappDriverInput] = useState("meta-cloud");
1034
+ const [smsDriverInput, setSmsDriverInput] = useState("twilio");
1035
+ const [verifyCooldown, setVerifyCooldown] = useState(false);
1036
+ const saveOrVerifyMutation = useSaveOrVerifyMpnChannel();
1037
+ useEffect(() => {
1038
+ const tg = channelsConfig.find((c) => c.channel === "telegram");
1039
+ if (tg?.config_json?.merchant_channel_id) setTelegramChannelInput(String(tg.config_json.merchant_channel_id));
1040
+ const wa = channelsConfig.find((c) => c.channel === "whatsapp");
1041
+ if (wa?.driver) setWhatsappDriverInput(String(wa.driver));
1042
+ if (wa?.config_json?.gateway_url) setOpenWaUrlInput(String(wa.config_json.gateway_url));
1043
+ const sms = channelsConfig.find((c) => c.channel === "sms");
1044
+ if (sms?.driver) setSmsDriverInput(String(sms.driver));
1045
+ }, [channelsConfig]);
1046
+ const handleSaveOrVerifyChannel = async (channel, driver, configJson, action) => {
1047
+ if (action === "verify") {
1048
+ setVerifyCooldown(true);
1049
+ setTimeout(() => setVerifyCooldown(false), 3e3);
1050
+ }
1051
+ try {
1052
+ await saveOrVerifyMutation.mutateAsync({
1053
+ channel,
1054
+ driver,
1055
+ config_json: configJson,
1056
+ action
1057
+ });
1058
+ const msg = action === "verify" ? t("messages.verifiedChannelSuccess", { channel }) : t("messages.savedChannelSuccess", { channel });
1059
+ toast.success(msg);
1060
+ onStatus?.({
1061
+ type: "success",
1062
+ text: msg
1063
+ });
1064
+ await onRefresh();
1065
+ } catch (err) {
1066
+ const msg = err?.message || t("messages.channelActionError", {
1067
+ action,
1068
+ channel
1069
+ });
1070
+ toast.error(msg);
1071
+ onStatus?.({
1072
+ type: "error",
1073
+ text: msg
1074
+ });
1075
+ }
1076
+ };
1077
+ const tgVerified = Boolean(channelsConfig.find((c) => c.channel === "telegram")?.is_verified);
1078
+ const mainCards = /* @__PURE__ */ jsx(ChannelsMainSection, {
1079
+ whatsappDriverInput,
1080
+ openWaUrlInput,
1081
+ telegramChannelInput,
1082
+ tgVerified,
1083
+ verifyCooldown,
1084
+ isPending: saveOrVerifyMutation.isPending,
1085
+ onWhatsappDriverChange: setWhatsappDriverInput,
1086
+ onOpenWaUrlChange: setOpenWaUrlInput,
1087
+ onTelegramChannelChange: setTelegramChannelInput,
1088
+ onSaveOrVerify: (ch, drv, cfg, act) => void handleSaveOrVerifyChannel(ch, drv, cfg, act)
1089
+ });
1090
+ const sideCard = /* @__PURE__ */ jsx(ChannelsSideSection, {
1091
+ smsDriverInput,
1092
+ isPending: saveOrVerifyMutation.isPending,
1093
+ onSmsDriverChange: setSmsDriverInput,
1094
+ onSaveSms: () => void handleSaveOrVerifyChannel("sms", smsDriverInput, {}, "save")
1095
+ });
1096
+ if (section === "main") return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(Toaster, {}), mainCards] });
1097
+ if (section === "side") return sideCard;
1098
+ return /* @__PURE__ */ jsxs("div", {
1099
+ className: "grid grid-cols-1 gap-4 lg:grid-cols-3",
1100
+ children: [
1101
+ /* @__PURE__ */ jsx(Toaster, {}),
1102
+ /* @__PURE__ */ jsx("div", {
1103
+ className: "lg:col-span-2",
1104
+ children: mainCards
1105
+ }),
1106
+ /* @__PURE__ */ jsx("div", { children: sideCard })
1107
+ ]
1108
+ });
1109
+ };
1110
+ var CHANNELS = [
1111
+ "email",
1112
+ "whatsapp",
1113
+ "telegram",
1114
+ "sms",
1115
+ "slack",
1116
+ "dummy"
1117
+ ];
1118
+ var BLOCK_TYPES = [
1119
+ "section",
1120
+ "heading",
1121
+ "text",
1122
+ "row",
1123
+ "separator",
1124
+ "group",
1125
+ "repeater",
1126
+ "product-item",
1127
+ "button",
1128
+ "actions",
1129
+ "divider",
1130
+ "attachment"
1131
+ ];
1132
+ var SUPPORTED_LOCALES = [
1133
+ "en",
1134
+ "es",
1135
+ "pl",
1136
+ "de",
1137
+ "fr",
1138
+ "pt",
1139
+ "it",
1140
+ "nl",
1141
+ "tr",
1142
+ "ar"
1143
+ ];
1144
+ var CONTEXT_TYPES = [
1145
+ "order",
1146
+ "shipment",
1147
+ "product",
1148
+ "inventory-level",
1149
+ "customer",
1150
+ "cart",
1151
+ "document",
1152
+ "otp",
1153
+ "custom"
1154
+ ];
1155
+ // src/admin/components/mpn/delivery-logs-tab.tsx
1156
+ var DeliveryLogsTab = ({ logs }) => {
1157
+ const { t } = useTranslation();
1158
+ return /* @__PURE__ */ jsxs(Container, {
1159
+ className: "divide-y p-0",
1160
+ children: [
1161
+ /* @__PURE__ */ jsx(Toaster, {}),
1162
+ /* @__PURE__ */ jsxs("div", {
1163
+ className: "flex items-center justify-between px-6 py-4",
1164
+ children: [/* @__PURE__ */ jsx(Heading, {
1165
+ level: "h2",
1166
+ children: t("logs.title")
1167
+ }), /* @__PURE__ */ jsx(StatusBadge, {
1168
+ color: "green",
1169
+ children: logs.length
1170
+ })]
1171
+ }),
1172
+ /* @__PURE__ */ jsx(SectionRow, {
1173
+ title: t("logs.colStatus"),
1174
+ value: logs.length
1175
+ }),
1176
+ /* @__PURE__ */ jsxs(Table, { children: [/* @__PURE__ */ jsx(Table.Header, { children: /* @__PURE__ */ jsxs(Table.Row, { children: [
1177
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("logs.colEvent") }),
1178
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("logs.colChannel") }),
1179
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("logs.colRecipient") }),
1180
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("logs.colStatus") }),
1181
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("logs.colExternalId") })
1182
+ ] }) }), /* @__PURE__ */ jsx(Table.Body, { children: logs.map((row) => /* @__PURE__ */ jsxs(Table.Row, { children: [
1183
+ /* @__PURE__ */ jsx(Table.Cell, { children: row.event_name }),
1184
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Badge, {
1185
+ size: "2xsmall",
1186
+ color: "blue",
1187
+ children: row.channel
1188
+ }) }),
1189
+ /* @__PURE__ */ jsx(Table.Cell, { children: row.recipient_masked }),
1190
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(StatusBadge, {
1191
+ color: row.status === "sent" || row.status === "delivered" ? "green" : row.status === "failed" ? "red" : "orange",
1192
+ children: row.status
1193
+ }) }),
1194
+ /* @__PURE__ */ jsx(Table.Cell, { children: row.external_message_id || "—" })
1195
+ ] }, row.id)) })] })
1196
+ ]
1197
+ });
1198
+ };
1199
+ // src/admin/components/mpn/event-mapping-form.tsx
1200
+ var EventMappingForm = ({ supportedEvents, templates, newMappingEvent, newMappingChannel, newMappingTemplateId, newMappingRecipientRule, newMappingAttachInvoice, newMappingThreadId, isSubmitting = false, onEventChange, onChannelChange, onTemplateChange, onRecipientRuleChange, onAttachInvoiceChange, onThreadIdChange, onSubmit }) => {
1201
+ const { t } = useTranslation();
1202
+ const form = useForm({ defaultValues: {
1203
+ event_name: newMappingEvent,
1204
+ channel: newMappingChannel,
1205
+ template_id: newMappingTemplateId,
1206
+ recipient_rule: newMappingRecipientRule,
1207
+ telegram_thread_id: newMappingThreadId,
1208
+ attach_invoice: newMappingAttachInvoice
1209
+ } });
1210
+ return /* @__PURE__ */ jsx(Form, {
1211
+ ...form,
1212
+ children: /* @__PURE__ */ jsxs(KeyboundForm, {
1213
+ onSubmit: (e) => {
1214
+ e.preventDefault();
1215
+ onSubmit();
1216
+ },
1217
+ className: "px-6 py-4",
1218
+ children: [/* @__PURE__ */ jsxs("div", {
1219
+ className: "grid grid-cols-1 gap-4 md:grid-cols-5",
1220
+ children: [
1221
+ /* @__PURE__ */ jsxs("div", {
1222
+ className: "flex flex-col gap-y-2",
1223
+ children: [/* @__PURE__ */ jsx(Label, {
1224
+ size: "small",
1225
+ children: t("mappings.eventLabel")
1226
+ }), /* @__PURE__ */ jsxs(Select, {
1227
+ size: "small",
1228
+ value: newMappingEvent,
1229
+ onValueChange: onEventChange,
1230
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }), /* @__PURE__ */ jsx(Select.Content, { children: supportedEvents.map((ev) => /* @__PURE__ */ jsx(Select.Item, {
1231
+ value: ev,
1232
+ children: ev
1233
+ }, ev)) })]
1234
+ })]
1235
+ }),
1236
+ /* @__PURE__ */ jsxs("div", {
1237
+ className: "flex flex-col gap-y-2",
1238
+ children: [/* @__PURE__ */ jsx(Label, {
1239
+ size: "small",
1240
+ children: t("mappings.channelLabel")
1241
+ }), /* @__PURE__ */ jsxs(Select, {
1242
+ size: "small",
1243
+ value: newMappingChannel,
1244
+ onValueChange: onChannelChange,
1245
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }), /* @__PURE__ */ jsx(Select.Content, { children: CHANNELS.map((ch) => /* @__PURE__ */ jsx(Select.Item, {
1246
+ value: ch,
1247
+ children: ch.toUpperCase()
1248
+ }, ch)) })]
1249
+ })]
1250
+ }),
1251
+ /* @__PURE__ */ jsxs("div", {
1252
+ className: "flex flex-col gap-y-2",
1253
+ children: [/* @__PURE__ */ jsx(Label, {
1254
+ size: "small",
1255
+ children: t("mappings.templateLabel")
1256
+ }), /* @__PURE__ */ jsxs(Select, {
1257
+ size: "small",
1258
+ value: newMappingTemplateId,
1259
+ onValueChange: onTemplateChange,
1260
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }), /* @__PURE__ */ jsx(Select.Content, { children: templates.map((tpl) => /* @__PURE__ */ jsxs(Select.Item, {
1261
+ value: tpl.id,
1262
+ children: [
1263
+ "[",
1264
+ tpl.channel,
1265
+ "] ",
1266
+ tpl.label
1267
+ ]
1268
+ }, tpl.id)) })]
1269
+ })]
1270
+ }),
1271
+ /* @__PURE__ */ jsxs("div", {
1272
+ className: "flex flex-col gap-y-2",
1273
+ children: [/* @__PURE__ */ jsx(Label, {
1274
+ size: "small",
1275
+ children: t("mappings.recipientRuleLabel")
1276
+ }), /* @__PURE__ */ jsxs(Select, {
1277
+ size: "small",
1278
+ value: newMappingRecipientRule,
1279
+ onValueChange: onRecipientRuleChange,
1280
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, {}) }), /* @__PURE__ */ jsxs(Select.Content, { children: [
1281
+ /* @__PURE__ */ jsx(Select.Item, {
1282
+ value: "customer_auto",
1283
+ children: t("mappings.ruleCustomerAuto")
1284
+ }),
1285
+ /* @__PURE__ */ jsx(Select.Item, {
1286
+ value: "order_email",
1287
+ children: t("mappings.ruleOrderEmail")
1288
+ }),
1289
+ /* @__PURE__ */ jsx(Select.Item, {
1290
+ value: "order_phone",
1291
+ children: t("mappings.ruleOrderPhone")
1292
+ }),
1293
+ /* @__PURE__ */ jsx(Select.Item, {
1294
+ value: "customer_telegram",
1295
+ children: t("mappings.ruleCustomerTelegram")
1296
+ }),
1297
+ /* @__PURE__ */ jsx(Select.Item, {
1298
+ value: "merchant_channel",
1299
+ children: t("mappings.ruleMerchantChannel")
1300
+ }),
1301
+ /* @__PURE__ */ jsx(Select.Item, {
1302
+ value: "b2b_accounting_contact",
1303
+ children: t("mappings.ruleB2bAccounting")
1304
+ })
1305
+ ] })]
1306
+ })]
1307
+ }),
1308
+ /* @__PURE__ */ jsxs("div", {
1309
+ className: "flex flex-col gap-y-2",
1310
+ children: [/* @__PURE__ */ jsx(Label, {
1311
+ size: "small",
1312
+ children: t("mappings.threadIdLabel")
1313
+ }), /* @__PURE__ */ jsx(Input, {
1314
+ size: "small",
1315
+ placeholder: t("mappings.threadIdPlaceholder"),
1316
+ value: newMappingThreadId,
1317
+ onChange: (e) => onThreadIdChange(e.target.value)
1318
+ })]
1319
+ })
1320
+ ]
1321
+ }), /* @__PURE__ */ jsxs("div", {
1322
+ className: "mt-4 flex items-center justify-between",
1323
+ children: [/* @__PURE__ */ jsxs("div", {
1324
+ className: "flex items-center gap-x-2",
1325
+ children: [/* @__PURE__ */ jsx(Switch, {
1326
+ checked: newMappingAttachInvoice,
1327
+ onCheckedChange: onAttachInvoiceChange
1328
+ }), /* @__PURE__ */ jsx(Label, {
1329
+ size: "small",
1330
+ children: t("mappings.attachInvoiceLabel")
1331
+ })]
1332
+ }), /* @__PURE__ */ jsx(Button, {
1333
+ size: "small",
1334
+ variant: "primary",
1335
+ type: "submit",
1336
+ isLoading: isSubmitting,
1337
+ children: t("mappings.addMappingButton")
1338
+ })]
1339
+ })]
1340
+ })
1341
+ });
1342
+ };
1343
+ // src/admin/components/mpn/event-mappings-tab.tsx
1344
+ var EventMappingsTab = ({ mappings, supportedEvents, templates, onRefresh, onStatus }) => {
1345
+ const { t } = useTranslation();
1346
+ const [newMappingEvent, setNewMappingEvent] = useState("order.placed");
1347
+ const [newMappingChannel, setNewMappingChannel] = useState("email");
1348
+ const [newMappingTemplateId, setNewMappingTemplateId] = useState("system_email_order_placed");
1349
+ const [newMappingRecipientRule, setNewMappingRecipientRule] = useState("customer_auto");
1350
+ const [newMappingAttachInvoice, setNewMappingAttachInvoice] = useState(false);
1351
+ const [newMappingThreadId, setNewMappingThreadId] = useState("");
1352
+ const createMappingMutation = useCreateMpnMapping();
1353
+ const deleteMappingMutation = useDeleteMpnMapping();
1354
+ const handleCreateMapping = async () => {
1355
+ try {
1356
+ await createMappingMutation.mutateAsync({
1357
+ event_name: newMappingEvent,
1358
+ channel: newMappingChannel,
1359
+ template_id: newMappingTemplateId,
1360
+ recipient_rule: newMappingRecipientRule,
1361
+ telegram_thread_id: newMappingThreadId ? Number(newMappingThreadId) : null,
1362
+ attach_document_types: newMappingAttachInvoice ? ["invoice"] : null,
1363
+ is_active: true
1364
+ });
1365
+ const msg = t("messages.createdMappingSuccess", {
1366
+ event: newMappingEvent,
1367
+ channel: newMappingChannel
1368
+ });
1369
+ toast.success(msg);
1370
+ onStatus?.({
1371
+ type: "success",
1372
+ text: msg
1373
+ });
1374
+ await onRefresh();
1375
+ } catch {
1376
+ const msg = t("messages.createMappingError");
1377
+ toast.error(msg);
1378
+ onStatus?.({
1379
+ type: "error",
1380
+ text: msg
1381
+ });
1382
+ }
1383
+ };
1384
+ const handleDeleteMapping = async (mappingId) => {
1385
+ try {
1386
+ await deleteMappingMutation.mutateAsync({ id: mappingId });
1387
+ await onRefresh();
1388
+ } catch {}
1389
+ };
1390
+ return /* @__PURE__ */ jsxs(Container, {
1391
+ className: "divide-y p-0",
1392
+ children: [
1393
+ /* @__PURE__ */ jsx(Toaster, {}),
1394
+ /* @__PURE__ */ jsxs("div", {
1395
+ className: "flex items-center justify-between px-6 py-4",
1396
+ children: [/* @__PURE__ */ jsx(Heading, {
1397
+ level: "h2",
1398
+ children: t("mappings.title")
1399
+ }), /* @__PURE__ */ jsx(StatusBadge, {
1400
+ color: "green",
1401
+ children: mappings.length
1402
+ })]
1403
+ }),
1404
+ /* @__PURE__ */ jsx(SectionRow, {
1405
+ title: t("mappings.eventLabel"),
1406
+ value: /* @__PURE__ */ jsx(Badge, {
1407
+ size: "2xsmall",
1408
+ color: "grey",
1409
+ children: supportedEvents.length
1410
+ })
1411
+ }),
1412
+ /* @__PURE__ */ jsx(EventMappingForm, {
1413
+ supportedEvents,
1414
+ templates,
1415
+ newMappingEvent,
1416
+ newMappingChannel,
1417
+ newMappingTemplateId,
1418
+ newMappingRecipientRule,
1419
+ newMappingAttachInvoice,
1420
+ newMappingThreadId,
1421
+ isSubmitting: createMappingMutation.isPending,
1422
+ onEventChange: setNewMappingEvent,
1423
+ onChannelChange: setNewMappingChannel,
1424
+ onTemplateChange: setNewMappingTemplateId,
1425
+ onRecipientRuleChange: setNewMappingRecipientRule,
1426
+ onAttachInvoiceChange: setNewMappingAttachInvoice,
1427
+ onThreadIdChange: setNewMappingThreadId,
1428
+ onSubmit: () => void handleCreateMapping()
1429
+ }),
1430
+ /* @__PURE__ */ jsxs(Table, { children: [/* @__PURE__ */ jsx(Table.Header, { children: /* @__PURE__ */ jsxs(Table.Row, { children: [
1431
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("mappings.colEvent") }),
1432
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("mappings.colChannel") }),
1433
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("mappings.colTemplate") }),
1434
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("mappings.colRecipientRule") }),
1435
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("mappings.colAttachments") }),
1436
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("mappings.colAction") })
1437
+ ] }) }), /* @__PURE__ */ jsx(Table.Body, { children: mappings.map((m) => /* @__PURE__ */ jsxs(Table.Row, { children: [
1438
+ /* @__PURE__ */ jsx(Table.Cell, { children: m.event_name }),
1439
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Badge, {
1440
+ size: "2xsmall",
1441
+ color: "blue",
1442
+ children: m.channel
1443
+ }) }),
1444
+ /* @__PURE__ */ jsx(Table.Cell, { children: m.template_id }),
1445
+ /* @__PURE__ */ jsx(Table.Cell, { children: m.recipient_rule }),
1446
+ /* @__PURE__ */ jsx(Table.Cell, { children: Array.isArray(m.attach_document_types) ? m.attach_document_types.join(", ") : "—" }),
1447
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Button, {
1448
+ size: "small",
1449
+ variant: "secondary",
1450
+ isLoading: deleteMappingMutation.isPending,
1451
+ onClick: () => void handleDeleteMapping(m.id),
1452
+ children: t("mappings.deleteButton")
1453
+ }) })
1454
+ ] }, m.id)) })] })
1455
+ ]
1456
+ });
1457
+ };
1458
+ // src/admin/components/mpn/overview-cards.tsx
1459
+ var StatCard = ({ title, value, icon, loading = false, onClick }) => {
1460
+ return /* @__PURE__ */ jsx(Container, {
1461
+ className: clx("p-0", onClick ? "cursor-pointer hover:bg-ui-bg-subtle-hover transition-colors" : ""),
1462
+ onClick,
1463
+ children: /* @__PURE__ */ jsxs("div", {
1464
+ className: "p-5",
1465
+ children: [/* @__PURE__ */ jsxs("div", {
1466
+ className: "flex items-center justify-between",
1467
+ children: [/* @__PURE__ */ jsx(Text, {
1468
+ className: "text-ui-fg-subtle",
1469
+ children: title
1470
+ }), /* @__PURE__ */ jsx("div", {
1471
+ className: "flex items-center justify-center w-8 h-8 rounded-md bg-ui-bg-subtle",
1472
+ children: icon
1473
+ })]
1474
+ }), /* @__PURE__ */ jsx("div", {
1475
+ className: "mt-3",
1476
+ children: loading ? /* @__PURE__ */ jsx(Skeleton, { className: "h-8 w-16" }) : /* @__PURE__ */ jsx(Heading, {
1477
+ level: "h2",
1478
+ children: value
1479
+ })
1480
+ })]
1481
+ })
1482
+ });
1483
+ };
1484
+ var NavigationCard = ({ icon, title, description, onClick, position }) => {
1485
+ return /* @__PURE__ */ jsx(Button, {
1486
+ type: "button",
1487
+ variant: "transparent",
1488
+ className: clx("h-auto w-full justify-start text-left p-6 hover:bg-ui-bg-subtle-hover transition-colors rounded-none", !(position === "bottom-left" || position === "bottom-right") ? "border-b border-ui-border-base" : "", position === "top-left" || position === "middle-left" || position === "bottom-left" ? "md:border-r md:border-ui-border-base" : ""),
1489
+ onClick,
1490
+ children: /* @__PURE__ */ jsxs("div", {
1491
+ className: "flex items-start gap-x-3",
1492
+ children: [/* @__PURE__ */ jsx("div", {
1493
+ className: "flex items-center justify-center w-8 h-8 rounded-md bg-ui-bg-subtle shrink-0",
1494
+ children: icon
1495
+ }), /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Heading, {
1496
+ level: "h3",
1497
+ children: title
1498
+ }), /* @__PURE__ */ jsx(Text, {
1499
+ className: "text-ui-fg-subtle mt-1",
1500
+ children: description
1501
+ })] })]
1502
+ })
1503
+ });
1504
+ };
1505
+ // src/admin/components/mpn/sandbox-tab.tsx
1506
+ var DummySandboxTab = ({ sandboxMessages, onRefresh }) => {
1507
+ const { t } = useTranslation();
1508
+ const clearSandboxMutation = useClearMpnSandbox();
1509
+ const handleClearSandbox = async () => {
1510
+ try {
1511
+ await clearSandboxMutation.mutateAsync();
1512
+ toast.success(t("sandbox.clearButton"));
1513
+ await onRefresh();
1514
+ } catch (err) {
1515
+ toast.error(err?.message || t("messages.loadStudioError"));
1516
+ }
1517
+ };
1518
+ return /* @__PURE__ */ jsxs(Container, {
1519
+ className: "divide-y p-0",
1520
+ children: [
1521
+ /* @__PURE__ */ jsx(Toaster, {}),
1522
+ /* @__PURE__ */ jsxs("div", {
1523
+ className: "flex items-center justify-between px-6 py-4",
1524
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Heading, {
1525
+ level: "h2",
1526
+ children: t("sandbox.title")
1527
+ }), /* @__PURE__ */ jsx(Text, {
1528
+ className: "text-ui-fg-subtle text-xs mt-1",
1529
+ children: t("sandbox.subtitle")
1530
+ })] }), /* @__PURE__ */ jsx(Button, {
1531
+ size: "small",
1532
+ variant: "secondary",
1533
+ isLoading: clearSandboxMutation.isPending,
1534
+ onClick: () => void handleClearSandbox(),
1535
+ children: t("sandbox.clearButton")
1536
+ })]
1537
+ }),
1538
+ /* @__PURE__ */ jsx(SectionRow, {
1539
+ title: t("sandbox.colOtp"),
1540
+ value: sandboxMessages.length
1541
+ }),
1542
+ /* @__PURE__ */ jsxs(Table, { children: [/* @__PURE__ */ jsx(Table.Header, { children: /* @__PURE__ */ jsxs(Table.Row, { children: [
1543
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("sandbox.colChannel") }),
1544
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("sandbox.colRecipient") }),
1545
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("sandbox.colOtp") }),
1546
+ /* @__PURE__ */ jsx(Table.HeaderCell, { children: t("sandbox.colBody") })
1547
+ ] }) }), /* @__PURE__ */ jsx(Table.Body, { children: sandboxMessages.map((msg) => /* @__PURE__ */ jsxs(Table.Row, { children: [
1548
+ /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Badge, {
1549
+ size: "2xsmall",
1550
+ color: "blue",
1551
+ children: msg.channel
1552
+ }) }),
1553
+ /* @__PURE__ */ jsx(Table.Cell, { children: msg.recipient }),
1554
+ /* @__PURE__ */ jsx(Table.Cell, { children: msg.otp_code ? /* @__PURE__ */ jsx(StatusBadge, {
1555
+ color: "green",
1556
+ children: msg.otp_code
1557
+ }) : "—" }),
1558
+ /* @__PURE__ */ jsx(Table.Cell, {
1559
+ className: "max-w-md truncate",
1560
+ children: msg.body
1561
+ })
1562
+ ] }, msg.id)) })] })
1563
+ ]
1564
+ });
1565
+ };
1566
+ // src/admin/components/mpn/template-preview-section.tsx
1567
+ var TemplatePreviewSection = ({ previewContextType, previewLocale, previewResult, onContextChange, onLocaleChange }) => {
1568
+ const { t } = useTranslation();
1569
+ return /* @__PURE__ */ jsxs("div", {
1570
+ className: "px-6 py-4",
1571
+ children: [/* @__PURE__ */ jsxs("div", {
1572
+ className: "mb-3 flex flex-wrap items-center justify-between gap-2",
1573
+ children: [/* @__PURE__ */ jsx(Heading, {
1574
+ level: "h3",
1575
+ children: t("templates.previewTitle", { locale: previewLocale.toUpperCase() })
1576
+ }), /* @__PURE__ */ jsxs("div", {
1577
+ className: "flex items-center gap-x-2",
1578
+ children: [/* @__PURE__ */ jsxs(Select, {
1579
+ size: "small",
1580
+ value: previewContextType,
1581
+ onValueChange: onContextChange,
1582
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, { placeholder: t("templates.contextPlaceholder") }) }), /* @__PURE__ */ jsx(Select.Content, { children: CONTEXT_TYPES.map((ct) => /* @__PURE__ */ jsx(Select.Item, {
1583
+ value: ct,
1584
+ children: ct
1585
+ }, ct)) })]
1586
+ }), /* @__PURE__ */ jsxs(Select, {
1587
+ size: "small",
1588
+ value: previewLocale,
1589
+ onValueChange: onLocaleChange,
1590
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, { placeholder: t("templates.localePlaceholder") }) }), /* @__PURE__ */ jsx(Select.Content, { children: SUPPORTED_LOCALES.map((loc) => /* @__PURE__ */ jsx(Select.Item, {
1591
+ value: loc,
1592
+ children: loc.toUpperCase()
1593
+ }, loc)) })]
1594
+ })]
1595
+ })]
1596
+ }), previewResult && /* @__PURE__ */ jsxs("div", {
1597
+ className: "rounded border border-ui-border-base bg-ui-bg-subtle p-4",
1598
+ children: [
1599
+ previewResult.subject && /* @__PURE__ */ jsx(Text, {
1600
+ className: "font-semibold mb-2",
1601
+ children: t("templates.subjectPrefix", { subject: previewResult.subject })
1602
+ }),
1603
+ previewResult.sms_options && /* @__PURE__ */ jsxs("div", {
1604
+ className: "mb-2 flex items-center gap-x-2",
1605
+ children: [/* @__PURE__ */ jsx(Badge, {
1606
+ size: "2xsmall",
1607
+ color: "green",
1608
+ children: t("templates.encodingBadge", { encoding: previewResult.sms_options.encoding })
1609
+ }), /* @__PURE__ */ jsx(Badge, {
1610
+ size: "2xsmall",
1611
+ color: "blue",
1612
+ children: t("templates.segmentsBadge", {
1613
+ segments: previewResult.sms_options.segments,
1614
+ chars: previewResult.sms_options.character_count
1615
+ })
1616
+ })]
1617
+ }),
1618
+ /* @__PURE__ */ jsx("pre", {
1619
+ className: "whitespace-pre-wrap text-xs font-mono",
1620
+ children: previewResult.text
1621
+ }),
1622
+ previewResult.whatsapp_options?.buttons?.length > 0 && /* @__PURE__ */ jsx("div", {
1623
+ className: "mt-3 flex gap-x-2",
1624
+ children: previewResult.whatsapp_options.buttons.map((btn) => /* @__PURE__ */ jsx(Badge, {
1625
+ size: "2xsmall",
1626
+ color: "green",
1627
+ children: t("templates.waButtonPrefix", { title: btn.title })
1628
+ }, btn.id))
1629
+ }),
1630
+ previewResult.telegram_options?.inline_keyboard?.length > 0 && /* @__PURE__ */ jsx("div", {
1631
+ className: "mt-3 flex gap-x-2",
1632
+ children: previewResult.telegram_options.inline_keyboard.flat().map((btn, i) => /* @__PURE__ */ jsx(Badge, {
1633
+ size: "2xsmall",
1634
+ color: "blue",
1635
+ children: t("templates.tgInlinePrefix", { text: btn.text })
1636
+ }, i))
1637
+ })
1638
+ ]
1639
+ })]
1640
+ });
1641
+ };
1642
+ // src/admin/components/mpn/template-editor-section.tsx
1643
+ var TemplateEditorSection = ({ selectedTemplate, selectedBlocks, previewContextType, previewLocale, previewResult, isSaving = false, onTemplateChange, onAddBlock, onRemoveBlock, onSaveTemplate, onContextChange, onLocaleChange }) => {
1644
+ const { t } = useTranslation();
1645
+ return /* @__PURE__ */ jsx(Container, {
1646
+ className: "divide-y p-0 lg:col-span-7",
1647
+ children: selectedTemplate ? /* @__PURE__ */ jsxs(Fragment, { children: [
1648
+ /* @__PURE__ */ jsxs("div", {
1649
+ className: "flex items-center justify-between px-6 py-4",
1650
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Heading, {
1651
+ level: "h2",
1652
+ children: selectedTemplate.label
1653
+ }), /* @__PURE__ */ jsxs(Text, {
1654
+ className: "text-ui-fg-subtle text-xs mt-1",
1655
+ children: [
1656
+ "ID: ",
1657
+ selectedTemplate.id,
1658
+ " (",
1659
+ selectedTemplate.channel,
1660
+ " /",
1661
+ " ",
1662
+ selectedTemplate.mode,
1663
+ ")"
1664
+ ]
1665
+ })] }), selectedTemplate.source === "db" && /* @__PURE__ */ jsx(Button, {
1666
+ size: "small",
1667
+ variant: "primary",
1668
+ isLoading: isSaving,
1669
+ onClick: onSaveTemplate,
1670
+ children: t("templates.saveButton")
1671
+ })]
1672
+ }),
1673
+ /* @__PURE__ */ jsx(SectionRow, {
1674
+ title: t("mappings.channelLabel"),
1675
+ value: /* @__PURE__ */ jsx(Badge, {
1676
+ size: "2xsmall",
1677
+ color: "blue",
1678
+ children: selectedTemplate.channel
1679
+ })
1680
+ }),
1681
+ selectedTemplate.source === "db" && /* @__PURE__ */ jsxs("div", {
1682
+ className: "grid grid-cols-1 gap-4 px-6 py-4 md:grid-cols-2",
1683
+ children: [/* @__PURE__ */ jsxs("div", {
1684
+ className: "flex flex-col gap-y-2",
1685
+ children: [/* @__PURE__ */ jsx(Label, {
1686
+ size: "small",
1687
+ children: t("templates.subjectLabel")
1688
+ }), /* @__PURE__ */ jsx(Input, {
1689
+ size: "small",
1690
+ value: selectedTemplate.subject || "",
1691
+ onChange: (e) => onTemplateChange({
1692
+ ...selectedTemplate,
1693
+ subject: e.target.value
1694
+ })
1695
+ })]
1696
+ }), /* @__PURE__ */ jsxs("div", {
1697
+ className: "flex flex-col gap-y-2",
1698
+ children: [/* @__PURE__ */ jsx(Label, {
1699
+ size: "small",
1700
+ children: t("templates.metaTemplateLabel")
1701
+ }), /* @__PURE__ */ jsx(Input, {
1702
+ size: "small",
1703
+ value: selectedTemplate.meta_template_name || "",
1704
+ onChange: (e) => onTemplateChange({
1705
+ ...selectedTemplate,
1706
+ meta_template_name: e.target.value
1707
+ })
1708
+ })]
1709
+ })]
1710
+ }),
1711
+ /* @__PURE__ */ jsx("div", {
1712
+ className: "px-6 py-4",
1713
+ children: selectedTemplate.mode === "raw" ? /* @__PURE__ */ jsxs("div", {
1714
+ className: "flex flex-col gap-y-2",
1715
+ children: [/* @__PURE__ */ jsx(Label, {
1716
+ size: "small",
1717
+ children: t("templates.rawContentLabel")
1718
+ }), /* @__PURE__ */ jsx(Textarea, {
1719
+ rows: 5,
1720
+ value: selectedTemplate.raw_content || "",
1721
+ disabled: selectedTemplate.source === "system",
1722
+ onChange: (e) => onTemplateChange({
1723
+ ...selectedTemplate,
1724
+ raw_content: e.target.value
1725
+ })
1726
+ })]
1727
+ }) : /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
1728
+ className: "mb-3 flex flex-wrap items-center justify-between gap-2",
1729
+ children: [/* @__PURE__ */ jsx(Label, {
1730
+ size: "small",
1731
+ children: t("templates.blockTreeLabel", { count: selectedBlocks.length })
1732
+ }), selectedTemplate.source === "db" && /* @__PURE__ */ jsx("div", {
1733
+ className: "flex flex-wrap gap-1",
1734
+ children: BLOCK_TYPES.slice(0, 6).map((bType) => /* @__PURE__ */ jsxs(Button, {
1735
+ size: "small",
1736
+ variant: "secondary",
1737
+ onClick: () => onAddBlock(bType),
1738
+ children: ["+ ", bType]
1739
+ }, bType))
1740
+ })]
1741
+ }), /* @__PURE__ */ jsx("div", {
1742
+ className: "flex flex-col gap-y-2",
1743
+ children: selectedBlocks.map((blk, idx) => /* @__PURE__ */ jsxs("div", {
1744
+ className: "flex items-center justify-between rounded border border-ui-border-base p-2.5",
1745
+ children: [/* @__PURE__ */ jsxs("div", {
1746
+ className: "flex items-center gap-x-2",
1747
+ children: [/* @__PURE__ */ jsx(Badge, {
1748
+ size: "2xsmall",
1749
+ color: "purple",
1750
+ children: blk.type
1751
+ }), /* @__PURE__ */ jsx(Text, {
1752
+ className: "text-xs",
1753
+ children: blk.metadata?.text || blk.metadata?.label || blk.metadata?.arrayKey || blk.metadata?.variant || "—"
1754
+ })]
1755
+ }), selectedTemplate.source === "db" && /* @__PURE__ */ jsx(Button, {
1756
+ size: "small",
1757
+ variant: "transparent",
1758
+ onClick: () => onRemoveBlock(idx),
1759
+ children: t("templates.removeBlock")
1760
+ })]
1761
+ }, blk.id || idx))
1762
+ })] })
1763
+ }),
1764
+ /* @__PURE__ */ jsx(TemplatePreviewSection, {
1765
+ templateId: selectedTemplate.id,
1766
+ previewContextType,
1767
+ previewLocale,
1768
+ previewResult,
1769
+ onContextChange,
1770
+ onLocaleChange
1771
+ })
1772
+ ] }) : /* @__PURE__ */ jsx("div", {
1773
+ className: "px-6 py-8",
1774
+ children: /* @__PURE__ */ jsx(Text, {
1775
+ className: "text-ui-fg-subtle",
1776
+ children: t("templates.emptySelection")
1777
+ })
1778
+ })
1779
+ });
1780
+ };
1781
+ // src/admin/components/mpn/templates-list-section.tsx
1782
+ var TemplatesListSection = ({ templates, channelFilter, onChannelFilterChange, onSelectTemplate, onClonePreset, isCloning = false }) => {
1783
+ const { t } = useTranslation();
1784
+ const filteredTemplates = templates.filter((tpl) => channelFilter === "all" ? true : tpl.channel === channelFilter);
1785
+ return /* @__PURE__ */ jsxs(Container, {
1786
+ className: "divide-y p-0 lg:col-span-5",
1787
+ children: [/* @__PURE__ */ jsxs("div", {
1788
+ className: "flex items-center justify-between px-6 py-4",
1789
+ children: [/* @__PURE__ */ jsx(Heading, {
1790
+ level: "h2",
1791
+ children: t("templates.title")
1792
+ }), /* @__PURE__ */ jsx("div", {
1793
+ className: "w-40",
1794
+ children: /* @__PURE__ */ jsxs(Select, {
1795
+ size: "small",
1796
+ value: channelFilter,
1797
+ onValueChange: onChannelFilterChange,
1798
+ children: [/* @__PURE__ */ jsx(Select.Trigger, { children: /* @__PURE__ */ jsx(Select.Value, { placeholder: t("templates.filterChannel") }) }), /* @__PURE__ */ jsxs(Select.Content, { children: [/* @__PURE__ */ jsx(Select.Item, {
1799
+ value: "all",
1800
+ children: t("templates.allChannels")
1801
+ }), CHANNELS.map((ch) => /* @__PURE__ */ jsx(Select.Item, {
1802
+ value: ch,
1803
+ children: ch.toUpperCase()
1804
+ }, ch))] })]
1805
+ })
1806
+ })]
1807
+ }), /* @__PURE__ */ jsx(Table, { children: /* @__PURE__ */ jsx(Table.Body, { children: filteredTemplates.map((tpl) => /* @__PURE__ */ jsxs(Table.Row, { children: [/* @__PURE__ */ jsxs(Table.Cell, {
1808
+ className: "py-3",
1809
+ children: [/* @__PURE__ */ jsxs("div", {
1810
+ className: "flex items-center gap-x-2",
1811
+ children: [
1812
+ /* @__PURE__ */ jsx(Badge, {
1813
+ size: "2xsmall",
1814
+ color: "blue",
1815
+ children: tpl.channel
1816
+ }),
1817
+ /* @__PURE__ */ jsx(StatusBadge, {
1818
+ color: tpl.source === "system" ? "grey" : "green",
1819
+ children: tpl.source
1820
+ }),
1821
+ /* @__PURE__ */ jsx(Text, {
1822
+ size: "small",
1823
+ weight: "plus",
1824
+ children: tpl.label
1825
+ })
1826
+ ]
1827
+ }), /* @__PURE__ */ jsxs(Text, {
1828
+ className: "text-ui-fg-subtle text-xs mt-1",
1829
+ children: [
1830
+ tpl.name,
1831
+ " ·",
1832
+ " ",
1833
+ t("templates.modeLabel", { mode: tpl.mode })
1834
+ ]
1835
+ })]
1836
+ }), /* @__PURE__ */ jsx(Table.Cell, {
1837
+ className: "py-3 text-right",
1838
+ children: /* @__PURE__ */ jsxs("div", {
1839
+ className: "flex items-center justify-end gap-x-2",
1840
+ children: [/* @__PURE__ */ jsx(Button, {
1841
+ size: "small",
1842
+ variant: "secondary",
1843
+ onClick: () => onSelectTemplate(tpl.id),
1844
+ children: t("templates.inspectPreview")
1845
+ }), tpl.source === "system" && /* @__PURE__ */ jsx(Button, {
1846
+ size: "small",
1847
+ variant: "primary",
1848
+ isLoading: isCloning,
1849
+ onClick: () => onClonePreset(tpl.id),
1850
+ children: t("templates.cloneToDb")
1851
+ })]
1852
+ })
1853
+ })] }, tpl.id)) }) })]
1854
+ });
1855
+ };
1856
+ // src/admin/components/mpn/templates-tab.tsx
1857
+ var TemplatesBuilderTab = ({ templates, onRefresh, onStatus }) => {
1858
+ const { t } = useTranslation();
1859
+ const [channelFilter, setChannelFilter] = useState("all");
1860
+ const [selectedTemplate, setSelectedTemplate] = useState(null);
1861
+ const [selectedBlocks, setSelectedBlocks] = useState([]);
1862
+ const [previewContextType, setPreviewContextType] = useState("order");
1863
+ const [previewLocale, setPreviewLocale] = useState("en");
1864
+ const [previewResult, setPreviewResult] = useState(null);
1865
+ const renderPreviewMutation = useRenderMpnTemplatePreview();
1866
+ const cloneTemplateMutation = useCreateOrCloneMpnTemplate();
1867
+ const updateTemplateMutation = useUpdateMpnTemplate();
1868
+ const handlePreviewTemplate = async (templateId, contextType, locale) => {
1869
+ try {
1870
+ const data = await renderPreviewMutation.mutateAsync({
1871
+ template_id: templateId,
1872
+ context_type: contextType,
1873
+ locale,
1874
+ append_sms_consent_footer: true
1875
+ });
1876
+ setPreviewResult(data.rendered || null);
1877
+ } catch {}
1878
+ };
1879
+ const handleSelectTemplate = async (templateId) => {
1880
+ try {
1881
+ const data = await notificationsAdminSdk.getTemplate(templateId);
1882
+ setSelectedTemplate(data.template || null);
1883
+ setSelectedBlocks(data.flat_blocks || []);
1884
+ await handlePreviewTemplate(templateId, previewContextType, previewLocale);
1885
+ } catch {}
1886
+ };
1887
+ const handleClonePresetToDb = async (presetId) => {
1888
+ try {
1889
+ const data = await cloneTemplateMutation.mutateAsync({ clone_from_preset_id: presetId });
1890
+ const msg = t("messages.clonedPresetSuccess", { label: data.template?.label || presetId });
1891
+ toast.success(msg);
1892
+ onStatus?.({
1893
+ type: "success",
1894
+ text: msg
1895
+ });
1896
+ await onRefresh();
1897
+ if (data.template?.id) await handleSelectTemplate(data.template.id);
1898
+ } catch {
1899
+ const msg = t("messages.clonePresetError");
1900
+ toast.error(msg);
1901
+ onStatus?.({
1902
+ type: "error",
1903
+ text: msg
1904
+ });
1905
+ }
1906
+ };
1907
+ const handleSaveDbTemplate = async () => {
1908
+ if (!selectedTemplate || selectedTemplate.source === "system") return;
1909
+ try {
1910
+ await updateTemplateMutation.mutateAsync({
1911
+ id: selectedTemplate.id,
1912
+ payload: {
1913
+ label: selectedTemplate.label,
1914
+ subject: selectedTemplate.subject,
1915
+ mode: selectedTemplate.mode,
1916
+ raw_content: selectedTemplate.raw_content,
1917
+ meta_template_name: selectedTemplate.meta_template_name,
1918
+ blocks: selectedBlocks
1919
+ }
1920
+ });
1921
+ const msg = t("messages.savedTemplateSuccess");
1922
+ toast.success(msg);
1923
+ onStatus?.({
1924
+ type: "success",
1925
+ text: msg
1926
+ });
1927
+ await handlePreviewTemplate(selectedTemplate.id, previewContextType, previewLocale);
1928
+ await onRefresh();
1929
+ } catch {
1930
+ const msg = t("messages.saveTemplateError");
1931
+ toast.error(msg);
1932
+ onStatus?.({
1933
+ type: "error",
1934
+ text: msg
1935
+ });
1936
+ }
1937
+ };
1938
+ const handleAddBlock = (type) => {
1939
+ const nextPos = selectedBlocks.length;
1940
+ setSelectedBlocks([...selectedBlocks, {
1941
+ id: `blk_${Date.now()}`,
1942
+ type,
1943
+ position: nextPos,
1944
+ parent_id: null,
1945
+ metadata: type === "row" ? {
1946
+ label: "Field",
1947
+ value: "{{data.total_formatted}}"
1948
+ } : type === "button" || type === "actions" ? {
1949
+ text: "View Order",
1950
+ url: "{{data.order_url}}"
1951
+ } : { text: "New content block ({{data.first_name}})" }
1952
+ }]);
1953
+ };
1954
+ return /* @__PURE__ */ jsxs("div", {
1955
+ className: "grid grid-cols-1 gap-4 lg:grid-cols-12",
1956
+ children: [
1957
+ /* @__PURE__ */ jsx(Toaster, {}),
1958
+ /* @__PURE__ */ jsx(TemplatesListSection, {
1959
+ templates,
1960
+ channelFilter,
1961
+ onChannelFilterChange: setChannelFilter,
1962
+ onSelectTemplate: (id) => void handleSelectTemplate(id),
1963
+ onClonePreset: (id) => void handleClonePresetToDb(id),
1964
+ isCloning: cloneTemplateMutation.isPending
1965
+ }),
1966
+ /* @__PURE__ */ jsx(TemplateEditorSection, {
1967
+ selectedTemplate,
1968
+ selectedBlocks,
1969
+ previewContextType,
1970
+ previewLocale,
1971
+ previewResult,
1972
+ isSaving: updateTemplateMutation.isPending,
1973
+ onTemplateChange: setSelectedTemplate,
1974
+ onAddBlock: handleAddBlock,
1975
+ onRemoveBlock: (idx) => setSelectedBlocks(selectedBlocks.filter((_, i) => i !== idx)),
1976
+ onSaveTemplate: () => void handleSaveDbTemplate(),
1977
+ onContextChange: (val) => {
1978
+ setPreviewContextType(val);
1979
+ if (selectedTemplate?.id) handlePreviewTemplate(selectedTemplate.id, val, previewLocale);
1980
+ },
1981
+ onLocaleChange: (loc) => {
1982
+ setPreviewLocale(loc);
1983
+ if (selectedTemplate?.id) handlePreviewTemplate(selectedTemplate.id, previewContextType, loc);
1984
+ }
1985
+ })
1986
+ ]
1987
+ });
1988
+ };
1989
+ // src/admin/components/mpn/use-notification-studio.ts
1990
+ function useNotificationStudio() {
1991
+ const { t } = useTranslation();
1992
+ const handleLoadError = useCallback(() => {
1993
+ toast.error(t("messages.loadStudioError"));
1994
+ }, [t]);
1995
+ const { data: tplData, isLoading: templatesLoading } = useMpnTemplates(void 0, { onError: handleLoadError });
1996
+ const { data: mapData, isLoading: mappingsLoading } = useMpnMappings({ onError: handleLoadError });
1997
+ const { data: chData, isLoading: channelsLoading } = useMpnChannels({ onError: handleLoadError });
1998
+ const { data: logData, isLoading: logsLoading } = useMpnLogs({ limit: 50 }, { onError: handleLoadError });
1999
+ const { data: brcData, isLoading: broadcastsLoading } = useMpnBroadcasts({ onError: handleLoadError });
2000
+ const { data: sbxData, isLoading: sandboxLoading } = useMpnSandboxMessages({ limit: 50 }, { onError: handleLoadError });
2001
+ const setStatusBanner = useCallback((status) => {
2002
+ if (!status) return;
2003
+ if (status.type === "success") toast.success(status.text);
2004
+ else toast.error(status.text);
2005
+ }, []);
2006
+ const loadAllStudioData = useCallback(async () => {
2007
+ invalidateNotificationsQueries(notificationsQueryKeys.all);
2008
+ }, []);
2009
+ return {
2010
+ isLoading: templatesLoading || mappingsLoading || channelsLoading || logsLoading || broadcastsLoading || sandboxLoading,
2011
+ statusBanner: null,
2012
+ setStatusBanner,
2013
+ templates: tplData?.templates || [],
2014
+ mappings: mapData?.mappings || [],
2015
+ supportedEvents: mapData?.supported_events || [],
2016
+ channelsConfig: chData?.channels || [],
2017
+ logs: logData?.logs || [],
2018
+ broadcasts: brcData?.broadcasts || [],
2019
+ consentSummary: brcData?.consent_summary || null,
2020
+ sandboxMessages: sbxData?.messages || [],
2021
+ loadAllStudioData
2022
+ };
2023
+ }
2024
+ // src/admin/components/rbac-guard.tsx
2025
+ var CACHE_TTL_MS = 3e4;
2026
+ var cachedResult = null;
2027
+ var inflightPromise = null;
2028
+ function matchRbacPermission(granted, required, isSuperAdmin = false) {
2029
+ if (isSuperAdmin || !required) return true;
2030
+ if (granted.includes("*") || granted.includes("*:*") || granted.includes(required)) return true;
2031
+ const sep = required.includes(".") ? "." : required.includes(":") ? ":" : null;
2032
+ if (sep) {
2033
+ const ns = required.split(sep)[0];
2034
+ if (granted.includes(`${ns}.*`) || granted.includes(`${ns}:*`)) return true;
2035
+ }
2036
+ return false;
2037
+ }
2038
+ async function fetchRbacMe() {
2039
+ if (cachedResult && Date.now() - cachedResult.fetchedAt < CACHE_TTL_MS) return cachedResult;
2040
+ if (inflightPromise) return inflightPromise;
2041
+ inflightPromise = (async () => {
2042
+ try {
2043
+ const res = await fetch("/admin/rbac/me", {
2044
+ credentials: "include",
2045
+ headers: { Accept: "application/json" }
2046
+ });
2047
+ if (res.status === 404) {
2048
+ cachedResult = {
2049
+ rbacActive: false,
2050
+ isSuperAdmin: false,
2051
+ permissions: [],
2052
+ fetchedAt: Date.now()
2053
+ };
2054
+ return cachedResult;
2055
+ }
2056
+ if (!res.ok) {
2057
+ cachedResult = {
2058
+ rbacActive: true,
2059
+ isSuperAdmin: false,
2060
+ permissions: [],
2061
+ fetchedAt: Date.now()
2062
+ };
2063
+ return cachedResult;
2064
+ }
2065
+ const data = await res.json();
2066
+ cachedResult = {
2067
+ rbacActive: true,
2068
+ isSuperAdmin: Boolean(data?.isSuperAdmin),
2069
+ permissions: Array.isArray(data?.permissions) ? data.permissions : [],
2070
+ fetchedAt: Date.now()
2071
+ };
2072
+ return cachedResult;
2073
+ } catch {
2074
+ cachedResult = {
2075
+ rbacActive: false,
2076
+ isSuperAdmin: false,
2077
+ permissions: [],
2078
+ fetchedAt: Date.now()
2079
+ };
2080
+ return cachedResult;
2081
+ } finally {
2082
+ inflightPromise = null;
2083
+ }
2084
+ })();
2085
+ return inflightPromise;
2086
+ }
2087
+ function useRbacAccess() {
2088
+ const [state, setState] = useState(() => cachedResult && Date.now() - cachedResult.fetchedAt < CACHE_TTL_MS ? cachedResult : null);
2089
+ useEffect(() => {
2090
+ let active = true;
2091
+ fetchRbacMe().then((res) => {
2092
+ if (active) setState(res);
2093
+ });
2094
+ return () => {
2095
+ active = false;
2096
+ };
2097
+ }, []);
2098
+ if (!state) return {
2099
+ isLoading: true,
2100
+ rbacActive: false,
2101
+ hasPermission: () => false
2102
+ };
2103
+ return {
2104
+ isLoading: false,
2105
+ rbacActive: state.rbacActive,
2106
+ hasPermission: (permission) => {
2107
+ if (!state.rbacActive || !permission) return true;
2108
+ return matchRbacPermission(state.permissions, permission, state.isSuperAdmin);
2109
+ }
2110
+ };
2111
+ }
2112
+ var RbacGuard = ({ permission, children, hideOnDenied = false }) => {
2113
+ const { isLoading, hasPermission } = useRbacAccess();
2114
+ if (isLoading) return null;
2115
+ if (!hasPermission(permission)) {
2116
+ if (hideOnDenied) return null;
2117
+ return /* @__PURE__ */ jsxs(Container, {
2118
+ className: "flex flex-col gap-y-2 p-6",
2119
+ children: [/* @__PURE__ */ jsx(Heading, {
2120
+ level: "h2",
2121
+ children: "Access denied"
2122
+ }), /* @__PURE__ */ jsxs(Text, {
2123
+ size: "small",
2124
+ className: "text-ui-fg-subtle",
2125
+ children: [
2126
+ "You do not have permission to view this section. (",
2127
+ permission,
2128
+ ")"
2129
+ ]
2130
+ })]
2131
+ });
2132
+ }
2133
+ return /* @__PURE__ */ jsx(Fragment, { children });
2134
+ };
2135
+ // src/admin/routes/mpn/page.tsx
2136
+ var NotificationStudioOverviewPage = () => {
2137
+ const { t, i18n } = useTranslation();
2138
+ const navigate = useNavigate();
2139
+ const { isLoading, templates, mappings, logs, sandboxMessages, loadAllStudioData } = useNotificationStudio();
2140
+ const isRtl = (i18n.resolvedLanguage || i18n.language || "").startsWith("ar");
2141
+ const handleRefresh = async () => {
2142
+ try {
2143
+ await loadAllStudioData();
2144
+ toast.success(t("header.refresh"));
2145
+ } catch {
2146
+ toast.error(t("messages.loadStudioError"));
2147
+ }
2148
+ };
2149
+ return /* @__PURE__ */ jsx(LayoutComposer, {
2150
+ widgetsZonePrefix: "mpn.overview",
2151
+ preferredLayoutId: CORE_LAYOUT_IDS.SINGLE_COLUMN,
2152
+ sections: { main: /* @__PURE__ */ jsx(LayoutComposer.Entry, {
2153
+ id: "MpnOverviewDashboard",
2154
+ children: /* @__PURE__ */ jsxs("div", {
2155
+ className: "flex flex-col gap-y-4",
2156
+ dir: isRtl ? "rtl" : "ltr",
2157
+ children: [
2158
+ /* @__PURE__ */ jsx(Toaster, {}),
2159
+ /* @__PURE__ */ jsxs("div", {
2160
+ className: "flex flex-wrap items-center justify-between gap-4",
2161
+ children: [/* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsx(Heading, {
2162
+ className: "font-sans font-medium h1-core",
2163
+ children: t("header.title")
2164
+ }), /* @__PURE__ */ jsx(Text, {
2165
+ className: "text-ui-fg-subtle mt-1",
2166
+ children: t("header.subtitle")
2167
+ })] }), /* @__PURE__ */ jsxs(Button, {
2168
+ size: "small",
2169
+ variant: "secondary",
2170
+ onClick: () => void handleRefresh(),
2171
+ children: [/* @__PURE__ */ jsx(ArrowPath, {}), t("header.refresh")]
2172
+ })]
2173
+ }),
2174
+ /* @__PURE__ */ jsxs("div", {
2175
+ className: "grid grid-cols-1 md:grid-cols-2 xl:grid-cols-4 gap-4",
2176
+ children: [
2177
+ /* @__PURE__ */ jsx(StatCard, {
2178
+ title: t("templates.title"),
2179
+ value: templates.length,
2180
+ icon: /* @__PURE__ */ jsx(DocumentText, {}),
2181
+ loading: isLoading,
2182
+ onClick: () => navigate("/mpn/templates")
2183
+ }),
2184
+ /* @__PURE__ */ jsx(StatCard, {
2185
+ title: t("mappings.title"),
2186
+ value: mappings.length,
2187
+ icon: /* @__PURE__ */ jsx(Tag, {}),
2188
+ loading: isLoading,
2189
+ onClick: () => navigate("/mpn/mappings")
2190
+ }),
2191
+ /* @__PURE__ */ jsx(StatCard, {
2192
+ title: t("logs.title"),
2193
+ value: logs.length,
2194
+ icon: /* @__PURE__ */ jsx(CheckCircle, {}),
2195
+ loading: isLoading,
2196
+ onClick: () => navigate("/mpn/logs")
2197
+ }),
2198
+ /* @__PURE__ */ jsx(StatCard, {
2199
+ title: t("sandbox.title"),
2200
+ value: sandboxMessages.length,
2201
+ icon: /* @__PURE__ */ jsx(EnvelopeSolid, {}),
2202
+ loading: isLoading,
2203
+ onClick: () => navigate("/mpn/sandbox")
2204
+ })
2205
+ ]
2206
+ }),
2207
+ /* @__PURE__ */ jsxs(Container, {
2208
+ className: "p-0 overflow-hidden",
2209
+ children: [/* @__PURE__ */ jsxs("div", {
2210
+ className: "px-6 py-5 border-b border-ui-border-base",
2211
+ children: [/* @__PURE__ */ jsx(Heading, {
2212
+ level: "h2",
2213
+ children: t("nav.label")
2214
+ }), /* @__PURE__ */ jsx(Text, {
2215
+ className: "text-ui-fg-subtle mt-1",
2216
+ children: t("header.subtitle")
2217
+ })]
2218
+ }), /* @__PURE__ */ jsxs("div", {
2219
+ className: "grid grid-cols-1 md:grid-cols-2",
2220
+ children: [
2221
+ /* @__PURE__ */ jsx(NavigationCard, {
2222
+ icon: /* @__PURE__ */ jsx(DocumentText, {}),
2223
+ title: t("tabs.templates", { count: templates.length }),
2224
+ description: t("templates.emptySelection"),
2225
+ onClick: () => navigate("/mpn/templates"),
2226
+ position: "top-left"
2227
+ }),
2228
+ /* @__PURE__ */ jsx(NavigationCard, {
2229
+ icon: /* @__PURE__ */ jsx(Tag, {}),
2230
+ title: t("tabs.mappings", { count: mappings.length }),
2231
+ description: t("mappings.title"),
2232
+ onClick: () => navigate("/mpn/mappings"),
2233
+ position: "top-right"
2234
+ }),
2235
+ /* @__PURE__ */ jsx(NavigationCard, {
2236
+ icon: /* @__PURE__ */ jsx(CogSixTooth, {}),
2237
+ title: t("tabs.channels"),
2238
+ description: t("channels.whatsappSubtitle"),
2239
+ onClick: () => navigate("/mpn/channels"),
2240
+ position: "middle-left"
2241
+ }),
2242
+ /* @__PURE__ */ jsx(NavigationCard, {
2243
+ icon: /* @__PURE__ */ jsx(CheckCircle, {}),
2244
+ title: t("tabs.logs", { count: logs.length }),
2245
+ description: t("logs.title"),
2246
+ onClick: () => navigate("/mpn/logs"),
2247
+ position: "middle-right"
2248
+ }),
2249
+ /* @__PURE__ */ jsx(NavigationCard, {
2250
+ icon: /* @__PURE__ */ jsx(Megaphone, {}),
2251
+ title: t("tabs.broadcasts"),
2252
+ description: t("broadcasts.title"),
2253
+ onClick: () => navigate("/mpn/broadcasts"),
2254
+ position: "bottom-left"
2255
+ }),
2256
+ /* @__PURE__ */ jsx(NavigationCard, {
2257
+ icon: /* @__PURE__ */ jsx(EnvelopeSolid, {}),
2258
+ title: t("tabs.sandbox", { count: sandboxMessages.length }),
2259
+ description: t("sandbox.subtitle"),
2260
+ onClick: () => navigate("/mpn/sandbox"),
2261
+ position: "bottom-right"
2262
+ })
2263
+ ]
2264
+ })]
2265
+ })
2266
+ ]
2267
+ })
2268
+ }) }
2269
+ });
2270
+ };
2271
+ var Breadcrumb$6 = () => {
2272
+ const { t } = useTranslation();
2273
+ return t("nav.label");
2274
+ };
2275
+ var config$6 = defineRouteConfig({
2276
+ label: "Notifications",
2277
+ translationNs: "mpn",
2278
+ icon: ChatBubbleLeftRight
2279
+ });
2280
+ var handle$6 = { breadcrumb: () => /* @__PURE__ */ jsx(Breadcrumb$6, {}) };
2281
+ var GuardedNotificationStudioOverviewPage = () => /* @__PURE__ */ jsx(RbacGuard, {
2282
+ permission: "notifications.read",
2283
+ children: /* @__PURE__ */ jsx(NotificationStudioOverviewPage, {})
2284
+ });
2285
+ // src/admin/routes/mpn/channels/page.tsx
2286
+ var MpnChannelsPage = () => {
2287
+ const { channelsConfig, loadAllStudioData, setStatusBanner } = useNotificationStudio();
2288
+ return /* @__PURE__ */ jsx(LayoutComposer, {
2289
+ widgetsZonePrefix: "mpn.channels",
2290
+ preferredLayoutId: CORE_LAYOUT_IDS.TWO_COLUMN,
2291
+ sections: {
2292
+ main: /* @__PURE__ */ jsx(LayoutComposer.Entry, {
2293
+ id: "MpnChannelsMainSection",
2294
+ children: /* @__PURE__ */ jsx(ChannelsConfigTab, {
2295
+ channelsConfig,
2296
+ onRefresh: loadAllStudioData,
2297
+ onStatus: setStatusBanner,
2298
+ section: "main"
2299
+ })
2300
+ }),
2301
+ side: /* @__PURE__ */ jsx(LayoutComposer.Entry, {
2302
+ id: "MpnChannelsSideSection",
2303
+ children: /* @__PURE__ */ jsx(ChannelsConfigTab, {
2304
+ channelsConfig,
2305
+ onRefresh: loadAllStudioData,
2306
+ onStatus: setStatusBanner,
2307
+ section: "side"
2308
+ })
2309
+ })
2310
+ }
2311
+ });
2312
+ };
2313
+ var Breadcrumb$5 = () => {
2314
+ const { t } = useTranslation();
2315
+ return t("tabs.channels");
2316
+ };
2317
+ var config$5 = defineRouteConfig({
2318
+ label: "Channels",
2319
+ translationNs: "mpn",
2320
+ icon: CogSixTooth
2321
+ });
2322
+ var handle$5 = { breadcrumb: () => /* @__PURE__ */ jsx(Breadcrumb$5, {}) };
2323
+ var GuardedMpnChannelsPage = () => /* @__PURE__ */ jsx(RbacGuard, {
2324
+ permission: "notifications.read",
2325
+ children: /* @__PURE__ */ jsx(MpnChannelsPage, {})
2326
+ });
2327
+ // src/admin/routes/mpn/broadcasts/page.tsx
2328
+ var MpnBroadcastsPage = () => {
2329
+ const { broadcasts, consentSummary, templates, loadAllStudioData, setStatusBanner } = useNotificationStudio();
2330
+ return /* @__PURE__ */ jsx(LayoutComposer, {
2331
+ widgetsZonePrefix: "mpn.broadcasts",
2332
+ preferredLayoutId: CORE_LAYOUT_IDS.TWO_COLUMN,
2333
+ sections: {
2334
+ main: /* @__PURE__ */ jsx(LayoutComposer.Entry, {
2335
+ id: "MpnBroadcastsMainSection",
2336
+ children: /* @__PURE__ */ jsx(BroadcastsConsentTab, {
2337
+ broadcasts,
2338
+ consentSummary,
2339
+ templates,
2340
+ onRefresh: loadAllStudioData,
2341
+ onStatus: setStatusBanner,
2342
+ section: "main"
2343
+ })
2344
+ }),
2345
+ side: /* @__PURE__ */ jsx(LayoutComposer.Entry, {
2346
+ id: "MpnBroadcastsSideSection",
2347
+ children: /* @__PURE__ */ jsx(BroadcastsConsentTab, {
2348
+ broadcasts,
2349
+ consentSummary,
2350
+ templates,
2351
+ onRefresh: loadAllStudioData,
2352
+ onStatus: setStatusBanner,
2353
+ section: "side"
2354
+ })
2355
+ })
2356
+ }
2357
+ });
2358
+ };
2359
+ var Breadcrumb$4 = () => {
2360
+ const { t } = useTranslation();
2361
+ return t("tabs.broadcasts");
2362
+ };
2363
+ var config$4 = defineRouteConfig({
2364
+ label: "Broadcasts",
2365
+ translationNs: "mpn",
2366
+ icon: Megaphone
2367
+ });
2368
+ var handle$4 = { breadcrumb: () => /* @__PURE__ */ jsx(Breadcrumb$4, {}) };
2369
+ var GuardedMpnBroadcastsPage = () => /* @__PURE__ */ jsx(RbacGuard, {
2370
+ permission: "notifications.read",
2371
+ children: /* @__PURE__ */ jsx(MpnBroadcastsPage, {})
2372
+ });
2373
+ // src/admin/routes/mpn/logs/page.tsx
2374
+ var MpnLogsPage = () => {
2375
+ const { logs } = useNotificationStudio();
2376
+ return /* @__PURE__ */ jsx(LayoutComposer, {
2377
+ widgetsZonePrefix: "mpn.logs",
2378
+ preferredLayoutId: CORE_LAYOUT_IDS.SINGLE_COLUMN,
2379
+ sections: { main: /* @__PURE__ */ jsx(LayoutComposer.Entry, {
2380
+ id: "MpnLogsSection",
2381
+ children: /* @__PURE__ */ jsx(DeliveryLogsTab, { logs })
2382
+ }) }
2383
+ });
2384
+ };
2385
+ var Breadcrumb$3 = () => {
2386
+ const { t } = useTranslation();
2387
+ return t("logs.title");
2388
+ };
2389
+ var config$3 = defineRouteConfig({
2390
+ label: "Delivery Logs",
2391
+ translationNs: "mpn",
2392
+ icon: CheckCircle
2393
+ });
2394
+ var handle$3 = { breadcrumb: () => /* @__PURE__ */ jsx(Breadcrumb$3, {}) };
2395
+ var GuardedMpnLogsPage = () => /* @__PURE__ */ jsx(RbacGuard, {
2396
+ permission: "notifications.read",
2397
+ children: /* @__PURE__ */ jsx(MpnLogsPage, {})
2398
+ });
2399
+ // src/admin/routes/mpn/mappings/page.tsx
2400
+ var MpnMappingsPage = () => {
2401
+ const { mappings, supportedEvents, templates, loadAllStudioData, setStatusBanner } = useNotificationStudio();
2402
+ return /* @__PURE__ */ jsx(LayoutComposer, {
2403
+ widgetsZonePrefix: "mpn.mappings",
2404
+ preferredLayoutId: CORE_LAYOUT_IDS.SINGLE_COLUMN,
2405
+ sections: { main: /* @__PURE__ */ jsx(LayoutComposer.Entry, {
2406
+ id: "MpnMappingsSection",
2407
+ children: /* @__PURE__ */ jsx(EventMappingsTab, {
2408
+ mappings,
2409
+ supportedEvents,
2410
+ templates,
2411
+ onRefresh: loadAllStudioData,
2412
+ onStatus: setStatusBanner
2413
+ })
2414
+ }) }
2415
+ });
2416
+ };
2417
+ var Breadcrumb$2 = () => {
2418
+ const { t } = useTranslation();
2419
+ return t("mappings.title");
2420
+ };
2421
+ var config$2 = defineRouteConfig({
2422
+ label: "Event Mappings",
2423
+ translationNs: "mpn",
2424
+ icon: Tag
2425
+ });
2426
+ var handle$2 = { breadcrumb: () => /* @__PURE__ */ jsx(Breadcrumb$2, {}) };
2427
+ var GuardedMpnMappingsPage = () => /* @__PURE__ */ jsx(RbacGuard, {
2428
+ permission: "notifications.read",
2429
+ children: /* @__PURE__ */ jsx(MpnMappingsPage, {})
2430
+ });
2431
+ // src/admin/routes/mpn/sandbox/page.tsx
2432
+ var MpnSandboxPage = () => {
2433
+ const { sandboxMessages, loadAllStudioData } = useNotificationStudio();
2434
+ return /* @__PURE__ */ jsx(LayoutComposer, {
2435
+ widgetsZonePrefix: "mpn.sandbox",
2436
+ preferredLayoutId: CORE_LAYOUT_IDS.SINGLE_COLUMN,
2437
+ sections: { main: /* @__PURE__ */ jsx(LayoutComposer.Entry, {
2438
+ id: "MpnSandboxSection",
2439
+ children: /* @__PURE__ */ jsx(DummySandboxTab, {
2440
+ sandboxMessages,
2441
+ onRefresh: loadAllStudioData
2442
+ })
2443
+ }) }
2444
+ });
2445
+ };
2446
+ var Breadcrumb$1 = () => {
2447
+ const { t } = useTranslation();
2448
+ return t("sandbox.title");
2449
+ };
2450
+ var config$1 = defineRouteConfig({
2451
+ label: "OTP Sandbox",
2452
+ translationNs: "mpn",
2453
+ icon: EnvelopeSolid
2454
+ });
2455
+ var handle$1 = { breadcrumb: () => /* @__PURE__ */ jsx(Breadcrumb$1, {}) };
2456
+ var GuardedMpnSandboxPage = () => /* @__PURE__ */ jsx(RbacGuard, {
2457
+ permission: "notifications.read",
2458
+ children: /* @__PURE__ */ jsx(MpnSandboxPage, {})
2459
+ });
2460
+ // src/admin/routes/mpn/templates/page.tsx
2461
+ var MpnTemplatesPage = () => {
2462
+ const { templates, loadAllStudioData, setStatusBanner } = useNotificationStudio();
2463
+ return /* @__PURE__ */ jsx(LayoutComposer, {
2464
+ widgetsZonePrefix: "mpn.templates",
2465
+ preferredLayoutId: CORE_LAYOUT_IDS.SINGLE_COLUMN,
2466
+ sections: { main: /* @__PURE__ */ jsx(LayoutComposer.Entry, {
2467
+ id: "MpnTemplatesSection",
2468
+ children: /* @__PURE__ */ jsx(TemplatesBuilderTab, {
2469
+ templates,
2470
+ onRefresh: loadAllStudioData,
2471
+ onStatus: setStatusBanner
2472
+ })
2473
+ }) }
2474
+ });
2475
+ };
2476
+ var Breadcrumb = () => {
2477
+ const { t } = useTranslation();
2478
+ return t("templates.title");
2479
+ };
2480
+ var config = defineRouteConfig({
2481
+ label: "Templates",
2482
+ translationNs: "mpn",
2483
+ icon: DocumentText
2484
+ });
2485
+ var handle = { breadcrumb: () => /* @__PURE__ */ jsx(Breadcrumb, {}) };
2486
+ var GuardedMpnTemplatesPage = () => /* @__PURE__ */ jsx(RbacGuard, {
2487
+ permission: "notifications.read",
2488
+ children: /* @__PURE__ */ jsx(MpnTemplatesPage, {})
2489
+ });
2490
+ // src/admin/i18n/index.ts
2491
+ var i18n_default = {
2492
+ ar: { translation: {
2493
+ nav: { "label": "الإشعارات" },
2494
+ header: {
2495
+ "title": "استوديو الإشعارات متعدد القنوات (البريد، واتساب/OpenWA، تيليجرام، SMS، سلاك)",
2496
+ "subtitle": "منشئ القوالب والكتل المرئية، ربط أحداث المتجر، بوابات الإرسال المتعددة، سجل الموافقات، وبيئة اختبار رموز التحقق OTP.",
2497
+ "languageLabel": "اللغة",
2498
+ "refresh": "تحديث الاستوديو",
2499
+ "successBadge": "نجاح",
2500
+ "errorBadge": "خطأ"
2501
+ },
2502
+ tabs: {
2503
+ "templates": "القوالب والمنشئ المرئي ({{count}})",
2504
+ "mappings": "ربط الأحداث ({{count}})",
2505
+ "channels": "القنوات (OpenWA / تيليجرام / SMS)",
2506
+ "logs": "سجلات التسليم ({{count}})",
2507
+ "broadcasts": "الحملات وسجل الموافقات",
2508
+ "sandbox": "صندوق اختبار OTP ({{count}})"
2509
+ },
2510
+ templates: {
2511
+ "title": "القوالب",
2512
+ "filterChannel": "تصفية حسب القناة",
2513
+ "allChannels": "جميع القنوات",
2514
+ "modeLabel": "الوضع: {{mode}}",
2515
+ "inspectPreview": "فحص / معاينة",
2516
+ "cloneToDb": "نسخ لقاعدة البيانات",
2517
+ "saveButton": "حفظ القالب والكتل",
2518
+ "subjectLabel": "عنوان الرسالة (البريد / الموضوع)",
2519
+ "metaTemplateLabel": "اسم قالب Meta WABA (واتساب الرسمي)",
2520
+ "rawContentLabel": "محتوى القالب النصي (يدعم {{data.*}} و {{translations.*}} و {{ .var }})",
2521
+ "blockTreeLabel": "شجرة الكتل المرئية ({{count}} كتل)",
2522
+ "removeBlock": "حذف",
2523
+ "previewTitle": "معاينة مباشرة متعددة القنوات ({{locale}})",
2524
+ "contextPlaceholder": "السياق",
2525
+ "localePlaceholder": "اللغة",
2526
+ "subjectPrefix": "الموضوع: {{subject}}",
2527
+ "encodingBadge": "الترميز: {{encoding}}",
2528
+ "segmentsBadge": "المقاطع: {{segments}} ({{chars}} حرف)",
2529
+ "waButtonPrefix": "[زر واتساب] {{title}}",
2530
+ "tgInlinePrefix": "[زر تيليجرام] {{text}}",
2531
+ "emptySelection": "اختر قالباً من القائمة لاستعراض شجرة الكتل أو نسخ قالب نظام أو معاينة المخرجات بجميع اللغات."
2532
+ },
2533
+ mappings: {
2534
+ "title": "إنشاء ربط: حدث ← قناة ← قالب",
2535
+ "eventLabel": "حدث متجر Medusa",
2536
+ "channelLabel": "القناة",
2537
+ "templateLabel": "القالب",
2538
+ "recipientRuleLabel": "قاعدة المستلم",
2539
+ "ruleCustomerAuto": "العميل تلقائياً",
2540
+ "ruleOrderEmail": "بريد الطلب",
2541
+ "ruleOrderPhone": "هاتف الطلب (E.164)",
2542
+ "ruleCustomerTelegram": "تيليجرام العميل المباشر",
2543
+ "ruleMerchantChannel": "قناة / مجموعة المتجر",
2544
+ "ruleB2bAccounting": "مسؤول المحاسبة B2B",
2545
+ "threadIdLabel": "معرّف موضوع تيليجرام Thread ID (اختياري)",
2546
+ "threadIdPlaceholder": "مثال: 42",
2547
+ "attachInvoiceLabel": "إرفاق فاتورة PDF تلقائياً من medusa-documents-plugin (للبريد وواتساب/OpenWA وتيليجرام)",
2548
+ "addMappingButton": "إضافة ربط نشط",
2549
+ "colEvent": "الحدث",
2550
+ "colChannel": "القناة",
2551
+ "colTemplate": "القالب",
2552
+ "colRecipientRule": "قاعدة المستلم",
2553
+ "colAttachments": "المرفقات",
2554
+ "colAction": "إجراء",
2555
+ "deleteButton": "حذف"
2556
+ },
2557
+ channels: {
2558
+ "whatsappTitle": "بوابة واتساب و OpenWA",
2559
+ "whatsappSubtitle": "التبديل بين واجهة Meta Cloud الرسمية (قوالب WABA) أو البوابات المستضافة ذاتياً OpenWA / WAHA / Evolution API.",
2560
+ "activeDriverLabel": "المشغّل النشط",
2561
+ "driverMetaCloud": "Meta Cloud API (واتساب الرسمي)",
2562
+ "driverOpenWa": "OpenWA (@open-wa/wa-automate REST)",
2563
+ "driverWaha": "WAHA (WhatsApp HTTP API)",
2564
+ "driverEvolution": "Evolution API v2",
2565
+ "gatewayUrlLabel": "رابط بوابة OpenWA / WAHA / Evolution",
2566
+ "saveWhatsappButton": "حفظ مشغّل واتساب",
2567
+ "telegramTitle": "إشعارات تيليجرام",
2568
+ "verifiedBadge": "موثّق",
2569
+ "unverifiedBadge": "غير موثّق",
2570
+ "telegramSubtitle": "إعداد المجموعة الفائقة للمتجر (-100... أو @channel). تغيير المعرّف يعيد ضبط التوثيق حتى تنجح رسالة الاختبار.",
2571
+ "merchantChannelLabel": "معرّف قناة / مجموعة المتجر",
2572
+ "merchantChannelPlaceholder": "-1001234567890 أو @my_store_alerts",
2573
+ "saveChannelIdButton": "حفظ معرّف القناة",
2574
+ "sendTestButton": "إرسال رسالة تجريبية",
2575
+ "smsTitle": "مشغّل الرسائل النصية SMS",
2576
+ "smsSubtitle": "اختر Twilio SMS/MMS أو Signal House (10DLC) أو MSG91 Flow أو SMSAPI أو بيئة الاختبار.",
2577
+ "smsDriverLabel": "مشغّل SMS",
2578
+ "driverTwilio": "Twilio (SMS / MMS + خدمة الرسائل)",
2579
+ "driverSignalHouse": "Signal House (10DLC واستعادة السلة)",
2580
+ "driverMsg91": "MSG91 Flow API",
2581
+ "driverSmsApi": "SMSAPI",
2582
+ "driverDummy": "بيئة اختبار OTP محلية",
2583
+ "saveSmsButton": "حفظ مشغّل SMS"
2584
+ },
2585
+ logs: {
2586
+ "title": "سجل التسليم المحمي (إخفاء البيانات الشخصية ومنع التكرار)",
2587
+ "colEvent": "الحدث",
2588
+ "colChannel": "القناة",
2589
+ "colRecipient": "المستلم (مخفي جزئياً)",
2590
+ "colStatus": "الحالة",
2591
+ "colExternalId": "المعرّف الخارجي"
2592
+ },
2593
+ broadcasts: {
2594
+ "title": "ملخص الموافقات (TCPA / 10DLC) وحملات البث للعملاء",
2595
+ "smsOptedIn": "مشتركو SMS: {{count}}",
2596
+ "whatsappOptedIn": "مشتركو واتساب: {{count}}",
2597
+ "telegramLinked": "تيليجرام مرتبط: {{count}}",
2598
+ "optedOut": "ألغوا الاشتراك (STOP): {{count}}",
2599
+ "campaignNameLabel": "اسم الحملة",
2600
+ "campaignNamePlaceholder": "عروض نهاية الأسبوع",
2601
+ "channelLabel": "القناة",
2602
+ "templateLabel": "القالب",
2603
+ "sendNowButton": "إرسال الحملة الآن",
2604
+ "colCampaign": "الحملة",
2605
+ "colChannel": "القناة",
2606
+ "colStatus": "الحالة",
2607
+ "colSentTotal": "المرسل / الإجمالي"
2608
+ },
2609
+ sandbox: {
2610
+ "title": "بيئة الاختبار المحلية للرسائل ورموز التحقق OTP",
2611
+ "subtitle": "التقاط رموز التحقق OTP وإشعارات الاختبار محلياً دون إرسال رسائل فعلية عبر شركات الاتصالات.",
2612
+ "clearButton": "مسح الرسائل الملتقطة",
2613
+ "colChannel": "القناة",
2614
+ "colRecipient": "المستلم",
2615
+ "colOtp": "رمز OTP المستخرج",
2616
+ "colBody": "نص الرسالة"
2617
+ },
2618
+ widget: {
2619
+ "title": "إشعارات الطلب متعددة القنوات ({{count}})",
2620
+ "subtitle": "إرسال أو إعادة إرسال بريد إلكتروني أو واتساب/OpenWA أو تيليجرام أو SMS لهذا الطلب (مع إرفاق فاتورة PDF اختيارياً).",
2621
+ "channelPlaceholder": "القناة",
2622
+ "templatePlaceholder": "القالب",
2623
+ "attachInvoiceLabel": "إرفاق فاتورة PDF (إن وجدت)",
2624
+ "sending": "جارٍ الإرسال...",
2625
+ "sendResendButton": "إرسال / إعادة إرسال الإشعار",
2626
+ "dispatchedSuccess": "تم إرسال إشعار {{channel}} بنجاح",
2627
+ "dispatchFailed": "تعذر إرسال الإشعار",
2628
+ "colChannel": "القناة",
2629
+ "colEventTemplate": "الحدث / القالب",
2630
+ "colRecipient": "المستلم",
2631
+ "colStatus": "الحالة"
2632
+ },
2633
+ messages: {
2634
+ "loadStudioError": "تعذر تحميل بيانات استوديو الإشعارات.",
2635
+ "clonedPresetSuccess": "تم نسخ القالب الافتراضي إلى قالب قابل للتعديل '{{label}}'.",
2636
+ "clonePresetError": "تعذر نسخ القالب الافتراضي.",
2637
+ "savedTemplateSuccess": "تم حفظ القالب وشجرة الكتل بنجاح.",
2638
+ "saveTemplateError": "تعذر حفظ القالب.",
2639
+ "createdMappingSuccess": "تم إنشاء ربط نشط للحدث '{{event}}' ← '{{channel}}'.",
2640
+ "createMappingError": "تعذر إنشاء ربط الحدث.",
2641
+ "verifiedChannelSuccess": "تم توثيق قناة '{{channel}}' وإرسال رسالة تجريبية.",
2642
+ "savedChannelSuccess": "تم حفظ إعدادات قناة '{{channel}}'.",
2643
+ "channelActionError": "فشل إجراء {{action}} لقناة {{channel}}",
2644
+ "broadcastSentSuccess": "تم إطلاق حملة البث للمستلمين المشتركين."
2645
+ }
2646
+ } },
2647
+ de: { translation: {
2648
+ nav: { "label": "Benachrichtigungen" },
2649
+ header: {
2650
+ "title": "Multi-Channel-Benachrichtigungsstudio (E-Mail, WhatsApp/OpenWA, Telegram, SMS, Slack)",
2651
+ "subtitle": "Visueller Block- & Raw-Vorlagen-Editor, DB-Ereigniszuordnungen, Multi-Driver-Gateways, Einwilligungsregister und Dummy-OTP-Sandbox.",
2652
+ "languageLabel": "Sprache",
2653
+ "refresh": "Studio aktualisieren",
2654
+ "successBadge": "ERFOLG",
2655
+ "errorBadge": "FEHLER"
2656
+ },
2657
+ tabs: {
2658
+ "templates": "Vorlagen & Visueller Editor ({{count}})",
2659
+ "mappings": "Ereigniszuordnungen ({{count}})",
2660
+ "channels": "Kanäle (OpenWA / Telegram / SMS)",
2661
+ "logs": "Zustellprotokolle ({{count}})",
2662
+ "broadcasts": "Broadcasts & Einwilligungen",
2663
+ "sandbox": "Dummy-OTP-Sandbox ({{count}})"
2664
+ },
2665
+ templates: {
2666
+ "title": "Vorlagen",
2667
+ "filterChannel": "Kanal filtern",
2668
+ "allChannels": "Alle Kanäle",
2669
+ "modeLabel": "Modus: {{mode}}",
2670
+ "inspectPreview": "Prüfen / Vorschau",
2671
+ "cloneToDb": "In DB klonen",
2672
+ "saveButton": "Vorlage & Blöcke speichern",
2673
+ "subjectLabel": "Betreffzeile (E-Mail / Titel)",
2674
+ "metaTemplateLabel": "Meta WABA-Vorlagenname (WhatsApp Cloud)",
2675
+ "rawContentLabel": "Raw-Vorlageninhalt (unterstützt {{data.*}}, {{translations.*}} und {{ .var }})",
2676
+ "blockTreeLabel": "Visueller Blockbaum ({{count}} Blöcke)",
2677
+ "removeBlock": "Entfernen",
2678
+ "previewTitle": "Live-Multi-Channel-Vorschau ({{locale}})",
2679
+ "contextPlaceholder": "Kontext",
2680
+ "localePlaceholder": "Sprache",
2681
+ "subjectPrefix": "Betreff: {{subject}}",
2682
+ "encodingBadge": "Kodierung: {{encoding}}",
2683
+ "segmentsBadge": "Segmente: {{segments}} ({{chars}} Zeichen)",
2684
+ "waButtonPrefix": "[WA-Button] {{title}}",
2685
+ "tgInlinePrefix": "[TG-Inline] {{text}}",
2686
+ "emptySelection": "Wählen Sie links eine Vorlage aus, um den Blockbaum zu prüfen, eine Systemvorlage zu klonen oder die Vorschau anzuzeigen."
2687
+ },
2688
+ mappings: {
2689
+ "title": "Ereignis → Kanal → Vorlagen-Zuordnung erstellen",
2690
+ "eventLabel": "Medusa Store-Ereignis",
2691
+ "channelLabel": "Kanal",
2692
+ "templateLabel": "Vorlage",
2693
+ "recipientRuleLabel": "Empfängerregel",
2694
+ "ruleCustomerAuto": "Kunde Automatisch",
2695
+ "ruleOrderEmail": "Bestell-E-Mail",
2696
+ "ruleOrderPhone": "Bestelltelefon (E.164)",
2697
+ "ruleCustomerTelegram": "Kunden-Telegram-DM",
2698
+ "ruleMerchantChannel": "Händlerkanal / Gruppe",
2699
+ "ruleB2bAccounting": "B2B-Buchhaltungskontakt",
2700
+ "threadIdLabel": "Telegram-Thema Thread-ID (Optional)",
2701
+ "threadIdPlaceholder": "z. B. 42",
2702
+ "attachInvoiceLabel": "PDF-Rechnung aus medusa-documents-plugin automatisch anhängen (E-Mail, WhatsApp/OpenWA & Telegram)",
2703
+ "addMappingButton": "Aktive Zuordnung hinzufügen",
2704
+ "colEvent": "Ereignis",
2705
+ "colChannel": "Kanal",
2706
+ "colTemplate": "Vorlage",
2707
+ "colRecipientRule": "Empfängerregel",
2708
+ "colAttachments": "Anhänge",
2709
+ "colAction": "Aktion",
2710
+ "deleteButton": "Löschen"
2711
+ },
2712
+ channels: {
2713
+ "whatsappTitle": "WhatsApp & OpenWA Gateway",
2714
+ "whatsappSubtitle": "Wechseln Sie zwischen der offiziellen Meta Cloud API (WABA-Vorlagen) und selbst gehostetem OpenWA / WAHA / Evolution API.",
2715
+ "activeDriverLabel": "Aktiver Treiber",
2716
+ "driverMetaCloud": "Meta Cloud API (Offizielles WABA)",
2717
+ "driverOpenWa": "OpenWA (@open-wa/wa-automate REST)",
2718
+ "driverWaha": "WAHA (WhatsApp HTTP API)",
2719
+ "driverEvolution": "Evolution API v2",
2720
+ "gatewayUrlLabel": "OpenWA / WAHA / Evolution Gateway-URL",
2721
+ "saveWhatsappButton": "WhatsApp-Treiber speichern",
2722
+ "telegramTitle": "Telegram-Benachrichtigungen",
2723
+ "verifiedBadge": "Verifiziert",
2724
+ "unverifiedBadge": "Nicht verifiziert",
2725
+ "telegramSubtitle": "Konfigurieren Sie die Händler-Supergruppe (-100... oder @kanal). Das Ändern der ID setzt die Verifizierung zurück.",
2726
+ "merchantChannelLabel": "Händlerkanal / Supergruppen-ID",
2727
+ "merchantChannelPlaceholder": "-1001234567890 oder @my_store_alerts",
2728
+ "saveChannelIdButton": "Kanal-ID speichern",
2729
+ "sendTestButton": "Testnachricht senden",
2730
+ "smsTitle": "SMS-Anbietertreiber",
2731
+ "smsSubtitle": "Wählen Sie Twilio SMS/MMS, Signal House (10DLC), MSG91 Flow, SMSAPI oder Dummy-Sandbox.",
2732
+ "smsDriverLabel": "SMS-Treiber",
2733
+ "driverTwilio": "Twilio (SMS / MMS + Messaging Service)",
2734
+ "driverSignalHouse": "Signal House (10DLC & Warenkorbrettung)",
2735
+ "driverMsg91": "MSG91 Flow API",
2736
+ "driverSmsApi": "SMSAPI",
2737
+ "driverDummy": "Dummy-OTP-Sandbox (Test)",
2738
+ "saveSmsButton": "SMS-Treiber speichern"
2739
+ },
2740
+ logs: {
2741
+ "title": "Geschwärztes Zustellprotokoll (PII-maskiert & Idempotent)",
2742
+ "colEvent": "Ereignis",
2743
+ "colChannel": "Kanal",
2744
+ "colRecipient": "Empfänger (Maskiert)",
2745
+ "colStatus": "Status",
2746
+ "colExternalId": "Externe ID"
2747
+ },
2748
+ broadcasts: {
2749
+ "title": "TCPA / 10DLC Einwilligungsübersicht & Kundengruppen-Broadcasts",
2750
+ "smsOptedIn": "SMS Opt-In: {{count}}",
2751
+ "whatsappOptedIn": "WhatsApp Opt-In: {{count}}",
2752
+ "telegramLinked": "Telegram Verknüpft: {{count}}",
2753
+ "optedOut": "Abgemeldet (STOP): {{count}}",
2754
+ "campaignNameLabel": "Kampagnenname",
2755
+ "campaignNamePlaceholder": "Wochenend-Flash-Sale",
2756
+ "channelLabel": "Kanal",
2757
+ "templateLabel": "Vorlage",
2758
+ "sendNowButton": "Broadcast jetzt senden",
2759
+ "colCampaign": "Kampagne",
2760
+ "colChannel": "Kanal",
2761
+ "colStatus": "Status",
2762
+ "colSentTotal": "Gesendet / Gesamt"
2763
+ },
2764
+ sandbox: {
2765
+ "title": "Dummy-SMS / OTP & Multi-Channel-Sandbox",
2766
+ "subtitle": "Erfasst OTP-Verifizierungscodes und Testbenachrichtigungen lokal ohne echten Versand.",
2767
+ "clearButton": "Erfasste Nachrichten löschen",
2768
+ "colChannel": "Kanal",
2769
+ "colRecipient": "Empfänger",
2770
+ "colOtp": "Extrahierter OTP",
2771
+ "colBody": "Nachrichtentext"
2772
+ },
2773
+ widget: {
2774
+ "title": "Multi-Channel-Bestellbenachrichtigungen ({{count}})",
2775
+ "subtitle": "Senden oder wiederholen Sie E-Mail, WhatsApp/OpenWA, Telegram oder SMS für diese Bestellung (optional mit PDF-Rechnung).",
2776
+ "channelPlaceholder": "Kanal",
2777
+ "templatePlaceholder": "Vorlage",
2778
+ "attachInvoiceLabel": "PDF-Rechnung anhängen (falls vorhanden)",
2779
+ "sending": "Wird gesendet...",
2780
+ "sendResendButton": "Benachrichtigung senden / erneut senden",
2781
+ "dispatchedSuccess": "{{channel}}-Benachrichtigung gesendet",
2782
+ "dispatchFailed": "Benachrichtigung konnte nicht gesendet werden",
2783
+ "colChannel": "Kanal",
2784
+ "colEventTemplate": "Ereignis / Vorlage",
2785
+ "colRecipient": "Empfänger",
2786
+ "colStatus": "Status"
2787
+ },
2788
+ messages: {
2789
+ "loadStudioError": "Notification Studio-Daten konnten nicht geladen werden.",
2790
+ "clonedPresetSuccess": "Systemvorlage in bearbeitbare DB-Vorlage '{{label}}' geklont.",
2791
+ "clonePresetError": "Systemvorlage konnte nicht geklont werden.",
2792
+ "savedTemplateSuccess": "Vorlage & Blockbaum gespeichert.",
2793
+ "saveTemplateError": "Vorlage konnte nicht gespeichert werden.",
2794
+ "createdMappingSuccess": "Aktive Zuordnung für '{{event}}' -> '{{channel}}' erstellt.",
2795
+ "createMappingError": "Ereigniszuordnung konnte nicht erstellt werden.",
2796
+ "verifiedChannelSuccess": "Kanal '{{channel}}' verifiziert und Testnachricht gesendet.",
2797
+ "savedChannelSuccess": "Konfiguration für '{{channel}}' gespeichert.",
2798
+ "channelActionError": "Aktion {{action}} für {{channel}} fehlgeschlagen",
2799
+ "broadcastSentSuccess": "Broadcast-Kampagne an Opt-In-Empfänger gesendet."
2800
+ }
2801
+ } },
2802
+ en: { translation: {
2803
+ nav: { "label": "Notifications" },
2804
+ header: {
2805
+ "title": "Multi-Channel Notification Studio (Email, WhatsApp/OpenWA, Telegram, SMS, Slack)",
2806
+ "subtitle": "Visual Block & Raw Template Builder, DB Event Mappings, Multi-Driver Gateways, Consent Ledger, and Dummy OTP Sandbox.",
2807
+ "languageLabel": "Language",
2808
+ "refresh": "Refresh Studio",
2809
+ "successBadge": "SUCCESS",
2810
+ "errorBadge": "ERROR"
2811
+ },
2812
+ tabs: {
2813
+ "templates": "Templates & Visual Builder ({{count}})",
2814
+ "mappings": "Event Mappings ({{count}})",
2815
+ "channels": "Channels (OpenWA / Telegram / SMS)",
2816
+ "logs": "Delivery Logs ({{count}})",
2817
+ "broadcasts": "Broadcasts & Consent Ledger",
2818
+ "sandbox": "Dummy OTP Sandbox ({{count}})"
2819
+ },
2820
+ templates: {
2821
+ "title": "Templates",
2822
+ "filterChannel": "Filter Channel",
2823
+ "allChannels": "All Channels",
2824
+ "modeLabel": "Mode: {{mode}}",
2825
+ "inspectPreview": "Inspect / Preview",
2826
+ "cloneToDb": "Clone to DB",
2827
+ "saveButton": "Save Template & Blocks",
2828
+ "subjectLabel": "Subject Line (Email / Title)",
2829
+ "metaTemplateLabel": "Meta WABA Template Name (WhatsApp Cloud)",
2830
+ "rawContentLabel": "Raw Template Content (supports {{data.*}}, {{translations.*}}, and {{ .var }})",
2831
+ "blockTreeLabel": "Visual Block Tree ({{count}} blocks)",
2832
+ "removeBlock": "Remove",
2833
+ "previewTitle": "Live Multi-Channel Preview ({{locale}})",
2834
+ "contextPlaceholder": "Context",
2835
+ "localePlaceholder": "Locale",
2836
+ "subjectPrefix": "Subject: {{subject}}",
2837
+ "encodingBadge": "Encoding: {{encoding}}",
2838
+ "segmentsBadge": "Segments: {{segments}} ({{chars}} chars)",
2839
+ "waButtonPrefix": "[WA Button] {{title}}",
2840
+ "tgInlinePrefix": "[TG Inline] {{text}}",
2841
+ "emptySelection": "Select a template on the left to inspect its block tree, clone a system preset, or preview its rendered output across locales."
2842
+ },
2843
+ mappings: {
2844
+ "title": "Create Event → Channel → Template Mapping",
2845
+ "eventLabel": "Medusa Store Event",
2846
+ "channelLabel": "Channel",
2847
+ "templateLabel": "Template",
2848
+ "recipientRuleLabel": "Recipient Rule",
2849
+ "ruleCustomerAuto": "Customer Auto",
2850
+ "ruleOrderEmail": "Order Email",
2851
+ "ruleOrderPhone": "Order Phone (E.164)",
2852
+ "ruleCustomerTelegram": "Customer Telegram DM",
2853
+ "ruleMerchantChannel": "Merchant Channel / Group",
2854
+ "ruleB2bAccounting": "B2B Accounting Contact",
2855
+ "threadIdLabel": "Telegram Topic Thread ID (Optional)",
2856
+ "threadIdPlaceholder": "e.g. 42",
2857
+ "attachInvoiceLabel": "Auto-attach PDF Invoice from medusa-documents-plugin (Email, WhatsApp/OpenWA & Telegram)",
2858
+ "addMappingButton": "Add Active Mapping",
2859
+ "colEvent": "Event",
2860
+ "colChannel": "Channel",
2861
+ "colTemplate": "Template",
2862
+ "colRecipientRule": "Recipient Rule",
2863
+ "colAttachments": "Attachments",
2864
+ "colAction": "Action",
2865
+ "deleteButton": "Delete"
2866
+ },
2867
+ channels: {
2868
+ "whatsappTitle": "WhatsApp & OpenWA Gateway",
2869
+ "whatsappSubtitle": "Switch between Official Meta Cloud API (WABA Templates) and self-hosted OpenWA / WAHA / Evolution API.",
2870
+ "activeDriverLabel": "Active Driver",
2871
+ "driverMetaCloud": "Meta Cloud API (Official WABA)",
2872
+ "driverOpenWa": "OpenWA (@open-wa/wa-automate REST)",
2873
+ "driverWaha": "WAHA (WhatsApp HTTP API)",
2874
+ "driverEvolution": "Evolution API v2",
2875
+ "gatewayUrlLabel": "OpenWA / WAHA / Evolution Gateway URL",
2876
+ "saveWhatsappButton": "Save WhatsApp Driver",
2877
+ "telegramTitle": "Telegram Notifications",
2878
+ "verifiedBadge": "Verified",
2879
+ "unverifiedBadge": "Unverified",
2880
+ "telegramSubtitle": "Configure Merchant Supergroup (-100... or @channel). Changing the channel ID resets verification until a test message succeeds.",
2881
+ "merchantChannelLabel": "Merchant Channel / Supergroup ID",
2882
+ "merchantChannelPlaceholder": "-1001234567890 or @my_store_alerts",
2883
+ "saveChannelIdButton": "Save Channel ID",
2884
+ "sendTestButton": "Send Test Message",
2885
+ "smsTitle": "SMS Carrier Driver",
2886
+ "smsSubtitle": "Select Twilio SMS/MMS, Signal House (10DLC), MSG91 Flow, SMSAPI, or Dummy Sandbox.",
2887
+ "smsDriverLabel": "SMS Driver",
2888
+ "driverTwilio": "Twilio (SMS / MMS + Messaging Service)",
2889
+ "driverSignalHouse": "Signal House (10DLC & Cart Recovery)",
2890
+ "driverMsg91": "MSG91 Flow API",
2891
+ "driverSmsApi": "SMSAPI",
2892
+ "driverDummy": "Dummy OTP Sandbox (Testing)",
2893
+ "saveSmsButton": "Save SMS Driver"
2894
+ },
2895
+ logs: {
2896
+ "title": "Redacted Delivery Ledger (PII Masked & Idempotent)",
2897
+ "colEvent": "Event",
2898
+ "colChannel": "Channel",
2899
+ "colRecipient": "Recipient (Masked)",
2900
+ "colStatus": "Status",
2901
+ "colExternalId": "External ID"
2902
+ },
2903
+ broadcasts: {
2904
+ "title": "TCPA / 10DLC Consent Summary & Customer Group Broadcasts",
2905
+ "smsOptedIn": "SMS Opted-In: {{count}}",
2906
+ "whatsappOptedIn": "WhatsApp Opted-In: {{count}}",
2907
+ "telegramLinked": "Telegram Linked: {{count}}",
2908
+ "optedOut": "Opted-Out (STOP): {{count}}",
2909
+ "campaignNameLabel": "Campaign Name",
2910
+ "campaignNamePlaceholder": "Weekend Flash Sale",
2911
+ "channelLabel": "Channel",
2912
+ "templateLabel": "Template",
2913
+ "sendNowButton": "Send Broadcast Now",
2914
+ "colCampaign": "Campaign",
2915
+ "colChannel": "Channel",
2916
+ "colStatus": "Status",
2917
+ "colSentTotal": "Sent / Total"
2918
+ },
2919
+ sandbox: {
2920
+ "title": "Dummy SMS / OTP & Multi-Channel Sandbox",
2921
+ "subtitle": "Captures OTP verification codes and test notifications locally without sending real carrier messages.",
2922
+ "clearButton": "Clear Captured Messages",
2923
+ "colChannel": "Channel",
2924
+ "colRecipient": "Recipient",
2925
+ "colOtp": "Extracted OTP",
2926
+ "colBody": "Message Body"
2927
+ },
2928
+ widget: {
2929
+ "title": "Multi-Channel Order Notifications ({{count}})",
2930
+ "subtitle": "Send or resend Email, WhatsApp/OpenWA, Telegram, or SMS for this order (with optional PDF invoice attachment).",
2931
+ "channelPlaceholder": "Channel",
2932
+ "templatePlaceholder": "Template",
2933
+ "attachInvoiceLabel": "Attach Invoice PDF (if generated)",
2934
+ "sending": "Sending...",
2935
+ "sendResendButton": "Send / Resend Notification",
2936
+ "dispatchedSuccess": "Dispatched {{channel}} notification",
2937
+ "dispatchFailed": "Failed to dispatch notification",
2938
+ "colChannel": "Channel",
2939
+ "colEventTemplate": "Event / Template",
2940
+ "colRecipient": "Recipient",
2941
+ "colStatus": "Status"
2942
+ },
2943
+ messages: {
2944
+ "loadStudioError": "Failed to load Notification Studio data.",
2945
+ "clonedPresetSuccess": "Cloned preset into editable DB template '{{label}}'.",
2946
+ "clonePresetError": "Failed to clone system preset.",
2947
+ "savedTemplateSuccess": "Saved template & block tree.",
2948
+ "saveTemplateError": "Failed to save template.",
2949
+ "createdMappingSuccess": "Created active mapping for '{{event}}' -> '{{channel}}'.",
2950
+ "createMappingError": "Failed to create event mapping.",
2951
+ "verifiedChannelSuccess": "Verified '{{channel}}' channel and sent test message.",
2952
+ "savedChannelSuccess": "Saved '{{channel}}' configuration.",
2953
+ "channelActionError": "Failed to {{action}} {{channel}}",
2954
+ "broadcastSentSuccess": "Broadcast campaign dispatched to opted-in recipients."
2955
+ }
2956
+ } },
2957
+ es: { translation: {
2958
+ nav: { "label": "Notificaciones" },
2959
+ header: {
2960
+ "title": "Estudio de Notificaciones Multicanal (Email, WhatsApp/OpenWA, Telegram, SMS, Slack)",
2961
+ "subtitle": "Constructor visual de bloques y plantillas, mapeo de eventos en BD, pasarelas multi-driver, registro de consentimiento y sandbox OTP.",
2962
+ "languageLabel": "Idioma",
2963
+ "refresh": "Actualizar Estudio",
2964
+ "successBadge": "ÉXITO",
2965
+ "errorBadge": "ERROR"
2966
+ },
2967
+ tabs: {
2968
+ "templates": "Plantillas y Constructor Visual ({{count}})",
2969
+ "mappings": "Mapeo de Eventos ({{count}})",
2970
+ "channels": "Canales (OpenWA / Telegram / SMS)",
2971
+ "logs": "Registros de Envío ({{count}})",
2972
+ "broadcasts": "Campañas y Consentimiento",
2973
+ "sandbox": "Sandbox OTP de Prueba ({{count}})"
2974
+ },
2975
+ templates: {
2976
+ "title": "Plantillas",
2977
+ "filterChannel": "Filtrar Canal",
2978
+ "allChannels": "Todos los Canales",
2979
+ "modeLabel": "Modo: {{mode}}",
2980
+ "inspectPreview": "Inspeccionar / Vista Previa",
2981
+ "cloneToDb": "Clonar a BD",
2982
+ "saveButton": "Guardar Plantilla y Bloques",
2983
+ "subjectLabel": "Asunto (Email / Título)",
2984
+ "metaTemplateLabel": "Nombre de Plantilla Meta WABA (WhatsApp Cloud)",
2985
+ "rawContentLabel": "Contenido de Plantilla Raw (soporta {{data.*}}, {{translations.*}} y {{ .var }})",
2986
+ "blockTreeLabel": "Árbol Visual de Bloques ({{count}} bloques)",
2987
+ "removeBlock": "Eliminar",
2988
+ "previewTitle": "Vista Previa Multicanal en Vivo ({{locale}})",
2989
+ "contextPlaceholder": "Contexto",
2990
+ "localePlaceholder": "Idioma",
2991
+ "subjectPrefix": "Asunto: {{subject}}",
2992
+ "encodingBadge": "Codificación: {{encoding}}",
2993
+ "segmentsBadge": "Segmentos: {{segments}} ({{chars}} caracteres)",
2994
+ "waButtonPrefix": "[Botón WA] {{title}}",
2995
+ "tgInlinePrefix": "[Botón TG] {{text}}",
2996
+ "emptySelection": "Selecciona una plantilla a la izquierda para inspeccionar sus bloques, clonar un preset del sistema o previsualizarla."
2997
+ },
2998
+ mappings: {
2999
+ "title": "Crear Mapeo Evento → Canal → Plantilla",
3000
+ "eventLabel": "Evento de Tienda Medusa",
3001
+ "channelLabel": "Canal",
3002
+ "templateLabel": "Plantilla",
3003
+ "recipientRuleLabel": "Regla de Destinatario",
3004
+ "ruleCustomerAuto": "Cliente Automático",
3005
+ "ruleOrderEmail": "Email del Pedido",
3006
+ "ruleOrderPhone": "Teléfono del Pedido (E.164)",
3007
+ "ruleCustomerTelegram": "Telegram DM del Cliente",
3008
+ "ruleMerchantChannel": "Canal / Grupo del Comercio",
3009
+ "ruleB2bAccounting": "Contacto de Contabilidad B2B",
3010
+ "threadIdLabel": "ID de Tema / Hilo de Telegram (Opcional)",
3011
+ "threadIdPlaceholder": "ej. 42",
3012
+ "attachInvoiceLabel": "Adjuntar Factura PDF automáticamente desde medusa-documents-plugin (Email, WhatsApp/OpenWA y Telegram)",
3013
+ "addMappingButton": "Añadir Mapeo Activo",
3014
+ "colEvent": "Evento",
3015
+ "colChannel": "Canal",
3016
+ "colTemplate": "Plantilla",
3017
+ "colRecipientRule": "Regla de Destinatario",
3018
+ "colAttachments": "Adjuntos",
3019
+ "colAction": "Acción",
3020
+ "deleteButton": "Eliminar"
3021
+ },
3022
+ channels: {
3023
+ "whatsappTitle": "Pasarela WhatsApp y OpenWA",
3024
+ "whatsappSubtitle": "Alterna entre Meta Cloud API Oficial (Plantillas WABA) y servidores propios OpenWA / WAHA / Evolution API.",
3025
+ "activeDriverLabel": "Driver Activo",
3026
+ "driverMetaCloud": "Meta Cloud API (WABA Oficial)",
3027
+ "driverOpenWa": "OpenWA (@open-wa/wa-automate REST)",
3028
+ "driverWaha": "WAHA (WhatsApp HTTP API)",
3029
+ "driverEvolution": "Evolution API v2",
3030
+ "gatewayUrlLabel": "URL de Pasarela OpenWA / WAHA / Evolution",
3031
+ "saveWhatsappButton": "Guardar Driver WhatsApp",
3032
+ "telegramTitle": "Notificaciones de Telegram",
3033
+ "verifiedBadge": "Verificado",
3034
+ "unverifiedBadge": "Sin Verificar",
3035
+ "telegramSubtitle": "Configura el supergrupo del comercio (-100... o @canal). Cambiar el ID reinicia la verificación hasta enviar un mensaje de prueba.",
3036
+ "merchantChannelLabel": "ID de Canal / Supergrupo del Comercio",
3037
+ "merchantChannelPlaceholder": "-1001234567890 o @mis_alertas",
3038
+ "saveChannelIdButton": "Guardar ID de Canal",
3039
+ "sendTestButton": "Enviar Mensaje de Prueba",
3040
+ "smsTitle": "Driver de Operador SMS",
3041
+ "smsSubtitle": "Selecciona Twilio SMS/MMS, Signal House (10DLC), MSG91 Flow, SMSAPI o Sandbox OTP.",
3042
+ "smsDriverLabel": "Driver SMS",
3043
+ "driverTwilio": "Twilio (SMS / MMS + Messaging Service)",
3044
+ "driverSignalHouse": "Signal House (10DLC y Recuperación de Carrito)",
3045
+ "driverMsg91": "MSG91 Flow API",
3046
+ "driverSmsApi": "SMSAPI",
3047
+ "driverDummy": "Sandbox OTP Dummy (Pruebas)",
3048
+ "saveSmsButton": "Guardar Driver SMS"
3049
+ },
3050
+ logs: {
3051
+ "title": "Registro de Entregas Redactado (PII Enmascarado e Idempotente)",
3052
+ "colEvent": "Evento",
3053
+ "colChannel": "Canal",
3054
+ "colRecipient": "Destinatario (Enmascarado)",
3055
+ "colStatus": "Estado",
3056
+ "colExternalId": "ID Externo"
3057
+ },
3058
+ broadcasts: {
3059
+ "title": "Resumen de Consentimiento TCPA / 10DLC y Difusiones a Clientes",
3060
+ "smsOptedIn": "SMS Suscritos: {{count}}",
3061
+ "whatsappOptedIn": "WhatsApp Suscritos: {{count}}",
3062
+ "telegramLinked": "Telegram Vinculados: {{count}}",
3063
+ "optedOut": "Bajas (STOP): {{count}}",
3064
+ "campaignNameLabel": "Nombre de Campaña",
3065
+ "campaignNamePlaceholder": "Oferta Relámpago de Fin de Semana",
3066
+ "channelLabel": "Canal",
3067
+ "templateLabel": "Plantilla",
3068
+ "sendNowButton": "Enviar Difusión Ahora",
3069
+ "colCampaign": "Campaña",
3070
+ "colChannel": "Canal",
3071
+ "colStatus": "Estado",
3072
+ "colSentTotal": "Enviados / Total"
3073
+ },
3074
+ sandbox: {
3075
+ "title": "Sandbox Local de SMS / OTP y Multicanal",
3076
+ "subtitle": "Captura códigos OTP de verificación y notificaciones de prueba localmente sin enviar mensajes reales.",
3077
+ "clearButton": "Limpiar Mensajes Capturados",
3078
+ "colChannel": "Canal",
3079
+ "colRecipient": "Destinatario",
3080
+ "colOtp": "OTP Extraído",
3081
+ "colBody": "Cuerpo del Mensaje"
3082
+ },
3083
+ widget: {
3084
+ "title": "Notificaciones Multicanal del Pedido ({{count}})",
3085
+ "subtitle": "Envía o reenvía Email, WhatsApp/OpenWA, Telegram o SMS para este pedido (con factura PDF opcional).",
3086
+ "channelPlaceholder": "Canal",
3087
+ "templatePlaceholder": "Plantilla",
3088
+ "attachInvoiceLabel": "Adjuntar Factura PDF (si fue generada)",
3089
+ "sending": "Enviando...",
3090
+ "sendResendButton": "Enviar / Reenviar Notificación",
3091
+ "dispatchedSuccess": "Notificación enviada por {{channel}}",
3092
+ "dispatchFailed": "Error al enviar la notificación",
3093
+ "colChannel": "Canal",
3094
+ "colEventTemplate": "Evento / Plantilla",
3095
+ "colRecipient": "Destinatario",
3096
+ "colStatus": "Estado"
3097
+ },
3098
+ messages: {
3099
+ "loadStudioError": "Error al cargar los datos del Estudio de Notificaciones.",
3100
+ "clonedPresetSuccess": "Preset clonado en plantilla editable '{{label}}'.",
3101
+ "clonePresetError": "Error al clonar el preset del sistema.",
3102
+ "savedTemplateSuccess": "Plantilla y árbol de bloques guardados.",
3103
+ "saveTemplateError": "Error al guardar la plantilla.",
3104
+ "createdMappingSuccess": "Mapeo activo creado para '{{event}}' -> '{{channel}}'.",
3105
+ "createMappingError": "Error al crear el mapeo de eventos.",
3106
+ "verifiedChannelSuccess": "Canal '{{channel}}' verificado y mensaje de prueba enviado.",
3107
+ "savedChannelSuccess": "Configuración de '{{channel}}' guardada.",
3108
+ "channelActionError": "Error al ejecutar {{action}} en {{channel}}",
3109
+ "broadcastSentSuccess": "Campaña de difusión enviada a los destinatarios suscritos."
3110
+ }
3111
+ } },
3112
+ fr: { translation: {
3113
+ nav: { "label": "Notifications" },
3114
+ header: {
3115
+ "title": "Studio de Notifications Multicanal (E-mail, WhatsApp/OpenWA, Telegram, SMS, Slack)",
3116
+ "subtitle": "Éditeur visuel de blocs et modèles bruts, routage d'événements BD, passerelles multi-pilotes, registre de consentement et sandbox OTP.",
3117
+ "languageLabel": "Langue",
3118
+ "refresh": "Actualiser le Studio",
3119
+ "successBadge": "SUCCÈS",
3120
+ "errorBadge": "ERREUR"
3121
+ },
3122
+ tabs: {
3123
+ "templates": "Modèles & Éditeur Visuel ({{count}})",
3124
+ "mappings": "Routage d'Événements ({{count}})",
3125
+ "channels": "Canaux (OpenWA / Telegram / SMS)",
3126
+ "logs": "Journaux d'Envoi ({{count}})",
3127
+ "broadcasts": "Diffusions & Consentement",
3128
+ "sandbox": "Sandbox OTP ({{count}})"
3129
+ },
3130
+ templates: {
3131
+ "title": "Modèles",
3132
+ "filterChannel": "Filtrer par Canal",
3133
+ "allChannels": "Tous les Canaux",
3134
+ "modeLabel": "Mode : {{mode}}",
3135
+ "inspectPreview": "Inspecter / Aperçu",
3136
+ "cloneToDb": "Cloner en BD",
3137
+ "saveButton": "Enregistrer Modèle & Blocs",
3138
+ "subjectLabel": "Objet (E-mail / Titre)",
3139
+ "metaTemplateLabel": "Nom du Modèle Meta WABA (WhatsApp Cloud)",
3140
+ "rawContentLabel": "Contenu Brut (supporte {{data.*}}, {{translations.*}} et {{ .var }})",
3141
+ "blockTreeLabel": "Arbre Visuel de Blocs ({{count}} blocs)",
3142
+ "removeBlock": "Supprimer",
3143
+ "previewTitle": "Aperçu Multicanal en Direct ({{locale}})",
3144
+ "contextPlaceholder": "Contexte",
3145
+ "localePlaceholder": "Langue",
3146
+ "subjectPrefix": "Objet : {{subject}}",
3147
+ "encodingBadge": "Encodage : {{encoding}}",
3148
+ "segmentsBadge": "Segments : {{segments}} ({{chars}} caractères)",
3149
+ "waButtonPrefix": "[Bouton WA] {{title}}",
3150
+ "tgInlinePrefix": "[Bouton TG] {{text}}",
3151
+ "emptySelection": "Sélectionnez un modèle à gauche pour inspecter ses blocs, cloner un préréglage système ou prévisualiser le rendu."
3152
+ },
3153
+ mappings: {
3154
+ "title": "Créer une Règle Événement → Canal → Modèle",
3155
+ "eventLabel": "Événement Medusa",
3156
+ "channelLabel": "Canal",
3157
+ "templateLabel": "Modèle",
3158
+ "recipientRuleLabel": "Règle de Destinataire",
3159
+ "ruleCustomerAuto": "Client Auto",
3160
+ "ruleOrderEmail": "E-mail de Commande",
3161
+ "ruleOrderPhone": "Téléphone de Commande (E.164)",
3162
+ "ruleCustomerTelegram": "Telegram DM Client",
3163
+ "ruleMerchantChannel": "Canal / Groupe Marchand",
3164
+ "ruleB2bAccounting": "Contact Comptabilité B2B",
3165
+ "threadIdLabel": "ID de Sujet / Thread Telegram (Optionnel)",
3166
+ "threadIdPlaceholder": "ex. 42",
3167
+ "attachInvoiceLabel": "Joindre automatiquement la facture PDF depuis medusa-documents-plugin (E-mail, WhatsApp/OpenWA & Telegram)",
3168
+ "addMappingButton": "Ajouter la Règle",
3169
+ "colEvent": "Événement",
3170
+ "colChannel": "Canal",
3171
+ "colTemplate": "Modèle",
3172
+ "colRecipientRule": "Destinataire",
3173
+ "colAttachments": "Pièces jointes",
3174
+ "colAction": "Action",
3175
+ "deleteButton": "Supprimer"
3176
+ },
3177
+ channels: {
3178
+ "whatsappTitle": "Passerelle WhatsApp & OpenWA",
3179
+ "whatsappSubtitle": "Basculez entre l'API officielle Meta Cloud (modèles WABA) et OpenWA / WAHA / Evolution API auto-hébergés.",
3180
+ "activeDriverLabel": "Pilote Actif",
3181
+ "driverMetaCloud": "Meta Cloud API (WABA Officiel)",
3182
+ "driverOpenWa": "OpenWA (@open-wa/wa-automate REST)",
3183
+ "driverWaha": "WAHA (WhatsApp HTTP API)",
3184
+ "driverEvolution": "Evolution API v2",
3185
+ "gatewayUrlLabel": "URL de Passerelle OpenWA / WAHA / Evolution",
3186
+ "saveWhatsappButton": "Enregistrer le Pilote WhatsApp",
3187
+ "telegramTitle": "Notifications Telegram",
3188
+ "verifiedBadge": "Vérifié",
3189
+ "unverifiedBadge": "Non vérifié",
3190
+ "telegramSubtitle": "Configurez le supergroupe marchand (-100... ou @canal). Modifier l'ID réinitialise la vérification.",
3191
+ "merchantChannelLabel": "ID du Canal / Supergroupe Marchand",
3192
+ "merchantChannelPlaceholder": "-1001234567890 ou @mes_alertes",
3193
+ "saveChannelIdButton": "Enregistrer l'ID",
3194
+ "sendTestButton": "Envoyer un Message Test",
3195
+ "smsTitle": "Pilote Opérateur SMS",
3196
+ "smsSubtitle": "Sélectionnez Twilio SMS/MMS, Signal House (10DLC), MSG91 Flow, SMSAPI ou Sandbox OTP.",
3197
+ "smsDriverLabel": "Pilote SMS",
3198
+ "driverTwilio": "Twilio (SMS / MMS + Messaging Service)",
3199
+ "driverSignalHouse": "Signal House (10DLC & Panier Abandonné)",
3200
+ "driverMsg91": "MSG91 Flow API",
3201
+ "driverSmsApi": "SMSAPI",
3202
+ "driverDummy": "Sandbox OTP (Test)",
3203
+ "saveSmsButton": "Enregistrer le Pilote SMS"
3204
+ },
3205
+ logs: {
3206
+ "title": "Journal des Envois Anonymisé (PII Masqué & Idempotent)",
3207
+ "colEvent": "Événement",
3208
+ "colChannel": "Canal",
3209
+ "colRecipient": "Destinataire (Masqué)",
3210
+ "colStatus": "Statut",
3211
+ "colExternalId": "ID Externe"
3212
+ },
3213
+ broadcasts: {
3214
+ "title": "Résumé du Consentement TCPA / 10DLC & Campagnes de Diffusion",
3215
+ "smsOptedIn": "SMS Inscrits : {{count}}",
3216
+ "whatsappOptedIn": "WhatsApp Inscrits : {{count}}",
3217
+ "telegramLinked": "Telegram Liés : {{count}}",
3218
+ "optedOut": "Désinscrits (STOP) : {{count}}",
3219
+ "campaignNameLabel": "Nom de la Campagne",
3220
+ "campaignNamePlaceholder": "Vente Flash Week-end",
3221
+ "channelLabel": "Canal",
3222
+ "templateLabel": "Modèle",
3223
+ "sendNowButton": "Envoyer la Diffusion",
3224
+ "colCampaign": "Campagne",
3225
+ "colChannel": "Canal",
3226
+ "colStatus": "Statut",
3227
+ "colSentTotal": "Envoyés / Total"
3228
+ },
3229
+ sandbox: {
3230
+ "title": "Sandbox Locale SMS / OTP & Multicanal",
3231
+ "subtitle": "Capture localement les codes OTP et notifications de test sans envoi opérateur réel.",
3232
+ "clearButton": "Effacer les Messages Capturés",
3233
+ "colChannel": "Canal",
3234
+ "colRecipient": "Destinataire",
3235
+ "colOtp": "OTP Extrait",
3236
+ "colBody": "Message"
3237
+ },
3238
+ widget: {
3239
+ "title": "Notifications Multicanal de la Commande ({{count}})",
3240
+ "subtitle": "Envoyer ou renvoyer un E-mail, WhatsApp/OpenWA, Telegram ou SMS pour cette commande (avec facture PDF en option).",
3241
+ "channelPlaceholder": "Canal",
3242
+ "templatePlaceholder": "Modèle",
3243
+ "attachInvoiceLabel": "Joindre la facture PDF (si générée)",
3244
+ "sending": "Envoi...",
3245
+ "sendResendButton": "Envoyer / Renvoyer la Notification",
3246
+ "dispatchedSuccess": "Notification {{channel}} envoyée",
3247
+ "dispatchFailed": "Échec de l'envoi de la notification",
3248
+ "colChannel": "Canal",
3249
+ "colEventTemplate": "Événement / Modèle",
3250
+ "colRecipient": "Destinataire",
3251
+ "colStatus": "Statut"
3252
+ },
3253
+ messages: {
3254
+ "loadStudioError": "Impossible de charger les données du Studio de Notifications.",
3255
+ "clonedPresetSuccess": "Préréglage cloné en modèle modifiable '{{label}}'.",
3256
+ "clonePresetError": "Échec du clonage du préréglage.",
3257
+ "savedTemplateSuccess": "Modèle et arbre de blocs enregistrés.",
3258
+ "saveTemplateError": "Échec de l'enregistrement du modèle.",
3259
+ "createdMappingSuccess": "Règle active créée pour '{{event}}' -> '{{channel}}'.",
3260
+ "createMappingError": "Échec de la création de la règle.",
3261
+ "verifiedChannelSuccess": "Canal '{{channel}}' vérifié et message test envoyé.",
3262
+ "savedChannelSuccess": "Configuration '{{channel}}' enregistrée.",
3263
+ "channelActionError": "Échec de l'action {{action}} sur {{channel}}",
3264
+ "broadcastSentSuccess": "Campagne de diffusion envoyée aux destinataires inscrits."
3265
+ }
3266
+ } },
3267
+ it: { translation: {
3268
+ nav: { "label": "Notifiche" },
3269
+ header: {
3270
+ "title": "Studio Notifiche Multicanale (Email, WhatsApp/OpenWA, Telegram, SMS, Slack)",
3271
+ "subtitle": "Costruttore visivo di blocchi e modelli raw, mappatura eventi DB, gateway multi-driver, registro consensi e sandbox OTP.",
3272
+ "languageLabel": "Lingua",
3273
+ "refresh": "Aggiorna Studio",
3274
+ "successBadge": "SUCCESSO",
3275
+ "errorBadge": "ERRORE"
3276
+ },
3277
+ tabs: {
3278
+ "templates": "Modelli e Builder Visivo ({{count}})",
3279
+ "mappings": "Mappatura Eventi ({{count}})",
3280
+ "channels": "Canali (OpenWA / Telegram / SMS)",
3281
+ "logs": "Log di Consegna ({{count}})",
3282
+ "broadcasts": "Broadcast e Consensi",
3283
+ "sandbox": "Sandbox OTP ({{count}})"
3284
+ },
3285
+ templates: {
3286
+ "title": "Modelli",
3287
+ "filterChannel": "Filtra Canale",
3288
+ "allChannels": "Tutti i Canali",
3289
+ "modeLabel": "Modalità: {{mode}}",
3290
+ "inspectPreview": "Ispeziona / Anteprima",
3291
+ "cloneToDb": "Clona su DB",
3292
+ "saveButton": "Salva Modello e Blocchi",
3293
+ "subjectLabel": "Oggetto (Email / Titolo)",
3294
+ "metaTemplateLabel": "Nome Modello Meta WABA (WhatsApp Cloud)",
3295
+ "rawContentLabel": "Contenuto Modello Raw (supporta {{data.*}}, {{translations.*}} e {{ .var }})",
3296
+ "blockTreeLabel": "Albero Visivo dei Blocchi ({{count}} blocchi)",
3297
+ "removeBlock": "Rimuovi",
3298
+ "previewTitle": "Anteprima Multicanale Live ({{locale}})",
3299
+ "contextPlaceholder": "Contesto",
3300
+ "localePlaceholder": "Lingua",
3301
+ "subjectPrefix": "Oggetto: {{subject}}",
3302
+ "encodingBadge": "Codifica: {{encoding}}",
3303
+ "segmentsBadge": "Segmenti: {{segments}} ({{chars}} caratteri)",
3304
+ "waButtonPrefix": "[Pulsante WA] {{title}}",
3305
+ "tgInlinePrefix": "[Pulsante TG] {{text}}",
3306
+ "emptySelection": "Seleziona un modello a sinistra per ispezionare i blocchi, clonare un preset di sistema o visualizzare l'anteprima."
3307
+ },
3308
+ mappings: {
3309
+ "title": "Crea Mappatura Evento → Canale → Modello",
3310
+ "eventLabel": "Evento Store Medusa",
3311
+ "channelLabel": "Canale",
3312
+ "templateLabel": "Modello",
3313
+ "recipientRuleLabel": "Regola Destinatario",
3314
+ "ruleCustomerAuto": "Cliente Automatico",
3315
+ "ruleOrderEmail": "Email Ordine",
3316
+ "ruleOrderPhone": "Telefono Ordine (E.164)",
3317
+ "ruleCustomerTelegram": "Telegram DM Cliente",
3318
+ "ruleMerchantChannel": "Canale / Gruppo Commerciante",
3319
+ "ruleB2bAccounting": "Contatto Contabilità B2B",
3320
+ "threadIdLabel": "ID Topic Telegram (Opzionale)",
3321
+ "threadIdPlaceholder": "es. 42",
3322
+ "attachInvoiceLabel": "Allega automaticamente fattura PDF da medusa-documents-plugin (Email, WhatsApp/OpenWA e Telegram)",
3323
+ "addMappingButton": "Aggiungi Mappatura Attiva",
3324
+ "colEvent": "Evento",
3325
+ "colChannel": "Canale",
3326
+ "colTemplate": "Modello",
3327
+ "colRecipientRule": "Regola Destinatario",
3328
+ "colAttachments": "Allegati",
3329
+ "colAction": "Azione",
3330
+ "deleteButton": "Elimina"
3331
+ },
3332
+ channels: {
3333
+ "whatsappTitle": "Gateway WhatsApp e OpenWA",
3334
+ "whatsappSubtitle": "Passa tra l'API ufficiale Meta Cloud (Modelli WABA) e OpenWA / WAHA / Evolution API self-hosted.",
3335
+ "activeDriverLabel": "Driver Attivo",
3336
+ "driverMetaCloud": "Meta Cloud API (WABA Ufficiale)",
3337
+ "driverOpenWa": "OpenWA (@open-wa/wa-automate REST)",
3338
+ "driverWaha": "WAHA (WhatsApp HTTP API)",
3339
+ "driverEvolution": "Evolution API v2",
3340
+ "gatewayUrlLabel": "URL Gateway OpenWA / WAHA / Evolution",
3341
+ "saveWhatsappButton": "Salva Driver WhatsApp",
3342
+ "telegramTitle": "Notifiche Telegram",
3343
+ "verifiedBadge": "Verificato",
3344
+ "unverifiedBadge": "Non Verificato",
3345
+ "telegramSubtitle": "Configura il supergruppo del negozio (-100... o @canale). La modifica dell'ID azzera la verifica fino al messaggio di test.",
3346
+ "merchantChannelLabel": "ID Canale / Supergruppo Commerciante",
3347
+ "merchantChannelPlaceholder": "-1001234567890 o @avvisi_negozio",
3348
+ "saveChannelIdButton": "Salva ID Canale",
3349
+ "sendTestButton": "Invia Messaggio di Test",
3350
+ "smsTitle": "Driver Operatore SMS",
3351
+ "smsSubtitle": "Seleziona Twilio SMS/MMS, Signal House (10DLC), MSG91 Flow, SMSAPI o Sandbox OTP.",
3352
+ "smsDriverLabel": "Driver SMS",
3353
+ "driverTwilio": "Twilio (SMS / MMS + Messaging Service)",
3354
+ "driverSignalHouse": "Signal House (10DLC e Recupero Carrello)",
3355
+ "driverMsg91": "MSG91 Flow API",
3356
+ "driverSmsApi": "SMSAPI",
3357
+ "driverDummy": "Sandbox OTP (Test)",
3358
+ "saveSmsButton": "Salva Driver SMS"
3359
+ },
3360
+ logs: {
3361
+ "title": "Registro Consegne Oscurato (PII Mascherato e Idempotente)",
3362
+ "colEvent": "Evento",
3363
+ "colChannel": "Canale",
3364
+ "colRecipient": "Destinatario (Mascherato)",
3365
+ "colStatus": "Stato",
3366
+ "colExternalId": "ID Esterno"
3367
+ },
3368
+ broadcasts: {
3369
+ "title": "Riepilogo Consensi TCPA / 10DLC e Campagne Broadcast",
3370
+ "smsOptedIn": "SMS Iscritti: {{count}}",
3371
+ "whatsappOptedIn": "WhatsApp Iscritti: {{count}}",
3372
+ "telegramLinked": "Telegram Collegati: {{count}}",
3373
+ "optedOut": "Disiscritti (STOP): {{count}}",
3374
+ "campaignNameLabel": "Nome Campagna",
3375
+ "campaignNamePlaceholder": "Flash Sale del Weekend",
3376
+ "channelLabel": "Canale",
3377
+ "templateLabel": "Modello",
3378
+ "sendNowButton": "Invia Broadcast Ora",
3379
+ "colCampaign": "Campagna",
3380
+ "colChannel": "Canale",
3381
+ "colStatus": "Stato",
3382
+ "colSentTotal": "Inviati / Totale"
3383
+ },
3384
+ sandbox: {
3385
+ "title": "Sandbox Locale SMS / OTP e Multicanale",
3386
+ "subtitle": "Cattura codici OTP e notifiche di test localmente senza invii reali.",
3387
+ "clearButton": "Cancella Messaggi Catturati",
3388
+ "colChannel": "Canale",
3389
+ "colRecipient": "Destinatario",
3390
+ "colOtp": "OTP Estratto",
3391
+ "colBody": "Testo del Messaggio"
3392
+ },
3393
+ widget: {
3394
+ "title": "Notifiche Ordine Multicanale ({{count}})",
3395
+ "subtitle": "Invia o reinvia Email, WhatsApp/OpenWA, Telegram o SMS per questo ordine (con fattura PDF opzionale).",
3396
+ "channelPlaceholder": "Canale",
3397
+ "templatePlaceholder": "Modello",
3398
+ "attachInvoiceLabel": "Allega Fattura PDF (se generata)",
3399
+ "sending": "Invio in corso...",
3400
+ "sendResendButton": "Invia / Reinvia Notifica",
3401
+ "dispatchedSuccess": "Notifica {{channel}} inviata",
3402
+ "dispatchFailed": "Impossibile inviare la notifica",
3403
+ "colChannel": "Canale",
3404
+ "colEventTemplate": "Evento / Modello",
3405
+ "colRecipient": "Destinatario",
3406
+ "colStatus": "Stato"
3407
+ },
3408
+ messages: {
3409
+ "loadStudioError": "Impossibile caricare i dati dello Studio Notifiche.",
3410
+ "clonedPresetSuccess": "Preset clonato nel modello modificabile '{{label}}'.",
3411
+ "clonePresetError": "Impossibile clonare il preset di sistema.",
3412
+ "savedTemplateSuccess": "Modello e albero dei blocchi salvati.",
3413
+ "saveTemplateError": "Impossibile salvare il modello.",
3414
+ "createdMappingSuccess": "Mappatura attiva creata per '{{event}}' -> '{{channel}}'.",
3415
+ "createMappingError": "Impossibile creare la mappatura eventi.",
3416
+ "verifiedChannelSuccess": "Canale '{{channel}}' verificato e messaggio di test inviato.",
3417
+ "savedChannelSuccess": "Configurazione '{{channel}}' salvata.",
3418
+ "channelActionError": "Azione {{action}} fallita su {{channel}}",
3419
+ "broadcastSentSuccess": "Campagna broadcast inviata ai destinatari iscritti."
3420
+ }
3421
+ } },
3422
+ nl: { translation: {
3423
+ nav: { "label": "Meldingen" },
3424
+ header: {
3425
+ "title": "Multi-Channel Notificatiestudio (E-mail, WhatsApp/OpenWA, Telegram, SMS, Slack)",
3426
+ "subtitle": "Visuele blok- en sjabloonbouwer, DB-gebeurteniskoppelingen, multi-driver gateways, toestemmingsregister en OTP-sandbox.",
3427
+ "languageLabel": "Taal",
3428
+ "refresh": "Studio Vernieuwen",
3429
+ "successBadge": "SUCCES",
3430
+ "errorBadge": "FOUT"
3431
+ },
3432
+ tabs: {
3433
+ "templates": "Sjablonen & Visuele Bouwer ({{count}})",
3434
+ "mappings": "Gebeurteniskoppelingen ({{count}})",
3435
+ "channels": "Kanalen (OpenWA / Telegram / SMS)",
3436
+ "logs": "Verzendlogboeken ({{count}})",
3437
+ "broadcasts": "Broadcasts & Toestemming",
3438
+ "sandbox": "Dummy OTP Sandbox ({{count}})"
3439
+ },
3440
+ templates: {
3441
+ "title": "Sjablonen",
3442
+ "filterChannel": "Kanaal Filteren",
3443
+ "allChannels": "Alle Kanalen",
3444
+ "modeLabel": "Modus: {{mode}}",
3445
+ "inspectPreview": "Inspecteren / Voorbeeld",
3446
+ "cloneToDb": "Klonen naar DB",
3447
+ "saveButton": "Sjabloon & Blokken Opslaan",
3448
+ "subjectLabel": "Onderwerpregel (E-mail / Titel)",
3449
+ "metaTemplateLabel": "Meta WABA-sjabloonnaam (WhatsApp Cloud)",
3450
+ "rawContentLabel": "Raw Sjablooninhoud (ondersteunt {{data.*}}, {{translations.*}} en {{ .var }})",
3451
+ "blockTreeLabel": "Visuele Blokstructuur ({{count}} blokken)",
3452
+ "removeBlock": "Verwijderen",
3453
+ "previewTitle": "Live Multi-Channel Voorbeeld ({{locale}})",
3454
+ "contextPlaceholder": "Context",
3455
+ "localePlaceholder": "Taal",
3456
+ "subjectPrefix": "Onderwerp: {{subject}}",
3457
+ "encodingBadge": "Codering: {{encoding}}",
3458
+ "segmentsBadge": "Segmenten: {{segments}} ({{chars}} tekens)",
3459
+ "waButtonPrefix": "[WA-knop] {{title}}",
3460
+ "tgInlinePrefix": "[TG-knop] {{text}}",
3461
+ "emptySelection": "Selecteer links een sjabloon om de blokstructuur te bekijken, een systeempreset te klonen of een voorbeeld weer te geven."
3462
+ },
3463
+ mappings: {
3464
+ "title": "Koppeling Gebeurtenis → Kanaal → Sjabloon Maken",
3465
+ "eventLabel": "Medusa Winkelgebeurtenis",
3466
+ "channelLabel": "Kanaal",
3467
+ "templateLabel": "Sjabloon",
3468
+ "recipientRuleLabel": "Ontvangersregel",
3469
+ "ruleCustomerAuto": "Klant Automatisch",
3470
+ "ruleOrderEmail": "Bestel-e-mail",
3471
+ "ruleOrderPhone": "Besteltelefoon (E.164)",
3472
+ "ruleCustomerTelegram": "Klant Telegram DM",
3473
+ "ruleMerchantChannel": "Winkelkanaal / Groep",
3474
+ "ruleB2bAccounting": "B2B Administratiecontact",
3475
+ "threadIdLabel": "Telegram Topic Thread-ID (Optioneel)",
3476
+ "threadIdPlaceholder": "bijv. 42",
3477
+ "attachInvoiceLabel": "PDF-factuur vanuit medusa-documents-plugin automatisch bijvoegen (E-mail, WhatsApp/OpenWA & Telegram)",
3478
+ "addMappingButton": "Actieve Koppeling Toevoegen",
3479
+ "colEvent": "Gebeurtenis",
3480
+ "colChannel": "Kanaal",
3481
+ "colTemplate": "Sjabloon",
3482
+ "colRecipientRule": "Ontvangersregel",
3483
+ "colAttachments": "Bijlagen",
3484
+ "colAction": "Actie",
3485
+ "deleteButton": "Verwijderen"
3486
+ },
3487
+ channels: {
3488
+ "whatsappTitle": "WhatsApp & OpenWA Gateway",
3489
+ "whatsappSubtitle": "Schakel tussen de officiële Meta Cloud API (WABA-sjablonen) en zelf-gehoste OpenWA / WAHA / Evolution API.",
3490
+ "activeDriverLabel": "Actieve Driver",
3491
+ "driverMetaCloud": "Meta Cloud API (Officieel WABA)",
3492
+ "driverOpenWa": "OpenWA (@open-wa/wa-automate REST)",
3493
+ "driverWaha": "WAHA (WhatsApp HTTP API)",
3494
+ "driverEvolution": "Evolution API v2",
3495
+ "gatewayUrlLabel": "OpenWA / WAHA / Evolution Gateway-URL",
3496
+ "saveWhatsappButton": "WhatsApp-driver Opslaan",
3497
+ "telegramTitle": "Telegram-meldingen",
3498
+ "verifiedBadge": "Geverifieerd",
3499
+ "unverifiedBadge": "Niet geverifieerd",
3500
+ "telegramSubtitle": "Configureer de winkelsupergroep (-100... of @kanaal). Wijziging van het ID reset de verificatie totdat een testbericht slaagt.",
3501
+ "merchantChannelLabel": "Winkelkanaal / Supergroep-ID",
3502
+ "merchantChannelPlaceholder": "-1001234567890 of @winkel_meldingen",
3503
+ "saveChannelIdButton": "Kanaal-ID Opslaan",
3504
+ "sendTestButton": "Testbericht Verzenden",
3505
+ "smsTitle": "SMS-provider Driver",
3506
+ "smsSubtitle": "Selecteer Twilio SMS/MMS, Signal House (10DLC), MSG91 Flow, SMSAPI of Dummy Sandbox.",
3507
+ "smsDriverLabel": "SMS-driver",
3508
+ "driverTwilio": "Twilio (SMS / MMS + Messaging Service)",
3509
+ "driverSignalHouse": "Signal House (10DLC & Winkelwagenherstel)",
3510
+ "driverMsg91": "MSG91 Flow API",
3511
+ "driverSmsApi": "SMSAPI",
3512
+ "driverDummy": "Dummy OTP Sandbox (Test)",
3513
+ "saveSmsButton": "SMS-driver Opslaan"
3514
+ },
3515
+ logs: {
3516
+ "title": "Geanonimiseerd Verzendlogboek (PII Gemaskeerd & Idempotent)",
3517
+ "colEvent": "Gebeurtenis",
3518
+ "colChannel": "Kanaal",
3519
+ "colRecipient": "Ontvanger (Gemaskeerd)",
3520
+ "colStatus": "Status",
3521
+ "colExternalId": "Externe ID"
3522
+ },
3523
+ broadcasts: {
3524
+ "title": "TCPA / 10DLC Toestemmingsoverzicht & Klantgroep Broadcasts",
3525
+ "smsOptedIn": "SMS Opt-in: {{count}}",
3526
+ "whatsappOptedIn": "WhatsApp Opt-in: {{count}}",
3527
+ "telegramLinked": "Telegram Gekoppeld: {{count}}",
3528
+ "optedOut": "Uitgeschreven (STOP): {{count}}",
3529
+ "campaignNameLabel": "Campagnenaam",
3530
+ "campaignNamePlaceholder": "Weekend Flash Sale",
3531
+ "channelLabel": "Kanaal",
3532
+ "templateLabel": "Sjabloon",
3533
+ "sendNowButton": "Broadcast Nu Verzenden",
3534
+ "colCampaign": "Campagne",
3535
+ "colChannel": "Kanaal",
3536
+ "colStatus": "Status",
3537
+ "colSentTotal": "Verzonden / Totaal"
3538
+ },
3539
+ sandbox: {
3540
+ "title": "Lokale SMS / OTP & Multi-Channel Sandbox",
3541
+ "subtitle": "Vangt OTP-verificatiecodes en testmeldingen lokaal op zonder echte berichten te versturen.",
3542
+ "clearButton": "Opgevangen Berichten Wissen",
3543
+ "colChannel": "Kanaal",
3544
+ "colRecipient": "Ontvanger",
3545
+ "colOtp": "Geëxtraheerde OTP",
3546
+ "colBody": "Berichtinhoud"
3547
+ },
3548
+ widget: {
3549
+ "title": "Multi-Channel Bestelmeldingen ({{count}})",
3550
+ "subtitle": "Verstuur of herverstuur E-mail, WhatsApp/OpenWA, Telegram of SMS voor deze bestelling (met optionele PDF-factuur).",
3551
+ "channelPlaceholder": "Kanaal",
3552
+ "templatePlaceholder": "Sjabloon",
3553
+ "attachInvoiceLabel": "PDF-factuur bijvoegen (indien gegenereerd)",
3554
+ "sending": "Verzenden...",
3555
+ "sendResendButton": "Melding Verzenden / Opnieuw Verzenden",
3556
+ "dispatchedSuccess": "{{channel}}-melding verzonden",
3557
+ "dispatchFailed": "Melding verzenden mislukt",
3558
+ "colChannel": "Kanaal",
3559
+ "colEventTemplate": "Gebeurtenis / Sjabloon",
3560
+ "colRecipient": "Ontvanger",
3561
+ "colStatus": "Status"
3562
+ },
3563
+ messages: {
3564
+ "loadStudioError": "Kan gegevens van Notificatiestudio niet laden.",
3565
+ "clonedPresetSuccess": "Preset gekloond naar bewerkbaar DB-sjabloon '{{label}}'.",
3566
+ "clonePresetError": "Systeempreset klonen mislukt.",
3567
+ "savedTemplateSuccess": "Sjabloon & blokstructuur opgeslagen.",
3568
+ "saveTemplateError": "Sjabloon opslaan mislukt.",
3569
+ "createdMappingSuccess": "Actieve koppeling gemaakt voor '{{event}}' -> '{{channel}}'.",
3570
+ "createMappingError": "Gebeurteniskoppeling maken mislukt.",
3571
+ "verifiedChannelSuccess": "Kanaal '{{channel}}' geverifieerd en testbericht verzonden.",
3572
+ "savedChannelSuccess": "Configuratie '{{channel}}' opgeslagen.",
3573
+ "channelActionError": "Actie {{action}} voor {{channel}} mislukt",
3574
+ "broadcastSentSuccess": "Broadcastcampagne verzonden naar opt-in ontvangers."
3575
+ }
3576
+ } },
3577
+ pl: { translation: {
3578
+ nav: { "label": "Powiadomienia" },
3579
+ header: {
3580
+ "title": "Wielokanałowe Studio Powiadomień (E-mail, WhatsApp/OpenWA, Telegram, SMS, Slack)",
3581
+ "subtitle": "Wizualny kreator bloków i szablonów, mapowanie zdarzeń w bazie, bramki wielosterownikowe, rejestr zgód i piaskownica OTP.",
3582
+ "languageLabel": "Język",
3583
+ "refresh": "Odśwież Studio",
3584
+ "successBadge": "SUKCES",
3585
+ "errorBadge": "BŁĄD"
3586
+ },
3587
+ tabs: {
3588
+ "templates": "Szablony i Kreator Wizualny ({{count}})",
3589
+ "mappings": "Mapowanie Zdarzeń ({{count}})",
3590
+ "channels": "Kanały (OpenWA / Telegram / SMS)",
3591
+ "logs": "Dziennik Dostarczeń ({{count}})",
3592
+ "broadcasts": "Kampanie i Rejestr Zgód",
3593
+ "sandbox": "Piaskownica OTP ({{count}})"
3594
+ },
3595
+ templates: {
3596
+ "title": "Szablony",
3597
+ "filterChannel": "Filtruj Kanał",
3598
+ "allChannels": "Wszystkie Kanały",
3599
+ "modeLabel": "Tryb: {{mode}}",
3600
+ "inspectPreview": "Sprawdź / Podgląd",
3601
+ "cloneToDb": "Klonuj do Bazy",
3602
+ "saveButton": "Zapisz Szablon i Bloki",
3603
+ "subjectLabel": "Temat wiadomości (E-mail / Tytuł)",
3604
+ "metaTemplateLabel": "Nazwa Szablonu Meta WABA (WhatsApp Cloud)",
3605
+ "rawContentLabel": "Treść szablonu Raw (obsługuje {{data.*}}, {{translations.*}} oraz {{ .var }})",
3606
+ "blockTreeLabel": "Wizualne Drzewo Bloków ({{count}} bloków)",
3607
+ "removeBlock": "Usuń",
3608
+ "previewTitle": "Podgląd Wielokanałowy na Żywo ({{locale}})",
3609
+ "contextPlaceholder": "Kontekst",
3610
+ "localePlaceholder": "Język",
3611
+ "subjectPrefix": "Temat: {{subject}}",
3612
+ "encodingBadge": "Kodowanie: {{encoding}}",
3613
+ "segmentsBadge": "Segmenty: {{segments}} ({{chars}} znaków)",
3614
+ "waButtonPrefix": "[Przycisk WA] {{title}}",
3615
+ "tgInlinePrefix": "[Przycisk TG] {{text}}",
3616
+ "emptySelection": "Wybierz szablon po lewej stronie, aby sprawdzić drzewo bloków, sklonować szablon systemowy lub wyświetlić podgląd."
3617
+ },
3618
+ mappings: {
3619
+ "title": "Utwórz Mapowanie Zdarzenie → Kanał → Szablon",
3620
+ "eventLabel": "Zdarzenie Sklepu Medusa",
3621
+ "channelLabel": "Kanał",
3622
+ "templateLabel": "Szablon",
3623
+ "recipientRuleLabel": "Reguła Odbiorcy",
3624
+ "ruleCustomerAuto": "Klient Automatycznie",
3625
+ "ruleOrderEmail": "E-mail Zamówienia",
3626
+ "ruleOrderPhone": "Telefon Zamówienia (E.164)",
3627
+ "ruleCustomerTelegram": "Telegram DM Klienta",
3628
+ "ruleMerchantChannel": "Kanał / Grupa Sklepu",
3629
+ "ruleB2bAccounting": "Kontakt Księgowości B2B",
3630
+ "threadIdLabel": "ID Wątku / Tematu Telegram (Opcjonalnie)",
3631
+ "threadIdPlaceholder": "np. 42",
3632
+ "attachInvoiceLabel": "Automatycznie dołącz fakturę PDF z medusa-documents-plugin (E-mail, WhatsApp/OpenWA i Telegram)",
3633
+ "addMappingButton": "Dodaj Aktywne Mapowanie",
3634
+ "colEvent": "Zdarzenie",
3635
+ "colChannel": "Kanał",
3636
+ "colTemplate": "Szablon",
3637
+ "colRecipientRule": "Reguła Odbiorcy",
3638
+ "colAttachments": "Załączniki",
3639
+ "colAction": "Akcja",
3640
+ "deleteButton": "Usuń"
3641
+ },
3642
+ channels: {
3643
+ "whatsappTitle": "Bramka WhatsApp i OpenWA",
3644
+ "whatsappSubtitle": "Przełączaj między oficjalnym Meta Cloud API (Szablony WABA) a własnym serwerem OpenWA / WAHA / Evolution API.",
3645
+ "activeDriverLabel": "Aktywny Sterownik",
3646
+ "driverMetaCloud": "Meta Cloud API (Oficjalne WABA)",
3647
+ "driverOpenWa": "OpenWA (@open-wa/wa-automate REST)",
3648
+ "driverWaha": "WAHA (WhatsApp HTTP API)",
3649
+ "driverEvolution": "Evolution API v2",
3650
+ "gatewayUrlLabel": "URL Bramki OpenWA / WAHA / Evolution",
3651
+ "saveWhatsappButton": "Zapisz Sterownik WhatsApp",
3652
+ "telegramTitle": "Powiadomienia Telegram",
3653
+ "verifiedBadge": "Zweryfikowano",
3654
+ "unverifiedBadge": "Niezweryfikowano",
3655
+ "telegramSubtitle": "Skonfiguruj supergrupę sklepu (-100... lub @kanał). Zmiana ID resetuje weryfikację do czasu wysłania wiadomości testowej.",
3656
+ "merchantChannelLabel": "ID Kanału / Supergrupy Sklepu",
3657
+ "merchantChannelPlaceholder": "-1001234567890 lub @alerty_sklepu",
3658
+ "saveChannelIdButton": "Zapisz ID Kanału",
3659
+ "sendTestButton": "Wyślij Wiadomość Testową",
3660
+ "smsTitle": "Sterownik Operatora SMS",
3661
+ "smsSubtitle": "Wybierz Twilio SMS/MMS, Signal House (10DLC), MSG91 Flow, SMSAPI lub Piaskownicę OTP.",
3662
+ "smsDriverLabel": "Sterownik SMS",
3663
+ "driverTwilio": "Twilio (SMS / MMS + Messaging Service)",
3664
+ "driverSignalHouse": "Signal House (10DLC i Porzucone Koszyki)",
3665
+ "driverMsg91": "MSG91 Flow API",
3666
+ "driverSmsApi": "SMSAPI",
3667
+ "driverDummy": "Piaskownica OTP (Testy)",
3668
+ "saveSmsButton": "Zapisz Sterownik SMS"
3669
+ },
3670
+ logs: {
3671
+ "title": "Zanonimizowany Rejestr Dostarczeń (Ukryte PII i Idempotentność)",
3672
+ "colEvent": "Zdarzenie",
3673
+ "colChannel": "Kanał",
3674
+ "colRecipient": "Odbiorca (Zamaskowany)",
3675
+ "colStatus": "Status",
3676
+ "colExternalId": "Zewnętrzne ID"
3677
+ },
3678
+ broadcasts: {
3679
+ "title": "Podsumowanie Zgód TCPA / 10DLC i Wysyłki Masowe",
3680
+ "smsOptedIn": "Zgody SMS: {{count}}",
3681
+ "whatsappOptedIn": "Zgody WhatsApp: {{count}}",
3682
+ "telegramLinked": "Połączeni Telegram: {{count}}",
3683
+ "optedOut": "Wypisani (STOP): {{count}}",
3684
+ "campaignNameLabel": "Nazwa Kampanii",
3685
+ "campaignNamePlaceholder": "Weekendowa Wyprzedaż Błyskawiczna",
3686
+ "channelLabel": "Kanał",
3687
+ "templateLabel": "Szablon",
3688
+ "sendNowButton": "Wyślij Kampanię Teraz",
3689
+ "colCampaign": "Kampania",
3690
+ "colChannel": "Kanał",
3691
+ "colStatus": "Status",
3692
+ "colSentTotal": "Wysłane / Razem"
3693
+ },
3694
+ sandbox: {
3695
+ "title": "Lokalna Piaskownica SMS / OTP i Wielokanałowa",
3696
+ "subtitle": "Przechwytuje kody weryfikacyjne OTP i powiadomienia testowe lokalnie bez wysyłania prawdziwych wiadomości.",
3697
+ "clearButton": "Wyczyść Przechwycone Wiadomości",
3698
+ "colChannel": "Kanał",
3699
+ "colRecipient": "Odbiorca",
3700
+ "colOtp": "Kod OTP",
3701
+ "colBody": "Treść Wiadomości"
3702
+ },
3703
+ widget: {
3704
+ "title": "Wielokanałowe Powiadomienia Zamówienia ({{count}})",
3705
+ "subtitle": "Wyślij lub ponów E-mail, WhatsApp/OpenWA, Telegram lub SMS dla tego zamówienia (opcjonalnie z fakturą PDF).",
3706
+ "channelPlaceholder": "Kanał",
3707
+ "templatePlaceholder": "Szablon",
3708
+ "attachInvoiceLabel": "Dołącz fakturę PDF (jeśli wygenerowano)",
3709
+ "sending": "Wysyłanie...",
3710
+ "sendResendButton": "Wyślij / Ponów Powiadomienie",
3711
+ "dispatchedSuccess": "Wysłano powiadomienie ({{channel}})",
3712
+ "dispatchFailed": "Nie udało się wysłać powiadomienia",
3713
+ "colChannel": "Kanał",
3714
+ "colEventTemplate": "Zdarzenie / Szablon",
3715
+ "colRecipient": "Odbiorca",
3716
+ "colStatus": "Status"
3717
+ },
3718
+ messages: {
3719
+ "loadStudioError": "Nie udało się załadować danych Studia Powiadomień.",
3720
+ "clonedPresetSuccess": "Sklonowano szablon systemowy do edytowalnego szablonu '{{label}}'.",
3721
+ "clonePresetError": "Nie udało się sklonować szablonu systemowego.",
3722
+ "savedTemplateSuccess": "Zapisano szablon i drzewo bloków.",
3723
+ "saveTemplateError": "Nie udało się zapisać szablonu.",
3724
+ "createdMappingSuccess": "Utworzono aktywne mapowanie dla '{{event}}' -> '{{channel}}'.",
3725
+ "createMappingError": "Nie udało się utworzyć mapowania zdarzenia.",
3726
+ "verifiedChannelSuccess": "Zweryfikowano kanał '{{channel}}' i wysłano wiadomość testową.",
3727
+ "savedChannelSuccess": "Zapisano konfigurację kanału '{{channel}}'.",
3728
+ "channelActionError": "Błąd akcji {{action}} dla kanału {{channel}}",
3729
+ "broadcastSentSuccess": "Kampania masowa została wysłana do subskrybentów."
3730
+ }
3731
+ } },
3732
+ pt: { translation: {
3733
+ nav: { "label": "Notificações" },
3734
+ header: {
3735
+ "title": "Estúdio de Notificações Multicanal (E-mail, WhatsApp/OpenWA, Telegram, SMS, Slack)",
3736
+ "subtitle": "Construtor Visual de Blocos e Modelos, Mapeamento de Eventos em BD, Gateways Multi-Driver, Consentimento e Sandbox OTP.",
3737
+ "languageLabel": "Idioma",
3738
+ "refresh": "Atualizar Estúdio",
3739
+ "successBadge": "SUCESSO",
3740
+ "errorBadge": "ERRO"
3741
+ },
3742
+ tabs: {
3743
+ "templates": "Modelos e Construtor Visual ({{count}})",
3744
+ "mappings": "Mapeamento de Eventos ({{count}})",
3745
+ "channels": "Canais (OpenWA / Telegram / SMS)",
3746
+ "logs": "Registos de Envio ({{count}})",
3747
+ "broadcasts": "Campanhas e Consentimento",
3748
+ "sandbox": "Sandbox OTP ({{count}})"
3749
+ },
3750
+ templates: {
3751
+ "title": "Modelos",
3752
+ "filterChannel": "Filtrar Canal",
3753
+ "allChannels": "Todos os Canais",
3754
+ "modeLabel": "Modo: {{mode}}",
3755
+ "inspectPreview": "Inspecionar / Pré-visualizar",
3756
+ "cloneToDb": "Clonar para BD",
3757
+ "saveButton": "Guardar Modelo e Blocos",
3758
+ "subjectLabel": "Assunto (E-mail / Título)",
3759
+ "metaTemplateLabel": "Nome do Modelo Meta WABA (WhatsApp Cloud)",
3760
+ "rawContentLabel": "Conteúdo Raw (suporta {{data.*}}, {{translations.*}} e {{ .var }})",
3761
+ "blockTreeLabel": "Árvore Visual de Blocos ({{count}} blocos)",
3762
+ "removeBlock": "Remover",
3763
+ "previewTitle": "Pré-visualização Multicanal ao Vivo ({{locale}})",
3764
+ "contextPlaceholder": "Contexto",
3765
+ "localePlaceholder": "Idioma",
3766
+ "subjectPrefix": "Assunto: {{subject}}",
3767
+ "encodingBadge": "Codificação: {{encoding}}",
3768
+ "segmentsBadge": "Segmentos: {{segments}} ({{chars}} caracteres)",
3769
+ "waButtonPrefix": "[Botão WA] {{title}}",
3770
+ "tgInlinePrefix": "[Botão TG] {{text}}",
3771
+ "emptySelection": "Selecione um modelo à esquerda para inspecionar os blocos, clonar uma predefinição ou pré-visualizar."
3772
+ },
3773
+ mappings: {
3774
+ "title": "Criar Mapeamento Evento → Canal → Modelo",
3775
+ "eventLabel": "Evento da Loja Medusa",
3776
+ "channelLabel": "Canal",
3777
+ "templateLabel": "Modelo",
3778
+ "recipientRuleLabel": "Regra de Destinatário",
3779
+ "ruleCustomerAuto": "Cliente Automático",
3780
+ "ruleOrderEmail": "E-mail do Pedido",
3781
+ "ruleOrderPhone": "Telefone do Pedido (E.164)",
3782
+ "ruleCustomerTelegram": "Telegram DM do Cliente",
3783
+ "ruleMerchantChannel": "Canal / Grupo do Lojista",
3784
+ "ruleB2bAccounting": "Contacto Financeiro B2B",
3785
+ "threadIdLabel": "ID do Tópico Telegram (Opcional)",
3786
+ "threadIdPlaceholder": "ex. 42",
3787
+ "attachInvoiceLabel": "Anexar Fatura PDF automaticamente via medusa-documents-plugin (E-mail, WhatsApp/OpenWA e Telegram)",
3788
+ "addMappingButton": "Adicionar Mapeamento Ativo",
3789
+ "colEvent": "Evento",
3790
+ "colChannel": "Canal",
3791
+ "colTemplate": "Modelo",
3792
+ "colRecipientRule": "Destinatário",
3793
+ "colAttachments": "Anexos",
3794
+ "colAction": "Ação",
3795
+ "deleteButton": "Eliminar"
3796
+ },
3797
+ channels: {
3798
+ "whatsappTitle": "Gateway WhatsApp e OpenWA",
3799
+ "whatsappSubtitle": "Alterne entre a API Oficial Meta Cloud (Modelos WABA) e OpenWA / WAHA / Evolution API auto-hospedados.",
3800
+ "activeDriverLabel": "Driver Ativo",
3801
+ "driverMetaCloud": "Meta Cloud API (WABA Oficial)",
3802
+ "driverOpenWa": "OpenWA (@open-wa/wa-automate REST)",
3803
+ "driverWaha": "WAHA (WhatsApp HTTP API)",
3804
+ "driverEvolution": "Evolution API v2",
3805
+ "gatewayUrlLabel": "URL do Gateway OpenWA / WAHA / Evolution",
3806
+ "saveWhatsappButton": "Guardar Driver WhatsApp",
3807
+ "telegramTitle": "Notificações Telegram",
3808
+ "verifiedBadge": "Verificado",
3809
+ "unverifiedBadge": "Não Verificado",
3810
+ "telegramSubtitle": "Configure o supergrupo da loja (-100... ou @canal). Alterar o ID reinicia a verificação até enviar um teste.",
3811
+ "merchantChannelLabel": "ID do Canal / Supergrupo da Loja",
3812
+ "merchantChannelPlaceholder": "-1001234567890 ou @alertas_loja",
3813
+ "saveChannelIdButton": "Guardar ID do Canal",
3814
+ "sendTestButton": "Enviar Mensagem de Teste",
3815
+ "smsTitle": "Driver de Operadora SMS",
3816
+ "smsSubtitle": "Selecione Twilio SMS/MMS, Signal House (10DLC), MSG91 Flow, SMSAPI ou Sandbox OTP.",
3817
+ "smsDriverLabel": "Driver SMS",
3818
+ "driverTwilio": "Twilio (SMS / MMS + Messaging Service)",
3819
+ "driverSignalHouse": "Signal House (10DLC e Recuperação de Carrinho)",
3820
+ "driverMsg91": "MSG91 Flow API",
3821
+ "driverSmsApi": "SMSAPI",
3822
+ "driverDummy": "Sandbox OTP (Teste)",
3823
+ "saveSmsButton": "Guardar Driver SMS"
3824
+ },
3825
+ logs: {
3826
+ "title": "Registo de Entregas Protegido (PII Mascarado e Idempotente)",
3827
+ "colEvent": "Evento",
3828
+ "colChannel": "Canal",
3829
+ "colRecipient": "Destinatário (Mascarado)",
3830
+ "colStatus": "Estado",
3831
+ "colExternalId": "ID Externo"
3832
+ },
3833
+ broadcasts: {
3834
+ "title": "Resumo de Consentimento TCPA / 10DLC e Campanhas para Clientes",
3835
+ "smsOptedIn": "SMS Subscritos: {{count}}",
3836
+ "whatsappOptedIn": "WhatsApp Subscritos: {{count}}",
3837
+ "telegramLinked": "Telegram Associados: {{count}}",
3838
+ "optedOut": "Cancelados (STOP): {{count}}",
3839
+ "campaignNameLabel": "Nome da Campanha",
3840
+ "campaignNamePlaceholder": "Promoção Relâmpago de Fim de Semana",
3841
+ "channelLabel": "Canal",
3842
+ "templateLabel": "Modelo",
3843
+ "sendNowButton": "Enviar Campanha Agora",
3844
+ "colCampaign": "Campanha",
3845
+ "colChannel": "Canal",
3846
+ "colStatus": "Estado",
3847
+ "colSentTotal": "Enviados / Total"
3848
+ },
3849
+ sandbox: {
3850
+ "title": "Sandbox Local SMS / OTP e Multicanal",
3851
+ "subtitle": "Captura códigos OTP e notificações de teste localmente sem enviar mensagens reais.",
3852
+ "clearButton": "Limpar Mensagens Capturadas",
3853
+ "colChannel": "Canal",
3854
+ "colRecipient": "Destinatário",
3855
+ "colOtp": "OTP Extraído",
3856
+ "colBody": "Mensagem"
3857
+ },
3858
+ widget: {
3859
+ "title": "Notificações Multicanal do Pedido ({{count}})",
3860
+ "subtitle": "Envie ou reenvie E-mail, WhatsApp/OpenWA, Telegram ou SMS para este pedido (com fatura PDF opcional).",
3861
+ "channelPlaceholder": "Canal",
3862
+ "templatePlaceholder": "Modelo",
3863
+ "attachInvoiceLabel": "Anexar Fatura PDF (se gerada)",
3864
+ "sending": "A enviar...",
3865
+ "sendResendButton": "Enviar / Reenviar Notificação",
3866
+ "dispatchedSuccess": "Notificação {{channel}} enviada",
3867
+ "dispatchFailed": "Falha ao enviar notificação",
3868
+ "colChannel": "Canal",
3869
+ "colEventTemplate": "Evento / Modelo",
3870
+ "colRecipient": "Destinatário",
3871
+ "colStatus": "Estado"
3872
+ },
3873
+ messages: {
3874
+ "loadStudioError": "Falha ao carregar dados do Estúdio de Notificações.",
3875
+ "clonedPresetSuccess": "Predefinição clonada para o modelo editável '{{label}}'.",
3876
+ "clonePresetError": "Falha ao clonar predefinição do sistema.",
3877
+ "savedTemplateSuccess": "Modelo e árvore de blocos guardados.",
3878
+ "saveTemplateError": "Falha ao guardar o modelo.",
3879
+ "createdMappingSuccess": "Mapeamento ativo criado para '{{event}}' -> '{{channel}}'.",
3880
+ "createMappingError": "Falha ao criar mapeamento de evento.",
3881
+ "verifiedChannelSuccess": "Canal '{{channel}}' verificado e mensagem de teste enviada.",
3882
+ "savedChannelSuccess": "Configuração '{{channel}}' guardada.",
3883
+ "channelActionError": "Falha ao executar {{action}} em {{channel}}",
3884
+ "broadcastSentSuccess": "Campanha enviada para os destinatários subscritos."
3885
+ }
3886
+ } },
3887
+ tr: { translation: {
3888
+ nav: { "label": "Bildirimler" },
3889
+ header: {
3890
+ "title": "Çok Kanallı Bildirim Stüdyosu (E-posta, WhatsApp/OpenWA, Telegram, SMS, Slack)",
3891
+ "subtitle": "Görsel Blok ve Ham Şablon Oluşturucu, Veritabanı Olay Eşlemeleri, Çoklu Sürücü Ağ Geçitleri, İzin Kaydı ve Dummy OTP Sandbox.",
3892
+ "languageLabel": "Dil",
3893
+ "refresh": "Stüdyoyu Yenile",
3894
+ "successBadge": "BAŞARILI",
3895
+ "errorBadge": "HATA"
3896
+ },
3897
+ tabs: {
3898
+ "templates": "Şablonlar ve Görsel Oluşturucu ({{count}})",
3899
+ "mappings": "Olay Eşlemeleri ({{count}})",
3900
+ "channels": "Kanallar (OpenWA / Telegram / SMS)",
3901
+ "logs": "Teslimat Kayıtları ({{count}})",
3902
+ "broadcasts": "Toplu Gönderim ve İzin Defteri",
3903
+ "sandbox": "Dummy OTP Sandbox ({{count}})"
3904
+ },
3905
+ templates: {
3906
+ "title": "Şablonlar",
3907
+ "filterChannel": "Kanal Filtrele",
3908
+ "allChannels": "Tüm Kanallar",
3909
+ "modeLabel": "Mod: {{mode}}",
3910
+ "inspectPreview": "İncele / Önizle",
3911
+ "cloneToDb": "VT'ye Kopyala",
3912
+ "saveButton": "Şablonu ve Blokları Kaydet",
3913
+ "subjectLabel": "Konu Satırı (E-posta / Başlık)",
3914
+ "metaTemplateLabel": "Meta WABA Şablon Adı (WhatsApp Cloud)",
3915
+ "rawContentLabel": "Ham Şablon İçeriği ({{data.*}}, {{translations.*}} ve {{ .var }} destekler)",
3916
+ "blockTreeLabel": "Görsel Blok Ağacı ({{count}} blok)",
3917
+ "removeBlock": "Kaldır",
3918
+ "previewTitle": "Canlı Çok Kanallı Önizleme ({{locale}})",
3919
+ "contextPlaceholder": "Bağlam",
3920
+ "localePlaceholder": "Dil",
3921
+ "subjectPrefix": "Konu: {{subject}}",
3922
+ "encodingBadge": "Kodlama: {{encoding}}",
3923
+ "segmentsBadge": "Segment: {{segments}} ({{chars}} karakter)",
3924
+ "waButtonPrefix": "[WA Butonu] {{title}}",
3925
+ "tgInlinePrefix": "[TG Butonu] {{text}}",
3926
+ "emptySelection": "Blok ağacını incelemek, sistem şablonunu kopyalamak veya farklı dillerde önizlemek için soldan bir şablon seçin."
3927
+ },
3928
+ mappings: {
3929
+ "title": "Olay → Kanal → Şablon Eşlemesi Oluştur",
3930
+ "eventLabel": "Medusa Mağaza Olayı",
3931
+ "channelLabel": "Kanal",
3932
+ "templateLabel": "Şablon",
3933
+ "recipientRuleLabel": "Alıcı Kuralı",
3934
+ "ruleCustomerAuto": "Müşteri Otomatik",
3935
+ "ruleOrderEmail": "Sipariş E-postası",
3936
+ "ruleOrderPhone": "Sipariş Telefonu (E.164)",
3937
+ "ruleCustomerTelegram": "Müşteri Telegram DM",
3938
+ "ruleMerchantChannel": "Mağaza Kanalı / Grubu",
3939
+ "ruleB2bAccounting": "B2B Muhasebe Yetkilisi",
3940
+ "threadIdLabel": "Telegram Konu (Thread) ID (İsteğe Bağlı)",
3941
+ "threadIdPlaceholder": "örn. 42",
3942
+ "attachInvoiceLabel": "medusa-documents-plugin üzerinden PDF Faturayı otomatik ekle (E-posta, WhatsApp/OpenWA ve Telegram)",
3943
+ "addMappingButton": "Aktif Eşleme Ekle",
3944
+ "colEvent": "Olay",
3945
+ "colChannel": "Kanal",
3946
+ "colTemplate": "Şablon",
3947
+ "colRecipientRule": "Alıcı Kuralı",
3948
+ "colAttachments": "Ekler",
3949
+ "colAction": "İşlem",
3950
+ "deleteButton": "Sil"
3951
+ },
3952
+ channels: {
3953
+ "whatsappTitle": "WhatsApp ve OpenWA Ağ Geçidi",
3954
+ "whatsappSubtitle": "Resmi Meta Cloud API (WABA Şablonları) ile kendi barındırdığınız OpenWA / WAHA / Evolution API arasında geçiş yapın.",
3955
+ "activeDriverLabel": "Aktif Sürücü",
3956
+ "driverMetaCloud": "Meta Cloud API (Resmi WABA)",
3957
+ "driverOpenWa": "OpenWA (@open-wa/wa-automate REST)",
3958
+ "driverWaha": "WAHA (WhatsApp HTTP API)",
3959
+ "driverEvolution": "Evolution API v2",
3960
+ "gatewayUrlLabel": "OpenWA / WAHA / Evolution Ağ Geçidi URL'si",
3961
+ "saveWhatsappButton": "WhatsApp Sürücüsünü Kaydet",
3962
+ "telegramTitle": "Telegram Bildirimleri",
3963
+ "verifiedBadge": "Doğrulandı",
3964
+ "unverifiedBadge": "Doğrulanmadı",
3965
+ "telegramSubtitle": "Mağaza Süper Grubunu (-100... veya @kanal) yapılandırın. Kanal ID'sini değiştirmek, test mesajı başarılı olana kadar doğrulamayı sıfırlar.",
3966
+ "merchantChannelLabel": "Mağaza Kanal / Süper Grup ID",
3967
+ "merchantChannelPlaceholder": "-1001234567890 veya @magaza_uyarilari",
3968
+ "saveChannelIdButton": "Kanal ID Kaydet",
3969
+ "sendTestButton": "Test Mesajı Gönder",
3970
+ "smsTitle": "SMS Operatör Sürücüsü",
3971
+ "smsSubtitle": "Twilio SMS/MMS, Signal House (10DLC), MSG91 Flow, SMSAPI veya Dummy Sandbox seçin.",
3972
+ "smsDriverLabel": "SMS Sürücüsü",
3973
+ "driverTwilio": "Twilio (SMS / MMS + Mesajlaşma Servisi)",
3974
+ "driverSignalHouse": "Signal House (10DLC ve Sepet Kurtarma)",
3975
+ "driverMsg91": "MSG91 Flow API",
3976
+ "driverSmsApi": "SMSAPI",
3977
+ "driverDummy": "Dummy OTP Sandbox (Test)",
3978
+ "saveSmsButton": "SMS Sürücüsünü Kaydet"
3979
+ },
3980
+ logs: {
3981
+ "title": "Maskelenmiş Teslimat Kayıtları (KVKK/PII Korumalı ve İdempotent)",
3982
+ "colEvent": "Olay",
3983
+ "colChannel": "Kanal",
3984
+ "colRecipient": "Alıcı (Maskelenmiş)",
3985
+ "colStatus": "Durum",
3986
+ "colExternalId": "Harici ID"
3987
+ },
3988
+ broadcasts: {
3989
+ "title": "TCPA / 10DLC İzin Özeti ve Müşteri Grubu Duyuruları",
3990
+ "smsOptedIn": "SMS Onaylı: {{count}}",
3991
+ "whatsappOptedIn": "WhatsApp Onaylı: {{count}}",
3992
+ "telegramLinked": "Telegram Bağlı: {{count}}",
3993
+ "optedOut": "İptal Edenler (STOP): {{count}}",
3994
+ "campaignNameLabel": "Kampanya Adı",
3995
+ "campaignNamePlaceholder": "Hafta Sonu Flaş İndirimi",
3996
+ "channelLabel": "Kanal",
3997
+ "templateLabel": "Şablon",
3998
+ "sendNowButton": "Duyuruyu Şimdi Gönder",
3999
+ "colCampaign": "Kampanya",
4000
+ "colChannel": "Kanal",
4001
+ "colStatus": "Durum",
4002
+ "colSentTotal": "Gönderilen / Toplam"
4003
+ },
4004
+ sandbox: {
4005
+ "title": "Dummy SMS / OTP ve Çok Kanallı Sandbox",
4006
+ "subtitle": "Gerçek operatör mesajı göndermeden OTP doğrulama kodlarını ve test bildirimlerini yerel olarak yakalar.",
4007
+ "clearButton": "Yakalanan Mesajları Temizle",
4008
+ "colChannel": "Kanal",
4009
+ "colRecipient": "Alıcı",
4010
+ "colOtp": "Çıkarılan OTP",
4011
+ "colBody": "Mesaj İçeriği"
4012
+ },
4013
+ widget: {
4014
+ "title": "Çok Kanallı Sipariş Bildirimleri ({{count}})",
4015
+ "subtitle": "Bu sipariş için E-posta, WhatsApp/OpenWA, Telegram veya SMS gönderin / yeniden gönderin (isteğe bağlı PDF fatura ekiyle).",
4016
+ "channelPlaceholder": "Kanal",
4017
+ "templatePlaceholder": "Şablon",
4018
+ "attachInvoiceLabel": "PDF Faturayı Ekle (oluşturulduysa)",
4019
+ "sending": "Gönderiliyor...",
4020
+ "sendResendButton": "Bildirim Gönder / Yeniden Gönder",
4021
+ "dispatchedSuccess": "{{channel}} bildirimi gönderildi",
4022
+ "dispatchFailed": "Bildirim gönderilemedi",
4023
+ "colChannel": "Kanal",
4024
+ "colEventTemplate": "Olay / Şablon",
4025
+ "colRecipient": "Alıcı",
4026
+ "colStatus": "Durum"
4027
+ },
4028
+ messages: {
4029
+ "loadStudioError": "Bildirim Stüdyosu verileri yüklenemedi.",
4030
+ "clonedPresetSuccess": "Sistem şablonu düzenlenebilir '{{label}}' şablonuna kopyalandı.",
4031
+ "clonePresetError": "Sistem şablonu kopyalanamadı.",
4032
+ "savedTemplateSuccess": "Şablon ve blok ağacı kaydedildi.",
4033
+ "saveTemplateError": "Şablon kaydedilemedi.",
4034
+ "createdMappingSuccess": "'{{event}}' -> '{{channel}}' için aktif eşleme oluşturuldu.",
4035
+ "createMappingError": "Olay eşlemesi oluşturulamadı.",
4036
+ "verifiedChannelSuccess": "'{{channel}}' kanalı doğrulandı ve test mesajı gönderildi.",
4037
+ "savedChannelSuccess": "'{{channel}}' yapılandırması kaydedildi.",
4038
+ "channelActionError": "{{channel}} için {{action}} işlemi başarısız oldu",
4039
+ "broadcastSentSuccess": "Toplu bildirim kampanyası onaylı alıcılara gönderildi."
4040
+ }
4041
+ } }
4042
+ };
4043
+ var plugin = {
4044
+ widgetModule: { widgets: [{
4045
+ Component: OrderNotificationsActivityWidget,
4046
+ zone: ["order.details.after"],
4047
+ widgetId: "Widget-7197"
4048
+ }] },
4049
+ routeModule: { routes: [
4050
+ {
4051
+ Component: GuardedNotificationStudioOverviewPage,
4052
+ path: "/mpn",
4053
+ handle: {
4054
+ label: config$6.label,
4055
+ translationNs: config$6.translationNs,
4056
+ permissions: config$6.permissions,
4057
+ ...handle$6
4058
+ }
4059
+ },
4060
+ {
4061
+ Component: GuardedMpnChannelsPage,
4062
+ path: "/mpn/channels",
4063
+ handle: {
4064
+ label: config$5.label,
4065
+ translationNs: config$5.translationNs,
4066
+ permissions: config$5.permissions,
4067
+ ...handle$5
4068
+ }
4069
+ },
4070
+ {
4071
+ Component: GuardedMpnBroadcastsPage,
4072
+ path: "/mpn/broadcasts",
4073
+ handle: {
4074
+ label: config$4.label,
4075
+ translationNs: config$4.translationNs,
4076
+ permissions: config$4.permissions,
4077
+ ...handle$4
4078
+ }
4079
+ },
4080
+ {
4081
+ Component: GuardedMpnLogsPage,
4082
+ path: "/mpn/logs",
4083
+ handle: {
4084
+ label: config$3.label,
4085
+ translationNs: config$3.translationNs,
4086
+ permissions: config$3.permissions,
4087
+ ...handle$3
4088
+ }
4089
+ },
4090
+ {
4091
+ Component: GuardedMpnMappingsPage,
4092
+ path: "/mpn/mappings",
4093
+ handle: {
4094
+ label: config$2.label,
4095
+ translationNs: config$2.translationNs,
4096
+ permissions: config$2.permissions,
4097
+ ...handle$2
4098
+ }
4099
+ },
4100
+ {
4101
+ Component: GuardedMpnSandboxPage,
4102
+ path: "/mpn/sandbox",
4103
+ handle: {
4104
+ label: config$1.label,
4105
+ translationNs: config$1.translationNs,
4106
+ permissions: config$1.permissions,
4107
+ ...handle$1
4108
+ }
4109
+ },
4110
+ {
4111
+ Component: GuardedMpnTemplatesPage,
4112
+ path: "/mpn/templates",
4113
+ handle: {
4114
+ label: config.label,
4115
+ translationNs: config.translationNs,
4116
+ permissions: config.permissions,
4117
+ ...handle
4118
+ }
4119
+ }
4120
+ ] },
4121
+ menuItemModule: { menuItems: [
4122
+ {
4123
+ label: config$6.label,
4124
+ icon: config$6.icon,
4125
+ path: "/mpn",
4126
+ nested: void 0,
4127
+ rank: void 0,
4128
+ translationNs: config$6.translationNs,
4129
+ permissions: void 0
4130
+ },
4131
+ {
4132
+ label: config$4.label,
4133
+ icon: config$4.icon,
4134
+ path: "/mpn/broadcasts",
4135
+ nested: void 0,
4136
+ rank: void 0,
4137
+ translationNs: config$4.translationNs,
4138
+ permissions: void 0
4139
+ },
4140
+ {
4141
+ label: config$5.label,
4142
+ icon: config$5.icon,
4143
+ path: "/mpn/channels",
4144
+ nested: void 0,
4145
+ rank: void 0,
4146
+ translationNs: config$5.translationNs,
4147
+ permissions: void 0
4148
+ },
4149
+ {
4150
+ label: config$3.label,
4151
+ icon: config$3.icon,
4152
+ path: "/mpn/logs",
4153
+ nested: void 0,
4154
+ rank: void 0,
4155
+ translationNs: config$3.translationNs,
4156
+ permissions: void 0
4157
+ },
4158
+ {
4159
+ label: config$2.label,
4160
+ icon: config$2.icon,
4161
+ path: "/mpn/mappings",
4162
+ nested: void 0,
4163
+ rank: void 0,
4164
+ translationNs: config$2.translationNs,
4165
+ permissions: void 0
4166
+ },
4167
+ {
4168
+ label: config$1.label,
4169
+ icon: config$1.icon,
4170
+ path: "/mpn/sandbox",
4171
+ nested: void 0,
4172
+ rank: void 0,
4173
+ translationNs: config$1.translationNs,
4174
+ permissions: void 0
4175
+ },
4176
+ {
4177
+ label: config.label,
4178
+ icon: config.icon,
4179
+ path: "/mpn/templates",
4180
+ nested: void 0,
4181
+ rank: void 0,
4182
+ translationNs: config.translationNs,
4183
+ permissions: void 0
4184
+ }
4185
+ ] },
4186
+ formModule: { customFields: {} },
4187
+ displayModule: { displays: {} },
4188
+ i18nModule: { resources: i18n_default },
4189
+ cellRendererModule: {},
4190
+ layoutModule: { layouts: [] },
4191
+ searchEntityModule: {}
4192
+ };
4193
+ export { plugin as default };