@kontextso/sdk-react-native 2.0.0-rc.2 → 2.0.0-rc.5
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/dist/index.d.mts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +45 -3
- package/dist/index.mjs +35 -3
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { FormatProps } from '@kontextso/sdk-react';
|
|
3
|
-
export { AdsProvider } from '@kontextso/sdk-react';
|
|
2
|
+
import { FormatProps, AdsProviderProps } from '@kontextso/sdk-react';
|
|
4
3
|
|
|
5
4
|
declare const InlineAd: ({ code, messageId, wrapper, ...props }: FormatProps) => react_jsx_runtime.JSX.Element;
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
declare const AdsProvider: (props: AdsProviderProps) => react_jsx_runtime.JSX.Element;
|
|
7
|
+
|
|
8
|
+
export { AdsProvider, InlineAd };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
-
import { FormatProps } from '@kontextso/sdk-react';
|
|
3
|
-
export { AdsProvider } from '@kontextso/sdk-react';
|
|
2
|
+
import { FormatProps, AdsProviderProps } from '@kontextso/sdk-react';
|
|
4
3
|
|
|
5
4
|
declare const InlineAd: ({ code, messageId, wrapper, ...props }: FormatProps) => react_jsx_runtime.JSX.Element;
|
|
6
5
|
|
|
7
|
-
|
|
6
|
+
declare const AdsProvider: (props: AdsProviderProps) => react_jsx_runtime.JSX.Element;
|
|
7
|
+
|
|
8
|
+
export { AdsProvider, InlineAd };
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,12 +17,20 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
|
|
20
30
|
// src/index.ts
|
|
21
31
|
var index_exports = {};
|
|
22
32
|
__export(index_exports, {
|
|
23
|
-
AdsProvider: () =>
|
|
33
|
+
AdsProvider: () => AdsProvider,
|
|
24
34
|
InlineAd: () => InlineAd_default
|
|
25
35
|
});
|
|
26
36
|
module.exports = __toCommonJS(index_exports);
|
|
@@ -232,7 +242,9 @@ var InlineAd_default = InlineAd;
|
|
|
232
242
|
|
|
233
243
|
// src/context/AdsProvider.tsx
|
|
234
244
|
var import_sdk_react2 = require("@kontextso/sdk-react");
|
|
235
|
-
var
|
|
245
|
+
var import_react_native2 = require("react-native");
|
|
246
|
+
var import_react_native_device_info = __toESM(require("react-native-device-info"));
|
|
247
|
+
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
236
248
|
ErrorUtils.setGlobalHandler((error, isFatal) => {
|
|
237
249
|
if (!isFatal) {
|
|
238
250
|
import_sdk_react2.log.warn(error);
|
|
@@ -240,7 +252,37 @@ ErrorUtils.setGlobalHandler((error, isFatal) => {
|
|
|
240
252
|
import_sdk_react2.log.error(error);
|
|
241
253
|
}
|
|
242
254
|
});
|
|
243
|
-
|
|
255
|
+
var getDevice = () => {
|
|
256
|
+
try {
|
|
257
|
+
const os = import_react_native2.Platform.OS;
|
|
258
|
+
const systemVersion = import_react_native_device_info.default.getSystemVersion();
|
|
259
|
+
const model = import_react_native_device_info.default.getModel();
|
|
260
|
+
const brand = import_react_native_device_info.default.getBrand();
|
|
261
|
+
const deviceId = import_react_native_device_info.default.getDeviceId();
|
|
262
|
+
const deviceType = import_react_native_device_info.default.getDeviceType();
|
|
263
|
+
const appBundleId = import_react_native_device_info.default.getBundleId();
|
|
264
|
+
const appVersion = import_react_native_device_info.default.getVersion();
|
|
265
|
+
const rnv = import_react_native2.Platform.constants.reactNativeVersion;
|
|
266
|
+
const reactNativeVersion = `${rnv.major}.${rnv.minor}.${rnv.patch}`;
|
|
267
|
+
return {
|
|
268
|
+
os,
|
|
269
|
+
systemVersion,
|
|
270
|
+
reactNativeVersion,
|
|
271
|
+
model,
|
|
272
|
+
brand,
|
|
273
|
+
deviceId,
|
|
274
|
+
deviceType,
|
|
275
|
+
appBundleId,
|
|
276
|
+
appVersion
|
|
277
|
+
};
|
|
278
|
+
} catch (error) {
|
|
279
|
+
console.error(error);
|
|
280
|
+
}
|
|
281
|
+
return {};
|
|
282
|
+
};
|
|
283
|
+
var AdsProvider = (props) => {
|
|
284
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_sdk_react2.AdsProviderInternal, { ...props, getDevice });
|
|
285
|
+
};
|
|
244
286
|
// Annotate the CommonJS export names for ESM import in node:
|
|
245
287
|
0 && (module.exports = {
|
|
246
288
|
AdsProvider,
|
package/dist/index.mjs
CHANGED
|
@@ -205,7 +205,9 @@ var InlineAd_default = InlineAd;
|
|
|
205
205
|
|
|
206
206
|
// src/context/AdsProvider.tsx
|
|
207
207
|
import { AdsProviderInternal, log } from "@kontextso/sdk-react";
|
|
208
|
-
import {
|
|
208
|
+
import { Platform } from "react-native";
|
|
209
|
+
import DeviceInfo from "react-native-device-info";
|
|
210
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
209
211
|
ErrorUtils.setGlobalHandler((error, isFatal) => {
|
|
210
212
|
if (!isFatal) {
|
|
211
213
|
log.warn(error);
|
|
@@ -213,8 +215,38 @@ ErrorUtils.setGlobalHandler((error, isFatal) => {
|
|
|
213
215
|
log.error(error);
|
|
214
216
|
}
|
|
215
217
|
});
|
|
216
|
-
|
|
218
|
+
var getDevice = () => {
|
|
219
|
+
try {
|
|
220
|
+
const os = Platform.OS;
|
|
221
|
+
const systemVersion = DeviceInfo.getSystemVersion();
|
|
222
|
+
const model = DeviceInfo.getModel();
|
|
223
|
+
const brand = DeviceInfo.getBrand();
|
|
224
|
+
const deviceId = DeviceInfo.getDeviceId();
|
|
225
|
+
const deviceType = DeviceInfo.getDeviceType();
|
|
226
|
+
const appBundleId = DeviceInfo.getBundleId();
|
|
227
|
+
const appVersion = DeviceInfo.getVersion();
|
|
228
|
+
const rnv = Platform.constants.reactNativeVersion;
|
|
229
|
+
const reactNativeVersion = `${rnv.major}.${rnv.minor}.${rnv.patch}`;
|
|
230
|
+
return {
|
|
231
|
+
os,
|
|
232
|
+
systemVersion,
|
|
233
|
+
reactNativeVersion,
|
|
234
|
+
model,
|
|
235
|
+
brand,
|
|
236
|
+
deviceId,
|
|
237
|
+
deviceType,
|
|
238
|
+
appBundleId,
|
|
239
|
+
appVersion
|
|
240
|
+
};
|
|
241
|
+
} catch (error) {
|
|
242
|
+
console.error(error);
|
|
243
|
+
}
|
|
244
|
+
return {};
|
|
245
|
+
};
|
|
246
|
+
var AdsProvider = (props) => {
|
|
247
|
+
return /* @__PURE__ */ jsx3(AdsProviderInternal, { ...props, getDevice });
|
|
248
|
+
};
|
|
217
249
|
export {
|
|
218
|
-
|
|
250
|
+
AdsProvider,
|
|
219
251
|
InlineAd_default as InlineAd
|
|
220
252
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kontextso/sdk-react-native",
|
|
3
|
-
"version": "2.0.0-rc.
|
|
3
|
+
"version": "2.0.0-rc.5",
|
|
4
4
|
"main": "./dist/index.js",
|
|
5
5
|
"module": "./dist/index.mjs",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"react-native-webview": "^13.15.0"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
|
-
"@kontextso/sdk-react": "^1.2.
|
|
54
|
+
"@kontextso/sdk-react": "^1.2.2"
|
|
55
55
|
},
|
|
56
56
|
"files": [
|
|
57
57
|
"dist/*"
|