@encatch/ws-react 0.0.12 → 0.0.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/ws-react.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import C, { useState as $, useEffect as U, useCallback as ne } from "react";
|
|
2
|
-
var w = { exports: {} },
|
|
2
|
+
var w = { exports: {} }, h = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.js
|
|
@@ -11,27 +11,27 @@ var w = { exports: {} }, b = {};
|
|
|
11
11
|
*/
|
|
12
12
|
var q;
|
|
13
13
|
function oe() {
|
|
14
|
-
if (q) return
|
|
14
|
+
if (q) return h;
|
|
15
15
|
q = 1;
|
|
16
|
-
var t = Symbol.for("react.transitional.element"),
|
|
17
|
-
function d
|
|
18
|
-
var
|
|
19
|
-
if (i !== void 0 && (
|
|
16
|
+
var t = Symbol.for("react.transitional.element"), l = Symbol.for("react.fragment");
|
|
17
|
+
function f(d, c, i) {
|
|
18
|
+
var m = null;
|
|
19
|
+
if (i !== void 0 && (m = "" + i), c.key !== void 0 && (m = "" + c.key), "key" in c) {
|
|
20
20
|
i = {};
|
|
21
|
-
for (var
|
|
22
|
-
|
|
21
|
+
for (var p in c)
|
|
22
|
+
p !== "key" && (i[p] = c[p]);
|
|
23
23
|
} else i = c;
|
|
24
24
|
return c = i.ref, {
|
|
25
25
|
$$typeof: t,
|
|
26
|
-
type:
|
|
27
|
-
key:
|
|
26
|
+
type: d,
|
|
27
|
+
key: m,
|
|
28
28
|
ref: c !== void 0 ? c : null,
|
|
29
29
|
props: i
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return h.Fragment = l, h.jsx = f, h.jsxs = f, h;
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var T = {};
|
|
35
35
|
/**
|
|
36
36
|
* @license React
|
|
37
37
|
* react-jsx-runtime.development.js
|
|
@@ -87,12 +87,12 @@ function ae() {
|
|
|
87
87
|
}
|
|
88
88
|
return null;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
function l(e) {
|
|
91
91
|
return "" + e;
|
|
92
92
|
}
|
|
93
|
-
function
|
|
93
|
+
function f(e) {
|
|
94
94
|
try {
|
|
95
|
-
|
|
95
|
+
l(e);
|
|
96
96
|
var r = !1;
|
|
97
97
|
} catch {
|
|
98
98
|
r = !0;
|
|
@@ -104,10 +104,10 @@ function ae() {
|
|
|
104
104
|
r,
|
|
105
105
|
"The provided key is an unsupported type %s. This value must be coerced to a string before using it here.",
|
|
106
106
|
a
|
|
107
|
-
),
|
|
107
|
+
), l(e);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
|
-
function
|
|
110
|
+
function d(e) {
|
|
111
111
|
if (e === P) return "<>";
|
|
112
112
|
if (typeof e == "object" && e !== null && e.$$typeof === x)
|
|
113
113
|
return "<...>";
|
|
@@ -125,14 +125,14 @@ function ae() {
|
|
|
125
125
|
function i() {
|
|
126
126
|
return Error("react-stack-top-frame");
|
|
127
127
|
}
|
|
128
|
-
function
|
|
128
|
+
function m(e) {
|
|
129
129
|
if (N.call(e, "key")) {
|
|
130
130
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
131
131
|
if (r && r.isReactWarning) return !1;
|
|
132
132
|
}
|
|
133
133
|
return e.key !== void 0;
|
|
134
134
|
}
|
|
135
|
-
function
|
|
135
|
+
function p(e, r) {
|
|
136
136
|
function o() {
|
|
137
137
|
I || (I = !0, console.error(
|
|
138
138
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
@@ -150,13 +150,13 @@ function ae() {
|
|
|
150
150
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
151
151
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
152
152
|
}
|
|
153
|
-
function
|
|
154
|
-
return o =
|
|
153
|
+
function R(e, r, o, a, E, u, O, A) {
|
|
154
|
+
return o = u.ref, e = {
|
|
155
155
|
$$typeof: j,
|
|
156
156
|
type: e,
|
|
157
157
|
key: r,
|
|
158
|
-
props:
|
|
159
|
-
_owner:
|
|
158
|
+
props: u,
|
|
159
|
+
_owner: E
|
|
160
160
|
}, (o !== void 0 ? o : null) !== null ? Object.defineProperty(e, "ref", {
|
|
161
161
|
enumerable: !1,
|
|
162
162
|
get: v
|
|
@@ -182,25 +182,25 @@ function ae() {
|
|
|
182
182
|
value: A
|
|
183
183
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function g(e, r, o, a, E, u, O, A) {
|
|
186
186
|
var s = r.children;
|
|
187
187
|
if (s !== void 0)
|
|
188
188
|
if (a)
|
|
189
189
|
if (re(s)) {
|
|
190
190
|
for (a = 0; a < s.length; a++)
|
|
191
|
-
|
|
191
|
+
n(s[a]);
|
|
192
192
|
Object.freeze && Object.freeze(s);
|
|
193
193
|
} else
|
|
194
194
|
console.error(
|
|
195
195
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
196
196
|
);
|
|
197
|
-
else
|
|
197
|
+
else n(s);
|
|
198
198
|
if (N.call(r, "key")) {
|
|
199
199
|
s = t(e);
|
|
200
|
-
var
|
|
200
|
+
var _ = Object.keys(r).filter(function(te) {
|
|
201
201
|
return te !== "key";
|
|
202
202
|
});
|
|
203
|
-
a = 0 <
|
|
203
|
+
a = 0 < _.length ? "{key: someKey, " + _.join(": ..., ") + ": ...}" : "{key: someKey}", F[s + a] || (_ = 0 < _.length ? "{" + _.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
204
204
|
`A props object containing a "key" prop is being spread into JSX:
|
|
205
205
|
let props = %s;
|
|
206
206
|
<%s {...props} />
|
|
@@ -209,99 +209,100 @@ React keys must be passed directly to JSX without using spread:
|
|
|
209
209
|
<%s key={someKey} {...props} />`,
|
|
210
210
|
a,
|
|
211
211
|
s,
|
|
212
|
-
|
|
212
|
+
_,
|
|
213
213
|
s
|
|
214
214
|
), F[s + a] = !0);
|
|
215
215
|
}
|
|
216
|
-
if (s = null, o !== void 0 && (
|
|
216
|
+
if (s = null, o !== void 0 && (f(o), s = "" + o), m(r) && (f(r.key), s = "" + r.key), "key" in r) {
|
|
217
217
|
o = {};
|
|
218
218
|
for (var y in r)
|
|
219
219
|
y !== "key" && (o[y] = r[y]);
|
|
220
220
|
} else o = r;
|
|
221
|
-
return s &&
|
|
221
|
+
return s && p(
|
|
222
222
|
o,
|
|
223
223
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
224
|
-
),
|
|
224
|
+
), R(
|
|
225
225
|
e,
|
|
226
226
|
s,
|
|
227
|
-
|
|
228
|
-
|
|
227
|
+
u,
|
|
228
|
+
E,
|
|
229
229
|
c(),
|
|
230
230
|
o,
|
|
231
231
|
O,
|
|
232
232
|
A
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function n(e) {
|
|
236
236
|
typeof e == "object" && e !== null && e.$$typeof === j && e._store && (e._store.validated = 1);
|
|
237
237
|
}
|
|
238
|
-
var
|
|
238
|
+
var b = C, j = Symbol.for("react.transitional.element"), z = Symbol.for("react.portal"), P = Symbol.for("react.fragment"), V = Symbol.for("react.strict_mode"), G = Symbol.for("react.profiler"), X = Symbol.for("react.consumer"), B = Symbol.for("react.context"), H = Symbol.for("react.forward_ref"), Z = Symbol.for("react.suspense"), Q = Symbol.for("react.suspense_list"), D = Symbol.for("react.memo"), x = Symbol.for("react.lazy"), K = Symbol.for("react.activity"), ee = Symbol.for("react.client.reference"), k = b.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, N = Object.prototype.hasOwnProperty, re = Array.isArray, S = console.createTask ? console.createTask : function() {
|
|
239
239
|
return null;
|
|
240
240
|
};
|
|
241
|
-
|
|
241
|
+
b = {
|
|
242
242
|
react_stack_bottom_frame: function(e) {
|
|
243
243
|
return e();
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
-
var I, Y = {}, M =
|
|
247
|
-
|
|
246
|
+
var I, Y = {}, M = b.react_stack_bottom_frame.bind(
|
|
247
|
+
b,
|
|
248
248
|
i
|
|
249
|
-
)(), L = S(
|
|
250
|
-
|
|
251
|
-
var
|
|
252
|
-
return
|
|
249
|
+
)(), L = S(d(i)), F = {};
|
|
250
|
+
T.Fragment = P, T.jsx = function(e, r, o, a, E) {
|
|
251
|
+
var u = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
252
|
+
return g(
|
|
253
253
|
e,
|
|
254
254
|
r,
|
|
255
255
|
o,
|
|
256
256
|
!1,
|
|
257
257
|
a,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
258
|
+
E,
|
|
259
|
+
u ? Error("react-stack-top-frame") : M,
|
|
260
|
+
u ? S(d(e)) : L
|
|
261
261
|
);
|
|
262
|
-
},
|
|
263
|
-
var
|
|
264
|
-
return
|
|
262
|
+
}, T.jsxs = function(e, r, o, a, E) {
|
|
263
|
+
var u = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return g(
|
|
265
265
|
e,
|
|
266
266
|
r,
|
|
267
267
|
o,
|
|
268
268
|
!0,
|
|
269
269
|
a,
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
270
|
+
E,
|
|
271
|
+
u ? Error("react-stack-top-frame") : M,
|
|
272
|
+
u ? S(d(e)) : L
|
|
273
273
|
);
|
|
274
274
|
};
|
|
275
|
-
})()),
|
|
275
|
+
})()), T;
|
|
276
276
|
}
|
|
277
277
|
var J;
|
|
278
278
|
function se() {
|
|
279
279
|
return J || (J = 1, process.env.NODE_ENV === "production" ? w.exports = oe() : w.exports = ae()), w.exports;
|
|
280
280
|
}
|
|
281
281
|
var ce = se();
|
|
282
|
-
typeof window < "u" && import("./web-form-engine-core.umd-
|
|
282
|
+
typeof window < "u" && import("./web-form-engine-core.umd-B1xHitkx.js").then((t) => t.w).then(({ EncatchAppElement: t }) => {
|
|
283
283
|
try {
|
|
284
284
|
customElements.get("encatch-app") || customElements.define("encatch-app", t);
|
|
285
|
-
} catch (
|
|
286
|
-
console.debug("Custom element registration:",
|
|
285
|
+
} catch (l) {
|
|
286
|
+
console.debug("Custom element registration:", l);
|
|
287
287
|
}
|
|
288
288
|
});
|
|
289
289
|
const ue = ({
|
|
290
290
|
formData: t,
|
|
291
|
-
cssLink:
|
|
292
|
-
scale:
|
|
291
|
+
cssLink: l,
|
|
292
|
+
scale: f = 100,
|
|
293
|
+
persistMode: d = "none"
|
|
293
294
|
}) => {
|
|
294
|
-
const [
|
|
295
|
+
const [c, i] = $(!1), [m, p] = $(!0), v = C.useRef(null), R = C.useRef(
|
|
295
296
|
null
|
|
296
297
|
);
|
|
297
298
|
U(() => {
|
|
298
299
|
(() => {
|
|
299
300
|
try {
|
|
300
301
|
return t ? !0 : (console.warn("[EncatchPreview] formData is not defined"), !1);
|
|
301
|
-
} catch (
|
|
302
|
-
return console.error("[EncatchPreview] Error during data validation:",
|
|
302
|
+
} catch (b) {
|
|
303
|
+
return console.error("[EncatchPreview] Error during data validation:", b), !1;
|
|
303
304
|
}
|
|
304
|
-
})() ? (
|
|
305
|
+
})() ? (i(!0), console.log("[EncatchPreview] Data is ready, rendering web component")) : console.warn(
|
|
305
306
|
"[EncatchPreview] Data validation failed, retrying in 100ms..."
|
|
306
307
|
);
|
|
307
308
|
}, [t]);
|
|
@@ -309,16 +310,16 @@ const ue = ({
|
|
|
309
310
|
console.log("[EncatchPreview] Close triggered, unmounting component"), t.onClose && t.onClose(), p(!1);
|
|
310
311
|
}, [t.onClose]);
|
|
311
312
|
return U(() => {
|
|
312
|
-
if (!
|
|
313
|
+
if (!c || !v.current)
|
|
313
314
|
return;
|
|
314
315
|
console.log(
|
|
315
316
|
"[EncatchPreview] Creating web component imperatively with properties"
|
|
316
317
|
);
|
|
317
318
|
const n = document.createElement("encatch-app");
|
|
318
|
-
return n.theme = t.theme, n.currentMode = t.currentMode, n.currentLanguage = t.currentLanguage, n.questions = t.questions, n.questionLanguages = t.questionLanguages, n.otherConfigurationProperties = t.otherConfigurationProperties, n.welcomeScreenProperties = t.welcomeScreenProperties, n.endScreenProperties = t.endScreenProperties, n.translations = t.translations, n.sections = t.sections, n.themeSettings = t.themeSettings, n.onClose = g, n.onSectionChange = t.onSectionChange, n.apiKey = t.apiKey, n.hostUrl = t.hostUrl, n.feedbackConfigId = t.feedbackConfigId, n.identifier = t.identifier, n.cssLink =
|
|
319
|
-
console.log("[EncatchPreview] Unmounting web component"),
|
|
319
|
+
return n.theme = t.theme, n.currentMode = t.currentMode, n.currentLanguage = t.currentLanguage, n.questions = t.questions, n.questionLanguages = t.questionLanguages, n.otherConfigurationProperties = t.otherConfigurationProperties, n.welcomeScreenProperties = t.welcomeScreenProperties, n.endScreenProperties = t.endScreenProperties, n.translations = t.translations, n.sections = t.sections, n.themeSettings = t.themeSettings, n.onClose = g, n.onSectionChange = t.onSectionChange, n.apiKey = t.apiKey, n.hostUrl = t.hostUrl, n.feedbackConfigId = t.feedbackConfigId, n.identifier = t.identifier, n.cssLink = l, n.scale = f, n.persistMode = d, console.log("[EncatchPreview] All properties set, now adding to DOM"), R.current = n, v.current.appendChild(n), () => {
|
|
320
|
+
console.log("[EncatchPreview] Unmounting web component"), v.current && R.current && v.current.removeChild(R.current), R.current = null;
|
|
320
321
|
};
|
|
321
|
-
}, [
|
|
322
|
+
}, [c, t, l, f, g, d]), m ? /* @__PURE__ */ ce.jsx("div", { ref: v }) : null;
|
|
322
323
|
};
|
|
323
324
|
export {
|
|
324
325
|
ue as EncatchPreview
|