@ovok/native 1.17.0-dev.2266 → 1.17.0-dev.2268
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/lib/commonjs/modules/next/index.js +8 -0
- package/lib/commonjs/modules/next/index.js.map +1 -1
- package/lib/commonjs/modules/next/register-push-device.js +69 -0
- package/lib/commonjs/modules/next/register-push-device.js.map +1 -0
- package/lib/module/modules/next/index.js +1 -0
- package/lib/module/modules/next/index.js.map +1 -1
- package/lib/module/modules/next/register-push-device.js +66 -0
- package/lib/module/modules/next/register-push-device.js.map +1 -0
- package/lib/typescript/commonjs/src/modules/next/index.d.ts +2 -0
- package/lib/typescript/commonjs/src/modules/next/index.d.ts.map +1 -1
- package/lib/typescript/commonjs/src/modules/next/register-push-device.d.ts +23 -0
- package/lib/typescript/commonjs/src/modules/next/register-push-device.d.ts.map +1 -0
- package/lib/typescript/module/src/modules/next/index.d.ts +2 -0
- package/lib/typescript/module/src/modules/next/index.d.ts.map +1 -1
- package/lib/typescript/module/src/modules/next/register-push-device.d.ts +23 -0
- package/lib/typescript/module/src/modules/next/register-push-device.d.ts.map +1 -0
- package/package.json +2 -2
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
var _exportNames = {
|
|
7
7
|
Ovok: true,
|
|
8
|
+
registerPushDevice: true,
|
|
8
9
|
SecureStoreStorage: true
|
|
9
10
|
};
|
|
10
11
|
Object.defineProperty(exports, "Ovok", {
|
|
@@ -19,6 +20,12 @@ Object.defineProperty(exports, "SecureStoreStorage", {
|
|
|
19
20
|
return _secureStoreStorage.SecureStoreStorage;
|
|
20
21
|
}
|
|
21
22
|
});
|
|
23
|
+
Object.defineProperty(exports, "registerPushDevice", {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function () {
|
|
26
|
+
return _registerPushDevice.registerPushDevice;
|
|
27
|
+
}
|
|
28
|
+
});
|
|
22
29
|
var _next = require("@ovok/core/next");
|
|
23
30
|
Object.keys(_next).forEach(function (key) {
|
|
24
31
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -32,5 +39,6 @@ Object.keys(_next).forEach(function (key) {
|
|
|
32
39
|
});
|
|
33
40
|
});
|
|
34
41
|
var _ovok = require("./ovok.js");
|
|
42
|
+
var _registerPushDevice = require("./register-push-device.js");
|
|
35
43
|
var _secureStoreStorage = require("./secure-store-storage.js");
|
|
36
44
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_next","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_ovok","_secureStoreStorage"],"sourceRoot":"../../../../src","sources":["modules/next/index.ts"],"mappings":"
|
|
1
|
+
{"version":3,"names":["_next","require","Object","keys","forEach","key","prototype","hasOwnProperty","call","_exportNames","exports","defineProperty","enumerable","get","_ovok","_registerPushDevice","_secureStoreStorage"],"sourceRoot":"../../../../src","sources":["modules/next/index.ts"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOA,IAAAA,KAAA,GAAAC,OAAA;AAAAC,MAAA,CAAAC,IAAA,CAAAH,KAAA,EAAAI,OAAA,WAAAC,GAAA;EAAA,IAAAA,GAAA,kBAAAA,GAAA;EAAA,IAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAC,YAAA,EAAAJ,GAAA;EAAA,IAAAA,GAAA,IAAAK,OAAA,IAAAA,OAAA,CAAAL,GAAA,MAAAL,KAAA,CAAAK,GAAA;EAAAH,MAAA,CAAAS,cAAA,CAAAD,OAAA,EAAAL,GAAA;IAAAO,UAAA;IAAAC,GAAA,WAAAA,CAAA;MAAA,OAAAb,KAAA,CAAAK,GAAA;IAAA;EAAA;AAAA;AACA,IAAAS,KAAA,GAAAb,OAAA;AAIA,IAAAc,mBAAA,GAAAd,OAAA;AAEA,IAAAe,mBAAA,GAAAf,OAAA","ignoreList":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.registerPushDevice = void 0;
|
|
7
|
+
var _reactNative = require("react-native");
|
|
8
|
+
var _sentryLogger = require("../helpers/utils/sentry-logger.js");
|
|
9
|
+
/** Which token to register: an Expo push token, or the device's own APNs or FCM token. */
|
|
10
|
+
|
|
11
|
+
/** Options for {@link registerPushDevice}. */
|
|
12
|
+
|
|
13
|
+
/** Stops re-registering on token refresh and removes the device from Ovok, so it gets no more push. */
|
|
14
|
+
|
|
15
|
+
const notifications = () => {
|
|
16
|
+
try {
|
|
17
|
+
// Optional peer: importing @ovok/native/next must not make apps without push load Expo modules.
|
|
18
|
+
return require("expo-notifications");
|
|
19
|
+
} catch (error) {
|
|
20
|
+
throw new Error("Push devices require expo-notifications. Install it and configure its app plugin.", {
|
|
21
|
+
cause: error
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
const tokenOf = async (expoNotifications, {
|
|
26
|
+
kind,
|
|
27
|
+
projectId
|
|
28
|
+
}) => {
|
|
29
|
+
const token = kind === "expo" ? await expoNotifications.getExpoPushTokenAsync(projectId === undefined ? {} : {
|
|
30
|
+
projectId
|
|
31
|
+
}) : await expoNotifications.getDevicePushTokenAsync();
|
|
32
|
+
if (typeof token.data !== "string") {
|
|
33
|
+
throw new TypeError("Web push subscriptions cannot be registered as push devices.");
|
|
34
|
+
}
|
|
35
|
+
return token.data;
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* Registers this device for push to the signed-in person, and registers it again whenever its token changes.
|
|
40
|
+
* Ask for notification permission first, and call it after sign-in.
|
|
41
|
+
*
|
|
42
|
+
* @returns A function that stops listening for token changes and removes the device from Ovok.
|
|
43
|
+
*/
|
|
44
|
+
const registerPushDevice = async (ovok, options) => {
|
|
45
|
+
const expoNotifications = notifications();
|
|
46
|
+
const platform = _reactNative.Platform.OS;
|
|
47
|
+
const register = async () => ovok.push.devices.register({
|
|
48
|
+
token: await tokenOf(expoNotifications, options),
|
|
49
|
+
platform,
|
|
50
|
+
appId: options.appId ?? null
|
|
51
|
+
});
|
|
52
|
+
let device = await register();
|
|
53
|
+
const subscription = expoNotifications.addPushTokenListener(() => {
|
|
54
|
+
register().then(registered => {
|
|
55
|
+
device = registered;
|
|
56
|
+
}).catch(error => {
|
|
57
|
+
(0, _sentryLogger.ovokLogger)("error", "Push device registration failed", {
|
|
58
|
+
errorCode: "push_device_registration_failed",
|
|
59
|
+
error
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
return async () => {
|
|
64
|
+
subscription.remove();
|
|
65
|
+
await ovok.push.devices.unregister(device.id);
|
|
66
|
+
};
|
|
67
|
+
};
|
|
68
|
+
exports.registerPushDevice = registerPushDevice;
|
|
69
|
+
//# sourceMappingURL=register-push-device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_sentryLogger","notifications","error","Error","cause","tokenOf","expoNotifications","kind","projectId","token","getExpoPushTokenAsync","undefined","getDevicePushTokenAsync","data","TypeError","registerPushDevice","ovok","options","platform","Platform","OS","register","push","devices","appId","device","subscription","addPushTokenListener","then","registered","catch","ovokLogger","errorCode","remove","unregister","id","exports"],"sourceRoot":"../../../../src","sources":["modules/next/register-push-device.ts"],"mappings":";;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAMA,IAAAC,aAAA,GAAAD,OAAA;AAEA;;AAGA;;AAaA;;AAGA,MAAME,aAAa,GAAGA,CAAA,KAAkC;EACtD,IAAI;IACF;IACA,OAAOF,OAAO,CAAC,oBAAoB,CAAC;EACtC,CAAC,CAAC,OAAOG,KAAK,EAAE;IACd,MAAM,IAAIC,KAAK,CAAC,mFAAmF,EAAE;MAAEC,KAAK,EAAEF;IAAM,CAAC,CAAC;EACxH;AACF,CAAC;AAED,MAAMG,OAAO,GAAG,MAAAA,CACdC,iBAA6C,EAC7C;EAAEC,IAAI;EAAEC;AAAqC,CAAC,KAC1B;EACpB,MAAMC,KAAK,GAAGF,IAAI,KAAK,MAAM,GACzB,MAAMD,iBAAiB,CAACI,qBAAqB,CAACF,SAAS,KAAKG,SAAS,GAAG,CAAC,CAAC,GAAG;IAAEH;EAAU,CAAC,CAAC,GAC3F,MAAMF,iBAAiB,CAACM,uBAAuB,CAAC,CAAC;EAErD,IAAI,OAAOH,KAAK,CAACI,IAAI,KAAK,QAAQ,EAAE;IAClC,MAAM,IAAIC,SAAS,CAAC,8DAA8D,CAAC;EACrF;EAEA,OAAOL,KAAK,CAACI,IAAI;AACnB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,kBAAkB,GAAG,MAAAA,CACzBC,IAAwB,EACxBC,OAAkC,KACC;EACnC,MAAMX,iBAAiB,GAAGL,aAAa,CAAC,CAAC;EACzC,MAAMiB,QAAQ,GAAGC,qBAAQ,CAACC,EAAkB;EAE5C,MAAMC,QAAQ,GAAG,MAAAA,CAAA,KAAiCL,IAAI,CAACM,IAAI,CAACC,OAAO,CAACF,QAAQ,CAAC;IAC3EZ,KAAK,EAAE,MAAMJ,OAAO,CAACC,iBAAiB,EAAEW,OAAO,CAAC;IAChDC,QAAQ;IACRM,KAAK,EAAEP,OAAO,CAACO,KAAK,IAAI;EAC1B,CAAC,CAAC;EAEF,IAAIC,MAAM,GAAG,MAAMJ,QAAQ,CAAC,CAAC;EAE7B,MAAMK,YAAY,GAAGpB,iBAAiB,CAACqB,oBAAoB,CAAC,MAAM;IAChEN,QAAQ,CAAC,CAAC,CACPO,IAAI,CAAEC,UAAU,IAAK;MAAEJ,MAAM,GAAGI,UAAU;IAAE,CAAC,CAAC,CAC9CC,KAAK,CAAE5B,KAAc,IAAK;MACzB,IAAA6B,wBAAU,EAAC,OAAO,EAAE,iCAAiC,EAAE;QAAEC,SAAS,EAAE,iCAAiC;QAAE9B;MAAM,CAAC,CAAC;IACjH,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAO,YAAY;IACjBwB,YAAY,CAACO,MAAM,CAAC,CAAC;IACrB,MAAMjB,IAAI,CAACM,IAAI,CAACC,OAAO,CAACW,UAAU,CAACT,MAAM,CAACU,EAAE,CAAC;EAC/C,CAAC;AACH,CAAC;AAACC,OAAA,CAAArB,kBAAA,GAAAA,kBAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Ovok","SecureStoreStorage"],"sourceRoot":"../../../../src","sources":["modules/next/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B,SAASA,IAAI,QAAQ,WAAQ;AAI7B,SAASC,kBAAkB,QAAQ,2BAAwB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["Ovok","registerPushDevice","SecureStoreStorage"],"sourceRoot":"../../../../src","sources":["modules/next/index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,cAAc,iBAAiB;AAC/B,SAASA,IAAI,QAAQ,WAAQ;AAI7B,SAASC,kBAAkB,QAAQ,2BAAwB;AAE3D,SAASC,kBAAkB,QAAQ,2BAAwB","ignoreList":[]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { Platform } from "react-native";
|
|
4
|
+
import { ovokLogger } from "../helpers/utils/sentry-logger.js";
|
|
5
|
+
|
|
6
|
+
/** Which token to register: an Expo push token, or the device's own APNs or FCM token. */
|
|
7
|
+
|
|
8
|
+
/** Options for {@link registerPushDevice}. */
|
|
9
|
+
|
|
10
|
+
/** Stops re-registering on token refresh and removes the device from Ovok, so it gets no more push. */
|
|
11
|
+
|
|
12
|
+
const notifications = () => {
|
|
13
|
+
try {
|
|
14
|
+
// Optional peer: importing @ovok/native/next must not make apps without push load Expo modules.
|
|
15
|
+
return require("expo-notifications");
|
|
16
|
+
} catch (error) {
|
|
17
|
+
throw new Error("Push devices require expo-notifications. Install it and configure its app plugin.", {
|
|
18
|
+
cause: error
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
const tokenOf = async (expoNotifications, {
|
|
23
|
+
kind,
|
|
24
|
+
projectId
|
|
25
|
+
}) => {
|
|
26
|
+
const token = kind === "expo" ? await expoNotifications.getExpoPushTokenAsync(projectId === undefined ? {} : {
|
|
27
|
+
projectId
|
|
28
|
+
}) : await expoNotifications.getDevicePushTokenAsync();
|
|
29
|
+
if (typeof token.data !== "string") {
|
|
30
|
+
throw new TypeError("Web push subscriptions cannot be registered as push devices.");
|
|
31
|
+
}
|
|
32
|
+
return token.data;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Registers this device for push to the signed-in person, and registers it again whenever its token changes.
|
|
37
|
+
* Ask for notification permission first, and call it after sign-in.
|
|
38
|
+
*
|
|
39
|
+
* @returns A function that stops listening for token changes and removes the device from Ovok.
|
|
40
|
+
*/
|
|
41
|
+
const registerPushDevice = async (ovok, options) => {
|
|
42
|
+
const expoNotifications = notifications();
|
|
43
|
+
const platform = Platform.OS;
|
|
44
|
+
const register = async () => ovok.push.devices.register({
|
|
45
|
+
token: await tokenOf(expoNotifications, options),
|
|
46
|
+
platform,
|
|
47
|
+
appId: options.appId ?? null
|
|
48
|
+
});
|
|
49
|
+
let device = await register();
|
|
50
|
+
const subscription = expoNotifications.addPushTokenListener(() => {
|
|
51
|
+
register().then(registered => {
|
|
52
|
+
device = registered;
|
|
53
|
+
}).catch(error => {
|
|
54
|
+
ovokLogger("error", "Push device registration failed", {
|
|
55
|
+
errorCode: "push_device_registration_failed",
|
|
56
|
+
error
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
return async () => {
|
|
61
|
+
subscription.remove();
|
|
62
|
+
await ovok.push.devices.unregister(device.id);
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export { registerPushDevice };
|
|
66
|
+
//# sourceMappingURL=register-push-device.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["Platform","ovokLogger","notifications","require","error","Error","cause","tokenOf","expoNotifications","kind","projectId","token","getExpoPushTokenAsync","undefined","getDevicePushTokenAsync","data","TypeError","registerPushDevice","ovok","options","platform","OS","register","push","devices","appId","device","subscription","addPushTokenListener","then","registered","catch","errorCode","remove","unregister","id"],"sourceRoot":"../../../../src","sources":["modules/next/register-push-device.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AAMvC,SAASC,UAAU,QAAQ,mCAAgC;;AAE3D;;AAGA;;AAaA;;AAGA,MAAMC,aAAa,GAAGA,CAAA,KAAkC;EACtD,IAAI;IACF;IACA,OAAOC,OAAO,CAAC,oBAAoB,CAAC;EACtC,CAAC,CAAC,OAAOC,KAAK,EAAE;IACd,MAAM,IAAIC,KAAK,CAAC,mFAAmF,EAAE;MAAEC,KAAK,EAAEF;IAAM,CAAC,CAAC;EACxH;AACF,CAAC;AAED,MAAMG,OAAO,GAAG,MAAAA,CACdC,iBAA6C,EAC7C;EAAEC,IAAI;EAAEC;AAAqC,CAAC,KAC1B;EACpB,MAAMC,KAAK,GAAGF,IAAI,KAAK,MAAM,GACzB,MAAMD,iBAAiB,CAACI,qBAAqB,CAACF,SAAS,KAAKG,SAAS,GAAG,CAAC,CAAC,GAAG;IAAEH;EAAU,CAAC,CAAC,GAC3F,MAAMF,iBAAiB,CAACM,uBAAuB,CAAC,CAAC;EAErD,IAAI,OAAOH,KAAK,CAACI,IAAI,KAAK,QAAQ,EAAE;IAClC,MAAM,IAAIC,SAAS,CAAC,8DAA8D,CAAC;EACrF;EAEA,OAAOL,KAAK,CAACI,IAAI;AACnB,CAAC;;AAED;AACA;AACA;AACA;AACA;AACA;AACA,MAAME,kBAAkB,GAAG,MAAAA,CACzBC,IAAwB,EACxBC,OAAkC,KACC;EACnC,MAAMX,iBAAiB,GAAGN,aAAa,CAAC,CAAC;EACzC,MAAMkB,QAAQ,GAAGpB,QAAQ,CAACqB,EAAkB;EAE5C,MAAMC,QAAQ,GAAG,MAAAA,CAAA,KAAiCJ,IAAI,CAACK,IAAI,CAACC,OAAO,CAACF,QAAQ,CAAC;IAC3EX,KAAK,EAAE,MAAMJ,OAAO,CAACC,iBAAiB,EAAEW,OAAO,CAAC;IAChDC,QAAQ;IACRK,KAAK,EAAEN,OAAO,CAACM,KAAK,IAAI;EAC1B,CAAC,CAAC;EAEF,IAAIC,MAAM,GAAG,MAAMJ,QAAQ,CAAC,CAAC;EAE7B,MAAMK,YAAY,GAAGnB,iBAAiB,CAACoB,oBAAoB,CAAC,MAAM;IAChEN,QAAQ,CAAC,CAAC,CACPO,IAAI,CAAEC,UAAU,IAAK;MAAEJ,MAAM,GAAGI,UAAU;IAAE,CAAC,CAAC,CAC9CC,KAAK,CAAE3B,KAAc,IAAK;MACzBH,UAAU,CAAC,OAAO,EAAE,iCAAiC,EAAE;QAAE+B,SAAS,EAAE,iCAAiC;QAAE5B;MAAM,CAAC,CAAC;IACjH,CAAC,CAAC;EACN,CAAC,CAAC;EAEF,OAAO,YAAY;IACjBuB,YAAY,CAACM,MAAM,CAAC,CAAC;IACrB,MAAMf,IAAI,CAACK,IAAI,CAACC,OAAO,CAACU,UAAU,CAACR,MAAM,CAACS,EAAE,CAAC;EAC/C,CAAC;AACH,CAAC;AAED,SAAgDlB,kBAAkB","ignoreList":[]}
|
|
@@ -10,6 +10,8 @@ export { Ovok } from "./ovok";
|
|
|
10
10
|
export type { OvokSqlite } from "./bluetooth/adapters/sqlite-database";
|
|
11
11
|
export type { OvokNativeConfig } from "./ovok";
|
|
12
12
|
export type { RandomValuesSource } from "./random-values";
|
|
13
|
+
export { registerPushDevice } from "./register-push-device";
|
|
14
|
+
export type { PushDeviceKind, PushDeviceUnsubscribe, RegisterPushDeviceOptions } from "./register-push-device";
|
|
13
15
|
export { SecureStoreStorage } from "./secure-store-storage";
|
|
14
16
|
export type { OvokSecureStore } from "./secure-store-storage";
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/next/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACvE,YAAY,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC/C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/next/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACvE,YAAY,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC/C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Ovok } from "./ovok";
|
|
2
|
+
/** Which token to register: an Expo push token, or the device's own APNs or FCM token. */
|
|
3
|
+
type PushDeviceKind = "expo" | "native";
|
|
4
|
+
/** Options for {@link registerPushDevice}. */
|
|
5
|
+
type RegisterPushDeviceOptions = {
|
|
6
|
+
/** `expo` when the project's push provider is Expo; `native` for APNs, FCM or a relay. */
|
|
7
|
+
kind: PushDeviceKind;
|
|
8
|
+
/** The EAS project id for Expo tokens; expo-notifications reads it from the app config when omitted. */
|
|
9
|
+
projectId?: string;
|
|
10
|
+
/** The app the token belongs to, such as its bundle or package id. */
|
|
11
|
+
appId?: string | null;
|
|
12
|
+
};
|
|
13
|
+
/** Stops re-registering on token refresh and removes the device from Ovok, so it gets no more push. */
|
|
14
|
+
type PushDeviceUnsubscribe = () => Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Registers this device for push to the signed-in person, and registers it again whenever its token changes.
|
|
17
|
+
* Ask for notification permission first, and call it after sign-in.
|
|
18
|
+
*
|
|
19
|
+
* @returns A function that stops listening for token changes and removes the device from Ovok.
|
|
20
|
+
*/
|
|
21
|
+
declare const registerPushDevice: (ovok: Pick<Ovok, "push">, options: RegisterPushDeviceOptions) => Promise<PushDeviceUnsubscribe>;
|
|
22
|
+
export { PushDeviceKind, PushDeviceUnsubscribe, registerPushDevice, RegisterPushDeviceOptions };
|
|
23
|
+
//# sourceMappingURL=register-push-device.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-push-device.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/next/register-push-device.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAMnC,0FAA0F;AAC1F,KAAK,cAAc,GAAG,MAAM,GAAG,QAAQ,CAAC;AAExC,8CAA8C;AAC9C,KAAK,yBAAyB,GAAG;IAE/B,0FAA0F;IAC1F,IAAI,EAAE,cAAc,CAAC;IAErB,wGAAwG;IACxG,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,uGAAuG;AACvG,KAAK,qBAAqB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AA0BjD;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,GACtB,MAAM,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EACxB,SAAS,yBAAyB,KACjC,OAAO,CAAC,qBAAqB,CAwB/B,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,CAAC"}
|
|
@@ -10,6 +10,8 @@ export { Ovok } from "./ovok";
|
|
|
10
10
|
export type { OvokSqlite } from "./bluetooth/adapters/sqlite-database";
|
|
11
11
|
export type { OvokNativeConfig } from "./ovok";
|
|
12
12
|
export type { RandomValuesSource } from "./random-values";
|
|
13
|
+
export { registerPushDevice } from "./register-push-device";
|
|
14
|
+
export type { PushDeviceKind, PushDeviceUnsubscribe, RegisterPushDeviceOptions } from "./register-push-device";
|
|
13
15
|
export { SecureStoreStorage } from "./secure-store-storage";
|
|
14
16
|
export type { OvokSecureStore } from "./secure-store-storage";
|
|
15
17
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/next/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACvE,YAAY,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC/C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/next/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,cAAc,iBAAiB,CAAC;AAChC,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,YAAY,EAAE,UAAU,EAAE,MAAM,sCAAsC,CAAC;AACvE,YAAY,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC/C,YAAY,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,cAAc,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAC/G,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,YAAY,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Ovok } from "./ovok";
|
|
2
|
+
/** Which token to register: an Expo push token, or the device's own APNs or FCM token. */
|
|
3
|
+
type PushDeviceKind = "expo" | "native";
|
|
4
|
+
/** Options for {@link registerPushDevice}. */
|
|
5
|
+
type RegisterPushDeviceOptions = {
|
|
6
|
+
/** `expo` when the project's push provider is Expo; `native` for APNs, FCM or a relay. */
|
|
7
|
+
kind: PushDeviceKind;
|
|
8
|
+
/** The EAS project id for Expo tokens; expo-notifications reads it from the app config when omitted. */
|
|
9
|
+
projectId?: string;
|
|
10
|
+
/** The app the token belongs to, such as its bundle or package id. */
|
|
11
|
+
appId?: string | null;
|
|
12
|
+
};
|
|
13
|
+
/** Stops re-registering on token refresh and removes the device from Ovok, so it gets no more push. */
|
|
14
|
+
type PushDeviceUnsubscribe = () => Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Registers this device for push to the signed-in person, and registers it again whenever its token changes.
|
|
17
|
+
* Ask for notification permission first, and call it after sign-in.
|
|
18
|
+
*
|
|
19
|
+
* @returns A function that stops listening for token changes and removes the device from Ovok.
|
|
20
|
+
*/
|
|
21
|
+
declare const registerPushDevice: (ovok: Pick<Ovok, "push">, options: RegisterPushDeviceOptions) => Promise<PushDeviceUnsubscribe>;
|
|
22
|
+
export { PushDeviceKind, PushDeviceUnsubscribe, registerPushDevice, RegisterPushDeviceOptions };
|
|
23
|
+
//# sourceMappingURL=register-push-device.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"register-push-device.d.ts","sourceRoot":"","sources":["../../../../../../src/modules/next/register-push-device.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAMnC,0FAA0F;AAC1F,KAAK,cAAc,GAAG,MAAM,GAAG,QAAQ,CAAC;AAExC,8CAA8C;AAC9C,KAAK,yBAAyB,GAAG;IAE/B,0FAA0F;IAC1F,IAAI,EAAE,cAAc,CAAC;IAErB,wGAAwG;IACxG,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,sEAAsE;IACtE,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACvB,CAAC;AAEF,uGAAuG;AACvG,KAAK,qBAAqB,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;AA0BjD;;;;;GAKG;AACH,QAAA,MAAM,kBAAkB,GACtB,MAAM,IAAI,CAAC,IAAI,EAAE,MAAM,CAAC,EACxB,SAAS,yBAAyB,KACjC,OAAO,CAAC,qBAAqB,CAwB/B,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,qBAAqB,EAAE,kBAAkB,EAAE,yBAAyB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ovok/native",
|
|
3
|
-
"version": "1.17.0-dev.
|
|
3
|
+
"version": "1.17.0-dev.2268+09ab8e9",
|
|
4
4
|
"description": "React native component sdk for OVOK",
|
|
5
5
|
"source": "./src/index.tsx",
|
|
6
6
|
"main": "./lib/commonjs/index.js",
|
|
@@ -105,7 +105,7 @@
|
|
|
105
105
|
"@medplum/react-hooks": "3.2.23",
|
|
106
106
|
"@opentelemetry/api": "^1.9.1",
|
|
107
107
|
"@opentelemetry/api-logs": "^0.222.0",
|
|
108
|
-
"@ovok/core": "
|
|
108
|
+
"@ovok/core": "0.4.59-dev.563",
|
|
109
109
|
"@react-native-community/datetimepicker": "^9.1.0",
|
|
110
110
|
"@react-native-community/netinfo": "^12.0.1",
|
|
111
111
|
"@react-native-google-signin/google-signin": "^16.1.2",
|