@osano/osano-cmp-react-native 0.12.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 (493) hide show
  1. package/README.dev.md +216 -1
  2. package/README.md +2 -268
  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 +57 -14
  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 +5 -4
  24. package/lib/commonjs/context.js.map +1 -1
  25. package/lib/commonjs/iab/tcf/constants.js +34 -1
  26. package/lib/commonjs/iab/tcf/constants.js.map +1 -1
  27. package/lib/commonjs/iab/tcf/iab-storage-utils.js +102 -0
  28. package/lib/commonjs/iab/tcf/iab-storage-utils.js.map +1 -0
  29. package/lib/commonjs/iab/tcf/index.js +1 -2
  30. package/lib/commonjs/iab/tcf/index.js.map +1 -1
  31. package/lib/commonjs/iab/tcf/middleware.js +33 -35
  32. package/lib/commonjs/iab/tcf/middleware.js.map +1 -1
  33. package/lib/commonjs/iab/tcf/selectors.js +1 -1
  34. package/lib/commonjs/iab/tcf/selectors.js.map +1 -1
  35. package/lib/commonjs/iab/tcf/v2.0/shared-constants.js +1 -2
  36. package/lib/commonjs/iab/tcf/v2.0/shared-constants.js.map +1 -1
  37. package/lib/commonjs/index.js +29 -9
  38. package/lib/commonjs/index.js.map +1 -1
  39. package/lib/commonjs/locale/af.json +342 -323
  40. package/lib/commonjs/locale/ar.json +342 -323
  41. package/lib/commonjs/locale/bg.json +342 -323
  42. package/lib/commonjs/locale/ca.json +342 -323
  43. package/lib/commonjs/locale/cs.json +342 -323
  44. package/lib/commonjs/locale/da.json +342 -323
  45. package/lib/commonjs/locale/de-at.json +342 -323
  46. package/lib/commonjs/locale/de.json +342 -323
  47. package/lib/commonjs/locale/el.json +342 -323
  48. package/lib/commonjs/locale/en-au.json +342 -323
  49. package/lib/commonjs/locale/en-ca.json +342 -323
  50. package/lib/commonjs/locale/en-gb.json +342 -323
  51. package/lib/commonjs/locale/en.json +342 -323
  52. package/lib/commonjs/locale/es-mx.json +342 -323
  53. package/lib/commonjs/locale/es.json +342 -323
  54. package/lib/commonjs/locale/et.json +342 -323
  55. package/lib/commonjs/locale/fa.json +342 -323
  56. package/lib/commonjs/locale/fi.json +342 -323
  57. package/lib/commonjs/locale/fr-ca.json +342 -323
  58. package/lib/commonjs/locale/fr.json +342 -323
  59. package/lib/commonjs/locale/gd.json +342 -323
  60. package/lib/commonjs/locale/he.json +342 -323
  61. package/lib/commonjs/locale/hi.json +342 -323
  62. package/lib/commonjs/locale/hr.json +342 -323
  63. package/lib/commonjs/locale/hu.json +342 -323
  64. package/lib/commonjs/locale/hy.json +342 -323
  65. package/lib/commonjs/locale/id.json +342 -323
  66. package/lib/commonjs/locale/is.json +342 -323
  67. package/lib/commonjs/locale/it.json +342 -323
  68. package/lib/commonjs/locale/ja.json +342 -323
  69. package/lib/commonjs/locale/kk.json +342 -323
  70. package/lib/commonjs/locale/ko.json +342 -323
  71. package/lib/commonjs/locale/lt.json +342 -323
  72. package/lib/commonjs/locale/lv.json +342 -323
  73. package/lib/commonjs/locale/mi.json +342 -323
  74. package/lib/commonjs/locale/ms.json +342 -323
  75. package/lib/commonjs/locale/nb.json +342 -323
  76. package/lib/commonjs/locale/nl-be.json +342 -323
  77. package/lib/commonjs/locale/nl.json +342 -323
  78. package/lib/commonjs/locale/nn.json +342 -323
  79. package/lib/commonjs/locale/no.json +342 -323
  80. package/lib/commonjs/locale/pl.json +342 -323
  81. package/lib/commonjs/locale/pt-br.json +342 -323
  82. package/lib/commonjs/locale/pt.json +342 -323
  83. package/lib/commonjs/locale/ro.json +342 -323
  84. package/lib/commonjs/locale/ru.json +342 -323
  85. package/lib/commonjs/locale/sk.json +342 -323
  86. package/lib/commonjs/locale/sl.json +342 -323
  87. package/lib/commonjs/locale/sq.json +342 -323
  88. package/lib/commonjs/locale/sr.json +342 -323
  89. package/lib/commonjs/locale/sv.json +342 -323
  90. package/lib/commonjs/locale/th.json +342 -323
  91. package/lib/commonjs/locale/tl.json +342 -323
  92. package/lib/commonjs/locale/tr.json +342 -323
  93. package/lib/commonjs/locale/uk.json +342 -323
  94. package/lib/commonjs/locale/vi.json +342 -323
  95. package/lib/commonjs/locale/zh-hk.json +342 -323
  96. package/lib/commonjs/locale/zh-tw.json +342 -323
  97. package/lib/commonjs/locale/zh.json +342 -323
  98. package/lib/commonjs/locale/zu.json +342 -323
  99. package/lib/commonjs/native/OsanoCmp.js +16 -0
  100. package/lib/commonjs/native/OsanoCmp.js.map +1 -1
  101. package/lib/commonjs/services/consent.js +6 -5
  102. package/lib/commonjs/services/consent.js.map +1 -1
  103. package/lib/commonjs/services/google-consent-mode-mapper.js +109 -0
  104. package/lib/commonjs/services/google-consent-mode-mapper.js.map +1 -0
  105. package/lib/commonjs/types/google-consent-mode.js +73 -0
  106. package/lib/commonjs/types/google-consent-mode.js.map +1 -0
  107. package/lib/commonjs/utils/OsanoLogger.js +51 -0
  108. package/lib/commonjs/utils/OsanoLogger.js.map +1 -0
  109. package/lib/commonjs/utils/index.js +7 -0
  110. package/lib/commonjs/utils/index.js.map +1 -1
  111. package/lib/commonjs/views/Dialog/Buttons.js +1 -2
  112. package/lib/commonjs/views/Dialog/Buttons.js.map +1 -1
  113. package/lib/commonjs/views/Dialog/FirstLayerUsage.js +1 -2
  114. package/lib/commonjs/views/Dialog/FirstLayerUsage.js.map +1 -1
  115. package/lib/commonjs/views/Dialog/Message.js +1 -2
  116. package/lib/commonjs/views/Dialog/Message.js.map +1 -1
  117. package/lib/commonjs/views/Dialog/PreferenceManagementDeepLinks.js +1 -2
  118. package/lib/commonjs/views/Dialog/PreferenceManagementDeepLinks.js.map +1 -1
  119. package/lib/commonjs/views/Dialog/index.js +1 -2
  120. package/lib/commonjs/views/Dialog/index.js.map +1 -1
  121. package/lib/commonjs/views/Drawer/Drawer.ConsentCategories.js +1 -2
  122. package/lib/commonjs/views/Drawer/Drawer.ConsentCategories.js.map +1 -1
  123. package/lib/commonjs/views/Drawer/Drawer.Header.js +1 -2
  124. package/lib/commonjs/views/Drawer/Drawer.Header.js.map +1 -1
  125. package/lib/commonjs/views/Drawer/Drawer.Iab.Disclosures.js +1 -2
  126. package/lib/commonjs/views/Drawer/Drawer.Iab.Disclosures.js.map +1 -1
  127. package/lib/commonjs/views/Drawer/Drawer.Iab.Vendors.js +1 -2
  128. package/lib/commonjs/views/Drawer/Drawer.Iab.Vendors.js.map +1 -1
  129. package/lib/commonjs/views/Drawer/index.js +1 -2
  130. package/lib/commonjs/views/Drawer/index.js.map +1 -1
  131. package/lib/module/ConsentManager.js +56 -12
  132. package/lib/module/ConsentManager.js.map +1 -1
  133. package/lib/module/ConsentUiBuilder.js +9 -5
  134. package/lib/module/ConsentUiBuilder.js.map +1 -1
  135. package/lib/module/commands.js +10 -5
  136. package/lib/module/commands.js.map +1 -1
  137. package/lib/module/components/Button.js +5 -5
  138. package/lib/module/components/Button.js.map +1 -1
  139. package/lib/module/context.js +5 -4
  140. package/lib/module/context.js.map +1 -1
  141. package/lib/module/iab/tcf/constants.js +32 -0
  142. package/lib/module/iab/tcf/constants.js.map +1 -1
  143. package/lib/module/iab/tcf/iab-storage-utils.js +89 -0
  144. package/lib/module/iab/tcf/iab-storage-utils.js.map +1 -0
  145. package/lib/module/iab/tcf/middleware.js +25 -27
  146. package/lib/module/iab/tcf/middleware.js.map +1 -1
  147. package/lib/module/iab/tcf/selectors.js +1 -1
  148. package/lib/module/iab/tcf/selectors.js.map +1 -1
  149. package/lib/module/index.js +22 -7
  150. package/lib/module/index.js.map +1 -1
  151. package/lib/module/locale/af.json +342 -323
  152. package/lib/module/locale/ar.json +342 -323
  153. package/lib/module/locale/bg.json +342 -323
  154. package/lib/module/locale/ca.json +342 -323
  155. package/lib/module/locale/cs.json +342 -323
  156. package/lib/module/locale/da.json +342 -323
  157. package/lib/module/locale/de-at.json +342 -323
  158. package/lib/module/locale/de.json +342 -323
  159. package/lib/module/locale/el.json +342 -323
  160. package/lib/module/locale/en-au.json +342 -323
  161. package/lib/module/locale/en-ca.json +342 -323
  162. package/lib/module/locale/en-gb.json +342 -323
  163. package/lib/module/locale/en.json +342 -323
  164. package/lib/module/locale/es-mx.json +342 -323
  165. package/lib/module/locale/es.json +342 -323
  166. package/lib/module/locale/et.json +342 -323
  167. package/lib/module/locale/fa.json +342 -323
  168. package/lib/module/locale/fi.json +342 -323
  169. package/lib/module/locale/fr-ca.json +342 -323
  170. package/lib/module/locale/fr.json +342 -323
  171. package/lib/module/locale/gd.json +342 -323
  172. package/lib/module/locale/he.json +342 -323
  173. package/lib/module/locale/hi.json +342 -323
  174. package/lib/module/locale/hr.json +342 -323
  175. package/lib/module/locale/hu.json +342 -323
  176. package/lib/module/locale/hy.json +342 -323
  177. package/lib/module/locale/id.json +342 -323
  178. package/lib/module/locale/is.json +342 -323
  179. package/lib/module/locale/it.json +342 -323
  180. package/lib/module/locale/ja.json +342 -323
  181. package/lib/module/locale/kk.json +342 -323
  182. package/lib/module/locale/ko.json +342 -323
  183. package/lib/module/locale/lt.json +342 -323
  184. package/lib/module/locale/lv.json +342 -323
  185. package/lib/module/locale/mi.json +342 -323
  186. package/lib/module/locale/ms.json +342 -323
  187. package/lib/module/locale/nb.json +342 -323
  188. package/lib/module/locale/nl-be.json +342 -323
  189. package/lib/module/locale/nl.json +342 -323
  190. package/lib/module/locale/nn.json +342 -323
  191. package/lib/module/locale/no.json +342 -323
  192. package/lib/module/locale/pl.json +342 -323
  193. package/lib/module/locale/pt-br.json +342 -323
  194. package/lib/module/locale/pt.json +342 -323
  195. package/lib/module/locale/ro.json +342 -323
  196. package/lib/module/locale/ru.json +342 -323
  197. package/lib/module/locale/sk.json +342 -323
  198. package/lib/module/locale/sl.json +342 -323
  199. package/lib/module/locale/sq.json +342 -323
  200. package/lib/module/locale/sr.json +342 -323
  201. package/lib/module/locale/sv.json +342 -323
  202. package/lib/module/locale/th.json +342 -323
  203. package/lib/module/locale/tl.json +342 -323
  204. package/lib/module/locale/tr.json +342 -323
  205. package/lib/module/locale/uk.json +342 -323
  206. package/lib/module/locale/vi.json +342 -323
  207. package/lib/module/locale/zh-hk.json +342 -323
  208. package/lib/module/locale/zh-tw.json +342 -323
  209. package/lib/module/locale/zh.json +342 -323
  210. package/lib/module/locale/zu.json +342 -323
  211. package/lib/module/native/OsanoCmp.js +12 -0
  212. package/lib/module/native/OsanoCmp.js.map +1 -1
  213. package/lib/module/services/consent.js +6 -6
  214. package/lib/module/services/consent.js.map +1 -1
  215. package/lib/module/services/google-consent-mode-mapper.js +103 -0
  216. package/lib/module/services/google-consent-mode-mapper.js.map +1 -0
  217. package/lib/module/types/google-consent-mode.js +70 -0
  218. package/lib/module/types/google-consent-mode.js.map +1 -0
  219. package/lib/module/utils/OsanoLogger.js +44 -0
  220. package/lib/module/utils/OsanoLogger.js.map +1 -0
  221. package/lib/module/utils/index.js +1 -0
  222. package/lib/module/utils/index.js.map +1 -1
  223. package/lib/typescript/lib/commonjs/ConsentManager.d.ts +15 -0
  224. package/lib/typescript/lib/commonjs/ConsentManager.d.ts.map +1 -1
  225. package/lib/typescript/lib/commonjs/ConsentUiBuilder.d.ts.map +1 -1
  226. package/lib/typescript/lib/commonjs/commands.d.ts.map +1 -1
  227. package/lib/typescript/lib/commonjs/components/Button.d.ts.map +1 -1
  228. package/lib/typescript/lib/commonjs/components/Checkbox.d.ts.map +1 -1
  229. package/lib/typescript/lib/commonjs/components/ExpansionPanel.d.ts.map +1 -1
  230. package/lib/typescript/lib/commonjs/components/Link.d.ts.map +1 -1
  231. package/lib/typescript/lib/commonjs/components/StoragePolicyLink.d.ts.map +1 -1
  232. package/lib/typescript/lib/commonjs/components/Toggle.d.ts.map +1 -1
  233. package/lib/typescript/lib/commonjs/constants.d.ts.map +1 -1
  234. package/lib/typescript/lib/commonjs/iab/gpp/api.d.ts.map +1 -1
  235. package/lib/typescript/lib/commonjs/iab/gpp/consent.d.ts.map +1 -1
  236. package/lib/typescript/lib/commonjs/iab/gpp/encoders/AbstractBase64UrlEncoder.d.ts.map +1 -1
  237. package/lib/typescript/lib/commonjs/iab/gpp/v1/index.d.ts +1 -3
  238. package/lib/typescript/lib/commonjs/iab/gpp/v1/index.d.ts.map +1 -1
  239. package/lib/typescript/lib/commonjs/iab/index.d.ts.map +1 -1
  240. package/lib/typescript/lib/commonjs/iab/tcf/consent.d.ts.map +1 -1
  241. package/lib/typescript/lib/commonjs/iab/tcf/constants.d.ts +41 -1
  242. package/lib/typescript/lib/commonjs/iab/tcf/constants.d.ts.map +1 -1
  243. package/lib/typescript/lib/commonjs/iab/tcf/iab-storage-utils.d.ts +9 -0
  244. package/lib/typescript/lib/commonjs/iab/tcf/iab-storage-utils.d.ts.map +1 -0
  245. package/lib/typescript/lib/commonjs/iab/tcf/middleware.d.ts.map +1 -1
  246. package/lib/typescript/lib/commonjs/iab/tcf/reducer.d.ts.map +1 -1
  247. package/lib/typescript/lib/commonjs/iab/tcf/selectors.d.ts +0 -1
  248. package/lib/typescript/lib/commonjs/iab/tcf/selectors.d.ts.map +1 -1
  249. package/lib/typescript/lib/commonjs/iab/tcf/v2.0/shared-constants.d.ts.map +1 -1
  250. package/lib/typescript/lib/commonjs/iab/usp/api.d.ts +1 -1
  251. package/lib/typescript/lib/commonjs/iab/usp/api.d.ts.map +1 -1
  252. package/lib/typescript/lib/commonjs/iab/usp/consent.d.ts.map +1 -1
  253. package/lib/typescript/lib/commonjs/iab/usp/selectors.d.ts +1 -4
  254. package/lib/typescript/lib/commonjs/iab/usp/selectors.d.ts.map +1 -1
  255. package/lib/typescript/lib/commonjs/iab/usp/v1/index.d.ts.map +1 -1
  256. package/lib/typescript/lib/commonjs/index.d.ts +2 -0
  257. package/lib/typescript/lib/commonjs/native/OsanoCmp.d.ts +4 -0
  258. package/lib/typescript/lib/commonjs/native/OsanoCmp.d.ts.map +1 -1
  259. package/lib/typescript/lib/commonjs/reducer.d.ts +7 -1
  260. package/lib/typescript/lib/commonjs/reducer.d.ts.map +1 -1
  261. package/lib/typescript/lib/commonjs/services/consent.d.ts.map +1 -1
  262. package/lib/typescript/lib/commonjs/services/google-consent-mode-mapper.d.ts +72 -0
  263. package/lib/typescript/lib/commonjs/services/google-consent-mode-mapper.d.ts.map +1 -0
  264. package/lib/typescript/lib/commonjs/types/google-consent-mode.d.ts +32 -0
  265. package/lib/typescript/lib/commonjs/types/google-consent-mode.d.ts.map +1 -0
  266. package/lib/typescript/lib/commonjs/utils/OsanoLogger.d.ts +16 -0
  267. package/lib/typescript/lib/commonjs/utils/OsanoLogger.d.ts.map +1 -0
  268. package/lib/typescript/lib/commonjs/utils/Translator.d.ts +1 -1
  269. package/lib/typescript/lib/commonjs/utils/Translator.d.ts.map +1 -1
  270. package/lib/typescript/lib/commonjs/utils/index.d.ts +2 -0
  271. package/lib/typescript/lib/commonjs/utils/index.d.ts.map +1 -1
  272. package/lib/typescript/lib/commonjs/views/Dialog/Buttons.d.ts.map +1 -1
  273. package/lib/typescript/lib/commonjs/views/Dialog/FirstLayerUsage.d.ts.map +1 -1
  274. package/lib/typescript/lib/commonjs/views/Dialog/Message.d.ts.map +1 -1
  275. package/lib/typescript/lib/commonjs/views/Dialog/PreferenceManagementDeepLinks.d.ts.map +1 -1
  276. package/lib/typescript/lib/commonjs/views/Dialog/index.d.ts.map +1 -1
  277. package/lib/typescript/lib/commonjs/views/Drawer/Drawer.ConsentCategories.d.ts.map +1 -1
  278. package/lib/typescript/lib/commonjs/views/Drawer/Drawer.Header.d.ts.map +1 -1
  279. package/lib/typescript/lib/commonjs/views/Drawer/Drawer.Iab.Disclosures.d.ts.map +1 -1
  280. package/lib/typescript/lib/commonjs/views/Drawer/Drawer.Iab.Vendors.d.ts.map +1 -1
  281. package/lib/typescript/lib/commonjs/views/Drawer/index.d.ts.map +1 -1
  282. package/lib/typescript/lib/module/ConsentManager.d.ts +17 -2
  283. package/lib/typescript/lib/module/ConsentManager.d.ts.map +1 -1
  284. package/lib/typescript/lib/module/ConsentUiBuilder.d.ts +1 -0
  285. package/lib/typescript/lib/module/ConsentUiBuilder.d.ts.map +1 -1
  286. package/lib/typescript/lib/module/actions.d.ts.map +1 -1
  287. package/lib/typescript/lib/module/commands.d.ts +1 -1
  288. package/lib/typescript/lib/module/commands.d.ts.map +1 -1
  289. package/lib/typescript/lib/module/components/Button.d.ts.map +1 -1
  290. package/lib/typescript/lib/module/constants.d.ts.map +1 -1
  291. package/lib/typescript/lib/module/context.d.ts +9 -1
  292. package/lib/typescript/lib/module/context.d.ts.map +1 -1
  293. package/lib/typescript/lib/module/flavors/index.d.ts.map +1 -1
  294. package/lib/typescript/lib/module/iab/constants.d.ts.map +1 -1
  295. package/lib/typescript/lib/module/iab/gpp/api.d.ts.map +1 -1
  296. package/lib/typescript/lib/module/iab/gpp/consent.d.ts.map +1 -1
  297. package/lib/typescript/lib/module/iab/gpp/encoders/AbstractBase64UrlEncoder.d.ts.map +1 -1
  298. package/lib/typescript/lib/module/iab/gpp/v1/constants.d.ts.map +1 -1
  299. package/lib/typescript/lib/module/iab/gpp/v1/index.d.ts +1 -3
  300. package/lib/typescript/lib/module/iab/gpp/v1/index.d.ts.map +1 -1
  301. package/lib/typescript/lib/module/iab/index.d.ts.map +1 -1
  302. package/lib/typescript/lib/module/iab/tcf/consent.d.ts.map +1 -1
  303. package/lib/typescript/lib/module/iab/tcf/constants.d.ts +41 -1
  304. package/lib/typescript/lib/module/iab/tcf/constants.d.ts.map +1 -1
  305. package/lib/typescript/lib/module/iab/tcf/iab-storage-utils.d.ts +8 -0
  306. package/lib/typescript/lib/module/iab/tcf/iab-storage-utils.d.ts.map +1 -0
  307. package/lib/typescript/lib/module/iab/tcf/index.d.ts +0 -2
  308. package/lib/typescript/lib/module/iab/tcf/index.d.ts.map +1 -1
  309. package/lib/typescript/lib/module/iab/tcf/middleware.d.ts.map +1 -1
  310. package/lib/typescript/lib/module/iab/tcf/reducer.d.ts.map +1 -1
  311. package/lib/typescript/lib/module/iab/tcf/selectors.d.ts +0 -1
  312. package/lib/typescript/lib/module/iab/tcf/selectors.d.ts.map +1 -1
  313. package/lib/typescript/lib/module/iab/tcf/v2.0/index.d.ts +0 -2
  314. package/lib/typescript/lib/module/iab/tcf/v2.0/index.d.ts.map +1 -1
  315. package/lib/typescript/lib/module/iab/tcf/v2.0/shared-constants.d.ts +0 -1
  316. package/lib/typescript/lib/module/iab/tcf/v2.0/shared-constants.d.ts.map +1 -1
  317. package/lib/typescript/lib/module/iab/tcf/v2.0/tcfcav1-constants.d.ts +5 -2
  318. package/lib/typescript/lib/module/iab/tcf/v2.0/tcfcav1-constants.d.ts.map +1 -1
  319. package/lib/typescript/lib/module/iab/tcf/v2.0/tcfeuv2-constants.d.ts +0 -1
  320. package/lib/typescript/lib/module/iab/tcf/v2.0/tcfeuv2-constants.d.ts.map +1 -1
  321. package/lib/typescript/lib/module/iab/usp/api.d.ts +1 -1
  322. package/lib/typescript/lib/module/iab/usp/api.d.ts.map +1 -1
  323. package/lib/typescript/lib/module/iab/usp/consent.d.ts.map +1 -1
  324. package/lib/typescript/lib/module/iab/usp/selectors.d.ts +1 -4
  325. package/lib/typescript/lib/module/iab/usp/selectors.d.ts.map +1 -1
  326. package/lib/typescript/lib/module/iab/usp/v1/constants.d.ts.map +1 -1
  327. package/lib/typescript/lib/module/iab/usp/v1/index.d.ts +1 -1
  328. package/lib/typescript/lib/module/iab/usp/v1/index.d.ts.map +1 -1
  329. package/lib/typescript/lib/module/index.d.ts +1 -0
  330. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  331. package/lib/typescript/lib/module/native/OsanoCmp.d.ts +4 -0
  332. package/lib/typescript/lib/module/native/OsanoCmp.d.ts.map +1 -1
  333. package/lib/typescript/lib/module/reducer.d.ts +7 -1
  334. package/lib/typescript/lib/module/reducer.d.ts.map +1 -1
  335. package/lib/typescript/lib/module/services/google-consent-mode-mapper.d.ts +71 -0
  336. package/lib/typescript/lib/module/services/google-consent-mode-mapper.d.ts.map +1 -0
  337. package/lib/typescript/lib/module/types/google-consent-mode.d.ts +38 -0
  338. package/lib/typescript/lib/module/types/google-consent-mode.d.ts.map +1 -0
  339. package/lib/typescript/lib/module/utils/OsanoLogger.d.ts +15 -0
  340. package/lib/typescript/lib/module/utils/OsanoLogger.d.ts.map +1 -0
  341. package/lib/typescript/lib/module/utils/Translator.d.ts +1 -1
  342. package/lib/typescript/lib/module/utils/Translator.d.ts.map +1 -1
  343. package/lib/typescript/lib/module/utils/index.d.ts +1 -0
  344. package/lib/typescript/src/ConsentManager.d.ts +23 -7
  345. package/lib/typescript/src/ConsentManager.d.ts.map +1 -1
  346. package/lib/typescript/src/ConsentUiBuilder.d.ts +1 -1
  347. package/lib/typescript/src/ConsentUiBuilder.d.ts.map +1 -1
  348. package/lib/typescript/src/commands.d.ts.map +1 -1
  349. package/lib/typescript/src/components/Button.d.ts +1 -1
  350. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  351. package/lib/typescript/src/components/Divider.d.ts.map +1 -1
  352. package/lib/typescript/src/components/ExpansionPanel.d.ts.map +1 -1
  353. package/lib/typescript/src/components/Link.d.ts.map +1 -1
  354. package/lib/typescript/src/components/Locale.d.ts.map +1 -1
  355. package/lib/typescript/src/components/StoragePolicyLink.d.ts.map +1 -1
  356. package/lib/typescript/src/components/Toggle.d.ts.map +1 -1
  357. package/lib/typescript/src/context.d.ts +4 -2
  358. package/lib/typescript/src/context.d.ts.map +1 -1
  359. package/lib/typescript/src/iab/actions.d.ts.map +1 -1
  360. package/lib/typescript/src/iab/gpp/api.d.ts.map +1 -1
  361. package/lib/typescript/src/iab/gpp/consent.d.ts.map +1 -1
  362. package/lib/typescript/src/iab/gpp/encoders/AbstractBase64UrlEncoder.d.ts.map +1 -1
  363. package/lib/typescript/src/iab/gpp/encoders/BooleanEncoder.d.ts.map +1 -1
  364. package/lib/typescript/src/iab/gpp/encoders/DatetimeEncoder.d.ts.map +1 -1
  365. package/lib/typescript/src/iab/gpp/encoders/FibonacciIntegerEncoder.d.ts.map +1 -1
  366. package/lib/typescript/src/iab/gpp/encoders/FibonacciIntegerRangeEncoder.d.ts.map +1 -1
  367. package/lib/typescript/src/iab/gpp/encoders/FixedBitfieldEncoder.d.ts.map +1 -1
  368. package/lib/typescript/src/iab/gpp/encoders/FixedIntegerEncoder.d.ts.map +1 -1
  369. package/lib/typescript/src/iab/gpp/encoders/FixedIntegerListEncoder.d.ts.map +1 -1
  370. package/lib/typescript/src/iab/gpp/encoders/FixedIntegerRangeEncoder.d.ts.map +1 -1
  371. package/lib/typescript/src/iab/gpp/encoders/FixedStringEncoder.d.ts.map +1 -1
  372. package/lib/typescript/src/iab/gpp/v1/constants.d.ts.map +1 -1
  373. package/lib/typescript/src/iab/gpp/v1/index.d.ts +1 -3
  374. package/lib/typescript/src/iab/gpp/v1/index.d.ts.map +1 -1
  375. package/lib/typescript/src/iab/index.d.ts.map +1 -1
  376. package/lib/typescript/src/iab/tcf/actions.d.ts.map +1 -1
  377. package/lib/typescript/src/iab/tcf/consent.d.ts.map +1 -1
  378. package/lib/typescript/src/iab/tcf/constants.d.ts +32 -0
  379. package/lib/typescript/src/iab/tcf/constants.d.ts.map +1 -1
  380. package/lib/typescript/src/iab/tcf/helpers.d.ts.map +1 -1
  381. package/lib/typescript/src/iab/tcf/iab-storage-utils.d.ts +24 -0
  382. package/lib/typescript/src/iab/tcf/iab-storage-utils.d.ts.map +1 -0
  383. package/lib/typescript/src/iab/tcf/middleware.d.ts.map +1 -1
  384. package/lib/typescript/src/iab/tcf/reducer.d.ts.map +1 -1
  385. package/lib/typescript/src/iab/tcf/selectors.d.ts.map +1 -1
  386. package/lib/typescript/src/iab/tcf/v2.0/formatters.d.ts.map +1 -1
  387. package/lib/typescript/src/iab/tcf/v2.0/shared-constants.d.ts.map +1 -1
  388. package/lib/typescript/src/iab/tcf/v2.0/tcfcav1-constants.d.ts.map +1 -1
  389. package/lib/typescript/src/iab/tcf/v2.0/tcfeuv2-constants.d.ts.map +1 -1
  390. package/lib/typescript/src/iab/usp/api.d.ts +1 -1
  391. package/lib/typescript/src/iab/usp/api.d.ts.map +1 -1
  392. package/lib/typescript/src/iab/usp/consent.d.ts.map +1 -1
  393. package/lib/typescript/src/iab/usp/selectors.d.ts +1 -4
  394. package/lib/typescript/src/iab/usp/selectors.d.ts.map +1 -1
  395. package/lib/typescript/src/iab/usp/v1/constants.d.ts.map +1 -1
  396. package/lib/typescript/src/iab/usp/v1/index.d.ts +1 -1
  397. package/lib/typescript/src/iab/usp/v1/index.d.ts.map +1 -1
  398. package/lib/typescript/src/iab/utilities.d.ts.map +1 -1
  399. package/lib/typescript/src/index.d.ts +2 -0
  400. package/lib/typescript/src/index.d.ts.map +1 -1
  401. package/lib/typescript/src/native/OsanoCmp.d.ts +4 -0
  402. package/lib/typescript/src/native/OsanoCmp.d.ts.map +1 -1
  403. package/lib/typescript/src/reducer.d.ts.map +1 -1
  404. package/lib/typescript/src/selectors.d.ts.map +1 -1
  405. package/lib/typescript/src/services/consent.d.ts +1 -1
  406. package/lib/typescript/src/services/consent.d.ts.map +1 -1
  407. package/lib/typescript/src/services/google-consent-mode-mapper.d.ts +66 -0
  408. package/lib/typescript/src/services/google-consent-mode-mapper.d.ts.map +1 -0
  409. package/lib/typescript/src/styles.d.ts.map +1 -1
  410. package/lib/typescript/src/types/google-consent-mode.d.ts +77 -0
  411. package/lib/typescript/src/types/google-consent-mode.d.ts.map +1 -0
  412. package/lib/typescript/src/utils/Color.d.ts.map +1 -1
  413. package/lib/typescript/src/utils/OsanoLogger.d.ts +15 -0
  414. package/lib/typescript/src/utils/OsanoLogger.d.ts.map +1 -0
  415. package/lib/typescript/src/utils/index.d.ts +1 -0
  416. package/lib/typescript/src/utils/index.d.ts.map +1 -1
  417. package/package.json +4 -2
  418. package/src/ConsentManager.ts +93 -25
  419. package/src/ConsentUiBuilder.tsx +23 -13
  420. package/src/commands.ts +11 -8
  421. package/src/components/Button.tsx +17 -17
  422. package/src/context.ts +6 -3
  423. package/src/iab/tcf/constants.ts +46 -0
  424. package/src/iab/tcf/iab-storage-utils.ts +166 -0
  425. package/src/iab/tcf/middleware.ts +43 -51
  426. package/src/index.tsx +35 -8
  427. package/src/locale/af.json +342 -323
  428. package/src/locale/ar.json +342 -323
  429. package/src/locale/bg.json +342 -323
  430. package/src/locale/ca.json +342 -323
  431. package/src/locale/cs.json +342 -323
  432. package/src/locale/da.json +342 -323
  433. package/src/locale/de-at.json +342 -323
  434. package/src/locale/de.json +342 -323
  435. package/src/locale/el.json +342 -323
  436. package/src/locale/en-au.json +342 -323
  437. package/src/locale/en-ca.json +342 -323
  438. package/src/locale/en-gb.json +342 -323
  439. package/src/locale/en.json +342 -323
  440. package/src/locale/es-mx.json +342 -323
  441. package/src/locale/es.json +342 -323
  442. package/src/locale/et.json +342 -323
  443. package/src/locale/fa.json +342 -323
  444. package/src/locale/fi.json +342 -323
  445. package/src/locale/fr-ca.json +342 -323
  446. package/src/locale/fr.json +342 -323
  447. package/src/locale/gd.json +342 -323
  448. package/src/locale/he.json +342 -323
  449. package/src/locale/hi.json +342 -323
  450. package/src/locale/hr.json +342 -323
  451. package/src/locale/hu.json +342 -323
  452. package/src/locale/hy.json +342 -323
  453. package/src/locale/id.json +342 -323
  454. package/src/locale/is.json +342 -323
  455. package/src/locale/it.json +342 -323
  456. package/src/locale/ja.json +342 -323
  457. package/src/locale/kk.json +342 -323
  458. package/src/locale/ko.json +342 -323
  459. package/src/locale/lt.json +342 -323
  460. package/src/locale/lv.json +342 -323
  461. package/src/locale/mi.json +342 -323
  462. package/src/locale/ms.json +342 -323
  463. package/src/locale/nb.json +342 -323
  464. package/src/locale/nl-be.json +342 -323
  465. package/src/locale/nl.json +342 -323
  466. package/src/locale/nn.json +342 -323
  467. package/src/locale/no.json +342 -323
  468. package/src/locale/pl.json +342 -323
  469. package/src/locale/pt-br.json +342 -323
  470. package/src/locale/pt.json +342 -323
  471. package/src/locale/ro.json +342 -323
  472. package/src/locale/ru.json +342 -323
  473. package/src/locale/sk.json +342 -323
  474. package/src/locale/sl.json +342 -323
  475. package/src/locale/sq.json +342 -323
  476. package/src/locale/sr.json +342 -323
  477. package/src/locale/sv.json +342 -323
  478. package/src/locale/th.json +342 -323
  479. package/src/locale/tl.json +342 -323
  480. package/src/locale/tr.json +342 -323
  481. package/src/locale/uk.json +342 -323
  482. package/src/locale/vi.json +342 -323
  483. package/src/locale/zh-hk.json +342 -323
  484. package/src/locale/zh-tw.json +342 -323
  485. package/src/locale/zh.json +342 -323
  486. package/src/locale/zu.json +342 -323
  487. package/src/native/OsanoCmp.ts +29 -0
  488. package/src/services/consent.ts +9 -8
  489. package/src/services/google-consent-mode-mapper.ts +122 -0
  490. package/src/types/google-consent-mode.ts +122 -0
  491. package/src/types/index.d.ts +4 -2
  492. package/src/utils/OsanoLogger.ts +53 -0
  493. package/src/utils/index.ts +2 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osano/osano-cmp-react-native",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "Package and example for the react-native Osano CMP SDK",
