@kontextso/sdk-react-native 3.3.0-rc.3 → 3.3.0-rc.4

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kontextso/sdk-react-native",
3
- "version": "3.3.0-rc.3",
3
+ "version": "3.3.0-rc.4",
4
4
  "description": "Kontext SDK for React Native",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",
@@ -7,7 +7,7 @@ export interface Spec extends TurboModule {
7
7
  dismissSKOverlay(): Promise<boolean>
8
8
  presentSKStoreProduct(appStoreId: string): Promise<boolean>
9
9
  dismissSKStoreProduct(): Promise<boolean>
10
- getTcfData(): Promise<{ gdprApplies: 0 | 1 | undefined, tcString: string | undefined }>
10
+ getTcfData(): Promise<{ gdprApplies: 0 | 1 | undefined; tcString: string | undefined }>
11
11
  }
12
12
 
13
13
  export default TurboModuleRegistry.getEnforcing<Spec>('RNKontext')
@@ -125,9 +125,15 @@ const getSdk = async (): Promise<SDKConfig> => ({
125
125
  const getTcf = async (): Promise<Pick<RegulatoryConfig, 'gdpr' | 'gdprConsent'>> => {
126
126
  try {
127
127
  const tcfData = await NativeRNKontext.getTcfData()
128
+
129
+ const gdpr = tcfData.gdprApplies === 0 || tcfData.gdprApplies === 1 ? tcfData.gdprApplies : undefined
130
+
131
+ const gdprConsent =
132
+ typeof tcfData.tcString === 'string' && tcfData.tcString.length > 0 ? tcfData.tcString : undefined
133
+
128
134
  return {
129
- gdpr: tcfData.gdprApplies,
130
- gdprConsent: tcfData.tcString,
135
+ ...(gdpr !== undefined ? { gdpr } : {}),
136
+ ...(gdprConsent !== undefined ? { gdprConsent } : {}),
131
137
  }
132
138
  } catch (error) {
133
139
  console.error(error)