@adyen/kyc-components 3.56.0 → 3.56.1
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/es/{B4MFY5CR-sw69iyPQ.js → B4MFY5CR-Bvs2knxQ.js} +1 -1
- package/dist/es/{HO4MOOFI-BiF4odym.js → HO4MOOFI-D73JTsvp.js} +2 -2
- package/dist/es/{HUY7CZI3-C_Pfr-a6.js → HUY7CZI3-DV5kn2jF.js} +2 -2
- package/dist/es/Introduction-C7VMHFjG.js +227 -0
- package/dist/es/adyen-kyc-components.es.js +2 -225
- package/dist/es/{index-BFB-zOM1.js → index-DvfA_PFX.js} +3527 -135
- package/dist/style.css +240 -240
- package/package.json +1 -1
- package/dist/es/adyen-kyc-components.es2.js +0 -4
- package/dist/es/singpass-logo-ClABMCMK.js +0 -8
- package/dist/es/useCanSeeIntroduction--XLChwhg.js +0 -3453
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
var __defProp = Object.defineProperty;
|
|
2
2
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
3
3
|
var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
|
4
|
-
import {
|
|
4
|
+
import { h as createContext, i as createSignal, o as onMount, j as createEffect, e as createMemo, f as createComponent, P as Portal, k as Show, l as template, m as insert, n as createRenderEffect, p as className, q as clearDelegatedEvents, r as delegateEvents, s as useContext, v as onCleanup, w as sortFns, x as mutationSortFns, y as on, z as setAttribute, A as getSidedProp, C as use, D as createUniqueId, E as batch, F as getQueryStatusLabel, G as getMutationStatusColor, H as getQueryStatusColor, I as getQueryStatusColorByLabel, J as displayValue, K as For, M as convertRemToPixels, N as untrack, $ as $TRACK, O as useTransition, Q as spread, R as mergeProps, U as createRoot, V as serialize, W as Index, X as updateNestedDataByPath, Y as addEventListener, Z as stringify, _ as Match, a0 as Switch, a1 as deleteNestedDataByPath, a2 as splitProps, a3 as Dynamic, a4 as createComputed } from "./index-DvfA_PFX.js";
|
|
5
5
|
var isNonNullable = (i2) => i2 != null;
|
|
6
6
|
var filterNonNullable = (arr) => arr.filter(isNonNullable);
|
|
7
7
|
function chain(callbacks) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, D as Devtools, Q as QueryDevtoolsContext } from "./B4MFY5CR-
|
|
2
|
-
import {
|
|
1
|
+
import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, D as Devtools, Q as QueryDevtoolsContext } from "./B4MFY5CR-Bvs2knxQ.js";
|
|
2
|
+
import { d as getPreferredColorScheme, e as createMemo, f as createComponent } from "./index-DvfA_PFX.js";
|
|
3
3
|
var DevtoolsComponent = (props) => {
|
|
4
4
|
const [localStore, setLocalStore] = createLocalStorage({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, b as ParentPanel, C as ContentView, Q as QueryDevtoolsContext } from "./B4MFY5CR-
|
|
2
|
-
import {
|
|
1
|
+
import { c as createLocalStorage, T as THEME_PREFERENCE, P as PiPProvider, a as ThemeContext, b as ParentPanel, C as ContentView, Q as QueryDevtoolsContext } from "./B4MFY5CR-Bvs2knxQ.js";
|
|
2
|
+
import { d as getPreferredColorScheme, e as createMemo, f as createComponent } from "./index-DvfA_PFX.js";
|
|
3
3
|
var DevtoolsPanelComponent = (props) => {
|
|
4
4
|
const [localStore, setLocalStore] = createLocalStorage({
|
|
5
5
|
prefix: "TanstackQueryDevtools"
|
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "preact/jsx-runtime";
|
|
2
|
+
import { useMemo as useMemo$1, useState, useEffect } from "preact/hooks";
|
|
3
|
+
import { T as TaskTypes, L as LegalEntityType, u as useCanSeeIntroduction, a as useLegalEntityType, t as toCapitalized, g as getTranslationKeysByPrefix, b as useI18nContext, c as userEvents, S as StepProgressIndicator, B as Button } from "./index-DvfA_PFX.js";
|
|
4
|
+
import { useMemo } from "preact/compat";
|
|
5
|
+
var IntroductionScreens = ((IntroductionScreens2) => {
|
|
6
|
+
IntroductionScreens2["PROLOGUE"] = "PROLOGUE";
|
|
7
|
+
IntroductionScreens2[IntroductionScreens2["COMPANY"] = TaskTypes.COMPANY] = "COMPANY";
|
|
8
|
+
IntroductionScreens2[IntroductionScreens2["INDIVIDUAL"] = TaskTypes.INDIVIDUAL] = "INDIVIDUAL";
|
|
9
|
+
IntroductionScreens2[IntroductionScreens2["DECISION_MAKER"] = TaskTypes.DECISION_MAKER] = "DECISION_MAKER";
|
|
10
|
+
IntroductionScreens2[IntroductionScreens2["SOLE_PROPRIETOR_COMPANY"] = TaskTypes.SOLE_PROPRIETOR_COMPANY] = "SOLE_PROPRIETOR_COMPANY";
|
|
11
|
+
IntroductionScreens2[IntroductionScreens2["TRUST"] = TaskTypes.TRUST] = "TRUST";
|
|
12
|
+
IntroductionScreens2[IntroductionScreens2["TRUST_MEMBER"] = TaskTypes.TRUST_MEMBER] = "TRUST_MEMBER";
|
|
13
|
+
IntroductionScreens2["ACCOUNT"] = "ACCOUNT";
|
|
14
|
+
IntroductionScreens2["EPILOGUE"] = "EPILOGUE";
|
|
15
|
+
return IntroductionScreens2;
|
|
16
|
+
})(IntroductionScreens || {});
|
|
17
|
+
const introductionScreensByLegalEntityType = {
|
|
18
|
+
[LegalEntityType.INDIVIDUAL]: [
|
|
19
|
+
IntroductionScreens.PROLOGUE,
|
|
20
|
+
IntroductionScreens.INDIVIDUAL,
|
|
21
|
+
IntroductionScreens.ACCOUNT,
|
|
22
|
+
IntroductionScreens.EPILOGUE
|
|
23
|
+
],
|
|
24
|
+
[LegalEntityType.ORGANIZATION]: [
|
|
25
|
+
IntroductionScreens.PROLOGUE,
|
|
26
|
+
IntroductionScreens.COMPANY,
|
|
27
|
+
IntroductionScreens.DECISION_MAKER,
|
|
28
|
+
IntroductionScreens.ACCOUNT,
|
|
29
|
+
IntroductionScreens.EPILOGUE
|
|
30
|
+
],
|
|
31
|
+
[LegalEntityType.SOLE_PROPRIETORSHIP]: [
|
|
32
|
+
IntroductionScreens.PROLOGUE,
|
|
33
|
+
IntroductionScreens.INDIVIDUAL,
|
|
34
|
+
IntroductionScreens.SOLE_PROPRIETOR_COMPANY,
|
|
35
|
+
IntroductionScreens.ACCOUNT,
|
|
36
|
+
IntroductionScreens.EPILOGUE
|
|
37
|
+
],
|
|
38
|
+
[LegalEntityType.TRUST]: [
|
|
39
|
+
IntroductionScreens.PROLOGUE,
|
|
40
|
+
IntroductionScreens.COMPANY,
|
|
41
|
+
IntroductionScreens.INDIVIDUAL,
|
|
42
|
+
IntroductionScreens.DECISION_MAKER,
|
|
43
|
+
IntroductionScreens.TRUST,
|
|
44
|
+
IntroductionScreens.TRUST_MEMBER,
|
|
45
|
+
IntroductionScreens.ACCOUNT,
|
|
46
|
+
IntroductionScreens.EPILOGUE
|
|
47
|
+
]
|
|
48
|
+
};
|
|
49
|
+
const useIntroductionScreens = ({ legalEntity, tasks }) => {
|
|
50
|
+
const canSeeIntroduction = useCanSeeIntroduction({ legalEntity });
|
|
51
|
+
const legalEntityType = useLegalEntityType({ legalEntity });
|
|
52
|
+
const introductionScreens = useMemo(
|
|
53
|
+
() => legalEntityType ? introductionScreensByLegalEntityType[legalEntityType].filter((screen) => {
|
|
54
|
+
const isAccountScreen = screen === IntroductionScreens.ACCOUNT;
|
|
55
|
+
const hasAccountTask = tasks.includes(TaskTypes.PAYIN) || tasks.includes(TaskTypes.PAYOUT);
|
|
56
|
+
const isSoleProprietorScreen = screen === IntroductionScreens.SOLE_PROPRIETOR_COMPANY;
|
|
57
|
+
const isSoleProprietor = legalEntityType === LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
58
|
+
const isTrustScreen = screen === IntroductionScreens.TRUST || screen === IntroductionScreens.TRUST_MEMBER;
|
|
59
|
+
const isTrust = legalEntityType === LegalEntityType.TRUST;
|
|
60
|
+
if (isAccountScreen) return hasAccountTask;
|
|
61
|
+
if (isSoleProprietorScreen) return isSoleProprietor;
|
|
62
|
+
if (isTrustScreen) return isTrust;
|
|
63
|
+
return tasks.some((task) => screen === task);
|
|
64
|
+
}) : [],
|
|
65
|
+
[legalEntityType, tasks]
|
|
66
|
+
);
|
|
67
|
+
return canSeeIntroduction && (introductionScreens == null ? void 0 : introductionScreens.length) > 0 ? [IntroductionScreens.PROLOGUE, ...introductionScreens, IntroductionScreens.EPILOGUE] : void 0;
|
|
68
|
+
};
|
|
69
|
+
const toPascalCase = (s) => s.split(/[^A-Za-z]/).map((word) => toCapitalized(word)).join("");
|
|
70
|
+
var IntroductionScreenTranslationKeyElements = /* @__PURE__ */ ((IntroductionScreenTranslationKeyElements2) => {
|
|
71
|
+
IntroductionScreenTranslationKeyElements2["ListItem"] = "LI";
|
|
72
|
+
IntroductionScreenTranslationKeyElements2["Paragraph"] = "P";
|
|
73
|
+
return IntroductionScreenTranslationKeyElements2;
|
|
74
|
+
})(IntroductionScreenTranslationKeyElements || {});
|
|
75
|
+
const getIntroductionScreenTranslationKeys = (translations, factors) => {
|
|
76
|
+
const elForKey = (factors.elementType || "").toUpperCase();
|
|
77
|
+
const lForKey = toPascalCase(factors.legalEntityType || "");
|
|
78
|
+
const iForKey = toPascalCase(factors.introductionScreen);
|
|
79
|
+
const keyPrefix = `introductionScreen${iForKey}Description${elForKey}`;
|
|
80
|
+
const keyPrefixWithL = `introductionScreen${iForKey}${lForKey}Description${elForKey}`;
|
|
81
|
+
const keys = getTranslationKeysByPrefix(translations, keyPrefix);
|
|
82
|
+
const keysWithL = getTranslationKeysByPrefix(translations, keyPrefixWithL);
|
|
83
|
+
return (keysWithL.length ? keysWithL : keys).sort(
|
|
84
|
+
(a, b) => Number(a.charAt(a.length - 1)) - Number(b.charAt(b.length - 1))
|
|
85
|
+
);
|
|
86
|
+
};
|
|
87
|
+
const IntroductionScreen = ({
|
|
88
|
+
introductionScreen,
|
|
89
|
+
legalEntity,
|
|
90
|
+
number
|
|
91
|
+
}) => {
|
|
92
|
+
const { i18n } = useI18nContext();
|
|
93
|
+
const legalEntityType = useLegalEntityType({ legalEntity });
|
|
94
|
+
const paragraphKeys = useMemo$1(
|
|
95
|
+
() => legalEntityType ? getIntroductionScreenTranslationKeys(i18n.translations, {
|
|
96
|
+
introductionScreen,
|
|
97
|
+
legalEntityType,
|
|
98
|
+
elementType: IntroductionScreenTranslationKeyElements.Paragraph
|
|
99
|
+
}) : void 0,
|
|
100
|
+
[i18n, introductionScreen, legalEntityType]
|
|
101
|
+
);
|
|
102
|
+
const listItemKeys = useMemo$1(
|
|
103
|
+
() => legalEntityType ? getIntroductionScreenTranslationKeys(i18n.translations, {
|
|
104
|
+
introductionScreen,
|
|
105
|
+
legalEntityType,
|
|
106
|
+
elementType: IntroductionScreenTranslationKeyElements.ListItem
|
|
107
|
+
}) : void 0,
|
|
108
|
+
[i18n, introductionScreen, legalEntityType]
|
|
109
|
+
);
|
|
110
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
111
|
+
/* @__PURE__ */ jsx("div", { className: "adyen-kyc-introduction__number", children: number }),
|
|
112
|
+
/* @__PURE__ */ jsx("div", { className: "adyen-kyc-introduction__title", children: i18n.get(`introductionScreen${toPascalCase(introductionScreen)}Title`) }),
|
|
113
|
+
/* @__PURE__ */ jsxs("div", { className: "adyen-kyc-introduction__description", children: [
|
|
114
|
+
!!(paragraphKeys == null ? void 0 : paragraphKeys.length) && paragraphKeys.map((key) => /* @__PURE__ */ jsx("p", { children: i18n.get(key) }, key)),
|
|
115
|
+
!!(listItemKeys == null ? void 0 : listItemKeys.length) && /* @__PURE__ */ jsx("ul", { children: listItemKeys.map((key) => /* @__PURE__ */ jsx("li", { children: i18n.get(key) }, key)) })
|
|
116
|
+
] })
|
|
117
|
+
] });
|
|
118
|
+
};
|
|
119
|
+
const Introduction = ({
|
|
120
|
+
legalEntity,
|
|
121
|
+
onExitIntroduction,
|
|
122
|
+
tasks
|
|
123
|
+
}) => {
|
|
124
|
+
const { i18n } = useI18nContext();
|
|
125
|
+
const introductionScreens = useIntroductionScreens({ legalEntity, tasks });
|
|
126
|
+
const [activeIndex, setActiveIndex] = useState(0);
|
|
127
|
+
const pageEventDetails = {
|
|
128
|
+
actionLevel: "page",
|
|
129
|
+
page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : void 0
|
|
130
|
+
};
|
|
131
|
+
useEffect(() => {
|
|
132
|
+
userEvents.addTaskEvent("Landed on page", {
|
|
133
|
+
actionType: "start"
|
|
134
|
+
});
|
|
135
|
+
}, []);
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
if (!(introductionScreens == null ? void 0 : introductionScreens.length)) {
|
|
138
|
+
onExitIntroduction();
|
|
139
|
+
}
|
|
140
|
+
}, [introductionScreens, onExitIntroduction]);
|
|
141
|
+
const translationKeys = {
|
|
142
|
+
skip: "goToOverviewFromIntroduction",
|
|
143
|
+
back: "back",
|
|
144
|
+
next: "next",
|
|
145
|
+
start: "start"
|
|
146
|
+
};
|
|
147
|
+
return (introductionScreens == null ? void 0 : introductionScreens.length) ? /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-introduction", children: [
|
|
148
|
+
/* @__PURE__ */ jsx(
|
|
149
|
+
StepProgressIndicator,
|
|
150
|
+
{
|
|
151
|
+
activeStepIndex: activeIndex + 1,
|
|
152
|
+
stepsCount: introductionScreens.length
|
|
153
|
+
}
|
|
154
|
+
),
|
|
155
|
+
/* @__PURE__ */ jsx("div", { className: "adyen-kyc-introduction__skip", children: /* @__PURE__ */ jsx(
|
|
156
|
+
Button,
|
|
157
|
+
{
|
|
158
|
+
label: i18n.get(translationKeys.skip),
|
|
159
|
+
onClick: () => {
|
|
160
|
+
userEvents.addEvent("Clicked button", {
|
|
161
|
+
...pageEventDetails,
|
|
162
|
+
actionType: "skip",
|
|
163
|
+
label: translationKeys.skip
|
|
164
|
+
});
|
|
165
|
+
onExitIntroduction();
|
|
166
|
+
},
|
|
167
|
+
showAsLink: true
|
|
168
|
+
}
|
|
169
|
+
) }),
|
|
170
|
+
/* @__PURE__ */ jsx(
|
|
171
|
+
IntroductionScreen,
|
|
172
|
+
{
|
|
173
|
+
introductionScreen: introductionScreens[activeIndex],
|
|
174
|
+
legalEntity,
|
|
175
|
+
number: activeIndex > 0 && activeIndex < introductionScreens.length - 1 ? activeIndex : void 0
|
|
176
|
+
},
|
|
177
|
+
introductionScreens[activeIndex]
|
|
178
|
+
),
|
|
179
|
+
/* @__PURE__ */ jsxs("div", { className: "adyen-kyc-introduction__nav", children: [
|
|
180
|
+
/* @__PURE__ */ jsx(
|
|
181
|
+
Button,
|
|
182
|
+
{
|
|
183
|
+
disabled: activeIndex === 0,
|
|
184
|
+
label: i18n.get(translationKeys.back),
|
|
185
|
+
onClick: () => {
|
|
186
|
+
userEvents.addEvent("Clicked button", {
|
|
187
|
+
...pageEventDetails,
|
|
188
|
+
actionType: "back",
|
|
189
|
+
label: translationKeys.back
|
|
190
|
+
});
|
|
191
|
+
setActiveIndex((currentValue) => currentValue - 1);
|
|
192
|
+
},
|
|
193
|
+
secondary: true
|
|
194
|
+
}
|
|
195
|
+
),
|
|
196
|
+
activeIndex + 1 === introductionScreens.length ? /* @__PURE__ */ jsx(
|
|
197
|
+
Button,
|
|
198
|
+
{
|
|
199
|
+
label: i18n.get(translationKeys.start),
|
|
200
|
+
onClick: () => {
|
|
201
|
+
userEvents.addTaskEvent("Success", {
|
|
202
|
+
actionType: "submit",
|
|
203
|
+
label: translationKeys.start
|
|
204
|
+
});
|
|
205
|
+
onExitIntroduction();
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
) : /* @__PURE__ */ jsx(
|
|
209
|
+
Button,
|
|
210
|
+
{
|
|
211
|
+
label: i18n.get(translationKeys.next),
|
|
212
|
+
onClick: () => {
|
|
213
|
+
userEvents.addEvent("Clicked button", {
|
|
214
|
+
...pageEventDetails,
|
|
215
|
+
actionType: "next",
|
|
216
|
+
label: translationKeys.next
|
|
217
|
+
});
|
|
218
|
+
setActiveIndex((currentValue) => currentValue + 1);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
)
|
|
222
|
+
] })
|
|
223
|
+
] }) : null;
|
|
224
|
+
};
|
|
225
|
+
export {
|
|
226
|
+
Introduction
|
|
227
|
+
};
|
|
@@ -1,227 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { useMemo as useMemo$1, useState, useEffect } from "preact/hooks";
|
|
3
|
-
import { f as TaskTypes, L as LegalEntityType, a2 as useCanSeeIntroduction, ad as useLegalEntityType, R as toCapitalized, ae as getTranslationKeysByPrefix, u as useI18nContext, a as userEvents, M as StepProgressIndicator, B as Button } from "./useCanSeeIntroduction--XLChwhg.js";
|
|
4
|
-
import { useMemo } from "preact/compat";
|
|
5
|
-
var IntroductionScreens = ((IntroductionScreens2) => {
|
|
6
|
-
IntroductionScreens2["PROLOGUE"] = "PROLOGUE";
|
|
7
|
-
IntroductionScreens2[IntroductionScreens2["COMPANY"] = TaskTypes.COMPANY] = "COMPANY";
|
|
8
|
-
IntroductionScreens2[IntroductionScreens2["INDIVIDUAL"] = TaskTypes.INDIVIDUAL] = "INDIVIDUAL";
|
|
9
|
-
IntroductionScreens2[IntroductionScreens2["DECISION_MAKER"] = TaskTypes.DECISION_MAKER] = "DECISION_MAKER";
|
|
10
|
-
IntroductionScreens2[IntroductionScreens2["SOLE_PROPRIETOR_COMPANY"] = TaskTypes.SOLE_PROPRIETOR_COMPANY] = "SOLE_PROPRIETOR_COMPANY";
|
|
11
|
-
IntroductionScreens2[IntroductionScreens2["TRUST"] = TaskTypes.TRUST] = "TRUST";
|
|
12
|
-
IntroductionScreens2[IntroductionScreens2["TRUST_MEMBER"] = TaskTypes.TRUST_MEMBER] = "TRUST_MEMBER";
|
|
13
|
-
IntroductionScreens2["ACCOUNT"] = "ACCOUNT";
|
|
14
|
-
IntroductionScreens2["EPILOGUE"] = "EPILOGUE";
|
|
15
|
-
return IntroductionScreens2;
|
|
16
|
-
})(IntroductionScreens || {});
|
|
17
|
-
const introductionScreensByLegalEntityType = {
|
|
18
|
-
[LegalEntityType.INDIVIDUAL]: [
|
|
19
|
-
IntroductionScreens.PROLOGUE,
|
|
20
|
-
IntroductionScreens.INDIVIDUAL,
|
|
21
|
-
IntroductionScreens.ACCOUNT,
|
|
22
|
-
IntroductionScreens.EPILOGUE
|
|
23
|
-
],
|
|
24
|
-
[LegalEntityType.ORGANIZATION]: [
|
|
25
|
-
IntroductionScreens.PROLOGUE,
|
|
26
|
-
IntroductionScreens.COMPANY,
|
|
27
|
-
IntroductionScreens.DECISION_MAKER,
|
|
28
|
-
IntroductionScreens.ACCOUNT,
|
|
29
|
-
IntroductionScreens.EPILOGUE
|
|
30
|
-
],
|
|
31
|
-
[LegalEntityType.SOLE_PROPRIETORSHIP]: [
|
|
32
|
-
IntroductionScreens.PROLOGUE,
|
|
33
|
-
IntroductionScreens.INDIVIDUAL,
|
|
34
|
-
IntroductionScreens.SOLE_PROPRIETOR_COMPANY,
|
|
35
|
-
IntroductionScreens.ACCOUNT,
|
|
36
|
-
IntroductionScreens.EPILOGUE
|
|
37
|
-
],
|
|
38
|
-
[LegalEntityType.TRUST]: [
|
|
39
|
-
IntroductionScreens.PROLOGUE,
|
|
40
|
-
IntroductionScreens.COMPANY,
|
|
41
|
-
IntroductionScreens.INDIVIDUAL,
|
|
42
|
-
IntroductionScreens.DECISION_MAKER,
|
|
43
|
-
IntroductionScreens.TRUST,
|
|
44
|
-
IntroductionScreens.TRUST_MEMBER,
|
|
45
|
-
IntroductionScreens.ACCOUNT,
|
|
46
|
-
IntroductionScreens.EPILOGUE
|
|
47
|
-
]
|
|
48
|
-
};
|
|
49
|
-
const useIntroductionScreens = ({ legalEntity, tasks }) => {
|
|
50
|
-
const canSeeIntroduction = useCanSeeIntroduction({ legalEntity });
|
|
51
|
-
const legalEntityType = useLegalEntityType({ legalEntity });
|
|
52
|
-
const introductionScreens = useMemo(
|
|
53
|
-
() => legalEntityType ? introductionScreensByLegalEntityType[legalEntityType].filter((screen) => {
|
|
54
|
-
const isAccountScreen = screen === IntroductionScreens.ACCOUNT;
|
|
55
|
-
const hasAccountTask = tasks.includes(TaskTypes.PAYIN) || tasks.includes(TaskTypes.PAYOUT);
|
|
56
|
-
const isSoleProprietorScreen = screen === IntroductionScreens.SOLE_PROPRIETOR_COMPANY;
|
|
57
|
-
const isSoleProprietor = legalEntityType === LegalEntityType.SOLE_PROPRIETORSHIP;
|
|
58
|
-
const isTrustScreen = screen === IntroductionScreens.TRUST || screen === IntroductionScreens.TRUST_MEMBER;
|
|
59
|
-
const isTrust = legalEntityType === LegalEntityType.TRUST;
|
|
60
|
-
if (isAccountScreen) return hasAccountTask;
|
|
61
|
-
if (isSoleProprietorScreen) return isSoleProprietor;
|
|
62
|
-
if (isTrustScreen) return isTrust;
|
|
63
|
-
return tasks.some((task) => screen === task);
|
|
64
|
-
}) : [],
|
|
65
|
-
[legalEntityType, tasks]
|
|
66
|
-
);
|
|
67
|
-
return canSeeIntroduction && (introductionScreens == null ? void 0 : introductionScreens.length) > 0 ? [IntroductionScreens.PROLOGUE, ...introductionScreens, IntroductionScreens.EPILOGUE] : void 0;
|
|
68
|
-
};
|
|
69
|
-
const toPascalCase = (s) => s.split(/[^A-Za-z]/).map((word) => toCapitalized(word)).join("");
|
|
70
|
-
var IntroductionScreenTranslationKeyElements = /* @__PURE__ */ ((IntroductionScreenTranslationKeyElements2) => {
|
|
71
|
-
IntroductionScreenTranslationKeyElements2["ListItem"] = "LI";
|
|
72
|
-
IntroductionScreenTranslationKeyElements2["Paragraph"] = "P";
|
|
73
|
-
return IntroductionScreenTranslationKeyElements2;
|
|
74
|
-
})(IntroductionScreenTranslationKeyElements || {});
|
|
75
|
-
const getIntroductionScreenTranslationKeys = (translations, factors) => {
|
|
76
|
-
const elForKey = (factors.elementType || "").toUpperCase();
|
|
77
|
-
const lForKey = toPascalCase(factors.legalEntityType || "");
|
|
78
|
-
const iForKey = toPascalCase(factors.introductionScreen);
|
|
79
|
-
const keyPrefix = `introductionScreen${iForKey}Description${elForKey}`;
|
|
80
|
-
const keyPrefixWithL = `introductionScreen${iForKey}${lForKey}Description${elForKey}`;
|
|
81
|
-
const keys = getTranslationKeysByPrefix(translations, keyPrefix);
|
|
82
|
-
const keysWithL = getTranslationKeysByPrefix(translations, keyPrefixWithL);
|
|
83
|
-
return (keysWithL.length ? keysWithL : keys).sort(
|
|
84
|
-
(a, b) => Number(a.charAt(a.length - 1)) - Number(b.charAt(b.length - 1))
|
|
85
|
-
);
|
|
86
|
-
};
|
|
87
|
-
const IntroductionScreen = ({
|
|
88
|
-
introductionScreen,
|
|
89
|
-
legalEntity,
|
|
90
|
-
number
|
|
91
|
-
}) => {
|
|
92
|
-
const { i18n } = useI18nContext();
|
|
93
|
-
const legalEntityType = useLegalEntityType({ legalEntity });
|
|
94
|
-
const paragraphKeys = useMemo$1(
|
|
95
|
-
() => legalEntityType ? getIntroductionScreenTranslationKeys(i18n.translations, {
|
|
96
|
-
introductionScreen,
|
|
97
|
-
legalEntityType,
|
|
98
|
-
elementType: IntroductionScreenTranslationKeyElements.Paragraph
|
|
99
|
-
}) : void 0,
|
|
100
|
-
[i18n, introductionScreen, legalEntityType]
|
|
101
|
-
);
|
|
102
|
-
const listItemKeys = useMemo$1(
|
|
103
|
-
() => legalEntityType ? getIntroductionScreenTranslationKeys(i18n.translations, {
|
|
104
|
-
introductionScreen,
|
|
105
|
-
legalEntityType,
|
|
106
|
-
elementType: IntroductionScreenTranslationKeyElements.ListItem
|
|
107
|
-
}) : void 0,
|
|
108
|
-
[i18n, introductionScreen, legalEntityType]
|
|
109
|
-
);
|
|
110
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
111
|
-
/* @__PURE__ */ jsx("div", { className: "adyen-kyc-introduction__number", children: number }),
|
|
112
|
-
/* @__PURE__ */ jsx("div", { className: "adyen-kyc-introduction__title", children: i18n.get(`introductionScreen${toPascalCase(introductionScreen)}Title`) }),
|
|
113
|
-
/* @__PURE__ */ jsxs("div", { className: "adyen-kyc-introduction__description", children: [
|
|
114
|
-
!!(paragraphKeys == null ? void 0 : paragraphKeys.length) && paragraphKeys.map((key) => /* @__PURE__ */ jsx("p", { children: i18n.get(key) }, key)),
|
|
115
|
-
!!(listItemKeys == null ? void 0 : listItemKeys.length) && /* @__PURE__ */ jsx("ul", { children: listItemKeys.map((key) => /* @__PURE__ */ jsx("li", { children: i18n.get(key) }, key)) })
|
|
116
|
-
] })
|
|
117
|
-
] });
|
|
118
|
-
};
|
|
119
|
-
const Introduction = ({
|
|
120
|
-
legalEntity,
|
|
121
|
-
onExitIntroduction,
|
|
122
|
-
tasks
|
|
123
|
-
}) => {
|
|
124
|
-
const { i18n } = useI18nContext();
|
|
125
|
-
const introductionScreens = useIntroductionScreens({ legalEntity, tasks });
|
|
126
|
-
const [activeIndex, setActiveIndex] = useState(0);
|
|
127
|
-
const pageEventDetails = {
|
|
128
|
-
actionLevel: "page",
|
|
129
|
-
page: (introductionScreens == null ? void 0 : introductionScreens.length) ? introductionScreens[activeIndex] : void 0
|
|
130
|
-
};
|
|
131
|
-
useEffect(() => {
|
|
132
|
-
userEvents.addTaskEvent("Landed on page", {
|
|
133
|
-
actionType: "start"
|
|
134
|
-
});
|
|
135
|
-
}, []);
|
|
136
|
-
useEffect(() => {
|
|
137
|
-
if (!(introductionScreens == null ? void 0 : introductionScreens.length)) {
|
|
138
|
-
onExitIntroduction();
|
|
139
|
-
}
|
|
140
|
-
}, [introductionScreens, onExitIntroduction]);
|
|
141
|
-
const translationKeys = {
|
|
142
|
-
skip: "goToOverviewFromIntroduction",
|
|
143
|
-
back: "back",
|
|
144
|
-
next: "next",
|
|
145
|
-
start: "start"
|
|
146
|
-
};
|
|
147
|
-
return (introductionScreens == null ? void 0 : introductionScreens.length) ? /* @__PURE__ */ jsxs("div", { className: "adyen-kyc-introduction", children: [
|
|
148
|
-
/* @__PURE__ */ jsx(
|
|
149
|
-
StepProgressIndicator,
|
|
150
|
-
{
|
|
151
|
-
activeStepIndex: activeIndex + 1,
|
|
152
|
-
stepsCount: introductionScreens.length
|
|
153
|
-
}
|
|
154
|
-
),
|
|
155
|
-
/* @__PURE__ */ jsx("div", { className: "adyen-kyc-introduction__skip", children: /* @__PURE__ */ jsx(
|
|
156
|
-
Button,
|
|
157
|
-
{
|
|
158
|
-
label: i18n.get(translationKeys.skip),
|
|
159
|
-
onClick: () => {
|
|
160
|
-
userEvents.addEvent("Clicked button", {
|
|
161
|
-
...pageEventDetails,
|
|
162
|
-
actionType: "skip",
|
|
163
|
-
label: translationKeys.skip
|
|
164
|
-
});
|
|
165
|
-
onExitIntroduction();
|
|
166
|
-
},
|
|
167
|
-
showAsLink: true
|
|
168
|
-
}
|
|
169
|
-
) }),
|
|
170
|
-
/* @__PURE__ */ jsx(
|
|
171
|
-
IntroductionScreen,
|
|
172
|
-
{
|
|
173
|
-
introductionScreen: introductionScreens[activeIndex],
|
|
174
|
-
legalEntity,
|
|
175
|
-
number: activeIndex > 0 && activeIndex < introductionScreens.length - 1 ? activeIndex : void 0
|
|
176
|
-
},
|
|
177
|
-
introductionScreens[activeIndex]
|
|
178
|
-
),
|
|
179
|
-
/* @__PURE__ */ jsxs("div", { className: "adyen-kyc-introduction__nav", children: [
|
|
180
|
-
/* @__PURE__ */ jsx(
|
|
181
|
-
Button,
|
|
182
|
-
{
|
|
183
|
-
disabled: activeIndex === 0,
|
|
184
|
-
label: i18n.get(translationKeys.back),
|
|
185
|
-
onClick: () => {
|
|
186
|
-
userEvents.addEvent("Clicked button", {
|
|
187
|
-
...pageEventDetails,
|
|
188
|
-
actionType: "back",
|
|
189
|
-
label: translationKeys.back
|
|
190
|
-
});
|
|
191
|
-
setActiveIndex((currentValue) => currentValue - 1);
|
|
192
|
-
},
|
|
193
|
-
secondary: true
|
|
194
|
-
}
|
|
195
|
-
),
|
|
196
|
-
activeIndex + 1 === introductionScreens.length ? /* @__PURE__ */ jsx(
|
|
197
|
-
Button,
|
|
198
|
-
{
|
|
199
|
-
label: i18n.get(translationKeys.start),
|
|
200
|
-
onClick: () => {
|
|
201
|
-
userEvents.addTaskEvent("Success", {
|
|
202
|
-
actionType: "submit",
|
|
203
|
-
label: translationKeys.start
|
|
204
|
-
});
|
|
205
|
-
onExitIntroduction();
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
) : /* @__PURE__ */ jsx(
|
|
209
|
-
Button,
|
|
210
|
-
{
|
|
211
|
-
label: i18n.get(translationKeys.next),
|
|
212
|
-
onClick: () => {
|
|
213
|
-
userEvents.addEvent("Clicked button", {
|
|
214
|
-
...pageEventDetails,
|
|
215
|
-
actionType: "next",
|
|
216
|
-
label: translationKeys.next
|
|
217
|
-
});
|
|
218
|
-
setActiveIndex((currentValue) => currentValue + 1);
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
)
|
|
222
|
-
] })
|
|
223
|
-
] }) : null;
|
|
224
|
-
};
|
|
1
|
+
import { a5 } from "./index-DvfA_PFX.js";
|
|
225
2
|
export {
|
|
226
|
-
|
|
3
|
+
a5 as default
|
|
227
4
|
};
|