@osano/osano-cmp-react-native 0.10.0 → 0.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (278) hide show
  1. package/README.md +1 -0
  2. package/lib/commonjs/ConsentManager.js +29 -1
  3. package/lib/commonjs/ConsentManager.js.map +1 -1
  4. package/lib/commonjs/components/Button.js +27 -12
  5. package/lib/commonjs/components/Button.js.map +1 -1
  6. package/lib/commonjs/context.js +2 -1
  7. package/lib/commonjs/context.js.map +1 -1
  8. package/lib/commonjs/iab/tcf/consent.js +0 -5
  9. package/lib/commonjs/iab/tcf/consent.js.map +1 -1
  10. package/lib/commonjs/index.js +25 -6
  11. package/lib/commonjs/index.js.map +1 -1
  12. package/lib/commonjs/locale/af.json +324 -321
  13. package/lib/commonjs/locale/ar.json +324 -321
  14. package/lib/commonjs/locale/bg.json +324 -321
  15. package/lib/commonjs/locale/ca.json +324 -321
  16. package/lib/commonjs/locale/cs.json +324 -321
  17. package/lib/commonjs/locale/da.json +324 -321
  18. package/lib/commonjs/locale/de-at.json +324 -321
  19. package/lib/commonjs/locale/de.json +324 -321
  20. package/lib/commonjs/locale/el.json +324 -321
  21. package/lib/commonjs/locale/en-au.json +324 -321
  22. package/lib/commonjs/locale/en-ca.json +324 -321
  23. package/lib/commonjs/locale/en-gb.json +324 -321
  24. package/lib/commonjs/locale/en.json +324 -321
  25. package/lib/commonjs/locale/es-mx.json +324 -321
  26. package/lib/commonjs/locale/es.json +324 -321
  27. package/lib/commonjs/locale/et.json +324 -321
  28. package/lib/commonjs/locale/fa.json +324 -321
  29. package/lib/commonjs/locale/fi.json +324 -321
  30. package/lib/commonjs/locale/fr-ca.json +324 -321
  31. package/lib/commonjs/locale/fr.json +324 -321
  32. package/lib/commonjs/locale/gd.json +324 -321
  33. package/lib/commonjs/locale/he.json +324 -321
  34. package/lib/commonjs/locale/hi.json +324 -321
  35. package/lib/commonjs/locale/hr.json +324 -321
  36. package/lib/commonjs/locale/hu.json +324 -321
  37. package/lib/commonjs/locale/hy.json +324 -321
  38. package/lib/commonjs/locale/id.json +324 -321
  39. package/lib/commonjs/locale/is.json +324 -321
  40. package/lib/commonjs/locale/it.json +324 -321
  41. package/lib/commonjs/locale/ja.json +324 -321
  42. package/lib/commonjs/locale/kk.json +324 -321
  43. package/lib/commonjs/locale/ko.json +324 -321
  44. package/lib/commonjs/locale/lt.json +324 -321
  45. package/lib/commonjs/locale/lv.json +324 -321
  46. package/lib/commonjs/locale/mi.json +324 -321
  47. package/lib/commonjs/locale/ms.json +324 -321
  48. package/lib/commonjs/locale/nb.json +324 -321
  49. package/lib/commonjs/locale/nl-be.json +324 -321
  50. package/lib/commonjs/locale/nl.json +324 -321
  51. package/lib/commonjs/locale/nn.json +324 -321
  52. package/lib/commonjs/locale/no.json +324 -321
  53. package/lib/commonjs/locale/pl.json +324 -321
  54. package/lib/commonjs/locale/pt-br.json +324 -321
  55. package/lib/commonjs/locale/pt.json +324 -321
  56. package/lib/commonjs/locale/ro.json +324 -321
  57. package/lib/commonjs/locale/ru.json +324 -321
  58. package/lib/commonjs/locale/sk.json +324 -321
  59. package/lib/commonjs/locale/sl.json +324 -321
  60. package/lib/commonjs/locale/sq.json +324 -321
  61. package/lib/commonjs/locale/sr.json +324 -321
  62. package/lib/commonjs/locale/sv.json +324 -321
  63. package/lib/commonjs/locale/th.json +324 -321
  64. package/lib/commonjs/locale/tl.json +324 -321
  65. package/lib/commonjs/locale/tr.json +324 -321
  66. package/lib/commonjs/locale/uk.json +324 -321
  67. package/lib/commonjs/locale/vi.json +324 -321
  68. package/lib/commonjs/locale/zh-hk.json +324 -321
  69. package/lib/commonjs/locale/zh-tw.json +324 -321
  70. package/lib/commonjs/locale/zh.json +324 -321
  71. package/lib/commonjs/locale/zu.json +324 -321
  72. package/lib/commonjs/selectors.js +1 -1
  73. package/lib/commonjs/selectors.js.map +1 -1
  74. package/lib/commonjs/services/consent.js +54 -3
  75. package/lib/commonjs/services/consent.js.map +1 -1
  76. package/lib/commonjs/utils/EventEmitter.js +0 -2
  77. package/lib/commonjs/utils/EventEmitter.js.map +1 -1
  78. package/lib/commonjs/utils/Translator.js +2 -2
  79. package/lib/commonjs/utils/Translator.js.map +1 -1
  80. package/lib/commonjs/views/Dialog/Message.js +2 -2
  81. package/lib/commonjs/views/Dialog/Message.js.map +1 -1
  82. package/lib/commonjs/views/Dialog/index.js +1 -0
  83. package/lib/commonjs/views/Dialog/index.js.map +1 -1
  84. package/lib/commonjs/views/Drawer/index.js +1 -0
  85. package/lib/commonjs/views/Drawer/index.js.map +1 -1
  86. package/lib/module/ConsentManager.js +30 -2
  87. package/lib/module/ConsentManager.js.map +1 -1
  88. package/lib/module/components/Button.js +27 -12
  89. package/lib/module/components/Button.js.map +1 -1
  90. package/lib/module/context.js +2 -1
  91. package/lib/module/context.js.map +1 -1
  92. package/lib/module/iab/tcf/consent.js +0 -5
  93. package/lib/module/iab/tcf/consent.js.map +1 -1
  94. package/lib/module/index.js +25 -6
  95. package/lib/module/index.js.map +1 -1
  96. package/lib/module/locale/af.json +324 -321
  97. package/lib/module/locale/ar.json +324 -321
  98. package/lib/module/locale/bg.json +324 -321
  99. package/lib/module/locale/ca.json +324 -321
  100. package/lib/module/locale/cs.json +324 -321
  101. package/lib/module/locale/da.json +324 -321
  102. package/lib/module/locale/de-at.json +324 -321
  103. package/lib/module/locale/de.json +324 -321
  104. package/lib/module/locale/el.json +324 -321
  105. package/lib/module/locale/en-au.json +324 -321
  106. package/lib/module/locale/en-ca.json +324 -321
  107. package/lib/module/locale/en-gb.json +324 -321
  108. package/lib/module/locale/en.json +324 -321
  109. package/lib/module/locale/es-mx.json +324 -321
  110. package/lib/module/locale/es.json +324 -321
  111. package/lib/module/locale/et.json +324 -321
  112. package/lib/module/locale/fa.json +324 -321
  113. package/lib/module/locale/fi.json +324 -321
  114. package/lib/module/locale/fr-ca.json +324 -321
  115. package/lib/module/locale/fr.json +324 -321
  116. package/lib/module/locale/gd.json +324 -321
  117. package/lib/module/locale/he.json +324 -321
  118. package/lib/module/locale/hi.json +324 -321
  119. package/lib/module/locale/hr.json +324 -321
  120. package/lib/module/locale/hu.json +324 -321
  121. package/lib/module/locale/hy.json +324 -321
  122. package/lib/module/locale/id.json +324 -321
  123. package/lib/module/locale/is.json +324 -321
  124. package/lib/module/locale/it.json +324 -321
  125. package/lib/module/locale/ja.json +324 -321
  126. package/lib/module/locale/kk.json +324 -321
  127. package/lib/module/locale/ko.json +324 -321
  128. package/lib/module/locale/lt.json +324 -321
  129. package/lib/module/locale/lv.json +324 -321
  130. package/lib/module/locale/mi.json +324 -321
  131. package/lib/module/locale/ms.json +324 -321
  132. package/lib/module/locale/nb.json +324 -321
  133. package/lib/module/locale/nl-be.json +324 -321
  134. package/lib/module/locale/nl.json +324 -321
  135. package/lib/module/locale/nn.json +324 -321
  136. package/lib/module/locale/no.json +324 -321
  137. package/lib/module/locale/pl.json +324 -321
  138. package/lib/module/locale/pt-br.json +324 -321
  139. package/lib/module/locale/pt.json +324 -321
  140. package/lib/module/locale/ro.json +324 -321
  141. package/lib/module/locale/ru.json +324 -321
  142. package/lib/module/locale/sk.json +324 -321
  143. package/lib/module/locale/sl.json +324 -321
  144. package/lib/module/locale/sq.json +324 -321
  145. package/lib/module/locale/sr.json +324 -321
  146. package/lib/module/locale/sv.json +324 -321
  147. package/lib/module/locale/th.json +324 -321
  148. package/lib/module/locale/tl.json +324 -321
  149. package/lib/module/locale/tr.json +324 -321
  150. package/lib/module/locale/uk.json +324 -321
  151. package/lib/module/locale/vi.json +324 -321
  152. package/lib/module/locale/zh-hk.json +324 -321
  153. package/lib/module/locale/zh-tw.json +324 -321
  154. package/lib/module/locale/zh.json +324 -321
  155. package/lib/module/locale/zu.json +324 -321
  156. package/lib/module/selectors.js +1 -1
  157. package/lib/module/selectors.js.map +1 -1
  158. package/lib/module/services/consent.js +48 -1
  159. package/lib/module/services/consent.js.map +1 -1
  160. package/lib/module/utils/EventEmitter.js +0 -2
  161. package/lib/module/utils/EventEmitter.js.map +1 -1
  162. package/lib/module/utils/Translator.js +2 -2
  163. package/lib/module/utils/Translator.js.map +1 -1
  164. package/lib/module/views/Dialog/Message.js +2 -2
  165. package/lib/module/views/Dialog/Message.js.map +1 -1
  166. package/lib/module/views/Dialog/index.js +1 -0
  167. package/lib/module/views/Dialog/index.js.map +1 -1
  168. package/lib/module/views/Drawer/index.js +1 -0
  169. package/lib/module/views/Drawer/index.js.map +1 -1
  170. package/lib/typescript/lib/commonjs/ConsentManager.d.ts +2 -1
  171. package/lib/typescript/lib/commonjs/ConsentManager.d.ts.map +1 -1
  172. package/lib/typescript/lib/commonjs/components/Button.d.ts.map +1 -1
  173. package/lib/typescript/lib/commonjs/iab/tcf/consent.d.ts.map +1 -1
  174. package/lib/typescript/lib/commonjs/services/consent.d.ts +4 -0
  175. package/lib/typescript/lib/commonjs/services/consent.d.ts.map +1 -1
  176. package/lib/typescript/lib/commonjs/utils/EventEmitter.d.ts.map +1 -1
  177. package/lib/typescript/lib/commonjs/views/Dialog/index.d.ts.map +1 -1
  178. package/lib/typescript/lib/commonjs/views/Drawer/index.d.ts.map +1 -1
  179. package/lib/typescript/lib/module/ConsentManager.d.ts +1 -0
  180. package/lib/typescript/lib/module/ConsentManager.d.ts.map +1 -1
  181. package/lib/typescript/lib/module/components/Button.d.ts.map +1 -1
  182. package/lib/typescript/lib/module/context.d.ts +1 -0
  183. package/lib/typescript/lib/module/context.d.ts.map +1 -1
  184. package/lib/typescript/lib/module/iab/tcf/consent.d.ts.map +1 -1
  185. package/lib/typescript/lib/module/index.d.ts.map +1 -1
  186. package/lib/typescript/lib/module/services/consent.d.ts +4 -0
  187. package/lib/typescript/lib/module/services/consent.d.ts.map +1 -1
  188. package/lib/typescript/lib/module/utils/EventEmitter.d.ts.map +1 -1
  189. package/lib/typescript/lib/module/views/Dialog/index.d.ts.map +1 -1
  190. package/lib/typescript/lib/module/views/Drawer/index.d.ts.map +1 -1
  191. package/lib/typescript/src/ConsentManager.d.ts +1 -0
  192. package/lib/typescript/src/ConsentManager.d.ts.map +1 -1
  193. package/lib/typescript/src/components/Button.d.ts.map +1 -1
  194. package/lib/typescript/src/context.d.ts +1 -0
  195. package/lib/typescript/src/context.d.ts.map +1 -1
  196. package/lib/typescript/src/iab/tcf/consent.d.ts.map +1 -1
  197. package/lib/typescript/src/index.d.ts.map +1 -1
  198. package/lib/typescript/src/selectors.d.ts.map +1 -1
  199. package/lib/typescript/src/services/consent.d.ts +12 -1
  200. package/lib/typescript/src/services/consent.d.ts.map +1 -1
  201. package/lib/typescript/src/utils/EventEmitter.d.ts.map +1 -1
  202. package/lib/typescript/src/views/Dialog/Message.d.ts.map +1 -1
  203. package/lib/typescript/src/views/Dialog/index.d.ts.map +1 -1
  204. package/lib/typescript/src/views/Drawer/index.d.ts.map +1 -1
  205. package/package.json +1 -1
  206. package/src/ConsentManager.ts +42 -1
  207. package/src/components/Button.tsx +22 -12
  208. package/src/context.ts +8 -6
  209. package/src/iab/tcf/consent.ts +11 -16
  210. package/src/index.tsx +42 -14
  211. package/src/locale/af.json +324 -321
  212. package/src/locale/ar.json +324 -321
  213. package/src/locale/bg.json +324 -321
  214. package/src/locale/ca.json +324 -321
  215. package/src/locale/cs.json +324 -321
  216. package/src/locale/da.json +324 -321
  217. package/src/locale/de-at.json +324 -321
  218. package/src/locale/de.json +324 -321
  219. package/src/locale/el.json +324 -321
  220. package/src/locale/en-au.json +324 -321
  221. package/src/locale/en-ca.json +324 -321
  222. package/src/locale/en-gb.json +324 -321
  223. package/src/locale/en.json +324 -321
  224. package/src/locale/es-mx.json +324 -321
  225. package/src/locale/es.json +324 -321
  226. package/src/locale/et.json +324 -321
  227. package/src/locale/fa.json +324 -321
  228. package/src/locale/fi.json +324 -321
  229. package/src/locale/fr-ca.json +324 -321
  230. package/src/locale/fr.json +324 -321
  231. package/src/locale/gd.json +324 -321
  232. package/src/locale/he.json +324 -321
  233. package/src/locale/hi.json +324 -321
  234. package/src/locale/hr.json +324 -321
  235. package/src/locale/hu.json +324 -321
  236. package/src/locale/hy.json +324 -321
  237. package/src/locale/id.json +324 -321
  238. package/src/locale/is.json +324 -321
  239. package/src/locale/it.json +324 -321
  240. package/src/locale/ja.json +324 -321
  241. package/src/locale/kk.json +324 -321
  242. package/src/locale/ko.json +324 -321
  243. package/src/locale/lt.json +324 -321
  244. package/src/locale/lv.json +324 -321
  245. package/src/locale/mi.json +324 -321
  246. package/src/locale/ms.json +324 -321
  247. package/src/locale/nb.json +324 -321
  248. package/src/locale/nl-be.json +324 -321
  249. package/src/locale/nl.json +324 -321
  250. package/src/locale/nn.json +324 -321
  251. package/src/locale/no.json +324 -321
  252. package/src/locale/pl.json +324 -321
  253. package/src/locale/pt-br.json +324 -321
  254. package/src/locale/pt.json +324 -321
  255. package/src/locale/ro.json +324 -321
  256. package/src/locale/ru.json +324 -321
  257. package/src/locale/sk.json +324 -321
  258. package/src/locale/sl.json +324 -321
  259. package/src/locale/sq.json +324 -321
  260. package/src/locale/sr.json +324 -321
  261. package/src/locale/sv.json +324 -321
  262. package/src/locale/th.json +324 -321
  263. package/src/locale/tl.json +324 -321
  264. package/src/locale/tr.json +324 -321
  265. package/src/locale/uk.json +324 -321
  266. package/src/locale/vi.json +324 -321
  267. package/src/locale/zh-hk.json +324 -321
  268. package/src/locale/zh-tw.json +324 -321
  269. package/src/locale/zh.json +324 -321
  270. package/src/locale/zu.json +324 -321
  271. package/src/selectors.ts +1 -0
  272. package/src/services/consent.ts +66 -1
  273. package/src/types/consent-config.d.ts +0 -3
  274. package/src/utils/EventEmitter.ts +1 -3
  275. package/src/utils/Translator.ts +15 -15
  276. package/src/views/Dialog/Message.tsx +2 -1
  277. package/src/views/Dialog/index.tsx +1 -0
  278. package/src/views/Drawer/index.tsx +1 -0
