pipeline new version update
This commit is contained in:
parent
949cad9926
commit
eaef44363a
@ -252,7 +252,6 @@ export class ZinoClient {
|
||||
|
||||
dailySalesReport(data: Record<string, unknown>): Promise<any> {
|
||||
return this.request('POST', PIPELINE.endpoints.dailySalesReport, data, {
|
||||
'TemplateID': '157',
|
||||
'sec-ch-ua-platform': '"Android"',
|
||||
});
|
||||
}
|
||||
|
||||
@ -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'
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@ -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));
|
||||
|
||||
@ -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<string, string> = {
|
||||
'templateid': '192',
|
||||
'x-pipeline-version': 'latest'
|
||||
};
|
||||
headers['orgid'] = '57';
|
||||
headers['groupid'] = '25';
|
||||
|
||||
const summaryRes = await client.request<any>(
|
||||
'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) => {
|
||||
|
||||
@ -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,
|
||||
|
||||
@ -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 || [];
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -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 || [];
|
||||
|
||||
Loading…
Reference in New Issue
Block a user