From eaef44363a5e58ff2eec991ffcdecc2f9b709ebf Mon Sep 17 00:00:00 2001 From: suryac Date: Mon, 7 Sep 2026 15:46:21 +0530 Subject: [PATCH] pipeline new version update --- src/api/client.ts | 1 - src/api/config.ts | 12 ++++++++---- src/components/dv/CallDetail.tsx | 7 +++---- src/components/forms/DynamicForm.tsx | 19 +++++-------------- src/components/maps/NearestStoresMap.tsx | 6 +----- src/screens/CallsPage.tsx | 7 +++---- src/screens/DailySalesReportPage.tsx | 10 +--------- src/screens/OrdersPage.tsx | 7 +++---- 8 files changed, 24 insertions(+), 45 deletions(-) diff --git a/src/api/client.ts b/src/api/client.ts index 4f354fd..df88e2a 100644 --- a/src/api/client.ts +++ b/src/api/client.ts @@ -252,7 +252,6 @@ export class ZinoClient { dailySalesReport(data: Record): Promise { return this.request('POST', PIPELINE.endpoints.dailySalesReport, data, { - 'TemplateID': '157', 'sec-ch-ua-platform': '"Android"', }); } diff --git a/src/api/config.ts b/src/api/config.ts index 8a3f1f4..a7d1965 100644 --- a/src/api/config.ts +++ b/src/api/config.ts @@ -253,10 +253,14 @@ export const SALES_REPORT_SO_NAMES = [ // --- Pipeline Endpoints --- export const PIPELINE = { endpoints: { - nearestStores: '/api/papi2/nearest-stores', - dailySalesReport: '/api/papi2/daily-sales-report', - productiveCallSummary: '/api/papi2/productive-call-summary', - salesOfficers: '/api/papi2/sales-officers' + nearestStores: '/api/p/krishna-group/v1/nearest-stores', + dailySalesReport: '/api/p/krishna-group/v1/daily-sales-report', + productiveCallSummary: '/api/p/krishna-group/v1/productive-call-summary', + salesOfficers: '/api/p/krishna-group/v1/sales-officers', + autoCloseOrders: '/api/p/krishna-group/v1/auto-close-orders', + editOrder: '/api/p/krishna-group/v1/edit-orders', + order: '/api/p/krishna-group/v1/orders', + potentialMining: '/api/p/krishna-group/v1/potential-mining' } }; diff --git a/src/components/dv/CallDetail.tsx b/src/components/dv/CallDetail.tsx index e98758b..2c5e288 100644 --- a/src/components/dv/CallDetail.tsx +++ b/src/components/dv/CallDetail.tsx @@ -1,6 +1,6 @@ import { useEffect, useState, type ReactNode } from 'react'; import { orderBookingClient } from '../../api/clients'; -import { ORDER_BOOKING, APP_ID } from '../../api/config'; +import { ORDER_BOOKING, APP_ID, PIPELINE } from '../../api/config'; import { Spinner } from '../reusable/Spinner'; import { EmptyState } from '../reusable/EmptyState'; import { @@ -57,9 +57,8 @@ export function CallDetail({ if (storeCode) { orderBookingClient.request<{ potential: { potential: any[] } }>( 'POST', - '/api/papi2/potential-mining', - { store_code: storeCode, instance_id: String(instanceId) }, - { 'TemplateID': '146' } + PIPELINE.endpoints.potentialMining, + { store_code: storeCode, instance_id: String(instanceId) } ).then(res => { if (live) setPotentialData(res.potential?.potential || []); }).catch(e => console.warn("Failed to fetch potential mining", e)); diff --git a/src/components/forms/DynamicForm.tsx b/src/components/forms/DynamicForm.tsx index 85935d1..a9cc264 100644 --- a/src/components/forms/DynamicForm.tsx +++ b/src/components/forms/DynamicForm.tsx @@ -17,7 +17,7 @@ import { WfLookupField, RadioField, } from './fields'; -import { ORDER_BOOKING, STORE, DAILY_REPORTS, HIDDEN_FORM_FIELDS, SELECT_OPTION_LIMIT } from '../../api/config'; +import { ORDER_BOOKING, STORE, DAILY_REPORTS, HIDDEN_FORM_FIELDS, SELECT_OPTION_LIMIT, PIPELINE } from '../../api/config'; export interface DynamicFormProps { client: ZinoClient; @@ -141,18 +141,10 @@ export function DynamicForm({ client, activityId: initialActivityId, instanceId: const userEmail = user?.email; if (userEmail) { try { - const headers: Record = { - 'templateid': '192', - 'x-pipeline-version': 'latest' - }; - headers['orgid'] = '57'; - headers['groupid'] = '25'; - const summaryRes = await client.request( 'POST', - '/api/papi2/productive-call-summary', - { email: userEmail }, - headers + PIPELINE.endpoints.productiveCallSummary, + { email: userEmail } ); let summaryData = summaryRes.data || summaryRes; if (Array.isArray(summaryData)) { @@ -478,12 +470,11 @@ export function DynamicForm({ client, activityId: initialActivityId, instanceId: try { const pmRes = await client.request<{ potential: { potential: any[] } }>( 'POST', - '/api/papi2/potential-mining', + PIPELINE.endpoints.potentialMining, { instance_id: String(res.instance_id ?? currentInstanceId), store_code: storeCodeToSend - }, - { 'TemplateID': '146' } + } ); const rawPotential = pmRes.potential?.potential || []; const mappedPotential = rawPotential.map((row: any) => { diff --git a/src/components/maps/NearestStoresMap.tsx b/src/components/maps/NearestStoresMap.tsx index a6ab6ba..19ff54d 100644 --- a/src/components/maps/NearestStoresMap.tsx +++ b/src/components/maps/NearestStoresMap.tsx @@ -64,11 +64,7 @@ export function NearestStoresMap() { method: 'POST', headers: { 'accept': 'application/json, text/plain, */*', - 'content-type': 'application/json', - 'groupid': '25', - 'orgid': '57', - 'templateid': '189', - 'x-pipeline-version': 'latest' + 'content-type': 'application/json' }, body: JSON.stringify({ latitude: lat, diff --git a/src/screens/CallsPage.tsx b/src/screens/CallsPage.tsx index b915bb5..4957a45 100644 --- a/src/screens/CallsPage.tsx +++ b/src/screens/CallsPage.tsx @@ -7,7 +7,7 @@ import { Phone, Plus } from 'lucide-react'; import { Button } from '../components/buttons/Button'; import { LogVisitForm } from '../components/forms/LogVisitForm'; import { DynamicForm } from '../components/forms/DynamicForm'; -import { ORDER_BOOKING } from '../api/config'; +import { ORDER_BOOKING, PIPELINE } from '../api/config'; import { orderBookingClient } from '../api/clients'; export function CallsPage() { @@ -40,9 +40,8 @@ export function CallsPage() { const response = await orderBookingClient.request<{ potential: { potential: any[] } }>( 'POST', - '/api/papi2/potential-mining', - payload, - { 'TemplateID': '146' } + PIPELINE.endpoints.potentialMining, + payload ); const rawPotential = response.potential?.potential || []; diff --git a/src/screens/DailySalesReportPage.tsx b/src/screens/DailySalesReportPage.tsx index c66417c..856124b 100644 --- a/src/screens/DailySalesReportPage.tsx +++ b/src/screens/DailySalesReportPage.tsx @@ -27,15 +27,7 @@ export function DailySalesReportPage() { useEffect(() => { async function fetchSOs() { try { - const res = await fetch(`${BASE_URL}${PIPELINE.endpoints.salesOfficers}`, { - headers: { - 'TemplateID': '194', - 'X-Pipeline-Version': 'latest', - 'OrgID': '57', - 'GroupID': '25', - 'Content-Type': 'application/json' - } - }); + const res = await fetch(`${BASE_URL}${PIPELINE.endpoints.salesOfficers}`); const data = await res.json(); if (data?.response?.options) { setSoOptions(data.response.options); diff --git a/src/screens/OrdersPage.tsx b/src/screens/OrdersPage.tsx index e0bc3df..38e24f0 100644 --- a/src/screens/OrdersPage.tsx +++ b/src/screens/OrdersPage.tsx @@ -8,7 +8,7 @@ import { Plus, ShoppingBag } from 'lucide-react'; import { Button } from '../components/buttons/Button'; import { LogVisitForm } from '../components/forms/LogVisitForm'; import { DynamicForm } from '../components/forms/DynamicForm'; -import { ORDER_BOOKING } from '../api/config'; +import { ORDER_BOOKING, PIPELINE } from '../api/config'; import { orderBookingClient } from '../api/clients'; export function OrdersPage() { @@ -42,9 +42,8 @@ export function OrdersPage() { const response = await orderBookingClient.request<{ potential: { potential: any[] } }>( 'POST', - '/api/papi2/potential-mining', - payload, - { 'TemplateID': '146' } + PIPELINE.endpoints.potentialMining, + payload ); const rawPotential = response.potential?.potential || [];