@controleonline/ui-common 1.2.81 → 1.2.83

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@controleonline/ui-common",
3
- "version": "1.2.81",
3
+ "version": "1.2.83",
4
4
  "author": "ControleOnline",
5
5
  "description": "ControleOnline Common Quasar UI Component",
6
6
  "license": "MIT",
package/src/api/index.js CHANGED
@@ -391,12 +391,38 @@ export const api = {
391
391
 
392
392
  return safeUri;
393
393
  },
394
- post: async function (uri, body = {}) {
395
- const options = {
394
+ get: async function (uri, options = {}) {
395
+ return await this.fetch(uri, {
396
+ ...options,
397
+ method: 'GET',
398
+ });
399
+ },
400
+ post: async function (uri, body = {}, options = {}) {
401
+ return await this.fetch(uri, {
402
+ ...options,
396
403
  method: 'POST',
397
- body: body,
398
- };
399
- return await this.fetch(uri, options);
404
+ body,
405
+ });
406
+ },
407
+ put: async function (uri, body = {}, options = {}) {
408
+ return await this.fetch(uri, {
409
+ ...options,
410
+ method: 'PUT',
411
+ body,
412
+ });
413
+ },
414
+ patch: async function (uri, body = {}, options = {}) {
415
+ return await this.fetch(uri, {
416
+ ...options,
417
+ method: 'PATCH',
418
+ body,
419
+ });
420
+ },
421
+ delete: async function (uri, options = {}) {
422
+ return await this.fetch(uri, {
423
+ ...options,
424
+ method: 'DELETE',
425
+ });
400
426
  },
401
427
  loadSmokeIndex: async function (config = {}) {
402
428
  return await requestSmoke('/tests', {}, config);
@@ -10,31 +10,35 @@ import styles from '../../DeviceDetailPage.styles';
10
10
  */
11
11
  export default function DeviceDetailPaymentSection(ctx) {
12
12
  const {
13
- showPdvPaymentTypesTab, renderHelpButton, deviceId, savePaymentTypeConfigs, savingPaymentTypes,
13
+ showPdvPaymentTypesTab,
14
+ renderHelpButton,
15
+ deviceId,
16
+ savePaymentTypeConfigs,
17
+ savingPaymentTypes,
18
+ currentCompany,
19
+ configs,
14
20
  } = ctx;
15
21
 
16
22
  if (!showPdvPaymentTypesTab) return null;
17
23
 
18
24
  return (
19
- <View style={styles.section}>
20
- <View style={styles.sectionHeaderRow}>
21
- <Text style={styles.sectionTitle}>
22
- <Icon name="credit-card" size={13} /> {' '}Pagamentos do device
23
- </Text>
24
- {renderHelpButton(
25
- 'Pagamentos do device',
26
- 'Selecione os meios de pagamento que este device pode exibir e usar nas opções de pagamento. Os wallets entram só para organizar a lista.',
27
- )}
28
- </View>
29
- <PaymentTypesByWalletTab
30
- currentCompanyId={currentCompany?.id}
31
- configs={configs}
32
- disableSelection={savingPaymentTypes}
33
- isSaving={savingPaymentTypes}
34
- onPersistSelectedPaymentTypeIds={savePaymentTypeConfigs}
35
- />
36
- </View>
37
- )}
38
-
25
+ <View style={styles.section}>
26
+ <View style={styles.sectionHeaderRow}>
27
+ <Text style={styles.sectionTitle}>
28
+ <Icon name="credit-card" size={13} /> {' '}Pagamentos do device
29
+ </Text>
30
+ {renderHelpButton(
31
+ 'Pagamentos do device',
32
+ 'Selecione os meios de pagamento que este device pode exibir e usar nas opções de pagamento. Os wallets entram só para organizar a lista.',
33
+ )}
34
+ </View>
35
+ <PaymentTypesByWalletTab
36
+ currentCompanyId={currentCompany?.id}
37
+ configs={configs}
38
+ disableSelection={savingPaymentTypes}
39
+ isSaving={savingPaymentTypes}
40
+ onPersistSelectedPaymentTypeIds={savePaymentTypeConfigs}
41
+ />
42
+ </View>
39
43
  );
40
44
  }
