@crystaldesign/widget-contact-form 25.3.0-beta.2 → 25.3.0-beta.20

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.
@@ -0,0 +1,440 @@
1
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
2
+ import { useState, useEffect } from 'react';
3
+ import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
4
+ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
5
+ import _regeneratorRuntime from '@babel/runtime/regenerator';
6
+ import { useDivaCore, useTranslation, Trans } from '@crystaldesign/diva-core';
7
+ import { jsxs, Fragment, jsx } from 'react/jsx-runtime';
8
+
9
+ (function() {
10
+ const env = {"STAGE":"production"};
11
+ try {
12
+ if (process) {
13
+ process.env = Object.assign({}, process.env);
14
+ Object.assign(process.env, env);
15
+ return;
16
+ }
17
+ } catch (e) {} // avoid ReferenceError: process is not defined
18
+ globalThis.process = { env:env };
19
+ })();
20
+
21
+ function styleInject(css, ref) {
22
+ if ( ref === void 0 ) ref = {};
23
+ var insertAt = ref.insertAt;
24
+
25
+ if (!css || typeof document === 'undefined') { return; }
26
+
27
+ var head = document.head || document.getElementsByTagName('head')[0];
28
+ var style = document.createElement('style');
29
+ style.type = 'text/css';
30
+
31
+ if (insertAt === 'top') {
32
+ if (head.firstChild) {
33
+ head.insertBefore(style, head.firstChild);
34
+ } else {
35
+ head.appendChild(style);
36
+ }
37
+ } else {
38
+ head.appendChild(style);
39
+ }
40
+
41
+ if (style.styleSheet) {
42
+ style.styleSheet.cssText = css;
43
+ } else {
44
+ style.appendChild(document.createTextNode(css));
45
+ }
46
+ }
47
+
48
+ var form = "form-B77D-";
49
+ var input = "input-oPXuT";
50
+ var textarea = "textarea-cMW-q";
51
+ var inputGroup = "inputGroup-gO790";
52
+ var button = "button-fOW5S";
53
+ var agbContainer = "agbContainer--O-xN";
54
+ var checkAgbText = "checkAgbText-Jl3wz";
55
+ var errorBox = "errorBox-hMx0W";
56
+ var errorMailValidation = "errorMailValidation-HNoLo";
57
+ var css_248z = ".form-B77D- {\n display: flex;\n flex-direction: column;\n padding: 10px;\n gap: 1.3rem;\n font-family: 'Roboto';\n}\n\n.input-oPXuT,\n.textarea-cMW-q {\n padding: 0.5rem;\n border: 1px solid #ccc;\n}\n\n.inputGroup-gO790 {\n display: flex;\n flex-direction: column;\n}\n.textarea-cMW-q {\n min-height: 150px;\n font-family: 'Roboto';\n resize: none;\n}\n\n.button-fOW5S {\n padding: 0.75rem;\n background-color: #6c757d;\n background-color: var(--primaryColor, #6c757d);\n color: white;\n border: none;\n cursor: pointer;\n}\n\n.button-fOW5S:disabled {\n background-color: #ccc;\n cursor: not-allowed;\n color: #666;\n}\n\n.button-fOW5S:enabled:hover {\n background-color: #5a6268;\n background-color: var(--primaryColor, #5a6268);\n}\n\n.agbContainer--O-xN {\n display: flex;\n align-items: center;\n justify-content: flex-start;\n gap: 10px;\n}\n.agbContainer--O-xN input {\n transform: scale(1.5);\n}\n\n.checkAgbText-Jl3wz {\n display: flex;\n flex-direction: column;\n font-size: 12px;\n}\n\n.errorBox-hMx0W {\n background-color: #fdecea; /* Helles Rot */\n border-left: 4px solid #e53e3e; /* Dunkelrote linke Linie */\n color: #b71c1c; /* Kräftiges Rot für den Text */\n padding: 10px;\n border-radius: 6px;\n font-weight: bold;\n}\n.errorMailValidation-HNoLo {\n color: #d9534f; /* Dezentes Rot */\n font-size: 13px; /* Kleine Schrift */\n margin-top: 4px;\n font-weight: 500; /* Etwas kräftiger für bessere Lesbarkeit */\n}\n@media (max-width: 768px) {\n .agbContainer--O-xN {\n flex-direction: row; /* Stack the elements vertically */\n gap: 5px; /* Reduce the gap between checkbox and text */\n }\n\n .checkAgbText-Jl3wz {\n font-size: 10px; /* Reduce the font size on smaller screens */\n }\n .agbContainer--O-xN input {\n transform: scale(1.2);\n }\n}\n";
58
+ styleInject(css_248z);
59
+
60
+ /**
61
+ * Sends an email via API call.
62
+ *
63
+ * @param {string} messageService - The URL of the message service.
64
+ * @param {string} jwt - The JWT token.
65
+ * @param {string} mailTo - The email address to send the email to.
66
+ * @param {any} data - The data to send in the email.
67
+ * @param {string[]} [attachments] - The attachments to send with the email.
68
+ * @returns {Promise<void>} - A promise that resolves when the email is sent.
69
+ */
70
+ function sendMail(_x, _x2, _x3, _x4, _x5, _x6, _x7, _x8) {
71
+ return _sendMail.apply(this, arguments);
72
+ }
73
+ function _sendMail() {
74
+ _sendMail = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(messageService, jwt, organizationId, mailTo, variant, data, attachments, language) {
75
+ var body, response;
76
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
77
+ while (1) switch (_context.prev = _context.next) {
78
+ case 0:
79
+ _context.prev = 0;
80
+ body = {
81
+ variant: variant !== null && variant !== void 0 ? variant : 'DEFAULT',
82
+ to: mailTo,
83
+ language: language,
84
+ organizationIds: [organizationId],
85
+ data: data,
86
+ attachments: attachments !== null && attachments !== void 0 && attachments.length ? attachments : undefined
87
+ };
88
+ _context.next = 4;
89
+ return fetch(messageService + '/mail/contact', {
90
+ method: 'POST',
91
+ headers: {
92
+ 'Content-Type': 'application/json',
93
+ Authorization: 'Bearer ' + jwt
94
+ },
95
+ body: JSON.stringify(body)
96
+ });
97
+ case 4:
98
+ response = _context.sent;
99
+ if (response.ok) {
100
+ _context.next = 7;
101
+ break;
102
+ }
103
+ throw new Error('Failed to send email');
104
+ case 7:
105
+ _context.next = 12;
106
+ break;
107
+ case 9:
108
+ _context.prev = 9;
109
+ _context.t0 = _context["catch"](0);
110
+ throw new Error('Failed to send email');
111
+ case 12:
112
+ case "end":
113
+ return _context.stop();
114
+ }
115
+ }, _callee, null, [[0, 9]]);
116
+ }));
117
+ return _sendMail.apply(this, arguments);
118
+ }
119
+
120
+ /**
121
+ * Make sure that the CSS is in the dome and that it has the current content
122
+ *
123
+ * @param url an url to a css file
124
+ */
125
+ function updateCssInDom (url) {
126
+ var element = document.getElementById('CONTACT-FORM-STYLE-URL');
127
+ if (element) {
128
+ var _element$parentNode;
129
+ (_element$parentNode = element.parentNode) === null || _element$parentNode === void 0 || _element$parentNode.removeChild(element);
130
+ }
131
+ element = document.createElement('link');
132
+ element.rel = 'stylesheet';
133
+ element.type = 'text/css';
134
+ element.id = 'CONTACT-FORM-STYLE-URL';
135
+ element.href = url;
136
+ document.head.appendChild(element);
137
+ }
138
+
139
+ function _createForOfIteratorHelper(r, e) { var t = "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (!t) { if (Array.isArray(r) || (t = _unsupportedIterableToArray(r)) || e && r && "number" == typeof r.length) { t && (r = t); var _n = 0, F = function F() {}; return { s: F, n: function n() { return _n >= r.length ? { done: !0 } : { done: !1, value: r[_n++] }; }, e: function e(r) { throw r; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var o, a = !0, u = !1; return { s: function s() { t = t.call(r); }, n: function n() { var r = t.next(); return a = r.done, r; }, e: function e(r) { u = !0, o = r; }, f: function f() { try { a || null == t["return"] || t["return"](); } finally { if (u) throw o; } } }; }
140
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
141
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
142
+ function useContactForm(settings) {
143
+ var _useState = useState(settings),
144
+ _useState2 = _slicedToArray(_useState, 2),
145
+ contactFormSettings = _useState2[0],
146
+ setContactFormSettings = _useState2[1];
147
+ var _useDivaCore = useDivaCore(),
148
+ _useDivaCore$state = _useDivaCore.state,
149
+ apiConfig = _useDivaCore$state.apiConfig,
150
+ jwt = _useDivaCore$state.jwt,
151
+ currentComponent = _useDivaCore$state.currentComponent,
152
+ organization = _useDivaCore$state.organization,
153
+ navigationConfiguration = _useDivaCore$state.navigationConfiguration,
154
+ _useDivaCore$actions = _useDivaCore.actions,
155
+ openModal = _useDivaCore$actions.openModal,
156
+ toggleLoading = _useDivaCore$actions.toggleLoading;
157
+ var _useTranslation = useTranslation(),
158
+ t = _useTranslation.t,
159
+ i18n = _useTranslation.i18n;
160
+ useEffect(function () {
161
+ if (!settings) {
162
+ var contactFormConfig = findContactForm(currentComponent);
163
+ if (contactFormConfig) {
164
+ setContactFormSettings(contactFormConfig.settings);
165
+ if (contactFormConfig.settings.cssUrl) {
166
+ updateCssInDom(contactFormConfig.settings.cssUrl);
167
+ }
168
+ }
169
+ }
170
+ }, []);
171
+ useEffect(function () {
172
+ if (settings !== null && settings !== void 0 && settings.cssUrl) {
173
+ updateCssInDom(settings === null || settings === void 0 ? void 0 : settings.cssUrl);
174
+ }
175
+ }, [settings === null || settings === void 0 ? void 0 : settings.cssUrl]);
176
+ function sendEMail(_x, _x2, _x3, _x4, _x5, _x6) {
177
+ return _sendEMail.apply(this, arguments);
178
+ }
179
+ function _sendEMail() {
180
+ _sendEMail = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(name, email, message, variant, attachments, divaNr) {
181
+ var _ref, data;
182
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
183
+ while (1) switch (_context.prev = _context.next) {
184
+ case 0:
185
+ _context.prev = 0;
186
+ if (contactFormSettings) {
187
+ _context.next = 3;
188
+ break;
189
+ }
190
+ throw new Error('No contact form settings found');
191
+ case 3:
192
+ data = {
193
+ name: name,
194
+ email: variant !== 'CLIENT' ? email : undefined,
195
+ message: message,
196
+ divaNr: divaNr
197
+ };
198
+ toggleLoading('sendMail');
199
+ _context.next = 7;
200
+ return sendMail(apiConfig.messageService, jwt, organization._id, variant === 'CLIENT' ? email : contactFormSettings.mailTo, variant, data, attachments, (_ref = i18n.language.toUpperCase()) !== null && _ref !== void 0 ? _ref : 'DE');
201
+ case 7:
202
+ toggleLoading('sendMail');
203
+ openModal({
204
+ content: t('modal.success.sendingcontactform'),
205
+ accept: true
206
+ });
207
+ _context.next = 15;
208
+ break;
209
+ case 11:
210
+ _context.prev = 11;
211
+ _context.t0 = _context["catch"](0);
212
+ toggleLoading('sendMail');
213
+ openModal({
214
+ title: t('Error'),
215
+ content: t('modal.error.sendingcontactform') + _context.t0,
216
+ accept: true
217
+ });
218
+ case 15:
219
+ case "end":
220
+ return _context.stop();
221
+ }
222
+ }, _callee, null, [[0, 11]]);
223
+ }));
224
+ return _sendEMail.apply(this, arguments);
225
+ }
226
+ function findContactForm(component) {
227
+ var _component$settings;
228
+ if ((component === null || component === void 0 ? void 0 : component.type) === 'CONTACTFORM') {
229
+ return component;
230
+ }
231
+ if (component !== null && component !== void 0 && (_component$settings = component.settings) !== null && _component$settings !== void 0 && _component$settings.subComponents) {
232
+ var _iterator = _createForOfIteratorHelper(component.settings.subComponents),
233
+ _step;
234
+ try {
235
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
236
+ var subComponent = _step.value;
237
+ var found = findContactForm(subComponent);
238
+ if (found) return found;
239
+ }
240
+ } catch (err) {
241
+ _iterator.e(err);
242
+ } finally {
243
+ _iterator.f();
244
+ }
245
+ }
246
+ return undefined;
247
+ }
248
+ var validateEmail = function validateEmail(email) {
249
+ var regex = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
250
+ return regex.test(email);
251
+ };
252
+ return {
253
+ sendEMail: sendEMail,
254
+ navigationConfiguration: navigationConfiguration,
255
+ validateEmail: validateEmail
256
+ };
257
+ }
258
+
259
+ var MainComponent = function MainComponent(_ref) {
260
+ var _navigationConfigurat, _navigationConfigurat2;
261
+ var onSubmit = _ref.onSubmit,
262
+ title = _ref.title,
263
+ submitButtonText = _ref.submitButtonText,
264
+ action = _ref.action,
265
+ basket = _ref.basket,
266
+ settings = _ref.settings;
267
+ var _useTranslation = useTranslation(),
268
+ t = _useTranslation.t;
269
+ var _useContactForm = useContactForm(settings),
270
+ sendEMail = _useContactForm.sendEMail,
271
+ navigationConfiguration = _useContactForm.navigationConfiguration,
272
+ validateEmail = _useContactForm.validateEmail;
273
+ var _useState = useState(''),
274
+ _useState2 = _slicedToArray(_useState, 2),
275
+ error = _useState2[0],
276
+ setError = _useState2[1];
277
+ var _useState3 = useState(''),
278
+ _useState4 = _slicedToArray(_useState3, 2),
279
+ name = _useState4[0],
280
+ setName = _useState4[1];
281
+ var _useState5 = useState(''),
282
+ _useState6 = _slicedToArray(_useState5, 2),
283
+ email = _useState6[0],
284
+ setEmail = _useState6[1];
285
+ var _useState7 = useState(''),
286
+ _useState8 = _slicedToArray(_useState7, 2),
287
+ message = _useState8[0],
288
+ setMessage = _useState8[1];
289
+ var _useState9 = useState(false),
290
+ _useState10 = _slicedToArray(_useState9, 2),
291
+ acceptAgbs = _useState10[0],
292
+ setAcceptAgbs = _useState10[1];
293
+ var _useState11 = useState(''),
294
+ _useState12 = _slicedToArray(_useState11, 2),
295
+ emailError = _useState12[0],
296
+ setEmailError = _useState12[1];
297
+ var inputOk = name && validateEmail(email) && message && acceptAgbs;
298
+ var handleEmailChange = function handleEmailChange(e) {
299
+ var value = e.target.value;
300
+ setEmail(value);
301
+ if (!validateEmail(value)) {
302
+ setEmailError(t('input.mail.validation.error'));
303
+ } else {
304
+ setEmailError('');
305
+ }
306
+ };
307
+ var handleSubmit = function handleSubmit() {
308
+ if (action === 'SEND_MAIL') {
309
+ if (inputOk) {
310
+ var attachments = basket !== null && basket !== void 0 && basket.PDFDocumentURL ? [basket === null || basket === void 0 ? void 0 : basket.PDFDocumentURL] : undefined;
311
+ sendEMail(name, email, message, 'DEFAULT', attachments, basket === null || basket === void 0 ? void 0 : basket.DivaNr);
312
+ sendEMail(name, email, message, 'CLIENT', attachments, undefined);
313
+ } else {
314
+ setError(t('contactform.error.fields'));
315
+ }
316
+ } else if (onSubmit) {
317
+ onSubmit({
318
+ name: name,
319
+ email: email,
320
+ message: message
321
+ });
322
+ } else alert('Action is not implemented yet');
323
+ };
324
+ return /*#__PURE__*/jsxs(Fragment, {
325
+ children: [title && /*#__PURE__*/jsx("h2", {
326
+ children: t(title, title)
327
+ }), /*#__PURE__*/jsxs("div", {
328
+ className: form,
329
+ children: [/*#__PURE__*/jsx("input", {
330
+ type: "text",
331
+ id: "name",
332
+ value: name,
333
+ onChange: function onChange(e) {
334
+ return setName(e.target.value);
335
+ },
336
+ required: true,
337
+ className: input,
338
+ placeholder: t('contactform.placeholder.name')
339
+ }), /*#__PURE__*/jsxs("div", {
340
+ className: inputGroup,
341
+ children: [/*#__PURE__*/jsx("input", {
342
+ type: "email",
343
+ id: "email",
344
+ value: email,
345
+ onChange: handleEmailChange,
346
+ required: true,
347
+ className: input,
348
+ placeholder: t('contactform.placeholder.email')
349
+ }), emailError && /*#__PURE__*/jsx("div", {
350
+ className: errorMailValidation,
351
+ children: emailError
352
+ })]
353
+ }), /*#__PURE__*/jsx("textarea", {
354
+ id: "message",
355
+ value: message,
356
+ onChange: function onChange(e) {
357
+ return setMessage(e.target.value);
358
+ },
359
+ required: true,
360
+ className: textarea,
361
+ placeholder: t('contactform.placeholder.message')
362
+ }), /*#__PURE__*/jsxs("div", {
363
+ id: "agbContainer",
364
+ className: agbContainer,
365
+ children: [/*#__PURE__*/jsx("input", {
366
+ type: "checkbox",
367
+ id: "acceptAgbs",
368
+ onChange: function onChange(e) {
369
+ return setAcceptAgbs(e.target.checked);
370
+ },
371
+ required: true
372
+ }), /*#__PURE__*/jsx("label", {
373
+ htmlFor: "acceptAgbs",
374
+ children: /*#__PURE__*/jsx("div", {
375
+ className: checkAgbText,
376
+ children: /*#__PURE__*/jsx("span", {
377
+ children: /*#__PURE__*/jsx(AcceptTerms, {
378
+ privacyUrl: (_navigationConfigurat = navigationConfiguration === null || navigationConfiguration === void 0 ? void 0 : navigationConfiguration.privacyUrl) !== null && _navigationConfigurat !== void 0 ? _navigationConfigurat : 'https://www.diva-portal.de/datenschutz',
379
+ agbUrl: (_navigationConfigurat2 = navigationConfiguration === null || navigationConfiguration === void 0 ? void 0 : navigationConfiguration.tosUrl) !== null && _navigationConfigurat2 !== void 0 ? _navigationConfigurat2 : 'https://www.diva-portal.de/agb'
380
+ })
381
+ })
382
+ })
383
+ })]
384
+ }), error && /*#__PURE__*/jsx("div", {
385
+ className: errorBox,
386
+ children: error
387
+ }), /*#__PURE__*/jsx("button", {
388
+ type: "submit",
389
+ id: "submitButton",
390
+ className: button,
391
+ onClick: handleSubmit,
392
+ disabled: !inputOk,
393
+ children: submitButtonText ? t(submitButtonText, submitButtonText) : t('contactform.submitbuttontext')
394
+ })]
395
+ })]
396
+ });
397
+ };
398
+ var AcceptTerms = function AcceptTerms(_ref2) {
399
+ var privacyUrl = _ref2.privacyUrl,
400
+ agbUrl = _ref2.agbUrl;
401
+ var _useTranslation2 = useTranslation(),
402
+ t = _useTranslation2.t;
403
+ var pUrl = /*#__PURE__*/jsx("a", {
404
+ href: privacyUrl,
405
+ target: "_blank",
406
+ children: t('auth.privacypolicy')
407
+ });
408
+ var aUrl = /*#__PURE__*/jsx("a", {
409
+ href: agbUrl,
410
+ target: "_blank",
411
+ children: t('auth.GeneralTerms')
412
+ });
413
+ return /*#__PURE__*/jsx(Trans, {
414
+ i18nKey: "contactform.acceptprivacyandagb",
415
+ components: {
416
+ privacyUrl: pUrl,
417
+ agbUrl: aUrl
418
+ }
419
+ });
420
+ };
421
+
422
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
423
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
424
+ var Main = function Main(_ref) {
425
+ var settings = _ref.settings;
426
+ _ref.parameters;
427
+ _ref.internal;
428
+ return /*#__PURE__*/jsx(MainComponent, {
429
+ settings: settings
430
+ });
431
+ };
432
+ var ContactFormComponent = function ContactFormComponent(props) {
433
+ return /*#__PURE__*/jsx(MainComponent, _objectSpread({}, props));
434
+ };
435
+ var ContactForm = {
436
+ name: 'CONTACTFORM',
437
+ renderFunction: Main
438
+ };
439
+
440
+ export { ContactFormComponent, ContactForm as default };
@@ -0,0 +1,5 @@
1
+ import React from 'react';
2
+ import { ContactFormProps } from '../types';
3
+ export declare const MainComponent: React.FC<ContactFormProps>;
4
+ export default MainComponent;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAExC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAI5C,eAAO,MAAM,aAAa,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CA+FpD,CAAC;AAgBF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,11 @@
1
+
2
+
3
+ export * from './types';
4
+ import React from 'react';
5
+ import { ComponentDefinition } from '@crystaldesign/diva-core';
6
+ import { Configuration, ContactFormProps } from './types';
7
+ export declare const ContactFormComponent: React.FC<ContactFormProps>;
8
+ declare const ContactForm: ComponentDefinition<Configuration>;
9
+ export default ContactForm;
10
+ //# sourceMappingURL=index.d.ts.map
11
+
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/index.tsx"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAkB,MAAM,0BAA0B,CAAC;AAE/E,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAM1D,eAAO,MAAM,oBAAoB,EAAE,KAAK,CAAC,EAAE,CAAC,gBAAgB,CAE3D,CAAC;AAEF,QAAA,MAAM,WAAW,EAAE,mBAAmB,CAAC,aAAa,CAGnD,CAAC;AAEF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Sends an email via API call.
3
+ *
4
+ * @param {string} messageService - The URL of the message service.
5
+ * @param {string} jwt - The JWT token.
6
+ * @param {string} mailTo - The email address to send the email to.
7
+ * @param {any} data - The data to send in the email.
8
+ * @param {string[]} [attachments] - The attachments to send with the email.
9
+ * @returns {Promise<void>} - A promise that resolves when the email is sent.
10
+ */
11
+ export declare function sendMail(messageService: string, jwt: string, organizationId: string, mailTo: string, variant: string, data: any, attachments?: string[], language?: 'DE' | 'IT' | 'FR' | 'EN'): Promise<void>;
12
+ //# sourceMappingURL=ApiHandler.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ApiHandler.d.ts","sourceRoot":"","sources":["../../../../../src/services/ApiHandler.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,wBAAsB,QAAQ,CAC5B,cAAc,EAAE,MAAM,EACtB,GAAG,EAAE,MAAM,EACX,cAAc,EAAE,MAAM,EACtB,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,GAAG,EACT,WAAW,CAAC,EAAE,MAAM,EAAE,EACtB,QAAQ,CAAC,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,iBA2BrC"}
@@ -0,0 +1,8 @@
1
+ import type { Meta, StoryObj } from '@storybook/react';
2
+ import { WithDivaMock } from '@crystaldesign/diva-core';
3
+ import { ContactFormProps } from '@crystaldesign/widget-contact-form/types';
4
+ declare const meta: Meta<WithDivaMock<ContactFormProps>>;
5
+ export default meta;
6
+ type Story = StoryObj<WithDivaMock<ContactFormProps>>;
7
+ export declare const Default: Story;
8
+ //# sourceMappingURL=contactform.stories.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contactform.stories.d.ts","sourceRoot":"","sources":["../../../../../../src/stories/default/contactform.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAqB,MAAM,0BAA0B,CAAC;AAC3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,0CAA0C,CAAC;AAG5E,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAI9C,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,YAAY,CAAC,gBAAgB,CAAC,CAAC,CAAC;AAEtD,eAAO,MAAM,OAAO,EAAE,KAUrB,CAAC"}
@@ -0,0 +1,18 @@
1
+ import { BasketData } from '@crystaldesign/diva-core';
2
+ export interface ContactFormProps {
3
+ settings?: Configuration;
4
+ title?: string;
5
+ submitButtonText?: string;
6
+ onSubmit?: (data: {
7
+ name: string;
8
+ email: string;
9
+ message: string;
10
+ }) => void;
11
+ action?: 'SEND_MAIL';
12
+ basket?: BasketData;
13
+ }
14
+ export interface Configuration {
15
+ mailTo: string;
16
+ cssUrl?: string;
17
+ }
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/types/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAEtD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,EAAE,aAAa,CAAC;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC5E,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB,MAAM,CAAC,EAAE,UAAU,CAAC;CACrB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
@@ -0,0 +1,6 @@
1
+ export default function useContactForm(settings?: any): {
2
+ sendEMail: (name: string, email: string, message: string, variant: string, attachments?: string[], divaNr?: string) => Promise<void>;
3
+ navigationConfiguration: import("packages/core/src/types").NavigationConfiguration;
4
+ validateEmail: (email: string) => boolean;
5
+ };
6
+ //# sourceMappingURL=useContactForm.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useContactForm.d.ts","sourceRoot":"","sources":["../../../../src/useContactForm.ts"],"names":[],"mappings":"AAMA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,QAAQ,CAAC,EAAE,GAAG;sBA0BpB,MAAM,SAAS,MAAM,WAAW,MAAM,WAAW,MAAM,gBAAgB,MAAM,EAAE,WAAW,MAAM;;2BA2CjG,MAAM;EAMrC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Make sure that the CSS is in the dome and that it has the current content
3
+ *
4
+ * @param url an url to a css file
5
+ */
6
+ export default function (url: string): void;
7
+ //# sourceMappingURL=updateCssInDom.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"updateCssInDom.d.ts","sourceRoot":"","sources":["../../../../../src/utils/updateCssInDom.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,CAAC,OAAO,WAAW,GAAG,EAAE,MAAM,QAWnC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@crystaldesign/widget-contact-form",
3
- "version": "25.3.0-beta.2",
3
+ "version": "25.3.0-beta.20",
4
4
  "license": "MIT",
5
5
  "scripts": {
6
6
  "storybook": "storybook dev -p 6006",
@@ -27,5 +27,5 @@
27
27
  },
28
28
  "module": "build/esm/index.js",
29
29
  "types": "./build/types/widget-contact-form/src/index.d.ts",
30
- "gitHead": "54ea9345ad72c01925ce8c09c588f113ec10e98c"
30
+ "gitHead": "262d06f563e45f2d566c2170fbafd223cb0298f2"
31
31
  }