@didomi/react-native 1.0.0 → 1.4.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.
@@ -1 +1 @@
1
- {"version":3,"sources":["Didomi.ts"],"names":["Didomi","RNDidomi","NativeModules","initialize","apiKey","localConfigurationPath","remoteConfigurationUrl","providerId","disableDidomiRemoteConfig","languageCode","noticeId","DidomiListener","init","setupUI","setLogLevel","level","addEventListener","eventType","callback","removeEventListener","removeAllEventListeners","reset","getDisabledPurposes","getDisabledPurposeIds","getDisabledVendors","getDisabledVendorIds","getEnabledPurposes","getEnabledPurposeIds","getEnabledVendors","getEnabledVendorIds","getJavaScriptForWebView","getQueryStringForWebView","getPurpose","purposeId","getRequiredPurposes","getRequiredPurposeIds","getRequiredVendors","getRequiredVendorIds","getText","key","getTranslatedText","getUserConsentStatusForPurpose","getUserConsentStatusForVendor","vendorId","getUserConsentStatusForVendorAndRequiredPurposes","getUserLegitimateInterestStatusForPurpose","getUserLegitimateInterestForVendor","getUserLegitimateInterestStatusForVendor","getUserLegitimateInterestStatusForVendorAndRequiredPurposes","getUserStatusForVendor","getVendor","hideNotice","hidePreferences","isConsentRequired","isUserConsentStatusPartial","isNoticeVisible","isPreferencesVisible","isError","isReady","setUser","organizationUserId","organizationUserIdAuthAlgorithm","organizationUserIdAuthSid","organizationUserIdAuthSalt","organizationUserIdAuthDigest","showNotice","showPreferences","view","setUserAgreeToAll","setUserConsentStatus","enabledPurposeIds","disabledPurposeIds","enabledVendorIds","disabledVendorIds","setUserDisagreeToAll","setUserStatus","purposesConsentStatus","purposesLIStatus","vendorsConsentStatus","vendorsLIStatus","setUserStatusSets","enabledConsentPurposeIds","disabledConsentPurposeIds","enabledLIPurposeIds","disabledLIPurposeIds","enabledConsentVendorIds","disabledConsentVendorIds","enabledLIVendorIds","disabledLIVendorIds","shouldConsentBeCollected","updateSelectedLanguage"],"mappings":";;;;;;;AAAA;;AACA;;AAGA,MAAM;AAAEA,EA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AACA;AACE+C,EAAAA,iBAAiB,EAAE,MAAwBnE,QAAQ,CAACmE,iBAAT,EAhXvB;;AAkXpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,oBAAoB,EAAE,CACpBC,iBADoB,EAEpBC,kBAFoB,EAGpBC,gBAHoB,EAIpBC,iBAJoB,KAMpBxE,QAAQ,CAACoE,oBAAT,CACEC,iBADF,EAEEC,kBAFF,EAGEC,gBAHF,EAIEC,iBAJF,CAhYkB;;AAuYpB;AACF;AACA;AACA;AACEC,EAAAA,oBAAoB,EAAE,MAAwBzE,QAAQ,CAACyE,oBAAT,EA3Y1B;;AA6YpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,aAAa,EAAE,CACbC,qBADa,EAEbC,gBAFa,EAGbC,oBAHa,EAIbC,eAJa,KAMb9E,QAAQ,CAAC0E,aAAT,CACEC,qBADF,EAEEC,gBAFF,EAGEC,oBAHF,EAIEC,eAJF,CA3ZkB;;AAkapB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAEEC,EAAAA,iBAAiB,EAAE,CACjBC,wBADiB,EAEjBC,yBAFiB,EAGjBC,mBAHiB,EAIjBC,oBAJiB,EAKjBC,uBALiB,EAMjBC,wBANiB,EAOjBC,kBAPiB,EAQjBC,mBARiB,KAUjBvF,QAAQ,CAAC+E,iBAAT,CACEC,wBADF,EAEEC,yBAFF,EAGEC,mBAHF,EAIEC,oBAJF,EAKEC,uBALF,EAMEC,wBANF,EAOEC,kBAPF,EAQEC,mBARF,CAxbkB;;AAmcpB;AACF;AACA;AACA;AACEC,EAAAA,wBAAwB,EAAE,MACxBxF,QAAQ,CAACwF,wBAAT,EAxckB;;AA0cpB;AACF;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,sBAAsB,EAAGjF,YAAD,IACtBR,QAAQ,CAACyF,sBAAT,CAAgCjF,YAAhC;AAldkB,CAAf","sourcesContent":["import { NativeModules } from 'react-native';\nimport { DidomiListener } from './DidomiListener';\nimport { DidomiEventType } from './DidomiTypes';\n\nconst { Didomi: RNDidomi } = NativeModules;\n\nexport const Didomi = {\n /**\n Initialize the Didomi SDK\n \n @param apiKey: Public API key of the organization from the Didomi Console.\n @param localConfigurationPath: Path to your local config file. Defaults to didomi_config.json if null.\n @param remoteConfigurationURL: URL to a remote configuration file to load during initialization. This parameter is not used yet. Set it to null for now.\n @param providerId: Your provider ID (if any).\n @param disableDidomiRemoteConfig: Whether to disable loading the remove configuration from the Didomi config. Keep this to \"false\" for loading configuration from the Didomi Console.\n @param languageCode: Language in which the consent UI should be displayed. By default, the consent UI is displayed in the language configured in the device settings. This property allows you to override the default setting and specify a language to display the UI in. String containing the language code e.g.: \"es\", \"fr\", etc.\n @param noticeId: Notice id for the remote configuration.\n */\n initialize: (\n apiKey: string,\n localConfigurationPath?: string,\n remoteConfigurationUrl?: string,\n providerId?: string,\n disableDidomiRemoteConfig: boolean = false,\n languageCode?: string,\n noticeId?: string\n ) => {\n // Init listener\n DidomiListener.init();\n\n // Trigger native SDK init\n RNDidomi.initialize(\n apiKey,\n localConfigurationPath,\n remoteConfigurationUrl,\n providerId,\n disableDidomiRemoteConfig,\n languageCode,\n noticeId\n );\n },\n\n /**\n -Provide the objects required to display UI elements\n */\n setupUI: (): Promise<void> => RNDidomi.setupUI(),\n\n /**\n Set the minimum level of messages to log\n \n Messages with a level below `minLevel` will not be logged.\n Levels are standard levels from `OSLogType` (https://developer.apple.com/documentation/os/logging/choosing_the_log_level_for_a_message):\n - OSLogType.info (1)\n - OSLogType.debug (2)\n - OSLogType.error (16)\n - OSLogType.fault (17)\n \n We recommend setting `OSLogType.error` (16) in production\n \n @param minLevel: Minimum level of messages to log\n */\n setLogLevel: (level: number): Promise<number> => RNDidomi.setLogLevel(level),\n\n /**\n Add an event listener\n @param listener:\n */\n addEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => DidomiListener.addEventListener(eventType, callback),\n\n /**\n Remove an event listener\n @param listener:\n */\n removeEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => DidomiListener.removeEventListener(eventType, callback),\n\n /**\n Remove all event listeners\n */\n removeAllEventListeners: () => DidomiListener.reset(),\n\n /**\n Method used to get an array of disabled purposes.\n @returns: array of disabled purposes.\n */\n getDisabledPurposes: (): Promise<any[]> => RNDidomi.getDisabledPurposes(),\n\n /**\n Method used to get a set of disabled purpose IDs.\n @returns: set that contains the IDs of disabled purposes.\n */\n getDisabledPurposeIds: (): Promise<any[]> => RNDidomi.getDisabledPurposeIds(),\n\n /**\n Method used to get an array of disabled vendors.\n @returns: array of disabled vendors.\n */\n getDisabledVendors: (): Promise<any[]> => RNDidomi.getDisabledVendors(),\n\n /**\n Method used to get a set of disabled vendor IDs.\n @returns: set that contains the IDs of disabled vendors.\n */\n getDisabledVendorIds: (): Promise<any[]> => RNDidomi.getDisabledVendorIds(),\n\n /**\n Method used to get an array of enabled purposes.\n @returns: array of enabled purposes.\n */\n getEnabledPurposes: (): Promise<any[]> => RNDidomi.getEnabledPurposes(),\n\n /**\n Method used to get a set of enabled purpose IDs.\n @returns: set that contains the IDs of enabled purposes.\n */\n getEnabledPurposeIds: (): Promise<any[]> => RNDidomi.getEnabledPurposeIds(),\n\n /**\n Method used to get an array of enabled vendors.\n @returns: array of enabled vendors.\n */\n getEnabledVendors: (): Promise<any[]> => RNDidomi.getEnabledVendors(),\n\n /**\n Method used to get a set of enabled vendor IDs.\n @returns: set that contains the IDs of enabled vendors.\n */\n getEnabledVendorIds: (): Promise<any[]> => RNDidomi.getEnabledVendorIds(),\n\n /**\n Get JavaScript to embed into a WebView to pass the consent status from the app\n to the Didomi Web SDK embedded into the WebView\n Inject the returned JavaScript into a WebView\n @param extra: Extra JavaScript to inject in the returned code\n @returns: JavaScript code to inject in a WebView\n */\n getJavaScriptForWebView: (): Promise<string> =>\n RNDidomi.getJavaScriptForWebView(),\n\n getQueryStringForWebView: (): Promise<string> =>\n RNDidomi.getQueryStringForWebView(),\n\n /**\n Method used to get a Purpose based on its ID.\n @param purposeId: purpose ID used in the search.\n @returns: purpose found in the array.\n */\n getPurpose: (purposeId: string): Promise<any[]> =>\n RNDidomi.getPurpose(purposeId),\n\n /**\n Method used to get an array of required purposes.\n \n @returns: array of required purposes.\n */\n getRequiredPurposes: (): Promise<any[]> => RNDidomi.getRequiredPurposes(),\n\n /**\n Get the configured purpose IDs\n @returns: set of purpose IDs.\n */\n getRequiredPurposeIds: (): Promise<any[]> => RNDidomi.getRequiredPurposeIds(),\n\n /**\n Method used to get an array of required vendors.\n @returns: array of required vendors.\n */\n getRequiredVendors: (): Promise<any[]> => RNDidomi.getRequiredVendors(),\n\n /**\n Get the configured vendor IDs\n @returns: set of vendor IDs.\n */\n getRequiredVendorIds: (): Promise<any[]> => RNDidomi.getRequiredVendorIds(),\n\n /**\n Method used to get a dictionary/map in the form of { \"en\": \"Key in English\", \"fr\": \"Key in French.\" }\n for a given key.\n @param key: used to find its corresponding value in the dictionary/map.\n @returns: dictionary containing the different translations for a given key.\n */\n getText: (key: string): Promise<any[]> => RNDidomi.getText(key),\n\n /**\n Method used to get a translated text based on the key being passed.\n The language and the source of this translated text will depend on the availability of the translation for the specific key.\n The language being used will be either the selected language of the SDK (based on device Locale and other parameters) or the language specified by app developers as the default language being used by the SDK. The source can be either the `didomi_config.json` file which can be either local or remote, or the `didomi_master_config.json` file which is bundled within the SDK.\n \n These are the attempts performed by the SDK to try to find a translation for the specific key:\n - Get translated value in user locale (selected language) from `didomi_config.json` (either local or remote).\n - Get translated value in default locale (from the config) from `didomi_config.json` (either local or remote).\n - Get translated value in user locale (selected language) from `didomi_master_config.json` (bundled within the Didomi SDK).\n - Get translated value in default locale (from the config) from `didomi_master_config.json` (bundled within the Didomi SDK).\n \n If no translation can be found after these 4 attempts, the key will be returned.\n \n App developers can provide these translated texts through the `didomi_config.json` file (locally or remotely) in 3 different ways:\n - Custom texts for the consent notice: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-notice#texts\n - Custom texts for the preferences: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-preferences-popup#text\n - Custom texts for custom notices: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-theme#translatable-texts-for-custom-notices\n \n @param key: used to find its corresponding value in one of the different sources.\n @returns: a translated string if a translation was found, the same key that was passed otherwise.\n */\n getTranslatedText: (key: string): Promise<string> =>\n RNDidomi.getTranslatedText(key),\n\n /**\n Get the user consent status for a specific purpose\n @param purposeId: The purpose ID to check consent for\n @returns: The user consent status for the specified purpose\n */\n getUserConsentStatusForPurpose: (purposeId: string): Promise<boolean> =>\n RNDidomi.getUserConsentStatusForPurpose(purposeId),\n\n /**\n Get the user consent status for a specific vendor\n @param vendorId: The vendor ID to check consent for\n @returns: The user consent status for the specified vendor\n */\n getUserConsentStatusForVendor: (vendorId: string): Promise<boolean> =>\n RNDidomi.getUserConsentStatusForVendor(vendorId),\n\n /**\n Get the user consent status for a specific vendor and all its purposes\n @param vendorId: The ID of the vendor\n @returns: The user consent status corresponding to the specified vendor and all its required purposes.\n */\n getUserConsentStatusForVendorAndRequiredPurposes: (\n vendorId: string\n ): Promise<boolean> =>\n RNDidomi.getUserConsentStatusForVendorAndRequiredPurposes(vendorId),\n\n /**\n Get the user legitimate interest status for a specific purpose.\n @param purposeId: purpose ID.\n @returns: LI status of a purpose.\n */\n getUserLegitimateInterestStatusForPurpose: (\n purposeId: string\n ): Promise<boolean> =>\n RNDidomi.getUserLegitimateInterestStatusForPurpose(purposeId),\n\n /**\n Get the user legitimate interest status for a specific vendor.\n @param vendorId: vendor ID.\n @returns: LI status of a vendor.\n */\n getUserLegitimateInterestForVendor: (vendorId: string): Promise<boolean> =>\n RNDidomi.getUserLegitimateInterestStatusForVendor(vendorId),\n\n /**\n Get the user LI status for a specific vendor and all its purposes.\n @param vendorId: vendor ID.\n @returns: The user LI status corresponding to the specified vendor and all its required purposes.\n */\n getUserLegitimateInterestStatusForVendorAndRequiredPurposes: (\n vendorId: string\n ): boolean =>\n RNDidomi.getUserLegitimateInterestStatusForVendorAndRequiredPurposes(\n vendorId\n ),\n\n /**\n Get the user consent and legitimate interest status for a specific vendor.\n @param vendorId: vendor ID.\n @returns: status that represents both consent and legitimate interest status of a vendor.\n */\n getUserStatusForVendor: (vendorId: string): Promise<boolean> =>\n RNDidomi.getUserStatusForVendor(vendorId),\n\n /**\n Method used to get a Vendor based on its ID.\n @param vendorId: vendor ID used in the search.\n @returns: vendor found in the array.\n */\n getVendor: (vendorId: string): Promise<any[]> => RNDidomi.getVendor(vendorId),\n\n /**\n - Hide the notice if it is currently displayed\n */\n hideNotice: (): Promise<void> => RNDidomi.hideNotice(),\n\n /**\n - Hide the preferences popup for purposes\n */\n hidePreferences: (): Promise<void> => RNDidomi.hidePreferences(),\n\n /**\n Determine if consent is required for the user. The rules are (OR):\n - The user country is in the EU.\n - The company is from the EU.\n - The user country is unknown and the app has chosen to collect consent when unknown.\n @returns: **true** if consent is required, **false** if it is not required.\n */\n isConsentRequired: (): Promise<boolean> => RNDidomi.isConsentRequired(),\n\n /**\n Determine if consent information is available for all purposes and vendors that are required\n @returns: **true** if consent is required and consent information is available, **false** otherwise.\n */\n isUserConsentStatusPartial: (): Promise<boolean> =>\n RNDidomi.isUserConsentStatusPartial(),\n\n /**\n Check if the consent notice is currently displayed\n @returns: **true** if the notice is displayed, **false** if is not.\n */\n isNoticeVisible: (): Promise<boolean> => RNDidomi.isNoticeVisible(),\n\n /**\n Method used to check if the Preferences view is visible.\n @returns: **true** if Preferences view is visible, **false** otherwise.\n */\n isPreferencesVisible: (): Promise<boolean> => RNDidomi.isPreferencesVisible(),\n\n isError: (): Promise<boolean> => RNDidomi.isError(),\n\n /**\n Is the Didomi SDK ready?\n */\n isReady: (): Promise<boolean> => RNDidomi.isReady(),\n\n /**\n Set user information with authentication\n \n @param id Organization user ID\n @param algorithm Algorithm used for computing the digest\n @param secretId ID of the secret used for computing the digest\n @param salt Salt used for computing the digest (optional)\n @param digest Digest of the organization user ID and secret\n */\n setUser: (\n organizationUserId: string,\n organizationUserIdAuthAlgorithm: string,\n organizationUserIdAuthSid: string,\n organizationUserIdAuthSalt: string,\n organizationUserIdAuthDigest: string\n ): Promise<void> =>\n RNDidomi.setUser(\n organizationUserId,\n organizationUserIdAuthAlgorithm,\n organizationUserIdAuthSid,\n organizationUserIdAuthSalt,\n organizationUserIdAuthDigest\n ),\n\n /**\n - Show the consent notice (if required, not disabled in the config and not already displayed)\n */\n showNotice: (): Promise<void> => RNDidomi.showNotice(),\n\n /**\n Show the preferences screen when/if the SDK is ready. By default the purposes list will be displayed.\n @param controller: view controller from where preferences will be presented.\n @param view: a value from `Didomi.Views`. It can be `.purposes` or `.vendors` (`ViewsPurposes` or `ViewsVendors` in Objective-C)\n */\n showPreferences: (view?: string): Promise<void> =>\n RNDidomi.showPreferences(view),\n\n /**\n Remove all consents for the user\n */\n reset: (): Promise<void> => RNDidomi.reset(),\n\n /**\n Method that allows to enable consent and legitimate interest for all the required purposes.\n @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserAgreeToAll: (): Promise<boolean> => RNDidomi.setUserAgreeToAll(),\n\n /**\n Set the user consent status.\n @param enabledPurposeIds: set containing **enabled purpose ids**\n @param disabledPurposeIds: set containing **disabled purpose ids**\n @param enabledVendorIds: set containing **enabled vendor ids**\n @param disabledVendorIds: set containing **disabled purpose ids** \n @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserConsentStatus: (\n enabledPurposeIds: string[],\n disabledPurposeIds: string[],\n enabledVendorIds: string[],\n disabledVendorIds: string[]\n ): Promise<boolean> =>\n RNDidomi.setUserConsentStatus(\n enabledPurposeIds,\n disabledPurposeIds,\n enabledVendorIds,\n disabledVendorIds\n ),\n\n /**\n Method that allows to disable consent and legitimate interest for all the required purposes and vendors.\n @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserDisagreeToAll: (): Promise<boolean> => RNDidomi.setUserDisagreeToAll(),\n\n /**\n Set the user status for purposes and vendors for consent and legitimate interest.\n @params purposesConsentStatus: boolean used to determine if consent will be enabled or disabled for all purposes.\n @params purposesLIStatus: boolean used to determine if legitimate interest will be enabled or disabled for all purposes.\n @params vendorsConsentStatus: boolean used to determine if consent will be enabled or disabled for all vendors.\n @params vendorsLIStatus: boolean used to determine if legitimate interest will be enabled or disabled for all vendors.\n @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserStatus: (\n purposesConsentStatus: boolean,\n purposesLIStatus: boolean,\n vendorsConsentStatus: boolean,\n vendorsLIStatus: boolean\n ): Promise<boolean> =>\n RNDidomi.setUserStatus(\n purposesConsentStatus,\n purposesLIStatus,\n vendorsConsentStatus,\n vendorsLIStatus\n ),\n\n /**\n Set the user status for purposes and vendors for consent and legitimate interest.\n\n @param enabledConsentPurposeIds: List of purpose IDs to enable for consent.\n @param disabledConsentPurposeIds: List of purpose IDs to disable for consent.\n @param enabledLIPurposeIds: List of purpose IDs to enable for LI.\n @param disabledLIPurposeIds: List of purpose IDs to disable for LI.\n @param enabledConsentVendorIds: List of vendor IDs to enable for consent.\n @param disabledConsentVendorIds: List of vendor IDs to disable for consent.\n @param enabledLIVendorIds: List of vendor IDs to enable for LI.\n @param disabledLIVendorIds: List of vendor IDs to disable for LI.\n */\n setUserStatusSets: (\n enabledConsentPurposeIds: string[],\n disabledConsentPurposeIds: string[],\n enabledLIPurposeIds: string[],\n disabledLIPurposeIds: string[],\n enabledConsentVendorIds: string[],\n disabledConsentVendorIds: string[],\n enabledLIVendorIds: string[],\n disabledLIVendorIds: string[]\n ): Promise<boolean> =>\n RNDidomi.setUserStatusSets(\n enabledConsentPurposeIds,\n disabledConsentPurposeIds,\n enabledLIPurposeIds,\n disabledLIPurposeIds,\n enabledConsentVendorIds,\n disabledConsentVendorIds,\n enabledLIVendorIds,\n disabledLIVendorIds\n ),\n\n /**\n Check if the consent should be collected depending on if we have any consents or if we have some consents but the number of days before displaying the notice again has not expired yet\n @returns: A boolean depending if the consent should be collected or not\n */\n shouldConsentBeCollected: (): Promise<boolean> =>\n RNDidomi.shouldConsentBeCollected(),\n\n /**\n Method used to update the selected language of the Didomi SDK and any property that depends on it.\n In most cases this method doesn't need to be called. It would only be required for those apps that allow language change on-the-fly, i.e.: from within the app rather than from the device settings.\n In order to update the language of the views displayed by the Didomi SDK, this method needs to be called before these views are displayed.\n \n @param languageCode: string containing the language code e.g.: \"es\", \"fr\", etc.\n */\n updateSelectedLanguage: (languageCode: string): Promise<void> =>\n RNDidomi.updateSelectedLanguage(languageCode),\n};\n"]}
1
+ {"version":3,"sources":["Didomi.ts"],"names":["Didomi","RNDidomi","NativeModules","initialize","apiKey","localConfigurationPath","remoteConfigurationUrl","providerId","disableDidomiRemoteConfig","languageCode","noticeId","DidomiListener","init","onReady","onError","setupUI","setLogLevel","level","addEventListener","eventType","callback","removeEventListener","removeAllEventListeners","reset","getDisabledPurposes","getDisabledPurposeIds","getDisabledVendors","getDisabledVendorIds","getEnabledPurposes","getEnabledPurposeIds","getEnabledVendors","getEnabledVendorIds","getJavaScriptForWebView","extra","getQueryStringForWebView","getPurpose","purposeId","getRequiredPurposes","getRequiredPurposeIds","getRequiredVendors","getRequiredVendorIds","getText","key","getTranslatedText","getUserConsentStatusForPurpose","getUserConsentStatusForVendor","vendorId","getUserConsentStatusForVendorAndRequiredPurposes","getUserLegitimateInterestStatusForPurpose","getUserLegitimateInterestForVendor","getUserLegitimateInterestStatusForVendor","getUserLegitimateInterestStatusForVendorAndRequiredPurposes","getUserStatus","getUserStatusForVendor","getVendor","hideNotice","hidePreferences","isConsentRequired","isUserConsentStatusPartial","isNoticeVisible","isPreferencesVisible","isError","isReady","setUser","organizationUserId","organizationUserIdAuthAlgorithm","organizationUserIdAuthSid","organizationUserIdAuthSalt","organizationUserIdAuthDigest","showNotice","showPreferences","view","setUserAgreeToAll","setUserConsentStatus","enabledPurposeIds","disabledPurposeIds","enabledVendorIds","disabledVendorIds","setUserDisagreeToAll","setUserStatus","purposesConsentStatus","purposesLIStatus","vendorsConsentStatus","vendorsLIStatus","setUserStatusSets","enabledConsentPurposeIds","disabledConsentPurposeIds","enabledLIPurposeIds","disabledLIPurposeIds","enabledConsentVendorIds","disabledConsentVendorIds","enabledLIVendorIds","disabledLIVendorIds","shouldConsentBeCollected","updateSelectedLanguage"],"mappings":";;;;;;;AAAA;;AACA;;AAGA,MAAM;AAAEA,EAAAA,MAAM,EAAEC;AAAV,IAAuBC,0BAA7B;AAEO,MAAMF,MAAM,GAAG;AACpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEG,EAAAA,UAAU,EAAE,CACVC,MADU,EAEVC,sBAFU,EAGVC,sBAHU,EAIVC,UAJU,EAKVC,yBAAkC,GAAG,KAL3B,EAMVC,YANU,EAOVC,QAPU,KAQP;AACH;AACAC,mCAAeC,IAAf,GAFG,CAIH;;;AACAX,IAAAA,QAAQ,CAACE,UAAT,CACEC,MADF,EAEEC,sBAFF,EAGEC,sBAHF,EAIEC,UAJF,EAKEC,yBALF,EAMEC,YANF,EAOEC,QAPF;AASD,GAlCmB;;AAoCpB;AACF;AACA;AACEG,EAAAA,OAAO,EAAE,MAAqBF,+BAAeE,OAAf,EAvCV;;AAyCpB;AACF;AACA;AACEC,EAAAA,OAAO,EAAE,MAAoBH,+BAAeG,OAAf,EA5CT;;AA8CpB;AACF;AACA;AACEC,EAAAA,OAAO,EAAE,MAAqBd,QAAQ,CAACc,OAAT,EAjDV;;AAmDpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,WAAW,EAAGC,KAAD,IAAoChB,QAAQ,CAACe,WAAT,CAAqBC,KAArB,CA1E7B;;AA4EpB;AACF;AACA;AACA;AACEC,EAAAA,gBAAgB,EAAE,CAChBC,SADgB,EAEhBC,QAFgB,KAGbT,+BAAeO,gBAAf,CAAgCC,SAAhC,EAA2CC,QAA3C,CAnF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,EAIEC,eAJF,CAnbkB;;AA0bpB;AACF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACEC,EAAAA,iBAAiB,EAAE,CACjBC,wBADiB,EAEjBC,yBAFiB,EAGjBC,mBAHiB,EAIjBC,oBAJiB,EAKjBC,uBALiB,EAMjBC,wBANiB,EAOjBC,kBAPiB,EAQjBC,mBARiB,KAUjB3F,QAAQ,CAACmF,iBAAT,CACEC,wBADF,EAEEC,yBAFF,EAGEC,mBAHF,EAIEC,oBAJF,EAKEC,uBALF,EAMEC,wBANF,EAOEC,kBAPF,EAQEC,mBARF,CA/ckB;;AA0dpB;AACF;AACA;AACA;AACEC,EAAAA,wBAAwB,EAAE,MACxB5F,QAAQ,CAAC4F,wBAAT,EA/dkB;;AAiepB;AACF;AACA;AACA;AACA;AACA;AACEC,EAAAA,sBAAsB,EAAGrF,YAAD,IACtBR,QAAQ,CAAC6F,sBAAT,CAAgCrF,YAAhC;AAxekB,CAAf","sourcesContent":["import { NativeModules } from 'react-native';\nimport { DidomiListener } from './DidomiListener';\nimport { DidomiEventType } from './DidomiTypes';\n\nconst { Didomi: RNDidomi } = NativeModules;\n\nexport const Didomi = {\n /**\n * Initialize the Didomi SDK\n *\n * @param apiKey: Public API key of the organization from the Didomi Console.\n * @param localConfigurationPath: Path to your local config file. Defaults to didomi_config.json if null.\n * @param remoteConfigurationURL: URL to a remote configuration file to load during initialization. This parameter is not used yet. Set it to null for now.\n * @param providerId: Your provider ID (if any).\n * @param disableDidomiRemoteConfig: Whether to disable loading the remove configuration from the Didomi config. Keep this to \"false\" for loading configuration from the Didomi Console.\n * @param languageCode: Language in which the consent UI should be displayed. By default, the consent UI is displayed in the language configured in the device settings. This property allows you to override the default setting and specify a language to display the UI in. String containing the language code e.g.: \"es\", \"fr\", etc.\n * @param noticeId: Notice id for the remote configuration.\n */\n initialize: (\n apiKey: string,\n localConfigurationPath?: string,\n remoteConfigurationUrl?: string,\n providerId?: string,\n disableDidomiRemoteConfig: boolean = false,\n languageCode?: string,\n noticeId?: string\n ) => {\n // Init listener\n DidomiListener.init();\n\n // Trigger native SDK init\n RNDidomi.initialize(\n apiKey,\n localConfigurationPath,\n remoteConfigurationUrl,\n providerId,\n disableDidomiRemoteConfig,\n languageCode,\n noticeId\n );\n },\n\n /**\n * Listen to SDK ready state\n * */\n onReady: (): Promise<void> => DidomiListener.onReady(),\n\n /**\n * Listen to SDK errors\n * */\n onError: (): Promise<any> => DidomiListener.onError(),\n\n /**\n Provide the objects required to display UI elements\n */\n setupUI: (): Promise<void> => RNDidomi.setupUI(),\n\n /**\n * Set the minimum level of messages to log\n * You can decide what level of messages should be logged by the SDK by calling the setLogLevel function before initialize\n *\n * Messages with a level below `minLevel` will not be logged.\n *\n * For iOS:\n * Levels are standard levels from `OSLogType` (https://developer.apple.com/documentation/os/logging/choosing_the_log_level_for_a_message):\n * - OSLogType.info (1)\n * - OSLogType.debug (2)\n * - OSLogType.error (16)\n * - OSLogType.fault (17)\n *\n * We recommend setting `OSLogType.error` (16) in production\n *\n * For Android:\n * Use the standard log levels supported by android.util.Log: VERBOSE, DEBUG, INFO, WARN and ERROR.\n * (https://developer.android.com/reference/android/util/Log#constants_1)\n *\n * We recommend setting `Log.INFO` (4) in production\n *\n * @param minLevel: Minimum level of messages to log\n */\n setLogLevel: (level: number): Promise<number> => RNDidomi.setLogLevel(level),\n\n /**\n * Add an event listener\n * @param listener:\n */\n addEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => DidomiListener.addEventListener(eventType, callback),\n\n /**\n * Remove an event listener\n * @param listener:\n */\n removeEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => DidomiListener.removeEventListener(eventType, callback),\n\n /**\n * Remove all event listeners\n */\n removeAllEventListeners: () => DidomiListener.reset(),\n\n /**\n * Method used to get an array of disabled purposes.\n * @returns: array of disabled purposes.\n */\n getDisabledPurposes: (): Promise<any[]> => RNDidomi.getDisabledPurposes(),\n\n /**\n * Method used to get a set of disabled purpose IDs.\n * @returns: set that contains the IDs of disabled purposes.\n */\n getDisabledPurposeIds: (): Promise<any[]> => RNDidomi.getDisabledPurposeIds(),\n\n /**\n * Method used to get an array of disabled vendors.\n * @returns: array of disabled vendors.\n */\n getDisabledVendors: (): Promise<any[]> => RNDidomi.getDisabledVendors(),\n\n /**\n * Method used to get a set of disabled vendor IDs.\n * @returns: set that contains the IDs of disabled vendors.\n */\n getDisabledVendorIds: (): Promise<any[]> => RNDidomi.getDisabledVendorIds(),\n\n /**\n * Method used to get an array of enabled purposes.\n * @returns: array of enabled purposes.\n */\n getEnabledPurposes: (): Promise<any[]> => RNDidomi.getEnabledPurposes(),\n\n /**\n * Method used to get a set of enabled purpose IDs.\n * @returns: set that contains the IDs of enabled purposes.\n */\n getEnabledPurposeIds: (): Promise<any[]> => RNDidomi.getEnabledPurposeIds(),\n\n /**\n * Method used to get an array of enabled vendors.\n * @returns: array of enabled vendors.\n */\n getEnabledVendors: (): Promise<any[]> => RNDidomi.getEnabledVendors(),\n\n /**\n * Method used to get a set of enabled vendor IDs.\n * @returns: set that contains the IDs of enabled vendors.\n */\n getEnabledVendorIds: (): Promise<any[]> => RNDidomi.getEnabledVendorIds(),\n\n /**\n * Get JavaScript to embed into a WebView to pass the consent status from the app\n * to the Didomi Web SDK embedded into the WebView\n * Inject the returned JavaScript into a WebView\n * @param extra: Extra JavaScript to inject in the returned code\n * @returns: JavaScript code to inject in a WebView\n */\n getJavaScriptForWebView: (extra?: string | null): Promise<string> => RNDidomi.getJavaScriptForWebView(extra),\n\n getQueryStringForWebView: (): Promise<string> => RNDidomi.getQueryStringForWebView(),\n\n /**\n * Method used to get a Purpose based on its ID.\n * @param purposeId: purpose ID used in the search.\n * @returns: purpose found in the array.\n */\n getPurpose: (purposeId: string): Promise<any> => RNDidomi.getPurpose(purposeId),\n\n /**\n * Method used to get an array of required purposes.\n *\n * @returns: array of required purposes.\n */\n getRequiredPurposes: (): Promise<any[]> => RNDidomi.getRequiredPurposes(),\n\n /**\n * Get the configured purpose IDs\n * @returns: set of purpose IDs.\n */\n getRequiredPurposeIds: (): Promise<any[]> => RNDidomi.getRequiredPurposeIds(),\n\n /**\n * Method used to get an array of required vendors.\n * @returns: array of required vendors.\n */\n getRequiredVendors: (): Promise<any[]> => RNDidomi.getRequiredVendors(),\n\n /**\n * Get the configured vendor IDs\n * @returns: set of vendor IDs.\n */\n getRequiredVendorIds: (): Promise<any[]> => RNDidomi.getRequiredVendorIds(),\n\n /**\n * Method used to get a dictionary/map in the form of { \"en\": \"Key in English\", \"fr\": \"Key in French.\" }\n * for a given key.\n * @param key: used to find its corresponding value in the dictionary/map.\n * @returns: dictionary containing the different translations for a given key.\n */\n getText: (key: string): Promise<any[]> => RNDidomi.getText(key),\n\n /**\n * Method used to get a translated text based on the key being passed.\n * The language and the source of this translated text will depend on the availability of the translation for the specific key.\n * The language being used will be either the selected language of the SDK (based on device Locale and other parameters) or the language specified by app developers as the default language being used by the SDK. The source can be either the `didomi_config.json` file which can be either local or remote, or the `didomi_master_config.json` file which is bundled within the SDK.\n *\n * These are the attempts performed by the SDK to try to find a translation for the specific key:\n * - Get translated value in user locale (selected language) from `didomi_config.json` (either local or remote).\n * - Get translated value in default locale (from the config) from `didomi_config.json` (either local or remote).\n * - Get translated value in user locale (selected language) from `didomi_master_config.json` (bundled within the Didomi SDK).\n * - Get translated value in default locale (from the config) from `didomi_master_config.json` (bundled within the Didomi SDK).\n *\n * If no translation can be found after these 4 attempts, the key will be returned.\n *\n * App developers can provide these translated texts through the `didomi_config.json` file (locally or remotely) in 3 different ways:\n * - Custom texts for the consent notice: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-notice#texts\n * - Custom texts for the preferences: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-preferences-popup#text\n * - Custom texts for custom notices: https://developers.didomi.io/cmp/mobile-sdk/consent-notice/customize-the-theme#translatable-texts-for-custom-notices\n *\n * @param key: used to find its corresponding value in one of the different sources.\n * @returns: a translated string if a translation was found, the same key that was passed otherwise.\n */\n getTranslatedText: (key: string): Promise<string> => RNDidomi.getTranslatedText(key),\n\n /**\n * Get the user consent status for a specific purpose\n * @param purposeId: The purpose ID to check consent for\n * @returns: The user consent status for the specified purpose\n * @deprecated use {@link #getUserStatus()} instead. Search the purposeId in\n * getUserStatus().getPurposes().getConsent().getEnabled() or\n * getUserStatus().getPurposes().getConsent().getDisabled().\n */\n getUserConsentStatusForPurpose: (purposeId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForPurpose(purposeId),\n\n /**\n * Get the user consent status for a specific vendor\n * @param vendorId: The vendor ID to check consent for\n * @returns: The user consent status for the specified vendor\n * @deprecated use {@link #getUserStatus()} instead. Search the vendorId in\n * getUserStatus().getVendors().getConsent().getEnabled() or\n * getUserStatus().getVendors().getConsent().getDisabled().\n */\n getUserConsentStatusForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForVendor(vendorId),\n\n /**\n * Get the user consent status for a specific vendor and all its purposes\n * @param vendorId: The ID of the vendor\n * @returns: The user consent status corresponding to the specified vendor and all its required purposes.\n * @deprecated use {@link #getUserStatus()} instead. The result of this method has been replaced\n * by getUserStatus().getVendors().getGlobalConsent().getEnabled() or\n * getUserStatus().getVendors().getGlobalConsent().getDisabled().\n */\n getUserConsentStatusForVendorAndRequiredPurposes: (vendorId: string): Promise<boolean> => RNDidomi.getUserConsentStatusForVendorAndRequiredPurposes(vendorId),\n\n /**\n * Get the user legitimate interest status for a specific purpose.\n * @param purposeId: purpose ID.\n * @returns: LI status of a purpose.\n * @deprecated use {@link #getUserStatus()} instead. Search the purposeId in\n * getUserStatus().getPurposes().getLegitimateInterest().getEnabled() or\n * getUserStatus().getPurposes().getLegitimateInterest().getDisabled().\n */\n getUserLegitimateInterestStatusForPurpose: (purposeId: string): Promise<boolean> => RNDidomi.getUserLegitimateInterestStatusForPurpose(purposeId),\n\n /**\n * Get the user legitimate interest status for a specific vendor.\n * @param vendorId: vendor ID.\n * @returns: LI status of a vendor.\n * @deprecated use {@link #getUserStatus()} instead. Search the vendorId in\n * getUserStatus().getVendors().getLegitimateInterest().getEnabled() or\n * getUserStatus().getVendors().getLegitimateInterest().getDisabled().\n */\n getUserLegitimateInterestForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserLegitimateInterestStatusForVendor(vendorId),\n\n /**\n * Get the user LI status for a specific vendor and all its purposes.\n * @param vendorId: vendor ID.\n * @returns: The user LI status corresponding to the specified vendor and all its required purposes.\n * @deprecated use {@link #getUserStatus()} instead. Search the purposeId in\n * getUserStatus().getVendors().getGlobalLegitimateInterest().getEnabled() or\n * getUserStatus().getVendors().getGlobalLegitimateInterest().getDisabled().\n */\n getUserLegitimateInterestStatusForVendorAndRequiredPurposes: (vendorId: string): boolean => RNDidomi.getUserLegitimateInterestStatusForVendorAndRequiredPurposes(vendorId),\n\n /**\n * Get the user consent status.\n * @returns: status that represents user consent.\n */\n getUserStatus: (): Promise<any> => RNDidomi.getUserStatus(),\n\n /**\n * Get the user consent and legitimate interest status for a specific vendor.\n * @param vendorId: vendor ID.\n * @returns: status that represents both consent and legitimate interest status of a vendor.\n * @deprecated use {@link #getUserStatus()} instead. Search the vendorId in\n * getUserStatus().getVendors().getGlobal().getEnabled() or\n * getUserStatus().getVendors().getGlobal().getDisabled().\n */\n getUserStatusForVendor: (vendorId: string): Promise<boolean> => RNDidomi.getUserStatusForVendor(vendorId),\n\n /**\n * Method used to get a Vendor based on its ID.\n * @param vendorId: vendor ID used in the search.\n * @returns: vendor found in the array.\n */\n getVendor: (vendorId: string): Promise<any> => RNDidomi.getVendor(vendorId),\n\n /**\n * Hide the notice if it is currently displayed\n */\n hideNotice: (): Promise<void> => RNDidomi.hideNotice(),\n\n /**\n * Hide the preferences popup for purposes\n */\n hidePreferences: (): Promise<void> => RNDidomi.hidePreferences(),\n\n /**\n * Determine if consent is required for the user. The rules are (OR):\n * - The user country is in the EU.\n * - The company is from the EU.\n * - The user country is unknown and the app has chosen to collect consent when unknown.\n * @returns: **true** if consent is required, **false** if it is not required.\n */\n isConsentRequired: (): Promise<boolean> => RNDidomi.isConsentRequired(),\n\n /**\n * Determine if consent information is available for all purposes and vendors that are required\n * @returns: **true** if consent is required and consent information is available, **false** otherwise.\n */\n isUserConsentStatusPartial: (): Promise<boolean> => RNDidomi.isUserConsentStatusPartial(),\n\n /**\n * Check if the consent notice is currently displayed\n * @returns: **true** if the notice is displayed, **false** if is not.\n */\n isNoticeVisible: (): Promise<boolean> => RNDidomi.isNoticeVisible(),\n\n /**\n * Method used to check if the Preferences view is visible.\n * @returns: **true** if Preferences view is visible, **false** otherwise.\n */\n isPreferencesVisible: (): Promise<boolean> => RNDidomi.isPreferencesVisible(),\n\n isError: (): Promise<boolean> => RNDidomi.isError(),\n\n /**\n * Is the Didomi SDK ready?\n */\n isReady: (): Promise<boolean> => RNDidomi.isReady(),\n\n /**\n * Set user information with authentication\n *\n * @param id Organization user ID\n * @param algorithm Algorithm used for computing the digest\n * @param secretId ID of the secret used for computing the digest\n * @param salt Salt used for computing the digest (optional)\n * @param digest Digest of the organization user ID and secret\n */\n setUser: (\n organizationUserId: string,\n organizationUserIdAuthAlgorithm: string,\n organizationUserIdAuthSid: string,\n organizationUserIdAuthSalt: string,\n organizationUserIdAuthDigest: string\n ): Promise<void> =>\n RNDidomi.setUser(\n organizationUserId,\n organizationUserIdAuthAlgorithm,\n organizationUserIdAuthSid,\n organizationUserIdAuthSalt,\n organizationUserIdAuthDigest\n ),\n\n /**\n * Show the consent notice (if required, not disabled in the config and not already displayed)\n */\n showNotice: (): Promise<void> => RNDidomi.showNotice(),\n\n /**\n * Show the preferences screen when/if the SDK is ready. By default the purposes list will be displayed.\n * @param view: It can be `purposes` or `vendors`\n */\n showPreferences: (view?: string): Promise<void> => RNDidomi.showPreferences(view),\n\n /**\n * Remove all consents for the user\n */\n reset: (): Promise<void> => RNDidomi.reset(),\n\n /**\n * Method that allows to enable consent and legitimate interest for all the required purposes.\n * @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserAgreeToAll: (): Promise<boolean> => RNDidomi.setUserAgreeToAll(),\n\n /**\n * Set the user consent status.\n * @param enabledPurposeIds: set containing **enabled purpose ids**\n * @param disabledPurposeIds: set containing **disabled purpose ids**\n * @param enabledVendorIds: set containing **enabled vendor ids**\n * @param disabledVendorIds: set containing **disabled purpose ids**\n * @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserConsentStatus: (\n enabledPurposeIds: string[],\n disabledPurposeIds: string[],\n enabledVendorIds: string[],\n disabledVendorIds: string[]\n ): Promise<boolean> =>\n RNDidomi.setUserConsentStatus(\n enabledPurposeIds,\n disabledPurposeIds,\n enabledVendorIds,\n disabledVendorIds\n ),\n\n /**\n * Method that allows to disable consent and legitimate interest for all the required purposes and vendors.\n * @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserDisagreeToAll: (): Promise<boolean> => RNDidomi.setUserDisagreeToAll(),\n\n /**\n * Set the user status for purposes and vendors for consent and legitimate interest.\n * @param purposesConsentStatus: boolean used to determine if consent will be enabled or disabled for all purposes.\n * @param purposesLIStatus: boolean used to determine if legitimate interest will be enabled or disabled for all purposes.\n * @param vendorsConsentStatus: boolean used to determine if consent will be enabled or disabled for all vendors.\n * @param vendorsLIStatus: boolean used to determine if legitimate interest will be enabled or disabled for all vendors.\n * @returns: **true** if consent status has been updated, **false** otherwise.\n */\n setUserStatus: (\n purposesConsentStatus: boolean,\n purposesLIStatus: boolean,\n vendorsConsentStatus: boolean,\n vendorsLIStatus: boolean\n ): Promise<boolean> =>\n RNDidomi.setUserStatus(\n purposesConsentStatus,\n purposesLIStatus,\n vendorsConsentStatus,\n vendorsLIStatus\n ),\n\n /**\n * Set the user status for purposes and vendors for consent and legitimate interest.\n * @param enabledConsentPurposeIds: List of purpose IDs to enable for consent.\n * @param disabledConsentPurposeIds: List of purpose IDs to disable for consent.\n * @param enabledLIPurposeIds: List of purpose IDs to enable for LI.\n * @param disabledLIPurposeIds: List of purpose IDs to disable for LI.\n * @param enabledConsentVendorIds: List of vendor IDs to enable for consent.\n * @param disabledConsentVendorIds: List of vendor IDs to disable for consent.\n * @param enabledLIVendorIds: List of vendor IDs to enable for LI.\n * @param disabledLIVendorIds: List of vendor IDs to disable for LI.\n */\n setUserStatusSets: (\n enabledConsentPurposeIds: string[],\n disabledConsentPurposeIds: string[],\n enabledLIPurposeIds: string[],\n disabledLIPurposeIds: string[],\n enabledConsentVendorIds: string[],\n disabledConsentVendorIds: string[],\n enabledLIVendorIds: string[],\n disabledLIVendorIds: string[]\n ): Promise<boolean> =>\n RNDidomi.setUserStatusSets(\n enabledConsentPurposeIds,\n disabledConsentPurposeIds,\n enabledLIPurposeIds,\n disabledLIPurposeIds,\n enabledConsentVendorIds,\n disabledConsentVendorIds,\n enabledLIVendorIds,\n disabledLIVendorIds\n ),\n\n /**\n * Check if the consent should be collected depending on if we have any consents or if we have some consents but the number of days before displaying the notice again has not expired yet\n * @returns: A boolean depending if the consent should be collected or not\n */\n shouldConsentBeCollected: (): Promise<boolean> =>\n RNDidomi.shouldConsentBeCollected(),\n\n /**\n * Method used to update the selected language of the Didomi SDK and any property that depends on it.\n * In most cases this method doesn't need to be called. It would only be required for those apps that allow language change on-the-fly, i.e.: from within the app rather than from the device settings.\n * In order to update the language of the views displayed by the Didomi SDK, this method needs to be called before these views are displayed.\n * @param languageCode: string containing the language code e.g.: \"es\", \"fr\", etc.\n */\n updateSelectedLanguage: (languageCode: string): Promise<void> =>\n RNDidomi.updateSelectedLanguage(languageCode),\n};\n"]}
@@ -12,6 +12,13 @@ var _DidomiTypes = require("./DidomiTypes");
12
12
  const {
13
13
  Didomi: RNDidomi
14
14
  } = _reactNative.NativeModules;
