@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.
- package/README.dev.md +216 -1
- package/README.md +2 -268
- package/android/src/main/java/com/OsanoCMPSDK/OsanoCMPSDKModule.kt +41 -0
- package/ios/OsanoCmpSDK.mm +42 -0
- package/lib/commonjs/ConsentManager.js +57 -14
- package/lib/commonjs/ConsentManager.js.map +1 -1
- package/lib/commonjs/ConsentUiBuilder.js +10 -7
- package/lib/commonjs/ConsentUiBuilder.js.map +1 -1
- package/lib/commonjs/commands.js +10 -5
- package/lib/commonjs/commands.js.map +1 -1
- package/lib/commonjs/components/Button.js +6 -7
- package/lib/commonjs/components/Button.js.map +1 -1
- package/lib/commonjs/components/Checkbox.js +1 -2
- package/lib/commonjs/components/Checkbox.js.map +1 -1
- package/lib/commonjs/components/ExpansionPanel.js +1 -2
- package/lib/commonjs/components/ExpansionPanel.js.map +1 -1
- package/lib/commonjs/components/Link.js +1 -2
- package/lib/commonjs/components/Link.js.map +1 -1
- package/lib/commonjs/components/StoragePolicyLink.js +1 -2
- package/lib/commonjs/components/StoragePolicyLink.js.map +1 -1
- package/lib/commonjs/components/Toggle.js +1 -2
- package/lib/commonjs/components/Toggle.js.map +1 -1
- package/lib/commonjs/context.js +5 -4
- package/lib/commonjs/context.js.map +1 -1
- package/lib/commonjs/iab/tcf/constants.js +34 -1
- package/lib/commonjs/iab/tcf/constants.js.map +1 -1
- package/lib/commonjs/iab/tcf/iab-storage-utils.js +102 -0
- package/lib/commonjs/iab/tcf/iab-storage-utils.js.map +1 -0
- package/lib/commonjs/iab/tcf/index.js +1 -2
- package/lib/commonjs/iab/tcf/index.js.map +1 -1
- package/lib/commonjs/iab/tcf/middleware.js +33 -35
- package/lib/commonjs/iab/tcf/middleware.js.map +1 -1
- package/lib/commonjs/iab/tcf/selectors.js +1 -1
- package/lib/commonjs/iab/tcf/selectors.js.map +1 -1
- package/lib/commonjs/iab/tcf/v2.0/shared-constants.js +1 -2
- package/lib/commonjs/iab/tcf/v2.0/shared-constants.js.map +1 -1
- package/lib/commonjs/index.js +29 -9
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/locale/af.json +342 -323
- package/lib/commonjs/locale/ar.json +342 -323
- package/lib/commonjs/locale/bg.json +342 -323
- package/lib/commonjs/locale/ca.json +342 -323
- package/lib/commonjs/locale/cs.json +342 -323
- package/lib/commonjs/locale/da.json +342 -323
- package/lib/commonjs/locale/de-at.json +342 -323
- package/lib/commonjs/locale/de.json +342 -323
- package/lib/commonjs/locale/el.json +342 -323
- package/lib/commonjs/locale/en-au.json +342 -323
- package/lib/commonjs/locale/en-ca.json +342 -323
- package/lib/commonjs/locale/en-gb.json +342 -323
- package/lib/commonjs/locale/en.json +342 -323
- package/lib/commonjs/locale/es-mx.json +342 -323
- package/lib/commonjs/locale/es.json +342 -323
- package/lib/commonjs/locale/et.json +342 -323
- package/lib/commonjs/locale/fa.json +342 -323
- package/lib/commonjs/locale/fi.json +342 -323
- package/lib/commonjs/locale/fr-ca.json +342 -323
- package/lib/commonjs/locale/fr.json +342 -323
- package/lib/commonjs/locale/gd.json +342 -323
- package/lib/commonjs/locale/he.json +342 -323
- package/lib/commonjs/locale/hi.json +342 -323
- package/lib/commonjs/locale/hr.json +342 -323
- package/lib/commonjs/locale/hu.json +342 -323
- package/lib/commonjs/locale/hy.json +342 -323
- package/lib/commonjs/locale/id.json +342 -323
- package/lib/commonjs/locale/is.json +342 -323
- package/lib/commonjs/locale/it.json +342 -323
- package/lib/commonjs/locale/ja.json +342 -323
- package/lib/commonjs/locale/kk.json +342 -323
- package/lib/commonjs/locale/ko.json +342 -323
- package/lib/commonjs/locale/lt.json +342 -323
- package/lib/commonjs/locale/lv.json +342 -323
- package/lib/commonjs/locale/mi.json +342 -323
- package/lib/commonjs/locale/ms.json +342 -323
- package/lib/commonjs/locale/nb.json +342 -323
- package/lib/commonjs/locale/nl-be.json +342 -323
- package/lib/commonjs/locale/nl.json +342 -323
- package/lib/commonjs/locale/nn.json +342 -323
- package/lib/commonjs/locale/no.json +342 -323
- package/lib/commonjs/locale/pl.json +342 -323
- package/lib/commonjs/locale/pt-br.json +342 -323
- package/lib/commonjs/locale/pt.json +342 -323
- package/lib/commonjs/locale/ro.json +342 -323
- package/lib/commonjs/locale/ru.json +342 -323
- package/lib/commonjs/locale/sk.json +342 -323
- package/lib/commonjs/locale/sl.json +342 -323
- package/lib/commonjs/locale/sq.json +342 -323
- package/lib/commonjs/locale/sr.json +342 -323
- package/lib/commonjs/locale/sv.json +342 -323
- package/lib/commonjs/locale/th.json +342 -323
- package/lib/commonjs/locale/tl.json +342 -323
- package/lib/commonjs/locale/tr.json +342 -323
- package/lib/commonjs/locale/uk.json +342 -323
- package/lib/commonjs/locale/vi.json +342 -323
- package/lib/commonjs/locale/zh-hk.json +342 -323
- package/lib/commonjs/locale/zh-tw.json +342 -323
- package/lib/commonjs/locale/zh.json +342 -323
- package/lib/commonjs/locale/zu.json +342 -323
- package/lib/commonjs/native/OsanoCmp.js +16 -0
- package/lib/commonjs/native/OsanoCmp.js.map +1 -1
- package/lib/commonjs/services/consent.js +6 -5
- package/lib/commonjs/services/consent.js.map +1 -1
- package/lib/commonjs/services/google-consent-mode-mapper.js +109 -0
- package/lib/commonjs/services/google-consent-mode-mapper.js.map +1 -0
- package/lib/commonjs/types/google-consent-mode.js +73 -0
- package/lib/commonjs/types/google-consent-mode.js.map +1 -0
- package/lib/commonjs/utils/OsanoLogger.js +51 -0
- package/lib/commonjs/utils/OsanoLogger.js.map +1 -0
- package/lib/commonjs/utils/index.js +7 -0
- package/lib/commonjs/utils/index.js.map +1 -1
- package/lib/commonjs/views/Dialog/Buttons.js +1 -2
- package/lib/commonjs/views/Dialog/Buttons.js.map +1 -1
- package/lib/commonjs/views/Dialog/FirstLayerUsage.js +1 -2
- package/lib/commonjs/views/Dialog/FirstLayerUsage.js.map +1 -1
- package/lib/commonjs/views/Dialog/Message.js +1 -2
- package/lib/commonjs/views/Dialog/Message.js.map +1 -1
- package/lib/commonjs/views/Dialog/PreferenceManagementDeepLinks.js +1 -2
- package/lib/commonjs/views/Dialog/PreferenceManagementDeepLinks.js.map +1 -1
- package/lib/commonjs/views/Dialog/index.js +1 -2
- package/lib/commonjs/views/Dialog/index.js.map +1 -1
- package/lib/commonjs/views/Drawer/Drawer.ConsentCategories.js +1 -2
- package/lib/commonjs/views/Drawer/Drawer.ConsentCategories.js.map +1 -1
- package/lib/commonjs/views/Drawer/Drawer.Header.js +1 -2
- package/lib/commonjs/views/Drawer/Drawer.Header.js.map +1 -1
- package/lib/commonjs/views/Drawer/Drawer.Iab.Disclosures.js +1 -2
- package/lib/commonjs/views/Drawer/Drawer.Iab.Disclosures.js.map +1 -1
- package/lib/commonjs/views/Drawer/Drawer.Iab.Vendors.js +1 -2
- package/lib/commonjs/views/Drawer/Drawer.Iab.Vendors.js.map +1 -1
- package/lib/commonjs/views/Drawer/index.js +1 -2
- package/lib/commonjs/views/Drawer/index.js.map +1 -1
- package/lib/module/ConsentManager.js +56 -12
- package/lib/module/ConsentManager.js.map +1 -1
- package/lib/module/ConsentUiBuilder.js +9 -5
- package/lib/module/ConsentUiBuilder.js.map +1 -1
- package/lib/module/commands.js +10 -5
- package/lib/module/commands.js.map +1 -1
- package/lib/module/components/Button.js +5 -5
- package/lib/module/components/Button.js.map +1 -1
- package/lib/module/context.js +5 -4
- package/lib/module/context.js.map +1 -1
- package/lib/module/iab/tcf/constants.js +32 -0
- package/lib/module/iab/tcf/constants.js.map +1 -1
- package/lib/module/iab/tcf/iab-storage-utils.js +89 -0
- package/lib/module/iab/tcf/iab-storage-utils.js.map +1 -0
- package/lib/module/iab/tcf/middleware.js +25 -27
- package/lib/module/iab/tcf/middleware.js.map +1 -1
- package/lib/module/iab/tcf/selectors.js +1 -1
- package/lib/module/iab/tcf/selectors.js.map +1 -1
- package/lib/module/index.js +22 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/locale/af.json +342 -323
- package/lib/module/locale/ar.json +342 -323
- package/lib/module/locale/bg.json +342 -323
- package/lib/module/locale/ca.json +342 -323
- package/lib/module/locale/cs.json +342 -323
- package/lib/module/locale/da.json +342 -323
- package/lib/module/locale/de-at.json +342 -323
- package/lib/module/locale/de.json +342 -323
- package/lib/module/locale/el.json +342 -323
- package/lib/module/locale/en-au.json +342 -323
- package/lib/module/locale/en-ca.json +342 -323
- package/lib/module/locale/en-gb.json +342 -323
- package/lib/module/locale/en.json +342 -323
- package/lib/module/locale/es-mx.json +342 -323
- package/lib/module/locale/es.json +342 -323
- package/lib/module/locale/et.json +342 -323
- package/lib/module/locale/fa.json +342 -323
- package/lib/module/locale/fi.json +342 -323
- package/lib/module/locale/fr-ca.json +342 -323
- package/lib/module/locale/fr.json +342 -323
- package/lib/module/locale/gd.json +342 -323
- package/lib/module/locale/he.json +342 -323
- package/lib/module/locale/hi.json +342 -323
- package/lib/module/locale/hr.json +342 -323
- package/lib/module/locale/hu.json +342 -323
- package/lib/module/locale/hy.json +342 -323
- package/lib/module/locale/id.json +342 -323
- package/lib/module/locale/is.json +342 -323
- package/lib/module/locale/it.json +342 -323
- package/lib/module/locale/ja.json +342 -323
- package/lib/module/locale/kk.json +342 -323
- package/lib/module/locale/ko.json +342 -323
- package/lib/module/locale/lt.json +342 -323
- package/lib/module/locale/lv.json +342 -323
- package/lib/module/locale/mi.json +342 -323
- package/lib/module/locale/ms.json +342 -323
- package/lib/module/locale/nb.json +342 -323
- package/lib/module/locale/nl-be.json +342 -323
- package/lib/module/locale/nl.json +342 -323
- package/lib/module/locale/nn.json +342 -323
- package/lib/module/locale/no.json +342 -323
- package/lib/module/locale/pl.json +342 -323
- package/lib/module/locale/pt-br.json +342 -323
- package/lib/module/locale/pt.json +342 -323
- package/lib/module/locale/ro.json +342 -323
- package/lib/module/locale/ru.json +342 -323
- package/lib/module/locale/sk.json +342 -323
- package/lib/module/locale/sl.json +342 -323
- package/lib/module/locale/sq.json +342 -323
- package/lib/module/locale/sr.json +342 -323
- package/lib/module/locale/sv.json +342 -323
- package/lib/module/locale/th.json +342 -323
- package/lib/module/locale/tl.json +342 -323
- package/lib/module/locale/tr.json +342 -323
- package/lib/module/locale/uk.json +342 -323
- package/lib/module/locale/vi.json +342 -323
- package/lib/module/locale/zh-hk.json +342 -323
- package/lib/module/locale/zh-tw.json +342 -323
- package/lib/module/locale/zh.json +342 -323
- package/lib/module/locale/zu.json +342 -323
- package/lib/module/native/OsanoCmp.js +12 -0
- package/lib/module/native/OsanoCmp.js.map +1 -1
- package/lib/module/services/consent.js +6 -6
- package/lib/module/services/consent.js.map +1 -1
- package/lib/module/services/google-consent-mode-mapper.js +103 -0
- package/lib/module/services/google-consent-mode-mapper.js.map +1 -0
- package/lib/module/types/google-consent-mode.js +70 -0
- package/lib/module/types/google-consent-mode.js.map +1 -0
- package/lib/module/utils/OsanoLogger.js +44 -0
- package/lib/module/utils/OsanoLogger.js.map +1 -0
- package/lib/module/utils/index.js +1 -0
- package/lib/module/utils/index.js.map +1 -1
- package/lib/typescript/lib/commonjs/ConsentManager.d.ts +15 -0
- package/lib/typescript/lib/commonjs/ConsentManager.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/ConsentUiBuilder.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/commands.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/components/Button.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/components/Checkbox.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/components/ExpansionPanel.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/components/Link.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/components/StoragePolicyLink.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/components/Toggle.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/constants.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/gpp/api.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/gpp/consent.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/gpp/encoders/AbstractBase64UrlEncoder.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/gpp/v1/index.d.ts +1 -3
- package/lib/typescript/lib/commonjs/iab/gpp/v1/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/tcf/consent.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/tcf/constants.d.ts +41 -1
- package/lib/typescript/lib/commonjs/iab/tcf/constants.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/tcf/iab-storage-utils.d.ts +9 -0
- package/lib/typescript/lib/commonjs/iab/tcf/iab-storage-utils.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/iab/tcf/middleware.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/tcf/reducer.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/tcf/selectors.d.ts +0 -1
- package/lib/typescript/lib/commonjs/iab/tcf/selectors.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/tcf/v2.0/shared-constants.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/usp/api.d.ts +1 -1
- package/lib/typescript/lib/commonjs/iab/usp/api.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/usp/consent.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/usp/selectors.d.ts +1 -4
- package/lib/typescript/lib/commonjs/iab/usp/selectors.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/iab/usp/v1/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/native/OsanoCmp.d.ts +4 -0
- package/lib/typescript/lib/commonjs/native/OsanoCmp.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/reducer.d.ts +7 -1
- package/lib/typescript/lib/commonjs/reducer.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/services/consent.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/services/google-consent-mode-mapper.d.ts +72 -0
- package/lib/typescript/lib/commonjs/services/google-consent-mode-mapper.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/types/google-consent-mode.d.ts +32 -0
- package/lib/typescript/lib/commonjs/types/google-consent-mode.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/utils/OsanoLogger.d.ts +16 -0
- package/lib/typescript/lib/commonjs/utils/OsanoLogger.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/utils/Translator.d.ts +1 -1
- package/lib/typescript/lib/commonjs/utils/Translator.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/utils/index.d.ts +2 -0
- package/lib/typescript/lib/commonjs/utils/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/views/Dialog/Buttons.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/views/Dialog/FirstLayerUsage.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/views/Dialog/Message.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/views/Dialog/PreferenceManagementDeepLinks.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/views/Dialog/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/views/Drawer/Drawer.ConsentCategories.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/views/Drawer/Drawer.Header.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/views/Drawer/Drawer.Iab.Disclosures.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/views/Drawer/Drawer.Iab.Vendors.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/views/Drawer/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/ConsentManager.d.ts +17 -2
- package/lib/typescript/lib/module/ConsentManager.d.ts.map +1 -1
- package/lib/typescript/lib/module/ConsentUiBuilder.d.ts +1 -0
- package/lib/typescript/lib/module/ConsentUiBuilder.d.ts.map +1 -1
- package/lib/typescript/lib/module/actions.d.ts.map +1 -1
- package/lib/typescript/lib/module/commands.d.ts +1 -1
- package/lib/typescript/lib/module/commands.d.ts.map +1 -1
- package/lib/typescript/lib/module/components/Button.d.ts.map +1 -1
- package/lib/typescript/lib/module/constants.d.ts.map +1 -1
- package/lib/typescript/lib/module/context.d.ts +9 -1
- package/lib/typescript/lib/module/context.d.ts.map +1 -1
- package/lib/typescript/lib/module/flavors/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/constants.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/gpp/api.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/gpp/consent.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/gpp/encoders/AbstractBase64UrlEncoder.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/gpp/v1/constants.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/gpp/v1/index.d.ts +1 -3
- package/lib/typescript/lib/module/iab/gpp/v1/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/tcf/consent.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/tcf/constants.d.ts +41 -1
- package/lib/typescript/lib/module/iab/tcf/constants.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/tcf/iab-storage-utils.d.ts +8 -0
- package/lib/typescript/lib/module/iab/tcf/iab-storage-utils.d.ts.map +1 -0
- package/lib/typescript/lib/module/iab/tcf/index.d.ts +0 -2
- package/lib/typescript/lib/module/iab/tcf/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/tcf/middleware.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/tcf/reducer.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/tcf/selectors.d.ts +0 -1
- package/lib/typescript/lib/module/iab/tcf/selectors.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/tcf/v2.0/index.d.ts +0 -2
- package/lib/typescript/lib/module/iab/tcf/v2.0/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/tcf/v2.0/shared-constants.d.ts +0 -1
- package/lib/typescript/lib/module/iab/tcf/v2.0/shared-constants.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/tcf/v2.0/tcfcav1-constants.d.ts +5 -2
- package/lib/typescript/lib/module/iab/tcf/v2.0/tcfcav1-constants.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/tcf/v2.0/tcfeuv2-constants.d.ts +0 -1
- package/lib/typescript/lib/module/iab/tcf/v2.0/tcfeuv2-constants.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/usp/api.d.ts +1 -1
- package/lib/typescript/lib/module/iab/usp/api.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/usp/consent.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/usp/selectors.d.ts +1 -4
- package/lib/typescript/lib/module/iab/usp/selectors.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/usp/v1/constants.d.ts.map +1 -1
- package/lib/typescript/lib/module/iab/usp/v1/index.d.ts +1 -1
- package/lib/typescript/lib/module/iab/usp/v1/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/index.d.ts +1 -0
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/native/OsanoCmp.d.ts +4 -0
- package/lib/typescript/lib/module/native/OsanoCmp.d.ts.map +1 -1
- package/lib/typescript/lib/module/reducer.d.ts +7 -1
- package/lib/typescript/lib/module/reducer.d.ts.map +1 -1
- package/lib/typescript/lib/module/services/google-consent-mode-mapper.d.ts +71 -0
- package/lib/typescript/lib/module/services/google-consent-mode-mapper.d.ts.map +1 -0
- package/lib/typescript/lib/module/types/google-consent-mode.d.ts +38 -0
- package/lib/typescript/lib/module/types/google-consent-mode.d.ts.map +1 -0
- package/lib/typescript/lib/module/utils/OsanoLogger.d.ts +15 -0
- package/lib/typescript/lib/module/utils/OsanoLogger.d.ts.map +1 -0
- package/lib/typescript/lib/module/utils/Translator.d.ts +1 -1
- package/lib/typescript/lib/module/utils/Translator.d.ts.map +1 -1
- package/lib/typescript/lib/module/utils/index.d.ts +1 -0
- package/lib/typescript/src/ConsentManager.d.ts +23 -7
- package/lib/typescript/src/ConsentManager.d.ts.map +1 -1
- package/lib/typescript/src/ConsentUiBuilder.d.ts +1 -1
- package/lib/typescript/src/ConsentUiBuilder.d.ts.map +1 -1
- package/lib/typescript/src/commands.d.ts.map +1 -1
- package/lib/typescript/src/components/Button.d.ts +1 -1
- package/lib/typescript/src/components/Button.d.ts.map +1 -1
- package/lib/typescript/src/components/Divider.d.ts.map +1 -1
- package/lib/typescript/src/components/ExpansionPanel.d.ts.map +1 -1
- package/lib/typescript/src/components/Link.d.ts.map +1 -1
- package/lib/typescript/src/components/Locale.d.ts.map +1 -1
- package/lib/typescript/src/components/StoragePolicyLink.d.ts.map +1 -1
- package/lib/typescript/src/components/Toggle.d.ts.map +1 -1
- package/lib/typescript/src/context.d.ts +4 -2
- package/lib/typescript/src/context.d.ts.map +1 -1
- package/lib/typescript/src/iab/actions.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/api.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/consent.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/encoders/AbstractBase64UrlEncoder.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/encoders/BooleanEncoder.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/encoders/DatetimeEncoder.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/encoders/FibonacciIntegerEncoder.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/encoders/FibonacciIntegerRangeEncoder.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/encoders/FixedBitfieldEncoder.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/encoders/FixedIntegerEncoder.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/encoders/FixedIntegerListEncoder.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/encoders/FixedIntegerRangeEncoder.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/encoders/FixedStringEncoder.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/v1/constants.d.ts.map +1 -1
- package/lib/typescript/src/iab/gpp/v1/index.d.ts +1 -3
- package/lib/typescript/src/iab/gpp/v1/index.d.ts.map +1 -1
- package/lib/typescript/src/iab/index.d.ts.map +1 -1
- package/lib/typescript/src/iab/tcf/actions.d.ts.map +1 -1
- package/lib/typescript/src/iab/tcf/consent.d.ts.map +1 -1
- package/lib/typescript/src/iab/tcf/constants.d.ts +32 -0
- package/lib/typescript/src/iab/tcf/constants.d.ts.map +1 -1
- package/lib/typescript/src/iab/tcf/helpers.d.ts.map +1 -1
- package/lib/typescript/src/iab/tcf/iab-storage-utils.d.ts +24 -0
- package/lib/typescript/src/iab/tcf/iab-storage-utils.d.ts.map +1 -0
- package/lib/typescript/src/iab/tcf/middleware.d.ts.map +1 -1
- package/lib/typescript/src/iab/tcf/reducer.d.ts.map +1 -1
- package/lib/typescript/src/iab/tcf/selectors.d.ts.map +1 -1
- package/lib/typescript/src/iab/tcf/v2.0/formatters.d.ts.map +1 -1
- package/lib/typescript/src/iab/tcf/v2.0/shared-constants.d.ts.map +1 -1
- package/lib/typescript/src/iab/tcf/v2.0/tcfcav1-constants.d.ts.map +1 -1
- package/lib/typescript/src/iab/tcf/v2.0/tcfeuv2-constants.d.ts.map +1 -1
- package/lib/typescript/src/iab/usp/api.d.ts +1 -1
- package/lib/typescript/src/iab/usp/api.d.ts.map +1 -1
- package/lib/typescript/src/iab/usp/consent.d.ts.map +1 -1
- package/lib/typescript/src/iab/usp/selectors.d.ts +1 -4
- package/lib/typescript/src/iab/usp/selectors.d.ts.map +1 -1
- package/lib/typescript/src/iab/usp/v1/constants.d.ts.map +1 -1
- package/lib/typescript/src/iab/usp/v1/index.d.ts +1 -1
- package/lib/typescript/src/iab/usp/v1/index.d.ts.map +1 -1
- package/lib/typescript/src/iab/utilities.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/OsanoCmp.d.ts +4 -0
- package/lib/typescript/src/native/OsanoCmp.d.ts.map +1 -1
- package/lib/typescript/src/reducer.d.ts.map +1 -1
- package/lib/typescript/src/selectors.d.ts.map +1 -1
- package/lib/typescript/src/services/consent.d.ts +1 -1
- package/lib/typescript/src/services/consent.d.ts.map +1 -1
- package/lib/typescript/src/services/google-consent-mode-mapper.d.ts +66 -0
- package/lib/typescript/src/services/google-consent-mode-mapper.d.ts.map +1 -0
- package/lib/typescript/src/styles.d.ts.map +1 -1
- package/lib/typescript/src/types/google-consent-mode.d.ts +77 -0
- package/lib/typescript/src/types/google-consent-mode.d.ts.map +1 -0
- package/lib/typescript/src/utils/Color.d.ts.map +1 -1
- package/lib/typescript/src/utils/OsanoLogger.d.ts +15 -0
- package/lib/typescript/src/utils/OsanoLogger.d.ts.map +1 -0
- package/lib/typescript/src/utils/index.d.ts +1 -0
- package/lib/typescript/src/utils/index.d.ts.map +1 -1
- package/package.json +4 -2
- package/src/ConsentManager.ts +93 -25
- package/src/ConsentUiBuilder.tsx +23 -13
- package/src/commands.ts +11 -8
- package/src/components/Button.tsx +17 -17
- package/src/context.ts +6 -3
- package/src/iab/tcf/constants.ts +46 -0
- package/src/iab/tcf/iab-storage-utils.ts +166 -0
- package/src/iab/tcf/middleware.ts +43 -51
- package/src/index.tsx +35 -8
- package/src/locale/af.json +342 -323
- package/src/locale/ar.json +342 -323
- package/src/locale/bg.json +342 -323
- package/src/locale/ca.json +342 -323
- package/src/locale/cs.json +342 -323
- package/src/locale/da.json +342 -323
- package/src/locale/de-at.json +342 -323
- package/src/locale/de.json +342 -323
- package/src/locale/el.json +342 -323
- package/src/locale/en-au.json +342 -323
- package/src/locale/en-ca.json +342 -323
- package/src/locale/en-gb.json +342 -323
- package/src/locale/en.json +342 -323
- package/src/locale/es-mx.json +342 -323
- package/src/locale/es.json +342 -323
- package/src/locale/et.json +342 -323
- package/src/locale/fa.json +342 -323
- package/src/locale/fi.json +342 -323
- package/src/locale/fr-ca.json +342 -323
- package/src/locale/fr.json +342 -323
- package/src/locale/gd.json +342 -323
- package/src/locale/he.json +342 -323
- package/src/locale/hi.json +342 -323
- package/src/locale/hr.json +342 -323
- package/src/locale/hu.json +342 -323
- package/src/locale/hy.json +342 -323
- package/src/locale/id.json +342 -323
- package/src/locale/is.json +342 -323
- package/src/locale/it.json +342 -323
- package/src/locale/ja.json +342 -323
- package/src/locale/kk.json +342 -323
- package/src/locale/ko.json +342 -323
- package/src/locale/lt.json +342 -323
- package/src/locale/lv.json +342 -323
- package/src/locale/mi.json +342 -323
- package/src/locale/ms.json +342 -323
- package/src/locale/nb.json +342 -323
- package/src/locale/nl-be.json +342 -323
- package/src/locale/nl.json +342 -323
- package/src/locale/nn.json +342 -323
- package/src/locale/no.json +342 -323
- package/src/locale/pl.json +342 -323
- package/src/locale/pt-br.json +342 -323
- package/src/locale/pt.json +342 -323
- package/src/locale/ro.json +342 -323
- package/src/locale/ru.json +342 -323
- package/src/locale/sk.json +342 -323
- package/src/locale/sl.json +342 -323
- package/src/locale/sq.json +342 -323
- package/src/locale/sr.json +342 -323
- package/src/locale/sv.json +342 -323
- package/src/locale/th.json +342 -323
- package/src/locale/tl.json +342 -323
- package/src/locale/tr.json +342 -323
- package/src/locale/uk.json +342 -323
- package/src/locale/vi.json +342 -323
- package/src/locale/zh-hk.json +342 -323
- package/src/locale/zh-tw.json +342 -323
- package/src/locale/zh.json +342 -323
- package/src/locale/zu.json +342 -323
- package/src/native/OsanoCmp.ts +29 -0
- package/src/services/consent.ts +9 -8
- package/src/services/google-consent-mode-mapper.ts +122 -0
- package/src/types/google-consent-mode.ts +122 -0
- package/src/types/index.d.ts +4 -2
- package/src/utils/OsanoLogger.ts +53 -0
- 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.
|
|
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",
|
package/src/ConsentManager.ts
CHANGED
|
@@ -1,5 +1,16 @@
|
|
|
1
|
-
import
|
|
2
|
-
import {
|
|
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 {
|
|
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
|
|
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
|
-
|
|
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 {
|
|
36
|
-
import {
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
}
|
package/src/ConsentUiBuilder.tsx
CHANGED
|
@@ -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 {
|
|
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 {
|
|
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
|
|
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
|
|
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 ||
|
|
87
|
+
title: title || 'buttons.denyNonEssential',
|
|
88
88
|
onPress: onPress || handleReject,
|
|
89
|
-
testID: testID || '
|
|
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
|
|
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
|
);
|
package/src/iab/tcf/constants.ts
CHANGED
|
@@ -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],
|