@osano/osano-cmp-react-native 0.11.0 → 0.13.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 (520) hide show
  1. package/README.dev.md +216 -1
  2. package/README.md +2 -267
  3. package/android/src/main/java/com/OsanoCMPSDK/OsanoCMPSDKModule.kt +41 -0
  4. package/ios/OsanoCmpSDK.mm +42 -0
  5. package/lib/commonjs/ConsentManager.js +82 -11
  6. package/lib/commonjs/ConsentManager.js.map +1 -1
  7. package/lib/commonjs/ConsentUiBuilder.js +10 -7
  8. package/lib/commonjs/ConsentUiBuilder.js.map +1 -1
  9. package/lib/commonjs/commands.js +10 -5
  10. package/lib/commonjs/commands.js.map +1 -1
  11. package/lib/commonjs/components/Button.js +6 -7
  12. package/lib/commonjs/components/Button.js.map +1 -1
  13. package/lib/commonjs/components/Checkbox.js +1 -2
  14. package/lib/commonjs/components/Checkbox.js.map +1 -1
  15. package/lib/commonjs/components/ExpansionPanel.js +1 -2
  16. package/lib/commonjs/components/ExpansionPanel.js.map +1 -1
  17. package/lib/commonjs/components/Link.js +1 -2
  18. package/lib/commonjs/components/Link.js.map +1 -1
  19. package/lib/commonjs/components/StoragePolicyLink.js +1 -2
  20. package/lib/commonjs/components/StoragePolicyLink.js.map +1 -1
  21. package/lib/commonjs/components/Toggle.js +1 -2
  22. package/lib/commonjs/components/Toggle.js.map +1 -1
  23. package/lib/commonjs/context.js +7 -5
  24. package/lib/commonjs/context.js.map +1 -1
  25. package/lib/commonjs/iab/tcf/consent.js +0 -5
  26. package/lib/commonjs/iab/tcf/consent.js.map +1 -1
  27. package/lib/commonjs/iab/tcf/constants.js +34 -1
  28. package/lib/commonjs/iab/tcf/constants.js.map +1 -1
  29. package/lib/commonjs/iab/tcf/iab-storage-utils.js +102 -0
  30. package/lib/commonjs/iab/tcf/iab-storage-utils.js.map +1 -0
  31. package/lib/commonjs/iab/tcf/index.js +1 -2
  32. package/lib/commonjs/iab/tcf/index.js.map +1 -1
  33. package/lib/commonjs/iab/tcf/middleware.js +33 -35
  34. package/lib/commonjs/iab/tcf/middleware.js.map +1 -1
  35. package/lib/commonjs/iab/tcf/selectors.js +1 -1
  36. package/lib/commonjs/iab/tcf/selectors.js.map +1 -1
  37. package/lib/commonjs/iab/tcf/v2.0/shared-constants.js +1 -2
  38. package/lib/commonjs/iab/tcf/v2.0/shared-constants.js.map +1 -1
  39. package/lib/commonjs/index.js +54 -15
  40. package/lib/commonjs/index.js.map +1 -1
  41. package/lib/commonjs/locale/af.json +342 -323
  42. package/lib/commonjs/locale/ar.json +342 -323
  43. package/lib/commonjs/locale/bg.json +342 -323
  44. package/lib/commonjs/locale/ca.json +342 -323
  45. package/lib/commonjs/locale/cs.json +342 -323
  46. package/lib/commonjs/locale/da.json +342 -323
  47. package/lib/commonjs/locale/de-at.json +342 -323
  48. package/lib/commonjs/locale/de.json +342 -323
  49. package/lib/commonjs/locale/el.json +342 -323
  50. package/lib/commonjs/locale/en-au.json +342 -323
  51. package/lib/commonjs/locale/en-ca.json +342 -323
  52. package/lib/commonjs/locale/en-gb.json +342 -323
  53. package/lib/commonjs/locale/en.json +342 -323
  54. package/lib/commonjs/locale/es-mx.json +342 -323
  55. package/lib/commonjs/locale/es.json +342 -323
  56. package/lib/commonjs/locale/et.json +342 -323
  57. package/lib/commonjs/locale/fa.json +342 -323
  58. package/lib/commonjs/locale/fi.json +342 -323
  59. package/lib/commonjs/locale/fr-ca.json +342 -323
  60. package/lib/commonjs/locale/fr.json +342 -323
  61. package/lib/commonjs/locale/gd.json +342 -323
  62. package/lib/commonjs/locale/he.json +342 -323
  63. package/lib/commonjs/locale/hi.json +342 -323
  64. package/lib/commonjs/locale/hr.json +342 -323
  65. package/lib/commonjs/locale/hu.json +342 -323
  66. package/lib/commonjs/locale/hy.json +342 -323
  67. package/lib/commonjs/locale/id.json +342 -323
  68. package/lib/commonjs/locale/is.json +342 -323
  69. package/lib/commonjs/locale/it.json +342 -323
  70. package/lib/commonjs/locale/ja.json +342 -323
  71. package/lib/commonjs/locale/kk.json +342 -323
  72. package/lib/commonjs/locale/ko.json +342 -323
  73. package/lib/commonjs/locale/lt.json +342 -323
  74. package/lib/commonjs/locale/lv.json +342 -323
  75. package/lib/commonjs/locale/mi.json +342 -323
  76. package/lib/commonjs/locale/ms.json +342 -323
  77. package/lib/commonjs/locale/nb.json +342 -323
  78. package/lib/commonjs/locale/nl-be.json +342 -323
  79. package/lib/commonjs/locale/nl.json +342 -323
  80. package/lib/commonjs/locale/nn.json +342 -323
  81. package/lib/commonjs/locale/no.json +342 -323
  82. package/lib/commonjs/locale/pl.json +342 -323
  83. package/lib/commonjs/locale/pt-br.json +342 -323
  84. package/lib/commonjs/locale/pt.json +342 -323
  85. package/lib/commonjs/locale/ro.json +342 -323
  86. package/lib/commonjs/locale/ru.json +342 -323
  87. package/lib/commonjs/locale/sk.json +342 -323
  88. package/lib/commonjs/locale/sl.json +342 -323
  89. package/lib/commonjs/locale/sq.json +342 -323
  90. package/lib/commonjs/locale/sr.json +342 -323
  91. package/lib/commonjs/locale/sv.json +342 -323
  92. package/lib/commonjs/locale/th.json +342 -323
  93. package/lib/commonjs/locale/tl.json +342 -323
  94. package/lib/commonjs/locale/tr.json +342 -323
  95. package/lib/commonjs/locale/uk.json +342 -323
  96. package/lib/commonjs/locale/vi.json +342 -323
  97. package/lib/commonjs/locale/zh-hk.json +342 -323
  98. package/lib/commonjs/locale/zh-tw.json +342 -323
  99. package/lib/commonjs/locale/zh.json +342 -323
  100. package/lib/commonjs/locale/zu.json +342 -323
  101. package/lib/commonjs/native/OsanoCmp.js +16 -0
  102. package/lib/commonjs/native/OsanoCmp.js.map +1 -1
  103. package/lib/commonjs/selectors.js +1 -1
  104. package/lib/commonjs/selectors.js.map +1 -1
  105. package/lib/commonjs/services/consent.js +60 -8
  106. package/lib/commonjs/services/consent.js.map +1 -1
  107. package/lib/commonjs/services/google-consent-mode-mapper.js +109 -0
  108. package/lib/commonjs/services/google-consent-mode-mapper.js.map +1 -0
  109. package/lib/commonjs/types/google-consent-mode.js +73 -0
  110. package/lib/commonjs/types/google-consent-mode.js.map +1 -0
  111. package/lib/commonjs/utils/EventEmitter.js +0 -2
  112. package/lib/commonjs/utils/EventEmitter.js.map +1 -1
  113. package/lib/commonjs/utils/OsanoLogger.js +51 -0
  114. package/lib/commonjs/utils/OsanoLogger.js.map +1 -0
  115. package/lib/commonjs/utils/Translator.js +2 -2
  116. package/lib/commonjs/utils/Translator.js.map +1 -1
  117. package/lib/commonjs/utils/index.js +7 -0
  118. package/lib/commonjs/utils/index.js.map +1 -1
  119. package/lib/commonjs/views/Dialog/Buttons.js +1 -2
  120. package/lib/commonjs/views/Dialog/Buttons.js.map +1 -1
  121. package/lib/commonjs/views/Dialog/FirstLayerUsage.js +1 -2
  122. package/lib/commonjs/views/Dialog/FirstLayerUsage.js.map +1 -1
  123. package/lib/commonjs/views/Dialog/Message.js +1 -2
  124. package/lib/commonjs/views/Dialog/Message.js.map +1 -1
  125. package/lib/commonjs/views/Dialog/PreferenceManagementDeepLinks.js +1 -2
  126. package/lib/commonjs/views/Dialog/PreferenceManagementDeepLinks.js.map +1 -1
  127. package/lib/commonjs/views/Dialog/index.js +1 -2
  128. package/lib/commonjs/views/Dialog/index.js.map +1 -1
  129. package/lib/commonjs/views/Drawer/Drawer.ConsentCategories.js +1 -2
  130. package/lib/commonjs/views/Drawer/Drawer.ConsentCategories.js.map +1 -1
  131. package/lib/commonjs/views/Drawer/Drawer.Header.js +1 -2
  132. package/lib/commonjs/views/Drawer/Drawer.Header.js.map +1 -1
  133. package/lib/commonjs/views/Drawer/Drawer.Iab.Disclosures.js +1 -2
  134. package/lib/commonjs/views/Drawer/Drawer.Iab.Disclosures.js.map +1 -1
  135. package/lib/commonjs/views/Drawer/Drawer.Iab.Vendors.js +1 -2
  136. package/lib/commonjs/views/Drawer/Drawer.Iab.Vendors.js.map +1 -1
  137. package/lib/commonjs/views/Drawer/index.js +1 -2
  138. package/lib/commonjs/views/Drawer/index.js.map +1 -1
  139. package/lib/module/ConsentManager.js +81 -9
  140. package/lib/module/ConsentManager.js.map +1 -1
  141. package/lib/module/ConsentUiBuilder.js +9 -5
  142. package/lib/module/ConsentUiBuilder.js.map +1 -1
  143. package/lib/module/commands.js +10 -5
  144. package/lib/module/commands.js.map +1 -1
  145. package/lib/module/components/Button.js +5 -5
  146. package/lib/module/components/Button.js.map +1 -1
  147. package/lib/module/context.js +7 -5
  148. package/lib/module/context.js.map +1 -1
  149. package/lib/module/iab/tcf/consent.js +0 -5
  150. package/lib/module/iab/tcf/consent.js.map +1 -1
  151. package/lib/module/iab/tcf/constants.js +32 -0
  152. package/lib/module/iab/tcf/constants.js.map +1 -1
  153. package/lib/module/iab/tcf/iab-storage-utils.js +89 -0
  154. package/lib/module/iab/tcf/iab-storage-utils.js.map +1 -0
  155. package/lib/module/iab/tcf/middleware.js +25 -27
  156. package/lib/module/iab/tcf/middleware.js.map +1 -1
  157. package/lib/module/iab/tcf/selectors.js +1 -1
  158. package/lib/module/iab/tcf/selectors.js.map +1 -1
  159. package/lib/module/index.js +47 -13
  160. package/lib/module/index.js.map +1 -1
  161. package/lib/module/locale/af.json +342 -323
  162. package/lib/module/locale/ar.json +342 -323
  163. package/lib/module/locale/bg.json +342 -323
  164. package/lib/module/locale/ca.json +342 -323
  165. package/lib/module/locale/cs.json +342 -323
  166. package/lib/module/locale/da.json +342 -323
  167. package/lib/module/locale/de-at.json +342 -323
  168. package/lib/module/locale/de.json +342 -323
  169. package/lib/module/locale/el.json +342 -323
  170. package/lib/module/locale/en-au.json +342 -323
  171. package/lib/module/locale/en-ca.json +342 -323
  172. package/lib/module/locale/en-gb.json +342 -323
  173. package/lib/module/locale/en.json +342 -323
  174. package/lib/module/locale/es-mx.json +342 -323
  175. package/lib/module/locale/es.json +342 -323
  176. package/lib/module/locale/et.json +342 -323
  177. package/lib/module/locale/fa.json +342 -323
  178. package/lib/module/locale/fi.json +342 -323
  179. package/lib/module/locale/fr-ca.json +342 -323
  180. package/lib/module/locale/fr.json +342 -323
  181. package/lib/module/locale/gd.json +342 -323
  182. package/lib/module/locale/he.json +342 -323
  183. package/lib/module/locale/hi.json +342 -323
  184. package/lib/module/locale/hr.json +342 -323
  185. package/lib/module/locale/hu.json +342 -323
  186. package/lib/module/locale/hy.json +342 -323
  187. package/lib/module/locale/id.json +342 -323
  188. package/lib/module/locale/is.json +342 -323
  189. package/lib/module/locale/it.json +342 -323
  190. package/lib/module/locale/ja.json +342 -323
  191. package/lib/module/locale/kk.json +342 -323
  192. package/lib/module/locale/ko.json +342 -323
  193. package/lib/module/locale/lt.json +342 -323
  194. package/lib/module/locale/lv.json +342 -323
  195. package/lib/module/locale/mi.json +342 -323
  196. package/lib/module/locale/ms.json +342 -323
  197. package/lib/module/locale/nb.json +342 -323
  198. package/lib/module/locale/nl-be.json +342 -323
  199. package/lib/module/locale/nl.json +342 -323
  200. package/lib/module/locale/nn.json +342 -323
  201. package/lib/module/locale/no.json +342 -323
  202. package/lib/module/locale/pl.json +342 -323
  203. package/lib/module/locale/pt-br.json +342 -323
  204. package/lib/module/locale/pt.json +342 -323
  205. package/lib/module/locale/ro.json +342 -323
  206. package/lib/module/locale/ru.json +342 -323
  207. package/lib/module/locale/sk.json +342 -323
  208. package/lib/module/locale/sl.json +342 -323
  209. package/lib/module/locale/sq.json +342 -323
  210. package/lib/module/locale/sr.json +342 -323
  211. package/lib/module/locale/sv.json +342 -323
  212. package/lib/module/locale/th.json +342 -323
  213. package/lib/module/locale/tl.json +342 -323
  214. package/lib/module/locale/tr.json +342 -323
  215. package/lib/module/locale/uk.json +342 -323
  216. package/lib/module/locale/vi.json +342 -323
  217. package/lib/module/locale/zh-hk.json +342 -323
  218. package/lib/module/locale/zh-tw.json +342 -323
  219. package/lib/module/locale/zh.json +342 -323
  220. package/lib/module/locale/zu.json +342 -323
  221. package/lib/module/native/OsanoCmp.js +12 -0
  222. package/lib/module/native/OsanoCmp.js.map +1 -1
  223. package/lib/module/selectors.js +1 -1
  224. package/lib/module/selectors.js.map +1 -1
  225. package/lib/module/services/consent.js +54 -7
  226. package/lib/module/services/consent.js.map +1 -1
  227. package/lib/module/services/google-consent-mode-mapper.js +103 -0
  228. package/lib/module/services/google-consent-mode-mapper.js.map +1 -0
  229. package/lib/module/types/google-consent-mode.js +70 -0
  230. package/lib/module/types/google-consent-mode.js.map +1 -0
  231. package/lib/module/utils/EventEmitter.js +0 -2
  232. package/lib/module/utils/EventEmitter.js.map +1 -1
  233. package/lib/module/utils/OsanoLogger.js +44 -0
  234. package/lib/module/utils/OsanoLogger.js.map +1 -0
  235. package/lib/module/utils/Translator.js +2 -2
  236. package/lib/module/utils/Translator.js.map +1 -1
  237. package/lib/module/utils/index.js +1 -0
  238. package/lib/module/utils/index.js.map +1 -1
  239. package/lib/typescript/lib/commonjs/ConsentManager.d.ts +17 -1
  240. package/lib/typescript/lib/commonjs/ConsentManager.d.ts.map +1 -1
  241. package/lib/typescript/lib/commonjs/ConsentUiBuilder.d.ts.map +1 -1
  242. package/lib/typescript/lib/commonjs/commands.d.ts.map +1 -1
  243. package/lib/typescript/lib/commonjs/components/Button.d.ts.map +1 -1
  244. package/lib/typescript/lib/commonjs/components/Checkbox.d.ts.map +1 -1
  245. package/lib/typescript/lib/commonjs/components/ExpansionPanel.d.ts.map +1 -1
  246. package/lib/typescript/lib/commonjs/components/Link.d.ts.map +1 -1
  247. package/lib/typescript/lib/commonjs/components/StoragePolicyLink.d.ts.map +1 -1
  248. package/lib/typescript/lib/commonjs/components/Toggle.d.ts.map +1 -1
  249. package/lib/typescript/lib/commonjs/constants.d.ts.map +1 -1
  250. package/lib/typescript/lib/commonjs/iab/gpp/api.d.ts.map +1 -1
  251. package/lib/typescript/lib/commonjs/iab/gpp/consent.d.ts.map +1 -1
  252. package/lib/typescript/lib/commonjs/iab/gpp/encoders/AbstractBase64UrlEncoder.d.ts.map +1 -1
  253. package/lib/typescript/lib/commonjs/iab/gpp/v1/index.d.ts +1 -3
  254. package/lib/typescript/lib/commonjs/iab/gpp/v1/index.d.ts.map +1 -1
  255. package/lib/typescript/lib/commonjs/iab/index.d.ts.map +1 -1
  256. package/lib/typescript/lib/commonjs/iab/tcf/consent.d.ts.map +1 -1
  257. package/lib/typescript/lib/commonjs/iab/tcf/constants.d.ts +41 -1
  258. package/lib/typescript/lib/commonjs/iab/tcf/constants.d.ts.map +1 -1
  259. package/lib/typescript/lib/commonjs/iab/tcf/iab-storage-utils.d.ts +9 -0
  260. package/lib/typescript/lib/commonjs/iab/tcf/iab-storage-utils.d.ts.map +1 -0
  261. package/lib/typescript/lib/commonjs/iab/tcf/middleware.d.ts.map +1 -1
  262. package/lib/typescript/lib/commonjs/iab/tcf/reducer.d.ts.map +1 -1
  263. package/lib/typescript/lib/commonjs/iab/tcf/selectors.d.ts +0 -1
  264. package/lib/typescript/lib/commonjs/iab/tcf/selectors.d.ts.map +1 -1
  265. package/lib/typescript/lib/commonjs/iab/tcf/v2.0/shared-constants.d.ts.map +1 -1
  266. package/lib/typescript/lib/commonjs/iab/usp/api.d.ts +1 -1
  267. package/lib/typescript/lib/commonjs/iab/usp/api.d.ts.map +1 -1
  268. package/lib/typescript/lib/commonjs/iab/usp/consent.d.ts.map +1 -1
  269. package/lib/typescript/lib/commonjs/iab/usp/selectors.d.ts +1 -4
  270. package/lib/typescript/lib/commonjs/iab/usp/selectors.d.ts.map +1 -1
  271. package/lib/typescript/lib/commonjs/iab/usp/v1/index.d.ts.map +1 -1
  272. package/lib/typescript/lib/commonjs/index.d.ts +2 -0
  273. package/lib/typescript/lib/commonjs/native/OsanoCmp.d.ts +4 -0
  274. package/lib/typescript/lib/commonjs/native/OsanoCmp.d.ts.map +1 -1
  275. package/lib/typescript/lib/commonjs/reducer.d.ts +7 -1
  276. package/lib/typescript/lib/commonjs/reducer.d.ts.map +1 -1
  277. package/lib/typescript/lib/commonjs/services/consent.d.ts +4 -0
  278. package/lib/typescript/lib/commonjs/services/consent.d.ts.map +1 -1
  279. package/lib/typescript/lib/commonjs/services/google-consent-mode-mapper.d.ts +72 -0
  280. package/lib/typescript/lib/commonjs/services/google-consent-mode-mapper.d.ts.map +1 -0
  281. package/lib/typescript/lib/commonjs/types/google-consent-mode.d.ts +32 -0
  282. package/lib/typescript/lib/commonjs/types/google-consent-mode.d.ts.map +1 -0
  283. package/lib/typescript/lib/commonjs/utils/EventEmitter.d.ts.map +1 -1
  284. package/lib/typescript/lib/commonjs/utils/OsanoLogger.d.ts +16 -0
  285. package/lib/typescript/lib/commonjs/utils/OsanoLogger.d.ts.map +1 -0
  286. package/lib/typescript/lib/commonjs/utils/Translator.d.ts +1 -1
  287. package/lib/typescript/lib/commonjs/utils/Translator.d.ts.map +1 -1
  288. package/lib/typescript/lib/commonjs/utils/index.d.ts +2 -0
  289. package/lib/typescript/lib/commonjs/utils/index.d.ts.map +1 -1
  290. package/lib/typescript/lib/commonjs/views/Dialog/Buttons.d.ts.map +1 -1
  291. package/lib/typescript/lib/commonjs/views/Dialog/FirstLayerUsage.d.ts.map +1 -1
  292. package/lib/typescript/lib/commonjs/views/Dialog/Message.d.ts.map +1 -1
  293. package/lib/typescript/lib/commonjs/views/Dialog/PreferenceManagementDeepLinks.d.ts.map +1 -1
  294. package/lib/typescript/lib/commonjs/views/Dialog/index.d.ts.map +1 -1
  295. package/lib/typescript/lib/commonjs/views/Drawer/Drawer.ConsentCategories.d.ts.map +1 -1
  296. package/lib/typescript/lib/commonjs/views/Drawer/Drawer.Header.d.ts.map +1 -1
  297. package/lib/typescript/lib/commonjs/views/Drawer/Drawer.Iab.Disclosures.d.ts.map +1 -1
  298. package/lib/typescript/lib/commonjs/views/Drawer/Drawer.Iab.Vendors.d.ts.map +1 -1
  299. package/lib/typescript/lib/commonjs/views/Drawer/index.d.ts.map +1 -1
  300. package/lib/typescript/lib/module/ConsentManager.d.ts +18 -2
  301. package/lib/typescript/lib/module/ConsentManager.d.ts.map +1 -1
  302. package/lib/typescript/lib/module/ConsentUiBuilder.d.ts +1 -0
  303. package/lib/typescript/lib/module/ConsentUiBuilder.d.ts.map +1 -1
  304. package/lib/typescript/lib/module/actions.d.ts.map +1 -1
  305. package/lib/typescript/lib/module/commands.d.ts +1 -1
  306. package/lib/typescript/lib/module/commands.d.ts.map +1 -1
  307. package/lib/typescript/lib/module/components/Button.d.ts.map +1 -1
  308. package/lib/typescript/lib/module/constants.d.ts.map +1 -1
  309. package/lib/typescript/lib/module/context.d.ts +10 -1
  310. package/lib/typescript/lib/module/context.d.ts.map +1 -1
  311. package/lib/typescript/lib/module/flavors/index.d.ts.map +1 -1
  312. package/lib/typescript/lib/module/iab/constants.d.ts.map +1 -1
  313. package/lib/typescript/lib/module/iab/gpp/api.d.ts.map +1 -1
  314. package/lib/typescript/lib/module/iab/gpp/consent.d.ts.map +1 -1
  315. package/lib/typescript/lib/module/iab/gpp/encoders/AbstractBase64UrlEncoder.d.ts.map +1 -1
  316. package/lib/typescript/lib/module/iab/gpp/v1/constants.d.ts.map +1 -1
  317. package/lib/typescript/lib/module/iab/gpp/v1/index.d.ts +1 -3
  318. package/lib/typescript/lib/module/iab/gpp/v1/index.d.ts.map +1 -1
  319. package/lib/typescript/lib/module/iab/index.d.ts.map +1 -1
  320. package/lib/typescript/lib/module/iab/tcf/consent.d.ts.map +1 -1
  321. package/lib/typescript/lib/module/iab/tcf/constants.d.ts +41 -1
  322. package/lib/typescript/lib/module/iab/tcf/constants.d.ts.map +1 -1
  323. package/lib/typescript/lib/module/iab/tcf/iab-storage-utils.d.ts +8 -0
  324. package/lib/typescript/lib/module/iab/tcf/iab-storage-utils.d.ts.map +1 -0
  325. package/lib/typescript/lib/module/iab/tcf/index.d.ts +0 -2
  326. package/lib/typescript/lib/module/iab/tcf/index.d.ts.map +1 -1
  327. package/lib/typescript/lib/module/iab/tcf/middleware.d.ts.map +1 -1
  328. package/lib/typescript/lib/module/iab/tcf/reducer.d.ts.map +1 -1
  329. package/lib/typescript/lib/module/iab/tcf/selectors.d.ts +0 -1
  330. package/lib/typescript/lib/module/iab/tcf/selectors.d.ts.map +1 -1
  331. package/lib/typescript/lib/module/iab/tcf/v2.0/index.d.ts +0 -2
  332. package/lib/typescript/lib/module/iab/tcf/v2.0/index.d.ts.map +1 -1
  333. package/lib/typescript/lib/module/iab/tcf/v2.0/shared-constants.d.ts +0 -1
  334. package/lib/typescript/lib/module/iab/tcf/v2.0/shared-constants.d.ts.map +1 -1
  335. package/lib/typescript/lib/module/iab/tcf/v2.0/tcfcav1-constants.d.ts +5 -2
  336. package/lib/typescript/lib/module/iab/tcf/v2.0/tcfcav1-constants.d.ts.map +1 -1
  337. package/lib/typescript/lib/module/iab/tcf/v2.0/tcfeuv2-constants.d.ts +0 -1
  338. package/lib/typescript/lib/module/iab/tcf/v2.0/tcfeuv2-constants.d.ts.map +1 -1
  339. package/lib/typescript/lib/module/iab/usp/api.d.ts +1 -1
  340. package/lib/typescript/lib/module/iab/usp/api.d.ts.map +1 -1
  341. package/lib/typescript/lib/module/iab/usp/consent.d.ts.map +1 -1
  342. package/lib/typescript/lib/module/iab/usp/selectors.d.ts +1 -4
  343. package/lib/typescript/lib/module/iab/usp/selectors.d.ts.map +1 -1
  344. package/lib/typescript/lib/module/iab/usp/v1/constants.d.ts.map +1 -1
  345. package/lib/typescript/lib/module/iab/usp/v1/index.d.ts +1 -1
  346. package/lib/typescript/lib/module/iab/usp/v1/index.d.ts.map +1 -1
  347. package/lib/typescript/lib/module/index.d.ts +1 -0
  348. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  349. package/lib/typescript/lib/module/native/OsanoCmp.d.ts +4 -0
  350. package/lib/typescript/lib/module/native/OsanoCmp.d.ts.map +1 -1
  351. package/lib/typescript/lib/module/reducer.d.ts +7 -1
  352. package/lib/typescript/lib/module/reducer.d.ts.map +1 -1
  353. package/lib/typescript/lib/module/services/consent.d.ts +4 -0
  354. package/lib/typescript/lib/module/services/consent.d.ts.map +1 -1
  355. package/lib/typescript/lib/module/services/google-consent-mode-mapper.d.ts +71 -0
  356. package/lib/typescript/lib/module/services/google-consent-mode-mapper.d.ts.map +1 -0
  357. package/lib/typescript/lib/module/types/google-consent-mode.d.ts +38 -0
  358. package/lib/typescript/lib/module/types/google-consent-mode.d.ts.map +1 -0
  359. package/lib/typescript/lib/module/utils/EventEmitter.d.ts.map +1 -1
  360. package/lib/typescript/lib/module/utils/OsanoLogger.d.ts +15 -0
  361. package/lib/typescript/lib/module/utils/OsanoLogger.d.ts.map +1 -0
  362. package/lib/typescript/lib/module/utils/Translator.d.ts +1 -1
  363. package/lib/typescript/lib/module/utils/Translator.d.ts.map +1 -1
  364. package/lib/typescript/lib/module/utils/index.d.ts +1 -0
  365. package/lib/typescript/src/ConsentManager.d.ts +24 -7
  366. package/lib/typescript/src/ConsentManager.d.ts.map +1 -1
  367. package/lib/typescript/src/ConsentUiBuilder.d.ts +1 -1
  368. package/lib/typescript/src/ConsentUiBuilder.d.ts.map +1 -1
  369. package/lib/typescript/src/commands.d.ts.map +1 -1
  370. package/lib/typescript/src/components/Button.d.ts +1 -1
  371. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  372. package/lib/typescript/src/components/Divider.d.ts.map +1 -1
  373. package/lib/typescript/src/components/ExpansionPanel.d.ts.map +1 -1
  374. package/lib/typescript/src/components/Link.d.ts.map +1 -1
  375. package/lib/typescript/src/components/Locale.d.ts.map +1 -1
  376. package/lib/typescript/src/components/StoragePolicyLink.d.ts.map +1 -1
  377. package/lib/typescript/src/components/Toggle.d.ts.map +1 -1
  378. package/lib/typescript/src/context.d.ts +5 -2
  379. package/lib/typescript/src/context.d.ts.map +1 -1
  380. package/lib/typescript/src/iab/actions.d.ts.map +1 -1
  381. package/lib/typescript/src/iab/gpp/api.d.ts.map +1 -1
  382. package/lib/typescript/src/iab/gpp/consent.d.ts.map +1 -1
  383. package/lib/typescript/src/iab/gpp/encoders/AbstractBase64UrlEncoder.d.ts.map +1 -1
  384. package/lib/typescript/src/iab/gpp/encoders/BooleanEncoder.d.ts.map +1 -1
  385. package/lib/typescript/src/iab/gpp/encoders/DatetimeEncoder.d.ts.map +1 -1
  386. package/lib/typescript/src/iab/gpp/encoders/FibonacciIntegerEncoder.d.ts.map +1 -1
  387. package/lib/typescript/src/iab/gpp/encoders/FibonacciIntegerRangeEncoder.d.ts.map +1 -1
  388. package/lib/typescript/src/iab/gpp/encoders/FixedBitfieldEncoder.d.ts.map +1 -1
  389. package/lib/typescript/src/iab/gpp/encoders/FixedIntegerEncoder.d.ts.map +1 -1
  390. package/lib/typescript/src/iab/gpp/encoders/FixedIntegerListEncoder.d.ts.map +1 -1
  391. package/lib/typescript/src/iab/gpp/encoders/FixedIntegerRangeEncoder.d.ts.map +1 -1
  392. package/lib/typescript/src/iab/gpp/encoders/FixedStringEncoder.d.ts.map +1 -1
  393. package/lib/typescript/src/iab/gpp/v1/constants.d.ts.map +1 -1
  394. package/lib/typescript/src/iab/gpp/v1/index.d.ts +1 -3
  395. package/lib/typescript/src/iab/gpp/v1/index.d.ts.map +1 -1
  396. package/lib/typescript/src/iab/index.d.ts.map +1 -1
  397. package/lib/typescript/src/iab/tcf/actions.d.ts.map +1 -1
  398. package/lib/typescript/src/iab/tcf/consent.d.ts.map +1 -1
  399. package/lib/typescript/src/iab/tcf/constants.d.ts +32 -0
  400. package/lib/typescript/src/iab/tcf/constants.d.ts.map +1 -1
  401. package/lib/typescript/src/iab/tcf/helpers.d.ts.map +1 -1
  402. package/lib/typescript/src/iab/tcf/iab-storage-utils.d.ts +24 -0
  403. package/lib/typescript/src/iab/tcf/iab-storage-utils.d.ts.map +1 -0
  404. package/lib/typescript/src/iab/tcf/middleware.d.ts.map +1 -1
  405. package/lib/typescript/src/iab/tcf/reducer.d.ts.map +1 -1
  406. package/lib/typescript/src/iab/tcf/selectors.d.ts.map +1 -1
  407. package/lib/typescript/src/iab/tcf/v2.0/formatters.d.ts.map +1 -1
  408. package/lib/typescript/src/iab/tcf/v2.0/shared-constants.d.ts.map +1 -1
  409. package/lib/typescript/src/iab/tcf/v2.0/tcfcav1-constants.d.ts.map +1 -1
  410. package/lib/typescript/src/iab/tcf/v2.0/tcfeuv2-constants.d.ts.map +1 -1
  411. package/lib/typescript/src/iab/usp/api.d.ts +1 -1
  412. package/lib/typescript/src/iab/usp/api.d.ts.map +1 -1
  413. package/lib/typescript/src/iab/usp/consent.d.ts.map +1 -1
  414. package/lib/typescript/src/iab/usp/selectors.d.ts +1 -4
  415. package/lib/typescript/src/iab/usp/selectors.d.ts.map +1 -1
  416. package/lib/typescript/src/iab/usp/v1/constants.d.ts.map +1 -1
  417. package/lib/typescript/src/iab/usp/v1/index.d.ts +1 -1
  418. package/lib/typescript/src/iab/usp/v1/index.d.ts.map +1 -1
  419. package/lib/typescript/src/iab/utilities.d.ts.map +1 -1
  420. package/lib/typescript/src/index.d.ts +2 -0
  421. package/lib/typescript/src/index.d.ts.map +1 -1
  422. package/lib/typescript/src/native/OsanoCmp.d.ts +4 -0
  423. package/lib/typescript/src/native/OsanoCmp.d.ts.map +1 -1
  424. package/lib/typescript/src/reducer.d.ts.map +1 -1
  425. package/lib/typescript/src/selectors.d.ts.map +1 -1
  426. package/lib/typescript/src/services/consent.d.ts +13 -2
  427. package/lib/typescript/src/services/consent.d.ts.map +1 -1
  428. package/lib/typescript/src/services/google-consent-mode-mapper.d.ts +66 -0
  429. package/lib/typescript/src/services/google-consent-mode-mapper.d.ts.map +1 -0
  430. package/lib/typescript/src/styles.d.ts.map +1 -1
  431. package/lib/typescript/src/types/google-consent-mode.d.ts +77 -0
  432. package/lib/typescript/src/types/google-consent-mode.d.ts.map +1 -0
  433. package/lib/typescript/src/utils/Color.d.ts.map +1 -1
  434. package/lib/typescript/src/utils/EventEmitter.d.ts.map +1 -1
  435. package/lib/typescript/src/utils/OsanoLogger.d.ts +15 -0
  436. package/lib/typescript/src/utils/OsanoLogger.d.ts.map +1 -0
  437. package/lib/typescript/src/utils/index.d.ts +1 -0
  438. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  439. package/package.json +4 -2
  440. package/src/ConsentManager.ts +131 -22
  441. package/src/ConsentUiBuilder.tsx +23 -13
  442. package/src/commands.ts +11 -8
  443. package/src/components/Button.tsx +17 -17
  444. package/src/context.ts +14 -9
  445. package/src/iab/tcf/consent.ts +11 -16
  446. package/src/iab/tcf/constants.ts +46 -0
  447. package/src/iab/tcf/iab-storage-utils.ts +166 -0
  448. package/src/iab/tcf/middleware.ts +43 -51
  449. package/src/index.tsx +77 -22
  450. package/src/locale/af.json +342 -323
  451. package/src/locale/ar.json +342 -323
  452. package/src/locale/bg.json +342 -323
  453. package/src/locale/ca.json +342 -323
  454. package/src/locale/cs.json +342 -323
  455. package/src/locale/da.json +342 -323
  456. package/src/locale/de-at.json +342 -323
  457. package/src/locale/de.json +342 -323
  458. package/src/locale/el.json +342 -323
  459. package/src/locale/en-au.json +342 -323
  460. package/src/locale/en-ca.json +342 -323
  461. package/src/locale/en-gb.json +342 -323
  462. package/src/locale/en.json +342 -323
  463. package/src/locale/es-mx.json +342 -323
  464. package/src/locale/es.json +342 -323
  465. package/src/locale/et.json +342 -323
  466. package/src/locale/fa.json +342 -323
  467. package/src/locale/fi.json +342 -323
  468. package/src/locale/fr-ca.json +342 -323
  469. package/src/locale/fr.json +342 -323
  470. package/src/locale/gd.json +342 -323
  471. package/src/locale/he.json +342 -323
  472. package/src/locale/hi.json +342 -323
  473. package/src/locale/hr.json +342 -323
  474. package/src/locale/hu.json +342 -323
  475. package/src/locale/hy.json +342 -323
  476. package/src/locale/id.json +342 -323
  477. package/src/locale/is.json +342 -323
  478. package/src/locale/it.json +342 -323
  479. package/src/locale/ja.json +342 -323
  480. package/src/locale/kk.json +342 -323
  481. package/src/locale/ko.json +342 -323
  482. package/src/locale/lt.json +342 -323
  483. package/src/locale/lv.json +342 -323
  484. package/src/locale/mi.json +342 -323
  485. package/src/locale/ms.json +342 -323
  486. package/src/locale/nb.json +342 -323
  487. package/src/locale/nl-be.json +342 -323
  488. package/src/locale/nl.json +342 -323
  489. package/src/locale/nn.json +342 -323
  490. package/src/locale/no.json +342 -323
  491. package/src/locale/pl.json +342 -323
  492. package/src/locale/pt-br.json +342 -323
  493. package/src/locale/pt.json +342 -323
  494. package/src/locale/ro.json +342 -323
  495. package/src/locale/ru.json +342 -323
  496. package/src/locale/sk.json +342 -323
  497. package/src/locale/sl.json +342 -323
  498. package/src/locale/sq.json +342 -323
  499. package/src/locale/sr.json +342 -323
  500. package/src/locale/sv.json +342 -323
  501. package/src/locale/th.json +342 -323
  502. package/src/locale/tl.json +342 -323
  503. package/src/locale/tr.json +342 -323
  504. package/src/locale/uk.json +342 -323
  505. package/src/locale/vi.json +342 -323
  506. package/src/locale/zh-hk.json +342 -323
  507. package/src/locale/zh-tw.json +342 -323
  508. package/src/locale/zh.json +342 -323
  509. package/src/locale/zu.json +342 -323
  510. package/src/native/OsanoCmp.ts +29 -0
  511. package/src/selectors.ts +1 -0
  512. package/src/services/consent.ts +75 -9
  513. package/src/services/google-consent-mode-mapper.ts +122 -0
  514. package/src/types/consent-config.d.ts +0 -3
  515. package/src/types/google-consent-mode.ts +122 -0
  516. package/src/types/index.d.ts +4 -2
  517. package/src/utils/EventEmitter.ts +1 -3
  518. package/src/utils/OsanoLogger.ts +53 -0
  519. package/src/utils/Translator.ts +15 -15
  520. package/src/utils/index.ts +2 -0
