@eid-easy/eideasy-browser-client 2.7.0 → 2.10.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/CHANGELOG.md +46 -2
- package/README.md +1 -2
- package/dist/eideasy-browser-client.js +1 -1
- package/package.json +8 -5
- package/.editorconfig +0 -14
- package/.env.development +0 -1
- package/.env.production +0 -1
- package/.env.staging +0 -1
- package/.eslintrc.js +0 -22
- package/.github/ISSUE_TEMPLATE/---bug-report.md +0 -35
- package/.github/ISSUE_TEMPLATE/---feature-request.md +0 -20
- package/.github/workflows/ci.yml +0 -37
- package/.github/workflows/github-release.yml +0 -24
- package/babel.config.js +0 -19
- package/build-utils/loadPresets.js +0 -12
- package/build-utils/presets/webpack.analyze.js +0 -5
- package/build-utils/presets/webpack.compress.js +0 -5
- package/build-utils/webpack.development.js +0 -3
- package/build-utils/webpack.production.js +0 -3
- package/docs/.vuepress/components/AppChallenge.vue +0 -24
- package/docs/.vuepress/components/AppError.vue +0 -55
- package/docs/.vuepress/components/AppIdentification.vue +0 -177
- package/docs/.vuepress/components/AppSigning.vue +0 -171
- package/docs/.vuepress/components/GetClientConfig.vue +0 -56
- package/docs/.vuepress/components/IdentAtHandy.vue +0 -102
- package/docs/.vuepress/components/IdentEParakstsMobile.vue +0 -111
- package/docs/.vuepress/components/IdentFinnishTrustNetwork.vue +0 -102
- package/docs/.vuepress/components/IdentFrejaEid.vue +0 -86
- package/docs/.vuepress/components/IdentIdCard.vue +0 -65
- package/docs/.vuepress/components/IdentMobileId.vue +0 -100
- package/docs/.vuepress/components/IdentMojeId.vue +0 -99
- package/docs/.vuepress/components/IdentSmartId.vue +0 -93
- package/docs/.vuepress/components/IdentZealId.vue +0 -85
- package/docs/.vuepress/components/MethodCard.vue +0 -95
- package/docs/.vuepress/components/SignAtHandy.vue +0 -103
- package/docs/.vuepress/components/SignEParakstsMobile.vue +0 -103
- package/docs/.vuepress/components/SignEvrotrust.vue +0 -113
- package/docs/.vuepress/components/SignFtn.vue +0 -103
- package/docs/.vuepress/components/SignIdCard.vue +0 -70
- package/docs/.vuepress/components/SignMobileId.vue +0 -100
- package/docs/.vuepress/components/SignOtp.vue +0 -93
- package/docs/.vuepress/components/SignSmartId.vue +0 -89
- package/docs/.vuepress/components/SignZealId.vue +0 -106
- package/docs/.vuepress/components/eidEasyDemoClient.js +0 -25
- package/docs/.vuepress/components/logResult.js +0 -17
- package/docs/.vuepress/config.js +0 -34
- package/docs/.vuepress/public/assets/img/eid-easy-icon.png +0 -0
- package/docs/.vuepress/public/assets/img/eid-easy-logo.png +0 -0
- package/docs/.vuepress/styles/core.scss +0 -32
- package/docs/.vuepress/styles/index.scss +0 -124
- package/docs/.vuepress/styles/palette.scss +0 -9
- package/docs/.vuepress/styles/variables.scss +0 -1468
- package/docs/README.md +0 -12
- package/docs/contributing/README.md +0 -47
- package/docs/demos/README.md +0 -21
- package/docs/guide/README.md +0 -248
- package/jest.config.js +0 -16
- package/scripts/release.js +0 -204
- package/scripts/update-translations.js +0 -19
- package/src/MethodException.js +0 -10
- package/src/apiClient/createApiClient.js +0 -52
- package/src/apiClient/createApiClient.test.js +0 -20
- package/src/apiClient/createApiEndpoints.js +0 -71
- package/src/cloneDeep.js +0 -3
- package/src/config.js +0 -260
- package/src/coreSettingsSchema.js +0 -76
- package/src/createApiPoller.js +0 -54
- package/src/createClientCore.js +0 -84
- package/src/createGetClientConfig.js +0 -14
- package/src/createModuleCreator.js +0 -66
- package/src/createMonitoringService.js +0 -33
- package/src/createRequestError.js +0 -24
- package/src/createSettings.js +0 -26
- package/src/createStep.js +0 -49
- package/src/formatError.js +0 -19
- package/src/i18n/createI18n.js +0 -52
- package/src/i18n/createI18n.test.js +0 -63
- package/src/i18n/de.json +0 -1
- package/src/i18n/en.json +0 -1
- package/src/i18n/et.json +0 -1
- package/src/i18n/lt.json +0 -1
- package/src/i18n/lv.json +0 -1
- package/src/i18n/ru.json +0 -1
- package/src/identificationModules/createAtHandy.js +0 -37
- package/src/identificationModules/createEParakstsMobile.js +0 -37
- package/src/identificationModules/createFinnishTrustNetwork.js +0 -40
- package/src/identificationModules/createFrejaEid.js +0 -118
- package/src/identificationModules/createIdCard.js +0 -70
- package/src/identificationModules/createMobileId.js +0 -117
- package/src/identificationModules/createMojeId.js +0 -37
- package/src/identificationModules/createSmartId.js +0 -110
- package/src/identificationModules/createZealId.js +0 -107
- package/src/identificationModules/identificationModules.js +0 -21
- package/src/identificationModules/identificationModules.test.js +0 -21
- package/src/index.js +0 -9
- package/src/main.js +0 -78
- package/src/modes.js +0 -6
- package/src/poll.js +0 -36
- package/src/request.js +0 -45
- package/src/signatureModules/createAtHandySignature.js +0 -70
- package/src/signatureModules/createEParakstsMobileSignature.js +0 -70
- package/src/signatureModules/createEvrotrustSignature.js +0 -144
- package/src/signatureModules/createFtnSignature.js +0 -70
- package/src/signatureModules/createIdCardSignature.js +0 -217
- package/src/signatureModules/createMobileIdSignature.js +0 -129
- package/src/signatureModules/createOtpSignature.js +0 -68
- package/src/signatureModules/createSmartIdSignature.js +0 -124
- package/src/signatureModules/createZealIdSignature.js +0 -37
- package/src/signatureModules/signatureModules.js +0 -21
- package/src/tests/cloneDeep.test.js +0 -31
- package/src/tests/config.test.js +0 -25
- package/src/tests/createRequestError.test.js +0 -36
- package/src/tests/main.test.js +0 -7
- package/src/tests/poll.test.js +0 -64
- package/src/tests/windowOpen.test.js +0 -43
- package/src/windowOpen.js +0 -46
- package/webpack.config.js +0 -55
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/* eslint-disable max-len */
|
|
2
|
-
|
|
3
|
-
import modes from '../modes';
|
|
4
|
-
|
|
5
|
-
const createEndpoint = function createEndpoint(endpointFn, baseConfig) {
|
|
6
|
-
// eslint-disable-next-line func-names
|
|
7
|
-
return function (config) {
|
|
8
|
-
const mergedConfig = {
|
|
9
|
-
...baseConfig,
|
|
10
|
-
...config,
|
|
11
|
-
};
|
|
12
|
-
return endpointFn(mergedConfig);
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
const provideEndpointsWithBaseConfig = function provideEndpointsWithBaseConfig(endpoints, baseConfig) {
|
|
17
|
-
const newEndpoints = {};
|
|
18
|
-
Object.keys(endpoints).forEach((key) => {
|
|
19
|
-
newEndpoints[key] = createEndpoint(endpoints[key], baseConfig);
|
|
20
|
-
});
|
|
21
|
-
return newEndpoints;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
const createApiEndpoints = function createApiEndpoints(settings = {}, overrides = {}) {
|
|
25
|
-
const apiEndpoints = {
|
|
26
|
-
base: ({ baseUrl }) => baseUrl,
|
|
27
|
-
readCard: ({
|
|
28
|
-
countryCode = settings.countryCode.toLowerCase(),
|
|
29
|
-
clientId,
|
|
30
|
-
}) => `https://${countryCode}.eideasy.com/api/identity/${clientId}/read-card`,
|
|
31
|
-
eParakstsMobile: ({ baseUrl, clientId, redirectUri }) => `${baseUrl}/oauth/start/lv-eparaksts-mobile-login?client_id=${clientId}&redirect_uri=${redirectUri}&response_type=code`,
|
|
32
|
-
zealIdIframeUrl: ({ baseUrl, clientId }) => `${baseUrl}/api/identity/${clientId}/zealid/get_iframe_url`,
|
|
33
|
-
mojeId: ({ baseUrl, clientId, redirectUri }) => `${baseUrl}/oauth/start/mojeid?client_id=${clientId}&redirect_uri=${redirectUri}&response_type=code`,
|
|
34
|
-
finnishTrustNetwork: ({
|
|
35
|
-
baseUrl, clientId, redirectUri, language,
|
|
36
|
-
}) => `${baseUrl}/oauth/start/finnish-ftn-login?client_id=${clientId}&redirect_uri=${redirectUri}&response_type=code&lang=${language}`,
|
|
37
|
-
atHandy: ({ baseUrl, clientId, redirectUri }) => `${baseUrl}/oauth/authorize?client_id=${clientId}&redirect_uri=${redirectUri}&response_type=code&method=at-handy-signatur-login`,
|
|
38
|
-
idCardIframe: ({ baseUrl, clientId, actionType }) => `${baseUrl}/signatures/integration/${clientId}/${actionType}`,
|
|
39
|
-
startSigning: ({ baseUrl }) => `${baseUrl}/api/signatures/start-signing`,
|
|
40
|
-
completeSignatureIdCard: ({ baseUrl }) => `${baseUrl}/api/signatures/id-card/complete`,
|
|
41
|
-
completeSignatureMobileId: ({ baseUrl }) => `${baseUrl}/api/signatures/sk-mobile-id/complete`,
|
|
42
|
-
completeSignatureSmartId: ({ baseUrl }) => `${baseUrl}/api/signatures/sk-smart-id/complete`,
|
|
43
|
-
completeSignatureEvrotrust: ({ baseUrl }) => `${baseUrl}/api/signatures/evrotrust-signature/complete`,
|
|
44
|
-
completeOtp: ({ baseUrl }) => `${baseUrl}/api/signatures/non-qualified/complete`,
|
|
45
|
-
eideasyMonitoring: ({ baseUrl }) => `${baseUrl}/confirm_progress`,
|
|
46
|
-
startZealIdSignature: ({ baseUrl, clientId, docId }) => `${baseUrl}/zealid/signature/start?client_id=${clientId}&doc_id=${docId}`,
|
|
47
|
-
...overrides,
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
const apiEndpointsByModes = {
|
|
51
|
-
[modes.production]: {
|
|
52
|
-
...provideEndpointsWithBaseConfig(apiEndpoints, {
|
|
53
|
-
baseUrl: overrides.base ? overrides.base() : 'https://id.eideasy.com',
|
|
54
|
-
}),
|
|
55
|
-
},
|
|
56
|
-
[modes.sandbox]: {
|
|
57
|
-
...provideEndpointsWithBaseConfig(apiEndpoints, {
|
|
58
|
-
baseUrl: overrides.base ? overrides.base() : 'https://test.eideasy.com',
|
|
59
|
-
}),
|
|
60
|
-
},
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
get inCurrentMode() {
|
|
65
|
-
const mode = settings.sandbox ? modes.sandbox : modes.production;
|
|
66
|
-
return apiEndpointsByModes[mode];
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
export default createApiEndpoints;
|
package/src/cloneDeep.js
DELETED
package/src/config.js
DELETED
|
@@ -1,260 +0,0 @@
|
|
|
1
|
-
const methodTypes = {
|
|
2
|
-
IDENTIFICATION: 'identification',
|
|
3
|
-
SIGNATURE: 'signature',
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
const methodActionTypes = {
|
|
7
|
-
BE_ID_LOGIN: 'be-id-login',
|
|
8
|
-
EE_ID_LOGIN: 'ee-id-login',
|
|
9
|
-
FI_ID_LOGIN: 'fi-id-login',
|
|
10
|
-
PT_ID_LOGIN: 'pt-id-login',
|
|
11
|
-
LV_ID_LOGIN: 'lv-id-login',
|
|
12
|
-
LT_ID_LOGIN: 'lt-id-login',
|
|
13
|
-
RS_ID_LOGIN: 'rs-id-login',
|
|
14
|
-
EE_MOBILE_ID: 'mid-login',
|
|
15
|
-
LV_EPARAKSTS_MOBILE_LOGIN: 'lv-eparaksts-mobile-login',
|
|
16
|
-
LT_MOBILE_ID: 'lt-mobile-id',
|
|
17
|
-
SMART_ID: 'smartid',
|
|
18
|
-
FREJA_EID_LOGIN: 'freja-eid-login',
|
|
19
|
-
ZEALID_LOGIN: 'zealid-login',
|
|
20
|
-
CZ_MOJEID: 'mojeid',
|
|
21
|
-
AT_HANDY_SIGNATUR_LOGIN: 'at-handy-signatur-login',
|
|
22
|
-
FI_FTN_LOGIN: 'finnish-ftn-login',
|
|
23
|
-
|
|
24
|
-
ZEAL_ID_SIGNATURE: 'zealid-signature',
|
|
25
|
-
EE_IDCARD_SIGNATURE: 'id-signature',
|
|
26
|
-
EE_MOBILEID_SIGNATURE: 'mid-signature',
|
|
27
|
-
LT_MOBILEID_SIGNATURE: 'lt-mid-signature',
|
|
28
|
-
SMARTID_SIGNATURE: 'smart-id-signature',
|
|
29
|
-
BE_IDCARD_SIGNATURE: 'be-id-signature',
|
|
30
|
-
LV_IDCARD_SIGNATURE: 'lv-id-signature',
|
|
31
|
-
LT_IDCARD_SIGNATURE: 'lt-id-signature',
|
|
32
|
-
FI_IDCARD_SIGNATURE: 'fi-id-signature',
|
|
33
|
-
LU_IDCARD_SIGNATURE: 'lu-id-signature',
|
|
34
|
-
PT_IDCARD_SIGNATURE: 'pt-id-signature',
|
|
35
|
-
LV_EPARAKSTS_MOBILE_SIGNATURE: 'lv-eparaksts-mobile-signature',
|
|
36
|
-
AT_HANDY_SIGNATUR_SIGNATURE: 'at-handy-signatur-signature',
|
|
37
|
-
REGISTRU_CENTRAS_SIGNATURE: 'registru-centras-signature',
|
|
38
|
-
OTP_EMAIL: 'otp-email-non-qualified',
|
|
39
|
-
FI_FTN_ADVANCED_SIGNATURE: 'fi-ftn-advanced-signature',
|
|
40
|
-
EVROTRUST_SIGNATURE: 'evrotrust-signature',
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
const moduleNames = {
|
|
44
|
-
idCard: 'idCard',
|
|
45
|
-
mobileId: 'mobileId',
|
|
46
|
-
eParakstsMobile: 'eParakstsMobile',
|
|
47
|
-
smartId: 'smartId',
|
|
48
|
-
frejaEid: 'frejaEid',
|
|
49
|
-
zealId: 'zealId',
|
|
50
|
-
mojeId: 'mojeId',
|
|
51
|
-
finnishTrustNetwork: 'finnishTrustNetwork',
|
|
52
|
-
atHandy: 'atHandy',
|
|
53
|
-
|
|
54
|
-
idCardSignature: 'idCardSignature',
|
|
55
|
-
mobileIdSignature: 'mobileIdSignature',
|
|
56
|
-
smartIdSignature: 'smartIdSignature',
|
|
57
|
-
evroTrustSignature: 'evroTrustSignature',
|
|
58
|
-
otpSignature: 'otpSignature',
|
|
59
|
-
eParakstsMobileSignature: 'eParakstsMobileSignature',
|
|
60
|
-
ftnSignature: 'ftnSignature',
|
|
61
|
-
atHandySignature: 'atHandySignature',
|
|
62
|
-
zealIdSignature: 'zealIdSignature',
|
|
63
|
-
};
|
|
64
|
-
|
|
65
|
-
const allMethods = Object.freeze({
|
|
66
|
-
[methodTypes.IDENTIFICATION]: [
|
|
67
|
-
{
|
|
68
|
-
actionType: methodActionTypes.BE_ID_LOGIN,
|
|
69
|
-
handlingModule: moduleNames.idCard,
|
|
70
|
-
supportedCountries: ['BE'],
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
actionType: methodActionTypes.EE_ID_LOGIN,
|
|
74
|
-
handlingModule: moduleNames.idCard,
|
|
75
|
-
supportedCountries: ['EE'],
|
|
76
|
-
},
|
|
77
|
-
{
|
|
78
|
-
actionType: methodActionTypes.FI_ID_LOGIN,
|
|
79
|
-
handlingModule: moduleNames.idCard,
|
|
80
|
-
supportedCountries: ['FI'],
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
actionType: methodActionTypes.LV_ID_LOGIN,
|
|
84
|
-
handlingModule: moduleNames.idCard,
|
|
85
|
-
supportedCountries: ['LV'],
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
actionType: methodActionTypes.LT_ID_LOGIN,
|
|
89
|
-
handlingModule: moduleNames.idCard,
|
|
90
|
-
supportedCountries: ['LT'],
|
|
91
|
-
},
|
|
92
|
-
{
|
|
93
|
-
actionType: methodActionTypes.PT_ID_LOGIN,
|
|
94
|
-
handlingModule: moduleNames.idCard,
|
|
95
|
-
supportedCountries: ['PT'],
|
|
96
|
-
},
|
|
97
|
-
{
|
|
98
|
-
actionType: methodActionTypes.RS_ID_LOGIN,
|
|
99
|
-
handlingModule: moduleNames.idCard,
|
|
100
|
-
supportedCountries: ['RS'],
|
|
101
|
-
},
|
|
102
|
-
{
|
|
103
|
-
actionType: methodActionTypes.LV_EPARAKSTS_MOBILE_LOGIN,
|
|
104
|
-
handlingModule: moduleNames.eParakstsMobile,
|
|
105
|
-
supportedCountries: ['LV'],
|
|
106
|
-
},
|
|
107
|
-
{
|
|
108
|
-
actionType: methodActionTypes.LT_MOBILE_ID,
|
|
109
|
-
handlingModule: moduleNames.mobileId,
|
|
110
|
-
supportedCountries: ['LT'],
|
|
111
|
-
},
|
|
112
|
-
{
|
|
113
|
-
actionType: methodActionTypes.EE_MOBILE_ID,
|
|
114
|
-
handlingModule: moduleNames.mobileId,
|
|
115
|
-
supportedCountries: ['EE'],
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
actionType: methodActionTypes.SMART_ID,
|
|
119
|
-
handlingModule: moduleNames.smartId,
|
|
120
|
-
supportedCountries: ['EE', 'LV', 'LT'],
|
|
121
|
-
},
|
|
122
|
-
{
|
|
123
|
-
actionType: methodActionTypes.FREJA_EID_LOGIN,
|
|
124
|
-
handlingModule: moduleNames.frejaEid,
|
|
125
|
-
supportedCountries: ['FI', 'SE', 'NO', 'DK'],
|
|
126
|
-
},
|
|
127
|
-
{
|
|
128
|
-
actionType: methodActionTypes.ZEALID_LOGIN,
|
|
129
|
-
handlingModule: moduleNames.zealId,
|
|
130
|
-
supportedCountries: [
|
|
131
|
-
'AT', 'BE', 'BG', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IE', 'IT', 'LV', 'LT',
|
|
132
|
-
'NL', 'NO', 'PL', 'PT', 'RO', 'RS', 'SE', 'SI', 'SK',
|
|
133
|
-
],
|
|
134
|
-
},
|
|
135
|
-
{
|
|
136
|
-
actionType: methodActionTypes.CZ_MOJEID,
|
|
137
|
-
handlingModule: moduleNames.mojeId,
|
|
138
|
-
supportedCountries: ['CZ'],
|
|
139
|
-
},
|
|
140
|
-
{
|
|
141
|
-
actionType: methodActionTypes.FI_FTN_LOGIN,
|
|
142
|
-
handlingModule: moduleNames.finnishTrustNetwork,
|
|
143
|
-
supportedCountries: ['FI'],
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
actionType: methodActionTypes.AT_HANDY_SIGNATUR_LOGIN,
|
|
147
|
-
handlingModule: moduleNames.atHandy,
|
|
148
|
-
supportedCountries: ['AT'],
|
|
149
|
-
},
|
|
150
|
-
],
|
|
151
|
-
[methodTypes.SIGNATURE]: [
|
|
152
|
-
{
|
|
153
|
-
actionType: methodActionTypes.EE_IDCARD_SIGNATURE,
|
|
154
|
-
handlingModule: moduleNames.idCardSignature,
|
|
155
|
-
supportedCountries: ['EE'],
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
actionType: methodActionTypes.LV_IDCARD_SIGNATURE,
|
|
159
|
-
handlingModule: moduleNames.idCardSignature,
|
|
160
|
-
supportedCountries: ['LV'],
|
|
161
|
-
},
|
|
162
|
-
{
|
|
163
|
-
actionType: methodActionTypes.LT_IDCARD_SIGNATURE,
|
|
164
|
-
handlingModule: moduleNames.idCardSignature,
|
|
165
|
-
supportedCountries: ['LT'],
|
|
166
|
-
},
|
|
167
|
-
{
|
|
168
|
-
actionType: methodActionTypes.FI_IDCARD_SIGNATURE,
|
|
169
|
-
handlingModule: moduleNames.idCardSignature,
|
|
170
|
-
supportedCountries: ['FI'],
|
|
171
|
-
},
|
|
172
|
-
{
|
|
173
|
-
actionType: methodActionTypes.PT_IDCARD_SIGNATURE,
|
|
174
|
-
handlingModule: moduleNames.idCardSignature,
|
|
175
|
-
supportedCountries: ['PT'],
|
|
176
|
-
},
|
|
177
|
-
{
|
|
178
|
-
actionType: methodActionTypes.BE_IDCARD_SIGNATURE,
|
|
179
|
-
handlingModule: moduleNames.idCardSignature,
|
|
180
|
-
supportedCountries: ['BE'],
|
|
181
|
-
},
|
|
182
|
-
{
|
|
183
|
-
actionType: methodActionTypes.EE_MOBILEID_SIGNATURE,
|
|
184
|
-
handlingModule: moduleNames.mobileIdSignature,
|
|
185
|
-
supportedCountries: ['EE'],
|
|
186
|
-
},
|
|
187
|
-
{
|
|
188
|
-
actionType: methodActionTypes.LT_MOBILEID_SIGNATURE,
|
|
189
|
-
handlingModule: moduleNames.mobileIdSignature,
|
|
190
|
-
supportedCountries: ['LT'],
|
|
191
|
-
},
|
|
192
|
-
{
|
|
193
|
-
actionType: methodActionTypes.SMARTID_SIGNATURE,
|
|
194
|
-
handlingModule: moduleNames.smartIdSignature,
|
|
195
|
-
supportedCountries: ['EE', 'LV', 'LT'],
|
|
196
|
-
},
|
|
197
|
-
{
|
|
198
|
-
actionType: methodActionTypes.EVROTRUST_SIGNATURE,
|
|
199
|
-
handlingModule: moduleNames.evroTrustSignature,
|
|
200
|
-
supportedCountries: [
|
|
201
|
-
'AL', 'AD', 'AM', 'AU', 'AT', 'AZ', 'BY', 'BE', 'BA', 'BG', 'CA', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR',
|
|
202
|
-
'GE', 'DE', 'GR', 'HU', 'IS', 'IE', 'IT', 'IL', 'KZ', 'KE', 'XK', 'LV', 'LI', 'LT', 'LU', 'MT', 'MD', 'MC',
|
|
203
|
-
'ME', 'NL', 'NZ', 'NO', 'MK', 'PL', 'PT', 'RO', 'RU', 'SM', 'RS', 'SK', 'SI', 'ES', 'SE', 'CH', 'TW', 'TR',
|
|
204
|
-
'UA', 'GB', 'US', 'VA',
|
|
205
|
-
],
|
|
206
|
-
},
|
|
207
|
-
{
|
|
208
|
-
actionType: methodActionTypes.OTP_EMAIL,
|
|
209
|
-
handlingModule: moduleNames.otpSignature,
|
|
210
|
-
supportedCountries: ['WORLD'],
|
|
211
|
-
},
|
|
212
|
-
{
|
|
213
|
-
actionType: methodActionTypes.LV_EPARAKSTS_MOBILE_SIGNATURE,
|
|
214
|
-
handlingModule: moduleNames.eParakstsMobileSignature,
|
|
215
|
-
supportedCountries: ['LV'],
|
|
216
|
-
},
|
|
217
|
-
{
|
|
218
|
-
actionType: methodActionTypes.FI_FTN_ADVANCED_SIGNATURE,
|
|
219
|
-
handlingModule: moduleNames.ftnSignature,
|
|
220
|
-
supportedCountries: ['FI'],
|
|
221
|
-
},
|
|
222
|
-
{
|
|
223
|
-
actionType: methodActionTypes.AT_HANDY_SIGNATUR_SIGNATURE,
|
|
224
|
-
handlingModule: moduleNames.atHandySignature,
|
|
225
|
-
supportedCountries: ['AT'],
|
|
226
|
-
},
|
|
227
|
-
{
|
|
228
|
-
actionType: methodActionTypes.ZEAL_ID_SIGNATURE,
|
|
229
|
-
handlingModule: moduleNames.zealIdSignature,
|
|
230
|
-
supportedCountries: [
|
|
231
|
-
'AT', 'BE', 'BG', 'CZ', 'DE', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HR', 'HU', 'IE', 'IT', 'LV', 'LT',
|
|
232
|
-
'NL', 'NO', 'PL', 'PT', 'RO', 'RS', 'SE', 'SI', 'SK',
|
|
233
|
-
],
|
|
234
|
-
},
|
|
235
|
-
],
|
|
236
|
-
});
|
|
237
|
-
|
|
238
|
-
const getMethodByHandlingModule = function getMethodByHandlingModule(methodType, handlingModule, country) {
|
|
239
|
-
const methods = allMethods[methodType];
|
|
240
|
-
if (handlingModule && country) {
|
|
241
|
-
const match = methods.find((method) => method.handlingModule === handlingModule
|
|
242
|
-
&& (method.supportedCountries.includes(country) || method.supportedCountries.includes('WORLD')));
|
|
243
|
-
|
|
244
|
-
if (!match) {
|
|
245
|
-
const matchingMethods = methods.filter((method) => method.handlingModule === handlingModule);
|
|
246
|
-
if (matchingMethods.length === 0) {
|
|
247
|
-
throw new Error(`Could not find matching method configuration for ${methodType} module "${handlingModule}"`);
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
throw new Error(`Country "${country}" is not supported for ${methodType}
|
|
251
|
-
module "${handlingModule}".`);
|
|
252
|
-
}
|
|
253
|
-
return match;
|
|
254
|
-
}
|
|
255
|
-
return methods.find((method) => method.handlingModule === handlingModule);
|
|
256
|
-
};
|
|
257
|
-
|
|
258
|
-
export {
|
|
259
|
-
methodTypes, methodActionTypes, moduleNames, allMethods, getMethodByHandlingModule,
|
|
260
|
-
};
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
const coreSettingsSchema = {
|
|
2
|
-
countryCode: {
|
|
3
|
-
type: 'string',
|
|
4
|
-
},
|
|
5
|
-
sandbox: {
|
|
6
|
-
default: false,
|
|
7
|
-
type: 'boolean',
|
|
8
|
-
},
|
|
9
|
-
clientId: {
|
|
10
|
-
required: true,
|
|
11
|
-
type: 'string',
|
|
12
|
-
},
|
|
13
|
-
redirectUri: {
|
|
14
|
-
type: 'string',
|
|
15
|
-
},
|
|
16
|
-
docId: {
|
|
17
|
-
type: 'string',
|
|
18
|
-
},
|
|
19
|
-
contractId: {
|
|
20
|
-
type: 'string',
|
|
21
|
-
},
|
|
22
|
-
apiEndpoints: {
|
|
23
|
-
type: 'object',
|
|
24
|
-
},
|
|
25
|
-
modifyRequestSettings: {
|
|
26
|
-
type: 'function',
|
|
27
|
-
},
|
|
28
|
-
language: {
|
|
29
|
-
default: 'en',
|
|
30
|
-
type: 'string',
|
|
31
|
-
},
|
|
32
|
-
success: {
|
|
33
|
-
default: () => {},
|
|
34
|
-
type: 'function',
|
|
35
|
-
},
|
|
36
|
-
fail: {
|
|
37
|
-
default: () => {},
|
|
38
|
-
type: 'function',
|
|
39
|
-
},
|
|
40
|
-
finished: {
|
|
41
|
-
default: () => {},
|
|
42
|
-
type: 'function',
|
|
43
|
-
},
|
|
44
|
-
started: {
|
|
45
|
-
default: () => {},
|
|
46
|
-
type: 'function',
|
|
47
|
-
},
|
|
48
|
-
redirect: {
|
|
49
|
-
default: (result) => {
|
|
50
|
-
const redirectUrl = result.data && result.data.redirect_uri;
|
|
51
|
-
if (redirectUrl) {
|
|
52
|
-
if (window.location !== window.top.location) {
|
|
53
|
-
// we are inside an iframe
|
|
54
|
-
// eParaksts, Telia FTN, etc do not work inside an iframe
|
|
55
|
-
// so we need to redirect the parent window
|
|
56
|
-
window.top.location.href = redirectUrl;
|
|
57
|
-
} else {
|
|
58
|
-
window.location.href = redirectUrl;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
// Return a pending promise to prevent the method module from calling success callback right after redirect.
|
|
62
|
-
// The reason for skipping success callback here is that if a redirect happens, then there are still
|
|
63
|
-
// some actions that the end user or the browser needs to perform (the redirect itself for example)
|
|
64
|
-
// so it doesn't make sense to call the success at this point.
|
|
65
|
-
return new Promise(() => {});
|
|
66
|
-
}
|
|
67
|
-
return result;
|
|
68
|
-
},
|
|
69
|
-
type: 'function',
|
|
70
|
-
},
|
|
71
|
-
remoteMonitoringEnabled: {
|
|
72
|
-
default: false,
|
|
73
|
-
},
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
export default coreSettingsSchema;
|
package/src/createApiPoller.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import poll from './poll';
|
|
2
|
-
import { isCancel } from './request';
|
|
3
|
-
|
|
4
|
-
function isBelowAttemptsLimit(currentCount, limit) {
|
|
5
|
-
if (!limit) {
|
|
6
|
-
return true;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
return currentCount < limit;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
const createApiPoller = function createApiPoller({
|
|
13
|
-
pollInterval = 2000,
|
|
14
|
-
maxPollDuration,
|
|
15
|
-
fn,
|
|
16
|
-
fnArgs,
|
|
17
|
-
}) {
|
|
18
|
-
let maxPollAttempts;
|
|
19
|
-
if (maxPollDuration) {
|
|
20
|
-
maxPollAttempts = maxPollDuration / pollInterval;
|
|
21
|
-
}
|
|
22
|
-
let totalFails = 0;
|
|
23
|
-
|
|
24
|
-
const start = function start() {
|
|
25
|
-
return poll({
|
|
26
|
-
fn: () => fn(...fnArgs),
|
|
27
|
-
shouldContinue: (pollContext) => {
|
|
28
|
-
const { result } = pollContext;
|
|
29
|
-
const responseStatus = result
|
|
30
|
-
&& result.data
|
|
31
|
-
&& result.data.status;
|
|
32
|
-
|
|
33
|
-
const cancelled = isCancel(pollContext.error);
|
|
34
|
-
// probably a network error
|
|
35
|
-
const networkFail = pollContext.error && !pollContext.error.response && !cancelled;
|
|
36
|
-
if (networkFail) {
|
|
37
|
-
totalFails += 1;
|
|
38
|
-
}
|
|
39
|
-
let keepGoing = false;
|
|
40
|
-
if (isBelowAttemptsLimit(pollContext.attempts, maxPollAttempts) && totalFails < 3) {
|
|
41
|
-
keepGoing = networkFail || responseStatus === 'RUNNING';
|
|
42
|
-
}
|
|
43
|
-
return keepGoing;
|
|
44
|
-
},
|
|
45
|
-
interval: pollInterval,
|
|
46
|
-
});
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
return {
|
|
50
|
-
start,
|
|
51
|
-
};
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
export default createApiPoller;
|
package/src/createClientCore.js
DELETED
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import { allMethods } from './config';
|
|
2
|
-
import createApiClient from './apiClient/createApiClient';
|
|
3
|
-
// we can't get the client config directly from the API client-side because
|
|
4
|
-
// the /api/client-config/ endpoint requires secret
|
|
5
|
-
// import createGetClientConfig from './createGetClientConfig';
|
|
6
|
-
|
|
7
|
-
const createClientCore = function createClientCore({
|
|
8
|
-
identificationModules = [],
|
|
9
|
-
signingModules = [],
|
|
10
|
-
settings = {},
|
|
11
|
-
i18n,
|
|
12
|
-
apiEndpoints,
|
|
13
|
-
monitoringService,
|
|
14
|
-
} = {}) {
|
|
15
|
-
const config = { ...settings };
|
|
16
|
-
|
|
17
|
-
config.apiEndpoints = apiEndpoints;
|
|
18
|
-
i18n.setLanguage(config.language);
|
|
19
|
-
|
|
20
|
-
const setCountryCode = function setCountryCode(countryCode) {
|
|
21
|
-
config.countryCode = countryCode;
|
|
22
|
-
};
|
|
23
|
-
const getCountryCode = function getCountryCode() {
|
|
24
|
-
return config.countryCode;
|
|
25
|
-
};
|
|
26
|
-
/*
|
|
27
|
-
const getClientConfig = createGetClientConfig({
|
|
28
|
-
apiClient: createApiClient(),
|
|
29
|
-
coreContext: {
|
|
30
|
-
config,
|
|
31
|
-
},
|
|
32
|
-
});
|
|
33
|
-
*/
|
|
34
|
-
|
|
35
|
-
const getAllMethods = function getAllMethods() {
|
|
36
|
-
return allMethods;
|
|
37
|
-
};
|
|
38
|
-
|
|
39
|
-
const installedAuthenticationModules = {};
|
|
40
|
-
identificationModules.forEach((module) => {
|
|
41
|
-
const instance = module({
|
|
42
|
-
coreContext: {
|
|
43
|
-
config,
|
|
44
|
-
i18n,
|
|
45
|
-
monitoringService,
|
|
46
|
-
},
|
|
47
|
-
apiClient: createApiClient({
|
|
48
|
-
modifyRequestSettings: config.modifyRequestSettings,
|
|
49
|
-
}),
|
|
50
|
-
});
|
|
51
|
-
installedAuthenticationModules[instance.MODULE_NAME] = instance;
|
|
52
|
-
});
|
|
53
|
-
|
|
54
|
-
const installedSigningModules = {};
|
|
55
|
-
signingModules.forEach((module) => {
|
|
56
|
-
const instance = module({
|
|
57
|
-
coreContext: {
|
|
58
|
-
config,
|
|
59
|
-
i18n,
|
|
60
|
-
monitoringService,
|
|
61
|
-
},
|
|
62
|
-
apiClient: createApiClient({
|
|
63
|
-
modifyRequestSettings: config.modifyRequestSettings,
|
|
64
|
-
}),
|
|
65
|
-
});
|
|
66
|
-
installedSigningModules[instance.MODULE_NAME] = instance;
|
|
67
|
-
});
|
|
68
|
-
|
|
69
|
-
return Object.freeze({
|
|
70
|
-
identification: {
|
|
71
|
-
...installedAuthenticationModules,
|
|
72
|
-
},
|
|
73
|
-
signature: {
|
|
74
|
-
...installedSigningModules,
|
|
75
|
-
},
|
|
76
|
-
// getClientConfig,
|
|
77
|
-
getAllMethods,
|
|
78
|
-
setLanguage: i18n.setLanguage,
|
|
79
|
-
setCountryCode,
|
|
80
|
-
getCountryCode,
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
export default createClientCore;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
const createGetClientConfig = function createGetServiceConfig({
|
|
2
|
-
coreContext,
|
|
3
|
-
apiClient,
|
|
4
|
-
}) {
|
|
5
|
-
const { clientId } = coreContext.config;
|
|
6
|
-
return function getClientConfig() {
|
|
7
|
-
return apiClient.post({
|
|
8
|
-
url: `${coreContext.config.apiEndpoints.inCurrentMode.base()}/api/client-config/${clientId}`,
|
|
9
|
-
withCredentials: false,
|
|
10
|
-
});
|
|
11
|
-
};
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
export default createGetClientConfig;
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import formatError from './formatError';
|
|
2
|
-
import createSettings from './createSettings';
|
|
3
|
-
import coreSettingsSchema from './coreSettingsSchema';
|
|
4
|
-
|
|
5
|
-
const createModuleCreator = function createModuleCreator(moduleName, executable, methodSettingsSchema = {}) {
|
|
6
|
-
return function create({
|
|
7
|
-
coreContext,
|
|
8
|
-
apiClient,
|
|
9
|
-
}) {
|
|
10
|
-
const { i18n, config: coreConfig, monitoringService } = coreContext;
|
|
11
|
-
const start = function start(userSettings = {}) {
|
|
12
|
-
const schema = { ...coreSettingsSchema, ...methodSettingsSchema };
|
|
13
|
-
const fullSettings = { ...coreConfig, ...userSettings };
|
|
14
|
-
const config = createSettings({
|
|
15
|
-
rawSettings: fullSettings,
|
|
16
|
-
schema,
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
const {
|
|
20
|
-
success,
|
|
21
|
-
fail,
|
|
22
|
-
finished,
|
|
23
|
-
} = config;
|
|
24
|
-
|
|
25
|
-
const language = userSettings.language || i18n.getCurrentLanguage();
|
|
26
|
-
const source = apiClient.CancelToken.source();
|
|
27
|
-
const cancelToken = source.token;
|
|
28
|
-
|
|
29
|
-
const execute = async function execute() {
|
|
30
|
-
await executable({
|
|
31
|
-
...config,
|
|
32
|
-
language,
|
|
33
|
-
i18n,
|
|
34
|
-
monitoringService,
|
|
35
|
-
cancelToken,
|
|
36
|
-
apiClient,
|
|
37
|
-
})
|
|
38
|
-
.then((result) => {
|
|
39
|
-
success(result);
|
|
40
|
-
})
|
|
41
|
-
.catch((error) => {
|
|
42
|
-
if (console && console.error) {
|
|
43
|
-
console.error(error);
|
|
44
|
-
}
|
|
45
|
-
fail(formatError(error));
|
|
46
|
-
})
|
|
47
|
-
.finally(finished);
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
execute().catch(console.error);
|
|
51
|
-
|
|
52
|
-
return Object.freeze({
|
|
53
|
-
cancel: function cancel() {
|
|
54
|
-
source.cancel();
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
};
|
|
58
|
-
|
|
59
|
-
return Object.freeze({
|
|
60
|
-
MODULE_NAME: moduleName,
|
|
61
|
-
start,
|
|
62
|
-
});
|
|
63
|
-
};
|
|
64
|
-
};
|
|
65
|
-
|
|
66
|
-
export default createModuleCreator;
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import request from './request';
|
|
2
|
-
|
|
3
|
-
const createMonitoringService = function createMonitoringService({ remoteMonitoringEnabled, apiEndpoints }) {
|
|
4
|
-
const dispatch = function dispatch({ message, data = {} }) {
|
|
5
|
-
if (!remoteMonitoringEnabled) {
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
// confirm_progress endpoint doesn't support cors currently
|
|
10
|
-
// this means we need to avoid OPTIONS request, since if the options request response
|
|
11
|
-
// has no Access-Control-Allow-Origin, the following POST request gets cancelled and the remote server won't see it
|
|
12
|
-
// https://stackoverflow.com/questions/29954037/why-is-an-options-request-sent-and-can-i-disable-it
|
|
13
|
-
const params = new URLSearchParams();
|
|
14
|
-
params.append('message', message);
|
|
15
|
-
request({
|
|
16
|
-
url: apiEndpoints.inCurrentMode.eideasyMonitoring(),
|
|
17
|
-
method: 'post',
|
|
18
|
-
cache: 'no-cache',
|
|
19
|
-
withCredentials: false,
|
|
20
|
-
headers: {
|
|
21
|
-
Accept: '*/*',
|
|
22
|
-
'Content-Type': 'application/x-www-form-urlencoded',
|
|
23
|
-
},
|
|
24
|
-
data: params,
|
|
25
|
-
});
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
return {
|
|
29
|
-
dispatch,
|
|
30
|
-
};
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
export default createMonitoringService;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
// we're using axios behind the scenes
|
|
2
|
-
// so it makes sense to use a similar request error format
|
|
3
|
-
// for our own api errors as well
|
|
4
|
-
// https://github.com/axios/axios/blob/master/lib/core/createError.js
|
|
5
|
-
const createRequestError = function createRequestError({
|
|
6
|
-
message,
|
|
7
|
-
config,
|
|
8
|
-
code,
|
|
9
|
-
request,
|
|
10
|
-
response,
|
|
11
|
-
}) {
|
|
12
|
-
const error = new Error(message);
|
|
13
|
-
error.config = config;
|
|
14
|
-
if (code) {
|
|
15
|
-
error.code = code;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
error.request = request;
|
|
19
|
-
error.response = response;
|
|
20
|
-
error.isRequestError = true;
|
|
21
|
-
return error;
|
|
22
|
-
};
|
|
23
|
-
|
|
24
|
-
export default createRequestError;
|