be-components 7.4.2 → 7.4.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/ApiOverrides/index.js +4 -2
- package/lib/commonjs/ApiOverrides/index.js.map +1 -1
- package/lib/commonjs/BettorBot/api/index.js +64 -0
- package/lib/commonjs/BettorBot/api/index.js.map +1 -0
- package/lib/commonjs/BettorBot/components/BroadcastMessageCard.js +233 -0
- package/lib/commonjs/BettorBot/components/BroadcastMessageCard.js.map +1 -0
- package/lib/commonjs/BettorBot/components/ServerInfoCard.js +126 -0
- package/lib/commonjs/BettorBot/components/ServerInfoCard.js.map +1 -0
- package/lib/commonjs/BettorBot/index.js +532 -0
- package/lib/commonjs/BettorBot/index.js.map +1 -0
- package/lib/commonjs/NotificationManager/api/index.js +448 -0
- package/lib/commonjs/NotificationManager/api/index.js.map +1 -0
- package/lib/commonjs/NotificationManager/index.js +1159 -0
- package/lib/commonjs/NotificationManager/index.js.map +1 -0
- package/lib/commonjs/index.js +27 -0
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/types.d.js.map +1 -1
- package/lib/module/ApiOverrides/index.js +4 -2
- package/lib/module/ApiOverrides/index.js.map +1 -1
- package/lib/module/BettorBot/api/index.js +57 -0
- package/lib/module/BettorBot/api/index.js.map +1 -0
- package/lib/module/BettorBot/components/BroadcastMessageCard.js +226 -0
- package/lib/module/BettorBot/components/BroadcastMessageCard.js.map +1 -0
- package/lib/module/BettorBot/components/ServerInfoCard.js +119 -0
- package/lib/module/BettorBot/components/ServerInfoCard.js.map +1 -0
- package/lib/module/BettorBot/index.js +524 -0
- package/lib/module/BettorBot/index.js.map +1 -0
- package/lib/module/NotificationManager/api/index.js +441 -0
- package/lib/module/NotificationManager/api/index.js.map +1 -0
- package/lib/module/NotificationManager/index.js +1140 -0
- package/lib/module/NotificationManager/index.js.map +1 -0
- package/lib/module/index.js +4 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.d.js.map +1 -1
- package/lib/typescript/lib/commonjs/ApiOverrides/index.d.ts.map +1 -1
- package/lib/typescript/lib/commonjs/BettorBot/api/index.d.ts +9 -0
- package/lib/typescript/lib/commonjs/BettorBot/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/BettorBot/components/BroadcastMessageCard.d.ts +10 -0
- package/lib/typescript/lib/commonjs/BettorBot/components/BroadcastMessageCard.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/BettorBot/components/ServerInfoCard.d.ts +10 -0
- package/lib/typescript/lib/commonjs/BettorBot/components/ServerInfoCard.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/BettorBot/index.d.ts +7 -0
- package/lib/typescript/lib/commonjs/BettorBot/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/NotificationManager/api/index.d.ts +804 -0
- package/lib/typescript/lib/commonjs/NotificationManager/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/NotificationManager/index.d.ts +815 -0
- package/lib/typescript/lib/commonjs/NotificationManager/index.d.ts.map +1 -0
- package/lib/typescript/lib/commonjs/index.d.ts +804 -0
- package/lib/typescript/lib/commonjs/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/ApiOverrides/index.d.ts.map +1 -1
- package/lib/typescript/lib/module/BettorBot/api/index.d.ts +8 -0
- package/lib/typescript/lib/module/BettorBot/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/BettorBot/components/BroadcastMessageCard.d.ts +10 -0
- package/lib/typescript/lib/module/BettorBot/components/BroadcastMessageCard.d.ts.map +1 -0
- package/lib/typescript/lib/module/BettorBot/components/ServerInfoCard.d.ts +10 -0
- package/lib/typescript/lib/module/BettorBot/components/ServerInfoCard.d.ts.map +1 -0
- package/lib/typescript/lib/module/BettorBot/index.d.ts +7 -0
- package/lib/typescript/lib/module/BettorBot/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/NotificationManager/api/index.d.ts +803 -0
- package/lib/typescript/lib/module/NotificationManager/api/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/NotificationManager/index.d.ts +16 -0
- package/lib/typescript/lib/module/NotificationManager/index.d.ts.map +1 -0
- package/lib/typescript/lib/module/index.d.ts +5 -1
- package/lib/typescript/lib/module/index.d.ts.map +1 -1
- package/lib/typescript/src/ApiOverrides/index.d.ts.map +1 -1
- package/lib/typescript/src/BettorBot/api/index.d.ts +9 -0
- package/lib/typescript/src/BettorBot/api/index.d.ts.map +1 -0
- package/lib/typescript/src/BettorBot/components/BroadcastMessageCard.d.ts +15 -0
- package/lib/typescript/src/BettorBot/components/BroadcastMessageCard.d.ts.map +1 -0
- package/lib/typescript/src/BettorBot/components/ServerInfoCard.d.ts +12 -0
- package/lib/typescript/src/BettorBot/components/ServerInfoCard.d.ts.map +1 -0
- package/lib/typescript/src/BettorBot/index.d.ts +9 -0
- package/lib/typescript/src/BettorBot/index.d.ts.map +1 -0
- package/lib/typescript/src/NotificationManager/api/index.d.ts +822 -0
- package/lib/typescript/src/NotificationManager/api/index.d.ts.map +1 -0
- package/lib/typescript/src/NotificationManager/index.d.ts +17 -0
- package/lib/typescript/src/NotificationManager/index.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -1
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/ApiOverrides/index.ts +4 -2
- package/src/BettorBot/api/index.ts +49 -0
- package/src/BettorBot/components/BroadcastMessageCard.tsx +159 -0
- package/src/BettorBot/components/ServerInfoCard.tsx +73 -0
- package/src/BettorBot/index.tsx +295 -0
- package/src/NotificationManager/api/index.ts +134 -0
- package/src/NotificationManager/index.tsx +894 -0
- package/src/index.tsx +8 -1
- package/src/types.d.ts +118 -0
|
@@ -0,0 +1,1159 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
Object.defineProperty(exports, "NotificationApi", {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: function () {
|
|
9
|
+
return _api.NotificationApi;
|
|
10
|
+
}
|
|
11
|
+
});
|
|
12
|
+
Object.defineProperty(exports, "NotificationHelpers", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _api.NotificationHelpers;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
exports.default = void 0;
|
|
19
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
20
|
+
var _reactNative = require("react-native");
|
|
21
|
+
var _Themed = require("../Components/Themed");
|
|
22
|
+
var _useColors = require("../constants/useColors");
|
|
23
|
+
var _api = require("./api");
|
|
24
|
+
var _Components = require("../Components");
|
|
25
|
+
var _Dropdown = _interopRequireDefault(require("../Components/Dropdown"));
|
|
26
|
+
var _ConfirmAlert = require("../Components/ConfirmAlert");
|
|
27
|
+
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
|
|
28
|
+
function _interopRequireWildcard(e, t) { if ("function" == typeof WeakMap) var r = new WeakMap(), n = new WeakMap(); return (_interopRequireWildcard = function (e, t) { if (!t && e && e.__esModule) return e; var o, i, f = { __proto__: null, default: e }; if (null === e || "object" != typeof e && "function" != typeof e) return f; if (o = t ? n : r) { if (o.has(e)) return o.get(e); o.set(e, f); } for (const t in e) "default" !== t && {}.hasOwnProperty.call(e, t) && ((i = (o = Object.defineProperty) && Object.getOwnPropertyDescriptor(e, t)) && (i.get || i.set) ? o(f, t, i) : f[t] = e[t]); return f; })(e, t); }
|
|
29
|
+
const notification_types = [{
|
|
30
|
+
label: 'Order Notifications',
|
|
31
|
+
value: 'order_notifications'
|
|
32
|
+
}, {
|
|
33
|
+
label: 'Competition Notifications',
|
|
34
|
+
value: 'competition_notifications'
|
|
35
|
+
}, {
|
|
36
|
+
label: 'Social Notifications',
|
|
37
|
+
value: 'social_notifications'
|
|
38
|
+
}];
|
|
39
|
+
const sections = ['header', 'top_row', 'preview', 'second_row'];
|
|
40
|
+
const NotificationManager = ({
|
|
41
|
+
player_ids,
|
|
42
|
+
me,
|
|
43
|
+
notification_type,
|
|
44
|
+
default_path_name,
|
|
45
|
+
onFocusPosition,
|
|
46
|
+
default_params,
|
|
47
|
+
onComplete,
|
|
48
|
+
onClose
|
|
49
|
+
}) => {
|
|
50
|
+
const Colors = (0, _useColors.useColors)();
|
|
51
|
+
const [loading, setLoading] = (0, _react.useState)(false);
|
|
52
|
+
const [loadingGroups, setLoadingGroups] = (0, _react.useState)(false);
|
|
53
|
+
const [notificationGroups, setNotificationGroups] = (0, _react.useState)([]);
|
|
54
|
+
const [selectedGroup, setSelectedGroup] = (0, _react.useState)(null);
|
|
55
|
+
const [showGroupsModal, setShowGroupsModal] = (0, _react.useState)(false);
|
|
56
|
+
const [groupMemberIds, setGroupMemberIds] = (0, _react.useState)([]);
|
|
57
|
+
const [showEditCustomGroupModal, setShowEditCustomGroupModal] = (0, _react.useState)(false);
|
|
58
|
+
const [customGroupCsv, setCustomGroupCsv] = (0, _react.useState)('');
|
|
59
|
+
const [sendingProgress, setSendingProgress] = (0, _react.useState)(null);
|
|
60
|
+
|
|
61
|
+
// Create a custom group from initial player_ids
|
|
62
|
+
const customGroup = player_ids.length > 0 ? {
|
|
63
|
+
notification_group_id: 'custom_group',
|
|
64
|
+
name: 'Custom Recipients',
|
|
65
|
+
description: `${player_ids.length} selected recipients`,
|
|
66
|
+
status: 'active',
|
|
67
|
+
grouping_function: '',
|
|
68
|
+
player_count: player_ids.length,
|
|
69
|
+
create_datetime: new Date().toISOString(),
|
|
70
|
+
last_update_datetime: new Date().toISOString()
|
|
71
|
+
} : null;
|
|
72
|
+
|
|
73
|
+
// Initialize selectedPath based on default_path_name if provided
|
|
74
|
+
const initialPath = default_path_name ? _api.NotificationHelpers.app_paths.find(p => p.path_name === default_path_name) || _api.NotificationHelpers.app_paths[0] : _api.NotificationHelpers.app_paths[0];
|
|
75
|
+
const [selectedPath, setSelectedPath] = (0, _react.useState)(initialPath);
|
|
76
|
+
const [customPathName, setCustomPathName] = (0, _react.useState)('');
|
|
77
|
+
const [pathParams, setPathParams] = (0, _react.useState)(default_params || {});
|
|
78
|
+
const [pathSearch, setPathSearch] = (0, _react.useState)('');
|
|
79
|
+
const [notification, setNotification] = (0, _react.useState)({
|
|
80
|
+
type: notification_type || 'order_notifications',
|
|
81
|
+
notify_body_type: 'custom',
|
|
82
|
+
title: '',
|
|
83
|
+
body: '',
|
|
84
|
+
status: 'pending',
|
|
85
|
+
expire_time: Date.now() + 7 * 24 * 60 * 60 * 1000 // 7 days from now
|
|
86
|
+
});
|
|
87
|
+
(0, _react.useEffect)(() => {
|
|
88
|
+
startUp();
|
|
89
|
+
// Auto-select custom group if initial player_ids provided
|
|
90
|
+
if (customGroup) {
|
|
91
|
+
setSelectedGroup(customGroup);
|
|
92
|
+
setGroupMemberIds(player_ids);
|
|
93
|
+
}
|
|
94
|
+
}, []);
|
|
95
|
+
(0, _react.useEffect)(() => {
|
|
96
|
+
// Initialize pathParams when selectedPath changes, merging with default_params
|
|
97
|
+
const mergedParams = {
|
|
98
|
+
...selectedPath?.params,
|
|
99
|
+
...(default_params || {})
|
|
100
|
+
};
|
|
101
|
+
setPathParams(mergedParams);
|
|
102
|
+
}, [selectedPath]);
|
|
103
|
+
const startUp = () => {
|
|
104
|
+
_api.NotificationApi.setEnvironment();
|
|
105
|
+
};
|
|
106
|
+
const loadNotificationGroups = async () => {
|
|
107
|
+
setLoadingGroups(true);
|
|
108
|
+
const groups = await _api.NotificationApi.getActiveNotificationGroups();
|
|
109
|
+
setNotificationGroups(groups);
|
|
110
|
+
setLoadingGroups(false);
|
|
111
|
+
};
|
|
112
|
+
const handleSelectGroup = async group_id => {
|
|
113
|
+
setLoadingGroups(true);
|
|
114
|
+
|
|
115
|
+
// Check if it's the custom group
|
|
116
|
+
if (group_id === 'custom_group' && customGroup) {
|
|
117
|
+
setSelectedGroup(customGroup);
|
|
118
|
+
setGroupMemberIds(player_ids);
|
|
119
|
+
setLoadingGroups(false);
|
|
120
|
+
setShowGroupsModal(false);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const group = notificationGroups.find(g => g.notification_group_id === group_id);
|
|
124
|
+
setSelectedGroup(group || null);
|
|
125
|
+
|
|
126
|
+
// Fetch all members for this group
|
|
127
|
+
const members = await _api.NotificationApi.getNotificationGroupMembersByGroup(group_id);
|
|
128
|
+
|
|
129
|
+
// Flatten all player_ids arrays from all member objects
|
|
130
|
+
const memberPlayerIds = members.flatMap(m => m.player_ids);
|
|
131
|
+
setGroupMemberIds(memberPlayerIds);
|
|
132
|
+
setLoadingGroups(false);
|
|
133
|
+
setShowGroupsModal(false);
|
|
134
|
+
};
|
|
135
|
+
const handleRemoveGroup = () => {
|
|
136
|
+
setSelectedGroup(null);
|
|
137
|
+
setGroupMemberIds([]);
|
|
138
|
+
};
|
|
139
|
+
const handleOpenEditCustomGroup = () => {
|
|
140
|
+
// Populate CSV with current groupMemberIds
|
|
141
|
+
setCustomGroupCsv(groupMemberIds.join(','));
|
|
142
|
+
setShowEditCustomGroupModal(true);
|
|
143
|
+
};
|
|
144
|
+
const handleSaveCustomGroup = () => {
|
|
145
|
+
// Parse CSV and update groupMemberIds
|
|
146
|
+
const ids = customGroupCsv.split(',').map(id => id.trim()).filter(id => id.length > 0);
|
|
147
|
+
setGroupMemberIds(ids);
|
|
148
|
+
|
|
149
|
+
// Update the custom group description
|
|
150
|
+
if (customGroup && selectedGroup?.notification_group_id === 'custom_group') {
|
|
151
|
+
const updatedGroup = {
|
|
152
|
+
...customGroup,
|
|
153
|
+
description: `${ids.length} selected recipients`,
|
|
154
|
+
player_count: ids.length
|
|
155
|
+
};
|
|
156
|
+
setSelectedGroup(updatedGroup);
|
|
157
|
+
}
|
|
158
|
+
setShowEditCustomGroupModal(false);
|
|
159
|
+
};
|
|
160
|
+
|
|
161
|
+
// Filter and sort paths: primary first (alphabetically), then others (alphabetically), limited by search
|
|
162
|
+
const filteredPaths = (0, _react.useMemo)(() => {
|
|
163
|
+
let filtered = _api.NotificationHelpers.app_paths;
|
|
164
|
+
|
|
165
|
+
// Apply search filter
|
|
166
|
+
if (pathSearch) {
|
|
167
|
+
filtered = filtered.filter(path => path.label.toLowerCase().includes(pathSearch.toLowerCase()) || path.path_name.toLowerCase().includes(pathSearch.toLowerCase()));
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Sort: primary paths first (alphabetically), then non-primary (alphabetically)
|
|
171
|
+
const sorted = [...filtered].sort((a, b) => {
|
|
172
|
+
if (a.primary && !b.primary) return -1;
|
|
173
|
+
if (!a.primary && b.primary) return 1;
|
|
174
|
+
return a.label.localeCompare(b.label);
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
// Limit to 15 results
|
|
178
|
+
return sorted.slice(0, 15);
|
|
179
|
+
}, [pathSearch]);
|
|
180
|
+
const isValid = () => {
|
|
181
|
+
const errors = [];
|
|
182
|
+
if (!notification.title || notification.title.trim() === '') {
|
|
183
|
+
errors.push('Notification title is required');
|
|
184
|
+
}
|
|
185
|
+
if (!notification.body || notification.body.trim() === '') {
|
|
186
|
+
errors.push('Notification body is required');
|
|
187
|
+
}
|
|
188
|
+
if (groupMemberIds.length === 0) {
|
|
189
|
+
errors.push('At least one recipient is required');
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
// Check required params
|
|
193
|
+
if (selectedPath?.requiredParams && selectedPath.requiredParams.length > 0) {
|
|
194
|
+
selectedPath.requiredParams.forEach(paramKey => {
|
|
195
|
+
if (!pathParams[paramKey] || pathParams[paramKey].trim() === '') {
|
|
196
|
+
errors.push(`Required parameter "${paramKey}" is missing`);
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
// Check custom path name
|
|
202
|
+
if (selectedPath?.path_name === 'custom' && (!customPathName || customPathName.trim() === '')) {
|
|
203
|
+
errors.push('Custom path name is required');
|
|
204
|
+
}
|
|
205
|
+
return errors;
|
|
206
|
+
};
|
|
207
|
+
const confirmSendNotification = options => {
|
|
208
|
+
const errors = isValid();
|
|
209
|
+
if (errors.length > 0) {
|
|
210
|
+
const errorMessage = 'Please fix the following errors:\n\n' + errors.map((err, idx) => `${idx + 1}. ${err}`).join('\n');
|
|
211
|
+
alert(errorMessage);
|
|
212
|
+
return;
|
|
213
|
+
}
|
|
214
|
+
(0, _ConfirmAlert.showConfirmAlert)('Are you sure?', options?.test ? 'This will send a test notification to you only' : 'This will send a notification to all users selected', () => handleSendNotification(options), () => console.log('Done'));
|
|
215
|
+
};
|
|
216
|
+
const handleSendNotification = async options => {
|
|
217
|
+
// Use only group member IDs (no individual player_ids)
|
|
218
|
+
let player_ids_to_send = [...groupMemberIds];
|
|
219
|
+
if (options?.test) {
|
|
220
|
+
//Change to the admin
|
|
221
|
+
player_ids_to_send = [me.player_id];
|
|
222
|
+
}
|
|
223
|
+
setLoading(true);
|
|
224
|
+
try {
|
|
225
|
+
// Determine final path_name
|
|
226
|
+
const finalPathName = selectedPath?.path_name === 'custom' ? customPathName : selectedPath?.path_name;
|
|
227
|
+
|
|
228
|
+
// Construct the complete notification object with all required fields
|
|
229
|
+
const completeNotification = {
|
|
230
|
+
player_notification_id: '',
|
|
231
|
+
// Will be generated by backend
|
|
232
|
+
player_id: me.player_id,
|
|
233
|
+
type: notification.type,
|
|
234
|
+
notify_body_type: notification.notify_body_type || 'custom',
|
|
235
|
+
title: notification.title,
|
|
236
|
+
body: notification.body,
|
|
237
|
+
options: {
|
|
238
|
+
id: Date.now().toString(),
|
|
239
|
+
body: notification.body,
|
|
240
|
+
icon: 'default',
|
|
241
|
+
type: notification.type || 'order_notifications',
|
|
242
|
+
data: {
|
|
243
|
+
id: Date.now().toString(),
|
|
244
|
+
player_id: me.player_id,
|
|
245
|
+
pageStack: 'MainStack',
|
|
246
|
+
page: 'Notifications',
|
|
247
|
+
pageParams: {},
|
|
248
|
+
url: notification.link_override,
|
|
249
|
+
path_name: finalPathName,
|
|
250
|
+
params: pathParams
|
|
251
|
+
}
|
|
252
|
+
},
|
|
253
|
+
status: 'unread',
|
|
254
|
+
link_override: notification.link_override,
|
|
255
|
+
expire_time: 0,
|
|
256
|
+
create_datetime: new Date().toISOString(),
|
|
257
|
+
last_update_datetime: new Date().toISOString()
|
|
258
|
+
};
|
|
259
|
+
|
|
260
|
+
// Split into batches of 500
|
|
261
|
+
const BATCH_SIZE = 500;
|
|
262
|
+
const batches = [];
|
|
263
|
+
for (let i = 0; i < player_ids_to_send.length; i += BATCH_SIZE) {
|
|
264
|
+
batches.push(player_ids_to_send.slice(i, i + BATCH_SIZE));
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
// Send notifications in batches
|
|
268
|
+
for (let i = 0; i < batches.length; i++) {
|
|
269
|
+
const batch = batches[i];
|
|
270
|
+
if (!batch) continue;
|
|
271
|
+
setSendingProgress({
|
|
272
|
+
current: i + 1,
|
|
273
|
+
total: batches.length
|
|
274
|
+
});
|
|
275
|
+
await _api.NotificationApi.broadcastNotifications(completeNotification, batch);
|
|
276
|
+
}
|
|
277
|
+
setSendingProgress(null);
|
|
278
|
+
if (onComplete) {
|
|
279
|
+
onComplete(completeNotification);
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Only reset form if not a test send
|
|
283
|
+
if (!options?.test) {
|
|
284
|
+
setNotification({
|
|
285
|
+
type: 'order_notifications',
|
|
286
|
+
notify_body_type: 'custom',
|
|
287
|
+
title: '',
|
|
288
|
+
body: '',
|
|
289
|
+
status: 'pending',
|
|
290
|
+
expire_time: Date.now() + 7 * 24 * 60 * 60 * 1000
|
|
291
|
+
});
|
|
292
|
+
}
|
|
293
|
+
const recipientCount = options?.test ? 1 : groupMemberIds.length;
|
|
294
|
+
const recipientMessage = options?.test ? 'Test notification sent to you!' : `Notification sent successfully to ${recipientCount} user${recipientCount !== 1 ? 's' : ''}!`;
|
|
295
|
+
alert(recipientMessage);
|
|
296
|
+
} catch (error) {
|
|
297
|
+
console.error('Error sending notification:', error);
|
|
298
|
+
alert('Failed to send notification. Please try again.');
|
|
299
|
+
}
|
|
300
|
+
setLoading(false);
|
|
301
|
+
};
|
|
302
|
+
const renderSections = data => {
|
|
303
|
+
switch (data.item) {
|
|
304
|
+
case 'header':
|
|
305
|
+
const headerTotalRecipients = groupMemberIds.length;
|
|
306
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
307
|
+
type: "header",
|
|
308
|
+
style: {
|
|
309
|
+
flexDirection: 'row',
|
|
310
|
+
alignItems: 'center',
|
|
311
|
+
padding: 10,
|
|
312
|
+
borderTopRightRadius: 8,
|
|
313
|
+
borderTopLeftRadius: 8
|
|
314
|
+
}
|
|
315
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
316
|
+
transparent: true,
|
|
317
|
+
style: {
|
|
318
|
+
flex: 1
|
|
319
|
+
}
|
|
320
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
321
|
+
theme: "h1"
|
|
322
|
+
}, "Send Notification"), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
323
|
+
theme: "description",
|
|
324
|
+
style: {
|
|
325
|
+
marginTop: 3
|
|
326
|
+
}
|
|
327
|
+
}, "Sending to ", headerTotalRecipients, " users")), onClose && /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
328
|
+
transparent: true,
|
|
329
|
+
onPress: onClose
|
|
330
|
+
}, /*#__PURE__*/_react.default.createElement(_Components.Icons.CloseIcon, {
|
|
331
|
+
size: 16,
|
|
332
|
+
color: Colors.text.h1
|
|
333
|
+
})));
|
|
334
|
+
case 'preview':
|
|
335
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
336
|
+
float: true,
|
|
337
|
+
style: {
|
|
338
|
+
margin: 5
|
|
339
|
+
}
|
|
340
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
341
|
+
type: "header",
|
|
342
|
+
style: {
|
|
343
|
+
flexDirection: 'row',
|
|
344
|
+
alignItems: 'center',
|
|
345
|
+
padding: 10,
|
|
346
|
+
borderTopRightRadius: 8,
|
|
347
|
+
borderTopLeftRadius: 8
|
|
348
|
+
}
|
|
349
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
350
|
+
transparent: true,
|
|
351
|
+
style: {
|
|
352
|
+
flex: 1
|
|
353
|
+
}
|
|
354
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
355
|
+
theme: "h1"
|
|
356
|
+
}, "Preview"), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
357
|
+
theme: "description",
|
|
358
|
+
style: {
|
|
359
|
+
marginTop: 3
|
|
360
|
+
}
|
|
361
|
+
}, "What will this notification look like?"))), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
362
|
+
float: true,
|
|
363
|
+
style: {
|
|
364
|
+
padding: 15,
|
|
365
|
+
margin: 10,
|
|
366
|
+
borderRadius: 8,
|
|
367
|
+
borderWidth: 1,
|
|
368
|
+
borderColor: Colors.borders.light
|
|
369
|
+
}
|
|
370
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
371
|
+
transparent: true,
|
|
372
|
+
style: {
|
|
373
|
+
flexDirection: 'row',
|
|
374
|
+
alignItems: 'center'
|
|
375
|
+
}
|
|
376
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
377
|
+
style: {
|
|
378
|
+
width: 40,
|
|
379
|
+
height: 40,
|
|
380
|
+
borderRadius: 8,
|
|
381
|
+
justifyContent: 'center',
|
|
382
|
+
alignItems: 'center',
|
|
383
|
+
marginRight: 12
|
|
384
|
+
}
|
|
385
|
+
}, /*#__PURE__*/_react.default.createElement(_Components.Icons.NotificationIcon, {
|
|
386
|
+
size: 20,
|
|
387
|
+
color: Colors.text.h1
|
|
388
|
+
})), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
389
|
+
transparent: true,
|
|
390
|
+
style: {
|
|
391
|
+
flex: 1
|
|
392
|
+
}
|
|
393
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
394
|
+
theme: "h1"
|
|
395
|
+
}, notification.title || 'Notification Title'), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
396
|
+
theme: "description",
|
|
397
|
+
style: {
|
|
398
|
+
marginTop: 4
|
|
399
|
+
}
|
|
400
|
+
}, notification.body || 'Notification message will appear here')))));
|
|
401
|
+
case 'top_row':
|
|
402
|
+
const totalRecipients = groupMemberIds.length;
|
|
403
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
404
|
+
style: {
|
|
405
|
+
flexDirection: 'row',
|
|
406
|
+
flexWrap: 'wrap'
|
|
407
|
+
}
|
|
408
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
409
|
+
float: true,
|
|
410
|
+
style: {
|
|
411
|
+
flexGrow: 1,
|
|
412
|
+
minWidth: 300,
|
|
413
|
+
padding: 10,
|
|
414
|
+
margin: 5
|
|
415
|
+
}
|
|
416
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
417
|
+
transparent: true,
|
|
418
|
+
style: {
|
|
419
|
+
flexDirection: 'row',
|
|
420
|
+
alignItems: 'center',
|
|
421
|
+
justifyContent: 'space-between',
|
|
422
|
+
marginBottom: 10
|
|
423
|
+
}
|
|
424
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
425
|
+
transparent: true,
|
|
426
|
+
style: {
|
|
427
|
+
flex: 1
|
|
428
|
+
}
|
|
429
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
430
|
+
theme: "h2"
|
|
431
|
+
}, "Recipients (", totalRecipients, ")"), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
432
|
+
theme: "description",
|
|
433
|
+
style: {
|
|
434
|
+
marginTop: 4
|
|
435
|
+
}
|
|
436
|
+
}, totalRecipients === 0 ? 'No recipients selected' : 'Selected group')), /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
437
|
+
type: "action",
|
|
438
|
+
onPress: () => {
|
|
439
|
+
loadNotificationGroups();
|
|
440
|
+
setShowGroupsModal(true);
|
|
441
|
+
},
|
|
442
|
+
style: {
|
|
443
|
+
padding: 8
|
|
444
|
+
}
|
|
445
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
446
|
+
theme: "h1",
|
|
447
|
+
color: Colors.text.white
|
|
448
|
+
}, "Select Group"))), selectedGroup && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
449
|
+
float: true,
|
|
450
|
+
style: {
|
|
451
|
+
flexDirection: 'row',
|
|
452
|
+
alignItems: 'center',
|
|
453
|
+
justifyContent: 'space-between',
|
|
454
|
+
padding: 12,
|
|
455
|
+
borderRadius: 8,
|
|
456
|
+
marginTop: 5
|
|
457
|
+
}
|
|
458
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
459
|
+
transparent: true,
|
|
460
|
+
style: {
|
|
461
|
+
flex: 1
|
|
462
|
+
}
|
|
463
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
464
|
+
theme: "h1"
|
|
465
|
+
}, selectedGroup.name), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
466
|
+
theme: "description",
|
|
467
|
+
style: {
|
|
468
|
+
marginTop: 2
|
|
469
|
+
}
|
|
470
|
+
}, groupMemberIds.length, " members")), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
471
|
+
transparent: true,
|
|
472
|
+
style: {
|
|
473
|
+
flexDirection: 'row'
|
|
474
|
+
}
|
|
475
|
+
}, selectedGroup.notification_group_id === 'custom_group' && /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
476
|
+
type: "action",
|
|
477
|
+
onPress: handleOpenEditCustomGroup,
|
|
478
|
+
style: {
|
|
479
|
+
padding: 8,
|
|
480
|
+
marginRight: 8
|
|
481
|
+
}
|
|
482
|
+
}, /*#__PURE__*/_react.default.createElement(_Components.Icons.EditIcon, {
|
|
483
|
+
size: 16,
|
|
484
|
+
color: Colors.text.white
|
|
485
|
+
})), /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
486
|
+
type: "error",
|
|
487
|
+
onPress: handleRemoveGroup,
|
|
488
|
+
style: {
|
|
489
|
+
padding: 8
|
|
490
|
+
}
|
|
491
|
+
}, /*#__PURE__*/_react.default.createElement(_Components.Icons.CloseIcon, {
|
|
492
|
+
size: 16,
|
|
493
|
+
color: Colors.text.white
|
|
494
|
+
}))))));
|
|
495
|
+
case 'second_row':
|
|
496
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
497
|
+
style: {
|
|
498
|
+
flexDirection: 'row',
|
|
499
|
+
flexWrap: 'wrap'
|
|
500
|
+
}
|
|
501
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
502
|
+
float: true,
|
|
503
|
+
style: {
|
|
504
|
+
minWidth: 300,
|
|
505
|
+
flexGrow: 1,
|
|
506
|
+
margin: 5
|
|
507
|
+
}
|
|
508
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
509
|
+
type: "header",
|
|
510
|
+
style: {
|
|
511
|
+
flexDirection: 'row',
|
|
512
|
+
alignItems: 'center',
|
|
513
|
+
padding: 10,
|
|
514
|
+
borderTopRightRadius: 8,
|
|
515
|
+
borderTopLeftRadius: 8
|
|
516
|
+
}
|
|
517
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
518
|
+
transparent: true,
|
|
519
|
+
style: {
|
|
520
|
+
flex: 1
|
|
521
|
+
}
|
|
522
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
523
|
+
theme: "h1"
|
|
524
|
+
}, "Notification Message"), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
525
|
+
theme: "description",
|
|
526
|
+
style: {
|
|
527
|
+
marginTop: 3
|
|
528
|
+
}
|
|
529
|
+
}, "Update notification message below"))), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
530
|
+
transparent: true,
|
|
531
|
+
type: "body"
|
|
532
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
533
|
+
transparent: true,
|
|
534
|
+
style: {
|
|
535
|
+
padding: 10
|
|
536
|
+
}
|
|
537
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
538
|
+
theme: "h2",
|
|
539
|
+
style: {
|
|
540
|
+
marginBottom: 10
|
|
541
|
+
}
|
|
542
|
+
}, "Notification Title"), /*#__PURE__*/_react.default.createElement(_Themed.TextInput, {
|
|
543
|
+
value: notification.title,
|
|
544
|
+
onFocusPosition: onFocusPosition,
|
|
545
|
+
placeholder: "Enter notification title",
|
|
546
|
+
onChangeText: title => setNotification({
|
|
547
|
+
...notification,
|
|
548
|
+
title
|
|
549
|
+
})
|
|
550
|
+
})), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
551
|
+
transparent: true,
|
|
552
|
+
style: {
|
|
553
|
+
padding: 10
|
|
554
|
+
}
|
|
555
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
556
|
+
theme: "h2",
|
|
557
|
+
style: {
|
|
558
|
+
marginBottom: 10
|
|
559
|
+
}
|
|
560
|
+
}, "Notification Body"), /*#__PURE__*/_react.default.createElement(_Themed.TextInput, {
|
|
561
|
+
value: notification.body,
|
|
562
|
+
onFocusPosition: onFocusPosition,
|
|
563
|
+
placeholder: "Enter notification message",
|
|
564
|
+
onChangeText: body => setNotification({
|
|
565
|
+
...notification,
|
|
566
|
+
body
|
|
567
|
+
}),
|
|
568
|
+
multiline: true,
|
|
569
|
+
numberOfLines: 6,
|
|
570
|
+
style: {
|
|
571
|
+
padding: 12,
|
|
572
|
+
borderRadius: 8,
|
|
573
|
+
minHeight: 120
|
|
574
|
+
}
|
|
575
|
+
})))), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
576
|
+
float: true,
|
|
577
|
+
style: {
|
|
578
|
+
flexGrow: 1,
|
|
579
|
+
minWidth: 300,
|
|
580
|
+
margin: 5
|
|
581
|
+
}
|
|
582
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
583
|
+
type: "header",
|
|
584
|
+
style: {
|
|
585
|
+
flexDirection: 'row',
|
|
586
|
+
alignItems: 'center',
|
|
587
|
+
padding: 10,
|
|
588
|
+
borderTopRightRadius: 8,
|
|
589
|
+
borderTopLeftRadius: 8
|
|
590
|
+
}
|
|
591
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
592
|
+
transparent: true,
|
|
593
|
+
style: {
|
|
594
|
+
flex: 1
|
|
595
|
+
}
|
|
596
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
597
|
+
theme: "h1"
|
|
598
|
+
}, "Notification Settings"), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
599
|
+
theme: "description",
|
|
600
|
+
style: {
|
|
601
|
+
marginTop: 3
|
|
602
|
+
}
|
|
603
|
+
}, "Manage settigns below"))), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
604
|
+
transparent: true,
|
|
605
|
+
type: "body"
|
|
606
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
607
|
+
type: "row",
|
|
608
|
+
style: {
|
|
609
|
+
padding: 10
|
|
610
|
+
}
|
|
611
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
612
|
+
theme: "h2",
|
|
613
|
+
style: {
|
|
614
|
+
flex: 1
|
|
615
|
+
}
|
|
616
|
+
}, "Notification Type"), /*#__PURE__*/_react.default.createElement(_Dropdown.default, {
|
|
617
|
+
selected_value: notification_types.find(t => t.value === notification.type)?.label ?? '',
|
|
618
|
+
dropdown_options: [{
|
|
619
|
+
value: 'type',
|
|
620
|
+
eligible_options: notification_types.map(t => t.label)
|
|
621
|
+
}],
|
|
622
|
+
onOptionSelect: selected => {
|
|
623
|
+
const type = notification_types.find(t => t.label === selected)?.value;
|
|
624
|
+
setNotification({
|
|
625
|
+
...notification,
|
|
626
|
+
type: type
|
|
627
|
+
});
|
|
628
|
+
}
|
|
629
|
+
})), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
630
|
+
transparent: true,
|
|
631
|
+
style: {
|
|
632
|
+
padding: 10
|
|
633
|
+
}
|
|
634
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
635
|
+
theme: "h2",
|
|
636
|
+
style: {
|
|
637
|
+
marginBottom: 10
|
|
638
|
+
}
|
|
639
|
+
}, "Link Override (Optional)"), /*#__PURE__*/_react.default.createElement(_Themed.TextInput, {
|
|
640
|
+
value: notification.link_override || '',
|
|
641
|
+
onFocusPosition: onFocusPosition,
|
|
642
|
+
placeholder: "https://example.com",
|
|
643
|
+
onChangeText: link_override => setNotification({
|
|
644
|
+
...notification,
|
|
645
|
+
link_override
|
|
646
|
+
}),
|
|
647
|
+
style: {
|
|
648
|
+
padding: 12,
|
|
649
|
+
borderRadius: 8
|
|
650
|
+
}
|
|
651
|
+
})), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
652
|
+
transparent: true,
|
|
653
|
+
style: {
|
|
654
|
+
padding: 10
|
|
655
|
+
}
|
|
656
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
657
|
+
theme: "h2",
|
|
658
|
+
style: {
|
|
659
|
+
marginBottom: 10
|
|
660
|
+
}
|
|
661
|
+
}, "Deep Link Path"), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
662
|
+
type: "header",
|
|
663
|
+
style: {
|
|
664
|
+
padding: 12,
|
|
665
|
+
borderRadius: 8,
|
|
666
|
+
marginBottom: 8,
|
|
667
|
+
flexDirection: 'row',
|
|
668
|
+
alignItems: 'center',
|
|
669
|
+
justifyContent: 'space-between'
|
|
670
|
+
}
|
|
671
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
672
|
+
transparent: true,
|
|
673
|
+
style: {
|
|
674
|
+
flex: 1
|
|
675
|
+
}
|
|
676
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
677
|
+
theme: "h1",
|
|
678
|
+
style: {
|
|
679
|
+
marginBottom: 2
|
|
680
|
+
}
|
|
681
|
+
}, selectedPath?.label), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
682
|
+
theme: "description",
|
|
683
|
+
style: {
|
|
684
|
+
fontSize: 12
|
|
685
|
+
}
|
|
686
|
+
}, selectedPath?.path_name)), selectedPath?.primary && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
687
|
+
transparent: true,
|
|
688
|
+
style: {
|
|
689
|
+
paddingHorizontal: 8,
|
|
690
|
+
paddingVertical: 4,
|
|
691
|
+
borderRadius: 4
|
|
692
|
+
}
|
|
693
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
694
|
+
theme: "description",
|
|
695
|
+
color: Colors.text.white,
|
|
696
|
+
style: {
|
|
697
|
+
fontSize: 10
|
|
698
|
+
}
|
|
699
|
+
}, "Primary"))), /*#__PURE__*/_react.default.createElement(_Themed.TextInput, {
|
|
700
|
+
value: pathSearch,
|
|
701
|
+
placeholder: "Search paths to change...",
|
|
702
|
+
onFocusPosition: onFocusPosition,
|
|
703
|
+
onChangeText: setPathSearch,
|
|
704
|
+
style: {
|
|
705
|
+
padding: 12,
|
|
706
|
+
borderRadius: 8,
|
|
707
|
+
marginBottom: 8
|
|
708
|
+
}
|
|
709
|
+
}), pathSearch && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
710
|
+
float: true,
|
|
711
|
+
style: {
|
|
712
|
+
maxHeight: 300,
|
|
713
|
+
borderRadius: 8,
|
|
714
|
+
borderWidth: 1,
|
|
715
|
+
borderColor: Colors.borders.light
|
|
716
|
+
}
|
|
717
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, {
|
|
718
|
+
data: filteredPaths,
|
|
719
|
+
keyExtractor: item => item.path_name,
|
|
720
|
+
renderItem: ({
|
|
721
|
+
item
|
|
722
|
+
}) => /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
723
|
+
onPress: () => {
|
|
724
|
+
setSelectedPath(item);
|
|
725
|
+
setPathSearch('');
|
|
726
|
+
},
|
|
727
|
+
style: {
|
|
728
|
+
padding: 12,
|
|
729
|
+
borderBottomWidth: 1,
|
|
730
|
+
borderColor: Colors.borders.light
|
|
731
|
+
}
|
|
732
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
733
|
+
transparent: true,
|
|
734
|
+
style: {
|
|
735
|
+
flexDirection: 'row',
|
|
736
|
+
alignItems: 'center',
|
|
737
|
+
justifyContent: 'space-between'
|
|
738
|
+
}
|
|
739
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
740
|
+
transparent: true,
|
|
741
|
+
style: {
|
|
742
|
+
flex: 1
|
|
743
|
+
}
|
|
744
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
745
|
+
theme: "h2",
|
|
746
|
+
style: {
|
|
747
|
+
marginBottom: 2
|
|
748
|
+
}
|
|
749
|
+
}, item.label), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
750
|
+
theme: "description",
|
|
751
|
+
style: {
|
|
752
|
+
fontSize: 11
|
|
753
|
+
}
|
|
754
|
+
}, item.path_name)), item.primary && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
755
|
+
transparent: true,
|
|
756
|
+
style: {
|
|
757
|
+
paddingHorizontal: 6,
|
|
758
|
+
paddingVertical: 2,
|
|
759
|
+
borderRadius: 4,
|
|
760
|
+
marginLeft: 8
|
|
761
|
+
}
|
|
762
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
763
|
+
theme: "description",
|
|
764
|
+
color: Colors.text.white,
|
|
765
|
+
style: {
|
|
766
|
+
fontSize: 9
|
|
767
|
+
}
|
|
768
|
+
}, "Primary")))),
|
|
769
|
+
ListEmptyComponent: /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
770
|
+
style: {
|
|
771
|
+
padding: 20,
|
|
772
|
+
alignItems: 'center'
|
|
773
|
+
}
|
|
774
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
775
|
+
theme: "description"
|
|
776
|
+
}, "No paths found"))
|
|
777
|
+
}))), Object.keys(selectedPath?.params ?? {}).length > 0 && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
778
|
+
style: {
|
|
779
|
+
padding: 10
|
|
780
|
+
}
|
|
781
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
782
|
+
theme: "h2",
|
|
783
|
+
style: {
|
|
784
|
+
marginBottom: 8
|
|
785
|
+
}
|
|
786
|
+
}, "Path Parameters"), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
787
|
+
type: "header",
|
|
788
|
+
style: {
|
|
789
|
+
padding: 12,
|
|
790
|
+
borderRadius: 8
|
|
791
|
+
}
|
|
792
|
+
}, Object.keys(selectedPath?.params ?? {}).map(paramKey => {
|
|
793
|
+
const isRequired = selectedPath?.requiredParams.includes(paramKey);
|
|
794
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
795
|
+
key: paramKey,
|
|
796
|
+
transparent: true,
|
|
797
|
+
style: {
|
|
798
|
+
marginBottom: 12
|
|
799
|
+
}
|
|
800
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
801
|
+
transparent: true,
|
|
802
|
+
style: {
|
|
803
|
+
flexDirection: 'row',
|
|
804
|
+
alignItems: 'center',
|
|
805
|
+
marginBottom: 4
|
|
806
|
+
}
|
|
807
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
808
|
+
theme: "description"
|
|
809
|
+
}, paramKey), isRequired ? /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
810
|
+
transparent: true,
|
|
811
|
+
style: {
|
|
812
|
+
marginLeft: 4,
|
|
813
|
+
paddingHorizontal: 6,
|
|
814
|
+
paddingVertical: 2,
|
|
815
|
+
backgroundColor: Colors.text.error,
|
|
816
|
+
borderRadius: 4
|
|
817
|
+
}
|
|
818
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
819
|
+
theme: "description",
|
|
820
|
+
color: Colors.text.white,
|
|
821
|
+
style: {
|
|
822
|
+
fontSize: 10
|
|
823
|
+
}
|
|
824
|
+
}, "Required")) : /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
825
|
+
transparent: true,
|
|
826
|
+
style: {
|
|
827
|
+
marginLeft: 4,
|
|
828
|
+
paddingHorizontal: 6,
|
|
829
|
+
paddingVertical: 2,
|
|
830
|
+
backgroundColor: Colors.borders.light,
|
|
831
|
+
borderRadius: 4
|
|
832
|
+
}
|
|
833
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
834
|
+
theme: "description",
|
|
835
|
+
style: {
|
|
836
|
+
fontSize: 10
|
|
837
|
+
}
|
|
838
|
+
}, "Optional"))), /*#__PURE__*/_react.default.createElement(_Themed.TextInput, {
|
|
839
|
+
value: pathParams[paramKey] || '',
|
|
840
|
+
onFocusPosition: onFocusPosition,
|
|
841
|
+
placeholder: `Enter ${paramKey}${isRequired ? ' (required)' : ' (optional)'}`,
|
|
842
|
+
onChangeText: value => setPathParams({
|
|
843
|
+
...pathParams,
|
|
844
|
+
[paramKey]: value
|
|
845
|
+
}),
|
|
846
|
+
style: {
|
|
847
|
+
padding: 10,
|
|
848
|
+
borderRadius: 8,
|
|
849
|
+
borderWidth: isRequired ? 2 : 1,
|
|
850
|
+
borderColor: isRequired && !pathParams[paramKey] ? Colors.text.error : Colors.borders.light
|
|
851
|
+
}
|
|
852
|
+
}));
|
|
853
|
+
})))), selectedPath?.path_name === 'custom' && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
854
|
+
style: {
|
|
855
|
+
marginBottom: 20
|
|
856
|
+
}
|
|
857
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
858
|
+
theme: "h2",
|
|
859
|
+
style: {
|
|
860
|
+
marginBottom: 8
|
|
861
|
+
}
|
|
862
|
+
}, "Custom Path Name"), /*#__PURE__*/_react.default.createElement(_Themed.TextInput, {
|
|
863
|
+
value: customPathName,
|
|
864
|
+
onFocusPosition: onFocusPosition,
|
|
865
|
+
placeholder: "/your/custom/path",
|
|
866
|
+
onChangeText: setCustomPathName,
|
|
867
|
+
style: {
|
|
868
|
+
padding: 12,
|
|
869
|
+
borderRadius: 8
|
|
870
|
+
}
|
|
871
|
+
}))));
|
|
872
|
+
default:
|
|
873
|
+
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null);
|
|
874
|
+
}
|
|
875
|
+
};
|
|
876
|
+
return /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
877
|
+
style: {
|
|
878
|
+
flex: 1
|
|
879
|
+
}
|
|
880
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
881
|
+
transparent: true,
|
|
882
|
+
style: {
|
|
883
|
+
flex: 1
|
|
884
|
+
}
|
|
885
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, {
|
|
886
|
+
data: sections,
|
|
887
|
+
keyExtractor: item => item,
|
|
888
|
+
key: 'notification_manager_list',
|
|
889
|
+
renderItem: renderSections
|
|
890
|
+
})), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
891
|
+
type: "footer",
|
|
892
|
+
style: {
|
|
893
|
+
flexDirection: 'row',
|
|
894
|
+
alignItems: 'center',
|
|
895
|
+
padding: 10,
|
|
896
|
+
borderBottomRightRadius: 8,
|
|
897
|
+
borderBottomLeftRadius: 8
|
|
898
|
+
}
|
|
899
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
900
|
+
type: "action",
|
|
901
|
+
disabled: loading,
|
|
902
|
+
loading: loading,
|
|
903
|
+
onPress: () => confirmSendNotification({
|
|
904
|
+
test: true
|
|
905
|
+
}),
|
|
906
|
+
style: {
|
|
907
|
+
flex: 1,
|
|
908
|
+
opacity: loading || isValid().length > 0 ? 0.5 : 1
|
|
909
|
+
}
|
|
910
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
911
|
+
textAlign: "center",
|
|
912
|
+
theme: "h1",
|
|
913
|
+
color: Colors.text.white
|
|
914
|
+
}, loading ? sendingProgress ? `Sending ${sendingProgress.current}/${sendingProgress.total}` : 'Sending...' : 'Send Test')), /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
915
|
+
type: "success",
|
|
916
|
+
disabled: loading,
|
|
917
|
+
loading: loading,
|
|
918
|
+
onPress: () => confirmSendNotification(),
|
|
919
|
+
style: {
|
|
920
|
+
flex: 2,
|
|
921
|
+
marginLeft: 5,
|
|
922
|
+
opacity: loading || isValid().length > 0 ? 0.5 : 1
|
|
923
|
+
}
|
|
924
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
925
|
+
textAlign: "center",
|
|
926
|
+
theme: "h1",
|
|
927
|
+
color: Colors.text.white
|
|
928
|
+
}, loading ? sendingProgress ? `Sending batch ${sendingProgress.current} of ${sendingProgress.total}` : 'Sending...' : 'Send Notification'))), showGroupsModal && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
929
|
+
type: "blur",
|
|
930
|
+
style: {
|
|
931
|
+
position: 'absolute',
|
|
932
|
+
top: 0,
|
|
933
|
+
left: 0,
|
|
934
|
+
right: 0,
|
|
935
|
+
bottom: 0,
|
|
936
|
+
padding: 20
|
|
937
|
+
}
|
|
938
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
939
|
+
float: true,
|
|
940
|
+
style: {
|
|
941
|
+
flex: 1
|
|
942
|
+
}
|
|
943
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
944
|
+
type: "header",
|
|
945
|
+
style: {
|
|
946
|
+
flexDirection: 'row',
|
|
947
|
+
alignItems: 'center',
|
|
948
|
+
padding: 10,
|
|
949
|
+
borderTopRightRadius: 8,
|
|
950
|
+
borderTopLeftRadius: 8
|
|
951
|
+
}
|
|
952
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
953
|
+
transparent: true,
|
|
954
|
+
style: {
|
|
955
|
+
flex: 1
|
|
956
|
+
}
|
|
957
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
958
|
+
theme: "h1"
|
|
959
|
+
}, "Notification Groups"), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
960
|
+
theme: "description",
|
|
961
|
+
style: {
|
|
962
|
+
marginTop: 3
|
|
963
|
+
}
|
|
964
|
+
}, "Select a group to send to"))), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
965
|
+
style: {
|
|
966
|
+
flex: 1
|
|
967
|
+
}
|
|
968
|
+
}, loadingGroups ? /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
969
|
+
style: {
|
|
970
|
+
padding: 40,
|
|
971
|
+
alignItems: 'center'
|
|
972
|
+
}
|
|
973
|
+
}, /*#__PURE__*/_react.default.createElement(_reactNative.ActivityIndicator, {
|
|
974
|
+
size: "large",
|
|
975
|
+
color: Colors.text.action
|
|
976
|
+
})) : /*#__PURE__*/_react.default.createElement(_reactNative.FlatList, {
|
|
977
|
+
data: customGroup ? [customGroup, ...notificationGroups] : notificationGroups,
|
|
978
|
+
keyExtractor: item => item.notification_group_id,
|
|
979
|
+
renderItem: ({
|
|
980
|
+
item
|
|
981
|
+
}) => /*#__PURE__*/_react.default.createElement(_reactNative.TouchableOpacity, {
|
|
982
|
+
onPress: () => handleSelectGroup(item.notification_group_id),
|
|
983
|
+
style: {
|
|
984
|
+
padding: 15,
|
|
985
|
+
borderBottomWidth: 1,
|
|
986
|
+
borderColor: Colors.borders.light,
|
|
987
|
+
backgroundColor: item.notification_group_id === 'custom_group' ? Colors.views.header : 'transparent'
|
|
988
|
+
}
|
|
989
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
990
|
+
transparent: true
|
|
991
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
992
|
+
transparent: true,
|
|
993
|
+
style: {
|
|
994
|
+
flexDirection: 'row',
|
|
995
|
+
alignItems: 'center',
|
|
996
|
+
justifyContent: 'space-between'
|
|
997
|
+
}
|
|
998
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
999
|
+
transparent: true,
|
|
1000
|
+
style: {
|
|
1001
|
+
flexDirection: 'row',
|
|
1002
|
+
alignItems: 'center',
|
|
1003
|
+
flex: 1
|
|
1004
|
+
}
|
|
1005
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
1006
|
+
theme: "h1"
|
|
1007
|
+
}, item.name), item.notification_group_id === 'custom_group' && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
1008
|
+
transparent: true,
|
|
1009
|
+
style: {
|
|
1010
|
+
marginLeft: 8,
|
|
1011
|
+
paddingHorizontal: 6,
|
|
1012
|
+
paddingVertical: 2,
|
|
1013
|
+
backgroundColor: Colors.buttons.background.action,
|
|
1014
|
+
borderRadius: 4
|
|
1015
|
+
}
|
|
1016
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
1017
|
+
theme: "description",
|
|
1018
|
+
color: Colors.text.white,
|
|
1019
|
+
style: {
|
|
1020
|
+
fontSize: 10
|
|
1021
|
+
}
|
|
1022
|
+
}, "CUSTOM"))), item.player_count !== undefined && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
1023
|
+
transparent: true,
|
|
1024
|
+
style: {
|
|
1025
|
+
marginLeft: 8,
|
|
1026
|
+
paddingHorizontal: 8,
|
|
1027
|
+
paddingVertical: 4,
|
|
1028
|
+
backgroundColor: Colors.views.header,
|
|
1029
|
+
borderRadius: 4
|
|
1030
|
+
}
|
|
1031
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
1032
|
+
theme: "description",
|
|
1033
|
+
style: {
|
|
1034
|
+
fontSize: 12,
|
|
1035
|
+
fontWeight: '600'
|
|
1036
|
+
}
|
|
1037
|
+
}, item.player_count.toLocaleString(), " users"))), item.description && /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
1038
|
+
theme: "description",
|
|
1039
|
+
style: {
|
|
1040
|
+
marginTop: 4
|
|
1041
|
+
}
|
|
1042
|
+
}, item.description))),
|
|
1043
|
+
ListEmptyComponent: /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
1044
|
+
style: {
|
|
1045
|
+
padding: 40,
|
|
1046
|
+
alignItems: 'center'
|
|
1047
|
+
}
|
|
1048
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
1049
|
+
theme: "description"
|
|
1050
|
+
}, "No groups found"))
|
|
1051
|
+
})), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
1052
|
+
type: "footer",
|
|
1053
|
+
style: {
|
|
1054
|
+
flexDirection: 'row',
|
|
1055
|
+
alignItems: 'center',
|
|
1056
|
+
padding: 10,
|
|
1057
|
+
borderBottomRightRadius: 8,
|
|
1058
|
+
borderBottomLeftRadius: 8
|
|
1059
|
+
}
|
|
1060
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
1061
|
+
style: {
|
|
1062
|
+
flex: 1
|
|
1063
|
+
},
|
|
1064
|
+
type: "close",
|
|
1065
|
+
title: "CLOSE",
|
|
1066
|
+
onPress: () => setShowGroupsModal(false)
|
|
1067
|
+
})))), showEditCustomGroupModal && /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
1068
|
+
type: "blur",
|
|
1069
|
+
style: {
|
|
1070
|
+
position: 'absolute',
|
|
1071
|
+
top: 0,
|
|
1072
|
+
left: 0,
|
|
1073
|
+
right: 0,
|
|
1074
|
+
bottom: 0,
|
|
1075
|
+
padding: 20
|
|
1076
|
+
}
|
|
1077
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
1078
|
+
float: true,
|
|
1079
|
+
style: {
|
|
1080
|
+
maxHeight: '80%',
|
|
1081
|
+
minHeight: 400
|
|
1082
|
+
}
|
|
1083
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
1084
|
+
type: "header",
|
|
1085
|
+
style: {
|
|
1086
|
+
flexDirection: 'row',
|
|
1087
|
+
alignItems: 'center',
|
|
1088
|
+
padding: 10,
|
|
1089
|
+
borderTopRightRadius: 8,
|
|
1090
|
+
borderTopLeftRadius: 8
|
|
1091
|
+
}
|
|
1092
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
1093
|
+
transparent: true,
|
|
1094
|
+
style: {
|
|
1095
|
+
flex: 1
|
|
1096
|
+
}
|
|
1097
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
1098
|
+
theme: "h1"
|
|
1099
|
+
}, "Edit Custom Recipients"), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
1100
|
+
theme: "description",
|
|
1101
|
+
style: {
|
|
1102
|
+
marginTop: 3
|
|
1103
|
+
}
|
|
1104
|
+
}, "Paste comma-separated player IDs"))), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
1105
|
+
style: {
|
|
1106
|
+
flex: 1,
|
|
1107
|
+
padding: 15
|
|
1108
|
+
}
|
|
1109
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
1110
|
+
theme: "h2",
|
|
1111
|
+
style: {
|
|
1112
|
+
marginBottom: 10
|
|
1113
|
+
}
|
|
1114
|
+
}, "Player IDs (CSV format)"), /*#__PURE__*/_react.default.createElement(_Themed.TextInput, {
|
|
1115
|
+
value: customGroupCsv,
|
|
1116
|
+
onFocusPosition: onFocusPosition,
|
|
1117
|
+
placeholder: "98,100,2485,etc",
|
|
1118
|
+
onChangeText: setCustomGroupCsv,
|
|
1119
|
+
multiline: true,
|
|
1120
|
+
numberOfLines: 10,
|
|
1121
|
+
style: {
|
|
1122
|
+
padding: 12,
|
|
1123
|
+
borderRadius: 8,
|
|
1124
|
+
minHeight: 200,
|
|
1125
|
+
textAlignVertical: 'top'
|
|
1126
|
+
}
|
|
1127
|
+
}), /*#__PURE__*/_react.default.createElement(_Themed.Text, {
|
|
1128
|
+
theme: "description",
|
|
1129
|
+
style: {
|
|
1130
|
+
marginTop: 8
|
|
1131
|
+
}
|
|
1132
|
+
}, "Current count: ", customGroupCsv.split(',').filter(id => id.trim().length > 0).length, " IDs")), /*#__PURE__*/_react.default.createElement(_Themed.View, {
|
|
1133
|
+
type: "footer",
|
|
1134
|
+
style: {
|
|
1135
|
+
flexDirection: 'row',
|
|
1136
|
+
alignItems: 'center',
|
|
1137
|
+
padding: 10,
|
|
1138
|
+
borderBottomRightRadius: 8,
|
|
1139
|
+
borderBottomLeftRadius: 8
|
|
1140
|
+
}
|
|
1141
|
+
}, /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
1142
|
+
style: {
|
|
1143
|
+
flex: 1,
|
|
1144
|
+
marginRight: 5
|
|
1145
|
+
},
|
|
1146
|
+
type: "close",
|
|
1147
|
+
title: "CANCEL",
|
|
1148
|
+
onPress: () => setShowEditCustomGroupModal(false)
|
|
1149
|
+
}), /*#__PURE__*/_react.default.createElement(_Themed.Button, {
|
|
1150
|
+
style: {
|
|
1151
|
+
flex: 1
|
|
1152
|
+
},
|
|
1153
|
+
type: "success",
|
|
1154
|
+
title: "SAVE",
|
|
1155
|
+
onPress: handleSaveCustomGroup
|
|
1156
|
+
})))));
|
|
1157
|
+
};
|
|
1158
|
+
var _default = exports.default = NotificationManager;
|
|
1159
|
+
//# sourceMappingURL=index.js.map
|