@resulticks/trustsignal-wa-hsm 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/resulticks-trustsignal-wa-hsm.cjs.js +20 -20
- package/dist/resulticks-trustsignal-wa-hsm.es.js +1030 -1012
- package/dist/style.css +1 -1
- package/package.json +1 -1
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { jsx as e, jsxs as r, Fragment as
|
|
2
|
-
import
|
|
3
|
-
import { useNavigate as
|
|
4
|
-
const
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as ne } from "react/jsx-runtime";
|
|
2
|
+
import K, { forwardRef as Le, createElement as be, useRef as Te, useEffect as se, useState as B, useMemo as Ne, useCallback as ge, createContext as Se } from "react";
|
|
3
|
+
import { useNavigate as Ce, useInRouterContext as ye } from "react-router-dom";
|
|
4
|
+
const Ve = async (a, n = {}) => {
|
|
5
5
|
try {
|
|
6
|
-
return await
|
|
6
|
+
return await je(a.apiKey);
|
|
7
7
|
} catch (i) {
|
|
8
8
|
return console.error("API Error:", i), {
|
|
9
9
|
status: "error",
|
|
10
10
|
message: i instanceof Error ? i.message : "Failed to fetch templates"
|
|
11
11
|
};
|
|
12
12
|
}
|
|
13
|
-
},
|
|
13
|
+
}, je = async (a) => {
|
|
14
14
|
const n = await fetch(
|
|
15
15
|
"https://wpapi.trustsignal.io/api/v1/template?page=1&limit=100",
|
|
16
16
|
{
|
|
@@ -54,7 +54,7 @@ const Le = async (a, n = {}) => {
|
|
|
54
54
|
* This source code is licensed under the ISC license.
|
|
55
55
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
56
|
*/
|
|
57
|
-
var
|
|
57
|
+
var Ue = {
|
|
58
58
|
xmlns: "http://www.w3.org/2000/svg",
|
|
59
59
|
width: 24,
|
|
60
60
|
height: 24,
|
|
@@ -71,31 +71,31 @@ var Se = {
|
|
|
71
71
|
* This source code is licensed under the ISC license.
|
|
72
72
|
* See the LICENSE file in the root directory of this source tree.
|
|
73
73
|
*/
|
|
74
|
-
const
|
|
75
|
-
const i =
|
|
74
|
+
const Ae = (a) => a.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim(), H = (a, n) => {
|
|
75
|
+
const i = Le(
|
|
76
76
|
({
|
|
77
77
|
color: l = "currentColor",
|
|
78
78
|
size: d = 24,
|
|
79
|
-
strokeWidth:
|
|
79
|
+
strokeWidth: p = 2,
|
|
80
80
|
absoluteStrokeWidth: m,
|
|
81
|
-
className:
|
|
82
|
-
children:
|
|
83
|
-
...
|
|
84
|
-
},
|
|
81
|
+
className: C = "",
|
|
82
|
+
children: g,
|
|
83
|
+
...f
|
|
84
|
+
}, y) => be(
|
|
85
85
|
"svg",
|
|
86
86
|
{
|
|
87
|
-
ref:
|
|
88
|
-
...
|
|
87
|
+
ref: y,
|
|
88
|
+
...Ue,
|
|
89
89
|
width: d,
|
|
90
90
|
height: d,
|
|
91
91
|
stroke: l,
|
|
92
|
-
strokeWidth: m ? Number(
|
|
93
|
-
className: ["lucide", `lucide-${
|
|
94
|
-
...
|
|
92
|
+
strokeWidth: m ? Number(p) * 24 / Number(d) : p,
|
|
93
|
+
className: ["lucide", `lucide-${Ae(a)}`, C].join(" "),
|
|
94
|
+
...f
|
|
95
95
|
},
|
|
96
96
|
[
|
|
97
|
-
...n.map(([
|
|
98
|
-
...Array.isArray(
|
|
97
|
+
...n.map(([j, U]) => be(j, U)),
|
|
98
|
+
...Array.isArray(g) ? g : [g]
|
|
99
99
|
]
|
|
100
100
|
)
|
|
101
101
|
);
|
|
@@ -107,7 +107,7 @@ const Ve = (a) => a.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim(),
|
|
|
107
107
|
* This source code is licensed under the ISC license.
|
|
108
108
|
* See the LICENSE file in the root directory of this source tree.
|
|
109
109
|
*/
|
|
110
|
-
const
|
|
110
|
+
const ce = H("AlertCircle", [
|
|
111
111
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
112
112
|
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
113
113
|
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
@@ -118,7 +118,7 @@ const ie = q("AlertCircle", [
|
|
|
118
118
|
* This source code is licensed under the ISC license.
|
|
119
119
|
* See the LICENSE file in the root directory of this source tree.
|
|
120
120
|
*/
|
|
121
|
-
const
|
|
121
|
+
const Re = H("ArrowRight", [
|
|
122
122
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
123
123
|
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
124
124
|
]);
|
|
@@ -128,7 +128,7 @@ const je = q("ArrowRight", [
|
|
|
128
128
|
* This source code is licensed under the ISC license.
|
|
129
129
|
* See the LICENSE file in the root directory of this source tree.
|
|
130
130
|
*/
|
|
131
|
-
const
|
|
131
|
+
const Be = H("ExternalLink", [
|
|
132
132
|
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
133
133
|
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
134
134
|
["path", { d: "M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6", key: "a6xqqp" }]
|
|
@@ -139,7 +139,7 @@ const Ue = q("ExternalLink", [
|
|
|
139
139
|
* This source code is licensed under the ISC license.
|
|
140
140
|
* See the LICENSE file in the root directory of this source tree.
|
|
141
141
|
*/
|
|
142
|
-
const
|
|
142
|
+
const Ie = H("FileText", [
|
|
143
143
|
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
144
144
|
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
145
145
|
["path", { d: "M10 9H8", key: "b1mrlr" }],
|
|
@@ -152,7 +152,7 @@ const Ae = q("FileText", [
|
|
|
152
152
|
* This source code is licensed under the ISC license.
|
|
153
153
|
* See the LICENSE file in the root directory of this source tree.
|
|
154
154
|
*/
|
|
155
|
-
const
|
|
155
|
+
const ze = H("FileVideo", [
|
|
156
156
|
["path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z", key: "1rqfz7" }],
|
|
157
157
|
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
158
158
|
["path", { d: "m10 11 5 3-5 3v-6Z", key: "7ntvm4" }]
|
|
@@ -163,7 +163,7 @@ const Re = q("FileVideo", [
|
|
|
163
163
|
* This source code is licensed under the ISC license.
|
|
164
164
|
* See the LICENSE file in the root directory of this source tree.
|
|
165
165
|
*/
|
|
166
|
-
const
|
|
166
|
+
const Oe = H("Link", [
|
|
167
167
|
["path", { d: "M10 13a5 5 0 0 0 7.54.54l3-3a5 5 0 0 0-7.07-7.07l-1.72 1.71", key: "1cjeqo" }],
|
|
168
168
|
["path", { d: "M14 11a5 5 0 0 0-7.54-.54l-3 3a5 5 0 0 0 7.07 7.07l1.71-1.71", key: "19qd67" }]
|
|
169
169
|
]);
|
|
@@ -173,7 +173,7 @@ const Ie = q("Link", [
|
|
|
173
173
|
* This source code is licensed under the ISC license.
|
|
174
174
|
* See the LICENSE file in the root directory of this source tree.
|
|
175
175
|
*/
|
|
176
|
-
const
|
|
176
|
+
const le = H("MessageCircle", [
|
|
177
177
|
["path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z", key: "vv11sd" }]
|
|
178
178
|
]);
|
|
179
179
|
/**
|
|
@@ -182,7 +182,7 @@ const re = q("MessageCircle", [
|
|
|
182
182
|
* This source code is licensed under the ISC license.
|
|
183
183
|
* See the LICENSE file in the root directory of this source tree.
|
|
184
184
|
*/
|
|
185
|
-
const
|
|
185
|
+
const Me = H("Phone", [
|
|
186
186
|
[
|
|
187
187
|
"path",
|
|
188
188
|
{
|
|
@@ -197,7 +197,7 @@ const ke = q("Phone", [
|
|
|
197
197
|
* This source code is licensed under the ISC license.
|
|
198
198
|
* See the LICENSE file in the root directory of this source tree.
|
|
199
199
|
*/
|
|
200
|
-
const
|
|
200
|
+
const de = H("Plus", [
|
|
201
201
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
202
202
|
["path", { d: "M12 5v14", key: "s699le" }]
|
|
203
203
|
]);
|
|
@@ -207,7 +207,7 @@ const te = q("Plus", [
|
|
|
207
207
|
* This source code is licensed under the ISC license.
|
|
208
208
|
* See the LICENSE file in the root directory of this source tree.
|
|
209
209
|
*/
|
|
210
|
-
const
|
|
210
|
+
const Pe = H("Reply", [
|
|
211
211
|
["polyline", { points: "9 17 4 12 9 7", key: "hvgpf2" }],
|
|
212
212
|
["path", { d: "M20 18v-2a4 4 0 0 0-4-4H4", key: "5vmcpk" }]
|
|
213
213
|
]);
|
|
@@ -217,7 +217,7 @@ const Be = q("Reply", [
|
|
|
217
217
|
* This source code is licensed under the ISC license.
|
|
218
218
|
* See the LICENSE file in the root directory of this source tree.
|
|
219
219
|
*/
|
|
220
|
-
const
|
|
220
|
+
const xe = H("Smile", [
|
|
221
221
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
222
222
|
["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
|
|
223
223
|
["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
|
|
@@ -229,7 +229,7 @@ const me = q("Smile", [
|
|
|
229
229
|
* This source code is licensed under the ISC license.
|
|
230
230
|
* See the LICENSE file in the root directory of this source tree.
|
|
231
231
|
*/
|
|
232
|
-
const
|
|
232
|
+
const _e = H("Upload", [
|
|
233
233
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
234
234
|
["polyline", { points: "17 8 12 3 7 8", key: "t8dd8p" }],
|
|
235
235
|
["line", { x1: "12", x2: "12", y1: "3", y2: "15", key: "widbto" }]
|
|
@@ -240,7 +240,7 @@ const ze = q("Upload", [
|
|
|
240
240
|
* This source code is licensed under the ISC license.
|
|
241
241
|
* See the LICENSE file in the root directory of this source tree.
|
|
242
242
|
*/
|
|
243
|
-
const
|
|
243
|
+
const Fe = H("Workflow", [
|
|
244
244
|
["rect", { width: "8", height: "8", x: "3", y: "3", rx: "2", key: "by2w9f" }],
|
|
245
245
|
["path", { d: "M7 11v4a2 2 0 0 0 2 2h4", key: "xkn7yn" }],
|
|
246
246
|
["rect", { width: "8", height: "8", x: "13", y: "13", rx: "2", key: "1cgmvn" }]
|
|
@@ -251,18 +251,18 @@ const Pe = q("Workflow", [
|
|
|
251
251
|
* This source code is licensed under the ISC license.
|
|
252
252
|
* See the LICENSE file in the root directory of this source tree.
|
|
253
253
|
*/
|
|
254
|
-
const
|
|
254
|
+
const ee = H("X", [
|
|
255
255
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
256
256
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
257
257
|
]);
|
|
258
|
-
function
|
|
259
|
-
const d =
|
|
260
|
-
return
|
|
261
|
-
const
|
|
258
|
+
function pe({ isOpen: a, onClose: n, title: i, children: l }) {
|
|
259
|
+
const d = Te(null);
|
|
260
|
+
return se(() => {
|
|
261
|
+
const p = (m) => {
|
|
262
262
|
d.current && !d.current.contains(m.target) && n();
|
|
263
263
|
};
|
|
264
|
-
return a && document.addEventListener("mousedown",
|
|
265
|
-
document.removeEventListener("mousedown",
|
|
264
|
+
return a && document.addEventListener("mousedown", p), () => {
|
|
265
|
+
document.removeEventListener("mousedown", p);
|
|
266
266
|
};
|
|
267
267
|
}, [a, n]), a ? /* @__PURE__ */ e("div", { className: "rsp-fixed rsp-inset-0 rsp-bg-black rsp-bg-opacity-50 rsp-flex rsp-items-center rsp-justify-center rsp-p-4 rsp-z-50", children: /* @__PURE__ */ r("div", { ref: d, className: "rsp-bg-white rsp-rounded-lg rsp-shadow-xl rsp-w-full rsp-max-w-[600px] rsp-animate-modal-appear", style: { backgroundColor: "#f5f7fc" }, children: [
|
|
268
268
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-px-6 rsp-py-4 rsp-border-b", children: [
|
|
@@ -272,58 +272,58 @@ function ce({ isOpen: a, onClose: n, title: i, children: l }) {
|
|
|
272
272
|
{
|
|
273
273
|
onClick: n,
|
|
274
274
|
className: "rsp-p-1 hover:rsp-bg-gray-100 rsp-rounded-full",
|
|
275
|
-
children: /* @__PURE__ */ e(
|
|
275
|
+
children: /* @__PURE__ */ e(ee, { className: "rsp-w-5 rsp-h-5 rsp-text-gray-500" })
|
|
276
276
|
}
|
|
277
277
|
)
|
|
278
278
|
] }),
|
|
279
279
|
/* @__PURE__ */ e("div", { className: "rsp-px-6 rsp-py-4 rsp-overflow-y-auto rsp-max-h-[70vh] rsp-break-words rsp-whitespace-pre-wrap", children: l })
|
|
280
280
|
] }) }) : null;
|
|
281
281
|
}
|
|
282
|
-
function
|
|
283
|
-
const a =
|
|
284
|
-
const
|
|
285
|
-
return
|
|
282
|
+
function ga() {
|
|
283
|
+
const a = Ce(), [n, i] = B([]), [l, d] = B(!0), [p, m] = B(null), [C, g] = B(() => {
|
|
284
|
+
const c = localStorage.getItem("account");
|
|
285
|
+
return c ? JSON.parse(c) : {
|
|
286
286
|
apiKey: ""
|
|
287
287
|
};
|
|
288
|
-
}), [
|
|
289
|
-
|
|
288
|
+
}), [f, y] = B(""), [j, U] = B("all"), [k, N] = B("all"), [o, u] = B("all"), [t, h] = B(1), v = 20, [V, R] = B({ isOpen: !1 });
|
|
289
|
+
se(() => {
|
|
290
290
|
(async () => {
|
|
291
291
|
try {
|
|
292
|
-
if (m(null), d(!0), i([]), !
|
|
292
|
+
if (m(null), d(!0), i([]), !C.apiKey) {
|
|
293
293
|
m("Please enter your TrustSignal API key"), d(!1);
|
|
294
294
|
return;
|
|
295
295
|
}
|
|
296
|
-
const
|
|
296
|
+
const M = await Ve(C, {
|
|
297
297
|
limit: 1e3
|
|
298
298
|
});
|
|
299
|
-
if (
|
|
300
|
-
throw new Error(
|
|
301
|
-
i(
|
|
302
|
-
} catch (
|
|
303
|
-
m(
|
|
299
|
+
if (M.status === "error")
|
|
300
|
+
throw new Error(M.message);
|
|
301
|
+
i(M.data);
|
|
302
|
+
} catch (M) {
|
|
303
|
+
m(M instanceof Error ? M.message : "Failed to fetch templates"), i([]);
|
|
304
304
|
} finally {
|
|
305
305
|
d(!1);
|
|
306
306
|
}
|
|
307
307
|
})();
|
|
308
|
-
}, [
|
|
309
|
-
const
|
|
310
|
-
const { name:
|
|
311
|
-
...
|
|
312
|
-
[
|
|
308
|
+
}, [C]);
|
|
309
|
+
const I = (c) => {
|
|
310
|
+
const { name: M, value: A } = c.target, O = {
|
|
311
|
+
...C,
|
|
312
|
+
[M]: A
|
|
313
313
|
};
|
|
314
|
-
|
|
315
|
-
},
|
|
316
|
-
|
|
314
|
+
g(O), localStorage.setItem("account", JSON.stringify(O));
|
|
315
|
+
}, x = (c, M) => {
|
|
316
|
+
R({
|
|
317
317
|
isOpen: !0,
|
|
318
|
-
url:
|
|
319
|
-
templateName:
|
|
318
|
+
url: c,
|
|
319
|
+
templateName: M
|
|
320
320
|
});
|
|
321
|
-
},
|
|
322
|
-
|
|
323
|
-
},
|
|
324
|
-
const
|
|
325
|
-
return
|
|
326
|
-
}),
|
|
321
|
+
}, w = () => {
|
|
322
|
+
R({ isOpen: !1 });
|
|
323
|
+
}, L = n.filter((c) => {
|
|
324
|
+
const M = f.trim(), A = M.toLowerCase(), O = M === "" || c.id.toString().includes(M) || c.name.toLowerCase().includes(A), $ = j === "all" || c.status.toLowerCase() === j.toLowerCase(), X = k === "all" || c.category.toLowerCase() === k.toLowerCase(), S = o === "all" || c.language.toLowerCase().startsWith(o.toLowerCase());
|
|
325
|
+
return O && $ && X && S;
|
|
326
|
+
}), s = Math.ceil(L.length / v), b = (t - 1) * v, E = b + v, T = L.slice(b, E);
|
|
327
327
|
return l ? /* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center rsp-justify-center rsp-min-h-screen", children: /* @__PURE__ */ e("div", { className: "rsp-text-lg rsp-text-gray-600", children: "Loading templates..." }) }) : /* @__PURE__ */ r("div", { className: "rsp-container rsp-mx-auto rsp-px-4 rsp-py-8 rsp-bg-[#f5f7fc] rsp-rounded-lg rsp-shadow-sm", children: [
|
|
328
328
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between rsp-items-center rsp-mb-6", children: [
|
|
329
329
|
/* @__PURE__ */ e("h1", { className: "rsp-text-2xl rsp-font-bold", children: "Whatsapp HSM Templates" }),
|
|
@@ -332,7 +332,7 @@ function ha() {
|
|
|
332
332
|
{
|
|
333
333
|
onClick: () => a("/create"),
|
|
334
334
|
className: "rsp-bg-blue-600 rsp-text-white rsp-p-1 rsp-rounded-full hover:rsp-bg-blue-700 rsp-flex rsp-items-center rsp-gap-2",
|
|
335
|
-
children: /* @__PURE__ */ e(
|
|
335
|
+
children: /* @__PURE__ */ e(de, { className: "rsp-w-6 rsp-h-6" })
|
|
336
336
|
}
|
|
337
337
|
)
|
|
338
338
|
] }),
|
|
@@ -344,8 +344,8 @@ function ha() {
|
|
|
344
344
|
{
|
|
345
345
|
type: "password",
|
|
346
346
|
name: "apiKey",
|
|
347
|
-
value:
|
|
348
|
-
onChange:
|
|
347
|
+
value: C.apiKey,
|
|
348
|
+
onChange: I,
|
|
349
349
|
className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",
|
|
350
350
|
placeholder: "Enter your TrustSignal API key"
|
|
351
351
|
}
|
|
@@ -353,17 +353,17 @@ function ha() {
|
|
|
353
353
|
/* @__PURE__ */ e("div", { className: "rsp-absolute rsp-bottom-0 rsp-left-0 rsp-w-4 rsp-h-0.5 rsp-bg-red-500" })
|
|
354
354
|
] })
|
|
355
355
|
] }) }),
|
|
356
|
-
|
|
357
|
-
/* @__PURE__ */ e("div", { className: "rsp-flex-shrink-0", children: /* @__PURE__ */ e(
|
|
358
|
-
/* @__PURE__ */ e("div", { className: "rsp-ml-3", children: /* @__PURE__ */ e("p", { className: "rsp-text-sm rsp-text-red-700", children:
|
|
356
|
+
p && /* @__PURE__ */ e("div", { className: "rsp-bg-red-50 rsp-border-l-4 rsp-border-red-500 rsp-p-4 rsp-mb-6", children: /* @__PURE__ */ r("div", { className: "rsp-flex", children: [
|
|
357
|
+
/* @__PURE__ */ e("div", { className: "rsp-flex-shrink-0", children: /* @__PURE__ */ e(ce, { className: "rsp-h-5 rsp-w-5 rsp-text-red-400" }) }),
|
|
358
|
+
/* @__PURE__ */ e("div", { className: "rsp-ml-3", children: /* @__PURE__ */ e("p", { className: "rsp-text-sm rsp-text-red-700", children: p }) })
|
|
359
359
|
] }) }),
|
|
360
360
|
/* @__PURE__ */ e("div", { className: "rsp-mb-6", children: /* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
|
|
361
361
|
"input",
|
|
362
362
|
{
|
|
363
363
|
type: "text",
|
|
364
364
|
placeholder: "Search by name or ID...",
|
|
365
|
-
value:
|
|
366
|
-
onChange: (
|
|
365
|
+
value: f,
|
|
366
|
+
onChange: (c) => y(c.target.value),
|
|
367
367
|
className: "rsp-w-full rsp-px-0 rsp-py-3 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent"
|
|
368
368
|
}
|
|
369
369
|
) }) }),
|
|
@@ -376,10 +376,10 @@ function ha() {
|
|
|
376
376
|
/* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center", children: /* @__PURE__ */ r(
|
|
377
377
|
"select",
|
|
378
378
|
{
|
|
379
|
-
value:
|
|
380
|
-
onChange: (
|
|
379
|
+
value: k,
|
|
380
|
+
onChange: (c) => N(c.target.value),
|
|
381
381
|
className: "rsp-cursor-pointer rsp-ml-2 rsp-bg-transparent rsp-text-white rsp-border-0 rsp-text-sm focus:rsp-outline-none ",
|
|
382
|
-
onClick: (
|
|
382
|
+
onClick: (c) => c.stopPropagation(),
|
|
383
383
|
children: [
|
|
384
384
|
/* @__PURE__ */ e("option", { value: "all", className: "rsp-text-gray-900", children: "All" }),
|
|
385
385
|
/* @__PURE__ */ e("option", { value: "utility", className: "rsp-text-gray-900", children: "Utility" }),
|
|
@@ -395,10 +395,10 @@ function ha() {
|
|
|
395
395
|
/* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center", children: /* @__PURE__ */ r(
|
|
396
396
|
"select",
|
|
397
397
|
{
|
|
398
|
-
value:
|
|
399
|
-
onChange: (
|
|
398
|
+
value: j,
|
|
399
|
+
onChange: (c) => U(c.target.value),
|
|
400
400
|
className: "rsp-cursor-pointer rsp-ml-2 rsp-bg-transparent rsp-text-white rsp-border-0 rsp-text-sm focus:rsp-outline-none",
|
|
401
|
-
onClick: (
|
|
401
|
+
onClick: (c) => c.stopPropagation(),
|
|
402
402
|
children: [
|
|
403
403
|
/* @__PURE__ */ e("option", { value: "all", className: "rsp-text-gray-900", children: "All" }),
|
|
404
404
|
/* @__PURE__ */ e("option", { value: "pending", className: "rsp-text-gray-900", children: "Pending" }),
|
|
@@ -412,26 +412,26 @@ function ha() {
|
|
|
412
412
|
/* @__PURE__ */ e("th", { className: "rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium", children: "Updated" }),
|
|
413
413
|
/* @__PURE__ */ e("th", { className: "rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium", children: "Media" })
|
|
414
414
|
] }) }),
|
|
415
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
415
|
+
/* @__PURE__ */ e("tbody", { children: T.length > 0 ? T.map((c, M) => {
|
|
416
416
|
var A;
|
|
417
417
|
return /* @__PURE__ */ r(
|
|
418
418
|
"tr",
|
|
419
419
|
{
|
|
420
|
-
className: `rsp-border-b rsp-border-gray-200 ${
|
|
420
|
+
className: `rsp-border-b rsp-border-gray-200 ${M % 2 === 0 ? "rsp-bg-white" : "rsp-bg-blue-50"} hover:rsp-bg-blue-100 rsp-transition-colors`,
|
|
421
421
|
children: [
|
|
422
|
-
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900", children:
|
|
423
|
-
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900 rsp-font-medium", children:
|
|
424
|
-
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700 rsp-capitalize", children:
|
|
425
|
-
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children:
|
|
426
|
-
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children:
|
|
422
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900", children: c.id }),
|
|
423
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900 rsp-font-medium", children: c.name }),
|
|
424
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700 rsp-capitalize", children: c.category }),
|
|
425
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: c.language }),
|
|
426
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: c.type }),
|
|
427
427
|
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4", children: /* @__PURE__ */ e("span", { className: `rsp-inline-flex rsp-px-3 rsp-py-1 rsp-rounded-full rsp-text-xs rsp-font-medium
|
|
428
|
-
${
|
|
429
|
-
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children:
|
|
430
|
-
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children:
|
|
431
|
-
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: (A =
|
|
428
|
+
${c.status.toLowerCase() === "approved" ? "rsp-bg-green-100 rsp-text-green-800" : c.status.toLowerCase() === "rejected" ? "rsp-bg-red-100 rsp-text-red-800" : "rsp-bg-yellow-100 rsp-text-yellow-800"}`, children: c.status }) }),
|
|
429
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: c.creation_time ? new Date(c.creation_time).toLocaleDateString() : "N/A" }),
|
|
430
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: c.updation_time ? new Date(c.updation_time).toLocaleDateString() : "N/A" }),
|
|
431
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: (A = c.medialist) != null && A.header ? /* @__PURE__ */ r(
|
|
432
432
|
"button",
|
|
433
433
|
{
|
|
434
|
-
onClick: () =>
|
|
434
|
+
onClick: () => x(c.medialist.header, c.name),
|
|
435
435
|
className: "rsp-inline-flex rsp-items-center rsp-px-3 rsp-py-1 rsp-rounded rsp-text-xs rsp-font-medium rsp-bg-blue-100 rsp-text-blue-800 hover:rsp-bg-blue-200 rsp-transition-colors",
|
|
436
436
|
children: [
|
|
437
437
|
/* @__PURE__ */ r("svg", { className: "rsp-w-3 rsp-h-3 rsp-mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
|
|
@@ -444,25 +444,25 @@ function ha() {
|
|
|
444
444
|
) : /* @__PURE__ */ e("span", { className: "rsp-inline-flex rsp-px-2 rsp-py-1 rsp-rounded-full rsp-text-xs rsp-font-medium rsp-bg-gray-100 rsp-text-gray-800", children: "No Media" }) })
|
|
445
445
|
]
|
|
446
446
|
},
|
|
447
|
-
|
|
447
|
+
c.id
|
|
448
448
|
);
|
|
449
449
|
}) : /* @__PURE__ */ e("tr", { children: /* @__PURE__ */ e("td", { colSpan: 9, className: "rsp-px-6 rsp-py-8 rsp-text-center rsp-text-gray-500", children: "No templates found" }) }) })
|
|
450
450
|
] }) }) }),
|
|
451
|
-
|
|
451
|
+
T.length > 0 && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between rsp-items-center rsp-mt-6 rsp-px-6 rsp-py-4 rsp-bg-white rsp-rounded-lg rsp-shadow-sm rsp-border rsp-border-gray-200", children: [
|
|
452
452
|
/* @__PURE__ */ r("div", { className: "rsp-text-sm rsp-text-gray-700", children: [
|
|
453
453
|
"Showing ",
|
|
454
|
-
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children:
|
|
454
|
+
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children: b + 1 }),
|
|
455
455
|
" to ",
|
|
456
|
-
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children: Math.min(
|
|
456
|
+
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children: Math.min(E, L.length) }),
|
|
457
457
|
" of ",
|
|
458
|
-
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children:
|
|
458
|
+
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children: L.length }),
|
|
459
459
|
" results"
|
|
460
460
|
] }),
|
|
461
461
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-gap-2", children: [
|
|
462
462
|
/* @__PURE__ */ e(
|
|
463
463
|
"button",
|
|
464
464
|
{
|
|
465
|
-
onClick: () =>
|
|
465
|
+
onClick: () => h((c) => Math.max(c - 1, 1)),
|
|
466
466
|
disabled: t === 1,
|
|
467
467
|
className: "rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-bg-white rsp-border rsp-border-gray-300 rsp-rounded-md hover:rsp-bg-gray-50 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-transition-colors",
|
|
468
468
|
children: "Previous"
|
|
@@ -472,13 +472,13 @@ function ha() {
|
|
|
472
472
|
"Page ",
|
|
473
473
|
t,
|
|
474
474
|
" of ",
|
|
475
|
-
|
|
475
|
+
s
|
|
476
476
|
] }),
|
|
477
477
|
/* @__PURE__ */ e(
|
|
478
478
|
"button",
|
|
479
479
|
{
|
|
480
|
-
onClick: () =>
|
|
481
|
-
disabled: t ===
|
|
480
|
+
onClick: () => h((c) => Math.min(c + 1, s)),
|
|
481
|
+
disabled: t === s,
|
|
482
482
|
className: "rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-bg-white rsp-border rsp-border-gray-300 rsp-rounded-md hover:rsp-bg-gray-50 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-transition-colors",
|
|
483
483
|
children: "Next"
|
|
484
484
|
}
|
|
@@ -486,30 +486,30 @@ function ha() {
|
|
|
486
486
|
] })
|
|
487
487
|
] }),
|
|
488
488
|
/* @__PURE__ */ e(
|
|
489
|
-
|
|
489
|
+
pe,
|
|
490
490
|
{
|
|
491
|
-
isOpen:
|
|
492
|
-
onClose:
|
|
493
|
-
title: `Media - ${
|
|
491
|
+
isOpen: V.isOpen,
|
|
492
|
+
onClose: w,
|
|
493
|
+
title: `Media - ${V.templateName || "Template"}`,
|
|
494
494
|
children: /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
|
|
495
|
-
|
|
495
|
+
V.url && /* @__PURE__ */ r("div", { className: "rsp-text-center", children: [
|
|
496
496
|
/* @__PURE__ */ r("div", { className: "rsp-relative rsp-bg-gray-50 rsp-rounded-lg rsp-p-4 rsp-min-h-[200px] rsp-flex rsp-items-center rsp-justify-center", children: [
|
|
497
497
|
/* @__PURE__ */ e(
|
|
498
498
|
"img",
|
|
499
499
|
{
|
|
500
|
-
src:
|
|
500
|
+
src: V.url,
|
|
501
501
|
alt: "Template media",
|
|
502
502
|
className: "rsp-max-w-full rsp-max-h-[400px] rsp-mx-auto rsp-rounded-lg rsp-shadow-md rsp-object-contain",
|
|
503
|
-
onLoad: (
|
|
503
|
+
onLoad: (c) => {
|
|
504
504
|
var A;
|
|
505
|
-
const
|
|
506
|
-
|
|
505
|
+
const M = (A = c.currentTarget.parentElement) == null ? void 0 : A.querySelector(".loading-placeholder");
|
|
506
|
+
M && (M.style.display = "none");
|
|
507
507
|
},
|
|
508
|
-
onError: (
|
|
508
|
+
onError: (c) => {
|
|
509
509
|
var A;
|
|
510
|
-
|
|
511
|
-
const
|
|
512
|
-
|
|
510
|
+
c.currentTarget.style.display = "none";
|
|
511
|
+
const M = (A = c.currentTarget.parentElement) == null ? void 0 : A.querySelector(".error-placeholder");
|
|
512
|
+
M && (M.style.display = "block");
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
),
|
|
@@ -521,13 +521,13 @@ function ha() {
|
|
|
521
521
|
] }),
|
|
522
522
|
/* @__PURE__ */ r("div", { className: "rsp-mt-4 rsp-p-3 rsp-bg-gray-50 rsp-rounded-lg", children: [
|
|
523
523
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-600 rsp-mb-1", children: "Media URL:" }),
|
|
524
|
-
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-800 rsp-break-all rsp-font-mono", children:
|
|
524
|
+
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-800 rsp-break-all rsp-font-mono", children: V.url })
|
|
525
525
|
] })
|
|
526
526
|
] }),
|
|
527
527
|
/* @__PURE__ */ e("div", { className: "rsp-flex rsp-justify-end rsp-pt-4", children: /* @__PURE__ */ r(
|
|
528
528
|
"a",
|
|
529
529
|
{
|
|
530
|
-
href:
|
|
530
|
+
href: V.url,
|
|
531
531
|
target: "_blank",
|
|
532
532
|
rel: "noopener noreferrer",
|
|
533
533
|
className: "rsp-inline-flex rsp-items-center rsp-px-4 rsp-py-2 rsp-bg-blue-600 rsp-text-white rsp-text-sm rsp-font-medium rsp-rounded-md hover:rsp-bg-blue-700 rsp-transition-colors",
|
|
@@ -542,64 +542,64 @@ function ha() {
|
|
|
542
542
|
)
|
|
543
543
|
] });
|
|
544
544
|
}
|
|
545
|
-
const
|
|
546
|
-
var i, l, d,
|
|
545
|
+
const De = async (a, n) => {
|
|
546
|
+
var i, l, d, p, m, C, g;
|
|
547
547
|
try {
|
|
548
548
|
console.log("Creating template with data:", n);
|
|
549
|
-
const
|
|
550
|
-
let
|
|
551
|
-
|
|
552
|
-
const
|
|
549
|
+
const f = n.language, y = n.headerType === "MEDIA" && n.mediaType === "DOCUMENT", j = n.type === "CAROUSEL";
|
|
550
|
+
let U = "";
|
|
551
|
+
y ? U = qe(n, f) : j ? U = He(n, f) : U = Ge(n, f), console.log("Raw JSON string being sent:", U);
|
|
552
|
+
const k = {
|
|
553
553
|
method: "POST",
|
|
554
554
|
headers: {
|
|
555
555
|
"Content-Type": "application/json"
|
|
556
556
|
},
|
|
557
|
-
body:
|
|
557
|
+
body: U,
|
|
558
558
|
redirect: "follow"
|
|
559
559
|
};
|
|
560
560
|
console.log(
|
|
561
561
|
"Making request to:",
|
|
562
562
|
`https://wpapi.trustsignal.io/api/v1/template?api_key=${a}`
|
|
563
|
-
), console.log("Request options:",
|
|
564
|
-
const
|
|
563
|
+
), console.log("Request options:", k);
|
|
564
|
+
const N = await fetch(
|
|
565
565
|
`https://wpapi.trustsignal.io/api/v1/template?api_key=${a}`,
|
|
566
|
-
|
|
566
|
+
k
|
|
567
567
|
);
|
|
568
|
-
console.log("Response status:",
|
|
568
|
+
console.log("Response status:", N.status), console.log(
|
|
569
569
|
"Response headers:",
|
|
570
|
-
Object.fromEntries(
|
|
570
|
+
Object.fromEntries(N.headers.entries())
|
|
571
571
|
);
|
|
572
|
-
const
|
|
573
|
-
console.log("Raw response:",
|
|
574
|
-
const
|
|
575
|
-
if (console.log("Parsed response:",
|
|
576
|
-
throw new Error(
|
|
572
|
+
const o = await N.text();
|
|
573
|
+
console.log("Raw response:", o);
|
|
574
|
+
const u = JSON.parse(o);
|
|
575
|
+
if (console.log("Parsed response:", u), !u.success)
|
|
576
|
+
throw new Error(u.message || "Template creation failed");
|
|
577
577
|
return {
|
|
578
578
|
status: "success",
|
|
579
579
|
message: "Template created successfully",
|
|
580
580
|
data: {
|
|
581
|
-
template:
|
|
581
|
+
template: u.template,
|
|
582
582
|
details: [
|
|
583
583
|
{
|
|
584
|
-
template_name: ((i =
|
|
585
|
-
template_id: ((l =
|
|
586
|
-
meta_tid: (d =
|
|
587
|
-
status: (
|
|
588
|
-
quality: (m =
|
|
589
|
-
temp_route: (
|
|
590
|
-
temptype: (
|
|
584
|
+
template_name: ((i = u.template) == null ? void 0 : i.name) || n.name,
|
|
585
|
+
template_id: ((l = u.template) == null ? void 0 : l.id) || "unknown",
|
|
586
|
+
meta_tid: (d = u.template) == null ? void 0 : d.meta_tid,
|
|
587
|
+
status: (p = u.template) == null ? void 0 : p.status,
|
|
588
|
+
quality: (m = u.template) == null ? void 0 : m.quality,
|
|
589
|
+
temp_route: (C = u.template) == null ? void 0 : C.temp_route,
|
|
590
|
+
temptype: (g = u.template) == null ? void 0 : g.temptype
|
|
591
591
|
}
|
|
592
592
|
]
|
|
593
593
|
}
|
|
594
594
|
};
|
|
595
|
-
} catch (
|
|
596
|
-
return console.error("TrustSignal API Error:",
|
|
595
|
+
} catch (f) {
|
|
596
|
+
return console.error("TrustSignal API Error:", f), {
|
|
597
597
|
status: "error",
|
|
598
|
-
message:
|
|
598
|
+
message: f instanceof Error ? f.message : "Failed to create template"
|
|
599
599
|
};
|
|
600
600
|
}
|
|
601
|
-
},
|
|
602
|
-
var
|
|
601
|
+
}, qe = (a, n) => {
|
|
602
|
+
var p, m;
|
|
603
603
|
const i = {
|
|
604
604
|
name: a.name,
|
|
605
605
|
lang: n,
|
|
@@ -613,14 +613,14 @@ const Oe = async (a, n) => {
|
|
|
613
613
|
type: "HEADER",
|
|
614
614
|
format: "DOCUMENT"
|
|
615
615
|
}));
|
|
616
|
-
const l =
|
|
616
|
+
const l = J(a.body), d = {
|
|
617
617
|
type: "BODY",
|
|
618
618
|
text: a.body
|
|
619
619
|
};
|
|
620
|
-
if (l.length > 0 && ((
|
|
621
|
-
const
|
|
620
|
+
if (l.length > 0 && ((p = a.sampleContent) != null && p.bodyVariables)) {
|
|
621
|
+
const C = oe(a, l);
|
|
622
622
|
d.example = {
|
|
623
|
-
body_text: [
|
|
623
|
+
body_text: [C]
|
|
624
624
|
// This creates the required nested array
|
|
625
625
|
};
|
|
626
626
|
}
|
|
@@ -628,34 +628,34 @@ const Oe = async (a, n) => {
|
|
|
628
628
|
type: "FOOTER",
|
|
629
629
|
text: a.footer
|
|
630
630
|
}), a.buttons && a.buttons.length > 0) {
|
|
631
|
-
const
|
|
632
|
-
var
|
|
633
|
-
const
|
|
634
|
-
type:
|
|
635
|
-
text:
|
|
631
|
+
const C = a.buttons.map((g) => {
|
|
632
|
+
var y;
|
|
633
|
+
const f = {
|
|
634
|
+
type: g.type === "CALL" ? "PHONE_NUMBER" : g.type,
|
|
635
|
+
text: g.text
|
|
636
636
|
};
|
|
637
|
-
if (
|
|
638
|
-
const
|
|
639
|
-
if (
|
|
640
|
-
const
|
|
641
|
-
({ number:
|
|
642
|
-
var
|
|
643
|
-
return ((
|
|
637
|
+
if (g.type === "URL" && g.value && (f.url = g.value, g.urlType === "dynamic" && g.value.includes("{{"))) {
|
|
638
|
+
const j = J(g.value);
|
|
639
|
+
if (j.length > 0 && ((y = a.sampleContent) != null && y.buttonVariables)) {
|
|
640
|
+
const U = j.map(
|
|
641
|
+
({ number: k }) => {
|
|
642
|
+
var N, o;
|
|
643
|
+
return ((o = (N = a.sampleContent) == null ? void 0 : N.buttonVariables) == null ? void 0 : o[k]) || `sample${k}`;
|
|
644
644
|
}
|
|
645
645
|
);
|
|
646
|
-
|
|
646
|
+
f.example = U;
|
|
647
647
|
}
|
|
648
648
|
}
|
|
649
|
-
return (
|
|
649
|
+
return (g.type === "CALL" || g.type === "PHONE_NUMBER") && g.value && (f.phone_number = g.value.startsWith("+") ? g.value : `+${g.value}`), f;
|
|
650
650
|
});
|
|
651
651
|
i.components.push({
|
|
652
652
|
type: "BUTTONS",
|
|
653
|
-
buttons:
|
|
653
|
+
buttons: C
|
|
654
654
|
});
|
|
655
655
|
}
|
|
656
656
|
return JSON.stringify(i);
|
|
657
|
-
},
|
|
658
|
-
var m,
|
|
657
|
+
}, He = (a, n) => {
|
|
658
|
+
var m, C, g;
|
|
659
659
|
const i = {
|
|
660
660
|
name: a.name,
|
|
661
661
|
lang: n,
|
|
@@ -663,69 +663,69 @@ const Oe = async (a, n) => {
|
|
|
663
663
|
shortlink: a.enableClickTracking ? "1" : "0",
|
|
664
664
|
components: []
|
|
665
665
|
};
|
|
666
|
-
(m = a.carousel) != null && m.cards.length && (i.media = {}, a.carousel.cards.forEach((
|
|
667
|
-
|
|
666
|
+
(m = a.carousel) != null && m.cards.length && (i.media = {}, a.carousel.cards.forEach((f, y) => {
|
|
667
|
+
f.mediaUrl && (i.media[`card${y}header`] = f.mediaUrl);
|
|
668
668
|
}));
|
|
669
|
-
const l = [], d =
|
|
669
|
+
const l = [], d = J(a.body), p = {
|
|
670
670
|
type: "BODY",
|
|
671
671
|
text: a.body,
|
|
672
|
-
...d.length > 0 && ((
|
|
672
|
+
...d.length > 0 && ((C = a.sampleContent) == null ? void 0 : C.bodyVariables) && {
|
|
673
673
|
example: {
|
|
674
|
-
body_text: [
|
|
674
|
+
body_text: [oe(a, d)]
|
|
675
675
|
}
|
|
676
676
|
}
|
|
677
677
|
};
|
|
678
|
-
if (l.push(
|
|
679
|
-
const
|
|
678
|
+
if (l.push(p), (g = a.carousel) != null && g.cards.length) {
|
|
679
|
+
const f = {
|
|
680
680
|
type: "CAROUSEL",
|
|
681
|
-
cards: a.carousel.cards.map((
|
|
682
|
-
var
|
|
681
|
+
cards: a.carousel.cards.map((y, j) => {
|
|
682
|
+
var U;
|
|
683
683
|
return {
|
|
684
684
|
components: [
|
|
685
685
|
{
|
|
686
686
|
type: "HEADER",
|
|
687
|
-
format: ((
|
|
687
|
+
format: ((U = a.carousel) == null ? void 0 : U.type) || "IMAGE"
|
|
688
688
|
},
|
|
689
689
|
{
|
|
690
690
|
type: "BODY",
|
|
691
|
-
text:
|
|
692
|
-
...
|
|
691
|
+
text: y.body,
|
|
692
|
+
...J(y.body).length > 0 && {
|
|
693
693
|
example: {
|
|
694
|
-
body_text: [
|
|
694
|
+
body_text: [$e(y)]
|
|
695
695
|
}
|
|
696
696
|
}
|
|
697
697
|
},
|
|
698
|
-
...
|
|
698
|
+
...y.buttons.length > 0 ? [{
|
|
699
699
|
type: "BUTTONS",
|
|
700
|
-
buttons:
|
|
701
|
-
var
|
|
702
|
-
const
|
|
703
|
-
type:
|
|
704
|
-
text:
|
|
700
|
+
buttons: y.buttons.map((k) => {
|
|
701
|
+
var o;
|
|
702
|
+
const N = {
|
|
703
|
+
type: k.type === "CALL" ? "PHONE_NUMBER" : k.type,
|
|
704
|
+
text: k.text
|
|
705
705
|
};
|
|
706
|
-
if (
|
|
707
|
-
const
|
|
708
|
-
if (
|
|
709
|
-
const t = ((
|
|
710
|
-
|
|
706
|
+
if (k.type === "URL" && k.value && (N.url = k.value, k.urlType === "dynamic" && k.value.includes("{{"))) {
|
|
707
|
+
const u = J(k.value);
|
|
708
|
+
if (u.length > 0) {
|
|
709
|
+
const t = ((o = y == null ? void 0 : y.sampleContent) == null ? void 0 : o.buttonVariables) || {}, h = u.map(({ number: v }) => t[v] || `sample${v}`);
|
|
710
|
+
N.example = h;
|
|
711
711
|
}
|
|
712
712
|
}
|
|
713
|
-
return (
|
|
713
|
+
return (k.type === "CALL" || k.type === "PHONE_NUMBER") && k.value && (N.phone_number = k.value), console.log("Carousel card button data:", N), N;
|
|
714
714
|
})
|
|
715
715
|
}] : []
|
|
716
716
|
]
|
|
717
717
|
};
|
|
718
718
|
})
|
|
719
719
|
};
|
|
720
|
-
l.push(
|
|
720
|
+
l.push(f);
|
|
721
721
|
}
|
|
722
722
|
return i.components = l, JSON.stringify(i);
|
|
723
|
-
},
|
|
723
|
+
}, $e = (a) => {
|
|
724
724
|
var l;
|
|
725
|
-
const n =
|
|
725
|
+
const n = J(a.body || ""), i = ((l = a == null ? void 0 : a.sampleContent) == null ? void 0 : l.bodyVariables) || {};
|
|
726
726
|
return n.map(({ number: d }) => i[d] || `Sample ${d}`);
|
|
727
|
-
},
|
|
728
|
-
var m,
|
|
727
|
+
}, Ge = (a, n) => {
|
|
728
|
+
var m, C;
|
|
729
729
|
const i = {
|
|
730
730
|
name: a.name,
|
|
731
731
|
lang: n,
|
|
@@ -739,91 +739,91 @@ const Oe = async (a, n) => {
|
|
|
739
739
|
const l = [];
|
|
740
740
|
if (a.type !== "CAROUSEL") {
|
|
741
741
|
if (a.headerType === "TEXT" && a.headerText) {
|
|
742
|
-
const
|
|
742
|
+
const g = J(a.headerText), f = {
|
|
743
743
|
type: "HEADER",
|
|
744
744
|
format: "TEXT",
|
|
745
745
|
text: a.headerText,
|
|
746
|
-
...
|
|
746
|
+
...g.length > 0 && ((m = a.sampleContent) == null ? void 0 : m.headerVariables) && {
|
|
747
747
|
example: {
|
|
748
|
-
header_text:
|
|
748
|
+
header_text: We(a, g)
|
|
749
749
|
}
|
|
750
750
|
}
|
|
751
751
|
};
|
|
752
|
-
l.push(
|
|
752
|
+
l.push(f);
|
|
753
753
|
} else if (a.headerType === "MEDIA") {
|
|
754
|
-
const
|
|
754
|
+
const g = {
|
|
755
755
|
type: "HEADER",
|
|
756
756
|
format: a.mediaType || "IMAGE"
|
|
757
757
|
};
|
|
758
|
-
l.push(
|
|
758
|
+
l.push(g);
|
|
759
759
|
}
|
|
760
760
|
}
|
|
761
|
-
const d =
|
|
761
|
+
const d = J(a.body), p = {
|
|
762
762
|
type: "BODY",
|
|
763
763
|
text: a.body,
|
|
764
|
-
...d.length > 0 && ((
|
|
764
|
+
...d.length > 0 && ((C = a.sampleContent) == null ? void 0 : C.bodyVariables) && {
|
|
765
765
|
example: {
|
|
766
|
-
body_text: [
|
|
766
|
+
body_text: [oe(a, d)]
|
|
767
767
|
}
|
|
768
768
|
}
|
|
769
769
|
};
|
|
770
|
-
if (l.push(
|
|
770
|
+
if (l.push(p), a.footer && a.type !== "CAROUSEL" && l.push({
|
|
771
771
|
type: "FOOTER",
|
|
772
772
|
text: a.footer
|
|
773
773
|
}), a.buttons.length > 0) {
|
|
774
|
-
const
|
|
775
|
-
var
|
|
776
|
-
const
|
|
777
|
-
type:
|
|
778
|
-
text:
|
|
774
|
+
const g = a.buttons.map((f) => {
|
|
775
|
+
var j;
|
|
776
|
+
const y = {
|
|
777
|
+
type: f.type === "CALL" ? "PHONE_NUMBER" : f.type,
|
|
778
|
+
text: f.text
|
|
779
779
|
};
|
|
780
|
-
if (
|
|
781
|
-
const
|
|
782
|
-
if (
|
|
783
|
-
const
|
|
784
|
-
({ number:
|
|
785
|
-
var
|
|
786
|
-
return ((
|
|
780
|
+
if (f.type === "URL" && f.value && (y.url = f.value, f.urlType === "dynamic" && f.value.includes("{{"))) {
|
|
781
|
+
const U = J(f.value);
|
|
782
|
+
if (U.length > 0 && ((j = a.sampleContent) != null && j.buttonVariables)) {
|
|
783
|
+
const k = U.map(
|
|
784
|
+
({ number: N }) => {
|
|
785
|
+
var o, u;
|
|
786
|
+
return ((u = (o = a.sampleContent) == null ? void 0 : o.buttonVariables) == null ? void 0 : u[N]) || `sample${N}`;
|
|
787
787
|
}
|
|
788
788
|
);
|
|
789
|
-
|
|
789
|
+
y.example = k;
|
|
790
790
|
}
|
|
791
791
|
}
|
|
792
|
-
return (
|
|
792
|
+
return (f.type === "CALL" || f.type === "PHONE_NUMBER") && f.value && (y.phone_number = f.value), y;
|
|
793
793
|
});
|
|
794
794
|
l.push({
|
|
795
795
|
type: "BUTTONS",
|
|
796
|
-
buttons:
|
|
796
|
+
buttons: g
|
|
797
797
|
});
|
|
798
798
|
}
|
|
799
799
|
return i.components = l, JSON.stringify(i);
|
|
800
|
-
},
|
|
800
|
+
}, J = (a) => (a.match(/\{\{(\d+)\}\}/g) || []).map((i) => ({
|
|
801
801
|
variable: i.replace(/[{}]/g, ""),
|
|
802
802
|
number: i.replace(/[{}]/g, "")
|
|
803
|
-
})),
|
|
803
|
+
})), We = (a, n) => n.map(
|
|
804
804
|
({ number: i }) => {
|
|
805
805
|
var l, d;
|
|
806
806
|
return ((d = (l = a.sampleContent) == null ? void 0 : l.headerVariables) == null ? void 0 : d[i]) || `Sample ${i}`;
|
|
807
807
|
}
|
|
808
|
-
),
|
|
808
|
+
), oe = (a, n) => n.map(
|
|
809
809
|
({ number: i }) => {
|
|
810
810
|
var l, d;
|
|
811
811
|
return ((d = (l = a.sampleContent) == null ? void 0 : l.bodyVariables) == null ? void 0 : d[i]) || `Sample ${i}`;
|
|
812
812
|
}
|
|
813
|
-
),
|
|
813
|
+
), Ke = async (a, n) => {
|
|
814
814
|
try {
|
|
815
815
|
if (!n.name || !n.body)
|
|
816
816
|
throw new Error("Missing required template fields: name and body are required");
|
|
817
817
|
if (!a.apiKey)
|
|
818
818
|
throw new Error("Missing TrustSignal API key");
|
|
819
|
-
return await
|
|
819
|
+
return await De(a.apiKey, n);
|
|
820
820
|
} catch (i) {
|
|
821
821
|
return console.error("API Error:", i), {
|
|
822
822
|
status: "error",
|
|
823
823
|
message: i instanceof Error ? i.message : "An unexpected error occurred while creating the template"
|
|
824
824
|
};
|
|
825
825
|
}
|
|
826
|
-
},
|
|
826
|
+
}, Qe = [
|
|
827
827
|
{ value: "af", label: "Afrikaans" },
|
|
828
828
|
{ value: "sq", label: "Albanian" },
|
|
829
829
|
{ value: "ar", label: "Arabic" },
|
|
@@ -888,118 +888,118 @@ const Oe = async (a, n) => {
|
|
|
888
888
|
{ value: "ur", label: "Urdu" },
|
|
889
889
|
{ value: "uz", label: "Uzbek" },
|
|
890
890
|
{ value: "vi", label: "Vietnamese" }
|
|
891
|
-
],
|
|
891
|
+
], Ye = [
|
|
892
892
|
{ value: "NONE", label: "None" },
|
|
893
893
|
{ value: "TEXT", label: "Text" },
|
|
894
894
|
{ value: "MEDIA", label: "Media" }
|
|
895
|
-
],
|
|
895
|
+
], Xe = [
|
|
896
896
|
{ value: "IMAGE", label: "Image" },
|
|
897
897
|
{ value: "VIDEO", label: "Video" },
|
|
898
898
|
{ value: "DOCUMENT", label: "Document" }
|
|
899
|
-
],
|
|
900
|
-
function
|
|
901
|
-
var
|
|
902
|
-
const [l, d] =
|
|
903
|
-
const
|
|
904
|
-
if (!
|
|
905
|
-
const
|
|
906
|
-
const
|
|
907
|
-
return
|
|
899
|
+
], Je = 5 * 1024 * 1024, Ze = 16 * 1024 * 1024, ea = 100 * 1024 * 1024, ie = ["jpg", "jpeg", "png"], te = ["mp4", "3gpp"], me = ["pdf", "docx", "xlsx", "pptx", "txt"];
|
|
900
|
+
function aa({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
901
|
+
var R, I;
|
|
902
|
+
const [l, d] = K.useState(null), [p, m] = K.useState(!1), [C, g] = K.useState(null), [f, y] = K.useState(null), j = () => {
|
|
903
|
+
const w = (a.headerText || "").match(/{{\d+}}/g);
|
|
904
|
+
if (!w) return 0;
|
|
905
|
+
const L = w.map((s) => {
|
|
906
|
+
const b = s.match(/{{(\d+)}}/);
|
|
907
|
+
return b ? parseInt(b[1], 10) : 0;
|
|
908
908
|
});
|
|
909
|
-
return
|
|
910
|
-
},
|
|
911
|
-
const
|
|
912
|
-
if (
|
|
913
|
-
const
|
|
914
|
-
n({ ...a, headerText:
|
|
915
|
-
if (
|
|
916
|
-
const
|
|
917
|
-
|
|
909
|
+
return L.length > 0 ? Math.max(...L) : 0;
|
|
910
|
+
}, U = () => {
|
|
911
|
+
const L = `{{${j() + 1}}}`;
|
|
912
|
+
if (C && a.headerText.length + L.length <= 60) {
|
|
913
|
+
const s = C.selectionStart || a.headerText.length, b = a.headerText.substring(0, s), E = a.headerText.substring(s), T = b + L + E;
|
|
914
|
+
n({ ...a, headerText: T }), setTimeout(() => {
|
|
915
|
+
if (C) {
|
|
916
|
+
const c = s + L.length;
|
|
917
|
+
C.setSelectionRange(c, c), C.focus();
|
|
918
918
|
}
|
|
919
919
|
}, 0);
|
|
920
920
|
}
|
|
921
|
-
},
|
|
922
|
-
n((
|
|
923
|
-
...
|
|
924
|
-
headerType:
|
|
925
|
-
headerText:
|
|
926
|
-
mediaType:
|
|
927
|
-
mediaUrl:
|
|
928
|
-
})),
|
|
929
|
-
},
|
|
930
|
-
var
|
|
931
|
-
return ((
|
|
932
|
-
},
|
|
933
|
-
const
|
|
934
|
-
switch (
|
|
921
|
+
}, k = (x) => {
|
|
922
|
+
n((w) => ({
|
|
923
|
+
...w,
|
|
924
|
+
headerType: x,
|
|
925
|
+
headerText: x === "TEXT" ? w.headerText : "",
|
|
926
|
+
mediaType: x === "MEDIA" ? w.mediaType || "IMAGE" : void 0,
|
|
927
|
+
mediaUrl: x === "MEDIA" ? w.mediaUrl : void 0
|
|
928
|
+
})), x !== "MEDIA" && (d(null), y(null));
|
|
929
|
+
}, N = (x) => {
|
|
930
|
+
var w;
|
|
931
|
+
return ((w = x.split("?")[0].split(".").pop()) == null ? void 0 : w.toLowerCase()) || "";
|
|
932
|
+
}, o = (x, w) => {
|
|
933
|
+
const L = N(x.name);
|
|
934
|
+
switch (w) {
|
|
935
935
|
case "IMAGE":
|
|
936
|
-
if (!
|
|
937
|
-
if (
|
|
936
|
+
if (!ie.includes(L)) return "Invalid format. Only JPG, JPEG, PNG are allowed.";
|
|
937
|
+
if (x.size > Je) return "File is too large. Max size is 5 MB.";
|
|
938
938
|
break;
|
|
939
939
|
case "VIDEO":
|
|
940
|
-
if (!
|
|
941
|
-
if (
|
|
940
|
+
if (!te.includes(L)) return "Invalid format. Only MP4, 3GPP are allowed.";
|
|
941
|
+
if (x.size > Ze) return "File is too large. Max size is 16 MB.";
|
|
942
942
|
break;
|
|
943
943
|
case "DOCUMENT":
|
|
944
|
-
if (!
|
|
945
|
-
if (
|
|
944
|
+
if (!me.includes(L)) return "Invalid format. Allowed types: PDF, DOCX, XLSX, PPTX, TXT.";
|
|
945
|
+
if (x.size > ea) return "File is too large. Max size is 100 MB.";
|
|
946
946
|
break;
|
|
947
947
|
default:
|
|
948
948
|
return "Invalid media type.";
|
|
949
949
|
}
|
|
950
950
|
return null;
|
|
951
|
-
},
|
|
952
|
-
if (!
|
|
953
|
-
const
|
|
954
|
-
switch (
|
|
951
|
+
}, u = (x, w) => {
|
|
952
|
+
if (!x) return null;
|
|
953
|
+
const L = N(x);
|
|
954
|
+
switch (w) {
|
|
955
955
|
case "IMAGE":
|
|
956
|
-
if (!
|
|
956
|
+
if (!ie.includes(L)) return "URL does not point to a valid image (JPG, JPEG, PNG).";
|
|
957
957
|
break;
|
|
958
958
|
case "VIDEO":
|
|
959
|
-
if (!
|
|
959
|
+
if (!te.includes(L)) return "URL does not point to a valid video (MP4, 3GPP).";
|
|
960
960
|
break;
|
|
961
961
|
case "DOCUMENT":
|
|
962
|
-
if (!
|
|
962
|
+
if (!me.includes(L)) return "URL does not point to a valid document.";
|
|
963
963
|
break;
|
|
964
964
|
}
|
|
965
965
|
return null;
|
|
966
966
|
}, t = () => {
|
|
967
|
-
d(null), n({ ...a, mediaUrl: "" }),
|
|
968
|
-
},
|
|
969
|
-
var
|
|
970
|
-
const
|
|
971
|
-
if (!
|
|
972
|
-
|
|
973
|
-
const
|
|
974
|
-
if (
|
|
975
|
-
|
|
967
|
+
d(null), n({ ...a, mediaUrl: "" }), y(null);
|
|
968
|
+
}, h = async (x) => {
|
|
969
|
+
var s;
|
|
970
|
+
const w = (s = x.target.files) == null ? void 0 : s[0];
|
|
971
|
+
if (!w || !a.mediaType) return;
|
|
972
|
+
y(null);
|
|
973
|
+
const L = o(w, a.mediaType);
|
|
974
|
+
if (L) {
|
|
975
|
+
y(L);
|
|
976
976
|
return;
|
|
977
977
|
}
|
|
978
|
-
m(!0), d(
|
|
978
|
+
m(!0), d(w);
|
|
979
979
|
try {
|
|
980
|
-
const
|
|
981
|
-
n({ ...a, mediaUrl:
|
|
982
|
-
} catch (
|
|
983
|
-
console.error("File upload failed:",
|
|
984
|
-
const
|
|
985
|
-
|
|
980
|
+
const b = await i(w);
|
|
981
|
+
n({ ...a, mediaUrl: b });
|
|
982
|
+
} catch (b) {
|
|
983
|
+
console.error("File upload failed:", b), t();
|
|
984
|
+
const E = b instanceof Error ? b.message : "File upload failed. Please try again.";
|
|
985
|
+
y(E);
|
|
986
986
|
} finally {
|
|
987
987
|
m(!1);
|
|
988
988
|
}
|
|
989
|
-
},
|
|
990
|
-
const
|
|
991
|
-
if (d(null), n({ ...a, mediaUrl:
|
|
992
|
-
const
|
|
993
|
-
|
|
989
|
+
}, v = (x) => {
|
|
990
|
+
const w = x.target.value;
|
|
991
|
+
if (d(null), n({ ...a, mediaUrl: w }), a.mediaType) {
|
|
992
|
+
const L = u(w, a.mediaType);
|
|
993
|
+
y(L);
|
|
994
994
|
}
|
|
995
|
-
},
|
|
995
|
+
}, V = () => {
|
|
996
996
|
switch (a.mediaType) {
|
|
997
997
|
case "IMAGE":
|
|
998
|
-
return
|
|
998
|
+
return ie.map((x) => `.${x}`).join(",");
|
|
999
999
|
case "VIDEO":
|
|
1000
|
-
return
|
|
1000
|
+
return te.map((x) => `.${x}`).join(",");
|
|
1001
1001
|
case "DOCUMENT":
|
|
1002
|
-
return
|
|
1002
|
+
return me.map((x) => `.${x}`).join(",");
|
|
1003
1003
|
default:
|
|
1004
1004
|
return "*/*";
|
|
1005
1005
|
}
|
|
@@ -1012,9 +1012,9 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1012
1012
|
"select",
|
|
1013
1013
|
{
|
|
1014
1014
|
value: a.headerType,
|
|
1015
|
-
onChange: (
|
|
1015
|
+
onChange: (x) => k(x.target.value),
|
|
1016
1016
|
className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent rsp-appearance-none",
|
|
1017
|
-
children:
|
|
1017
|
+
children: Ye.map((x) => /* @__PURE__ */ e("option", { value: x.value, children: x.label }, x.value))
|
|
1018
1018
|
}
|
|
1019
1019
|
),
|
|
1020
1020
|
/* @__PURE__ */ e("div", { className: "rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none", children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }),
|
|
@@ -1026,10 +1026,10 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1026
1026
|
/* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
|
|
1027
1027
|
"input",
|
|
1028
1028
|
{
|
|
1029
|
-
ref:
|
|
1029
|
+
ref: g,
|
|
1030
1030
|
type: "text",
|
|
1031
1031
|
value: a.headerText,
|
|
1032
|
-
onChange: (
|
|
1032
|
+
onChange: (x) => n({ ...a, headerText: x.target.value }),
|
|
1033
1033
|
maxLength: 60,
|
|
1034
1034
|
className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",
|
|
1035
1035
|
placeholder: "Add a 60 character title to your message"
|
|
@@ -1039,7 +1039,7 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1039
1039
|
/* @__PURE__ */ e(
|
|
1040
1040
|
"button",
|
|
1041
1041
|
{
|
|
1042
|
-
onClick:
|
|
1042
|
+
onClick: U,
|
|
1043
1043
|
className: "rsp-px-2 rsp-py-1 rsp-text-xs hover:rsp-bg-gray-100 rsp-rounded rsp-text-gray-500 rsp-flex rsp-items-center rsp-gap-1",
|
|
1044
1044
|
title: "Add variable to header",
|
|
1045
1045
|
children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" }) })
|
|
@@ -1051,30 +1051,30 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1051
1051
|
] })
|
|
1052
1052
|
] }),
|
|
1053
1053
|
(() => {
|
|
1054
|
-
const
|
|
1055
|
-
return
|
|
1054
|
+
const x = [...new Set((a.headerText.match(/\{\{(\d+)\}\}/g) || []).map((w) => w.replace(/[{}]/g, "")))];
|
|
1055
|
+
return x.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
|
|
1056
1056
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2", children: "Sample Values" }),
|
|
1057
|
-
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children:
|
|
1058
|
-
var
|
|
1057
|
+
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: x.map((w) => {
|
|
1058
|
+
var L, s;
|
|
1059
1059
|
return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
1060
1060
|
/* @__PURE__ */ r("label", { className: "rsp-text-xs rsp-text-gray-500 rsp-whitespace-nowrap", children: [
|
|
1061
|
-
`{{${
|
|
1061
|
+
`{{${w}}}`,
|
|
1062
1062
|
":"
|
|
1063
1063
|
] }),
|
|
1064
1064
|
/* @__PURE__ */ e(
|
|
1065
1065
|
"input",
|
|
1066
1066
|
{
|
|
1067
1067
|
type: "text",
|
|
1068
|
-
value: ((
|
|
1069
|
-
onChange: (
|
|
1070
|
-
var
|
|
1071
|
-
const
|
|
1068
|
+
value: ((s = (L = a.sampleContent) == null ? void 0 : L.headerVariables) == null ? void 0 : s[w]) || "",
|
|
1069
|
+
onChange: (b) => {
|
|
1070
|
+
var T, c, M;
|
|
1071
|
+
const E = {
|
|
1072
1072
|
...a.sampleContent,
|
|
1073
|
-
headerVariables: { ...(
|
|
1074
|
-
bodyVariables: ((
|
|
1075
|
-
buttonVariables: ((
|
|
1073
|
+
headerVariables: { ...(T = a.sampleContent) == null ? void 0 : T.headerVariables, [w]: b.target.value },
|
|
1074
|
+
bodyVariables: ((c = a.sampleContent) == null ? void 0 : c.bodyVariables) || {},
|
|
1075
|
+
buttonVariables: ((M = a.sampleContent) == null ? void 0 : M.buttonVariables) || {}
|
|
1076
1076
|
};
|
|
1077
|
-
n({ ...a, sampleContent:
|
|
1077
|
+
n({ ...a, sampleContent: E });
|
|
1078
1078
|
},
|
|
1079
1079
|
className: "rsp-flex-1 rsp-px-2 rsp-py-1 rsp-border rsp-border-gray-300 rsp-rounded rsp-text-xs focus:rsp-outline-none focus:rsp-border-blue-500",
|
|
1080
1080
|
placeholder: "Sample"
|
|
@@ -1085,15 +1085,15 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1085
1085
|
{
|
|
1086
1086
|
type: "button",
|
|
1087
1087
|
onClick: () => {
|
|
1088
|
-
var
|
|
1089
|
-
const
|
|
1088
|
+
var c, M, A;
|
|
1089
|
+
const b = new RegExp(`\\{\\{${w}\\}\\}`, "g"), E = (a.headerText || "").replace(b, ""), T = Object.fromEntries(Object.entries(((c = a.sampleContent) == null ? void 0 : c.headerVariables) || {}).filter(([O]) => O !== w));
|
|
1090
1090
|
n({
|
|
1091
1091
|
...a,
|
|
1092
|
-
headerText:
|
|
1092
|
+
headerText: E,
|
|
1093
1093
|
sampleContent: {
|
|
1094
1094
|
...a.sampleContent,
|
|
1095
|
-
headerVariables:
|
|
1096
|
-
bodyVariables: ((
|
|
1095
|
+
headerVariables: T,
|
|
1096
|
+
bodyVariables: ((M = a.sampleContent) == null ? void 0 : M.bodyVariables) || {},
|
|
1097
1097
|
buttonVariables: ((A = a.sampleContent) == null ? void 0 : A.buttonVariables) || {}
|
|
1098
1098
|
}
|
|
1099
1099
|
});
|
|
@@ -1103,7 +1103,7 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1103
1103
|
children: "×"
|
|
1104
1104
|
}
|
|
1105
1105
|
)
|
|
1106
|
-
] }, `header-sample-${
|
|
1106
|
+
] }, `header-sample-${w}`);
|
|
1107
1107
|
}) })
|
|
1108
1108
|
] });
|
|
1109
1109
|
})()
|
|
@@ -1116,15 +1116,15 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1116
1116
|
"select",
|
|
1117
1117
|
{
|
|
1118
1118
|
value: a.mediaType || "IMAGE",
|
|
1119
|
-
onChange: (
|
|
1120
|
-
n((
|
|
1121
|
-
...
|
|
1122
|
-
mediaType:
|
|
1119
|
+
onChange: (x) => {
|
|
1120
|
+
n((w) => ({
|
|
1121
|
+
...w,
|
|
1122
|
+
mediaType: x.target.value,
|
|
1123
1123
|
mediaUrl: ""
|
|
1124
|
-
})), d(null),
|
|
1124
|
+
})), d(null), y(null);
|
|
1125
1125
|
},
|
|
1126
1126
|
className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent rsp-appearance-none",
|
|
1127
|
-
children:
|
|
1127
|
+
children: Xe.map((x) => /* @__PURE__ */ e("option", { value: x.value, children: x.label }, x.value))
|
|
1128
1128
|
}
|
|
1129
1129
|
),
|
|
1130
1130
|
/* @__PURE__ */ e("div", { className: "rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none", children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) })
|
|
@@ -1140,32 +1140,32 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1140
1140
|
src: a.mediaUrl,
|
|
1141
1141
|
alt: "Preview",
|
|
1142
1142
|
className: "rsp-w-12 rsp-h-12 rsp-object-cover rsp-rounded",
|
|
1143
|
-
onError: (
|
|
1144
|
-
|
|
1143
|
+
onError: (x) => {
|
|
1144
|
+
x.currentTarget.style.display = "none", f || y("Could not load image preview from URL.");
|
|
1145
1145
|
},
|
|
1146
1146
|
onLoad: () => {
|
|
1147
|
-
|
|
1147
|
+
f != null && f.includes("Could not load") && y(null);
|
|
1148
1148
|
}
|
|
1149
1149
|
}
|
|
1150
1150
|
),
|
|
1151
|
-
a.mediaType === "VIDEO" && /* @__PURE__ */ e("div", { className: "rsp-w-12 rsp-h-12 rsp-bg-gray-200 rsp-rounded rsp-flex rsp-items-center rsp-justify-center flex-shrink-0", children: /* @__PURE__ */ e(
|
|
1152
|
-
a.mediaType === "DOCUMENT" && /* @__PURE__ */ e("div", { className: "rsp-w-12 rsp-h-12 rsp-bg-gray-200 rsp-rounded rsp-flex rsp-items-center rsp-justify-center flex-shrink-0", children: /* @__PURE__ */ e(
|
|
1151
|
+
a.mediaType === "VIDEO" && /* @__PURE__ */ e("div", { className: "rsp-w-12 rsp-h-12 rsp-bg-gray-200 rsp-rounded rsp-flex rsp-items-center rsp-justify-center flex-shrink-0", children: /* @__PURE__ */ e(ze, { className: "rsp-w-6 rsp-h-6 rsp-text-gray-500" }) }),
|
|
1152
|
+
a.mediaType === "DOCUMENT" && /* @__PURE__ */ e("div", { className: "rsp-w-12 rsp-h-12 rsp-bg-gray-200 rsp-rounded rsp-flex rsp-items-center rsp-justify-center flex-shrink-0", children: /* @__PURE__ */ e(Ie, { className: "rsp-w-6 rsp-h-6 rsp-text-gray-500" }) }),
|
|
1153
1153
|
/* @__PURE__ */ r("div", { className: "overflow-hidden", children: [
|
|
1154
1154
|
/* @__PURE__ */ e("p", { className: "rsp-text-sm rsp-font-medium rsp-text-gray-900 rsp-truncate", children: l ? l.name : a.mediaUrl }),
|
|
1155
1155
|
l && /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500", children: `${(l.size / 1024 / 1024).toFixed(2)} MB` })
|
|
1156
1156
|
] })
|
|
1157
1157
|
] }),
|
|
1158
|
-
/* @__PURE__ */ e("button", { onClick: t, className: "rsp-p-1 rsp-text-gray-400 hover:rsp-text-red-500 rsp-transition-colors flex-shrink-0", children: /* @__PURE__ */ e(
|
|
1158
|
+
/* @__PURE__ */ e("button", { onClick: t, className: "rsp-p-1 rsp-text-gray-400 hover:rsp-text-red-500 rsp-transition-colors flex-shrink-0", children: /* @__PURE__ */ e(ee, { className: "rsp-w-4 rsp-h-4" }) })
|
|
1159
1159
|
] }) : /* @__PURE__ */ r("div", { children: [
|
|
1160
|
-
/* @__PURE__ */ e("input", { type: "file", accept:
|
|
1160
|
+
/* @__PURE__ */ e("input", { type: "file", accept: V(), onChange: h, className: "rsp-hidden", id: "media-upload", disabled: p }),
|
|
1161
1161
|
/* @__PURE__ */ r(
|
|
1162
1162
|
"label",
|
|
1163
1163
|
{
|
|
1164
1164
|
htmlFor: "media-upload",
|
|
1165
|
-
className: `rsp-w-full rsp-px-4 rsp-py-3 rsp-border-2 rsp-border-dashed rsp-border-gray-300 rsp-rounded-md rsp-flex rsp-flex-col rsp-items-center rsp-justify-center rsp-cursor-pointer rsp-transition-colors hover:rsp-border-gray-400 hover:rsp-bg-gray-50 ${
|
|
1165
|
+
className: `rsp-w-full rsp-px-4 rsp-py-3 rsp-border-2 rsp-border-dashed rsp-border-gray-300 rsp-rounded-md rsp-flex rsp-flex-col rsp-items-center rsp-justify-center rsp-cursor-pointer rsp-transition-colors hover:rsp-border-gray-400 hover:rsp-bg-gray-50 ${p ? "rsp-opacity-50 rsp-cursor-not-allowed" : ""}`,
|
|
1166
1166
|
children: [
|
|
1167
|
-
/* @__PURE__ */ e(
|
|
1168
|
-
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children:
|
|
1167
|
+
/* @__PURE__ */ e(_e, { className: "rsp-w-6 rsp-h-6 rsp-text-gray-400 rsp-mb-2" }),
|
|
1168
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: p ? "Uploading..." : `Upload ${((R = a.mediaType) == null ? void 0 : R.toLowerCase()) || "file"}` }),
|
|
1169
1169
|
/* @__PURE__ */ r("span", { className: "rsp-text-xs rsp-text-gray-400 rsp-mt-1", children: [
|
|
1170
1170
|
a.mediaType === "IMAGE" && "JPG, PNG up to 5MB",
|
|
1171
1171
|
a.mediaType === "VIDEO" && "MP4, 3GPP up to 16MB",
|
|
@@ -1175,9 +1175,9 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1175
1175
|
}
|
|
1176
1176
|
)
|
|
1177
1177
|
] }),
|
|
1178
|
-
|
|
1179
|
-
/* @__PURE__ */ e(
|
|
1180
|
-
/* @__PURE__ */ e("span", { children:
|
|
1178
|
+
f && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2 rsp-text-xs rsp-text-red-600", children: [
|
|
1179
|
+
/* @__PURE__ */ e(ce, { className: "rsp-w-4 rsp-h-4" }),
|
|
1180
|
+
/* @__PURE__ */ e("span", { children: f })
|
|
1181
1181
|
] }),
|
|
1182
1182
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center", children: [
|
|
1183
1183
|
/* @__PURE__ */ e("div", { className: "rsp-flex-1 rsp-border-t rsp-border-gray-300" }),
|
|
@@ -1189,16 +1189,16 @@ function Je({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1189
1189
|
{
|
|
1190
1190
|
type: "url",
|
|
1191
1191
|
value: a.mediaUrl || "",
|
|
1192
|
-
onChange:
|
|
1192
|
+
onChange: v,
|
|
1193
1193
|
className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",
|
|
1194
|
-
placeholder: `Enter ${(
|
|
1194
|
+
placeholder: `Enter ${(I = a.mediaType) == null ? void 0 : I.toLowerCase()} URL`
|
|
1195
1195
|
}
|
|
1196
1196
|
) })
|
|
1197
1197
|
] })
|
|
1198
1198
|
] })
|
|
1199
1199
|
] });
|
|
1200
1200
|
}
|
|
1201
|
-
const
|
|
1201
|
+
const we = [
|
|
1202
1202
|
{ name: "grinning-face", hexadecimal: "😀" },
|
|
1203
1203
|
{ name: "grinning-face-with-smiling-eyes", hexadecimal: "😁" },
|
|
1204
1204
|
{ name: "face-with-tears-of-joy", hexadecimal: "😂" },
|
|
@@ -2997,56 +2997,56 @@ const be = [
|
|
|
2997
2997
|
{ name: "south-africa", hexadecimal: "🇿🇦" },
|
|
2998
2998
|
{ name: "zambia", hexadecimal: "🇿🇲" },
|
|
2999
2999
|
{ name: "zimbabwe", hexadecimal: "🇿🇼" }
|
|
3000
|
-
],
|
|
3000
|
+
], ra = ({
|
|
3001
3001
|
emojis: a,
|
|
3002
3002
|
onSelect: n,
|
|
3003
3003
|
onClose: i
|
|
3004
3004
|
}) => {
|
|
3005
|
-
const [l, d] =
|
|
3006
|
-
const
|
|
3007
|
-
|
|
3008
|
-
Math.ceil(a.length /
|
|
3005
|
+
const [l, d] = B({ start: 0, end: 80 }), p = 8, m = 40, C = 400, g = ge((U) => {
|
|
3006
|
+
const k = U.currentTarget.scrollTop, N = Math.floor(k / m), o = Math.min(
|
|
3007
|
+
N + Math.ceil(C / m) + 2,
|
|
3008
|
+
Math.ceil(a.length / p)
|
|
3009
3009
|
);
|
|
3010
3010
|
d({
|
|
3011
|
-
start:
|
|
3012
|
-
end:
|
|
3011
|
+
start: N * p,
|
|
3012
|
+
end: o * p
|
|
3013
3013
|
});
|
|
3014
|
-
}, [a.length, m,
|
|
3015
|
-
const
|
|
3016
|
-
if (!
|
|
3017
|
-
const
|
|
3018
|
-
const
|
|
3019
|
-
return parseInt(
|
|
3014
|
+
}, [a.length, m, C, p]), f = ge((U) => {
|
|
3015
|
+
const k = U.match(/&#x([0-9A-Fa-f]+);/g);
|
|
3016
|
+
if (!k) return "";
|
|
3017
|
+
const N = k.map((o) => {
|
|
3018
|
+
const u = o.replace(/&#x|;/g, "");
|
|
3019
|
+
return parseInt(u, 16);
|
|
3020
3020
|
});
|
|
3021
|
-
return String.fromCodePoint(...
|
|
3022
|
-
}, []),
|
|
3021
|
+
return String.fromCodePoint(...N);
|
|
3022
|
+
}, []), y = Math.ceil(a.length / p) * m, j = a.slice(l.start, l.end);
|
|
3023
3023
|
return /* @__PURE__ */ e(
|
|
3024
3024
|
"div",
|
|
3025
3025
|
{
|
|
3026
3026
|
className: "rsp-h-[400px] rsp-overflow-y-auto rsp-relative",
|
|
3027
|
-
onScroll:
|
|
3028
|
-
children: /* @__PURE__ */ e("div", { style: { height:
|
|
3027
|
+
onScroll: g,
|
|
3028
|
+
children: /* @__PURE__ */ e("div", { style: { height: y }, className: "rsp-relative", children: /* @__PURE__ */ e(
|
|
3029
3029
|
"div",
|
|
3030
3030
|
{
|
|
3031
3031
|
className: "rsp-absolute rsp-w-full rsp-grid rsp-grid-cols-8 rsp-gap-1",
|
|
3032
3032
|
style: {
|
|
3033
|
-
top: Math.floor(l.start /
|
|
3033
|
+
top: Math.floor(l.start / p) * m,
|
|
3034
3034
|
transform: "translateY(0px)"
|
|
3035
3035
|
},
|
|
3036
|
-
children:
|
|
3037
|
-
const
|
|
3036
|
+
children: j.map((U, k) => {
|
|
3037
|
+
const N = l.start + k;
|
|
3038
3038
|
return /* @__PURE__ */ e(
|
|
3039
3039
|
"button",
|
|
3040
3040
|
{
|
|
3041
3041
|
onClick: () => {
|
|
3042
|
-
n(
|
|
3042
|
+
n(f(U.hexadecimal));
|
|
3043
3043
|
},
|
|
3044
3044
|
className: "rsp-w-10 rsp-h-10 rsp-flex rsp-items-center rsp-justify-center rsp-text-xl hover:rsp-bg-gray-100 rsp-rounded rsp-transition-colors",
|
|
3045
|
-
title:
|
|
3045
|
+
title: U.name,
|
|
3046
3046
|
style: { height: m },
|
|
3047
|
-
children:
|
|
3047
|
+
children: f(U.hexadecimal)
|
|
3048
3048
|
},
|
|
3049
|
-
|
|
3049
|
+
N
|
|
3050
3050
|
);
|
|
3051
3051
|
})
|
|
3052
3052
|
}
|
|
@@ -3054,13 +3054,13 @@ const be = [
|
|
|
3054
3054
|
}
|
|
3055
3055
|
);
|
|
3056
3056
|
};
|
|
3057
|
-
function
|
|
3058
|
-
const [l, d] =
|
|
3057
|
+
function fe({ isOpen: a, onClose: n, onSelect: i }) {
|
|
3058
|
+
const [l, d] = B(""), p = Ne(() => l ? we.filter(
|
|
3059
3059
|
(m) => m.name.toLowerCase().includes(l.toLowerCase())
|
|
3060
|
-
) :
|
|
3061
|
-
return
|
|
3060
|
+
) : we, [l]);
|
|
3061
|
+
return K.useEffect(() => {
|
|
3062
3062
|
a || d("");
|
|
3063
|
-
}, [a]), /* @__PURE__ */ e(
|
|
3063
|
+
}, [a]), /* @__PURE__ */ e(pe, { isOpen: a, onClose: n, title: "Select Emoji", children: /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
|
|
3064
3064
|
/* @__PURE__ */ r("div", { className: "rsp-relative", children: [
|
|
3065
3065
|
/* @__PURE__ */ e(
|
|
3066
3066
|
"input",
|
|
@@ -3093,74 +3093,74 @@ function xe({ isOpen: a, onClose: n, onSelect: i }) {
|
|
|
3093
3093
|
m
|
|
3094
3094
|
)) }),
|
|
3095
3095
|
/* @__PURE__ */ r("div", { className: "rsp-text-sm rsp-text-gray-500", children: [
|
|
3096
|
-
|
|
3096
|
+
p.length,
|
|
3097
3097
|
" emojis found"
|
|
3098
3098
|
] }),
|
|
3099
3099
|
/* @__PURE__ */ e(
|
|
3100
|
-
|
|
3100
|
+
ra,
|
|
3101
3101
|
{
|
|
3102
|
-
emojis:
|
|
3102
|
+
emojis: p,
|
|
3103
3103
|
onSelect: i,
|
|
3104
3104
|
onClose: n
|
|
3105
3105
|
}
|
|
3106
3106
|
)
|
|
3107
3107
|
] }) });
|
|
3108
3108
|
}
|
|
3109
|
-
function
|
|
3110
|
-
const [i, l] =
|
|
3111
|
-
const
|
|
3112
|
-
if (!
|
|
3113
|
-
const
|
|
3114
|
-
const
|
|
3115
|
-
return
|
|
3109
|
+
function sa({ template: a, setTemplate: n }) {
|
|
3110
|
+
const [i, l] = B(!1), [d, p] = B(null), [m, C] = B(null), [g, f] = B(null), y = () => {
|
|
3111
|
+
const o = (a.body || "").match(/{{\d+}}/g);
|
|
3112
|
+
if (!o) return 0;
|
|
3113
|
+
const u = o.map((t) => {
|
|
3114
|
+
const h = t.match(/{{(\d+)}}/);
|
|
3115
|
+
return h ? parseInt(h[1], 10) : 0;
|
|
3116
3116
|
});
|
|
3117
|
-
return
|
|
3118
|
-
},
|
|
3119
|
-
const
|
|
3120
|
-
if (m && a.body.length +
|
|
3121
|
-
const t = m.selectionStart || a.body.length,
|
|
3117
|
+
return u.length > 0 ? Math.max(...u) : 0;
|
|
3118
|
+
}, j = () => {
|
|
3119
|
+
const u = `{{${y() + 1}}}`;
|
|
3120
|
+
if (m && a.body.length + u.length <= 1024) {
|
|
3121
|
+
const t = m.selectionStart || a.body.length, h = a.body.substring(0, t), v = a.body.substring(t), V = h + u + v;
|
|
3122
3122
|
n({
|
|
3123
3123
|
...a,
|
|
3124
|
-
body:
|
|
3124
|
+
body: V
|
|
3125
3125
|
}), setTimeout(() => {
|
|
3126
3126
|
if (m) {
|
|
3127
|
-
const
|
|
3128
|
-
m.setSelectionRange(
|
|
3127
|
+
const R = t + u.length;
|
|
3128
|
+
m.setSelectionRange(R, R), m.focus();
|
|
3129
3129
|
}
|
|
3130
3130
|
}, 0);
|
|
3131
3131
|
}
|
|
3132
|
-
},
|
|
3133
|
-
|
|
3132
|
+
}, U = () => {
|
|
3133
|
+
p("body"), l(!0), setTimeout(() => {
|
|
3134
3134
|
m && m.focus();
|
|
3135
3135
|
}, 0);
|
|
3136
|
-
},
|
|
3136
|
+
}, k = (N) => {
|
|
3137
3137
|
if (d === "body") {
|
|
3138
3138
|
if (!m) return;
|
|
3139
|
-
const
|
|
3140
|
-
if (t.length +
|
|
3141
|
-
const
|
|
3139
|
+
const o = m.selectionStart || a.body.length, u = 1024, t = a.body;
|
|
3140
|
+
if (t.length + N.length <= u) {
|
|
3141
|
+
const h = t.substring(0, o), v = t.substring(o), V = h + N + v;
|
|
3142
3142
|
n({
|
|
3143
3143
|
...a,
|
|
3144
|
-
body:
|
|
3144
|
+
body: V
|
|
3145
3145
|
}), setTimeout(() => {
|
|
3146
3146
|
if (m) {
|
|
3147
|
-
const
|
|
3148
|
-
m.setSelectionRange(
|
|
3147
|
+
const R = o + N.length;
|
|
3148
|
+
m.setSelectionRange(R, R), m.focus();
|
|
3149
3149
|
}
|
|
3150
3150
|
}, 0);
|
|
3151
3151
|
}
|
|
3152
3152
|
} else if (d === "footer") {
|
|
3153
|
-
if (!
|
|
3154
|
-
const
|
|
3155
|
-
if (t.length +
|
|
3156
|
-
const
|
|
3153
|
+
if (!g) return;
|
|
3154
|
+
const o = g.selectionStart || a.footer.length, u = 60, t = a.footer;
|
|
3155
|
+
if (t.length + N.length <= u) {
|
|
3156
|
+
const h = t.substring(0, o), v = t.substring(o), V = h + N + v;
|
|
3157
3157
|
n({
|
|
3158
3158
|
...a,
|
|
3159
|
-
footer:
|
|
3159
|
+
footer: V
|
|
3160
3160
|
}), setTimeout(() => {
|
|
3161
|
-
if (
|
|
3162
|
-
const
|
|
3163
|
-
|
|
3161
|
+
if (g) {
|
|
3162
|
+
const R = o + N.length;
|
|
3163
|
+
g.setSelectionRange(R, R), g.focus();
|
|
3164
3164
|
}
|
|
3165
3165
|
}, 0);
|
|
3166
3166
|
}
|
|
@@ -3172,14 +3172,14 @@ function ea({ template: a, setTemplate: n }) {
|
|
|
3172
3172
|
/* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
|
|
3173
3173
|
"textarea",
|
|
3174
3174
|
{
|
|
3175
|
-
ref:
|
|
3175
|
+
ref: C,
|
|
3176
3176
|
value: a.body,
|
|
3177
|
-
onChange: (
|
|
3177
|
+
onChange: (N) => n({ ...a, body: N.target.value }),
|
|
3178
3178
|
maxLength: 1024,
|
|
3179
3179
|
rows: 6,
|
|
3180
3180
|
className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white rsp-resize-none rsp-shadow-sm",
|
|
3181
3181
|
placeholder: "Enter the text for your message",
|
|
3182
|
-
onFocus: () =>
|
|
3182
|
+
onFocus: () => p("body")
|
|
3183
3183
|
}
|
|
3184
3184
|
) }),
|
|
3185
3185
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-mt-2", children: [
|
|
@@ -3187,7 +3187,7 @@ function ea({ template: a, setTemplate: n }) {
|
|
|
3187
3187
|
/* @__PURE__ */ e(
|
|
3188
3188
|
"button",
|
|
3189
3189
|
{
|
|
3190
|
-
onClick:
|
|
3190
|
+
onClick: j,
|
|
3191
3191
|
className: "rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",
|
|
3192
3192
|
title: "Add Variable",
|
|
3193
3193
|
children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" }) })
|
|
@@ -3196,10 +3196,10 @@ function ea({ template: a, setTemplate: n }) {
|
|
|
3196
3196
|
/* @__PURE__ */ e(
|
|
3197
3197
|
"button",
|
|
3198
3198
|
{
|
|
3199
|
-
onClick:
|
|
3199
|
+
onClick: U,
|
|
3200
3200
|
className: "rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",
|
|
3201
3201
|
title: "Add emoji",
|
|
3202
|
-
children: /* @__PURE__ */ e(
|
|
3202
|
+
children: /* @__PURE__ */ e(xe, { className: "rsp-w-4 rsp-h-4" })
|
|
3203
3203
|
}
|
|
3204
3204
|
)
|
|
3205
3205
|
] }),
|
|
@@ -3209,15 +3209,15 @@ function ea({ template: a, setTemplate: n }) {
|
|
|
3209
3209
|
] }) })
|
|
3210
3210
|
] }),
|
|
3211
3211
|
(() => {
|
|
3212
|
-
const
|
|
3213
|
-
return
|
|
3212
|
+
const N = a.body.match(/\{\{(\d+)\}\}/g) || [], o = [...new Set(N.map((u) => u.replace(/[{}]/g, "")))];
|
|
3213
|
+
return o.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
|
|
3214
3214
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2", children: "Sample Values" }),
|
|
3215
|
-
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children:
|
|
3216
|
-
var t,
|
|
3215
|
+
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: o.map((u) => {
|
|
3216
|
+
var t, h;
|
|
3217
3217
|
return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
3218
3218
|
/* @__PURE__ */ r("label", { className: "rsp-text-xs rsp-text-gray-500 rsp-whitespace-nowrap", children: [
|
|
3219
3219
|
"{{",
|
|
3220
|
-
|
|
3220
|
+
u,
|
|
3221
3221
|
"}}",
|
|
3222
3222
|
":"
|
|
3223
3223
|
] }),
|
|
@@ -3225,21 +3225,21 @@ function ea({ template: a, setTemplate: n }) {
|
|
|
3225
3225
|
"input",
|
|
3226
3226
|
{
|
|
3227
3227
|
type: "text",
|
|
3228
|
-
value: ((
|
|
3229
|
-
onChange: (
|
|
3230
|
-
var
|
|
3231
|
-
const
|
|
3228
|
+
value: ((h = (t = a.sampleContent) == null ? void 0 : t.bodyVariables) == null ? void 0 : h[u]) || "",
|
|
3229
|
+
onChange: (v) => {
|
|
3230
|
+
var R, I, x;
|
|
3231
|
+
const V = {
|
|
3232
3232
|
...a.sampleContent,
|
|
3233
3233
|
bodyVariables: {
|
|
3234
|
-
...(
|
|
3235
|
-
[
|
|
3234
|
+
...(R = a.sampleContent) == null ? void 0 : R.bodyVariables,
|
|
3235
|
+
[u]: v.target.value
|
|
3236
3236
|
},
|
|
3237
|
-
headerVariables: ((
|
|
3238
|
-
buttonVariables: ((
|
|
3237
|
+
headerVariables: ((I = a.sampleContent) == null ? void 0 : I.headerVariables) || {},
|
|
3238
|
+
buttonVariables: ((x = a.sampleContent) == null ? void 0 : x.buttonVariables) || {}
|
|
3239
3239
|
};
|
|
3240
3240
|
n({
|
|
3241
3241
|
...a,
|
|
3242
|
-
sampleContent:
|
|
3242
|
+
sampleContent: V
|
|
3243
3243
|
});
|
|
3244
3244
|
},
|
|
3245
3245
|
className: "rsp-flex-1 rsp-px-2 rsp-py-1 rsp-border rsp-border-gray-300 rsp-rounded rsp-text-xs focus:rsp-outline-none focus:rsp-border-blue-500",
|
|
@@ -3251,16 +3251,16 @@ function ea({ template: a, setTemplate: n }) {
|
|
|
3251
3251
|
{
|
|
3252
3252
|
type: "button",
|
|
3253
3253
|
onClick: () => {
|
|
3254
|
-
var
|
|
3255
|
-
const
|
|
3254
|
+
var I, x, w;
|
|
3255
|
+
const v = new RegExp(`\\{\\{${u}\\}\\}`, "g"), V = (a.body || "").replace(v, ""), R = Object.fromEntries(Object.entries(((I = a.sampleContent) == null ? void 0 : I.bodyVariables) || {}).filter(([L]) => L !== u));
|
|
3256
3256
|
n({
|
|
3257
3257
|
...a,
|
|
3258
|
-
body:
|
|
3258
|
+
body: V,
|
|
3259
3259
|
sampleContent: {
|
|
3260
3260
|
...a.sampleContent,
|
|
3261
|
-
bodyVariables:
|
|
3262
|
-
headerVariables: ((
|
|
3263
|
-
buttonVariables: ((
|
|
3261
|
+
bodyVariables: R,
|
|
3262
|
+
headerVariables: ((x = a.sampleContent) == null ? void 0 : x.headerVariables) || {},
|
|
3263
|
+
buttonVariables: ((w = a.sampleContent) == null ? void 0 : w.buttonVariables) || {}
|
|
3264
3264
|
}
|
|
3265
3265
|
});
|
|
3266
3266
|
},
|
|
@@ -3269,7 +3269,7 @@ function ea({ template: a, setTemplate: n }) {
|
|
|
3269
3269
|
children: "×"
|
|
3270
3270
|
}
|
|
3271
3271
|
)
|
|
3272
|
-
] }, `body-sample-${
|
|
3272
|
+
] }, `body-sample-${u}`);
|
|
3273
3273
|
}) })
|
|
3274
3274
|
] });
|
|
3275
3275
|
})()
|
|
@@ -3279,14 +3279,14 @@ function ea({ template: a, setTemplate: n }) {
|
|
|
3279
3279
|
/* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
|
|
3280
3280
|
"input",
|
|
3281
3281
|
{
|
|
3282
|
-
ref:
|
|
3282
|
+
ref: f,
|
|
3283
3283
|
type: "text",
|
|
3284
3284
|
value: a.footer,
|
|
3285
|
-
onChange: (
|
|
3285
|
+
onChange: (N) => n({ ...a, footer: N.target.value }),
|
|
3286
3286
|
maxLength: 60,
|
|
3287
3287
|
className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",
|
|
3288
3288
|
placeholder: "Footer Text",
|
|
3289
|
-
onFocus: () =>
|
|
3289
|
+
onFocus: () => p("footer")
|
|
3290
3290
|
}
|
|
3291
3291
|
) }),
|
|
3292
3292
|
/* @__PURE__ */ r("p", { className: "rsp-text-xs rsp-text-gray-500 rsp-mt-1", children: [
|
|
@@ -3295,31 +3295,31 @@ function ea({ template: a, setTemplate: n }) {
|
|
|
3295
3295
|
] })
|
|
3296
3296
|
] }),
|
|
3297
3297
|
/* @__PURE__ */ e(
|
|
3298
|
-
|
|
3298
|
+
fe,
|
|
3299
3299
|
{
|
|
3300
3300
|
isOpen: i,
|
|
3301
3301
|
onClose: () => l(!1),
|
|
3302
|
-
onSelect:
|
|
3302
|
+
onSelect: k
|
|
3303
3303
|
}
|
|
3304
3304
|
)
|
|
3305
3305
|
] });
|
|
3306
3306
|
}
|
|
3307
|
-
function
|
|
3308
|
-
var
|
|
3309
|
-
const [i, l] =
|
|
3307
|
+
function na({ template: a, setTemplate: n }) {
|
|
3308
|
+
var u;
|
|
3309
|
+
const [i, l] = B(null), [d, p] = B(!1), [m, C] = B({
|
|
3310
3310
|
text: "",
|
|
3311
3311
|
value: "",
|
|
3312
3312
|
urlType: "static"
|
|
3313
|
-
}),
|
|
3313
|
+
}), f = {
|
|
3314
3314
|
quickReply: a.buttons.filter((t) => t.type === "QUICK_REPLY").length,
|
|
3315
3315
|
url: a.buttons.filter((t) => t.type === "URL").length,
|
|
3316
3316
|
call: a.buttons.filter((t) => t.type === "CALL").length,
|
|
3317
3317
|
flow: a.buttons.filter((t) => t.type === "FLOW").length
|
|
3318
|
-
},
|
|
3319
|
-
|
|
3320
|
-
},
|
|
3318
|
+
}, y = () => {
|
|
3319
|
+
C({ text: "", value: "", urlType: "static" }), l(null), p(!1);
|
|
3320
|
+
}, j = (t) => {
|
|
3321
3321
|
if (!m.text.trim()) return;
|
|
3322
|
-
const
|
|
3322
|
+
const h = {
|
|
3323
3323
|
id: Math.random().toString(36).substr(2, 9),
|
|
3324
3324
|
type: t,
|
|
3325
3325
|
text: m.text,
|
|
@@ -3328,60 +3328,60 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3328
3328
|
};
|
|
3329
3329
|
n({
|
|
3330
3330
|
...a,
|
|
3331
|
-
buttons: [...a.buttons,
|
|
3332
|
-
}),
|
|
3333
|
-
},
|
|
3331
|
+
buttons: [...a.buttons, h]
|
|
3332
|
+
}), y();
|
|
3333
|
+
}, U = (t) => {
|
|
3334
3334
|
n({
|
|
3335
3335
|
...a,
|
|
3336
|
-
buttons: a.buttons.filter((
|
|
3336
|
+
buttons: a.buttons.filter((h) => h.id !== t)
|
|
3337
3337
|
});
|
|
3338
|
-
},
|
|
3339
|
-
var
|
|
3340
|
-
const
|
|
3338
|
+
}, k = (t, h, v) => {
|
|
3339
|
+
var R;
|
|
3340
|
+
const V = h === "text" ? 25 : h === "value" && ((R = a.buttons.find((I) => I.id === t)) == null ? void 0 : R.type) === "URL" ? 2e3 : 20;
|
|
3341
3341
|
n({
|
|
3342
3342
|
...a,
|
|
3343
3343
|
buttons: a.buttons.map(
|
|
3344
|
-
(
|
|
3344
|
+
(I) => I.id === t ? { ...I, [h]: v.slice(0, V) } : I
|
|
3345
3345
|
)
|
|
3346
3346
|
});
|
|
3347
|
-
},
|
|
3348
|
-
const
|
|
3349
|
-
...a.buttons.filter((
|
|
3347
|
+
}, N = () => {
|
|
3348
|
+
const h = [
|
|
3349
|
+
...a.buttons.filter((V) => V.type === "URL" && V.urlType === "dynamic").map((V) => V.value || ""),
|
|
3350
3350
|
m.value
|
|
3351
3351
|
// Include current form input
|
|
3352
3352
|
].join(" ").match(/{{\d+}}/g);
|
|
3353
|
-
if (!
|
|
3354
|
-
const
|
|
3355
|
-
const
|
|
3356
|
-
return
|
|
3353
|
+
if (!h) return 0;
|
|
3354
|
+
const v = h.map((V) => {
|
|
3355
|
+
const R = V.match(/{{(\d+)}}/);
|
|
3356
|
+
return R ? parseInt(R[1], 10) : 0;
|
|
3357
3357
|
});
|
|
3358
|
-
return
|
|
3359
|
-
},
|
|
3358
|
+
return v.length > 0 ? Math.max(...v) : 0;
|
|
3359
|
+
}, o = [
|
|
3360
3360
|
{
|
|
3361
3361
|
type: "QUICK_REPLY",
|
|
3362
|
-
icon:
|
|
3362
|
+
icon: le,
|
|
3363
3363
|
label: "Quick Reply",
|
|
3364
3364
|
description: "Add quick response options",
|
|
3365
3365
|
limit: 10,
|
|
3366
|
-
current:
|
|
3366
|
+
current: f.quickReply,
|
|
3367
3367
|
color: "blue"
|
|
3368
3368
|
},
|
|
3369
3369
|
{
|
|
3370
3370
|
type: "URL",
|
|
3371
|
-
icon:
|
|
3371
|
+
icon: Be,
|
|
3372
3372
|
label: "Web URL",
|
|
3373
3373
|
description: "Link to websites or pages",
|
|
3374
3374
|
limit: 2,
|
|
3375
|
-
current:
|
|
3375
|
+
current: f.url,
|
|
3376
3376
|
color: "green"
|
|
3377
3377
|
},
|
|
3378
3378
|
{
|
|
3379
3379
|
type: "CALL",
|
|
3380
|
-
icon:
|
|
3380
|
+
icon: Me,
|
|
3381
3381
|
label: "Call Button",
|
|
3382
3382
|
description: "Add phone number to call",
|
|
3383
3383
|
limit: 1,
|
|
3384
|
-
current:
|
|
3384
|
+
current: f.call,
|
|
3385
3385
|
color: "purple"
|
|
3386
3386
|
}
|
|
3387
3387
|
// {
|
|
@@ -3406,17 +3406,17 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3406
3406
|
/* @__PURE__ */ e("div", { className: "rsp-flex-shrink-0", children: /* @__PURE__ */ e("svg", { className: "rsp-h-5 rsp-w-5 rsp-text-blue-400", viewBox: "0 0 20 20", fill: "currentColor", children: /* @__PURE__ */ e("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }) }),
|
|
3407
3407
|
/* @__PURE__ */ e("div", { className: "rsp-ml-3", children: /* @__PURE__ */ e("p", { className: "rsp-text-sm rsp-text-blue-700", children: "We recommend adding the marketing opt-out button. This can help reduce blocks from customers and increase your quality rating." }) })
|
|
3408
3408
|
] }) }),
|
|
3409
|
-
!i && /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-1 md:rsp-grid-cols-2 rsp-gap-4", children:
|
|
3410
|
-
const
|
|
3409
|
+
!i && /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-1 md:rsp-grid-cols-2 rsp-gap-4", children: o.map((t) => {
|
|
3410
|
+
const h = t.icon, v = t.current >= t.limit;
|
|
3411
3411
|
return /* @__PURE__ */ e(
|
|
3412
3412
|
"button",
|
|
3413
3413
|
{
|
|
3414
|
-
onClick: () => !
|
|
3415
|
-
disabled:
|
|
3416
|
-
className: `rsp-p-4 rsp-border-2 rsp-rounded-xl rsp-text-left rsp-transition-all rsp-duration-200 ${
|
|
3414
|
+
onClick: () => !v && l(t.type),
|
|
3415
|
+
disabled: v,
|
|
3416
|
+
className: `rsp-p-4 rsp-border-2 rsp-rounded-xl rsp-text-left rsp-transition-all rsp-duration-200 ${v ? "rsp-border-gray-200 rsp-bg-gray-50 rsp-text-gray-400 rsp-cursor-not-allowed rsp-opacity-60" : "rsp-cursor-pointer rsp-transform rsp-shadow-sm hover:rsp-shadow-md"}`,
|
|
3417
3417
|
children: /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-start rsp-justify-between", children: [
|
|
3418
3418
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-3", children: [
|
|
3419
|
-
/* @__PURE__ */ e("div", { className: `rsp-p-2 rsp-rounded-lg ${
|
|
3419
|
+
/* @__PURE__ */ e("div", { className: `rsp-p-2 rsp-rounded-lg ${v ? "rsp-bg-gray-200" : "rsp-bg-white rsp-shadow-sm"}`, children: /* @__PURE__ */ e(h, { className: "rsp-w-5 rsp-h-5" }) }),
|
|
3420
3420
|
/* @__PURE__ */ r("div", { children: [
|
|
3421
3421
|
/* @__PURE__ */ e("h4", { className: "rsp-font-semibold rsp-text-sm", children: t.label }),
|
|
3422
3422
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-opacity-80 rsp-mt-1", children: t.description })
|
|
@@ -3428,7 +3428,7 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3428
3428
|
"/",
|
|
3429
3429
|
t.limit
|
|
3430
3430
|
] }),
|
|
3431
|
-
!
|
|
3431
|
+
!v && /* @__PURE__ */ e(de, { className: "rsp-w-4 rsp-h-4" })
|
|
3432
3432
|
] })
|
|
3433
3433
|
] })
|
|
3434
3434
|
},
|
|
@@ -3439,14 +3439,14 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3439
3439
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-mb-4", children: [
|
|
3440
3440
|
/* @__PURE__ */ r("h4", { className: "rsp-text-lg rsp-font-semibold rsp-text-gray-900", children: [
|
|
3441
3441
|
"Add ",
|
|
3442
|
-
(
|
|
3442
|
+
(u = o.find((t) => t.type === i)) == null ? void 0 : u.label
|
|
3443
3443
|
] }),
|
|
3444
3444
|
/* @__PURE__ */ e(
|
|
3445
3445
|
"button",
|
|
3446
3446
|
{
|
|
3447
|
-
onClick:
|
|
3447
|
+
onClick: y,
|
|
3448
3448
|
className: "rsp-p-2 rsp-text-gray-400 hover:rsp-text-gray-600 hover:rsp-bg-white rsp-rounded-lg rsp-transition-colors",
|
|
3449
|
-
children: /* @__PURE__ */ e(
|
|
3449
|
+
children: /* @__PURE__ */ e(ee, { className: "rsp-w-5 rsp-h-5" })
|
|
3450
3450
|
}
|
|
3451
3451
|
)
|
|
3452
3452
|
] }),
|
|
@@ -3459,7 +3459,7 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3459
3459
|
{
|
|
3460
3460
|
type: "text",
|
|
3461
3461
|
value: m.text,
|
|
3462
|
-
onChange: (t) =>
|
|
3462
|
+
onChange: (t) => C({ ...m, text: t.target.value.slice(0, 25) }),
|
|
3463
3463
|
className: "rsp-w-full rsp-px-4 rsp-py-3 rsp-border rsp-border-gray-300 rsp-rounded-lg rsp-bg-white rsp-text-sm focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-transparent rsp-shadow-sm",
|
|
3464
3464
|
placeholder: "Enter button text (max 25 characters)",
|
|
3465
3465
|
maxLength: 25
|
|
@@ -3481,7 +3481,7 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3481
3481
|
{
|
|
3482
3482
|
type: "radio",
|
|
3483
3483
|
checked: m.urlType === "static",
|
|
3484
|
-
onChange: () =>
|
|
3484
|
+
onChange: () => C({ ...m, urlType: "static" }),
|
|
3485
3485
|
className: "rsp-mr-2 rsp-text-blue-600"
|
|
3486
3486
|
}
|
|
3487
3487
|
),
|
|
@@ -3493,7 +3493,7 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3493
3493
|
{
|
|
3494
3494
|
type: "radio",
|
|
3495
3495
|
checked: m.urlType === "dynamic",
|
|
3496
|
-
onChange: () =>
|
|
3496
|
+
onChange: () => C({ ...m, urlType: "dynamic" }),
|
|
3497
3497
|
className: "rsp-mr-2 rsp-text-blue-600"
|
|
3498
3498
|
}
|
|
3499
3499
|
),
|
|
@@ -3517,8 +3517,8 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3517
3517
|
type: i === "CALL" ? "tel" : i === "URL" ? "url" : "text",
|
|
3518
3518
|
value: m.value,
|
|
3519
3519
|
onChange: (t) => {
|
|
3520
|
-
const
|
|
3521
|
-
|
|
3520
|
+
const h = i === "URL" ? 2e3 : 20;
|
|
3521
|
+
C({ ...m, value: t.target.value.slice(0, h) });
|
|
3522
3522
|
},
|
|
3523
3523
|
className: "rsp-w-full rsp-px-4 rsp-py-3 rsp-border rsp-border-gray-300 rsp-rounded-lg rsp-bg-white rsp-text-sm focus:rsp-outline-none focus:rsp-ring-2 focus:rsp-ring-blue-500 focus:rsp-border-transparent rsp-shadow-sm",
|
|
3524
3524
|
placeholder: i === "URL" ? m.urlType === "dynamic" ? "https://example.com/order/{{1}}?user={{2}}" : "https://example.com" : i === "CALL" ? "+1234567890" : "Flow ID",
|
|
@@ -3538,8 +3538,8 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3538
3538
|
type: "button",
|
|
3539
3539
|
onClick: () => {
|
|
3540
3540
|
if ((m.value.match(/\{\{(\d+)\}\}/g) || []).length >= 3) return;
|
|
3541
|
-
const
|
|
3542
|
-
|
|
3541
|
+
const v = N() + 1, V = m.value + `{{${v}}}`;
|
|
3542
|
+
C({ ...m, value: V }), p(!0);
|
|
3543
3543
|
},
|
|
3544
3544
|
disabled: (m.value.match(/\{\{(\d+)\}\}/g) || []).length >= 3,
|
|
3545
3545
|
className: "rsp-px-2 rsp-py-2 rsp-text-xs rsp-bg-gray-300 hover:rsp-bg-gray-200 rsp-rounded rsp-text-gray-700 disabled:rsp-bg-gray-200 disabled:rsp-text-gray-500",
|
|
@@ -3551,37 +3551,37 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3551
3551
|
/* @__PURE__ */ e("h4", { className: "rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-3", children: "Sample Values for URL Variables" }),
|
|
3552
3552
|
/* @__PURE__ */ e("div", { className: "rsp-space-y-3", children: (() => {
|
|
3553
3553
|
const t = m.value.match(/\{\{(\d+)\}\}/g) || [];
|
|
3554
|
-
return [...new Set(t.map((
|
|
3555
|
-
var
|
|
3554
|
+
return [...new Set(t.map((v) => v.replace(/[{}]/g, "")))].map((v) => {
|
|
3555
|
+
var V, R;
|
|
3556
3556
|
return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
3557
3557
|
/* @__PURE__ */ r("label", { className: "rsp-text-sm rsp-text-gray-600 rsp-whitespace-nowrap", children: [
|
|
3558
3558
|
"Variable {{",
|
|
3559
|
-
|
|
3559
|
+
v,
|
|
3560
3560
|
"}}"
|
|
3561
3561
|
] }),
|
|
3562
3562
|
/* @__PURE__ */ e(
|
|
3563
3563
|
"input",
|
|
3564
3564
|
{
|
|
3565
3565
|
type: "text",
|
|
3566
|
-
value: ((
|
|
3567
|
-
onChange: (
|
|
3568
|
-
var
|
|
3569
|
-
const
|
|
3566
|
+
value: ((R = (V = a.sampleContent) == null ? void 0 : V.buttonVariables) == null ? void 0 : R[v]) || "",
|
|
3567
|
+
onChange: (I) => {
|
|
3568
|
+
var w, L, s;
|
|
3569
|
+
const x = {
|
|
3570
3570
|
...a.sampleContent,
|
|
3571
|
-
headerVariables: ((
|
|
3572
|
-
bodyVariables: ((
|
|
3571
|
+
headerVariables: ((w = a.sampleContent) == null ? void 0 : w.headerVariables) || {},
|
|
3572
|
+
bodyVariables: ((L = a.sampleContent) == null ? void 0 : L.bodyVariables) || {},
|
|
3573
3573
|
buttonVariables: {
|
|
3574
|
-
...(
|
|
3575
|
-
[
|
|
3574
|
+
...(s = a.sampleContent) == null ? void 0 : s.buttonVariables,
|
|
3575
|
+
[v]: I.target.value
|
|
3576
3576
|
}
|
|
3577
3577
|
};
|
|
3578
3578
|
n({
|
|
3579
3579
|
...a,
|
|
3580
|
-
sampleContent:
|
|
3580
|
+
sampleContent: x
|
|
3581
3581
|
});
|
|
3582
3582
|
},
|
|
3583
3583
|
className: "rsp-flex-1 rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-ring-1 focus:rsp-ring-blue-500 focus:rsp-border-blue-500",
|
|
3584
|
-
placeholder: `Sample value (e.g., ${
|
|
3584
|
+
placeholder: `Sample value (e.g., ${v === "1" ? "order123" : "user456"})`
|
|
3585
3585
|
}
|
|
3586
3586
|
),
|
|
3587
3587
|
/* @__PURE__ */ e(
|
|
@@ -3589,17 +3589,17 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3589
3589
|
{
|
|
3590
3590
|
type: "button",
|
|
3591
3591
|
onClick: () => {
|
|
3592
|
-
var
|
|
3593
|
-
const
|
|
3594
|
-
|
|
3595
|
-
const
|
|
3592
|
+
var L, s, b;
|
|
3593
|
+
const I = new RegExp(`\\{\\{${v}\\}\\}`, "g"), x = (m.value || "").replace(I, "");
|
|
3594
|
+
C({ ...m, value: x });
|
|
3595
|
+
const w = Object.fromEntries(Object.entries(((L = a.sampleContent) == null ? void 0 : L.buttonVariables) || {}).filter(([E]) => E !== v));
|
|
3596
3596
|
n({
|
|
3597
3597
|
...a,
|
|
3598
3598
|
sampleContent: {
|
|
3599
3599
|
...a.sampleContent,
|
|
3600
|
-
headerVariables: ((
|
|
3601
|
-
bodyVariables: ((
|
|
3602
|
-
buttonVariables:
|
|
3600
|
+
headerVariables: ((s = a.sampleContent) == null ? void 0 : s.headerVariables) || {},
|
|
3601
|
+
bodyVariables: ((b = a.sampleContent) == null ? void 0 : b.bodyVariables) || {},
|
|
3602
|
+
buttonVariables: w
|
|
3603
3603
|
}
|
|
3604
3604
|
});
|
|
3605
3605
|
},
|
|
@@ -3608,16 +3608,16 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3608
3608
|
children: "×"
|
|
3609
3609
|
}
|
|
3610
3610
|
)
|
|
3611
|
-
] }, `sample-${
|
|
3611
|
+
] }, `sample-${v}`);
|
|
3612
3612
|
});
|
|
3613
3613
|
})() }),
|
|
3614
3614
|
/* @__PURE__ */ r("div", { className: "rsp-mt-4 rsp-p-3 rsp-bg-white rsp-rounded-lg rsp-border", children: [
|
|
3615
3615
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-700 rsp-mb-1", children: "Preview URL:" }),
|
|
3616
3616
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-600 rsp-font-mono rsp-break-all", children: m.value.replace(
|
|
3617
3617
|
/\{\{(\d+)\}\}/g,
|
|
3618
|
-
(t,
|
|
3619
|
-
var
|
|
3620
|
-
return ((
|
|
3618
|
+
(t, h) => {
|
|
3619
|
+
var v, V;
|
|
3620
|
+
return ((V = (v = a.sampleContent) == null ? void 0 : v.buttonVariables) == null ? void 0 : V[h]) || `[${t}]`;
|
|
3621
3621
|
}
|
|
3622
3622
|
) })
|
|
3623
3623
|
] }),
|
|
@@ -3625,7 +3625,7 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3625
3625
|
"button",
|
|
3626
3626
|
{
|
|
3627
3627
|
type: "button",
|
|
3628
|
-
onClick: () =>
|
|
3628
|
+
onClick: () => p(!1),
|
|
3629
3629
|
className: "rsp-px-3 rsp-py-1 rsp-text-xs rsp-text-gray-500 hover:rsp-text-gray-700",
|
|
3630
3630
|
children: "Close"
|
|
3631
3631
|
}
|
|
@@ -3637,7 +3637,7 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3637
3637
|
/* @__PURE__ */ e(
|
|
3638
3638
|
"button",
|
|
3639
3639
|
{
|
|
3640
|
-
onClick: () =>
|
|
3640
|
+
onClick: () => j(i),
|
|
3641
3641
|
disabled: !m.text.trim() || i !== "QUICK_REPLY" && !m.value.trim(),
|
|
3642
3642
|
className: "rsp-flex-1 rsp-bg-blue-600 rsp-text-white rsp-py-3 rsp-px-4 rsp-rounded-lg rsp-font-medium rsp-text-sm rsp-transition-colors hover:rsp-bg-blue-700 disabled:rsp-opacity-50 disabled:rsp-cursor-not-allowed rsp-shadow-sm",
|
|
3643
3643
|
children: "Add Button"
|
|
@@ -3646,7 +3646,7 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3646
3646
|
/* @__PURE__ */ e(
|
|
3647
3647
|
"button",
|
|
3648
3648
|
{
|
|
3649
|
-
onClick:
|
|
3649
|
+
onClick: y,
|
|
3650
3650
|
className: "rsp-px-4 rsp-py-3 rsp-text-gray-600 rsp-bg-white rsp-border rsp-border-gray-300 rsp-rounded-lg rsp-font-medium rsp-text-sm rsp-transition-colors hover:rsp-bg-gray-50 rsp-shadow-sm",
|
|
3651
3651
|
children: "Cancel"
|
|
3652
3652
|
}
|
|
@@ -3657,18 +3657,18 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3657
3657
|
a.buttons.length > 0 && /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
|
|
3658
3658
|
/* @__PURE__ */ e("h4", { className: "rsp-text-md rsp-font-semibold rsp-text-gray-900", children: "Added Buttons" }),
|
|
3659
3659
|
/* @__PURE__ */ e("div", { className: "rsp-space-y-3", children: a.buttons.map((t) => {
|
|
3660
|
-
const
|
|
3660
|
+
const h = o.find((V) => V.type === t.type), v = (h == null ? void 0 : h.icon) || le;
|
|
3661
3661
|
return /* @__PURE__ */ e("div", { className: "rsp-bg-white rsp-border rsp-border-gray-200 rsp-rounded-lg rsp-p-4 rsp-shadow-sm", children: /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-start rsp-gap-3", children: [
|
|
3662
|
-
/* @__PURE__ */ e("div", { className: "rsp-p-2 rsp-bg-gray-50 rsp-rounded-lg", children: /* @__PURE__ */ e(
|
|
3662
|
+
/* @__PURE__ */ e("div", { className: "rsp-p-2 rsp-bg-gray-50 rsp-rounded-lg", children: /* @__PURE__ */ e(v, { className: "rsp-w-4 rsp-h-4 rsp-text-gray-600" }) }),
|
|
3663
3663
|
/* @__PURE__ */ r("div", { className: "rsp-flex-1 rsp-space-y-3", children: [
|
|
3664
3664
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between", children: [
|
|
3665
3665
|
/* @__PURE__ */ e("span", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-500 rsp-uppercase rsp-tracking-wider", children: t.type.replace("_", " ") }),
|
|
3666
3666
|
/* @__PURE__ */ e(
|
|
3667
3667
|
"button",
|
|
3668
3668
|
{
|
|
3669
|
-
onClick: () =>
|
|
3669
|
+
onClick: () => U(t.id),
|
|
3670
3670
|
className: "rsp-p-1 rsp-text-red-400 hover:rsp-text-red-600 hover:rsp-bg-red-50 rsp-rounded rsp-transition-colors",
|
|
3671
|
-
children: /* @__PURE__ */ e(
|
|
3671
|
+
children: /* @__PURE__ */ e(ee, { className: "rsp-w-4 rsp-h-4" })
|
|
3672
3672
|
}
|
|
3673
3673
|
)
|
|
3674
3674
|
] }),
|
|
@@ -3681,7 +3681,7 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3681
3681
|
{
|
|
3682
3682
|
type: "text",
|
|
3683
3683
|
value: t.text,
|
|
3684
|
-
onChange: (
|
|
3684
|
+
onChange: (V) => k(t.id, "text", V.target.value),
|
|
3685
3685
|
maxLength: 25,
|
|
3686
3686
|
className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-ring-1 focus:rsp-ring-blue-500 focus:rsp-border-blue-500"
|
|
3687
3687
|
}
|
|
@@ -3700,7 +3700,7 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3700
3700
|
{
|
|
3701
3701
|
type: t.type === "CALL" ? "tel" : t.type === "URL" ? "url" : "text",
|
|
3702
3702
|
value: t.value || "",
|
|
3703
|
-
onChange: (
|
|
3703
|
+
onChange: (V) => k(t.id, "value", V.target.value),
|
|
3704
3704
|
maxLength: t.type === "URL" ? 2e3 : 20,
|
|
3705
3705
|
className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-ring-1 focus:rsp-ring-blue-500 focus:rsp-border-blue-500"
|
|
3706
3706
|
}
|
|
@@ -3718,14 +3718,14 @@ function aa({ template: a, setTemplate: n }) {
|
|
|
3718
3718
|
}) })
|
|
3719
3719
|
] }),
|
|
3720
3720
|
a.buttons.length === 0 && !i && /* @__PURE__ */ r("div", { className: "rsp-text-center rsp-py-12 rsp-bg-gray-50 rsp-rounded-xl rsp-border-2 rsp-border-dashed rsp-border-gray-300", children: [
|
|
3721
|
-
/* @__PURE__ */ e("div", { className: "rsp-w-16 rsp-h-16 rsp-bg-white rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-mx-auto rsp-mb-4 rsp-shadow-sm", children: /* @__PURE__ */ e(
|
|
3721
|
+
/* @__PURE__ */ e("div", { className: "rsp-w-16 rsp-h-16 rsp-bg-white rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-mx-auto rsp-mb-4 rsp-shadow-sm", children: /* @__PURE__ */ e(le, { className: "rsp-w-8 rsp-h-8 rsp-text-gray-400" }) }),
|
|
3722
3722
|
/* @__PURE__ */ e("h3", { className: "rsp-text-lg rsp-font-medium rsp-text-gray-900 rsp-mb-2", children: "No buttons added yet" }),
|
|
3723
3723
|
/* @__PURE__ */ e("p", { className: "rsp-text-gray-500 rsp-text-sm rsp-mb-4", children: "Add interactive buttons to make your message more engaging" }),
|
|
3724
3724
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-400", children: "Choose from Quick Reply, Web URL, Call, or Flow buttons above" })
|
|
3725
3725
|
] })
|
|
3726
3726
|
] });
|
|
3727
3727
|
}
|
|
3728
|
-
const
|
|
3728
|
+
const la = async (a) => {
|
|
3729
3729
|
try {
|
|
3730
3730
|
if (!a)
|
|
3731
3731
|
throw new Error("No file provided");
|
|
@@ -3741,16 +3741,16 @@ const ra = async (a) => {
|
|
|
3741
3741
|
console.log("Upload response status:", l.status), console.log("Upload response headers:", Object.fromEntries(l.headers.entries()));
|
|
3742
3742
|
const d = await l.text();
|
|
3743
3743
|
console.log("Raw upload response:", d);
|
|
3744
|
-
let
|
|
3744
|
+
let p;
|
|
3745
3745
|
try {
|
|
3746
|
-
|
|
3746
|
+
p = JSON.parse(d);
|
|
3747
3747
|
} catch (m) {
|
|
3748
3748
|
throw console.error("Failed to parse upload response:", m), new Error("Invalid response from upload server");
|
|
3749
3749
|
}
|
|
3750
|
-
if (console.log("Parsed upload response:",
|
|
3751
|
-
throw new Error(
|
|
3752
|
-
if (
|
|
3753
|
-
const m =
|
|
3750
|
+
if (console.log("Parsed upload response:", p), console.log("Upload status:", p.status), console.log("Upload message:", p.message), console.log("Upload data:", p.data), !p.status)
|
|
3751
|
+
throw new Error(p.message || "Upload failed");
|
|
3752
|
+
if (p.data && Array.isArray(p.data) && p.data.length > 0) {
|
|
3753
|
+
const m = p.data[0];
|
|
3754
3754
|
if (m.url)
|
|
3755
3755
|
return console.log("File uploaded successfully:", {
|
|
3756
3756
|
url: m.url,
|
|
@@ -3764,7 +3764,7 @@ const ra = async (a) => {
|
|
|
3764
3764
|
} catch (n) {
|
|
3765
3765
|
throw console.error("File upload error:", n), n instanceof Error ? n : new Error("Unknown error occurred during file upload");
|
|
3766
3766
|
}
|
|
3767
|
-
},
|
|
3767
|
+
}, ia = (a, n) => {
|
|
3768
3768
|
const l = a.name.toLowerCase().split(".").pop();
|
|
3769
3769
|
switch (n) {
|
|
3770
3770
|
case "IMAGE":
|
|
@@ -3776,7 +3776,7 @@ const ra = async (a) => {
|
|
|
3776
3776
|
default:
|
|
3777
3777
|
return !1;
|
|
3778
3778
|
}
|
|
3779
|
-
},
|
|
3779
|
+
}, ta = (a) => {
|
|
3780
3780
|
switch (a) {
|
|
3781
3781
|
case "IMAGE":
|
|
3782
3782
|
return 5 * 1024 * 1024;
|
|
@@ -3788,116 +3788,119 @@ const ra = async (a) => {
|
|
|
3788
3788
|
return 10 * 1024 * 1024;
|
|
3789
3789
|
}
|
|
3790
3790
|
};
|
|
3791
|
-
function
|
|
3792
|
-
var
|
|
3793
|
-
const [l, d] =
|
|
3794
|
-
var
|
|
3791
|
+
function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
3792
|
+
var R, I, x, w, L;
|
|
3793
|
+
const [l, d] = K.useState({}), [, p] = K.useState({}), [m, C] = K.useState(!1), [g, f] = K.useState(null), y = K.useRef({}), j = () => {
|
|
3794
|
+
var b;
|
|
3795
3795
|
const s = {
|
|
3796
3796
|
id: Math.random().toString(36).substr(2, 9),
|
|
3797
3797
|
headerType: "MEDIA",
|
|
3798
|
-
mediaType: ((
|
|
3798
|
+
mediaType: ((b = a.carousel) == null ? void 0 : b.type) === "VIDEO" ? "VIDEO" : "IMAGE",
|
|
3799
3799
|
body: "",
|
|
3800
3800
|
buttons: []
|
|
3801
3801
|
};
|
|
3802
|
-
n((
|
|
3803
|
-
var
|
|
3802
|
+
n((E) => {
|
|
3803
|
+
var T, c;
|
|
3804
3804
|
return {
|
|
3805
|
-
...
|
|
3805
|
+
...E,
|
|
3806
3806
|
carousel: {
|
|
3807
|
-
type: ((
|
|
3808
|
-
cards: [...((
|
|
3807
|
+
type: ((T = a.carousel) == null ? void 0 : T.type) || "IMAGE",
|
|
3808
|
+
cards: [...((c = a.carousel) == null ? void 0 : c.cards) || [], s]
|
|
3809
3809
|
}
|
|
3810
3810
|
};
|
|
3811
3811
|
});
|
|
3812
|
-
},
|
|
3813
|
-
n((
|
|
3814
|
-
...
|
|
3812
|
+
}, U = (s) => {
|
|
3813
|
+
n((b) => ({
|
|
3814
|
+
...b,
|
|
3815
3815
|
carousel: {
|
|
3816
|
-
...
|
|
3817
|
-
cards:
|
|
3816
|
+
...b.carousel,
|
|
3817
|
+
cards: b.carousel.cards.filter((E) => E.id !== s)
|
|
3818
3818
|
}
|
|
3819
3819
|
}));
|
|
3820
|
-
},
|
|
3821
|
-
n((
|
|
3822
|
-
...
|
|
3820
|
+
}, k = (s, b, E) => {
|
|
3821
|
+
n((T) => ({
|
|
3822
|
+
...T,
|
|
3823
3823
|
carousel: {
|
|
3824
|
-
...
|
|
3825
|
-
cards:
|
|
3826
|
-
(
|
|
3824
|
+
...T.carousel,
|
|
3825
|
+
cards: T.carousel.cards.map(
|
|
3826
|
+
(c) => c.id === s ? { ...c, [b]: E } : c
|
|
3827
3827
|
)
|
|
3828
3828
|
}
|
|
3829
3829
|
}));
|
|
3830
|
-
},
|
|
3831
|
-
var
|
|
3832
|
-
const
|
|
3833
|
-
if (!
|
|
3834
|
-
const
|
|
3835
|
-
|
|
3836
|
-
},
|
|
3837
|
-
var
|
|
3838
|
-
if (!
|
|
3839
|
-
const
|
|
3840
|
-
if (!
|
|
3841
|
-
const
|
|
3842
|
-
g
|
|
3843
|
-
const
|
|
3844
|
-
if (
|
|
3845
|
-
const
|
|
3846
|
-
|
|
3830
|
+
}, N = (s, b) => {
|
|
3831
|
+
var $;
|
|
3832
|
+
const E = ($ = a.carousel) == null ? void 0 : $.cards.find((X) => X.id === s);
|
|
3833
|
+
if (!E) return;
|
|
3834
|
+
const M = `{{${u(s) + 1}}}`, O = E[b] + M;
|
|
3835
|
+
k(s, b, O);
|
|
3836
|
+
}, o = (s) => {
|
|
3837
|
+
var O;
|
|
3838
|
+
if (!g) return;
|
|
3839
|
+
const b = y.current[g], E = (O = a.carousel) == null ? void 0 : O.cards.find(($) => $.id === g);
|
|
3840
|
+
if (!E) return;
|
|
3841
|
+
const T = b && typeof b.selectionStart == "number" ? b.selectionStart : E.body.length, c = E.body.substring(0, T), M = E.body.substring(T), A = c + s + M;
|
|
3842
|
+
k(g, "body", A), setTimeout(() => {
|
|
3843
|
+
const $ = y.current[g];
|
|
3844
|
+
if ($) {
|
|
3845
|
+
const X = T + s.length;
|
|
3846
|
+
$.setSelectionRange(X, X), $.focus();
|
|
3847
3847
|
}
|
|
3848
|
-
}, 0),
|
|
3849
|
-
},
|
|
3850
|
-
var
|
|
3851
|
-
const
|
|
3852
|
-
if (!
|
|
3853
|
-
const
|
|
3854
|
-
if (!
|
|
3855
|
-
const
|
|
3856
|
-
const
|
|
3857
|
-
return
|
|
3848
|
+
}, 0), C(!1);
|
|
3849
|
+
}, u = (s) => {
|
|
3850
|
+
var M;
|
|
3851
|
+
const b = (M = a.carousel) == null ? void 0 : M.cards.find((A) => A.id === s);
|
|
3852
|
+
if (!b) return 0;
|
|
3853
|
+
const T = (b.body || "").match(/\{\{(\d+)\}\}/g);
|
|
3854
|
+
if (!T) return 0;
|
|
3855
|
+
const c = T.map((A) => {
|
|
3856
|
+
const O = A.match(/{{(\d+)}}/);
|
|
3857
|
+
return O ? parseInt(O[1], 10) : 0;
|
|
3858
3858
|
});
|
|
3859
|
-
return
|
|
3860
|
-
},
|
|
3861
|
-
var
|
|
3862
|
-
const
|
|
3863
|
-
if (!
|
|
3864
|
-
const
|
|
3859
|
+
return c.length > 0 ? Math.max(...c) : 0;
|
|
3860
|
+
}, t = (s, b) => {
|
|
3861
|
+
var c;
|
|
3862
|
+
const E = (c = a.carousel) == null ? void 0 : c.cards.find((M) => M.id === s);
|
|
3863
|
+
if (!E || E.buttons.length >= 2) return;
|
|
3864
|
+
const T = {
|
|
3865
3865
|
id: Math.random().toString(36).substr(2, 9),
|
|
3866
|
-
type:
|
|
3866
|
+
type: b,
|
|
3867
3867
|
text: "",
|
|
3868
3868
|
value: "",
|
|
3869
3869
|
urlType: "static"
|
|
3870
3870
|
};
|
|
3871
|
-
|
|
3872
|
-
},
|
|
3873
|
-
var
|
|
3874
|
-
const
|
|
3875
|
-
if (!
|
|
3876
|
-
const
|
|
3877
|
-
(
|
|
3871
|
+
k(s, "buttons", [...E.buttons, T]);
|
|
3872
|
+
}, h = (s, b, E, T) => {
|
|
3873
|
+
var A;
|
|
3874
|
+
const c = (A = a.carousel) == null ? void 0 : A.cards.find((O) => O.id === s);
|
|
3875
|
+
if (!c) return;
|
|
3876
|
+
const M = c.buttons.map(
|
|
3877
|
+
(O) => O.id === b ? { ...O, [E]: T } : O
|
|
3878
3878
|
);
|
|
3879
|
-
|
|
3880
|
-
},
|
|
3881
|
-
var
|
|
3882
|
-
const
|
|
3883
|
-
if (!
|
|
3884
|
-
const
|
|
3885
|
-
|
|
3886
|
-
},
|
|
3887
|
-
var
|
|
3879
|
+
k(s, "buttons", M);
|
|
3880
|
+
}, v = (s, b) => {
|
|
3881
|
+
var c;
|
|
3882
|
+
const E = (c = a.carousel) == null ? void 0 : c.cards.find((M) => M.id === s);
|
|
3883
|
+
if (!E) return;
|
|
3884
|
+
const T = E.buttons.filter((M) => M.id !== b);
|
|
3885
|
+
k(s, "buttons", T);
|
|
3886
|
+
}, V = async (s, b) => {
|
|
3887
|
+
var E;
|
|
3888
3888
|
try {
|
|
3889
|
-
|
|
3890
|
-
|
|
3891
|
-
|
|
3892
|
-
|
|
3893
|
-
|
|
3894
|
-
|
|
3895
|
-
|
|
3889
|
+
d((A) => ({ ...A, [s]: !0 })), p((A) => ({ ...A, [s]: !1 }));
|
|
3890
|
+
const T = ((E = a.carousel) == null ? void 0 : E.type) === "VIDEO" ? "VIDEO" : "IMAGE";
|
|
3891
|
+
if (!ia(b, T))
|
|
3892
|
+
throw new Error(`Invalid file type. Expected ${T.toLowerCase()} file.`);
|
|
3893
|
+
const c = ta(T);
|
|
3894
|
+
if (b.size > c) {
|
|
3895
|
+
const A = c / 1048576;
|
|
3896
|
+
throw new Error(`File size too large. Maximum allowed size is ${A}MB.`);
|
|
3896
3897
|
}
|
|
3897
|
-
const
|
|
3898
|
-
|
|
3899
|
-
} catch (
|
|
3900
|
-
console.error("File upload failed:",
|
|
3898
|
+
const M = await i(b);
|
|
3899
|
+
k(s, "mediaUrl", M);
|
|
3900
|
+
} catch (T) {
|
|
3901
|
+
console.error("File upload failed:", T), alert(T instanceof Error ? T.message : "File upload failed");
|
|
3902
|
+
} finally {
|
|
3903
|
+
d((T) => ({ ...T, [s]: !1 }));
|
|
3901
3904
|
}
|
|
3902
3905
|
};
|
|
3903
3906
|
return /* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
|
|
@@ -3906,17 +3909,17 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
3906
3909
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-4", children: [
|
|
3907
3910
|
/* @__PURE__ */ r("span", { className: "rsp-text-sm rsp-text-gray-500", children: [
|
|
3908
3911
|
"Total Cards: ",
|
|
3909
|
-
((
|
|
3912
|
+
((R = a.carousel) == null ? void 0 : R.cards.length) || 0,
|
|
3910
3913
|
"/10"
|
|
3911
3914
|
] }),
|
|
3912
3915
|
/* @__PURE__ */ r(
|
|
3913
3916
|
"button",
|
|
3914
3917
|
{
|
|
3915
|
-
onClick:
|
|
3916
|
-
disabled: (((
|
|
3918
|
+
onClick: j,
|
|
3919
|
+
disabled: (((I = a.carousel) == null ? void 0 : I.cards.length) || 0) >= 10,
|
|
3917
3920
|
className: "rsp-px-4 rsp-py-2 rsp-bg-blue-600 rsp-text-white rsp-rounded-md hover:rsp-bg-blue-700 disabled:rsp-bg-gray-400 disabled:rsp-cursor-not-allowed rsp-text-sm rsp-font-medium",
|
|
3918
3921
|
children: [
|
|
3919
|
-
/* @__PURE__ */ e(
|
|
3922
|
+
/* @__PURE__ */ e(de, { className: "rsp-w-4 rsp-h-4 rsp-inline rsp-mr-2" }),
|
|
3920
3923
|
"Add Card"
|
|
3921
3924
|
]
|
|
3922
3925
|
}
|
|
@@ -3933,14 +3936,14 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
3933
3936
|
type: "radio",
|
|
3934
3937
|
name: "carouselType",
|
|
3935
3938
|
value: "IMAGE",
|
|
3936
|
-
checked: ((
|
|
3937
|
-
onChange: (s) => n((
|
|
3938
|
-
var
|
|
3939
|
+
checked: ((x = a.carousel) == null ? void 0 : x.type) === "IMAGE",
|
|
3940
|
+
onChange: (s) => n((b) => {
|
|
3941
|
+
var E;
|
|
3939
3942
|
return {
|
|
3940
|
-
...
|
|
3943
|
+
...b,
|
|
3941
3944
|
carousel: {
|
|
3942
3945
|
type: s.target.value,
|
|
3943
|
-
cards: ((
|
|
3946
|
+
cards: ((E = b.carousel) == null ? void 0 : E.cards) || []
|
|
3944
3947
|
}
|
|
3945
3948
|
};
|
|
3946
3949
|
}),
|
|
@@ -3956,14 +3959,14 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
3956
3959
|
type: "radio",
|
|
3957
3960
|
name: "carouselType",
|
|
3958
3961
|
value: "VIDEO",
|
|
3959
|
-
checked: ((
|
|
3960
|
-
onChange: (s) => n((
|
|
3961
|
-
var
|
|
3962
|
+
checked: ((w = a.carousel) == null ? void 0 : w.type) === "VIDEO",
|
|
3963
|
+
onChange: (s) => n((b) => {
|
|
3964
|
+
var E;
|
|
3962
3965
|
return {
|
|
3963
|
-
...
|
|
3966
|
+
...b,
|
|
3964
3967
|
carousel: {
|
|
3965
3968
|
type: s.target.value,
|
|
3966
|
-
cards: ((
|
|
3969
|
+
cards: ((E = b.carousel) == null ? void 0 : E.cards) || []
|
|
3967
3970
|
}
|
|
3968
3971
|
};
|
|
3969
3972
|
}),
|
|
@@ -3974,90 +3977,105 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
3974
3977
|
] })
|
|
3975
3978
|
] })
|
|
3976
3979
|
] }),
|
|
3977
|
-
/* @__PURE__ */ e("div", { className: "rsp-space-y-6", children: (
|
|
3978
|
-
var
|
|
3980
|
+
/* @__PURE__ */ e("div", { className: "rsp-space-y-6", children: (L = a.carousel) == null ? void 0 : L.cards.map((s, b) => {
|
|
3981
|
+
var E, T, c, M, A, O, $, X;
|
|
3979
3982
|
return /* @__PURE__ */ r("div", { className: "rsp-bg-white rsp-rounded-xl rsp-border-2 rsp-border-gray-200 rsp-overflow-hidden rsp-shadow-lg rsp-transition-all hover:rsp-shadow-xl hover:rsp-border-blue-300", children: [
|
|
3980
3983
|
/* @__PURE__ */ r("div", { className: "rsp-bg-gradient-to-r rsp-from-blue-50 rsp-to-blue-100 rsp-px-5 rsp-py-3 rsp-flex rsp-items-center rsp-justify-between rsp-border-b rsp-border-gray-200", children: [
|
|
3981
3984
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-3", children: [
|
|
3982
|
-
/* @__PURE__ */ e("div", { className: "rsp-w-8 rsp-h-8 rsp-bg-blue-500 rsp-text-white rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-font-bold rsp-text-sm rsp-shadow-md", children:
|
|
3985
|
+
/* @__PURE__ */ e("div", { className: "rsp-w-8 rsp-h-8 rsp-bg-blue-500 rsp-text-white rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-font-bold rsp-text-sm rsp-shadow-md", children: b + 1 }),
|
|
3983
3986
|
/* @__PURE__ */ r("h4", { className: "rsp-text-base rsp-font-semibold rsp-text-gray-800", children: [
|
|
3984
3987
|
"Card ",
|
|
3985
|
-
|
|
3988
|
+
b + 1
|
|
3986
3989
|
] })
|
|
3987
3990
|
] }),
|
|
3988
3991
|
/* @__PURE__ */ e(
|
|
3989
3992
|
"button",
|
|
3990
3993
|
{
|
|
3991
|
-
onClick: () =>
|
|
3994
|
+
onClick: () => U(s.id),
|
|
3992
3995
|
className: "rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-white hover:rsp-bg-red-500 rsp-rounded-full rsp-transition-colors",
|
|
3993
3996
|
title: "Remove Card",
|
|
3994
|
-
children: /* @__PURE__ */ e(
|
|
3997
|
+
children: /* @__PURE__ */ e(ee, { className: "rsp-w-4 rsp-h-4" })
|
|
3995
3998
|
}
|
|
3996
3999
|
)
|
|
3997
4000
|
] }),
|
|
3998
4001
|
/* @__PURE__ */ e("div", { className: "rsp-p-6", children: /* @__PURE__ */ r("div", { className: "rsp-grid rsp-grid-cols-1 lg:rsp-grid-cols-2 rsp-gap-6", children: [
|
|
3999
4002
|
/* @__PURE__ */ r("div", { children: [
|
|
4000
4003
|
/* @__PURE__ */ r("label", { className: "rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-mb-3 rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
4001
|
-
/* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: ((
|
|
4002
|
-
((
|
|
4004
|
+
/* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: ((E = a.carousel) == null ? void 0 : E.type) === "VIDEO" ? /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) : /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
|
|
4005
|
+
((T = a.carousel) == null ? void 0 : T.type) === "VIDEO" ? "Video" : "Image",
|
|
4003
4006
|
" Upload"
|
|
4004
4007
|
] }),
|
|
4005
|
-
/* @__PURE__ */
|
|
4006
|
-
|
|
4007
|
-
"
|
|
4008
|
-
|
|
4009
|
-
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
|
|
4027
|
-
|
|
4028
|
-
|
|
4029
|
-
|
|
4030
|
-
|
|
4031
|
-
|
|
4032
|
-
|
|
4033
|
-
|
|
4034
|
-
|
|
4035
|
-
{
|
|
4036
|
-
|
|
4037
|
-
|
|
4038
|
-
|
|
4039
|
-
|
|
4040
|
-
|
|
4041
|
-
|
|
4042
|
-
|
|
4043
|
-
|
|
4044
|
-
|
|
4045
|
-
|
|
4046
|
-
|
|
4047
|
-
|
|
4048
|
-
|
|
4049
|
-
|
|
4050
|
-
|
|
4051
|
-
|
|
4052
|
-
|
|
4053
|
-
|
|
4054
|
-
|
|
4055
|
-
|
|
4056
|
-
|
|
4057
|
-
|
|
4058
|
-
|
|
4059
|
-
|
|
4060
|
-
|
|
4008
|
+
/* @__PURE__ */ r("div", { className: "rsp-border-2 rsp-border-dashed rsp-border-blue-200 rsp-rounded-xl rsp-p-6 rsp-text-center rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-white rsp-transition-all hover:rsp-border-blue-400 hover:rsp-from-blue-100 rsp-relative", children: [
|
|
4009
|
+
s.mediaUrl ? /* @__PURE__ */ r("div", { className: "rsp-relative rsp-group", children: [
|
|
4010
|
+
((c = a.carousel) == null ? void 0 : c.type) === "IMAGE" ? /* @__PURE__ */ e(
|
|
4011
|
+
"img",
|
|
4012
|
+
{
|
|
4013
|
+
src: s.mediaUrl,
|
|
4014
|
+
alt: `Card ${b + 1}`,
|
|
4015
|
+
className: "rsp-w-full rsp-h-48 rsp-object-cover rsp-rounded-lg rsp-shadow-md",
|
|
4016
|
+
onLoad: () => p((S) => ({ ...S, [s.id]: !0 })),
|
|
4017
|
+
onError: () => p((S) => ({ ...S, [s.id]: !1 }))
|
|
4018
|
+
}
|
|
4019
|
+
) : /* @__PURE__ */ e(
|
|
4020
|
+
"video",
|
|
4021
|
+
{
|
|
4022
|
+
src: s.mediaUrl,
|
|
4023
|
+
className: "rsp-w-full rsp-h-48 rsp-object-cover rsp-rounded-lg rsp-shadow-md",
|
|
4024
|
+
controls: !0,
|
|
4025
|
+
onLoadedData: () => p((S) => ({ ...S, [s.id]: !0 })),
|
|
4026
|
+
onError: () => p((S) => ({ ...S, [s.id]: !1 }))
|
|
4027
|
+
}
|
|
4028
|
+
),
|
|
4029
|
+
/* @__PURE__ */ e(
|
|
4030
|
+
"button",
|
|
4031
|
+
{
|
|
4032
|
+
onClick: () => k(s.id, "mediaUrl", ""),
|
|
4033
|
+
className: "rsp-absolute rsp-top-2 rsp-right-2 rsp-p-2 rsp-bg-red-500 rsp-text-white rsp-rounded-full hover:rsp-bg-red-600 rsp-shadow-lg rsp-opacity-0 group-hover:rsp-opacity-100 rsp-transition-opacity",
|
|
4034
|
+
title: "Remove media",
|
|
4035
|
+
children: /* @__PURE__ */ e(ee, { className: "rsp-w-4 rsp-h-4" })
|
|
4036
|
+
}
|
|
4037
|
+
),
|
|
4038
|
+
/* @__PURE__ */ e("div", { className: "rsp-absolute rsp-bottom-2 rsp-left-2 rsp-bg-black rsp-bg-opacity-60 rsp-text-white rsp-text-xs rsp-px-2 rsp-py-1 rsp-rounded rsp-backdrop-blur-sm", children: ((M = a.carousel) == null ? void 0 : M.type) === "VIDEO" ? "📹 Video" : "🖼️ Image" })
|
|
4039
|
+
] }) : /* @__PURE__ */ r("div", { children: [
|
|
4040
|
+
/* @__PURE__ */ e("div", { className: "rsp-w-20 rsp-h-20 rsp-mx-auto rsp-mb-4 rsp-bg-gradient-to-br rsp-from-blue-100 rsp-to-blue-200 rsp-rounded-xl rsp-flex rsp-items-center rsp-justify-center rsp-shadow-md", children: /* @__PURE__ */ e("svg", { className: "rsp-w-10 rsp-h-10 rsp-text-blue-600", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: ((A = a.carousel) == null ? void 0 : A.type) === "VIDEO" ? /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) : /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }) }),
|
|
4041
|
+
/* @__PURE__ */ e(
|
|
4042
|
+
"input",
|
|
4043
|
+
{
|
|
4044
|
+
type: "file",
|
|
4045
|
+
accept: ((O = a.carousel) == null ? void 0 : O.type) === "VIDEO" ? "video/*" : "image/*",
|
|
4046
|
+
onChange: (S) => {
|
|
4047
|
+
var z;
|
|
4048
|
+
const ae = (z = S.target.files) == null ? void 0 : z[0];
|
|
4049
|
+
ae && !l[s.id] && V(s.id, ae);
|
|
4050
|
+
},
|
|
4051
|
+
className: "rsp-hidden",
|
|
4052
|
+
id: `file-upload-${s.id}`,
|
|
4053
|
+
disabled: !!l[s.id]
|
|
4054
|
+
}
|
|
4055
|
+
),
|
|
4056
|
+
/* @__PURE__ */ r(
|
|
4057
|
+
"label",
|
|
4058
|
+
{
|
|
4059
|
+
htmlFor: `file-upload-${s.id}`,
|
|
4060
|
+
className: `rsp-inline-flex rsp-items-center rsp-gap-2 rsp-px-5 rsp-py-2.5 rsp-border rsp-border-blue-300 rsp-rounded-lg rsp-shadow-sm rsp-text-sm rsp-font-semibold rsp-text-blue-600 rsp-bg-white rsp-transition-colors ${l[s.id] ? "rsp-opacity-50 rsp-cursor-not-allowed" : "hover:rsp-bg-blue-50 rsp-cursor-pointer"}`,
|
|
4061
|
+
"aria-disabled": !!l[s.id],
|
|
4062
|
+
children: [
|
|
4063
|
+
/* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M7 16a4 4 0 01-.88-7.903A5 5 0 1115.9 6L16 6a5 5 0 011 9.9M15 13l-3-3m0 0l-3 3m3-3v12" }) }),
|
|
4064
|
+
"Upload ",
|
|
4065
|
+
(($ = a.carousel) == null ? void 0 : $.type) === "VIDEO" ? "Video" : "Image"
|
|
4066
|
+
]
|
|
4067
|
+
}
|
|
4068
|
+
),
|
|
4069
|
+
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500 rsp-mt-3 rsp-px-2", children: ((X = a.carousel) == null ? void 0 : X.type) === "VIDEO" ? "📹 MP4, MOV, AVI (Max 16MB)" : "🖼️ PNG, JPG, GIF, TIFF, SVG, BMP (Max 5MB)" })
|
|
4070
|
+
] }),
|
|
4071
|
+
l[s.id] && /* @__PURE__ */ e("div", { className: "rsp-absolute rsp-inset-0 rsp-bg-black rsp-bg-opacity-30 rsp-flex rsp-items-center rsp-justify-center", children: /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2 rsp-bg-white rsp-px-3 rsp-py-2 rsp-rounded-md rsp-shadow", children: [
|
|
4072
|
+
/* @__PURE__ */ r("svg", { className: "rsp-w-4 rsp-h-4 rsp-animate-spin", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: [
|
|
4073
|
+
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10", strokeOpacity: "0.25", strokeWidth: "4" }),
|
|
4074
|
+
/* @__PURE__ */ e("path", { d: "M22 12a10 10 0 00-10-10", strokeWidth: "4" })
|
|
4075
|
+
] }),
|
|
4076
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-xs rsp-text-gray-700", children: "Uploading..." })
|
|
4077
|
+
] }) })
|
|
4078
|
+
] })
|
|
4061
4079
|
] }),
|
|
4062
4080
|
/* @__PURE__ */ r("div", { className: "rsp-space-y-5", children: [
|
|
4063
4081
|
/* @__PURE__ */ r("div", { children: [
|
|
@@ -4069,11 +4087,11 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4069
4087
|
/* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
|
|
4070
4088
|
"textarea",
|
|
4071
4089
|
{
|
|
4072
|
-
ref: (
|
|
4073
|
-
|
|
4090
|
+
ref: (S) => {
|
|
4091
|
+
y.current[s.id] = S;
|
|
4074
4092
|
},
|
|
4075
4093
|
value: s.body,
|
|
4076
|
-
onChange: (
|
|
4094
|
+
onChange: (S) => k(s.id, "body", S.target.value),
|
|
4077
4095
|
maxLength: 160,
|
|
4078
4096
|
rows: 4,
|
|
4079
4097
|
className: "rsp-w-full rsp-px-4 rsp-py-3 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-400 rsp-bg-white rsp-resize-none rsp-shadow-sm rsp-transition-colors",
|
|
@@ -4085,7 +4103,7 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4085
4103
|
/* @__PURE__ */ e(
|
|
4086
4104
|
"button",
|
|
4087
4105
|
{
|
|
4088
|
-
onClick: () =>
|
|
4106
|
+
onClick: () => N(s.id, "body"),
|
|
4089
4107
|
className: "rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",
|
|
4090
4108
|
title: "Add Variable",
|
|
4091
4109
|
children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M16 7a4 4 0 11-8 0 4 4 0 018 0zM12 14a7 7 0 00-7 7h14a7 7 0 00-7-7z" }) })
|
|
@@ -4095,11 +4113,11 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4095
4113
|
"button",
|
|
4096
4114
|
{
|
|
4097
4115
|
onClick: () => {
|
|
4098
|
-
|
|
4116
|
+
f(s.id), C(!0);
|
|
4099
4117
|
},
|
|
4100
4118
|
className: "rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",
|
|
4101
4119
|
title: "Add Emoji",
|
|
4102
|
-
children: /* @__PURE__ */ e(
|
|
4120
|
+
children: /* @__PURE__ */ e(xe, { className: "rsp-w-4 rsp-h-4" })
|
|
4103
4121
|
}
|
|
4104
4122
|
)
|
|
4105
4123
|
] }),
|
|
@@ -4109,11 +4127,11 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4109
4127
|
] })
|
|
4110
4128
|
] }),
|
|
4111
4129
|
(() => {
|
|
4112
|
-
const
|
|
4113
|
-
return
|
|
4130
|
+
const S = s.body.match(/\{\{(\d+)\}\}/g) || [], ae = [...new Set(S.map((z) => z.replace(/[{}]/g, "")))];
|
|
4131
|
+
return ae.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3 rsp-p-3 rsp-bg-blue-50 rsp-rounded-lg rsp-border rsp-border-blue-200", children: [
|
|
4114
4132
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-semibold rsp-text-blue-800 rsp-mb-2", children: "Sample Values for This Card" }),
|
|
4115
|
-
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-1 rsp-gap-2", children:
|
|
4116
|
-
var
|
|
4133
|
+
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-1 rsp-gap-2", children: ae.map((z) => {
|
|
4134
|
+
var Z, _;
|
|
4117
4135
|
return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
4118
4136
|
/* @__PURE__ */ r("label", { className: "rsp-text-xs rsp-text-gray-700 rsp-font-medium rsp-whitespace-nowrap", children: [
|
|
4119
4137
|
"{{",
|
|
@@ -4125,24 +4143,24 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4125
4143
|
"input",
|
|
4126
4144
|
{
|
|
4127
4145
|
type: "text",
|
|
4128
|
-
value: ((
|
|
4129
|
-
onChange: (
|
|
4130
|
-
const
|
|
4131
|
-
n((
|
|
4132
|
-
...
|
|
4146
|
+
value: ((_ = (Z = s.sampleContent) == null ? void 0 : Z.bodyVariables) == null ? void 0 : _[z]) || "",
|
|
4147
|
+
onChange: (Q) => {
|
|
4148
|
+
const W = Q.target.value;
|
|
4149
|
+
n((F) => ({
|
|
4150
|
+
...F,
|
|
4133
4151
|
carousel: {
|
|
4134
|
-
...
|
|
4135
|
-
cards:
|
|
4136
|
-
var
|
|
4152
|
+
...F.carousel,
|
|
4153
|
+
cards: F.carousel.cards.map((P) => {
|
|
4154
|
+
var D, q, Y;
|
|
4137
4155
|
return P.id !== s.id ? P : {
|
|
4138
4156
|
...P,
|
|
4139
4157
|
sampleContent: {
|
|
4140
|
-
headerVariables: ((
|
|
4158
|
+
headerVariables: ((D = P.sampleContent) == null ? void 0 : D.headerVariables) || {},
|
|
4141
4159
|
bodyVariables: {
|
|
4142
|
-
...((
|
|
4143
|
-
[z]:
|
|
4160
|
+
...((q = P.sampleContent) == null ? void 0 : q.bodyVariables) || {},
|
|
4161
|
+
[z]: W
|
|
4144
4162
|
},
|
|
4145
|
-
buttonVariables: ((
|
|
4163
|
+
buttonVariables: ((Y = P.sampleContent) == null ? void 0 : Y.buttonVariables) || {}
|
|
4146
4164
|
}
|
|
4147
4165
|
};
|
|
4148
4166
|
})
|
|
@@ -4158,22 +4176,22 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4158
4176
|
{
|
|
4159
4177
|
type: "button",
|
|
4160
4178
|
onClick: () => {
|
|
4161
|
-
const
|
|
4162
|
-
n((
|
|
4163
|
-
...
|
|
4179
|
+
const Q = new RegExp(`\\{\\{${z}\\}\\}`, "g"), W = (s.body || "").replace(Q, "");
|
|
4180
|
+
n((F) => ({
|
|
4181
|
+
...F,
|
|
4164
4182
|
carousel: {
|
|
4165
|
-
...
|
|
4166
|
-
cards:
|
|
4167
|
-
var
|
|
4183
|
+
...F.carousel,
|
|
4184
|
+
cards: F.carousel.cards.map((P) => {
|
|
4185
|
+
var D, q, Y;
|
|
4168
4186
|
if (P.id !== s.id) return P;
|
|
4169
|
-
const
|
|
4187
|
+
const G = Object.fromEntries(Object.entries(((D = P.sampleContent) == null ? void 0 : D.bodyVariables) || {}).filter(([re]) => re !== z));
|
|
4170
4188
|
return {
|
|
4171
4189
|
...P,
|
|
4172
|
-
body:
|
|
4190
|
+
body: W,
|
|
4173
4191
|
sampleContent: {
|
|
4174
|
-
headerVariables: ((
|
|
4175
|
-
bodyVariables:
|
|
4176
|
-
buttonVariables: ((
|
|
4192
|
+
headerVariables: ((q = P.sampleContent) == null ? void 0 : q.headerVariables) || {},
|
|
4193
|
+
bodyVariables: G,
|
|
4194
|
+
buttonVariables: ((Y = P.sampleContent) == null ? void 0 : Y.buttonVariables) || {}
|
|
4177
4195
|
}
|
|
4178
4196
|
};
|
|
4179
4197
|
})
|
|
@@ -4204,7 +4222,7 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4204
4222
|
/* @__PURE__ */ r(
|
|
4205
4223
|
"button",
|
|
4206
4224
|
{
|
|
4207
|
-
onClick: () =>
|
|
4225
|
+
onClick: () => t(s.id, "QUICK_REPLY"),
|
|
4208
4226
|
className: "rsp-flex rsp-flex-col rsp-items-center rsp-gap-2 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-font-medium rsp-text-gray-700 hover:rsp-border-blue-400 hover:rsp-bg-blue-50 rsp-transition-all rsp-shadow-sm",
|
|
4209
4227
|
children: [
|
|
4210
4228
|
/* @__PURE__ */ e("svg", { className: "rsp-w-6 rsp-h-6 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M8 12h.01M12 12h.01M16 12h.01M21 12c0 4.418-4.03 8-9 8a9.863 9.863 0 01-4.255-.949L3 20l1.395-3.72C3.512 15.042 3 13.574 3 12c0-4.418 4.03-8 9-8s9 3.582 9 8z" }) }),
|
|
@@ -4215,7 +4233,7 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4215
4233
|
/* @__PURE__ */ r(
|
|
4216
4234
|
"button",
|
|
4217
4235
|
{
|
|
4218
|
-
onClick: () =>
|
|
4236
|
+
onClick: () => t(s.id, "URL"),
|
|
4219
4237
|
className: "rsp-flex rsp-flex-col rsp-items-center rsp-gap-2 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-font-medium rsp-text-gray-700 hover:rsp-border-blue-400 hover:rsp-bg-blue-50 rsp-transition-all rsp-shadow-sm",
|
|
4220
4238
|
children: [
|
|
4221
4239
|
/* @__PURE__ */ e("svg", { className: "rsp-w-6 rsp-h-6 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }),
|
|
@@ -4226,7 +4244,7 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4226
4244
|
/* @__PURE__ */ r(
|
|
4227
4245
|
"button",
|
|
4228
4246
|
{
|
|
4229
|
-
onClick: () =>
|
|
4247
|
+
onClick: () => t(s.id, "PHONE_NUMBER"),
|
|
4230
4248
|
className: "rsp-flex rsp-flex-col rsp-items-center rsp-gap-2 rsp-px-3 rsp-py-4 rsp-border-2 rsp-border-gray-200 rsp-rounded-lg rsp-text-sm rsp-font-medium rsp-text-gray-700 hover:rsp-border-blue-400 hover:rsp-bg-blue-50 rsp-transition-all rsp-shadow-sm",
|
|
4231
4249
|
children: [
|
|
4232
4250
|
/* @__PURE__ */ e("svg", { className: "rsp-w-6 rsp-h-6 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" }) }),
|
|
@@ -4241,19 +4259,19 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4241
4259
|
/* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-green-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 12l2 2 4-4m6 2a9 9 0 11-18 0 9 9 0 0118 0z" }) }),
|
|
4242
4260
|
"Configured Buttons"
|
|
4243
4261
|
] }),
|
|
4244
|
-
s.buttons.map((
|
|
4262
|
+
s.buttons.map((S, ae) => /* @__PURE__ */ r("div", { className: "rsp-p-4 rsp-border-2 rsp-border-blue-200 rsp-rounded-lg rsp-bg-gradient-to-br rsp-from-blue-50 rsp-to-white rsp-shadow-sm", children: [
|
|
4245
4263
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-mb-3", children: [
|
|
4246
4264
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
4247
|
-
/* @__PURE__ */ e("div", { className: "rsp-w-6 rsp-h-6 rsp-bg-blue-500 rsp-text-white rsp-rounded rsp-flex rsp-items-center rsp-justify-center rsp-text-xs rsp-font-bold", children:
|
|
4248
|
-
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-semibold rsp-text-gray-800", children:
|
|
4265
|
+
/* @__PURE__ */ e("div", { className: "rsp-w-6 rsp-h-6 rsp-bg-blue-500 rsp-text-white rsp-rounded rsp-flex rsp-items-center rsp-justify-center rsp-text-xs rsp-font-bold", children: ae + 1 }),
|
|
4266
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-semibold rsp-text-gray-800", children: S.type === "QUICK_REPLY" ? "Quick Reply" : S.type === "URL" ? "Website" : "Phone" })
|
|
4249
4267
|
] }),
|
|
4250
4268
|
/* @__PURE__ */ e(
|
|
4251
4269
|
"button",
|
|
4252
4270
|
{
|
|
4253
|
-
onClick: () =>
|
|
4271
|
+
onClick: () => v(s.id, S.id),
|
|
4254
4272
|
className: "rsp-p-1 rsp-text-gray-400 hover:rsp-text-red-500 hover:rsp-bg-red-50 rsp-rounded rsp-transition-colors",
|
|
4255
4273
|
title: "Remove button",
|
|
4256
|
-
children: /* @__PURE__ */ e(
|
|
4274
|
+
children: /* @__PURE__ */ e(ee, { className: "rsp-w-4 rsp-h-4" })
|
|
4257
4275
|
}
|
|
4258
4276
|
)
|
|
4259
4277
|
] }),
|
|
@@ -4264,15 +4282,15 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4264
4282
|
"input",
|
|
4265
4283
|
{
|
|
4266
4284
|
type: "text",
|
|
4267
|
-
value:
|
|
4268
|
-
onChange: (z) =>
|
|
4269
|
-
placeholder: `Enter Button Text (Max ${
|
|
4270
|
-
maxLength:
|
|
4285
|
+
value: S.text,
|
|
4286
|
+
onChange: (z) => h(s.id, S.id, "text", z.target.value),
|
|
4287
|
+
placeholder: `Enter Button Text (Max ${S.type === "QUICK_REPLY" ? "25" : "20"} characters)`,
|
|
4288
|
+
maxLength: S.type === "QUICK_REPLY" ? 25 : 20,
|
|
4271
4289
|
className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white"
|
|
4272
4290
|
}
|
|
4273
4291
|
)
|
|
4274
4292
|
] }),
|
|
4275
|
-
|
|
4293
|
+
S.type === "URL" && /* @__PURE__ */ r("div", { className: "rsp-space-y-3", children: [
|
|
4276
4294
|
/* @__PURE__ */ r("div", { children: [
|
|
4277
4295
|
/* @__PURE__ */ e("label", { className: "rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2", children: "URL Type" }),
|
|
4278
4296
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-gap-4", children: [
|
|
@@ -4281,8 +4299,8 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4281
4299
|
"input",
|
|
4282
4300
|
{
|
|
4283
4301
|
type: "radio",
|
|
4284
|
-
checked:
|
|
4285
|
-
onChange: () =>
|
|
4302
|
+
checked: S.urlType !== "dynamic",
|
|
4303
|
+
onChange: () => h(s.id, S.id, "urlType", "static"),
|
|
4286
4304
|
className: "rsp-mr-2 rsp-text-blue-600"
|
|
4287
4305
|
}
|
|
4288
4306
|
),
|
|
@@ -4293,8 +4311,8 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4293
4311
|
"input",
|
|
4294
4312
|
{
|
|
4295
4313
|
type: "radio",
|
|
4296
|
-
checked:
|
|
4297
|
-
onChange: () =>
|
|
4314
|
+
checked: S.urlType === "dynamic",
|
|
4315
|
+
onChange: () => h(s.id, S.id, "urlType", "dynamic"),
|
|
4298
4316
|
className: "rsp-mr-2 rsp-text-blue-600"
|
|
4299
4317
|
}
|
|
4300
4318
|
),
|
|
@@ -4308,14 +4326,14 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4308
4326
|
"input",
|
|
4309
4327
|
{
|
|
4310
4328
|
type: "text",
|
|
4311
|
-
value:
|
|
4312
|
-
onChange: (z) =>
|
|
4313
|
-
placeholder:
|
|
4329
|
+
value: S.value || "",
|
|
4330
|
+
onChange: (z) => h(s.id, S.id, "value", z.target.value),
|
|
4331
|
+
placeholder: S.urlType === "dynamic" ? "https://example.com/order/{{1}}" : "https://example.com",
|
|
4314
4332
|
className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white"
|
|
4315
4333
|
}
|
|
4316
4334
|
)
|
|
4317
4335
|
] }),
|
|
4318
|
-
|
|
4336
|
+
S.urlType === "dynamic" && /* @__PURE__ */ r("div", { className: "rsp-space-y-2", children: [
|
|
4319
4337
|
/* @__PURE__ */ e("div", { className: "rsp-p-2 rsp-bg-blue-50 rsp-rounded rsp-border rsp-border-blue-200", children: /* @__PURE__ */ r("p", { className: "rsp-text-xs rsp-text-blue-700", children: [
|
|
4320
4338
|
/* @__PURE__ */ e("strong", { children: "Tip:" }),
|
|
4321
4339
|
" Use ",
|
|
@@ -4334,71 +4352,71 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4334
4352
|
{
|
|
4335
4353
|
type: "button",
|
|
4336
4354
|
onClick: () => {
|
|
4337
|
-
if (((
|
|
4338
|
-
const
|
|
4339
|
-
const
|
|
4340
|
-
return
|
|
4341
|
-
}),
|
|
4342
|
-
|
|
4355
|
+
if (((S.value || "").match(/\{\{(\d+)\}\}/g) || []).length >= 3) return;
|
|
4356
|
+
const _ = ((S.value || "").match(/\{\{(\d+)\}\}/g) || []).map((P) => {
|
|
4357
|
+
const G = P.match(/{{(\d+)}}/);
|
|
4358
|
+
return G ? parseInt(G[1], 10) : 0;
|
|
4359
|
+
}), W = (_.length > 0 ? Math.max(..._) : 0) + 1, F = (S.value || "") + `{{${W}}}`;
|
|
4360
|
+
h(s.id, S.id, "value", F);
|
|
4343
4361
|
},
|
|
4344
|
-
disabled: ((
|
|
4362
|
+
disabled: ((S.value || "").match(/\{\{(\d+)\}\}/g) || []).length >= 3,
|
|
4345
4363
|
className: "rsp-px-3 rsp-py-1.5 rsp-text-xs rsp-bg-blue-500 hover:rsp-bg-blue-600 rsp-text-white rsp-rounded disabled:rsp-bg-gray-300 disabled:rsp-cursor-not-allowed rsp-transition-colors",
|
|
4346
4364
|
children: "+ Add Variable"
|
|
4347
4365
|
}
|
|
4348
4366
|
),
|
|
4349
|
-
((
|
|
4367
|
+
((S.value || "").match(/\{\{(\d+)\}\}/g) || []).length >= 3 && /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500 rsp-mt-1", children: "Maximum 3 variables allowed" })
|
|
4350
4368
|
] }),
|
|
4351
4369
|
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
4352
4370
|
"button",
|
|
4353
4371
|
{
|
|
4354
4372
|
type: "button",
|
|
4355
4373
|
onClick: () => {
|
|
4356
|
-
const z =
|
|
4357
|
-
let
|
|
4358
|
-
for (; (
|
|
4359
|
-
|
|
4360
|
-
if (
|
|
4361
|
-
const
|
|
4362
|
-
|
|
4374
|
+
const z = S.value || "", Z = /\{\{\d+\}\}/g;
|
|
4375
|
+
let _ = -1, Q = "", W;
|
|
4376
|
+
for (; (W = Z.exec(z)) !== null; )
|
|
4377
|
+
_ = W.index, Q = W[0];
|
|
4378
|
+
if (_ === -1) return;
|
|
4379
|
+
const F = _, P = F + Q.length, G = z.slice(0, F) + z.slice(P);
|
|
4380
|
+
h(s.id, S.id, "value", G);
|
|
4363
4381
|
},
|
|
4364
4382
|
className: "rsp-mt-2 rsp-px-3 rsp-py-1.5 rsp-text-xs rsp-bg-red-500 hover:rsp-bg-red-600 rsp-text-white rsp-rounded rsp-transition-colors",
|
|
4365
4383
|
children: "Remove Last"
|
|
4366
4384
|
}
|
|
4367
4385
|
) }),
|
|
4368
4386
|
(() => {
|
|
4369
|
-
const z = (
|
|
4370
|
-
return
|
|
4387
|
+
const z = (S.value || "").match(/\{\{(\d+)\}\}/g) || [], Z = [...new Set(z.map((_) => _.replace(/[{}]/g, "")))];
|
|
4388
|
+
return Z.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-p-3 rsp-bg-gray-50 rsp-rounded-lg rsp-border rsp-border-gray-200", children: [
|
|
4371
4389
|
/* @__PURE__ */ e("h4", { className: "rsp-text-xs rsp-font-semibold rsp-text-gray-700 rsp-mb-2", children: "Sample Values for URL Variables" }),
|
|
4372
|
-
/* @__PURE__ */ e("div", { className: "rsp-space-y-2", children:
|
|
4373
|
-
var
|
|
4390
|
+
/* @__PURE__ */ e("div", { className: "rsp-space-y-2", children: Z.map((_) => {
|
|
4391
|
+
var Q, W;
|
|
4374
4392
|
return /* @__PURE__ */ r("div", { className: "rsp-space-y-1", children: [
|
|
4375
4393
|
/* @__PURE__ */ r("label", { className: "rsp-block rsp-text-xs rsp-text-gray-600 rsp-mb-1", children: [
|
|
4376
4394
|
"Variable ",
|
|
4377
4395
|
"{{",
|
|
4378
|
-
|
|
4396
|
+
_,
|
|
4379
4397
|
"}}"
|
|
4380
4398
|
] }),
|
|
4381
4399
|
/* @__PURE__ */ e(
|
|
4382
4400
|
"input",
|
|
4383
4401
|
{
|
|
4384
4402
|
type: "text",
|
|
4385
|
-
value: ((
|
|
4386
|
-
onChange: (
|
|
4387
|
-
const P =
|
|
4388
|
-
n((
|
|
4389
|
-
...
|
|
4403
|
+
value: ((W = (Q = s.sampleContent) == null ? void 0 : Q.buttonVariables) == null ? void 0 : W[_]) || "",
|
|
4404
|
+
onChange: (F) => {
|
|
4405
|
+
const P = F.target.value;
|
|
4406
|
+
n((G) => ({
|
|
4407
|
+
...G,
|
|
4390
4408
|
carousel: {
|
|
4391
|
-
...
|
|
4392
|
-
cards:
|
|
4393
|
-
var
|
|
4394
|
-
return
|
|
4395
|
-
...
|
|
4409
|
+
...G.carousel,
|
|
4410
|
+
cards: G.carousel.cards.map((D) => {
|
|
4411
|
+
var q, Y, re;
|
|
4412
|
+
return D.id !== s.id ? D : {
|
|
4413
|
+
...D,
|
|
4396
4414
|
sampleContent: {
|
|
4397
|
-
headerVariables: ((
|
|
4398
|
-
bodyVariables: ((
|
|
4415
|
+
headerVariables: ((q = D.sampleContent) == null ? void 0 : q.headerVariables) || {},
|
|
4416
|
+
bodyVariables: ((Y = D.sampleContent) == null ? void 0 : Y.bodyVariables) || {},
|
|
4399
4417
|
buttonVariables: {
|
|
4400
|
-
...((
|
|
4401
|
-
[
|
|
4418
|
+
...((re = D.sampleContent) == null ? void 0 : re.buttonVariables) || {},
|
|
4419
|
+
[_]: P
|
|
4402
4420
|
}
|
|
4403
4421
|
}
|
|
4404
4422
|
};
|
|
@@ -4407,7 +4425,7 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4407
4425
|
}));
|
|
4408
4426
|
},
|
|
4409
4427
|
className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-ring-1 focus:rsp-ring-blue-500 focus:rsp-border-blue-500 rsp-bg-white",
|
|
4410
|
-
placeholder: `Sample value (e.g., ${
|
|
4428
|
+
placeholder: `Sample value (e.g., ${_ === "1" ? "order123" : "user456"})`
|
|
4411
4429
|
}
|
|
4412
4430
|
),
|
|
4413
4431
|
/* @__PURE__ */ e(
|
|
@@ -4415,21 +4433,21 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4415
4433
|
{
|
|
4416
4434
|
type: "button",
|
|
4417
4435
|
onClick: () => {
|
|
4418
|
-
const
|
|
4419
|
-
|
|
4420
|
-
...
|
|
4436
|
+
const F = S.value || "", P = new RegExp(`\\{\\{${_}\\}\\}`, "g"), G = F.replace(P, "");
|
|
4437
|
+
h(s.id, S.id, "value", G), n((D) => ({
|
|
4438
|
+
...D,
|
|
4421
4439
|
carousel: {
|
|
4422
|
-
...
|
|
4423
|
-
cards:
|
|
4424
|
-
var
|
|
4425
|
-
if (
|
|
4426
|
-
const
|
|
4440
|
+
...D.carousel,
|
|
4441
|
+
cards: D.carousel.cards.map((q) => {
|
|
4442
|
+
var re, he, ue;
|
|
4443
|
+
if (q.id !== s.id) return q;
|
|
4444
|
+
const Y = Object.fromEntries(Object.entries(((re = q.sampleContent) == null ? void 0 : re.buttonVariables) || {}).filter(([Ee]) => Ee !== _));
|
|
4427
4445
|
return {
|
|
4428
|
-
...
|
|
4446
|
+
...q,
|
|
4429
4447
|
sampleContent: {
|
|
4430
|
-
headerVariables: ((
|
|
4431
|
-
bodyVariables: ((
|
|
4432
|
-
buttonVariables:
|
|
4448
|
+
headerVariables: ((he = q.sampleContent) == null ? void 0 : he.headerVariables) || {},
|
|
4449
|
+
bodyVariables: ((ue = q.sampleContent) == null ? void 0 : ue.bodyVariables) || {},
|
|
4450
|
+
buttonVariables: Y
|
|
4433
4451
|
}
|
|
4434
4452
|
};
|
|
4435
4453
|
})
|
|
@@ -4441,27 +4459,27 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4441
4459
|
children: "×"
|
|
4442
4460
|
}
|
|
4443
4461
|
)
|
|
4444
|
-
] }, `button-${
|
|
4462
|
+
] }, `button-${S.id}-sample-${_}`);
|
|
4445
4463
|
}) })
|
|
4446
4464
|
] });
|
|
4447
4465
|
})()
|
|
4448
4466
|
] })
|
|
4449
4467
|
] }),
|
|
4450
|
-
|
|
4468
|
+
S.type === "PHONE_NUMBER" && /* @__PURE__ */ r("div", { children: [
|
|
4451
4469
|
/* @__PURE__ */ e("label", { className: "rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-1", children: "Phone Number" }),
|
|
4452
4470
|
/* @__PURE__ */ e(
|
|
4453
4471
|
"input",
|
|
4454
4472
|
{
|
|
4455
4473
|
type: "text",
|
|
4456
|
-
value:
|
|
4457
|
-
onChange: (z) =>
|
|
4474
|
+
value: S.value || "",
|
|
4475
|
+
onChange: (z) => h(s.id, S.id, "value", z.target.value),
|
|
4458
4476
|
placeholder: "+1234567890",
|
|
4459
4477
|
className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white"
|
|
4460
4478
|
}
|
|
4461
4479
|
)
|
|
4462
4480
|
] })
|
|
4463
4481
|
] })
|
|
4464
|
-
] },
|
|
4482
|
+
] }, S.id))
|
|
4465
4483
|
] })
|
|
4466
4484
|
] })
|
|
4467
4485
|
] }) })
|
|
@@ -4482,43 +4500,43 @@ function la({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4482
4500
|
] })
|
|
4483
4501
|
] }) }),
|
|
4484
4502
|
/* @__PURE__ */ e(
|
|
4485
|
-
|
|
4503
|
+
fe,
|
|
4486
4504
|
{
|
|
4487
|
-
isOpen:
|
|
4488
|
-
onClose: () =>
|
|
4489
|
-
onSelect:
|
|
4505
|
+
isOpen: m,
|
|
4506
|
+
onClose: () => C(!1),
|
|
4507
|
+
onSelect: o
|
|
4490
4508
|
}
|
|
4491
4509
|
)
|
|
4492
4510
|
] });
|
|
4493
4511
|
}
|
|
4494
|
-
const
|
|
4512
|
+
const ve = async (a) => {
|
|
4495
4513
|
try {
|
|
4496
4514
|
console.log(`Starting file upload: ${a.name}`);
|
|
4497
|
-
const n = await
|
|
4515
|
+
const n = await la(a);
|
|
4498
4516
|
return console.log(`File uploaded successfully: ${n}`), n;
|
|
4499
4517
|
} catch (n) {
|
|
4500
4518
|
throw console.error("Upload failed in parent:", n), n;
|
|
4501
4519
|
}
|
|
4502
|
-
},
|
|
4520
|
+
}, ca = (a) => {
|
|
4503
4521
|
const i = (a.body || "").match(/\{\{(\d+)\}\}/g);
|
|
4504
4522
|
if (!i) return 0;
|
|
4505
4523
|
const l = i.map((d) => {
|
|
4506
|
-
const
|
|
4507
|
-
return
|
|
4524
|
+
const p = d.match(/{{(\d+)}}/);
|
|
4525
|
+
return p ? parseInt(p[1], 10) : 0;
|
|
4508
4526
|
});
|
|
4509
4527
|
return l.length > 0 ? Math.max(...l) : 0;
|
|
4510
4528
|
};
|
|
4511
|
-
function
|
|
4512
|
-
const [i, l] =
|
|
4529
|
+
function da({ template: a, setTemplate: n }) {
|
|
4530
|
+
const [i, l] = K.useState(!1), d = K.useRef(null), p = () => {
|
|
4513
4531
|
l(!0), setTimeout(() => {
|
|
4514
4532
|
d.current && d.current.focus();
|
|
4515
4533
|
}, 0);
|
|
4516
|
-
}, m = (
|
|
4517
|
-
const
|
|
4518
|
-
n({ ...a, body:
|
|
4534
|
+
}, m = (C) => {
|
|
4535
|
+
const g = d.current, f = a.body, y = g && typeof g.selectionStart == "number" ? g.selectionStart : f.length, j = f.substring(0, y), U = f.substring(y), k = j + C + U;
|
|
4536
|
+
n({ ...a, body: k }), setTimeout(() => {
|
|
4519
4537
|
if (d.current) {
|
|
4520
|
-
const
|
|
4521
|
-
d.current.setSelectionRange(
|
|
4538
|
+
const N = y + C.length;
|
|
4539
|
+
d.current.setSelectionRange(N, N), d.current.focus();
|
|
4522
4540
|
}
|
|
4523
4541
|
}, 0), l(!1);
|
|
4524
4542
|
};
|
|
@@ -4526,8 +4544,8 @@ function ta({ template: a, setTemplate: n }) {
|
|
|
4526
4544
|
a.type !== "CAROUSEL" && /* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
|
|
4527
4545
|
/* @__PURE__ */ e("h2", { className: "rsp-text-lg rsp-font-semibold rsp-text-gray-900", children: "Message Content" }),
|
|
4528
4546
|
/* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
|
|
4529
|
-
/* @__PURE__ */ e(
|
|
4530
|
-
/* @__PURE__ */ e(
|
|
4547
|
+
/* @__PURE__ */ e(aa, { template: a, setTemplate: n, onFileUpload: ve }),
|
|
4548
|
+
/* @__PURE__ */ e(sa, { template: a, setTemplate: n })
|
|
4531
4549
|
] })
|
|
4532
4550
|
] }),
|
|
4533
4551
|
a.type === "CAROUSEL" && /* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
|
|
@@ -4542,7 +4560,7 @@ function ta({ template: a, setTemplate: n }) {
|
|
|
4542
4560
|
{
|
|
4543
4561
|
ref: d,
|
|
4544
4562
|
value: a.body,
|
|
4545
|
-
onChange: (
|
|
4563
|
+
onChange: (C) => n({ ...a, body: C.target.value }),
|
|
4546
4564
|
maxLength: 1024,
|
|
4547
4565
|
rows: 4,
|
|
4548
4566
|
className: "rsp-w-full rsp-px-3 rsp-py-2 rsp-border rsp-border-gray-300 rsp-rounded-md rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-white rsp-resize-none",
|
|
@@ -4555,8 +4573,8 @@ function ta({ template: a, setTemplate: n }) {
|
|
|
4555
4573
|
"button",
|
|
4556
4574
|
{
|
|
4557
4575
|
onClick: () => {
|
|
4558
|
-
const
|
|
4559
|
-
n({ ...a, body: a.body +
|
|
4576
|
+
const f = `{{${ca(a) + 1}}}`;
|
|
4577
|
+
n({ ...a, body: a.body + f });
|
|
4560
4578
|
},
|
|
4561
4579
|
className: "rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",
|
|
4562
4580
|
title: "Add Variable",
|
|
@@ -4566,10 +4584,10 @@ function ta({ template: a, setTemplate: n }) {
|
|
|
4566
4584
|
/* @__PURE__ */ e(
|
|
4567
4585
|
"button",
|
|
4568
4586
|
{
|
|
4569
|
-
onClick:
|
|
4587
|
+
onClick: p,
|
|
4570
4588
|
className: "rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",
|
|
4571
4589
|
title: "Add emoji",
|
|
4572
|
-
children: /* @__PURE__ */ e(
|
|
4590
|
+
children: /* @__PURE__ */ e(xe, { className: "rsp-w-4 rsp-h-4" })
|
|
4573
4591
|
}
|
|
4574
4592
|
)
|
|
4575
4593
|
] }),
|
|
@@ -4579,15 +4597,15 @@ function ta({ template: a, setTemplate: n }) {
|
|
|
4579
4597
|
] })
|
|
4580
4598
|
] }),
|
|
4581
4599
|
(() => {
|
|
4582
|
-
const
|
|
4583
|
-
return
|
|
4600
|
+
const C = a.body.match(/\{\{(\d+)\}\}/g) || [], g = [...new Set(C.map((f) => f.replace(/[{}]/g, "")))];
|
|
4601
|
+
return g.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
|
|
4584
4602
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2", children: "Sample Values" }),
|
|
4585
|
-
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children:
|
|
4586
|
-
var
|
|
4603
|
+
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: g.map((f) => {
|
|
4604
|
+
var y, j;
|
|
4587
4605
|
return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
4588
4606
|
/* @__PURE__ */ r("label", { className: "rsp-text-xs rsp-text-gray-500 rsp-whitespace-nowrap", children: [
|
|
4589
4607
|
"{{",
|
|
4590
|
-
|
|
4608
|
+
f,
|
|
4591
4609
|
"}}",
|
|
4592
4610
|
":"
|
|
4593
4611
|
] }),
|
|
@@ -4595,19 +4613,19 @@ function ta({ template: a, setTemplate: n }) {
|
|
|
4595
4613
|
"input",
|
|
4596
4614
|
{
|
|
4597
4615
|
type: "text",
|
|
4598
|
-
value: ((
|
|
4599
|
-
onChange: (
|
|
4600
|
-
var
|
|
4601
|
-
const
|
|
4616
|
+
value: ((j = (y = a.sampleContent) == null ? void 0 : y.bodyVariables) == null ? void 0 : j[f]) || "",
|
|
4617
|
+
onChange: (U) => {
|
|
4618
|
+
var N, o, u;
|
|
4619
|
+
const k = {
|
|
4602
4620
|
...a.sampleContent,
|
|
4603
|
-
headerVariables: ((
|
|
4621
|
+
headerVariables: ((N = a.sampleContent) == null ? void 0 : N.headerVariables) || {},
|
|
4604
4622
|
bodyVariables: {
|
|
4605
|
-
...(
|
|
4606
|
-
[
|
|
4623
|
+
...(o = a.sampleContent) == null ? void 0 : o.bodyVariables,
|
|
4624
|
+
[f]: U.target.value
|
|
4607
4625
|
},
|
|
4608
|
-
buttonVariables: ((
|
|
4626
|
+
buttonVariables: ((u = a.sampleContent) == null ? void 0 : u.buttonVariables) || {}
|
|
4609
4627
|
};
|
|
4610
|
-
n({ ...a, sampleContent:
|
|
4628
|
+
n({ ...a, sampleContent: k });
|
|
4611
4629
|
},
|
|
4612
4630
|
className: "rsp-flex-1 rsp-px-2 rsp-py-1 rsp-border rsp-border-gray-300 rsp-rounded rsp-text-xs focus:rsp-outline-none focus:rsp-border-blue-500",
|
|
4613
4631
|
placeholder: "Sample"
|
|
@@ -4618,15 +4636,15 @@ function ta({ template: a, setTemplate: n }) {
|
|
|
4618
4636
|
{
|
|
4619
4637
|
type: "button",
|
|
4620
4638
|
onClick: () => {
|
|
4621
|
-
var
|
|
4622
|
-
const
|
|
4639
|
+
var o, u, t;
|
|
4640
|
+
const U = new RegExp(`\\{\\{${f}\\}\\}`, "g"), k = (a.body || "").replace(U, ""), N = Object.fromEntries(Object.entries(((o = a.sampleContent) == null ? void 0 : o.bodyVariables) || {}).filter(([h]) => h !== f));
|
|
4623
4641
|
n({
|
|
4624
4642
|
...a,
|
|
4625
|
-
body:
|
|
4643
|
+
body: k,
|
|
4626
4644
|
sampleContent: {
|
|
4627
4645
|
...a.sampleContent,
|
|
4628
|
-
bodyVariables:
|
|
4629
|
-
headerVariables: ((
|
|
4646
|
+
bodyVariables: N,
|
|
4647
|
+
headerVariables: ((u = a.sampleContent) == null ? void 0 : u.headerVariables) || {},
|
|
4630
4648
|
buttonVariables: ((t = a.sampleContent) == null ? void 0 : t.buttonVariables) || {}
|
|
4631
4649
|
}
|
|
4632
4650
|
});
|
|
@@ -4636,29 +4654,29 @@ function ta({ template: a, setTemplate: n }) {
|
|
|
4636
4654
|
children: "×"
|
|
4637
4655
|
}
|
|
4638
4656
|
)
|
|
4639
|
-
] }, `global-body-sample-${
|
|
4657
|
+
] }, `global-body-sample-${f}`);
|
|
4640
4658
|
}) })
|
|
4641
4659
|
] });
|
|
4642
4660
|
})()
|
|
4643
4661
|
] }) })
|
|
4644
4662
|
] }),
|
|
4645
4663
|
a.type === "CAROUSEL" && /* @__PURE__ */ e("div", { className: "rsp-space-y-6", children: /* @__PURE__ */ e(
|
|
4646
|
-
|
|
4664
|
+
ma,
|
|
4647
4665
|
{
|
|
4648
4666
|
template: a,
|
|
4649
4667
|
setTemplate: n,
|
|
4650
|
-
onFileUpload:
|
|
4668
|
+
onFileUpload: ve
|
|
4651
4669
|
}
|
|
4652
4670
|
) }),
|
|
4653
4671
|
a.type !== "CAROUSEL" && /* @__PURE__ */ e("div", { className: "rsp-space-y-6", children: /* @__PURE__ */ e(
|
|
4654
|
-
|
|
4672
|
+
na,
|
|
4655
4673
|
{
|
|
4656
4674
|
template: a,
|
|
4657
4675
|
setTemplate: n
|
|
4658
4676
|
}
|
|
4659
4677
|
) }),
|
|
4660
4678
|
/* @__PURE__ */ e(
|
|
4661
|
-
|
|
4679
|
+
fe,
|
|
4662
4680
|
{
|
|
4663
4681
|
isOpen: i,
|
|
4664
4682
|
onClose: () => l(!1),
|
|
@@ -4667,21 +4685,21 @@ function ta({ template: a, setTemplate: n }) {
|
|
|
4667
4685
|
)
|
|
4668
4686
|
] });
|
|
4669
4687
|
}
|
|
4670
|
-
function
|
|
4688
|
+
function xa({ type: a }) {
|
|
4671
4689
|
switch (a) {
|
|
4672
4690
|
case "QUICK_REPLY":
|
|
4673
|
-
return /* @__PURE__ */ e(
|
|
4691
|
+
return /* @__PURE__ */ e(Pe, { className: "w-4 h-4" });
|
|
4674
4692
|
case "URL":
|
|
4675
|
-
return /* @__PURE__ */ e(
|
|
4693
|
+
return /* @__PURE__ */ e(Oe, { className: "w-4 h-4" });
|
|
4676
4694
|
case "CALL":
|
|
4677
|
-
return /* @__PURE__ */ e(
|
|
4695
|
+
return /* @__PURE__ */ e(Me, { className: "w-4 h-4" });
|
|
4678
4696
|
case "FLOW":
|
|
4679
|
-
return /* @__PURE__ */ e(
|
|
4697
|
+
return /* @__PURE__ */ e(Fe, { className: "w-4 h-4" });
|
|
4680
4698
|
default:
|
|
4681
4699
|
return null;
|
|
4682
4700
|
}
|
|
4683
4701
|
}
|
|
4684
|
-
function
|
|
4702
|
+
function pa({ buttons: a, flowButtonText: n, onShowAllOptions: i }) {
|
|
4685
4703
|
const l = [...a];
|
|
4686
4704
|
n && l.push({
|
|
4687
4705
|
id: "flow-button",
|
|
@@ -4690,18 +4708,18 @@ function ca({ buttons: a, flowButtonText: n, onShowAllOptions: i }) {
|
|
|
4690
4708
|
});
|
|
4691
4709
|
const d = l.slice(0, 2);
|
|
4692
4710
|
return /* @__PURE__ */ r("div", { className: "rsp-divide-y rsp-divide-gray-200", children: [
|
|
4693
|
-
d.map((
|
|
4711
|
+
d.map((p) => /* @__PURE__ */ r(
|
|
4694
4712
|
"button",
|
|
4695
4713
|
{
|
|
4696
4714
|
className: "rsp-w-full rsp-py-4 rsp-text-[#128C7E] rsp-text-[15px] rsp-font-medium rsp-bg-white hover:rsp-bg-gray-50 rsp-flex rsp-items-center rsp-gap-3 rsp-px-4 rsp-transition-colors",
|
|
4697
4715
|
style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' },
|
|
4698
4716
|
children: [
|
|
4699
|
-
/* @__PURE__ */ e("div", { className: "rsp-text-[#128C7E]", children: /* @__PURE__ */ e(
|
|
4700
|
-
/* @__PURE__ */ e("span", { className: "rsp-flex-1 rsp-text-left rsp-break-words rsp-break-all rsp-whitespace-pre-wrap", children:
|
|
4701
|
-
|
|
4717
|
+
/* @__PURE__ */ e("div", { className: "rsp-text-[#128C7E]", children: /* @__PURE__ */ e(xa, { type: p.type }) }),
|
|
4718
|
+
/* @__PURE__ */ e("span", { className: "rsp-flex-1 rsp-text-left rsp-break-words rsp-break-all rsp-whitespace-pre-wrap", children: p.text }),
|
|
4719
|
+
p.id === "flow-button" && /* @__PURE__ */ e(Re, { className: "rsp-w-5 rsp-h-5 rsp-text-[#128C7E] rsp-ml-auto" })
|
|
4702
4720
|
]
|
|
4703
4721
|
},
|
|
4704
|
-
|
|
4722
|
+
p.id
|
|
4705
4723
|
)),
|
|
4706
4724
|
l.length > 2 && /* @__PURE__ */ r(
|
|
4707
4725
|
"button",
|
|
@@ -4717,25 +4735,25 @@ function ca({ buttons: a, flowButtonText: n, onShowAllOptions: i }) {
|
|
|
4717
4735
|
)
|
|
4718
4736
|
] });
|
|
4719
4737
|
}
|
|
4720
|
-
function
|
|
4721
|
-
var
|
|
4722
|
-
const [n, i] =
|
|
4723
|
-
|
|
4724
|
-
a.type === "CAROUSEL" &&
|
|
4725
|
-
}, [
|
|
4726
|
-
const m = (
|
|
4727
|
-
var
|
|
4728
|
-
return ((
|
|
4729
|
-
}) : "",
|
|
4730
|
-
var
|
|
4731
|
-
return ((
|
|
4732
|
-
}) : "",
|
|
4733
|
-
var
|
|
4734
|
-
const
|
|
4735
|
-
if (!
|
|
4736
|
-
const t = ((
|
|
4737
|
-
return
|
|
4738
|
-
},
|
|
4738
|
+
function oa({ template: a }) {
|
|
4739
|
+
var j, U, k, N;
|
|
4740
|
+
const [n, i] = B(!1), [l, d] = B(0), p = (j = a.carousel) != null && j.cards ? a.carousel.cards.length : 0;
|
|
4741
|
+
se(() => {
|
|
4742
|
+
a.type === "CAROUSEL" && p > 0 ? l >= p && d(0) : d(0);
|
|
4743
|
+
}, [p, a.type]);
|
|
4744
|
+
const m = (o) => o ? o.replace(/\{\{(\d+)\}\}/g, (u, t) => {
|
|
4745
|
+
var h, v;
|
|
4746
|
+
return ((v = (h = a.sampleContent) == null ? void 0 : h.headerVariables) == null ? void 0 : v[t]) || `[Variable ${t}]`;
|
|
4747
|
+
}) : "", C = (o) => o ? o.replace(/\{\{(\d+)\}\}/g, (u, t) => {
|
|
4748
|
+
var h, v;
|
|
4749
|
+
return ((v = (h = a.sampleContent) == null ? void 0 : h.bodyVariables) == null ? void 0 : v[t]) || `[Variable ${t}]`;
|
|
4750
|
+
}) : "", g = (o) => {
|
|
4751
|
+
var h;
|
|
4752
|
+
const u = (o == null ? void 0 : o.body) ?? "";
|
|
4753
|
+
if (!u) return "";
|
|
4754
|
+
const t = ((h = o == null ? void 0 : o.sampleContent) == null ? void 0 : h.bodyVariables) ?? {};
|
|
4755
|
+
return u.replace(/\{\{(\d+)\}\}/g, (v, V) => t[V] || `[Variable ${V}]`);
|
|
4756
|
+
}, f = a.headerType !== "NONE" || a.body || a.footer || a.buttons.length > 0 || a.type === "CAROUSEL" && ((U = a.carousel) == null ? void 0 : U.cards.length), y = a.headerText || a.body || a.footer;
|
|
4739
4757
|
return /* @__PURE__ */ r("div", { className: "rsp-bg-white rsp-rounded-lg rsp-shadow-sm rsp-border rsp-border-gray-200", children: [
|
|
4740
4758
|
/* @__PURE__ */ r("div", { className: "rsp-p-4 rsp-border-b rsp-border-gray-200", children: [
|
|
4741
4759
|
/* @__PURE__ */ e("h3", { className: "rsp-text-lg rsp-font-semibold rsp-text-gray-900", children: "Preview" }),
|
|
@@ -4782,7 +4800,7 @@ function da({ template: a }) {
|
|
|
4782
4800
|
] }),
|
|
4783
4801
|
/* @__PURE__ */ r("div", { className: "rsp-absolute rsp-top-[105px] rsp-left-0 rsp-right-0 rsp-bottom-[60px] rsp-bg-gradient-to-b rsp-from-[#E8E2DB] rsp-via-[#E5DDD5] rsp-to-[#DDD5CC] rsp-overflow-y-auto", children: [
|
|
4784
4802
|
/* @__PURE__ */ e("div", { className: "rsp-absolute rsp-inset-0 rsp-opacity-[0.03]", style: { backgroundImage: `url("data:image/svg+xml,%3Csvg width='80' height='80' viewBox='0 0 80 80' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23000000' fill-opacity='0.08'%3E%3Cpath d='M40 40c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8zm0-32c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8zm32 32c0-4.4-3.6-8-8-8s-8 3.6-8 8 3.6 8 8 8 8-3.6 8-8z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E")` } }),
|
|
4785
|
-
/* @__PURE__ */ e("div", { className: "rsp-relative rsp-px-4 rsp-py-4", children:
|
|
4803
|
+
/* @__PURE__ */ e("div", { className: "rsp-relative rsp-px-4 rsp-py-4", children: f ? /* @__PURE__ */ r("div", { className: "rsp-flex rsp-flex-col rsp-items-start", children: [
|
|
4786
4804
|
a.headerType === "MEDIA" && a.mediaUrl && /* @__PURE__ */ r("div", { className: "rsp-max-w-[220px] rsp-w-auto rsp-rounded-xl rsp-overflow-hidden rsp-shadow-md rsp-mb-1.5 rsp-animate-slide-up rsp-border rsp-border-gray-200", children: [
|
|
4787
4805
|
a.mediaType === "IMAGE" && /* @__PURE__ */ e(
|
|
4788
4806
|
"img",
|
|
@@ -4790,8 +4808,8 @@ function da({ template: a }) {
|
|
|
4790
4808
|
src: a.mediaUrl,
|
|
4791
4809
|
alt: "Header media",
|
|
4792
4810
|
className: "rsp-w-full rsp-max-h-[150px] rsp-object-cover rsp-block",
|
|
4793
|
-
onError: (
|
|
4794
|
-
|
|
4811
|
+
onError: (o) => {
|
|
4812
|
+
o.currentTarget.style.display = "none";
|
|
4795
4813
|
}
|
|
4796
4814
|
}
|
|
4797
4815
|
),
|
|
@@ -4807,38 +4825,38 @@ function da({ template: a }) {
|
|
|
4807
4825
|
] })
|
|
4808
4826
|
] }) })
|
|
4809
4827
|
] }),
|
|
4810
|
-
|
|
4828
|
+
y && /* @__PURE__ */ e("div", { className: "rsp-flex rsp-justify-start rsp-mb-1.5", children: /* @__PURE__ */ r("div", { className: "rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[12px] rsp-max-w-[220px] rsp-shadow-[0_2px_8px_rgba(0,0,0,0.08)] rsp-relative rsp-border rsp-border-gray-100 rsp-animate-slide-up", children: [
|
|
4811
4829
|
a.headerType === "TEXT" && a.headerText && /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-pt-3 rsp-pb-2", children: /* @__PURE__ */ e("div", { className: "rsp-text-[15px] rsp-font-semibold rsp-text-[#111b21] rsp-leading-[1.3] rsp-tracking-normal rsp-break-words", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: m(a.headerText) }) }),
|
|
4812
|
-
a.body && /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-py-2", children: /* @__PURE__ */ e("div", { className: "rsp-text-[14px] rsp-text-[#111b21] rsp-leading-[1.4] rsp-whitespace-pre-wrap rsp-tracking-normal rsp-break-words", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children:
|
|
4830
|
+
a.body && /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-py-2", children: /* @__PURE__ */ e("div", { className: "rsp-text-[14px] rsp-text-[#111b21] rsp-leading-[1.4] rsp-whitespace-pre-wrap rsp-tracking-normal rsp-break-words", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: C(a.body) }) }),
|
|
4813
4831
|
a.footer && /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-pb-2", children: /* @__PURE__ */ e("div", { className: "rsp-text-[12px] rsp-text-[#667781] rsp-pt-2 rsp-border-t rsp-border-gray-100 rsp-break-words rsp-break-all rsp-whitespace-pre-wrap", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: a.footer }) }),
|
|
4814
4832
|
/* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-pb-2 rsp-text-right", children: /* @__PURE__ */ r("div", { className: "rsp-text-[11px] rsp-text-[#667781] rsp-flex rsp-items-center rsp-justify-end rsp-gap-1 rsp-opacity-80", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: [
|
|
4815
4833
|
"9:41 AM",
|
|
4816
4834
|
/* @__PURE__ */ e("svg", { className: "rsp-w-3 rsp-h-3 rsp-text-[#53bdeb]", viewBox: "0 0 16 15", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M15.01 3.316l-.478-.372a.365.365 0 0 0-.51.063L8.666 9.879a.32.32 0 0 1-.484.033l-.358-.325a.319.319 0 0 0-.484.032l-.378.483a.418.418 0 0 0 .036.541l1.32 1.266c.143.14.361.125.484-.033l6.272-8.048a.366.366 0 0 0-.064-.512zm-4.1 0l-.478-.372a.365.365 0 0 0-.51.063L4.566 9.879a.32.32 0 0 1-.484.033L1.891 7.769a.319.319 0 0 0-.484.032l-.378.483a.418.418 0 0 0 .036.541l3.61 3.463c.143.14.361.125.484-.033l6.272-8.048a.365.365 0 0 0-.064-.512z" }) })
|
|
4817
4835
|
] }) })
|
|
4818
4836
|
] }) }),
|
|
4819
|
-
a.type === "CAROUSEL" && (((
|
|
4837
|
+
a.type === "CAROUSEL" && (((N = (k = a.carousel) == null ? void 0 : k.cards) == null ? void 0 : N.length) || 0) > 0 && /* @__PURE__ */ e("div", { className: "rsp-flex rsp-justify-start rsp-mb-1.5", children: /* @__PURE__ */ e("div", { className: "rsp-w-[220px] rsp-animate-slide-up", children: /* @__PURE__ */ e("div", { className: "rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[12px] rsp-overflow-hidden rsp-shadow-[0_2px_8px_rgba(0,0,0,0.08)] rsp-border rsp-border-gray-100 rsp-relative rsp-min-h-[280px] rsp-flex rsp-flex-col", children: /* @__PURE__ */ r("div", { className: "rsp-relative rsp-flex-1 rsp-flex rsp-flex-col", children: [
|
|
4820
4838
|
(() => {
|
|
4821
|
-
var
|
|
4822
|
-
const
|
|
4839
|
+
var u, t;
|
|
4840
|
+
const o = a.carousel && a.carousel.cards.length > 0 ? a.carousel.cards[l] || a.carousel.cards[0] : void 0;
|
|
4823
4841
|
return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-flex-col rsp-h-full", children: [
|
|
4824
|
-
/* @__PURE__ */ e("div", { className: "rsp-relative rsp-w-full rsp-h-[140px] rsp-bg-gray-100 rsp-group rsp-flex-shrink-0", children:
|
|
4825
|
-
((
|
|
4842
|
+
/* @__PURE__ */ e("div", { className: "rsp-relative rsp-w-full rsp-h-[140px] rsp-bg-gray-100 rsp-group rsp-flex-shrink-0", children: o && o.mediaUrl ? /* @__PURE__ */ r(ne, { children: [
|
|
4843
|
+
((u = a.carousel) == null ? void 0 : u.type) === "IMAGE" ? /* @__PURE__ */ e(
|
|
4826
4844
|
"img",
|
|
4827
4845
|
{
|
|
4828
|
-
src:
|
|
4846
|
+
src: o.mediaUrl,
|
|
4829
4847
|
alt: "Carousel card",
|
|
4830
4848
|
className: "rsp-w-full rsp-h-full rsp-object-cover",
|
|
4831
|
-
onError: (
|
|
4832
|
-
|
|
4849
|
+
onError: (h) => {
|
|
4850
|
+
h.currentTarget.style.display = "none";
|
|
4833
4851
|
}
|
|
4834
4852
|
}
|
|
4835
4853
|
) : /* @__PURE__ */ e("div", { className: "rsp-relative rsp-w-full rsp-h-full rsp-bg-gradient-to-br rsp-from-gray-800 rsp-to-gray-900 rsp-flex rsp-items-center rsp-justify-center", children: /* @__PURE__ */ e("div", { className: "rsp-w-10 rsp-h-10 rsp-bg-black rsp-bg-opacity-70 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-shadow-lg", children: /* @__PURE__ */ e("div", { className: "rsp-w-0 rsp-h-0 rsp-border-l-[6px] rsp-border-l-white rsp-border-t-[5px] rsp-border-t-transparent rsp-border-b-[5px] rsp-border-b-transparent rsp-ml-1" }) }) }),
|
|
4836
|
-
a.carousel && a.carousel.cards.length > 1 && /* @__PURE__ */ r(
|
|
4854
|
+
a.carousel && a.carousel.cards.length > 1 && /* @__PURE__ */ r(ne, { children: [
|
|
4837
4855
|
/* @__PURE__ */ e(
|
|
4838
4856
|
"button",
|
|
4839
4857
|
{
|
|
4840
4858
|
onClick: () => d(
|
|
4841
|
-
(
|
|
4859
|
+
(h) => h > 0 ? h - 1 : a.carousel.cards.length - 1
|
|
4842
4860
|
),
|
|
4843
4861
|
className: "rsp-absolute rsp-left-1 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-z-20 rsp-w-6 rsp-h-6 rsp-bg-black rsp-bg-opacity-50 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-text-white hover:rsp-bg-opacity-80 rsp-transition-all rsp-opacity-0 group-hover:rsp-opacity-100",
|
|
4844
4862
|
children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 19l-7-7 7-7" }) })
|
|
@@ -4848,7 +4866,7 @@ function da({ template: a }) {
|
|
|
4848
4866
|
"button",
|
|
4849
4867
|
{
|
|
4850
4868
|
onClick: () => d(
|
|
4851
|
-
(
|
|
4869
|
+
(h) => h < a.carousel.cards.length - 1 ? h + 1 : 0
|
|
4852
4870
|
),
|
|
4853
4871
|
className: "rsp-absolute rsp-right-1 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-z-20 rsp-w-6 rsp-h-6 rsp-bg-black rsp-bg-opacity-50 rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-text-white hover:rsp-bg-opacity-80 rsp-transition-all rsp-opacity-0 group-hover:rsp-opacity-100",
|
|
4854
4872
|
children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) })
|
|
@@ -4864,33 +4882,33 @@ function da({ template: a }) {
|
|
|
4864
4882
|
/* @__PURE__ */ e("svg", { className: "rsp-w-12 rsp-h-12 rsp-mx-auto rsp-text-gray-400 rsp-mb-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: ((t = a.carousel) == null ? void 0 : t.type) === "VIDEO" ? /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 10l4.553-2.276A1 1 0 0121 8.618v6.764a1 1 0 01-1.447.894L15 14M5 18h8a2 2 0 002-2V8a2 2 0 00-2-2H5a2 2 0 00-2 2v8a2 2 0 002 2z" }) : /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M4 16l4.586-4.586a2 2 0 012.828 0L16 16m-2-2l1.586-1.586a2 2 0 012.828 0L20 14m-6-6h.01M6 20h12a2 2 0 002-2V6a2 2 0 00-2-2H6a2 2 0 00-2 2v12a2 2 0 002 2z" }) }),
|
|
4865
4883
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: "No media" })
|
|
4866
4884
|
] }) }) }),
|
|
4867
|
-
/* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-py-3 rsp-flex-1 rsp-flex rsp-items-start", children: /* @__PURE__ */ e("p", { className: "rsp-text-[13px] rsp-text-[#111b21] rsp-leading-[1.4] rsp-line-clamp-3", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children:
|
|
4868
|
-
/* @__PURE__ */ e("div", { className: "rsp-border-t rsp-border-gray-100 rsp-mt-auto", children:
|
|
4885
|
+
/* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-py-3 rsp-flex-1 rsp-flex rsp-items-start", children: /* @__PURE__ */ e("p", { className: "rsp-text-[13px] rsp-text-[#111b21] rsp-leading-[1.4] rsp-line-clamp-3", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: o ? g(o) : "Card body text..." }) }),
|
|
4886
|
+
/* @__PURE__ */ e("div", { className: "rsp-border-t rsp-border-gray-100 rsp-mt-auto", children: o && o.buttons.length > 0 ? /* @__PURE__ */ e(ne, { children: o.buttons.map((h, v) => /* @__PURE__ */ e(
|
|
4869
4887
|
"div",
|
|
4870
4888
|
{
|
|
4871
|
-
className: `rsp-px-4 rsp-py-3 rsp-text-center rsp-text-[14px] rsp-text-[#128C7E] rsp-font-medium rsp-break-words rsp-whitespace-pre-wrap ${
|
|
4889
|
+
className: `rsp-px-4 rsp-py-3 rsp-text-center rsp-text-[14px] rsp-text-[#128C7E] rsp-font-medium rsp-break-words rsp-whitespace-pre-wrap ${v < o.buttons.length - 1 ? "rsp-border-b rsp-border-gray-100" : ""}`,
|
|
4872
4890
|
style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' },
|
|
4873
4891
|
children: /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-center rsp-gap-2", children: [
|
|
4874
|
-
|
|
4875
|
-
(
|
|
4876
|
-
/* @__PURE__ */ e("span", { className: "rsp-inline-block rsp-max-w-[180px] rsp-break-words rsp-break-all rsp-whitespace-pre-wrap rsp-text-center", children:
|
|
4892
|
+
h.type === "URL" && /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M10 6H6a2 2 0 00-2 2v10a2 2 0 002 2h10a2 2 0 002-2v-4M14 4h6m0 0v6m0-6L10 14" }) }),
|
|
4893
|
+
(h.type === "CALL" || h.type === "PHONE_NUMBER") && /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M3 5a2 2 0 012-2h3.28a1 1 0 01.948.684l1.498 4.493a1 1 0 01-.502 1.21l-2.257 1.13a11.042 11.042 0 005.516 5.516l1.13-2.257a1 1 0 011.21-.502l4.493 1.498a1 1 0 01.684.949V19a2 2 0 01-2 2h-1C9.716 21 3 14.284 3 6V5z" }) }),
|
|
4894
|
+
/* @__PURE__ */ e("span", { className: "rsp-inline-block rsp-max-w-[180px] rsp-break-words rsp-break-all rsp-whitespace-pre-wrap rsp-text-center", children: h.text })
|
|
4877
4895
|
] })
|
|
4878
4896
|
},
|
|
4879
|
-
|
|
4897
|
+
h.id
|
|
4880
4898
|
)) }) : /* @__PURE__ */ e("div", { className: "rsp-px-4 rsp-py-3 rsp-text-center rsp-text-xs rsp-text-gray-400", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: "No buttons" }) })
|
|
4881
4899
|
] });
|
|
4882
4900
|
})(),
|
|
4883
|
-
a.carousel && a.carousel.cards.length > 1 && /* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center rsp-justify-center rsp-gap-1.5 rsp-py-3 rsp-bg-white rsp-border-t rsp-border-gray-100", children: a.carousel && a.carousel.cards.map((
|
|
4901
|
+
a.carousel && a.carousel.cards.length > 1 && /* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center rsp-justify-center rsp-gap-1.5 rsp-py-3 rsp-bg-white rsp-border-t rsp-border-gray-100", children: a.carousel && a.carousel.cards.map((o, u) => /* @__PURE__ */ e(
|
|
4884
4902
|
"button",
|
|
4885
4903
|
{
|
|
4886
|
-
onClick: () => d(
|
|
4887
|
-
className: `rsp-w-2 rsp-h-2 rsp-rounded-full rsp-transition-all ${
|
|
4904
|
+
onClick: () => d(u),
|
|
4905
|
+
className: `rsp-w-2 rsp-h-2 rsp-rounded-full rsp-transition-all ${u === l ? "rsp-bg-[#128C7E] rsp-w-6" : "rsp-bg-gray-300 hover:rsp-bg-gray-400"}`
|
|
4888
4906
|
},
|
|
4889
|
-
|
|
4907
|
+
u
|
|
4890
4908
|
)) })
|
|
4891
4909
|
] }) }) }) }),
|
|
4892
4910
|
a.buttons.length > 0 && /* @__PURE__ */ e("div", { className: "rsp-flex rsp-justify-start", children: /* @__PURE__ */ e("div", { className: "rsp-bg-gradient-to-b rsp-from-white rsp-to-[#fafafa] rsp-rounded-[12px] rsp-overflow-hidden rsp-shadow-[0_2px_8px_rgba(0,0,0,0.08)] rsp-max-w-[220px] rsp-w-full rsp-border rsp-border-gray-100 rsp-animate-slide-up", children: /* @__PURE__ */ e(
|
|
4893
|
-
|
|
4911
|
+
pa,
|
|
4894
4912
|
{
|
|
4895
4913
|
buttons: a.buttons,
|
|
4896
4914
|
onShowAllOptions: () => i(!0)
|
|
@@ -4913,14 +4931,14 @@ function da({ template: a }) {
|
|
|
4913
4931
|
className: "rsp-w-full rsp-bg-[#F0F2F5] rsp-rounded-t-2xl rsp-shadow-lg rsp-animate-slide-up",
|
|
4914
4932
|
children: [
|
|
4915
4933
|
/* @__PURE__ */ e("div", { className: "rsp-p-4 rsp-border-b rsp-border-gray-300", children: /* @__PURE__ */ e("h4", { className: "rsp-font-bold rsp-text-center rsp-text-gray-800 rsp-text-md", children: a.body || "Options" }) }),
|
|
4916
|
-
/* @__PURE__ */ e("div", { className: "rsp-max-h-[250px] rsp-overflow-y-auto", children: a.buttons.map((
|
|
4934
|
+
/* @__PURE__ */ e("div", { className: "rsp-max-h-[250px] rsp-overflow-y-auto", children: a.buttons.map((o, u) => /* @__PURE__ */ e(
|
|
4917
4935
|
"div",
|
|
4918
4936
|
{
|
|
4919
|
-
className: `rsp-p-4 rsp-text-center rsp-text-[15px] rsp-text-[#128C7E] rsp-font-medium ${
|
|
4937
|
+
className: `rsp-p-4 rsp-text-center rsp-text-[15px] rsp-text-[#128C7E] rsp-font-medium ${u < a.buttons.length - 1 ? "rsp-border-b rsp-border-gray-300" : ""}`,
|
|
4920
4938
|
style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' },
|
|
4921
|
-
children:
|
|
4939
|
+
children: o.text
|
|
4922
4940
|
},
|
|
4923
|
-
|
|
4941
|
+
o.id
|
|
4924
4942
|
)) }),
|
|
4925
4943
|
/* @__PURE__ */ e(
|
|
4926
4944
|
"div",
|
|
@@ -4939,7 +4957,7 @@ function da({ template: a }) {
|
|
|
4939
4957
|
] }) }) })
|
|
4940
4958
|
] });
|
|
4941
4959
|
}
|
|
4942
|
-
const
|
|
4960
|
+
const ke = {
|
|
4943
4961
|
name: "",
|
|
4944
4962
|
category: "MARKETING",
|
|
4945
4963
|
type: "BASIC",
|
|
@@ -4951,76 +4969,76 @@ const ye = {
|
|
|
4951
4969
|
footer: "",
|
|
4952
4970
|
buttons: []
|
|
4953
4971
|
};
|
|
4954
|
-
function
|
|
4955
|
-
var
|
|
4956
|
-
const i = (typeof
|
|
4972
|
+
function ya({ onCancel: a }) {
|
|
4973
|
+
var V, R, I;
|
|
4974
|
+
const i = (typeof ye == "function" ? ye() : !1) ? Ce() : void 0, [l, d] = B(ke), [p, m] = B(!0), [C, g] = B(!1), [f, y] = B(null), [j, U] = B({
|
|
4957
4975
|
isOpen: !1
|
|
4958
|
-
}), [
|
|
4976
|
+
}), [k, N] = B({
|
|
4959
4977
|
isOpen: !1
|
|
4960
|
-
}),
|
|
4978
|
+
}), o = () => {
|
|
4961
4979
|
if (!l.name || !l.body) return !1;
|
|
4962
|
-
const
|
|
4963
|
-
(
|
|
4964
|
-
var
|
|
4965
|
-
return !!((A = (
|
|
4980
|
+
const x = u(l.body), w = u(l.headerText), L = t(), s = w.every(
|
|
4981
|
+
(T) => {
|
|
4982
|
+
var c, M, A;
|
|
4983
|
+
return !!((A = (M = (c = l.sampleContent) == null ? void 0 : c.headerVariables) == null ? void 0 : M[T]) != null && A.trim());
|
|
4966
4984
|
}
|
|
4967
|
-
),
|
|
4968
|
-
(
|
|
4969
|
-
var
|
|
4970
|
-
return !!((A = (
|
|
4985
|
+
), b = x.every(
|
|
4986
|
+
(T) => {
|
|
4987
|
+
var c, M, A;
|
|
4988
|
+
return !!((A = (M = (c = l.sampleContent) == null ? void 0 : c.bodyVariables) == null ? void 0 : M[T]) != null && A.trim());
|
|
4971
4989
|
}
|
|
4972
|
-
),
|
|
4973
|
-
(
|
|
4974
|
-
var
|
|
4975
|
-
return !!((A = (
|
|
4990
|
+
), E = L.every(
|
|
4991
|
+
(T) => {
|
|
4992
|
+
var c, M, A;
|
|
4993
|
+
return !!((A = (M = (c = l.sampleContent) == null ? void 0 : c.buttonVariables) == null ? void 0 : M[T]) != null && A.trim());
|
|
4976
4994
|
}
|
|
4977
4995
|
);
|
|
4978
|
-
return
|
|
4979
|
-
},
|
|
4980
|
-
if (!
|
|
4981
|
-
const
|
|
4982
|
-
return [...new Set(
|
|
4996
|
+
return s && b && E;
|
|
4997
|
+
}, u = (x) => {
|
|
4998
|
+
if (!x) return [];
|
|
4999
|
+
const w = x.match(/\{\{(\d+)\}\}/g) || [];
|
|
5000
|
+
return [...new Set(w.map((L) => L.replace(/[{}]/g, "")))];
|
|
4983
5001
|
}, t = () => {
|
|
4984
|
-
const
|
|
4985
|
-
(
|
|
5002
|
+
const x = l.buttons.find(
|
|
5003
|
+
(L) => L.type === "URL" && L.urlType === "dynamic"
|
|
4986
5004
|
);
|
|
4987
|
-
if (!(
|
|
4988
|
-
const
|
|
4989
|
-
return [...new Set(
|
|
5005
|
+
if (!(x != null && x.value)) return [];
|
|
5006
|
+
const w = x.value.match(/\{\{(\d+)\}\}/g) || [];
|
|
5007
|
+
return [...new Set(w.map((L) => L.replace(/[{}]/g, "")))];
|
|
4990
5008
|
};
|
|
4991
|
-
|
|
4992
|
-
if (
|
|
4993
|
-
const
|
|
4994
|
-
|
|
5009
|
+
se(() => {
|
|
5010
|
+
if (f) {
|
|
5011
|
+
const x = setTimeout(() => {
|
|
5012
|
+
y(null);
|
|
4995
5013
|
}, 5e3);
|
|
4996
|
-
return () => clearTimeout(
|
|
5014
|
+
return () => clearTimeout(x);
|
|
4997
5015
|
}
|
|
4998
|
-
}, [
|
|
4999
|
-
const
|
|
5000
|
-
var
|
|
5016
|
+
}, [f]);
|
|
5017
|
+
const h = async () => {
|
|
5018
|
+
var x, w, L;
|
|
5001
5019
|
try {
|
|
5002
|
-
if (
|
|
5020
|
+
if (g(!0), y(null), !l.name || !l.body)
|
|
5003
5021
|
throw new Error("Template name and body are required");
|
|
5004
|
-
const
|
|
5005
|
-
if (!
|
|
5022
|
+
const s = localStorage.getItem("account"), b = s ? JSON.parse(s) : { apiKey: "" };
|
|
5023
|
+
if (!b.apiKey)
|
|
5006
5024
|
throw new Error("Please set your API key in the dashboard first");
|
|
5007
|
-
const
|
|
5008
|
-
if (
|
|
5009
|
-
throw new Error(
|
|
5010
|
-
|
|
5025
|
+
const E = await Ke(b, l);
|
|
5026
|
+
if (E.status === "error")
|
|
5027
|
+
throw new Error(E.message);
|
|
5028
|
+
U({
|
|
5011
5029
|
isOpen: !0,
|
|
5012
|
-
templateName: (
|
|
5013
|
-
templateId: (
|
|
5030
|
+
templateName: (x = E.data) == null ? void 0 : x.details[0].template_name,
|
|
5031
|
+
templateId: (w = E.data) == null ? void 0 : w.details[0].template_id,
|
|
5014
5032
|
// @ts-ignore
|
|
5015
|
-
template: (
|
|
5016
|
-
}), d(
|
|
5017
|
-
} catch (
|
|
5018
|
-
|
|
5033
|
+
template: (L = E.data) == null ? void 0 : L.template
|
|
5034
|
+
}), d(ke);
|
|
5035
|
+
} catch (s) {
|
|
5036
|
+
y(s instanceof Error ? s.message : "An error occurred while creating the template");
|
|
5019
5037
|
} finally {
|
|
5020
|
-
|
|
5038
|
+
g(!1);
|
|
5021
5039
|
}
|
|
5022
|
-
},
|
|
5023
|
-
|
|
5040
|
+
}, v = () => {
|
|
5041
|
+
U({ isOpen: !1 }), a ? a() : i ? i("/") : window.history.length > 1 && window.history.back();
|
|
5024
5042
|
};
|
|
5025
5043
|
return /* @__PURE__ */ r("div", { className: "rsp-min-h-screen rsp-bg-[#f5f7fc] rsp-rounded-lg rsp-shadow-sm", children: [
|
|
5026
5044
|
/* @__PURE__ */ r("div", { className: "rsp-max-w-[1200px] rsp-mx-auto rsp-px-6 rsp-h-full", children: [
|
|
@@ -5040,22 +5058,22 @@ function ua({ onCancel: a }) {
|
|
|
5040
5058
|
/* @__PURE__ */ r(
|
|
5041
5059
|
"button",
|
|
5042
5060
|
{
|
|
5043
|
-
onClick: () => m(!
|
|
5061
|
+
onClick: () => m(!p),
|
|
5044
5062
|
className: `rsp-flex rsp-items-center rsp-gap-2 rsp-px-4 rsp-py-2 rsp-rounded-md rsp-text-sm rsp-font-medium rsp-transition-colors
|
|
5045
|
-
${
|
|
5063
|
+
${p ? "rsp-bg-blue-100 rsp-text-blue-700 rsp-border rsp-border-blue-200" : "rsp-bg-gray-100 rsp-text-gray-700 rsp-border rsp-border-gray-200"}`,
|
|
5046
5064
|
children: [
|
|
5047
5065
|
/* @__PURE__ */ r("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
|
|
5048
5066
|
/* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z" }),
|
|
5049
5067
|
/* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M2.458 12C3.732 7.943 7.523 5 12 5c4.478 0 8.268 2.943 9.542 7-1.274 4.057-5.064 7-9.542 7-4.477 0-8.268-2.943-9.542-7z" })
|
|
5050
5068
|
] }),
|
|
5051
|
-
|
|
5069
|
+
p ? "Hide Preview" : "Show Preview"
|
|
5052
5070
|
]
|
|
5053
5071
|
}
|
|
5054
5072
|
)
|
|
5055
5073
|
] })
|
|
5056
5074
|
] }) }),
|
|
5057
|
-
/* @__PURE__ */ r("div", { className: `rsp-py-8 ${
|
|
5058
|
-
/* @__PURE__ */ r("div", { className: `rsp-space-y-8 ${
|
|
5075
|
+
/* @__PURE__ */ r("div", { className: `rsp-py-8 ${p ? "rsp-grid xl:rsp-grid-cols-[1fr,400px] rsp-gap-8" : ""}`, children: [
|
|
5076
|
+
/* @__PURE__ */ r("div", { className: `rsp-space-y-8 ${p ? "" : "rsp-max-w-4xl rsp-mx-auto"}`, children: [
|
|
5059
5077
|
/* @__PURE__ */ r("div", { className: "rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm rsp-space-y-6", children: [
|
|
5060
5078
|
/* @__PURE__ */ r("div", { children: [
|
|
5061
5079
|
/* @__PURE__ */ r("label", { className: "rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2", children: [
|
|
@@ -5068,7 +5086,7 @@ function ua({ onCancel: a }) {
|
|
|
5068
5086
|
{
|
|
5069
5087
|
type: "text",
|
|
5070
5088
|
value: l.name,
|
|
5071
|
-
onChange: (
|
|
5089
|
+
onChange: (x) => d({ ...l, name: x.target.value.replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, "").replace(/_+/g, "_") }),
|
|
5072
5090
|
className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent",
|
|
5073
5091
|
placeholder: "Template name cannot Have capital letters and space"
|
|
5074
5092
|
}
|
|
@@ -5085,7 +5103,7 @@ function ua({ onCancel: a }) {
|
|
|
5085
5103
|
"select",
|
|
5086
5104
|
{
|
|
5087
5105
|
value: l.category,
|
|
5088
|
-
onChange: (
|
|
5106
|
+
onChange: (x) => d({ ...l, category: x.target.value }),
|
|
5089
5107
|
className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent rsp-appearance-none",
|
|
5090
5108
|
children: [
|
|
5091
5109
|
/* @__PURE__ */ e("option", { value: "MARKETING", children: "Marketing" }),
|
|
@@ -5105,9 +5123,9 @@ function ua({ onCancel: a }) {
|
|
|
5105
5123
|
"select",
|
|
5106
5124
|
{
|
|
5107
5125
|
value: l.language,
|
|
5108
|
-
onChange: (
|
|
5126
|
+
onChange: (x) => d({ ...l, language: x.target.value }),
|
|
5109
5127
|
className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent rsp-appearance-none",
|
|
5110
|
-
children:
|
|
5128
|
+
children: Qe.map((x) => /* @__PURE__ */ e("option", { value: x.value, children: x.label }, x.value))
|
|
5111
5129
|
}
|
|
5112
5130
|
),
|
|
5113
5131
|
/* @__PURE__ */ e("div", { className: "rsp-absolute rsp-inset-y-0 rsp-right-0 rsp-flex rsp-items-center rsp-px-2 rsp-pointer-events-none", children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-gray-400", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M19 9l-7 7-7-7" }) }) }),
|
|
@@ -5123,11 +5141,11 @@ function ua({ onCancel: a }) {
|
|
|
5123
5141
|
"select",
|
|
5124
5142
|
{
|
|
5125
5143
|
value: l.type,
|
|
5126
|
-
onChange: (
|
|
5127
|
-
const
|
|
5128
|
-
|
|
5144
|
+
onChange: (x) => {
|
|
5145
|
+
const w = x.target.value;
|
|
5146
|
+
w === "CAROUSEL" && !l.carousel ? d({
|
|
5129
5147
|
...l,
|
|
5130
|
-
type:
|
|
5148
|
+
type: w,
|
|
5131
5149
|
carousel: {
|
|
5132
5150
|
type: "IMAGE",
|
|
5133
5151
|
cards: [{
|
|
@@ -5139,7 +5157,7 @@ function ua({ onCancel: a }) {
|
|
|
5139
5157
|
buttons: []
|
|
5140
5158
|
}]
|
|
5141
5159
|
}
|
|
5142
|
-
}) : d({ ...l, type:
|
|
5160
|
+
}) : d({ ...l, type: w });
|
|
5143
5161
|
},
|
|
5144
5162
|
className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent rsp-appearance-none",
|
|
5145
5163
|
children: [
|
|
@@ -5159,7 +5177,7 @@ function ua({ onCancel: a }) {
|
|
|
5159
5177
|
"select",
|
|
5160
5178
|
{
|
|
5161
5179
|
value: l.enableClickTracking.toString(),
|
|
5162
|
-
onChange: (
|
|
5180
|
+
onChange: (x) => d({ ...l, enableClickTracking: x.target.value === "true" }),
|
|
5163
5181
|
className: "rsp-w-full rsp-px-0 rsp-py-2 rsp-border-0 rsp-border-b rsp-border-gray-300 rsp-text-sm focus:rsp-outline-none focus:rsp-border-blue-500 rsp-bg-transparent rsp-appearance-none",
|
|
5164
5182
|
children: [
|
|
5165
5183
|
/* @__PURE__ */ e("option", { value: "false", children: "False" }),
|
|
@@ -5172,70 +5190,70 @@ function ua({ onCancel: a }) {
|
|
|
5172
5190
|
] })
|
|
5173
5191
|
] })
|
|
5174
5192
|
] }),
|
|
5175
|
-
/* @__PURE__ */ e("div", { className: "rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm", children: /* @__PURE__ */ e(
|
|
5193
|
+
/* @__PURE__ */ e("div", { className: "rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm", children: /* @__PURE__ */ e(da, { template: l, setTemplate: d }) }),
|
|
5176
5194
|
/* @__PURE__ */ r("div", { className: "rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm rsp-pt-6 rsp-border-t rsp-border-gray-200", children: [
|
|
5177
|
-
|
|
5178
|
-
/* @__PURE__ */ e(
|
|
5195
|
+
f && /* @__PURE__ */ r("div", { className: "rsp-mb-4 rsp-flex rsp-items-start rsp-gap-3 rsp-p-4 rsp-rounded-lg rsp-bg-red-50 rsp-border-l-4 rsp-border-l-red-500 rsp-relative rsp-animate-fade-in", children: [
|
|
5196
|
+
/* @__PURE__ */ e(ce, { className: "rsp-w-5 rsp-h-5 rsp-text-red-500 rsp-flex-shrink-0 rsp-mt-0.5" }),
|
|
5179
5197
|
/* @__PURE__ */ r("div", { children: [
|
|
5180
5198
|
/* @__PURE__ */ e("h3", { className: "rsp-text-sm rsp-font-medium rsp-text-red-800", children: "Error" }),
|
|
5181
|
-
/* @__PURE__ */ e("p", { className: "rsp-mt-1 rsp-text-sm rsp-text-red-700", children:
|
|
5199
|
+
/* @__PURE__ */ e("p", { className: "rsp-mt-1 rsp-text-sm rsp-text-red-700", children: f })
|
|
5182
5200
|
] }),
|
|
5183
5201
|
/* @__PURE__ */ e(
|
|
5184
5202
|
"button",
|
|
5185
5203
|
{
|
|
5186
|
-
onClick: () =>
|
|
5204
|
+
onClick: () => y(null),
|
|
5187
5205
|
className: "rsp-absolute rsp-top-2 rsp-right-2 rsp-p-1 hover:rsp-bg-red-100 rsp-rounded-full",
|
|
5188
|
-
children: /* @__PURE__ */ e(
|
|
5206
|
+
children: /* @__PURE__ */ e(ee, { className: "rsp-w-4 rsp-h-4 rsp-text-red-500" })
|
|
5189
5207
|
}
|
|
5190
5208
|
)
|
|
5191
5209
|
] }),
|
|
5192
5210
|
/* @__PURE__ */ e("div", { className: "rsp-flex rsp-gap-4", children: /* @__PURE__ */ e(
|
|
5193
5211
|
"button",
|
|
5194
5212
|
{
|
|
5195
|
-
onClick:
|
|
5196
|
-
disabled:
|
|
5213
|
+
onClick: h,
|
|
5214
|
+
disabled: C || !o(),
|
|
5197
5215
|
className: `rsp-flex-1 rsp-py-3 rsp-px-6 rsp-rounded-md rsp-transition-colors rsp-text-white rsp-font-medium rsp-text-sm
|
|
5198
|
-
${
|
|
5199
|
-
children:
|
|
5216
|
+
${C || !o() ? "rsp-bg-blue-600 rsp-cursor-not-allowed" : "rsp-bg-blue-600 hover:rsp-bg-blue-700 active:rsp-bg-blue-800"}`,
|
|
5217
|
+
children: C ? "Submitting for Approval..." : "Submit for Approval"
|
|
5200
5218
|
}
|
|
5201
5219
|
) })
|
|
5202
5220
|
] })
|
|
5203
5221
|
] }),
|
|
5204
|
-
|
|
5222
|
+
p && /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("div", { className: "rsp-sticky rsp-top-4", children: /* @__PURE__ */ e(oa, { template: l }) }) })
|
|
5205
5223
|
] })
|
|
5206
5224
|
] }),
|
|
5207
5225
|
/* @__PURE__ */ e(
|
|
5208
|
-
|
|
5226
|
+
pe,
|
|
5209
5227
|
{
|
|
5210
|
-
isOpen:
|
|
5211
|
-
onClose:
|
|
5228
|
+
isOpen: j.isOpen,
|
|
5229
|
+
onClose: v,
|
|
5212
5230
|
title: "Success",
|
|
5213
5231
|
children: /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
|
|
5214
5232
|
/* @__PURE__ */ e("div", { className: "rsp-text-center", children: /* @__PURE__ */ e("p", { className: "rsp-text-green-600 rsp-font-medium rsp-mb-4", children: "Template created successfully!" }) }),
|
|
5215
|
-
|
|
5233
|
+
j.templateId && /* @__PURE__ */ r("div", { className: "rsp-bg-gray-50 rsp-p-4 rsp-rounded-lg rsp-space-y-2", children: [
|
|
5216
5234
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
|
|
5217
5235
|
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Template Name:" }),
|
|
5218
|
-
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium", children:
|
|
5236
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium", children: j.templateName })
|
|
5219
5237
|
] }),
|
|
5220
5238
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
|
|
5221
5239
|
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Template ID:" }),
|
|
5222
|
-
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-font-mono", children:
|
|
5240
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-font-mono", children: j.templateId })
|
|
5223
5241
|
] }),
|
|
5224
|
-
((
|
|
5242
|
+
((V = j.template) == null ? void 0 : V.meta_tid) && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
|
|
5225
5243
|
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Meta TID:" }),
|
|
5226
|
-
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-font-mono", children:
|
|
5244
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-font-mono", children: j.template.meta_tid })
|
|
5227
5245
|
] }),
|
|
5228
|
-
((
|
|
5246
|
+
((R = j.template) == null ? void 0 : R.status) && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
|
|
5229
5247
|
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Status:" }),
|
|
5230
5248
|
/* @__PURE__ */ e("span", { className: `rsp-text-sm rsp-font-medium rsp-capitalize ${// @ts-ignore
|
|
5231
|
-
|
|
5249
|
+
j.template.status === "pending" ? "rsp-text-yellow-600" : (
|
|
5232
5250
|
// @ts-ignore
|
|
5233
|
-
|
|
5234
|
-
)}`, children:
|
|
5251
|
+
j.template.status === "approved" ? "rsp-text-green-600" : "rsp-text-red-600"
|
|
5252
|
+
)}`, children: j.template.status })
|
|
5235
5253
|
] }),
|
|
5236
|
-
((
|
|
5254
|
+
((I = j.template) == null ? void 0 : I.quality) && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
|
|
5237
5255
|
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Quality:" }),
|
|
5238
|
-
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-capitalize", children:
|
|
5256
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-capitalize", children: j.template.quality })
|
|
5239
5257
|
] })
|
|
5240
5258
|
] })
|
|
5241
5259
|
] })
|
|
@@ -5243,18 +5261,18 @@ function ua({ onCancel: a }) {
|
|
|
5243
5261
|
)
|
|
5244
5262
|
] });
|
|
5245
5263
|
}
|
|
5246
|
-
const
|
|
5247
|
-
function
|
|
5248
|
-
const i =
|
|
5264
|
+
const fa = Se({});
|
|
5265
|
+
function wa({ apiKey: a, children: n }) {
|
|
5266
|
+
const i = Ne(() => ({ apiKey: a }), [a]);
|
|
5249
5267
|
if (a)
|
|
5250
5268
|
try {
|
|
5251
5269
|
localStorage.setItem("account", JSON.stringify({ apiKey: a }));
|
|
5252
5270
|
} catch {
|
|
5253
5271
|
}
|
|
5254
|
-
return /* @__PURE__ */ e(
|
|
5272
|
+
return /* @__PURE__ */ e(fa.Provider, { value: i, children: n });
|
|
5255
5273
|
}
|
|
5256
5274
|
export {
|
|
5257
|
-
|
|
5258
|
-
|
|
5259
|
-
|
|
5275
|
+
ya as CreateTemplate,
|
|
5276
|
+
ga as Dashboard,
|
|
5277
|
+
wa as TrustSignalProvider
|
|
5260
5278
|
};
|