@controleonline/ui-common 1.2.71 → 1.2.75

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 (150) hide show
  1. package/.github/actions/workers/manager/action.yml +147 -0
  2. package/.github/actions/workers/qa/action.yml +44 -0
  3. package/.github/actions/workers/security/action.yml +44 -0
  4. package/.github/actions/workers/technical-documenter/action.yml +51 -0
  5. package/.github/workflows/manager-worker.yml +168 -0
  6. package/.github/workflows/publish-npm.yml +45 -0
  7. package/.gitmodules +3 -0
  8. package/AGENTS.md +6 -0
  9. package/README.md +14 -0
  10. package/package.json +3 -2
  11. package/src/api/fetch.js +1 -1
  12. package/src/api/index.js +92 -22
  13. package/src/react/components/AddImportModal.js +94 -110
  14. package/src/react/components/BottomNavigationBar.config.js +211 -231
  15. package/src/react/components/CategoryForm.js +52 -35
  16. package/src/react/components/DefaultProvider.native.js +131 -95
  17. package/src/react/components/DefaultProvider.web.js +148 -74
  18. package/src/react/components/NetworkPrinterPreviewModal.js +249 -0
  19. package/src/react/components/NetworkPrinterPreviewModal.styles.js +159 -0
  20. package/src/react/components/RuntimeInfoFooter.js +100 -36
  21. package/src/react/components/RuntimeInfoFooter.styles.js +3 -0
  22. package/src/react/components/UnifiedPaymentBar.js +7 -4
  23. package/src/react/components/UserAvatar.js +160 -0
  24. package/src/react/components/integrations/IntegrationHero/index.js +48 -0
  25. package/src/react/components/integrations/IntegrationHero/styles.js +57 -0
  26. package/src/react/components/integrations/IntegrationTabs/index.js +89 -0
  27. package/src/react/components/integrations/IntegrationTabs/styles.js +44 -0
  28. package/src/react/config/deviceConfigBootstrap.js +5 -3
  29. package/src/react/pages/Connections.js +229 -0
  30. package/src/react/pages/Connections.styles.js +222 -0
  31. package/src/react/pages/DeviceDetailPage.js +2814 -0
  32. package/src/react/pages/DeviceDetailPage.styles.js +308 -0
  33. package/src/react/pages/Devices/currentDevice.js +194 -0
  34. package/src/react/pages/Devices/deviceTypes/DeviceGroupCard.js +257 -0
  35. package/src/react/pages/Devices/deviceTypes/all.js +23 -0
  36. package/src/react/pages/Devices/deviceTypes/device.js +25 -0
  37. package/src/react/pages/Devices/deviceTypes/deviceListHelpers.js +178 -0
  38. package/src/react/pages/Devices/deviceTypes/display.js +26 -0
  39. package/src/react/pages/Devices/deviceTypes/index.js +145 -0
  40. package/src/react/pages/Devices/deviceTypes/ipCamera.js +35 -0
  41. package/src/react/pages/Devices/deviceTypes/pdv.js +88 -0
  42. package/src/react/pages/Devices/deviceTypes/printer.js +37 -0
  43. package/src/react/pages/Devices/deviceTypes/shared.js +453 -0
  44. package/src/react/pages/Devices/deviceTypes/useDeviceNetworkConnectivity.js +145 -0
  45. package/src/react/pages/Devices.js +183 -0
  46. package/src/react/pages/Devices.styles.js +353 -0
  47. package/src/react/pages/Food99IntegrationPage/components/Food99CatalogTab.js +219 -0
  48. package/src/react/pages/Food99IntegrationPage/components/Food99OverviewTab.js +134 -0
  49. package/src/react/pages/Food99IntegrationPage/components/Food99PreviewModal.js +173 -0
  50. package/src/react/pages/Food99IntegrationPage/components/Food99ProductCard.js +1 -0
  51. package/src/react/pages/Food99IntegrationPage/components/Food99QuickWalletModal.js +181 -0
  52. package/src/react/pages/Food99IntegrationPage/components/Food99SettingsTab.js +306 -0
  53. package/src/react/pages/Food99IntegrationPage/components/Food99StoreTab.js +417 -0
  54. package/src/react/pages/Food99IntegrationPage/index.js +1530 -0
  55. package/src/react/pages/Food99IntegrationPage/styles.js +792 -0
  56. package/src/react/pages/Food99IntegrationPage/utils.js +155 -0
  57. package/src/react/pages/Food99IntegrationPage.js +1 -0
  58. package/src/react/pages/Food99IntegrationPage.styles.js +1 -0
  59. package/src/react/pages/GenericLogPage.js +42 -167
  60. package/src/react/pages/IFoodIntegrationPage/components/IFoodCatalogTab.js +8 -0
  61. package/src/react/pages/IFoodIntegrationPage/components/IFoodOperationsTab.js +420 -0
  62. package/src/react/pages/IFoodIntegrationPage/components/IFoodOverviewTab.js +118 -0
  63. package/src/react/pages/IFoodIntegrationPage/components/IFoodPreviewModal.js +103 -0
  64. package/src/react/pages/IFoodIntegrationPage/components/IFoodProductCard.js +1 -0
  65. package/src/react/pages/IFoodIntegrationPage/components/IFoodStoreTab.js +150 -0
  66. package/src/react/pages/IFoodIntegrationPage/index.js +1298 -0
  67. package/src/react/pages/IFoodIntegrationPage/styles.js +764 -0
  68. package/src/react/pages/IFoodIntegrationPage/utils.js +91 -0
  69. package/src/react/pages/IFoodIntegrationPage.js +1 -0
  70. package/src/react/pages/IFoodIntegrationPage.styles.js +1 -0
  71. package/src/react/pages/Imports.js +214 -166
  72. package/src/react/pages/IntegrationConfigPage.js +744 -0
  73. package/src/react/pages/IntegrationConfigPage.styles.js +269 -0
  74. package/src/react/pages/Integrations.js +299 -0
  75. package/src/react/pages/Integrations.styles.js +130 -0
  76. package/src/react/pages/ManagerOrderNotificationsPage.js +642 -0
  77. package/src/react/pages/MarketplaceIntegrationPage/components/MarketplaceProductCard.js +205 -0
  78. package/src/react/pages/MarketplaceIntegrationPage/components/RemoteMarketplaceMenuTab.js +335 -0
  79. package/src/react/pages/MarketplaceIntegrationPage/index.js +60 -0
  80. package/src/react/pages/MarketplaceIntegrationPage/utils.js +137 -0
  81. package/src/react/pages/MercadoLivreIntegrationPage.js +538 -0
  82. package/src/react/pages/PrinterDeviceDetailPage.js +1916 -0
  83. package/src/react/pages/PrinterDeviceDetailPage.styles.js +223 -0
  84. package/src/react/pages/PrinterDeviceFormPage.js +521 -0
  85. package/src/react/pages/PrinterDeviceFormPage.styles.js +159 -0
  86. package/src/react/pages/WhatsAppConnectionPage.js +459 -0
  87. package/src/react/pages/WhatsAppConnectionPage.styles.js +284 -0
  88. package/src/react/pages/integrationsCatalog.js +399 -0
  89. package/src/react/services/Cielo/Cielo.js +193 -193
  90. package/src/react/utils/categoryContexts.js +46 -0
  91. package/src/react/utils/entityDisplay.js +222 -217
  92. package/src/react/utils/fileUrl.js +39 -20
  93. package/src/react/utils/integrationPage.js +16 -0
  94. package/src/react/utils/runtimeFooter.js +40 -22
  95. package/src/react/utils/runtimeLanguage.js +50 -9
  96. package/src/react/utils/runtimeMenu.js +191 -131
  97. package/src/react/utils/runtimeZoom.js +43 -0
  98. package/src/react/utils/shopConfig.js +27 -15
  99. package/src/react/utils/shopFranchises.js +126 -1
  100. package/src/react/utils/storeColumns.js +23 -4
  101. package/src/react/utils/userAvatar.js +104 -0
  102. package/src/store/categories/index.js +48 -20
  103. package/src/store/device_config/index.js +62 -21
  104. package/src/store/entity_log/index.js +22 -1
  105. package/src/store/imports/customActions.js +51 -0
  106. package/src/store/imports/index.js +89 -88
  107. package/src/store/status/index.js +11 -11
  108. package/src/store/themes/index.js +22 -0
  109. package/src/store/timezones/index.js +3 -1
  110. package/src/tests/browser/manager/connections.spec.js +143 -0
  111. package/src/tests/browser/manager/devices-current.spec.js +343 -0
  112. package/src/tests/browser/manager/mercado-livre-integration.spec.js +268 -0
  113. package/src/tests/react/api/deviceHeaders.test.js +114 -0
  114. package/src/tests/react/components/AddImportModal.test.js +166 -0
  115. package/src/tests/react/components/BottomNavigationBar.config.test.js +20 -0
  116. package/src/tests/react/components/UserAvatar.test.js +52 -0
  117. package/src/tests/react/pages/DevicePickerStyles.test.js +47 -0
  118. package/src/tests/react/pages/Devices/deviceListHelpers.test.js +39 -0
  119. package/src/tests/react/pages/DevicesCurrentDevice.test.js +198 -0
  120. package/src/tests/react/pages/connectionsHelpers.test.js +34 -0
  121. package/src/tests/react/pages/mercadoLivreIntegrationPageContract.test.mjs +16 -0
  122. package/src/tests/react/services/Cielo.test.js +190 -190
  123. package/src/tests/react/store/categoriesOrdering.test.js +26 -0
  124. package/src/tests/react/utils/appDomain.test.js +62 -0
  125. package/src/tests/react/utils/entityDisplay.test.js +2 -2
  126. package/src/tests/react/utils/fileUrl.test.js +3 -3
  127. package/src/tests/react/utils/formatter.test.mjs +33 -0
  128. package/src/tests/react/utils/runtimeFooter.test.js +29 -4
  129. package/src/tests/react/utils/runtimeLanguage.test.js +79 -9
  130. package/src/tests/react/utils/runtimeMenu.test.js +198 -134
  131. package/src/tests/react/utils/runtimeZoom.test.js +38 -0
  132. package/src/tests/react/utils/shopConfig.test.js +10 -9
  133. package/src/tests/react/utils/shopFranchises.test.js +43 -0
  134. package/src/tests/react/utils/translate.discovery.test.mjs +170 -0
  135. package/src/tests/react/utils/translate.test.helpers.mjs +152 -0
  136. package/src/tests/react/utils/translate.test.mjs +141 -349
  137. package/src/tests/react/utils/userAvatar.test.js +63 -0
  138. package/src/utils/appDomain.js +15 -4
  139. package/src/utils/formatter.js +104 -16
  140. package/src/utils/integrationConfigs.js +80 -80
  141. package/src/utils/translate.js +222 -438
  142. package/src/utils/translateDiscovery.js +96 -0
  143. package/src/utils/translateNormalize.js +33 -0
  144. package/src/utils/translatePending.js +92 -0
  145. package/src/utils/translateStorage.js +142 -0
  146. package/.github/agents/developer.agent.md +0 -30
  147. package/.github/agents/devops.agent.md +0 -30
  148. package/.github/agents/qa.agent.md +0 -30
  149. package/.github/agents/security.agent.md +0 -30
  150. package/.github/workflows/npmjs.yml +0 -35
