@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,124 +0,0 @@
|
|
|
1
|
-
import createStep from '../createStep';
|
|
2
|
-
import createModuleCreator from '../createModuleCreator';
|
|
3
|
-
import { getMethodByHandlingModule, methodTypes, moduleNames } from '../config';
|
|
4
|
-
import createApiPoller from '../createApiPoller';
|
|
5
|
-
|
|
6
|
-
const MODULE_NAME = moduleNames.smartIdSignature;
|
|
7
|
-
const settingsSchema = {
|
|
8
|
-
countryCode: {
|
|
9
|
-
type: 'string',
|
|
10
|
-
required: true,
|
|
11
|
-
},
|
|
12
|
-
idcode: {
|
|
13
|
-
type: 'string',
|
|
14
|
-
required: true,
|
|
15
|
-
},
|
|
16
|
-
docId: {
|
|
17
|
-
type: 'string',
|
|
18
|
-
required: true,
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
const startSigning = function startSigning({
|
|
23
|
-
contractId, idcode, clientId, docId, cancelToken, apiEndpoints, apiClient, countryCode, language,
|
|
24
|
-
}) {
|
|
25
|
-
const url = apiEndpoints.inCurrentMode.startSigning();
|
|
26
|
-
return apiClient.post({
|
|
27
|
-
url,
|
|
28
|
-
withCredentials: false,
|
|
29
|
-
data: {
|
|
30
|
-
doc_id: docId,
|
|
31
|
-
contract_id: contractId,
|
|
32
|
-
client_id: clientId,
|
|
33
|
-
sign_type: 'smart-id',
|
|
34
|
-
idcode,
|
|
35
|
-
country: countryCode,
|
|
36
|
-
lang: language,
|
|
37
|
-
},
|
|
38
|
-
cancelToken,
|
|
39
|
-
});
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
const finishSigning = function finishSigning({
|
|
43
|
-
data, apiClient, apiEndpoints, language, cancelToken, docId, clientId,
|
|
44
|
-
}) {
|
|
45
|
-
return apiClient.post({
|
|
46
|
-
url: apiEndpoints.inCurrentMode.completeSignatureSmartId(),
|
|
47
|
-
withCredentials: false,
|
|
48
|
-
data: {
|
|
49
|
-
token: data.token,
|
|
50
|
-
doc_id: docId,
|
|
51
|
-
lang: language,
|
|
52
|
-
client_id: clientId,
|
|
53
|
-
},
|
|
54
|
-
cancelToken,
|
|
55
|
-
});
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
const pollFinishSigning = function pollFinishSigning({
|
|
59
|
-
data, apiClient, apiEndpoints, language, cancelToken, docId, clientId,
|
|
60
|
-
}) {
|
|
61
|
-
const poller = createApiPoller({
|
|
62
|
-
pollInterval: 2000,
|
|
63
|
-
// Smart ID users have ~120 seconds to enter their pin,
|
|
64
|
-
// so it doesn't make sense to poll longer than that
|
|
65
|
-
maxPollDuration: 120 * 1000,
|
|
66
|
-
fn: finishSigning,
|
|
67
|
-
fnArgs: [{
|
|
68
|
-
data,
|
|
69
|
-
apiClient,
|
|
70
|
-
apiEndpoints,
|
|
71
|
-
language,
|
|
72
|
-
cancelToken,
|
|
73
|
-
docId,
|
|
74
|
-
clientId,
|
|
75
|
-
}],
|
|
76
|
-
});
|
|
77
|
-
return poller.start();
|
|
78
|
-
};
|
|
79
|
-
|
|
80
|
-
const executable = async function executable({
|
|
81
|
-
clientId,
|
|
82
|
-
docId,
|
|
83
|
-
contractId,
|
|
84
|
-
cancelToken,
|
|
85
|
-
apiEndpoints,
|
|
86
|
-
apiClient,
|
|
87
|
-
monitoringService,
|
|
88
|
-
language,
|
|
89
|
-
idcode,
|
|
90
|
-
countryCode,
|
|
91
|
-
started,
|
|
92
|
-
}) {
|
|
93
|
-
const method = getMethodByHandlingModule(methodTypes.SIGNATURE, MODULE_NAME, countryCode);
|
|
94
|
-
monitoringService.dispatch({
|
|
95
|
-
message: `${method.actionType}: signing started`,
|
|
96
|
-
});
|
|
97
|
-
|
|
98
|
-
const startSigningResult = await createStep(startSigning)({
|
|
99
|
-
clientId,
|
|
100
|
-
docId,
|
|
101
|
-
cancelToken,
|
|
102
|
-
apiEndpoints,
|
|
103
|
-
apiClient,
|
|
104
|
-
language,
|
|
105
|
-
idcode,
|
|
106
|
-
countryCode,
|
|
107
|
-
contractId,
|
|
108
|
-
});
|
|
109
|
-
|
|
110
|
-
started(startSigningResult);
|
|
111
|
-
|
|
112
|
-
return createStep(pollFinishSigning)({
|
|
113
|
-
data: startSigningResult.data,
|
|
114
|
-
apiClient,
|
|
115
|
-
apiEndpoints,
|
|
116
|
-
language,
|
|
117
|
-
cancelToken,
|
|
118
|
-
docId,
|
|
119
|
-
clientId,
|
|
120
|
-
});
|
|
121
|
-
};
|
|
122
|
-
|
|
123
|
-
const createSmartIdSignature = createModuleCreator(MODULE_NAME, executable, settingsSchema);
|
|
124
|
-
export default createSmartIdSignature;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import createStep from '../createStep';
|
|
2
|
-
import createModuleCreator from '../createModuleCreator';
|
|
3
|
-
import { moduleNames } from '../config';
|
|
4
|
-
|
|
5
|
-
const MODULE_NAME = moduleNames.zealIdSignature;
|
|
6
|
-
|
|
7
|
-
const getRedirectUrl = function getRedirectUrl({ apiEndpoints, clientId, docId }) {
|
|
8
|
-
const redirectUrl = apiEndpoints.inCurrentMode.startZealIdSignature({
|
|
9
|
-
clientId,
|
|
10
|
-
docId,
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
return {
|
|
14
|
-
data: {
|
|
15
|
-
// we use snake case for redirect_uri to maintain consistency with the responses coming from the core API
|
|
16
|
-
redirect_uri: redirectUrl,
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
const executable = async function executable(config) {
|
|
22
|
-
const {
|
|
23
|
-
redirect,
|
|
24
|
-
apiEndpoints,
|
|
25
|
-
clientId,
|
|
26
|
-
docId,
|
|
27
|
-
} = config;
|
|
28
|
-
|
|
29
|
-
const redirectUrlResult = await createStep(getRedirectUrl)({
|
|
30
|
-
apiEndpoints, clientId, docId,
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
return createStep(redirect, { shouldFormatResult: false })(redirectUrlResult);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
const createZealIdSignature = createModuleCreator(MODULE_NAME, executable);
|
|
37
|
-
export default createZealIdSignature;
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import createIdCardSignature from './createIdCardSignature';
|
|
2
|
-
import createMobileIdSignature from './createMobileIdSignature';
|
|
3
|
-
import createSmartIdSignature from './createSmartIdSignature';
|
|
4
|
-
import createEvrotrustSignature from './createEvrotrustSignature';
|
|
5
|
-
import createOtpSignature from './createOtpSignature';
|
|
6
|
-
import createEParakstsMobileSignature from './createEParakstsMobileSignature';
|
|
7
|
-
import createFtnSignature from './createFtnSignature';
|
|
8
|
-
import createAtHandySignature from './createAtHandySignature';
|
|
9
|
-
import createZealIdSignature from './createZealIdSignature';
|
|
10
|
-
|
|
11
|
-
export {
|
|
12
|
-
createIdCardSignature,
|
|
13
|
-
createMobileIdSignature,
|
|
14
|
-
createSmartIdSignature,
|
|
15
|
-
createEvrotrustSignature,
|
|
16
|
-
createOtpSignature,
|
|
17
|
-
createEParakstsMobileSignature,
|
|
18
|
-
createFtnSignature,
|
|
19
|
-
createAtHandySignature,
|
|
20
|
-
createZealIdSignature,
|
|
21
|
-
};
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import cloneDeep from '../cloneDeep';
|
|
2
|
-
|
|
3
|
-
describe('cloneDeep', () => {
|
|
4
|
-
let originalObj;
|
|
5
|
-
|
|
6
|
-
beforeEach(() => {
|
|
7
|
-
originalObj = {
|
|
8
|
-
lvl1: {
|
|
9
|
-
lvl2: {
|
|
10
|
-
lvl3: {
|
|
11
|
-
prop1: 'I am a string',
|
|
12
|
-
prop2: undefined,
|
|
13
|
-
prop3: null,
|
|
14
|
-
prop4: ['item1', 'item2', 'item3'],
|
|
15
|
-
prop5: new Error(),
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
},
|
|
19
|
-
};
|
|
20
|
-
});
|
|
21
|
-
|
|
22
|
-
test('object gets cloned', () => {
|
|
23
|
-
const clonedObject = cloneDeep(originalObj);
|
|
24
|
-
expect(clonedObject).toEqual(originalObj);
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
test('cloned object is not the original object', () => {
|
|
28
|
-
const clonedObject = cloneDeep(originalObj);
|
|
29
|
-
expect(clonedObject).not.toBe(originalObj);
|
|
30
|
-
});
|
|
31
|
-
});
|
package/src/tests/config.test.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getMethodByHandlingModule, methodTypes, moduleNames, methodActionTypes,
|
|
3
|
-
} from '../config';
|
|
4
|
-
|
|
5
|
-
describe('config', () => {
|
|
6
|
-
test('getMethodByHandlingModule returns correct module in case country is not provided', () => {
|
|
7
|
-
const method = getMethodByHandlingModule(methodTypes.IDENTIFICATION, moduleNames.idCard);
|
|
8
|
-
expect(method.handlingModule).toBe(moduleNames.idCard);
|
|
9
|
-
});
|
|
10
|
-
|
|
11
|
-
test('getMethodByHandlingModule returns correct module in case country is provided', () => {
|
|
12
|
-
const method = getMethodByHandlingModule(methodTypes.IDENTIFICATION, moduleNames.idCard, 'FI');
|
|
13
|
-
expect(method.actionType).toBe(methodActionTypes.FI_ID_LOGIN);
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
test('getMethodByHandlingModule returns correct module in case country is provided and method has multiple countries', () => {
|
|
17
|
-
const method = getMethodByHandlingModule(methodTypes.IDENTIFICATION, moduleNames.frejaEid, 'NO');
|
|
18
|
-
expect(method.actionType).toBe(methodActionTypes.FREJA_EID_LOGIN);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('getMethodByHandlingModule returns correct module in case country is not provided and method has multiple countries', () => {
|
|
22
|
-
const method = getMethodByHandlingModule(methodTypes.IDENTIFICATION, moduleNames.frejaEid);
|
|
23
|
-
expect(method.actionType).toBe(methodActionTypes.FREJA_EID_LOGIN);
|
|
24
|
-
});
|
|
25
|
-
});
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import createRequestError from '../createRequestError';
|
|
2
|
-
|
|
3
|
-
describe('createRequestError', () => {
|
|
4
|
-
let requestError;
|
|
5
|
-
const errorSettings = {
|
|
6
|
-
message: 'A mock error',
|
|
7
|
-
config: 'asdfasf',
|
|
8
|
-
code: 'mockErrorCode',
|
|
9
|
-
request: 'asfdasf',
|
|
10
|
-
response: {},
|
|
11
|
-
};
|
|
12
|
-
|
|
13
|
-
beforeAll(() => {
|
|
14
|
-
requestError = createRequestError(errorSettings);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test('requestError\'s isRequestError property value is true', () => {
|
|
18
|
-
expect(requestError.isRequestError).toBe(true);
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
test('requestError property values match the settings', () => {
|
|
22
|
-
const actualValues = {
|
|
23
|
-
message: requestError.message,
|
|
24
|
-
config: requestError.config,
|
|
25
|
-
code: requestError.code,
|
|
26
|
-
request: requestError.request,
|
|
27
|
-
response: requestError.response,
|
|
28
|
-
};
|
|
29
|
-
|
|
30
|
-
expect(actualValues).toEqual(errorSettings);
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
test('requestError is instanceof Error', () => {
|
|
34
|
-
expect(requestError instanceof Error).toBe(true);
|
|
35
|
-
});
|
|
36
|
-
});
|
package/src/tests/main.test.js
DELETED
package/src/tests/poll.test.js
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import poll from '../poll';
|
|
2
|
-
|
|
3
|
-
describe('poll', () => {
|
|
4
|
-
test('function is called 10 times', async () => {
|
|
5
|
-
const mockFunction = jest.fn();
|
|
6
|
-
|
|
7
|
-
await poll({
|
|
8
|
-
fn: mockFunction,
|
|
9
|
-
interval: 3,
|
|
10
|
-
shouldContinue({
|
|
11
|
-
attempts,
|
|
12
|
-
}) {
|
|
13
|
-
return attempts < 10;
|
|
14
|
-
},
|
|
15
|
-
});
|
|
16
|
-
expect(mockFunction).toHaveBeenCalledTimes(10);
|
|
17
|
-
});
|
|
18
|
-
|
|
19
|
-
test('shouldcontinue callback receives the error and terminates polling after 2 calls', async () => {
|
|
20
|
-
const mockFunction = jest.fn();
|
|
21
|
-
mockFunction
|
|
22
|
-
.mockReturnValueOnce(true)
|
|
23
|
-
.mockImplementation(() => {
|
|
24
|
-
throw new Error('Mock error message');
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
const result = await poll({
|
|
28
|
-
fn: mockFunction,
|
|
29
|
-
interval: 3,
|
|
30
|
-
shouldContinue({
|
|
31
|
-
attempts,
|
|
32
|
-
error,
|
|
33
|
-
}) {
|
|
34
|
-
return !(error || attempts > 9);
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
expect(mockFunction).toHaveBeenCalledTimes(2);
|
|
38
|
-
expect(result.error).not.toBe(undefined);
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
test('poll returns the final value in correct format', async () => {
|
|
42
|
-
const mockFunction = jest.fn();
|
|
43
|
-
mockFunction
|
|
44
|
-
.mockReturnValue({
|
|
45
|
-
mockProperty: 'mockPropertyValue',
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
const result = await poll({
|
|
49
|
-
fn: mockFunction,
|
|
50
|
-
interval: 3,
|
|
51
|
-
shouldContinue({
|
|
52
|
-
attempts,
|
|
53
|
-
}) {
|
|
54
|
-
return attempts < 1;
|
|
55
|
-
},
|
|
56
|
-
});
|
|
57
|
-
expect(result).toEqual({
|
|
58
|
-
result: {
|
|
59
|
-
mockProperty: 'mockPropertyValue',
|
|
60
|
-
},
|
|
61
|
-
error: undefined,
|
|
62
|
-
});
|
|
63
|
-
});
|
|
64
|
-
});
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import { calculateChildPosition } from '../windowOpen';
|
|
2
|
-
|
|
3
|
-
describe('calculateChildPosition', () => {
|
|
4
|
-
it('should center the child window relative to parent if child is smaller than parent', () => {
|
|
5
|
-
const childPosition = calculateChildPosition({
|
|
6
|
-
parent: {
|
|
7
|
-
width: 1300,
|
|
8
|
-
height: 700,
|
|
9
|
-
left: 600,
|
|
10
|
-
top: 500,
|
|
11
|
-
},
|
|
12
|
-
child: {
|
|
13
|
-
width: 800,
|
|
14
|
-
height: 600,
|
|
15
|
-
},
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
expect(childPosition).toEqual({
|
|
19
|
-
top: 550,
|
|
20
|
-
left: 850,
|
|
21
|
-
});
|
|
22
|
-
});
|
|
23
|
-
|
|
24
|
-
it('should center the child window relative to parent if child is bigger than parent', () => {
|
|
25
|
-
const childPosition = calculateChildPosition({
|
|
26
|
-
parent: {
|
|
27
|
-
width: 700,
|
|
28
|
-
height: 400,
|
|
29
|
-
left: 600,
|
|
30
|
-
top: 500,
|
|
31
|
-
},
|
|
32
|
-
child: {
|
|
33
|
-
width: 950,
|
|
34
|
-
height: 650,
|
|
35
|
-
},
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
expect(childPosition).toEqual({
|
|
39
|
-
top: 375,
|
|
40
|
-
left: 475,
|
|
41
|
-
});
|
|
42
|
-
});
|
|
43
|
-
});
|
package/src/windowOpen.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
const calculateChildPosition = function calculateChildPosition({
|
|
2
|
-
parent,
|
|
3
|
-
child,
|
|
4
|
-
}) {
|
|
5
|
-
// center the child window relative to the parent window
|
|
6
|
-
return {
|
|
7
|
-
left: (parent.width / 2) - (child.width / 2) + parent.left,
|
|
8
|
-
top: (parent.height / 2) - (child.height / 2) + parent.top,
|
|
9
|
-
};
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const windowOpen = function windowOpen(url) {
|
|
13
|
-
const child = {
|
|
14
|
-
width: 800,
|
|
15
|
-
height: 600,
|
|
16
|
-
};
|
|
17
|
-
|
|
18
|
-
const childPosition = calculateChildPosition({
|
|
19
|
-
parent: {
|
|
20
|
-
width: window.outerWidth,
|
|
21
|
-
height: window.outerHeight,
|
|
22
|
-
left: window.screenLeft,
|
|
23
|
-
top: window.screenTop,
|
|
24
|
-
},
|
|
25
|
-
child,
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
const features = [
|
|
29
|
-
'toolbar=no',
|
|
30
|
-
'location=no',
|
|
31
|
-
'directories=no',
|
|
32
|
-
'status=no',
|
|
33
|
-
'menubar=no',
|
|
34
|
-
'scrollbars=no',
|
|
35
|
-
'resizable=no',
|
|
36
|
-
'copyhistory=no',
|
|
37
|
-
`width=${child.width}`,
|
|
38
|
-
`height=${child.height}`,
|
|
39
|
-
`left=${childPosition.left}`,
|
|
40
|
-
`top=${childPosition.top}`,
|
|
41
|
-
];
|
|
42
|
-
return window.open(url, 'eID Easy', features.join(', '));
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
export default windowOpen;
|
|
46
|
-
export { calculateChildPosition };
|
package/webpack.config.js
DELETED
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
const webpack = require('webpack');
|
|
3
|
-
const { merge } = require('webpack-merge');
|
|
4
|
-
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
|
|
5
|
-
const ESLintPlugin = require('eslint-webpack-plugin');
|
|
6
|
-
const dotenv = require('dotenv');
|
|
7
|
-
|
|
8
|
-
const modeConfig = (env) => require(`./build-utils/webpack.${env}`)(env);
|
|
9
|
-
const presetConfig = require('./build-utils/loadPresets');
|
|
10
|
-
|
|
11
|
-
module.exports = ({
|
|
12
|
-
mode,
|
|
13
|
-
presets,
|
|
14
|
-
} = {
|
|
15
|
-
mode: 'production',
|
|
16
|
-
presets: [],
|
|
17
|
-
}) => merge(
|
|
18
|
-
{
|
|
19
|
-
mode,
|
|
20
|
-
stats: {
|
|
21
|
-
chunks: true,
|
|
22
|
-
},
|
|
23
|
-
entry: './src/index.js',
|
|
24
|
-
output: {
|
|
25
|
-
path: path.resolve(__dirname, 'dist'),
|
|
26
|
-
filename: 'eideasy-browser-client.js',
|
|
27
|
-
library: 'eidEasyBrowserClient',
|
|
28
|
-
libraryTarget: 'umd',
|
|
29
|
-
},
|
|
30
|
-
devServer: {
|
|
31
|
-
contentBase: './dist',
|
|
32
|
-
},
|
|
33
|
-
module: {
|
|
34
|
-
rules: [
|
|
35
|
-
{
|
|
36
|
-
test: /\.js$/,
|
|
37
|
-
exclude: /node_modules/,
|
|
38
|
-
use: ['babel-loader'],
|
|
39
|
-
},
|
|
40
|
-
],
|
|
41
|
-
},
|
|
42
|
-
plugins: [
|
|
43
|
-
new CleanWebpackPlugin(),
|
|
44
|
-
new ESLintPlugin(),
|
|
45
|
-
new webpack.ProgressPlugin(),
|
|
46
|
-
new webpack.DefinePlugin({
|
|
47
|
-
'process.env': JSON.stringify(dotenv.config({
|
|
48
|
-
path: path.join(__dirname, `.env.${mode}`),
|
|
49
|
-
}).parsed),
|
|
50
|
-
}),
|
|
51
|
-
],
|
|
52
|
-
},
|
|
53
|
-
modeConfig(mode),
|
|
54
|
-
presetConfig({ mode, presets }),
|
|
55
|
-
);
|