@trycourier/courier-react-native 2.0.0-beta1 → 2.0.0-beta3
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/ios/CourierReactNative-Bridging-Header.h +1 -0
- package/ios/CourierReactNative.xcodeproj/project.pbxproj +5 -3
- package/ios/CourierReactNative.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/CourierReactNative.xcodeproj/project.xcworkspace/xcuserdata/mike.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/CourierReactNative.xcodeproj/xcuserdata/mike.xcuserdatad/xcschemes/xcschememanagement.plist +14 -0
- package/ios/CourierReactNativeDelegate.h +18 -0
- package/ios/CourierReactNativeDelegate.m +125 -0
- package/ios/CourierReactNativeModule.m +54 -2
- package/ios/CourierReactNativeModule.swift +104 -70
- package/ios/CourierReactNativeViewManager.m +1 -3
- package/ios/CourierReactNativeViewManager.swift +14 -18
- package/lib/commonjs/hooks/useCourier.js +224 -0
- package/lib/commonjs/hooks/useCourier.js.map +1 -0
- package/lib/commonjs/index.js +215 -13
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/models/CourierAuthenticationListener.js +21 -0
- package/lib/commonjs/models/CourierAuthenticationListener.js.map +1 -0
- package/lib/commonjs/models/CourierPushListener.js +15 -0
- package/lib/commonjs/models/CourierPushListener.js.map +1 -0
- package/lib/commonjs/views/CourierInboxView.js +4 -2
- package/lib/commonjs/views/CourierInboxView.js.map +1 -1
- package/lib/module/hooks/useCourier.js +213 -0
- package/lib/module/hooks/useCourier.js.map +1 -0
- package/lib/module/index.js +188 -14
- package/lib/module/index.js.map +1 -1
- package/lib/module/models/CourierAuthenticationListener.js +13 -0
- package/lib/module/models/CourierAuthenticationListener.js.map +1 -0
- package/lib/module/models/CourierPushListener.js +8 -0
- package/lib/module/models/CourierPushListener.js.map +1 -0
- package/lib/module/views/CourierInboxView.js +4 -2
- package/lib/module/views/CourierInboxView.js.map +1 -1
- package/lib/typescript/hooks/useCourier.d.ts +52 -0
- package/lib/typescript/hooks/useCourier.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +96 -2
- package/lib/typescript/index.d.ts.map +1 -1
- package/lib/typescript/models/CourierAuthenticationListener.d.ts +7 -0
- package/lib/typescript/models/CourierAuthenticationListener.d.ts.map +1 -0
- package/lib/typescript/models/CourierPushListener.d.ts +7 -0
- package/lib/typescript/models/CourierPushListener.d.ts.map +1 -0
- package/lib/typescript/views/CourierInboxView.d.ts +4 -2
- package/lib/typescript/views/CourierInboxView.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/hooks/useCourier.tsx +291 -0
- package/src/index.tsx +208 -15
- package/src/models/CourierAuthenticationListener.tsx +19 -0
- package/src/models/CourierPushListener.tsx +13 -0
- package/src/views/CourierInboxView.tsx +5 -4
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useCourier = exports.CourierProvider = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _ = _interopRequireDefault(require(".."));
|
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
10
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
11
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
12
|
+
let authListener = undefined;
|
|
13
|
+
let pushListener = undefined;
|
|
14
|
+
let inboxListener = undefined;
|
|
15
|
+
const CourierContext = /*#__PURE__*/(0, _react.createContext)(undefined);
|
|
16
|
+
const CourierProvider = _ref => {
|
|
17
|
+
let {
|
|
18
|
+
listeners,
|
|
19
|
+
children
|
|
20
|
+
} = _ref;
|
|
21
|
+
// Auth
|
|
22
|
+
const [auth_userId, auth_setUserId] = (0, _react.useState)(undefined);
|
|
23
|
+
const [auth_isLoading, auth_setIsLoading] = (0, _react.useState)(false);
|
|
24
|
+
const [auth_error, auth_setError] = (0, _react.useState)(undefined);
|
|
25
|
+
|
|
26
|
+
// Push
|
|
27
|
+
const [push_pushNotificationDelivered, inbox_setPushNotificationDelivered] = (0, _react.useState)(undefined);
|
|
28
|
+
const [push_pushNotificationClicked, inbox_setPushNotificationClicked] = (0, _react.useState)(undefined);
|
|
29
|
+
const [push_apnsToken, push_setApnsToken] = (0, _react.useState)(undefined);
|
|
30
|
+
const [push_fcmToken, push_setFcmToken] = (0, _react.useState)(undefined);
|
|
31
|
+
const [push_notificationPermission, push_setNotificationPermission] = (0, _react.useState)(undefined);
|
|
32
|
+
|
|
33
|
+
// Inbox
|
|
34
|
+
const [inbox_isLoading, inbox_setIsLoading] = (0, _react.useState)(false);
|
|
35
|
+
const [inbox_isRefreshing, inbox_setIsRefreshing] = (0, _react.useState)(false);
|
|
36
|
+
const [inbox_error, inbox_setError] = (0, _react.useState)(undefined);
|
|
37
|
+
const [inbox_messages, inbox_setMessages] = (0, _react.useState)([]);
|
|
38
|
+
const [inbox_unreadMessageCount, inbox_setUnreadMessageCount] = (0, _react.useState)(0);
|
|
39
|
+
const [inbox_totalMessageCount, inbox_setTotalMessageCount] = (0, _react.useState)(0);
|
|
40
|
+
const [inbox_canPaginate, inbox_setCanPaginate] = (0, _react.useState)(false);
|
|
41
|
+
(0, _react.useEffect)(() => {
|
|
42
|
+
// Get the initial values
|
|
43
|
+
const userId = _.default.shared.userId;
|
|
44
|
+
auth_setUserId(userId);
|
|
45
|
+
|
|
46
|
+
// Permissions
|
|
47
|
+
syncNotificationPermissions();
|
|
48
|
+
|
|
49
|
+
// Push tokens
|
|
50
|
+
syncTokens();
|
|
51
|
+
}, []);
|
|
52
|
+
(0, _react.useEffect)(() => {
|
|
53
|
+
var _authListener, _pushListener, _inboxListener;
|
|
54
|
+
(_authListener = authListener) === null || _authListener === void 0 ? void 0 : _authListener.remove();
|
|
55
|
+
(_pushListener = pushListener) === null || _pushListener === void 0 ? void 0 : _pushListener.remove();
|
|
56
|
+
(_inboxListener = inboxListener) === null || _inboxListener === void 0 ? void 0 : _inboxListener.remove();
|
|
57
|
+
|
|
58
|
+
// Push
|
|
59
|
+
if (listeners.includes('auth')) {
|
|
60
|
+
authListener = _.default.shared.addAuthenticationListener({
|
|
61
|
+
onUserChanged: userId => {
|
|
62
|
+
auth_setUserId(userId);
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// Push
|
|
68
|
+
if (listeners.includes('push')) {
|
|
69
|
+
pushListener = _.default.shared.addPushNotificationListener({
|
|
70
|
+
onPushNotificationDelivered: push => inbox_setPushNotificationDelivered(push),
|
|
71
|
+
onPushNotificationClicked: push => inbox_setPushNotificationClicked(push)
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Inbox
|
|
76
|
+
if (listeners.includes('inbox')) {
|
|
77
|
+
inboxListener = _.default.shared.addInboxListener({
|
|
78
|
+
onInitialLoad: () => {
|
|
79
|
+
inbox_setIsLoading(true);
|
|
80
|
+
inbox_setError(undefined);
|
|
81
|
+
},
|
|
82
|
+
onError: error => {
|
|
83
|
+
inbox_setIsLoading(false);
|
|
84
|
+
inbox_setError(error);
|
|
85
|
+
},
|
|
86
|
+
onMessagesChanged: (messages, unreadMessageCount, totalMessageCount, canPaginate) => {
|
|
87
|
+
inbox_setIsLoading(false);
|
|
88
|
+
inbox_setError(undefined);
|
|
89
|
+
inbox_setMessages(messages);
|
|
90
|
+
inbox_setUnreadMessageCount(unreadMessageCount);
|
|
91
|
+
inbox_setTotalMessageCount(totalMessageCount);
|
|
92
|
+
inbox_setCanPaginate(canPaginate);
|
|
93
|
+
}
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
return () => {
|
|
97
|
+
var _authListener2, _pushListener2, _inboxListener2;
|
|
98
|
+
(_authListener2 = authListener) === null || _authListener2 === void 0 ? void 0 : _authListener2.remove();
|
|
99
|
+
(_pushListener2 = pushListener) === null || _pushListener2 === void 0 ? void 0 : _pushListener2.remove();
|
|
100
|
+
(_inboxListener2 = inboxListener) === null || _inboxListener2 === void 0 ? void 0 : _inboxListener2.remove();
|
|
101
|
+
};
|
|
102
|
+
}, [listeners]);
|
|
103
|
+
const signIn = async props => {
|
|
104
|
+
auth_setIsLoading(true);
|
|
105
|
+
auth_setError(undefined);
|
|
106
|
+
try {
|
|
107
|
+
await _.default.shared.signIn(props);
|
|
108
|
+
} catch (error) {
|
|
109
|
+
auth_setError(error);
|
|
110
|
+
}
|
|
111
|
+
auth_setIsLoading(false);
|
|
112
|
+
};
|
|
113
|
+
const signOut = async () => {
|
|
114
|
+
auth_setIsLoading(true);
|
|
115
|
+
auth_setError(undefined);
|
|
116
|
+
try {
|
|
117
|
+
await _.default.shared.signOut();
|
|
118
|
+
} catch (error) {
|
|
119
|
+
auth_setError(error);
|
|
120
|
+
}
|
|
121
|
+
auth_setIsLoading(false);
|
|
122
|
+
};
|
|
123
|
+
const syncNotificationPermissions = async () => {
|
|
124
|
+
const status = await _.default.shared.getNotificationPermissionStatus();
|
|
125
|
+
push_setNotificationPermission(status);
|
|
126
|
+
};
|
|
127
|
+
const syncTokens = () => {
|
|
128
|
+
// APNS
|
|
129
|
+
const apnsToken = _.default.shared.apnsToken;
|
|
130
|
+
push_setApnsToken(apnsToken);
|
|
131
|
+
const fcmToken = _.default.shared.fcmToken;
|
|
132
|
+
push_setFcmToken(fcmToken);
|
|
133
|
+
};
|
|
134
|
+
const requestNotificationPermission = async () => {
|
|
135
|
+
const status = await _.default.shared.requestNotificationPermission();
|
|
136
|
+
push_setNotificationPermission(status);
|
|
137
|
+
};
|
|
138
|
+
const setPaginationLimit = limit => {
|
|
139
|
+
_.default.shared.setInboxPaginationLimit({
|
|
140
|
+
limit
|
|
141
|
+
});
|
|
142
|
+
};
|
|
143
|
+
const fetchNextPageOfMessages = () => {
|
|
144
|
+
return _.default.shared.fetchNextPageOfMessages();
|
|
145
|
+
};
|
|
146
|
+
const refresh = async () => {
|
|
147
|
+
inbox_setIsRefreshing(true);
|
|
148
|
+
await _.default.shared.refreshInbox();
|
|
149
|
+
inbox_setIsRefreshing(false);
|
|
150
|
+
};
|
|
151
|
+
const readAllMessages = () => {
|
|
152
|
+
// Skip if no user is found
|
|
153
|
+
if (!_.default.shared.userId) {
|
|
154
|
+
return Promise.resolve();
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
// Read the messages
|
|
158
|
+
return _.default.shared.readAllInboxMessages();
|
|
159
|
+
};
|
|
160
|
+
const readMessage = messageId => {
|
|
161
|
+
return _.default.shared.readMessage({
|
|
162
|
+
messageId
|
|
163
|
+
});
|
|
164
|
+
};
|
|
165
|
+
const unreadMessage = messageId => {
|
|
166
|
+
return _.default.shared.unreadMessage({
|
|
167
|
+
messageId
|
|
168
|
+
});
|
|
169
|
+
};
|
|
170
|
+
return /*#__PURE__*/_react.default.createElement(CourierContext.Provider, {
|
|
171
|
+
value: {
|
|
172
|
+
auth: {
|
|
173
|
+
isLoading: auth_isLoading,
|
|
174
|
+
error: auth_error,
|
|
175
|
+
userId: auth_userId,
|
|
176
|
+
signIn,
|
|
177
|
+
signOut
|
|
178
|
+
},
|
|
179
|
+
push: {
|
|
180
|
+
delivered: push_pushNotificationDelivered,
|
|
181
|
+
clicked: push_pushNotificationClicked,
|
|
182
|
+
tokens: {
|
|
183
|
+
fcm: push_fcmToken,
|
|
184
|
+
apns: push_apnsToken
|
|
185
|
+
},
|
|
186
|
+
notificationPermissionStatus: push_notificationPermission,
|
|
187
|
+
requestNotificationPermission
|
|
188
|
+
},
|
|
189
|
+
inbox: {
|
|
190
|
+
isLoading: inbox_isLoading,
|
|
191
|
+
error: inbox_error,
|
|
192
|
+
messages: inbox_messages,
|
|
193
|
+
unreadMessageCount: inbox_unreadMessageCount,
|
|
194
|
+
totalMessageCount: inbox_totalMessageCount,
|
|
195
|
+
canPaginate: inbox_canPaginate,
|
|
196
|
+
setPaginationLimit,
|
|
197
|
+
fetchNextPageOfMessages,
|
|
198
|
+
refresh,
|
|
199
|
+
isRefreshing: inbox_isRefreshing,
|
|
200
|
+
readAllMessages,
|
|
201
|
+
readMessage,
|
|
202
|
+
unreadMessage
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}, children);
|
|
206
|
+
};
|
|
207
|
+
exports.CourierProvider = CourierProvider;
|
|
208
|
+
const useCourier = function () {
|
|
209
|
+
var _props$inbox;
|
|
210
|
+
let props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
211
|
+
const context = (0, _react.useContext)(CourierContext);
|
|
212
|
+
if (!context) {
|
|
213
|
+
throw new Error('useCourier must be used within an CourierProvider');
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
// Set the initial pagination limit if needed
|
|
217
|
+
if ((_props$inbox = props.inbox) !== null && _props$inbox !== void 0 && _props$inbox.paginationLimit) {
|
|
218
|
+
var _context$inbox, _props$inbox2;
|
|
219
|
+
(_context$inbox = context.inbox) === null || _context$inbox === void 0 ? void 0 : _context$inbox.setPaginationLimit((_props$inbox2 = props.inbox) === null || _props$inbox2 === void 0 ? void 0 : _props$inbox2.paginationLimit);
|
|
220
|
+
}
|
|
221
|
+
return context;
|
|
222
|
+
};
|
|
223
|
+
exports.useCourier = useCourier;
|
|
224
|
+
//# sourceMappingURL=useCourier.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireWildcard","require","_","_interopRequireDefault","obj","__esModule","default","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","authListener","undefined","pushListener","inboxListener","CourierContext","createContext","CourierProvider","_ref","listeners","children","auth_userId","auth_setUserId","useState","auth_isLoading","auth_setIsLoading","auth_error","auth_setError","push_pushNotificationDelivered","inbox_setPushNotificationDelivered","push_pushNotificationClicked","inbox_setPushNotificationClicked","push_apnsToken","push_setApnsToken","push_fcmToken","push_setFcmToken","push_notificationPermission","push_setNotificationPermission","inbox_isLoading","inbox_setIsLoading","inbox_isRefreshing","inbox_setIsRefreshing","inbox_error","inbox_setError","inbox_messages","inbox_setMessages","inbox_unreadMessageCount","inbox_setUnreadMessageCount","inbox_totalMessageCount","inbox_setTotalMessageCount","inbox_canPaginate","inbox_setCanPaginate","useEffect","userId","Courier","shared","syncNotificationPermissions","syncTokens","_authListener","_pushListener","_inboxListener","remove","includes","addAuthenticationListener","onUserChanged","addPushNotificationListener","onPushNotificationDelivered","push","onPushNotificationClicked","addInboxListener","onInitialLoad","onError","error","onMessagesChanged","messages","unreadMessageCount","totalMessageCount","canPaginate","_authListener2","_pushListener2","_inboxListener2","signIn","props","signOut","status","getNotificationPermissionStatus","apnsToken","fcmToken","requestNotificationPermission","setPaginationLimit","limit","setInboxPaginationLimit","fetchNextPageOfMessages","refresh","refreshInbox","readAllMessages","Promise","resolve","readAllInboxMessages","readMessage","messageId","unreadMessage","createElement","Provider","value","auth","isLoading","delivered","clicked","tokens","fcm","apns","notificationPermissionStatus","inbox","isRefreshing","exports","useCourier","_props$inbox","arguments","length","context","useContext","Error","paginationLimit","_context$inbox","_props$inbox2"],"sourceRoot":"../../../src","sources":["hooks/useCourier.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AAEA,IAAAC,CAAA,GAAAC,sBAAA,CAAAF,OAAA;AAAuG,SAAAE,uBAAAC,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAAA,SAAAG,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,CAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAR,wBAAAI,GAAA,EAAAI,WAAA,SAAAA,WAAA,IAAAJ,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,oBAAAA,GAAA,wBAAAA,GAAA,4BAAAE,OAAA,EAAAF,GAAA,UAAAQ,KAAA,GAAAL,wBAAA,CAAAC,WAAA,OAAAI,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAT,GAAA,YAAAQ,KAAA,CAAAE,GAAA,CAAAV,GAAA,SAAAW,MAAA,WAAAC,qBAAA,GAAAC,MAAA,CAAAC,cAAA,IAAAD,MAAA,CAAAE,wBAAA,WAAAC,GAAA,IAAAhB,GAAA,QAAAgB,GAAA,kBAAAH,MAAA,CAAAI,SAAA,CAAAC,cAAA,CAAAC,IAAA,CAAAnB,GAAA,EAAAgB,GAAA,SAAAI,IAAA,GAAAR,qBAAA,GAAAC,MAAA,CAAAE,wBAAA,CAAAf,GAAA,EAAAgB,GAAA,cAAAI,IAAA,KAAAA,IAAA,CAAAV,GAAA,IAAAU,IAAA,CAAAC,GAAA,KAAAR,MAAA,CAAAC,cA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aM,eAAe,EAAE;IAAA,IAAAC,cAAA,EAAAC,aAAA;IAChC,CAAAD,cAAA,GAAAJ,OAAO,CAACP,KAAK,cAAAW,cAAA,uBAAbA,cAAA,CAAenC,kBAAkB,EAAAoC,aAAA,GAAC3C,KAAK,CAAC+B,KAAK,cAAAY,aAAA,uBAAXA,aAAA,CAAaF,eAAe,CAAC;EACjE;EAEA,OAAOH,OAAO;AAEhB,CAAC;AAACL,OAAA,CAAAC,UAAA,GAAAA,UAAA"}
|
package/lib/commonjs/index.js
CHANGED
|
@@ -3,16 +3,53 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
Object.defineProperty(exports, "CourierAuthenticationListener", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _CourierAuthenticationListener.CourierAuthenticationListener;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "CourierInboxListener", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _CourierInboxListener.CourierInboxListener;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
6
18
|
Object.defineProperty(exports, "CourierInboxView", {
|
|
7
19
|
enumerable: true,
|
|
8
20
|
get: function () {
|
|
9
21
|
return _CourierInboxView.CourierInboxView;
|
|
10
22
|
}
|
|
11
23
|
});
|
|
24
|
+
Object.defineProperty(exports, "CourierProvider", {
|
|
25
|
+
enumerable: true,
|
|
26
|
+
get: function () {
|
|
27
|
+
return _useCourier.CourierProvider;
|
|
28
|
+
}
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "CourierPushListener", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () {
|
|
33
|
+
return _CourierPushListener.CourierPushListener;
|
|
34
|
+
}
|
|
35
|
+
});
|
|
12
36
|
exports.default = void 0;
|
|
37
|
+
Object.defineProperty(exports, "useCourier", {
|
|
38
|
+
enumerable: true,
|
|
39
|
+
get: function () {
|
|
40
|
+
return _useCourier.useCourier;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
13
43
|
var _reactNative = require("react-native");
|
|
14
44
|
var _CourierInboxListener = require("./models/CourierInboxListener");
|
|
45
|
+
var _CourierPushListener = require("./models/CourierPushListener");
|
|
46
|
+
var _CourierAuthenticationListener = require("./models/CourierAuthenticationListener");
|
|
15
47
|
var _CourierInboxView = require("./views/CourierInboxView");
|
|
48
|
+
var _useCourier = require("./hooks/useCourier");
|
|
49
|
+
// Imports
|
|
50
|
+
|
|
51
|
+
// Exports
|
|
52
|
+
|
|
16
53
|
const LINKING_ERROR = `The package '@trycourier/courier-react-native' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
|
|
17
54
|
ios: "- You have run 'pod install'\n",
|
|
18
55
|
default: ''
|
|
@@ -24,6 +61,8 @@ const CourierReactNativeModules = _reactNative.NativeModules.CourierReactNativeM
|
|
|
24
61
|
});
|
|
25
62
|
const CourierEventEmitter = new _reactNative.NativeEventEmitter(_reactNative.NativeModules.CourierReactNativeModule);
|
|
26
63
|
class Courier {
|
|
64
|
+
PUSH_NOTIFICATION_CLICKED = 'pushNotificationClicked';
|
|
65
|
+
PUSH_NOTIFICATION_DELIVERED = 'pushNotificationDelivered';
|
|
27
66
|
_isDebugging = false;
|
|
28
67
|
constructor() {
|
|
29
68
|
// Sets the initial SDK values
|
|
@@ -40,15 +79,10 @@ class Courier {
|
|
|
40
79
|
return this._sharedInstance;
|
|
41
80
|
}
|
|
42
81
|
async setDefaults() {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
// }),
|
|
48
|
-
]);
|
|
49
|
-
} catch (error) {
|
|
50
|
-
console.log(error);
|
|
51
|
-
}
|
|
82
|
+
this.setIsDebugging(__DEV__);
|
|
83
|
+
this.iOSForegroundPresentationOptions({
|
|
84
|
+
options: ['sound', 'badge', 'list', 'banner']
|
|
85
|
+
});
|
|
52
86
|
}
|
|
53
87
|
|
|
54
88
|
/**
|
|
@@ -56,7 +90,7 @@ class Courier {
|
|
|
56
90
|
* Defaults to the React __DEV__ mode
|
|
57
91
|
* @example Courier.setIsDebugging(true)
|
|
58
92
|
*/
|
|
59
|
-
|
|
93
|
+
setIsDebugging(isDebugging) {
|
|
60
94
|
var _this$debugListener;
|
|
61
95
|
// Remove the existing listener if needed
|
|
62
96
|
(_this$debugListener = this.debugListener) === null || _this$debugListener === void 0 ? void 0 : _this$debugListener.remove();
|
|
@@ -68,19 +102,137 @@ class Courier {
|
|
|
68
102
|
console.log('\x1b[36m%s\x1b[0m', 'COURIER', event);
|
|
69
103
|
});
|
|
70
104
|
}
|
|
71
|
-
|
|
105
|
+
CourierReactNativeModules.setDebugMode(isDebugging);
|
|
106
|
+
this._isDebugging = isDebugging;
|
|
72
107
|
return this._isDebugging;
|
|
73
108
|
}
|
|
74
109
|
get isDebugging() {
|
|
75
110
|
return this._isDebugging;
|
|
76
111
|
}
|
|
77
112
|
|
|
113
|
+
/**
|
|
114
|
+
* TODO
|
|
115
|
+
* @param props
|
|
116
|
+
* @returns
|
|
117
|
+
*/
|
|
118
|
+
iOSForegroundPresentationOptions(props) {
|
|
119
|
+
// Only works on iOS
|
|
120
|
+
if (_reactNative.Platform.OS !== 'ios') return 'unsupported';
|
|
121
|
+
const normalizedParams = Array.from(new Set(props.options));
|
|
122
|
+
return CourierReactNativeModules.iOSForegroundPresentationOptions({
|
|
123
|
+
options: normalizedParams
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
/**
|
|
128
|
+
* Sets the current Apple Push Notification Service (APNS) token
|
|
129
|
+
* using Courier token management apis
|
|
130
|
+
* @example const apnsToken = await Courier.apnsToken
|
|
131
|
+
*/
|
|
132
|
+
get apnsToken() {
|
|
133
|
+
if (_reactNative.Platform.OS !== 'ios') return undefined;
|
|
134
|
+
return CourierReactNativeModules.getApnsToken();
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/**
|
|
138
|
+
* Sets the current Firebase Cloud Messaging (FCM) token
|
|
139
|
+
* using Courier token management apis
|
|
140
|
+
* @example const fcmToken = await Courier.fcmToken
|
|
141
|
+
*/
|
|
142
|
+
get fcmToken() {
|
|
143
|
+
return CourierReactNativeModules.getFcmToken();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
/**
|
|
147
|
+
* Sets the current Firebase Cloud Messaging (FCM) token
|
|
148
|
+
* using Courier token management apis
|
|
149
|
+
* @example await setFcmToken('asdf...asdf')
|
|
150
|
+
*/
|
|
151
|
+
setFcmToken(props) {
|
|
152
|
+
return CourierReactNativeModules.setFcmToken(props.token);
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* Gets notification permission status at a system level.
|
|
157
|
+
* @example const permissionStatus = await Courier.getNotificationPermissionStatus()
|
|
158
|
+
*/
|
|
159
|
+
getNotificationPermissionStatus() {
|
|
160
|
+
return CourierReactNativeModules.getNotificationPermissionStatus();
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* Requests notification permission status at a system level.
|
|
165
|
+
* Returns the string associated with the permission status.
|
|
166
|
+
* Will return the current status and will not present a popup
|
|
167
|
+
* if the user has already been asked for permission.
|
|
168
|
+
* @example const permissionStatus = await Courier.requestNotificationPermission()
|
|
169
|
+
*/
|
|
170
|
+
requestNotificationPermission() {
|
|
171
|
+
return CourierReactNativeModules.requestNotificationPermission();
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @example
|
|
176
|
+
TODO
|
|
177
|
+
* @returns function that can be used to unsubscribe from registered listeners
|
|
178
|
+
*/
|
|
179
|
+
addPushNotificationListener(props) {
|
|
180
|
+
const pushListener = new _CourierPushListener.CourierPushListener();
|
|
181
|
+
if (_reactNative.Platform.OS === 'android') {
|
|
182
|
+
if (props.onPushNotificationClicked) {
|
|
183
|
+
pushListener.onNotificationClickedListener = _reactNative.DeviceEventEmitter.addListener(this.PUSH_NOTIFICATION_CLICKED, event => {
|
|
184
|
+
try {
|
|
185
|
+
props.onPushNotificationClicked(JSON.parse(event));
|
|
186
|
+
} catch (error) {
|
|
187
|
+
console.log(error);
|
|
188
|
+
}
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
if (props.onPushNotificationDelivered) {
|
|
192
|
+
pushListener.onNotificationDeliveredListener = _reactNative.DeviceEventEmitter.addListener(this.PUSH_NOTIFICATION_DELIVERED, event => {
|
|
193
|
+
try {
|
|
194
|
+
props.onPushNotificationDelivered(JSON.parse(event));
|
|
195
|
+
} catch (error) {
|
|
196
|
+
console.log(error);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
if (_reactNative.Platform.OS === 'ios') {
|
|
202
|
+
if (props.onPushNotificationClicked) {
|
|
203
|
+
pushListener.onNotificationClickedListener = CourierEventEmitter.addListener(this.PUSH_NOTIFICATION_CLICKED, event => {
|
|
204
|
+
try {
|
|
205
|
+
props.onPushNotificationClicked(JSON.parse(event));
|
|
206
|
+
} catch (error) {
|
|
207
|
+
console.log(error);
|
|
208
|
+
}
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
if (props.onPushNotificationDelivered) {
|
|
212
|
+
pushListener.onNotificationDeliveredListener = CourierEventEmitter.addListener(this.PUSH_NOTIFICATION_DELIVERED, event => {
|
|
213
|
+
try {
|
|
214
|
+
props.onPushNotificationDelivered(JSON.parse(event));
|
|
215
|
+
} catch (error) {
|
|
216
|
+
console.log(error);
|
|
217
|
+
}
|
|
218
|
+
});
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// When listener is registered
|
|
223
|
+
// Attempt to fetch the last message that was clicked
|
|
224
|
+
// This is needed for when the app is killed and the
|
|
225
|
+
// user launched the app by clicking on a notifications
|
|
226
|
+
CourierReactNativeModules.registerPushNotificationClickedOnKilledState();
|
|
227
|
+
return pushListener;
|
|
228
|
+
}
|
|
229
|
+
|
|
78
230
|
/**
|
|
79
231
|
* Returns the current user id stored in local native storage
|
|
80
232
|
* @example const userId = await Courier.userId
|
|
81
233
|
*/
|
|
82
234
|
get userId() {
|
|
83
|
-
return CourierReactNativeModules.getUserId();
|
|
235
|
+
return CourierReactNativeModules.getUserId() ?? undefined;
|
|
84
236
|
}
|
|
85
237
|
|
|
86
238
|
/**
|
|
@@ -103,6 +255,38 @@ class Courier {
|
|
|
103
255
|
return CourierReactNativeModules.signIn(props.accessToken, props.clientKey ?? null, props.userId);
|
|
104
256
|
}
|
|
105
257
|
|
|
258
|
+
/**
|
|
259
|
+
* TODO
|
|
260
|
+
* @param props
|
|
261
|
+
* @returns
|
|
262
|
+
*/
|
|
263
|
+
signOut() {
|
|
264
|
+
return CourierReactNativeModules.signOut();
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* TODO
|
|
269
|
+
* @param props
|
|
270
|
+
* @returns
|
|
271
|
+
*/
|
|
272
|
+
addAuthenticationListener(props) {
|
|
273
|
+
const authListener = new _CourierAuthenticationListener.CourierAuthenticationListener();
|
|
274
|
+
authListener.onUserChanged = CourierEventEmitter.addListener('courierAuthUserChanged', event => {
|
|
275
|
+
props.onUserChanged(event);
|
|
276
|
+
});
|
|
277
|
+
authListener.listenerId = CourierReactNativeModules.addAuthenticationListener();
|
|
278
|
+
return authListener;
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/**
|
|
282
|
+
* TODO
|
|
283
|
+
* @param props
|
|
284
|
+
* @returns
|
|
285
|
+
*/
|
|
286
|
+
removeAuthenticationListener(props) {
|
|
287
|
+
return CourierReactNativeModules.removeAuthenticationListener(props.listenerId);
|
|
288
|
+
}
|
|
289
|
+
|
|
106
290
|
/**
|
|
107
291
|
* TODO
|
|
108
292
|
* @param props
|
|
@@ -153,7 +337,7 @@ class Courier {
|
|
|
153
337
|
props.onMessagesChanged(event.messages, event.unreadMessageCount, event.totalMessageCount, event.canPaginate);
|
|
154
338
|
});
|
|
155
339
|
}
|
|
156
|
-
inboxListener.listenerId = CourierReactNativeModules.addInboxListener(
|
|
340
|
+
inboxListener.listenerId = CourierReactNativeModules.addInboxListener();
|
|
157
341
|
return inboxListener;
|
|
158
342
|
}
|
|
159
343
|
|
|
@@ -174,6 +358,24 @@ class Courier {
|
|
|
174
358
|
async refreshInbox() {
|
|
175
359
|
return CourierReactNativeModules.refreshInbox();
|
|
176
360
|
}
|
|
361
|
+
|
|
362
|
+
/**
|
|
363
|
+
* TODO
|
|
364
|
+
* @param props
|
|
365
|
+
* @returns
|
|
366
|
+
*/
|
|
367
|
+
async fetchNextPageOfMessages() {
|
|
368
|
+
return CourierReactNativeModules.fetchNextPageOfMessages();
|
|
369
|
+
}
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* TODO
|
|
373
|
+
* @param props
|
|
374
|
+
* @returns
|
|
375
|
+
*/
|
|
376
|
+
setInboxPaginationLimit(props) {
|
|
377
|
+
CourierReactNativeModules.setInboxPaginationLimit(props.limit);
|
|
378
|
+
}
|
|
177
379
|
}
|
|
178
380
|
var _default = Courier;
|
|
179
381
|
exports.default = _default;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_reactNative","require","_CourierInboxListener","_CourierInboxView","LINKING_ERROR","Platform","select","ios","default","CourierReactNativeModules","NativeModules","CourierReactNativeModule","Proxy","get","Error","CourierEventEmitter","NativeEventEmitter","Courier","
|
|
1
|
+
{"version":3,"names":["_reactNative","require","_CourierInboxListener","_CourierPushListener","_CourierAuthenticationListener","_CourierInboxView","_useCourier","LINKING_ERROR","Platform","select","ios","default","CourierReactNativeModules","NativeModules","CourierReactNativeModule","Proxy","get","Error","CourierEventEmitter","NativeEventEmitter","Courier","PUSH_NOTIFICATION_CLICKED","PUSH_NOTIFICATION_DELIVERED","_isDebugging","constructor","setDefaults","shared","_sharedInstance","setIsDebugging","__DEV__","iOSForegroundPresentationOptions","options","isDebugging","_this$debugListener","debugListener","remove","addListener","event","console","log","setDebugMode","props","OS","normalizedParams","Array","from","Set","apnsToken","undefined","getApnsToken","fcmToken","getFcmToken","setFcmToken","token","getNotificationPermissionStatus","requestNotificationPermission","addPushNotificationListener","pushListener","CourierPushListener","onPushNotificationClicked","onNotificationClickedListener","DeviceEventEmitter","JSON","parse","error","onPushNotificationDelivered","onNotificationDeliveredListener","registerPushNotificationClickedOnKilledState","userId","getUserId","signIn","accessToken","clientKey","signOut","addAuthenticationListener","authListener","CourierAuthenticationListener","onUserChanged","listenerId","removeAuthenticationListener","readMessage","messageId","unreadMessage","readAllInboxMessages","addInboxListener","inboxListener","CourierInboxListener","onInitialLoad","onError","onMessagesChanged","messages","unreadMessageCount","totalMessageCount","canPaginate","removeInboxListener","refreshInbox","fetchNextPageOfMessages","setInboxPaginationLimit","limit","_default","exports"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AASA,IAAAC,qBAAA,GAAAD,OAAA;AACA,IAAAE,oBAAA,GAAAF,OAAA;AACA,IAAAG,8BAAA,GAAAH,OAAA;AAIA,IAAAI,iBAAA,GAAAJ,OAAA;AACA,IAAAK,WAAA,GAAAL,OAAA;AARA;;AAMA;;AAOA,MAAMM,aAAa,GAChB,2FAA0F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,yBAAyB,GAAGC,0BAAa,CAACC,wBAAwB,GACpED,0BAAa,CAACC,wBAAwB,GACtC,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACV,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,MAAMW,mBAAmB,GAAG,IAAIC,+BAAk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ACP,UAAU,GAAGlE,yBAAyB,CAACwE,gBAAgB,CAAC,CAAC;IAEvE,OAAOC,aAAa;EAEtB;;EAEA;AACF;AACA;AACA;AACA;EACSS,mBAAmBA,CAACrD,KAA6B,EAAU;IAChE,OAAO7B,yBAAyB,CAACkF,mBAAmB,CAACrD,KAAK,CAACqC,UAAU,CAAC;EACxE;;EAEA;AACF;AACA;AACA;AACA;EACE,MAAaiB,YAAYA,CAAA,EAAkB;IACzC,OAAOnF,yBAAyB,CAACmF,YAAY,CAAC,CAAC;EACjD;;EAEA;AACF;AACA;AACA;AACA;EACG,MAAaC,uBAAuBA,CAAA,EAA4B;IAC/D,OAAOpF,yBAAyB,CAACoF,uBAAuB,CAAC,CAAC;EAC5D;;EAEA;AACF;AACA;AACA;AACA;EACUC,uBAAuBA,CAACxD,KAAwB,EAAQ;IAC9D7B,yBAAyB,CAACqF,uBAAuB,CAACxD,KAAK,CAACyD,KAAK,CAAC;EAChE;AAEF;AAAC,IAAAC,QAAA,GAEc/E,OAAO;AAAAgF,OAAA,CAAAzF,OAAA,GAAAwF,QAAA"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CourierAuthenticationListener = void 0;
|
|
7
|
+
var _ = _interopRequireDefault(require(".."));
|
|
8
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
9
|
+
class CourierAuthenticationListener {
|
|
10
|
+
remove() {
|
|
11
|
+
var _this$onUserChanged;
|
|
12
|
+
if (this.listenerId) {
|
|
13
|
+
_.default.shared.removeInboxListener({
|
|
14
|
+
listenerId: this.listenerId
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
(_this$onUserChanged = this.onUserChanged) === null || _this$onUserChanged === void 0 ? void 0 : _this$onUserChanged.remove();
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.CourierAuthenticationListener = CourierAuthenticationListener;
|
|
21
|
+
//# sourceMappingURL=CourierAuthenticationListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["_","_interopRequireDefault","require","obj","__esModule","default","CourierAuthenticationListener","remove","_this$onUserChanged","listenerId","Courier","shared","removeInboxListener","onUserChanged","exports"],"sourceRoot":"../../../src","sources":["models/CourierAuthenticationListener.tsx"],"mappings":";;;;;;AACA,IAAAA,CAAA,GAAAC,sBAAA,CAAAC,OAAA;AAAyB,SAAAD,uBAAAE,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAElB,MAAMG,6BAA6B,CAAC;EAKlCC,MAAMA,CAAA,EAAG;IAAA,IAAAC,mBAAA;IAEd,IAAI,IAAI,CAACC,UAAU,EAAE;MACnBC,SAAO,CAACC,MAAM,CAACC,mBAAmB,CAAC;QAAEH,UAAU,EAAE,IAAI,CAACA;MAAW,CAAC,CAAC;IACrE;IAEA,CAAAD,mBAAA,OAAI,CAACK,aAAa,cAAAL,mBAAA,uBAAlBA,mBAAA,CAAoBD,MAAM,CAAC,CAAC;EAE9B;AAEF;AAACO,OAAA,CAAAR,6BAAA,GAAAA,6BAAA"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.CourierPushListener = void 0;
|
|
7
|
+
class CourierPushListener {
|
|
8
|
+
remove() {
|
|
9
|
+
var _this$onNotificationC, _this$onNotificationD;
|
|
10
|
+
(_this$onNotificationC = this.onNotificationClickedListener) === null || _this$onNotificationC === void 0 ? void 0 : _this$onNotificationC.remove();
|
|
11
|
+
(_this$onNotificationD = this.onNotificationDeliveredListener) === null || _this$onNotificationD === void 0 ? void 0 : _this$onNotificationD.remove();
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.CourierPushListener = CourierPushListener;
|
|
15
|
+
//# sourceMappingURL=CourierPushListener.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["CourierPushListener","remove","_this$onNotificationC","_this$onNotificationD","onNotificationClickedListener","onNotificationDeliveredListener","exports"],"sourceRoot":"../../../src","sources":["models/CourierPushListener.tsx"],"mappings":";;;;;;AAEO,MAAMA,mBAAmB,CAAC;EAKxBC,MAAMA,CAAA,EAAG;IAAA,IAAAC,qBAAA,EAAAC,qBAAA;IACd,CAAAD,qBAAA,OAAI,CAACE,6BAA6B,cAAAF,qBAAA,uBAAlCA,qBAAA,CAAoCD,MAAM,CAAC,CAAC;IAC5C,CAAAE,qBAAA,OAAI,CAACE,+BAA+B,cAAAF,qBAAA,uBAApCA,qBAAA,CAAsCF,MAAM,CAAC,CAAC;EAChD;AAEF;AAACK,OAAA,CAAAN,mBAAA,GAAAA,mBAAA"}
|
|
@@ -41,8 +41,10 @@ const CourierInboxView = props => {
|
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
43
|
return /*#__PURE__*/_react.default.createElement(CourierInbox, {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
theme: props.theme ?? {
|
|
45
|
+
light: undefined,
|
|
46
|
+
dark: undefined
|
|
47
|
+
},
|
|
46
48
|
onClickInboxMessageAtIndex: onClickInboxMessageAtIndex,
|
|
47
49
|
onClickInboxActionForMessageAtIndex: onClickInboxActionForMessageAtIndex,
|
|
48
50
|
onScrollInbox: onScrollInbox,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","obj","__esModule","default","ComponentName","LINKING_ERROR","Platform","select","ios","CourierInbox","UIManager","getViewManagerConfig","requireNativeComponent","Error","CourierInboxView","props","onClickInboxMessageAtIndex","event","index","nativeEvent","message","onClickInboxActionForMessageAtIndex","action","onScrollInbox","contentOffset","createElement","
|
|
1
|
+
{"version":3,"names":["_react","_interopRequireDefault","require","_reactNative","obj","__esModule","default","ComponentName","LINKING_ERROR","Platform","select","ios","CourierInbox","UIManager","getViewManagerConfig","requireNativeComponent","Error","CourierInboxView","props","onClickInboxMessageAtIndex","event","index","nativeEvent","message","onClickInboxActionForMessageAtIndex","action","onScrollInbox","contentOffset","createElement","theme","light","undefined","dark","style","exports"],"sourceRoot":"../../../src","sources":["views/CourierInboxView.tsx"],"mappings":";;;;;;AAAA,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AAAsF,SAAAD,uBAAAG,GAAA,WAAAA,GAAA,IAAAA,GAAA,CAAAC,UAAA,GAAAD,GAAA,KAAAE,OAAA,EAAAF,GAAA;AAgBtF,MAAMG,aAAa,GAAG,wBAAwB;AAE9C,MAAMC,aAAa,GAChB,2FAA0F,GAC3FC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEL,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMM,YAAY,GAChBC,sBAAS,CAACC,oBAAoB,CAACP,aAAa,CAAC,IAAI,IAAI,GACjD,IAAAQ,mCAAsB,EAAwBR,aAAa,CAAC,GAC5D,MAAM;EACJ,MAAM,IAAIS,KAAK,CAACR,aAAa,CAAC;AAChC,CAAC;AAEA,MAAMS,gBAAgB,GAAIC,KAA4B,IAAK;EAEhE,MAAMC,0BAA0B,GAAIC,KAAU,IAAK;IAEjD;IACA,IAAIF,KAAK,CAACC,0BAA0B,EAAE;MAEpC,MAAME,KAAK,GAAGD,KAAK,CAACE,WAAW,CAAC,OAAO,CAAC;MACxC,MAAMC,OAAO,GAAGH,KAAK,CAACE,WAAW,CAAC,SAAS,CAAiB;MAE5DJ,KAAK,CAACC,0BAA0B,CAACI,OAAO,EAAEF,KAAK,CAAC;IAElD;EAEF,CAAC;EAED,MAAMG,mCAAmC,GAAIJ,KAAU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