@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/README.dev.md
CHANGED
|
@@ -26,9 +26,24 @@ From the root folder, run the following:
|
|
|
26
26
|
corepack yarn install
|
|
27
27
|
corepack yarn prepare
|
|
28
28
|
cd example/ios && pod install && cd ../..
|
|
29
|
+
cd example/ios && echo export NODE_BINARY=$(command -v node) > .xcode.env && cd ../.. # do once
|
|
30
|
+
cp example/.env.example example/.env # do once
|
|
29
31
|
corepack yarn example android # or ios
|
|
32
|
+
|
|
33
|
+
# alternatively
|
|
34
|
+
cd example && corepack yarn start android # or ios
|
|
30
35
|
```
|
|
31
36
|
|
|
37
|
+
### Specifying run destination
|
|
38
|
+
|
|
39
|
+
**iOS**
|
|
40
|
+
|
|
41
|
+
`corepack yarn example ios --simulator "iPhone 15 Pro"`
|
|
42
|
+
|
|
43
|
+
**Android**
|
|
44
|
+
|
|
45
|
+
`// TODO`
|
|
46
|
+
|
|
32
47
|
## Running Tests
|
|
33
48
|
|
|
34
49
|
Testing should be done through both the example integration and the package itself.
|
|
@@ -49,10 +64,210 @@ npm test
|
|
|
49
64
|
|
|
50
65
|
### Testing the examples
|
|
51
66
|
|
|
52
|
-
|
|
67
|
+
#### Build the test applications from local builds
|
|
68
|
+
|
|
69
|
+
- iOS
|
|
70
|
+
|
|
71
|
+
1. Run the iOS application locally via `yarn example ios`
|
|
72
|
+
1. Open the Derived Data in your XCode folder `~/Library/Developer/XCode/DerivedData`
|
|
73
|
+
1. One of the folders in the `DerivedData` folder will contain a `Build` folder
|
|
74
|
+
1. Open `Build/Products/<device-type>`
|
|
75
|
+
1. The .app file will be `OsanoCMPExample` with a file type `Application`
|
|
76
|
+
|
|
77
|
+
- Android
|
|
78
|
+
|
|
79
|
+
1. Run the android example application locally via `yarn example android`
|
|
80
|
+
1. In `Android Studio` under `Project` open `app/build/outputs/apk/<release-or-debug>/` to get the apk file
|
|
81
|
+
|
|
82
|
+
Both files can be sent to coworkers with an ios simulator or android emulator to run for testing
|
|
53
83
|
|
|
54
84
|
## Troubleshooting
|
|
55
85
|
|
|
56
86
|
1. If the `run` command fails saying there is no development project, make sure to open the relevant simulator/emulator before running.
|
|
57
87
|
1. If there are significant errors citing duplicates, it is likely you ran `npm i` in the packages folder. These files should be removed via `rm -rf node_modules` in the `packages/osano-cmp-react-native` folder from the command line
|
|
58
88
|
1. For initial developing and testing make sure you have a relatively recent simulator on iOS and emulator on Android. Old devices running old OS can cause unnecessary issues
|
|
89
|
+
1. Building the iOS example from Xcode might result in a `Command PhaseScriptExecution failed with a nonzero exit code`. This is caused by a missing `.xcode.env` file that contains an entry for NODE_PATH. Resolve by running `echo export NODE_BINARY=$(command -v node) > .xcode.env` from the `example/ios` directory.
|
|
90
|
+
|
|
91
|
+
=======
|
|
92
|
+
|
|
93
|
+
The Osano ConsentSDK for iOS is a native framework that integrates with the Consent Management Platform on the [Osano Website](https://my.osano.com). It is necessary to have an account, and a Cookie Consent configuration created and published in order for this SDK to be able to record end-user consents.
|
|
94
|
+
|
|
95
|
+
### Installation
|
|
96
|
+
|
|
97
|
+
---
|
|
98
|
+
|
|
99
|
+
We use NPM to manage and install the SDK package.
|
|
100
|
+
|
|
101
|
+
1. At the top level of your project run `npm install @osano/osano-cmp-react-native`
|
|
102
|
+
|
|
103
|
+
#### Native iOS installation
|
|
104
|
+
|
|
105
|
+
NPM uses cocoapods to install the native iOS portion of modules[CocoaPods](https://guides.cocoapods.org/)
|
|
106
|
+
|
|
107
|
+
1. Install Cocoapods using [Cocoapods - Getting Started](https://guides.cocoapods.org/using/getting-started.html).
|
|
108
|
+
1. Run `pod install` from inside the iOS folder in your project
|
|
109
|
+
|
|
110
|
+
#### Native Android installation
|
|
111
|
+
|
|
112
|
+
1. Run a gradle sync after `@osano/osano-cmp-react-native` has been added to your package manager
|
|
113
|
+
|
|
114
|
+
### Integration
|
|
115
|
+
|
|
116
|
+
## How do I use it?
|
|
117
|
+
|
|
118
|
+
- [ConsentManager](#consentmanager)
|
|
119
|
+
- [UI Builder](#ui-builder)
|
|
120
|
+
- [1. Dialog](#dialog)
|
|
121
|
+
- [2. Drawer](#drawer)
|
|
122
|
+
- [Using Custom UI](#using-custom-ui)
|
|
123
|
+
|
|
124
|
+
### ConsentManager
|
|
125
|
+
|
|
126
|
+
First, you must create an instance of the `Osano` object. This object contains the general
|
|
127
|
+
configuration parameters that will be used throughout the life of the
|
|
128
|
+
application.
|
|
129
|
+
|
|
130
|
+
```js
|
|
131
|
+
import { Osano, OsanoContext } from '@osano/osano-cmp-react-native'
|
|
132
|
+
|
|
133
|
+
// ...
|
|
134
|
+
|
|
135
|
+
<Osano
|
|
136
|
+
customerId={customerId}
|
|
137
|
+
configId={configId}
|
|
138
|
+
hideDisclosures={hideDisclosures}
|
|
139
|
+
onConfigLoadSuccess={handleConfigLoadSuccess}
|
|
140
|
+
onConfigLoadFailure={handleConfigLoadFailure}
|
|
141
|
+
onLangLoadSuccess={handleLangLoadSuccess}
|
|
142
|
+
onLangLoadFailure={handleLangLoadFailure}
|
|
143
|
+
setLoggingEnabled={__DEV__} // Control SDK logging
|
|
144
|
+
overrides={{
|
|
145
|
+
flavor: flavor ? flavor : undefined,
|
|
146
|
+
locale: locale ? locale : undefined,
|
|
147
|
+
}}
|
|
148
|
+
>
|
|
149
|
+
<YourAppHere>
|
|
150
|
+
</Osano>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
Note that the `configId` and `customerId` parameters are not optional, and must match the values of your configuration on the [Osano website](https://my.osano.com).
|
|
154
|
+
|
|
155
|
+
#### Logging Configuration
|
|
156
|
+
|
|
157
|
+
The SDK includes built-in logging for debugging. Use `setLoggingEnabled={__DEV__}` to enable logging in development and disable it in production. All logs are prefixed with `[OsanoSDK]`.
|
|
158
|
+
|
|
159
|
+
You can use the `OsanoContext` to access the `ConsentManager` object:
|
|
160
|
+
|
|
161
|
+
```js
|
|
162
|
+
const {
|
|
163
|
+
clearConsent,
|
|
164
|
+
getConsent,
|
|
165
|
+
getDeviceId,
|
|
166
|
+
locale,
|
|
167
|
+
setLocale,
|
|
168
|
+
showBanner,
|
|
169
|
+
showDrawer,
|
|
170
|
+
isReady,
|
|
171
|
+
} = React.useContext(OsanoContext);
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
### UI Builder
|
|
175
|
+
|
|
176
|
+
Now that you have created an instance of the `ConsentManager`, you can
|
|
177
|
+
use it to create and show consent messages in your application. There
|
|
178
|
+
are two types of dialogues available to show in the SDK, and (depending on the geo-location of your end-user) the UI for each will look different. This is due to legal requirements that are in place for the end-user's geo-location. Rest assured, these UI differences are intentional and necessary to maintain legal compliance for the location of your users.
|
|
179
|
+
|
|
180
|
+
#### Display Modes
|
|
181
|
+
|
|
182
|
+
The UI may de shown in 2 different ways:
|
|
183
|
+
|
|
184
|
+
##### Dialog
|
|
185
|
+
|
|
186
|
+
The Dialog View Controller allows you to show a consent message and the
|
|
187
|
+
required data storage preferences based on the country the device is in.
|
|
188
|
+
The SDK takes care of figuring out which consent variant must be shown
|
|
189
|
+
based on the device's locale.
|
|
190
|
+
|
|
191
|
+
To create the dialogue and show it, use the `showDrawer` method from the `OsanoContext`:
|
|
192
|
+
|
|
193
|
+
```js
|
|
194
|
+
<Pressable onPress={showDrawer}>
|
|
195
|
+
<Text>Show Categories Dialog</Text>
|
|
196
|
+
</Pressable>
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
:::note
|
|
200
|
+
|
|
201
|
+
The dialog (depending on the end-user's geo-location) may have an automatic timeout, which will grant consent upon closure. This is normal functionality for specific global regions.
|
|
202
|
+
|
|
203
|
+
:::
|
|
204
|
+
|
|
205
|
+
:::caution Declined to Consent
|
|
206
|
+
|
|
207
|
+
If a the completion callback notifies you that the end-user declined to consent, this **does not mean** they _denied_ consent. It simply means that they _**did not make a selection**_.
|
|
208
|
+
|
|
209
|
+
The Drawer UI will not allow the user to dismiss the modal without making a selection, but the Dialog UI (in some geo-locations) will allow the user to dismiss the modal without making a selection. This is why it is important to check the `categories` array in the completion callback to determine if the user has actually declined to consent.
|
|
210
|
+
|
|
211
|
+
:::
|
|
212
|
+
|
|
213
|
+
##### Drawer
|
|
214
|
+
|
|
215
|
+
The Drawer View Controller allows you to display all consent
|
|
216
|
+
categories using a built-in UI. In this dialogue, the user can choose to
|
|
217
|
+
enable or disable any of the consent categories.
|
|
218
|
+
To user the view controller and show it, use the method `showBanner`
|
|
219
|
+
|
|
220
|
+
```js
|
|
221
|
+
<Pressable onPress={showBanner}>
|
|
222
|
+
<Text>Show Concent Banner</Text>
|
|
223
|
+
</Pressable>
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Using Custom Implementation
|
|
227
|
+
|
|
228
|
+
If the SDK's built-in UI and implementation does not fit your requirements, you can use the
|
|
229
|
+
`ConsentManager`'s APIs and integrate them to your own app's UI:
|
|
230
|
+
|
|
231
|
+
```js
|
|
232
|
+
const consentManager = useRef<ConsentManager>(new ConsentManager());
|
|
233
|
+
const [_state, dispatch, getState, addMiddleware, removeMiddleware] =
|
|
234
|
+
useThunkReducer<OsanoState, OsanoAction>(
|
|
235
|
+
reducer,
|
|
236
|
+
{ configId, customerId },
|
|
237
|
+
init,
|
|
238
|
+
[],
|
|
239
|
+
);
|
|
240
|
+
return(
|
|
241
|
+
<OsanoPublicContext.Provider value={context}>
|
|
242
|
+
{<YourAppHere>}
|
|
243
|
+
<ConsentUiBuilder
|
|
244
|
+
addMiddleware={addMiddleware}
|
|
245
|
+
removeMiddleware={removeMiddleware}
|
|
246
|
+
dispatch={dispatch}
|
|
247
|
+
getState={getState}
|
|
248
|
+
cmp={consentManager}
|
|
249
|
+
hideDisclosures={hideDisclosures}
|
|
250
|
+
/>
|
|
251
|
+
</OsanoPublicContext.Provider>
|
|
252
|
+
)
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
To save (locally and remotely) new consent categories use:
|
|
256
|
+
|
|
257
|
+
```js
|
|
258
|
+
recordConsent(consentManager.current, ConsentCategory.ESSENTIAL); //ESSENTIAL, ANALYTICS, MARKETING, PERSONALIZATION, OPT_OUT
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
To get the list of consented categories (local storage):
|
|
262
|
+
|
|
263
|
+
```js
|
|
264
|
+
let consentedArray = consentManager.current.consent;
|
|
265
|
+
let consentedString = consentedArray.join(', ');
|
|
266
|
+
console.log(consentedString);
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
To get whether the user has already gone through the consent process:
|
|
270
|
+
|
|
271
|
+
```js
|
|
272
|
+
let userConsented = consentManager.current.consent.length > 0;
|
|
273
|
+
```
|
package/README.md
CHANGED
|
@@ -1,269 +1,3 @@
|
|
|
1
|
-
# Osano CMP React Native
|
|
1
|
+
# Osano CMP SDK for React Native
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
1. Xcode
|
|
6
|
-
1. Android Studio
|
|
7
|
-
1. Xcode command-line tools
|
|
8
|
-
1. Node
|
|
9
|
-
|
|
10
|
-
### Corepack
|
|
11
|
-
|
|
12
|
-
This project uses `corepack` to manage and link dependencies. To install `corepack`, run the following commands:
|
|
13
|
-
|
|
14
|
-
```shell
|
|
15
|
-
corepack enable
|
|
16
|
-
corepack install # installs yarn
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
## Running Locally
|
|
20
|
-
|
|
21
|
-
The repo is made up of a root folder and 2 important sub folders. The first is `packages`, which is the actual SDK. The second is `examples`, which includes different implementations of the SDK in a test app to demonstrate and test integration.
|
|
22
|
-
|
|
23
|
-
From the root folder, run the following:
|
|
24
|
-
|
|
25
|
-
```shell
|
|
26
|
-
corepack yarn install
|
|
27
|
-
corepack yarn prepare
|
|
28
|
-
cd example/ios && pod install && cd ../..
|
|
29
|
-
cd example/ios && echo export NODE_BINARY=$(command -v node) > .xcode.env && cd ../.. # do once
|
|
30
|
-
cp example/.env.example example/.env # do once
|
|
31
|
-
corepack yarn example android # or ios
|
|
32
|
-
|
|
33
|
-
# alternatively
|
|
34
|
-
cd example && corepack yarn start android # or ios
|
|
35
|
-
```
|
|
36
|
-
|
|
37
|
-
### Specifying run destination
|
|
38
|
-
|
|
39
|
-
**iOS**
|
|
40
|
-
|
|
41
|
-
`corepack yarn example ios --simulator "iPhone 15 Pro"`
|
|
42
|
-
|
|
43
|
-
**Android**
|
|
44
|
-
|
|
45
|
-
`// TODO`
|
|
46
|
-
|
|
47
|
-
## Running Tests
|
|
48
|
-
|
|
49
|
-
Testing should be done through both the example integration and the package itself.
|
|
50
|
-
|
|
51
|
-
### Testing the package
|
|
52
|
-
|
|
53
|
-
1. From the `packages/osano-comp-react-native` folder run the following. This specifically runs the tests associated with the main package
|
|
54
|
-
|
|
55
|
-
```shell
|
|
56
|
-
npm test /src/__tests__
|
|
57
|
-
```
|
|
58
|
-
|
|
59
|
-
1. In order to test all test files in the package, including IAB, run the following from the `packages/osano-comp-react-native` folder
|
|
60
|
-
|
|
61
|
-
```shell
|
|
62
|
-
npm test
|
|
63
|
-
```
|
|
64
|
-
|
|
65
|
-
### Testing the examples
|
|
66
|
-
|
|
67
|
-
#### Build the test applications from local builds
|
|
68
|
-
|
|
69
|
-
- iOS
|
|
70
|
-
|
|
71
|
-
1. Run the iOS application locally via `yarn example ios`
|
|
72
|
-
1. Open the Derived Data in your XCode folder `~/Library/Developer/XCode/DerivedData`
|
|
73
|
-
1. One of the folders in the `DerivedData` folder will contain a `Build` folder
|
|
74
|
-
1. Open `Build/Products/<device-type>`
|
|
75
|
-
1. The .app file will be `OsanoCMPExample` with a file type `Application`
|
|
76
|
-
|
|
77
|
-
- Android
|
|
78
|
-
|
|
79
|
-
1. Run the android example application locally via `yarn example android`
|
|
80
|
-
1. In `Android Studio` under `Project` open `app/build/outputs/apk/<release-or-debug>/` to get the apk file
|
|
81
|
-
|
|
82
|
-
Both files can be sent to coworkers with an ios simulator or android emulator to run for testing
|
|
83
|
-
|
|
84
|
-
## Troubleshooting
|
|
85
|
-
|
|
86
|
-
1. If the `run` command fails saying there is no development project, make sure to open the relevant simulator/emulator before running.
|
|
87
|
-
1. If there are significant errors citing duplicates, it is likely you ran `npm i` in the packages folder. These files should be removed via `rm -rf node_modules` in the `packages/osano-cmp-react-native` folder from the command line
|
|
88
|
-
1. For initial developing and testing make sure you have a relatively recent simulator on iOS and emulator on Android. Old devices running old OS can cause unnecessary issues
|
|
89
|
-
1. Building the iOS example from Xcode might result in a `Command PhaseScriptExecution failed with a nonzero exit code`. This is caused by a missing `.xcode.env` file that contains an entry for NODE_PATH. Resolve by running `echo export NODE_BINARY=$(command -v node) > .xcode.env` from the `example/ios` directory.
|
|
90
|
-
|
|
91
|
-
=======
|
|
92
|
-
|
|
93
|
-
The Osano ConsentSDK for iOS is a native framework that integrates with the Consent Management Platform on the [Osano Website](https://my.osano.com). It is necessary to have an account, and a Cookie Consent configuration created and published in order for this SDK to be able to record end-user consents.
|
|
94
|
-
|
|
95
|
-
### Installation
|
|
96
|
-
|
|
97
|
-
---
|
|
98
|
-
|
|
99
|
-
We use NPM to manage and install the SDK package.
|
|
100
|
-
|
|
101
|
-
1. At the top level of your project run `npm install @osano/osano-cmp-react-native`
|
|
102
|
-
|
|
103
|
-
#### Native iOS installation
|
|
104
|
-
|
|
105
|
-
NPM uses cocoapods to install the native iOS portion of modules[CocoaPods](https://guides.cocoapods.org/)
|
|
106
|
-
|
|
107
|
-
1. Install Cocoapods using [Cocoapods - Getting Started](https://guides.cocoapods.org/using/getting-started.html).
|
|
108
|
-
1. Run `pod install` from inside the iOS folder in your project
|
|
109
|
-
|
|
110
|
-
#### Native Android installation
|
|
111
|
-
|
|
112
|
-
1. Run a gradle sync after `@osano/osano-cmp-react-native` has been added to your package manager
|
|
113
|
-
|
|
114
|
-
### Integration
|
|
115
|
-
|
|
116
|
-
## How do I use it?
|
|
117
|
-
|
|
118
|
-
- [ConsentManager](#consentmanager)
|
|
119
|
-
- [UI Builder](#ui-builder)
|
|
120
|
-
- [1. Dialog](#dialog)
|
|
121
|
-
- [2. Drawer](#drawer)
|
|
122
|
-
- [Using Custom UI](#using-custom-ui)
|
|
123
|
-
|
|
124
|
-
### ConsentManager
|
|
125
|
-
|
|
126
|
-
First, you must create an instance of the `Osano` object. This object contains the general
|
|
127
|
-
configuration parameters that will be used throughout the life of the
|
|
128
|
-
application.
|
|
129
|
-
|
|
130
|
-
```js
|
|
131
|
-
import { Osano, OsanoContext } from '@osano/osano-cmp-react-native'
|
|
132
|
-
|
|
133
|
-
// ...
|
|
134
|
-
|
|
135
|
-
const
|
|
136
|
-
<Osano
|
|
137
|
-
customerId={customerId}
|
|
138
|
-
configId={configId}
|
|
139
|
-
hideDisclosures={hideDisclosures}
|
|
140
|
-
onConfigLoadSuccess={handleConfigLoadSuccess}
|
|
141
|
-
onConfigLoadFailure={handleConfigLoadFailure}
|
|
142
|
-
onLangLoadSuccess={handleLangLoadSuccess}
|
|
143
|
-
onLangLoadFailure={handleLangLoadFailure}
|
|
144
|
-
overrides={{
|
|
145
|
-
flavor: flavor ? flavor : undefined,
|
|
146
|
-
locale: locale ? locale : undefined,
|
|
147
|
-
}}
|
|
148
|
-
>
|
|
149
|
-
<YourAppHere>
|
|
150
|
-
</Osano>
|
|
151
|
-
```
|
|
152
|
-
|
|
153
|
-
Note that the `configId` and `customerId` parameters are not optional, and must match the values of your configuration on the [Osano website](https://my.osano.com).
|
|
154
|
-
|
|
155
|
-
You can use the `OsanoContext` to access the `ConsentManager` object:
|
|
156
|
-
|
|
157
|
-
```js
|
|
158
|
-
const {
|
|
159
|
-
clearConsent,
|
|
160
|
-
getConsent,
|
|
161
|
-
getDeviceId,
|
|
162
|
-
locale,
|
|
163
|
-
setLocale,
|
|
164
|
-
showBanner,
|
|
165
|
-
showDrawer,
|
|
166
|
-
isReady,
|
|
167
|
-
} = React.useContext(OsanoContext);
|
|
168
|
-
```
|
|
169
|
-
|
|
170
|
-
### UI Builder
|
|
171
|
-
|
|
172
|
-
Now that you have created an instance of the `ConsentManager`, you can
|
|
173
|
-
use it to create and show consent messages in your application. There
|
|
174
|
-
are two types of dialogues available to show in the SDK, and (depending on the geo-location of your end-user) the UI for each will look different. This is due to legal requirements that are in place for the end-user's geo-location. Rest assured, these UI differences are intentional and necessary to maintain legal compliance for the location of your users.
|
|
175
|
-
|
|
176
|
-
#### Display Modes
|
|
177
|
-
|
|
178
|
-
The UI may de shown in 2 different ways:
|
|
179
|
-
|
|
180
|
-
##### Dialog
|
|
181
|
-
|
|
182
|
-
The Dialog View Controller allows you to show a consent message and the
|
|
183
|
-
required data storage preferences based on the country the device is in.
|
|
184
|
-
The SDK takes care of figuring out which consent variant must be shown
|
|
185
|
-
based on the device's locale.
|
|
186
|
-
|
|
187
|
-
To create the dialogue and show it, use the `showDrawer` method from the `OsanoContext`:
|
|
188
|
-
|
|
189
|
-
```js
|
|
190
|
-
<Pressable onPress={showDrawer}>
|
|
191
|
-
<Text>Show Categories Dialog</Text>
|
|
192
|
-
</Pressable>
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
:::note
|
|
196
|
-
|
|
197
|
-
The dialog (depending on the end-user's geo-location) may have an automatic timeout, which will grant consent upon closure. This is normal functionality for specific global regions.
|
|
198
|
-
|
|
199
|
-
:::
|
|
200
|
-
|
|
201
|
-
:::caution Declined to Consent
|
|
202
|
-
|
|
203
|
-
If a the completion callback notifies you that the end-user declined to consent, this **does not mean** they _denied_ consent. It simply means that they _**did not make a selection**_.
|
|
204
|
-
|
|
205
|
-
The Drawer UI will not allow the user to dismiss the modal without making a selection, but the Dialog UI (in some geo-locations) will allow the user to dismiss the modal without making a selection. This is why it is important to check the `categories` array in the completion callback to determine if the user has actually declined to consent.
|
|
206
|
-
|
|
207
|
-
:::
|
|
208
|
-
|
|
209
|
-
##### Drawer
|
|
210
|
-
|
|
211
|
-
The Drawer View Controller allows you to display all consent
|
|
212
|
-
categories using a built-in UI. In this dialogue, the user can choose to
|
|
213
|
-
enable or disable any of the consent categories.
|
|
214
|
-
To user the view controller and show it, use the method `showBanner`
|
|
215
|
-
|
|
216
|
-
```js
|
|
217
|
-
<Pressable onPress={showBanner}>
|
|
218
|
-
<Text>Show Concent Banner</Text>
|
|
219
|
-
</Pressable>
|
|
220
|
-
```
|
|
221
|
-
|
|
222
|
-
### Using Custom Implementation
|
|
223
|
-
|
|
224
|
-
If the SDK's built-in UI and implementation does not fit your requirements, you can use the
|
|
225
|
-
`ConsentManager`'s APIs and integrate them to your own app's UI:
|
|
226
|
-
|
|
227
|
-
```js
|
|
228
|
-
const consentManager = useRef<ConsentManager>(new ConsentManager());
|
|
229
|
-
const [_state, dispatch, getState, addMiddleware, removeMiddleware] =
|
|
230
|
-
useThunkReducer<OsanoState, OsanoAction>(
|
|
231
|
-
reducer,
|
|
232
|
-
{ configId, customerId },
|
|
233
|
-
init,
|
|
234
|
-
[],
|
|
235
|
-
);
|
|
236
|
-
return(
|
|
237
|
-
<OsanoPublicContext.Provider value={context}>
|
|
238
|
-
{<YourAppHere>}
|
|
239
|
-
<ConsentUiBuilder
|
|
240
|
-
addMiddleware={addMiddleware}
|
|
241
|
-
removeMiddleware={removeMiddleware}
|
|
242
|
-
dispatch={dispatch}
|
|
243
|
-
getState={getState}
|
|
244
|
-
cmp={consentManager}
|
|
245
|
-
hideDisclosures={hideDisclosures}
|
|
246
|
-
/>
|
|
247
|
-
</OsanoPublicContext.Provider>
|
|
248
|
-
)
|
|
249
|
-
```
|
|
250
|
-
|
|
251
|
-
To save (locally and remotely) new consent categories use:
|
|
252
|
-
|
|
253
|
-
```js
|
|
254
|
-
recordConsent(consentManager.current, ConsentCategory.ESSENTIAL); //ESSENTIAL, ANALYTICS, MARKETING, PERSONALIZATION, OPT_OUT
|
|
255
|
-
```
|
|
256
|
-
|
|
257
|
-
To get the list of consented categories (local storage):
|
|
258
|
-
|
|
259
|
-
```js
|
|
260
|
-
let consentedArray = consentManager.current.consent;
|
|
261
|
-
let consentedString = consentedArray.join(', ');
|
|
262
|
-
console.log(consentedString);
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
To get whether the user has already gone through the consent process:
|
|
266
|
-
|
|
267
|
-
```js
|
|
268
|
-
let userConsented = consentManager.current.consent.length > 0;
|
|
269
|
-
```
|
|
3
|
+
Visit the [Developer Docs](https://developers.osano.com/cmp/react-native/) to learn more about installation and usage.
|
|
@@ -6,6 +6,7 @@ import com.facebook.react.bridge.ReactMethod
|
|
|
6
6
|
import com.facebook.react.bridge.Promise
|
|
7
7
|
import android.content.Context
|
|
8
8
|
import android.provider.Settings
|
|
9
|
+
import android.preference.PreferenceManager
|
|
9
10
|
import java.util.UUID
|
|
10
11
|
|
|
11
12
|
class OsanoCMPSDKModule(reactContext: ReactApplicationContext) :
|
|
@@ -43,6 +44,46 @@ class OsanoCMPSDKModule(reactContext: ReactApplicationContext) :
|
|
|
43
44
|
promise.resolve(null)
|
|
44
45
|
}
|
|
45
46
|
|
|
47
|
+
@ReactMethod
|
|
48
|
+
fun setStorageToDefault(key: String?, value: String?, promise: Promise) {
|
|
49
|
+
val appContext = this.reactApplicationContext.applicationContext
|
|
50
|
+
val defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(appContext)
|
|
51
|
+
val editor = defaultSharedPreferences.edit()
|
|
52
|
+
editor.putString(key, value)
|
|
53
|
+
editor.apply()
|
|
54
|
+
promise.resolve(value)
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@ReactMethod
|
|
58
|
+
fun setIntStorageToDefault(key: String?, value: Int, promise: Promise) {
|
|
59
|
+
val appContext = this.reactApplicationContext.applicationContext
|
|
60
|
+
val defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(appContext)
|
|
61
|
+
val editor = defaultSharedPreferences.edit()
|
|
62
|
+
editor.putInt(key, value)
|
|
63
|
+
editor.apply()
|
|
64
|
+
promise.resolve(value)
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
@ReactMethod
|
|
68
|
+
fun setBoolStorageToDefault(key: String?, value: Boolean, promise: Promise) {
|
|
69
|
+
val appContext = this.reactApplicationContext.applicationContext
|
|
70
|
+
val defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(appContext)
|
|
71
|
+
val editor = defaultSharedPreferences.edit()
|
|
72
|
+
editor.putBoolean(key, value)
|
|
73
|
+
editor.apply()
|
|
74
|
+
promise.resolve(value)
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
@ReactMethod
|
|
78
|
+
fun clearStorageFromDefault(key: String?, promise: Promise) {
|
|
79
|
+
val appContext = this.reactApplicationContext.applicationContext
|
|
80
|
+
val defaultSharedPreferences = PreferenceManager.getDefaultSharedPreferences(appContext)
|
|
81
|
+
val editor = defaultSharedPreferences.edit()
|
|
82
|
+
editor.remove(key)
|
|
83
|
+
editor.apply()
|
|
84
|
+
promise.resolve(null)
|
|
85
|
+
}
|
|
86
|
+
|
|
46
87
|
@ReactMethod
|
|
47
88
|
fun getDeviceId(promise: Promise) {
|
|
48
89
|
// Get a unique vendor ID for the android device
|
package/ios/OsanoCmpSDK.mm
CHANGED
|
@@ -32,6 +32,48 @@ RCT_EXPORT_METHOD(clearStorage:(NSString *)key
|
|
|
32
32
|
resolve(nil);
|
|
33
33
|
}
|
|
34
34
|
|
|
35
|
+
RCT_EXPORT_METHOD(setStorageToDefault:(NSString *)key
|
|
36
|
+
val:(NSString *)value
|
|
37
|
+
res:(RCTPromiseResolveBlock)resolve
|
|
38
|
+
rej:(RCTPromiseRejectBlock)reject
|
|
39
|
+
) {
|
|
40
|
+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
41
|
+
[defaults setObject:value forKey:key];
|
|
42
|
+
[defaults synchronize];
|
|
43
|
+
resolve(value);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
RCT_EXPORT_METHOD(setIntStorageToDefault:(NSString *)key
|
|
47
|
+
val:(NSNumber *)value
|
|
48
|
+
res:(RCTPromiseResolveBlock)resolve
|
|
49
|
+
rej:(RCTPromiseRejectBlock)reject
|
|
50
|
+
) {
|
|
51
|
+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
52
|
+
[defaults setInteger:[value integerValue] forKey:key];
|
|
53
|
+
[defaults synchronize];
|
|
54
|
+
resolve(value);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
RCT_EXPORT_METHOD(setBoolStorageToDefault:(NSString *)key
|
|
58
|
+
val:(NSNumber *)value
|
|
59
|
+
res:(RCTPromiseResolveBlock)resolve
|
|
60
|
+
rej:(RCTPromiseRejectBlock)reject
|
|
61
|
+
) {
|
|
62
|
+
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
|
63
|
+
[defaults setBool:[value boolValue] forKey:key];
|
|
64
|
+
[defaults synchronize];
|
|
65
|
+
resolve(value);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
RCT_EXPORT_METHOD(clearStorageFromDefault:(NSString *)key
|
|
69
|
+
res:(RCTPromiseResolveBlock)resolve
|
|
70
|
+
rej:(RCTPromiseRejectBlock)reject
|
|
71
|
+
) {
|
|
72
|
+
[[NSUserDefaults standardUserDefaults] removeObjectForKey:key];
|
|
73
|
+
[[NSUserDefaults standardUserDefaults] synchronize];
|
|
74
|
+
resolve(nil);
|
|
75
|
+
}
|
|
76
|
+
|
|
35
77
|
RCT_EXPORT_METHOD(getDeviceId:(RCTPromiseResolveBlock)resolve
|
|
36
78
|
rej:(RCTPromiseRejectBlock)reject
|
|
37
79
|
) {
|