@@ -30,3 +30,32 @@ export function getStorage(key: string): Promise<string | null | undefined> {
30
30
  export function clearStorage(key: string): Promise<void> {
31
31
  return OsanoCmp.clearStorage(key);
32
32
  }
33
+ export function setStorageToDefault(
34
+ key: string,
35
+ value: string,
36
+ ): Promise<string> {
37
+ return OsanoCmp.setStorageToDefault
38
+ ? OsanoCmp.setStorageToDefault(key, value)
39
+ : Promise.resolve(value);
40
+ }
41
+ export function setIntStorageToDefault(
42
+ key: string,
43
+ value: number,
44
+ ): Promise<number> {
45
+ return OsanoCmp.setIntStorageToDefault
46
+ ? OsanoCmp.setIntStorageToDefault(key, value)
47
+ : Promise.resolve(value);
48
+ }
49
+ export function setBoolStorageToDefault(
50
+ key: string,
51
+ value: boolean,
52
+ ): Promise<boolean> {
53
+ return OsanoCmp.setBoolStorageToDefault
54
+ ? OsanoCmp.setBoolStorageToDefault(key, value)
55
+ : Promise.resolve(value);
56
+ }
57
+ export function clearStorageFromDefault(key: string): Promise<void> {
58
+ return OsanoCmp.clearStorageFromDefault
59
+ ? OsanoCmp.clearStorageFromDefault(key)
60
+ : Promise.resolve();
61
+ }
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
@@ -1,17 +1,17 @@
1
+ import { sha512 } from 'js-sha512';
2
+ import { Platform } from 'react-native';
3
+ import { TextEncoder } from 'text-encoding';
4
+ import type { ConsentManager } from '../ConsentManager';
1
5
  import {
2
6
  ConsentCategory,
3
7
  ConsentCategory as ConsentCategoryType,
8
+ env,
4
9
  } from '../constants';
5
10
  import { clearStorage, getStorage, setStorage } from '../native/OsanoCmp';
6
-
7
- import API from '../utils/API';
8
11
  import type { Config } from '../types/consent-config';
9
- import type { ConsentManager } from '../ConsentManager';
10
- import { Platform } from 'react-native';
11
- import { TextEncoder } from 'text-encoding';
12
- import { env } from '../constants';
13
12
  import { merge } from '../utils';
14
- import { sha512 } from 'js-sha512';
13
+ import API from '../utils/API';
14
+ import { osanoLogger } from '../utils/OsanoLogger';
15
15
 
16
16
  const Buffer = require('buffer').Buffer;
17
17
 
@@ -270,6 +270,7 @@ export const fetchConsent = async (cmp: ConsentManager) => {
270
270
  ConsentCategoryType[category as keyof typeof ConsentCategoryType],
271
271
  );
272
272
  await storeConsent(cmp, remoteConsentCategories);
273
+
273
274
  return remoteConsentCategories;
274
275
  }
