@controleonline/ui-common 1.2.108 → 1.2.110

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 (50) hide show
  1. package/.release/rc-manifest.json +7 -5
  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.js +18 -96
  11. package/src/react/pages/Connections.styles.js +72 -72
  12. package/src/react/pages/Devices/detail/DeviceDetailHeader.js +1 -1
  13. package/src/react/pages/Devices/detail/DeviceDetailMovementSections.js +1 -1
  14. package/src/react/pages/Devices/detail/useDeviceDetailStateA.js +2 -2
  15. package/src/react/pages/Devices/detail/useDeviceDetailStateB.js +2 -2
  16. package/src/react/pages/Devices/deviceTypes/DeviceGroupCard.js +1 -1
  17. package/src/react/pages/Devices/deviceTypes/shared.js +2 -2
  18. package/src/react/pages/Devices.js +2 -2
  19. package/src/react/pages/Devices.styles.js +353 -353
  20. package/src/react/pages/Food99IntegrationPage/components/Food99CatalogTab.js +219 -219
  21. package/src/react/pages/Food99IntegrationPage/components/Food99OverviewTab.js +134 -134
  22. package/src/react/pages/Food99IntegrationPage/components/Food99PreviewModal.js +173 -173
  23. package/src/react/pages/Food99IntegrationPage/components/Food99QuickWalletModal.js +1 -1
  24. package/src/react/pages/Food99IntegrationPage/components/Food99SettingsTab.js +306 -306
  25. package/src/react/pages/Food99IntegrationPage/components/Food99StoreTab.js +417 -417
  26. package/src/react/pages/Food99IntegrationPage/index.js +1530 -1530
  27. package/src/react/pages/Food99IntegrationPage/styles.js +792 -792
  28. package/src/react/pages/IFoodIntegrationPage/components/IFoodOperationsTab.js +267 -267
  29. package/src/react/pages/IFoodIntegrationPage/components/IFoodOverviewTab.js +118 -118
  30. package/src/react/pages/IFoodIntegrationPage/components/IFoodPreviewModal.js +101 -101
  31. package/src/react/pages/IFoodIntegrationPage/components/IFoodStoreTab.js +150 -150
  32. package/src/react/pages/IFoodIntegrationPage/index.js +1298 -1298
  33. package/src/react/pages/Imports.js +1 -1
  34. package/src/react/pages/Imports.styles.js +223 -223
  35. package/src/react/pages/IntegrationConfigPage.js +2 -2
  36. package/src/react/pages/Integrations.js +299 -299
  37. package/src/react/pages/Integrations.styles.js +130 -130
  38. package/src/react/pages/LinkedInIntegrationPage.js +2 -2
  39. package/src/react/pages/ManagerOrderNotificationsPage.js +642 -642
  40. package/src/react/pages/MarketplaceIntegrationPage/components/MarketplaceProductCard.js +205 -205
  41. package/src/react/pages/MercadoLivreIntegrationPage.js +2 -2
  42. package/src/react/pages/PrinterDeviceDetailPage.js +1915 -1915
  43. package/src/react/pages/PrinterDeviceFormPage.js +2 -2
  44. package/src/react/pages/WhatsAppConnectionPage.js +280 -364
  45. package/src/react/pages/WhatsAppConnectionPage.styles.js +315 -279
  46. package/src/react/pages/WhatsAppProviderForm.js +1 -1
  47. package/src/react/pages/whatsAppConnectionHelpers.js +38 -10
  48. package/src/react/utils/fileUrl.js +1 -1
  49. package/src/store/connections/customActions.js +16 -14
  50. package/src/store/connections/index.js +109 -105
