@controleonline/ui-crm 1.0.44 → 1.0.45

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 (43) hide show
  1. package/.github/workflows/integration-source-gate.yml +1 -15
  2. package/.github/workflows/manager-worker.yml +155 -7
  3. package/.github/workflows/publish-npm.yml +22 -73
  4. package/AGENTS.md +0 -2
  5. package/package.json +2 -2
  6. package/src/react/pages/crm/hooks/useCrmData.js +17 -23
  7. package/src/react/pages/mcp/McpPage.js +301 -0
  8. package/src/react/pages/mcp/McpPage.styles.js +116 -0
  9. package/src/react/pages/proposals/CreateProposalsModal.js +0 -1
  10. package/src/react/pages/proposals/index.js +33 -14
  11. package/src/react/pages/settings/GeneralSettings.js +17 -9
  12. package/src/react/pages/settings/GeneralSettings.shared.js +20 -20
  13. package/src/react/pages/settings/GeneralSettings.styles.js +0 -2
  14. package/src/react/pages/settings/sections/AiProvidersSection.js +263 -0
  15. package/src/react/pages/settings/sections/DeviceRuntimeFooterSection.js +11 -11
  16. package/src/react/pages/settings/sections/IntegrationsSection.js +17 -17
  17. package/src/react/pages/settings/sections/LogSection.js +10 -10
  18. package/src/react/pages/settings/sections/LoginSection.js +13 -13
  19. package/src/react/pages/settings/sections/LoyaltyProductPicker.js +145 -58
  20. package/src/react/pages/settings/sections/LoyaltySection.js +9 -35
  21. package/src/react/pages/settings/sections/MaintenanceSection.js +16 -16
  22. package/src/react/pages/settings/sections/MapsSection.js +257 -81
  23. package/src/react/pages/settings/sections/ShopSection.js +2 -2
  24. package/src/react/pages/settings/sections/shop/ShopFranchiseLocatorSection.js +28 -7
  25. package/src/react/pages/settings/sections/shop/ShopLoyaltySection.js +8 -54
  26. package/src/react/pages/settings/sections/shop/shopSettingsShared.js +11 -32
  27. package/src/react/router/routes.js +14 -0
  28. package/src/react/utils/proposalProductSelection.js +13 -103
  29. package/src/tests/browser/crm/create-proposal-product-category-filter.spec.js +0 -25
  30. package/src/tests/browser/manager/general-settings-maps.spec.js +347 -173
  31. package/src/tests/react/utils/proposalProductSelection.test.js +1 -57
  32. package/src/react/pages/settings/sections/MapsFranchisePreview.js +0 -102
  33. package/src/react/pages/settings/sections/MapsMapasControls.js +0 -262
  34. package/src/react/pages/settings/sections/loyaltyProductCompany.js +0 -57
  35. package/src/react/pages/settings/sections/mapsSectionHelpers.js +0 -137
  36. package/src/react/utils/clientDetailsNavigation.js +0 -56
  37. package/src/react/utils/clientSellerVisibility.js +0 -60
  38. package/src/react/utils/proposalStatus.js +0 -160
  39. package/src/tests/react/pages/settings/sections/loyaltyProductCompany.test.js +0 -41
  40. package/src/tests/react/pages/settings/sections/mapsSectionHelpers.test.js +0 -38
  41. package/src/tests/react/utils/clientDetailsNavigation.test.js +0 -98
  42. package/src/tests/react/utils/clientSellerVisibility.test.js +0 -74
  43. package/src/tests/react/utils/proposalStatus.test.mjs +0 -77
