@controleonline/ui-common 1.2.133 → 1.2.135

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.
Files changed (52) hide show
  1. package/.release/rc-manifest.json +12 -6
  2. package/package.json +1 -1
  3. package/src/react/components/CategoryForm.js +539 -539
  4. package/src/react/components/DefaultProvider.native.js +2 -2
  5. package/src/react/components/DefaultProvider.web.js +2 -2
  6. package/src/react/components/integrations/IntegrationHero/index.js +1 -1
  7. package/src/react/components/integrations/IntegrationHero/styles.js +2 -2
  8. package/src/react/components/integrations/IntegrationTabs/index.js +1 -1
  9. package/src/react/components/integrations/IntegrationTabs/styles.js +1 -1
  10. package/src/react/pages/Connections.styles.js +72 -72
  11. package/src/react/pages/Devices/detail/DeviceDetailHeader.js +1 -1
  12. package/src/react/pages/Devices/detail/DeviceDetailMovementSections.js +1 -1
  13. package/src/react/pages/Devices/detail/useDeviceDetailStateA.js +2 -2
  14. package/src/react/pages/Devices/detail/useDeviceDetailStateB.js +2 -2
  15. package/src/react/pages/Devices/deviceTypes/DeviceGroupCard.js +1 -1
  16. package/src/react/pages/Devices/deviceTypes/shared.js +2 -2
  17. package/src/react/pages/Devices.js +2 -2
  18. package/src/react/pages/Devices.styles.js +353 -353
  19. package/src/react/pages/Food99IntegrationPage/components/Food99CatalogTab.js +219 -219
  20. package/src/react/pages/Food99IntegrationPage/components/Food99OverviewTab.js +134 -134
  21. package/src/react/pages/Food99IntegrationPage/components/Food99PreviewModal.js +173 -173
  22. package/src/react/pages/Food99IntegrationPage/components/Food99QuickWalletModal.js +1 -1
  23. package/src/react/pages/Food99IntegrationPage/components/Food99SettingsTab.js +306 -306
  24. package/src/react/pages/Food99IntegrationPage/components/Food99StoreTab.js +417 -417
  25. package/src/react/pages/Food99IntegrationPage/index.js +1530 -1530
  26. package/src/react/pages/Food99IntegrationPage/styles.js +792 -792
  27. package/src/react/pages/IFoodIntegrationPage/components/IFoodOperationsTab.js +267 -267
  28. package/src/react/pages/IFoodIntegrationPage/components/IFoodOverviewTab.js +118 -118
  29. package/src/react/pages/IFoodIntegrationPage/components/IFoodPreviewModal.js +101 -101
  30. package/src/react/pages/IFoodIntegrationPage/components/IFoodStoreTab.js +150 -150
  31. package/src/react/pages/IFoodIntegrationPage/index.js +1298 -1298
  32. package/src/react/pages/Imports.js +1 -1
  33. package/src/react/pages/Imports.styles.js +223 -223
  34. package/src/react/pages/IntegrationConfigPage.js +2 -2
  35. package/src/react/pages/Integrations.js +2 -15
  36. package/src/react/pages/Integrations.styles.js +130 -130
  37. package/src/react/pages/LinkedInIntegrationPage.js +2 -2
  38. package/src/react/pages/ManagerOrderNotificationsPage.js +642 -642
  39. package/src/react/pages/MarketplaceIntegrationPage/components/MarketplaceProductCard.js +205 -205
  40. package/src/react/pages/MercadoLivreIntegrationPage.js +2 -2
  41. package/src/react/pages/PrinterDeviceDetailPage.js +1915 -1915
  42. package/src/react/pages/PrinterDeviceFormPage.js +2 -2
  43. package/src/react/pages/WhatsAppConnectionPage.js +51 -0
  44. package/src/react/pages/WhatsAppConnectionPage.styles.js +315 -279
  45. package/src/react/pages/WhatsAppProviderForm.js +39 -1
  46. package/src/react/pages/whatsAppConnectionHelpers.js +38 -10
  47. package/src/react/pages/whatsAppEmbeddedSignup.js +133 -0
  48. package/src/react/router/__tests__/publicRoutes.test.js +12 -0
  49. package/src/react/router/publicRoutes.js +3 -0
  50. package/src/react/utils/fileUrl.js +1 -1
  51. package/src/store/connections/customActions.js +51 -14
  52. package/src/store/connections/index.js +109 -105