@@ -4,19 +4,18 @@ import * as types from "@controleonline/ui-default/src/store/default/mutation_ty
4
4
  export const createWhatsappConnection = ({ commit, getters }, params = {}) => {
5
5
  commit(types.SET_ISLOADING, true);
6
6
 
7
- let options = {
7
+ const options = {
8
8
  method: "POST",
9
9
  body: params,
10
10
  };
11
11
 
12
12
  return api
13
- .fetch("/whatsapp/create-session" , options)
14
- .then((data) => {
13
+ .fetch("/whatsapp/create-session", options)
14
+ .then(data => {
15
15
  commit(types.SET_ITEM, data);
16
-
17
16
  return data;
18
17
  })
19
- .catch((e) => {
18
+ .catch(e => {
20
19
  commit(types.SET_ERROR, e.message);
21
20
  throw e;
22
21
  })
@@ -26,34 +25,37 @@ export const createWhatsappConnection = ({ commit, getters }, params = {}) => {
26
25
  };
27
26
 
28
27
  /**
29
- * Persist an official (Meta Cloud API) WhatsApp connection.
30
- * Uses connections.channel = whatsapp_official and channelConfig for credentials.
28
+ * Persist official Meta Cloud API WhatsApp connection.
29
+ * channel=whatsapp_official + channelConfig JSON (write-only on API).
31
30
  */
32
- export const saveOfficialWhatsappConnection = ({ commit, getters }, params = {}) => {
31
+ export const saveOfficialWhatsappConnection = ({ commit }, params = {}) => {
33
32
  commit(types.SET_ISLOADING, true);
34
33
 
35
34
  const body = {
36
- name: params.name || `WhatsApp Oficial ${params.phoneNumberId || ''}`.trim(),
37
- channel: 'whatsapp_official',
38
- type: params.type || null,
35
+ name: params.name || `WA Oficial ${params.phoneNumberId || ""}`.trim().slice(0, 50),
36
+ channel: "whatsapp_official",
37
+ type: params.type || "relationship",
39
38
  people: params.people,
40
39
  channelConfig: JSON.stringify({
41
40
  access_token: params.accessToken,
42
41
  phone_number_id: params.phoneNumberId,
43
- api_version: params.apiVersion || 'v22.0',
42
+ api_version: params.apiVersion || "v22.0",
44
43
  }),
45
44
  };
46
45
 
46
+ if (params.status) {
47
+ body.status = params.status;
48
+ }
47
49
  if (params.phone) {
48
50
  body.phone = params.phone;
49
51
  }
50
52
 
51
53
  const options = {
52
- method: params.id ? 'PUT' : 'POST',
54
+ method: params.id ? "PUT" : "POST",
53
55
  body,
54
56
  };
55
57
 
56
- const endpoint = params.id ? `/connections/${params.id}` : '/connections';
58
+ const endpoint = params.id ? `/connections/${params.id}` : "/connections";
57
59
 
58
60
  return api
59
61
  .fetch(endpoint, options)
@@ -1,101 +1,105 @@
1
- import * as actions from "@controleonline/ui-default/src/store/default/actions";
2
- import * as getters from "@controleonline/ui-default/src/store/default/getters";
3
- import mutations from "@controleonline/ui-default/src/store/default/mutations";
4
- import * as customActions from "./customActions";
5
-
6
- export default {
7
- namespaced: true,
8
- state: {
9
- item: {},
10
- items: [],
11
- resourceEndpoint: "connections",
12
- isLoading: false,
13
- reload: false,
14
- error: "",
15
- totalItems: 0,
16
- summary: {},
17
- messages: [],
18
- message: {},
19
- filters: {},
20
- columns: [
21
- {
22
- editable: false,
23
- isIdentity: true,
24
- sortable: true,
25
- name: "id",
26
- align: "left",
27
- label: "id",
28
- sum: false,
29
- format: function (value) {
30
- return "#" + value;
31
- },
32
- },
33
- {
34
- externalFilter: false,
35
- sortable: true,
36
- name: "name",
37
- align: "left",
38
- label: "name",
39
- format: function (value) {
40
- return value;
41
- },
42
- },
43
- {
44
- externalFilter: false,
45
- sortable: true,
46
- editable: false,
47
- name: "phone",
48
- align: "left",
49
- label: "phone",
50
- format: function (value, row, column) {
51
- const phone = String(value.phone);
52
- const lastFour = phone.slice(-4);
53
- const firstPart = phone.slice(0, -4);
54
- return `(${value?.ddd}) ${firstPart}-${lastFour}`;
55
- },
56
- },
57
-
1
+ import * as actions from "@controleonline/ui-default/src/store/default/actions";
2
+ import * as getters from "@controleonline/ui-default/src/store/default/getters";
3
+ import mutations from "@controleonline/ui-default/src/store/default/mutations";
4
+ import * as customActions from "./customActions";
5
+
6
+ export default {
7
+ namespaced: true,
8
+ state: {
9
+ item: {},
10
+ items: [],
11
+ resourceEndpoint: "connections",
12
+ isLoading: false,
13
+ reload: false,
14
+ error: "",
15
+ totalItems: 0,
16
+ summary: {},
17
+ messages: [],
18
+ message: {},
19
+ filters: {},
20
+ columns: [
21
+ {
22
+ editable: false,
23
+ isIdentity: true,
24
+ sortable: true,
25
+ name: "id",
26
+ align: "left",
27
+ label: "id",
28
+ sum: false,
29
+ format: function (value) {
30
+ return "#" + value;
31
+ },
32
+ },
33
+ {
34
+ externalFilter: false,
35
+ sortable: true,
36
+ name: "name",
37
+ align: "left",
38
+ label: "name",
39
+ format: function (value) {
40
+ return value;
41
+ },
42
+ },
43
+ {
44
+ externalFilter: false,
45
+ sortable: true,
46
+ editable: false,
47
+ name: "phone",
48
+ align: "left",
49
+ label: "phone",
50
+ format: function (value, row, column) {
51
+ const phone = String(value.phone);
52
+ const lastFour = phone.slice(-4);
53
+ const firstPart = phone.slice(0, -4);
54
+ return `(${value?.ddd}) ${firstPart}-${lastFour}`;
55
+ },
56
+ },
57
+
58
58
  {
59
59
  externalFilter: false,
60
60
  sortable: true,
61
61
  name: "type",
62
62
  align: "left",
63
63
  label: "type",
64
- list: [
65
- {
66
- value: "crm",
67
- label: "CRM",
68
- },
69
- {
70
- value: "support",
71
- label: "Suporte",
72
- },
73
- {
74
- value: null,
75
- label: "Nenhum",
76
- },
77
- ],
78
- format: function (value) {
79
- return value;
80
- },
81
- },
82
-
64
+ list: [
65
+ {
66
+ value: "crm",
67
+ label: "CRM",
68
+ },
69
+ {
70
+ value: "support",
71
+ label: "Suporte",
72
+ },
73
+ {
74
+ value: null,
75
+ label: "Nenhum",
76
+ },
77
+ ],
78
+ format: function (value) {
79
+ return value;
80
+ },
81
+ },
82
+
83
83
  {
84
84
  sortable: true,
85
85
  editable: false,
86
86
  name: "channel",
87
87
  align: "left",
88
88
  label: "channel",
89
- list: [
90
- {
91
- value: "whatsapp",
92
- label: "Whatsapp",
93
- },
94
- ],
95
- format: function (value) {
96
- return value;
97
- },
98
- },
89
+ list: [
90
+ {
91
+ value: "whatsapp",
92
+ label: "WhatsApp",
93
+ },
94
+ {
95
+ value: "whatsapp_official",
96
+ label: "WhatsApp Oficial",
97
+ },
98
+ ],
99
+ format: function (value) {
100
+ return value;
101
+ },
102
+ },
99
103
  {
100
104
  editable: false,
101
105
  externalFilter: false,
@@ -103,22 +107,22 @@ export default {
103
107
  name: "status",
104
108
  align: "left",
105
109
  label: "status",
106
- list: "status/getItems",
107
- searchParam: "status",
108
- format: function (value) {
109
- return value?.status;
110
- },
111
- saveFormat: function (value) {
112
- return value ? "/statuses/" + (value.value || value) : null;
113
- },
114
- },
115
- {
116
- name: "connection",
117
- },
118
- ],
119
- print: [],
120
- },
121
- actions: { ...actions, ...customActions },
122
- getters,
123
- mutations,
124
- };
110
+ list: "status/getItems",
111
+ searchParam: "status",
112
+ format: function (value) {
113
+ return value?.status;
114
+ },
115
+ saveFormat: function (value) {
116
+ return value ? "/statuses/" + (value.value || value) : null;
117
+ },
118
+ },
119
+ {
120
+ name: "connection",
121
+ },
122
+ ],
123
+ print: [],
124
+ },
125
+ actions: { ...actions, ...customActions },
126
+ getters,
127
+ mutations,
128
+ };