@@ -0,0 +1,263 @@
1
+ /*
2
+ * @agents Company-scoped AI providers (Grok/Codex/Gemini/Claude) via /mcp/chat/config.
3
+ * Keys stay server-side; UI only shows masked values and optional system_prompt.
4
+ */
5
+ import React, {useCallback, useEffect, useState} from 'react';
6
+ import {
7
+ ActivityIndicator,
8
+ Switch,
9
+ Text,
10
+ TextInput,
11
+ TouchableOpacity,
12
+ View,
13
+ } from 'react-native';
14
+
15
+ import {api} from '@controleonline/ui-common/src/api';
16
+ import useToastMessage from '@controleonline/ui-crm/src/react/hooks/useToastMessage';
17
+
18
+ import {
19
+ useGeneralSettingsPalette,
20
+ useGeneralSettingsStyles,
21
+ } from '../GeneralSettings.styles';
22
+ import GeneralSettingsSection from '../GeneralSettingsSection';
23
+ import {useGeneralSettingsConfig} from '../GeneralSettings.shared';
24
+
25
+ const PROVIDER_ORDER = ['grok', 'openai', 'gemini', 'claude'];
26
+ const PROVIDER_TITLES = {
27
+ grok: 'Grok (xAI)',
28
+ openai: 'Codex / OpenAI',
29
+ gemini: 'Gemini',
30
+ claude: 'Claude',
31
+ };
32
+
33
+ const emptyProvider = () => ({
34
+ enabled: false,
35
+ model: '',
36
+ base_url: '',
37
+ system_prompt: '',
38
+ api_key: '',
39
+ has_key: false,
40
+ api_key_masked: null,
41
+ });
42
+
43
+ const AiProvidersSection = () => {
44
+ const localStyles = useGeneralSettingsStyles();
45
+ const themePalette = useGeneralSettingsPalette();
46
+ const {showError, showSuccess} = useToastMessage();
47
+ const {defaultCompany, hasDefaultCompanyAccess, isMainCompanySelected} =
48
+ useGeneralSettingsConfig();
49
+
50
+ const companyId = defaultCompany?.id || null;
51
+ const [loading, setLoading] = useState(true);
52
+ const [saving, setSaving] = useState(false);
53
+ const [providers, setProviders] = useState(() => {
54
+ const init = {};
55
+ PROVIDER_ORDER.forEach(k => {
56
+ init[k] = emptyProvider();
57
+ });
58
+ return init;
59
+ });
60
+
61
+ const load = useCallback(async () => {
62
+ if (!companyId) {
63
+ setLoading(false);
64
+ return;
65
+ }
66
+ setLoading(true);
67
+ try {
68
+ const res = await api.fetch('/mcp/chat/config', {
69
+ params: {company_id: Number(companyId)},
70
+ });
71
+ const remote = res?.providers || {};
72
+ const next = {};
73
+ PROVIDER_ORDER.forEach(k => {
74
+ const r = remote[k] || {};
75
+ next[k] = {
76
+ enabled: !!r.enabled,
77
+ model: String(r.model || ''),
78
+ base_url: String(r.base_url || ''),
79
+ system_prompt: String(r.system_prompt || ''),
80
+ api_key: '',
81
+ has_key: !!r.has_key,
82
+ api_key_masked: r.api_key_masked || null,
83
+ };
84
+ });
85
+ setProviders(next);
86
+ } catch (e) {
87
+ showError(e?.message || 'Falha ao carregar providers de IA');
88
+ } finally {
89
+ setLoading(false);
90
+ }
91
+ }, [companyId, showError]);
92
+
93
+ useEffect(() => {
94
+ load();
95
+ }, [load]);
96
+
97
+ const updateField = (key, field, value) => {
98
+ setProviders(prev => ({
99
+ ...prev,
100
+ [key]: {...prev[key], [field]: value},
101
+ }));
102
+ };
103
+
104
+ const save = useCallback(async () => {
105
+ if (!hasDefaultCompanyAccess || !companyId) {
106
+ showError('Empresa nao identificada para salvar providers de IA.');
107
+ return;
108
+ }
109
+ if (!isMainCompanySelected) {
110
+ showError('Abra as configuracoes da empresa principal para editar as IAs.');
111
+ return;
112
+ }
113
+ setSaving(true);
114
+ try {
115
+ const payload = {};
116
+ PROVIDER_ORDER.forEach(k => {
117
+ const p = providers[k] || emptyProvider();
118
+ payload[k] = {
119
+ enabled: !!p.enabled,
120
+ model: String(p.model || '').trim(),
121
+ base_url: String(p.base_url || '').trim(),
122
+ system_prompt: String(p.system_prompt || ''),
123
+ api_key: String(p.api_key || '').trim(),
124
+ };
125
+ });
126
+ await api.put('/mcp/chat/config', {
127
+ company_id: Number(companyId),
128
+ providers: payload,
129
+ });
130
+ showSuccess('Providers de IA salvos.');
131
+ await load();
132
+ } catch (e) {
133
+ showError(e?.message || 'Falha ao salvar providers de IA');
134
+ } finally {
135
+ setSaving(false);
136
+ }
137
+ }, [
138
+ companyId,
139
+ hasDefaultCompanyAccess,
140
+ isMainCompanySelected,
141
+ load,
142
+ providers,
143
+ showError,
144
+ showSuccess,
145
+ ]);
146
+
147
+ const editable = hasDefaultCompanyAccess && isMainCompanySelected && !saving;
148
+
149
+ return (
150
+ <GeneralSettingsSection
151
+ title="Inteligencia Artificial / MCP"
152
+ description="Configure Grok, Codex/OpenAI, Gemini e Claude por empresa. A chave nao volta em claro no GET. O prompt inicial e enviado em toda conversa do /mcp.">
153
+ {!hasDefaultCompanyAccess ? (
154
+ <Text style={localStyles.helperText}>
155
+ Sem acesso a empresa padrao para editar configs.
156
+ </Text>
157
+ ) : loading ? (
158
+ <ActivityIndicator style={{marginTop: 12}} />
159
+ ) : (
160
+ <View>
161
+ {PROVIDER_ORDER.map(key => {
162
+ const p = providers[key] || emptyProvider();
163
+ return (
164
+ <View key={key} style={{marginBottom: 20}}>
165
+ <View
166
+ style={{
167
+ flexDirection: 'row',
168
+ alignItems: 'center',
169
+ justifyContent: 'space-between',
170
+ marginBottom: 8,
171
+ }}>
172
+ <Text style={localStyles.sectionTitle}>
173
+ {PROVIDER_TITLES[key] || key}
174
+ </Text>
175
+ <Switch
176
+ value={!!p.enabled}
177
+ onValueChange={v => updateField(key, 'enabled', v)}
178
+ disabled={!editable}
179
+ />
180
+ </View>
181
+ <Text style={localStyles.fieldLabel}>API key</Text>
182
+ <TextInput
183
+ style={[
184
+ localStyles.input,
185
+ !editable && localStyles.inputDisabled,
186
+ ]}
187
+ value={p.api_key}
188
+ onChangeText={v => updateField(key, 'api_key', v)}
189
+ placeholder={
190
+ p.has_key
191
+ ? p.api_key_masked || '•••• (mantem a atual se vazio)'
192
+ : 'Cole a API key'
193
+ }
194
+ editable={editable}
195
+ autoCapitalize="none"
196
+ autoCorrect={false}
197
+ secureTextEntry
198
+ />
199
+ <Text style={localStyles.fieldLabel}>Modelo</Text>
200
+ <TextInput
201
+ style={[
202
+ localStyles.input,
203
+ !editable && localStyles.inputDisabled,
204
+ ]}
205
+ value={p.model}
206
+ onChangeText={v => updateField(key, 'model', v)}
207
+ placeholder="ex.: grok-4, gpt-4.1, gemini-2.0-flash"
208
+ editable={editable}
209
+ autoCapitalize="none"
210
+ autoCorrect={false}
211
+ />
212
+ <Text style={localStyles.fieldLabel}>Base URL (opcional)</Text>
213
+ <TextInput
214
+ style={[
215
+ localStyles.input,
216
+ !editable && localStyles.inputDisabled,
217
+ ]}
218
+ value={p.base_url}
219
+ onChangeText={v => updateField(key, 'base_url', v)}
220
+ placeholder="Padrao do provider se vazio"
221
+ editable={editable}
222
+ autoCapitalize="none"
223
+ autoCorrect={false}
224
+ />
225
+ <Text style={localStyles.fieldLabel}>Prompt inicial</Text>
226
+ <TextInput
227
+ style={[
228
+ localStyles.input,
229
+ !editable && localStyles.inputDisabled,
230
+ {minHeight: 80, textAlignVertical: 'top'},
231
+ ]}
232
+ value={p.system_prompt}
233
+ onChangeText={v => updateField(key, 'system_prompt', v)}
234
+ placeholder="Instrucoes fixas para esta IA (opcional)"
235
+ editable={editable}
236
+ multiline
237
+ />
238
+ </View>
239
+ );
240
+ })}
241
+ <TouchableOpacity
242
+ onPress={save}
243
+ disabled={!editable || saving}
244
+ style={{
245
+ marginTop: 8,
246
+ paddingVertical: 12,
247
+ paddingHorizontal: 16,
248
+ borderRadius: 8,
249
+ backgroundColor: themePalette?.primary || '#1976d2',
250
+ opacity: !editable || saving ? 0.5 : 1,
251
+ alignSelf: 'flex-start',
252
+ }}>
253
+ <Text style={{color: '#fff', fontWeight: '600'}}>
254
+ {saving ? 'Salvando…' : 'Salvar providers de IA'}
255
+ </Text>
256
+ </TouchableOpacity>
257
+ </View>
258
+ )}
259
+ </GeneralSettingsSection>
260
+ );
261
+ };
262
+
263
+ export default AiProvidersSection;
@@ -21,25 +21,25 @@ const DeviceRuntimeFooterSection = () => {
21
21
  const themePalette = useGeneralSettingsPalette();
22
22
  const {
23
23
  configActions,
24
- mainCompany,
25
- mainCompanyLabel,
26
- hasMainCompanyAccess,
24
+ defaultCompany,
25
+ defaultCompanyLabel,
26
+ hasDefaultCompanyAccess,
27
27
  isMainCompanySelected,
28
28
  peopleActions,
29
29
  } = useGeneralSettingsConfig();
30
30
  const [deviceRuntimeFooterText, setDeviceRuntimeFooterText] = useState('');
31
- const canEditFooterText = !!mainCompany?.id && hasMainCompanyAccess;
31
+ const canEditFooterText = !!defaultCompany?.id && hasDefaultCompanyAccess;
32
32
 
33
33
  useEffect(() => {
34
34
  setDeviceRuntimeFooterText(
35
35
  normalizeRuntimeFooterText(
36
- mainCompany?.configs?.[DEVICE_RUNTIME_FOOTER_TEXT_CONFIG_KEY],
36
+ defaultCompany?.configs?.[DEVICE_RUNTIME_FOOTER_TEXT_CONFIG_KEY],
37
37
  ),
38
38
  );
39
- }, [mainCompany?.configs]);
39
+ }, [defaultCompany?.configs]);
40
40
 
