@eid-easy/eideasy-widget 2.172.1 → 2.172.3-beta.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/index.html DELETED
@@ -1,304 +0,0 @@
1
- <!DOCTYPE html><html lang=""><head>
2
- <meta charset="utf-8">
3
- <meta http-equiv="X-UA-Compatible" content="IE=edge">
4
- <meta name="viewport" content="width=device-width,initial-scale=1.0">
5
- <link rel="icon" href="/favicon.ico">
6
- <title>@eid-easy/eideasy-widget</title>
7
-
8
- <style>
9
- h2 {
10
- text-align: center;
11
- margin-top: 40px;
12
- }
13
-
14
- .container {
15
- max-width: 768px;
16
- margin: 0 auto;
17
- }
18
-
19
- .widgetHolder {
20
- max-width: 490px;
21
- //max-width: 700px;
22
- margin-left: auto;
23
- margin-right: auto;
24
- }
25
- </style>
26
- </head>
27
- <body>
28
- <noscript>
29
- <strong>We're sorry but @eid-easy/eideasy-widget doesn't work properly without JavaScript enabled.
30
- Please enable it to continue.</strong>
31
- </noscript>
32
-
33
-
34
- <div class="container">
35
- <div style="margin-top: 10px; margin-bottom: 10px;">
36
- <label for="langPicker">Language:</label>
37
- <select name="langPicker" id="langPicker">
38
- <option value="cs">Czech</option>
39
- <option value="nl">Dutch</option>
40
- <option value="en" selected="">English</option>
41
- <option value="et">Estonian</option>
42
- <option value="fi">Finnish</option>
43
- <option value="fr">French</option>
44
- <option value="de">German</option>
45
- <option value="it">Italian</option>
46
- <option value="lv">Latvian</option>
47
- <option value="lt">Lithuanian</option>
48
- <option value="pl">Polish</option>
49
- <option value="pt">Portuguese</option>
50
- <option value="ru">Russian</option>
51
- <option value="es">Spanish</option>
52
- <option value="sv">Swedish</option>
53
- </select>
54
- </div>
55
- <h2>Signatures</h2>
56
- <div id="signingWidgetHolder" class="widgetHolder"></div>
57
- <h2>Signature Certs</h2>
58
- <div id="signingCertWidgetHolder" class="widgetHolder"></div>
59
- <h2>Identification</h2>
60
- <div id="identificationWidgetHolder" class="widgetHolder"></div>
61
- </div>
62
-
63
- <script>
64
- function initIdentificationWidget(widgetHolder) {
65
- const eidEasyWidget = document.createElement('eideasy-widget');
66
-
67
- const settings = {
68
- countryCode: 'EE', // ISO 3166 two letter country code
69
- language: 'en', // ISO 639-1 two letter language code,
70
- sandbox: true,
71
- clientId: '9kKmNtYQ7LDOlHvasAE9oYQ0gKS4V4Bl',
72
- redirectUri: 'https://id.eideasy.eu/admin/oauthlogin', // this gets used for redirects e.g. when using eParaksts mobile
73
- apiEndpoints: {
74
- base: () => 'https://id.eideasy.eu',
75
- identityStart: () => 'https://eid-sample-app.eu/api/identity/start',
76
- identityFinish: () => 'https://eid-sample-app.eu/api/identity/finish',
77
- },
78
- translations: {
79
- 'et': {
80
- "message": "Mina olen antud kasutaja poolt i18n !!",
81
- },
82
- 'en': {
83
- message: "I am provided in settings",
84
- }
85
- }, // translations object to override existing translations
86
- // identification: true or 'all' will enable all methods
87
- // if you want to enable specific methods, then use
88
- // identification: ['ee-id-login', 'lv-id-login'],
89
- enabledMethods: {
90
- identification: 'all',
91
- //identification: ['ee-id-login', 'lv-id-login'],
92
- },
93
- // mode: 'oidcAuthorize',
94
- clientInfo: {
95
- websiteName: 'TestWebsite.test',
96
- companyName: 'TestCompany',
97
- },
98
- selectedMethod: null,
99
- enabledCountries: 'all',
100
- // use these to prefill the input values
101
- inputValues: {
102
- //idcode: '',
103
- // phone: '00000766',
104
- },
105
- modifyRequestSettings: (currentSettings) => {
106
- return {
107
- data: {
108
- xsrf_token: 'some-token',
109
- },
110
- }
111
- },
112
- formatFlashMessage: (message) => {
113
- if (message.response && message.response.status) {
114
- if (message.response.status === 419) {
115
- message.text = 'Session expired, please refresh your browser';
116
- }
117
- }
118
- return message;
119
- },
120
- onSuccess: function (data) {
121
- console.log('!!!!!! success !!!!!!!');
122
- console.log(data);
123
- },
124
- onFail: function (error) {
125
- console.log('!!!!!! fail !!!!!!!');
126
- console.log(error);
127
- },
128
- onStarted: function (data) {
129
- console.log('!!!!!! started !!!!!!!');
130
- console.log(data);
131
- },
132
- methodsConfigFilter(methods) {
133
- console.log(
134
- methods.identification.filter(({actionType}) => actionType.includes('eparaksts'))
135
- );
136
- const modifiedMethods = {};
137
-
138
- modifiedMethods.signature = methods.signature.map((method) => {
139
- if (method.actionType === 'smart-id-signature') {
140
- method.supportedCountries.push('FI');
141
- return method;
142
- }
143
- });
144
- modifiedMethods.signature = methods.identification.map((method) => {
145
- if (method.actionType === 'smartid') {
146
- method.supportedCountries.push('FI');
147
- return method;
148
- }
149
- });
150
- return methods;
151
- },
152
- modifyEndpointUrl(urlString) {
153
- return urlString;
154
- },
155
- oauthParamState: 'custom-state-value-from-widget',
156
- fieldAutocomplete: true,
157
- allowMethodChange: true,
158
- }
159
-
160
- Object.keys(settings).forEach(key => {
161
- eidEasyWidget[key] = settings[key];
162
- });
163
-
164
- widgetHolder.appendChild(eidEasyWidget);
165
- return eidEasyWidget;
166
- }
167
-
168
- function initSigningWidget(widgetHolder, methods = [], mode = null) {
169
- const eidEasyWidget = document.createElement('eideasy-widget');
170
-
171
- const settings = {
172
- debug: true,
173
- countryCode: 'EE', // ISO 3166 two letter country code
174
- language: 'en', // ISO 639-1 two letter language code,
175
- sandbox: true,
176
- clientId: '9kKmNtYQ7LDOlHvasAE9oYQ0gKS4V4Bl',
177
- docId: 'eeHyfsOFU22CJfOn8n3ruBGn7Oiry6BFwZ3dbC2S',
178
- apiEndpoints: {
179
- // base: () => 'http://localhost:8000',
180
- base: () => 'https://id.eideasy.eu',
181
- },
182
- translations: {
183
- 'et': {
184
- "message": "Mina olen antud kasutaja poolt i18n !!",
185
- },
186
- 'en': {
187
- message: "I am provided in settings",
188
- }
189
- }, // translations object to override existing translations
190
- // identification: true or 'all' will enable all methods
191
- // if you want to enable specific methods, then use
192
- // identification: ['ee-id-login', 'lv-id-login'],
193
- enabledMethods: {
194
- signature: methods.length > 0 ? methods : 'all',
195
- },
196
- selectedMethod: null,
197
- enabledCountries: 'all',
198
- // use these to prefill the input values
199
- inputValues: {
200
- // idcode: '',
201
- //phone: '00000766',
202
- //callingCode: '+372',
203
- },
204
- modifyRequestSettings: (currentSettings) => {
205
- return {
206
- data: {
207
- xsrf_token: 'some-token',
208
- },
209
- }
210
- },
211
- formatFlashMessage: (message) => {
212
- if (message.response && message.response.status) {
213
- if (message.response.status === 419) {
214
- message.text = 'Session expired, please refresh your browser';
215
- }
216
- }
217
- return message;
218
- },
219
- beforeMethodSelection: function(data) {
220
- console.log('-------- beforeMethodSelection ----------');
221
- console.log(data);
222
- // returning false here prevents the flow from proceeding further
223
- // return false;
224
-
225
- // you can provide additional config for methods here
226
- /*
227
- return {
228
- additionalMethodConfig: {
229
- docId: 'asfjalsfalshfakfhaslkfhas',
230
- }
231
- }
232
- */
233
- },
234
- onSuccess: function (data) {
235
- console.log('!!!!!! success !!!!!!!');
236
- console.log(data);
237
- },
238
- onFail: function (error) {
239
- console.log('!!!!!! fail !!!!!!!');
240
- console.log(error);
241
- },
242
- onStarted: function (data) {
243
- console.log('!!!!!! started !!!!!!!');
244
- console.log(data);
245
- },
246
- remoteMonitoringEnabled: true,
247
- otpEmail: 'mj@eideasy.com',
248
- redirect: res => {
249
- console.log('redirecting to', res.data.redirect_uri);
250
- window.location.href = res.data.redirect_uri;
251
- },
252
- //emailToken: 'gher0eqq9drrh5u6',
253
- //otpPhone: '+37255548246',
254
- isOtpSent: false,
255
- //otpFlow: 'start-at-method-selection',
256
- requireHandwrittenSignature: true,
257
- fieldAutocomplete: true,
258
- showSignatureLevel: true,
259
- // waitForChallengeCode: true,
260
- mode,
261
- //showSignaturePolicyLink: false,
262
- //showPoweredByEidEasyLink: false,
263
- // uiTheme: {
264
- // colorPrimary: '#d51111',
265
- // colorSecondary: '#00ff00',
266
- // textColor: '#0000ff',
267
- // buttonTextColor: 'rgb(6,192,164)',
268
- // buttonColor: '#000000',
269
- // buttonColorHover: '#252323',
270
- // inputLabelColor: '#04048d',
271
- // fontFamily: '"Gill Sans", sans-serif',
272
- // fontSize: '16px',
273
- // fontWeight: 'bold',
274
- // },
275
- }
276
-
277
- Object.keys(settings).forEach(key => {
278
- eidEasyWidget[key] = settings[key];
279
- });
280
-
281
- widgetHolder.appendChild(eidEasyWidget);
282
- return eidEasyWidget;
283
- }
284
-
285
- const signingWidget = initSigningWidget(document.getElementById('signingWidgetHolder'));
286
- const signingCertWidget = initSigningWidget(
287
- document.getElementById('signingCertWidgetHolder'),
288
- ['id-signature', 'lt-id-signature', 'lv-id-signature', 'fi-id-signature'],
289
- 'cscApiAuthorizeCredential'
290
- );
291
- const identificationWidget = initIdentificationWidget(document.getElementById('identificationWidgetHolder'));
292
-
293
- document
294
- .getElementById('langPicker')
295
- .addEventListener('change', (e) => {
296
- identificationWidget.language = e.target.value;
297
- signingWidget.language = e.target.value;
298
- signingCertWidget.language = e.target.value;
299
- });
300
- </script>
301
- <!-- built files will be auto injected -->
302
-
303
-
304
- <script src="/full/eideasy-widget.umd.min.js"></script></body></html>