vibes-react-native 1.0.0 → 1.1.1
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/README.md +114 -1
- package/android/.gradle/6.8/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/6.8/fileChanges/last-build.bin +0 -0
- package/android/.gradle/6.8/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/6.8/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/configuration-cache/gc.properties +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +42 -40
- package/android/src/main/AndroidManifest.xml +6 -4
- package/android/src/main/java/com/vibes/push/rn/plugin/VibesAppHelper.java +170 -84
- package/android/src/main/java/com/vibes/push/rn/plugin/VibesModule.java +466 -303
- package/android/src/main/java/com/vibes/push/rn/plugin/notifications/Fms.java +95 -82
- package/android/src/main/java/com/vibes/push/rn/plugin/notifications/VibesPushReceiver.java +9 -7
- package/ios/Vibes.m +25 -0
- package/ios/Vibes.swift +143 -1
- package/lib/commonjs/index.js +117 -7
- package/lib/commonjs/index.js.map +1 -1
- package/lib/module/index.js +113 -1
- package/lib/module/index.js.map +1 -1
- package/lib/typescript/index.d.ts +115 -6
- package/package.json +1 -1
- package/src/index.tsx +149 -15
- package/vibes-react-native.podspec +1 -1
package/lib/module/index.js
CHANGED
|
@@ -7,25 +7,137 @@ const Vibes = NativeModules.Vibes ? NativeModules.Vibes : new Proxy({}, {
|
|
|
7
7
|
get() {
|
|
8
8
|
throw new Error(LINKING_ERROR);
|
|
9
9
|
}
|
|
10
|
-
|
|
11
10
|
});
|
|
11
|
+
/**
|
|
12
|
+
* Register this device with the Vibes platform
|
|
13
|
+
*
|
|
14
|
+
* @return {Promise<DeviceResponse>}
|
|
15
|
+
*/
|
|
12
16
|
export function registerDevice() {
|
|
13
17
|
return Vibes.registerDevice();
|
|
14
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Unregister this device with the Vibes platform
|
|
21
|
+
*
|
|
22
|
+
* @return {Promise<void>}
|
|
23
|
+
*/
|
|
15
24
|
export function unregisterDevice() {
|
|
16
25
|
return Vibes.unregisterDevice();
|
|
17
26
|
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Register this device to receive push notifications
|
|
30
|
+
*
|
|
31
|
+
* @return {Promise<void>}
|
|
32
|
+
*/
|
|
18
33
|
export function registerPush() {
|
|
19
34
|
return Vibes.registerPush();
|
|
20
35
|
}
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Unregister the device from receiving push notifications
|
|
39
|
+
*
|
|
40
|
+
* @return {Promise<void>}
|
|
41
|
+
*/
|
|
42
|
+
export function unregisterPush() {
|
|
43
|
+
return Vibes.registerPush();
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Fetches a DeviceInfoResponse with details about the Vibes Device ID and Push Token
|
|
48
|
+
*
|
|
49
|
+
* @return {Promise<DeviceInfoResponse>}
|
|
50
|
+
*/
|
|
21
51
|
export function getVibesDeviceInfo() {
|
|
22
52
|
return Vibes.getVibesDeviceInfo();
|
|
23
53
|
}
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* Updates the Vibes platform with changes to the device since the last time device information was submitted.
|
|
57
|
+
*
|
|
58
|
+
* @param updateCredential - if true, the authentication token will be refreshed. Unless required, pass false here.
|
|
59
|
+
* @param latitude - if you collect geolocation information, then pass the latitude here. Otherwise, pass 0
|
|
60
|
+
* @param longitude - if you collect geolocation information, then pass the latitude here. Otherwise, pass 0
|
|
61
|
+
* @returns {Promise<void>}
|
|
62
|
+
*/
|
|
24
63
|
export function updateDevice(updateCredential, latitude, longitude) {
|
|
25
64
|
return Vibes.updateDevice(updateCredential, latitude, longitude);
|
|
26
65
|
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Associate an external ID with the current person.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} externalPersonId
|
|
71
|
+
* @return {Promise<void>}
|
|
72
|
+
*/
|
|
27
73
|
export function associatePerson(externalPersonId) {
|
|
28
74
|
return Vibes.associatePerson(externalPersonId);
|
|
29
75
|
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Fetches the PersonResponse associated with this device currently
|
|
79
|
+
*
|
|
80
|
+
* @return {Promise<PersonResponse>}
|
|
81
|
+
*/
|
|
82
|
+
export function getPerson() {
|
|
83
|
+
return Vibes.getPerson();
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Fetches an array of inbox messages for the person associated with this device.
|
|
87
|
+
*
|
|
88
|
+
* @return {Promise<InboxMessage[]>}
|
|
89
|
+
*/
|
|
90
|
+
export function fetchInboxMessages() {
|
|
91
|
+
return Vibes.fetchInboxMessages();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/**
|
|
95
|
+
* Fetches a single inbox message by it's id.
|
|
96
|
+
*
|
|
97
|
+
* @param {string} message_uid
|
|
98
|
+
* @return {Promise<InboxMessage>}
|
|
99
|
+
*/
|
|
100
|
+
export function fetchInboxMessage(message_uid) {
|
|
101
|
+
return Vibes.fetchInboxMessage(message_uid);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Marks an inbox message as read.
|
|
106
|
+
*
|
|
107
|
+
* @param {string} message_uid
|
|
108
|
+
* @return {Promise<InboxMessage>} an updated version of the InboxMessage with read field updated
|
|
109
|
+
*/
|
|
110
|
+
export function markInboxMessageAsRead(message_uid) {
|
|
111
|
+
return Vibes.markInboxMessageAsRead(message_uid);
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Marks an inbox message as expired using message_uid and the expiry date supplied. Uses current date as expiry date
|
|
116
|
+
*
|
|
117
|
+
* @param {string} message_uid
|
|
118
|
+
* @return {Promise<InboxMessage>} an updated version of the InboxMessage with expires_at date updated
|
|
119
|
+
*/
|
|
120
|
+
export function expireInboxMessage(message_uid) {
|
|
121
|
+
return Vibes.expireInboxMessage(message_uid);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
/**
|
|
125
|
+
* Records an event for when the user opens an inbox message.
|
|
126
|
+
*
|
|
127
|
+
* @param inboxMap json map of the InboxMessage
|
|
128
|
+
* @return {Promise<void>}
|
|
129
|
+
*/
|
|
130
|
+
export function onInboxMessageOpen(inboxMap) {
|
|
131
|
+
return Vibes.onInboxMessageOpen(inboxMap);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
/**
|
|
135
|
+
* Records an event for when the user fetches a list of inbox messages.
|
|
136
|
+
*
|
|
137
|
+
* @return {Promise<void>}
|
|
138
|
+
*/
|
|
139
|
+
export function onInboxMessagesFetched() {
|
|
140
|
+
return Vibes.onInboxMessagesFetched();
|
|
141
|
+
}
|
|
30
142
|
export default Vibes;
|
|
31
143
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Vibes","Proxy","get","Error","registerDevice","unregisterDevice","registerPush","getVibesDeviceInfo","updateDevice","updateCredential","latitude","longitude","associatePerson","externalPersonId"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'vibes-react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst Vibes = NativeModules.Vibes\n ? NativeModules.Vibes\n : new Proxy(\n
|
|
1
|
+
{"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","Vibes","Proxy","get","Error","registerDevice","unregisterDevice","registerPush","unregisterPush","getVibesDeviceInfo","updateDevice","updateCredential","latitude","longitude","associatePerson","externalPersonId","getPerson","fetchInboxMessages","fetchInboxMessage","message_uid","markInboxMessageAsRead","expireInboxMessage","onInboxMessageOpen","inboxMap","onInboxMessagesFetched"],"sources":["index.tsx"],"sourcesContent":["import { NativeModules, Platform } from 'react-native';\n\nconst LINKING_ERROR =\n `The package 'vibes-react-native' doesn't seem to be linked. Make sure: \\n\\n` +\n Platform.select({ ios: \"- You have run 'pod install'\\n\", default: '' }) +\n '- You rebuilt the app after installing the package\\n' +\n '- You are not using Expo managed workflow\\n';\n\nconst Vibes = NativeModules.Vibes\n ? NativeModules.Vibes\n : new Proxy(\n {},\n {\n get() {\n throw new Error(LINKING_ERROR);\n },\n }\n );\n\nexport interface DeviceResponse {\n device_id?: string;\n}\nexport interface DeviceInfoResponse extends DeviceResponse {\n push_token?: string;\n}\n\nexport interface PersonResponse {\n person_key?: string;\n external_person_id?: string;\n}\n\nexport interface InboxMessage {\n content?: string;\n created_at?: string;\n expires_at?: string;\n message_uid?: string;\n read?: boolean;\n subject?: string;\n detail?: string;\n collapse_key?: string;\n apprefdata?: any;\n images?: any;\n inbox_custom_data: any;\n}\n\n/**\n * Register this device with the Vibes platform\n *\n * @return {Promise<DeviceResponse>}\n */\nexport function registerDevice(): Promise<DeviceResponse> {\n return Vibes.registerDevice();\n}\n/**\n * Unregister this device with the Vibes platform\n *\n * @return {Promise<void>}\n */\nexport function unregisterDevice(): Promise<void> {\n return Vibes.unregisterDevice();\n}\n\n/**\n * Register this device to receive push notifications\n *\n * @return {Promise<void>}\n */\nexport function registerPush(): Promise<void> {\n return Vibes.registerPush();\n}\n\n/**\n* Unregister the device from receiving push notifications\n*\n* @return {Promise<void>}\n*/\nexport function unregisterPush(): Promise<void> {\n return Vibes.registerPush();\n}\n\n/**\n * Fetches a DeviceInfoResponse with details about the Vibes Device ID and Push Token\n *\n * @return {Promise<DeviceInfoResponse>}\n */\nexport function getVibesDeviceInfo(): Promise<DeviceInfoResponse> {\n return Vibes.getVibesDeviceInfo();\n}\n\n/**\n * Updates the Vibes platform with changes to the device since the last time device information was submitted.\n *\n * @param updateCredential - if true, the authentication token will be refreshed. Unless required, pass false here.\n * @param latitude - if you collect geolocation information, then pass the latitude here. Otherwise, pass 0\n * @param longitude - if you collect geolocation information, then pass the latitude here. Otherwise, pass 0\n * @returns {Promise<void>}\n */\nexport function updateDevice(\n updateCredential: boolean,\n latitude: number,\n longitude: number\n): Promise<void> {\n return Vibes.updateDevice(updateCredential, latitude, longitude);\n}\n\n/**\n * Associate an external ID with the current person.\n *\n * @param {string} externalPersonId\n * @return {Promise<void>}\n */\nexport function associatePerson(externalPersonId: string): Promise<void> {\n return Vibes.associatePerson(externalPersonId);\n}\n\n/**\n * Fetches the PersonResponse associated with this device currently\n *\n * @return {Promise<PersonResponse>}\n */\nexport function getPerson(): Promise<PersonResponse> {\n return Vibes.getPerson();\n}\n/**\n * Fetches an array of inbox messages for the person associated with this device.\n *\n * @return {Promise<InboxMessage[]>}\n */\nexport function fetchInboxMessages(): Promise<InboxMessage[]> {\n return Vibes.fetchInboxMessages();\n}\n\n/**\n * Fetches a single inbox message by it's id.\n *\n * @param {string} message_uid\n * @return {Promise<InboxMessage>}\n */\nexport function fetchInboxMessage(message_uid: string): Promise<InboxMessage> {\n return Vibes.fetchInboxMessage(message_uid);\n}\n\n/**\n * Marks an inbox message as read.\n *\n * @param {string} message_uid\n * @return {Promise<InboxMessage>} an updated version of the InboxMessage with read field updated\n */\nexport function markInboxMessageAsRead(message_uid: string): Promise<InboxMessage> {\n return Vibes.markInboxMessageAsRead(message_uid);\n}\n\n/**\n * Marks an inbox message as expired using message_uid and the expiry date supplied. Uses current date as expiry date\n *\n * @param {string} message_uid\n * @return {Promise<InboxMessage>} an updated version of the InboxMessage with expires_at date updated\n */\nexport function expireInboxMessage(message_uid: string): Promise<InboxMessage> {\n return Vibes.expireInboxMessage(message_uid);\n}\n\n/**\n * Records an event for when the user opens an inbox message.\n *\n * @param inboxMap json map of the InboxMessage\n * @return {Promise<void>}\n */\nexport function onInboxMessageOpen(inboxMap: InboxMessage): Promise<void> {\n return Vibes.onInboxMessageOpen(inboxMap);\n}\n\n/**\n * Records an event for when the user fetches a list of inbox messages.\n *\n * @return {Promise<void>}\n */\nexport function onInboxMessagesFetched(): Promise<void> {\n return Vibes.onInboxMessagesFetched();\n}\n\nexport default Vibes;\n"],"mappings":"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"}
|
|
@@ -1,8 +1,117 @@
|
|
|
1
1
|
declare const Vibes: any;
|
|
2
|
-
export
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
export interface DeviceResponse {
|
|
3
|
+
device_id?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface DeviceInfoResponse extends DeviceResponse {
|
|
6
|
+
push_token?: string;
|
|
7
|
+
}
|
|
8
|
+
export interface PersonResponse {
|
|
9
|
+
person_key?: string;
|
|
10
|
+
external_person_id?: string;
|
|
11
|
+
}
|
|
12
|
+
export interface InboxMessage {
|
|
13
|
+
content?: string;
|
|
14
|
+
created_at?: string;
|
|
15
|
+
expires_at?: string;
|
|
16
|
+
message_uid?: string;
|
|
17
|
+
read?: boolean;
|
|
18
|
+
subject?: string;
|
|
19
|
+
detail?: string;
|
|
20
|
+
collapse_key?: string;
|
|
21
|
+
apprefdata?: any;
|
|
22
|
+
images?: any;
|
|
23
|
+
inbox_custom_data: any;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Register this device with the Vibes platform
|
|
27
|
+
*
|
|
28
|
+
* @return {Promise<DeviceResponse>}
|
|
29
|
+
*/
|
|
30
|
+
export declare function registerDevice(): Promise<DeviceResponse>;
|
|
31
|
+
/**
|
|
32
|
+
* Unregister this device with the Vibes platform
|
|
33
|
+
*
|
|
34
|
+
* @return {Promise<void>}
|
|
35
|
+
*/
|
|
36
|
+
export declare function unregisterDevice(): Promise<void>;
|
|
37
|
+
/**
|
|
38
|
+
* Register this device to receive push notifications
|
|
39
|
+
*
|
|
40
|
+
* @return {Promise<void>}
|
|
41
|
+
*/
|
|
42
|
+
export declare function registerPush(): Promise<void>;
|
|
43
|
+
/**
|
|
44
|
+
* Unregister the device from receiving push notifications
|
|
45
|
+
*
|
|
46
|
+
* @return {Promise<void>}
|
|
47
|
+
*/
|
|
48
|
+
export declare function unregisterPush(): Promise<void>;
|
|
49
|
+
/**
|
|
50
|
+
* Fetches a DeviceInfoResponse with details about the Vibes Device ID and Push Token
|
|
51
|
+
*
|
|
52
|
+
* @return {Promise<DeviceInfoResponse>}
|
|
53
|
+
*/
|
|
54
|
+
export declare function getVibesDeviceInfo(): Promise<DeviceInfoResponse>;
|
|
55
|
+
/**
|
|
56
|
+
* Updates the Vibes platform with changes to the device since the last time device information was submitted.
|
|
57
|
+
*
|
|
58
|
+
* @param updateCredential - if true, the authentication token will be refreshed. Unless required, pass false here.
|
|
59
|
+
* @param latitude - if you collect geolocation information, then pass the latitude here. Otherwise, pass 0
|
|
60
|
+
* @param longitude - if you collect geolocation information, then pass the latitude here. Otherwise, pass 0
|
|
61
|
+
* @returns {Promise<void>}
|
|
62
|
+
*/
|
|
63
|
+
export declare function updateDevice(updateCredential: boolean, latitude: number, longitude: number): Promise<void>;
|
|
64
|
+
/**
|
|
65
|
+
* Associate an external ID with the current person.
|
|
66
|
+
*
|
|
67
|
+
* @param {string} externalPersonId
|
|
68
|
+
* @return {Promise<void>}
|
|
69
|
+
*/
|
|
70
|
+
export declare function associatePerson(externalPersonId: string): Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Fetches the PersonResponse associated with this device currently
|
|
73
|
+
*
|
|
74
|
+
* @return {Promise<PersonResponse>}
|
|
75
|
+
*/
|
|
76
|
+
export declare function getPerson(): Promise<PersonResponse>;
|
|
77
|
+
/**
|
|
78
|
+
* Fetches an array of inbox messages for the person associated with this device.
|
|
79
|
+
*
|
|
80
|
+
* @return {Promise<InboxMessage[]>}
|
|
81
|
+
*/
|
|
82
|
+
export declare function fetchInboxMessages(): Promise<InboxMessage[]>;
|
|
83
|
+
/**
|
|
84
|
+
* Fetches a single inbox message by it's id.
|
|
85
|
+
*
|
|
86
|
+
* @param {string} message_uid
|
|
87
|
+
* @return {Promise<InboxMessage>}
|
|
88
|
+
*/
|
|
89
|
+
export declare function fetchInboxMessage(message_uid: string): Promise<InboxMessage>;
|
|
90
|
+
/**
|
|
91
|
+
* Marks an inbox message as read.
|
|
92
|
+
*
|
|
93
|
+
* @param {string} message_uid
|
|
94
|
+
* @return {Promise<InboxMessage>} an updated version of the InboxMessage with read field updated
|
|
95
|
+
*/
|
|
96
|
+
export declare function markInboxMessageAsRead(message_uid: string): Promise<InboxMessage>;
|
|
97
|
+
/**
|
|
98
|
+
* Marks an inbox message as expired using message_uid and the expiry date supplied. Uses current date as expiry date
|
|
99
|
+
*
|
|
100
|
+
* @param {string} message_uid
|
|
101
|
+
* @return {Promise<InboxMessage>} an updated version of the InboxMessage with expires_at date updated
|
|
102
|
+
*/
|
|
103
|
+
export declare function expireInboxMessage(message_uid: string): Promise<InboxMessage>;
|
|
104
|
+
/**
|
|
105
|
+
* Records an event for when the user opens an inbox message.
|
|
106
|
+
*
|
|
107
|
+
* @param inboxMap json map of the InboxMessage
|
|
108
|
+
* @return {Promise<void>}
|
|
109
|
+
*/
|
|
110
|
+
export declare function onInboxMessageOpen(inboxMap: InboxMessage): Promise<void>;
|
|
111
|
+
/**
|
|
112
|
+
* Records an event for when the user fetches a list of inbox messages.
|
|
113
|
+
*
|
|
114
|
+
* @return {Promise<void>}
|
|
115
|
+
*/
|
|
116
|
+
export declare function onInboxMessagesFetched(): Promise<void>;
|
|
8
117
|
export default Vibes;
|
package/package.json
CHANGED
package/src/index.tsx
CHANGED
|
@@ -9,40 +9,174 @@ const LINKING_ERROR =
|
|
|
9
9
|
const Vibes = NativeModules.Vibes
|
|
10
10
|
? NativeModules.Vibes
|
|
11
11
|
: new Proxy(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
export
|
|
21
|
-
|
|
12
|
+
{},
|
|
13
|
+
{
|
|
14
|
+
get() {
|
|
15
|
+
throw new Error(LINKING_ERROR);
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
export interface DeviceResponse {
|
|
21
|
+
device_id?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface DeviceInfoResponse extends DeviceResponse {
|
|
24
|
+
push_token?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export interface PersonResponse {
|
|
28
|
+
person_key?: string;
|
|
29
|
+
external_person_id?: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface InboxMessage {
|
|
33
|
+
content?: string;
|
|
34
|
+
created_at?: string;
|
|
35
|
+
expires_at?: string;
|
|
36
|
+
message_uid?: string;
|
|
37
|
+
read?: boolean;
|
|
38
|
+
subject?: string;
|
|
39
|
+
detail?: string;
|
|
40
|
+
collapse_key?: string;
|
|
41
|
+
apprefdata?: any;
|
|
42
|
+
images?: any;
|
|
43
|
+
inbox_custom_data: any;
|
|
22
44
|
}
|
|
23
45
|
|
|
24
|
-
|
|
46
|
+
/**
|
|
47
|
+
* Register this device with the Vibes platform
|
|
48
|
+
*
|
|
49
|
+
* @return {Promise<DeviceResponse>}
|
|
50
|
+
*/
|
|
51
|
+
export function registerDevice(): Promise<DeviceResponse> {
|
|
52
|
+
return Vibes.registerDevice();
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Unregister this device with the Vibes platform
|
|
56
|
+
*
|
|
57
|
+
* @return {Promise<void>}
|
|
58
|
+
*/
|
|
59
|
+
export function unregisterDevice(): Promise<void> {
|
|
25
60
|
return Vibes.unregisterDevice();
|
|
26
61
|
}
|
|
27
62
|
|
|
28
|
-
|
|
63
|
+
/**
|
|
64
|
+
* Register this device to receive push notifications
|
|
65
|
+
*
|
|
66
|
+
* @return {Promise<void>}
|
|
67
|
+
*/
|
|
68
|
+
export function registerPush(): Promise<void> {
|
|
69
|
+
return Vibes.registerPush();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Unregister the device from receiving push notifications
|
|
74
|
+
*
|
|
75
|
+
* @return {Promise<void>}
|
|
76
|
+
*/
|
|
77
|
+
export function unregisterPush(): Promise<void> {
|
|
29
78
|
return Vibes.registerPush();
|
|
30
79
|
}
|
|
31
80
|
|
|
32
|
-
|
|
81
|
+
/**
|
|
82
|
+
* Fetches a DeviceInfoResponse with details about the Vibes Device ID and Push Token
|
|
83
|
+
*
|
|
84
|
+
* @return {Promise<DeviceInfoResponse>}
|
|
85
|
+
*/
|
|
86
|
+
export function getVibesDeviceInfo(): Promise<DeviceInfoResponse> {
|
|
33
87
|
return Vibes.getVibesDeviceInfo();
|
|
34
88
|
}
|
|
35
89
|
|
|
90
|
+
/**
|
|
91
|
+
* Updates the Vibes platform with changes to the device since the last time device information was submitted.
|
|
92
|
+
*
|
|
93
|
+
* @param updateCredential - if true, the authentication token will be refreshed. Unless required, pass false here.
|
|
94
|
+
* @param latitude - if you collect geolocation information, then pass the latitude here. Otherwise, pass 0
|
|
95
|
+
* @param longitude - if you collect geolocation information, then pass the latitude here. Otherwise, pass 0
|
|
96
|
+
* @returns {Promise<void>}
|
|
97
|
+
*/
|
|
36
98
|
export function updateDevice(
|
|
37
99
|
updateCredential: boolean,
|
|
38
100
|
latitude: number,
|
|
39
101
|
longitude: number
|
|
40
|
-
): Promise<
|
|
102
|
+
): Promise<void> {
|
|
41
103
|
return Vibes.updateDevice(updateCredential, latitude, longitude);
|
|
42
104
|
}
|
|
43
105
|
|
|
44
|
-
|
|
106
|
+
/**
|
|
107
|
+
* Associate an external ID with the current person.
|
|
108
|
+
*
|
|
109
|
+
* @param {string} externalPersonId
|
|
110
|
+
* @return {Promise<void>}
|
|
111
|
+
*/
|
|
112
|
+
export function associatePerson(externalPersonId: string): Promise<void> {
|
|
45
113
|
return Vibes.associatePerson(externalPersonId);
|
|
46
114
|
}
|
|
47
115
|
|
|
116
|
+
/**
|
|
117
|
+
* Fetches the PersonResponse associated with this device currently
|
|
118
|
+
*
|
|
119
|
+
* @return {Promise<PersonResponse>}
|
|
120
|
+
*/
|
|
121
|
+
export function getPerson(): Promise<PersonResponse> {
|
|
122
|
+
return Vibes.getPerson();
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Fetches an array of inbox messages for the person associated with this device.
|
|
126
|
+
*
|
|
127
|
+
* @return {Promise<InboxMessage[]>}
|
|
128
|
+
*/
|
|
129
|
+
export function fetchInboxMessages(): Promise<InboxMessage[]> {
|
|
130
|
+
return Vibes.fetchInboxMessages();
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Fetches a single inbox message by it's id.
|
|
135
|
+
*
|
|
136
|
+
* @param {string} message_uid
|
|
137
|
+
* @return {Promise<InboxMessage>}
|
|
138
|
+
*/
|
|
139
|
+
export function fetchInboxMessage(message_uid: string): Promise<InboxMessage> {
|
|
140
|
+
return Vibes.fetchInboxMessage(message_uid);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* Marks an inbox message as read.
|
|
145
|
+
*
|
|
146
|
+
* @param {string} message_uid
|
|
147
|
+
* @return {Promise<InboxMessage>} an updated version of the InboxMessage with read field updated
|
|
148
|
+
*/
|
|
149
|
+
export function markInboxMessageAsRead(message_uid: string): Promise<InboxMessage> {
|
|
150
|
+
return Vibes.markInboxMessageAsRead(message_uid);
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* Marks an inbox message as expired using message_uid and the expiry date supplied. Uses current date as expiry date
|
|
155
|
+
*
|
|
156
|
+
* @param {string} message_uid
|
|
157
|
+
* @return {Promise<InboxMessage>} an updated version of the InboxMessage with expires_at date updated
|
|
158
|
+
*/
|
|
159
|
+
export function expireInboxMessage(message_uid: string): Promise<InboxMessage> {
|
|
160
|
+
return Vibes.expireInboxMessage(message_uid);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Records an event for when the user opens an inbox message.
|
|
165
|
+
*
|
|
166
|
+
* @param inboxMap json map of the InboxMessage
|
|
167
|
+
* @return {Promise<void>}
|
|
168
|
+
*/
|
|
169
|
+
export function onInboxMessageOpen(inboxMap: InboxMessage): Promise<void> {
|
|
170
|
+
return Vibes.onInboxMessageOpen(inboxMap);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* Records an event for when the user fetches a list of inbox messages.
|
|
175
|
+
*
|
|
176
|
+
* @return {Promise<void>}
|
|
177
|
+
*/
|
|
178
|
+
export function onInboxMessagesFetched(): Promise<void> {
|
|
179
|
+
return Vibes.onInboxMessagesFetched();
|
|
180
|
+
}
|
|
181
|
+
|
|
48
182
|
export default Vibes;
|