275
276
  } catch (error) {
@@ -278,7 +279,7 @@ export const fetchConsent = async (cmp: ConsentManager) => {
278
279
 
279
280
  return consent;
280
281
  } catch (error) {
281
- console.error('Error fetching consent:', error);
282
+ osanoLogger.error('Error fetching consent:', error as Error);
282
283
  // Consent not found or network/server error.
283
284
  const consent = await retrieveConsent(cmp);
284
285
  return consent;
@@ -305,6 +306,71 @@ export const fetchConfig = (customerId: string, configId: string) => {
305
306
  })
306
307
  .catch(() => {
307
308
  // Consent not found or network/server error
308
- return null;
309
+ throw new Error('Error fetching config');
309
310
  });
310
311
  };
312
+
313
+ export const getStoredConfig = async (
314
+ configId: string,
315
+ ): Promise<Config | null> => {
316
+ try {
317
+ const config = await getStorage(`${STORAGE_KEY}_${configId}_config`);
318
+ if (config) {
319
+ return JSON.parse(config) as Config;
320
+ }
321
+ } catch (error) {
322
+ // Failed to retrieve config
323
+ }
324
+ return null;
325
+ };
326
+
327
+ export const storeConfig = async (
328
+ configId: string,
329
+ config: Config,
330
+ ): Promise<void> => {
331
+ try {
332
+ await Promise.all([
333
+ setStorage(`${STORAGE_KEY}_${configId}_config`, JSON.stringify(config)),
334
+ setStorage(
335
+ `${STORAGE_KEY}_${configId}_config_last_stored_at`,
336
+ JSON.stringify(new Date()),
337
+ ),
338
+ ]);
339
+ } catch (error) {
340
+ throw new Error('Failed to store config');
341
+ }
342
+ };
343
+
344
+ export const getConfigLastStoredAt = async (
345
+ configId: string,
346
+ ): Promise<Date | null> => {
347
+ try {
348
+ const lastStoredAt = await getStorage(
349
+ `${STORAGE_KEY}_${configId}_config_last_stored_at`,
350
+ );
351
+ if (lastStoredAt) {
352
+ return new Date(JSON.parse(lastStoredAt));
353
+ }
354
+ } catch (error) {
355
+ // Failed to retrieve last stored at
356
+ }
357
+ return null;
358
+ };
359
+
360
+ /**
361
+ * Determine if a cached config is stale
362
+ *
363
+ * @async
364
+ * @param {string} configId
365
+ * @returns {Promise<boolean>}
366
+ */
367
+ export const hasStaleConfig = async (configId: string): Promise<boolean> => {
368
+ const lastStoredAt = await getConfigLastStoredAt(configId);
369
+ if (!lastStoredAt) {
370
+ return true;
371
+ }
372
+ const now = new Date();
373
+ const diff = now.getTime() - lastStoredAt.getTime();
374
+ const diffInMinutes = Math.floor(diff / 60000);
375
+ return diffInMinutes > 1440; // 24 hours = 1440 minutes
376
+ };
@@ -0,0 +1,122 @@
1
+ import { ConsentCategory } from '../constants';
2
+ import type { GoogleConsentMap } from '../types/google-consent-mode';
3
+ import {
4
+ GoogleConsentMapImpl,
5
+ GoogleConsentParameter,
6
+ GoogleConsentStatus,
7
+ } from '../types/google-consent-mode';
8
+
9
+ /**
10
+ * Google Consent Mode Category Mapper
11
+ *
12
+ * Converts Osano consent categories to Google Consent Mode v2 parameters.
13
+ *
14
+ * **Mapping Logic (matching iOS/Android SDKs):**
15
+ * - ANALYTICS category → analytics_storage parameter
16
+ * - MARKETING category → ad_storage, ad_user_data, ad_personalization parameters
17
+ *
18
+ * All Google Consent Mode parameters default to "denied" until explicitly granted through category mapping.
19
+ */
20
+ export class GoogleConsentModeMapper {
21
+ private static readonly GOOGLE_CATEGORIES_MAP: Record<
22
+ string,
23
+ GoogleConsentParameter[]
24
+ > = {
25
+ [ConsentCategory.ANALYTICS]: [GoogleConsentParameter.ANALYTICS_STORAGE],
26
+ [ConsentCategory.MARKETING]: [
27
+ GoogleConsentParameter.AD_STORAGE,
28
+ GoogleConsentParameter.AD_USER_DATA,
29
+ GoogleConsentParameter.AD_PERSONALIZATION,
30
+ ],
31
+ };
32
+
33
+ /**
34
+ * Build a Google Consent Map from a set of Osano consent categories
35
+ *
36
+ * @param categories - Set of Osano consent categories that the user has granted
37
+ * @returns GoogleConsentMap with appropriate Google Consent Mode v2 parameters
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * const categories = new Set([ConsentCategory.ANALYTICS, ConsentCategory.MARKETING]);
42
+ * const consentMap = GoogleConsentModeMapper.buildGoogleConsentMap(categories);
43
+ *
44
+ * // Results in:
45
+ * // {
46
+ * // analytics_storage: 'granted',
47
+ * // ad_storage: 'granted',
48
+ * // ad_user_data: 'granted',
49
+ * // ad_personalization: 'granted'
50
+ * // }
51
+ * ```
52
+ */
53
+ static buildGoogleConsentMap(
54
+ categories: Set<ConsentCategory>,
55
+ ): GoogleConsentMap {
56
+ // Initialize all parameters to DENIED by default
57
+ const consentMap: Record<GoogleConsentParameter, GoogleConsentStatus> = {
58
+ [GoogleConsentParameter.ANALYTICS_STORAGE]: GoogleConsentStatus.DENIED,
59
+ [GoogleConsentParameter.AD_STORAGE]: GoogleConsentStatus.DENIED,
60
+ [GoogleConsentParameter.AD_USER_DATA]: GoogleConsentStatus.DENIED,
61
+ [GoogleConsentParameter.AD_PERSONALIZATION]: GoogleConsentStatus.DENIED,
62
+ };
63
+
64
+ // Apply GRANTED status for mapped categories
65
+ categories.forEach((category) => {
66
+ const googleParameters = this.GOOGLE_CATEGORIES_MAP[category];
67
+
68
+ if (googleParameters) {
69
+ googleParameters.forEach((parameter) => {
70
+ consentMap[parameter] = GoogleConsentStatus.GRANTED;
71
+ });
72
+ }
73
+ });
74
+
75
+ return this.createGoogleConsentMap(consentMap);
76
+ }
77
+
78
+ /**
79
+ * Create a GoogleConsentMap from a raw consent map
80
+ *
81
+ * @param consentMap - Raw mapping of Google Consent Mode parameters to status
82
+ * @returns GoogleConsentMap implementation with helper methods
83
+ */
84
+ static createGoogleConsentMap(
85
+ consentMap: Record<GoogleConsentParameter, GoogleConsentStatus>,
86
+ ): GoogleConsentMap {
87
+ return new GoogleConsentMapImpl(consentMap);
88
+ }
89
+
90
+ /**
91
+ * Check if a consent category is mapped to Google Consent Mode parameters
92
+ *
93
+ * @param category - Osano consent category to check
94
+ * @returns true if the category is mapped to Google Consent Mode parameters
95
+ */
96
+ static isGoogleConsentCategory(category: ConsentCategory): boolean {
97
+ return category in this.GOOGLE_CATEGORIES_MAP;
98
+ }
99
+
100
+ /**
101
+ * Get Google Consent Mode parameters for a specific consent category
102
+ *
103
+ * @param category - Osano consent category
104
+ * @returns Array of Google Consent Mode parameters mapped to this category
105
+ */
106
+ static getGoogleParametersForCategory(
107
+ category: ConsentCategory,
108
+ ): GoogleConsentParameter[] {
109
+ return this.GOOGLE_CATEGORIES_MAP[category] || [];
110
+ }
111
+
112
+ /**
113
+ * Get readonly copy of the categories mapping
114
+ *
115
+ * @returns Readonly mapping of Osano categories to Google Consent Mode parameters
116
+ */
117
+ static getCategoriesMapping(): Readonly<
118
+ Record<string, GoogleConsentParameter[]>
119
+ > {
120
+ return Object.freeze({ ...this.GOOGLE_CATEGORIES_MAP });
121
+ }
122
+ }
@@ -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
  };
