From 40518cbea936db68e85aeab37f2280200af64835 Mon Sep 17 00:00:00 2001 From: suryac Date: Thu, 1 Oct 2026 12:17:33 +0530 Subject: [PATCH] fix:store field types --- src/api/client.ts | 4 +++- src/components/forms/DynamicForm.tsx | 10 ++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/src/api/client.ts b/src/api/client.ts index 22a09d7..93eeab6 100644 --- a/src/api/client.ts +++ b/src/api/client.ts @@ -221,9 +221,11 @@ export class ZinoClient { // --- Workflow execution (core) --- - startInstance(activityUid: string, data: Record): Promise { + startInstance(activityUid: string, data: Record, opts?: { version_uuid?: string; version_id?: number }): Promise { return this.request('POST', `/app/${APP_ID}/start`, { workflow_uuid: this.workflowUuid, + ...(opts?.version_uuid && { version_uuid: opts.version_uuid }), + ...(opts?.version_id && { version_id: opts.version_id }), activity_id: activityUid, data, }); diff --git a/src/components/forms/DynamicForm.tsx b/src/components/forms/DynamicForm.tsx index 196f5ef..5c8a88a 100644 --- a/src/components/forms/DynamicForm.tsx +++ b/src/components/forms/DynamicForm.tsx @@ -551,7 +551,11 @@ export function DynamicForm({ client, activityId: initialActivityId, instanceId: if (val == null) continue; - if (f.data_type === 'phone' && typeof val === 'string') { + if (f.data_type === 'number' && typeof val === 'string') { + payload[f.id] = val === '' ? null : Number(val); + } else if (f.data_type.startsWith('geolocation') && val && typeof val === 'object') { + payload[f.id] = { lat: (val as any).lat, lng: (val as any).lng }; + } else if (f.data_type === 'phone' && typeof val === 'string') { const phoneNum = val.replace(/^\+91\s*/, '').trim(); payload[f.id] = { dial_code: '+91', @@ -703,7 +707,9 @@ export function DynamicForm({ client, activityId: initialActivityId, instanceId: if (currentInstanceId != null) { res = await client.performActivity(currentInstanceId, currentActivityId, payload); } else { - res = await client.startInstance(currentActivityId, payload); + const isStoreInit = currentActivityId === STORE.activities.INIT.uid; + const versionOpts = isStoreInit ? { version_uuid: STORE.versionUuid, version_id: 30034 } : {}; + res = await client.startInstance(currentActivityId, payload, versionOpts); } setHasSubmitted(true);