5
5
  "main": "lib/commonjs/index",
6
6
  "module": "lib/module/index",
@@ -31,7 +31,8 @@
31
31
  ],
32
32
  "scripts": {
33
33
  "example": "yarn workspace osano-cmp-sdk-example",
34
- "test": "jest src/services/__tests__/consent.test.ts src/__tests__/index.test.tsx",
34
+ "test": "jest src/services/__tests__/consent.test.ts src/__tests__/index.test.tsx src/services/__tests__/google-consent-mode.test.ts src/__tests__/OsanoLogger.test.ts",
35
+ "test:google-consent-mode": "jest src/services/__tests__/google-consent-mode.test.ts",
35
36
  "typecheck": "tsc --noEmit",
36
37
  "lint": "eslint \"**/*.{js,ts,tsx}\"",
37
38
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
@@ -64,6 +65,7 @@
64
65
  "access": "public"
65
66
  },
66
67
  "devDependencies": {
68
+ "@biomejs/biome": "2.1.2",
67
69
  "@commitlint/config-conventional": "^17.0.2",
68
70
  "@docusaurus/core": "3.5.2",
69
71
  "@docusaurus/module-type-aliases": "3.5.2",
@@ -1,5 +1,16 @@
1
- import type { Config, Mode, Palette } from './types/consent-config';
2
- import { EventEmitter, type EventSubscription } from './utils/EventEmitter';
1
+ import { NativeModules, Platform } from 'react-native';
2
+ import { CLEAR_CONSENT, SAVE_SUCCESS } from './actions';
3
+ import { ConsentCategory, mappedJurisdictions } from './constants';
4
+ import flavors, { defaultFlavor, type Flavor } from './flavors';
5
+ import type { Store } from './hooks/useThunkReducer';
6
+ import Tcf from './iab/tcf';
7
+ import type {
8
+ GppVersionType,
9
+ TcfController,
10
+ TcfVersionType,
11
+ Tcf_v2,
12
+ UspVersionType,
13
+ } from './iab/tcf/types';
3
14
  import type {
4
15
  GvlVendor_v2,
5
16
  GvlVendor_v3,
@@ -7,7 +18,8 @@ import type {
7
18
  IabFrameworkType,
8
19
  IabState,
9
20
  } from './iab/types';
10
- import { NativeModules, Platform } from 'react-native';
21
+ import { getDeviceId } from './native/OsanoCmp';
22
+ import { getConsent } from './selectors';
11
23
  import {
12
24
  clearConsent as clearStoredConsent,
13
25
  fetchConfig,
@@ -16,24 +28,15 @@ import {
16
28
  hasStaleConfig,
17
29
  storeConfig,
18
30
  } from './services/consent';
19
- import flavors, { defaultFlavor, type Flavor } from './flavors';
20
- import { get, merge } from './utils';
31
+ import { GoogleConsentModeMapper } from './services/google-consent-mode-mapper';
21
32
  import type { OsanoOverrides } from './types';
22
- import type {
23
- GppVersionType,
24
- TcfController,
25
- TcfVersionType,
26
- Tcf_v2,
27
- UspVersionType,
28
- } from './iab/tcf/types';
29
- import Tcf from './iab/tcf';
30
- import Translator from './utils/Translator';
31
- import { ConsentCategory, mappedJurisdictions } from './constants';
32
- import { getDeviceId } from './native/OsanoCmp';
33
- import type { Store } from './hooks/useThunkReducer';
33
+ import type { Config, Mode, Palette } from './types/consent-config';
34
+ import type { GoogleConsentModeCallback } from './types/google-consent-mode';
34
35
  import type { OsanoAction, OsanoState } from './types/store';
35
- import { CLEAR_CONSENT, SAVE_SUCCESS } from './actions';
36
- import { getConsent } from './selectors';
36
+ import { get, merge } from './utils';
37
+ import { EventEmitter, type EventSubscription } from './utils/EventEmitter';
38
+ import { osanoLogger as OsanoLogger } from './utils/OsanoLogger';
39
+ import Translator from './utils/Translator';
37
40
 
38
41
  const CONFIG_ID_ERROR = new Error('customerId and configId must be set');
39
42
  const CONFIG_NOT_FOUND_ERROR = new Error('Config not found');
@@ -162,12 +165,15 @@ async function fetchConfigWithRetries(
162
165
  const config = await fetchConfig(customerId, configId);
163
166
  return config;
164
167
  } catch (error) {
165
- if (attempt === retries) {
168
+ if (attempt < retries) {
169
+ OsanoLogger.warn(
170
+ `Attempt ${attempt} failed. Retrying in ${delay}ms...`,
171
+ );
172
+ await new Promise((resolve) => setTimeout(resolve, delay));
173
+ delay *= 2; // Exponential backoff
174
+ } else {
166
175
  throw error;
167
176
  }
168
- console.warn(`Attempt ${attempt} failed. Retrying in ${delay}ms...`);
169
- await new Promise((resolve) => setTimeout(resolve, delay));
170
- delay *= 2; // Exponential backoff
171
177
  }
172
178
  }
173
179
 
@@ -616,6 +622,7 @@ export class ConsentManager {
616
622
  private _consent?: ConsentCategory[];
617
623
  private _translator: Translator = new Translator(this);
618
624
  private _overridePalette?: Palette;
625
+ private _googleConsentModeCallback?: GoogleConsentModeCallback;
619
626
 
620
627
  private _deviceId = '';
621
628
  public get deviceId(): string {
@@ -670,7 +677,10 @@ export class ConsentManager {
670
677
  try {
671
678
  getDeviceId().then(setDeviceId);
672
679
  } catch (err) {
673
- console.log(`Error getting device id: ${err}`);
680
+ OsanoLogger.error(
681
+ `Error getting device id: ${err}`,
682
+ err instanceof Error ? err : undefined,
683
+ );
674
684
  }
675
685
  this._locale = NativeModules.I18nManager.localeIdentifier;
676
686
  break;
@@ -679,7 +689,10 @@ export class ConsentManager {
679
689
  try {
680
690
  getDeviceId().then(setDeviceId);
681
691
  } catch (err) {
682
- console.log(`Error getting device id: ${err}`);
692
+ OsanoLogger.error(
693
+ `Error getting device id: ${err}`,
694
+ err instanceof Error ? err : undefined,
695
+ );
683
696
  }
684
697
  this._locale =
685
698
  NativeModules.SettingsManager.settings.AppleLanguages[0] || //iOS 13
@@ -783,6 +796,7 @@ export class ConsentManager {
783
796
  })
784
797
  .then((consent) => {
785
798
  this.consent = consent;
799
+ this.triggerGoogleConsentUpdate(consent);
786
800
  return this._translator
787
801
  .load(locale, onLangLoadSuccess, onLangLoadFailure)
788
802
  .then((results) => {
@@ -847,6 +861,60 @@ export class ConsentManager {
847
861
  return this._consent?.includes(category) ?? false;
848
862
  }
849
863
 
864
+ /**
865
+ * Set the Google Consent Mode callback function
866
+ *
867
+ * @param callback - Function to call when consent updates occur
868
+ * @returns this ConsentManager instance for method chaining
869
+ */
870
+ public setGoogleConsentModeCallback(
871
+ callback: GoogleConsentModeCallback,
872
+ ): this {
873
+ this._googleConsentModeCallback = callback;
874
+ return this;
875
+ }
876
+
877
+ /**
878
+ * Trigger Google Consent Mode update with current consent categories
879
+ *
880
+ * @param categories - Array of consent categories that have been granted
881
+ * @public
882
+ */
883
+ public triggerGoogleConsentUpdate(categories: ConsentCategory[]): void {
884
+ if (!this._config.googleConsent) {
885
+ OsanoLogger.debug('Google Consent Mode: disabled in configuration');
886
+ return;
887
+ }
888
+
889
+ if (!this._googleConsentModeCallback) {
890
+ OsanoLogger.debug('Google Consent Mode: callback not set');
891
+ return;
892
+ }
893
+
894
+ try {
895
+ OsanoLogger.debug(
896
+ `Google Consent Mode: triggering callback with categories: ${JSON.stringify(categories)}`,
897
+ );
898
+
899
+ const categorySet = new Set(categories);
900
+ const googleConsentMap =
901
+ GoogleConsentModeMapper.buildGoogleConsentMap(categorySet);
902
+
903
+ const consentStringMap = googleConsentMap.toStringMap();
904
+
905
+ OsanoLogger.debug(
906
+ `Google Consent Mode: consent map: ${JSON.stringify(consentStringMap)}`,
907
+ );
908
+ this._googleConsentModeCallback(consentStringMap);
909
+ OsanoLogger.debug('Google Consent Mode: callback executed successfully');
910
+ } catch (error) {
911
+ OsanoLogger.warn(
912
+ `Google Consent Mode: Error triggering callback: ${error}`,
913
+ );
914
+ // Don't re-throw - callback errors shouldn't break consent flow
915
+ }
916
+ }
917
+
850
918
  public get loaded(): boolean {
851
919
  return this._loaded;
852
920
  }
@@ -1,25 +1,26 @@
1
+ import React, { useCallback, useEffect, useMemo } from 'react';
2
+ import { StyleSheet, View } from 'react-native';
1
3
  import {
2
4
  type GetState,
3
5
  type MiddlewareNext,
4
6
  type Store,
5
7
  type ThunkDispatch,
6
8
  } from './hooks/useThunkReducer';
9
+ import type { GoogleConsentModeCallback } from './types/google-consent-mode';
7
10
  import { type OsanoAction, type OsanoState } from './types/store';
8
- import React, { useCallback, useEffect, useMemo } from 'react';
9
- import { StyleSheet, View } from 'react-native';
10
11
 
12
+ import { setConfig } from './actions';
11
13
  import { ConsentManager } from './ConsentManager';
12
- import { Dialog } from './views/Dialog';
13
- import { Drawer } from './views/Drawer';
14
14
  import { OsanoPrivateContext } from './context';
15
15
  import { createSharedStyles } from './styles';
16
- import { setConfig } from './actions';
16
+ import { Dialog } from './views/Dialog';
17
+ import { Drawer } from './views/Drawer';
17
18
 
18
19
  export const ConsentUiBuilder: React.FC<{
19
20
  addMiddleware: (
20
21
  m: (
21
- store: Store<OsanoState, OsanoAction>
22
- ) => (next: MiddlewareNext<OsanoAction>) => MiddlewareNext<OsanoAction>
22
+ store: Store<OsanoState, OsanoAction>,
23
+ ) => (next: MiddlewareNext<OsanoAction>) => MiddlewareNext<OsanoAction>,
23
24
  ) => void;
24
25
  cmp: React.MutableRefObject<ConsentManager>;
25
26
  dispatch: ThunkDispatch<OsanoState, OsanoAction, any>;
@@ -27,8 +28,8 @@ export const ConsentUiBuilder: React.FC<{
27
28
  hideDisclosures: boolean;
28
29
  removeMiddleware: (
29
30
  m: (
30
- store: Store<OsanoState, OsanoAction<any, any>>
31
- ) => (next: MiddlewareNext<OsanoAction>) => MiddlewareNext<OsanoAction>
31
+ store: Store<OsanoState, OsanoAction<any, any>>,
32
+ ) => (next: MiddlewareNext<OsanoAction>) => MiddlewareNext<OsanoAction>,
32
33
  ) => void;
33
34
  }> = (props): React.ReactElement<View> => {
34
35
  const {
@@ -45,16 +46,23 @@ export const ConsentUiBuilder: React.FC<{
45
46
  (
46
47
  path: string | string[],
47
48
  translationProps = {},
48
- defaultPhrase?: string
49
+ defaultPhrase?: string,
49
50
  ) => {
50
51
  const translated = cmp.current.translator.translate(
51
52
  path,
52
53
  translationProps,
53
- defaultPhrase
54
+ defaultPhrase,
54
55
  );
55
56
  return translated;
56
57
  },
57
- [cmp]
58
+ [cmp],
59
+ );
60
+
61
+ const setGoogleConsentModeCallback = useCallback(
62
+ (callback: GoogleConsentModeCallback) => {
63
+ cmp.current.setGoogleConsentModeCallback(callback);
64
+ },
65
+ [cmp],
58
66
  );
59
67
 
60
68
  const privateContext = useMemo(() => {
@@ -71,6 +79,7 @@ export const ConsentUiBuilder: React.FC<{
71
79
  locale: cmp.current.translator.locale,
72
80
  sharedStyles: createSharedStyles(cmp.current.config || {}),
73
81
  stack,
82
+ setGoogleConsentModeCallback,
74
83
  };
75
84
  }, [
76
85
  addMiddleware,
@@ -82,6 +91,7 @@ export const ConsentUiBuilder: React.FC<{
82
91
  handleTranslate,
83
92
  getState,
84
93
  stack,
94
+ setGoogleConsentModeCallback,
85
95
  ]);
86
96
 
87
97
  // Update our store with the config when CMP loads or config changes
@@ -92,7 +102,7 @@ export const ConsentUiBuilder: React.FC<{
92
102
  config: cmp.current.config,
93
103
  customerId: cmp.current.customerId,
94
104
  configId: cmp.current.configId,
95
- })
105
+ }),
96
106
  );
97
107
  }
98
108
  }, [cmp, dispatch, cmp.current.loaded, cmp.current.config]);
package/src/commands.ts CHANGED
@@ -7,17 +7,17 @@ import {
7
7
  SAVE_SUCCESS,
8
8
  } from './actions';
9
9
  import type { ConsentManager } from './ConsentManager';
10
- import type { OsanoAction, OsanoState } from './types/store';
11
10
  import {
12
11
  getConsent,
13
12
  hasFetchedDisclosuresForCategory,
14
13
  isLoadingDisclosures,
15
14
  } from './selectors';
15
+ import type { OsanoAction, OsanoState } from './types/store';
16
16
 
17
17
  import { type ConsentCategory as ConsentCategoryType } from './constants';
18
- import { fetchDisclosures } from './services/disclosures';
19
- import { recordConsent } from './services/consent';
20
18
  import type { AsyncAction } from './hooks/useThunkReducer';
19
+ import { recordConsent } from './services/consent';
20
+ import { fetchDisclosures } from './services/disclosures';
21
21
 
22
22
  export const toggleDisclosure =
23
23
  (payload: {
@@ -47,7 +47,7 @@ export const toggleDisclosure =
47
47
  customerId,
48
48
  configId,
49
49
  undefined /* category */,
50
- state.locale
50
+ state.locale,
51
51
  )
52
52
  .then((response) => {
53
53
  const disclosureResults = response || [];
@@ -70,7 +70,7 @@ export const toggleDisclosure =
70
70
 
71
71
  export const saveConsent =
72
72
  (
73
- cmp: ConsentManager
73
+ cmp: ConsentManager,
74
74
  ): AsyncAction<
75
75
  OsanoState,
76
76
  OsanoAction<
@@ -87,9 +87,12 @@ export const saveConsent =
87
87
  const consent = getConsent(state);
88
88
  dispatch({ type: SAVE_BEGIN });
89
89
  return recordConsent(cmp, consent)
90
- .then((newConsent: ConsentCategoryType[] | null) =>
91
- dispatch({ type: SAVE_SUCCESS, payload: newConsent })
92
- )
90
+ .then((newConsent: ConsentCategoryType[] | null) => {
91
+ dispatch({ type: SAVE_SUCCESS, payload: newConsent });
92
+ if (newConsent) {
93
+ cmp.triggerGoogleConsentUpdate(newConsent);
94
+ }
95
+ })
93
96
  .catch(() => {
94
97
  dispatch({ type: SAVE_FAILURE, payload: oldConsent });
95
98
  });
@@ -1,24 +1,24 @@
1
- import { Path, Polygon, Svg } from 'react-native-svg';
1
+ import React, { useCallback, useContext, useMemo } from 'react';
2
2
  import {
3
3
  Pressable,
4
4
  type PressableProps,
5
5
  type StyleProp,
6
6
  Text,
7
7
  type TextStyle,
8
- type ViewStyle,
9
8
  type View,
9
+ type ViewStyle,
10
10
  } from 'react-native';
11
- import React, { useCallback, useContext, useMemo } from 'react';
11
+ import { Path, Polygon, Svg } from 'react-native-svg';
12
12
  import { acceptAll, close, denyAll, goBack, showDrawer } from '../actions';
13
13
  import { saveConsent } from '../commands';
14
14
 
15
- import Locale from './Locale';
16
15
  import { OsanoPrivateContext } from '../context';
17
16
  import {
18
17
  setAllPurposeConsent,
19
18
  setAllSpecialFeatureConsent,
20
19
  setAllVendorConsent,
21
20
  } from '../iab/tcf/actions';
21
+ import Locale from './Locale';
22
22
 
23
23
  type ButtonProps = React.PropsWithoutRef<
24
24
  Omit<PressableProps, 'style' | 'title'> & {
@@ -44,7 +44,7 @@ export const Button: React.FC<ButtonProps> = (props) => {
44
44
  paddingHorizontal: 16,
45
45
  flexBasis: 'auto',
46
46
  }),
47
- [buttonBackgroundColor, buttonForegroundColor]
47
+ [buttonBackgroundColor, buttonForegroundColor],
48
48
  );
49
49
  const buttonText: StyleProp<TextStyle> = useMemo(
50
50
  () => ({
@@ -52,7 +52,7 @@ export const Button: React.FC<ButtonProps> = (props) => {
52
52
  fontSize: 16,
53
53
  fontWeight: 'bold',
54
54
  }),
55
- [buttonForegroundColor]
55
+ [buttonForegroundColor],
56
56
  );
57
57
 
58
58
  return (
@@ -71,7 +71,7 @@ export const Button: React.FC<ButtonProps> = (props) => {
71
71
 
72
72
  export const DenyButton = (props: ButtonProps) => {
73
73
  const { cmp, dispatch } = useContext(OsanoPrivateContext);
74
- const { onPress, title , testID} = props;
74
+ const { onPress, title, testID } = props;
75
75
 
76
76
  const handleReject = useCallback(() => {
77
77
  dispatch(setAllVendorConsent(false));
@@ -84,9 +84,9 @@ export const DenyButton = (props: ButtonProps) => {
84
84
 
85
85
  return Button({
86
86
  ...props,
87
- title: title || `buttons.deny`,
87
+ title: title || 'buttons.denyNonEssential',
88
88
  onPress: onPress || handleReject,
89
- testID: testID || 'Deny'
89
+ testID: testID || 'DenyNonEssential',
90
90
  });
91
91
  };
92
92
 
@@ -104,7 +104,7 @@ export const AcceptButton = (props: ButtonProps) => {
104
104
  ...props,
105
105
  title: title || 'buttons.accept',
106
106
  onPress: onPress || handleAcceptConsent,
107
- testID: 'Accept'
107
+ testID: 'Accept',
108
108
  });
109
109
  };
110
110
 
@@ -113,7 +113,7 @@ export const CloseButton = React.forwardRef(
113
113
  props: PressableProps & {
114
114
  color?: string;
115
115
  },
116
- ref: React.Ref<View>
116
+ ref: React.Ref<View>,
117
117
  ) => {
118
118
  const { color = '#fafafa', onPress, ...remain } = props;
119
119
  const { cmp, dispatch } = useContext(OsanoPrivateContext);
@@ -134,13 +134,13 @@ export const CloseButton = React.forwardRef(
134
134
  </Svg>
135
135
  </Pressable>
136
136
  );
137
- }
137
+ },
138
138
  );
139
139
 
140
140
  export const BackButton = (
141
141
  props: PressableProps & {
142
142
  color?: string;
143
- }
143
+ },
144
144
  ) => {
145
145
  const { color = '#fafafa', onPress, ...remain } = props;
146
146
  const { dispatch } = useContext(OsanoPrivateContext);
@@ -169,7 +169,7 @@ export const ManagePreferencesButton = (props: ButtonProps) => {
169
169
  onPress: onPress || handleShowDrawer,
170
170
  title: `buttons.dialog.openDrawer.${config?.jurisdiction}`,
171
171
  defaultPhrase: 'buttons.managePreferences',
172
- testID: `Manage Preferences`
172
+ testID: `Manage Preferences`,
173
173
  });
174
174
  };
175
175
 
@@ -179,7 +179,7 @@ export const RejectAllButton = (props: ButtonProps) => {
179
179
  ...props,
180
180
  title: `buttons.dialog.denyAll.${config?.jurisdiction}`,
181
181
  defaultPhrase: 'buttons.denyAll',
182
- testID: `Reject All`
182
+ testID: `Reject All`,
183
183
  });
184
184
  };
185
185
 
@@ -196,7 +196,7 @@ export const SaveButton = (props: ButtonProps) => {
196
196
  ...props,
197
197
  title: title || `buttons.save`,
198
198
  onPress: onPress || handleSave,
199
- testID: `Save`
199
+ testID: `Save`,
200
200
  });
201
201
  };
202
202
 
@@ -216,6 +216,6 @@ export const AcceptAllButton = (props: ButtonProps) => {
216
216
  ...remain,
217
217
  onPress: onPress || handleAcceptAllConsent,
218
218
  title: `buttons.acceptAll`,
219
- testID: `Accept All`
219
+ testID: `Accept All`,
220
220
  });
221
221
  };
package/src/context.ts CHANGED
@@ -5,14 +5,15 @@ import type {
5
5
  Store,
6
6
  ThunkDispatch,
7
7
  } from './hooks/useThunkReducer';
8
+ import type { GoogleConsentModeCallback } from './types/google-consent-mode';
8
9
  import type { OsanoAction, OsanoState } from './types/store';
9
10
 
10
- import { ConsentCategory } from './constants';
11
11
  import React from 'react';
12
- import Translator from './utils/Translator';
13
- import { createSharedStyles } from './styles';
12
+ import { ConsentCategory } from './constants';
14
13
  import { initialState } from './reducer';
14
+ import { createSharedStyles } from './styles';
15
15
  import { noop } from './utils';
16
+ import Translator from './utils/Translator';
16
17
 
17
18
  type OsanoPublicContextType = {
18
19
  locale: string;
@@ -48,6 +49,7 @@ type OsanoPrivateContextType = {
48
49
  locale: string;
49
50
  sharedStyles: ReturnType<typeof createSharedStyles>;
50
51
  translate: Translator['translate'];
52
+ setGoogleConsentModeCallback: (callback: GoogleConsentModeCallback) => void;
51
53
  };
52
54
 
53
55
  export const OsanoPublicContext = React.createContext<OsanoPublicContextType>({
@@ -77,5 +79,6 @@ export const OsanoPrivateContext = React.createContext<OsanoPrivateContextType>(
77
79
  locale: 'en',
78
80
  sharedStyles: createSharedStyles(),
79
81
  translate: () => '',
82
+ setGoogleConsentModeCallback: noop,
80
83
  },
81
84
  );
@@ -21,6 +21,52 @@ export const DisplayStatusCodes = {
21
21
  DISABLED: 'disabled',
22
22
  };
23
23
 
24
+ export const IABKeys = {
25
+ LEGACY: {
26
+ CMP_PRESENT: 'IABConsent_CMPPresent',
27
+ SUBJECT_TO_GDPR: 'IABConsent_SubjectToGDPR',
28
+ CONSENT_STRING: 'IABConsent_ConsentString',
29
+ PARSED_PURPOSE_CONSENTS: 'IABConsent_ParsedPurposeConsents',
30
+ PARSED_VENDOR_CONSENTS: 'IABConsent_ParsedVendorConsents',
31
+ },
32
+ IABTCF: {
33
+ CMP_SDK_ID: 'IABTCF_CmpSdkID',
34
+ CMP_SDK_VERSION: 'IABTCF_CmpSdkVersion',
35
+ POLICY_VERSION: 'IABTCF_PolicyVersion',
36
+ GDPR_APPLIES: 'IABTCF_gdprApplies',
37
+ PUBLISHER_CC: 'IABTCF_PublisherCC',
38
+ PURPOSE_ONE_TREATMENT: 'IABTCF_PurposeOneTreatment',
39
+ USE_NON_STANDARD_TEXTS: 'IABTCF_UseNonStandardTexts',
40
+ TC_STRING: 'IABTCF_TCString',
41
+ VENDOR_CONSENTS: 'IABTCF_VendorConsents',
42
+ VENDOR_LEGITIMATE_INTERESTS: 'IABTCF_VendorLegitimateInterests',
43
+ PURPOSE_CONSENTS: 'IABTCF_PurposeConsents',
44
+ PURPOSE_LEGITIMATE_INTERESTS: 'IABTCF_PurposeLegitimateInterests',
45
+ SPECIAL_FEATURES_OPT_INS: 'IABTCF_SpecialFeaturesOptIns',
46
+ ADDTL_CONSENT: 'IABTCF_AddtlConsent',
47
+ ENABLE_ADVERTISER_CONSENT_MODE: 'IABTCF_EnableAdvertiserConsentMode',
48
+ },
49
+ } as const;
50
+
51
+ export const getAllIABKeys = () => [
52
+ ...Object.values(IABKeys.LEGACY),
53
+ ...Object.values(IABKeys.IABTCF),
54
+ ];
55
+
56
+ export const DEFAULT_STORAGE_KEYS = {
57
+ LEGACY: Object.values(IABKeys.LEGACY),
58
+ IABTCF: [
59
+ IABKeys.IABTCF.GDPR_APPLIES,
60
+ IABKeys.IABTCF.TC_STRING,
61
+ IABKeys.IABTCF.PURPOSE_CONSENTS,
62
+ IABKeys.IABTCF.VENDOR_CONSENTS,
63
+ IABKeys.IABTCF.ADDTL_CONSENT,
64
+ IABKeys.IABTCF.ENABLE_ADVERTISER_CONSENT_MODE,
65
+ ],
66
+ } as const;
67
+
68
+ export const CUSTOM_STORAGE_KEYS = Object.values(IABKeys.IABTCF);
69
+
24
70
  export const purposeIds = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
25
71
  export const purposeMap: Record<ConsentCategoryType, number[]> = {
26
72
  [ConsentCategory.ESSENTIAL]: [1],