@@ -1,417 +1,417 @@
1
- import React from 'react';
2
- import { ActivityIndicator, Text, TextInput, TouchableOpacity, View } from 'react-native';
3
- import Icon from 'react-native-vector-icons/Feather';
4
- import { colors } from '@controleonline/../../src/styles/colors';
5
-
6
- import { withOpacity } from '@controleonline/../../src/styles/branding';
7
-
8
- import styles from '../styles';
9
-
10
- const resolveButtonPalette = (palette, accentColor) => {
11
- const primaryBackground =
12
- palette.buttonBackground || accentColor || palette.primary;
13
- const primaryBorder = palette.buttonBorder || primaryBackground;
14
- const primaryText = palette.buttonText || palette.white;
15
- const primaryIcon = palette.buttonIcon || primaryText;
16
- const secondaryBackground =
17
- palette.buttonBackgroundSecondary || palette.white;
18
- const secondaryBorder = palette.buttonBorderSecondary || palette.border;
19
- const secondaryText = palette.buttonTextSecondary || palette.textSecondary;
20
- const secondaryIcon = palette.buttonIconSecondary || secondaryText;
21
- const disabledBackground =
22
- palette.buttonDisabledBackground || secondaryBorder;
23
- const disabledText = palette.buttonDisabledText || secondaryText;
24
-
25
- return {
26
- primaryBackground,
27
- primaryBorder,
28
- primaryText,
29
- primaryIcon,
30
- secondaryBackground,
31
- secondaryBorder,
32
- secondaryText,
33
- secondaryIcon,
34
- disabledBackground,
35
- disabledText,
36
- };
37
- };
38
-
39
- // Aba dedicada ao vínculo da loja e ao status operacional remoto.
40
- export default function Food99StoreTab({
41
- shadowStyle,
42
- accentColor,
43
- statusRows,
44
- lastMenuPublishState,
45
- publicationTone,
46
- publishStateLabel,
47
- lastMenuTaskMessage,
48
- lastErrorMessage,
49
- actionLoading,
50
- connected,
51
- needsReconnect,
52
- isOnline,
53
- onRefresh,
54
- onConnect,
55
- onToggleStatus,
56
- onSyncOrders,
57
- onSyncTodayHistory,
58
- manualShopId,
59
- setManualShopId,
60
- onManualBind,
61
- onDisconnect,
62
- palette = colors,
63
- }) {
64
- const buttonPalette = resolveButtonPalette(palette, accentColor);
65
-
66
- return (
67
- <>
68
- <View style={[styles.panel, shadowStyle]}>
69
- <View style={styles.panelHeader}>
70
- <Text style={styles.panelTitle}>Status da loja</Text>
71
- <TouchableOpacity
72
- style={[
73
- styles.inlineAction,
74
- {
75
- borderWidth: 1,
76
- borderColor: buttonPalette.secondaryBorder,
77
- backgroundColor: buttonPalette.secondaryBackground,
78
- },
79
- ]}
80
- onPress={onRefresh}
81
- disabled={actionLoading === 'refresh'}>
82
- <Icon
83
- name="refresh-cw"
84
- size={14}
85
- color={buttonPalette.secondaryIcon}
86
- />
87
- <Text
88
- style={[
89
- styles.inlineActionText,
90
- { color: buttonPalette.secondaryText },
91
- ]}>
92
- Atualizar
93
- </Text>
94
- </TouchableOpacity>
95
- </View>
96
-
97
- {!!lastMenuPublishState && (
98
- <View style={[styles.infoBanner, { backgroundColor: withOpacity(publicationTone, 0.12) }]}>
99
- <Icon
100
- name={
101
- lastMenuPublishState === 'failed'
102
- ? 'alert-triangle'
103
- : lastMenuPublishState === 'published'
104
- ? 'check-circle'
105
- : 'clock'
106
- }
107
- size={14}
108
- color={publicationTone}
109
- />
110
- <Text style={[styles.infoBannerText, { color: publicationTone }]}>
111
- {publishStateLabel}
112
- {lastMenuTaskMessage ? ` • ${lastMenuTaskMessage}` : ''}
113
- </Text>
114
- </View>
115
- )}
116
-
117
- {!!lastErrorMessage && lastMenuPublishState !== 'failed' && (
118
- <View style={styles.errorBanner}>
119
- <Icon name="alert-circle" size={14} color={palette.error} />
120
- <Text style={styles.errorBannerText}>{lastErrorMessage}</Text>
121
- </View>
122
- )}
123
-
124
- {needsReconnect && (
125
- <View style={[styles.infoBanner, { backgroundColor: withOpacity(palette.warning, 0.12) }]}>
126
- <Icon name="alert-triangle" size={14} color={palette.warning} />
127
- <Text style={[styles.infoBannerText, { color: palette.warning }]}>
128
- A conexão remota da loja caiu. Refaça a reconexão para restaurar os webhooks.
129
- </Text>
130
- </View>
131
- )}
132
-
133
- <View style={styles.statusRows}>
134
- {statusRows.map(row => (
135
- <View
136
- key={row.label}
137
- style={[
138
- styles.statusRowItem,
139
- row.wide && styles.statusRowItemWide,
140
- ]}>
141
- <Text style={styles.statusRowLabel}>{row.label}</Text>
142
- <Text style={row.small ? styles.statusRowValueSmall : styles.statusRowValue}>{row.value}</Text>
143
- </View>
144
- ))}
145
- </View>
146
-
147
- <View style={styles.actionRow}>
148
- {!connected ? (
149
- <TouchableOpacity
150
- style={[
151
- styles.primaryButton,
152
- {
153
- borderWidth: 1,
154
- borderColor: buttonPalette.primaryBorder,
155
- backgroundColor: buttonPalette.primaryBackground,
156
- },
157
- actionLoading === 'connect' && {
158
- borderColor: buttonPalette.secondaryBorder,
159
- backgroundColor: buttonPalette.disabledBackground,
160
- },
161
- ]}
162
- onPress={onConnect}
163
- disabled={actionLoading === 'connect'}>
164
- {actionLoading === 'connect' ? (
165
- <ActivityIndicator
166
- size="small"
167
- color={buttonPalette.disabledText}
168
- />
169
- ) : (
170
- <>
171
- <Icon
172
- name="link-2"
173
- size={16}
174
- color={buttonPalette.primaryIcon}
175
- />
176
- <Text
177
- style={[
178
- styles.primaryButtonText,
179
- { color: buttonPalette.primaryText },
180
- ]}>
181
- Integrar loja
182
- </Text>
183
- </>
184
- )}
185
- </TouchableOpacity>
186
- ) : (
187
- <View style={styles.formRow}>
188
- {needsReconnect && (
189
- <TouchableOpacity
190
- style={[
191
- styles.secondaryActionButton,
192
- {
193
- flex: 1,
194
- borderColor: buttonPalette.secondaryBorder,
195
- backgroundColor: buttonPalette.secondaryBackground,
196
- },
197
- ]}
198
- onPress={onConnect}
199
- disabled={actionLoading === 'connect'}>
200
- {actionLoading === 'connect' ? (
201
- <ActivityIndicator
202
- size="small"
203
- color={buttonPalette.disabledText}
204
- />
205
- ) : (
206
- <>
207
- <Icon
208
- name="refresh-cw"
209
- size={15}
210
- color={buttonPalette.secondaryIcon}
211
- />
212
- <Text
213
- style={[
214
- styles.secondaryActionButtonText,
215
- { color: buttonPalette.secondaryText },
216
- ]}>
217
- Reconectar loja
218
- </Text>
219
- </>
220
- )}
221
- </TouchableOpacity>
222
- )}
223
-
224
- <TouchableOpacity
225
- style={[
226
- styles.primaryButton,
227
- {
228
- flex: 1,
229
- borderWidth: 1,
230
- borderColor: buttonPalette.primaryBorder,
231
- backgroundColor: buttonPalette.primaryBackground,
232
- },
233
- (actionLoading === 'online' || actionLoading === 'offline') && {
234
- borderColor: buttonPalette.secondaryBorder,
235
- backgroundColor: buttonPalette.disabledBackground,
236
- },
237
- ]}
238
- onPress={onToggleStatus}
239
- disabled={actionLoading === 'online' || actionLoading === 'offline'}>
240
- {actionLoading === 'online' || actionLoading === 'offline' ? (
241
- <ActivityIndicator
242
- size="small"
243
- color={buttonPalette.disabledText}
244
- />
245
- ) : (
246
- <>
247
- <Icon
248
- name={isOnline ? 'pause-circle' : 'play-circle'}
249
- size={16}
250
- color={buttonPalette.primaryIcon}
251
- />
252
- <Text
253
- style={[
254
- styles.primaryButtonText,
255
- { color: buttonPalette.primaryText },
256
- ]}>
257
- {isOnline ? 'Colocar offline' : 'Colocar online'}
258
- </Text>
259
- </>
260
- )}
261
- </TouchableOpacity>
262
- </View>
263
- )}
264
- </View>
265
-
266
- {connected && (
267
- <View style={styles.formRow}>
268
- <TouchableOpacity
269
- style={[
270
- styles.secondaryActionButton,
271
- {
272
- flex: 1,
273
- borderColor: buttonPalette.secondaryBorder,
274
- backgroundColor: buttonPalette.secondaryBackground,
275
- },
276
- ]}
277
- onPress={onSyncOrders}
278
- disabled={actionLoading === 'sync-orders'}>
279
- {actionLoading === 'sync-orders' ? (
280
- <ActivityIndicator
281
- size="small"
282
- color={buttonPalette.disabledText}
283
- />
284
- ) : (
285
- <>
286
- <Icon
287
- name="refresh-cw"
288
- size={15}
289
- color={buttonPalette.secondaryIcon}
290
- />
291
- <Text
292
- style={[
293
- styles.secondaryActionButtonText,
294
- { color: buttonPalette.secondaryText },
295
- ]}>
296
- Sincronizar pedidos
297
- </Text>
298
- </>
299
- )}
300
- </TouchableOpacity>
301
-
302
- <TouchableOpacity
303
- style={[
304
- styles.secondaryActionButton,
305
- {
306
- flex: 1,
307
- borderColor: buttonPalette.secondaryBorder,
308
- backgroundColor: buttonPalette.secondaryBackground,
309
- },
310
- ]}
311
- onPress={onSyncTodayHistory}
312
- disabled={actionLoading === 'sync-history'}>
313
- {actionLoading === 'sync-history' ? (
314
- <ActivityIndicator
315
- size="small"
316
- color={buttonPalette.disabledText}
317
- />
318
- ) : (
319
- <>
320
- <Icon
321
- name="clock"
322
- size={15}
323
- color={buttonPalette.secondaryIcon}
324
- />
325
- <Text
326
- style={[
327
- styles.secondaryActionButtonText,
328
- { color: buttonPalette.secondaryText },
329
- ]}>
330
- Histórico de hoje
331
- </Text>
332
- </>
333
- )}
334
- </TouchableOpacity>
335
- </View>
336
- )}
337
- </View>
338
-
339
- <View style={[styles.panel, shadowStyle]}>
340
- <View style={styles.panelHeader}>
341
- <View>
342
- <Text style={styles.panelTitle}>Conexao da loja</Text>
343
- <Text style={styles.panelSubtitle}>
344
- Separei o vínculo manual e a desconexão para não misturar com as configurações operacionais.
345
- </Text>
346
- </View>
347
- </View>
348
-
349
- {!connected ? (
350
- <>
351
- <View style={styles.formField}>
352
- <Text style={styles.formLabel}>Conectar manualmente por shop_id</Text>
353
- <TextInput
354
- value={manualShopId}
355
- onChangeText={setManualShopId}
356
- placeholder="Informe o shop_id da 99Food"
357
- style={styles.formInput}
358
- placeholderTextColor={palette.textSecondary}
359
- />
360
- </View>
361
-
362
- <View style={styles.formRow}>
363
- <TouchableOpacity
364
- style={[
365
- styles.secondaryActionButton,
366
- {
367
- borderColor: buttonPalette.secondaryBorder,
368
- backgroundColor: buttonPalette.secondaryBackground,
369
- },
370
- ]}
371
- onPress={onManualBind}
372
- disabled={actionLoading === 'bind-manual'}>
373
- {actionLoading === 'bind-manual' ? (
374
- <ActivityIndicator
375
- size="small"
376
- color={buttonPalette.disabledText}
377
- />
378
- ) : (
379
- <>
380
- <Icon
381
- name="link"
382
- size={15}
383
- color={buttonPalette.secondaryIcon}
384
- />
385
- <Text
386
- style={[
387
- styles.secondaryActionButtonText,
388
- { color: buttonPalette.secondaryText },
389
- ]}>
390
- Vincular shop_id
391
- </Text>
392
- </>
393
- )}
394
- </TouchableOpacity>
395
- </View>
396
- </>
397
- ) : (
398
- <View style={styles.formRow}>
399
- <TouchableOpacity
400
- style={[styles.secondaryActionButton, styles.dangerActionButton]}
401
- onPress={onDisconnect}
402
- disabled={actionLoading === 'disconnect'}>
403
- {actionLoading === 'disconnect' ? (
404
- <ActivityIndicator size="small" color={palette.error} />
405
- ) : (
406
- <>
407
- <Icon name="unlink" size={15} color={palette.error} />
408
- <Text style={[styles.secondaryActionButtonText, { color: palette.error }]}>Desconectar</Text>
409
- </>
410
- )}
411
- </TouchableOpacity>
412
- </View>
413
- )}
414
- </View>
415
- </>
416
- );
417
- }
1
+ import React from 'react';
2
+ import { ActivityIndicator, Text, TextInput, TouchableOpacity, View } from 'react-native';
3
+ import Icon from 'react-native-vector-icons/Feather';
4
+ import { colors } from '@controleonline/ui-layout/src/styles/colors';
5
+
6
+ import { withOpacity } from '@controleonline/ui-layout/src/styles/branding';
7
+
8
+ import styles from '../styles';
9
+
10
+ const resolveButtonPalette = (palette, accentColor) => {
11
+ const primaryBackground =
12
+ palette.buttonBackground || accentColor || palette.primary;
13
+ const primaryBorder = palette.buttonBorder || primaryBackground;
14
+ const primaryText = palette.buttonText || palette.white;
15
+ const primaryIcon = palette.buttonIcon || primaryText;
16
+ const secondaryBackground =
17
+ palette.buttonBackgroundSecondary || palette.white;
18
+ const secondaryBorder = palette.buttonBorderSecondary || palette.border;
19
+ const secondaryText = palette.buttonTextSecondary || palette.textSecondary;
20
+ const secondaryIcon = palette.buttonIconSecondary || secondaryText;
21
+ const disabledBackground =
22
+ palette.buttonDisabledBackground || secondaryBorder;
23
+ const disabledText = palette.buttonDisabledText || secondaryText;
24
+
25
+ return {
26
+ primaryBackground,
27
+ primaryBorder,
28
+ primaryText,
29
+ primaryIcon,
30
+ secondaryBackground,
31
+ secondaryBorder,
32
+ secondaryText,
33
+ secondaryIcon,
34
+ disabledBackground,
35
+ disabledText,
36
+ };
37
+ };
38
+
39
+ // Aba dedicada ao vínculo da loja e ao status operacional remoto.
40
+ export default function Food99StoreTab({
41
+ shadowStyle,
42
+ accentColor,
43
+ statusRows,
44
+ lastMenuPublishState,
45
+ publicationTone,
46
+ publishStateLabel,
47
+ lastMenuTaskMessage,
48
+ lastErrorMessage,
49
+ actionLoading,
50
+ connected,
51
+ needsReconnect,
52
+ isOnline,
53
+ onRefresh,
54
+ onConnect,
55
+ onToggleStatus,
56
+ onSyncOrders,
57
+ onSyncTodayHistory,
58
+ manualShopId,
59
+ setManualShopId,
60
+ onManualBind,
61
+ onDisconnect,
62
+ palette = colors,
63
+ }) {
64
+ const buttonPalette = resolveButtonPalette(palette, accentColor);
65
+
66
+ return (
67
+ <>
68
+ <View style={[styles.panel, shadowStyle]}>
69
+ <View style={styles.panelHeader}>
70
+ <Text style={styles.panelTitle}>Status da loja</Text>
71
+ <TouchableOpacity
72
+ style={[
73
+ styles.inlineAction,
74
+ {
75
+ borderWidth: 1,
76
+ borderColor: buttonPalette.secondaryBorder,
77
+ backgroundColor: buttonPalette.secondaryBackground,
78
+ },
79
+ ]}
80
+ onPress={onRefresh}
81
+ disabled={actionLoading === 'refresh'}>
82
+ <Icon
83
+ name="refresh-cw"
84
+ size={14}
85
+ color={buttonPalette.secondaryIcon}
86
+ />
87
+ <Text
88
+ style={[
89
+ styles.inlineActionText,
90
+ { color: buttonPalette.secondaryText },
91
+ ]}>
92
+ Atualizar
93
+ </Text>
94
+ </TouchableOpacity>
95
+ </View>
96
+
97
+ {!!lastMenuPublishState && (
98
+ <View style={[styles.infoBanner, { backgroundColor: withOpacity(publicationTone, 0.12) }]}>
99
+ <Icon
100
+ name={
101
+ lastMenuPublishState === 'failed'
102
+ ? 'alert-triangle'
103
+ : lastMenuPublishState === 'published'
104
+ ? 'check-circle'
105
+ : 'clock'
106
+ }
107
+ size={14}
108
+ color={publicationTone}
109
+ />
110
+ <Text style={[styles.infoBannerText, { color: publicationTone }]}>
111
+ {publishStateLabel}
112
+ {lastMenuTaskMessage ? ` • ${lastMenuTaskMessage}` : ''}
113
+ </Text>
114
+ </View>
115
+ )}
116
+
117
+ {!!lastErrorMessage && lastMenuPublishState !== 'failed' && (
118
+ <View style={styles.errorBanner}>
119
+ <Icon name="alert-circle" size={14} color={palette.error} />
120
+ <Text style={styles.errorBannerText}>{lastErrorMessage}</Text>
121
+ </View>
122
+ )}
123
+
124
+ {needsReconnect && (
125
+ <View style={[styles.infoBanner, { backgroundColor: withOpacity(palette.warning, 0.12) }]}>
126
+ <Icon name="alert-triangle" size={14} color={palette.warning} />
127
+ <Text style={[styles.infoBannerText, { color: palette.warning }]}>
128
+ A conexão remota da loja caiu. Refaça a reconexão para restaurar os webhooks.
129
+ </Text>
130
+ </View>
131
+ )}
132
+
133
+ <View style={styles.statusRows}>
134
+ {statusRows.map(row => (
135
+ <View
136
+ key={row.label}
137
+ style={[
138
+ styles.statusRowItem,
139
+ row.wide && styles.statusRowItemWide,
140
+ ]}>
141
+ <Text style={styles.statusRowLabel}>{row.label}</Text>
142
+ <Text style={row.small ? styles.statusRowValueSmall : styles.statusRowValue}>{row.value}</Text>
143
+ </View>
144
+ ))}
145
+ </View>
146
+
147
+ <View style={styles.actionRow}>
148
+ {!connected ? (
149
+ <TouchableOpacity
150
+ style={[
151
+ styles.primaryButton,
152
+ {
153
+ borderWidth: 1,
154
+ borderColor: buttonPalette.primaryBorder,
155
+ backgroundColor: buttonPalette.primaryBackground,
156
+ },
157
+ actionLoading === 'connect' && {
158
+ borderColor: buttonPalette.secondaryBorder,
159
+ backgroundColor: buttonPalette.disabledBackground,
160
+ },
161
+ ]}
162
+ onPress={onConnect}
163
+ disabled={actionLoading === 'connect'}>
164
+ {actionLoading === 'connect' ? (
165
+ <ActivityIndicator
166
+ size="small"
167
+ color={buttonPalette.disabledText}
168
+ />
169
+ ) : (
170
+ <>
171
+ <Icon
172
+ name="link-2"
173
+ size={16}
174
+ color={buttonPalette.primaryIcon}
175
+ />
176
+ <Text
177
+ style={[
178
+ styles.primaryButtonText,
179
+ { color: buttonPalette.primaryText },
180
+ ]}>
181
+ Integrar loja
182
+ </Text>
183
+ </>
184
+ )}
185
+ </TouchableOpacity>
186
+ ) : (
187
+ <View style={styles.formRow}>
188
+ {needsReconnect && (
189
+ <TouchableOpacity
190
+ style={[
191
+ styles.secondaryActionButton,
192
+ {
193
+ flex: 1,
194
+ borderColor: buttonPalette.secondaryBorder,
195
+ backgroundColor: buttonPalette.secondaryBackground,
196
+ },
197
+ ]}
198
+ onPress={onConnect}
199
+ disabled={actionLoading === 'connect'}>
200
+ {actionLoading === 'connect' ? (
201
+ <ActivityIndicator
202
+ size="small"
203
+ color={buttonPalette.disabledText}
204
+ />
205
+ ) : (
206
+ <>
207
+ <Icon
208
+ name="refresh-cw"
209
+ size={15}
210
+ color={buttonPalette.secondaryIcon}
211
+ />
212
+ <Text
213
+ style={[
214
+ styles.secondaryActionButtonText,
215
+ { color: buttonPalette.secondaryText },
216
+ ]}>
217
+ Reconectar loja
218
+ </Text>
219
+ </>
220
+ )}
221
+ </TouchableOpacity>
222
+ )}
223
+
224
+ <TouchableOpacity
225
+ style={[
226
+ styles.primaryButton,
227
+ {
228
+ flex: 1,
229
+ borderWidth: 1,
230
+ borderColor: buttonPalette.primaryBorder,
231
+ backgroundColor: buttonPalette.primaryBackground,
232
+ },
233
+ (actionLoading === 'online' || actionLoading === 'offline') && {
234
+ borderColor: buttonPalette.secondaryBorder,
235
+ backgroundColor: buttonPalette.disabledBackground,
236
+ },
237
+ ]}
238
+ onPress={onToggleStatus}
239
+ disabled={actionLoading === 'online' || actionLoading === 'offline'}>
240
+ {actionLoading === 'online' || actionLoading === 'offline' ? (
241
+ <ActivityIndicator
242
+ size="small"
243
+ color={buttonPalette.disabledText}
244
+ />
245
+ ) : (
246
+ <>
247
+ <Icon
248
+ name={isOnline ? 'pause-circle' : 'play-circle'}
249
+ size={16}
250
+ color={buttonPalette.primaryIcon}
251
+ />
252
+ <Text
253
+ style={[
254
+ styles.primaryButtonText,
255
+ { color: buttonPalette.primaryText },
256
+ ]}>
257
+ {isOnline ? 'Colocar offline' : 'Colocar online'}
258
+ </Text>
259
+ </>
260
+ )}
261
+ </TouchableOpacity>
262
+ </View>
263
+ )}
264
+ </View>
265
+
266
+ {connected && (
267
+ <View style={styles.formRow}>
268
+ <TouchableOpacity
269
+ style={[
270
+ styles.secondaryActionButton,
271
+ {
272
+ flex: 1,
273
+ borderColor: buttonPalette.secondaryBorder,
274
+ backgroundColor: buttonPalette.secondaryBackground,
275
+ },
276
+ ]}
277
+ onPress={onSyncOrders}
278
+ disabled={actionLoading === 'sync-orders'}>
279
+ {actionLoading === 'sync-orders' ? (
280
+ <ActivityIndicator
281
+ size="small"
282
+ color={buttonPalette.disabledText}
283
+ />
284
+ ) : (
285
+ <>
286
+ <Icon
287
+ name="refresh-cw"
288
+ size={15}
289
+ color={buttonPalette.secondaryIcon}
290
+ />
291
+ <Text
292
+ style={[
293
+ styles.secondaryActionButtonText,
294
+ { color: buttonPalette.secondaryText },
295
+ ]}>
296
+ Sincronizar pedidos
297
+ </Text>
298
+ </>
299
+ )}
300
+ </TouchableOpacity>
301
+
302
+ <TouchableOpacity
303
+ style={[
304
+ styles.secondaryActionButton,
305
+ {
306
+ flex: 1,
307
+ borderColor: buttonPalette.secondaryBorder,
308
+ backgroundColor: buttonPalette.secondaryBackground,
309
+ },
310
+ ]}
311
+ onPress={onSyncTodayHistory}
312
+ disabled={actionLoading === 'sync-history'}>
313
+ {actionLoading === 'sync-history' ? (
314
+ <ActivityIndicator
315
+ size="small"
316
+ color={buttonPalette.disabledText}
317
+ />
318
+ ) : (
319
+ <>
320
+ <Icon
321
+ name="clock"
322
+ size={15}
323
+ color={buttonPalette.secondaryIcon}
324
+ />
325
+ <Text
326
+ style={[
327
+ styles.secondaryActionButtonText,
328
+ { color: buttonPalette.secondaryText },
329
+ ]}>
330
+ Histórico de hoje
331
+ </Text>
332
+ </>
333
+ )}
334
+ </TouchableOpacity>
335
+ </View>
336
+ )}
337
+ </View>
338
+
339
+ <View style={[styles.panel, shadowStyle]}>
340
+ <View style={styles.panelHeader}>
341
+ <View>
342
+ <Text style={styles.panelTitle}>Conexao da loja</Text>
343
+ <Text style={styles.panelSubtitle}>
344
+ Separei o vínculo manual e a desconexão para não misturar com as configurações operacionais.
345
+ </Text>
346
+ </View>
347
+ </View>
348
+
349
+ {!connected ? (
350
+ <>
351
+ <View style={styles.formField}>
352
+ <Text style={styles.formLabel}>Conectar manualmente por shop_id</Text>
353
+ <TextInput
354
+ value={manualShopId}
355
+ onChangeText={setManualShopId}
356
+ placeholder="Informe o shop_id da 99Food"
357
+ style={styles.formInput}
358
+ placeholderTextColor={palette.textSecondary}
359
+ />
360
+ </View>
361
+
362
+ <View style={styles.formRow}>
363
+ <TouchableOpacity
364
+ style={[
365
+ styles.secondaryActionButton,
366
+ {
367
+ borderColor: buttonPalette.secondaryBorder,
368
+ backgroundColor: buttonPalette.secondaryBackground,
369
+ },
370
+ ]}
371
+ onPress={onManualBind}
372
+ disabled={actionLoading === 'bind-manual'}>
373
+ {actionLoading === 'bind-manual' ? (
374
+ <ActivityIndicator
375
+ size="small"
376
+ color={buttonPalette.disabledText}
377
+ />
378
+ ) : (
379
+ <>
380
+ <Icon
381
+ name="link"
382
+ size={15}
383
+ color={buttonPalette.secondaryIcon}
384
+ />
385
+ <Text
386
+ style={[
387
+ styles.secondaryActionButtonText,
388
+ { color: buttonPalette.secondaryText },
389
+ ]}>
390
+ Vincular shop_id
391
+ </Text>
392
+ </>
393
+ )}
394
+ </TouchableOpacity>
395
+ </View>
396
+ </>
397
+ ) : (
398
+ <View style={styles.formRow}>
399
+ <TouchableOpacity
400
+ style={[styles.secondaryActionButton, styles.dangerActionButton]}
401
+ onPress={onDisconnect}
402
+ disabled={actionLoading === 'disconnect'}>
403
+ {actionLoading === 'disconnect' ? (
404
+ <ActivityIndicator size="small" color={palette.error} />
405
+ ) : (
406
+ <>
407
+ <Icon name="unlink" size={15} color={palette.error} />
408
+ <Text style={[styles.secondaryActionButtonText, { color: palette.error }]}>Desconectar</Text>
409
+ </>
410
+ )}
411
+ </TouchableOpacity>
412
+ </View>
413
+ )}
414
+ </View>
415
+ </>
416
+ );
417
+ }