vibes-react-native 1.1.3 → 1.1.6
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 +2 -392
- 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/checksums/checksums.lock +0 -0
- package/android/.gradle/configuration-cache/gc.properties +0 -0
- package/android/.gradle/nb-cache/trust/0FE3017D1D91C06BBB23B2D967E1CF942770CADF1DE28563D6C5A7D96E872CFD +1 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +51 -0
- package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
- package/android/gradle/wrapper/gradle-wrapper.properties +5 -0
- package/android/gradlew +185 -0
- package/android/gradlew.bat +89 -0
- package/android/src/main/AndroidManifest.xml +30 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/PushEvtEmitter.java +65 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/VibesAppHelper.java +186 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/VibesModule.java +490 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/VibesPackage.java +28 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/notifications/Fms.java +132 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/notifications/PayloadWrapper.java +23 -0
- package/android/src/main/java/com/vibes/push/rn/plugin/notifications/VibesPushReceiver.java +62 -0
- package/ios/Configuration.swift +68 -0
- package/ios/Notifications.swift +72 -0
- package/ios/Vibes-Bridging-Header.h +2 -0
- package/ios/Vibes.m +56 -0
- package/ios/Vibes.swift +378 -0
- package/ios/Vibes.xcodeproj/project.pbxproj +293 -0
- package/ios/Vibes.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/Vibes.xcodeproj/project.xcworkspace/xcuserdata/ed.lafoy.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/Vibes.xcodeproj/xcuserdata/ed.lafoy.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/VibesClient.swift +35 -0
- package/ios/VibesPluginLogger.swift +160 -0
- package/lib/commonjs/index.js +163 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/module/index.js +143 -0
- package/lib/module/index.js.map +1 -0
- package/package.json +11 -17
- package/src/index.tsx +182 -0
- /package/{ib → lib}/typescript/index.d.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","Vibes","NativeModules","Proxy","get","Error","registerDevice","unregisterDevice","registerPush","unregisterPush","getVibesDeviceInfo","updateDevice","updateCredential","latitude","longitude","associatePerson","externalPersonId","getPerson","fetchInboxMessages","fetchInboxMessage","message_uid","markInboxMessageAsRead","expireInboxMessage","onInboxMessageOpen","inboxMap","onInboxMessagesFetched","_default","exports"],"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":";;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,6EAA6E,GAC7EC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,MAAMC,KAAK,GAAGC,0BAAa,CAACD,KAAK,GAC7BC,0BAAa,CAACD,KAAK,GACnB,IAAIE,KAAK,CACT,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AA4BH;AACA;AACA;AACA;AACA;AACO,SAASU,cAAcA,CAAA,EAA4B;EACxD,OAAOL,KAAK,CAACK,cAAc,CAAC,CAAC;AAC/B;AACA;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W,CAAC;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASE,kBAAkBA,CAACF,WAAmB,EAAyB;EAC7E,OAAOnB,KAAK,CAACqB,kBAAkB,CAACF,WAAW,CAAC;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACO,SAASG,kBAAkBA,CAACC,QAAsB,EAAiB;EACxE,OAAOvB,KAAK,CAACsB,kBAAkB,CAACC,QAAQ,CAAC;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACO,SAASC,sBAAsBA,CAAA,EAAkB;EACtD,OAAOxB,KAAK,CAACwB,sBAAsB,CAAC,CAAC;AACvC;AAAC,IAAAC,QAAA,GAAAC,OAAA,CAAA3B,OAAA,GAEcC,KAAK","ignoreList":[]}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
const LINKING_ERROR = `The package 'vibes-react-native' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
|
|
3
|
+
ios: "- You have run 'pod install'\n",
|
|
4
|
+
default: ''
|
|
5
|
+
}) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo managed workflow\n';
|
|
6
|
+
const Vibes = NativeModules.Vibes ? NativeModules.Vibes : new Proxy({}, {
|
|
7
|
+
get() {
|
|
8
|
+
throw new Error(LINKING_ERROR);
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
/**
|
|
12
|
+
* Register this device with the Vibes platform
|
|
13
|
+
*
|
|
14
|
+
* @return {Promise<DeviceResponse>}
|
|
15
|
+
*/
|
|
16
|
+
export function registerDevice() {
|
|
17
|
+
return Vibes.registerDevice();
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Unregister this device with the Vibes platform
|
|
21
|
+
*
|
|
22
|
+
* @return {Promise<void>}
|
|
23
|
+
*/
|
|
24
|
+
export function unregisterDevice() {
|
|
25
|
+
return Vibes.unregisterDevice();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Register this device to receive push notifications
|
|
30
|
+
*
|
|
31
|
+
* @return {Promise<void>}
|
|
32
|
+
*/
|
|
33
|
+
export function registerPush() {
|
|
34
|
+
return Vibes.registerPush();
|
|
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
|
+
*/
|
|
51
|
+
export function getVibesDeviceInfo() {
|
|
52
|
+
return Vibes.getVibesDeviceInfo();
|
|
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
|
+
*/
|
|
63
|
+
export function updateDevice(updateCredential, latitude, longitude) {
|
|
64
|
+
return Vibes.updateDevice(updateCredential, latitude, longitude);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* Associate an external ID with the current person.
|
|
69
|
+
*
|
|
70
|
+
* @param {string} externalPersonId
|
|
71
|
+
* @return {Promise<void>}
|
|
72
|
+
*/
|
|
73
|
+
export function associatePerson(externalPersonId) {
|
|
74
|
+
return Vibes.associatePerson(externalPersonId);
|
|
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
|
+
}
|
|
142
|
+
export default Vibes;
|
|
143
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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":"AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,6EAA6E,GAC7ED,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,6CAA6C;AAE/C,MAAMC,KAAK,GAAGN,aAAa,CAACM,KAAK,GAC7BN,aAAa,CAACM,KAAK,GACnB,IAAIC,KAAK,CACT,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AA4BH;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,cAAc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;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAACD,WAAmB,EAAyB;EACjF,OAAOlB,KAAK,CAACmB,sBAAsB,CAACD,WAAW,CAAC;AAClD;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASE,kBAAkBA,CAACF,WAAmB,EAAyB;EAC7E,OAAOlB,KAAK,CAACoB,kBAAkB,CAACF,WAAW,CAAC;AAC9C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASG,kBAAkBA,CAACC,QAAsB,EAAiB;EACxE,OAAOtB,KAAK,CAACqB,kBAAkB,CAACC,QAAQ,CAAC;AAC3C;;AAEA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAAA,EAAkB;EACtD,OAAOvB,KAAK,CAACuB,sBAAsB,CAAC,CAAC;AACvC;AAEA,eAAevB,KAAK","ignoreList":[]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vibes-react-native",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.6",
|
|
4
4
|
"description": "The React Native plugin for the Vibes Mobile SDKs",
|
|
5
5
|
"author": "Vibes",
|
|
6
6
|
"main": "lib/commonjs/index",
|
|
@@ -8,8 +8,6 @@
|
|
|
8
8
|
"types": "lib/typescript/index.d.ts",
|
|
9
9
|
"react-native": "src/index",
|
|
10
10
|
"source": "src/index",
|
|
11
|
-
"type": "module",
|
|
12
|
-
"readme": "",
|
|
13
11
|
"files": [
|
|
14
12
|
"src",
|
|
15
13
|
"lib",
|
|
@@ -50,23 +48,22 @@
|
|
|
50
48
|
},
|
|
51
49
|
"devDependencies": {
|
|
52
50
|
"@commitlint/config-conventional": "^11.0.0",
|
|
53
|
-
"@react-native
|
|
51
|
+
"@react-native/eslint-config": "0.74.87",
|
|
54
52
|
"@release-it/conventional-changelog": "^2.0.0",
|
|
55
53
|
"@types/jest": "^26.0.0",
|
|
56
|
-
"@types/react": "^
|
|
57
|
-
"@types/react-native": "0.62.13",
|
|
54
|
+
"@types/react": "^18.2.6",
|
|
58
55
|
"commitlint": "^11.0.0",
|
|
59
|
-
"eslint": "^
|
|
56
|
+
"eslint": "^8.57.1",
|
|
60
57
|
"eslint-config-prettier": "^7.0.0",
|
|
61
58
|
"eslint-plugin-prettier": "^3.1.3",
|
|
62
59
|
"husky": "^6.0.0",
|
|
63
|
-
"jest": "^
|
|
64
|
-
"pod-install": "^
|
|
65
|
-
"prettier": "^
|
|
66
|
-
"react": "
|
|
67
|
-
"react-native": "0.
|
|
68
|
-
"react-native-builder-bob": "^0.18.0",
|
|
60
|
+
"jest": "^29.7.0",
|
|
61
|
+
"pod-install": "^1.0.14",
|
|
62
|
+
"prettier": "^3.5.3",
|
|
63
|
+
"react": "18.2.0",
|
|
64
|
+
"react-native": "0.74.5",
|
|
69
65
|
"react-native-push-notification": "^3.1.9",
|
|
66
|
+
"react-native-builder-bob": "^0.18.0",
|
|
70
67
|
"release-it": "^14.2.2",
|
|
71
68
|
"typescript": "^4.1.3"
|
|
72
69
|
},
|
|
@@ -147,8 +144,5 @@
|
|
|
147
144
|
}
|
|
148
145
|
]
|
|
149
146
|
]
|
|
150
|
-
},
|
|
151
|
-
"dependencies": {
|
|
152
|
-
"react-dom": "^17.0.2"
|
|
153
147
|
}
|
|
154
|
-
}
|
|
148
|
+
}
|
package/src/index.tsx
ADDED
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
import { NativeModules, Platform } from 'react-native';
|
|
2
|
+
|
|
3
|
+
const LINKING_ERROR =
|
|
4
|
+
`The package 'vibes-react-native' doesn't seem to be linked. Make sure: \n\n` +
|
|
5
|
+
Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
|
|
6
|
+
'- You rebuilt the app after installing the package\n' +
|
|
7
|
+
'- You are not using Expo managed workflow\n';
|
|
8
|
+
|
|
9
|
+
const Vibes = NativeModules.Vibes
|
|
10
|
+
? NativeModules.Vibes
|
|
11
|
+
: new Proxy(
|
|
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;
|
|
44
|
+
}
|
|
45
|
+
|
|
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> {
|
|
60
|
+
return Vibes.unregisterDevice();
|
|
61
|
+
}
|
|
62
|
+
|
|
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> {
|
|
78
|
+
return Vibes.registerPush();
|
|
79
|
+
}
|
|
80
|
+
|
|
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> {
|
|
87
|
+
return Vibes.getVibesDeviceInfo();
|
|
88
|
+
}
|
|
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
|
+
*/
|
|
98
|
+
export function updateDevice(
|
|
99
|
+
updateCredential: boolean,
|
|
100
|
+
latitude: number,
|
|
101
|
+
longitude: number
|
|
102
|
+
): Promise<void> {
|
|
103
|
+
return Vibes.updateDevice(updateCredential, latitude, longitude);
|
|
104
|
+
}
|
|
105
|
+
|
|
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> {
|
|
113
|
+
return Vibes.associatePerson(externalPersonId);
|
|
114
|
+
}
|
|
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
|
+
|
|
182
|
+
export default Vibes;
|
|
File without changes
|