From cdf4ee9c2e0099c3035bff3c34c43e9f3f5c642d Mon Sep 17 00:00:00 2001 From: Sthefani Date: Fri, 29 Sep 2023 09:21:35 -0300 Subject: [PATCH 1/3] feat: whatsapp products catalogs base --- src/api/appType/whatsapp_cloud/index.js | 9 + .../config/channels/whatsapp/Setup.vue | 3 +- .../whatsapp/components/tabs/AccountTab.vue | 64 ++++--- src/components/whatsAppCatalogs/Card.vue | 166 ++++++++++++++++++ src/components/whatsAppCatalogs/Table.vue | 62 +++++++ src/locales/pt_br.json | 31 ++++ src/router.js | 14 ++ .../channels/whatsapp_cloud/actions.js | 20 +++ .../channels/whatsapp_cloud/mutations.js | 24 +++ .../appType/channels/whatsapp_cloud/state.js | 8 + src/views/whatsAppCatalogs/Base.vue | 59 +++++++ src/views/whatsAppCatalogs/Table.vue | 19 ++ 12 files changed, 458 insertions(+), 21 deletions(-) create mode 100644 src/components/whatsAppCatalogs/Card.vue create mode 100644 src/components/whatsAppCatalogs/Table.vue create mode 100644 src/views/whatsAppCatalogs/Base.vue create mode 100644 src/views/whatsAppCatalogs/Table.vue diff --git a/src/api/appType/whatsapp_cloud/index.js b/src/api/appType/whatsapp_cloud/index.js index 384d3841..407b9ae4 100644 --- a/src/api/appType/whatsapp_cloud/index.js +++ b/src/api/appType/whatsapp_cloud/index.js @@ -2,6 +2,8 @@ import qs from 'query-string'; import request from '@/api/request.js'; const resource = '/api/v1/apptypes/wpp-cloud/apps'; +const catalogsResource = '/api/v1/apptypes/wpp-cloud'; + export default { getDebugToken(params) { const queryString = qs.stringify(params); @@ -14,4 +16,11 @@ export default { configurePhoneNumber(data) { return request.$http.post(`${resource}/`, data); }, + getWhatsAppCloudCatalogs(appUuid, params) { + const queryString = qs.stringify(params); + return request.$http.get(`${catalogsResource}/${appUuid}/catalogs/?${queryString}`); + }, + fetchCatalogData(appUuid, catalogUuid) { + return request.$http.get(`${catalogsResource}/${appUuid}/catalogs/${catalogUuid}/`); + }, }; diff --git a/src/components/config/channels/whatsapp/Setup.vue b/src/components/config/channels/whatsapp/Setup.vue index 4f03de41..6c61e65d 100644 --- a/src/components/config/channels/whatsapp/Setup.vue +++ b/src/components/config/channels/whatsapp/Setup.vue @@ -173,7 +173,8 @@ }, { return_scopes: true, - scope: 'business_management,whatsapp_business_management,whatsapp_business_messaging', + scope: + 'business_management,whatsapp_business_management,whatsapp_business_messaging,catalog_management', extras: { feature: 'whatsapp_embedded_signup', }, diff --git a/src/components/config/channels/whatsapp/components/tabs/AccountTab.vue b/src/components/config/channels/whatsapp/components/tabs/AccountTab.vue index 5e235e6f..4ee81fa1 100644 --- a/src/components/config/channels/whatsapp/components/tabs/AccountTab.vue +++ b/src/components/config/channels/whatsapp/components/tabs/AccountTab.vue @@ -3,18 +3,35 @@