@@ -1,83 +1,83 @@
1
- const pickFirstText = (...values) => {
2
- for (const value of values) {
3
- const normalized = normalizeText(value);
4
- if (normalized) {
5
- return normalized;
6
- }
7
- }
8
-
9
- return '';
10
- };
11
-
12
- export const normalizeText = value => {
13
- if (value === null || value === undefined) return '';
14
-
15
- if (
16
- typeof value === 'string' ||
17
- typeof value === 'number' ||
18
- typeof value === 'bigint' ||
19
- typeof value === 'boolean'
20
- ) {
21
- return String(value).trim();
22
- }
23
-
24
- if (Array.isArray(value)) {
25
- for (const item of value) {
26
- const normalized = normalizeText(item);
27
- if (normalized) return normalized;
28
- }
29
- return '';
30
- }
31
-
32
- if (typeof value === 'object') {
33
- const street = String(
34
- value?.street_name ||
35
- value?.streetName ||
36
- value?.street ||
37
- value?.logradouro ||
38
- '',
39
- ).trim();
40
- const number = String(
41
- value?.street_number ||
42
- value?.streetNumber ||
43
- value?.number ||
44
- value?.house_number ||
45
- '',
46
- ).trim();
47
- const streetLine = [street, number].filter(Boolean).join(', ');
48
-
49
- const candidates = [
50
- value?.display,
51
- value?.formattedAddress,
52
- value?.formatted_address,
53
- value?.formatted,
54
- value?.address,
55
- value?.poi_address,
56
- value?.value,
57
- value?.description,
58
- streetLine,
59
- value?.district,
60
- value?.city,
61
- value?.name,
62
- value?.reference,
63
- value?.complement,
64
- ];
65
-
66
- for (const candidate of candidates) {
67
- const normalized = normalizeText(candidate);
68
- if (normalized) return normalized;
69
- }
70
- }
71
-
72
- return '';
73
- };
74
-
1
+ const pickFirstText = (...values) => {
2
+ for (const value of values) {
3
+ const normalized = normalizeText(value);
4
+ if (normalized) {
5
+ return normalized;
6
+ }
7
+ }
8
+
9
+ return '';
10
+ };
11
+
12
+ export const normalizeText = value => {
13
+ if (value === null || value === undefined) return '';
14
+
15
+ if (
16
+ typeof value === 'string' ||
17
+ typeof value === 'number' ||
18
+ typeof value === 'bigint' ||
19
+ typeof value === 'boolean'
20
+ ) {
21
+ return String(value).trim();
22
+ }
23
+
24
+ if (Array.isArray(value)) {
25
+ for (const item of value) {
26
+ const normalized = normalizeText(item);
27
+ if (normalized) return normalized;
28
+ }
29
+ return '';
30
+ }
31
+
32
+ if (typeof value === 'object') {
33
+ const street = String(
34
+ value?.street_name ||
35
+ value?.streetName ||
36
+ value?.street ||
37
+ value?.logradouro ||
38
+ '',
39
+ ).trim();
40
+ const number = String(
41
+ value?.street_number ||
42
+ value?.streetNumber ||
43
+ value?.number ||
44
+ value?.house_number ||
45
+ '',
46
+ ).trim();
47
+ const streetLine = [street, number].filter(Boolean).join(', ');
48
+
49
+ const candidates = [
50
+ value?.display,
51
+ value?.formattedAddress,
52
+ value?.formatted_address,
53
+ value?.formatted,
54
+ value?.address,
55
+ value?.poi_address,
56
+ value?.value,
57
+ value?.description,
58
+ streetLine,
59
+ value?.district,
60
+ value?.city,
61
+ value?.name,
62
+ value?.reference,
63
+ value?.complement,
64
+ ];
65
+
66
+ for (const candidate of candidates) {
67
+ const normalized = normalizeText(candidate);
68
+ if (normalized) return normalized;
69
+ }
70
+ }
71
+
72
+ return '';
73
+ };
74
+
75
75
  export const formatHumanLabel = value => {
76
76
  const normalized = normalizeText(value)
77
77
  .replace(/[_-]+/g, ' ')
78
78
  .replace(/\s+/g, ' ')
79
79
  .trim();
80
-
80
+
81
81
  if (!normalized) {
82
82
  return '';
83
83
  }
@@ -87,145 +87,150 @@ export const formatHumanLabel = value => {
87
87
  (match, prefix, char) => `${prefix}${char.toLocaleUpperCase('pt-BR')}`,
88
88
  );
89
89
  };
