1.1.0 • Published 3 years ago

cookie-popup-mobile-sdk v1.1.0

Weekly downloads
-
License
ISC
Repository
-
Last release
3 years ago

cookie-popup-mobile-sdk is a library that pulls in a configurable OneTrust template

Pull in with "cookie-popup-mobile-sdk": "git+ssh://git@bitbucket.org:trilegiant-production/gce-mobile-app-cookie-popup-react-native.git#dev",

To use this library:

import { CookieBanner, TemplateProvider } from "cookie-popup-mobile-sdk";

You must wrap your App.js in the TemplateContext for the context to work:

Initialize with font, applicationId, sdkVerasion, language and the callback after user has accepted Cookies:

const font = {fontFamily: "RN House Sans Light", fontWeight: "400"}

<CookiePopup font={font} applicationID="5df24d64-a26d-47a4-a661-b7aa65648909-test" sdkVersion="6.14.0" language="en-gb" onAcceptCookiesCB={(cookies) => console.log(cookies)} />

You can post to onetrust the username on login, in order to save consets:

OneTrust.getInstance().postConsents("hannah@gmail.com");

To deplay just the Cookie Preferences page (There is no need to pass the inialization parameters), but you can still pass the onAcceptCookiesCB if you wish to retrieve that data. Here is an example of how you might open and close the popup.

{showConsents && (
    <CookiePopup
      presentModal={true}
      onAcceptCookiesCB={(cookies) => { setShowConsents(false); console.log(cookies);}}
    />
  )}

onAcceptCookiesCB is a callback that returns an array of cookie IDs that have been accepted by the user. Font can be passed through and will apply to all text within the library. It accepts a dictionary that can contain fontFamily and fontWeight. SDK version is the SDK version used by onetrust on the UI language is the lanugage wanted to be displayed from the onetrust categorization section applicationID is the applicationID used by onetrust

To Work on this library:

Add the node module to a project of your choice and work directly in the node module after installation, set up a new remote pointing to the bitbucket repo inside that node module, and commit directly from there.