@@ -14,6 +14,7 @@ type OsanoPublicContextType = {
14
14
  setLocale: (locale: string) => void;
15
15
  showBanner: () => void;
16
16
  showDrawer: () => void;
17
+ isReady: boolean;
17
18
  };
18
19
  type OsanoPrivateContextType = {
19
20
  addMiddleware: (m: (store: Store<OsanoState, OsanoAction>) => (next: MiddlewareNext<OsanoAction>) => MiddlewareNext<OsanoAction>) => void;
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../src/context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACjE,OAAO,KAAK,EACX,QAAQ,EACR,cAAc,EACd,KAAK,EACL,aAAa,EACb,MAAM,yBAAyB,CAAC;AACjC,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE7D,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EAAE,kBAAkB,EAAE,MAAM,UAAU,CAAC;AAI9C,KAAK,sBAAsB,GAAG;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,CAAC,QAAQ,CAAC,EAAE,eAAe,KAAK,OAAO,GAAG,eAAe,EAAE,CAAC;IACxE,WAAW,EAAE,MAAM,MAAM,CAAC;IAC1B,YAAY,EAAE,MAAM,IAAI,CAAC;IACzB,OAAO,EAAE,CACR,OAAO,CAAC,EAAE,eAAe,GAAG,eAAe,EAAE,KACzC,OAAO,CAAC,eAAe,EAAE,CAAC,CAAC;IAChC,SAAS,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACpC,UAAU,EAAE,MAAM,IAAI,CAAC;IACvB,UAAU,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC9B,aAAa,EAAE,CACd,CAAC,EAAE,CACF,KAAK,EAAE,KAAK,CAAC,UAAU,EAAE,WAAW,CAAC,KACjC,CAAC,IAAI,EAAE,cAAc,CAAC,WAAW,CAAC,KAAK,cAAc,CAAC,W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,CAAC;AAEF,eAAO,MAAM,kBAAkB,uCAY7B,CAAC;AAEH,eAAO,MAAM,mBAAmB,wCAc/B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../../../../../src/iab/tcf/consent.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAiB9E,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,aAAa;;;;;;;;CAQzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,WACrB,aAAa,SACd,UAAU,GAAG,QAAQ,cAChB,cAAc,4BA8C1B,CAAC;AAEF,eAAO,MAAM,4BAA4B,WAChC,aAAa,SACd,QAAQ,GAAG,UAAU,cAChB,cAAc,4BA2D1B,CAAC;AAEF,eAAO,MAAM,sBAAsB,gBACpB,cAAc,gBACjB,MAAM,KAAG,MAgCnB,CAAC;AAEH,eAAO,MAAM,YAAY,gBAAiB,cAAc,gBAKrC,MAAM,kBAAkB,MAAM,cAEhD,CAAC;AAEF,eAAO,MAAM,sBAAsB,gBACpB,cAAc,cACnB,aAAa,SAAS,UAAU,GAAG,QAAQ,KAuE9C,MACL,CAAC;AAEH,eAAO,MAAM,uBAAuB,gBACrB,cAAc,cACnB,aAAa,SAAS,UAAU,GAAG,QAAQ,WAqCnD,CAAC;AAEH,eAAO,MAAM,mBAAmB,gBAAiB,cAAc,eAE7C,OAAO,CAAC,MAAM,CAAC;;;;CAOhC,CAAC"}
1
+ {"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../../../../../src/iab/tcf/consent.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,E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
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAwD,MAAM,OAAO,CAAC;AAa7E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAS1C,OAAO,EAAE,kBAAkB,IAAI,YAAY,EAAE,MAAM,WAAW,CAAC;AAQ/D,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,iBAAiB,CAC1C,KAAK,CAAC,iBAAiB,CAAC,UAAU,CAAC,CA+MnC,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"selectors.d.ts","sourceRoot":"","sources":["../../../src/selectors.ts"],"names":[],"mappings":"AACA,OAAO,EAEN,eAAe,IAAI,mBAAmB,EACtC,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAI5D,eAAO,MAAM,kBAAkB,UACvB,UAAU,YACP,mBAAmB,YACW,CAAC;AAE1C,eAAO,MAAM,wBAAwB,UAAW,UAAU,YACrB,CAAC;AACtC,eAAO,MAAM,kBAAkB,UACvB,UAAU,YACP,mBAAmB,YAMuB,CAAC;AAEtD,eAAO,MAAM,YAAY,UAAW,UAAU,YAA2B,CAAC;AAC1E,eAAO,MAAM,YAAY,UAAW,UAAU,YACL,CAAC;AAE1C,eAAO,MAAM,mBAAmB,UAAW,UAAU,YAKmB,CAAC;AACzE,eAAO,MAAM,kBAAkB,UAAW,UAAU,gBAAgB,OAAO,YAK3D,CAAC;AAEjB,wBAAgB,UAAU,CAAC,KAAK,EAAE,UAAU,GAAG,mBAAmB,EAAE,CAAC;AACrE,wBAAgB,UAAU,CACzB,KAAK,EAAE,UAAU,EACjB,QAAQ,EAAE,mBAAmB,GAC3B,OAAO,CAAC;AASX,eAAO,MAAM,mBAAmB,UAAW,UAAU,KAAG,MACpB,CAAC;AAQrC,eAAO,MAAM,cAAc,UAAW,UAAU,YACpB,CAAC;AAC7B,eAA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O,MAAM,oBAAoB,UAAW,UAAU,YAErD,CAAC;AACF,eAAO,MAAM,gCAAgC,UACrC,UAAU,YACP,mBAAmB,YAO7B,CAAC;AACF,eAAO,MAAM,sBAAsB,UAC3B,UAAU,YACP,mBAAmB,KAC3B,UAAU,EAUZ,CAAC;AAEF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,GAAG,MAAM,EAAE,CAAC;AACtD,wBAAgB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC"}
@@ -28,5 +28,16 @@ export declare const clearConsent: (cmp: ConsentManager) => Promise<ConsentCateg
28
28
  export declare const recordConsent: (cmp: ConsentManager, consent?: ConsentCategoryType[]) => Promise<ConsentCategory[]>;
29
29
  export declare function hashExtUsrData(customerId: string, configId: string, extUsrData: string): string;
30
30
  export declare const fetchConsent: (cmp: ConsentManager) => Promise<ConsentCategory[]>;
31
- export declare const fetchConfig: (customerId: string, configId: string) => Promise<Config | null>;
31
+ export declare const fetchConfig: (customerId: string, configId: string) => Promise<Config>;
32
+ export declare const getStoredConfig: (configId: string) => Promise<Config | null>;
33
+ export declare const storeConfig: (configId: string, config: Config) => Promise<void>;
34
+ export declare const getConfigLastStoredAt: (configId: string) => Promise<Date | null>;
35
+ /**
36
+ * Determine if a cached config is stale
37
+ *
38
+ * @async
39
+ * @param {string} configId
40
+ * @returns {Promise<boolean>}
41
+ */
42
+ export declare const hasStaleConfig: (configId: string) => Promise<boolean>;
32
43
  //# sourceMappingURL=consent.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"consent.d.ts","sourceRoot":"","sources":["../../../../src/services/consent.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,eAAe,IAAI,mBAAmB,EACtC,MAAM,cAAc,CAAC;AAItB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mB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CAAC;AAEF,eAAO,MAAM,WAAW,aACb,MAAM,UACR,MAAM,KACZ,OAAO,CAAC,IAAI,CAYd,CAAC;AAEF,eAAO,MAAM,qBAAqB,aACvB,MAAM,KACd,OAAO,CAAC,IAAI,GAAG,IAAI,CAYrB,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,cAAc,aAAoB,MAAM,KAAG,OAAO,CAAC,OAAO,CAStE,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../../../../src/utils/EventEmitter.ts"],"names":[],"mappings":"AACA,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAW;gBAEhB,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAMpE,MAAM;CAGN;AAED,qBAAa,YAAY;IACxB,OAAO,CAAC,OAAO,CAAkC;IAEjD,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAUpC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAUrC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAMtC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;CAOtC"}
1
+ {"version":3,"file":"EventEmitter.d.ts","sourceRoot":"","sources":["../../../../src/utils/EventEmitter.ts"],"names":[],"mappings":"AACA,qBAAa,iBAAiB;IAC7B,OAAO,CAAC,QAAQ,CAAe;IAC/B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,SAAS,CAAW;gBAEhB,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAMpE,MAAM;CAGN;AAED,qBAAa,YAAY;IACxB,OAAO,CAAC,OAAO,CAAkC;IAEjD,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IASpC,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IASrC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,OAAO,EAAE;IAMtC,IAAI,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;CAOtC"}
@@ -1 +1 @@
1
- {"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../../src/views/Dialog/Message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,eAAO,MAAM,OAAO,yBA0DnB,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"Message.d.ts","sourceRoot":"","sources":["../../../../../src/views/Dialog/Message.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAK1C,eAAO,MAAM,OAAO,yBA2DnB,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/Dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,EAWL,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAiB1C,eAAO,MAAM,MAAM,QAAO,YAAY,CAAC,KAAK,CAqS3C,CAAC;AAyGF,eAAe,MAAM,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/Dialog/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EACN,KAAK,EAWL,MAAM,cAAc,CAAC;AAStB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAiB1C,eAAO,MAAM,MAAM,QAAO,YAAY,CAAC,KAAK,CAsS3C,CAAC;AAyGF,eAAe,MAAM,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/Drawer/index.tsx"],"names":[],"mappings":"AAcA,OAAO,KAMN,MAAM,OAAO,CAAC;AAgBf,KAAK,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAKnD,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAmOxC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/views/Drawer/index.tsx"],"names":[],"mappings":"AAcA,OAAO,KAMN,MAAM,OAAO,CAAC;AAgBf,KAAK,WAAW,GAAG,KAAK,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;AAKnD,eAAO,MAAM,MAAM,EAAE,KAAK,CAAC,EAAE,CAAC,WAAW,CAoOxC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@osano/osano-cmp-react-native",
3
- "version": "0.10.0",
3
+ "version": "0.12.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",
@@ -12,6 +12,9 @@ import {
12
12
  clearConsent as clearStoredConsent,
13
13
  fetchConfig,
14
14
  fetchConsent,
15
+ getStoredConfig,
16
+ hasStaleConfig,
17
+ storeConfig,
15
18
  } from './services/consent';
16
19
  import flavors, { defaultFlavor, type Flavor } from './flavors';
17
20
  import { get, merge } from './utils';
@@ -137,6 +140,40 @@ const migrateIabConfig = (
137
140
 
138
141
  const emptyArray: never[] = [];
139
142
 
143
+ async function fetchConfigWithRetries(
144
+ customerId: string,
145
+ configId: string,
146
+ retries: number = 3,
147
+ delay: number = 500,
148
+ ): Promise<Config | null> {
149
+ const isStale = await hasStaleConfig(configId);
150
+
151
+ if (!isStale) {
152
+ // If the config is not stale, we can return the cached config
153
+ const cachedConfig = await getStoredConfig(configId);
154
+
155
+ if (cachedConfig) {
156
+ return cachedConfig;
157
+ }
158
+ }
159
+
160
+ for (let attempt = 1; attempt <= retries; attempt++) {
161
+ try {
162
+ const config = await fetchConfig(customerId, configId);
163
+ return config;
164
+ } catch (error) {
165
+ if (attempt === retries) {
166
+ throw error;
167
+ }
168
+ console.warn(`Attempt ${attempt} failed. Retrying in ${delay}ms...`);
169
+ await new Promise((resolve) => setTimeout(resolve, delay));
170
+ delay *= 2; // Exponential backoff
171
+ }
172
+ }
173
+
174
+ return null;
175
+ }
176
+
140
177
  export class ConsentConfig extends EventEmitter {
141
178
  private _config: Config;
142
179
  private _customerId: string;
@@ -154,7 +191,7 @@ export class ConsentConfig extends EventEmitter {
154
191
  this.emit('loadFailure', CONFIG_ID_ERROR);
155
192
  return;
156
193
  }
157
- return fetchConfig(this._customerId, this._configId)
194
+ return fetchConfigWithRetries(this._customerId, this._configId)
158
195
  .then((config: Config | null) => {
159
196
  if (!config || Object.keys(config).length === 0) {
160
197
  throw CONFIG_NOT_FOUND_ERROR;
@@ -175,12 +212,16 @@ export class ConsentConfig extends EventEmitter {
175
212
  config.palette,
176
213
  ) as Palette;
177
214
  this._config = merge(this._config, config) as Config;
215
+ storeConfig(this._configId, this._config);
178
216
  this.emit('loadSuccess', this._config);
179
217
  })
180
218
  .catch((err) => {
181
219
  this.emit('loadFailure', err);
182
220
  });
183
221
  }
222
+ get config(): Config {
223
+ return this._config;
224
+ }
184
225
  set customerId(value: string) {
185
226
  this._customerId = value || this._customerId;
186
227
  }
@@ -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 } = 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.deny`,
88
88
  onPress: onPress || handleReject,
89
- testID: 'deny-consents-button'
89
+ testID: testID || 'Deny'
90
90
  });
91
91
  };
92
92
 
@@ -94,7 +94,8 @@ export const AcceptButton = (props: ButtonProps) => {
94
94
  const { cmp, dispatch } = useContext(OsanoPrivateContext);
95
95
  const { onPress, title } = props;
96
96
 
97
- const handleSave = useCallback(() => {
97
+ const handleAcceptConsent = useCallback(() => {
98
+ dispatch(acceptAll());
98
99
  cmp && dispatch(saveConsent(cmp));
99
100
  dispatch(close(cmp));
100
101
  }, []);
@@ -102,8 +103,8 @@ export const AcceptButton = (props: ButtonProps) => {
102
103
  return Button({
103
104
  ...props,
104
105
  title: title || 'buttons.accept',
105
- onPress: onPress || handleSave,
106
- testID: 'accept-consents-button'
106
+ onPress: onPress || handleAcceptConsent,
107
+ testID: 'Accept'
107
108
  });
108
109
  };
109
110
 
@@ -168,7 +169,7 @@ export const ManagePreferencesButton = (props: ButtonProps) => {
168
169
  onPress: onPress || handleShowDrawer,
169
170
  title: `buttons.dialog.openDrawer.${config?.jurisdiction}`,
170
171
  defaultPhrase: 'buttons.managePreferences',
171
- testID: 'manage-preferences-button'
172
+ testID: `Manage Preferences`
172
173
  });
173
174
  };
174
175
 
@@ -178,15 +179,24 @@ export const RejectAllButton = (props: ButtonProps) => {
178
179
  ...props,
179
180
  title: `buttons.dialog.denyAll.${config?.jurisdiction}`,
180
181
  defaultPhrase: 'buttons.denyAll',
181
- testID: 'reject-all-consents'
182
+ testID: `Reject All`
182
183
  });
183
184
  };
184
185
 
185
186
  export const SaveButton = (props: ButtonProps) => {
186
- return AcceptButton({
187
+ const { cmp, dispatch } = useContext(OsanoPrivateContext);
188
+ const { onPress, title } = props;
189
+
190
+ const handleSave = useCallback(() => {
191
+ cmp && dispatch(saveConsent(cmp));
192
+ dispatch(close(cmp));
193
+ }, []);
194
+
195
+ return Button({
187
196
  ...props,
188
- title: `buttons.save`,
189
- testID: 'save-consents-button'
197
+ title: title || `buttons.save`,
198
+ onPress: onPress || handleSave,
199
+ testID: `Save`
190
200
  });
191
201
  };
192
202
 
@@ -206,6 +216,6 @@ export const AcceptAllButton = (props: ButtonProps) => {
206
216
  ...remain,
207
217
  onPress: onPress || handleAcceptAllConsent,
208
218
  title: `buttons.acceptAll`,
209
- testID: 'accept-all-consents'
219
+ testID: `Accept All`
210
220
  });
211
221
  };
package/src/context.ts CHANGED
@@ -20,23 +20,24 @@ type OsanoPublicContextType = {
20
20
  getDeviceId: () => string;
21
21
  clearConsent: () => void;
22
22
  consent: (
23
- consent?: ConsentCategory | ConsentCategory[]
23
+ consent?: ConsentCategory | ConsentCategory[],
24
24
  ) => Promise<ConsentCategory[]>;
25
25
  setLocale: (locale: string) => void;
26
26
  showBanner: () => void;
27
27
  showDrawer: () => void;
28
+ isReady: boolean;
28
29
  };
29
30
 
30
31
  type OsanoPrivateContextType = {
31
32
  addMiddleware: (
32
33
  m: (
33
- store: Store<OsanoState, OsanoAction>
34
- ) => (next: MiddlewareNext<OsanoAction>) => MiddlewareNext<OsanoAction>
34
+ store: Store<OsanoState, OsanoAction>,
35
+ ) => (next: MiddlewareNext<OsanoAction>) => MiddlewareNext<OsanoAction>,
35
36
  ) => void;
36
37
  removeMiddleware: (
37
38
  m: (
38
- store: Store<OsanoState, OsanoAction>
39
- ) => (next: MiddlewareNext<OsanoAction>) => MiddlewareNext<OsanoAction>
39
+ store: Store<OsanoState, OsanoAction>,
40
+ ) => (next: MiddlewareNext<OsanoAction>) => MiddlewareNext<OsanoAction>,
40
41
  ) => void;
41
42
  cmp?: ConsentManager;
42
43
  config?: ConsentConfig;
@@ -60,6 +61,7 @@ export const OsanoPublicContext = React.createContext<OsanoPublicContextType>({
60
61
  setLocale: noop,
61
62
  showBanner: noop,
62
63
  showDrawer: noop,
64
+ isReady: false,
63
65
  });
64
66
 
65
67
  export const OsanoPrivateContext = React.createContext<OsanoPrivateContextType>(
@@ -75,5 +77,5 @@ export const OsanoPrivateContext = React.createContext<OsanoPrivateContextType>(
75
77
  locale: 'en',
76
78
  sharedStyles: createSharedStyles(),
77
79
  translate: () => '',
78
- }
80
+ },
79
81
  );
@@ -38,7 +38,7 @@ export const commonConsent = {
38
38
  export const getVendorConsents = (
39
39
  config: ConsentConfig,
40
40
  state: OsanoState & IabState,
41
- apiVersion: TcfVersionType
41
+ apiVersion: TcfVersionType,
42
42
  ) => {
43
43
  const vendors = config.getVendors();
44
44
  /*
@@ -53,7 +53,7 @@ export const getVendorConsents = (
53
53
  */
54
54
  const purposeConsent = consentToPurpose(
55
55
  getSavedConsent(state) || getConsent(state),
56
- apiVersion
56
+ apiVersion,
57
57
  );
58
58
 
59
59
  const consents: Record<string, boolean> = Object.entries(vendors).reduce(
@@ -81,7 +81,7 @@ export const getVendorConsents = (
81
81
  }
82
82
  return vendorConsents;
83
83
  },
84
- {} as Record<string, boolean>
84
+ {} as Record<string, boolean>,
85
85
  );
86
86
  return consents;
87
87
  };
@@ -89,7 +89,7 @@ export const getVendorConsents = (
89
89
  export const getVendorLegitimateInterests = (
90
90
  config: ConsentConfig,
91
91
  state: IabState & OsanoState,
92
- apiVersion: TcfVersionType
92
+ apiVersion: TcfVersionType,
93
93
  ) => {
94
94
  /*
95
95
  * Unless a use has specifically opted out of a vendor, the consent
@@ -131,7 +131,7 @@ export const getVendorLegitimateInterests = (
131
131
  // If any legIntPurposes is not opted out
132
132
  (legIntPurposes &&
133
133
  legIntPurposes.some(
134
- (purposeId) => !optOutPurposes[`${purposeId}`]
134
+ (purposeId) => !optOutPurposes[`${purposeId}`],
135
135
  )) ||
136
136
  /**
137
137
  * Per June 2021 Policy change, Vendors declaring only
@@ -145,7 +145,7 @@ export const getVendorLegitimateInterests = (
145
145
  vendorLegitimateInterests[`${vendorId}`] = true;
146
146
  }
147
147
  }
148
- }
148
+ },
149
149
  );
150
150
  return vendorLegitimateInterests;
151
151
  };
@@ -181,7 +181,7 @@ export const makeParseConsentString =
181
181
  set(tcData, fieldName, decodedValue);
182
182
  return startBit + bitLength;
183
183
  },
184
- 0
184
+ 0,
185
185
  );
186
186
  return tcData as unknown as TcData;
187
187
  };
@@ -231,7 +231,7 @@ export const makeConsentFromOptions =
231
231
  acc[`${field}`] = getter(initOptions, state);
232
232
  return acc;
233
233
  },
234
- {} as Record<string, any>
234
+ {} as Record<string, any>,
235
235
  );
236
236
  return {
237
237
  version: staticFields.version,
@@ -260,7 +260,7 @@ export const makeConsentFromOptions =
260
260
  legitimateInterests: getVendorLegitimateInterests(
261
261
  config,
262
262
  state,
263
- version
263
+ version,
264
264
  ),
265
265
  },
266
266
  specialFeatureOptins: getSpecialFeatureOptIns(state, version),
@@ -287,7 +287,7 @@ export const makeFormatConsentString =
287
287
  const [bitFields] = coreFieldSequence.reduce(
288
288
  (
289
289
  [bitString, startBit],
290
- [key, numBits, { encode: encodeField }, dataField = key]
290
+ [key, numBits, { encode: encodeField }, dataField = key],
291
291
  ) => {
292
292
  let value;
293
293
  if (Object.hasOwnProperty.call(staticFields, dataField)) {
@@ -297,15 +297,10 @@ export const makeFormatConsentString =
297
297
  } else {
298
298
  value = get(tcData, dataField);
299
299
  }
300
- // if (process.env.NODE_ENV === 'development') {
301
- // console.log(
302
- // `TCString encode: ${dataField} -> ${JSON.stringify(value)} :: ${numBits} bits`
303
- // );
304
- // }
305
300
  const encodedValue = encodeField(value, numBits);
306
301
  return [bitString + encodedValue, startBit + encodedValue.length];
307
302
  },
308
- ['', 0]
303
+ ['', 0],
309
304
  );
310
305
  const newCoreString = encode(bitFields);
311
306
  segments.unshift(newCoreString);
package/src/index.tsx CHANGED
@@ -45,18 +45,18 @@ export const Osano: React.FunctionComponent<
45
45
  onLangLoadFailure,
46
46
  onLangLoadSuccess,
47
47
  overrides,
48
- extUsrData
48
+ extUsrData,
49
49
  } = props;
50
50
  const { flavor, iabEnabled } = overrides || {};
51
51
  const consentManager = useRef<ConsentManager>(
52
- new ConsentManager(overrides, extUsrData)
52
+ new ConsentManager(overrides, extUsrData),
53
53
  );
54
54
 
55
55
  const [_state, store] = useThunkReducer<OsanoState, OsanoAction>(
56
56
  reducer,
57
57
  { configId, customerId },
58
58
  init,
59
- [consentManager.current.middleware]
59
+ [consentManager.current.middleware],
60
60
  );
61
61
  const { addMiddleware, dispatch, getState, removeMiddleware } = store;
62
62
 
@@ -81,24 +81,47 @@ export const Osano: React.FunctionComponent<
81
81
  ).filter((cat) => OsanoCategories.includes(cat));
82
82
  consentedCategories = OsanoCategories.filter(
83
83
  (cat) =>
84
- cat === ConsentCategory.ESSENTIAL || categories.includes(cat)
84
+ cat === ConsentCategory.ESSENTIAL || categories.includes(cat),
85
85
  );
86
86
  }
87
87
  return recordConsent(consentManager.current, consentedCategories);
88
88
  },
89
- []
89
+ [],
90
90
  );
91
91
 
92
92
  const handleClearConsent = useCallback(() => {
93
93
  dispatch({ type: CLEAR_CONSENT });
94
94
  }, []);
95
95
 
96
- const handleShowDialog = useCallback(() => {
97
- dispatch(showDialog());
96
+ const retryWithBackoff = async (
97
+ callback: () => void,
98
+ retries: number,
99
+ delay: number,
100
+ ) => {
101
+ for (let attempt = 1; attempt <= retries; attempt++) {
102
+ try {
103
+ if (consentManager.current.loaded) {
104
+ await callback();
105
+ return;
106
+ } else {
107
+ throw new Error('Consent manager not loaded');
108
+ }
109
+ } catch (error) {
110
+ if (attempt === retries) {
111
+ throw error;
112
+ }
113
+ await new Promise((resolve) => setTimeout(resolve, delay));
114
+ delay *= 2; // Exponential backoff
115
+ }
116
+ }
117
+ };
118
+
119
+ const handleShowDialog = useCallback(async () => {
120
+ await retryWithBackoff(() => dispatch(showDialog()), 3, 100);
98
121
  }, []);
99
122
 
100
- const handleShowDrawer = useCallback(() => {
101
- dispatch(showDrawer());
123
+ const handleShowDrawer = useCallback(async () => {
124
+ await retryWithBackoff(() => dispatch(showDrawer()), 3, 100);
102
125
  }, []);
103
126
 
104
127
  const handleSetLocale = useCallback((value: string) => {
@@ -141,8 +164,14 @@ export const Osano: React.FunctionComponent<
141
164
  setLocale: handleSetLocale,
142
165
  showBanner: handleShowDialog,
143
166
  showDrawer: handleShowDrawer,
167
+ isReady: consentManager.current.loaded,
144
168
  };
145
- }, [configId, customerId, consentManager.current.translator.locale]);
169
+ }, [
170
+ configId,
171
+ customerId,
172
+ consentManager.current.translator.locale,
173
+ consentManager.current.loaded,
174
+ ]);
146
175
 
147
176
  useEffect(() => {
148
177
  consentManager.current.config.type = flavor;
@@ -165,7 +194,7 @@ export const Osano: React.FunctionComponent<
165
194
  // a config republish.
166
195
  iabLoaded.current = true;
167
196
  addIabReducers(frameworks)(
168
- store as unknown as Store<OsanoState & IabState, OsanoAction>
197
+ store as unknown as Store<OsanoState & IabState, OsanoAction>,
169
198
  );
170
199
  }
171
200
  consentManager.current.config.iabEnabled = iabEnabled ?? undefined;
@@ -176,9 +205,8 @@ export const Osano: React.FunctionComponent<
176
205
  config: consentManager.current.config,
177
206
  customerId,
178
207
  configId,
179
- })
208
+ }),
180
209
  );
181
-
182
210
  }, [iabEnabled]);
183
211
 
184
212
  return (
@@ -210,5 +238,5 @@ export const Osano: React.FunctionComponent<
210
238
  flavor === nextFlavor &&
211
239
  iabEnabled === nextIabEnabled
212
240
  );
213
- }
241
+ },
214
242
  );