@encatch/ws-react 0.0.11 → 0.0.12
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 +116 -112
- package/dist/ws-react.umd.js +19 -19
- package/package.json +1 -1
package/dist/ws-react.es.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
2
|
-
var
|
|
1
|
+
import C, { useState as $, useEffect as U, useCallback as ne } from "react";
|
|
2
|
+
var w = { exports: {} }, b = {};
|
|
3
3
|
/**
|
|
4
4
|
* @license React
|
|
5
5
|
* react-jsx-runtime.production.js
|
|
@@ -9,29 +9,29 @@ var _ = { exports: {} }, v = {};
|
|
|
9
9
|
* This source code is licensed under the MIT license found in the
|
|
10
10
|
* LICENSE file in the root directory of this source tree.
|
|
11
11
|
*/
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
if (
|
|
15
|
-
|
|
12
|
+
var q;
|
|
13
|
+
function oe() {
|
|
14
|
+
if (q) return b;
|
|
15
|
+
q = 1;
|
|
16
16
|
var t = Symbol.for("react.transitional.element"), f = Symbol.for("react.fragment");
|
|
17
|
-
function d(E,
|
|
18
|
-
var
|
|
19
|
-
if (
|
|
20
|
-
|
|
21
|
-
for (var
|
|
22
|
-
|
|
23
|
-
} else
|
|
24
|
-
return
|
|
17
|
+
function d(E, c, i) {
|
|
18
|
+
var p = null;
|
|
19
|
+
if (i !== void 0 && (p = "" + i), c.key !== void 0 && (p = "" + c.key), "key" in c) {
|
|
20
|
+
i = {};
|
|
21
|
+
for (var u in c)
|
|
22
|
+
u !== "key" && (i[u] = c[u]);
|
|
23
|
+
} else i = c;
|
|
24
|
+
return c = i.ref, {
|
|
25
25
|
$$typeof: t,
|
|
26
26
|
type: E,
|
|
27
|
-
key:
|
|
28
|
-
ref:
|
|
29
|
-
props:
|
|
27
|
+
key: p,
|
|
28
|
+
ref: c !== void 0 ? c : null,
|
|
29
|
+
props: i
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
|
-
return
|
|
32
|
+
return b.Fragment = f, b.jsx = d, b.jsxs = d, b;
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var _ = {};
|
|
35
35
|
/**
|
|
36
36
|
* @license React
|
|
37
37
|
* react-jsx-runtime.development.js
|
|
@@ -41,42 +41,42 @@ var R = {};
|
|
|
41
41
|
* This source code is licensed under the MIT license found in the
|
|
42
42
|
* LICENSE file in the root directory of this source tree.
|
|
43
43
|
*/
|
|
44
|
-
var
|
|
45
|
-
function
|
|
46
|
-
return
|
|
44
|
+
var W;
|
|
45
|
+
function ae() {
|
|
46
|
+
return W || (W = 1, process.env.NODE_ENV !== "production" && (function() {
|
|
47
47
|
function t(e) {
|
|
48
48
|
if (e == null) return null;
|
|
49
49
|
if (typeof e == "function")
|
|
50
|
-
return e.$$typeof ===
|
|
50
|
+
return e.$$typeof === ee ? null : e.displayName || e.name || null;
|
|
51
51
|
if (typeof e == "string") return e;
|
|
52
52
|
switch (e) {
|
|
53
|
-
case
|
|
53
|
+
case P:
|
|
54
54
|
return "Fragment";
|
|
55
|
-
case
|
|
55
|
+
case G:
|
|
56
56
|
return "Profiler";
|
|
57
|
-
case
|
|
57
|
+
case V:
|
|
58
58
|
return "StrictMode";
|
|
59
|
-
case
|
|
59
|
+
case Z:
|
|
60
60
|
return "Suspense";
|
|
61
|
-
case H:
|
|
62
|
-
return "SuspenseList";
|
|
63
61
|
case Q:
|
|
62
|
+
return "SuspenseList";
|
|
63
|
+
case K:
|
|
64
64
|
return "Activity";
|
|
65
65
|
}
|
|
66
66
|
if (typeof e == "object")
|
|
67
67
|
switch (typeof e.tag == "number" && console.error(
|
|
68
68
|
"Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."
|
|
69
69
|
), e.$$typeof) {
|
|
70
|
-
case
|
|
70
|
+
case z:
|
|
71
71
|
return "Portal";
|
|
72
|
-
case
|
|
72
|
+
case B:
|
|
73
73
|
return (e.displayName || "Context") + ".Provider";
|
|
74
|
-
case
|
|
74
|
+
case X:
|
|
75
75
|
return (e._context.displayName || "Context") + ".Consumer";
|
|
76
|
-
case
|
|
76
|
+
case H:
|
|
77
77
|
var r = e.render;
|
|
78
78
|
return e = e.displayName, e || (e = r.displayName || r.name || "", e = e !== "" ? "ForwardRef(" + e + ")" : "ForwardRef"), e;
|
|
79
|
-
case
|
|
79
|
+
case D:
|
|
80
80
|
return r = e.displayName || null, r !== null ? r : t(e.type) || "Memo";
|
|
81
81
|
case x:
|
|
82
82
|
r = e._payload, e = e._init;
|
|
@@ -99,16 +99,16 @@ function oe() {
|
|
|
99
99
|
}
|
|
100
100
|
if (r) {
|
|
101
101
|
r = console;
|
|
102
|
-
var o = r.error,
|
|
102
|
+
var o = r.error, a = typeof Symbol == "function" && Symbol.toStringTag && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
103
103
|
return o.call(
|
|
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
|
), f(e);
|
|
108
108
|
}
|
|
109
109
|
}
|
|
110
110
|
function E(e) {
|
|
111
|
-
if (e ===
|
|
111
|
+
if (e === P) return "<>";
|
|
112
112
|
if (typeof e == "object" && e !== null && e.$$typeof === x)
|
|
113
113
|
return "<...>";
|
|
114
114
|
try {
|
|
@@ -118,23 +118,23 @@ function oe() {
|
|
|
118
118
|
return "<...>";
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
|
-
function
|
|
122
|
-
var e =
|
|
121
|
+
function c() {
|
|
122
|
+
var e = k.A;
|
|
123
123
|
return e === null ? null : e.getOwner();
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function i() {
|
|
126
126
|
return Error("react-stack-top-frame");
|
|
127
127
|
}
|
|
128
|
-
function
|
|
129
|
-
if (
|
|
128
|
+
function p(e) {
|
|
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 u(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)",
|
|
139
139
|
r
|
|
140
140
|
));
|
|
@@ -144,13 +144,13 @@ function oe() {
|
|
|
144
144
|
configurable: !0
|
|
145
145
|
});
|
|
146
146
|
}
|
|
147
|
-
function
|
|
147
|
+
function v() {
|
|
148
148
|
var e = t(this.type);
|
|
149
149
|
return Y[e] || (Y[e] = !0, console.error(
|
|
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
|
|
153
|
+
function g(e, r, o, a, m, l, O, A) {
|
|
154
154
|
return o = l.ref, e = {
|
|
155
155
|
$$typeof: j,
|
|
156
156
|
type: e,
|
|
@@ -159,7 +159,7 @@ function oe() {
|
|
|
159
159
|
_owner: m
|
|
160
160
|
}, (o !== void 0 ? o : null) !== null ? Object.defineProperty(e, "ref", {
|
|
161
161
|
enumerable: !1,
|
|
162
|
-
get:
|
|
162
|
+
get: v
|
|
163
163
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
164
164
|
configurable: !1,
|
|
165
165
|
enumerable: !1,
|
|
@@ -174,111 +174,111 @@ function oe() {
|
|
|
174
174
|
configurable: !1,
|
|
175
175
|
enumerable: !1,
|
|
176
176
|
writable: !0,
|
|
177
|
-
value:
|
|
177
|
+
value: O
|
|
178
178
|
}), Object.defineProperty(e, "_debugTask", {
|
|
179
179
|
configurable: !1,
|
|
180
180
|
enumerable: !1,
|
|
181
181
|
writable: !0,
|
|
182
|
-
value:
|
|
182
|
+
value: A
|
|
183
183
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
184
184
|
}
|
|
185
|
-
function
|
|
186
|
-
var
|
|
187
|
-
if (
|
|
188
|
-
if (
|
|
189
|
-
if (
|
|
190
|
-
for (
|
|
191
|
-
|
|
192
|
-
Object.freeze && Object.freeze(
|
|
185
|
+
function n(e, r, o, a, m, l, O, A) {
|
|
186
|
+
var s = r.children;
|
|
187
|
+
if (s !== void 0)
|
|
188
|
+
if (a)
|
|
189
|
+
if (re(s)) {
|
|
190
|
+
for (a = 0; a < s.length; a++)
|
|
191
|
+
h(s[a]);
|
|
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
|
|
198
|
-
if (
|
|
199
|
-
|
|
200
|
-
var
|
|
201
|
-
return
|
|
197
|
+
else h(s);
|
|
198
|
+
if (N.call(r, "key")) {
|
|
199
|
+
s = t(e);
|
|
200
|
+
var R = Object.keys(r).filter(function(te) {
|
|
201
|
+
return te !== "key";
|
|
202
202
|
});
|
|
203
|
-
|
|
203
|
+
a = 0 < R.length ? "{key: someKey, " + R.join(": ..., ") + ": ...}" : "{key: someKey}", F[s + a] || (R = 0 < R.length ? "{" + R.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} />
|
|
207
207
|
React keys must be passed directly to JSX without using spread:
|
|
208
208
|
let props = %s;
|
|
209
209
|
<%s key={someKey} {...props} />`,
|
|
210
|
+
a,
|
|
210
211
|
s,
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
), F[c + s] = !0);
|
|
212
|
+
R,
|
|
213
|
+
s
|
|
214
|
+
), F[s + a] = !0);
|
|
215
215
|
}
|
|
216
|
-
if (
|
|
216
|
+
if (s = null, o !== void 0 && (d(o), s = "" + o), p(r) && (d(r.key), s = "" + r.key), "key" in r) {
|
|
217
217
|
o = {};
|
|
218
|
-
for (var
|
|
219
|
-
|
|
218
|
+
for (var y in r)
|
|
219
|
+
y !== "key" && (o[y] = r[y]);
|
|
220
220
|
} else o = r;
|
|
221
|
-
return
|
|
221
|
+
return s && u(
|
|
222
222
|
o,
|
|
223
223
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
224
|
-
),
|
|
224
|
+
), g(
|
|
225
225
|
e,
|
|
226
|
-
|
|
226
|
+
s,
|
|
227
227
|
l,
|
|
228
228
|
m,
|
|
229
|
-
|
|
229
|
+
c(),
|
|
230
230
|
o,
|
|
231
|
-
|
|
232
|
-
|
|
231
|
+
O,
|
|
232
|
+
A
|
|
233
233
|
);
|
|
234
234
|
}
|
|
235
|
-
function
|
|
235
|
+
function h(e) {
|
|
236
236
|
typeof e == "object" && e !== null && e.$$typeof === j && e._store && (e._store.validated = 1);
|
|
237
237
|
}
|
|
238
|
-
var
|
|
238
|
+
var T = 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 = T.__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
|
+
T = {
|
|
242
242
|
react_stack_bottom_frame: function(e) {
|
|
243
243
|
return e();
|
|
244
244
|
}
|
|
245
245
|
};
|
|
246
|
-
var
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
)(), L =
|
|
250
|
-
|
|
251
|
-
var l = 1e4 >
|
|
252
|
-
return
|
|
246
|
+
var I, Y = {}, M = T.react_stack_bottom_frame.bind(
|
|
247
|
+
T,
|
|
248
|
+
i
|
|
249
|
+
)(), L = S(E(i)), F = {};
|
|
250
|
+
_.Fragment = P, _.jsx = function(e, r, o, a, m) {
|
|
251
|
+
var l = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
252
|
+
return n(
|
|
253
253
|
e,
|
|
254
254
|
r,
|
|
255
255
|
o,
|
|
256
256
|
!1,
|
|
257
|
-
|
|
257
|
+
a,
|
|
258
258
|
m,
|
|
259
|
-
l ? Error("react-stack-top-frame") :
|
|
260
|
-
l ?
|
|
259
|
+
l ? Error("react-stack-top-frame") : M,
|
|
260
|
+
l ? S(E(e)) : L
|
|
261
261
|
);
|
|
262
|
-
},
|
|
263
|
-
var l = 1e4 >
|
|
264
|
-
return
|
|
262
|
+
}, _.jsxs = function(e, r, o, a, m) {
|
|
263
|
+
var l = 1e4 > k.recentlyCreatedOwnerStacks++;
|
|
264
|
+
return n(
|
|
265
265
|
e,
|
|
266
266
|
r,
|
|
267
267
|
o,
|
|
268
268
|
!0,
|
|
269
|
-
|
|
269
|
+
a,
|
|
270
270
|
m,
|
|
271
|
-
l ? Error("react-stack-top-frame") :
|
|
272
|
-
l ?
|
|
271
|
+
l ? Error("react-stack-top-frame") : M,
|
|
272
|
+
l ? S(E(e)) : L
|
|
273
273
|
);
|
|
274
274
|
};
|
|
275
|
-
})()),
|
|
275
|
+
})()), _;
|
|
276
276
|
}
|
|
277
|
-
var
|
|
278
|
-
function
|
|
279
|
-
return
|
|
277
|
+
var J;
|
|
278
|
+
function se() {
|
|
279
|
+
return J || (J = 1, process.env.NODE_ENV === "production" ? w.exports = oe() : w.exports = ae()), w.exports;
|
|
280
280
|
}
|
|
281
|
-
var
|
|
281
|
+
var ce = se();
|
|
282
282
|
typeof window < "u" && import("./web-form-engine-core.umd-DfbJvtSZ.js").then((t) => t.w).then(({ EncatchAppElement: t }) => {
|
|
283
283
|
try {
|
|
284
284
|
customElements.get("encatch-app") || customElements.define("encatch-app", t);
|
|
@@ -286,36 +286,40 @@ typeof window < "u" && import("./web-form-engine-core.umd-DfbJvtSZ.js").then((t)
|
|
|
286
286
|
console.debug("Custom element registration:", f);
|
|
287
287
|
}
|
|
288
288
|
});
|
|
289
|
-
const
|
|
289
|
+
const ue = ({
|
|
290
290
|
formData: t,
|
|
291
291
|
cssLink: f,
|
|
292
292
|
scale: d = 100
|
|
293
293
|
}) => {
|
|
294
|
-
const [E,
|
|
294
|
+
const [E, c] = $(!1), [i, p] = $(!0), u = C.useRef(null), v = C.useRef(
|
|
295
295
|
null
|
|
296
296
|
);
|
|
297
|
-
|
|
297
|
+
U(() => {
|
|
298
298
|
(() => {
|
|
299
299
|
try {
|
|
300
300
|
return t ? !0 : (console.warn("[EncatchPreview] formData is not defined"), !1);
|
|
301
|
-
} catch (
|
|
302
|
-
return console.error("[EncatchPreview] Error during data validation:",
|
|
301
|
+
} catch (h) {
|
|
302
|
+
return console.error("[EncatchPreview] Error during data validation:", h), !1;
|
|
303
303
|
}
|
|
304
|
-
})() ? (
|
|
304
|
+
})() ? (c(!0), console.log("[EncatchPreview] Data is ready, rendering web component")) : console.warn(
|
|
305
305
|
"[EncatchPreview] Data validation failed, retrying in 100ms..."
|
|
306
306
|
);
|
|
307
|
-
}, [t])
|
|
308
|
-
|
|
307
|
+
}, [t]);
|
|
308
|
+
const g = ne(() => {
|
|
309
|
+
console.log("[EncatchPreview] Close triggered, unmounting component"), t.onClose && t.onClose(), p(!1);
|
|
310
|
+
}, [t.onClose]);
|
|
311
|
+
return U(() => {
|
|
312
|
+
if (!E || !u.current)
|
|
309
313
|
return;
|
|
310
314
|
console.log(
|
|
311
315
|
"[EncatchPreview] Creating web component imperatively with properties"
|
|
312
316
|
);
|
|
313
317
|
const n = document.createElement("encatch-app");
|
|
314
|
-
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 =
|
|
315
|
-
console.log("[EncatchPreview] Unmounting web component"),
|
|
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 = f, n.scale = d, console.log("[EncatchPreview] All properties set, now adding to DOM"), v.current = n, u.current.appendChild(n), () => {
|
|
319
|
+
console.log("[EncatchPreview] Unmounting web component"), u.current && v.current && u.current.removeChild(v.current), v.current = null;
|
|
316
320
|
};
|
|
317
|
-
}, [E, t, f, d]), /* @__PURE__ */
|
|
321
|
+
}, [E, t, f, d, g]), i ? /* @__PURE__ */ ce.jsx("div", { ref: u }) : null;
|
|
318
322
|
};
|
|
319
323
|
export {
|
|
320
|
-
|
|
324
|
+
ue as EncatchPreview
|
|
321
325
|
};
|