@incodetech/web 2.0.0-alpha.5 → 2.0.0-alpha.7

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,254 @@
1
+ import { l as m, d as I, y as w, _ as p, J as H, G as f, K as _, k as V } from "./vendor-preact-CK0WeTOR.js";
2
+ var z = 0;
3
+ function s(e, n, t, o, c, r) {
4
+ n || (n = {});
5
+ var a, i, l = n;
6
+ if ("ref" in l) for (i in l = {}, n) i == "ref" ? a = n[i] : l[i] = n[i];
7
+ var d = { type: e, props: l, key: t, ref: a, __k: null, __: null, __b: 0, __e: null, __c: null, constructor: void 0, __v: --z, __i: -1, __u: 0, __source: c, __self: r };
8
+ if (typeof e == "function" && (a = e.defaultProps)) for (i in a) l[i] === void 0 && (l[i] = a[i]);
9
+ return m.vnode && m.vnode(d), d;
10
+ }
11
+ function G(e, n = {}) {
12
+ const { autoLoad: t = !0 } = n, [o] = I(e), [c, r] = I(
13
+ () => o.getState()
14
+ );
15
+ return w(() => (t && o.load && o.load(), o.subscribe(r)), [o, t]), [c, o];
16
+ }
17
+ const h = (...e) => {
18
+ const n = [];
19
+ for (const t of e)
20
+ if (t) {
21
+ if (typeof t == "string")
22
+ n.push(t);
23
+ else if (typeof t == "object")
24
+ for (const [o, c] of Object.entries(t))
25
+ c && n.push(o);
26
+ }
27
+ return n.join(" ");
28
+ }, L = ({
29
+ size: e,
30
+ className: n
31
+ }) => /* @__PURE__ */ s(
32
+ "svg",
33
+ {
34
+ width: e,
35
+ height: e,
36
+ viewBox: "0 0 31 31",
37
+ fill: "none",
38
+ xmlns: "http://www.w3.org/2000/svg",
39
+ class: h("IncodeLoadingIconPrimaryIcon", n),
40
+ children: [
41
+ /* @__PURE__ */ s("title", { children: "Spinner Inner part" }),
42
+ /* @__PURE__ */ s("path", { d: "M28.1614 15.2837C29.453 15.2837 30.5186 14.2304 30.3181 12.9545C30.1344 11.7862 29.8129 10.6411 29.3582 9.54344C28.6044 7.72356 27.4995 6.06997 26.1066 4.67709C24.7137 3.28421 23.0601 2.17932 21.2403 1.4255C20.1426 0.970841 18.9974 0.649265 17.8292 0.46563C16.5533 0.265073 15.5 1.33073 15.5 2.62232C15.5 3.91391 16.5601 4.93461 17.8187 5.22473C18.3748 5.35291 18.9206 5.52729 19.4503 5.74672C20.7028 6.26548 21.8407 7.02585 22.7993 7.98441C23.7578 8.94296 24.5182 10.0809 25.037 11.3333C25.2564 11.8631 25.4308 12.4089 25.559 12.965C25.8491 14.2236 26.8698 15.2837 28.1614 15.2837Z" })
43
+ ]
44
+ }
45
+ ), k = ({
46
+ size: e,
47
+ className: n
48
+ }) => /* @__PURE__ */ s(
49
+ "svg",
50
+ {
51
+ width: e,
52
+ height: e,
53
+ viewBox: "0 0 31 31",
54
+ fill: "none",
55
+ xmlns: "http://www.w3.org/2000/svg",
56
+ class: h("IncodeLoadingIconSecondaryIcon", n),
57
+ children: [
58
+ /* @__PURE__ */ s("title", { children: "Spinner Outer part" }),
59
+ /* @__PURE__ */ s("path", { d: "M30.5 15.2837C30.5 23.568 23.7843 30.2837 15.5 30.2837C7.21573 30.2837 0.5 23.568 0.5 15.2837C0.5 6.99942 7.21573 0.283691 15.5 0.283691C23.7843 0.283691 30.5 6.99942 30.5 15.2837ZM5.17725 15.2837C5.17725 20.9848 9.7989 25.6064 15.5 25.6064C21.2011 25.6064 25.8227 20.9848 25.8227 15.2837C25.8227 9.5826 21.2011 4.96095 15.5 4.96095C9.7989 4.96095 5.17725 9.5826 5.17725 15.2837Z" })
60
+ ]
61
+ }
62
+ ), x = ({
63
+ size: e = 30,
64
+ secondaryClass: n,
65
+ primaryClass: t
66
+ }) => /* @__PURE__ */ s("div", { class: "IncodeLoadingIcon", children: [
67
+ /* @__PURE__ */ s(k, { size: e, className: n }),
68
+ /* @__PURE__ */ s("div", { class: "IncodeLoadingIconPrimary", children: /* @__PURE__ */ s(L, { size: e, className: t }) })
69
+ ] }), E = {
70
+ primary: "IncodeButtonPrimary",
71
+ link: "IncodeButtonLink"
72
+ }, J = (e) => {
73
+ const {
74
+ isLoading: n = !1,
75
+ variant: t = "primary",
76
+ class: o,
77
+ type: c = "button",
78
+ children: r,
79
+ disabled: a,
80
+ ...i
81
+ } = e;
82
+ return /* @__PURE__ */ s(
83
+ "button",
84
+ {
85
+ ...i,
86
+ class: h(
87
+ "IncodeButton",
88
+ n ? "IncodeButtonLoading" : "",
89
+ E[t],
90
+ o
91
+ ),
92
+ disabled: a || n,
93
+ type: c,
94
+ children: n ? /* @__PURE__ */ s(x, { size: 30 }) : r
95
+ }
96
+ );
97
+ }, O = /* @__PURE__ */ new Set([
98
+ 0,
99
+ 2,
100
+ 4,
101
+ 8,
102
+ 12,
103
+ 16,
104
+ 20,
105
+ 24,
106
+ 32,
107
+ 40,
108
+ 48,
109
+ 64,
110
+ 80,
111
+ 96,
112
+ 104,
113
+ 120,
114
+ 160,
115
+ 200
116
+ ]), j = (e, n) => n === "horizontal" ? {
117
+ 0: "IncodeSpacerHorizontal0",
118
+ 2: "IncodeSpacerHorizontal2",
119
+ 4: "IncodeSpacerHorizontal4",
120
+ 8: "IncodeSpacerHorizontal8",
121
+ 12: "IncodeSpacerHorizontal12",
122
+ 16: "IncodeSpacerHorizontal16",
123
+ 20: "IncodeSpacerHorizontal20",
124
+ 24: "IncodeSpacerHorizontal24",
125
+ 32: "IncodeSpacerHorizontal32",
126
+ 40: "IncodeSpacerHorizontal40",
127
+ 48: "IncodeSpacerHorizontal48",
128
+ 64: "IncodeSpacerHorizontal64",
129
+ 80: "IncodeSpacerHorizontal80",
130
+ 96: "IncodeSpacerHorizontal96",
131
+ 104: "IncodeSpacerHorizontal104",
132
+ 120: "IncodeSpacerHorizontal120",
133
+ 160: "IncodeSpacerHorizontal160",
134
+ 200: "IncodeSpacerHorizontal200"
135
+ }[e] : {
136
+ 0: "IncodeSpacerVertical0",
137
+ 2: "IncodeSpacerVertical2",
138
+ 4: "IncodeSpacerVertical4",
139
+ 8: "IncodeSpacerVertical8",
140
+ 12: "IncodeSpacerVertical12",
141
+ 16: "IncodeSpacerVertical16",
142
+ 20: "IncodeSpacerVertical20",
143
+ 24: "IncodeSpacerVertical24",
144
+ 32: "IncodeSpacerVertical32",
145
+ 40: "IncodeSpacerVertical40",
146
+ 48: "IncodeSpacerVertical48",
147
+ 64: "IncodeSpacerVertical64",
148
+ 80: "IncodeSpacerVertical80",
149
+ 96: "IncodeSpacerVertical96",
150
+ 104: "IncodeSpacerVertical104",
151
+ 120: "IncodeSpacerVertical120",
152
+ 160: "IncodeSpacerVertical160",
153
+ 200: "IncodeSpacerVertical200"
154
+ }[e], R = ({
155
+ size: e,
156
+ className: n,
157
+ direction: t = "vertical"
158
+ }) => e === void 0 ? /* @__PURE__ */ s("div", { class: `IncodeSpacerFlex ${n || ""}` }) : (t === "horizontal" ? "w" : t === "vertical" ? "h" : void 0) ? typeof e == "number" && O.has(e) ? /* @__PURE__ */ s("div", { class: `${j(e, t)} ${n || ""}` }) : /* @__PURE__ */ s("div", { class: `${n || ""}` }) : /* @__PURE__ */ s("div", { class: `${n || ""}` });
159
+ function u() {
160
+ return u = Object.assign ? Object.assign.bind() : function(e) {
161
+ for (var n = 1; n < arguments.length; n++) {
162
+ var t = arguments[n];
163
+ for (var o in t) Object.prototype.hasOwnProperty.call(t, o) && (e[o] = t[o]);
164
+ }
165
+ return e;
166
+ }, u.apply(this, arguments);
167
+ }
168
+ function g(e, n) {
169
+ if (e == null) return {};
170
+ var t, o, c = {}, r = Object.keys(e);
171
+ for (o = 0; o < r.length; o++) n.indexOf(t = r[o]) >= 0 || (c[t] = e[t]);
172
+ return c;
173
+ }
174
+ var M = ["context", "children"], P = ["useFragment"];
175
+ function $(e, n, t, o) {
176
+ function c() {
177
+ var r, a = Reflect.construct(HTMLElement, [], c);
178
+ return a._vdomComponent = e, o && o.shadow ? (a._root = a.attachShadow({ mode: o.mode || "open", serializable: (r = o.serializable) != null && r }), o.adoptedStyleSheets && (a._root.adoptedStyleSheets = o.adoptedStyleSheets)) : a._root = a, a;
179
+ }
180
+ return (c.prototype = Object.create(HTMLElement.prototype)).constructor = c, c.prototype.connectedCallback = function() {
181
+ T.call(this, o);
182
+ }, c.prototype.attributeChangedCallback = A, c.prototype.disconnectedCallback = F, t = t || e.observedAttributes || Object.keys(e.propTypes || {}), c.observedAttributes = t, e.formAssociated && (c.formAssociated = !0), t.forEach(function(r) {
183
+ Object.defineProperty(c.prototype, r, { get: function() {
184
+ return this._vdom ? this._vdom.props[r] : this._props[r];
185
+ }, set: function(a) {
186
+ this._vdom ? this.attributeChangedCallback(r, null, a) : (this._props || (this._props = {}), this._props[r] = a);
187
+ var i = typeof a;
188
+ a != null && i !== "string" && i !== "boolean" && i !== "number" || this.setAttribute(r, a);
189
+ } });
190
+ }), customElements.define(n || e.tagName || e.displayName || e.name, c), c;
191
+ }
192
+ function B(e) {
193
+ this.getChildContext = function() {
194
+ return e.context;
195
+ };
196
+ var n = e.children, t = g(e, M);
197
+ return _(n, t);
198
+ }
199
+ function T(e) {
200
+ var n = new CustomEvent("_preact", { detail: {}, bubbles: !0, cancelable: !0 });
201
+ this.dispatchEvent(n), this._vdom = p(B, u({}, this._props, { context: n.detail.context }), y(this, this._vdomComponent, e)), (this.hasAttribute("hydrate") ? H : f)(this._vdom, this._root);
202
+ }
203
+ function b(e) {
204
+ return e.replace(/-(\w)/g, function(n, t) {
205
+ return t ? t.toUpperCase() : "";
206
+ });
207
+ }
208
+ function A(e, n, t) {
209
+ if (this._vdom) {
210
+ var o = {};
211
+ o[e] = t = t ?? void 0, o[b(e)] = t, this._vdom = _(this._vdom, o), f(this._vdom, this._root);
212
+ }
213
+ }
214
+ function F() {
215
+ f(this._vdom = null, this._root);
216
+ }
217
+ function S(e, n) {
218
+ var t = this, o = e.useFragment, c = g(e, P);
219
+ return p(o ? V : "slot", u({}, c, { ref: function(r) {
220
+ r ? (t.ref = r, t._listener || (t._listener = function(a) {
221
+ a.stopPropagation(), a.detail.context = n;
222
+ }, r.addEventListener("_preact", t._listener))) : t.ref.removeEventListener("_preact", t._listener);
223
+ } }));
224
+ }
225
+ function y(e, n, t) {
226
+ if (e.nodeType === 3) return e.data;
227
+ if (e.nodeType !== 1) return null;
228
+ var o = [], c = {}, r = 0, a = e.attributes, i = e.childNodes;
229
+ for (r = a.length; r--; ) a[r].name !== "slot" && (c[a[r].name] = a[r].value, c[b(a[r].name)] = a[r].value);
230
+ for (r = i.length; r--; ) {
231
+ var l = y(i[r], null, t), d = i[r].slot;
232
+ d ? c[d] = p(S, { name: d }, l) : o[r] = l;
233
+ }
234
+ var v = !(!t || !t.shadow), C = n ? p(S, { useFragment: !v }, o) : o;
235
+ return !v && n && (e.innerHTML = ""), p(n || e.nodeName.toLowerCase(), c, C);
236
+ }
237
+ function N(e, n, t) {
238
+ $(e, n, [...t], {
239
+ shadow: !1
240
+ });
241
+ }
242
+ const Z = ["config", "onFinish", "onError"];
243
+ function U(e, n) {
244
+ N(e, n, Z);
245
+ }
246
+ export {
247
+ J as B,
248
+ x as L,
249
+ R as S,
250
+ G as a,
251
+ h as c,
252
+ U as r,
253
+ s as u
254
+ };
package/dist/index.es.js CHANGED
@@ -1,101 +1,6 @@
1
- import { I as T, p as x, s as B } from "./flow-ZK6OBsa3.js";
2
- import { c as h, u as s, B as g } from "./button-DeMZ_34N.js";
3
- import { s as M, a as $ } from "./button-DeMZ_34N.js";
4
- import { y as f } from "./vendor-preact-CK0WeTOR.js";
5
- import { u as m } from "./title-ng7q7YDh.js";
6
- const S = (a) => new Promise((e) => setTimeout(e, a)), F = (a, e, t) => {
7
- try {
8
- const o = new URL(a);
9
- return e && o.searchParams.set("flowId", e), t && window.location.origin !== o.origin && o.searchParams.set("interviewId", t), o.toString();
10
- } catch {
11
- const n = new URLSearchParams();
12
- e && n.set("flowId", e), t && n.set("interviewId", t);
13
- const r = n.toString();
14
- return r ? `${a}?${r}` : a;
15
- }
16
- }, y = ({
17
- title: a,
18
- message: e,
19
- redirectionUrl: t,
20
- redirectDelay: o = 3e3,
21
- disableRedirect: n = !1,
22
- redirectOriginOnly: r = !1,
23
- flowId: c,
24
- interviewId: i
25
- }) => {
26
- const { t: l } = m(), d = a || l("verificationComplete.title"), p = e || l("verificationComplete.message");
27
- return f(() => {
28
- (async () => {
29
- if (n || !t) return;
30
- const u = new URLSearchParams(window.location.search);
31
- if (r && u.get("isRedirect") === "true")
32
- return;
33
- await S(o);
34
- const w = F(
35
- t,
36
- c,
37
- i
38
- );
39
- window.location.href = w;
40
- })();
41
- }, [
42
- t,
43
- o,
44
- n,
45
- r,
46
- c,
47
- i
48
- ]), /* @__PURE__ */ s("section", { class: "IncodeFlowCompleted", "aria-live": "assertive", children: [
49
- d ? /* @__PURE__ */ s("h1", { class: "IncodeFlowCompletedTitle", children: d }) : null,
50
- p ? /* @__PURE__ */ s("p", { class: "IncodeFlowCompletedSubtitle", children: p }) : null
51
- ] });
52
- };
53
- h(
54
- y,
55
- "incode-flow-completed",
56
- [
57
- "title",
58
- "message",
59
- "redirectionUrl",
60
- "action",
61
- "scoreStatus",
62
- "redirectDelay",
63
- "disableRedirect",
64
- "redirectOriginOnly",
65
- "flowId",
66
- "interviewId"
67
- ],
68
- { shadow: !1 }
69
- );
70
- const C = "https://assets.incode.com/@incodetech/web/2.0.0-alpha.5/assets/incode-logo-00b4a3b0.svg", P = ({
71
- logoUrl: a,
72
- subtitle: e,
73
- onStart: t
74
- }) => {
75
- const { t: o } = m();
76
- return /* @__PURE__ */ s("section", { class: "IncodeFlowStart", "aria-live": "polite", children: /* @__PURE__ */ s("div", { class: "IncodeFlowStartContent", children: [
77
- /* @__PURE__ */ s("div", { class: "IncodeFlowStartCenterSection", children: [
78
- /* @__PURE__ */ s("div", { class: "IncodeFlowStartLogoContainer", children: /* @__PURE__ */ s("img", { src: a || C, alt: "Logo", class: "IncodeFlowStartLogo" }) }),
79
- /* @__PURE__ */ s("h2", { class: "IncodeFlowStartSubtitle", children: e || "Demo App" })
80
- ] }),
81
- /* @__PURE__ */ s(
82
- g,
83
- {
84
- onClick: t,
85
- class: "IncodeFlowStartButton",
86
- "data-testid": "flow-start-button",
87
- children: o("home.start")
88
- }
89
- )
90
- ] }) });
91
- };
1
+ import { s as e } from "./setup-wNL83jmW.js";
2
+ import { s as t } from "./uiConfig-CQ1W9cUD.js";
92
3
  export {
93
- y as FlowCompleted,
94
- P as FlowStart,
95
- T as IncodeFlow,
96
- x as preloadIncodeFlow,
97
- M as setUiConfig,
98
- B as setup,
99
- $ as useManager,
100
- m as useTranslation
4
+ t as setUiConfig,
5
+ e as setup
101
6
  };