@@ -0,0 +1,122 @@
1
+ /**
2
+ * Google Consent Mode v2 parameters as defined by Google
3
+ * @see https://developers.google.com/tag-platform/security/guides/consent?consentmode=advanced
4
+ */
5
+ export enum GoogleConsentParameter {
6
+ ANALYTICS_STORAGE = 'analytics_storage',
7
+ AD_STORAGE = 'ad_storage',
8
+ AD_USER_DATA = 'ad_user_data',
9
+ AD_PERSONALIZATION = 'ad_personalization',
10
+ }
11
+
12
+ /**
13
+ * Google Consent Mode v2 status values
14
+ */
15
+ export enum GoogleConsentStatus {
16
+ GRANTED = 'granted',
17
+ DENIED = 'denied',
18
+ }
19
+
20
+ /**
21
+ * Immutable consent map that provides Google Consent Mode v2 parameters
22
+ * with their corresponding status values and helper methods.
23
+ */
24
+ export interface GoogleConsentMap {
25
+ readonly consentMap: Record<GoogleConsentParameter, GoogleConsentStatus>;
26
+
27
+ /**
28
+ * Convert the consent map to a string-based record for easier Firebase integration
29
+ * @returns Object with string keys and string values
30
+ */
31
+ toStringMap(): Record<string, string>;
32
+
33
+ /**
34
+ * Check if analytics storage consent is granted
35
+ * @returns true if analytics_storage is granted
36
+ */
37
+ isAnalyticsStorageGranted(): boolean;
38
+
39
+ /**
40
+ * Check if ad storage consent is granted
41
+ * @returns true if ad_storage is granted
42
+ */
43
+ isAdStorageGranted(): boolean;
44
+
45
+ /**
46
+ * Check if ad user data consent is granted
47
+ * @returns true if ad_user_data is granted
48
+ */
49
+ isAdUserDataGranted(): boolean;
50
+
51
+ /**
52
+ * Check if ad personalization consent is granted
53
+ * @returns true if ad_personalization is granted
54
+ */
55
+ isAdPersonalizationGranted(): boolean;
56
+ }
57
+
58
+ /**
59
+ * Callback function type for Google Consent Mode updates
60
+ *
61
+ * This callback is triggered whenever consent status changes and provides
62
+ * the Google Consent Mode v2 parameters in a format ready for Firebase integration.
63
+ *
64
+ * @param consentMap - Object containing the four Google Consent Mode v2 parameters:
65
+ * - "analytics_storage": "granted" or "denied"
66
+ * - "ad_storage": "granted" or "denied"
67
+ * - "ad_user_data": "granted" or "denied"
68
+ * - "ad_personalization": "granted" or "denied"
69
+ */
70
+ export interface GoogleConsentModeCallback {
71
+ (consentMap: Record<string, string>): void;
72
+ }
73
+
74
+ /**
75
+ * Concrete implementation of GoogleConsentMap interface
76
+ */
77
+ export class GoogleConsentMapImpl implements GoogleConsentMap {
78
+ readonly consentMap: Record<GoogleConsentParameter, GoogleConsentStatus>;
79
+
80
+ constructor(consentMap: Record<GoogleConsentParameter, GoogleConsentStatus>) {
81
+ // Create immutable copy
82
+ this.consentMap = Object.freeze({ ...consentMap });
83
+ }
84
+
85
+ toStringMap(): Record<string, string> {
86
+ const stringMap: Record<string, string> = {};
87
+
88
+ Object.entries(this.consentMap).forEach(([parameter, status]) => {
89
+ stringMap[parameter] = status;
90
+ });
91
+
92
+ return stringMap;
93
+ }
94
+
95
+ isAnalyticsStorageGranted(): boolean {
96
+ return (
97
+ this.consentMap[GoogleConsentParameter.ANALYTICS_STORAGE] ===
98
+ GoogleConsentStatus.GRANTED
99
+ );
100
+ }
101
+
102
+ isAdStorageGranted(): boolean {
103
+ return (
104
+ this.consentMap[GoogleConsentParameter.AD_STORAGE] ===
105
+ GoogleConsentStatus.GRANTED
106
+ );
107
+ }
108
+
109
+ isAdUserDataGranted(): boolean {
110
+ return (
111
+ this.consentMap[GoogleConsentParameter.AD_USER_DATA] ===
112
+ GoogleConsentStatus.GRANTED
113
+ );
114
+ }
115
+
116
+ isAdPersonalizationGranted(): boolean {
117
+ return (
118
+ this.consentMap[GoogleConsentParameter.AD_PERSONALIZATION] ===
119
+ GoogleConsentStatus.GRANTED
120
+ );
121
+ }
122
+ }
@@ -6,7 +6,7 @@ import type {
6
6
  } from '../iab/tcf/types';