41
41
  const saveDeviceRuntimeFooter = useCallback(() => {
42
- if (!mainCompany?.id) {
42
+ if (!defaultCompany?.id) {
43
43
  Alert.alert(
44
44
  'Empresa principal indisponivel',
45
45
  'Nao foi possivel identificar a empresa principal para salvar o rodape.',
@@ -55,7 +55,7 @@ const DeviceRuntimeFooterSection = () => {
55
55
  .addConfigs({
56
56
  configKey: DEVICE_RUNTIME_FOOTER_TEXT_CONFIG_KEY,
57
57
  configValue: toConfigRequestValue(normalizedText),
58
- people: '/people/' + mainCompany.id,
58
+ people: '/people/' + defaultCompany.id,
59
59
  module: 4,
60
60
  visibility: 'public',
61
61
  })
@@ -63,7 +63,7 @@ const DeviceRuntimeFooterSection = () => {
63
63
  setDeviceRuntimeFooterText(normalizedText);
64
64
 
65
65
  try {
66
- await peopleActions.mainCompany();
66
+ await peopleActions.defaultCompany();
67
67
  } catch {}
68
68
 
69
69
  resolve(true);
@@ -79,7 +79,7 @@ const DeviceRuntimeFooterSection = () => {
79
79
  });
80
80
  }, [
81
81
  configActions,
82
- mainCompany?.id,
82
+ defaultCompany?.id,
83
83
  deviceRuntimeFooterText,
84
84
  peopleActions,
85
85
  ]);
@@ -92,7 +92,7 @@ const DeviceRuntimeFooterSection = () => {
92
92
  iconColor={themePalette.cardIconColor}
93
93
  title="Rodape dos devices">
94
94
  <Text style={localStyles.helperText}>
95
- {`Esse texto livre e salvo na empresa principal (${mainCompanyLabel}) e compartilhado com todos os devices.`}
95
+ {`Esse texto livre e salvo na empresa principal (${defaultCompanyLabel}) e compartilhado com todos os devices.`}
96
96
  </Text>
97
97
 
98
98
  {!isMainCompanySelected && (
@@ -68,9 +68,9 @@ const IntegrationsSection = () => {
68
68
  const {showError, showSuccess} = useToastMessage();
69
69
  const {
70
70
  configActions,
71
- mainCompany,
72
- mainCompanyLabel,
73
- hasMainCompanyAccess,
71
+ defaultCompany,
72
+ defaultCompanyLabel,
73
+ hasDefaultCompanyAccess,
74
74
  isMainCompanySelected,
75
75
  isSaving,
76
76
  peopleActions,
@@ -87,7 +87,7 @@ const IntegrationsSection = () => {
87
87
  * This is the only place in the section that reads the company-scoped private payload remotely.
88
88
  */
89
89
  useEffect(() => {
90
- if (!hasMainCompanyAccess || !mainCompany?.id) {
90
+ if (!hasDefaultCompanyAccess || !defaultCompany?.id) {
91
91
  setPrivateConfigs({});
92
92
  setIsLoadingPrivateConfigs(false);
93
93
  return undefined;
@@ -99,7 +99,7 @@ const IntegrationsSection = () => {
99
99
  api
100
100
  .fetch('/configs', {
101
101
  params: {
102
- people: '/people/' + mainCompany.id,
102
+ people: '/people/' + defaultCompany.id,
103
103
  visibility: 'private',
104
104
  },
105
105
  })
@@ -142,7 +142,7 @@ const IntegrationsSection = () => {
142
142
  return () => {
143
143
  cancelled = true;
144
144
  };
145
- }, [mainCompany?.id, hasMainCompanyAccess, showError]);
145
+ }, [defaultCompany?.id, hasDefaultCompanyAccess, showError]);
146
146
 
147
147
  useEffect(() => {
148
148
  setCieloConfig(resolveCieloConfig(privateConfigs));
@@ -152,7 +152,7 @@ const IntegrationsSection = () => {
152
152
 
153
153
  const savePrivateConfig = useCallback(
154
154
  (configKey, configValue) => {
155
- if (!hasMainCompanyAccess || !mainCompany?.id) {
155
+ if (!hasDefaultCompanyAccess || !defaultCompany?.id) {
156
156
  showError(
157
157
  'Nao foi possivel identificar a empresa principal para salvar a integracao.',
158
158
  );
@@ -161,7 +161,7 @@ const IntegrationsSection = () => {
161
161
 
162
162
  if (!isMainCompanySelected) {
163
163
  showError(
164
- `Abra a empresa principal (${mainCompanyLabel}) para editar essas credenciais.`,
164
+ `Abra a empresa principal (${defaultCompanyLabel}) para editar essas credenciais.`,
165
165
  );
166
166
  return Promise.resolve(false);
167
167
  }
@@ -172,7 +172,7 @@ const IntegrationsSection = () => {
172
172
  .addConfigs({
173
173
  configKey,
174
174
  configValue: toConfigRequestValue(configValue),
175
- people: '/people/' + mainCompany.id,
175
+ people: '/people/' + defaultCompany.id,
176
176
  module: 4,
177
177
  visibility: 'private',
178
178
  })
@@ -183,7 +183,7 @@ const IntegrationsSection = () => {
183
183
  }));
184
184
 
185
185
  try {
186
- await peopleActions.mainCompany();
186
+ await peopleActions.defaultCompany();
187
187
  } catch {}
188
188
 
189
189
  showSuccess('Configuracao tecnica salva com sucesso.');
@@ -201,9 +201,9 @@ const IntegrationsSection = () => {
201
201
  },
202
202
  [
203
203
  configActions,
204
- mainCompany?.id,
205
- mainCompanyLabel,
206
- hasMainCompanyAccess,
204
+ defaultCompany?.id,
205
+ defaultCompanyLabel,
206
+ hasDefaultCompanyAccess,
207
207
  isMainCompanySelected,
208
208
  peopleActions,
209
209
  showError,
@@ -225,8 +225,8 @@ const IntegrationsSection = () => {
225
225
  );
226
226
 
227
227
  const editable =
228
- hasMainCompanyAccess &&
229
- !!mainCompany?.id &&
228
+ hasDefaultCompanyAccess &&
229
+ !!defaultCompany?.id &&
230
230
  isMainCompanySelected &&
231
231
  !isSaving &&
232
232
  !isLoadingPrivateConfigs;
@@ -242,9 +242,9 @@ const IntegrationsSection = () => {
242
242
  iconColor={themePalette.cardIconColor}
243
243
  title="Cielo">
244
244
  <Text style={localStyles.helperText}>
245
- {`Esses dados privados ficam vinculados a empresa principal (${mainCompanyLabel}).`}
245
+ {`Esses dados privados ficam vinculados a empresa principal (${defaultCompanyLabel}).`}
246
246
  </Text>
247
- {!isMainCompanySelected && hasMainCompanyAccess && (
247
+ {!isMainCompanySelected && hasDefaultCompanyAccess && (
248
248
  <Text style={localStyles.helperText}>
249
249
  Abra a empresa principal para editar as credenciais. Fora dela esta
250
250
  tela fica somente para consulta.
@@ -108,8 +108,8 @@ const LogSection = () => {
108
108
  const {showError, showSuccess} = useToastMessage();
109
109
  const {
110
110
  currentCompany,
111
- mainCompany,
112
- mainCompanyLabel,
111
+ defaultCompany,
112
+ defaultCompanyLabel,
113
113
  effectiveCompanyConfigs,
114
114
  isMainCompanySelected,
115
115
  isSaving,
@@ -122,8 +122,8 @@ const LogSection = () => {
122
122
  return effectiveCompanyConfigs;
123
123
  }
124
124
 
125
- return mainCompany?.configs || {};
126
- }, [mainCompany?.configs, effectiveCompanyConfigs, isMainCompanySelected]);
125
+ return defaultCompany?.configs || {};
126
+ }, [defaultCompany?.configs, effectiveCompanyConfigs, isMainCompanySelected]);
127
127
 
128
128
  const [emailAlertsEnabled, setEmailAlertsEnabled] = useState(false);
129
129
  const [recipientInput, setRecipientInput] = useState('');
@@ -150,9 +150,9 @@ const LogSection = () => {
150
150
  nextLogPolicy = logPolicy,
151
151
  nextRecipientInput = recipientInput,
152
152
  } = {}) => {
153
- if (!mainCompany?.id || !isMainCompanySelected) {
153
+ if (!defaultCompany?.id || !isMainCompanySelected) {
154
154
  showError(
155
- `Abra a empresa principal (${mainCompanyLabel}) para editar as configuracoes de log.`,
155
+ `Abra a empresa principal (${defaultCompanyLabel}) para editar as configuracoes de log.`,
156
156
  );
157
157
  return false;
158
158
  }
@@ -188,15 +188,15 @@ const LogSection = () => {
188
188
  }
189
189
 
190
190
  try {
191
- await peopleActions.mainCompany();
191
+ await peopleActions.defaultCompany();
192
192
  } catch {}
193
193
 
194
194
  showSuccess('Configuracoes de log salvas com sucesso.');
195
195
  return true;
196
196
  },
197
197
  [
198
- mainCompany?.id,
199
- mainCompanyLabel,
198
+ defaultCompany?.id,
199
+ defaultCompanyLabel,
200
200
  emailAlertsEnabled,
201
201
  isMainCompanySelected,
202
202
  logPolicy,
@@ -242,7 +242,7 @@ const LogSection = () => {
242
242
  iconColor={themePalette.cardIconColor}
243
243
  title="Logs e alertas">
244
244
  <Text style={localStyles.helperText}>
245
- {`Essas configuracoes sao globais e ficam vinculadas a empresa principal (${mainCompanyLabel}).`}
245
+ {`Essas configuracoes sao globais e ficam vinculadas a empresa principal (${defaultCompanyLabel}).`}
246
246
  </Text>
247
247
 
248
248
  {!isMainCompanySelected && (
@@ -24,9 +24,9 @@ const LoginSection = () => {
24
24
  const {showError, showSuccess} = useToastMessage();
25
25
  const {
26
26
  configActions,
27
- mainCompany,
28
- mainCompanyLabel,
29
- hasMainCompanyAccess,
27
+ defaultCompany,
28
+ defaultCompanyLabel,
29
+ hasDefaultCompanyAccess,
30
30
  isMainCompanySelected,
31
31
  peopleActions,
32
32
  } = useGeneralSettingsConfig();
@@ -34,11 +34,11 @@ const LoginSection = () => {
34
34
  const [googleClientId, setGoogleClientId] = useState('');
35
35
 
36
36
  useEffect(() => {
37
- setGoogleClientId(resolveCompanyGoogleOauthClientId(mainCompany));
38
- }, [mainCompany?.configs]);
37
+ setGoogleClientId(resolveCompanyGoogleOauthClientId(defaultCompany));
38
+ }, [defaultCompany?.configs]);
39
39
 
40
40
  const saveGoogleOauthConfig = useCallback(() => {
41
- if (!hasMainCompanyAccess || !mainCompany?.id) {
41
+ if (!hasDefaultCompanyAccess || !defaultCompany?.id) {
42
42
  showError(
43
43
  'Nao foi possivel identificar a empresa principal para salvar o login Google.',
44
44
  );
@@ -60,7 +60,7 @@ const LoginSection = () => {
60
60
  .addConfigs({
61
61
  configKey: OAUTH_GOOGLE_CLIENT_ID_CONFIG_KEY,
62
62
  configValue: toConfigRequestValue(normalizedGoogleClientId),
63
- people: '/people/' + mainCompany.id,
63
+ people: '/people/' + defaultCompany.id,
64
64
  module: 4,
65
65
  visibility: 'public',
66
66
  })
@@ -68,7 +68,7 @@ const LoginSection = () => {
68
68
  setGoogleClientId(normalizedGoogleClientId);
69
69
 
70
70
  try {
71
- await peopleActions.mainCompany();
71
+ await peopleActions.defaultCompany();
72
72
  } catch {}
73
73
 
74
74
  showSuccess('Google OAuth salvo com sucesso.');
@@ -85,8 +85,8 @@ const LoginSection = () => {
85
85
  });
86
86
  }, [
87
87
  configActions,
88
- mainCompany?.id,
89
- hasMainCompanyAccess,
88
+ defaultCompany?.id,
89
+ hasDefaultCompanyAccess,
90
90
  googleClientId,
91
91
  isMainCompanySelected,
92
92
  peopleActions,
@@ -102,7 +102,7 @@ const LoginSection = () => {
102
102
  iconColor={themePalette.cardIconColor}
103
103
  title="Login e autenticacao">
104
104
  <Text style={localStyles.helperText}>
105
- {`Esse client ID e salvo na empresa principal (${mainCompanyLabel}) e controla quando o botao "Entrar com Google" aparece no login web.`}
105
+ {`Esse client ID e salvo na empresa principal (${defaultCompanyLabel}) e controla quando o botao "Entrar com Google" aparece no login web.`}
106
106
  </Text>
107
107
 
108
108
  {!isMainCompanySelected && (
@@ -115,13 +115,13 @@ const LoginSection = () => {
115
115
  <TextInput
116
116
  style={[
117
117
  localStyles.input,
118
- (!mainCompany?.id || !isMainCompanySelected) &&
118
+ (!defaultCompany?.id || !isMainCompanySelected) &&
119
119
  localStyles.inputDisabled,
120
120
  ]}
121
121
  value={googleClientId}
122
122
  onChangeText={setGoogleClientId}
123
123
  onBlur={saveGoogleOauthConfig}
124
- editable={!!mainCompany?.id && isMainCompanySelected}
124
+ editable={!!defaultCompany?.id && isMainCompanySelected}
125
125
  autoCapitalize="none"
126
126
  autoCorrect={false}
127
127
  placeholder="1234567890-abc123def456.apps.googleusercontent.com"