@osano/osano-cmp-react-native 0.10.0 → 0.12.0
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/README.md +1 -0
- package/lib/commonjs/ConsentManager.js +29 -1
- package/lib/commonjs/ConsentManager.js.map +1 -1
- package/lib/commonjs/components/Button.js +27 -12
- package/lib/commonjs/components/Button.js.map +1 -1
- package/lib/commonjs/context.js +2 -1
- package/lib/commonjs/context.js.map +1 -1
- package/lib/commonjs/iab/tcf/consent.js +0 -5
- package/lib/commonjs/iab/tcf/consent.js.map +1 -1
- package/lib/commonjs/index.js +25 -6
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/locale/af.json +324 -321
- package/lib/commonjs/locale/ar.json +324 -321
- package/lib/commonjs/locale/bg.json +324 -321
- package/lib/commonjs/locale/ca.json +324 -321
- package/lib/commonjs/locale/cs.json +324 -321
- package/lib/commonjs/locale/da.json +324 -321
- package/lib/commonjs/locale/de-at.json +324 -321
- package/lib/commonjs/locale/de.json +324 -321
- package/lib/commonjs/locale/el.json +324 -321
- package/lib/commonjs/locale/en-au.json +324 -321
- package/lib/commonjs/locale/en-ca.json +324 -321
- package/lib/commonjs/locale/en-gb.json +324 -321
- package/lib/commonjs/locale/en.json +324 -321
- package/lib/commonjs/locale/es-mx.json +324 -321
- package/lib/commonjs/locale/es.json +324 -321
- package/lib/commonjs/locale/et.json +324 -321
- package/lib/commonjs/locale/fa.json +324 -321
- package/lib/commonjs/locale/fi.json +324 -321
- package/lib/commonjs/locale/fr-ca.json +324 -321
- package/lib/commonjs/locale/fr.json +324 -321
- package/lib/commonjs/locale/gd.json +324 -321
- package/lib/commonjs/locale/he.json +324 -321
- package/lib/commonjs/locale/hi.json +324 -321
- package/lib/commonjs/locale/hr.json +324 -321
- package/lib/commonjs/locale/hu.json +324 -321
- package/lib/commonjs/locale/hy.json +324 -321
- package/lib/commonjs/locale/id.json +324 -321
- package/lib/commonjs/locale/is.json +324 -321
- package/lib/commonjs/locale/it.json +324 -321
- package/lib/commonjs/locale/ja.json +324 -321
- package/lib/commonjs/locale/kk.json +324 -321
- package/lib/commonjs/locale/ko.json +324 -321
- package/lib/commonjs/locale/lt.json +324 -321
- package/lib/commonjs/locale/lv.json +324 -321
- package/lib/commonjs/locale/mi.json +324 -321
- package/lib/commonjs/locale/ms.json +324 -321
- package/lib/commonjs/locale/nb.json +324 -321
- package/lib/commonjs/locale/nl-be.json +324 -321
- package/lib/commonjs/locale/nl.json +324 -321
- package/lib/commonjs/locale/nn.json +324 -321
- package/lib/commonjs/locale/no.json +324 -321
- package/lib/commonjs/locale/pl.json +324 -321
- package/lib/commonjs/locale/pt-br.json +324 -321
- package/lib/commonjs/locale/pt.json +324 -321
- package/lib/commonjs/locale/ro.json +324 -321
- package/lib/commonjs/locale/ru.json +324 -321
- package/lib/commonjs/locale/sk.json +324 -321
- package/lib/commonjs/locale/sl.json +324 -321
- package/lib/commonjs/locale/sq.json +324 -321
- package/lib/commonjs/locale/sr.json +324 -321
- package/lib/commonjs/locale/sv.json +324 -321
- package/lib/commonjs/locale/th.json +324 -321
- package/lib/commonjs/locale/tl.json +324 -321
- package/lib/commonjs/locale/tr.json +324 -321
- package/lib/commonjs/locale/uk.json +324 -321
- package/lib/commonjs/locale/vi.json +324 -321
- package/lib/commonjs/locale/zh-hk.json +324 -321
- package/lib/commonjs/locale/zh-tw.json +324 -321
- package/lib/commonjs/locale/zh.json +324 -321
- package/lib/commonjs/locale/zu.json +324 -321
- package/lib/commonjs/selectors.js +1 -1
- package/lib/commonjs/selectors.js.map +1 -1
- package/lib/commonjs/services/consent.js +54 -3
- package/lib/commonjs/services/consent.js.map +1 -1
- package/lib/commonjs/utils/EventEmitter.js +0 -2
- package/lib/commonjs/utils/EventEmitter.js.map +1 -1
- package/lib/commonjs/utils/Translator.js +2 -2
- package/lib/commonjs/utils/Translator.js.map +1 -1
- package/lib/commonjs/views/Dialog/Message.js +2 -2
- package/lib/commonjs/views/Dialog/Message.js.map +1 -1
- package/lib/commonjs/views/Dialog/index.js +1 -0
- package/lib/commonjs/views/Dialog/index.js.map +1 -1
- package/lib/commonjs/views/Drawer/index.js +1 -0
- package/lib/commonjs/views/Drawer/index.js.map +1 -1
- package/lib/module/ConsentManager.js +30 -2
- package/lib/module/ConsentManager.js.map +1 -1
- package/lib/module/components/Button.js +27 -12
- package/lib/module/components/Button.js.map +1 -1
- package/lib/module/context.js +2 -1
- package/lib/module/context.js.map +1 -1
- package/lib/module/iab/tcf/consent.js +0 -5
- package/lib/module/iab/tcf/consent.js.map +1 -1
- package/lib/module/index.js +25 -6
- package/lib/module/index.js.map +1 -1
- package/lib/module/locale/af.json +324 -321
- package/lib/module/locale/ar.json +324 -321
- package/lib/module/locale/bg.json +324 -321
- package/lib/module/locale/ca.json +324 -321
- package/lib/module/locale/cs.json +324 -321
- package/lib/module/locale/da.json +324 -321
- package/lib/module/locale/de-at.json +324 -321
- package/lib/module/locale/de.json +324 -321
- package/lib/module/locale/el.json +324 -321
- package/lib/module/locale/en-au.json +324 -321
- package/lib/module/locale/en-ca.json +324 -321
- package/lib/module/locale/en-gb.json +324 -321
- package/lib/module/locale/en.json +324 -321
- package/lib/module/locale/es-mx.json +324 -321
- package/lib/module/locale/es.json +324 -321
- package/lib/module/locale/et.json +324 -321
- package/lib/module/locale/fa.json +324 -321
- package/lib/module/locale/fi.json +324 -321
- package/lib/module/locale/fr-ca.json +324 -321
- package/lib/module/locale/fr.json +324 -321
- package/lib/module/locale/gd.json +324 -321
- package/lib/module/locale/he.json +324 -321
- package/lib/module/locale/hi.json +324 -321
- package/lib/module/locale/hr.json +324 -321
- package/lib/module/locale/hu.json +324 -321
- package/lib/module/locale/hy.json +324 -321
- package/lib/module/locale/id.json +324 -321
- package/lib/module/locale/is.json +324 -321
- package/lib/module/locale/it.json +324 -321
- package/lib/module/locale/ja.json +324 -321
- package/lib/module/locale/kk.json +324 -321
- package/lib/module/locale/ko.json +324 -321
- package/lib/module/locale/lt.json +324 -321
- package/lib/module/locale/lv.json +324 -321
- package/lib/module/locale/mi.json +324 -321
- package/lib/module/locale/ms.json +324 -321
- package/lib/module/locale/nb.json +324 -321
- package/lib/module/locale/nl-be.json +324 -321
- package/lib/module/locale/nl.json +324 -321
- package/lib/module/locale/nn.json +324 -321
- package/lib/module/locale/no.json +324 -321
- package/lib/module/locale/pl.json +324 -321
- package/lib/module/locale/pt-br.json +324 -321
- package/lib/module/locale/pt.json +324 -321
- package/lib/module/locale/ro.json +324 -321
- package/lib/module/locale/ru.json +324 -321
- package/lib/module/locale/sk.json +324 -321
- package/lib/module/locale/sl.json +324 -321
- package/lib/module/locale/sq.json +324 -321
- package/lib/module/locale/sr.json +324 -321
- package/lib/module/locale/sv.json +324 -321
- package/lib/module/locale/th.json +324 -321
- package/lib/module/locale/tl.json +324 -321
- package/lib/module/locale/tr.json +324 -321
- package/lib/module/locale/uk.json +324 -321
- package/lib/module/locale/vi.json +324 -321
- package/lib/module/locale/zh-hk.json +324 -321
- package/lib/module/locale/zh-tw.json +324 -321
- package/lib/module/locale/zh.json +324 -321
- package/lib/module/locale/zu.json +324 -321
- package/lib/module/selectors.js +1 -1
- package/lib/module/selectors.js.map +1 -1
- package/lib/module/services/consent.js +48 -1
- package/lib/module/services/consent.js.map +1 -1
- package/lib/module/utils/EventEmitter.js +0 -2
- package/lib/module/utils/EventEmitter.js.map +1 -1
- package/lib/module/utils/Translator.js +2 -2
- package/lib/module/utils/Translator.js.map +1 -1
- package/lib/module/views/Dialog/Message.js +2 -2
- package/lib/module/views/Dialog/Message.js.map +1 -1
- package/lib/module/views/Dialog/index.js +1 -0
- package/lib/module/views/Dialog/index.js.map +1 -1
- package/lib/module/views/Drawer/index.js +1 -0
- package/lib/module/views/Drawer/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/ConsentManager.d.ts +2 -1
- package/lib/typescript/lib/commonjs/ConsentManager.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/components/Button.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/tcf/consent.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/services/consent.d.ts +4 -0
- package/lib/typescript/lib/commonjs/services/consent.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/utils/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/views/Dialog/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/views/Drawer/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/ConsentManager.d.ts +1 -0
- package/lib/typescript/lib/module/ConsentManager.d.ts.map +1 -1
- package/lib/typescript/lib/module/components/Button.d.ts.map +1 -1
- package/lib/typescript/lib/module/context.d.ts +1 -0
- package/lib/typescript/lib/module/context.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/tcf/consent.d.ts.map +1 -1
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/services/consent.d.ts +4 -0
- package/lib/typescript/lib/module/services/consent.d.ts.map +1 -1
- package/lib/typescript/lib/module/utils/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/lib/module/views/Dialog/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/views/Drawer/index.d.ts.map +1 -1
- package/lib/typescript/src/ConsentManager.d.ts +1 -0
- package/lib/typescript/src/ConsentManager.d.ts.map +1 -1
- package/lib/typescript/src/components/Button.d.ts.map +1 -1
- package/lib/typescript/src/context.d.ts +1 -0
- package/lib/typescript/src/context.d.ts.map +1 -1
- package/lib/typescript/src/iab/tcf/consent.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/selectors.d.ts.map +1 -1
- package/lib/typescript/src/services/consent.d.ts +12 -1
- package/lib/typescript/src/services/consent.d.ts.map +1 -1
- package/lib/typescript/src/utils/EventEmitter.d.ts.map +1 -1
- package/lib/typescript/src/views/Dialog/Message.d.ts.map +1 -1
- package/lib/typescript/src/views/Dialog/index.d.ts.map +1 -1
- package/lib/typescript/src/views/Drawer/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ConsentManager.ts +42 -1
- package/src/components/Button.tsx +22 -12
- package/src/context.ts +8 -6
- package/src/iab/tcf/consent.ts +11 -16
- package/src/index.tsx +42 -14
- package/src/locale/af.json +324 -321
- package/src/locale/ar.json +324 -321
- package/src/locale/bg.json +324 -321
- package/src/locale/ca.json +324 -321
- package/src/locale/cs.json +324 -321
- package/src/locale/da.json +324 -321
- package/src/locale/de-at.json +324 -321
- package/src/locale/de.json +324 -321
- package/src/locale/el.json +324 -321
- package/src/locale/en-au.json +324 -321
- package/src/locale/en-ca.json +324 -321
- package/src/locale/en-gb.json +324 -321
- package/src/locale/en.json +324 -321
- package/src/locale/es-mx.json +324 -321
- package/src/locale/es.json +324 -321
- package/src/locale/et.json +324 -321
- package/src/locale/fa.json +324 -321
- package/src/locale/fi.json +324 -321
- package/src/locale/fr-ca.json +324 -321
- package/src/locale/fr.json +324 -321
- package/src/locale/gd.json +324 -321
- package/src/locale/he.json +324 -321
- package/src/locale/hi.json +324 -321
- package/src/locale/hr.json +324 -321
- package/src/locale/hu.json +324 -321
- package/src/locale/hy.json +324 -321
- package/src/locale/id.json +324 -321
- package/src/locale/is.json +324 -321
- package/src/locale/it.json +324 -321
- package/src/locale/ja.json +324 -321
- package/src/locale/kk.json +324 -321
- package/src/locale/ko.json +324 -321
- package/src/locale/lt.json +324 -321
- package/src/locale/lv.json +324 -321
- package/src/locale/mi.json +324 -321
- package/src/locale/ms.json +324 -321
- package/src/locale/nb.json +324 -321
- package/src/locale/nl-be.json +324 -321
- package/src/locale/nl.json +324 -321
- package/src/locale/nn.json +324 -321
- package/src/locale/no.json +324 -321
- package/src/locale/pl.json +324 -321
- package/src/locale/pt-br.json +324 -321
- package/src/locale/pt.json +324 -321
- package/src/locale/ro.json +324 -321
- package/src/locale/ru.json +324 -321
- package/src/locale/sk.json +324 -321
- package/src/locale/sl.json +324 -321
- package/src/locale/sq.json +324 -321
- package/src/locale/sr.json +324 -321
- package/src/locale/sv.json +324 -321
- package/src/locale/th.json +324 -321
- package/src/locale/tl.json +324 -321
- package/src/locale/tr.json +324 -321
- package/src/locale/uk.json +324 -321
- package/src/locale/vi.json +324 -321
- package/src/locale/zh-hk.json +324 -321
- package/src/locale/zh-tw.json +324 -321
- package/src/locale/zh.json +324 -321
- package/src/locale/zu.json +324 -321
- package/src/selectors.ts +1 -0
- package/src/services/consent.ts +66 -1
- package/src/types/consent-config.d.ts +0 -3
- package/src/utils/EventEmitter.ts +1 -3
- package/src/utils/Translator.ts +15 -15
- package/src/views/Dialog/Message.tsx +2 -1
- package/src/views/Dialog/index.tsx +1 -0
- package/src/views/Drawer/index.tsx +1 -0
package/src/selectors.ts
CHANGED
|
@@ -30,6 +30,7 @@ export const isDialogOpen = (state: OsanoState) =>
|
|
|
30
30
|
|
|
31
31
|
export const isGPCSupportEnabled = (state: OsanoState) =>
|
|
32
32
|
!!state.config?.gpcSupport &&
|
|
33
|
+
typeof navigator !== 'undefined' &&
|
|
33
34
|
// Native browser support uses Navigator.prototype
|
|
34
35
|
(Object.hasOwnProperty.call(navigator, 'globalPrivacyControl') ||
|
|
35
36
|
// Browser extension support uses the Navigator instance on window
|
package/src/services/consent.ts
CHANGED
|
@@ -305,6 +305,71 @@ export const fetchConfig = (customerId: string, configId: string) => {
|
|
|
305
305
|
})
|
|
306
306
|
.catch(() => {
|
|
307
307
|
// Consent not found or network/server error
|
|
308
|
-
|
|
308
|
+
throw new Error('Error fetching config');
|
|
309
309
|
});
|
|
310
310
|
};
|
|
311
|
+
|
|
312
|
+
export const getStoredConfig = async (
|
|
313
|
+
configId: string,
|
|
314
|
+
): Promise<Config | null> => {
|
|
315
|
+
try {
|
|
316
|
+
const config = await getStorage(`${STORAGE_KEY}_${configId}_config`);
|
|
317
|
+
if (config) {
|
|
318
|
+
return JSON.parse(config) as Config;
|
|
319
|
+
}
|
|
320
|
+
} catch (error) {
|
|
321
|
+
// Failed to retrieve config
|
|
322
|
+
}
|
|
323
|
+
return null;
|
|
324
|
+
};
|
|
325
|
+
|
|
326
|
+
export const storeConfig = async (
|
|
327
|
+
configId: string,
|
|
328
|
+
config: Config,
|
|
329
|
+
): Promise<void> => {
|
|
330
|
+
try {
|
|
331
|
+
await Promise.all([
|
|
332
|
+
setStorage(`${STORAGE_KEY}_${configId}_config`, JSON.stringify(config)),
|
|
333
|
+
setStorage(
|
|
334
|
+
`${STORAGE_KEY}_${configId}_config_last_stored_at`,
|
|
335
|
+
JSON.stringify(new Date()),
|
|
336
|
+
),
|
|
337
|
+
]);
|
|
338
|
+
} catch (error) {
|
|
339
|
+
throw new Error('Failed to store config');
|
|
340
|
+
}
|
|
341
|
+
};
|
|
342
|
+
|
|
343
|
+
export const getConfigLastStoredAt = async (
|
|
344
|
+
configId: string,
|
|
345
|
+
): Promise<Date | null> => {
|
|
346
|
+
try {
|
|
347
|
+
const lastStoredAt = await getStorage(
|
|
348
|
+
`${STORAGE_KEY}_${configId}_config_last_stored_at`,
|
|
349
|
+
);
|
|
350
|
+
if (lastStoredAt) {
|
|
351
|
+
return new Date(JSON.parse(lastStoredAt));
|
|
352
|
+
}
|
|
353
|
+
} catch (error) {
|
|
354
|
+
// Failed to retrieve last stored at
|
|
355
|
+
}
|
|
356
|
+
return null;
|
|
357
|
+
};
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Determine if a cached config is stale
|
|
361
|
+
*
|
|
362
|
+
* @async
|
|
363
|
+
* @param {string} configId
|
|
364
|
+
* @returns {Promise<boolean>}
|
|
365
|
+
*/
|
|
366
|
+
export const hasStaleConfig = async (configId: string): Promise<boolean> => {
|
|
367
|
+
const lastStoredAt = await getConfigLastStoredAt(configId);
|
|
368
|
+
if (!lastStoredAt) {
|
|
369
|
+
return true;
|
|
370
|
+
}
|
|
371
|
+
const now = new Date();
|
|
372
|
+
const diff = now.getTime() - lastStoredAt.getTime();
|
|
373
|
+
const diffInMinutes = Math.floor(diff / 60000);
|
|
374
|
+
return diffInMinutes > 1440; // 24 hours = 1440 minutes
|
|
375
|
+
};
|
|
@@ -19,7 +19,6 @@ export class EventEmitter {
|
|
|
19
19
|
private _events: Record<string, Function[]> = {};
|
|
20
20
|
|
|
21
21
|
on(event: string, listener: Function) {
|
|
22
|
-
// console.log('EventEmitter.on', event, listener);
|
|
23
22
|
if (typeof this._events[event] !== 'object') {
|
|
24
23
|
this._events[event] = [];
|
|
25
24
|
}
|
|
@@ -29,7 +28,6 @@ export class EventEmitter {
|
|
|
29
28
|
}
|
|
30
29
|
|
|
31
30
|
off(event: string, listener: Function) {
|
|
32
|
-
// console.log('EventEmitter.off', event, listener);
|
|
33
31
|
if (typeof this._events[event] === 'object') {
|
|
34
32
|
const idx = this._events[event]!.indexOf(listener);
|
|
35
33
|
if (idx > -1) {
|
|
@@ -40,7 +38,7 @@ export class EventEmitter {
|
|
|
40
38
|
|
|
41
39
|
emit(event: string, ...args: unknown[]) {
|
|
42
40
|
if (typeof this._events[event] === 'object') {
|
|
43
|
-
this._events[event]?.forEach(listener => listener.apply(this, args));
|
|
41
|
+
this._events[event]?.forEach((listener) => listener.apply(this, args));
|
|
44
42
|
}
|
|
45
43
|
}
|
|
46
44
|
|
package/src/utils/Translator.ts
CHANGED
|
@@ -57,7 +57,7 @@ export default class Translator extends EventEmitter {
|
|
|
57
57
|
constructor(
|
|
58
58
|
consentManager: ConsentManager,
|
|
59
59
|
messages: LocalizedStrings = {},
|
|
60
|
-
defaultLocale = 'en'
|
|
60
|
+
defaultLocale = 'en',
|
|
61
61
|
) {
|
|
62
62
|
super();
|
|
63
63
|
this._consentManager = consentManager;
|
|
@@ -103,15 +103,15 @@ export default class Translator extends EventEmitter {
|
|
|
103
103
|
load(
|
|
104
104
|
desiredLocale?: string,
|
|
105
105
|
onLangLoadSuccess?: () => void,
|
|
106
|
-
onLangLoadFailure?: () => void
|
|
106
|
+
onLangLoadFailure?: () => void,
|
|
107
107
|
): Promise<PromiseSettledResult<string | undefined>[]> {
|
|
108
108
|
const allLocales = desiredLocale
|
|
109
109
|
? Translator.fallbackLanguages(
|
|
110
|
-
desiredLocale.toLowerCase().replace(/_/g, '-')
|
|
110
|
+
desiredLocale.toLowerCase().replace(/_/g, '-'),
|
|
111
111
|
)
|
|
112
|
-
: [];
|
|
112
|
+
: [Translator.DEFAULT_LANGUAGE];
|
|
113
113
|
|
|
114
|
-
const locale = allLocales
|
|
114
|
+
const locale = allLocales.shift();
|
|
115
115
|
const customerId = this._consentManager.customerId;
|
|
116
116
|
const configId = this._consentManager.configId;
|
|
117
117
|
this._langLoadFailureSubscription =
|
|
@@ -130,7 +130,7 @@ export default class Translator extends EventEmitter {
|
|
|
130
130
|
} else {
|
|
131
131
|
const localesToTry = [...allLocales];
|
|
132
132
|
globalPromise = this._loading[locale] = fetchGlobalLocalePhrases(
|
|
133
|
-
locale
|
|
133
|
+
locale,
|
|
134
134
|
)
|
|
135
135
|
.then((phrases) => {
|
|
136
136
|
this._currentLocale = locale;
|
|
@@ -146,7 +146,7 @@ export default class Translator extends EventEmitter {
|
|
|
146
146
|
while (nextLocale) {
|
|
147
147
|
try {
|
|
148
148
|
this._loading[`${nextLocale}`] = fetchGlobalLocalePhrases(
|
|
149
|
-
nextLocale
|
|
149
|
+
nextLocale,
|
|
150
150
|
).then((phrases) => {
|
|
151
151
|
this._currentLocale = nextLocale!;
|
|
152
152
|
this.extend(phrases as LocalizedStrings, nextLocale);
|
|
@@ -179,7 +179,7 @@ export default class Translator extends EventEmitter {
|
|
|
179
179
|
] = fetchLocalLocalePhrases(
|
|
180
180
|
this._consentManager.customerId,
|
|
181
181
|
this._consentManager.configId,
|
|
182
|
-
locale
|
|
182
|
+
locale,
|
|
183
183
|
)
|
|
184
184
|
.then((phrases) => {
|
|
185
185
|
this.override(phrases as LocalizedStrings, locale);
|
|
@@ -196,7 +196,7 @@ export default class Translator extends EventEmitter {
|
|
|
196
196
|
fetchLocalLocalePhrases(
|
|
197
197
|
this._consentManager.customerId,
|
|
198
198
|
this._consentManager.configId,
|
|
199
|
-
nextLocale
|
|
199
|
+
nextLocale,
|
|
200
200
|
).then((phrases) => {
|
|
201
201
|
this.override(phrases as LocalizedStrings, nextLocale);
|
|
202
202
|
delete this._loading[
|
|
@@ -217,7 +217,7 @@ export default class Translator extends EventEmitter {
|
|
|
217
217
|
}
|
|
218
218
|
this.emit(
|
|
219
219
|
'langLoadFailure',
|
|
220
|
-
`Locale ${locale} is not available for translation
|
|
220
|
+
`Locale ${locale} is not available for translation`,
|
|
221
221
|
);
|
|
222
222
|
throw error;
|
|
223
223
|
});
|
|
@@ -231,12 +231,12 @@ export default class Translator extends EventEmitter {
|
|
|
231
231
|
} else {
|
|
232
232
|
this.emit(
|
|
233
233
|
'langLoadFailure',
|
|
234
|
-
`Locale ${locale} is not available for translation
|
|
234
|
+
`Locale ${locale} is not available for translation`,
|
|
235
235
|
);
|
|
236
236
|
this._langLoadFailureSubscription?.remove();
|
|
237
237
|
this._langLoadSuccessSubscription?.remove();
|
|
238
238
|
return Promise.reject(
|
|
239
|
-
new Error(`Locale ${locale} is not available for translation`)
|
|
239
|
+
new Error(`Locale ${locale} is not available for translation`),
|
|
240
240
|
);
|
|
241
241
|
}
|
|
242
242
|
}
|
|
@@ -262,10 +262,10 @@ export default class Translator extends EventEmitter {
|
|
|
262
262
|
* Create a translation template for a particular key path
|
|
263
263
|
*/
|
|
264
264
|
template(
|
|
265
|
-
key: string
|
|
265
|
+
key: string,
|
|
266
266
|
): (
|
|
267
267
|
props: string | il8nProps,
|
|
268
|
-
defaultPhrase: string
|
|
268
|
+
defaultPhrase: string,
|
|
269
269
|
) => string | LocalizedStrings {
|
|
270
270
|
return (props: string | il8nProps, defaultPhrase: string) =>
|
|
271
271
|
this.translate(key, props, defaultPhrase);
|
|
@@ -277,7 +277,7 @@ export default class Translator extends EventEmitter {
|
|
|
277
277
|
translate(
|
|
278
278
|
path: string | string[],
|
|
279
279
|
props: string | il8nProps = {},
|
|
280
|
-
defaultPhrase?: string
|
|
280
|
+
defaultPhrase?: string,
|
|
281
281
|
): string | LocalizedStrings {
|
|
282
282
|
const localePassed = typeof props === 'string';
|
|
283
283
|
const locale = localePassed ? props : props.locale || this.locale;
|
|
@@ -8,12 +8,13 @@ export const Message = () => {
|
|
|
8
8
|
const isFirstLayerUsageRequired = config?.firstLayerUsageRequired;
|
|
9
9
|
|
|
10
10
|
const analyticsTranslation =
|
|
11
|
-
`${translate('categories.
|
|
11
|
+
`${translate('categories.ANALYTICS.label')}`.toLowerCase();
|
|
12
12
|
const personalizationTranslation =
|
|
13
13
|
`${translate('categories.PERSONALIZATION.label')}`.toLowerCase();
|
|
14
14
|
const marketingTranslation =
|
|
15
15
|
`${translate('categories.MARKETING.label')}`.toLowerCase();
|
|
16
16
|
const stackTranslations = [
|
|
17
|
+
translate('iab.purposes.1.name'),
|
|
17
18
|
translate('iab.stacks.20.name'),
|
|
18
19
|
translate('iab.stacks.3.name'),
|
|
19
20
|
translate('iab.stacks.44.name'),
|