7
7
  import type { IabFrameworkType } from '../iab/types';
8
8
  import type { Palette } from './consent-config';
9
-
9
+ import type { GoogleConsentModeCallback } from './google-consent-mode';
10
10
 
11
11
  export type OsanoOverrides = {
12
12
  flavor?: FlavorKeys;
@@ -30,6 +30,8 @@ export interface OsanoProps {
30
30
  onConfigLoadFailure?: () => void;
31
31
  onLangLoadSuccess?: () => void;
32
32
  onLangLoadFailure?: () => void;
33
+ onGoogleConsentUpdate?: GoogleConsentModeCallback;
33
34
  overrides?: OsanoOverrides;
34
- extUsrData?: string
35
+ extUsrData?: string;
36
+ setLoggingEnabled?: boolean;
35
37
  }
@@ -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
 
@@ -0,0 +1,53 @@
1
+ export class OsanoLogger {
2
+ private readonly TAG = 'OsanoSDK';
3
+ private isEnabled = true;
4
+
5
+ setEnabled(enabled: boolean): void {
6
+ this.isEnabled = enabled;
7
+ }
8
+
9
+ getEnabled(): boolean {
10
+ return this.isEnabled;
11
+ }
12
+
13
+ error(message: string, error?: Error): void {
14
+ // Always log errors regardless of enabled state
15
+ if (error) {
16
+ console.error(`[${this.TAG}] ${message}`, error);
17
+ } else {
18
+ console.error(`[${this.TAG}] ${message}`);
19
+ }
20
+ }
21
+
22
+ warn(message: string): void {
23
+ if (!this.isEnabled) return;
24
+ console.warn(`[${this.TAG}] ${message}`);
25
+ }
26
+
27
+ info(message: string): void {
28
+ if (!this.isEnabled) return;
29
+ console.info(`[${this.TAG}] ${message}`);
30
+ }
31
+
32
+ debug(message: string): void {
33
+ if (!this.isEnabled) return;
34
+ console.debug(`[${this.TAG}] ${message}`);
35
+ }
36
+
37
+ verbose(message: string): void {
38
+ if (!this.isEnabled) return;
39
+ console.log(`[${this.TAG}-VERBOSE] ${message}`);
40
+ }
41
+
42
+ metric(name: string, durationMs: number): void {
43
+ if (!this.isEnabled) return;
44
+ console.info(`[${this.TAG}-Metrics] ${name}: ${durationMs} ms`);
45
+ }
46
+
47
+ log(message: string): void {
48
+ if (!this.isEnabled) return;
49
+ console.log(`[${this.TAG}] ${message}`);
50
+ }
51
+ }
52
+
53
+ export const osanoLogger = new OsanoLogger();
@@ -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;
@@ -127,3 +127,5 @@ export function merge(
127
127
  }
128
128
 
129
129
  export function noop() {}
130
+
131
+ export { osanoLogger as OsanoLogger } from './OsanoLogger';