@everymatrix/user-action-controller 1.0.0 → 1.0.69
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/cjs/app-globals-3a1e7e63.js +5 -0
- package/dist/cjs/index-c5061e5a.js +1315 -0
- package/dist/cjs/loader.cjs.js +7 -13
- package/dist/cjs/player-user-consents_2.cjs.entry.js +504 -0
- package/dist/cjs/user-action-controller.cjs.js +17 -11
- package/dist/collection/collection-manifest.json +5 -11
- package/dist/collection/components/user-action-controller/index.js +1 -0
- package/dist/collection/components/user-action-controller/user-action-controller.css +37 -0
- package/dist/collection/components/user-action-controller/user-action-controller.js +418 -328
- package/dist/collection/utils/locale.utils.js +66 -0
- package/dist/collection/utils/utils.js +1 -1
- package/dist/esm/app-globals-0f993ce5.js +3 -0
- package/dist/esm/index-02b86e76.js +1288 -0
- package/dist/esm/loader.js +7 -13
- package/dist/esm/player-user-consents_2.entry.js +499 -0
- package/dist/esm/user-action-controller.js +14 -11
- package/dist/stencil.config.dev.js +17 -0
- package/dist/stencil.config.js +14 -19
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/stencil.config.d.ts +2 -0
- package/dist/types/Users/raul.vasile/workspace/everymatrix/widgets-monorepo/packages/stencil/user-action-controller/.stencil/packages/stencil/user-action-controller/stencil.config.dev.d.ts +2 -0
- package/dist/types/components/user-action-controller/index.d.ts +1 -0
- package/dist/types/components/user-action-controller/user-action-controller.d.ts +68 -68
- package/dist/types/components.d.ts +28 -40
- package/dist/types/stencil-public-runtime.d.ts +142 -33
- package/dist/types/utils/locale.utils.d.ts +2 -0
- package/dist/user-action-controller/p-4bd71dba.entry.js +1 -0
- package/dist/user-action-controller/p-b996e8b8.js +2 -0
- package/dist/user-action-controller/p-e1255160.js +1 -0
- package/dist/user-action-controller/user-action-controller.esm.js +1 -1
- package/loader/cdn.js +1 -3
- package/loader/index.cjs.js +1 -3
- package/loader/index.d.ts +13 -1
- package/loader/index.es2017.js +1 -3
- package/loader/index.js +1 -3
- package/loader/package.json +1 -0
- package/package.json +16 -3
- package/dist/cjs/generic-user-consent_3.cjs.entry.js +0 -210
- package/dist/cjs/index-5b463836.js +0 -1285
- package/dist/components/generic-user-consent.js +0 -6
- package/dist/components/generic-user-consent2.js +0 -93
- package/dist/components/index.d.ts +0 -26
- package/dist/components/index.js +0 -1
- package/dist/components/legislation-wrapper.js +0 -6
- package/dist/components/legislation-wrapper2.js +0 -33
- package/dist/components/user-action-controller.d.ts +0 -11
- package/dist/components/user-action-controller.js +0 -168
- package/dist/esm/generic-user-consent_3.entry.js +0 -204
- package/dist/esm/index-e34db4b0.js +0 -1259
- package/dist/esm/polyfills/core-js.js +0 -11
- package/dist/esm/polyfills/css-shim.js +0 -1
- package/dist/esm/polyfills/dom.js +0 -79
- package/dist/esm/polyfills/es5-html-element.js +0 -1
- package/dist/esm/polyfills/index.js +0 -34
- package/dist/esm/polyfills/system.js +0 -6
- package/dist/types/Users/user/workspace/everymatrix/widgets-stencil/packages/user-action-controller/.stencil/packages/user-action-controller/stencil.config.d.ts +0 -2
- package/dist/user-action-controller/p-20213f37.js +0 -1
- package/dist/user-action-controller/p-2a14a5fe.entry.js +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
const DEFAULT_LANGUAGE = 'en';
|
|
2
|
+
const SUPPORTED_LANGUAGES = ['ro', 'en', 'cz', 'de', 'hr'];
|
|
3
|
+
const TRANSLATIONS = {
|
|
4
|
+
en: {
|
|
5
|
+
termsandconditions: 'Terms and Conditions',
|
|
6
|
+
sms: 'SMS marketing',
|
|
7
|
+
emailmarketing: 'Email marketing',
|
|
8
|
+
privacypolicy: 'Privacy Policy'
|
|
9
|
+
},
|
|
10
|
+
ro: {
|
|
11
|
+
termsandconditions: 'Termeni şi condiţii',
|
|
12
|
+
sms: 'SMS marketing',
|
|
13
|
+
emailmarketing: 'Email marketing',
|
|
14
|
+
privacypolicy: 'Privacy Policy'
|
|
15
|
+
},
|
|
16
|
+
hr: {
|
|
17
|
+
termsandconditions: 'Terms and Conditions',
|
|
18
|
+
sms: 'SMS marketing',
|
|
19
|
+
emailmarketing: 'Email marketing',
|
|
20
|
+
privacypolicy: 'Privacy Policy'
|
|
21
|
+
},
|
|
22
|
+
fr: {
|
|
23
|
+
termsandconditions: 'Terms and Conditions',
|
|
24
|
+
sms: 'SMS marketing',
|
|
25
|
+
emailmarketing: 'Email marketing',
|
|
26
|
+
privacypolicy: 'Privacy Policy'
|
|
27
|
+
},
|
|
28
|
+
cs: {
|
|
29
|
+
termsandconditions: 'Terms and Conditions',
|
|
30
|
+
sms: 'SMS marketing',
|
|
31
|
+
emailmarketing: 'Email marketing',
|
|
32
|
+
privacypolicy: 'Privacy Policy'
|
|
33
|
+
},
|
|
34
|
+
de: {
|
|
35
|
+
termsandconditions: 'Terms and Conditions',
|
|
36
|
+
sms: 'SMS marketing',
|
|
37
|
+
emailmarketing: 'Email marketing',
|
|
38
|
+
privacypolicy: 'Privacy Policy'
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
export const getTranslations = (url) => {
|
|
42
|
+
// fetch url, get the data, replace the TRANSLATIONS content
|
|
43
|
+
return new Promise((resolve) => {
|
|
44
|
+
fetch(url)
|
|
45
|
+
.then((res) => res.json())
|
|
46
|
+
.then((data) => {
|
|
47
|
+
Object.keys(data).forEach((item) => {
|
|
48
|
+
for (let key in data[item]) {
|
|
49
|
+
TRANSLATIONS[item][key] = data[item][key];
|
|
50
|
+
}
|
|
51
|
+
});
|
|
52
|
+
resolve(true);
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
export const translate = (key, customLang, values) => {
|
|
57
|
+
const lang = customLang;
|
|
58
|
+
let translation = TRANSLATIONS[lang !== undefined && SUPPORTED_LANGUAGES.includes(lang) ? lang : DEFAULT_LANGUAGE][key];
|
|
59
|
+
if (values !== undefined) {
|
|
60
|
+
for (const [key, value] of Object.entries(values.values)) {
|
|
61
|
+
const regex = new RegExp(`{${key}}`, 'g');
|
|
62
|
+
translation = translation.replace(regex, value);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return translation;
|
|
66
|
+
};
|