@controleonline/ui-crm 1.0.45 → 1.0.47

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.
@@ -44,10 +44,10 @@ const AiProvidersSection = () => {
44
44
  const localStyles = useGeneralSettingsStyles();
45
45
  const themePalette = useGeneralSettingsPalette();
46
46
  const {showError, showSuccess} = useToastMessage();
47
- const {defaultCompany, hasDefaultCompanyAccess, isMainCompanySelected} =
47
+ const {mainCompany, hasDefaultCompanyAccess, isMainCompanySelected} =
48
48
  useGeneralSettingsConfig();
49
49
 
50
- const companyId = defaultCompany?.id || null;
50
+ const companyId = mainCompany?.id || null;
51
51
  const [loading, setLoading] = useState(true);
52
52
  const [saving, setSaving] = useState(false);
53
53
  const [providers, setProviders] = useState(() => {
@@ -21,25 +21,25 @@ const DeviceRuntimeFooterSection = () => {
21
21
  const themePalette = useGeneralSettingsPalette();
22
22
  const {
23
23
  configActions,
24
- defaultCompany,
25
- defaultCompanyLabel,
24
+ mainCompany,
25
+ mainCompanyLabel,
26
26
  hasDefaultCompanyAccess,
27
27
  isMainCompanySelected,
28
28
  peopleActions,
29
29
  } = useGeneralSettingsConfig();
30
30
  const [deviceRuntimeFooterText, setDeviceRuntimeFooterText] = useState('');
31
- const canEditFooterText = !!defaultCompany?.id && hasDefaultCompanyAccess;
31
+ const canEditFooterText = !!mainCompany?.id && hasDefaultCompanyAccess;
32
32
 
33
33
  useEffect(() => {
34
34
  setDeviceRuntimeFooterText(
35
35
  normalizeRuntimeFooterText(
36
- defaultCompany?.configs?.[DEVICE_RUNTIME_FOOTER_TEXT_CONFIG_KEY],
36
+ mainCompany?.configs?.[DEVICE_RUNTIME_FOOTER_TEXT_CONFIG_KEY],
37
37
  ),
38
38
  );
39
- }, [defaultCompany?.configs]);
39
+ }, [mainCompany?.configs]);
40
40
 
41
41
  const saveDeviceRuntimeFooter = useCallback(() => {
42
- if (!defaultCompany?.id) {
42
+ if (!mainCompany?.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/' + defaultCompany.id,
58
+ people: '/people/' + mainCompany.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.defaultCompany();
66
+ await peopleActions.mainCompany();
67
67
  } catch {}
68
68
 
69
69
  resolve(true);
@@ -79,7 +79,7 @@ const DeviceRuntimeFooterSection = () => {
79
79
  });
80
80
  }, [
81
81
  configActions,
82
- defaultCompany?.id,
82
+ mainCompany?.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 (${defaultCompanyLabel}) e compartilhado com todos os devices.`}
95
+ {`Esse texto livre e salvo na empresa principal (${mainCompanyLabel}) e compartilhado com todos os devices.`}
96
96
  </Text>
97
97
 
98
98
  {!isMainCompanySelected && (
@@ -68,8 +68,8 @@ const IntegrationsSection = () => {
68
68
  const {showError, showSuccess} = useToastMessage();
69
69
  const {
70
70
  configActions,
71
- defaultCompany,
72
- defaultCompanyLabel,
71
+ mainCompany,
72
+ mainCompanyLabel,
73
73
  hasDefaultCompanyAccess,
74
74
  isMainCompanySelected,
75
75
  isSaving,
@@ -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 (!hasDefaultCompanyAccess || !defaultCompany?.id) {
90
+ if (!hasDefaultCompanyAccess || !mainCompany?.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/' + defaultCompany.id,
102
+ people: '/people/' + mainCompany.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
- }, [defaultCompany?.id, hasDefaultCompanyAccess, showError]);
145
+ }, [mainCompany?.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 (!hasDefaultCompanyAccess || !defaultCompany?.id) {
155
+ if (!hasDefaultCompanyAccess || !mainCompany?.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 (${defaultCompanyLabel}) para editar essas credenciais.`,
164
+ `Abra a empresa principal (${mainCompanyLabel}) 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/' + defaultCompany.id,
175
+ people: '/people/' + mainCompany.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.defaultCompany();
186
+ await peopleActions.mainCompany();
187
187
  } catch {}
188
188
 
189
189
  showSuccess('Configuracao tecnica salva com sucesso.');
@@ -201,8 +201,8 @@ const IntegrationsSection = () => {
201
201
  },
202
202
  [
203
203
  configActions,
204
- defaultCompany?.id,
205
- defaultCompanyLabel,
204
+ mainCompany?.id,
205
+ mainCompanyLabel,
206
206
  hasDefaultCompanyAccess,
207
207
  isMainCompanySelected,
208
208
  peopleActions,
@@ -226,7 +226,7 @@ const IntegrationsSection = () => {
226
226
 
227
227
  const editable =
228
228
  hasDefaultCompanyAccess &&
229
- !!defaultCompany?.id &&
229
+ !!mainCompany?.id &&
230
230
  isMainCompanySelected &&
231
231
  !isSaving &&
232
232
  !isLoadingPrivateConfigs;
@@ -242,7 +242,7 @@ 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 (${defaultCompanyLabel}).`}
245
+ {`Esses dados privados ficam vinculados a empresa principal (${mainCompanyLabel}).`}
246
246
  </Text>
247
247
  {!isMainCompanySelected && hasDefaultCompanyAccess && (
248
248
  <Text style={localStyles.helperText}>
@@ -108,8 +108,8 @@ const LogSection = () => {
108
108
  const {showError, showSuccess} = useToastMessage();
109
109
  const {
110
110
  currentCompany,
111
- defaultCompany,
112
- defaultCompanyLabel,
111
+ mainCompany,
112
+ mainCompanyLabel,
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 defaultCompany?.configs || {};
126
- }, [defaultCompany?.configs, effectiveCompanyConfigs, isMainCompanySelected]);
125
+ return mainCompany?.configs || {};
126
+ }, [mainCompany?.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 (!defaultCompany?.id || !isMainCompanySelected) {
153
+ if (!mainCompany?.id || !isMainCompanySelected) {
154
154
  showError(
155
- `Abra a empresa principal (${defaultCompanyLabel}) para editar as configuracoes de log.`,
155
+ `Abra a empresa principal (${mainCompanyLabel}) 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.defaultCompany();
191
+ await peopleActions.mainCompany();
192
192
  } catch {}
193
193
 
194
194
  showSuccess('Configuracoes de log salvas com sucesso.');
195
195
  return true;
196
196
  },
197
197
  [
198
- defaultCompany?.id,
199
- defaultCompanyLabel,
198
+ mainCompany?.id,
199
+ mainCompanyLabel,
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 (${defaultCompanyLabel}).`}
245
+ {`Essas configuracoes sao globais e ficam vinculadas a empresa principal (${mainCompanyLabel}).`}
246
246
  </Text>
247
247
 
248
248
  {!isMainCompanySelected && (
@@ -24,8 +24,8 @@ const LoginSection = () => {
24
24
  const {showError, showSuccess} = useToastMessage();
25
25
  const {
26
26
  configActions,
27
- defaultCompany,
28
- defaultCompanyLabel,
27
+ mainCompany,
28
+ mainCompanyLabel,
29
29
  hasDefaultCompanyAccess,
30
30
  isMainCompanySelected,
31
31
  peopleActions,
@@ -34,11 +34,11 @@ const LoginSection = () => {
34
34
  const [googleClientId, setGoogleClientId] = useState('');
35
35
 
36
36
  useEffect(() => {
37
- setGoogleClientId(resolveCompanyGoogleOauthClientId(defaultCompany));
38
- }, [defaultCompany?.configs]);
37
+ setGoogleClientId(resolveCompanyGoogleOauthClientId(mainCompany));
38
+ }, [mainCompany?.configs]);
39
39
 
40
40
  const saveGoogleOauthConfig = useCallback(() => {
41
- if (!hasDefaultCompanyAccess || !defaultCompany?.id) {
41
+ if (!hasDefaultCompanyAccess || !mainCompany?.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/' + defaultCompany.id,
63
+ people: '/people/' + mainCompany.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.defaultCompany();
71
+ await peopleActions.mainCompany();
72
72
  } catch {}
73
73
 
74
74
  showSuccess('Google OAuth salvo com sucesso.');
@@ -85,7 +85,7 @@ const LoginSection = () => {
85
85
  });
86
86
  }, [
87
87
  configActions,
88
- defaultCompany?.id,
88
+ mainCompany?.id,
89
89
  hasDefaultCompanyAccess,
90
90
  googleClientId,
91
91
  isMainCompanySelected,
@@ -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 (${defaultCompanyLabel}) e controla quando o botao "Entrar com Google" aparece no login web.`}
105
+ {`Esse client ID e salvo na empresa principal (${mainCompanyLabel}) 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
- (!defaultCompany?.id || !isMainCompanySelected) &&
118
+ (!mainCompany?.id || !isMainCompanySelected) &&
119
119
  localStyles.inputDisabled,
120
120
  ]}
121
121
  value={googleClientId}
122
122
  onChangeText={setGoogleClientId}
123
123
  onBlur={saveGoogleOauthConfig}
124
- editable={!!defaultCompany?.id && isMainCompanySelected}
124
+ editable={!!mainCompany?.id && isMainCompanySelected}
125
125
  autoCapitalize="none"
126
126
  autoCorrect={false}
127
127
  placeholder="1234567890-abc123def456.apps.googleusercontent.com"
@@ -26,8 +26,8 @@ const MaintenanceSection = () => {
26
26
  const themePalette = useGeneralSettingsPalette();
27
27
  const {showError, showSuccess} = useToastMessage();
28
28
  const {
29
- defaultCompany,
30
- defaultCompanyLabel,
29
+ mainCompany,
30
+ mainCompanyLabel,
31
31
  hasDefaultCompanyAccess,
32
32
  isMainCompanySelected,
33
33
  isSaving,
@@ -35,7 +35,7 @@ const MaintenanceSection = () => {
35
35
  saveConfigs,
36
36
  } = useGeneralSettingsConfig();
37
37
  const [routines, setRoutines] = useState(
38
- normalizeMaintenanceRoutines(defaultCompany?.configs?.[
38
+ normalizeMaintenanceRoutines(mainCompany?.configs?.[
39
39
  MAINTENANCE_ROUTINES_CONFIG_KEY
40
40
  ]),
41
41
  );
@@ -43,22 +43,22 @@ const MaintenanceSection = () => {
43
43
  useEffect(() => {
44
44
  setRoutines(
45
45
  normalizeMaintenanceRoutines(
46
- defaultCompany?.configs?.[MAINTENANCE_ROUTINES_CONFIG_KEY],
46
+ mainCompany?.configs?.[MAINTENANCE_ROUTINES_CONFIG_KEY],
47
47
  ),
48
48
  );
49
- }, [defaultCompany?.configs]);
49
+ }, [mainCompany?.configs]);
50
50
 
51
51
  const editable =
52
52
  hasDefaultCompanyAccess &&
53
- !!defaultCompany?.id &&
53
+ !!mainCompany?.id &&
54
54
  isMainCompanySelected &&
55
55
  !isSaving;
56
56
 
57
57
  const saveRoutines = useCallback(
58
58
  async (nextRoutines = routines) => {
59
- if (!hasDefaultCompanyAccess || !defaultCompany?.id || !isMainCompanySelected) {
59
+ if (!hasDefaultCompanyAccess || !mainCompany?.id || !isMainCompanySelected) {
60
60
  showError(
61
- `Abra a empresa principal (${defaultCompanyLabel}) para editar as rotinas.`,
61
+ `Abra a empresa principal (${mainCompanyLabel}) para editar as rotinas.`,
62
62
  );
63
63
  return;
64
64
  }
@@ -87,15 +87,15 @@ const MaintenanceSection = () => {
87
87
  }
88
88
 
89
89
  try {
90
- await peopleActions.defaultCompany();
90
+ await peopleActions.mainCompany();
91
91
  } catch {}
92
92
 
93
93
  showSuccess('Rotinas de manutencao salvas com sucesso.');
94
94
  return true;
95
95
  },
96
96
  [
97
- defaultCompany?.id,
98
- defaultCompanyLabel,
97
+ mainCompany?.id,
98
+ mainCompanyLabel,
99
99
  hasDefaultCompanyAccess,
100
100
  isMainCompanySelected,
101
101
  peopleActions,
@@ -133,7 +133,7 @@ const MaintenanceSection = () => {
133
133
  iconColor={themePalette.cardIconColor}
134
134
  title="Rotinas de manutencao">
135
135
  <Text style={localStyles.helperText}>
136
- {`Essas rotinas ficam gravadas na empresa principal (${defaultCompanyLabel}) e o cron geral tenta executa-las a cada minuto.`}
136
+ {`Essas rotinas ficam gravadas na empresa principal (${mainCompanyLabel}) e o cron geral tenta executa-las a cada minuto.`}
137
137
  </Text>
138
138
 
139
139
  {!isMainCompanySelected && hasDefaultCompanyAccess && (
@@ -69,11 +69,11 @@ const MapsSection = () => {
69
69
  const categoryActions = categoriesStore.actions;
70
70
  const {
71
71
  currentCompany,
72
- defaultCompany,
72
+ mainCompany,
73
73
  effectiveCompanyConfigs,
74
74
  saveConfig,
75
75
  saveConfigs,
76
- saveDefaultCompanyConfigs,
76
+ saveMainCompanyConfigs,
77
77
  } = useGeneralSettingsConfig();
78
78
 
79
79
  const [webGoogleMapsApiKey, setWebGoogleMapsApiKey] = useState('');
@@ -96,9 +96,9 @@ const MapsSection = () => {
96
96
  [],
97
97
  );
98
98
 
99
- const defaultCompanyId = defaultCompany?.id || defaultCompany?.['@id'];
100
- const defaultCompanyIri = defaultCompanyId
101
- ? '/people/' + defaultCompanyId
99
+ const mainCompanyId = mainCompany?.id || mainCompany?.['@id'];
100
+ const mainCompanyIri = mainCompanyId
101
+ ? '/people/' + mainCompanyId
102
102
  : '';
103
103
  const currentCompanyId = normalizeShopEntityId(
104
104
  currentCompany?.id || currentCompany?.['@id'],
@@ -147,7 +147,7 @@ const MapsSection = () => {
147
147
  }, [effectiveCompanyConfigs, shopSettings.franchiseAddressCategoryIds]);
148
148
 
149
149
  useEffect(() => {
150
- if (!defaultCompanyIri || !categoryActions?.getItems) {
150
+ if (!mainCompanyIri || !categoryActions?.getItems) {
151
151
  setFranchiseAddressCategories([]);
152
152
  return undefined;
153
153
  }
@@ -158,7 +158,7 @@ const MapsSection = () => {
158
158
  categoryActions
159
159
  .getItems({
160
160
  context: SHOP_FRANCHISE_ADDRESS_CATEGORY_CONTEXT,
161
- people: defaultCompanyIri,
161
+ people: mainCompanyIri,
162
162
  itemsPerPage: 100,
163
163
  })
164
164
  .then(result => {
@@ -187,7 +187,7 @@ const MapsSection = () => {
187
187
  return () => {
188
188
  isMounted = false;
189
189
  };
190
- }, [categoryActions, categoriesStore.getters, defaultCompanyIri]);
190
+ }, [categoryActions, categoriesStore.getters, mainCompanyIri]);
191
191
 
192
192
  useEffect(() => {
193
193
  if (!franchiseLocatorEnabled || !currentCompanyId) {
@@ -317,14 +317,14 @@ const MapsSection = () => {
317
317
  ? franchiseAddressCategoryIds.filter(id => id !== categoryId)
318
318
  : [...franchiseAddressCategoryIds, categoryId];
319
319
  setFranchiseAddressCategoryIds(nextIds);
320
- const saved = saveDefaultCompanyConfigs?.({
320
+ const saved = saveMainCompanyConfigs?.({
321
321
  [SHOP_FRANCHISE_ADDRESS_CATEGORY_IDS_CONFIG_KEY]: nextIds,
322
322
  });
323
323
  if (!saved) {
324
324
  setFranchiseAddressCategoryIds(franchiseAddressCategoryIds);
325
325
  }
326
326
  },
327
- [franchiseAddressCategoryIds, saveDefaultCompanyConfigs],
327
+ [franchiseAddressCategoryIds, saveMainCompanyConfigs],
328
328
  );
329
329
 
330
330
  const toggleSalesPage = useCallback(() => {
@@ -88,7 +88,7 @@ const ShopSection = () => {
88
88
  const localStyles = useGeneralSettingsStyles();
89
89
  const {
90
90
  currentCompany,
91
- defaultCompanyLabel,
91
+ mainCompanyLabel,
92
92
  effectiveCompanyConfigs,
93
93
  isMainCompanySelected,
94
94
  saveConfig,
@@ -232,7 +232,7 @@ const ShopSection = () => {
232
232
  <View style={localStyles.emptyBox}>
233
233
  <Text style={localStyles.emptyTitle}>Disponivel na empresa principal</Text>
234
234
  <Text style={localStyles.emptyText}>
235
- Selecione a empresa principal ({defaultCompanyLabel}) para configurar o shop.
235
+ Selecione a empresa principal ({mainCompanyLabel}) para configurar o shop.
236
236
  </Text>
237
237
  </View>
238
238
  </GeneralSettingsSection>