@@ -326,7 +326,8 @@ const DeviceDetailScreen = () => {
326
326
  shouldShowOrderVisibility,
327
327
  shouldShowRemotePayment,
328
328
  shouldShowDeviceBehavior,
329
- shouldShowRemoteCommands
329
+ shouldShowRemoteCommands,
330
+ currentCompany,
330
331
  } = { ...state, ...loaders, ...actions, ...saves };
331
332
 
332
333
  const detailCtx = {
@@ -357,6 +358,7 @@ const DeviceDetailScreen = () => {
357
358
  showPdvMovementTab, showPdvPaymentTypesTab, showPdvOperationTab,
358
359
  inflowData, productTotal, wallets, filteredProducts, search, setSearch,
359
360
  loadingMovementData, deviceId, savePaymentTypeConfigs, savingPaymentTypes,
361
+ configs, currentCompany,
360
362
  };
361
363
 
362
364
  const {
@@ -337,6 +337,10 @@ export default function useDeviceDetailStateA() {
337
337
  () =>
338
338
  String(runtimeDevice?.type || runtimeDevice?.deviceType || '')
339
339
  .trim()
340
+ .toUpperCase(),
341
+ [runtimeDevice?.deviceType, runtimeDevice?.type],
342
+ );
343
+
340
344
  return {
341
345
  navigation,
342
346
  deviceId,
@@ -480,5 +484,6 @@ export default function useDeviceDetailStateA() {
480
484
  appVersion,
481
485
  runtimeDeviceId,
482
486
  runtimeDeviceType,
487
+ currentCompany,
483
488
  };
484
489
  }
@@ -51,9 +51,7 @@ export default function useDeviceDetailStateB(deps) {
51
51
  setAlias, editingAlias, setEditingAlias, aliasInput, setAliasInput, savingAlias, setSavingAlias, removingDevice, setRemovingDevice, aliasInputRef, skipAliasSyncFromStoreRef, isOpen,
52
52
  hasLocalPaymentGateway, paymentDeviceOptions, displayOptions, printerOptions, selectedPosOperationModeOption, pickerMode, packageVersion, appVersion, runtimeDeviceId, runtimeDeviceType,
53
53
  } = deps;
54
- .toUpperCase(),
55
- [runtimeDevice?.deviceType, runtimeDevice?.type],
56
- );
54
+
57
55
  const isEditingRuntimeDevice = useMemo(
58
56
  () =>
59
57
  !!runtimeDeviceId &&
@@ -64,8 +62,37 @@ export default function useDeviceDetailStateB(deps) {
64
62
 
65
63
  const resolveDeviceContext = useCallback(async () => {
66
64
  if (deviceString && deviceType) {
65
+ return {
66
+ deviceData: null,
67
+ deviceString,
68
+ deviceType,
69
+ };
70
+ }
71
+
72
+ if (!deviceId) {
73
+ return {
74
+ deviceData: null,
75
+ deviceString: '',
76
+ deviceType: '',
77
+ };
78
+ }
79
+
80
+ const fetchedDevice = await actionsRef.current.deviceActions
81
+ .get(deviceId)
82
+ .catch(() => null);
83
+
84
+ return {
85
+ deviceData: fetchedDevice,
86
+ deviceString: String(fetchedDevice?.device || '').trim(),
87
+ deviceType: String(fetchedDevice?.type || fetchedDevice?.deviceType || '')
88
+ .trim()
89
+ .toUpperCase(),
90
+ };
91
+ }, [deviceId, deviceString, deviceType]);
92
+
67
93
  return {
68
94
  isEditingRuntimeDevice,
69
95
  resolveDeviceContext,
70
96
  };
71
97
  }
98
+