@paroicms/contact-form-plugin 0.3.1 → 0.5.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 +1 -1
- package/{dist-backend/mail → backend/dist}/contact-form-mail.js +21 -23
- package/{dist-backend/helpers → backend/dist}/data-format.js +1 -2
- package/backend/dist/plugin.js +40 -0
- package/backend/locales/en.json +8 -0
- package/backend/locales/fr.json +8 -0
- package/package.json +14 -14
- package/public-front/dist/public-front-plugin.mjs +596 -0
- package/public-front/locales/en.json +14 -0
- package/public-front/locales/fr.json +14 -0
- package/dist-backend/plugin.js +0 -36
- package/dist-frontend/front-plugin.mjs +0 -632
- package/locales/en.json +0 -24
- package/locales/fr.json +0 -24
- /package/{dist-frontend → public-front/dist}/style.css +0 -0
|
@@ -0,0 +1,596 @@
|
|
|
1
|
+
const Te = (e, t) => e === t, H = {
|
|
2
|
+
equals: Te
|
|
3
|
+
};
|
|
4
|
+
let be = Ce;
|
|
5
|
+
const E = 1, B = 2, we = {
|
|
6
|
+
owned: null,
|
|
7
|
+
cleanups: null,
|
|
8
|
+
context: null,
|
|
9
|
+
owner: null
|
|
10
|
+
};
|
|
11
|
+
var u = null;
|
|
12
|
+
let z = null, Le = null, a = null, d = null, v = null, k = 0;
|
|
13
|
+
function Ne(e, t) {
|
|
14
|
+
const s = a, n = u, l = e.length === 0, r = t === void 0 ? n : t, i = l ? we : {
|
|
15
|
+
owned: null,
|
|
16
|
+
cleanups: null,
|
|
17
|
+
context: r ? r.context : null,
|
|
18
|
+
owner: r
|
|
19
|
+
}, o = l ? e : () => e(() => A(() => V(i)));
|
|
20
|
+
u = i, a = null;
|
|
21
|
+
try {
|
|
22
|
+
return T(o, !0);
|
|
23
|
+
} finally {
|
|
24
|
+
a = s, u = n;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
function y(e, t) {
|
|
28
|
+
t = t ? Object.assign({}, H, t) : H;
|
|
29
|
+
const s = {
|
|
30
|
+
value: e,
|
|
31
|
+
observers: null,
|
|
32
|
+
observerSlots: null,
|
|
33
|
+
comparator: t.equals || void 0
|
|
34
|
+
}, n = (l) => (typeof l == "function" && (l = l(s.value)), ve(s, l));
|
|
35
|
+
return [ye.bind(s), n];
|
|
36
|
+
}
|
|
37
|
+
function S(e, t, s) {
|
|
38
|
+
const n = ne(e, t, !1, E);
|
|
39
|
+
_(n);
|
|
40
|
+
}
|
|
41
|
+
function Oe(e, t, s) {
|
|
42
|
+
be = qe;
|
|
43
|
+
const n = ne(e, t, !1, E);
|
|
44
|
+
n.user = !0, v ? v.push(n) : _(n);
|
|
45
|
+
}
|
|
46
|
+
function ee(e, t, s) {
|
|
47
|
+
s = s ? Object.assign({}, H, s) : H;
|
|
48
|
+
const n = ne(e, t, !0, 0);
|
|
49
|
+
return n.observers = null, n.observerSlots = null, n.comparator = s.equals || void 0, _(n), ye.bind(n);
|
|
50
|
+
}
|
|
51
|
+
function A(e) {
|
|
52
|
+
if (a === null)
|
|
53
|
+
return e();
|
|
54
|
+
const t = a;
|
|
55
|
+
a = null;
|
|
56
|
+
try {
|
|
57
|
+
return e();
|
|
58
|
+
} finally {
|
|
59
|
+
a = t;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
function Ue(e) {
|
|
63
|
+
Oe(() => A(e));
|
|
64
|
+
}
|
|
65
|
+
function He(e) {
|
|
66
|
+
return u === null || (u.cleanups === null ? u.cleanups = [e] : u.cleanups.push(e)), e;
|
|
67
|
+
}
|
|
68
|
+
function ye() {
|
|
69
|
+
if (this.sources && this.state)
|
|
70
|
+
if (this.state === E)
|
|
71
|
+
_(this);
|
|
72
|
+
else {
|
|
73
|
+
const e = d;
|
|
74
|
+
d = null, T(() => q(this), !1), d = e;
|
|
75
|
+
}
|
|
76
|
+
if (a) {
|
|
77
|
+
const e = this.observers ? this.observers.length : 0;
|
|
78
|
+
a.sources ? (a.sources.push(this), a.sourceSlots.push(e)) : (a.sources = [this], a.sourceSlots = [e]), this.observers ? (this.observers.push(a), this.observerSlots.push(a.sources.length - 1)) : (this.observers = [a], this.observerSlots = [a.sources.length - 1]);
|
|
79
|
+
}
|
|
80
|
+
return this.value;
|
|
81
|
+
}
|
|
82
|
+
function ve(e, t, s) {
|
|
83
|
+
let n = e.value;
|
|
84
|
+
return (!e.comparator || !e.comparator(n, t)) && (e.value = t, e.observers && e.observers.length && T(() => {
|
|
85
|
+
for (let l = 0; l < e.observers.length; l += 1) {
|
|
86
|
+
const r = e.observers[l], i = z && z.running;
|
|
87
|
+
i && z.disposed.has(r), (i ? !r.tState : !r.state) && (r.pure ? d.push(r) : v.push(r), r.observers && Se(r)), i || (r.state = E);
|
|
88
|
+
}
|
|
89
|
+
if (d.length > 1e6)
|
|
90
|
+
throw d = [], new Error();
|
|
91
|
+
}, !1)), t;
|
|
92
|
+
}
|
|
93
|
+
function _(e) {
|
|
94
|
+
if (!e.fn)
|
|
95
|
+
return;
|
|
96
|
+
V(e);
|
|
97
|
+
const t = k;
|
|
98
|
+
Be(e, e.value, t);
|
|
99
|
+
}
|
|
100
|
+
function Be(e, t, s) {
|
|
101
|
+
let n;
|
|
102
|
+
const l = u, r = a;
|
|
103
|
+
a = u = e;
|
|
104
|
+
try {
|
|
105
|
+
n = e.fn(t);
|
|
106
|
+
} catch (i) {
|
|
107
|
+
return e.pure && (e.state = E, e.owned && e.owned.forEach(V), e.owned = null), e.updatedAt = s + 1, Ee(i);
|
|
108
|
+
} finally {
|
|
109
|
+
a = r, u = l;
|
|
110
|
+
}
|
|
111
|
+
(!e.updatedAt || e.updatedAt <= s) && (e.updatedAt != null && "observers" in e ? ve(e, n) : e.value = n, e.updatedAt = s);
|
|
112
|
+
}
|
|
113
|
+
function ne(e, t, s, n = E, l) {
|
|
114
|
+
const r = {
|
|
115
|
+
fn: e,
|
|
116
|
+
state: n,
|
|
117
|
+
updatedAt: null,
|
|
118
|
+
owned: null,
|
|
119
|
+
sources: null,
|
|
120
|
+
sourceSlots: null,
|
|
121
|
+
cleanups: null,
|
|
122
|
+
value: t,
|
|
123
|
+
owner: u,
|
|
124
|
+
context: u ? u.context : null,
|
|
125
|
+
pure: s
|
|
126
|
+
};
|
|
127
|
+
return u === null || u !== we && (u.owned ? u.owned.push(r) : u.owned = [r]), r;
|
|
128
|
+
}
|
|
129
|
+
function I(e) {
|
|
130
|
+
if (e.state === 0)
|
|
131
|
+
return;
|
|
132
|
+
if (e.state === B)
|
|
133
|
+
return q(e);
|
|
134
|
+
if (e.suspense && A(e.suspense.inFallback))
|
|
135
|
+
return e.suspense.effects.push(e);
|
|
136
|
+
const t = [e];
|
|
137
|
+
for (; (e = e.owner) && (!e.updatedAt || e.updatedAt < k); )
|
|
138
|
+
e.state && t.push(e);
|
|
139
|
+
for (let s = t.length - 1; s >= 0; s--)
|
|
140
|
+
if (e = t[s], e.state === E)
|
|
141
|
+
_(e);
|
|
142
|
+
else if (e.state === B) {
|
|
143
|
+
const n = d;
|
|
144
|
+
d = null, T(() => q(e, t[0]), !1), d = n;
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
function T(e, t) {
|
|
148
|
+
if (d)
|
|
149
|
+
return e();
|
|
150
|
+
let s = !1;
|
|
151
|
+
t || (d = []), v ? s = !0 : v = [], k++;
|
|
152
|
+
try {
|
|
153
|
+
const n = e();
|
|
154
|
+
return Ie(s), n;
|
|
155
|
+
} catch (n) {
|
|
156
|
+
s || (v = null), d = null, Ee(n);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
function Ie(e) {
|
|
160
|
+
if (d && (Ce(d), d = null), e)
|
|
161
|
+
return;
|
|
162
|
+
const t = v;
|
|
163
|
+
v = null, t.length && T(() => be(t), !1);
|
|
164
|
+
}
|
|
165
|
+
function Ce(e) {
|
|
166
|
+
for (let t = 0; t < e.length; t++)
|
|
167
|
+
I(e[t]);
|
|
168
|
+
}
|
|
169
|
+
function qe(e) {
|
|
170
|
+
let t, s = 0;
|
|
171
|
+
for (t = 0; t < e.length; t++) {
|
|
172
|
+
const n = e[t];
|
|
173
|
+
n.user ? e[s++] = n : I(n);
|
|
174
|
+
}
|
|
175
|
+
for (t = 0; t < s; t++)
|
|
176
|
+
I(e[t]);
|
|
177
|
+
}
|
|
178
|
+
function q(e, t) {
|
|
179
|
+
e.state = 0;
|
|
180
|
+
for (let s = 0; s < e.sources.length; s += 1) {
|
|
181
|
+
const n = e.sources[s];
|
|
182
|
+
if (n.sources) {
|
|
183
|
+
const l = n.state;
|
|
184
|
+
l === E ? n !== t && (!n.updatedAt || n.updatedAt < k) && I(n) : l === B && q(n, t);
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
function Se(e) {
|
|
189
|
+
for (let t = 0; t < e.observers.length; t += 1) {
|
|
190
|
+
const s = e.observers[t];
|
|
191
|
+
s.state || (s.state = B, s.pure ? d.push(s) : v.push(s), s.observers && Se(s));
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
function V(e) {
|
|
195
|
+
let t;
|
|
196
|
+
if (e.sources)
|
|
197
|
+
for (; e.sources.length; ) {
|
|
198
|
+
const s = e.sources.pop(), n = e.sourceSlots.pop(), l = s.observers;
|
|
199
|
+
if (l && l.length) {
|
|
200
|
+
const r = l.pop(), i = s.observerSlots.pop();
|
|
201
|
+
n < l.length && (r.sourceSlots[i] = n, l[n] = r, s.observerSlots[n] = i);
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (e.owned) {
|
|
205
|
+
for (t = e.owned.length - 1; t >= 0; t--)
|
|
206
|
+
V(e.owned[t]);
|
|
207
|
+
e.owned = null;
|
|
208
|
+
}
|
|
209
|
+
if (e.cleanups) {
|
|
210
|
+
for (t = e.cleanups.length - 1; t >= 0; t--)
|
|
211
|
+
e.cleanups[t]();
|
|
212
|
+
e.cleanups = null;
|
|
213
|
+
}
|
|
214
|
+
e.state = 0;
|
|
215
|
+
}
|
|
216
|
+
function De(e) {
|
|
217
|
+
return e instanceof Error ? e : new Error(typeof e == "string" ? e : "Unknown error", {
|
|
218
|
+
cause: e
|
|
219
|
+
});
|
|
220
|
+
}
|
|
221
|
+
function Ee(e, t = u) {
|
|
222
|
+
throw De(e);
|
|
223
|
+
}
|
|
224
|
+
let ke = !1;
|
|
225
|
+
function te(e, t) {
|
|
226
|
+
return A(() => e(t || {}));
|
|
227
|
+
}
|
|
228
|
+
const Ve = (e) => `Stale read from <${e}>.`;
|
|
229
|
+
function pe(e) {
|
|
230
|
+
const t = e.keyed, s = ee(() => e.when, void 0, {
|
|
231
|
+
equals: (n, l) => t ? n === l : !n == !l
|
|
232
|
+
});
|
|
233
|
+
return ee(() => {
|
|
234
|
+
const n = s();
|
|
235
|
+
if (n) {
|
|
236
|
+
const l = e.children;
|
|
237
|
+
return typeof l == "function" && l.length > 0 ? A(() => l(t ? n : () => {
|
|
238
|
+
if (!A(s))
|
|
239
|
+
throw Ve("Show");
|
|
240
|
+
return e.when;
|
|
241
|
+
})) : l;
|
|
242
|
+
}
|
|
243
|
+
return e.fallback;
|
|
244
|
+
}, void 0, void 0);
|
|
245
|
+
}
|
|
246
|
+
function Ge(e, t, s) {
|
|
247
|
+
let n = s.length, l = t.length, r = n, i = 0, o = 0, f = t[l - 1].nextSibling, p = null;
|
|
248
|
+
for (; i < l || o < r; ) {
|
|
249
|
+
if (t[i] === s[o]) {
|
|
250
|
+
i++, o++;
|
|
251
|
+
continue;
|
|
252
|
+
}
|
|
253
|
+
for (; t[l - 1] === s[r - 1]; )
|
|
254
|
+
l--, r--;
|
|
255
|
+
if (l === i) {
|
|
256
|
+
const h = r < n ? o ? s[o - 1].nextSibling : s[r - o] : f;
|
|
257
|
+
for (; o < r; )
|
|
258
|
+
e.insertBefore(s[o++], h);
|
|
259
|
+
} else if (r === o)
|
|
260
|
+
for (; i < l; )
|
|
261
|
+
(!p || !p.has(t[i])) && t[i].remove(), i++;
|
|
262
|
+
else if (t[i] === s[r - 1] && s[o] === t[l - 1]) {
|
|
263
|
+
const h = t[--l].nextSibling;
|
|
264
|
+
e.insertBefore(s[o++], t[i++].nextSibling), e.insertBefore(s[--r], h), t[l] = s[r];
|
|
265
|
+
} else {
|
|
266
|
+
if (!p) {
|
|
267
|
+
p = /* @__PURE__ */ new Map();
|
|
268
|
+
let w = o;
|
|
269
|
+
for (; w < r; )
|
|
270
|
+
p.set(s[w], w++);
|
|
271
|
+
}
|
|
272
|
+
const h = p.get(t[i]);
|
|
273
|
+
if (h != null)
|
|
274
|
+
if (o < h && h < r) {
|
|
275
|
+
let w = i, j = 1, M;
|
|
276
|
+
for (; ++w < l && w < r && !((M = p.get(t[w])) == null || M !== h + j); )
|
|
277
|
+
j++;
|
|
278
|
+
if (j > h - o) {
|
|
279
|
+
const L = t[i];
|
|
280
|
+
for (; o < h; )
|
|
281
|
+
e.insertBefore(s[o++], L);
|
|
282
|
+
} else
|
|
283
|
+
e.replaceChild(s[o++], t[i++]);
|
|
284
|
+
} else
|
|
285
|
+
i++;
|
|
286
|
+
else
|
|
287
|
+
t[i++].remove();
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
}
|
|
291
|
+
function Ye(e, t, s, n = {}) {
|
|
292
|
+
let l;
|
|
293
|
+
return Ne((r) => {
|
|
294
|
+
l = r, t === document ? e() : g(t, e(), t.firstChild ? null : void 0, s);
|
|
295
|
+
}, n.owner), () => {
|
|
296
|
+
l(), t.textContent = "";
|
|
297
|
+
};
|
|
298
|
+
}
|
|
299
|
+
function G(e, t, s) {
|
|
300
|
+
let n;
|
|
301
|
+
const l = () => {
|
|
302
|
+
const i = document.createElement("template");
|
|
303
|
+
return i.innerHTML = e, i.content.firstChild;
|
|
304
|
+
}, r = () => (n || (n = l())).cloneNode(!0);
|
|
305
|
+
return r.cloneNode = r, r;
|
|
306
|
+
}
|
|
307
|
+
function F(e, t, s) {
|
|
308
|
+
s == null ? e.removeAttribute(t) : e.setAttribute(t, s);
|
|
309
|
+
}
|
|
310
|
+
function g(e, t, s, n) {
|
|
311
|
+
if (s !== void 0 && !n && (n = []), typeof t != "function")
|
|
312
|
+
return D(e, t, n, s);
|
|
313
|
+
S((l) => D(e, t(), l, s), n);
|
|
314
|
+
}
|
|
315
|
+
function D(e, t, s, n, l) {
|
|
316
|
+
for (; typeof s == "function"; )
|
|
317
|
+
s = s();
|
|
318
|
+
if (t === s)
|
|
319
|
+
return s;
|
|
320
|
+
const r = typeof t, i = n !== void 0;
|
|
321
|
+
if (e = i && s[0] && s[0].parentNode || e, r === "string" || r === "number") {
|
|
322
|
+
if (r === "number" && (t = t.toString(), t === s))
|
|
323
|
+
return s;
|
|
324
|
+
if (i) {
|
|
325
|
+
let o = s[0];
|
|
326
|
+
o && o.nodeType === 3 ? o.data !== t && (o.data = t) : o = document.createTextNode(t), s = $(e, s, n, o);
|
|
327
|
+
} else
|
|
328
|
+
s !== "" && typeof s == "string" ? s = e.firstChild.data = t : s = e.textContent = t;
|
|
329
|
+
} else if (t == null || r === "boolean")
|
|
330
|
+
s = $(e, s, n);
|
|
331
|
+
else {
|
|
332
|
+
if (r === "function")
|
|
333
|
+
return S(() => {
|
|
334
|
+
let o = t();
|
|
335
|
+
for (; typeof o == "function"; )
|
|
336
|
+
o = o();
|
|
337
|
+
s = D(e, o, s, n);
|
|
338
|
+
}), () => s;
|
|
339
|
+
if (Array.isArray(t)) {
|
|
340
|
+
const o = [], f = s && Array.isArray(s);
|
|
341
|
+
if (se(o, t, s, l))
|
|
342
|
+
return S(() => s = D(e, o, s, n, !0)), () => s;
|
|
343
|
+
if (o.length === 0) {
|
|
344
|
+
if (s = $(e, s, n), i)
|
|
345
|
+
return s;
|
|
346
|
+
} else
|
|
347
|
+
f ? s.length === 0 ? me(e, o, n) : Ge(e, s, o) : (s && $(e), me(e, o));
|
|
348
|
+
s = o;
|
|
349
|
+
} else if (t.nodeType) {
|
|
350
|
+
if (Array.isArray(s)) {
|
|
351
|
+
if (i)
|
|
352
|
+
return s = $(e, s, n, t);
|
|
353
|
+
$(e, s, null, t);
|
|
354
|
+
} else
|
|
355
|
+
s == null || s === "" || !e.firstChild ? e.appendChild(t) : e.replaceChild(t, e.firstChild);
|
|
356
|
+
s = t;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
return s;
|
|
360
|
+
}
|
|
361
|
+
function se(e, t, s, n) {
|
|
362
|
+
let l = !1;
|
|
363
|
+
for (let r = 0, i = t.length; r < i; r++) {
|
|
364
|
+
let o = t[r], f = s && s[e.length], p;
|
|
365
|
+
if (!(o == null || o === !0 || o === !1))
|
|
366
|
+
if ((p = typeof o) == "object" && o.nodeType)
|
|
367
|
+
e.push(o);
|
|
368
|
+
else if (Array.isArray(o))
|
|
369
|
+
l = se(e, o, f) || l;
|
|
370
|
+
else if (p === "function")
|
|
371
|
+
if (n) {
|
|
372
|
+
for (; typeof o == "function"; )
|
|
373
|
+
o = o();
|
|
374
|
+
l = se(e, Array.isArray(o) ? o : [o], Array.isArray(f) ? f : [f]) || l;
|
|
375
|
+
} else
|
|
376
|
+
e.push(o), l = !0;
|
|
377
|
+
else {
|
|
378
|
+
const h = String(o);
|
|
379
|
+
f && f.nodeType === 3 && f.data === h ? e.push(f) : e.push(document.createTextNode(h));
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
return l;
|
|
383
|
+
}
|
|
384
|
+
function me(e, t, s = null) {
|
|
385
|
+
for (let n = 0, l = t.length; n < l; n++)
|
|
386
|
+
e.insertBefore(t[n], s);
|
|
387
|
+
}
|
|
388
|
+
function $(e, t, s, n) {
|
|
389
|
+
if (s === void 0)
|
|
390
|
+
return e.textContent = "";
|
|
391
|
+
const l = n || document.createTextNode("");
|
|
392
|
+
if (t.length) {
|
|
393
|
+
let r = !1;
|
|
394
|
+
for (let i = t.length - 1; i >= 0; i--) {
|
|
395
|
+
const o = t[i];
|
|
396
|
+
if (l !== o) {
|
|
397
|
+
const f = o.parentNode === e;
|
|
398
|
+
!r && !i ? f ? e.replaceChild(l, o) : e.insertBefore(l, s) : f && o.remove();
|
|
399
|
+
} else
|
|
400
|
+
r = !0;
|
|
401
|
+
}
|
|
402
|
+
} else
|
|
403
|
+
e.insertBefore(l, s);
|
|
404
|
+
return [l];
|
|
405
|
+
}
|
|
406
|
+
function Je(e) {
|
|
407
|
+
return e.varName ? ` for '${e.varName}'` : "";
|
|
408
|
+
}
|
|
409
|
+
function Qe(e, t = {}) {
|
|
410
|
+
if (e == null || e === "" && !t.allowEmpty)
|
|
411
|
+
throw new Error(`Missing string value${Je(t)}`);
|
|
412
|
+
return typeof e == "string" ? e : e.toString();
|
|
413
|
+
}
|
|
414
|
+
var xe = (e) => e != null && (e = Object.getPrototypeOf(e), e === Array.prototype || e === Object.prototype);
|
|
415
|
+
function Fe(e, t, s) {
|
|
416
|
+
for (const [n, l] of Object.entries(t)) {
|
|
417
|
+
const r = `${s}.${n}`;
|
|
418
|
+
e[r] = l, xe(l) && Fe(e, l, r);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
function We(e) {
|
|
422
|
+
const t = { ...e };
|
|
423
|
+
for (const [s, n] of Object.entries(e))
|
|
424
|
+
xe(n) && Fe(t, n, s);
|
|
425
|
+
return t;
|
|
426
|
+
}
|
|
427
|
+
var Xe = (e, t) => {
|
|
428
|
+
if (t)
|
|
429
|
+
for (const [s, n] of Object.entries(t))
|
|
430
|
+
e = e.replace(new RegExp(`{{\\s*${s}\\s*}}`, "g"), n);
|
|
431
|
+
return e;
|
|
432
|
+
}, Ze = (e) => e;
|
|
433
|
+
function Ke(e, t = Ze) {
|
|
434
|
+
return (s, ...n) => {
|
|
435
|
+
s[0] === "." && (s = s.slice(1));
|
|
436
|
+
const l = e()?.[s];
|
|
437
|
+
switch (typeof l) {
|
|
438
|
+
case "function":
|
|
439
|
+
return l(...n);
|
|
440
|
+
case "string":
|
|
441
|
+
return t(l, n[0]);
|
|
442
|
+
default:
|
|
443
|
+
return l;
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
}
|
|
447
|
+
const ze = "Name", et = "Email", tt = "Subject", st = "Message", nt = "Send", lt = "The e-mail address on which we can reply to you", ot = "Your name", rt = "The subject of your message", it = "Enter your message here...", ct = "Unexpected error, the message could not be sent.", at = "Return Home", ut = "Your message has been sent. If there is a response, it will be sent to the address", ft = {
|
|
448
|
+
name: ze,
|
|
449
|
+
email: et,
|
|
450
|
+
subject: tt,
|
|
451
|
+
message: st,
|
|
452
|
+
send: nt,
|
|
453
|
+
emailPlaceholder: lt,
|
|
454
|
+
namePlaceholder: ot,
|
|
455
|
+
subjectPlaceholder: rt,
|
|
456
|
+
messagePlaceholder: it,
|
|
457
|
+
unexpectedErrorMessage: ct,
|
|
458
|
+
returnHome: at,
|
|
459
|
+
successMessage: ut
|
|
460
|
+
}, dt = "Nom", ht = "E-mail", pt = "Sujet", mt = "Message", gt = "Envoyer", bt = "L'adresse e-mail sur laquelle nous pourrons vous répondre", wt = "Votre nom", yt = "Le sujet de votre message", vt = "Saisissez votre message", Ct = "Erreur inattendue, le message n'a pas pu être envoyé.", St = "Retourner à l'accueil", Et = "Votre message a été envoyé. S'il y a une réponse, elle sera envoyée à l'adresse", xt = {
|
|
461
|
+
name: dt,
|
|
462
|
+
email: ht,
|
|
463
|
+
subject: pt,
|
|
464
|
+
message: mt,
|
|
465
|
+
send: gt,
|
|
466
|
+
emailPlaceholder: bt,
|
|
467
|
+
namePlaceholder: wt,
|
|
468
|
+
subjectPlaceholder: yt,
|
|
469
|
+
messagePlaceholder: vt,
|
|
470
|
+
unexpectedErrorMessage: Ct,
|
|
471
|
+
returnHome: St,
|
|
472
|
+
successMessage: Et
|
|
473
|
+
}, ge = { en: ft, fr: xt };
|
|
474
|
+
function Ft(e) {
|
|
475
|
+
const t = ee(() => {
|
|
476
|
+
const n = e in ge ? e : "en";
|
|
477
|
+
return We(ge[n]);
|
|
478
|
+
});
|
|
479
|
+
return { t: Ke(t, Xe) };
|
|
480
|
+
}
|
|
481
|
+
async function $t(e, t, s) {
|
|
482
|
+
s(!0);
|
|
483
|
+
try {
|
|
484
|
+
const n = await At(e);
|
|
485
|
+
return t.reset(), n;
|
|
486
|
+
} finally {
|
|
487
|
+
s(!1);
|
|
488
|
+
}
|
|
489
|
+
}
|
|
490
|
+
async function At(e) {
|
|
491
|
+
const t = await fetch("/api/plugin/contact-form", {
|
|
492
|
+
headers: {
|
|
493
|
+
"Content-Type": "application/json"
|
|
494
|
+
},
|
|
495
|
+
body: JSON.stringify(e),
|
|
496
|
+
method: "POST"
|
|
497
|
+
});
|
|
498
|
+
if (t.status !== 200) {
|
|
499
|
+
const n = await t.text();
|
|
500
|
+
throw new Error(`Unexpected error: ${n}`);
|
|
501
|
+
}
|
|
502
|
+
return await t.json();
|
|
503
|
+
}
|
|
504
|
+
var jt = /* @__PURE__ */ G("<div class=ContactForm-error>"), Mt = /* @__PURE__ */ G('<div class="ContactForm-done ContactForm-ended"><div class=ContactForm-endedMessage><p></p><p></p></div><div class=ContactForm-endedActions><a class=BigBtn>'), Pt = /* @__PURE__ */ G("<form class=ContactForm><div class=ContactForm-fieldGroup><label class=ContactFormField><span class=ContactFormField-label></span><input class=ContactFormField-input type=email name=email required></label><label class=ContactFormField><span class=ContactFormField-label></span><input class=ContactFormField-input type=text name=name required></label><label class=ContactFormField><span class=ContactFormField-label></span><input class=ContactFormField-input type=text name=subject></label><label class=ContactFormField><span class=ContactFormField-label></span><textarea class=ContactFormField-textarea rows=5 name=message required></textarea></label></div><div class=ContactForm-action><button type=submit class=ContactForm-btn>"), Rt = /* @__PURE__ */ G("<div class=ContactForm-captcha><div class=g-recaptcha data-callback=onRecaptchaSubmitted data-expired-callback=onRecaptchaExpired>");
|
|
505
|
+
function _t({
|
|
506
|
+
recaptchaKey: e,
|
|
507
|
+
language: t,
|
|
508
|
+
homeUrl: s
|
|
509
|
+
}) {
|
|
510
|
+
const [n, l] = y(""), [r, i] = y(""), [o, f] = y(), [p, h] = y(""), [w, j] = y(), [M, L] = y(!e), [le, Y] = y(), [$e, oe] = y(""), [Ae, je] = y(!1), {
|
|
511
|
+
t: m
|
|
512
|
+
} = Ft(t), Me = async (b) => {
|
|
513
|
+
try {
|
|
514
|
+
if (b.preventDefault(), !M() || !N)
|
|
515
|
+
throw new Error("Erreur de recaptcha");
|
|
516
|
+
const C = await $t({
|
|
517
|
+
language: t,
|
|
518
|
+
name: n(),
|
|
519
|
+
subject: o(),
|
|
520
|
+
message: p(),
|
|
521
|
+
email: r(),
|
|
522
|
+
gRecaptchaResponse: w()
|
|
523
|
+
}, N, je);
|
|
524
|
+
C.success ? Y(!0) : (Y(!1), oe(C.message ?? m("unexpectedErrorMessage")));
|
|
525
|
+
} catch {
|
|
526
|
+
Y(!1), oe(m("unexpectedErrorMessage"));
|
|
527
|
+
}
|
|
528
|
+
}, N = (() => {
|
|
529
|
+
var b = Pt(), C = b.firstChild, re = C.firstChild, ie = re.firstChild, J = ie.nextSibling, ce = re.nextSibling, ae = ce.firstChild, Q = ae.nextSibling, ue = ce.nextSibling, fe = ue.firstChild, W = fe.nextSibling, _e = ue.nextSibling, de = _e.firstChild, X = de.nextSibling, Z = C.nextSibling, K = Z.firstChild;
|
|
530
|
+
return b.addEventListener("submit", Me), g(ie, () => m("email")), J.addEventListener("change", (c) => {
|
|
531
|
+
i(c.currentTarget.value);
|
|
532
|
+
}), g(ae, () => m("name")), Q.addEventListener("change", (c) => l(c.currentTarget.value)), g(fe, () => m("subject")), W.addEventListener("change", (c) => f(c.currentTarget.value)), g(de, () => m("message")), X.addEventListener("change", (c) => h(c.currentTarget.value)), g(b, e && (() => {
|
|
533
|
+
var c = Rt(), x = c.firstChild;
|
|
534
|
+
return F(x, "data-sitekey", e), c;
|
|
535
|
+
})(), Z), g(b, te(pe, {
|
|
536
|
+
get when() {
|
|
537
|
+
return le() === !1;
|
|
538
|
+
},
|
|
539
|
+
get children() {
|
|
540
|
+
var c = jt();
|
|
541
|
+
return g(c, $e), c;
|
|
542
|
+
}
|
|
543
|
+
}), Z), g(K, () => m("send")), g(b, te(pe, {
|
|
544
|
+
get when() {
|
|
545
|
+
return le() === !0;
|
|
546
|
+
},
|
|
547
|
+
get children() {
|
|
548
|
+
var c = Mt(), x = c.firstChild, P = x.firstChild, O = P.nextSibling, U = x.nextSibling, R = U.firstChild;
|
|
549
|
+
return g(P, () => m("successMessage")), g(O, r), F(R, "href", s), g(R, () => m("returnHome")), c;
|
|
550
|
+
}
|
|
551
|
+
}), null), S((c) => {
|
|
552
|
+
var x = m("emailPlaceholder"), P = m("namePlaceholder"), O = m("subjectPlaceholder"), U = m("messagePlaceholder"), R = !!Ae(), he = !M();
|
|
553
|
+
return x !== c.e && F(J, "placeholder", c.e = x), P !== c.t && F(Q, "placeholder", c.t = P), O !== c.a && F(W, "placeholder", c.a = O), U !== c.o && F(X, "placeholder", c.o = U), R !== c.i && K.classList.toggle("inProgress", c.i = R), he !== c.n && (K.disabled = c.n = he), c;
|
|
554
|
+
}, {
|
|
555
|
+
e: void 0,
|
|
556
|
+
t: void 0,
|
|
557
|
+
a: void 0,
|
|
558
|
+
o: void 0,
|
|
559
|
+
i: void 0,
|
|
560
|
+
n: void 0
|
|
561
|
+
}), S(() => J.value = r()), S(() => Q.value = n()), S(() => W.value = o() ?? ""), S(() => X.value = p()), b;
|
|
562
|
+
})();
|
|
563
|
+
return Ue(() => {
|
|
564
|
+
e && (window.onRecaptchaSubmitted = Pe, window.onRecaptchaExpired = Re);
|
|
565
|
+
}), He(() => {
|
|
566
|
+
e && (window.onRecaptchaSubmitted = void 0, window.onRecaptchaExpired = void 0);
|
|
567
|
+
}), N;
|
|
568
|
+
function Pe(b) {
|
|
569
|
+
if (!b)
|
|
570
|
+
return;
|
|
571
|
+
L(!0);
|
|
572
|
+
const C = N?.elements.namedItem("g-recaptcha-response");
|
|
573
|
+
j(C.value);
|
|
574
|
+
}
|
|
575
|
+
function Re() {
|
|
576
|
+
L(!1);
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
function Tt(e, {
|
|
580
|
+
language: t
|
|
581
|
+
}) {
|
|
582
|
+
if (!t)
|
|
583
|
+
throw new Error("Missing language");
|
|
584
|
+
const s = e.dataset.recaptchaKey, n = Qe(e.dataset.homeUrl), l = document.createElement("script");
|
|
585
|
+
l.setAttribute("src", "https://www.google.com/recaptcha/api.js"), document.head.appendChild(l), Ye(() => te(_t, {
|
|
586
|
+
recaptchaKey: s,
|
|
587
|
+
language: t,
|
|
588
|
+
homeUrl: n
|
|
589
|
+
}), e);
|
|
590
|
+
}
|
|
591
|
+
document.addEventListener("DOMContentLoaded", () => {
|
|
592
|
+
const e = document.documentElement.lang, t = document.querySelector("[data-effect='contactForm']");
|
|
593
|
+
t && Tt(t, {
|
|
594
|
+
language: e
|
|
595
|
+
});
|
|
596
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Name",
|
|
3
|
+
"email": "Email",
|
|
4
|
+
"subject": "Subject",
|
|
5
|
+
"message": "Message",
|
|
6
|
+
"send": "Send",
|
|
7
|
+
"emailPlaceholder": "The e-mail address on which we can reply to you",
|
|
8
|
+
"namePlaceholder": "Your name",
|
|
9
|
+
"subjectPlaceholder": "The subject of your message",
|
|
10
|
+
"messagePlaceholder": "Enter your message here...",
|
|
11
|
+
"unexpectedErrorMessage": "Unexpected error, the message could not be sent.",
|
|
12
|
+
"returnHome": "Return Home",
|
|
13
|
+
"successMessage": "Your message has been sent. If there is a response, it will be sent to the address"
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "Nom",
|
|
3
|
+
"email": "E-mail",
|
|
4
|
+
"subject": "Sujet",
|
|
5
|
+
"message": "Message",
|
|
6
|
+
"send": "Envoyer",
|
|
7
|
+
"emailPlaceholder": "L'adresse e-mail sur laquelle nous pourrons vous répondre",
|
|
8
|
+
"namePlaceholder": "Votre nom",
|
|
9
|
+
"subjectPlaceholder": "Le sujet de votre message",
|
|
10
|
+
"messagePlaceholder": "Saisissez votre message",
|
|
11
|
+
"unexpectedErrorMessage": "Erreur inattendue, le message n'a pas pu être envoyé.",
|
|
12
|
+
"returnHome": "Retourner à l'accueil",
|
|
13
|
+
"successMessage": "Votre message a été envoyé. S'il y a une réponse, elle sera envoyée à l'adresse"
|
|
14
|
+
}
|
package/dist-backend/plugin.js
DELETED
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.simpleI18n = void 0;
|
|
4
|
-
const public_server_lib_1 = require("@paroicms/public-server-lib");
|
|
5
|
-
const node_path_1 = require("node:path");
|
|
6
|
-
const data_format_1 = require("./helpers/data-format");
|
|
7
|
-
const contact_form_mail_1 = require("./mail/contact-form-mail");
|
|
8
|
-
const { version } = require("../package.json");
|
|
9
|
-
const localesDir = (0, node_path_1.join)(__dirname, "..", "locales");
|
|
10
|
-
const assetsBaseUrl = `/assets/plugin/contact-form/${version}`;
|
|
11
|
-
const plugin = {
|
|
12
|
-
boPluginDir: (0, node_path_1.join)(__dirname, "..", "dist-backend"),
|
|
13
|
-
version,
|
|
14
|
-
siteInit(api) {
|
|
15
|
-
api.setPublicAssetsDirectory((0, node_path_1.join)(__dirname, "..", "dist-frontend"));
|
|
16
|
-
api.addHeadTag(`<link rel="stylesheet" href="${(0, public_server_lib_1.escapeHtml)(`${assetsBaseUrl}/style.css`)}">`, `<script type="module" src="${(0, public_server_lib_1.escapeHtml)(`${assetsBaseUrl}/front-plugin.mjs`)}"></script>`);
|
|
17
|
-
api.setPublicApiHandler(async (pluginSiteContext, req, res, relativePath) => {
|
|
18
|
-
let input;
|
|
19
|
-
try {
|
|
20
|
-
input = (0, data_format_1.formatSendMailInput)(req.body);
|
|
21
|
-
}
|
|
22
|
-
catch (error) {
|
|
23
|
-
res.status(400).send({ status: 400, message: error.message });
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
exports.simpleI18n = await (0, public_server_lib_1.createSimpleTranslator)({
|
|
27
|
-
l10nDir: localesDir,
|
|
28
|
-
languages: ["en", "fr"],
|
|
29
|
-
appLog: pluginSiteContext.siteLog,
|
|
30
|
-
});
|
|
31
|
-
const result = await (0, contact_form_mail_1.sendContactFormMail)(pluginSiteContext, input);
|
|
32
|
-
res.send(result);
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
};
|
|
36
|
-
module.exports = plugin;
|