@resulticks/trustsignal-wa-hsm 0.5.0 → 0.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +60 -25
- package/dist/delete-BgBYMUw2.js +17 -0
- package/dist/delete-CZKt5rSC.cjs +1 -0
- package/dist/resulticks-trustsignal-wa-hsm.cjs.js +35 -20
- package/dist/resulticks-trustsignal-wa-hsm.es.js +1503 -1258
- package/dist/style.css +1 -1
- package/package.json +2 -4
|
@@ -1,17 +1,16 @@
|
|
|
1
|
-
import { jsx as e, jsxs as r, Fragment as
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
const Ve = async (a, n = {}) => {
|
|
1
|
+
import { jsx as e, jsxs as r, Fragment as ce } from "react/jsx-runtime";
|
|
2
|
+
import X, { forwardRef as Ie, createElement as ke, useRef as Te, useEffect as le, useState as B, useMemo as Se, useCallback as Ne, createContext as Be } from "react";
|
|
3
|
+
const Oe = async (a, s = {}) => {
|
|
5
4
|
try {
|
|
6
|
-
return await
|
|
7
|
-
} catch (
|
|
8
|
-
return console.error("API Error:",
|
|
5
|
+
return await Pe(a.apiKey);
|
|
6
|
+
} catch (n) {
|
|
7
|
+
return console.error("API Error:", n), {
|
|
9
8
|
status: "error",
|
|
10
|
-
message:
|
|
9
|
+
message: n instanceof Error ? n.message : "Failed to fetch templates"
|
|
11
10
|
};
|
|
12
11
|
}
|
|
13
|
-
},
|
|
14
|
-
const
|
|
12
|
+
}, Pe = async (a) => {
|
|
13
|
+
const s = await fetch(
|
|
15
14
|
"https://wpapi.trustsignal.io/api/v1/template?page=1&limit=100",
|
|
16
15
|
{
|
|
17
16
|
method: "GET",
|
|
@@ -21,30 +20,30 @@ const Ve = async (a, n = {}) => {
|
|
|
21
20
|
}
|
|
22
21
|
}
|
|
23
22
|
);
|
|
24
|
-
if (!
|
|
25
|
-
throw new Error(`HTTP error! status: ${
|
|
26
|
-
const
|
|
27
|
-
if (!
|
|
28
|
-
throw new Error(
|
|
23
|
+
if (!s.ok)
|
|
24
|
+
throw new Error(`HTTP error! status: ${s.status}`);
|
|
25
|
+
const n = await s.json();
|
|
26
|
+
if (!n.success)
|
|
27
|
+
throw new Error(n.message || "Failed to fetch templates");
|
|
29
28
|
return {
|
|
30
29
|
status: "success",
|
|
31
|
-
data:
|
|
32
|
-
id:
|
|
33
|
-
name:
|
|
34
|
-
category:
|
|
35
|
-
language:
|
|
36
|
-
type:
|
|
37
|
-
body:
|
|
38
|
-
status:
|
|
39
|
-
creation_time: new Date(
|
|
40
|
-
updation_time: new Date(
|
|
41
|
-
medialist:
|
|
42
|
-
shortlink:
|
|
30
|
+
data: n.templates.map((c) => ({
|
|
31
|
+
id: c.id,
|
|
32
|
+
name: c.name,
|
|
33
|
+
category: c.category,
|
|
34
|
+
language: c.lang,
|
|
35
|
+
type: c.temptype || "TEXT",
|
|
36
|
+
body: c.temp_var_data || "",
|
|
37
|
+
status: c.status,
|
|
38
|
+
creation_time: new Date(c.created_at).getTime(),
|
|
39
|
+
updation_time: new Date(c.modified_at).getTime(),
|
|
40
|
+
medialist: c.medialist,
|
|
41
|
+
shortlink: c.shortlink
|
|
43
42
|
})),
|
|
44
43
|
meta: {
|
|
45
|
-
total:
|
|
46
|
-
page:
|
|
47
|
-
limit:
|
|
44
|
+
total: n.totalrecords,
|
|
45
|
+
page: n.page,
|
|
46
|
+
limit: n.limit
|
|
48
47
|
}
|
|
49
48
|
};
|
|
50
49
|
};
|
|
@@ -54,7 +53,7 @@ const Ve = async (a, n = {}) => {
|
|
|
54
53
|
* This source code is licensed under the ISC license.
|
|
55
54
|
* See the LICENSE file in the root directory of this source tree.
|
|
56
55
|
*/
|
|
57
|
-
var
|
|
56
|
+
var ze = {
|
|
58
57
|
xmlns: "http://www.w3.org/2000/svg",
|
|
59
58
|
width: 24,
|
|
60
59
|
height: 24,
|
|
@@ -71,35 +70,35 @@ var Ue = {
|
|
|
71
70
|
* This source code is licensed under the ISC license.
|
|
72
71
|
* See the LICENSE file in the root directory of this source tree.
|
|
73
72
|
*/
|
|
74
|
-
const
|
|
75
|
-
const
|
|
73
|
+
const De = (a) => a.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim(), q = (a, s) => {
|
|
74
|
+
const n = Ie(
|
|
76
75
|
({
|
|
77
|
-
color:
|
|
78
|
-
size:
|
|
79
|
-
strokeWidth:
|
|
80
|
-
absoluteStrokeWidth:
|
|
81
|
-
className:
|
|
76
|
+
color: i = "currentColor",
|
|
77
|
+
size: c = 24,
|
|
78
|
+
strokeWidth: o = 2,
|
|
79
|
+
absoluteStrokeWidth: l,
|
|
80
|
+
className: v = "",
|
|
82
81
|
children: g,
|
|
83
|
-
...
|
|
84
|
-
},
|
|
82
|
+
...h
|
|
83
|
+
}, k) => ke(
|
|
85
84
|
"svg",
|
|
86
85
|
{
|
|
87
|
-
ref:
|
|
88
|
-
...
|
|
89
|
-
width:
|
|
90
|
-
height:
|
|
91
|
-
stroke:
|
|
92
|
-
strokeWidth:
|
|
93
|
-
className: ["lucide", `lucide-${
|
|
94
|
-
...
|
|
86
|
+
ref: k,
|
|
87
|
+
...ze,
|
|
88
|
+
width: c,
|
|
89
|
+
height: c,
|
|
90
|
+
stroke: i,
|
|
91
|
+
strokeWidth: l ? Number(o) * 24 / Number(c) : o,
|
|
92
|
+
className: ["lucide", `lucide-${De(a)}`, v].join(" "),
|
|
93
|
+
...h
|
|
95
94
|
},
|
|
96
95
|
[
|
|
97
|
-
...
|
|
96
|
+
...s.map(([V, d]) => ke(V, d)),
|
|
98
97
|
...Array.isArray(g) ? g : [g]
|
|
99
98
|
]
|
|
100
99
|
)
|
|
101
100
|
);
|
|
102
|
-
return
|
|
101
|
+
return n.displayName = `${a}`, n;
|
|
103
102
|
};
|
|
104
103
|
/**
|
|
105
104
|
* @license lucide-react v0.344.0 - ISC
|
|
@@ -107,7 +106,7 @@ const Ae = (a) => a.replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase().trim(),
|
|
|
107
106
|
* This source code is licensed under the ISC license.
|
|
108
107
|
* See the LICENSE file in the root directory of this source tree.
|
|
109
108
|
*/
|
|
110
|
-
const
|
|
109
|
+
const fe = q("AlertCircle", [
|
|
111
110
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
112
111
|
["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
|
|
113
112
|
["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
|
|
@@ -118,7 +117,7 @@ const ce = H("AlertCircle", [
|
|
|
118
117
|
* This source code is licensed under the ISC license.
|
|
119
118
|
* See the LICENSE file in the root directory of this source tree.
|
|
120
119
|
*/
|
|
121
|
-
const
|
|
120
|
+
const _e = q("ArrowRight", [
|
|
122
121
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
123
122
|
["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
|
|
124
123
|
]);
|
|
@@ -128,7 +127,16 @@ const Re = H("ArrowRight", [
|
|
|
128
127
|
* This source code is licensed under the ISC license.
|
|
129
128
|
* See the LICENSE file in the root directory of this source tree.
|
|
130
129
|
*/
|
|
131
|
-
const
|
|
130
|
+
const Fe = q("ChevronLeft", [
|
|
131
|
+
["path", { d: "m15 18-6-6 6-6", key: "1wnfg3" }]
|
|
132
|
+
]);
|
|
133
|
+
/**
|
|
134
|
+
* @license lucide-react v0.344.0 - ISC
|
|
135
|
+
*
|
|
136
|
+
* This source code is licensed under the ISC license.
|
|
137
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
138
|
+
*/
|
|
139
|
+
const qe = q("ExternalLink", [
|
|
132
140
|
["path", { d: "M15 3h6v6", key: "1q9fwt" }],
|
|
133
141
|
["path", { d: "M10 14 21 3", key: "gplh6r" }],
|
|
134
142
|
["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 +147,7 @@ const Be = H("ExternalLink", [
|
|
|
139
147
|
* This source code is licensed under the ISC license.
|
|
140
148
|
* See the LICENSE file in the root directory of this source tree.
|
|
141
149
|
*/
|
|
142
|
-
const
|
|
150
|
+
const He = q("FileText", [
|
|
143
151
|
["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
152
|
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
145
153
|
["path", { d: "M10 9H8", key: "b1mrlr" }],
|
|
@@ -152,7 +160,7 @@ const Ie = H("FileText", [
|
|
|
152
160
|
* This source code is licensed under the ISC license.
|
|
153
161
|
* See the LICENSE file in the root directory of this source tree.
|
|
154
162
|
*/
|
|
155
|
-
const
|
|
163
|
+
const $e = q("FileVideo", [
|
|
156
164
|
["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
165
|
["path", { d: "M14 2v4a2 2 0 0 0 2 2h4", key: "tnqrlb" }],
|
|
158
166
|
["path", { d: "m10 11 5 3-5 3v-6Z", key: "7ntvm4" }]
|
|
@@ -163,7 +171,7 @@ const ze = H("FileVideo", [
|
|
|
163
171
|
* This source code is licensed under the ISC license.
|
|
164
172
|
* See the LICENSE file in the root directory of this source tree.
|
|
165
173
|
*/
|
|
166
|
-
const
|
|
174
|
+
const Ge = q("Link", [
|
|
167
175
|
["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
176
|
["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
177
|
]);
|
|
@@ -173,7 +181,7 @@ const Oe = H("Link", [
|
|
|
173
181
|
* This source code is licensed under the ISC license.
|
|
174
182
|
* See the LICENSE file in the root directory of this source tree.
|
|
175
183
|
*/
|
|
176
|
-
const
|
|
184
|
+
const me = q("MessageCircle", [
|
|
177
185
|
["path", { d: "M7.9 20A9 9 0 1 0 4 16.1L2 22Z", key: "vv11sd" }]
|
|
178
186
|
]);
|
|
179
187
|
/**
|
|
@@ -182,7 +190,17 @@ const le = H("MessageCircle", [
|
|
|
182
190
|
* This source code is licensed under the ISC license.
|
|
183
191
|
* See the LICENSE file in the root directory of this source tree.
|
|
184
192
|
*/
|
|
185
|
-
const
|
|
193
|
+
const We = q("Pencil", [
|
|
194
|
+
["path", { d: "M17 3a2.85 2.83 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5Z", key: "5qss01" }],
|
|
195
|
+
["path", { d: "m15 5 4 4", key: "1mk7zo" }]
|
|
196
|
+
]);
|
|
197
|
+
/**
|
|
198
|
+
* @license lucide-react v0.344.0 - ISC
|
|
199
|
+
*
|
|
200
|
+
* This source code is licensed under the ISC license.
|
|
201
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
202
|
+
*/
|
|
203
|
+
const Ve = q("Phone", [
|
|
186
204
|
[
|
|
187
205
|
"path",
|
|
188
206
|
{
|
|
@@ -197,7 +215,7 @@ const Me = H("Phone", [
|
|
|
197
215
|
* This source code is licensed under the ISC license.
|
|
198
216
|
* See the LICENSE file in the root directory of this source tree.
|
|
199
217
|
*/
|
|
200
|
-
const
|
|
218
|
+
const he = q("Plus", [
|
|
201
219
|
["path", { d: "M5 12h14", key: "1ays0h" }],
|
|
202
220
|
["path", { d: "M12 5v14", key: "s699le" }]
|
|
203
221
|
]);
|
|
@@ -207,7 +225,7 @@ const de = H("Plus", [
|
|
|
207
225
|
* This source code is licensed under the ISC license.
|
|
208
226
|
* See the LICENSE file in the root directory of this source tree.
|
|
209
227
|
*/
|
|
210
|
-
const
|
|
228
|
+
const Ke = q("Reply", [
|
|
211
229
|
["polyline", { points: "9 17 4 12 9 7", key: "hvgpf2" }],
|
|
212
230
|
["path", { d: "M20 18v-2a4 4 0 0 0-4-4H4", key: "5vmcpk" }]
|
|
213
231
|
]);
|
|
@@ -217,7 +235,7 @@ const Pe = H("Reply", [
|
|
|
217
235
|
* This source code is licensed under the ISC license.
|
|
218
236
|
* See the LICENSE file in the root directory of this source tree.
|
|
219
237
|
*/
|
|
220
|
-
const
|
|
238
|
+
const ue = q("Smile", [
|
|
221
239
|
["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
|
|
222
240
|
["path", { d: "M8 14s1.5 2 4 2 4-2 4-2", key: "1y1vjs" }],
|
|
223
241
|
["line", { x1: "9", x2: "9.01", y1: "9", y2: "9", key: "yxxnd0" }],
|
|
@@ -229,7 +247,20 @@ const xe = H("Smile", [
|
|
|
229
247
|
* This source code is licensed under the ISC license.
|
|
230
248
|
* See the LICENSE file in the root directory of this source tree.
|
|
231
249
|
*/
|
|
232
|
-
const
|
|
250
|
+
const Je = q("Trash2", [
|
|
251
|
+
["path", { d: "M3 6h18", key: "d0wm0j" }],
|
|
252
|
+
["path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6", key: "4alrt4" }],
|
|
253
|
+
["path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2", key: "v07s0e" }],
|
|
254
|
+
["line", { x1: "10", x2: "10", y1: "11", y2: "17", key: "1uufr5" }],
|
|
255
|
+
["line", { x1: "14", x2: "14", y1: "11", y2: "17", key: "xtxkd" }]
|
|
256
|
+
]);
|
|
257
|
+
/**
|
|
258
|
+
* @license lucide-react v0.344.0 - ISC
|
|
259
|
+
*
|
|
260
|
+
* This source code is licensed under the ISC license.
|
|
261
|
+
* See the LICENSE file in the root directory of this source tree.
|
|
262
|
+
*/
|
|
263
|
+
const Xe = q("Upload", [
|
|
233
264
|
["path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4", key: "ih7n3h" }],
|
|
234
265
|
["polyline", { points: "17 8 12 3 7 8", key: "t8dd8p" }],
|
|
235
266
|
["line", { x1: "12", x2: "12", y1: "3", y2: "15", key: "widbto" }]
|
|
@@ -240,7 +271,7 @@ const _e = H("Upload", [
|
|
|
240
271
|
* This source code is licensed under the ISC license.
|
|
241
272
|
* See the LICENSE file in the root directory of this source tree.
|
|
242
273
|
*/
|
|
243
|
-
const
|
|
274
|
+
const Ye = q("Workflow", [
|
|
244
275
|
["rect", { width: "8", height: "8", x: "3", y: "3", rx: "2", key: "by2w9f" }],
|
|
245
276
|
["path", { d: "M7 11v4a2 2 0 0 0 2 2h4", key: "xkn7yn" }],
|
|
246
277
|
["rect", { width: "8", height: "8", x: "13", y: "13", rx: "2", key: "1cgmvn" }]
|
|
@@ -251,88 +282,104 @@ const Fe = H("Workflow", [
|
|
|
251
282
|
* This source code is licensed under the ISC license.
|
|
252
283
|
* See the LICENSE file in the root directory of this source tree.
|
|
253
284
|
*/
|
|
254
|
-
const
|
|
285
|
+
const re = q("X", [
|
|
255
286
|
["path", { d: "M18 6 6 18", key: "1bl5f8" }],
|
|
256
287
|
["path", { d: "m6 6 12 12", key: "d8bk6v" }]
|
|
257
288
|
]);
|
|
258
|
-
function
|
|
259
|
-
const
|
|
260
|
-
return
|
|
261
|
-
const
|
|
262
|
-
|
|
289
|
+
function te({ isOpen: a, onClose: s, title: n, children: i }) {
|
|
290
|
+
const c = Te(null);
|
|
291
|
+
return le(() => {
|
|
292
|
+
const o = (l) => {
|
|
293
|
+
c.current && !c.current.contains(l.target) && s();
|
|
263
294
|
};
|
|
264
|
-
return a && document.addEventListener("mousedown",
|
|
265
|
-
document.removeEventListener("mousedown",
|
|
295
|
+
return a && document.addEventListener("mousedown", o), () => {
|
|
296
|
+
document.removeEventListener("mousedown", o);
|
|
266
297
|
};
|
|
267
|
-
}, [a,
|
|
298
|
+
}, [a, s]), 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: c, 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
299
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-px-6 rsp-py-4 rsp-border-b", children: [
|
|
269
|
-
/* @__PURE__ */ e("h2", { className: "rsp-text-lg rsp-font-semibold rsp-text-gray-900 rsp-text-center rsp-w-full rsp-break-words rsp-break-all rsp-whitespace-pre-wrap", children:
|
|
300
|
+
/* @__PURE__ */ e("h2", { className: "rsp-text-lg rsp-font-semibold rsp-text-gray-900 rsp-text-center rsp-w-full rsp-break-words rsp-break-all rsp-whitespace-pre-wrap", children: n }),
|
|
270
301
|
/* @__PURE__ */ e(
|
|
271
302
|
"button",
|
|
272
303
|
{
|
|
273
|
-
onClick:
|
|
304
|
+
onClick: s,
|
|
274
305
|
className: "rsp-p-1 hover:rsp-bg-gray-100 rsp-rounded-full",
|
|
275
|
-
children: /* @__PURE__ */ e(
|
|
306
|
+
children: /* @__PURE__ */ e(re, { className: "rsp-w-5 rsp-h-5 rsp-text-gray-500" })
|
|
276
307
|
}
|
|
277
308
|
)
|
|
278
309
|
] }),
|
|
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:
|
|
310
|
+
/* @__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: i })
|
|
280
311
|
] }) }) : null;
|
|
281
312
|
}
|
|
282
|
-
function
|
|
283
|
-
const
|
|
284
|
-
const
|
|
285
|
-
return
|
|
313
|
+
function Ta({ onCreateTemplate: a, onEditTemplate: s }) {
|
|
314
|
+
const [n, i] = B([]), [c, o] = B(!0), [l, v] = B(null), [g, h] = B(null), [k, V] = B({ isOpen: !1 }), [d, N] = B(() => {
|
|
315
|
+
const u = localStorage.getItem("account");
|
|
316
|
+
return u ? JSON.parse(u) : {
|
|
286
317
|
apiKey: ""
|
|
287
318
|
};
|
|
288
|
-
}), [
|
|
289
|
-
|
|
319
|
+
}), [M, b] = B(""), [y, t] = B("all"), [x, p] = B("all"), [w] = B("all"), [A, R] = B(1), f = 20, [C, U] = B({ isOpen: !1 });
|
|
320
|
+
le(() => {
|
|
290
321
|
(async () => {
|
|
291
322
|
try {
|
|
292
|
-
if (
|
|
293
|
-
|
|
323
|
+
if (v(null), o(!0), i([]), !d.apiKey) {
|
|
324
|
+
v("Please enter your TrustSignal API key"), o(!1);
|
|
294
325
|
return;
|
|
295
326
|
}
|
|
296
|
-
const
|
|
327
|
+
const T = await Oe(d, {
|
|
297
328
|
limit: 1e3
|
|
298
329
|
});
|
|
299
|
-
if (
|
|
300
|
-
throw new Error(
|
|
301
|
-
i(
|
|
302
|
-
} catch (
|
|
303
|
-
|
|
330
|
+
if (T.status === "error")
|
|
331
|
+
throw new Error(T.message);
|
|
332
|
+
i(T.data);
|
|
333
|
+
} catch (T) {
|
|
334
|
+
v(T instanceof Error ? T.message : "Failed to fetch templates"), i([]);
|
|
304
335
|
} finally {
|
|
305
|
-
|
|
336
|
+
o(!1);
|
|
306
337
|
}
|
|
307
338
|
})();
|
|
308
|
-
}, [
|
|
309
|
-
const
|
|
310
|
-
const { name:
|
|
311
|
-
...
|
|
312
|
-
[
|
|
339
|
+
}, [d]);
|
|
340
|
+
const O = (u) => {
|
|
341
|
+
const { name: T, value: D } = u.target, K = {
|
|
342
|
+
...d,
|
|
343
|
+
[T]: D
|
|
313
344
|
};
|
|
314
|
-
|
|
315
|
-
},
|
|
316
|
-
|
|
345
|
+
N(K), localStorage.setItem("account", JSON.stringify(K));
|
|
346
|
+
}, P = (u, T) => {
|
|
347
|
+
U({
|
|
317
348
|
isOpen: !0,
|
|
318
|
-
url:
|
|
319
|
-
templateName:
|
|
349
|
+
url: u,
|
|
350
|
+
templateName: T
|
|
320
351
|
});
|
|
321
|
-
},
|
|
322
|
-
|
|
323
|
-
},
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
352
|
+
}, H = () => {
|
|
353
|
+
U({ isOpen: !1 });
|
|
354
|
+
}, m = async (u) => {
|
|
355
|
+
try {
|
|
356
|
+
const T = localStorage.getItem("account"), D = T ? JSON.parse(T) : { apiKey: "" };
|
|
357
|
+
if (!D.apiKey) {
|
|
358
|
+
v("Please enter your TrustSignal API key");
|
|
359
|
+
return;
|
|
360
|
+
}
|
|
361
|
+
h(u);
|
|
362
|
+
const { deleteTemplateById: K } = await import("./delete-BgBYMUw2.js"), L = await K(D.apiKey, u);
|
|
363
|
+
if (!L.success) throw new Error(L.message || "Delete failed");
|
|
364
|
+
i((Y) => Y.filter((_) => _.id !== u)), V({ isOpen: !1 });
|
|
365
|
+
} catch (T) {
|
|
366
|
+
v(T instanceof Error ? T.message : "Failed to delete template");
|
|
367
|
+
} finally {
|
|
368
|
+
h(null);
|
|
369
|
+
}
|
|
370
|
+
}, E = n.filter((u) => {
|
|
371
|
+
const T = M.trim(), D = T.toLowerCase(), K = T === "" || u.id.toString().includes(T) || u.name.toLowerCase().includes(D), L = y === "all" || u.status.toLowerCase() === y.toLowerCase(), Y = x === "all" || u.category.toLowerCase() === x.toLowerCase(), _ = w === "all" || u.language.toLowerCase().startsWith(w.toLowerCase());
|
|
372
|
+
return K && L && Y && _;
|
|
373
|
+
}), S = Math.ceil(E.length / f), j = (A - 1) * f, I = j + f, z = E.slice(j, I);
|
|
374
|
+
return c ? /* @__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
375
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between rsp-items-center rsp-mb-6", children: [
|
|
329
376
|
/* @__PURE__ */ e("h1", { className: "rsp-text-2xl rsp-font-bold", children: "Whatsapp HSM Templates" }),
|
|
330
377
|
/* @__PURE__ */ e(
|
|
331
378
|
"button",
|
|
332
379
|
{
|
|
333
|
-
onClick: () => a(
|
|
380
|
+
onClick: () => a == null ? void 0 : a(),
|
|
334
381
|
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(
|
|
382
|
+
children: /* @__PURE__ */ e(he, { className: "rsp-w-6 rsp-h-6" })
|
|
336
383
|
}
|
|
337
384
|
)
|
|
338
385
|
] }),
|
|
@@ -344,8 +391,8 @@ function ga() {
|
|
|
344
391
|
{
|
|
345
392
|
type: "password",
|
|
346
393
|
name: "apiKey",
|
|
347
|
-
value:
|
|
348
|
-
onChange:
|
|
394
|
+
value: d.apiKey,
|
|
395
|
+
onChange: O,
|
|
349
396
|
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
397
|
placeholder: "Enter your TrustSignal API key"
|
|
351
398
|
}
|
|
@@ -353,17 +400,17 @@ function ga() {
|
|
|
353
400
|
/* @__PURE__ */ e("div", { className: "rsp-absolute rsp-bottom-0 rsp-left-0 rsp-w-4 rsp-h-0.5 rsp-bg-red-500" })
|
|
354
401
|
] })
|
|
355
402
|
] }) }),
|
|
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:
|
|
403
|
+
l && /* @__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: [
|
|
404
|
+
/* @__PURE__ */ e("div", { className: "rsp-flex-shrink-0", children: /* @__PURE__ */ e(fe, { className: "rsp-h-5 rsp-w-5 rsp-text-red-400" }) }),
|
|
405
|
+
/* @__PURE__ */ e("div", { className: "rsp-ml-3", children: /* @__PURE__ */ e("p", { className: "rsp-text-sm rsp-text-red-700", children: l }) })
|
|
359
406
|
] }) }),
|
|
360
407
|
/* @__PURE__ */ e("div", { className: "rsp-mb-6", children: /* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
|
|
361
408
|
"input",
|
|
362
409
|
{
|
|
363
410
|
type: "text",
|
|
364
411
|
placeholder: "Search by name or ID...",
|
|
365
|
-
value:
|
|
366
|
-
onChange: (
|
|
412
|
+
value: M,
|
|
413
|
+
onChange: (u) => b(u.target.value),
|
|
367
414
|
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
415
|
}
|
|
369
416
|
) }) }),
|
|
@@ -376,10 +423,10 @@ function ga() {
|
|
|
376
423
|
/* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center", children: /* @__PURE__ */ r(
|
|
377
424
|
"select",
|
|
378
425
|
{
|
|
379
|
-
value:
|
|
380
|
-
onChange: (
|
|
426
|
+
value: x,
|
|
427
|
+
onChange: (u) => p(u.target.value),
|
|
381
428
|
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: (
|
|
429
|
+
onClick: (u) => u.stopPropagation(),
|
|
383
430
|
children: [
|
|
384
431
|
/* @__PURE__ */ e("option", { value: "all", className: "rsp-text-gray-900", children: "All" }),
|
|
385
432
|
/* @__PURE__ */ e("option", { value: "utility", className: "rsp-text-gray-900", children: "Utility" }),
|
|
@@ -395,10 +442,10 @@ function ga() {
|
|
|
395
442
|
/* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center", children: /* @__PURE__ */ r(
|
|
396
443
|
"select",
|
|
397
444
|
{
|
|
398
|
-
value:
|
|
399
|
-
onChange: (
|
|
445
|
+
value: y,
|
|
446
|
+
onChange: (u) => t(u.target.value),
|
|
400
447
|
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: (
|
|
448
|
+
onClick: (u) => u.stopPropagation(),
|
|
402
449
|
children: [
|
|
403
450
|
/* @__PURE__ */ e("option", { value: "all", className: "rsp-text-gray-900", children: "All" }),
|
|
404
451
|
/* @__PURE__ */ e("option", { value: "pending", className: "rsp-text-gray-900", children: "Pending" }),
|
|
@@ -410,75 +457,94 @@ function ga() {
|
|
|
410
457
|
] }) }),
|
|
411
458
|
/* @__PURE__ */ e("th", { className: "rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium", children: "Created" }),
|
|
412
459
|
/* @__PURE__ */ e("th", { className: "rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium", children: "Updated" }),
|
|
413
|
-
/* @__PURE__ */ e("th", { className: "rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium", children: "Media" })
|
|
460
|
+
/* @__PURE__ */ e("th", { className: "rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium", children: "Media" }),
|
|
461
|
+
/* @__PURE__ */ e("th", { className: "rsp-px-6 rsp-py-3 rsp-text-left rsp-text-sm rsp-font-medium", children: "Actions" })
|
|
414
462
|
] }) }),
|
|
415
|
-
/* @__PURE__ */ e("tbody", { children:
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
"
|
|
419
|
-
|
|
420
|
-
className:
|
|
421
|
-
children:
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
463
|
+
/* @__PURE__ */ e("tbody", { children: z.length > 0 ? z.map((u, T) => /* @__PURE__ */ r(
|
|
464
|
+
"tr",
|
|
465
|
+
{
|
|
466
|
+
className: `rsp-border-b rsp-border-gray-200 ${T % 2 === 0 ? "rsp-bg-white" : "rsp-bg-blue-50"} hover:rsp-bg-blue-100 rsp-transition-colors`,
|
|
467
|
+
children: [
|
|
468
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900", children: u.id }),
|
|
469
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-900 rsp-font-medium", children: u.name }),
|
|
470
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700 rsp-capitalize", children: u.category }),
|
|
471
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: u.language }),
|
|
472
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: u.type }),
|
|
473
|
+
/* @__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
|
|
474
|
+
${u.status.toLowerCase() === "approved" ? "rsp-bg-green-100 rsp-text-green-800" : u.status.toLowerCase() === "rejected" ? "rsp-bg-red-100 rsp-text-red-800" : "rsp-bg-yellow-100 rsp-text-yellow-800"}`, children: u.status }) }),
|
|
475
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: u.creation_time ? new Date(u.creation_time).toLocaleDateString() : "N/A" }),
|
|
476
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: u.updation_time ? new Date(u.updation_time).toLocaleDateString() : "N/A" }),
|
|
477
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4 rsp-text-sm rsp-text-gray-700", children: u.medialist && typeof u.medialist == "object" && "header" in u.medialist && u.medialist.header ? /* @__PURE__ */ r(
|
|
478
|
+
"button",
|
|
479
|
+
{
|
|
480
|
+
onClick: () => P(String(u.medialist.header || ""), u.name),
|
|
481
|
+
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",
|
|
482
|
+
children: [
|
|
483
|
+
/* @__PURE__ */ r("svg", { className: "rsp-w-3 rsp-h-3 rsp-mr-1", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
|
|
484
|
+
/* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z" }),
|
|
485
|
+
/* @__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" })
|
|
486
|
+
] }),
|
|
487
|
+
/* @__PURE__ */ e("span", { children: "View Media" })
|
|
488
|
+
]
|
|
489
|
+
}
|
|
490
|
+
) : /* @__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" }) }),
|
|
491
|
+
/* @__PURE__ */ e("td", { className: "rsp-px-6 rsp-py-4", children: /* @__PURE__ */ r("div", { className: "rsp-flex rsp-gap-2", children: [
|
|
492
|
+
/* @__PURE__ */ e(
|
|
432
493
|
"button",
|
|
433
494
|
{
|
|
434
|
-
onClick: () =>
|
|
435
|
-
className: "rsp-inline-flex rsp-items-center rsp-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
/* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z" }),
|
|
439
|
-
/* @__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" })
|
|
440
|
-
] }),
|
|
441
|
-
/* @__PURE__ */ e("span", { children: "View Media" })
|
|
442
|
-
]
|
|
495
|
+
onClick: () => s == null ? void 0 : s(String(u.id)),
|
|
496
|
+
className: "rsp-inline-flex rsp-items-center rsp-justify-center rsp-w-8 rsp-h-8 rsp-rounded rsp-bg-blue-600 rsp-text-white hover:rsp-bg-blue-700 rsp-transition-colors",
|
|
497
|
+
title: "Update",
|
|
498
|
+
children: /* @__PURE__ */ e(We, { className: "rsp-w-4 rsp-h-4" })
|
|
443
499
|
}
|
|
444
|
-
)
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
500
|
+
),
|
|
501
|
+
/* @__PURE__ */ e(
|
|
502
|
+
"button",
|
|
503
|
+
{
|
|
504
|
+
onClick: () => V({ isOpen: !0, templateId: String(u.id), templateName: u.name }),
|
|
505
|
+
disabled: g === u.id,
|
|
506
|
+
className: `rsp-inline-flex rsp-items-center rsp-justify-center rsp-w-8 rsp-h-8 rsp-rounded rsp-text-white rsp-transition-colors ${g === u.id ? "rsp-bg-red-400" : "rsp-bg-red-600 hover:rsp-bg-red-700"}`,
|
|
507
|
+
title: g === u.id ? "Deleting..." : "Delete",
|
|
508
|
+
children: /* @__PURE__ */ e(Je, { className: "rsp-w-4 rsp-h-4" })
|
|
509
|
+
}
|
|
510
|
+
)
|
|
511
|
+
] }) })
|
|
512
|
+
]
|
|
513
|
+
},
|
|
514
|
+
u.id
|
|
515
|
+
)) : /* @__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
516
|
] }) }) }),
|
|
451
|
-
|
|
517
|
+
z.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
518
|
/* @__PURE__ */ r("div", { className: "rsp-text-sm rsp-text-gray-700", children: [
|
|
453
519
|
"Showing ",
|
|
454
|
-
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children:
|
|
520
|
+
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children: j + 1 }),
|
|
455
521
|
" to ",
|
|
456
|
-
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children: Math.min(
|
|
522
|
+
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children: Math.min(I, E.length) }),
|
|
457
523
|
" of ",
|
|
458
|
-
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children:
|
|
524
|
+
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children: E.length }),
|
|
459
525
|
" results"
|
|
460
526
|
] }),
|
|
461
527
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-gap-2", children: [
|
|
462
528
|
/* @__PURE__ */ e(
|
|
463
529
|
"button",
|
|
464
530
|
{
|
|
465
|
-
onClick: () =>
|
|
466
|
-
disabled:
|
|
531
|
+
onClick: () => R((u) => Math.max(u - 1, 1)),
|
|
532
|
+
disabled: A === 1,
|
|
467
533
|
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
534
|
children: "Previous"
|
|
469
535
|
}
|
|
470
536
|
),
|
|
471
537
|
/* @__PURE__ */ r("span", { className: "rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-gray-700", children: [
|
|
472
538
|
"Page ",
|
|
473
|
-
|
|
539
|
+
A,
|
|
474
540
|
" of ",
|
|
475
|
-
|
|
541
|
+
S
|
|
476
542
|
] }),
|
|
477
543
|
/* @__PURE__ */ e(
|
|
478
544
|
"button",
|
|
479
545
|
{
|
|
480
|
-
onClick: () =>
|
|
481
|
-
disabled:
|
|
546
|
+
onClick: () => R((u) => Math.min(u + 1, S)),
|
|
547
|
+
disabled: A === S,
|
|
482
548
|
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
549
|
children: "Next"
|
|
484
550
|
}
|
|
@@ -486,34 +552,32 @@ function ga() {
|
|
|
486
552
|
] })
|
|
487
553
|
] }),
|
|
488
554
|
/* @__PURE__ */ e(
|
|
489
|
-
|
|
555
|
+
te,
|
|
490
556
|
{
|
|
491
|
-
isOpen:
|
|
492
|
-
onClose:
|
|
493
|
-
title: `Media - ${
|
|
557
|
+
isOpen: C.isOpen,
|
|
558
|
+
onClose: H,
|
|
559
|
+
title: `Media - ${C.templateName || "Template"}`,
|
|
494
560
|
children: /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
|
|
495
|
-
|
|
561
|
+
C.url && /* @__PURE__ */ r("div", { className: "rsp-text-center", children: [
|
|
496
562
|
/* @__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
563
|
/* @__PURE__ */ e(
|
|
498
564
|
"img",
|
|
499
565
|
{
|
|
500
|
-
src:
|
|
566
|
+
src: C.url,
|
|
501
567
|
alt: "Template media",
|
|
502
568
|
className: "rsp-max-w-full rsp-max-h-[400px] rsp-mx-auto rsp-rounded-lg rsp-shadow-md rsp-object-contain",
|
|
503
|
-
onLoad: (
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
M && (M.style.display = "none");
|
|
569
|
+
onLoad: (u) => {
|
|
570
|
+
const T = u.currentTarget.parentElement, D = T == null ? void 0 : T.querySelector(".loading-placeholder");
|
|
571
|
+
D && (D.style.display = "none");
|
|
507
572
|
},
|
|
508
|
-
onError: (
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
M && (M.style.display = "block");
|
|
573
|
+
onError: (u) => {
|
|
574
|
+
u.currentTarget.style.display = "none";
|
|
575
|
+
const T = u.currentTarget.parentElement, D = T == null ? void 0 : T.querySelector(".error-placeholder");
|
|
576
|
+
D && (D.style.display = "block");
|
|
513
577
|
}
|
|
514
578
|
}
|
|
515
579
|
),
|
|
516
|
-
|
|
580
|
+
c && /* @__PURE__ */ e("div", { className: "loading-placeholder rsp-absolute rsp-inset-0 rsp-flex rsp-items-center rsp-justify-center", children: /* @__PURE__ */ e("div", { className: "rsp-text-gray-500 rsp-text-sm", children: "Loading media..." }) }),
|
|
517
581
|
/* @__PURE__ */ r("div", { className: "error-placeholder rsp-absolute rsp-inset-0 rsp-flex rsp-flex-col rsp-items-center rsp-justify-center", style: { display: "none" }, children: [
|
|
518
582
|
/* @__PURE__ */ e("svg", { className: "rsp-w-[100%] rsp-h-12 rsp-text-gray-400 rsp-m-2", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__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" }) }),
|
|
519
583
|
/* @__PURE__ */ e("p", { className: "rsp-text-gray-500 rsp-text-sm rsp-mb-2", children: "Load media on new tab" })
|
|
@@ -521,13 +585,13 @@ function ga() {
|
|
|
521
585
|
] }),
|
|
522
586
|
/* @__PURE__ */ r("div", { className: "rsp-mt-4 rsp-p-3 rsp-bg-gray-50 rsp-rounded-lg", children: [
|
|
523
587
|
/* @__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:
|
|
588
|
+
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-800 rsp-break-all rsp-font-mono", children: C.url })
|
|
525
589
|
] })
|
|
526
590
|
] }),
|
|
527
591
|
/* @__PURE__ */ e("div", { className: "rsp-flex rsp-justify-end rsp-pt-4", children: /* @__PURE__ */ r(
|
|
528
592
|
"a",
|
|
529
593
|
{
|
|
530
|
-
href:
|
|
594
|
+
href: C.url,
|
|
531
595
|
target: "_blank",
|
|
532
596
|
rel: "noopener noreferrer",
|
|
533
597
|
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",
|
|
@@ -539,291 +603,457 @@ function ga() {
|
|
|
539
603
|
) })
|
|
540
604
|
] })
|
|
541
605
|
}
|
|
606
|
+
),
|
|
607
|
+
/* @__PURE__ */ e(
|
|
608
|
+
te,
|
|
609
|
+
{
|
|
610
|
+
isOpen: k.isOpen,
|
|
611
|
+
onClose: () => V({ isOpen: !1 }),
|
|
612
|
+
title: "Delete Template",
|
|
613
|
+
children: /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
|
|
614
|
+
/* @__PURE__ */ r("p", { className: "rsp-text-sm rsp-text-gray-700", children: [
|
|
615
|
+
"Are you sure you want to delete the template ",
|
|
616
|
+
/* @__PURE__ */ e("span", { className: "rsp-font-medium", children: k.templateName }),
|
|
617
|
+
"?"
|
|
618
|
+
] }),
|
|
619
|
+
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-end rsp-gap-3", children: [
|
|
620
|
+
/* @__PURE__ */ e("button", { onClick: () => V({ isOpen: !1 }), 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", children: "Cancel" }),
|
|
621
|
+
/* @__PURE__ */ e(
|
|
622
|
+
"button",
|
|
623
|
+
{
|
|
624
|
+
onClick: () => k.templateId && m(k.templateId),
|
|
625
|
+
className: "rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-white rsp-bg-red-600 rsp-rounded-md hover:rsp-bg-red-700",
|
|
626
|
+
children: "Delete"
|
|
627
|
+
}
|
|
628
|
+
)
|
|
629
|
+
] })
|
|
630
|
+
] })
|
|
631
|
+
}
|
|
542
632
|
)
|
|
543
633
|
] });
|
|
544
634
|
}
|
|
545
|
-
const
|
|
546
|
-
var
|
|
635
|
+
const Qe = async (a, s) => {
|
|
636
|
+
var n, i, c, o, l, v, g;
|
|
547
637
|
try {
|
|
548
|
-
console.log("Creating template with data:",
|
|
549
|
-
const
|
|
550
|
-
let
|
|
551
|
-
|
|
552
|
-
const
|
|
638
|
+
console.log("Creating template with data:", s);
|
|
639
|
+
const h = s.language, k = s.headerType === "MEDIA" && s.mediaType === "DOCUMENT", V = s.type === "CAROUSEL";
|
|
640
|
+
let d = "";
|
|
641
|
+
k ? d = Ue(s, h) : V ? d = Ae(s, h) : d = je(s, h), console.log("Raw JSON string being sent:", d);
|
|
642
|
+
const N = {
|
|
553
643
|
method: "POST",
|
|
554
644
|
headers: {
|
|
555
645
|
"Content-Type": "application/json"
|
|
556
646
|
},
|
|
557
|
-
body:
|
|
647
|
+
body: d,
|
|
558
648
|
redirect: "follow"
|
|
559
649
|
};
|
|
560
650
|
console.log(
|
|
561
651
|
"Making request to:",
|
|
562
652
|
`https://wpapi.trustsignal.io/api/v1/template?api_key=${a}`
|
|
563
|
-
), console.log("Request options:",
|
|
564
|
-
const
|
|
653
|
+
), console.log("Request options:", N);
|
|
654
|
+
const M = await fetch(
|
|
565
655
|
`https://wpapi.trustsignal.io/api/v1/template?api_key=${a}`,
|
|
566
|
-
|
|
656
|
+
N
|
|
567
657
|
);
|
|
568
|
-
console.log("Response status:",
|
|
658
|
+
console.log("Response status:", M.status), console.log(
|
|
569
659
|
"Response headers:",
|
|
570
|
-
Object.fromEntries(
|
|
660
|
+
Object.fromEntries(M.headers.entries())
|
|
571
661
|
);
|
|
572
|
-
const
|
|
573
|
-
console.log("Raw response:",
|
|
574
|
-
const
|
|
575
|
-
if (console.log("Parsed response:",
|
|
576
|
-
throw new Error(
|
|
662
|
+
const b = await M.text();
|
|
663
|
+
console.log("Raw response:", b);
|
|
664
|
+
const y = JSON.parse(b);
|
|
665
|
+
if (console.log("Parsed response:", y), !y.success)
|
|
666
|
+
throw new Error(y.message || "Template creation failed");
|
|
577
667
|
return {
|
|
578
668
|
status: "success",
|
|
579
669
|
message: "Template created successfully",
|
|
580
670
|
data: {
|
|
581
|
-
template:
|
|
671
|
+
template: y.template,
|
|
582
672
|
details: [
|
|
583
673
|
{
|
|
584
|
-
template_name: ((
|
|
585
|
-
template_id: ((
|
|
586
|
-
meta_tid: (
|
|
587
|
-
status: (
|
|
588
|
-
quality: (
|
|
589
|
-
temp_route: (
|
|
590
|
-
temptype: (g =
|
|
674
|
+
template_name: ((n = y.template) == null ? void 0 : n.name) || s.name,
|
|
675
|
+
template_id: ((i = y.template) == null ? void 0 : i.id) || "unknown",
|
|
676
|
+
meta_tid: (c = y.template) == null ? void 0 : c.meta_tid,
|
|
677
|
+
status: (o = y.template) == null ? void 0 : o.status,
|
|
678
|
+
quality: (l = y.template) == null ? void 0 : l.quality,
|
|
679
|
+
temp_route: (v = y.template) == null ? void 0 : v.temp_route,
|
|
680
|
+
temptype: (g = y.template) == null ? void 0 : g.temptype
|
|
591
681
|
}
|
|
592
682
|
]
|
|
593
683
|
}
|
|
594
684
|
};
|
|
595
|
-
} catch (
|
|
596
|
-
return console.error("TrustSignal API Error:",
|
|
685
|
+
} catch (h) {
|
|
686
|
+
return console.error("TrustSignal API Error:", h), {
|
|
597
687
|
status: "error",
|
|
598
|
-
message:
|
|
688
|
+
message: h instanceof Error ? h.message : "Failed to create template"
|
|
599
689
|
};
|
|
600
690
|
}
|
|
601
|
-
}
|
|
602
|
-
|
|
603
|
-
const i =
|
|
691
|
+
};
|
|
692
|
+
function Ze(a) {
|
|
693
|
+
const s = a.language, n = a.headerType === "MEDIA" && a.mediaType === "DOCUMENT", i = a.type === "CAROUSEL";
|
|
694
|
+
return n ? Ue(a, s) : i ? Ae(a, s) : je(a, s);
|
|
695
|
+
}
|
|
696
|
+
const Ue = (a, s) => {
|
|
697
|
+
var o, l;
|
|
698
|
+
const n = {
|
|
604
699
|
name: a.name,
|
|
605
|
-
lang:
|
|
700
|
+
lang: s,
|
|
606
701
|
category: a.category,
|
|
607
702
|
components: []
|
|
608
703
|
// Components should be an array
|
|
609
704
|
};
|
|
610
|
-
a.headerType === "MEDIA" && a.mediaUrl && (
|
|
705
|
+
a.headerType === "MEDIA" && a.mediaUrl && (n.media = {
|
|
611
706
|
header: a.mediaUrl
|
|
612
|
-
},
|
|
707
|
+
}, n.components.push({
|
|
613
708
|
type: "HEADER",
|
|
614
709
|
format: "DOCUMENT"
|
|
615
710
|
}));
|
|
616
|
-
const
|
|
711
|
+
const i = ee(a.body), c = {
|
|
617
712
|
type: "BODY",
|
|
618
713
|
text: a.body
|
|
619
714
|
};
|
|
620
|
-
if (
|
|
621
|
-
const
|
|
622
|
-
|
|
623
|
-
body_text: [
|
|
715
|
+
if (i.length > 0 && ((o = a.sampleContent) != null && o.bodyVariables)) {
|
|
716
|
+
const v = ge(a, i);
|
|
717
|
+
c.example = {
|
|
718
|
+
body_text: [v]
|
|
624
719
|
// This creates the required nested array
|
|
625
720
|
};
|
|
626
721
|
}
|
|
627
|
-
if (
|
|
722
|
+
if (n.components.push(c), (l = a.footer) != null && l.trim() && n.components.push({
|
|
628
723
|
type: "FOOTER",
|
|
629
724
|
text: a.footer
|
|
630
725
|
}), a.buttons && a.buttons.length > 0) {
|
|
631
|
-
const
|
|
632
|
-
var
|
|
633
|
-
const
|
|
726
|
+
const v = a.buttons.map((g) => {
|
|
727
|
+
var k;
|
|
728
|
+
const h = {
|
|
634
729
|
type: g.type === "CALL" ? "PHONE_NUMBER" : g.type,
|
|
635
730
|
text: g.text
|
|
636
731
|
};
|
|
637
|
-
if (g.type === "URL" && g.value && (
|
|
638
|
-
const
|
|
639
|
-
if (
|
|
640
|
-
const
|
|
641
|
-
({ number:
|
|
642
|
-
var
|
|
643
|
-
return ((
|
|
732
|
+
if (g.type === "URL" && g.value && (h.url = g.value, g.urlType === "dynamic" && g.value.includes("{{"))) {
|
|
733
|
+
const V = ee(g.value);
|
|
734
|
+
if (V.length > 0 && ((k = a.sampleContent) != null && k.buttonVariables)) {
|
|
735
|
+
const d = V.map(
|
|
736
|
+
({ number: N }) => {
|
|
737
|
+
var M, b;
|
|
738
|
+
return ((b = (M = a.sampleContent) == null ? void 0 : M.buttonVariables) == null ? void 0 : b[N]) || `sample${N}`;
|
|
644
739
|
}
|
|
645
740
|
);
|
|
646
|
-
|
|
741
|
+
h.example = d;
|
|
647
742
|
}
|
|
648
743
|
}
|
|
649
|
-
return (g.type === "CALL" || g.type === "PHONE_NUMBER") && g.value && (
|
|
744
|
+
return (g.type === "CALL" || g.type === "PHONE_NUMBER") && g.value && (h.phone_number = be(g.value)), h;
|
|
650
745
|
});
|
|
651
|
-
|
|
746
|
+
n.components.push({
|
|
652
747
|
type: "BUTTONS",
|
|
653
|
-
buttons:
|
|
748
|
+
buttons: v
|
|
654
749
|
});
|
|
655
750
|
}
|
|
656
|
-
return JSON.stringify(
|
|
657
|
-
},
|
|
658
|
-
var
|
|
659
|
-
const
|
|
751
|
+
return JSON.stringify(n);
|
|
752
|
+
}, Ae = (a, s) => {
|
|
753
|
+
var l, v, g;
|
|
754
|
+
const n = {
|
|
660
755
|
name: a.name,
|
|
661
|
-
lang:
|
|
756
|
+
lang: s,
|
|
662
757
|
category: a.category,
|
|
663
758
|
shortlink: a.enableClickTracking ? "1" : "0",
|
|
664
759
|
components: []
|
|
665
760
|
};
|
|
666
|
-
(
|
|
667
|
-
|
|
761
|
+
(l = a.carousel) != null && l.cards.length && (n.media = {}, a.carousel.cards.forEach((h, k) => {
|
|
762
|
+
h.mediaUrl && (n.media[`card${k}header`] = h.mediaUrl);
|
|
668
763
|
}));
|
|
669
|
-
const
|
|
764
|
+
const i = [], c = ee(a.body), o = {
|
|
670
765
|
type: "BODY",
|
|
671
766
|
text: a.body,
|
|
672
|
-
...
|
|
767
|
+
...c.length > 0 && ((v = a.sampleContent) == null ? void 0 : v.bodyVariables) && {
|
|
673
768
|
example: {
|
|
674
|
-
body_text: [
|
|
769
|
+
body_text: [ge(a, c)]
|
|
675
770
|
}
|
|
676
771
|
}
|
|
677
772
|
};
|
|
678
|
-
if (
|
|
679
|
-
const
|
|
773
|
+
if (i.push(o), (g = a.carousel) != null && g.cards.length) {
|
|
774
|
+
const h = {
|
|
680
775
|
type: "CAROUSEL",
|
|
681
|
-
cards: a.carousel.cards.map((
|
|
682
|
-
var
|
|
776
|
+
cards: a.carousel.cards.map((k) => {
|
|
777
|
+
var V;
|
|
683
778
|
return {
|
|
684
779
|
components: [
|
|
685
780
|
{
|
|
686
781
|
type: "HEADER",
|
|
687
|
-
format: ((
|
|
782
|
+
format: ((V = a.carousel) == null ? void 0 : V.type) || "IMAGE"
|
|
688
783
|
},
|
|
689
784
|
{
|
|
690
785
|
type: "BODY",
|
|
691
|
-
text:
|
|
692
|
-
...
|
|
786
|
+
text: k.body,
|
|
787
|
+
...ee(k.body).length > 0 && {
|
|
693
788
|
example: {
|
|
694
|
-
body_text: [
|
|
789
|
+
body_text: [ea(k)]
|
|
695
790
|
}
|
|
696
791
|
}
|
|
697
792
|
},
|
|
698
|
-
...
|
|
793
|
+
...k.buttons.length > 0 ? [{
|
|
699
794
|
type: "BUTTONS",
|
|
700
|
-
buttons:
|
|
701
|
-
var
|
|
795
|
+
buttons: k.buttons.map((d) => {
|
|
796
|
+
var M;
|
|
702
797
|
const N = {
|
|
703
|
-
type:
|
|
704
|
-
text:
|
|
798
|
+
type: d.type === "CALL" ? "PHONE_NUMBER" : d.type,
|
|
799
|
+
text: d.text
|
|
705
800
|
};
|
|
706
|
-
if (
|
|
707
|
-
const
|
|
708
|
-
if (
|
|
709
|
-
const
|
|
710
|
-
N.example =
|
|
801
|
+
if (d.type === "URL" && d.value && (N.url = d.value, d.urlType === "dynamic" && d.value.includes("{{"))) {
|
|
802
|
+
const b = ee(d.value);
|
|
803
|
+
if (b.length > 0) {
|
|
804
|
+
const y = ((M = k == null ? void 0 : k.sampleContent) == null ? void 0 : M.buttonVariables) || {}, t = b.map(({ number: x }) => y[x] || `sample${x}`);
|
|
805
|
+
N.example = t;
|
|
711
806
|
}
|
|
712
807
|
}
|
|
713
|
-
return (
|
|
808
|
+
return (d.type === "CALL" || d.type === "PHONE_NUMBER") && d.value && (N.phone_number = be(d.value)), console.log("Carousel card button data:", N), N;
|
|
714
809
|
})
|
|
715
810
|
}] : []
|
|
716
811
|
]
|
|
717
812
|
};
|
|
718
813
|
})
|
|
719
814
|
};
|
|
720
|
-
|
|
815
|
+
i.push(h);
|
|
721
816
|
}
|
|
722
|
-
return
|
|
723
|
-
},
|
|
724
|
-
var
|
|
725
|
-
const
|
|
726
|
-
return
|
|
727
|
-
},
|
|
728
|
-
var
|
|
729
|
-
const
|
|
817
|
+
return n.components = i, JSON.stringify(n);
|
|
818
|
+
}, ea = (a) => {
|
|
819
|
+
var i;
|
|
820
|
+
const s = ee(a.body || ""), n = ((i = a == null ? void 0 : a.sampleContent) == null ? void 0 : i.bodyVariables) || {};
|
|
821
|
+
return s.map(({ number: c }) => n[c] || `Sample ${c}`);
|
|
822
|
+
}, je = (a, s) => {
|
|
823
|
+
var l, v;
|
|
824
|
+
const n = {
|
|
730
825
|
name: a.name,
|
|
731
|
-
lang:
|
|
826
|
+
lang: s,
|
|
732
827
|
category: a.category,
|
|
733
828
|
shortlink: a.enableClickTracking ? "1" : "0",
|
|
734
829
|
components: []
|
|
735
830
|
};
|
|
736
|
-
a.headerType === "MEDIA" && a.mediaUrl && a.mediaType !== "DOCUMENT" && (
|
|
831
|
+
a.headerType === "MEDIA" && a.mediaUrl && a.mediaType !== "DOCUMENT" && (n.media = {
|
|
737
832
|
header: a.mediaUrl
|
|
738
833
|
});
|
|
739
|
-
const
|
|
834
|
+
const i = [];
|
|
740
835
|
if (a.type !== "CAROUSEL") {
|
|
741
836
|
if (a.headerType === "TEXT" && a.headerText) {
|
|
742
|
-
const g =
|
|
837
|
+
const g = ee(a.headerText), h = {
|
|
743
838
|
type: "HEADER",
|
|
744
839
|
format: "TEXT",
|
|
745
840
|
text: a.headerText,
|
|
746
|
-
...g.length > 0 && ((
|
|
841
|
+
...g.length > 0 && ((l = a.sampleContent) == null ? void 0 : l.headerVariables) && {
|
|
747
842
|
example: {
|
|
748
|
-
header_text:
|
|
843
|
+
header_text: aa(a, g)
|
|
749
844
|
}
|
|
750
845
|
}
|
|
751
846
|
};
|
|
752
|
-
|
|
847
|
+
i.push(h);
|
|
753
848
|
} else if (a.headerType === "MEDIA") {
|
|
754
849
|
const g = {
|
|
755
850
|
type: "HEADER",
|
|
756
851
|
format: a.mediaType || "IMAGE"
|
|
757
852
|
};
|
|
758
|
-
|
|
853
|
+
i.push(g);
|
|
759
854
|
}
|
|
760
855
|
}
|
|
761
|
-
const
|
|
856
|
+
const c = ee(a.body), o = {
|
|
762
857
|
type: "BODY",
|
|
763
858
|
text: a.body,
|
|
764
|
-
...
|
|
859
|
+
...c.length > 0 && ((v = a.sampleContent) == null ? void 0 : v.bodyVariables) && {
|
|
765
860
|
example: {
|
|
766
|
-
body_text: [
|
|
861
|
+
body_text: [ge(a, c)]
|
|
767
862
|
}
|
|
768
863
|
}
|
|
769
864
|
};
|
|
770
|
-
if (
|
|
865
|
+
if (i.push(o), a.footer && a.type !== "CAROUSEL" && i.push({
|
|
771
866
|
type: "FOOTER",
|
|
772
867
|
text: a.footer
|
|
773
868
|
}), a.buttons.length > 0) {
|
|
774
|
-
const g = a.buttons.map((
|
|
775
|
-
var
|
|
776
|
-
const
|
|
777
|
-
type:
|
|
778
|
-
text:
|
|
869
|
+
const g = a.buttons.map((h) => {
|
|
870
|
+
var V;
|
|
871
|
+
const k = {
|
|
872
|
+
type: h.type === "CALL" ? "PHONE_NUMBER" : h.type,
|
|
873
|
+
text: h.text
|
|
779
874
|
};
|
|
780
|
-
if (
|
|
781
|
-
const
|
|
782
|
-
if (
|
|
783
|
-
const
|
|
784
|
-
({ number:
|
|
785
|
-
var
|
|
786
|
-
return ((
|
|
875
|
+
if (h.type === "URL" && h.value && (k.url = h.value, h.urlType === "dynamic" && h.value.includes("{{"))) {
|
|
876
|
+
const d = ee(h.value);
|
|
877
|
+
if (d.length > 0 && ((V = a.sampleContent) != null && V.buttonVariables)) {
|
|
878
|
+
const N = d.map(
|
|
879
|
+
({ number: M }) => {
|
|
880
|
+
var b, y;
|
|
881
|
+
return ((y = (b = a.sampleContent) == null ? void 0 : b.buttonVariables) == null ? void 0 : y[M]) || `sample${M}`;
|
|
787
882
|
}
|
|
788
883
|
);
|
|
789
|
-
|
|
884
|
+
k.example = N;
|
|
790
885
|
}
|
|
791
886
|
}
|
|
792
|
-
return (
|
|
887
|
+
return (h.type === "CALL" || h.type === "PHONE_NUMBER") && h.value && (k.phone_number = be(h.value)), k;
|
|
793
888
|
});
|
|
794
|
-
|
|
889
|
+
i.push({
|
|
795
890
|
type: "BUTTONS",
|
|
796
891
|
buttons: g
|
|
797
892
|
});
|
|
798
893
|
}
|
|
799
|
-
return
|
|
800
|
-
},
|
|
801
|
-
variable:
|
|
802
|
-
number:
|
|
803
|
-
})),
|
|
804
|
-
({ number:
|
|
805
|
-
var
|
|
806
|
-
return ((
|
|
894
|
+
return n.components = i, JSON.stringify(n);
|
|
895
|
+
}, ee = (a) => (a.match(/\{\{(\d+)\}\}/g) || []).map((n) => ({
|
|
896
|
+
variable: n.replace(/[{}]/g, ""),
|
|
897
|
+
number: n.replace(/[{}]/g, "")
|
|
898
|
+
})), be = (a) => a.startsWith("+") ? a : `+${a}`, aa = (a, s) => s.map(
|
|
899
|
+
({ number: n }) => {
|
|
900
|
+
var i, c;
|
|
901
|
+
return ((c = (i = a.sampleContent) == null ? void 0 : i.headerVariables) == null ? void 0 : c[n]) || `Sample ${n}`;
|
|
807
902
|
}
|
|
808
|
-
),
|
|
809
|
-
({ number:
|
|
810
|
-
var
|
|
811
|
-
return ((
|
|
903
|
+
), ge = (a, s) => s.map(
|
|
904
|
+
({ number: n }) => {
|
|
905
|
+
var i, c;
|
|
906
|
+
return ((c = (i = a.sampleContent) == null ? void 0 : i.bodyVariables) == null ? void 0 : c[n]) || `Sample ${n}`;
|
|
812
907
|
}
|
|
813
|
-
),
|
|
908
|
+
), ra = async (a, s) => {
|
|
814
909
|
try {
|
|
815
|
-
if (!
|
|
910
|
+
if (!s.name || !s.body)
|
|
816
911
|
throw new Error("Missing required template fields: name and body are required");
|
|
817
912
|
if (!a.apiKey)
|
|
818
913
|
throw new Error("Missing TrustSignal API key");
|
|
819
|
-
return await
|
|
820
|
-
|
|
821
|
-
|
|
914
|
+
return await Qe(
|
|
915
|
+
a.apiKey,
|
|
916
|
+
s
|
|
917
|
+
);
|
|
918
|
+
} catch (n) {
|
|
919
|
+
return console.error("API Error:", n), {
|
|
822
920
|
status: "error",
|
|
823
|
-
message:
|
|
921
|
+
message: n instanceof Error ? n.message : "An unexpected error occurred while creating the template"
|
|
824
922
|
};
|
|
825
923
|
}
|
|
826
|
-
}
|
|
924
|
+
};
|
|
925
|
+
async function sa(a, s, n) {
|
|
926
|
+
const i = Ze(n), o = {
|
|
927
|
+
method: "POST",
|
|
928
|
+
headers: { "Content-Type": "application/json" },
|
|
929
|
+
body: i,
|
|
930
|
+
redirect: "follow"
|
|
931
|
+
}, l = `https://wpapi.trustsignal.io/v1/user-templates/update/${encodeURIComponent(s)}?api_key=${encodeURIComponent(a)}`, v = await fetch(l, o), g = await v.text();
|
|
932
|
+
if (!v.ok)
|
|
933
|
+
return { success: !1, message: `Update failed (${v.status}): ${g}`, raw: i };
|
|
934
|
+
try {
|
|
935
|
+
const h = JSON.parse(g);
|
|
936
|
+
return { success: !!((h == null ? void 0 : h.success) ?? !0), message: h == null ? void 0 : h.message, raw: i };
|
|
937
|
+
} catch {
|
|
938
|
+
return { success: !0, raw: i };
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
async function na(a, s) {
|
|
942
|
+
var v;
|
|
943
|
+
const n = `https://wpapi.trustsignal.io/api/v1/template/${encodeURIComponent(s)}?api_key=${encodeURIComponent(a)}`, i = await fetch(n, { method: "GET", redirect: "follow" });
|
|
944
|
+
if (!i.ok)
|
|
945
|
+
throw new Error(`Failed to fetch template ${s}: ${i.status}`);
|
|
946
|
+
const c = await i.text(), o = JSON.parse(c), l = o.template || ((v = o.data) == null ? void 0 : v.template) || o;
|
|
947
|
+
if (!l)
|
|
948
|
+
throw new Error("Invalid template details response");
|
|
949
|
+
return ia(l);
|
|
950
|
+
}
|
|
951
|
+
function ia(a) {
|
|
952
|
+
var k, V;
|
|
953
|
+
const s = {
|
|
954
|
+
headerVariables: {},
|
|
955
|
+
bodyVariables: {},
|
|
956
|
+
buttonVariables: {}
|
|
957
|
+
};
|
|
958
|
+
let n = "NONE", i = "", c, o, l = "", v = "";
|
|
959
|
+
const g = [];
|
|
960
|
+
if (a.jsonstruct)
|
|
961
|
+
try {
|
|
962
|
+
const d = JSON.parse(a.jsonstruct);
|
|
963
|
+
if (d != null && d.header) {
|
|
964
|
+
const N = d.header.format;
|
|
965
|
+
N && N !== "TEXT" ? (n = "MEDIA", c = N, o = d.header.url || ((k = a.medialist) == null ? void 0 : k.header)) : N === "TEXT" && (n = "TEXT", i = d.header.text || "");
|
|
966
|
+
}
|
|
967
|
+
if (d != null && d.body && (l = d.body.text || ""), (V = d == null ? void 0 : d.buttons) != null && V.buttons && Array.isArray(d.buttons.buttons))
|
|
968
|
+
for (const N of d.buttons.buttons) {
|
|
969
|
+
if (!N || !N.type || !N.text) continue;
|
|
970
|
+
const M = {
|
|
971
|
+
id: de(),
|
|
972
|
+
type: N.type === "PHONE_NUMBER" ? "PHONE_NUMBER" : N.type,
|
|
973
|
+
text: N.text
|
|
974
|
+
};
|
|
975
|
+
N.type === "URL" && (M.value = N.url, typeof N.url == "string" && N.url.includes("{{") && Array.isArray(N.example) ? (Ce(N.url).forEach((y, t) => {
|
|
976
|
+
s.buttonVariables[y] = N.example[t] ?? "";
|
|
977
|
+
}), M.urlType = "dynamic") : M.urlType = "static"), (N.type === "CALL" || N.type === "PHONE_NUMBER") && (M.value = N.phone_number || ""), g.push(M);
|
|
978
|
+
}
|
|
979
|
+
if (d != null && d.carousel) {
|
|
980
|
+
const N = Object.keys(d.carousel).filter((x) => /^card\d+$/.test(x));
|
|
981
|
+
N.sort((x, p) => {
|
|
982
|
+
const w = parseInt(x.replace("card", ""), 10), A = parseInt(p.replace("card", ""), 10);
|
|
983
|
+
return w - A;
|
|
984
|
+
});
|
|
985
|
+
const M = N.map((x) => {
|
|
986
|
+
const p = d.carousel[x] || {}, w = p.header || {}, A = p.body || {}, R = p.buttons && Array.isArray(p.buttons.buttons) ? p.buttons.buttons : [], f = w.format, C = f === "IMAGE" || f === "VIDEO" || f === "DOCUMENT" ? f : void 0, O = `card${x.replace("card", "")}header`, P = w.url || (a.medialist ? a.medialist[O] : void 0), H = A.text || "", m = [];
|
|
987
|
+
for (const E of R) {
|
|
988
|
+
if (!E || !E.type || !E.text) continue;
|
|
989
|
+
const S = { id: de(), type: E.type === "PHONE_NUMBER" ? "PHONE_NUMBER" : E.type, text: E.text };
|
|
990
|
+
E.type === "URL" && (S.value = E.url, typeof E.url == "string" && E.url.includes("{{") && Array.isArray(E.example) ? (Ce(E.url).forEach((I, z) => {
|
|
991
|
+
}), S.urlType = "dynamic") : S.urlType = "static"), (E.type === "CALL" || E.type === "PHONE_NUMBER") && (S.value = E.phone_number || ""), m.push(S);
|
|
992
|
+
}
|
|
993
|
+
return {
|
|
994
|
+
id: de(),
|
|
995
|
+
headerType: C ? "MEDIA" : "NONE",
|
|
996
|
+
mediaType: C,
|
|
997
|
+
mediaUrl: P,
|
|
998
|
+
body: H,
|
|
999
|
+
buttons: m,
|
|
1000
|
+
sampleContent: {
|
|
1001
|
+
headerVariables: {},
|
|
1002
|
+
bodyVariables: {},
|
|
1003
|
+
buttonVariables: {}
|
|
1004
|
+
}
|
|
1005
|
+
};
|
|
1006
|
+
});
|
|
1007
|
+
let b = "IMAGE";
|
|
1008
|
+
const y = M[0];
|
|
1009
|
+
(y == null ? void 0 : y.mediaType) === "VIDEO" && (b = "VIDEO");
|
|
1010
|
+
const t = {
|
|
1011
|
+
type: b,
|
|
1012
|
+
cards: M
|
|
1013
|
+
};
|
|
1014
|
+
return {
|
|
1015
|
+
name: a.name,
|
|
1016
|
+
category: a.category === "MARKETING" || a.category === "UTILITY" ? a.category : "MARKETING",
|
|
1017
|
+
type: "CAROUSEL",
|
|
1018
|
+
language: a.lang || "en",
|
|
1019
|
+
enableClickTracking: !1,
|
|
1020
|
+
headerType: "NONE",
|
|
1021
|
+
headerText: "",
|
|
1022
|
+
body: l,
|
|
1023
|
+
footer: v,
|
|
1024
|
+
buttons: [],
|
|
1025
|
+
sampleContent: s,
|
|
1026
|
+
carousel: t
|
|
1027
|
+
};
|
|
1028
|
+
}
|
|
1029
|
+
} catch (d) {
|
|
1030
|
+
console.warn("Failed to parse jsonstruct; falling back", d);
|
|
1031
|
+
}
|
|
1032
|
+
return {
|
|
1033
|
+
name: a.name,
|
|
1034
|
+
category: a.category === "MARKETING" || a.category === "UTILITY" ? a.category : "MARKETING",
|
|
1035
|
+
type: "BASIC",
|
|
1036
|
+
language: a.lang || "en",
|
|
1037
|
+
enableClickTracking: !1,
|
|
1038
|
+
headerType: n,
|
|
1039
|
+
headerText: i,
|
|
1040
|
+
mediaType: c,
|
|
1041
|
+
mediaUrl: o,
|
|
1042
|
+
body: l,
|
|
1043
|
+
footer: v,
|
|
1044
|
+
buttons: g,
|
|
1045
|
+
sampleContent: s
|
|
1046
|
+
};
|
|
1047
|
+
}
|
|
1048
|
+
function Ce(a) {
|
|
1049
|
+
if (!a) return [];
|
|
1050
|
+
const s = a.match(/\{\{(\d+)\}\}/g) || [];
|
|
1051
|
+
return [...new Set(s.map((n) => n.replace(/[{}]/g, "")))];
|
|
1052
|
+
}
|
|
1053
|
+
function de() {
|
|
1054
|
+
return typeof crypto < "u" && "randomUUID" in crypto ? crypto.randomUUID() : "id-" + Math.random().toString(36).slice(2);
|
|
1055
|
+
}
|
|
1056
|
+
const la = [
|
|
827
1057
|
{ value: "af", label: "Afrikaans" },
|
|
828
1058
|
{ value: "sq", label: "Albanian" },
|
|
829
1059
|
{ value: "ar", label: "Arabic" },
|
|
@@ -889,118 +1119,118 @@ const De = async (a, n) => {
|
|
|
889
1119
|
{ value: "ur", label: "Urdu" },
|
|
890
1120
|
{ value: "uz", label: "Uzbek" },
|
|
891
1121
|
{ value: "vi", label: "Vietnamese" }
|
|
892
|
-
],
|
|
1122
|
+
], ta = [
|
|
893
1123
|
{ value: "NONE", label: "None" },
|
|
894
1124
|
{ value: "TEXT", label: "Text" },
|
|
895
1125
|
{ value: "MEDIA", label: "Media" }
|
|
896
|
-
],
|
|
1126
|
+
], ca = [
|
|
897
1127
|
{ value: "IMAGE", label: "Image" },
|
|
898
1128
|
{ value: "VIDEO", label: "Video" },
|
|
899
1129
|
{ value: "DOCUMENT", label: "Document" }
|
|
900
|
-
],
|
|
901
|
-
function
|
|
902
|
-
var
|
|
903
|
-
const [
|
|
904
|
-
const
|
|
905
|
-
if (!
|
|
906
|
-
const
|
|
907
|
-
const
|
|
908
|
-
return
|
|
1130
|
+
], ma = 5 * 1024 * 1024, da = 16 * 1024 * 1024, xa = 100 * 1024 * 1024, xe = ["jpg", "jpeg", "png"], pe = ["mp4", "3gpp"], oe = ["pdf", "docx", "xlsx", "pptx", "txt"];
|
|
1131
|
+
function pa({ template: a, setTemplate: s, onFileUpload: n }) {
|
|
1132
|
+
var A, R;
|
|
1133
|
+
const [i, c] = X.useState(null), [o, l] = X.useState(!1), [v, g] = X.useState(null), [h, k] = X.useState(null), V = () => {
|
|
1134
|
+
const C = (a.headerText || "").match(/{{\d+}}/g);
|
|
1135
|
+
if (!C) return 0;
|
|
1136
|
+
const U = C.map((O) => {
|
|
1137
|
+
const P = O.match(/{{(\d+)}}/);
|
|
1138
|
+
return P ? parseInt(P[1], 10) : 0;
|
|
909
1139
|
});
|
|
910
|
-
return
|
|
911
|
-
},
|
|
912
|
-
const
|
|
913
|
-
if (
|
|
914
|
-
const
|
|
915
|
-
|
|
916
|
-
if (
|
|
917
|
-
const
|
|
918
|
-
|
|
1140
|
+
return U.length > 0 ? Math.max(...U) : 0;
|
|
1141
|
+
}, d = () => {
|
|
1142
|
+
const U = `{{${V() + 1}}}`;
|
|
1143
|
+
if (v && a.headerText.length + U.length <= 60) {
|
|
1144
|
+
const O = v.selectionStart || a.headerText.length, P = a.headerText.substring(0, O), H = a.headerText.substring(O), m = P + U + H;
|
|
1145
|
+
s({ ...a, headerText: m }), setTimeout(() => {
|
|
1146
|
+
if (v) {
|
|
1147
|
+
const E = O + U.length;
|
|
1148
|
+
v.setSelectionRange(E, E), v.focus();
|
|
919
1149
|
}
|
|
920
1150
|
}, 0);
|
|
921
1151
|
}
|
|
922
|
-
},
|
|
923
|
-
|
|
924
|
-
...
|
|
925
|
-
headerType:
|
|
926
|
-
headerText:
|
|
927
|
-
mediaType:
|
|
928
|
-
mediaUrl:
|
|
929
|
-
})),
|
|
930
|
-
},
|
|
931
|
-
var
|
|
932
|
-
return ((
|
|
933
|
-
},
|
|
934
|
-
const
|
|
935
|
-
switch (
|
|
1152
|
+
}, N = (f) => {
|
|
1153
|
+
s((C) => ({
|
|
1154
|
+
...C,
|
|
1155
|
+
headerType: f,
|
|
1156
|
+
headerText: f === "TEXT" ? C.headerText : "",
|
|
1157
|
+
mediaType: f === "MEDIA" ? C.mediaType || "IMAGE" : void 0,
|
|
1158
|
+
mediaUrl: f === "MEDIA" ? C.mediaUrl : void 0
|
|
1159
|
+
})), f !== "MEDIA" && (c(null), k(null));
|
|
1160
|
+
}, M = (f) => {
|
|
1161
|
+
var C;
|
|
1162
|
+
return ((C = f.split("?")[0].split(".").pop()) == null ? void 0 : C.toLowerCase()) || "";
|
|
1163
|
+
}, b = (f, C) => {
|
|
1164
|
+
const U = M(f.name);
|
|
1165
|
+
switch (C) {
|
|
936
1166
|
case "IMAGE":
|
|
937
|
-
if (!
|
|
938
|
-
if (
|
|
1167
|
+
if (!xe.includes(U)) return "Invalid format. Only JPG, JPEG, PNG are allowed.";
|
|
1168
|
+
if (f.size > ma) return "File is too large. Max size is 5 MB.";
|
|
939
1169
|
break;
|
|
940
1170
|
case "VIDEO":
|
|
941
|
-
if (!
|
|
942
|
-
if (
|
|
1171
|
+
if (!pe.includes(U)) return "Invalid format. Only MP4, 3GPP are allowed.";
|
|
1172
|
+
if (f.size > da) return "File is too large. Max size is 16 MB.";
|
|
943
1173
|
break;
|
|
944
1174
|
case "DOCUMENT":
|
|
945
|
-
if (!
|
|
946
|
-
if (
|
|
1175
|
+
if (!oe.includes(U)) return "Invalid format. Allowed types: PDF, DOCX, XLSX, PPTX, TXT.";
|
|
1176
|
+
if (f.size > xa) return "File is too large. Max size is 100 MB.";
|
|
947
1177
|
break;
|
|
948
1178
|
default:
|
|
949
1179
|
return "Invalid media type.";
|
|
950
1180
|
}
|
|
951
1181
|
return null;
|
|
952
|
-
},
|
|
953
|
-
if (!
|
|
954
|
-
const
|
|
955
|
-
switch (
|
|
1182
|
+
}, y = (f, C) => {
|
|
1183
|
+
if (!f) return null;
|
|
1184
|
+
const U = M(f);
|
|
1185
|
+
switch (C) {
|
|
956
1186
|
case "IMAGE":
|
|
957
|
-
if (!
|
|
1187
|
+
if (!xe.includes(U)) return "URL does not point to a valid image (JPG, JPEG, PNG).";
|
|
958
1188
|
break;
|
|
959
1189
|
case "VIDEO":
|
|
960
|
-
if (!
|
|
1190
|
+
if (!pe.includes(U)) return "URL does not point to a valid video (MP4, 3GPP).";
|
|
961
1191
|
break;
|
|
962
1192
|
case "DOCUMENT":
|
|
963
|
-
if (!
|
|
1193
|
+
if (!oe.includes(U)) return "URL does not point to a valid document.";
|
|
964
1194
|
break;
|
|
965
1195
|
}
|
|
966
1196
|
return null;
|
|
967
1197
|
}, t = () => {
|
|
968
|
-
|
|
969
|
-
},
|
|
970
|
-
var
|
|
971
|
-
const
|
|
972
|
-
if (!
|
|
973
|
-
|
|
974
|
-
const
|
|
975
|
-
if (
|
|
976
|
-
|
|
1198
|
+
c(null), s({ ...a, mediaUrl: "" }), k(null);
|
|
1199
|
+
}, x = async (f) => {
|
|
1200
|
+
var O;
|
|
1201
|
+
const C = (O = f.target.files) == null ? void 0 : O[0];
|
|
1202
|
+
if (!C || !a.mediaType) return;
|
|
1203
|
+
k(null);
|
|
1204
|
+
const U = b(C, a.mediaType);
|
|
1205
|
+
if (U) {
|
|
1206
|
+
k(U);
|
|
977
1207
|
return;
|
|
978
1208
|
}
|
|
979
|
-
|
|
1209
|
+
l(!0), c(C);
|
|
980
1210
|
try {
|
|
981
|
-
const
|
|
982
|
-
|
|
983
|
-
} catch (
|
|
984
|
-
console.error("File upload failed:",
|
|
985
|
-
const
|
|
986
|
-
|
|
1211
|
+
const P = await n(C);
|
|
1212
|
+
s({ ...a, mediaUrl: P });
|
|
1213
|
+
} catch (P) {
|
|
1214
|
+
console.error("File upload failed:", P), t();
|
|
1215
|
+
const H = P instanceof Error ? P.message : "File upload failed. Please try again.";
|
|
1216
|
+
k(H);
|
|
987
1217
|
} finally {
|
|
988
|
-
|
|
1218
|
+
l(!1);
|
|
989
1219
|
}
|
|
990
|
-
},
|
|
991
|
-
const
|
|
992
|
-
if (
|
|
993
|
-
const
|
|
994
|
-
|
|
1220
|
+
}, p = (f) => {
|
|
1221
|
+
const C = f.target.value;
|
|
1222
|
+
if (c(null), s({ ...a, mediaUrl: C }), a.mediaType) {
|
|
1223
|
+
const U = y(C, a.mediaType);
|
|
1224
|
+
k(U);
|
|
995
1225
|
}
|
|
996
|
-
},
|
|
1226
|
+
}, w = () => {
|
|
997
1227
|
switch (a.mediaType) {
|
|
998
1228
|
case "IMAGE":
|
|
999
|
-
return
|
|
1229
|
+
return xe.map((f) => `.${f}`).join(",");
|
|
1000
1230
|
case "VIDEO":
|
|
1001
|
-
return
|
|
1231
|
+
return pe.map((f) => `.${f}`).join(",");
|
|
1002
1232
|
case "DOCUMENT":
|
|
1003
|
-
return
|
|
1233
|
+
return oe.map((f) => `.${f}`).join(",");
|
|
1004
1234
|
default:
|
|
1005
1235
|
return "*/*";
|
|
1006
1236
|
}
|
|
@@ -1013,9 +1243,9 @@ function aa({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1013
1243
|
"select",
|
|
1014
1244
|
{
|
|
1015
1245
|
value: a.headerType,
|
|
1016
|
-
onChange: (
|
|
1246
|
+
onChange: (f) => N(f.target.value),
|
|
1017
1247
|
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",
|
|
1018
|
-
children:
|
|
1248
|
+
children: ta.map((f) => /* @__PURE__ */ e("option", { value: f.value, children: f.label }, f.value))
|
|
1019
1249
|
}
|
|
1020
1250
|
),
|
|
1021
1251
|
/* @__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" }) }) }),
|
|
@@ -1030,7 +1260,7 @@ function aa({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1030
1260
|
ref: g,
|
|
1031
1261
|
type: "text",
|
|
1032
1262
|
value: a.headerText,
|
|
1033
|
-
onChange: (
|
|
1263
|
+
onChange: (f) => s({ ...a, headerText: f.target.value }),
|
|
1034
1264
|
maxLength: 60,
|
|
1035
1265
|
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",
|
|
1036
1266
|
placeholder: "Add a 60 character title to your message"
|
|
@@ -1040,7 +1270,7 @@ function aa({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1040
1270
|
/* @__PURE__ */ e(
|
|
1041
1271
|
"button",
|
|
1042
1272
|
{
|
|
1043
|
-
onClick:
|
|
1273
|
+
onClick: d,
|
|
1044
1274
|
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",
|
|
1045
1275
|
title: "Add variable to header",
|
|
1046
1276
|
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" }) })
|
|
@@ -1052,30 +1282,30 @@ function aa({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1052
1282
|
] })
|
|
1053
1283
|
] }),
|
|
1054
1284
|
(() => {
|
|
1055
|
-
const
|
|
1056
|
-
return
|
|
1285
|
+
const f = [...new Set((a.headerText.match(/\{\{(\d+)\}\}/g) || []).map((C) => C.replace(/[{}]/g, "")))];
|
|
1286
|
+
return f.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
|
|
1057
1287
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2", children: "Sample Values" }),
|
|
1058
|
-
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children:
|
|
1059
|
-
var
|
|
1288
|
+
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: f.map((C) => {
|
|
1289
|
+
var U, O;
|
|
1060
1290
|
return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
1061
1291
|
/* @__PURE__ */ r("label", { className: "rsp-text-xs rsp-text-gray-500 rsp-whitespace-nowrap", children: [
|
|
1062
|
-
`{{${
|
|
1292
|
+
`{{${C}}}`,
|
|
1063
1293
|
":"
|
|
1064
1294
|
] }),
|
|
1065
1295
|
/* @__PURE__ */ e(
|
|
1066
1296
|
"input",
|
|
1067
1297
|
{
|
|
1068
1298
|
type: "text",
|
|
1069
|
-
value: ((
|
|
1070
|
-
onChange: (
|
|
1071
|
-
var
|
|
1072
|
-
const
|
|
1299
|
+
value: ((O = (U = a.sampleContent) == null ? void 0 : U.headerVariables) == null ? void 0 : O[C]) || "",
|
|
1300
|
+
onChange: (P) => {
|
|
1301
|
+
var m, E, S;
|
|
1302
|
+
const H = {
|
|
1073
1303
|
...a.sampleContent,
|
|
1074
|
-
headerVariables: { ...(
|
|
1075
|
-
bodyVariables: ((
|
|
1076
|
-
buttonVariables: ((
|
|
1304
|
+
headerVariables: { ...(m = a.sampleContent) == null ? void 0 : m.headerVariables, [C]: P.target.value },
|
|
1305
|
+
bodyVariables: ((E = a.sampleContent) == null ? void 0 : E.bodyVariables) || {},
|
|
1306
|
+
buttonVariables: ((S = a.sampleContent) == null ? void 0 : S.buttonVariables) || {}
|
|
1077
1307
|
};
|
|
1078
|
-
|
|
1308
|
+
s({ ...a, sampleContent: H });
|
|
1079
1309
|
},
|
|
1080
1310
|
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",
|
|
1081
1311
|
placeholder: "Sample"
|
|
@@ -1086,16 +1316,16 @@ function aa({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1086
1316
|
{
|
|
1087
1317
|
type: "button",
|
|
1088
1318
|
onClick: () => {
|
|
1089
|
-
var
|
|
1090
|
-
const
|
|
1091
|
-
|
|
1319
|
+
var E, S, j;
|
|
1320
|
+
const P = new RegExp(`\\{\\{${C}\\}\\}`, "g"), H = (a.headerText || "").replace(P, ""), m = Object.fromEntries(Object.entries(((E = a.sampleContent) == null ? void 0 : E.headerVariables) || {}).filter(([I]) => I !== C));
|
|
1321
|
+
s({
|
|
1092
1322
|
...a,
|
|
1093
|
-
headerText:
|
|
1323
|
+
headerText: H,
|
|
1094
1324
|
sampleContent: {
|
|
1095
1325
|
...a.sampleContent,
|
|
1096
|
-
headerVariables:
|
|
1097
|
-
bodyVariables: ((
|
|
1098
|
-
buttonVariables: ((
|
|
1326
|
+
headerVariables: m,
|
|
1327
|
+
bodyVariables: ((S = a.sampleContent) == null ? void 0 : S.bodyVariables) || {},
|
|
1328
|
+
buttonVariables: ((j = a.sampleContent) == null ? void 0 : j.buttonVariables) || {}
|
|
1099
1329
|
}
|
|
1100
1330
|
});
|
|
1101
1331
|
},
|
|
@@ -1104,7 +1334,7 @@ function aa({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1104
1334
|
children: "×"
|
|
1105
1335
|
}
|
|
1106
1336
|
)
|
|
1107
|
-
] }, `header-sample-${
|
|
1337
|
+
] }, `header-sample-${C}`);
|
|
1108
1338
|
}) })
|
|
1109
1339
|
] });
|
|
1110
1340
|
})()
|
|
@@ -1117,15 +1347,15 @@ function aa({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1117
1347
|
"select",
|
|
1118
1348
|
{
|
|
1119
1349
|
value: a.mediaType || "IMAGE",
|
|
1120
|
-
onChange: (
|
|
1121
|
-
|
|
1122
|
-
...
|
|
1123
|
-
mediaType:
|
|
1350
|
+
onChange: (f) => {
|
|
1351
|
+
s((C) => ({
|
|
1352
|
+
...C,
|
|
1353
|
+
mediaType: f.target.value,
|
|
1124
1354
|
mediaUrl: ""
|
|
1125
|
-
})),
|
|
1355
|
+
})), c(null), k(null);
|
|
1126
1356
|
},
|
|
1127
1357
|
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",
|
|
1128
|
-
children:
|
|
1358
|
+
children: ca.map((f) => /* @__PURE__ */ e("option", { value: f.value, children: f.label }, f.value))
|
|
1129
1359
|
}
|
|
1130
1360
|
),
|
|
1131
1361
|
/* @__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" }) }) })
|
|
@@ -1141,32 +1371,32 @@ function aa({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1141
1371
|
src: a.mediaUrl,
|
|
1142
1372
|
alt: "Preview",
|
|
1143
1373
|
className: "rsp-w-12 rsp-h-12 rsp-object-cover rsp-rounded",
|
|
1144
|
-
onError: (
|
|
1145
|
-
|
|
1374
|
+
onError: (f) => {
|
|
1375
|
+
f.currentTarget.style.display = "none", h || k("Could not load image preview from URL.");
|
|
1146
1376
|
},
|
|
1147
1377
|
onLoad: () => {
|
|
1148
|
-
|
|
1378
|
+
h != null && h.includes("Could not load") && k(null);
|
|
1149
1379
|
}
|
|
1150
1380
|
}
|
|
1151
1381
|
),
|
|
1152
|
-
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(
|
|
1153
|
-
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(
|
|
1382
|
+
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($e, { className: "rsp-w-6 rsp-h-6 rsp-text-gray-500" }) }),
|
|
1383
|
+
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(He, { className: "rsp-w-6 rsp-h-6 rsp-text-gray-500" }) }),
|
|
1154
1384
|
/* @__PURE__ */ r("div", { className: "overflow-hidden", children: [
|
|
1155
|
-
/* @__PURE__ */ e("p", { className: "rsp-text-sm rsp-font-medium rsp-text-gray-900 rsp-truncate", children:
|
|
1156
|
-
|
|
1385
|
+
/* @__PURE__ */ e("p", { className: "rsp-text-sm rsp-font-medium rsp-text-gray-900 rsp-truncate", children: i ? i.name : a.mediaUrl }),
|
|
1386
|
+
i && /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500", children: `${(i.size / 1024 / 1024).toFixed(2)} MB` })
|
|
1157
1387
|
] })
|
|
1158
1388
|
] }),
|
|
1159
|
-
/* @__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(
|
|
1389
|
+
/* @__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(re, { className: "rsp-w-4 rsp-h-4" }) })
|
|
1160
1390
|
] }) : /* @__PURE__ */ r("div", { children: [
|
|
1161
|
-
/* @__PURE__ */ e("input", { type: "file", accept:
|
|
1391
|
+
/* @__PURE__ */ e("input", { type: "file", accept: w(), onChange: x, className: "rsp-hidden", id: "media-upload", disabled: o }),
|
|
1162
1392
|
/* @__PURE__ */ r(
|
|
1163
1393
|
"label",
|
|
1164
1394
|
{
|
|
1165
1395
|
htmlFor: "media-upload",
|
|
1166
|
-
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 ${
|
|
1396
|
+
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 ${o ? "rsp-opacity-50 rsp-cursor-not-allowed" : ""}`,
|
|
1167
1397
|
children: [
|
|
1168
|
-
/* @__PURE__ */ e(
|
|
1169
|
-
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children:
|
|
1398
|
+
/* @__PURE__ */ e(Xe, { className: "rsp-w-6 rsp-h-6 rsp-text-gray-400 rsp-mb-2" }),
|
|
1399
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: o ? "Uploading..." : `Upload ${((A = a.mediaType) == null ? void 0 : A.toLowerCase()) || "file"}` }),
|
|
1170
1400
|
/* @__PURE__ */ r("span", { className: "rsp-text-xs rsp-text-gray-400 rsp-mt-1", children: [
|
|
1171
1401
|
a.mediaType === "IMAGE" && "JPG, PNG up to 5MB",
|
|
1172
1402
|
a.mediaType === "VIDEO" && "MP4, 3GPP up to 16MB",
|
|
@@ -1176,9 +1406,9 @@ function aa({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1176
1406
|
}
|
|
1177
1407
|
)
|
|
1178
1408
|
] }),
|
|
1179
|
-
|
|
1180
|
-
/* @__PURE__ */ e(
|
|
1181
|
-
/* @__PURE__ */ e("span", { children:
|
|
1409
|
+
h && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2 rsp-text-xs rsp-text-red-600", children: [
|
|
1410
|
+
/* @__PURE__ */ e(fe, { className: "rsp-w-4 rsp-h-4" }),
|
|
1411
|
+
/* @__PURE__ */ e("span", { children: h })
|
|
1182
1412
|
] }),
|
|
1183
1413
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center", children: [
|
|
1184
1414
|
/* @__PURE__ */ e("div", { className: "rsp-flex-1 rsp-border-t rsp-border-gray-300" }),
|
|
@@ -1190,16 +1420,16 @@ function aa({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
1190
1420
|
{
|
|
1191
1421
|
type: "url",
|
|
1192
1422
|
value: a.mediaUrl || "",
|
|
1193
|
-
onChange:
|
|
1423
|
+
onChange: p,
|
|
1194
1424
|
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",
|
|
1195
|
-
placeholder: `Enter ${(
|
|
1425
|
+
placeholder: `Enter ${(R = a.mediaType) == null ? void 0 : R.toLowerCase()} URL`
|
|
1196
1426
|
}
|
|
1197
1427
|
) })
|
|
1198
1428
|
] })
|
|
1199
1429
|
] })
|
|
1200
1430
|
] });
|
|
1201
1431
|
}
|
|
1202
|
-
const
|
|
1432
|
+
const Ee = [
|
|
1203
1433
|
{ name: "grinning-face", hexadecimal: "😀" },
|
|
1204
1434
|
{ name: "grinning-face-with-smiling-eyes", hexadecimal: "😁" },
|
|
1205
1435
|
{ name: "face-with-tears-of-joy", hexadecimal: "😂" },
|
|
@@ -2998,56 +3228,56 @@ const we = [
|
|
|
2998
3228
|
{ name: "south-africa", hexadecimal: "🇿🇦" },
|
|
2999
3229
|
{ name: "zambia", hexadecimal: "🇿🇲" },
|
|
3000
3230
|
{ name: "zimbabwe", hexadecimal: "🇿🇼" }
|
|
3001
|
-
],
|
|
3231
|
+
], oa = ({
|
|
3002
3232
|
emojis: a,
|
|
3003
|
-
onSelect:
|
|
3004
|
-
onClose:
|
|
3233
|
+
onSelect: s,
|
|
3234
|
+
onClose: n
|
|
3005
3235
|
}) => {
|
|
3006
|
-
const [
|
|
3007
|
-
const
|
|
3008
|
-
|
|
3009
|
-
Math.ceil(a.length /
|
|
3236
|
+
const [i, c] = B({ start: 0, end: 80 }), o = 8, l = 40, v = 400, g = Ne((d) => {
|
|
3237
|
+
const N = d.currentTarget.scrollTop, M = Math.floor(N / l), b = Math.min(
|
|
3238
|
+
M + Math.ceil(v / l) + 2,
|
|
3239
|
+
Math.ceil(a.length / o)
|
|
3010
3240
|
);
|
|
3011
|
-
|
|
3012
|
-
start:
|
|
3013
|
-
end:
|
|
3241
|
+
c({
|
|
3242
|
+
start: M * o,
|
|
3243
|
+
end: b * o
|
|
3014
3244
|
});
|
|
3015
|
-
}, [a.length,
|
|
3016
|
-
const
|
|
3017
|
-
if (!
|
|
3018
|
-
const
|
|
3019
|
-
const
|
|
3020
|
-
return parseInt(
|
|
3245
|
+
}, [a.length, l, v, o]), h = Ne((d) => {
|
|
3246
|
+
const N = d.match(/&#x([0-9A-Fa-f]+);/g);
|
|
3247
|
+
if (!N) return "";
|
|
3248
|
+
const M = N.map((b) => {
|
|
3249
|
+
const y = b.replace(/&#x|;/g, "");
|
|
3250
|
+
return parseInt(y, 16);
|
|
3021
3251
|
});
|
|
3022
|
-
return String.fromCodePoint(...
|
|
3023
|
-
}, []),
|
|
3252
|
+
return String.fromCodePoint(...M);
|
|
3253
|
+
}, []), k = Math.ceil(a.length / o) * l, V = a.slice(i.start, i.end);
|
|
3024
3254
|
return /* @__PURE__ */ e(
|
|
3025
3255
|
"div",
|
|
3026
3256
|
{
|
|
3027
3257
|
className: "rsp-h-[400px] rsp-overflow-y-auto rsp-relative",
|
|
3028
3258
|
onScroll: g,
|
|
3029
|
-
children: /* @__PURE__ */ e("div", { style: { height:
|
|
3259
|
+
children: /* @__PURE__ */ e("div", { style: { height: k }, className: "rsp-relative", children: /* @__PURE__ */ e(
|
|
3030
3260
|
"div",
|
|
3031
3261
|
{
|
|
3032
3262
|
className: "rsp-absolute rsp-w-full rsp-grid rsp-grid-cols-8 rsp-gap-1",
|
|
3033
3263
|
style: {
|
|
3034
|
-
top: Math.floor(
|
|
3264
|
+
top: Math.floor(i.start / o) * l,
|
|
3035
3265
|
transform: "translateY(0px)"
|
|
3036
3266
|
},
|
|
3037
|
-
children:
|
|
3038
|
-
const
|
|
3267
|
+
children: V.map((d, N) => {
|
|
3268
|
+
const M = i.start + N;
|
|
3039
3269
|
return /* @__PURE__ */ e(
|
|
3040
3270
|
"button",
|
|
3041
3271
|
{
|
|
3042
3272
|
onClick: () => {
|
|
3043
|
-
|
|
3273
|
+
s(h(d.hexadecimal));
|
|
3044
3274
|
},
|
|
3045
3275
|
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",
|
|
3046
|
-
title:
|
|
3047
|
-
style: { height:
|
|
3048
|
-
children:
|
|
3276
|
+
title: d.name,
|
|
3277
|
+
style: { height: l },
|
|
3278
|
+
children: h(d.hexadecimal)
|
|
3049
3279
|
},
|
|
3050
|
-
|
|
3280
|
+
M
|
|
3051
3281
|
);
|
|
3052
3282
|
})
|
|
3053
3283
|
}
|
|
@@ -3055,113 +3285,113 @@ const we = [
|
|
|
3055
3285
|
}
|
|
3056
3286
|
);
|
|
3057
3287
|
};
|
|
3058
|
-
function
|
|
3059
|
-
const [
|
|
3060
|
-
(
|
|
3061
|
-
) :
|
|
3062
|
-
return
|
|
3063
|
-
a ||
|
|
3064
|
-
}, [a]), /* @__PURE__ */ e(
|
|
3288
|
+
function ye({ isOpen: a, onClose: s, onSelect: n }) {
|
|
3289
|
+
const [i, c] = B(""), o = Se(() => i ? Ee.filter(
|
|
3290
|
+
(l) => l.name.toLowerCase().includes(i.toLowerCase())
|
|
3291
|
+
) : Ee, [i]);
|
|
3292
|
+
return X.useEffect(() => {
|
|
3293
|
+
a || c("");
|
|
3294
|
+
}, [a]), /* @__PURE__ */ e(te, { isOpen: a, onClose: s, title: "Select Emoji", children: /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
|
|
3065
3295
|
/* @__PURE__ */ r("div", { className: "rsp-relative", children: [
|
|
3066
3296
|
/* @__PURE__ */ e(
|
|
3067
3297
|
"input",
|
|
3068
3298
|
{
|
|
3069
3299
|
type: "text",
|
|
3070
3300
|
placeholder: "Search emojis...",
|
|
3071
|
-
value:
|
|
3072
|
-
onChange: (
|
|
3301
|
+
value: i,
|
|
3302
|
+
onChange: (l) => c(l.target.value),
|
|
3073
3303
|
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"
|
|
3074
3304
|
}
|
|
3075
3305
|
),
|
|
3076
|
-
|
|
3306
|
+
i && /* @__PURE__ */ e(
|
|
3077
3307
|
"button",
|
|
3078
3308
|
{
|
|
3079
|
-
onClick: () =>
|
|
3309
|
+
onClick: () => c(""),
|
|
3080
3310
|
className: "rsp-absolute rsp-right-2 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-gray-400 hover:rsp-text-gray-600",
|
|
3081
3311
|
children: "×"
|
|
3082
3312
|
}
|
|
3083
3313
|
)
|
|
3084
3314
|
] }),
|
|
3085
|
-
/* @__PURE__ */ e("div", { className: "rsp-flex rsp-gap-2 rsp-flex-wrap", children: ["😀", "🎉", "❤️", "👍", "🔥", "💯", "✨", "🎯"].map((
|
|
3315
|
+
/* @__PURE__ */ e("div", { className: "rsp-flex rsp-gap-2 rsp-flex-wrap", children: ["😀", "🎉", "❤️", "👍", "🔥", "💯", "✨", "🎯"].map((l) => /* @__PURE__ */ e(
|
|
3086
3316
|
"button",
|
|
3087
3317
|
{
|
|
3088
3318
|
onClick: () => {
|
|
3089
|
-
|
|
3319
|
+
n(l);
|
|
3090
3320
|
},
|
|
3091
3321
|
className: "rsp-w-8 rsp-h-8 rsp-flex rsp-items-center rsp-justify-center rsp-text-lg hover:rsp-bg-gray-100 rsp-rounded rsp-transition-colors",
|
|
3092
|
-
children:
|
|
3322
|
+
children: l
|
|
3093
3323
|
},
|
|
3094
|
-
|
|
3324
|
+
l
|
|
3095
3325
|
)) }),
|
|
3096
3326
|
/* @__PURE__ */ r("div", { className: "rsp-text-sm rsp-text-gray-500", children: [
|
|
3097
|
-
|
|
3327
|
+
o.length,
|
|
3098
3328
|
" emojis found"
|
|
3099
3329
|
] }),
|
|
3100
3330
|
/* @__PURE__ */ e(
|
|
3101
|
-
|
|
3331
|
+
oa,
|
|
3102
3332
|
{
|
|
3103
|
-
emojis:
|
|
3104
|
-
onSelect:
|
|
3105
|
-
onClose:
|
|
3333
|
+
emojis: o,
|
|
3334
|
+
onSelect: n,
|
|
3335
|
+
onClose: s
|
|
3106
3336
|
}
|
|
3107
3337
|
)
|
|
3108
3338
|
] }) });
|
|
3109
3339
|
}
|
|
3110
|
-
function
|
|
3111
|
-
const [
|
|
3112
|
-
const
|
|
3113
|
-
if (!
|
|
3114
|
-
const
|
|
3115
|
-
const
|
|
3116
|
-
return
|
|
3340
|
+
function fa({ template: a, setTemplate: s }) {
|
|
3341
|
+
const [n, i] = B(!1), [c, o] = B(null), [l, v] = B(null), [g, h] = B(null), [k, V] = B(!1), d = () => {
|
|
3342
|
+
const t = (a.body || "").match(/{{\d+}}/g);
|
|
3343
|
+
if (!t) return 0;
|
|
3344
|
+
const x = t.map((p) => {
|
|
3345
|
+
const w = p.match(/{{(\d+)}}/);
|
|
3346
|
+
return w ? parseInt(w[1], 10) : 0;
|
|
3117
3347
|
});
|
|
3118
|
-
return
|
|
3119
|
-
},
|
|
3120
|
-
const
|
|
3121
|
-
if (
|
|
3122
|
-
const
|
|
3123
|
-
|
|
3348
|
+
return x.length > 0 ? Math.max(...x) : 0;
|
|
3349
|
+
}, N = () => {
|
|
3350
|
+
const x = `{{${d() + 1}}}`;
|
|
3351
|
+
if (l && a.body.length + x.length <= 1024) {
|
|
3352
|
+
const p = l.selectionStart || a.body.length, w = a.body.substring(0, p), A = a.body.substring(p), R = w + x + A;
|
|
3353
|
+
s({
|
|
3124
3354
|
...a,
|
|
3125
|
-
body:
|
|
3355
|
+
body: R
|
|
3126
3356
|
}), setTimeout(() => {
|
|
3127
|
-
if (
|
|
3128
|
-
const
|
|
3129
|
-
|
|
3357
|
+
if (l) {
|
|
3358
|
+
const f = p + x.length;
|
|
3359
|
+
l.setSelectionRange(f, f), l.focus();
|
|
3130
3360
|
}
|
|
3131
3361
|
}, 0);
|
|
3132
3362
|
}
|
|
3133
|
-
},
|
|
3134
|
-
|
|
3135
|
-
|
|
3363
|
+
}, M = () => {
|
|
3364
|
+
o("body"), i(!0), setTimeout(() => {
|
|
3365
|
+
l && l.focus();
|
|
3136
3366
|
}, 0);
|
|
3137
|
-
},
|
|
3138
|
-
if (
|
|
3139
|
-
if (!
|
|
3140
|
-
const
|
|
3141
|
-
if (
|
|
3142
|
-
const
|
|
3143
|
-
|
|
3367
|
+
}, b = (y) => {
|
|
3368
|
+
if (c === "body") {
|
|
3369
|
+
if (!l) return;
|
|
3370
|
+
const t = l.selectionStart || a.body.length, x = 1024, p = a.body;
|
|
3371
|
+
if (p.length + y.length <= x) {
|
|
3372
|
+
const w = p.substring(0, t), A = p.substring(t), R = w + y + A;
|
|
3373
|
+
s({
|
|
3144
3374
|
...a,
|
|
3145
|
-
body:
|
|
3375
|
+
body: R
|
|
3146
3376
|
}), setTimeout(() => {
|
|
3147
|
-
if (
|
|
3148
|
-
const
|
|
3149
|
-
|
|
3377
|
+
if (l) {
|
|
3378
|
+
const f = t + y.length;
|
|
3379
|
+
l.setSelectionRange(f, f), l.focus();
|
|
3150
3380
|
}
|
|
3151
3381
|
}, 0);
|
|
3152
3382
|
}
|
|
3153
|
-
} else if (
|
|
3383
|
+
} else if (c === "footer") {
|
|
3154
3384
|
if (!g) return;
|
|
3155
|
-
const
|
|
3156
|
-
if (
|
|
3157
|
-
const
|
|
3158
|
-
|
|
3385
|
+
const t = g.selectionStart || a.footer.length, x = 60, p = a.footer;
|
|
3386
|
+
if (p.length + y.length <= x) {
|
|
3387
|
+
const w = p.substring(0, t), A = p.substring(t), R = w + y + A;
|
|
3388
|
+
s({
|
|
3159
3389
|
...a,
|
|
3160
|
-
footer:
|
|
3390
|
+
footer: R
|
|
3161
3391
|
}), setTimeout(() => {
|
|
3162
3392
|
if (g) {
|
|
3163
|
-
const
|
|
3164
|
-
g.setSelectionRange(
|
|
3393
|
+
const f = t + y.length;
|
|
3394
|
+
g.setSelectionRange(f, f), g.focus();
|
|
3165
3395
|
}
|
|
3166
3396
|
}, 0);
|
|
3167
3397
|
}
|
|
@@ -3173,22 +3403,24 @@ function sa({ template: a, setTemplate: n }) {
|
|
|
3173
3403
|
/* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
|
|
3174
3404
|
"textarea",
|
|
3175
3405
|
{
|
|
3176
|
-
ref:
|
|
3406
|
+
ref: v,
|
|
3177
3407
|
value: a.body,
|
|
3178
|
-
onChange: (
|
|
3408
|
+
onChange: (y) => s({ ...a, body: y.target.value }),
|
|
3179
3409
|
maxLength: 1024,
|
|
3180
3410
|
rows: 6,
|
|
3181
3411
|
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",
|
|
3182
3412
|
placeholder: "Enter the text for your message",
|
|
3183
|
-
onFocus: () =>
|
|
3413
|
+
onFocus: () => o("body"),
|
|
3414
|
+
onBlur: () => V(!0)
|
|
3184
3415
|
}
|
|
3185
3416
|
) }),
|
|
3417
|
+
!a.body && k && /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-red-600 rsp-mt-1", children: "Body is required." }),
|
|
3186
3418
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-mt-2", children: [
|
|
3187
3419
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
3188
3420
|
/* @__PURE__ */ e(
|
|
3189
3421
|
"button",
|
|
3190
3422
|
{
|
|
3191
|
-
onClick:
|
|
3423
|
+
onClick: N,
|
|
3192
3424
|
className: "rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",
|
|
3193
3425
|
title: "Add Variable",
|
|
3194
3426
|
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" }) })
|
|
@@ -3197,10 +3429,10 @@ function sa({ template: a, setTemplate: n }) {
|
|
|
3197
3429
|
/* @__PURE__ */ e(
|
|
3198
3430
|
"button",
|
|
3199
3431
|
{
|
|
3200
|
-
onClick:
|
|
3432
|
+
onClick: M,
|
|
3201
3433
|
className: "rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",
|
|
3202
3434
|
title: "Add emoji",
|
|
3203
|
-
children: /* @__PURE__ */ e(
|
|
3435
|
+
children: /* @__PURE__ */ e(ue, { className: "rsp-w-4 rsp-h-4" })
|
|
3204
3436
|
}
|
|
3205
3437
|
)
|
|
3206
3438
|
] }),
|
|
@@ -3210,15 +3442,15 @@ function sa({ template: a, setTemplate: n }) {
|
|
|
3210
3442
|
] }) })
|
|
3211
3443
|
] }),
|
|
3212
3444
|
(() => {
|
|
3213
|
-
const
|
|
3214
|
-
return
|
|
3445
|
+
const y = a.body.match(/\{\{(\d+)\}\}/g) || [], t = [...new Set(y.map((x) => x.replace(/[{}]/g, "")))];
|
|
3446
|
+
return t.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
|
|
3215
3447
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2", children: "Sample Values" }),
|
|
3216
|
-
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children:
|
|
3217
|
-
var
|
|
3448
|
+
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: t.map((x) => {
|
|
3449
|
+
var p, w;
|
|
3218
3450
|
return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
3219
3451
|
/* @__PURE__ */ r("label", { className: "rsp-text-xs rsp-text-gray-500 rsp-whitespace-nowrap", children: [
|
|
3220
3452
|
"{{",
|
|
3221
|
-
|
|
3453
|
+
x,
|
|
3222
3454
|
"}}",
|
|
3223
3455
|
":"
|
|
3224
3456
|
] }),
|
|
@@ -3226,21 +3458,21 @@ function sa({ template: a, setTemplate: n }) {
|
|
|
3226
3458
|
"input",
|
|
3227
3459
|
{
|
|
3228
3460
|
type: "text",
|
|
3229
|
-
value: ((
|
|
3230
|
-
onChange: (
|
|
3231
|
-
var
|
|
3232
|
-
const
|
|
3461
|
+
value: ((w = (p = a.sampleContent) == null ? void 0 : p.bodyVariables) == null ? void 0 : w[x]) || "",
|
|
3462
|
+
onChange: (A) => {
|
|
3463
|
+
var f, C, U;
|
|
3464
|
+
const R = {
|
|
3233
3465
|
...a.sampleContent,
|
|
3234
3466
|
bodyVariables: {
|
|
3235
|
-
...(
|
|
3236
|
-
[
|
|
3467
|
+
...(f = a.sampleContent) == null ? void 0 : f.bodyVariables,
|
|
3468
|
+
[x]: A.target.value
|
|
3237
3469
|
},
|
|
3238
|
-
headerVariables: ((
|
|
3239
|
-
buttonVariables: ((
|
|
3470
|
+
headerVariables: ((C = a.sampleContent) == null ? void 0 : C.headerVariables) || {},
|
|
3471
|
+
buttonVariables: ((U = a.sampleContent) == null ? void 0 : U.buttonVariables) || {}
|
|
3240
3472
|
};
|
|
3241
|
-
|
|
3473
|
+
s({
|
|
3242
3474
|
...a,
|
|
3243
|
-
sampleContent:
|
|
3475
|
+
sampleContent: R
|
|
3244
3476
|
});
|
|
3245
3477
|
},
|
|
3246
3478
|
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",
|
|
@@ -3252,16 +3484,16 @@ function sa({ template: a, setTemplate: n }) {
|
|
|
3252
3484
|
{
|
|
3253
3485
|
type: "button",
|
|
3254
3486
|
onClick: () => {
|
|
3255
|
-
var
|
|
3256
|
-
const
|
|
3257
|
-
|
|
3487
|
+
var C, U, O;
|
|
3488
|
+
const A = new RegExp(`\\{\\{${x}\\}\\}`, "g"), R = (a.body || "").replace(A, ""), f = Object.fromEntries(Object.entries(((C = a.sampleContent) == null ? void 0 : C.bodyVariables) || {}).filter(([P]) => P !== x));
|
|
3489
|
+
s({
|
|
3258
3490
|
...a,
|
|
3259
|
-
body:
|
|
3491
|
+
body: R,
|
|
3260
3492
|
sampleContent: {
|
|
3261
3493
|
...a.sampleContent,
|
|
3262
|
-
bodyVariables:
|
|
3263
|
-
headerVariables: ((
|
|
3264
|
-
buttonVariables: ((
|
|
3494
|
+
bodyVariables: f,
|
|
3495
|
+
headerVariables: ((U = a.sampleContent) == null ? void 0 : U.headerVariables) || {},
|
|
3496
|
+
buttonVariables: ((O = a.sampleContent) == null ? void 0 : O.buttonVariables) || {}
|
|
3265
3497
|
}
|
|
3266
3498
|
});
|
|
3267
3499
|
},
|
|
@@ -3270,7 +3502,7 @@ function sa({ template: a, setTemplate: n }) {
|
|
|
3270
3502
|
children: "×"
|
|
3271
3503
|
}
|
|
3272
3504
|
)
|
|
3273
|
-
] }, `body-sample-${
|
|
3505
|
+
] }, `body-sample-${x}`);
|
|
3274
3506
|
}) })
|
|
3275
3507
|
] });
|
|
3276
3508
|
})()
|
|
@@ -3280,14 +3512,14 @@ function sa({ template: a, setTemplate: n }) {
|
|
|
3280
3512
|
/* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
|
|
3281
3513
|
"input",
|
|
3282
3514
|
{
|
|
3283
|
-
ref:
|
|
3515
|
+
ref: h,
|
|
3284
3516
|
type: "text",
|
|
3285
3517
|
value: a.footer,
|
|
3286
|
-
onChange: (
|
|
3518
|
+
onChange: (y) => s({ ...a, footer: y.target.value }),
|
|
3287
3519
|
maxLength: 60,
|
|
3288
3520
|
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",
|
|
3289
3521
|
placeholder: "Footer Text",
|
|
3290
|
-
onFocus: () =>
|
|
3522
|
+
onFocus: () => o("footer")
|
|
3291
3523
|
}
|
|
3292
3524
|
) }),
|
|
3293
3525
|
/* @__PURE__ */ r("p", { className: "rsp-text-xs rsp-text-gray-500 rsp-mt-1", children: [
|
|
@@ -3296,93 +3528,95 @@ function sa({ template: a, setTemplate: n }) {
|
|
|
3296
3528
|
] })
|
|
3297
3529
|
] }),
|
|
3298
3530
|
/* @__PURE__ */ e(
|
|
3299
|
-
|
|
3531
|
+
ye,
|
|
3300
3532
|
{
|
|
3301
|
-
isOpen:
|
|
3302
|
-
onClose: () =>
|
|
3303
|
-
onSelect:
|
|
3533
|
+
isOpen: n,
|
|
3534
|
+
onClose: () => i(!1),
|
|
3535
|
+
onSelect: b
|
|
3304
3536
|
}
|
|
3305
3537
|
)
|
|
3306
3538
|
] });
|
|
3307
3539
|
}
|
|
3308
|
-
function
|
|
3309
|
-
var
|
|
3310
|
-
const [
|
|
3540
|
+
function ha({ template: a, setTemplate: s }) {
|
|
3541
|
+
var y;
|
|
3542
|
+
const [n, i] = B(null), [c, o] = B(!1), [l, v] = B({
|
|
3311
3543
|
text: "",
|
|
3312
3544
|
value: "",
|
|
3313
3545
|
urlType: "static"
|
|
3314
|
-
}),
|
|
3546
|
+
}), h = {
|
|
3315
3547
|
quickReply: a.buttons.filter((t) => t.type === "QUICK_REPLY").length,
|
|
3316
3548
|
url: a.buttons.filter((t) => t.type === "URL").length,
|
|
3317
3549
|
call: a.buttons.filter((t) => t.type === "CALL").length,
|
|
3318
3550
|
flow: a.buttons.filter((t) => t.type === "FLOW").length
|
|
3319
|
-
},
|
|
3320
|
-
|
|
3321
|
-
},
|
|
3322
|
-
if (!
|
|
3323
|
-
|
|
3551
|
+
}, k = () => {
|
|
3552
|
+
v({ text: "", value: "", urlType: "static" }), i(null), o(!1);
|
|
3553
|
+
}, V = (t) => {
|
|
3554
|
+
if (!l.text.trim()) return;
|
|
3555
|
+
let x = t === "QUICK_REPLY" ? l.text : l.value;
|
|
3556
|
+
t === "CALL" && x && !x.startsWith("+") && (x = "+" + x);
|
|
3557
|
+
const p = {
|
|
3324
3558
|
id: Math.random().toString(36).substr(2, 9),
|
|
3325
3559
|
type: t,
|
|
3326
|
-
text:
|
|
3327
|
-
value:
|
|
3328
|
-
urlType: t === "URL" ?
|
|
3560
|
+
text: l.text,
|
|
3561
|
+
value: x,
|
|
3562
|
+
urlType: t === "URL" ? l.urlType : void 0
|
|
3329
3563
|
};
|
|
3330
|
-
|
|
3564
|
+
s({
|
|
3331
3565
|
...a,
|
|
3332
|
-
buttons: [...a.buttons,
|
|
3333
|
-
}),
|
|
3334
|
-
},
|
|
3335
|
-
|
|
3566
|
+
buttons: [...a.buttons, p]
|
|
3567
|
+
}), k();
|
|
3568
|
+
}, d = (t) => {
|
|
3569
|
+
s({
|
|
3336
3570
|
...a,
|
|
3337
|
-
buttons: a.buttons.filter((
|
|
3571
|
+
buttons: a.buttons.filter((x) => x.id !== t)
|
|
3338
3572
|
});
|
|
3339
|
-
},
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3573
|
+
}, N = (t, x, p) => {
|
|
3574
|
+
const w = a.buttons.find((f) => f.id === t), A = x === "text" ? 25 : x === "value" && (w == null ? void 0 : w.type) === "URL" ? 2e3 : 20;
|
|
3575
|
+
let R = p.slice(0, A);
|
|
3576
|
+
x === "value" && (w == null ? void 0 : w.type) === "CALL" && R && !R.startsWith("+") && (R = "+" + R), s({
|
|
3343
3577
|
...a,
|
|
3344
3578
|
buttons: a.buttons.map(
|
|
3345
|
-
(
|
|
3579
|
+
(f) => f.id === t ? { ...f, [x]: R } : f
|
|
3346
3580
|
)
|
|
3347
3581
|
});
|
|
3348
|
-
},
|
|
3349
|
-
const
|
|
3350
|
-
...a.buttons.filter((
|
|
3351
|
-
|
|
3582
|
+
}, M = () => {
|
|
3583
|
+
const x = [
|
|
3584
|
+
...a.buttons.filter((w) => w.type === "URL" && w.urlType === "dynamic").map((w) => w.value || ""),
|
|
3585
|
+
l.value
|
|
3352
3586
|
// Include current form input
|
|
3353
3587
|
].join(" ").match(/{{\d+}}/g);
|
|
3354
|
-
if (!
|
|
3355
|
-
const
|
|
3356
|
-
const
|
|
3357
|
-
return
|
|
3588
|
+
if (!x) return 0;
|
|
3589
|
+
const p = x.map((w) => {
|
|
3590
|
+
const A = w.match(/{{(\d+)}}/);
|
|
3591
|
+
return A ? parseInt(A[1], 10) : 0;
|
|
3358
3592
|
});
|
|
3359
|
-
return
|
|
3360
|
-
},
|
|
3593
|
+
return p.length > 0 ? Math.max(...p) : 0;
|
|
3594
|
+
}, b = [
|
|
3361
3595
|
{
|
|
3362
3596
|
type: "QUICK_REPLY",
|
|
3363
|
-
icon:
|
|
3597
|
+
icon: me,
|
|
3364
3598
|
label: "Quick Reply",
|
|
3365
3599
|
description: "Add quick response options",
|
|
3366
3600
|
limit: 10,
|
|
3367
|
-
current:
|
|
3601
|
+
current: h.quickReply,
|
|
3368
3602
|
color: "blue"
|
|
3369
3603
|
},
|
|
3370
3604
|
{
|
|
3371
3605
|
type: "URL",
|
|
3372
|
-
icon:
|
|
3606
|
+
icon: qe,
|
|
3373
3607
|
label: "Web URL",
|
|
3374
3608
|
description: "Link to websites or pages",
|
|
3375
3609
|
limit: 2,
|
|
3376
|
-
current:
|
|
3610
|
+
current: h.url,
|
|
3377
3611
|
color: "green"
|
|
3378
3612
|
},
|
|
3379
3613
|
{
|
|
3380
3614
|
type: "CALL",
|
|
3381
|
-
icon:
|
|
3615
|
+
icon: Ve,
|
|
3382
3616
|
label: "Call Button",
|
|
3383
3617
|
description: "Add phone number to call",
|
|
3384
3618
|
limit: 1,
|
|
3385
|
-
current:
|
|
3619
|
+
current: h.call,
|
|
3386
3620
|
color: "purple"
|
|
3387
3621
|
}
|
|
3388
3622
|
// {
|
|
@@ -3407,17 +3641,17 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3407
3641
|
/* @__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" }) }) }),
|
|
3408
3642
|
/* @__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." }) })
|
|
3409
3643
|
] }) }),
|
|
3410
|
-
!
|
|
3411
|
-
const
|
|
3644
|
+
!n && /* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-1 md:rsp-grid-cols-2 rsp-gap-4", children: b.map((t) => {
|
|
3645
|
+
const x = t.icon, p = t.current >= t.limit;
|
|
3412
3646
|
return /* @__PURE__ */ e(
|
|
3413
3647
|
"button",
|
|
3414
3648
|
{
|
|
3415
|
-
onClick: () => !
|
|
3416
|
-
disabled:
|
|
3417
|
-
className: `rsp-p-4 rsp-border-2 rsp-rounded-xl rsp-text-left rsp-transition-all rsp-duration-200 ${
|
|
3649
|
+
onClick: () => !p && i(t.type),
|
|
3650
|
+
disabled: p,
|
|
3651
|
+
className: `rsp-p-4 rsp-border-2 rsp-rounded-xl rsp-text-left rsp-transition-all rsp-duration-200 ${p ? "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"}`,
|
|
3418
3652
|
children: /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-start rsp-justify-between", children: [
|
|
3419
3653
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-3", children: [
|
|
3420
|
-
/* @__PURE__ */ e("div", { className: `rsp-p-2 rsp-rounded-lg ${
|
|
3654
|
+
/* @__PURE__ */ e("div", { className: `rsp-p-2 rsp-rounded-lg ${p ? "rsp-bg-gray-200" : "rsp-bg-white rsp-shadow-sm"}`, children: /* @__PURE__ */ e(x, { className: "rsp-w-5 rsp-h-5" }) }),
|
|
3421
3655
|
/* @__PURE__ */ r("div", { children: [
|
|
3422
3656
|
/* @__PURE__ */ e("h4", { className: "rsp-font-semibold rsp-text-sm", children: t.label }),
|
|
3423
3657
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-opacity-80 rsp-mt-1", children: t.description })
|
|
@@ -3429,25 +3663,25 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3429
3663
|
"/",
|
|
3430
3664
|
t.limit
|
|
3431
3665
|
] }),
|
|
3432
|
-
!
|
|
3666
|
+
!p && /* @__PURE__ */ e(he, { className: "rsp-w-4 rsp-h-4" })
|
|
3433
3667
|
] })
|
|
3434
3668
|
] })
|
|
3435
3669
|
},
|
|
3436
3670
|
t.type
|
|
3437
3671
|
);
|
|
3438
3672
|
}) }),
|
|
3439
|
-
|
|
3673
|
+
n && /* @__PURE__ */ r("div", { className: "rsp-bg-gradient-to-br rsp-from-gray-50 rsp-to-gray-100 rsp-border rsp-border-gray-200 rsp-rounded-xl rsp-p-6 rsp-shadow-sm", children: [
|
|
3440
3674
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-mb-4", children: [
|
|
3441
3675
|
/* @__PURE__ */ r("h4", { className: "rsp-text-lg rsp-font-semibold rsp-text-gray-900", children: [
|
|
3442
3676
|
"Add ",
|
|
3443
|
-
(
|
|
3677
|
+
(y = b.find((t) => t.type === n)) == null ? void 0 : y.label
|
|
3444
3678
|
] }),
|
|
3445
3679
|
/* @__PURE__ */ e(
|
|
3446
3680
|
"button",
|
|
3447
3681
|
{
|
|
3448
|
-
onClick:
|
|
3682
|
+
onClick: k,
|
|
3449
3683
|
className: "rsp-p-2 rsp-text-gray-400 hover:rsp-text-gray-600 hover:rsp-bg-white rsp-rounded-lg rsp-transition-colors",
|
|
3450
|
-
children: /* @__PURE__ */ e(
|
|
3684
|
+
children: /* @__PURE__ */ e(re, { className: "rsp-w-5 rsp-h-5" })
|
|
3451
3685
|
}
|
|
3452
3686
|
)
|
|
3453
3687
|
] }),
|
|
@@ -3459,30 +3693,30 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3459
3693
|
"input",
|
|
3460
3694
|
{
|
|
3461
3695
|
type: "text",
|
|
3462
|
-
value:
|
|
3463
|
-
onChange: (t) =>
|
|
3696
|
+
value: l.text,
|
|
3697
|
+
onChange: (t) => v({ ...l, text: t.target.value.slice(0, 25) }),
|
|
3464
3698
|
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",
|
|
3465
3699
|
placeholder: "Enter button text (max 25 characters)",
|
|
3466
3700
|
maxLength: 25
|
|
3467
3701
|
}
|
|
3468
3702
|
),
|
|
3469
3703
|
/* @__PURE__ */ r("span", { className: "rsp-absolute rsp-right-3 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-xs rsp-text-gray-400", children: [
|
|
3470
|
-
|
|
3704
|
+
l.text.length,
|
|
3471
3705
|
"/25"
|
|
3472
3706
|
] })
|
|
3473
3707
|
] })
|
|
3474
3708
|
] }),
|
|
3475
|
-
|
|
3476
|
-
/* @__PURE__ */ e("label", { className: "rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2", children:
|
|
3477
|
-
|
|
3709
|
+
n !== "QUICK_REPLY" && /* @__PURE__ */ r("div", { children: [
|
|
3710
|
+
/* @__PURE__ */ e("label", { className: "rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2", children: n === "URL" ? "Website URL" : n === "CALL" ? "Phone Number" : "Flow ID" }),
|
|
3711
|
+
n === "URL" && /* @__PURE__ */ r("div", { className: "rsp-mb-3", children: [
|
|
3478
3712
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-gap-4", children: [
|
|
3479
3713
|
/* @__PURE__ */ r("label", { className: "rsp-flex rsp-items-center rsp-cursor-pointer", children: [
|
|
3480
3714
|
/* @__PURE__ */ e(
|
|
3481
3715
|
"input",
|
|
3482
3716
|
{
|
|
3483
3717
|
type: "radio",
|
|
3484
|
-
checked:
|
|
3485
|
-
onChange: () =>
|
|
3718
|
+
checked: l.urlType === "static",
|
|
3719
|
+
onChange: () => v({ ...l, urlType: "static" }),
|
|
3486
3720
|
className: "rsp-mr-2 rsp-text-blue-600"
|
|
3487
3721
|
}
|
|
3488
3722
|
),
|
|
@@ -3493,15 +3727,15 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3493
3727
|
"input",
|
|
3494
3728
|
{
|
|
3495
3729
|
type: "radio",
|
|
3496
|
-
checked:
|
|
3497
|
-
onChange: () =>
|
|
3730
|
+
checked: l.urlType === "dynamic",
|
|
3731
|
+
onChange: () => v({ ...l, urlType: "dynamic" }),
|
|
3498
3732
|
className: "rsp-mr-2 rsp-text-blue-600"
|
|
3499
3733
|
}
|
|
3500
3734
|
),
|
|
3501
3735
|
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-700", children: "Dynamic URL" })
|
|
3502
3736
|
] })
|
|
3503
3737
|
] }),
|
|
3504
|
-
|
|
3738
|
+
l.urlType === "dynamic" && /* @__PURE__ */ r("div", { className: "rsp-mt-3 rsp-p-3 rsp-bg-blue-50 rsp-rounded-lg rsp-border rsp-border-blue-200", children: [
|
|
3505
3739
|
/* @__PURE__ */ e("h4", { className: "rsp-text-sm rsp-font-medium rsp-text-blue-800 rsp-mb-2", children: "Dynamic URL Guidelines:" }),
|
|
3506
3740
|
/* @__PURE__ */ r("ul", { className: "rsp-text-xs rsp-text-blue-700 rsp-space-y-1", children: [
|
|
3507
3741
|
/* @__PURE__ */ e("li", { children: "• Use placeholders like: https://example.com/order/{{1}}" }),
|
|
@@ -3515,74 +3749,74 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3515
3749
|
/* @__PURE__ */ e(
|
|
3516
3750
|
"input",
|
|
3517
3751
|
{
|
|
3518
|
-
type:
|
|
3519
|
-
value:
|
|
3752
|
+
type: n === "CALL" ? "tel" : n === "URL" ? "url" : "text",
|
|
3753
|
+
value: l.value,
|
|
3520
3754
|
onChange: (t) => {
|
|
3521
|
-
const
|
|
3522
|
-
|
|
3755
|
+
const x = n === "URL" ? 2e3 : 20;
|
|
3756
|
+
v({ ...l, value: t.target.value.slice(0, x) });
|
|
3523
3757
|
},
|
|
3524
3758
|
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",
|
|
3525
|
-
placeholder:
|
|
3526
|
-
maxLength:
|
|
3759
|
+
placeholder: n === "URL" ? l.urlType === "dynamic" ? "https://example.com/order/{{1}}?user={{2}}" : "https://example.com" : n === "CALL" ? "+1234567890" : "Flow ID",
|
|
3760
|
+
maxLength: n === "URL" ? 2e3 : 20
|
|
3527
3761
|
}
|
|
3528
3762
|
),
|
|
3529
3763
|
/* @__PURE__ */ r("span", { className: "rsp-absolute rsp-right-3 rsp-top-1/2 rsp-transform -rsp-translate-y-1/2 rsp-text-xs rsp-text-gray-400", children: [
|
|
3530
|
-
|
|
3764
|
+
l.value.length,
|
|
3531
3765
|
"/",
|
|
3532
|
-
|
|
3766
|
+
n === "URL" ? 2e3 : 20
|
|
3533
3767
|
] })
|
|
3534
3768
|
] }),
|
|
3535
|
-
|
|
3769
|
+
n === "URL" && l.urlType === "dynamic" && /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
|
|
3536
3770
|
/* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center rsp-gap-2 rsp-mb-2", children: /* @__PURE__ */ e(
|
|
3537
3771
|
"button",
|
|
3538
3772
|
{
|
|
3539
3773
|
type: "button",
|
|
3540
3774
|
onClick: () => {
|
|
3541
|
-
if ((
|
|
3542
|
-
const
|
|
3543
|
-
|
|
3775
|
+
if ((l.value.match(/\{\{(\d+)\}\}/g) || []).length >= 3) return;
|
|
3776
|
+
const p = M() + 1, w = l.value + `{{${p}}}`;
|
|
3777
|
+
v({ ...l, value: w }), o(!0);
|
|
3544
3778
|
},
|
|
3545
|
-
disabled: (
|
|
3779
|
+
disabled: (l.value.match(/\{\{(\d+)\}\}/g) || []).length >= 3,
|
|
3546
3780
|
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",
|
|
3547
3781
|
children: "+ Add Variable"
|
|
3548
3782
|
}
|
|
3549
3783
|
) }),
|
|
3550
|
-
(
|
|
3551
|
-
|
|
3784
|
+
(l.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." }),
|
|
3785
|
+
c && /* @__PURE__ */ r("div", { className: "rsp-mt-4 rsp-p-4 rsp-bg-gray-50 rsp-rounded-lg rsp-border", children: [
|
|
3552
3786
|
/* @__PURE__ */ e("h4", { className: "rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-3", children: "Sample Values for URL Variables" }),
|
|
3553
3787
|
/* @__PURE__ */ e("div", { className: "rsp-space-y-3", children: (() => {
|
|
3554
|
-
const t =
|
|
3555
|
-
return [...new Set(t.map((
|
|
3556
|
-
var
|
|
3788
|
+
const t = l.value.match(/\{\{(\d+)\}\}/g) || [];
|
|
3789
|
+
return [...new Set(t.map((p) => p.replace(/[{}]/g, "")))].map((p) => {
|
|
3790
|
+
var w, A;
|
|
3557
3791
|
return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
3558
3792
|
/* @__PURE__ */ r("label", { className: "rsp-text-sm rsp-text-gray-600 rsp-whitespace-nowrap", children: [
|
|
3559
3793
|
"Variable {{",
|
|
3560
|
-
|
|
3794
|
+
p,
|
|
3561
3795
|
"}}"
|
|
3562
3796
|
] }),
|
|
3563
3797
|
/* @__PURE__ */ e(
|
|
3564
3798
|
"input",
|
|
3565
3799
|
{
|
|
3566
3800
|
type: "text",
|
|
3567
|
-
value: ((
|
|
3568
|
-
onChange: (
|
|
3569
|
-
var
|
|
3570
|
-
const
|
|
3801
|
+
value: ((A = (w = a.sampleContent) == null ? void 0 : w.buttonVariables) == null ? void 0 : A[p]) || "",
|
|
3802
|
+
onChange: (R) => {
|
|
3803
|
+
var C, U, O;
|
|
3804
|
+
const f = {
|
|
3571
3805
|
...a.sampleContent,
|
|
3572
|
-
headerVariables: ((
|
|
3573
|
-
bodyVariables: ((
|
|
3806
|
+
headerVariables: ((C = a.sampleContent) == null ? void 0 : C.headerVariables) || {},
|
|
3807
|
+
bodyVariables: ((U = a.sampleContent) == null ? void 0 : U.bodyVariables) || {},
|
|
3574
3808
|
buttonVariables: {
|
|
3575
|
-
...(
|
|
3576
|
-
[
|
|
3809
|
+
...(O = a.sampleContent) == null ? void 0 : O.buttonVariables,
|
|
3810
|
+
[p]: R.target.value
|
|
3577
3811
|
}
|
|
3578
3812
|
};
|
|
3579
|
-
|
|
3813
|
+
s({
|
|
3580
3814
|
...a,
|
|
3581
|
-
sampleContent:
|
|
3815
|
+
sampleContent: f
|
|
3582
3816
|
});
|
|
3583
3817
|
},
|
|
3584
3818
|
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",
|
|
3585
|
-
placeholder: `Sample value (e.g., ${
|
|
3819
|
+
placeholder: `Sample value (e.g., ${p === "1" ? "order123" : "user456"})`
|
|
3586
3820
|
}
|
|
3587
3821
|
),
|
|
3588
3822
|
/* @__PURE__ */ e(
|
|
@@ -3590,17 +3824,17 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3590
3824
|
{
|
|
3591
3825
|
type: "button",
|
|
3592
3826
|
onClick: () => {
|
|
3593
|
-
var
|
|
3594
|
-
const
|
|
3595
|
-
|
|
3596
|
-
const
|
|
3597
|
-
|
|
3827
|
+
var U, O, P;
|
|
3828
|
+
const R = new RegExp(`\\{\\{${p}\\}\\}`, "g"), f = (l.value || "").replace(R, "");
|
|
3829
|
+
v({ ...l, value: f });
|
|
3830
|
+
const C = Object.fromEntries(Object.entries(((U = a.sampleContent) == null ? void 0 : U.buttonVariables) || {}).filter(([H]) => H !== p));
|
|
3831
|
+
s({
|
|
3598
3832
|
...a,
|
|
3599
3833
|
sampleContent: {
|
|
3600
3834
|
...a.sampleContent,
|
|
3601
|
-
headerVariables: ((
|
|
3602
|
-
bodyVariables: ((
|
|
3603
|
-
buttonVariables:
|
|
3835
|
+
headerVariables: ((O = a.sampleContent) == null ? void 0 : O.headerVariables) || {},
|
|
3836
|
+
bodyVariables: ((P = a.sampleContent) == null ? void 0 : P.bodyVariables) || {},
|
|
3837
|
+
buttonVariables: C
|
|
3604
3838
|
}
|
|
3605
3839
|
});
|
|
3606
3840
|
},
|
|
@@ -3609,16 +3843,16 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3609
3843
|
children: "×"
|
|
3610
3844
|
}
|
|
3611
3845
|
)
|
|
3612
|
-
] }, `sample-${
|
|
3846
|
+
] }, `sample-${p}`);
|
|
3613
3847
|
});
|
|
3614
3848
|
})() }),
|
|
3615
3849
|
/* @__PURE__ */ r("div", { className: "rsp-mt-4 rsp-p-3 rsp-bg-white rsp-rounded-lg rsp-border", children: [
|
|
3616
3850
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-700 rsp-mb-1", children: "Preview URL:" }),
|
|
3617
|
-
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-600 rsp-font-mono rsp-break-all", children:
|
|
3851
|
+
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-600 rsp-font-mono rsp-break-all", children: l.value.replace(
|
|
3618
3852
|
/\{\{(\d+)\}\}/g,
|
|
3619
|
-
(t,
|
|
3620
|
-
var
|
|
3621
|
-
return ((
|
|
3853
|
+
(t, x) => {
|
|
3854
|
+
var p, w;
|
|
3855
|
+
return ((w = (p = a.sampleContent) == null ? void 0 : p.buttonVariables) == null ? void 0 : w[x]) || `[${t}]`;
|
|
3622
3856
|
}
|
|
3623
3857
|
) })
|
|
3624
3858
|
] }),
|
|
@@ -3626,7 +3860,7 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3626
3860
|
"button",
|
|
3627
3861
|
{
|
|
3628
3862
|
type: "button",
|
|
3629
|
-
onClick: () =>
|
|
3863
|
+
onClick: () => o(!1),
|
|
3630
3864
|
className: "rsp-px-3 rsp-py-1 rsp-text-xs rsp-text-gray-500 hover:rsp-text-gray-700",
|
|
3631
3865
|
children: "Close"
|
|
3632
3866
|
}
|
|
@@ -3638,8 +3872,8 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3638
3872
|
/* @__PURE__ */ e(
|
|
3639
3873
|
"button",
|
|
3640
3874
|
{
|
|
3641
|
-
onClick: () =>
|
|
3642
|
-
disabled: !
|
|
3875
|
+
onClick: () => V(n),
|
|
3876
|
+
disabled: !l.text.trim() || n !== "QUICK_REPLY" && !l.value.trim(),
|
|
3643
3877
|
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",
|
|
3644
3878
|
children: "Add Button"
|
|
3645
3879
|
}
|
|
@@ -3647,7 +3881,7 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3647
3881
|
/* @__PURE__ */ e(
|
|
3648
3882
|
"button",
|
|
3649
3883
|
{
|
|
3650
|
-
onClick:
|
|
3884
|
+
onClick: k,
|
|
3651
3885
|
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",
|
|
3652
3886
|
children: "Cancel"
|
|
3653
3887
|
}
|
|
@@ -3658,18 +3892,18 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3658
3892
|
a.buttons.length > 0 && /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
|
|
3659
3893
|
/* @__PURE__ */ e("h4", { className: "rsp-text-md rsp-font-semibold rsp-text-gray-900", children: "Added Buttons" }),
|
|
3660
3894
|
/* @__PURE__ */ e("div", { className: "rsp-space-y-3", children: a.buttons.map((t) => {
|
|
3661
|
-
const
|
|
3895
|
+
const x = b.find((w) => w.type === t.type), p = (x == null ? void 0 : x.icon) || me;
|
|
3662
3896
|
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: [
|
|
3663
|
-
/* @__PURE__ */ e("div", { className: "rsp-p-2 rsp-bg-gray-50 rsp-rounded-lg", children: /* @__PURE__ */ e(
|
|
3897
|
+
/* @__PURE__ */ e("div", { className: "rsp-p-2 rsp-bg-gray-50 rsp-rounded-lg", children: /* @__PURE__ */ e(p, { className: "rsp-w-4 rsp-h-4 rsp-text-gray-600" }) }),
|
|
3664
3898
|
/* @__PURE__ */ r("div", { className: "rsp-flex-1 rsp-space-y-3", children: [
|
|
3665
3899
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between", children: [
|
|
3666
3900
|
/* @__PURE__ */ e("span", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-500 rsp-uppercase rsp-tracking-wider", children: t.type.replace("_", " ") }),
|
|
3667
3901
|
/* @__PURE__ */ e(
|
|
3668
3902
|
"button",
|
|
3669
3903
|
{
|
|
3670
|
-
onClick: () =>
|
|
3904
|
+
onClick: () => d(t.id),
|
|
3671
3905
|
className: "rsp-p-1 rsp-text-red-400 hover:rsp-text-red-600 hover:rsp-bg-red-50 rsp-rounded rsp-transition-colors",
|
|
3672
|
-
children: /* @__PURE__ */ e(
|
|
3906
|
+
children: /* @__PURE__ */ e(re, { className: "rsp-w-4 rsp-h-4" })
|
|
3673
3907
|
}
|
|
3674
3908
|
)
|
|
3675
3909
|
] }),
|
|
@@ -3682,7 +3916,7 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3682
3916
|
{
|
|
3683
3917
|
type: "text",
|
|
3684
3918
|
value: t.text,
|
|
3685
|
-
onChange: (
|
|
3919
|
+
onChange: (w) => N(t.id, "text", w.target.value),
|
|
3686
3920
|
maxLength: 25,
|
|
3687
3921
|
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"
|
|
3688
3922
|
}
|
|
@@ -3701,7 +3935,7 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3701
3935
|
{
|
|
3702
3936
|
type: t.type === "CALL" ? "tel" : t.type === "URL" ? "url" : "text",
|
|
3703
3937
|
value: t.value || "",
|
|
3704
|
-
onChange: (
|
|
3938
|
+
onChange: (w) => N(t.id, "value", w.target.value),
|
|
3705
3939
|
maxLength: t.type === "URL" ? 2e3 : 20,
|
|
3706
3940
|
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"
|
|
3707
3941
|
}
|
|
@@ -3718,66 +3952,66 @@ function na({ template: a, setTemplate: n }) {
|
|
|
3718
3952
|
] }) }, t.id);
|
|
3719
3953
|
}) })
|
|
3720
3954
|
] }),
|
|
3721
|
-
a.buttons.length === 0 && !
|
|
3722
|
-
/* @__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(
|
|
3955
|
+
a.buttons.length === 0 && !n && /* @__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: [
|
|
3956
|
+
/* @__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(me, { className: "rsp-w-8 rsp-h-8 rsp-text-gray-400" }) }),
|
|
3723
3957
|
/* @__PURE__ */ e("h3", { className: "rsp-text-lg rsp-font-medium rsp-text-gray-900 rsp-mb-2", children: "No buttons added yet" }),
|
|
3724
3958
|
/* @__PURE__ */ e("p", { className: "rsp-text-gray-500 rsp-text-sm rsp-mb-4", children: "Add interactive buttons to make your message more engaging" }),
|
|
3725
3959
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-400", children: "Choose from Quick Reply, Web URL, Call, or Flow buttons above" })
|
|
3726
3960
|
] })
|
|
3727
3961
|
] });
|
|
3728
3962
|
}
|
|
3729
|
-
const
|
|
3963
|
+
const ua = async (a) => {
|
|
3730
3964
|
try {
|
|
3731
3965
|
if (!a)
|
|
3732
3966
|
throw new Error("No file provided");
|
|
3733
|
-
const
|
|
3734
|
-
if (a.size >
|
|
3735
|
-
throw new Error(`File size too large. Maximum allowed size is ${
|
|
3736
|
-
const
|
|
3737
|
-
|
|
3738
|
-
const
|
|
3967
|
+
const s = 100 * 1024 * 1024;
|
|
3968
|
+
if (a.size > s)
|
|
3969
|
+
throw new Error(`File size too large. Maximum allowed size is ${s / (1024 * 1024)}MB`);
|
|
3970
|
+
const n = new FormData();
|
|
3971
|
+
n.append("file", a), console.log("Uploading file:", a.name, "Size:", a.size, "Type:", a.type);
|
|
3972
|
+
const i = await fetch("https://wiz.resul.io/Communication/UploadDocuments", {
|
|
3739
3973
|
method: "POST",
|
|
3740
|
-
body:
|
|
3974
|
+
body: n
|
|
3741
3975
|
});
|
|
3742
|
-
console.log("Upload response status:",
|
|
3743
|
-
const
|
|
3744
|
-
console.log("Raw upload response:",
|
|
3745
|
-
let
|
|
3976
|
+
console.log("Upload response status:", i.status), console.log("Upload response headers:", Object.fromEntries(i.headers.entries()));
|
|
3977
|
+
const c = await i.text();
|
|
3978
|
+
console.log("Raw upload response:", c);
|
|
3979
|
+
let o;
|
|
3746
3980
|
try {
|
|
3747
|
-
|
|
3748
|
-
} catch (
|
|
3749
|
-
throw console.error("Failed to parse upload response:",
|
|
3981
|
+
o = JSON.parse(c);
|
|
3982
|
+
} catch (l) {
|
|
3983
|
+
throw console.error("Failed to parse upload response:", l), new Error("Invalid response from upload server");
|
|
3750
3984
|
}
|
|
3751
|
-
if (console.log("Parsed upload response:",
|
|
3752
|
-
throw new Error(
|
|
3753
|
-
if (
|
|
3754
|
-
const
|
|
3755
|
-
if (
|
|
3985
|
+
if (console.log("Parsed upload response:", o), console.log("Upload status:", o.status), console.log("Upload message:", o.message), console.log("Upload data:", o.data), !o.status)
|
|
3986
|
+
throw new Error(o.message || "Upload failed");
|
|
3987
|
+
if (o.data && Array.isArray(o.data) && o.data.length > 0) {
|
|
3988
|
+
const l = o.data[0];
|
|
3989
|
+
if (l.url)
|
|
3756
3990
|
return console.log("File uploaded successfully:", {
|
|
3757
|
-
url:
|
|
3758
|
-
filename:
|
|
3759
|
-
originalName:
|
|
3760
|
-
size:
|
|
3761
|
-
}),
|
|
3991
|
+
url: l.url,
|
|
3992
|
+
filename: l.filename,
|
|
3993
|
+
originalName: l.originalName,
|
|
3994
|
+
size: l.size
|
|
3995
|
+
}), l.url;
|
|
3762
3996
|
throw new Error("No file URL in upload response data");
|
|
3763
3997
|
} else
|
|
3764
3998
|
throw new Error("No files in upload response data");
|
|
3765
|
-
} catch (
|
|
3766
|
-
throw console.error("File upload error:",
|
|
3999
|
+
} catch (s) {
|
|
4000
|
+
throw console.error("File upload error:", s), s instanceof Error ? s : new Error("Unknown error occurred during file upload");
|
|
3767
4001
|
}
|
|
3768
|
-
},
|
|
3769
|
-
const
|
|
3770
|
-
switch (
|
|
4002
|
+
}, ba = (a, s) => {
|
|
4003
|
+
const i = a.name.toLowerCase().split(".").pop();
|
|
4004
|
+
switch (s) {
|
|
3771
4005
|
case "IMAGE":
|
|
3772
|
-
return ["jpg", "jpeg", "png", "gif", "bmp", "tiff", "svg"].includes(
|
|
4006
|
+
return ["jpg", "jpeg", "png", "gif", "bmp", "tiff", "svg"].includes(i || "");
|
|
3773
4007
|
case "VIDEO":
|
|
3774
|
-
return ["mp4", "mov", "avi", "3gpp"].includes(
|
|
4008
|
+
return ["mp4", "mov", "avi", "3gpp"].includes(i || "");
|
|
3775
4009
|
case "DOCUMENT":
|
|
3776
|
-
return ["pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt"].includes(
|
|
4010
|
+
return ["pdf", "doc", "docx", "xls", "xlsx", "ppt", "pptx", "txt"].includes(i || "");
|
|
3777
4011
|
default:
|
|
3778
4012
|
return !1;
|
|
3779
4013
|
}
|
|
3780
|
-
},
|
|
4014
|
+
}, ga = (a) => {
|
|
3781
4015
|
switch (a) {
|
|
3782
4016
|
case "IMAGE":
|
|
3783
4017
|
return 5 * 1024 * 1024;
|
|
@@ -3789,138 +4023,161 @@ const la = async (a) => {
|
|
|
3789
4023
|
return 10 * 1024 * 1024;
|
|
3790
4024
|
}
|
|
3791
4025
|
};
|
|
3792
|
-
function
|
|
3793
|
-
var
|
|
3794
|
-
const [
|
|
3795
|
-
var
|
|
3796
|
-
const
|
|
4026
|
+
function ya({ template: a, setTemplate: s, onFileUpload: n }) {
|
|
4027
|
+
var C, U, O, P, H;
|
|
4028
|
+
const [i, c] = X.useState({}), [, o] = X.useState({}), [l, v] = X.useState({ open: !1, message: "" }), [g, h] = X.useState(!1), [k, V] = X.useState(null), d = X.useRef({}), N = () => {
|
|
4029
|
+
var E;
|
|
4030
|
+
const m = {
|
|
3797
4031
|
id: Math.random().toString(36).substr(2, 9),
|
|
3798
4032
|
headerType: "MEDIA",
|
|
3799
|
-
mediaType: ((
|
|
4033
|
+
mediaType: ((E = a.carousel) == null ? void 0 : E.type) === "VIDEO" ? "VIDEO" : "IMAGE",
|
|
3800
4034
|
body: "",
|
|
3801
4035
|
buttons: []
|
|
3802
4036
|
};
|
|
3803
|
-
|
|
3804
|
-
var
|
|
4037
|
+
s((S) => {
|
|
4038
|
+
var j, I;
|
|
3805
4039
|
return {
|
|
3806
|
-
...
|
|
4040
|
+
...S,
|
|
3807
4041
|
carousel: {
|
|
3808
|
-
type: ((
|
|
3809
|
-
cards: [...((
|
|
4042
|
+
type: ((j = a.carousel) == null ? void 0 : j.type) || "IMAGE",
|
|
4043
|
+
cards: [...((I = a.carousel) == null ? void 0 : I.cards) || [], m]
|
|
3810
4044
|
}
|
|
3811
4045
|
};
|
|
3812
4046
|
});
|
|
3813
|
-
},
|
|
3814
|
-
|
|
3815
|
-
...
|
|
4047
|
+
}, M = (m) => {
|
|
4048
|
+
s((E) => ({
|
|
4049
|
+
...E,
|
|
3816
4050
|
carousel: {
|
|
3817
|
-
...
|
|
3818
|
-
cards:
|
|
4051
|
+
...E.carousel,
|
|
4052
|
+
cards: E.carousel.cards.filter((S) => S.id !== m)
|
|
3819
4053
|
}
|
|
3820
4054
|
}));
|
|
3821
|
-
},
|
|
3822
|
-
|
|
3823
|
-
...
|
|
4055
|
+
}, b = (m, E, S) => {
|
|
4056
|
+
s((j) => ({
|
|
4057
|
+
...j,
|
|
3824
4058
|
carousel: {
|
|
3825
|
-
...
|
|
3826
|
-
cards:
|
|
3827
|
-
(
|
|
4059
|
+
...j.carousel,
|
|
4060
|
+
cards: j.carousel.cards.map(
|
|
4061
|
+
(I) => I.id === m ? { ...I, [E]: S } : I
|
|
3828
4062
|
)
|
|
3829
4063
|
}
|
|
3830
4064
|
}));
|
|
3831
|
-
},
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
|
|
3843
|
-
|
|
3844
|
-
|
|
3845
|
-
|
|
3846
|
-
|
|
3847
|
-
|
|
4065
|
+
}, y = (m) => {
|
|
4066
|
+
s((E) => {
|
|
4067
|
+
const j = ((E.carousel || { type: m, cards: [] }).cards || []).map((I) => ({
|
|
4068
|
+
...I,
|
|
4069
|
+
mediaType: m,
|
|
4070
|
+
mediaUrl: ""
|
|
4071
|
+
}));
|
|
4072
|
+
return {
|
|
4073
|
+
...E,
|
|
4074
|
+
carousel: {
|
|
4075
|
+
type: m,
|
|
4076
|
+
cards: j
|
|
4077
|
+
}
|
|
4078
|
+
};
|
|
4079
|
+
});
|
|
4080
|
+
}, t = (m, E) => {
|
|
4081
|
+
var D;
|
|
4082
|
+
const S = (D = a.carousel) == null ? void 0 : D.cards.find((K) => K.id === m);
|
|
4083
|
+
if (!S) return;
|
|
4084
|
+
const z = `{{${p(m) + 1}}}`, T = S[E] + z;
|
|
4085
|
+
b(m, E, T);
|
|
4086
|
+
}, x = (m) => {
|
|
4087
|
+
var T;
|
|
4088
|
+
if (!k) return;
|
|
4089
|
+
const E = d.current[k], S = (T = a.carousel) == null ? void 0 : T.cards.find((D) => D.id === k);
|
|
4090
|
+
if (!S) return;
|
|
4091
|
+
const j = E && typeof E.selectionStart == "number" ? E.selectionStart : S.body.length, I = S.body.substring(0, j), z = S.body.substring(j), u = I + m + z;
|
|
4092
|
+
b(k, "body", u), setTimeout(() => {
|
|
4093
|
+
const D = d.current[k];
|
|
4094
|
+
if (D) {
|
|
4095
|
+
const K = j + m.length;
|
|
4096
|
+
D.setSelectionRange(K, K), D.focus();
|
|
3848
4097
|
}
|
|
3849
|
-
}, 0),
|
|
3850
|
-
},
|
|
3851
|
-
var
|
|
3852
|
-
const
|
|
3853
|
-
if (!
|
|
3854
|
-
const
|
|
3855
|
-
if (!
|
|
3856
|
-
const
|
|
3857
|
-
const
|
|
3858
|
-
return
|
|
4098
|
+
}, 0), h(!1);
|
|
4099
|
+
}, p = (m) => {
|
|
4100
|
+
var z;
|
|
4101
|
+
const E = (z = a.carousel) == null ? void 0 : z.cards.find((u) => u.id === m);
|
|
4102
|
+
if (!E) return 0;
|
|
4103
|
+
const j = (E.body || "").match(/\{\{(\d+)\}\}/g);
|
|
4104
|
+
if (!j) return 0;
|
|
4105
|
+
const I = j.map((u) => {
|
|
4106
|
+
const T = u.match(/{{(\d+)}}/);
|
|
4107
|
+
return T ? parseInt(T[1], 10) : 0;
|
|
3859
4108
|
});
|
|
3860
|
-
return
|
|
3861
|
-
},
|
|
3862
|
-
var
|
|
3863
|
-
const
|
|
3864
|
-
if (!
|
|
3865
|
-
const
|
|
4109
|
+
return I.length > 0 ? Math.max(...I) : 0;
|
|
4110
|
+
}, w = (m, E) => {
|
|
4111
|
+
var I;
|
|
4112
|
+
const S = (I = a.carousel) == null ? void 0 : I.cards.find((z) => z.id === m);
|
|
4113
|
+
if (!S || S.buttons.length >= 2) return;
|
|
4114
|
+
const j = {
|
|
3866
4115
|
id: Math.random().toString(36).substr(2, 9),
|
|
3867
|
-
type:
|
|
4116
|
+
type: E,
|
|
3868
4117
|
text: "",
|
|
3869
4118
|
value: "",
|
|
3870
4119
|
urlType: "static"
|
|
3871
4120
|
};
|
|
3872
|
-
|
|
3873
|
-
},
|
|
3874
|
-
var
|
|
3875
|
-
const
|
|
3876
|
-
if (!
|
|
3877
|
-
const
|
|
3878
|
-
(
|
|
4121
|
+
b(m, "buttons", [...S.buttons, j]);
|
|
4122
|
+
}, A = (m, E, S, j) => {
|
|
4123
|
+
var u;
|
|
4124
|
+
const I = (u = a.carousel) == null ? void 0 : u.cards.find((T) => T.id === m);
|
|
4125
|
+
if (!I) return;
|
|
4126
|
+
const z = I.buttons.map(
|
|
4127
|
+
(T) => T.id === E ? { ...T, [S]: j } : T
|
|
3879
4128
|
);
|
|
3880
|
-
|
|
3881
|
-
},
|
|
3882
|
-
var
|
|
3883
|
-
const
|
|
3884
|
-
if (!
|
|
3885
|
-
const
|
|
3886
|
-
|
|
3887
|
-
},
|
|
3888
|
-
var
|
|
4129
|
+
b(m, "buttons", z);
|
|
4130
|
+
}, R = (m, E) => {
|
|
4131
|
+
var I;
|
|
4132
|
+
const S = (I = a.carousel) == null ? void 0 : I.cards.find((z) => z.id === m);
|
|
4133
|
+
if (!S) return;
|
|
4134
|
+
const j = S.buttons.filter((z) => z.id !== E);
|
|
4135
|
+
b(m, "buttons", j);
|
|
4136
|
+
}, f = async (m, E) => {
|
|
4137
|
+
var S;
|
|
3889
4138
|
try {
|
|
3890
|
-
|
|
3891
|
-
const
|
|
3892
|
-
if (!
|
|
3893
|
-
throw new Error(`Invalid file type. Expected ${
|
|
3894
|
-
const
|
|
3895
|
-
if (
|
|
3896
|
-
const
|
|
3897
|
-
throw new Error(`File size too large. Maximum allowed size is ${
|
|
4139
|
+
c((u) => ({ ...u, [m]: !0 })), o((u) => ({ ...u, [m]: !1 }));
|
|
4140
|
+
const j = ((S = a.carousel) == null ? void 0 : S.type) === "VIDEO" ? "VIDEO" : "IMAGE";
|
|
4141
|
+
if (!ba(E, j))
|
|
4142
|
+
throw new Error(`Invalid file type. Expected ${j.toLowerCase()} file.`);
|
|
4143
|
+
const I = ga(j);
|
|
4144
|
+
if (E.size > I) {
|
|
4145
|
+
const u = I / 1048576;
|
|
4146
|
+
throw new Error(`File size too large. Maximum allowed size is ${u}MB.`);
|
|
3898
4147
|
}
|
|
3899
|
-
const
|
|
3900
|
-
|
|
3901
|
-
} catch (
|
|
3902
|
-
console.error("File upload failed:",
|
|
4148
|
+
const z = await n(E);
|
|
4149
|
+
b(m, "mediaUrl", z);
|
|
4150
|
+
} catch (j) {
|
|
4151
|
+
console.error("File upload failed:", j), v({ open: !0, message: j instanceof Error ? j.message : "File upload failed" });
|
|
3903
4152
|
} finally {
|
|
3904
|
-
|
|
4153
|
+
c((j) => ({ ...j, [m]: !1 }));
|
|
3905
4154
|
}
|
|
3906
4155
|
};
|
|
3907
4156
|
return /* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
|
|
4157
|
+
l.open && /* @__PURE__ */ r("div", { className: "rsp-fixed rsp-inset-0 rsp-z-50 rsp-flex rsp-items-center rsp-justify-center", children: [
|
|
4158
|
+
/* @__PURE__ */ e("div", { className: "rsp-absolute rsp-inset-0 rsp-bg-black rsp-bg-opacity-40", onClick: () => v({ open: !1, message: "" }) }),
|
|
4159
|
+
/* @__PURE__ */ r("div", { className: "rsp-relative rsp-z-10 rsp-bg-white rsp-rounded-lg rsp-shadow-lg rsp-w-full rsp-max-w-md rsp-p-5", children: [
|
|
4160
|
+
/* @__PURE__ */ e("div", { className: "rsp-mb-3 rsp-text-lg rsp-font-semibold rsp-text-gray-900", children: "Upload Error" }),
|
|
4161
|
+
/* @__PURE__ */ e("div", { className: "rsp-text-sm rsp-text-gray-700 rsp-break-words rsp-whitespace-pre-wrap", children: l.message }),
|
|
4162
|
+
/* @__PURE__ */ e("div", { className: "rsp-flex rsp-justify-end rsp-mt-4", children: /* @__PURE__ */ e("button", { onClick: () => v({ open: !1, message: "" }), className: "rsp-px-4 rsp-py-2 rsp-text-sm rsp-font-medium rsp-text-white rsp-bg-blue-600 rsp-rounded-md hover:rsp-bg-blue-700", children: "OK" }) })
|
|
4163
|
+
] })
|
|
4164
|
+
] }),
|
|
3908
4165
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between", children: [
|
|
3909
4166
|
/* @__PURE__ */ e("h3", { className: "rsp-text-lg rsp-font-semibold rsp-text-gray-900", children: "Carousel Cards" }),
|
|
3910
4167
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-4", children: [
|
|
3911
4168
|
/* @__PURE__ */ r("span", { className: "rsp-text-sm rsp-text-gray-500", children: [
|
|
3912
4169
|
"Total Cards: ",
|
|
3913
|
-
((
|
|
4170
|
+
((C = a.carousel) == null ? void 0 : C.cards.length) || 0,
|
|
3914
4171
|
"/10"
|
|
3915
4172
|
] }),
|
|
3916
4173
|
/* @__PURE__ */ r(
|
|
3917
4174
|
"button",
|
|
3918
4175
|
{
|
|
3919
|
-
onClick:
|
|
3920
|
-
disabled: (((
|
|
4176
|
+
onClick: N,
|
|
4177
|
+
disabled: (((U = a.carousel) == null ? void 0 : U.cards.length) || 0) >= 10,
|
|
3921
4178
|
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",
|
|
3922
4179
|
children: [
|
|
3923
|
-
/* @__PURE__ */ e(
|
|
4180
|
+
/* @__PURE__ */ e(he, { className: "rsp-w-4 rsp-h-4 rsp-inline rsp-mr-2" }),
|
|
3924
4181
|
"Add Card"
|
|
3925
4182
|
]
|
|
3926
4183
|
}
|
|
@@ -3937,17 +4194,8 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
3937
4194
|
type: "radio",
|
|
3938
4195
|
name: "carouselType",
|
|
3939
4196
|
value: "IMAGE",
|
|
3940
|
-
checked: ((
|
|
3941
|
-
onChange: (
|
|
3942
|
-
var E;
|
|
3943
|
-
return {
|
|
3944
|
-
...b,
|
|
3945
|
-
carousel: {
|
|
3946
|
-
type: s.target.value,
|
|
3947
|
-
cards: ((E = b.carousel) == null ? void 0 : E.cards) || []
|
|
3948
|
-
}
|
|
3949
|
-
};
|
|
3950
|
-
}),
|
|
4197
|
+
checked: ((O = a.carousel) == null ? void 0 : O.type) === "IMAGE",
|
|
4198
|
+
onChange: (m) => y(m.target.value),
|
|
3951
4199
|
className: "rsp-mr-2"
|
|
3952
4200
|
}
|
|
3953
4201
|
),
|
|
@@ -3960,17 +4208,8 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
3960
4208
|
type: "radio",
|
|
3961
4209
|
name: "carouselType",
|
|
3962
4210
|
value: "VIDEO",
|
|
3963
|
-
checked: ((
|
|
3964
|
-
onChange: (
|
|
3965
|
-
var E;
|
|
3966
|
-
return {
|
|
3967
|
-
...b,
|
|
3968
|
-
carousel: {
|
|
3969
|
-
type: s.target.value,
|
|
3970
|
-
cards: ((E = b.carousel) == null ? void 0 : E.cards) || []
|
|
3971
|
-
}
|
|
3972
|
-
};
|
|
3973
|
-
}),
|
|
4211
|
+
checked: ((P = a.carousel) == null ? void 0 : P.type) === "VIDEO",
|
|
4212
|
+
onChange: (m) => y(m.target.value),
|
|
3974
4213
|
className: "rsp-mr-2"
|
|
3975
4214
|
}
|
|
3976
4215
|
),
|
|
@@ -3978,98 +4217,98 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
3978
4217
|
] })
|
|
3979
4218
|
] })
|
|
3980
4219
|
] }),
|
|
3981
|
-
/* @__PURE__ */ e("div", { className: "rsp-space-y-6", children: (
|
|
3982
|
-
var
|
|
4220
|
+
/* @__PURE__ */ e("div", { className: "rsp-space-y-6", children: (H = a.carousel) == null ? void 0 : H.cards.map((m, E) => {
|
|
4221
|
+
var S, j, I, z, u, T, D, K;
|
|
3983
4222
|
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: [
|
|
3984
4223
|
/* @__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: [
|
|
3985
4224
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-3", children: [
|
|
3986
|
-
/* @__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:
|
|
4225
|
+
/* @__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: E + 1 }),
|
|
3987
4226
|
/* @__PURE__ */ r("h4", { className: "rsp-text-base rsp-font-semibold rsp-text-gray-800", children: [
|
|
3988
4227
|
"Card ",
|
|
3989
|
-
|
|
4228
|
+
E + 1
|
|
3990
4229
|
] })
|
|
3991
4230
|
] }),
|
|
3992
4231
|
/* @__PURE__ */ e(
|
|
3993
4232
|
"button",
|
|
3994
4233
|
{
|
|
3995
|
-
onClick: () =>
|
|
4234
|
+
onClick: () => M(m.id),
|
|
3996
4235
|
className: "rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-white hover:rsp-bg-red-500 rsp-rounded-full rsp-transition-colors",
|
|
3997
4236
|
title: "Remove Card",
|
|
3998
|
-
children: /* @__PURE__ */ e(
|
|
4237
|
+
children: /* @__PURE__ */ e(re, { className: "rsp-w-4 rsp-h-4" })
|
|
3999
4238
|
}
|
|
4000
4239
|
)
|
|
4001
4240
|
] }),
|
|
4002
4241
|
/* @__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: [
|
|
4003
4242
|
/* @__PURE__ */ r("div", { children: [
|
|
4004
4243
|
/* @__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: [
|
|
4005
|
-
/* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: ((
|
|
4006
|
-
((
|
|
4244
|
+
/* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: ((S = a.carousel) == null ? void 0 : S.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" }) }),
|
|
4245
|
+
((j = a.carousel) == null ? void 0 : j.type) === "VIDEO" ? "Video" : "Image",
|
|
4007
4246
|
" Upload"
|
|
4008
4247
|
] }),
|
|
4009
4248
|
/* @__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: [
|
|
4010
|
-
|
|
4011
|
-
((
|
|
4249
|
+
m.mediaUrl ? /* @__PURE__ */ r("div", { className: "rsp-relative rsp-group", children: [
|
|
4250
|
+
((I = a.carousel) == null ? void 0 : I.type) === "IMAGE" ? /* @__PURE__ */ e(
|
|
4012
4251
|
"img",
|
|
4013
4252
|
{
|
|
4014
|
-
src:
|
|
4015
|
-
alt: `Card ${
|
|
4253
|
+
src: m.mediaUrl,
|
|
4254
|
+
alt: `Card ${E + 1}`,
|
|
4016
4255
|
className: "rsp-w-full rsp-h-48 rsp-object-cover rsp-rounded-lg rsp-shadow-md",
|
|
4017
|
-
onLoad: () =>
|
|
4018
|
-
onError: () =>
|
|
4256
|
+
onLoad: () => o((L) => ({ ...L, [m.id]: !0 })),
|
|
4257
|
+
onError: () => o((L) => ({ ...L, [m.id]: !1 }))
|
|
4019
4258
|
}
|
|
4020
4259
|
) : /* @__PURE__ */ e(
|
|
4021
4260
|
"video",
|
|
4022
4261
|
{
|
|
4023
|
-
src:
|
|
4262
|
+
src: m.mediaUrl,
|
|
4024
4263
|
className: "rsp-w-full rsp-h-48 rsp-object-cover rsp-rounded-lg rsp-shadow-md",
|
|
4025
4264
|
controls: !0,
|
|
4026
|
-
onLoadedData: () =>
|
|
4027
|
-
onError: () =>
|
|
4265
|
+
onLoadedData: () => o((L) => ({ ...L, [m.id]: !0 })),
|
|
4266
|
+
onError: () => o((L) => ({ ...L, [m.id]: !1 }))
|
|
4028
4267
|
}
|
|
4029
4268
|
),
|
|
4030
4269
|
/* @__PURE__ */ e(
|
|
4031
4270
|
"button",
|
|
4032
4271
|
{
|
|
4033
|
-
onClick: () =>
|
|
4272
|
+
onClick: () => b(m.id, "mediaUrl", ""),
|
|
4034
4273
|
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",
|
|
4035
4274
|
title: "Remove media",
|
|
4036
|
-
children: /* @__PURE__ */ e(
|
|
4275
|
+
children: /* @__PURE__ */ e(re, { className: "rsp-w-4 rsp-h-4" })
|
|
4037
4276
|
}
|
|
4038
4277
|
),
|
|
4039
|
-
/* @__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: ((
|
|
4278
|
+
/* @__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: ((z = a.carousel) == null ? void 0 : z.type) === "VIDEO" ? "📹 Video" : "🖼️ Image" })
|
|
4040
4279
|
] }) : /* @__PURE__ */ r("div", { children: [
|
|
4041
|
-
/* @__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: ((
|
|
4280
|
+
/* @__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: ((u = a.carousel) == null ? void 0 : u.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" }) }) }),
|
|
4042
4281
|
/* @__PURE__ */ e(
|
|
4043
4282
|
"input",
|
|
4044
4283
|
{
|
|
4045
4284
|
type: "file",
|
|
4046
|
-
accept: ((
|
|
4047
|
-
onChange: (
|
|
4048
|
-
var
|
|
4049
|
-
const
|
|
4050
|
-
|
|
4285
|
+
accept: ((T = a.carousel) == null ? void 0 : T.type) === "VIDEO" ? "video/*" : "image/*",
|
|
4286
|
+
onChange: (L) => {
|
|
4287
|
+
var _;
|
|
4288
|
+
const Y = (_ = L.target.files) == null ? void 0 : _[0];
|
|
4289
|
+
Y && !i[m.id] && f(m.id, Y);
|
|
4051
4290
|
},
|
|
4052
4291
|
className: "rsp-hidden",
|
|
4053
|
-
id: `file-upload-${
|
|
4054
|
-
disabled: !!
|
|
4292
|
+
id: `file-upload-${m.id}`,
|
|
4293
|
+
disabled: !!i[m.id]
|
|
4055
4294
|
}
|
|
4056
4295
|
),
|
|
4057
4296
|
/* @__PURE__ */ r(
|
|
4058
4297
|
"label",
|
|
4059
4298
|
{
|
|
4060
|
-
htmlFor: `file-upload-${
|
|
4061
|
-
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 ${
|
|
4062
|
-
"aria-disabled": !!
|
|
4299
|
+
htmlFor: `file-upload-${m.id}`,
|
|
4300
|
+
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 ${i[m.id] ? "rsp-opacity-50 rsp-cursor-not-allowed" : "hover:rsp-bg-blue-50 rsp-cursor-pointer"}`,
|
|
4301
|
+
"aria-disabled": !!i[m.id],
|
|
4063
4302
|
children: [
|
|
4064
4303
|
/* @__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" }) }),
|
|
4065
4304
|
"Upload ",
|
|
4066
|
-
((
|
|
4305
|
+
((D = a.carousel) == null ? void 0 : D.type) === "VIDEO" ? "Video" : "Image"
|
|
4067
4306
|
]
|
|
4068
4307
|
}
|
|
4069
4308
|
),
|
|
4070
|
-
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500 rsp-mt-3 rsp-px-2", children: ((
|
|
4309
|
+
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500 rsp-mt-3 rsp-px-2", children: ((K = a.carousel) == null ? void 0 : K.type) === "VIDEO" ? "📹 MP4, MOV, AVI (Max 16MB)" : "🖼️ PNG, JPG, GIF, TIFF, SVG, BMP (Max 5MB)" })
|
|
4071
4310
|
] }),
|
|
4072
|
-
|
|
4311
|
+
i[m.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: [
|
|
4073
4312
|
/* @__PURE__ */ r("svg", { className: "rsp-w-4 rsp-h-4 rsp-animate-spin", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", children: [
|
|
4074
4313
|
/* @__PURE__ */ e("circle", { cx: "12", cy: "12", r: "10", strokeOpacity: "0.25", strokeWidth: "4" }),
|
|
4075
4314
|
/* @__PURE__ */ e("path", { d: "M22 12a10 10 0 00-10-10", strokeWidth: "4" })
|
|
@@ -4088,11 +4327,11 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4088
4327
|
/* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
|
|
4089
4328
|
"textarea",
|
|
4090
4329
|
{
|
|
4091
|
-
ref: (
|
|
4092
|
-
|
|
4330
|
+
ref: (L) => {
|
|
4331
|
+
d.current[m.id] = L;
|
|
4093
4332
|
},
|
|
4094
|
-
value:
|
|
4095
|
-
onChange: (
|
|
4333
|
+
value: m.body,
|
|
4334
|
+
onChange: (L) => b(m.id, "body", L.target.value),
|
|
4096
4335
|
maxLength: 160,
|
|
4097
4336
|
rows: 4,
|
|
4098
4337
|
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",
|
|
@@ -4104,7 +4343,7 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4104
4343
|
/* @__PURE__ */ e(
|
|
4105
4344
|
"button",
|
|
4106
4345
|
{
|
|
4107
|
-
onClick: () =>
|
|
4346
|
+
onClick: () => t(m.id, "body"),
|
|
4108
4347
|
className: "rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",
|
|
4109
4348
|
title: "Add Variable",
|
|
4110
4349
|
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" }) })
|
|
@@ -4114,29 +4353,29 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4114
4353
|
"button",
|
|
4115
4354
|
{
|
|
4116
4355
|
onClick: () => {
|
|
4117
|
-
|
|
4356
|
+
V(m.id), h(!0);
|
|
4118
4357
|
},
|
|
4119
4358
|
className: "rsp-p-1.5 rsp-text-gray-500 hover:rsp-text-blue-600 hover:rsp-bg-blue-50 rsp-rounded rsp-transition-colors",
|
|
4120
4359
|
title: "Add Emoji",
|
|
4121
|
-
children: /* @__PURE__ */ e(
|
|
4360
|
+
children: /* @__PURE__ */ e(ue, { className: "rsp-w-4 rsp-h-4" })
|
|
4122
4361
|
}
|
|
4123
4362
|
)
|
|
4124
4363
|
] }),
|
|
4125
|
-
/* @__PURE__ */ r("span", { className: `rsp-text-xs rsp-font-medium ${
|
|
4126
|
-
|
|
4364
|
+
/* @__PURE__ */ r("span", { className: `rsp-text-xs rsp-font-medium ${m.body.length > 140 ? "rsp-text-orange-500" : "rsp-text-gray-500"}`, children: [
|
|
4365
|
+
m.body.length,
|
|
4127
4366
|
"/160"
|
|
4128
4367
|
] })
|
|
4129
4368
|
] }),
|
|
4130
4369
|
(() => {
|
|
4131
|
-
const
|
|
4132
|
-
return
|
|
4370
|
+
const L = m.body.match(/\{\{(\d+)\}\}/g) || [], Y = [...new Set(L.map((_) => _.replace(/[{}]/g, "")))];
|
|
4371
|
+
return Y.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: [
|
|
4133
4372
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-semibold rsp-text-blue-800 rsp-mb-2", children: "Sample Values for This Card" }),
|
|
4134
|
-
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-1 rsp-gap-2", children:
|
|
4135
|
-
var
|
|
4373
|
+
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-1 rsp-gap-2", children: Y.map((_) => {
|
|
4374
|
+
var ie, G;
|
|
4136
4375
|
return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
4137
4376
|
/* @__PURE__ */ r("label", { className: "rsp-text-xs rsp-text-gray-700 rsp-font-medium rsp-whitespace-nowrap", children: [
|
|
4138
4377
|
"{{",
|
|
4139
|
-
|
|
4378
|
+
_,
|
|
4140
4379
|
"}}",
|
|
4141
4380
|
":"
|
|
4142
4381
|
] }),
|
|
@@ -4144,24 +4383,24 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4144
4383
|
"input",
|
|
4145
4384
|
{
|
|
4146
4385
|
type: "text",
|
|
4147
|
-
value: ((
|
|
4148
|
-
onChange: (
|
|
4149
|
-
const
|
|
4150
|
-
|
|
4151
|
-
...
|
|
4386
|
+
value: ((G = (ie = m.sampleContent) == null ? void 0 : ie.bodyVariables) == null ? void 0 : G[_]) || "",
|
|
4387
|
+
onChange: (se) => {
|
|
4388
|
+
const ae = se.target.value;
|
|
4389
|
+
s((J) => ({
|
|
4390
|
+
...J,
|
|
4152
4391
|
carousel: {
|
|
4153
|
-
...
|
|
4154
|
-
cards:
|
|
4155
|
-
var
|
|
4156
|
-
return
|
|
4157
|
-
...
|
|
4392
|
+
...J.carousel,
|
|
4393
|
+
cards: J.carousel.cards.map((F) => {
|
|
4394
|
+
var $, W, Z;
|
|
4395
|
+
return F.id !== m.id ? F : {
|
|
4396
|
+
...F,
|
|
4158
4397
|
sampleContent: {
|
|
4159
|
-
headerVariables: ((
|
|
4398
|
+
headerVariables: (($ = F.sampleContent) == null ? void 0 : $.headerVariables) || {},
|
|
4160
4399
|
bodyVariables: {
|
|
4161
|
-
...((
|
|
4162
|
-
[
|
|
4400
|
+
...((W = F.sampleContent) == null ? void 0 : W.bodyVariables) || {},
|
|
4401
|
+
[_]: ae
|
|
4163
4402
|
},
|
|
4164
|
-
buttonVariables: ((
|
|
4403
|
+
buttonVariables: ((Z = F.sampleContent) == null ? void 0 : Z.buttonVariables) || {}
|
|
4165
4404
|
}
|
|
4166
4405
|
};
|
|
4167
4406
|
})
|
|
@@ -4177,22 +4416,22 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4177
4416
|
{
|
|
4178
4417
|
type: "button",
|
|
4179
4418
|
onClick: () => {
|
|
4180
|
-
const
|
|
4181
|
-
|
|
4182
|
-
...
|
|
4419
|
+
const se = new RegExp(`\\{\\{${_}\\}\\}`, "g"), ae = (m.body || "").replace(se, "");
|
|
4420
|
+
s((J) => ({
|
|
4421
|
+
...J,
|
|
4183
4422
|
carousel: {
|
|
4184
|
-
...
|
|
4185
|
-
cards:
|
|
4186
|
-
var
|
|
4187
|
-
if (
|
|
4188
|
-
const
|
|
4423
|
+
...J.carousel,
|
|
4424
|
+
cards: J.carousel.cards.map((F) => {
|
|
4425
|
+
var $, W, Z;
|
|
4426
|
+
if (F.id !== m.id) return F;
|
|
4427
|
+
const Q = Object.fromEntries(Object.entries((($ = F.sampleContent) == null ? void 0 : $.bodyVariables) || {}).filter(([ne]) => ne !== _));
|
|
4189
4428
|
return {
|
|
4190
|
-
...
|
|
4191
|
-
body:
|
|
4429
|
+
...F,
|
|
4430
|
+
body: ae,
|
|
4192
4431
|
sampleContent: {
|
|
4193
|
-
headerVariables: ((
|
|
4194
|
-
bodyVariables:
|
|
4195
|
-
buttonVariables: ((
|
|
4432
|
+
headerVariables: ((W = F.sampleContent) == null ? void 0 : W.headerVariables) || {},
|
|
4433
|
+
bodyVariables: Q,
|
|
4434
|
+
buttonVariables: ((Z = F.sampleContent) == null ? void 0 : Z.buttonVariables) || {}
|
|
4196
4435
|
}
|
|
4197
4436
|
};
|
|
4198
4437
|
})
|
|
@@ -4204,18 +4443,18 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4204
4443
|
children: "×"
|
|
4205
4444
|
}
|
|
4206
4445
|
)
|
|
4207
|
-
] }, `card-${
|
|
4446
|
+
] }, `card-${m.id}-sample-${_}`);
|
|
4208
4447
|
}) })
|
|
4209
4448
|
] });
|
|
4210
4449
|
})()
|
|
4211
4450
|
] }),
|
|
4212
|
-
|
|
4451
|
+
m.buttons.length < 2 && /* @__PURE__ */ r("div", { children: [
|
|
4213
4452
|
/* @__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: [
|
|
4214
4453
|
/* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-blue-500", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: /* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 15l-2 5L9 9l11 4-5 2zm0 0l5 5M7.188 2.239l.777 2.897M5.136 7.965l-2.898-.777M13.95 4.05l-2.122 2.122m-5.657 5.656l-2.12 2.122" }) }),
|
|
4215
4454
|
"Add Action Button",
|
|
4216
4455
|
/* @__PURE__ */ r("span", { className: "rsp-text-xs rsp-text-gray-500 rsp-font-normal", children: [
|
|
4217
4456
|
"(",
|
|
4218
|
-
|
|
4457
|
+
m.buttons.length,
|
|
4219
4458
|
"/2)"
|
|
4220
4459
|
] })
|
|
4221
4460
|
] }),
|
|
@@ -4223,7 +4462,7 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4223
4462
|
/* @__PURE__ */ r(
|
|
4224
4463
|
"button",
|
|
4225
4464
|
{
|
|
4226
|
-
onClick: () =>
|
|
4465
|
+
onClick: () => w(m.id, "QUICK_REPLY"),
|
|
4227
4466
|
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",
|
|
4228
4467
|
children: [
|
|
4229
4468
|
/* @__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" }) }),
|
|
@@ -4234,7 +4473,7 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4234
4473
|
/* @__PURE__ */ r(
|
|
4235
4474
|
"button",
|
|
4236
4475
|
{
|
|
4237
|
-
onClick: () =>
|
|
4476
|
+
onClick: () => w(m.id, "URL"),
|
|
4238
4477
|
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",
|
|
4239
4478
|
children: [
|
|
4240
4479
|
/* @__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" }) }),
|
|
@@ -4245,7 +4484,7 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4245
4484
|
/* @__PURE__ */ r(
|
|
4246
4485
|
"button",
|
|
4247
4486
|
{
|
|
4248
|
-
onClick: () =>
|
|
4487
|
+
onClick: () => w(m.id, "PHONE_NUMBER"),
|
|
4249
4488
|
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",
|
|
4250
4489
|
children: [
|
|
4251
4490
|
/* @__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" }) }),
|
|
@@ -4255,24 +4494,24 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4255
4494
|
)
|
|
4256
4495
|
] })
|
|
4257
4496
|
] }),
|
|
4258
|
-
|
|
4497
|
+
m.buttons.length > 0 && /* @__PURE__ */ r("div", { className: "rsp-space-y-3", children: [
|
|
4259
4498
|
/* @__PURE__ */ r("label", { className: "rsp-text-sm rsp-font-semibold rsp-text-gray-800 rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
4260
4499
|
/* @__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" }) }),
|
|
4261
4500
|
"Configured Buttons"
|
|
4262
4501
|
] }),
|
|
4263
|
-
|
|
4502
|
+
m.buttons.map((L, Y) => /* @__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: [
|
|
4264
4503
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-mb-3", children: [
|
|
4265
4504
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
4266
|
-
/* @__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:
|
|
4267
|
-
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-semibold rsp-text-gray-800", children:
|
|
4505
|
+
/* @__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: Y + 1 }),
|
|
4506
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-semibold rsp-text-gray-800", children: L.type === "QUICK_REPLY" ? "Quick Reply" : L.type === "URL" ? "Website" : "Phone" })
|
|
4268
4507
|
] }),
|
|
4269
4508
|
/* @__PURE__ */ e(
|
|
4270
4509
|
"button",
|
|
4271
4510
|
{
|
|
4272
|
-
onClick: () =>
|
|
4511
|
+
onClick: () => R(m.id, L.id),
|
|
4273
4512
|
className: "rsp-p-1 rsp-text-gray-400 hover:rsp-text-red-500 hover:rsp-bg-red-50 rsp-rounded rsp-transition-colors",
|
|
4274
4513
|
title: "Remove button",
|
|
4275
|
-
children: /* @__PURE__ */ e(
|
|
4514
|
+
children: /* @__PURE__ */ e(re, { className: "rsp-w-4 rsp-h-4" })
|
|
4276
4515
|
}
|
|
4277
4516
|
)
|
|
4278
4517
|
] }),
|
|
@@ -4283,15 +4522,15 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4283
4522
|
"input",
|
|
4284
4523
|
{
|
|
4285
4524
|
type: "text",
|
|
4286
|
-
value:
|
|
4287
|
-
onChange: (
|
|
4288
|
-
placeholder: `Enter Button Text (Max ${
|
|
4289
|
-
maxLength:
|
|
4525
|
+
value: L.text,
|
|
4526
|
+
onChange: (_) => A(m.id, L.id, "text", _.target.value),
|
|
4527
|
+
placeholder: `Enter Button Text (Max ${L.type === "QUICK_REPLY" ? "25" : "20"} characters)`,
|
|
4528
|
+
maxLength: L.type === "QUICK_REPLY" ? 25 : 20,
|
|
4290
4529
|
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"
|
|
4291
4530
|
}
|
|
4292
4531
|
)
|
|
4293
4532
|
] }),
|
|
4294
|
-
|
|
4533
|
+
L.type === "URL" && /* @__PURE__ */ r("div", { className: "rsp-space-y-3", children: [
|
|
4295
4534
|
/* @__PURE__ */ r("div", { children: [
|
|
4296
4535
|
/* @__PURE__ */ e("label", { className: "rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2", children: "URL Type" }),
|
|
4297
4536
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-gap-4", children: [
|
|
@@ -4300,8 +4539,8 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4300
4539
|
"input",
|
|
4301
4540
|
{
|
|
4302
4541
|
type: "radio",
|
|
4303
|
-
checked:
|
|
4304
|
-
onChange: () =>
|
|
4542
|
+
checked: L.urlType !== "dynamic",
|
|
4543
|
+
onChange: () => A(m.id, L.id, "urlType", "static"),
|
|
4305
4544
|
className: "rsp-mr-2 rsp-text-blue-600"
|
|
4306
4545
|
}
|
|
4307
4546
|
),
|
|
@@ -4312,8 +4551,8 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4312
4551
|
"input",
|
|
4313
4552
|
{
|
|
4314
4553
|
type: "radio",
|
|
4315
|
-
checked:
|
|
4316
|
-
onChange: () =>
|
|
4554
|
+
checked: L.urlType === "dynamic",
|
|
4555
|
+
onChange: () => A(m.id, L.id, "urlType", "dynamic"),
|
|
4317
4556
|
className: "rsp-mr-2 rsp-text-blue-600"
|
|
4318
4557
|
}
|
|
4319
4558
|
),
|
|
@@ -4327,14 +4566,14 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4327
4566
|
"input",
|
|
4328
4567
|
{
|
|
4329
4568
|
type: "text",
|
|
4330
|
-
value:
|
|
4331
|
-
onChange: (
|
|
4332
|
-
placeholder:
|
|
4569
|
+
value: L.value || "",
|
|
4570
|
+
onChange: (_) => A(m.id, L.id, "value", _.target.value),
|
|
4571
|
+
placeholder: L.urlType === "dynamic" ? "https://example.com/order/{{1}}" : "https://example.com",
|
|
4333
4572
|
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"
|
|
4334
4573
|
}
|
|
4335
4574
|
)
|
|
4336
4575
|
] }),
|
|
4337
|
-
|
|
4576
|
+
L.urlType === "dynamic" && /* @__PURE__ */ r("div", { className: "rsp-space-y-2", children: [
|
|
4338
4577
|
/* @__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: [
|
|
4339
4578
|
/* @__PURE__ */ e("strong", { children: "Tip:" }),
|
|
4340
4579
|
" Use ",
|
|
@@ -4353,71 +4592,54 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4353
4592
|
{
|
|
4354
4593
|
type: "button",
|
|
4355
4594
|
onClick: () => {
|
|
4356
|
-
if (((
|
|
4357
|
-
const
|
|
4358
|
-
const
|
|
4359
|
-
return
|
|
4360
|
-
}),
|
|
4361
|
-
|
|
4595
|
+
if (((L.value || "").match(/\{\{(\d+)\}\}/g) || []).length >= 3) return;
|
|
4596
|
+
const G = ((L.value || "").match(/\{\{(\d+)\}\}/g) || []).map((F) => {
|
|
4597
|
+
const Q = F.match(/{{(\d+)}}/);
|
|
4598
|
+
return Q ? parseInt(Q[1], 10) : 0;
|
|
4599
|
+
}), ae = (G.length > 0 ? Math.max(...G) : 0) + 1, J = (L.value || "") + `{{${ae}}}`;
|
|
4600
|
+
A(m.id, L.id, "value", J);
|
|
4362
4601
|
},
|
|
4363
|
-
disabled: ((
|
|
4602
|
+
disabled: ((L.value || "").match(/\{\{(\d+)\}\}/g) || []).length >= 3,
|
|
4364
4603
|
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",
|
|
4365
4604
|
children: "+ Add Variable"
|
|
4366
4605
|
}
|
|
4367
4606
|
),
|
|
4368
|
-
((
|
|
4607
|
+
((L.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" })
|
|
4369
4608
|
] }),
|
|
4370
|
-
/* @__PURE__ */ e("div", { children: /* @__PURE__ */ e(
|
|
4371
|
-
"button",
|
|
4372
|
-
{
|
|
4373
|
-
type: "button",
|
|
4374
|
-
onClick: () => {
|
|
4375
|
-
const z = S.value || "", Z = /\{\{\d+\}\}/g;
|
|
4376
|
-
let _ = -1, Q = "", W;
|
|
4377
|
-
for (; (W = Z.exec(z)) !== null; )
|
|
4378
|
-
_ = W.index, Q = W[0];
|
|
4379
|
-
if (_ === -1) return;
|
|
4380
|
-
const F = _, P = F + Q.length, G = z.slice(0, F) + z.slice(P);
|
|
4381
|
-
h(s.id, S.id, "value", G);
|
|
4382
|
-
},
|
|
4383
|
-
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",
|
|
4384
|
-
children: "Remove Last"
|
|
4385
|
-
}
|
|
4386
|
-
) }),
|
|
4387
4609
|
(() => {
|
|
4388
|
-
const
|
|
4389
|
-
return
|
|
4610
|
+
const _ = (L.value || "").match(/\{\{(\d+)\}\}/g) || [], ie = [...new Set(_.map((G) => G.replace(/[{}]/g, "")))];
|
|
4611
|
+
return ie.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-p-3 rsp-bg-gray-50 rsp-rounded-lg rsp-border rsp-border-gray-200", children: [
|
|
4390
4612
|
/* @__PURE__ */ e("h4", { className: "rsp-text-xs rsp-font-semibold rsp-text-gray-700 rsp-mb-2", children: "Sample Values for URL Variables" }),
|
|
4391
|
-
/* @__PURE__ */ e("div", { className: "rsp-space-y-2", children:
|
|
4392
|
-
var
|
|
4613
|
+
/* @__PURE__ */ e("div", { className: "rsp-space-y-2", children: ie.map((G) => {
|
|
4614
|
+
var se, ae;
|
|
4393
4615
|
return /* @__PURE__ */ r("div", { className: "rsp-space-y-1", children: [
|
|
4394
4616
|
/* @__PURE__ */ r("label", { className: "rsp-block rsp-text-xs rsp-text-gray-600 rsp-mb-1", children: [
|
|
4395
4617
|
"Variable ",
|
|
4396
4618
|
"{{",
|
|
4397
|
-
|
|
4619
|
+
G,
|
|
4398
4620
|
"}}"
|
|
4399
4621
|
] }),
|
|
4400
4622
|
/* @__PURE__ */ e(
|
|
4401
4623
|
"input",
|
|
4402
4624
|
{
|
|
4403
4625
|
type: "text",
|
|
4404
|
-
value: ((
|
|
4405
|
-
onChange: (
|
|
4406
|
-
const
|
|
4407
|
-
|
|
4408
|
-
...
|
|
4626
|
+
value: ((ae = (se = m.sampleContent) == null ? void 0 : se.buttonVariables) == null ? void 0 : ae[G]) || "",
|
|
4627
|
+
onChange: (J) => {
|
|
4628
|
+
const F = J.target.value;
|
|
4629
|
+
s((Q) => ({
|
|
4630
|
+
...Q,
|
|
4409
4631
|
carousel: {
|
|
4410
|
-
...
|
|
4411
|
-
cards:
|
|
4412
|
-
var
|
|
4413
|
-
return
|
|
4414
|
-
|
|
4632
|
+
...Q.carousel,
|
|
4633
|
+
cards: Q.carousel.cards.map(($) => {
|
|
4634
|
+
var W, Z, ne;
|
|
4635
|
+
return $.id !== m.id ? $ : {
|
|
4636
|
+
...$,
|
|
4415
4637
|
sampleContent: {
|
|
4416
|
-
headerVariables: ((
|
|
4417
|
-
bodyVariables: ((
|
|
4638
|
+
headerVariables: ((W = $.sampleContent) == null ? void 0 : W.headerVariables) || {},
|
|
4639
|
+
bodyVariables: ((Z = $.sampleContent) == null ? void 0 : Z.bodyVariables) || {},
|
|
4418
4640
|
buttonVariables: {
|
|
4419
|
-
...((
|
|
4420
|
-
[
|
|
4641
|
+
...((ne = $.sampleContent) == null ? void 0 : ne.buttonVariables) || {},
|
|
4642
|
+
[G]: F
|
|
4421
4643
|
}
|
|
4422
4644
|
}
|
|
4423
4645
|
};
|
|
@@ -4426,7 +4648,7 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4426
4648
|
}));
|
|
4427
4649
|
},
|
|
4428
4650
|
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",
|
|
4429
|
-
placeholder: `Sample value (e.g., ${
|
|
4651
|
+
placeholder: `Sample value (e.g., ${G === "1" ? "order123" : "user456"})`
|
|
4430
4652
|
}
|
|
4431
4653
|
),
|
|
4432
4654
|
/* @__PURE__ */ e(
|
|
@@ -4434,57 +4656,57 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4434
4656
|
{
|
|
4435
4657
|
type: "button",
|
|
4436
4658
|
onClick: () => {
|
|
4437
|
-
const
|
|
4438
|
-
|
|
4439
|
-
|
|
4659
|
+
const J = L.value || "", F = new RegExp(`\\{\\{${G}\\}\\}`, "g"), Q = J.replace(F, "");
|
|
4660
|
+
A(m.id, L.id, "value", Q), s(($) => ({
|
|
4661
|
+
...$,
|
|
4440
4662
|
carousel: {
|
|
4441
|
-
|
|
4442
|
-
cards:
|
|
4443
|
-
var
|
|
4444
|
-
if (
|
|
4445
|
-
const
|
|
4663
|
+
...$.carousel,
|
|
4664
|
+
cards: $.carousel.cards.map((W) => {
|
|
4665
|
+
var ne, we, ve;
|
|
4666
|
+
if (W.id !== m.id) return W;
|
|
4667
|
+
const Z = Object.fromEntries(Object.entries(((ne = W.sampleContent) == null ? void 0 : ne.buttonVariables) || {}).filter(([Re]) => Re !== G));
|
|
4446
4668
|
return {
|
|
4447
|
-
...
|
|
4669
|
+
...W,
|
|
4448
4670
|
sampleContent: {
|
|
4449
|
-
headerVariables: ((
|
|
4450
|
-
bodyVariables: ((
|
|
4451
|
-
buttonVariables:
|
|
4671
|
+
headerVariables: ((we = W.sampleContent) == null ? void 0 : we.headerVariables) || {},
|
|
4672
|
+
bodyVariables: ((ve = W.sampleContent) == null ? void 0 : ve.bodyVariables) || {},
|
|
4673
|
+
buttonVariables: Z
|
|
4452
4674
|
}
|
|
4453
4675
|
};
|
|
4454
4676
|
})
|
|
4455
4677
|
}
|
|
4456
4678
|
}));
|
|
4457
4679
|
},
|
|
4458
|
-
className: "rsp-px-2 rsp-py-1 rsp-text-
|
|
4680
|
+
className: "rsp-px-2 rsp-py-1 rsp-text- rsp-text-red-600 hover:rsp-bg-red-50 rsp-rounded",
|
|
4459
4681
|
title: "Remove this variable",
|
|
4460
4682
|
children: "×"
|
|
4461
4683
|
}
|
|
4462
4684
|
)
|
|
4463
|
-
] }, `button-${
|
|
4685
|
+
] }, `button-${L.id}-sample-${G}`);
|
|
4464
4686
|
}) })
|
|
4465
4687
|
] });
|
|
4466
4688
|
})()
|
|
4467
4689
|
] })
|
|
4468
4690
|
] }),
|
|
4469
|
-
|
|
4691
|
+
L.type === "PHONE_NUMBER" && /* @__PURE__ */ r("div", { children: [
|
|
4470
4692
|
/* @__PURE__ */ e("label", { className: "rsp-block rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-1", children: "Phone Number" }),
|
|
4471
4693
|
/* @__PURE__ */ e(
|
|
4472
4694
|
"input",
|
|
4473
4695
|
{
|
|
4474
4696
|
type: "text",
|
|
4475
|
-
value:
|
|
4476
|
-
onChange: (
|
|
4697
|
+
value: L.value || "",
|
|
4698
|
+
onChange: (_) => A(m.id, L.id, "value", _.target.value),
|
|
4477
4699
|
placeholder: "+1234567890",
|
|
4478
4700
|
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"
|
|
4479
4701
|
}
|
|
4480
4702
|
)
|
|
4481
4703
|
] })
|
|
4482
4704
|
] })
|
|
4483
|
-
] },
|
|
4705
|
+
] }, L.id))
|
|
4484
4706
|
] })
|
|
4485
4707
|
] })
|
|
4486
4708
|
] }) })
|
|
4487
|
-
] },
|
|
4709
|
+
] }, m.id);
|
|
4488
4710
|
}) }),
|
|
4489
4711
|
/* @__PURE__ */ e("div", { className: "rsp-bg-blue-50 rsp-border-l-4 rsp-border-blue-500 rsp-p-4 rsp-rounded-r-md", children: /* @__PURE__ */ r("div", { className: "rsp-flex", children: [
|
|
4490
4712
|
/* @__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" }) }) }),
|
|
@@ -4501,52 +4723,52 @@ function ma({ template: a, setTemplate: n, onFileUpload: i }) {
|
|
|
4501
4723
|
] })
|
|
4502
4724
|
] }) }),
|
|
4503
4725
|
/* @__PURE__ */ e(
|
|
4504
|
-
|
|
4726
|
+
ye,
|
|
4505
4727
|
{
|
|
4506
|
-
isOpen:
|
|
4507
|
-
onClose: () =>
|
|
4508
|
-
onSelect:
|
|
4728
|
+
isOpen: g,
|
|
4729
|
+
onClose: () => h(!1),
|
|
4730
|
+
onSelect: x
|
|
4509
4731
|
}
|
|
4510
4732
|
)
|
|
4511
4733
|
] });
|
|
4512
4734
|
}
|
|
4513
|
-
const
|
|
4735
|
+
const Me = async (a) => {
|
|
4514
4736
|
try {
|
|
4515
4737
|
console.log(`Starting file upload: ${a.name}`);
|
|
4516
|
-
const
|
|
4517
|
-
return console.log(`File uploaded successfully: ${
|
|
4518
|
-
} catch (
|
|
4519
|
-
throw console.error("Upload failed in parent:",
|
|
4738
|
+
const s = await ua(a);
|
|
4739
|
+
return console.log(`File uploaded successfully: ${s}`), s;
|
|
4740
|
+
} catch (s) {
|
|
4741
|
+
throw console.error("Upload failed in parent:", s), s;
|
|
4520
4742
|
}
|
|
4521
|
-
},
|
|
4522
|
-
const
|
|
4523
|
-
if (!
|
|
4524
|
-
const
|
|
4525
|
-
const
|
|
4526
|
-
return
|
|
4743
|
+
}, wa = (a) => {
|
|
4744
|
+
const n = (a.body || "").match(/\{\{(\d+)\}\}/g);
|
|
4745
|
+
if (!n) return 0;
|
|
4746
|
+
const i = n.map((c) => {
|
|
4747
|
+
const o = c.match(/{{(\d+)}}/);
|
|
4748
|
+
return o ? parseInt(o[1], 10) : 0;
|
|
4527
4749
|
});
|
|
4528
|
-
return
|
|
4750
|
+
return i.length > 0 ? Math.max(...i) : 0;
|
|
4529
4751
|
};
|
|
4530
|
-
function
|
|
4531
|
-
const [
|
|
4532
|
-
|
|
4533
|
-
|
|
4752
|
+
function va({ template: a, setTemplate: s }) {
|
|
4753
|
+
const [n, i] = X.useState(!1), c = X.useRef(null), o = () => {
|
|
4754
|
+
i(!0), setTimeout(() => {
|
|
4755
|
+
c.current && c.current.focus();
|
|
4534
4756
|
}, 0);
|
|
4535
|
-
},
|
|
4536
|
-
const g =
|
|
4537
|
-
|
|
4538
|
-
if (
|
|
4539
|
-
const
|
|
4540
|
-
|
|
4757
|
+
}, l = (v) => {
|
|
4758
|
+
const g = c.current, h = a.body, k = g && typeof g.selectionStart == "number" ? g.selectionStart : h.length, V = h.substring(0, k), d = h.substring(k), N = V + v + d;
|
|
4759
|
+
s({ ...a, body: N }), setTimeout(() => {
|
|
4760
|
+
if (c.current) {
|
|
4761
|
+
const M = k + v.length;
|
|
4762
|
+
c.current.setSelectionRange(M, M), c.current.focus();
|
|
4541
4763
|
}
|
|
4542
|
-
}, 0),
|
|
4764
|
+
}, 0), i(!1);
|
|
4543
4765
|
};
|
|
4544
4766
|
return /* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
|
|
4545
4767
|
a.type !== "CAROUSEL" && /* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
|
|
4546
4768
|
/* @__PURE__ */ e("h2", { className: "rsp-text-lg rsp-font-semibold rsp-text-gray-900", children: "Message Content" }),
|
|
4547
4769
|
/* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
|
|
4548
|
-
/* @__PURE__ */ e(
|
|
4549
|
-
/* @__PURE__ */ e(
|
|
4770
|
+
/* @__PURE__ */ e(pa, { template: a, setTemplate: s, onFileUpload: Me }),
|
|
4771
|
+
/* @__PURE__ */ e(fa, { template: a, setTemplate: s })
|
|
4550
4772
|
] })
|
|
4551
4773
|
] }),
|
|
4552
4774
|
a.type === "CAROUSEL" && /* @__PURE__ */ r("div", { className: "rsp-space-y-6", children: [
|
|
@@ -4559,23 +4781,24 @@ function da({ template: a, setTemplate: n }) {
|
|
|
4559
4781
|
/* @__PURE__ */ e("div", { className: "rsp-relative", children: /* @__PURE__ */ e(
|
|
4560
4782
|
"textarea",
|
|
4561
4783
|
{
|
|
4562
|
-
ref:
|
|
4784
|
+
ref: c,
|
|
4563
4785
|
value: a.body,
|
|
4564
|
-
onChange: (
|
|
4786
|
+
onChange: (v) => s({ ...a, body: v.target.value }),
|
|
4565
4787
|
maxLength: 1024,
|
|
4566
4788
|
rows: 4,
|
|
4567
4789
|
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",
|
|
4568
4790
|
placeholder: "Enter Template Message"
|
|
4569
4791
|
}
|
|
4570
4792
|
) }),
|
|
4793
|
+
!a.body && /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-red-600 rsp-mt-1", children: "Body is required." }),
|
|
4571
4794
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between rsp-mt-1", children: [
|
|
4572
4795
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
4573
4796
|
/* @__PURE__ */ e(
|
|
4574
4797
|
"button",
|
|
4575
4798
|
{
|
|
4576
4799
|
onClick: () => {
|
|
4577
|
-
const
|
|
4578
|
-
|
|
4800
|
+
const h = `{{${wa(a) + 1}}}`;
|
|
4801
|
+
s({ ...a, body: a.body + h });
|
|
4579
4802
|
},
|
|
4580
4803
|
className: "rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",
|
|
4581
4804
|
title: "Add Variable",
|
|
@@ -4585,10 +4808,10 @@ function da({ template: a, setTemplate: n }) {
|
|
|
4585
4808
|
/* @__PURE__ */ e(
|
|
4586
4809
|
"button",
|
|
4587
4810
|
{
|
|
4588
|
-
onClick:
|
|
4811
|
+
onClick: o,
|
|
4589
4812
|
className: "rsp-p-1 rsp-text-gray-500 hover:rsp-text-gray-700 hover:rsp-bg-gray-100 rsp-rounded",
|
|
4590
4813
|
title: "Add emoji",
|
|
4591
|
-
children: /* @__PURE__ */ e(
|
|
4814
|
+
children: /* @__PURE__ */ e(ue, { className: "rsp-w-4 rsp-h-4" })
|
|
4592
4815
|
}
|
|
4593
4816
|
)
|
|
4594
4817
|
] }),
|
|
@@ -4598,15 +4821,15 @@ function da({ template: a, setTemplate: n }) {
|
|
|
4598
4821
|
] })
|
|
4599
4822
|
] }),
|
|
4600
4823
|
(() => {
|
|
4601
|
-
const
|
|
4824
|
+
const v = a.body.match(/\{\{(\d+)\}\}/g) || [], g = [...new Set(v.map((h) => h.replace(/[{}]/g, "")))];
|
|
4602
4825
|
return g.length === 0 ? null : /* @__PURE__ */ r("div", { className: "rsp-mt-3", children: [
|
|
4603
4826
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-font-medium rsp-text-gray-600 rsp-mb-2", children: "Sample Values" }),
|
|
4604
|
-
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: g.map((
|
|
4605
|
-
var
|
|
4827
|
+
/* @__PURE__ */ e("div", { className: "rsp-grid rsp-grid-cols-3 rsp-gap-2", children: g.map((h) => {
|
|
4828
|
+
var k, V;
|
|
4606
4829
|
return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-2", children: [
|
|
4607
4830
|
/* @__PURE__ */ r("label", { className: "rsp-text-xs rsp-text-gray-500 rsp-whitespace-nowrap", children: [
|
|
4608
4831
|
"{{",
|
|
4609
|
-
|
|
4832
|
+
h,
|
|
4610
4833
|
"}}",
|
|
4611
4834
|
":"
|
|
4612
4835
|
] }),
|
|
@@ -4614,19 +4837,19 @@ function da({ template: a, setTemplate: n }) {
|
|
|
4614
4837
|
"input",
|
|
4615
4838
|
{
|
|
4616
4839
|
type: "text",
|
|
4617
|
-
value: ((
|
|
4618
|
-
onChange: (
|
|
4619
|
-
var
|
|
4620
|
-
const
|
|
4840
|
+
value: ((V = (k = a.sampleContent) == null ? void 0 : k.bodyVariables) == null ? void 0 : V[h]) || "",
|
|
4841
|
+
onChange: (d) => {
|
|
4842
|
+
var M, b, y;
|
|
4843
|
+
const N = {
|
|
4621
4844
|
...a.sampleContent,
|
|
4622
|
-
headerVariables: ((
|
|
4845
|
+
headerVariables: ((M = a.sampleContent) == null ? void 0 : M.headerVariables) || {},
|
|
4623
4846
|
bodyVariables: {
|
|
4624
|
-
...(
|
|
4625
|
-
[
|
|
4847
|
+
...(b = a.sampleContent) == null ? void 0 : b.bodyVariables,
|
|
4848
|
+
[h]: d.target.value
|
|
4626
4849
|
},
|
|
4627
|
-
buttonVariables: ((
|
|
4850
|
+
buttonVariables: ((y = a.sampleContent) == null ? void 0 : y.buttonVariables) || {}
|
|
4628
4851
|
};
|
|
4629
|
-
|
|
4852
|
+
s({ ...a, sampleContent: N });
|
|
4630
4853
|
},
|
|
4631
4854
|
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",
|
|
4632
4855
|
placeholder: "Sample"
|
|
@@ -4637,15 +4860,15 @@ function da({ template: a, setTemplate: n }) {
|
|
|
4637
4860
|
{
|
|
4638
4861
|
type: "button",
|
|
4639
4862
|
onClick: () => {
|
|
4640
|
-
var
|
|
4641
|
-
const
|
|
4642
|
-
|
|
4863
|
+
var b, y, t;
|
|
4864
|
+
const d = new RegExp(`\\{\\{${h}\\}\\}`, "g"), N = (a.body || "").replace(d, ""), M = Object.fromEntries(Object.entries(((b = a.sampleContent) == null ? void 0 : b.bodyVariables) || {}).filter(([x]) => x !== h));
|
|
4865
|
+
s({
|
|
4643
4866
|
...a,
|
|
4644
|
-
body:
|
|
4867
|
+
body: N,
|
|
4645
4868
|
sampleContent: {
|
|
4646
4869
|
...a.sampleContent,
|
|
4647
|
-
bodyVariables:
|
|
4648
|
-
headerVariables: ((
|
|
4870
|
+
bodyVariables: M,
|
|
4871
|
+
headerVariables: ((y = a.sampleContent) == null ? void 0 : y.headerVariables) || {},
|
|
4649
4872
|
buttonVariables: ((t = a.sampleContent) == null ? void 0 : t.buttonVariables) || {}
|
|
4650
4873
|
}
|
|
4651
4874
|
});
|
|
@@ -4655,77 +4878,77 @@ function da({ template: a, setTemplate: n }) {
|
|
|
4655
4878
|
children: "×"
|
|
4656
4879
|
}
|
|
4657
4880
|
)
|
|
4658
|
-
] }, `global-body-sample-${
|
|
4881
|
+
] }, `global-body-sample-${h}`);
|
|
4659
4882
|
}) })
|
|
4660
4883
|
] });
|
|
4661
4884
|
})()
|
|
4662
4885
|
] }) })
|
|
4663
4886
|
] }),
|
|
4664
4887
|
a.type === "CAROUSEL" && /* @__PURE__ */ e("div", { className: "rsp-space-y-6", children: /* @__PURE__ */ e(
|
|
4665
|
-
|
|
4888
|
+
ya,
|
|
4666
4889
|
{
|
|
4667
4890
|
template: a,
|
|
4668
|
-
setTemplate:
|
|
4669
|
-
onFileUpload:
|
|
4891
|
+
setTemplate: s,
|
|
4892
|
+
onFileUpload: Me
|
|
4670
4893
|
}
|
|
4671
4894
|
) }),
|
|
4672
4895
|
a.type !== "CAROUSEL" && /* @__PURE__ */ e("div", { className: "rsp-space-y-6", children: /* @__PURE__ */ e(
|
|
4673
|
-
|
|
4896
|
+
ha,
|
|
4674
4897
|
{
|
|
4675
4898
|
template: a,
|
|
4676
|
-
setTemplate:
|
|
4899
|
+
setTemplate: s
|
|
4677
4900
|
}
|
|
4678
4901
|
) }),
|
|
4679
4902
|
/* @__PURE__ */ e(
|
|
4680
|
-
|
|
4903
|
+
ye,
|
|
4681
4904
|
{
|
|
4682
|
-
isOpen:
|
|
4683
|
-
onClose: () =>
|
|
4684
|
-
onSelect:
|
|
4905
|
+
isOpen: n,
|
|
4906
|
+
onClose: () => i(!1),
|
|
4907
|
+
onSelect: l
|
|
4685
4908
|
}
|
|
4686
4909
|
)
|
|
4687
4910
|
] });
|
|
4688
4911
|
}
|
|
4689
|
-
function
|
|
4912
|
+
function ka({ type: a }) {
|
|
4690
4913
|
switch (a) {
|
|
4691
4914
|
case "QUICK_REPLY":
|
|
4692
|
-
return /* @__PURE__ */ e(
|
|
4915
|
+
return /* @__PURE__ */ e(Ke, { className: "w-4 h-4" });
|
|
4693
4916
|
case "URL":
|
|
4694
|
-
return /* @__PURE__ */ e(
|
|
4917
|
+
return /* @__PURE__ */ e(Ge, { className: "w-4 h-4" });
|
|
4695
4918
|
case "CALL":
|
|
4696
|
-
return /* @__PURE__ */ e(
|
|
4919
|
+
return /* @__PURE__ */ e(Ve, { className: "w-4 h-4" });
|
|
4697
4920
|
case "FLOW":
|
|
4698
|
-
return /* @__PURE__ */ e(
|
|
4921
|
+
return /* @__PURE__ */ e(Ye, { className: "w-4 h-4" });
|
|
4699
4922
|
default:
|
|
4700
4923
|
return null;
|
|
4701
4924
|
}
|
|
4702
4925
|
}
|
|
4703
|
-
function
|
|
4704
|
-
const
|
|
4705
|
-
|
|
4926
|
+
function Na({ buttons: a, flowButtonText: s, onShowAllOptions: n }) {
|
|
4927
|
+
const i = [...a];
|
|
4928
|
+
s && i.push({
|
|
4706
4929
|
id: "flow-button",
|
|
4707
4930
|
type: "QUICK_REPLY",
|
|
4708
|
-
text:
|
|
4931
|
+
text: s
|
|
4709
4932
|
});
|
|
4710
|
-
const
|
|
4933
|
+
const c = i.slice(0, 2);
|
|
4711
4934
|
return /* @__PURE__ */ r("div", { className: "rsp-divide-y rsp-divide-gray-200", children: [
|
|
4712
|
-
|
|
4935
|
+
c.map((o) => /* @__PURE__ */ r(
|
|
4713
4936
|
"button",
|
|
4714
4937
|
{
|
|
4715
4938
|
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",
|
|
4716
4939
|
style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' },
|
|
4717
4940
|
children: [
|
|
4718
|
-
/* @__PURE__ */ e("div", { className: "rsp-text-[#128C7E]", children: /* @__PURE__ */ e(
|
|
4719
|
-
/* @__PURE__ */ e("span", { className: "rsp-flex-1 rsp-text-left rsp-break-words rsp-break-all rsp-whitespace-pre-wrap", children:
|
|
4720
|
-
|
|
4941
|
+
/* @__PURE__ */ e("div", { className: "rsp-text-[#128C7E]", children: /* @__PURE__ */ e(ka, { type: o.type }) }),
|
|
4942
|
+
/* @__PURE__ */ e("span", { className: "rsp-flex-1 rsp-text-left rsp-break-words rsp-break-all rsp-whitespace-pre-wrap", children: o.text }),
|
|
4943
|
+
o.id === "flow-button" && /* @__PURE__ */ e(_e, { className: "rsp-w-5 rsp-h-5 rsp-text-[#128C7E] rsp-ml-auto" })
|
|
4721
4944
|
]
|
|
4722
4945
|
},
|
|
4723
|
-
|
|
4946
|
+
o.id
|
|
4724
4947
|
)),
|
|
4725
|
-
|
|
4948
|
+
i.length > 2 && /* @__PURE__ */ r(
|
|
4726
4949
|
"button",
|
|
4727
4950
|
{
|
|
4728
|
-
onClick:
|
|
4951
|
+
onClick: n,
|
|
4729
4952
|
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-justify-center rsp-transition-colors",
|
|
4730
4953
|
style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' },
|
|
4731
4954
|
children: [
|
|
@@ -4736,25 +4959,25 @@ function pa({ buttons: a, flowButtonText: n, onShowAllOptions: i }) {
|
|
|
4736
4959
|
)
|
|
4737
4960
|
] });
|
|
4738
4961
|
}
|
|
4739
|
-
function
|
|
4740
|
-
var
|
|
4741
|
-
const [
|
|
4742
|
-
|
|
4743
|
-
a.type === "CAROUSEL" &&
|
|
4744
|
-
}, [
|
|
4745
|
-
const
|
|
4746
|
-
var
|
|
4747
|
-
return ((
|
|
4748
|
-
}) : "",
|
|
4749
|
-
var
|
|
4750
|
-
return ((
|
|
4751
|
-
}) : "", g = (
|
|
4752
|
-
var
|
|
4753
|
-
const
|
|
4754
|
-
if (!
|
|
4755
|
-
const t = ((
|
|
4756
|
-
return
|
|
4757
|
-
},
|
|
4962
|
+
function Ca({ template: a }) {
|
|
4963
|
+
var V, d, N, M;
|
|
4964
|
+
const [s, n] = B(!1), [i, c] = B(0), o = (V = a.carousel) != null && V.cards ? a.carousel.cards.length : 0;
|
|
4965
|
+
le(() => {
|
|
4966
|
+
a.type === "CAROUSEL" && o > 0 ? i >= o && c(0) : c(0);
|
|
4967
|
+
}, [o, a.type]);
|
|
4968
|
+
const l = (b) => b ? b.replace(/\{\{(\d+)\}\}/g, (y, t) => {
|
|
4969
|
+
var x, p;
|
|
4970
|
+
return ((p = (x = a.sampleContent) == null ? void 0 : x.headerVariables) == null ? void 0 : p[t]) || `[Variable ${t}]`;
|
|
4971
|
+
}) : "", v = (b) => b ? b.replace(/\{\{(\d+)\}\}/g, (y, t) => {
|
|
4972
|
+
var x, p;
|
|
4973
|
+
return ((p = (x = a.sampleContent) == null ? void 0 : x.bodyVariables) == null ? void 0 : p[t]) || `[Variable ${t}]`;
|
|
4974
|
+
}) : "", g = (b) => {
|
|
4975
|
+
var x;
|
|
4976
|
+
const y = (b == null ? void 0 : b.body) ?? "";
|
|
4977
|
+
if (!y) return "";
|
|
4978
|
+
const t = ((x = b == null ? void 0 : b.sampleContent) == null ? void 0 : x.bodyVariables) ?? {};
|
|
4979
|
+
return y.replace(/\{\{(\d+)\}\}/g, (p, w) => t[w] || `[Variable ${w}]`);
|
|
4980
|
+
}, h = a.headerType !== "NONE" || a.body || a.footer || a.buttons.length > 0 || a.type === "CAROUSEL" && ((d = a.carousel) == null ? void 0 : d.cards.length), k = a.headerText || a.body || a.footer;
|
|
4758
4981
|
return /* @__PURE__ */ r("div", { className: "rsp-bg-white rsp-rounded-lg rsp-shadow-sm rsp-border rsp-border-gray-200", children: [
|
|
4759
4982
|
/* @__PURE__ */ r("div", { className: "rsp-p-4 rsp-border-b rsp-border-gray-200", children: [
|
|
4760
4983
|
/* @__PURE__ */ e("h3", { className: "rsp-text-lg rsp-font-semibold rsp-text-gray-900", children: "Preview" }),
|
|
@@ -4801,7 +5024,7 @@ function oa({ template: a }) {
|
|
|
4801
5024
|
] }),
|
|
4802
5025
|
/* @__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: [
|
|
4803
5026
|
/* @__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")` } }),
|
|
4804
|
-
/* @__PURE__ */ e("div", { className: "rsp-relative rsp-px-4 rsp-py-4", children:
|
|
5027
|
+
/* @__PURE__ */ e("div", { className: "rsp-relative rsp-px-4 rsp-py-4", children: h ? /* @__PURE__ */ r("div", { className: "rsp-flex rsp-flex-col rsp-items-start", children: [
|
|
4805
5028
|
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: [
|
|
4806
5029
|
a.mediaType === "IMAGE" && /* @__PURE__ */ e(
|
|
4807
5030
|
"img",
|
|
@@ -4809,8 +5032,8 @@ function oa({ template: a }) {
|
|
|
4809
5032
|
src: a.mediaUrl,
|
|
4810
5033
|
alt: "Header media",
|
|
4811
5034
|
className: "rsp-w-full rsp-max-h-[150px] rsp-object-cover rsp-block",
|
|
4812
|
-
onError: (
|
|
4813
|
-
|
|
5035
|
+
onError: (b) => {
|
|
5036
|
+
b.currentTarget.style.display = "none";
|
|
4814
5037
|
}
|
|
4815
5038
|
}
|
|
4816
5039
|
),
|
|
@@ -4826,38 +5049,38 @@ function oa({ template: a }) {
|
|
|
4826
5049
|
] })
|
|
4827
5050
|
] }) })
|
|
4828
5051
|
] }),
|
|
4829
|
-
|
|
4830
|
-
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:
|
|
4831
|
-
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:
|
|
5052
|
+
k && /* @__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: [
|
|
5053
|
+
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: l(a.headerText) }) }),
|
|
5054
|
+
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: v(a.body) }) }),
|
|
4832
5055
|
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 }) }),
|
|
4833
5056
|
/* @__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: [
|
|
4834
5057
|
"9:41 AM",
|
|
4835
5058
|
/* @__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" }) })
|
|
4836
5059
|
] }) })
|
|
4837
5060
|
] }) }),
|
|
4838
|
-
a.type === "CAROUSEL" && (((
|
|
5061
|
+
a.type === "CAROUSEL" && (((M = (N = a.carousel) == null ? void 0 : N.cards) == null ? void 0 : M.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: [
|
|
4839
5062
|
(() => {
|
|
4840
|
-
var
|
|
4841
|
-
const
|
|
5063
|
+
var y, t;
|
|
5064
|
+
const b = a.carousel && a.carousel.cards.length > 0 ? a.carousel.cards[i] || a.carousel.cards[0] : void 0;
|
|
4842
5065
|
return /* @__PURE__ */ r("div", { className: "rsp-flex rsp-flex-col rsp-h-full", children: [
|
|
4843
|
-
/* @__PURE__ */ e("div", { className: "rsp-relative rsp-w-full rsp-h-[140px] rsp-bg-gray-100 rsp-group rsp-flex-shrink-0", children:
|
|
4844
|
-
((
|
|
5066
|
+
/* @__PURE__ */ e("div", { className: "rsp-relative rsp-w-full rsp-h-[140px] rsp-bg-gray-100 rsp-group rsp-flex-shrink-0", children: b && b.mediaUrl ? /* @__PURE__ */ r(ce, { children: [
|
|
5067
|
+
((y = a.carousel) == null ? void 0 : y.type) === "IMAGE" ? /* @__PURE__ */ e(
|
|
4845
5068
|
"img",
|
|
4846
5069
|
{
|
|
4847
|
-
src:
|
|
5070
|
+
src: b.mediaUrl,
|
|
4848
5071
|
alt: "Carousel card",
|
|
4849
5072
|
className: "rsp-w-full rsp-h-full rsp-object-cover",
|
|
4850
|
-
onError: (
|
|
4851
|
-
|
|
5073
|
+
onError: (x) => {
|
|
5074
|
+
x.currentTarget.style.display = "none";
|
|
4852
5075
|
}
|
|
4853
5076
|
}
|
|
4854
5077
|
) : /* @__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" }) }) }),
|
|
4855
|
-
a.carousel && a.carousel.cards.length > 1 && /* @__PURE__ */ r(
|
|
5078
|
+
a.carousel && a.carousel.cards.length > 1 && /* @__PURE__ */ r(ce, { children: [
|
|
4856
5079
|
/* @__PURE__ */ e(
|
|
4857
5080
|
"button",
|
|
4858
5081
|
{
|
|
4859
|
-
onClick: () =>
|
|
4860
|
-
(
|
|
5082
|
+
onClick: () => c(
|
|
5083
|
+
(x) => x > 0 ? x - 1 : a.carousel.cards.length - 1
|
|
4861
5084
|
),
|
|
4862
5085
|
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",
|
|
4863
5086
|
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" }) })
|
|
@@ -4866,8 +5089,8 @@ function oa({ template: a }) {
|
|
|
4866
5089
|
/* @__PURE__ */ e(
|
|
4867
5090
|
"button",
|
|
4868
5091
|
{
|
|
4869
|
-
onClick: () =>
|
|
4870
|
-
(
|
|
5092
|
+
onClick: () => c(
|
|
5093
|
+
(x) => x < a.carousel.cards.length - 1 ? x + 1 : 0
|
|
4871
5094
|
),
|
|
4872
5095
|
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",
|
|
4873
5096
|
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" }) })
|
|
@@ -4875,7 +5098,7 @@ function oa({ template: a }) {
|
|
|
4875
5098
|
)
|
|
4876
5099
|
] }),
|
|
4877
5100
|
/* @__PURE__ */ r("div", { className: "rsp-absolute rsp-top-2 rsp-right-2 rsp-bg-black rsp-bg-opacity-60 rsp-text-white rsp-text-[10px] rsp-px-2 rsp-py-0.5 rsp-rounded-full rsp-backdrop-blur-sm", style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' }, children: [
|
|
4878
|
-
|
|
5101
|
+
i + 1,
|
|
4879
5102
|
"/",
|
|
4880
5103
|
a.carousel ? a.carousel.cards.length : 0
|
|
4881
5104
|
] })
|
|
@@ -4883,36 +5106,36 @@ function oa({ template: a }) {
|
|
|
4883
5106
|
/* @__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" }) }),
|
|
4884
5107
|
/* @__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" })
|
|
4885
5108
|
] }) }) }),
|
|
4886
|
-
/* @__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:
|
|
4887
|
-
/* @__PURE__ */ e("div", { className: "rsp-border-t rsp-border-gray-100 rsp-mt-auto", children:
|
|
5109
|
+
/* @__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: b ? g(b) : "Card body text..." }) }),
|
|
5110
|
+
/* @__PURE__ */ e("div", { className: "rsp-border-t rsp-border-gray-100 rsp-mt-auto", children: b && b.buttons.length > 0 ? /* @__PURE__ */ e(ce, { children: b.buttons.map((x, p) => /* @__PURE__ */ e(
|
|
4888
5111
|
"div",
|
|
4889
5112
|
{
|
|
4890
|
-
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 ${
|
|
5113
|
+
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 ${p < b.buttons.length - 1 ? "rsp-border-b rsp-border-gray-100" : ""}`,
|
|
4891
5114
|
style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' },
|
|
4892
5115
|
children: /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-center rsp-gap-2", children: [
|
|
4893
|
-
|
|
4894
|
-
(
|
|
4895
|
-
/* @__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:
|
|
5116
|
+
x.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" }) }),
|
|
5117
|
+
(x.type === "CALL" || x.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" }) }),
|
|
5118
|
+
/* @__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: x.text })
|
|
4896
5119
|
] })
|
|
4897
5120
|
},
|
|
4898
|
-
|
|
5121
|
+
x.id
|
|
4899
5122
|
)) }) : /* @__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" }) })
|
|
4900
5123
|
] });
|
|
4901
5124
|
})(),
|
|
4902
|
-
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((
|
|
5125
|
+
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((b, y) => /* @__PURE__ */ e(
|
|
4903
5126
|
"button",
|
|
4904
5127
|
{
|
|
4905
|
-
onClick: () =>
|
|
4906
|
-
className: `rsp-w-2 rsp-h-2 rsp-rounded-full rsp-transition-all ${
|
|
5128
|
+
onClick: () => c(y),
|
|
5129
|
+
className: `rsp-w-2 rsp-h-2 rsp-rounded-full rsp-transition-all ${y === i ? "rsp-bg-[#128C7E] rsp-w-6" : "rsp-bg-gray-300 hover:rsp-bg-gray-400"}`
|
|
4907
5130
|
},
|
|
4908
|
-
|
|
5131
|
+
y
|
|
4909
5132
|
)) })
|
|
4910
5133
|
] }) }) }) }),
|
|
4911
5134
|
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(
|
|
4912
|
-
|
|
5135
|
+
Na,
|
|
4913
5136
|
{
|
|
4914
5137
|
buttons: a.buttons,
|
|
4915
|
-
onShowAllOptions: () =>
|
|
5138
|
+
onShowAllOptions: () => n(!0)
|
|
4916
5139
|
}
|
|
4917
5140
|
) }) })
|
|
4918
5141
|
] }) : /* @__PURE__ */ e("div", { className: "rsp-flex rsp-items-center rsp-justify-center rsp-h-[300px]", children: /* @__PURE__ */ r("div", { className: "rsp-text-center rsp-text-gray-500 rsp-animate-fade-in", children: [
|
|
@@ -4926,25 +5149,25 @@ function oa({ template: a }) {
|
|
|
4926
5149
|
/* @__PURE__ */ e("div", { className: "rsp-flex-1 rsp-bg-gradient-to-r rsp-from-white rsp-to-[#fafafa] rsp-rounded-[24px] rsp-px-4 rsp-py-2 rsp-flex rsp-items-center rsp-min-h-[36px] rsp-shadow-[0_1px_2px_rgba(0,0,0,0.1)] rsp-border rsp-border-gray-200", children: /* @__PURE__ */ e("span", { className: "rsp-text-[13px] rsp-text-[#667781] rsp-opacity-70 rsp-font-normal", children: "Type a message" }) }),
|
|
4927
5150
|
/* @__PURE__ */ e("div", { className: "rsp-w-9 rsp-h-9 rsp-bg-gradient-to-br rsp-from-[#25D366] rsp-via-[#20c55e] rsp-to-[#00A884] rsp-rounded-full rsp-flex rsp-items-center rsp-justify-center rsp-shadow-[0_2px_6px_rgba(37,211,102,0.3)] rsp-border rsp-border-[#20c55e] rsp-border-opacity-30", children: /* @__PURE__ */ e("svg", { className: "rsp-w-4 rsp-h-4 rsp-text-white rsp-drop-shadow-sm", viewBox: "0 0 24 24", fill: "currentColor", children: /* @__PURE__ */ e("path", { d: "M2.01 21L23 12 2.01 3 2 10l15 2-15 2z" }) }) })
|
|
4928
5151
|
] }),
|
|
4929
|
-
|
|
5152
|
+
s && /* @__PURE__ */ e("div", { className: "rsp-absolute rsp-inset-0 rsp-bg-black rsp-bg-opacity-40 rsp-z-30 rsp-flex rsp-items-end rsp-animate-fade-in", children: /* @__PURE__ */ r(
|
|
4930
5153
|
"div",
|
|
4931
5154
|
{
|
|
4932
5155
|
className: "rsp-w-full rsp-bg-[#F0F2F5] rsp-rounded-t-2xl rsp-shadow-lg rsp-animate-slide-up",
|
|
4933
5156
|
children: [
|
|
4934
5157
|
/* @__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" }) }),
|
|
4935
|
-
/* @__PURE__ */ e("div", { className: "rsp-max-h-[250px] rsp-overflow-y-auto", children: a.buttons.map((
|
|
5158
|
+
/* @__PURE__ */ e("div", { className: "rsp-max-h-[250px] rsp-overflow-y-auto", children: a.buttons.map((b, y) => /* @__PURE__ */ e(
|
|
4936
5159
|
"div",
|
|
4937
5160
|
{
|
|
4938
|
-
className: `rsp-p-4 rsp-text-center rsp-text-[15px] rsp-text-[#128C7E] rsp-font-medium ${
|
|
5161
|
+
className: `rsp-p-4 rsp-text-center rsp-text-[15px] rsp-text-[#128C7E] rsp-font-medium ${y < a.buttons.length - 1 ? "rsp-border-b rsp-border-gray-300" : ""}`,
|
|
4939
5162
|
style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' },
|
|
4940
|
-
children:
|
|
5163
|
+
children: b.text
|
|
4941
5164
|
},
|
|
4942
|
-
|
|
5165
|
+
b.id
|
|
4943
5166
|
)) }),
|
|
4944
5167
|
/* @__PURE__ */ e(
|
|
4945
5168
|
"div",
|
|
4946
5169
|
{
|
|
4947
|
-
onClick: () =>
|
|
5170
|
+
onClick: () => n(!1),
|
|
4948
5171
|
className: "rsp-mt-2 rsp-p-4 rsp-text-center rsp-font-bold rsp-text-[#128C7E] rsp-bg-white rsp-cursor-pointer rsp-shadow-inner",
|
|
4949
5172
|
style: { fontFamily: 'system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif' },
|
|
4950
5173
|
children: "Close"
|
|
@@ -4958,7 +5181,7 @@ function oa({ template: a }) {
|
|
|
4958
5181
|
] }) }) })
|
|
4959
5182
|
] });
|
|
4960
5183
|
}
|
|
4961
|
-
const
|
|
5184
|
+
const Le = {
|
|
4962
5185
|
name: "",
|
|
4963
5186
|
category: "MARKETING",
|
|
4964
5187
|
type: "BASIC",
|
|
@@ -4970,111 +5193,106 @@ const ke = {
|
|
|
4970
5193
|
footer: "",
|
|
4971
5194
|
buttons: []
|
|
4972
5195
|
};
|
|
4973
|
-
function
|
|
4974
|
-
var
|
|
4975
|
-
const i = (
|
|
5196
|
+
function Sa({ editId: a, onCancel: s }) {
|
|
5197
|
+
var y, t, x;
|
|
5198
|
+
const [n, i] = B(Le), [c, o] = B(!0), [l, v] = B(!1), [g, h] = B(!1), [k, V] = B(null), [d, N] = B({
|
|
4976
5199
|
isOpen: !1
|
|
4977
|
-
})
|
|
5200
|
+
});
|
|
5201
|
+
B({
|
|
4978
5202
|
isOpen: !1
|
|
4979
|
-
}),
|
|
4980
|
-
if (
|
|
4981
|
-
|
|
4982
|
-
|
|
4983
|
-
var c, M, A;
|
|
4984
|
-
return !!((A = (M = (c = l.sampleContent) == null ? void 0 : c.headerVariables) == null ? void 0 : M[T]) != null && A.trim());
|
|
4985
|
-
}
|
|
4986
|
-
), b = x.every(
|
|
4987
|
-
(T) => {
|
|
4988
|
-
var c, M, A;
|
|
4989
|
-
return !!((A = (M = (c = l.sampleContent) == null ? void 0 : c.bodyVariables) == null ? void 0 : M[T]) != null && A.trim());
|
|
4990
|
-
}
|
|
4991
|
-
), E = L.every(
|
|
4992
|
-
(T) => {
|
|
4993
|
-
var c, M, A;
|
|
4994
|
-
return !!((A = (M = (c = l.sampleContent) == null ? void 0 : c.buttonVariables) == null ? void 0 : M[T]) != null && A.trim());
|
|
4995
|
-
}
|
|
4996
|
-
);
|
|
4997
|
-
return s && b && E;
|
|
4998
|
-
}, u = (x) => {
|
|
4999
|
-
if (!x) return [];
|
|
5000
|
-
const w = x.match(/\{\{(\d+)\}\}/g) || [];
|
|
5001
|
-
return [...new Set(w.map((L) => L.replace(/[{}]/g, "")))];
|
|
5002
|
-
}, t = () => {
|
|
5003
|
-
const x = l.buttons.find(
|
|
5004
|
-
(L) => L.type === "URL" && L.urlType === "dynamic"
|
|
5005
|
-
);
|
|
5006
|
-
if (!(x != null && x.value)) return [];
|
|
5007
|
-
const w = x.value.match(/\{\{(\d+)\}\}/g) || [];
|
|
5008
|
-
return [...new Set(w.map((L) => L.replace(/[{}]/g, "")))];
|
|
5009
|
-
};
|
|
5010
|
-
se(() => {
|
|
5011
|
-
if (f) {
|
|
5012
|
-
const x = setTimeout(() => {
|
|
5013
|
-
y(null);
|
|
5203
|
+
}), le(() => {
|
|
5204
|
+
if (k) {
|
|
5205
|
+
const p = setTimeout(() => {
|
|
5206
|
+
V(null);
|
|
5014
5207
|
}, 5e3);
|
|
5015
|
-
return () => clearTimeout(
|
|
5208
|
+
return () => clearTimeout(p);
|
|
5016
5209
|
}
|
|
5017
|
-
}, [
|
|
5018
|
-
const
|
|
5019
|
-
var
|
|
5210
|
+
}, [k]);
|
|
5211
|
+
const M = async () => {
|
|
5212
|
+
var p, w, A;
|
|
5020
5213
|
try {
|
|
5021
|
-
if (
|
|
5214
|
+
if (h(!0), V(null), !n.name || !n.body)
|
|
5022
5215
|
throw new Error("Template name and body are required");
|
|
5023
|
-
const
|
|
5024
|
-
if (!
|
|
5216
|
+
const R = localStorage.getItem("account"), f = R ? JSON.parse(R) : { apiKey: "" };
|
|
5217
|
+
if (!f.apiKey)
|
|
5025
5218
|
throw new Error("Please set your API key in the dashboard first");
|
|
5026
|
-
|
|
5027
|
-
if (
|
|
5028
|
-
|
|
5029
|
-
|
|
5219
|
+
let C;
|
|
5220
|
+
if (a) {
|
|
5221
|
+
const U = await sa(f.apiKey, a, n);
|
|
5222
|
+
if (!U.success)
|
|
5223
|
+
throw new Error(U.message || "Update failed");
|
|
5224
|
+
C = {
|
|
5225
|
+
status: "success",
|
|
5226
|
+
data: { details: [{ template_name: n.name, template_id: a }] }
|
|
5227
|
+
};
|
|
5228
|
+
} else if (C = await ra(f, n), C.status === "error")
|
|
5229
|
+
throw new Error(C.message);
|
|
5230
|
+
if (C.status === "error")
|
|
5231
|
+
throw new Error(C.message);
|
|
5232
|
+
N({
|
|
5030
5233
|
isOpen: !0,
|
|
5031
|
-
templateName: (
|
|
5032
|
-
templateId: (w =
|
|
5033
|
-
|
|
5034
|
-
|
|
5035
|
-
|
|
5036
|
-
|
|
5037
|
-
y(s instanceof Error ? s.message : "An error occurred while creating the template");
|
|
5234
|
+
templateName: (p = C.data) == null ? void 0 : p.details[0].template_name,
|
|
5235
|
+
templateId: (w = C.data) == null ? void 0 : w.details[0].template_id,
|
|
5236
|
+
template: (A = C.data) == null ? void 0 : A.template
|
|
5237
|
+
}), i(Le);
|
|
5238
|
+
} catch (R) {
|
|
5239
|
+
V(R instanceof Error ? R.message : "An error occurred while creating the template");
|
|
5038
5240
|
} finally {
|
|
5039
|
-
|
|
5241
|
+
h(!1);
|
|
5040
5242
|
}
|
|
5041
|
-
}
|
|
5042
|
-
|
|
5243
|
+
};
|
|
5244
|
+
le(() => {
|
|
5245
|
+
if (!a) return;
|
|
5246
|
+
(async () => {
|
|
5247
|
+
try {
|
|
5248
|
+
const w = localStorage.getItem("account"), A = w ? JSON.parse(w) : { apiKey: "" };
|
|
5249
|
+
if (!A.apiKey)
|
|
5250
|
+
throw new Error("Please set your API key in the dashboard first");
|
|
5251
|
+
const R = await na(A.apiKey, a);
|
|
5252
|
+
i((f) => ({ ...f, ...R }));
|
|
5253
|
+
} catch (w) {
|
|
5254
|
+
console.error("Failed to load template for edit", w), V(w instanceof Error ? w.message : "Failed to load template");
|
|
5255
|
+
}
|
|
5256
|
+
})();
|
|
5257
|
+
}, [a]);
|
|
5258
|
+
const b = () => {
|
|
5259
|
+
N({ isOpen: !1 }), s && s();
|
|
5043
5260
|
};
|
|
5044
5261
|
return /* @__PURE__ */ r("div", { className: "rsp-min-h-screen rsp-bg-[#f5f7fc] rsp-rounded-lg rsp-shadow-sm", children: [
|
|
5045
5262
|
/* @__PURE__ */ r("div", { className: "rsp-max-w-[1200px] rsp-mx-auto rsp-px-6 rsp-h-full", children: [
|
|
5046
5263
|
/* @__PURE__ */ e("div", { className: "rsp-py-6 rsp-border-b rsp-border-gray-200", children: /* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-justify-between", children: [
|
|
5047
|
-
/* @__PURE__ */ e("h1", { className: "rsp-text-2xl rsp-font-semibold rsp-text-[#0043ff]", children: "Add Template" }),
|
|
5264
|
+
/* @__PURE__ */ e("h1", { className: "rsp-text-2xl rsp-font-semibold rsp-text-[#0043ff]", children: a ? "Edit Template" : "Add Template" }),
|
|
5048
5265
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-items-center rsp-gap-3", children: [
|
|
5049
|
-
/* @__PURE__ */ e(
|
|
5050
|
-
"button",
|
|
5051
|
-
{
|
|
5052
|
-
onClick: () => {
|
|
5053
|
-
a ? a() : i ? i("/") : window.history.length > 1 && window.history.back();
|
|
5054
|
-
},
|
|
5055
|
-
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 rsp-transition-colors",
|
|
5056
|
-
children: "Cancel"
|
|
5057
|
-
}
|
|
5058
|
-
),
|
|
5059
5266
|
/* @__PURE__ */ r(
|
|
5060
5267
|
"button",
|
|
5061
5268
|
{
|
|
5062
|
-
onClick: () =>
|
|
5269
|
+
onClick: () => o(!c),
|
|
5063
5270
|
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
|
|
5064
|
-
${
|
|
5271
|
+
${c ? "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"}`,
|
|
5065
5272
|
children: [
|
|
5066
5273
|
/* @__PURE__ */ r("svg", { className: "rsp-w-4 rsp-h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: [
|
|
5067
5274
|
/* @__PURE__ */ e("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M15 12a3 3 0 11-6 0 3 3 0 016 0z" }),
|
|
5068
5275
|
/* @__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" })
|
|
5069
5276
|
] }),
|
|
5070
|
-
|
|
5277
|
+
c ? "Hide Preview" : "Show Preview"
|
|
5278
|
+
]
|
|
5279
|
+
}
|
|
5280
|
+
),
|
|
5281
|
+
/* @__PURE__ */ r(
|
|
5282
|
+
"button",
|
|
5283
|
+
{
|
|
5284
|
+
onClick: () => s == null ? void 0 : s(),
|
|
5285
|
+
className: "rsp-flex rsp-items-center rsp-gap-1 rsp-text-sm rsp-font-medium rsp-text-[#0043ff] hover:rsp-text-[#0033cc] rsp-transition-colors rsp-bg-transparent rsp-border-0 rsp-cursor-pointer",
|
|
5286
|
+
children: [
|
|
5287
|
+
/* @__PURE__ */ e(Fe, { className: "rsp-w-5 rsp-h-5 rsp-relative rsp-left-[6px]" }),
|
|
5288
|
+
"Back"
|
|
5071
5289
|
]
|
|
5072
5290
|
}
|
|
5073
5291
|
)
|
|
5074
5292
|
] })
|
|
5075
5293
|
] }) }),
|
|
5076
|
-
/* @__PURE__ */ r("div", { className: `rsp-py-8 ${
|
|
5077
|
-
/* @__PURE__ */ r("div", { className: `rsp-space-y-8 ${
|
|
5294
|
+
/* @__PURE__ */ r("div", { className: `rsp-py-8 ${c ? "rsp-grid xl:rsp-grid-cols-[1fr,400px] rsp-gap-8" : ""}`, children: [
|
|
5295
|
+
/* @__PURE__ */ r("div", { className: `rsp-space-y-8 ${c ? "" : "rsp-max-w-4xl rsp-mx-auto"}`, children: [
|
|
5078
5296
|
/* @__PURE__ */ r("div", { className: "rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm rsp-space-y-6", children: [
|
|
5079
5297
|
/* @__PURE__ */ r("div", { children: [
|
|
5080
5298
|
/* @__PURE__ */ r("label", { className: "rsp-block rsp-text-sm rsp-font-medium rsp-text-gray-700 rsp-mb-2", children: [
|
|
@@ -5086,14 +5304,16 @@ function ya({ onCancel: a }) {
|
|
|
5086
5304
|
"input",
|
|
5087
5305
|
{
|
|
5088
5306
|
type: "text",
|
|
5089
|
-
value:
|
|
5090
|
-
onChange: (
|
|
5307
|
+
value: n.name,
|
|
5308
|
+
onChange: (p) => i({ ...n, name: p.target.value.replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, "").replace(/_+/g, "_") }),
|
|
5309
|
+
onBlur: () => v(!0),
|
|
5091
5310
|
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",
|
|
5092
5311
|
placeholder: "Template name cannot Have capital letters and space"
|
|
5093
5312
|
}
|
|
5094
5313
|
),
|
|
5095
5314
|
/* @__PURE__ */ e("div", { className: "rsp-absolute rsp-bottom-0 rsp-left-0 rsp-w-4 rsp-h-0.5 rsp-bg-red-500" })
|
|
5096
5315
|
] }),
|
|
5316
|
+
!n.name && l && /* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-red-600 rsp-mt-1", children: "Template name is required." }),
|
|
5097
5317
|
/* @__PURE__ */ e("p", { className: "rsp-text-xs rsp-text-gray-500 rsp-mt-1", children: "Template name cannot Have capital letters and space" })
|
|
5098
5318
|
] }),
|
|
5099
5319
|
/* @__PURE__ */ r("div", { className: "rsp-grid rsp-grid-cols-2 rsp-gap-6", children: [
|
|
@@ -5103,8 +5323,8 @@ function ya({ onCancel: a }) {
|
|
|
5103
5323
|
/* @__PURE__ */ r(
|
|
5104
5324
|
"select",
|
|
5105
5325
|
{
|
|
5106
|
-
value:
|
|
5107
|
-
onChange: (
|
|
5326
|
+
value: n.category,
|
|
5327
|
+
onChange: (p) => i({ ...n, category: p.target.value }),
|
|
5108
5328
|
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",
|
|
5109
5329
|
children: [
|
|
5110
5330
|
/* @__PURE__ */ e("option", { value: "MARKETING", children: "Marketing" }),
|
|
@@ -5123,10 +5343,10 @@ function ya({ onCancel: a }) {
|
|
|
5123
5343
|
/* @__PURE__ */ e(
|
|
5124
5344
|
"select",
|
|
5125
5345
|
{
|
|
5126
|
-
value:
|
|
5127
|
-
onChange: (
|
|
5346
|
+
value: n.language,
|
|
5347
|
+
onChange: (p) => i({ ...n, language: p.target.value }),
|
|
5128
5348
|
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",
|
|
5129
|
-
children:
|
|
5349
|
+
children: la.map((p) => /* @__PURE__ */ e("option", { value: p.value, children: p.label }, p.value))
|
|
5130
5350
|
}
|
|
5131
5351
|
),
|
|
5132
5352
|
/* @__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" }) }) }),
|
|
@@ -5141,11 +5361,11 @@ function ya({ onCancel: a }) {
|
|
|
5141
5361
|
/* @__PURE__ */ r(
|
|
5142
5362
|
"select",
|
|
5143
5363
|
{
|
|
5144
|
-
value:
|
|
5145
|
-
onChange: (
|
|
5146
|
-
const w =
|
|
5147
|
-
w === "CAROUSEL" && !
|
|
5148
|
-
...
|
|
5364
|
+
value: n.type,
|
|
5365
|
+
onChange: (p) => {
|
|
5366
|
+
const w = p.target.value;
|
|
5367
|
+
w === "CAROUSEL" && !n.carousel ? i({
|
|
5368
|
+
...n,
|
|
5149
5369
|
type: w,
|
|
5150
5370
|
carousel: {
|
|
5151
5371
|
type: "IMAGE",
|
|
@@ -5158,7 +5378,7 @@ function ya({ onCancel: a }) {
|
|
|
5158
5378
|
buttons: []
|
|
5159
5379
|
}]
|
|
5160
5380
|
}
|
|
5161
|
-
}) :
|
|
5381
|
+
}) : i({ ...n, type: w });
|
|
5162
5382
|
},
|
|
5163
5383
|
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
5384
|
children: [
|
|
@@ -5177,8 +5397,8 @@ function ya({ onCancel: a }) {
|
|
|
5177
5397
|
/* @__PURE__ */ r(
|
|
5178
5398
|
"select",
|
|
5179
5399
|
{
|
|
5180
|
-
value:
|
|
5181
|
-
onChange: (
|
|
5400
|
+
value: n.enableClickTracking.toString(),
|
|
5401
|
+
onChange: (p) => i({ ...n, enableClickTracking: p.target.value === "true" }),
|
|
5182
5402
|
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",
|
|
5183
5403
|
children: [
|
|
5184
5404
|
/* @__PURE__ */ e("option", { value: "false", children: "False" }),
|
|
@@ -5191,70 +5411,70 @@ function ya({ onCancel: a }) {
|
|
|
5191
5411
|
] })
|
|
5192
5412
|
] })
|
|
5193
5413
|
] }),
|
|
5194
|
-
/* @__PURE__ */ e("div", { className: "rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm", children: /* @__PURE__ */ e(
|
|
5414
|
+
/* @__PURE__ */ e("div", { className: "rsp-bg-white rsp-p-6 rsp-rounded-lg rsp-shadow-sm", children: /* @__PURE__ */ e(va, { template: n, setTemplate: i }) }),
|
|
5195
5415
|
/* @__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: [
|
|
5196
|
-
|
|
5197
|
-
/* @__PURE__ */ e(
|
|
5416
|
+
k && /* @__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: [
|
|
5417
|
+
/* @__PURE__ */ e(fe, { className: "rsp-w-5 rsp-h-5 rsp-text-red-500 rsp-flex-shrink-0 rsp-mt-0.5" }),
|
|
5198
5418
|
/* @__PURE__ */ r("div", { children: [
|
|
5199
5419
|
/* @__PURE__ */ e("h3", { className: "rsp-text-sm rsp-font-medium rsp-text-red-800", children: "Error" }),
|
|
5200
|
-
/* @__PURE__ */ e("p", { className: "rsp-mt-1 rsp-text-sm rsp-text-red-700", children:
|
|
5420
|
+
/* @__PURE__ */ e("p", { className: "rsp-mt-1 rsp-text-sm rsp-text-red-700", children: k })
|
|
5201
5421
|
] }),
|
|
5202
5422
|
/* @__PURE__ */ e(
|
|
5203
5423
|
"button",
|
|
5204
5424
|
{
|
|
5205
|
-
onClick: () =>
|
|
5425
|
+
onClick: () => V(null),
|
|
5206
5426
|
className: "rsp-absolute rsp-top-2 rsp-right-2 rsp-p-1 hover:rsp-bg-red-100 rsp-rounded-full",
|
|
5207
|
-
children: /* @__PURE__ */ e(
|
|
5427
|
+
children: /* @__PURE__ */ e(re, { className: "rsp-w-4 rsp-h-4 rsp-text-red-500" })
|
|
5208
5428
|
}
|
|
5209
5429
|
)
|
|
5210
5430
|
] }),
|
|
5211
5431
|
/* @__PURE__ */ e("div", { className: "rsp-flex rsp-gap-4", children: /* @__PURE__ */ e(
|
|
5212
5432
|
"button",
|
|
5213
5433
|
{
|
|
5214
|
-
onClick:
|
|
5215
|
-
disabled:
|
|
5434
|
+
onClick: M,
|
|
5435
|
+
disabled: g,
|
|
5216
5436
|
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
|
|
5217
|
-
${
|
|
5218
|
-
children:
|
|
5437
|
+
${g ? "rsp-bg-blue-600 rsp-cursor-not-allowed" : "rsp-bg-blue-600 hover:rsp-bg-blue-700 active:rsp-bg-blue-800"}`,
|
|
5438
|
+
children: g ? a ? "Resubmitting for Approval..." : "Submitting for Approval..." : a ? "Resubmit for Approval" : "Submit for Approval"
|
|
5219
5439
|
}
|
|
5220
5440
|
) })
|
|
5221
5441
|
] })
|
|
5222
5442
|
] }),
|
|
5223
|
-
|
|
5443
|
+
c && /* @__PURE__ */ e("div", { children: /* @__PURE__ */ e("div", { className: "rsp-sticky rsp-top-4", children: /* @__PURE__ */ e(Ca, { template: n }) }) })
|
|
5224
5444
|
] })
|
|
5225
5445
|
] }),
|
|
5226
5446
|
/* @__PURE__ */ e(
|
|
5227
|
-
|
|
5447
|
+
te,
|
|
5228
5448
|
{
|
|
5229
|
-
isOpen:
|
|
5230
|
-
onClose:
|
|
5449
|
+
isOpen: d.isOpen,
|
|
5450
|
+
onClose: b,
|
|
5231
5451
|
title: "Success",
|
|
5232
5452
|
children: /* @__PURE__ */ r("div", { className: "rsp-space-y-4", children: [
|
|
5233
5453
|
/* @__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!" }) }),
|
|
5234
|
-
|
|
5454
|
+
d.templateId && /* @__PURE__ */ r("div", { className: "rsp-bg-gray-50 rsp-p-4 rsp-rounded-lg rsp-space-y-2", children: [
|
|
5235
5455
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
|
|
5236
5456
|
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Template Name:" }),
|
|
5237
|
-
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium", children:
|
|
5457
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium", children: d.templateName })
|
|
5238
5458
|
] }),
|
|
5239
5459
|
/* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
|
|
5240
5460
|
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Template ID:" }),
|
|
5241
|
-
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-font-mono", children:
|
|
5461
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-font-mono", children: d.templateId })
|
|
5242
5462
|
] }),
|
|
5243
|
-
((
|
|
5463
|
+
((y = d.template) == null ? void 0 : y.meta_tid) && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
|
|
5244
5464
|
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Meta TID:" }),
|
|
5245
|
-
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-font-mono", children:
|
|
5465
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-font-mono", children: d.template.meta_tid })
|
|
5246
5466
|
] }),
|
|
5247
|
-
((
|
|
5467
|
+
((t = d.template) == null ? void 0 : t.status) && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
|
|
5248
5468
|
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Status:" }),
|
|
5249
5469
|
/* @__PURE__ */ e("span", { className: `rsp-text-sm rsp-font-medium rsp-capitalize ${// @ts-ignore
|
|
5250
|
-
|
|
5470
|
+
d.template.status === "pending" ? "rsp-text-yellow-600" : (
|
|
5251
5471
|
// @ts-ignore
|
|
5252
|
-
|
|
5253
|
-
)}`, children:
|
|
5472
|
+
d.template.status === "approved" ? "rsp-text-green-600" : "rsp-text-red-600"
|
|
5473
|
+
)}`, children: d.template.status })
|
|
5254
5474
|
] }),
|
|
5255
|
-
((
|
|
5475
|
+
((x = d.template) == null ? void 0 : x.quality) && /* @__PURE__ */ r("div", { className: "rsp-flex rsp-justify-between", children: [
|
|
5256
5476
|
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-text-gray-600", children: "Quality:" }),
|
|
5257
|
-
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-capitalize", children:
|
|
5477
|
+
/* @__PURE__ */ e("span", { className: "rsp-text-sm rsp-font-medium rsp-capitalize", children: d.template.quality })
|
|
5258
5478
|
] })
|
|
5259
5479
|
] })
|
|
5260
5480
|
] })
|
|
@@ -5262,18 +5482,43 @@ function ya({ onCancel: a }) {
|
|
|
5262
5482
|
)
|
|
5263
5483
|
] });
|
|
5264
5484
|
}
|
|
5265
|
-
const
|
|
5266
|
-
function
|
|
5267
|
-
const i =
|
|
5268
|
-
|
|
5485
|
+
const Ea = Be({});
|
|
5486
|
+
function Va({ apiKey: a, pConfig: s, children: n }) {
|
|
5487
|
+
const i = Se(
|
|
5488
|
+
() => ({ apiKey: a, resulMeta: s }),
|
|
5489
|
+
[a, s]
|
|
5490
|
+
), c = Te(null);
|
|
5491
|
+
return le(() => {
|
|
5492
|
+
if (typeof window > "u" || a === void 0 && !s)
|
|
5493
|
+
return;
|
|
5494
|
+
let o = {};
|
|
5269
5495
|
try {
|
|
5270
|
-
localStorage.
|
|
5271
|
-
|
|
5496
|
+
const g = localStorage.getItem("account");
|
|
5497
|
+
g && (o = JSON.parse(g));
|
|
5498
|
+
} catch (g) {
|
|
5499
|
+
console.error(
|
|
5500
|
+
"TrustSignalProvider: Failed to read account from storage",
|
|
5501
|
+
g
|
|
5502
|
+
);
|
|
5272
5503
|
}
|
|
5273
|
-
|
|
5504
|
+
const l = {
|
|
5505
|
+
...o,
|
|
5506
|
+
...a !== void 0 ? { apiKey: a } : {},
|
|
5507
|
+
...s ? { resulMeta: s } : {}
|
|
5508
|
+
}, v = JSON.stringify(l);
|
|
5509
|
+
if (v !== c.current)
|
|
5510
|
+
try {
|
|
5511
|
+
localStorage.setItem("account", v), c.current = v;
|
|
5512
|
+
} catch (g) {
|
|
5513
|
+
console.error(
|
|
5514
|
+
"TrustSignalProvider: Failed to persist account to storage",
|
|
5515
|
+
g
|
|
5516
|
+
);
|
|
5517
|
+
}
|
|
5518
|
+
}, [a, s]), /* @__PURE__ */ e(Ea.Provider, { value: i, children: n });
|
|
5274
5519
|
}
|
|
5275
5520
|
export {
|
|
5276
|
-
|
|
5277
|
-
|
|
5278
|
-
|
|
5521
|
+
Sa as CreateTemplate,
|
|
5522
|
+
Ta as Dashboard,
|
|
5523
|
+
Va as TrustSignalProvider
|
|
5279
5524
|
};
|