@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.
Files changed (278) hide show
  1. package/README.md +1 -0
  2. package/lib/commonjs/ConsentManager.js +29 -1
  3. package/lib/commonjs/ConsentManager.js.map +1 -1
  4. package/lib/commonjs/components/Button.js +27 -12
  5. package/lib/commonjs/components/Button.js.map +1 -1
  6. package/lib/commonjs/context.js +2 -1
  7. package/lib/commonjs/context.js.map +1 -1
  8. package/lib/commonjs/iab/tcf/consent.js +0 -5
  9. package/lib/commonjs/iab/tcf/consent.js.map +1 -1
  10. package/lib/commonjs/index.js +25 -6
  11. package/lib/commonjs/index.js.map +1 -1
  12. package/lib/commonjs/locale/af.json +324 -321
  13. package/lib/commonjs/locale/ar.json +324 -321
  14. package/lib/commonjs/locale/bg.json +324 -321
  15. package/lib/commonjs/locale/ca.json +324 -321
  16. package/lib/commonjs/locale/cs.json +324 -321
  17. package/lib/commonjs/locale/da.json +324 -321
  18. package/lib/commonjs/locale/de-at.json +324 -321
  19. package/lib/commonjs/locale/de.json +324 -321
  20. package/lib/commonjs/locale/el.json +324 -321
  21. package/lib/commonjs/locale/en-au.json +324 -321
  22. package/lib/commonjs/locale/en-ca.json +324 -321
  23. package/lib/commonjs/locale/en-gb.json +324 -321
  24. package/lib/commonjs/locale/en.json +324 -321
  25. package/lib/commonjs/locale/es-mx.json +324 -321
  26. package/lib/commonjs/locale/es.json +324 -321
  27. package/lib/commonjs/locale/et.json +324 -321
  28. package/lib/commonjs/locale/fa.json +324 -321
  29. package/lib/commonjs/locale/fi.json +324 -321
  30. package/lib/commonjs/locale/fr-ca.json +324 -321
  31. package/lib/commonjs/locale/fr.json +324 -321
  32. package/lib/commonjs/locale/gd.json +324 -321
  33. package/lib/commonjs/locale/he.json +324 -321
  34. package/lib/commonjs/locale/hi.json +324 -321
  35. package/lib/commonjs/locale/hr.json +324 -321
  36. package/lib/commonjs/locale/hu.json +324 -321
  37. package/lib/commonjs/locale/hy.json +324 -321
  38. package/lib/commonjs/locale/id.json +324 -321
  39. package/lib/commonjs/locale/is.json +324 -321
  40. package/lib/commonjs/locale/it.json +324 -321
  41. package/lib/commonjs/locale/ja.json +324 -321
  42. package/lib/commonjs/locale/kk.json +324 -321
  43. package/lib/commonjs/locale/ko.json +324 -321
  44. package/lib/commonjs/locale/lt.json +324 -321
  45. package/lib/commonjs/locale/lv.json +324 -321
  46. package/lib/commonjs/locale/mi.json +324 -321
  47. package/lib/commonjs/locale/ms.json +324 -321
  48. package/lib/commonjs/locale/nb.json +324 -321
  49. package/lib/commonjs/locale/nl-be.json +324 -321
  50. package/lib/commonjs/locale/nl.json +324 -321
  51. package/lib/commonjs/locale/nn.json +324 -321
  52. package/lib/commonjs/locale/no.json +324 -321
  53. package/lib/commonjs/locale/pl.json +324 -321
  54. package/lib/commonjs/locale/pt-br.json +324 -321
  55. package/lib/commonjs/locale/pt.json +324 -321
  56. package/lib/commonjs/locale/ro.json +324 -321
  57. package/lib/commonjs/locale/ru.json +324 -321
  58. package/lib/commonjs/locale/sk.json +324 -321
  59. package/lib/commonjs/locale/sl.json +324 -321
  60. package/lib/commonjs/locale/sq.json +324 -321
  61. package/lib/commonjs/locale/sr.json +324 -321
  62. package/lib/commonjs/locale/sv.json +324 -321
  63. package/lib/commonjs/locale/th.json +324 -321
  64. package/lib/commonjs/locale/tl.json +324 -321
  65. package/lib/commonjs/locale/tr.json +324 -321
  66. package/lib/commonjs/locale/uk.json +324 -321
  67. package/lib/commonjs/locale/vi.json +324 -321
  68. package/lib/commonjs/locale/zh-hk.json +324 -321
  69. package/lib/commonjs/locale/zh-tw.json +324 -321
  70. package/lib/commonjs/locale/zh.json +324 -321
  71. package/lib/commonjs/locale/zu.json +324 -321
  72. package/lib/commonjs/selectors.js +1 -1
  73. package/lib/commonjs/selectors.js.map +1 -1
  74. package/lib/commonjs/services/consent.js +54 -3
  75. package/lib/commonjs/services/consent.js.map +1 -1
  76. package/lib/commonjs/utils/EventEmitter.js +0 -2
  77. package/lib/commonjs/utils/EventEmitter.js.map +1 -1
  78. package/lib/commonjs/utils/Translator.js +2 -2
  79. package/lib/commonjs/utils/Translator.js.map +1 -1
  80. package/lib/commonjs/views/Dialog/Message.js +2 -2
  81. package/lib/commonjs/views/Dialog/Message.js.map +1 -1
  82. package/lib/commonjs/views/Dialog/index.js +1 -0
  83. package/lib/commonjs/views/Dialog/index.js.map +1 -1
  84. package/lib/commonjs/views/Drawer/index.js +1 -0
  85. package/lib/commonjs/views/Drawer/index.js.map +1 -1
  86. package/lib/module/ConsentManager.js +30 -2
  87. package/lib/module/ConsentManager.js.map +1 -1
  88. package/lib/module/components/Button.js +27 -12
  89. package/lib/module/components/Button.js.map +1 -1
  90. package/lib/module/context.js +2 -1
  91. package/lib/module/context.js.map +1 -1
  92. package/lib/module/iab/tcf/consent.js +0 -5
  93. package/lib/module/iab/tcf/consent.js.map +1 -1
  94. package/lib/module/index.js +25 -6
  95. package/lib/module/index.js.map +1 -1
  96. package/lib/module/locale/af.json +324 -321
  97. package/lib/module/locale/ar.json +324 -321
  98. package/lib/module/locale/bg.json +324 -321
  99. package/lib/module/locale/ca.json +324 -321
  100. package/lib/module/locale/cs.json +324 -321
  101. package/lib/module/locale/da.json +324 -321
  102. package/lib/module/locale/de-at.json +324 -321
  103. package/lib/module/locale/de.json +324 -321
  104. package/lib/module/locale/el.json +324 -321
  105. package/lib/module/locale/en-au.json +324 -321
  106. package/lib/module/locale/en-ca.json +324 -321
  107. package/lib/module/locale/en-gb.json +324 -321
  108. package/lib/module/locale/en.json +324 -321
  109. package/lib/module/locale/es-mx.json +324 -321
  110. package/lib/module/locale/es.json +324 -321
  111. package/lib/module/locale/et.json +324 -321
  112. package/lib/module/locale/fa.json +324 -321
  113. package/lib/module/locale/fi.json +324 -321
  114. package/lib/module/locale/fr-ca.json +324 -321
  115. package/lib/module/locale/fr.json +324 -321
  116. package/lib/module/locale/gd.json +324 -321
  117. package/lib/module/locale/he.json +324 -321
  118. package/lib/module/locale/hi.json +324 -321
  119. package/lib/module/locale/hr.json +324 -321
  120. package/lib/module/locale/hu.json +324 -321
  121. package/lib/module/locale/hy.json +324 -321
  122. package/lib/module/locale/id.json +324 -321
  123. package/lib/module/locale/is.json +324 -321
  124. package/lib/module/locale/it.json +324 -321
  125. package/lib/module/locale/ja.json +324 -321
  126. package/lib/module/locale/kk.json +324 -321
  127. package/lib/module/locale/ko.json +324 -321
  128. package/lib/module/locale/lt.json +324 -321
  129. package/lib/module/locale/lv.json +324 -321
  130. package/lib/module/locale/mi.json +324 -321
  131. package/lib/module/locale/ms.json +324 -321
  132. package/lib/module/locale/nb.json +324 -321
  133. package/lib/module/locale/nl-be.json +324 -321
  134. package/lib/module/locale/nl.json +324 -321
  135. package/lib/module/locale/nn.json +324 -321
  136. package/lib/module/locale/no.json +324 -321
  137. package/lib/module/locale/pl.json +324 -321
  138. package/lib/module/locale/pt-br.json +324 -321
  139. package/lib/module/locale/pt.json +324 -321
  140. package/lib/module/locale/ro.json +324 -321
  141. package/lib/module/locale/ru.json +324 -321
  142. package/lib/module/locale/sk.json +324 -321
  143. package/lib/module/locale/sl.json +324 -321
  144. package/lib/module/locale/sq.json +324 -321
  145. package/lib/module/locale/sr.json +324 -321
  146. package/lib/module/locale/sv.json +324 -321
  147. package/lib/module/locale/th.json +324 -321
  148. package/lib/module/locale/tl.json +324 -321
  149. package/lib/module/locale/tr.json +324 -321
  150. package/lib/module/locale/uk.json +324 -321
  151. package/lib/module/locale/vi.json +324 -321
  152. package/lib/module/locale/zh-hk.json +324 -321
  153. package/lib/module/locale/zh-tw.json +324 -321
  154. package/lib/module/locale/zh.json +324 -321
  155. package/lib/module/locale/zu.json +324 -321
  156. package/lib/module/selectors.js +1 -1
  157. package/lib/module/selectors.js.map +1 -1
  158. package/lib/module/services/consent.js +48 -1
  159. package/lib/module/services/consent.js.map +1 -1
  160. package/lib/module/utils/EventEmitter.js +0 -2
  161. package/lib/module/utils/EventEmitter.js.map +1 -1
  162. package/lib/module/utils/Translator.js +2 -2
  163. package/lib/module/utils/Translator.js.map +1 -1
  164. package/lib/module/views/Dialog/Message.js +2 -2
  165. package/lib/module/views/Dialog/Message.js.map +1 -1
  166. package/lib/module/views/Dialog/index.js +1 -0
  167. package/lib/module/views/Dialog/index.js.map +1 -1
  168. package/lib/module/views/Drawer/index.js +1 -0
  169. package/lib/module/views/Drawer/index.js.map +1 -1
  170. package/lib/typescript/lib/commonjs/ConsentManager.d.ts +2 -1
  171. package/lib/typescript/lib/commonjs/ConsentManager.d.ts.map +1 -1
  172. package/lib/typescript/lib/commonjs/components/Button.d.ts.map +1 -1
  173. package/lib/typescript/lib/commonjs/iab/tcf/consent.d.ts.map +1 -1
  174. package/lib/typescript/lib/commonjs/services/consent.d.ts +4 -0
  175. package/lib/typescript/lib/commonjs/services/consent.d.ts.map +1 -1
  176. package/lib/typescript/lib/commonjs/utils/EventEmitter.d.ts.map +1 -1
  177. package/lib/typescript/lib/commonjs/views/Dialog/index.d.ts.map +1 -1
  178. package/lib/typescript/lib/commonjs/views/Drawer/index.d.ts.map +1 -1
  179. package/lib/typescript/lib/module/ConsentManager.d.ts +1 -0
  180. package/lib/typescript/lib/module/ConsentManager.d.ts.map +1 -1
  181. package/lib/typescript/lib/module/components/Button.d.ts.map +1 -1
  182. package/lib/typescript/lib/module/context.d.ts +1 -0
  183. package/lib/typescript/lib/module/context.d.ts.map +1 -1
  184. package/lib/typescript/lib/module/iab/tcf/consent.d.ts.map +1 -1
  185. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  186. package/lib/typescript/lib/module/services/consent.d.ts +4 -0
  187. package/lib/typescript/lib/module/services/consent.d.ts.map +1 -1
  188. package/lib/typescript/lib/module/utils/EventEmitter.d.ts.map +1 -1
  189. package/lib/typescript/lib/module/views/Dialog/index.d.ts.map +1 -1
  190. package/lib/typescript/lib/module/views/Drawer/index.d.ts.map +1 -1
  191. package/lib/typescript/src/ConsentManager.d.ts +1 -0
  192. package/lib/typescript/src/ConsentManager.d.ts.map +1 -1
  193. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  194. package/lib/typescript/src/context.d.ts +1 -0
  195. package/lib/typescript/src/context.d.ts.map +1 -1
  196. package/lib/typescript/src/iab/tcf/consent.d.ts.map +1 -1
  197. package/lib/typescript/src/index.d.ts.map +1 -1
  198. package/lib/typescript/src/selectors.d.ts.map +1 -1
  199. package/lib/typescript/src/services/consent.d.ts +12 -1
  200. package/lib/typescript/src/services/consent.d.ts.map +1 -1
  201. package/lib/typescript/src/utils/EventEmitter.d.ts.map +1 -1
  202. package/lib/typescript/src/views/Dialog/Message.d.ts.map +1 -1
  203. package/lib/typescript/src/views/Dialog/index.d.ts.map +1 -1
  204. package/lib/typescript/src/views/Drawer/index.d.ts.map +1 -1
  205. package/package.json +1 -1
  206. package/src/ConsentManager.ts +42 -1
  207. package/src/components/Button.tsx +22 -12
  208. package/src/context.ts +8 -6
  209. package/src/iab/tcf/consent.ts +11 -16
  210. package/src/index.tsx +42 -14
  211. package/src/locale/af.json +324 -321
  212. package/src/locale/ar.json +324 -321
  213. package/src/locale/bg.json +324 -321
  214. package/src/locale/ca.json +324 -321
  215. package/src/locale/cs.json +324 -321
  216. package/src/locale/da.json +324 -321
  217. package/src/locale/de-at.json +324 -321
  218. package/src/locale/de.json +324 -321
  219. package/src/locale/el.json +324 -321
  220. package/src/locale/en-au.json +324 -321
  221. package/src/locale/en-ca.json +324 -321
  222. package/src/locale/en-gb.json +324 -321
  223. package/src/locale/en.json +324 -321
  224. package/src/locale/es-mx.json +324 -321
  225. package/src/locale/es.json +324 -321
  226. package/src/locale/et.json +324 -321
  227. package/src/locale/fa.json +324 -321
  228. package/src/locale/fi.json +324 -321
  229. package/src/locale/fr-ca.json +324 -321
  230. package/src/locale/fr.json +324 -321
  231. package/src/locale/gd.json +324 -321
  232. package/src/locale/he.json +324 -321
  233. package/src/locale/hi.json +324 -321
  234. package/src/locale/hr.json +324 -321
  235. package/src/locale/hu.json +324 -321
  236. package/src/locale/hy.json +324 -321
  237. package/src/locale/id.json +324 -321
  238. package/src/locale/is.json +324 -321
  239. package/src/locale/it.json +324 -321
  240. package/src/locale/ja.json +324 -321
  241. package/src/locale/kk.json +324 -321
  242. package/src/locale/ko.json +324 -321
  243. package/src/locale/lt.json +324 -321
  244. package/src/locale/lv.json +324 -321
  245. package/src/locale/mi.json +324 -321
  246. package/src/locale/ms.json +324 -321
  247. package/src/locale/nb.json +324 -321
  248. package/src/locale/nl-be.json +324 -321
  249. package/src/locale/nl.json +324 -321
  250. package/src/locale/nn.json +324 -321
  251. package/src/locale/no.json +324 -321
  252. package/src/locale/pl.json +324 -321
  253. package/src/locale/pt-br.json +324 -321
  254. package/src/locale/pt.json +324 -321
  255. package/src/locale/ro.json +324 -321
  256. package/src/locale/ru.json +324 -321
  257. package/src/locale/sk.json +324 -321
  258. package/src/locale/sl.json +324 -321
  259. package/src/locale/sq.json +324 -321
  260. package/src/locale/sr.json +324 -321
  261. package/src/locale/sv.json +324 -321
  262. package/src/locale/th.json +324 -321
  263. package/src/locale/tl.json +324 -321
  264. package/src/locale/tr.json +324 -321
  265. package/src/locale/uk.json +324 -321
  266. package/src/locale/vi.json +324 -321
  267. package/src/locale/zh-hk.json +324 -321
  268. package/src/locale/zh-tw.json +324 -321
  269. package/src/locale/zh.json +324 -321
  270. package/src/locale/zu.json +324 -321
  271. package/src/selectors.ts +1 -0
  272. package/src/services/consent.ts +66 -1
  273. package/src/types/consent-config.d.ts +0 -3
  274. package/src/utils/EventEmitter.ts +1 -3
  275. package/src/utils/Translator.ts +15 -15
  276. package/src/views/Dialog/Message.tsx +2 -1
  277. package/src/views/Dialog/index.tsx +1 -0
  278. 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
@@ -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
- return null;
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
+ };
@@ -70,9 +70,6 @@ export type Config = {
70
70
  type?: Flavor;
71
71
  variant: 'one' | 'two' | 'three' | 'four' | 'five' | 'six' | '' | undefined;
72
72
  country: string;
73
- region: string;
74
- iab: Iab;
75
- palette: Palette;
76
73
  additionalLinks: string[][];
77
74
  iabEnabled: boolean;
78
75
  };
@@ -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
 
@@ -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?.shift();
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.ESSENTIAL.label')}`.toLowerCase();
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'),
@@ -305,6 +305,7 @@ export const Dialog = (): ReactElement<Modal> => {
305
305
  ]}
306
306
  />
307
307
  <CloseButton
308
+ testID="close-dialog"
308
309
  onPress={handleClose}
309
310
  style={[
310
311
  styles.close,
@@ -259,6 +259,7 @@ export const Drawer: React.FC<DrawerProps> = () => {
259
259
  ]}
260
260
  >
261
261
  <CloseButton
262
+ testID="close-drawer"
262
263
  style={isRTL ? styles.closeLeft : styles.closeRight}
263
264
  color={infoDialogForegroundColor}
264
265
  />