15
+ var InternalEventType;
16
+
17
+ (function (InternalEventType) {
18
+ InternalEventType["READY_CALLBACK"] = "on_ready_callback";
19
+ InternalEventType["ERROR_CALLBACK"] = "on_error_callback";
20
+ })(InternalEventType || (InternalEventType = {}));
21
+
15
22
  const DidomiListener = {
16
23
  listeners: new Map(),
17
24
  eventEmitter: new _reactNative.NativeEventEmitter(RNDidomi),
@@ -53,6 +60,26 @@ const DidomiListener = {
53
60
  events.splice(index, 1);
54
61
  }
55
62
  }
63
+ },
64
+ onReady: () => {
65
+ return new Promise(resolve => {
66
+ const listener = _event => {
67
+ resolve();
68
+ DidomiListener.eventEmitter.removeListener(InternalEventType.READY_CALLBACK, listener);
69
+ };
70
+
71
+ DidomiListener.eventEmitter.addListener(InternalEventType.READY_CALLBACK, listener);
72
+ });
73
+ },
74
+ onError: () => {
75
+ return new Promise(resolve => {
76
+ const listener = _event => {
77
+ resolve(_event);
78
+ DidomiListener.eventEmitter.removeListener(InternalEventType.ERROR_CALLBACK, listener);
79
+ };
80
+
81
+ DidomiListener.eventEmitter.addListener(InternalEventType.ERROR_CALLBACK, listener);
82
+ });
56
83
  }