90
-
91
- export const uppercaseText = (value, locale = 'pt-BR') => {
92
- if (value === null || value === undefined) {
93
- return '';
94
- }
95
-
96
- const normalized = String(value);
97
-
98
- try {
99
- return normalized.toLocaleUpperCase(locale);
100
- } catch {
101
- return normalized.toUpperCase();
102
- }
103
- };
104
-
105
- export const formatDisplayUppercase = (value, locale = 'pt-BR') => {
106
- const normalized = normalizeText(value);
107
-
108
- if (!normalized) {
109
- return '';
110
- }
111
-
112
- return uppercaseText(normalized, locale);
113
- };
114
-
115
- export const formatPhoneDisplay = phoneEntry => {
116
- if (!phoneEntry) return '';
117
-
118
- if (typeof phoneEntry === 'string' || typeof phoneEntry === 'number') {
119
- return normalizeText(phoneEntry);
120
- }
121
-
122
- const ddi = normalizeText(phoneEntry?.ddi);
123
- const ddd = normalizeText(phoneEntry?.ddd);
124
- const phone = normalizeText(phoneEntry?.phone);
125
-
126
- if (!phone) return '';
127
-
128
- return [ddi ? `+${ddi}` : '', ddd ? `(${ddd})` : '', phone]
129
- .filter(Boolean)
130
- .join(' ')
131
- .trim();
132
- };
133
-
134
- export const resolveAddressDisplayParts = address => {
135
- const streetName = normalizeText(address?.street?.street);
136
- const streetNumber = normalizeText(address?.number);
137
- const nickname = normalizeText(address?.nickname);
138
- const complement = normalizeText(address?.complement);
139
- const district = normalizeText(address?.street?.district?.district);
140
- const city = normalizeText(address?.street?.district?.city?.city);
141
- const state = normalizeText(
142
- address?.street?.district?.city?.state?.uf ||
143
- address?.street?.district?.city?.state?.state,
144
- );
145
- const postalCode = normalizeText(address?.street?.cep?.cep);
146
-
147
- return {
148
- primary: pickFirstText(
149
- [streetName, streetNumber].filter(Boolean).join(', '),
150
- streetName,
151
- nickname,
152
- ),
153
- secondary: [district, [city, state].filter(Boolean).join(' / ')].filter(Boolean).join(' • '),
154
- streetLine: [streetName, streetNumber].filter(Boolean).join(', '),
155
- district,
156
- cityStateLine: [city, state].filter(Boolean).join(' / '),
157
- postalCode,
158
- complement,
159
- nickname,
160
- };
161
- };
162
-
163
- export const buildAddressOptionSummary = address => {
164
- const addressParts = resolveAddressDisplayParts(address);
165
-
166
- return {
167
- primary: pickFirstText(
168
- addressParts.primary,
169
- addressParts.streetLine,
170
- addressParts.nickname,
171
- ),
172
- secondary: pickFirstText(
173
- addressParts.secondary,
174
- addressParts.postalCode,
175
- addressParts.complement,
176
- ),
177
- };
178
- };
179
-
180
- export const buildCustomerSearchMeta = customer => {
181
- const phone = pickFirstText(
182
- Array.isArray(customer?.phone)
183
- ? customer.phone.map(formatPhoneDisplay).find(Boolean)
184
- : formatPhoneDisplay(customer?.phone),
185
- );
186
- const email = pickFirstText(
187
- Array.isArray(customer?.email)
188
- ? customer.email.map(item => normalizeText(item?.email)).find(Boolean)
189
- : normalizeText(customer?.email?.email || customer?.email),
190
- );
191
- const document = pickFirstText(
192
- Array.isArray(customer?.document)
193
- ? customer.document.map(item => normalizeText(item?.document)).find(Boolean)
194
- : normalizeText(customer?.document?.document || customer?.document),
195
- );
196
- const address = pickFirstText(
197
- Array.isArray(customer?.address)
198
- ? customer.address
199
- .map(item => {
200
- const summary = buildAddressOptionSummary(item);
201
-
202
- return pickFirstText(
203
- item?.search_for,
204
- summary.primary,
205
- summary.secondary,
206
- );
207
- })
208
- .find(Boolean)
209
- : '',
210
- );
211
-
212
- return [phone, email, document, address].filter(Boolean).join(' • ');
213
- };
214
-
215
- export const normalizePostalCodeInput = value =>
216
- String(value ?? '')
217
- .replace(/\D+/g, '')
218
- .slice(0, 8);
219
-
220
- export const createEmptyAddressForm = (overrides = {}) => ({
221
- nickname: '',
222
- cep: '',
223
- street: '',
224
- number: '',
225
- district: '',
226
- city: '',
227
- state: '',
228
- country: 'Brasil',
229
- complement: '',
230
- ...overrides,
231
- });
90
+
91
+ export const uppercaseText = (value, locale = 'pt-BR') => {
92
+ if (value === null || value === undefined) {
93
+ return '';
94
+ }
95
+
96
+ const normalized = String(value);
97
+
98
+ try {
99
+ return normalized.toLocaleUpperCase(locale);
100
+ } catch {
101
+ return normalized.toUpperCase();
102
+ }
103
+ };
104
+
105
+ export const formatDisplayUppercase = (value, locale = 'pt-BR') => {
106
+ const normalized = normalizeText(value);
107
+
108
+ if (!normalized) {
109
+ return '';
110
+ }
111
+
112
+ return uppercaseText(normalized, locale);
113
+ };
114
+
115
+ export const formatPhoneDisplay = phoneEntry => {
116
+ if (!phoneEntry) return '';
117
+
118
+ if (typeof phoneEntry === 'string' || typeof phoneEntry === 'number') {
119
+ return normalizeText(phoneEntry);
120
+ }
121
+
122
+ const ddi = normalizeText(phoneEntry?.ddi);
123
+ const ddd = normalizeText(phoneEntry?.ddd);
124
+ const phone = normalizeText(phoneEntry?.phone);
125
+
126
+ if (!phone) return '';
127
+
128
+ return [ddi ? `+${ddi}` : '', ddd ? `(${ddd})` : '', phone]
129
+ .filter(Boolean)
130
+ .join(' ')
131
+ .trim();
132
+ };
133
+
134
+ export const resolveAddressDisplayParts = address => {
135
+ const streetName = normalizeText(address?.street?.street);
136
+ const streetNumber = normalizeText(address?.number);
137
+ const nickname = normalizeText(address?.nickname);
138
+ const complement = normalizeText(address?.complement);
139
+ const district = normalizeText(address?.street?.district?.district);
140
+ const city = normalizeText(address?.street?.district?.city?.city);
141
+ const state = normalizeText(
142
+ address?.street?.district?.city?.state?.uf ||
143
+ address?.street?.district?.city?.state?.state,
144
+ );
145
+ const postalCode = normalizeText(address?.street?.cep?.cep);
146
+
147
+ return {
148
+ primary: pickFirstText(
149
+ [streetName, streetNumber].filter(Boolean).join(', '),
150
+ streetName,
151
+ nickname,
152
+ ),
153
+ secondary: [district, [city, state].filter(Boolean).join(' / ')].filter(Boolean).join(' • '),
154
+ streetLine: [streetName, streetNumber].filter(Boolean).join(', '),
155
+ district,
156
+ cityStateLine: [city, state].filter(Boolean).join(' / '),
157
+ postalCode,
158
+ complement,
159
+ nickname,
160
+ };
161
+ };
162
+
163
+ export const buildAddressOptionSummary = address => {
164
+ const addressParts = resolveAddressDisplayParts(address);
165
+
166
+ return {
167
+ primary: pickFirstText(
168
+ addressParts.primary,
169
+ addressParts.streetLine,
170
+ addressParts.nickname,
171
+ ),
172
+ secondary: pickFirstText(
173
+ addressParts.secondary,
174
+ addressParts.postalCode,
175
+ addressParts.complement,
176
+ ),
177
+ };
178
+ };
179
+
180
+ export const buildCustomerSearchMeta = customer => {
181
+ const phone = pickFirstText(
182
+ Array.isArray(customer?.phone)
183
+ ? customer.phone.map(formatPhoneDisplay).find(Boolean)
184
+ : formatPhoneDisplay(customer?.phone),
185
+ );
186
+ const email = pickFirstText(
187
+ Array.isArray(customer?.email)
188
+ ? customer.email.map(item => normalizeText(item?.email)).find(Boolean)
189
+ : normalizeText(customer?.email?.email || customer?.email),
190
+ );
191
+ const document = pickFirstText(
192
+ Array.isArray(customer?.document)
193
+ ? customer.document.map(item => normalizeText(item?.document)).find(Boolean)
194
+ : normalizeText(customer?.document?.document || customer?.document),
195
+ );
196
+ const address = pickFirstText(
197
+ Array.isArray(customer?.address)
198
+ ? customer.address
199
+ .map(item => {
200
+ const summary = buildAddressOptionSummary(item);
201
+
202
+ return pickFirstText(
203
+ item?.search_for,
204
+ summary.primary,
205
+ summary.secondary,
206
+ );
207
+ })
208
+ .find(Boolean)
209
+ : '',
210
+ );
211
+
212
+ return [phone, email, document, address].filter(Boolean).join(' • ');
213
+ };
214
+
215
+ export const normalizePostalCodeInput = value =>
216
+ String(value ?? '')
217
+ .replace(/\D+/g, '')
218
+ .slice(0, 8);
219
+
220
+ export const createEmptyAddressForm = (overrides = {}) => ({
221
+ nickname: '',
222
+ cep: '',
223
+ street: '',
224
+ number: '',
225
+ district: '',
226
+ city: '',
227
+ state: '',
228
+ uf: '',
229
+ country: 'BR',
230
+ countryCode: 'BR',
231
+ countryName: 'Brazil',
232
+ complement: '',
233
+ latitude: null,
234
+ longitude: null,
235
+ ...overrides,
236
+ });
@@ -25,13 +25,10 @@ const unwrapFile = file => {
25
25
  const isDownloadLikeUrl = value =>
26
26
  FILE_DOWNLOAD_PATTERN.test(normalizeText(value));
27
27
 
28
- const appendQueryParam = (url, key, value) => {
28
+ const stripDomainQueryParams = url => {
29
29
  const normalizedUrl = normalizeText(url);
30
- const normalizedKey = normalizeText(key);
31
- const normalizedValue = normalizeText(value);
32
-
33
- if (!normalizedUrl || !normalizedKey || !normalizedValue) {
34
- return normalizedUrl;
30
+ if (!normalizedUrl) {
31
+ return '';
35
32
  }
36
33
 
37
34
  const hashIndex = normalizedUrl.indexOf('#');
@@ -49,15 +46,12 @@ const appendQueryParam = (url, key, value) => {
49
46
  .filter(Boolean)
50
47
  .filter(item => {
51
48
  const [rawKey] = item.split('=');
52
- return decodeURIComponent(rawKey || '') !== normalizedKey;
49
+ const key = decodeURIComponent(rawKey || '').toLowerCase();
50
+ return key !== 'app-domain' && key !== 'appdomain';
53
51
  })
54
52
  : [];
55
53
 
56
- params.push(
57
- `${encodeURIComponent(normalizedKey)}=${encodeURIComponent(normalizedValue)}`,
58
- );
59
-
60
- return `${base}?${params.join('&')}${hash}`;
54
+ return `${base}${params.length ? `?${params.join('&')}` : ''}${hash}`;
61
55
  };
62
56
 
63
57
  const ensureAbsoluteUrl = url => {
@@ -95,9 +89,38 @@ const buildBackendDownloadUrl = (fileId, options = {}) => {
95
89
 
96
90
  const host = resolveDownloadHost(options);
97
91
  const relativeUrl = `/files/${normalizedId}/download`;
98
- const absoluteUrl = ensureAbsoluteUrl(relativeUrl);
99
92
 
100
- return host ? appendQueryParam(absoluteUrl, 'app-domain', host) : absoluteUrl;
93
+ return buildTenantDownloadUrl(relativeUrl, host);
94
+ };
95
+
96
+ const buildTenantDownloadUrl = (url, host) => {
97
+ const absoluteUrl = ensureAbsoluteUrl(stripDomainQueryParams(url));
98
+ const normalizedHost = normalizeText(host);
99
+ if (!absoluteUrl || !normalizedHost) {
100
+ return absoluteUrl;
101
+ }
102
+
103
+ if (/^https?:\/\//i.test(absoluteUrl)) {
104
+ const match = stripDomainQueryParams(absoluteUrl).match(
105
+ /^(https?:\/\/[^/?#]+)\/(?:[^/]+\/)?files\/([^/?#]+)\/download([^#]*)(#.*)?$/i,
106
+ );
107
+
108
+ return match
109
+ ? `${match[1]}/${encodeURIComponent(normalizedHost)}/files/${match[2]}/download${match[3] || ''}${match[4] || ''}`
110
+ : stripDomainQueryParams(absoluteUrl);
111
+ }
112
+
113
+ const hashIndex = absoluteUrl.indexOf('#');
114
+ const hash = hashIndex >= 0 ? absoluteUrl.slice(hashIndex) : '';
115
+ const urlWithoutHash = hashIndex >= 0 ? absoluteUrl.slice(0, hashIndex) : absoluteUrl;
116
+ const queryIndex = urlWithoutHash.indexOf('?');
117
+ const path = queryIndex >= 0 ? urlWithoutHash.slice(0, queryIndex) : urlWithoutHash;
118
+ const query = queryIndex >= 0 ? urlWithoutHash.slice(queryIndex) : '';
119
+ const match = path.match(/^\/(?:[^/]+\/)?files\/([^/]+)\/download$/i);
120
+
121
+ return match
122
+ ? `/${encodeURIComponent(normalizedHost)}/files/${match[1]}/download${query}${hash}`
123
+ : stripDomainQueryParams(absoluteUrl);
101
124
  };
102
125
 
103
126
  const resolveDirectFileUrl = file => {
@@ -185,11 +208,7 @@ export const resolveDefaultFileSource = (
185
208
  }
186
209
 
187
210
  if (isDownloadLikeUrl(normalizedValue)) {
188
- const uri = appendQueryParam(
189
- ensureAbsoluteUrl(normalizedValue),
190
- 'app-domain',
191
- host,
192
- );
211
+ const uri = buildTenantDownloadUrl(normalizedValue, host);
193
212
 
194
213
  return uri
195
214
  ? {
@@ -243,7 +262,7 @@ export const resolveDefaultFileSource = (
243
262
  }
244
263
 
245
264
  const uri = isBackendDownload
246
- ? appendQueryParam(ensureAbsoluteUrl(uriBase), 'app-domain', host)
265
+ ? buildTenantDownloadUrl(uriBase, host)
247
266
  : uriBase;
248
267
 
249
268
  return {
@@ -0,0 +1,16 @@
1
+ import { Platform } from 'react-native';
2
+
3
+ // Sombra base reutilizada em cards das telas de integração.
4
+ export const integrationCardShadowStyle = Platform.select({
5
+ ios: {
6
+ shadowColor: '#0F172A',
7
+ shadowOffset: { width: 0, height: 8 },
8
+ shadowOpacity: 0.08,
9
+ shadowRadius: 16,
10
+ },
11
+ android: { elevation: 3 },
12
+ web: { boxShadow: '0 10px 24px rgba(15,23,42,0.08)' },
13
+ });
14
+
15
+ // Contagem defensiva para listas usadas em resumos e pré-visualizações.
16
+ export const countCollection = collection => (Array.isArray(collection) ? collection.length : 0);
@@ -90,27 +90,43 @@ const parseObjectValue = value => {
90
90
  const parseDeviceMetadata = metadata => parseObjectValue(metadata);
91
91
  const parseDeviceConfigs = configs => parseObjectValue(configs);
92
92
 
93
- const normalizeRuntimeFooterText = value => {
94
- if (value === null || value === undefined) {
95
- return '';
96
- }
93
+ const normalizeRuntimeFooterText = value => {
94
+ if (value === null || value === undefined) {
95
+ return '';
96
+ }
97
97
 
98
98
  const parsedValue =
99
99
  typeof value === 'string' ? parseJsonStringValue(value) : value;
100
100
 
101
- if (parsedValue && typeof parsedValue === 'object') {
102
- return '';
103
- }
104
-
105
- const normalized = safeTrim(parsedValue);
106
-
107
- return normalized.replace(/\s+/g, ' ');
108
- };
109
-
110
- const getRuntimeFooterText = company =>
111
- normalizeRuntimeFooterText(
112
- company?.configs?.[DEVICE_RUNTIME_FOOTER_TEXT_CONFIG_KEY],
113
- );
101
+ if (parsedValue && typeof parsedValue === 'object') {
102
+ return '';
103
+ }
104
+
105
+ return safeTrim(String(parsedValue).replace(/\r\n?/g, '\n'))
106
+ .split('\n')
107
+ .map(line => safeTrim(line).replace(/\s+/g, ' '))
108
+ .filter(Boolean)
109
+ .join('\n');
110
+ };
111
+
112
+ const getRuntimeFooterText = company =>
113
+ normalizeRuntimeFooterText(
114
+ company?.configs?.[DEVICE_RUNTIME_FOOTER_TEXT_CONFIG_KEY],
115
+ );
116
+
117
+ const getRuntimeFooterTextLines = value => {
118
+ const normalizedText =
119
+ typeof value === 'string'
120
+ ? normalizeRuntimeFooterText(value)
121
+ : getRuntimeFooterText(value);
122
+
123
+ return normalizedText ? normalizedText.split('\n').filter(Boolean) : [];
124
+ };
125
+
126
+ const getRuntimeFooterRotationEntries = ({companyFooterText, primaryText}) =>
127
+ [...getRuntimeFooterTextLines(companyFooterText), safeTrim(primaryText)].filter(
128
+ Boolean,
129
+ );
114
130
 
115
131
  const isWebRuntimeDevice = device => {
116
132
  const metadata = parseDeviceMetadata(device?.metadata);
@@ -465,11 +481,13 @@ module.exports = {
465
481
  getRuntimeFooterDebugInfo,
466
482
  getRuntimeFooterDeviceName,
467
483
  getRuntimeFooterNativeIdentifierCandidates,
468
- getRuntimeFooterPrimaryText,
469
- getRuntimeFooterStoredVersion,
470
- getRuntimeFooterVersionCandidates,
471
- getRuntimeFooterWebIdentifierCandidates,
472
- getRuntimeFooterText,
484
+ getRuntimeFooterPrimaryText,
485
+ getRuntimeFooterRotationEntries,
486
+ getRuntimeFooterStoredVersion,
487
+ getRuntimeFooterTextLines,
488
+ getRuntimeFooterVersionCandidates,
489
+ getRuntimeFooterWebIdentifierCandidates,
490
+ getRuntimeFooterText,
473
491
  getRuntimeFooterWebHost,
474
492
  normalizeRuntimeFooterText,
475
493
  };