@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.
@@ -1,5 +1,5 @@
1
1
  import C, { useState as $, useEffect as U, useCallback as ne } from "react";
2
- var w = { exports: {} }, b = {};
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 b;
14
+ if (q) return h;
15
15
  q = 1;
16
- var t = Symbol.for("react.transitional.element"), f = Symbol.for("react.fragment");
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) {
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 u in c)
22
- u !== "key" && (i[u] = c[u]);
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: E,
27
- key: p,
26
+ type: d,
27
+ key: m,
28
28
  ref: c !== void 0 ? c : null,
29
29
  props: i
30
30
  };
31
31
  }
32
- return b.Fragment = f, b.jsx = d, b.jsxs = d, b;
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 f(e) {
90
+ function l(e) {
91
91
  return "" + e;
92
92
  }
93
- function d(e) {
93
+ function f(e) {
94
94
  try {
95
- f(e);
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
- ), f(e);
107
+ ), l(e);
108
108
  }
109
109
  }
110
- function E(e) {
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 p(e) {
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 u(e, r) {
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 g(e, r, o, a, m, l, O, A) {
154
- return o = l.ref, e = {
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: l,
159
- _owner: m
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 n(e, r, o, a, m, l, O, A) {
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
- h(s[a]);
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 h(s);
197
+ else n(s);
198
198
  if (N.call(r, "key")) {
199
199
  s = t(e);
200
- var R = Object.keys(r).filter(function(te) {
200
+ var _ = Object.keys(r).filter(function(te) {
201
201
  return te !== "key";
202
202
  });
203
- a = 0 < R.length ? "{key: someKey, " + R.join(": ..., ") + ": ...}" : "{key: someKey}", F[s + a] || (R = 0 < R.length ? "{" + R.join(": ..., ") + ": ...}" : "{}", console.error(
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
- R,
212
+ _,
213
213
  s
214
214
  ), F[s + a] = !0);
215
215
  }
216
- if (s = null, o !== void 0 && (d(o), s = "" + o), p(r) && (d(r.key), s = "" + r.key), "key" in r) {
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 && u(
221
+ return s && p(
222
222
  o,
223
223
  typeof e == "function" ? e.displayName || e.name || "Unknown" : e
224
- ), g(
224
+ ), R(
225
225
  e,
226
226
  s,
227
- l,
228
- m,
227
+ u,
228
+ E,
229
229
  c(),
230
230
  o,
231
231
  O,
232
232
  A
233
233
  );
234
234
  }
235
- function h(e) {
235
+ function n(e) {
236
236
  typeof e == "object" && e !== null && e.$$typeof === j && e._store && (e._store.validated = 1);
237
237
  }
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() {
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
- T = {
241
+ b = {
242
242
  react_stack_bottom_frame: function(e) {
243
243
  return e();
244
244
  }
245
245
  };
246
- var I, Y = {}, M = T.react_stack_bottom_frame.bind(
247
- T,
246
+ var I, Y = {}, M = b.react_stack_bottom_frame.bind(
247
+ b,
248
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(
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
- m,
259
- l ? Error("react-stack-top-frame") : M,
260
- l ? S(E(e)) : L
258
+ E,
259
+ u ? Error("react-stack-top-frame") : M,
260
+ u ? S(d(e)) : L
261
261
  );
262
- }, _.jsxs = function(e, r, o, a, m) {
263
- var l = 1e4 > k.recentlyCreatedOwnerStacks++;
264
- return n(
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
- m,
271
- l ? Error("react-stack-top-frame") : M,
272
- l ? S(E(e)) : L
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-DfbJvtSZ.js").then((t) => t.w).then(({ EncatchAppElement: t }) => {
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 (f) {
286
- console.debug("Custom element registration:", f);
285
+ } catch (l) {
286
+ console.debug("Custom element registration:", l);
287
287
  }
288
288
  });
289
289
  const ue = ({
290
290
  formData: t,
291
- cssLink: f,
292
- scale: d = 100
291
+ cssLink: l,
292
+ scale: f = 100,
293
+ persistMode: d = "none"
293
294
  }) => {
294
- const [E, c] = $(!1), [i, p] = $(!0), u = C.useRef(null), v = C.useRef(
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 (h) {
302
- return console.error("[EncatchPreview] Error during data validation:", h), !1;
302
+ } catch (b) {
303
+ return console.error("[EncatchPreview] Error during data validation:", b), !1;
303
304
  }
304
- })() ? (c(!0), console.log("[EncatchPreview] Data is ready, rendering web component")) : console.warn(
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 (!E || !u.current)
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 = 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;
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
- }, [E, t, f, d, g]), i ? /* @__PURE__ */ ce.jsx("div", { ref: u }) : null;
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