57
84
  };
58
85
  exports.DidomiListener = DidomiListener;
@@ -1 +1 @@
1
- {"version":3,"sources":["DidomiListener.ts"],"names":["Didomi","RNDidomi","NativeModules","DidomiListener","listeners","Map","eventEmitter","NativeEventEmitter","init","Object","values","DidomiEventType","forEach","eventTypeValue","addListener","_event","events","get","el","reset","addEventListener","eventType","callback","set","push","removeEventListener","index","indexOf","splice"],"mappings":";;;;;;;AAAA;;AACA;;AAEA,MAAM;AAAEA,EAAAA,MAAM,EAAEC;AAAV,IAAuBC,0BAA7B;AAEO,MAAMC,cAAc,GAAG;AAC5BC,EAAAA,SAAS,EAAE,IAAIC,GAAJ,EADiB;AAE5BC,EAAAA,YAAY,EAAE,IAAIC,+BAAJ,CAAuBN,QAAvB,CAFc;AAI5BO,EAAAA,IAAI,EAAE,MAAM;AACV;AACAC,IAAAA,MAAM,CAACC,MAAP,CAAcC,4BAAd,EAA+BC,OAA/B,CAAwCC,cAAD,IAAoB;AACzDV,MAAAA,cAAc,CAACG,YAAf,CAA4BQ,WAA5B,CAAwCD,cAAxC,EAAyDE,MAAD,IAAiB;AACvE,YAAIC,MAAM,GAAGb,cAAc,CAACC,SAAf,CAAyBa,GAAzB,CAA6BJ,cAA7B,CAAb;;AACA,YAAIG,MAAJ,EAAY;AACVA,UAAAA,MAAM,CAACJ,OAAP,CAAgBM,EAAD,IAAa;AAC1BA,YAAAA,EAAE,CAACH,MAAD,CAAF;AACD,WAFD;AAGD;AACF,OAPD;AAQD,KATD;AAUD,GAhB2B;AAkB5BI,EAAAA,KAAK,EAAE,MAAM;AACX;AACAhB,IAAAA,cAAc,CAACC,SAAf,GAA2B,IAAIC,GAAJ,EAA3B;AACD,GArB2B;AAuB5Be,EAAAA,gBAAgB,EAAE,CAChBC,SADgB,EAEhBC,QAFgB,KAGb;AACH,QAAIN,MAAM,GAAGb,cAAc,CAACC,SAAf,CAAyBa,GAAzB,CAA6BI,SAA7B,CAAb;;AACA,QAAI,CAACL,MAAL,EAAa;AACXA,MAAAA,MAAM,GAAG,EAAT;AACAb,MAAAA,cAAc,CAACC,SAAf,CAAyBmB,GAAzB,CAA6BF,SAA7B,EAAwCL,MAAxC;AACD;;AACDA,IAAAA,MAAM,CAACQ,IAAP,CAAYF,QAAZ;AACD,GAjC2B;AAmC5BG,EAAAA,mBAAmB,EAAE,CACnBJ,SADmB,EAEnBC,QAFmB,KAGhB;AACH,QAAIN,MAAM,GAAGb,cAAc,CAACC,SAAf,CAAyBa,GAAzB,CAA6BI,SAA7B,CAAb;;AACA,QAAIL,MAAJ,EAAY;AACV,UAAIU,KAAK,GAAGV,MAAM,CAACW,OAAP,CAAeL,QAAf,CAAZ;;AACA,UAAII,KAAK,KAAK,CAAC,CAAf,EAAkB;AAChBV,QAAAA,MAAM,CAACY,MAAP,CAAcF,KAAd,EAAqB,CAArB;AACD;AACF;AACF;AA9C2B,CAAvB","sourcesContent":["import { NativeModules, NativeEventEmitter } from 'react-native';\nimport { DidomiEventType } from './DidomiTypes';\n\nconst { Didomi: RNDidomi } = NativeModules;\n\nexport const DidomiListener = {\n listeners: new Map(),\n eventEmitter: new NativeEventEmitter(RNDidomi),\n\n init: () => {\n // Register all native event listeners\n Object.values(DidomiEventType).forEach((eventTypeValue) => {\n DidomiListener.eventEmitter.addListener(eventTypeValue, (_event: any) => {\n let events = DidomiListener.listeners.get(eventTypeValue);\n if (events) {\n events.forEach((el: any) => {\n el(_event);\n });\n }\n });\n });\n },\n\n reset: () => {\n // Reset listeners\n DidomiListener.listeners = new Map();\n },\n\n addEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => {\n let events = DidomiListener.listeners.get(eventType);\n if (!events) {\n events = [];\n DidomiListener.listeners.set(eventType, events);\n }\n events.push(callback);\n },\n\n removeEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => {\n let events = DidomiListener.listeners.get(eventType);\n if (events) {\n var index = events.indexOf(callback);\n if (index !== -1) {\n events.splice(index, 1);\n }\n }\n },\n};\n"]}
1
+ {"version":3,"sources":["DidomiListener.ts"],"names":["Didomi","RNDidomi","NativeModules","InternalEventType","DidomiListener","listeners","Map","eventEmitter","NativeEventEmitter","init","Object","values","DidomiEventType","forEach","eventTypeValue","addListener","_event","events","get","el","reset","addEventListener","eventType","callback","set","push","removeEventListener","index","indexOf","splice","onReady","Promise","resolve","listener","removeListener","READY_CALLBACK","onError","ERROR_CALLBACK"],"mappings":";;;;;;;AAAA;;AACA;;AAEA,MAAM;AAAEA,EAAAA,MAAM,EAAEC;AAAV,IAAuBC,0BAA7B;IAEKC,iB;;WAAAA,iB;AAAAA,EAAAA,iB;AAAAA,EAAAA,iB;GAAAA,iB,KAAAA,iB;;AAKE,MAAMC,cAAc,GAAG;AAC5BC,EAAAA,SAAS,EAAE,IAAIC,GAAJ,EADiB;AAE5BC,EAAAA,YAAY,EAAE,IAAIC,+BAAJ,CAAuBP,QAAvB,CAFc;AAI5BQ,EAAAA,IAAI,EAAE,MAAM;AACV;AACAC,IAAAA,MAAM,CAACC,MAAP,CAAcC,4BAAd,EAA+BC,OAA/B,CAAwCC,cAAD,IAAoB;AACzDV,MAAAA,cAAc,CAACG,YAAf,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AAMC,QAAQ,GAAIjB,MAAD,IAAiB;AAChCgB,QAAAA,OAAO;AACP5B,QAAAA,cAAc,CAACG,YAAf,CAA4B2B,cAA5B,CACE/B,iBAAiB,CAACgC,cADpB,EAEEF,QAFF;AAID,OAND;;AAOA7B,MAAAA,cAAc,CAACG,YAAf,CAA4BQ,WAA5B,CACEZ,iBAAiB,CAACgC,cADpB,EAEEF,QAFF;AAID,KAZM,CAAP;AAaD,GA9D2B;AAgE5BG,EAAAA,OAAO,EAAE,MAAoB;AAC3B,WAAO,IAAIL,OAAJ,CAAkBC,OAAD,IAAa;AACnC,YAAMC,QAAQ,GAAIjB,MAAD,IAAiB;AAChCgB,QAAAA,OAAO,CAAChB,MAAD,CAAP;AACAZ,QAAAA,cAAc,CAACG,YAAf,CAA4B2B,cAA5B,CACE/B,iBAAiB,CAACkC,cADpB,EAEEJ,QAFF;AAID,OAND;;AAOA7B,MAAAA,cAAc,CAACG,YAAf,CAA4BQ,WAA5B,CACEZ,iBAAiB,CAACkC,cADpB,EAEEJ,QAFF;AAID,KAZM,CAAP;AAaD;AA9E2B,CAAvB","sourcesContent":["import { NativeModules, NativeEventEmitter } from 'react-native';\nimport { DidomiEventType } from './DidomiTypes';\n\nconst { Didomi: RNDidomi } = NativeModules;\n\nenum InternalEventType {\n READY_CALLBACK = 'on_ready_callback',\n ERROR_CALLBACK = 'on_error_callback',\n}\n\nexport const DidomiListener = {\n listeners: new Map(),\n eventEmitter: new NativeEventEmitter(RNDidomi),\n\n init: () => {\n // Register all native event listeners\n Object.values(DidomiEventType).forEach((eventTypeValue) => {\n DidomiListener.eventEmitter.addListener(eventTypeValue, (_event: any) => {\n let events = DidomiListener.listeners.get(eventTypeValue);\n if (events) {\n events.forEach((el: any) => {\n el(_event);\n });\n }\n });\n });\n },\n\n reset: () => {\n // Reset listeners\n DidomiListener.listeners = new Map();\n },\n\n addEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => {\n let events = DidomiListener.listeners.get(eventType);\n if (!events) {\n events = [];\n DidomiListener.listeners.set(eventType, events);\n }\n events.push(callback);\n },\n\n removeEventListener: (\n eventType: DidomiEventType,\n callback: (data: any) => void\n ) => {\n let events = DidomiListener.listeners.get(eventType);\n if (events) {\n var index = events.indexOf(callback);\n if (index !== -1) {\n events.splice(index, 1);\n }\n }\n },\n\n onReady: (): Promise<void> => {\n return new Promise<void>((resolve) => {\n const listener = (_event: any) => {\n resolve();\n DidomiListener.eventEmitter.removeListener(\n InternalEventType.READY_CALLBACK,\n listener\n );\n };\n DidomiListener.eventEmitter.addListener(\n InternalEventType.READY_CALLBACK,\n listener\n );\n });\n },\n\n onError: (): Promise<any> => {\n return new Promise<any>((resolve) => {\n const listener = (_event: any) => {\n resolve(_event);\n DidomiListener.eventEmitter.removeListener(\n InternalEventType.ERROR_CALLBACK,\n listener\n );\n };\n DidomiListener.eventEmitter.addListener(\n InternalEventType.ERROR_CALLBACK,\n listener\n );\n });\n },\n};\n"]}
@@ -19,6 +19,8 @@ exports.DidomiEventType = DidomiEventType;
19
19
  DidomiEventType["NOTICE_CLICK_MORE_INFO"] = "on_notice_click_more_info";
20
20
  DidomiEventType["NOTICE_CLICK_VIEW_VENDORS"] = "on_notice_click_view_vendors";
21
21
  DidomiEventType["NOTICE_CLICK_PRIVACY_POLICY"] = "on_notice_click_privacy_policy";
22
+ DidomiEventType["HIDE_PREFERENCES"] = "on_hide_preferences";
23
+ DidomiEventType["SHOW_PREFERENCES"] = "on_show_preferences";
22
24
  DidomiEventType["PREFERENCES_CLICK_AGREE_TO_ALL"] = "on_preferences_click_agree_to_all";
23
25
  DidomiEventType["PREFERENCES_CLICK_DISAGREE_TO_ALL"] = "on_preferences_click_disagree_to_all";
24
26
  DidomiEventType["PREFERENCES_CLICK_PURPOSE_AGREE"] = "on_preferences_click_purpose_agree";
@@ -1 +1 @@
1
- {"version":3,"sources":["DidomiTypes.ts"],"names":["DidomiEventType"],"mappings":";;;;;;AAAA;IACYA,e;;;WAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;GAAAA,e,+BAAAA,e","sourcesContent":["// TODO\nexport enum DidomiEventType {\n READY = 'on_ready',\n ERROR = 'on_error',\n CONSENT_CHANGED = 'on_consent_changed',\n HIDE_NOTICE = 'on_hide_notice',\n SHOW_NOTICE = 'on_show_notice',\n NOTICE_CLICK_AGREE = 'on_notice_click_agree',\n NOTICE_CLICK_DISAGREE = 'on_notice_click_disagree',\n NOTICE_CLICK_MORE_INFO = 'on_notice_click_more_info',\n NOTICE_CLICK_VIEW_VENDORS = 'on_notice_click_view_vendors',\n NOTICE_CLICK_PRIVACY_POLICY = 'on_notice_click_privacy_policy',\n PREFERENCES_CLICK_AGREE_TO_ALL = 'on_preferences_click_agree_to_all',\n PREFERENCES_CLICK_DISAGREE_TO_ALL = 'on_preferences_click_disagree_to_all',\n PREFERENCES_CLICK_PURPOSE_AGREE = 'on_preferences_click_purpose_agree',\n PREFERENCES_CLICK_PURPOSE_DISAGREE = 'on_preferences_click_purpose_disagree',\n PREFERENCES_CLICK_VIEW_VENDORS = 'on_preferences_click_view_vendors',\n PREFERENCES_CLICK_SAVE_CHOICES = 'on_preferences_click_save_choices',\n PREFERENCES_CLICK_VENDOR_AGREE = 'on_preferences_click_vendor_agree',\n PREFERENCES_CLICK_VENDOR_DISAGREE = 'on_preferences_click_vendor_disagree',\n PREFERENCES_CLICK_CATEGORY_AGREE = 'on_preferences_click_category_agree',\n PREFERENCES_CLICK_CATEGORY_DISAGREE = 'on_preferences_click_category_disagree',\n PREFERENCES_CLICK_AGREE_TO_ALL_VENDORS = 'on_preferences_click_agree_to_all_vendors',\n PREFERENCES_CLICK_DISAGREE_TO_ALL_VENDORS = 'on_preferences_click_disagree_to_all_vendors',\n PREFERENCES_CLICK_VENDOR_SAVE_CHOICES = 'on_preferences_click_vendor_save_choices',\n PREFERENCES_CLICK_VIEW_PURPOSES = 'on_preferences_click_view_purposes',\n PREFERENCES_CLICK_AGREE_TO_ALL_PURPOSES = 'on_preferences_click_agree_to_all_purposes',\n PREFERENCES_CLICK_DISAGREE_TO_ALL_PURPOSES = 'on_preferences_click_disagree_to_all_purposes',\n PREFERENCES_CLICK_RESET_ALL_PURPOSES = 'on_preferences_click_reset_all_purposes',\n SYNC_DONE = 'on_sync_done',\n}\n\nexport interface Vendor {\n id: string;\n name: string;\n privacyPolicyUrl: string;\n namespace: string;\n namespaces: VendorNamespaces;\n iabVendor: boolean;\n purposeId: string[];\n legIntPurposeIds: string[];\n essentialPurposeIds: string[];\n}\n\nexport interface VendorNamespaces {\n iab2: string;\n}\n\nexport interface Purpose {\n id: string;\n iAbId: string;\n name: string;\n description: string;\n descriptionLegal: string;\n custom: boolean;\n essential: boolean;\n specialFeature: boolean;\n legitimateInterest: boolean;\n consent: boolean;\n category: PurposeCategory;\n}\n\nexport interface PurposeCategory {\n id: string;\n idpurposeId: string;\n icon: string;\n type: string;\n name: Map<string>;\n namedescription: Map<string>;\n children: PurposeCategory[];\n}\n\nexport interface Map<T> {\n [index: string]: T;\n [index: number]: T;\n}\n"]}
1
+ {"version":3,"sources":["DidomiTypes.ts"],"names":["DidomiEventType"],"mappings":";;;;;;AAAA;IACYA,e;;;WAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;AAAAA,EAAAA,e;GAAAA,e,+BAAAA,e","sourcesContent":["// TODO\nexport enum DidomiEventType {\n READY = 'on_ready',\n ERROR = 'on_error',\n CONSENT_CHANGED = 'on_consent_changed',\n HIDE_NOTICE = 'on_hide_notice',\n SHOW_NOTICE = 'on_show_notice',\n NOTICE_CLICK_AGREE = 'on_notice_click_agree',\n NOTICE_CLICK_DISAGREE = 'on_notice_click_disagree',\n NOTICE_CLICK_MORE_INFO = 'on_notice_click_more_info',\n NOTICE_CLICK_VIEW_VENDORS = 'on_notice_click_view_vendors',\n NOTICE_CLICK_PRIVACY_POLICY = 'on_notice_click_privacy_policy',\n HIDE_PREFERENCES = 'on_hide_preferences',\n SHOW_PREFERENCES = 'on_show_preferences',\n PREFERENCES_CLICK_AGREE_TO_ALL = 'on_preferences_click_agree_to_all',\n PREFERENCES_CLICK_DISAGREE_TO_ALL = 'on_preferences_click_disagree_to_all',\n PREFERENCES_CLICK_PURPOSE_AGREE = 'on_preferences_click_purpose_agree',\n PREFERENCES_CLICK_PURPOSE_DISAGREE = 'on_preferences_click_purpose_disagree',\n PREFERENCES_CLICK_VIEW_VENDORS = 'on_preferences_click_view_vendors',\n PREFERENCES_CLICK_SAVE_CHOICES = 'on_preferences_click_save_choices',\n PREFERENCES_CLICK_VENDOR_AGREE = 'on_preferences_click_vendor_agree',\n PREFERENCES_CLICK_VENDOR_DISAGREE = 'on_preferences_click_vendor_disagree',\n PREFERENCES_CLICK_CATEGORY_AGREE = 'on_preferences_click_category_agree',\n PREFERENCES_CLICK_CATEGORY_DISAGREE = 'on_preferences_click_category_disagree',\n PREFERENCES_CLICK_AGREE_TO_ALL_VENDORS = 'on_preferences_click_agree_to_all_vendors',\n PREFERENCES_CLICK_DISAGREE_TO_ALL_VENDORS = 'on_preferences_click_disagree_to_all_vendors',\n PREFERENCES_CLICK_VENDOR_SAVE_CHOICES = 'on_preferences_click_vendor_save_choices',\n PREFERENCES_CLICK_VIEW_PURPOSES = 'on_preferences_click_view_purposes',\n PREFERENCES_CLICK_AGREE_TO_ALL_PURPOSES = 'on_preferences_click_agree_to_all_purposes',\n PREFERENCES_CLICK_DISAGREE_TO_ALL_PURPOSES = 'on_preferences_click_disagree_to_all_purposes',\n PREFERENCES_CLICK_RESET_ALL_PURPOSES = 'on_preferences_click_reset_all_purposes',\n SYNC_DONE = 'on_sync_done',\n}\n\nexport interface Vendor {\n id: string;\n name: string;\n privacyPolicyUrl: string;\n namespace: string;\n namespaces: VendorNamespaces;\n iabVendor: boolean;\n purposeId: string[];\n legIntPurposeIds: string[];\n essentialPurposeIds: string[];\n}\n\nexport interface VendorNamespaces {\n iab2: string;\n}\n\nexport interface Purpose {\n id: string;\n iAbId: string;\n name: string;\n description: string;\n descriptionLegal: string;\n custom: boolean;\n essential: boolean;\n specialFeature: boolean;\n legitimateInterest: boolean;\n consent: boolean;\n category: PurposeCategory;\n}\n\nexport interface PurposeCategory {\n id: string;\n idpurposeId: string;\n icon: string;\n type: string;\n name: Map<string>;\n namedescription: Map<string>;\n children: PurposeCategory[];\n}\n\nexport interface Map<T> {\n [index: string]: T;\n [index: number]: T;\n}\n\nexport interface UserStatus {\n purposes: UserStatusPurposes;\n vendors: UserStatusVendors;\n userId: string;\n created: string;\n updated: string;\n consentString: string;\n additionalConsent: string;\n}\n\nexport interface UserStatusPurposes {\n global: UserStatusIds;\n consent: UserStatusIds;\n legitimateInterest: UserStatusIds;\n essential: UserStatusIds;\n}\n\nexport interface UserStatusVendors {\n global: UserStatusIds;\n globalConsent: UserStatusIds;\n globalLegitimateInterest: UserStatusIds;\n consent: UserStatusIds;\n legitimateInterest: UserStatusIds;\n}\n\nexport interface UserStatusIds {\n disabled: string[];\n enabled: string[];\n}\n"]}