@splpi/estore-shared-components 7.0.3 → 7.0.5

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.
package/dist/index.mjs CHANGED
@@ -230,7 +230,7 @@ var STANDARD_ICON_BUTTON_STYLES = {
230
230
  var OCR_STORAGE_KEY = "ocrResult";
231
231
  var readStored = () => {
232
232
  try {
233
- const raw = localStorage.getItem(OCR_STORAGE_KEY);
233
+ const raw = sessionStorage.getItem(OCR_STORAGE_KEY);
234
234
  return raw ? JSON.parse(raw) : null;
235
235
  } catch {
236
236
  return null;
@@ -247,7 +247,7 @@ var markOcrApplied = (section) => {
247
247
  const stored = readStored();
248
248
  if (!stored || stored.applied?.[section]) return false;
249
249
  try {
250
- localStorage.setItem(
250
+ sessionStorage.setItem(
251
251
  OCR_STORAGE_KEY,
252
252
  JSON.stringify({ ...stored, applied: { ...stored.applied, [section]: true } })
253
253
  );
@@ -259,14 +259,14 @@ var markOcrApplied = (section) => {
259
259
  var saveOcrResult = (value) => {
260
260
  if (typeof window === "undefined") return;
261
261
  try {
262
- localStorage.setItem(OCR_STORAGE_KEY, JSON.stringify(value));
262
+ sessionStorage.setItem(OCR_STORAGE_KEY, JSON.stringify(value));
263
263
  } catch {
264
264
  }
265
265
  };
266
266
  var clearOcrResult = () => {
267
267
  if (typeof window === "undefined") return;
268
268
  try {
269
- localStorage.removeItem(OCR_STORAGE_KEY);
269
+ sessionStorage.removeItem(OCR_STORAGE_KEY);
270
270
  } catch {
271
271
  }
272
272
  };
@@ -388,22 +388,22 @@ var LifePlanApplication1 = ({
388
388
  onUpdate
389
389
  }) => {
390
390
  const [formData, setFormData] = useState2(() => applyOcr({
391
- firstName: initialData?.firstName ?? "Juan",
392
- middleName: initialData?.middleName ?? "Santos",
393
- lastName: initialData?.lastName ?? "Dela Cruz",
391
+ firstName: initialData?.firstName ?? "",
392
+ middleName: initialData?.middleName ?? "",
393
+ lastName: initialData?.lastName ?? "",
394
394
  suffix: initialData?.suffix ?? "",
395
- birthDate: initialData?.birthDate ?? "1990-05-15",
396
- idType: initialData?.idType ?? "national_id",
397
- idNumber: initialData?.idNumber ?? "1234-5678-9012",
398
- height: initialData?.height ?? 5.7,
399
- weight: initialData?.weight ?? 154,
400
- gender: initialData?.gender ?? "male",
401
- civilStatus: initialData?.civilStatus ?? "married",
402
- nationality: initialData?.nationality ?? "Filipino",
403
- mobileNumber: initialData?.mobileNumber ?? "0917-123-4567",
404
- emailAddress: initialData?.emailAddress ?? "juan.delacruz@example.com",
405
- mailingAddress: initialData?.mailingAddress ?? "123 Mabini Street, Barangay San Antonio, Makati City",
406
- landLineNumber: initialData?.landLineNumber ?? "02-8123-4567"
395
+ birthDate: initialData?.birthDate ?? "",
396
+ idType: initialData?.idType ?? "",
397
+ idNumber: initialData?.idNumber ?? "",
398
+ height: initialData?.height ?? 0,
399
+ weight: initialData?.weight ?? 0,
400
+ gender: initialData?.gender ?? "",
401
+ civilStatus: initialData?.civilStatus ?? "",
402
+ nationality: initialData?.nationality ?? "",
403
+ mobileNumber: initialData?.mobileNumber ?? "",
404
+ emailAddress: initialData?.emailAddress ?? "",
405
+ mailingAddress: initialData?.mailingAddress ?? "",
406
+ landLineNumber: initialData?.landLineNumber ?? ""
407
407
  }, readOcrResult("personal")));
408
408
  const updateFormData = (nextData) => {
409
409
  setFormData(nextData);
@@ -882,15 +882,16 @@ var matchOption = (candidates, options) => {
882
882
  return "";
883
883
  };
884
884
  var LifePlanApplication2 = ({
885
+ initialData,
885
886
  onAddressUpdate,
886
887
  parseAddress
887
888
  }) => {
888
- const [lot, setLot] = useState3("");
889
- const [street, setStreet] = useState3("");
890
- const [city, setCity] = useState3("");
891
- const [province, setProvince] = useState3("");
892
- const [district, setDistrict] = useState3("");
893
- const [barangay, setBarangay] = useState3("");
889
+ const [lot, setLot] = useState3(initialData?.lot ?? "");
890
+ const [street, setStreet] = useState3(initialData?.street ?? "");
891
+ const [city, setCity] = useState3(initialData?.city ?? "");
892
+ const [province, setProvince] = useState3(initialData?.province ?? "");
893
+ const [district, setDistrict] = useState3(initialData?.district ?? "");
894
+ const [barangay, setBarangay] = useState3(initialData?.barangay ?? "");
894
895
  useEffect2(() => {
895
896
  if (!parseAddress) return;
896
897
  const ocr = readOcrResult("address");
@@ -1013,13 +1014,13 @@ var LifePlanApplication3 = ({
1013
1014
  onUpdate
1014
1015
  }) => {
1015
1016
  const [formData, setFormData] = React.useState({
1016
- occupation: initialData?.occupation ?? "Software Engineer",
1017
- employerName: initialData?.employerName ?? "ABC Technologies Inc.",
1018
- employmentStatus: initialData?.employmentStatus ?? "Regular",
1019
- officeAddress: initialData?.officeAddress ?? "456 Ayala Avenue, Bel-Air, Makati City",
1020
- TIN: initialData?.TIN ?? "123-456-789-000",
1021
- SSS: initialData?.SSS ?? "34-1234567-8",
1022
- sourceOfIncome: initialData?.sourceOfIncome ?? "Salary"
1017
+ occupation: initialData?.occupation ?? "",
1018
+ employerName: initialData?.employerName ?? "",
1019
+ employmentStatus: initialData?.employmentStatus ?? "",
1020
+ officeAddress: initialData?.officeAddress ?? "",
1021
+ TIN: initialData?.TIN ?? "",
1022
+ SSS: initialData?.SSS ?? "",
1023
+ sourceOfIncome: initialData?.sourceOfIncome ?? ""
1023
1024
  });
1024
1025
  const updateFormData = (nextData) => {
1025
1026
  setFormData(nextData);
@@ -1169,6 +1170,7 @@ var RowItem = ({
1169
1170
 
1170
1171
  // src/lib/applicationData.ts
1171
1172
  var LIFE_PLAN_APPLICATION_KEY = "LifePlanApplication";
1173
+ var APPLICATION_DATA_CHANGE_EVENT = "lifeplan-application:change";
1172
1174
  var createEmptyApplicationData = () => ({
1173
1175
  personalInfo: {
1174
1176
  firstName: "",
@@ -1213,19 +1215,57 @@ var createEmptyApplicationData = () => ({
1213
1215
  healthDeclaration4: false
1214
1216
  }
1215
1217
  });
1216
- var loadApplicationDataFromLocalStorage = (storageKey = LIFE_PLAN_APPLICATION_KEY) => {
1218
+ var getStorage = () => {
1217
1219
  if (typeof window === "undefined") return null;
1218
1220
  try {
1219
- const stored = window.localStorage.getItem(storageKey);
1221
+ return window.sessionStorage;
1222
+ } catch {
1223
+ return null;
1224
+ }
1225
+ };
1226
+ var notifyChange = (storageKey) => {
1227
+ window.dispatchEvent(
1228
+ new CustomEvent(APPLICATION_DATA_CHANGE_EVENT, { detail: { storageKey } })
1229
+ );
1230
+ };
1231
+ var loadApplicationData = (storageKey = LIFE_PLAN_APPLICATION_KEY) => {
1232
+ const storage = getStorage();
1233
+ if (!storage) return null;
1234
+ try {
1235
+ const stored = storage.getItem(storageKey);
1220
1236
  return stored ? JSON.parse(stored) : null;
1221
1237
  } catch {
1222
1238
  return null;
1223
1239
  }
1224
1240
  };
1225
- var saveApplicationDataToLocalStorage = (data, storageKey = LIFE_PLAN_APPLICATION_KEY) => {
1226
- if (typeof window === "undefined") return;
1227
- window.localStorage.setItem(storageKey, JSON.stringify(data));
1241
+ var saveApplicationData = (data, storageKey = LIFE_PLAN_APPLICATION_KEY) => {
1242
+ const storage = getStorage();
1243
+ if (!storage) return;
1244
+ try {
1245
+ storage.setItem(storageKey, JSON.stringify(data));
1246
+ } catch {
1247
+ return;
1248
+ }
1249
+ notifyChange(storageKey);
1250
+ };
1251
+ var updateApplicationData = (patch, storageKey = LIFE_PLAN_APPLICATION_KEY) => {
1252
+ const current = loadApplicationData(storageKey) ?? createEmptyApplicationData();
1253
+ const next = { ...current, ...patch };
1254
+ saveApplicationData(next, storageKey);
1255
+ return next;
1256
+ };
1257
+ var clearApplicationData = (storageKey = LIFE_PLAN_APPLICATION_KEY) => {
1258
+ const storage = getStorage();
1259
+ if (!storage) return;
1260
+ try {
1261
+ storage.removeItem(storageKey);
1262
+ } catch {
1263
+ return;
1264
+ }
1265
+ notifyChange(storageKey);
1228
1266
  };
1267
+ var loadApplicationDataFromLocalStorage = loadApplicationData;
1268
+ var saveApplicationDataToLocalStorage = saveApplicationData;
1229
1269
 
1230
1270
  // src/NewSaleForm/beneficiary.tsx
1231
1271
  import { Fragment, jsx as jsx6, jsxs as jsxs6 } from "react/jsx-runtime";
@@ -1279,13 +1319,13 @@ var Beneficiary = ({ onUpdate }) => {
1279
1319
  contingent.length > 0 ? contingent[0] : void 0,
1280
1320
  allBeneficiaries
1281
1321
  );
1282
- const currentData = loadApplicationDataFromLocalStorage() ?? createEmptyApplicationData();
1322
+ const currentData = loadApplicationData() ?? createEmptyApplicationData();
1283
1323
  const {
1284
1324
  principalBeneficiary: _oldPrincipal,
1285
1325
  contingentBeneficiary: _oldContingent,
1286
1326
  ...restData
1287
1327
  } = currentData;
1288
- saveApplicationDataToLocalStorage({
1328
+ saveApplicationData({
1289
1329
  ...restData,
1290
1330
  beneficiaries: allBeneficiaries,
1291
1331
  ...principal[0] ? { principalBeneficiary: principal[0] } : {},
@@ -1294,7 +1334,7 @@ var Beneficiary = ({ onUpdate }) => {
1294
1334
  };
1295
1335
  useEffect3(() => {
1296
1336
  const timeoutId = window.setTimeout(() => {
1297
- const currentData = loadApplicationDataFromLocalStorage();
1337
+ const currentData = loadApplicationData();
1298
1338
  if (!currentData) return;
1299
1339
  const storedBeneficiaries = currentData.beneficiaries ?? [];
1300
1340
  let principalFromStorage = storedBeneficiaries.filter(
@@ -1954,29 +1994,18 @@ var HealthDeclaration = () => {
1954
1994
  healthDeclaration3: false,
1955
1995
  healthDeclaration4: false
1956
1996
  });
1997
+ const [hydrated, setHydrated] = useState5(false);
1957
1998
  useEffect4(() => {
1958
- let appData = loadApplicationDataFromLocalStorage();
1959
- if (!appData) {
1960
- appData = createEmptyApplicationData();
1961
- saveApplicationDataToLocalStorage(appData);
1962
- }
1963
- if (appData && appData.healthDeclaration) {
1999
+ const appData = loadApplicationData();
2000
+ if (appData?.healthDeclaration) {
1964
2001
  setHealthDeclarationValues(appData.healthDeclaration);
1965
2002
  }
2003
+ setHydrated(true);
1966
2004
  }, []);
1967
2005
  useEffect4(() => {
1968
- return () => {
1969
- const appData = loadApplicationDataFromLocalStorage();
1970
- if (appData) {
1971
- appData.healthDeclaration = healthDeclarationValues;
1972
- saveApplicationDataToLocalStorage(appData);
1973
- console.log(
1974
- "Health Declaration saved to localStorage",
1975
- healthDeclarationValues
1976
- );
1977
- }
1978
- };
1979
- }, [healthDeclarationValues]);
2006
+ if (!hydrated) return;
2007
+ updateApplicationData({ healthDeclaration: healthDeclarationValues });
2008
+ }, [healthDeclarationValues, hydrated]);
1980
2009
  const items = [
1981
2010
  {
1982
2011
  value: "first-item",
@@ -2292,7 +2321,7 @@ var LifePlanApplicationFormWrapper = ({
2292
2321
  const [openSections, setOpenSections] = useState7(["personal"]);
2293
2322
  useEffect5(() => {
2294
2323
  const timeoutId = window.setTimeout(() => {
2295
- const saved = loadApplicationDataFromLocalStorage();
2324
+ const saved = loadApplicationData();
2296
2325
  if (saved) setApplicationData(saved);
2297
2326
  setHydrated(true);
2298
2327
  }, 0);
@@ -2300,7 +2329,11 @@ var LifePlanApplicationFormWrapper = ({
2300
2329
  }, []);
2301
2330
  useEffect5(() => {
2302
2331
  if (!hydrated) return;
2303
- saveApplicationDataToLocalStorage(applicationData);
2332
+ updateApplicationData({
2333
+ personalInfo: applicationData.personalInfo,
2334
+ address: applicationData.address,
2335
+ employment: applicationData.employment
2336
+ });
2304
2337
  }, [applicationData, hydrated]);
2305
2338
  const isComplete = isPersonalComplete(applicationData.personalInfo) && isAddressComplete(applicationData.address);
2306
2339
  useEffect5(() => {
@@ -2361,6 +2394,7 @@ var LifePlanApplicationFormWrapper = ({
2361
2394
  page: /* @__PURE__ */ jsx10(
2362
2395
  LifePlanApplication2_default,
2363
2396
  {
2397
+ initialData: applicationData.address,
2364
2398
  onAddressUpdate: handleAddressUpdate,
2365
2399
  ...parseAddress ? { parseAddress } : {}
2366
2400
  }
@@ -2388,6 +2422,7 @@ var LifePlanApplicationFormWrapper = ({
2388
2422
  (prev) => prev.includes(value) ? prev.filter((sectionValue) => sectionValue !== value) : [...prev, value]
2389
2423
  );
2390
2424
  };
2425
+ if (!hydrated) return null;
2391
2426
  return /* @__PURE__ */ jsxs10(Box9, { w: "full", children: [
2392
2427
  /* @__PURE__ */ jsx10(
2393
2428
  Flex4,
@@ -2438,7 +2473,7 @@ var LifePlanApplicationFormWrapper_default = LifePlanApplicationFormWrapper;
2438
2473
 
2439
2474
  // src/NewSaleForm/SharedLifePlanApplication.tsx
2440
2475
  import { Box as Box14 } from "@chakra-ui/react";
2441
- import { useState as useState11 } from "react";
2476
+ import { useState as useState12 } from "react";
2442
2477
 
2443
2478
  // src/NewSaleForm/data/lifePlanSteps.tsx
2444
2479
  import { FaClipboardCheck, FaFileSignature, FaRegUser as FaRegUser3 } from "react-icons/fa";
@@ -2465,7 +2500,7 @@ import { FaRegAddressCard as FaRegAddressCard2 } from "react-icons/fa6";
2465
2500
  import { FaRegUser as FaRegUser2 } from "react-icons/fa";
2466
2501
  import { IoIosInformationCircleOutline as IoIosInformationCircleOutline2 } from "react-icons/io";
2467
2502
  import { FiEdit2 } from "react-icons/fi";
2468
- import { useEffect as useEffect6, useState as useState9 } from "react";
2503
+ import { useEffect as useEffect7, useState as useState10 } from "react";
2469
2504
 
2470
2505
  // src/NewSaleForm/data/checkBoxList.tsx
2471
2506
  import { Box as Box10, Separator as Separator2 } from "@chakra-ui/react";
@@ -2568,9 +2603,22 @@ var checkboxList = [
2568
2603
  }
2569
2604
  ];
2570
2605
 
2606
+ // src/hooks/useApplicationData.ts
2607
+ import { useEffect as useEffect6, useState as useState8 } from "react";
2608
+ function useApplicationData(storageKey = LIFE_PLAN_APPLICATION_KEY) {
2609
+ const [data, setData] = useState8(null);
2610
+ useEffect6(() => {
2611
+ const refresh = () => setData(loadApplicationData(storageKey));
2612
+ refresh();
2613
+ window.addEventListener(APPLICATION_DATA_CHANGE_EVENT, refresh);
2614
+ return () => window.removeEventListener(APPLICATION_DATA_CHANGE_EVENT, refresh);
2615
+ }, [storageKey]);
2616
+ return data;
2617
+ }
2618
+
2571
2619
  // src/NewSaleForm/ui/info-card-accordion.tsx
2572
2620
  import { Box as Box11, Button as Button2, Flex as Flex5, Icon as Icon2, Text as Text6 } from "@chakra-ui/react";
2573
- import { useState as useState8 } from "react";
2621
+ import { useState as useState9 } from "react";
2574
2622
  import { LuChevronDown as LuChevronDown2, LuChevronUp as LuChevronUp2, LuHash as LuHash2, LuPencil as LuPencil2 } from "react-icons/lu";
2575
2623
  import { jsx as jsx12, jsxs as jsxs12 } from "react/jsx-runtime";
2576
2624
  function InfoCardAccordion({
@@ -2584,7 +2632,7 @@ function InfoCardAccordion({
2584
2632
  onToggle,
2585
2633
  onEdit
2586
2634
  }) {
2587
- const [internalOpen, setInternalOpen] = useState8(defaultOpen);
2635
+ const [internalOpen, setInternalOpen] = useState9(defaultOpen);
2588
2636
  const isControlled = controlledOpen !== void 0;
2589
2637
  const isOpen = isControlled ? controlledOpen : internalOpen;
2590
2638
  const toggle = () => {
@@ -2697,6 +2745,12 @@ var modeLabel = (mode) => {
2697
2745
  return mode || "-";
2698
2746
  }
2699
2747
  };
2748
+ var display = (value) => {
2749
+ if (value === void 0 || value === null) return void 0;
2750
+ if (typeof value === "number") return value > 0 ? String(value) : void 0;
2751
+ return value.trim() !== "" ? value : void 0;
2752
+ };
2753
+ var classLabel = (beneficiaryClass) => beneficiaryClass === "contingent" ? "Contingent" : "Principal";
2700
2754
  var ApplicationAccordion = ({
2701
2755
  items,
2702
2756
  onEdit
@@ -2768,23 +2822,18 @@ var SectionCard = ({
2768
2822
  }
2769
2823
  );
2770
2824
  var Confirmation = ({ onAllAcceptedChange, onEdit }) => {
2771
- const [cartItems, setCartItems] = useState9(null);
2772
- const [lifePlanApplication, setLifePlanApplication] = useState9(null);
2773
- const [openDialog, setOpenDialog] = useState9(false);
2774
- const [pendingCheck, setPendingCheck] = useState9(null);
2775
- const [acceptedAgreements, setAcceptedAgreements] = useState9(
2825
+ const [cartItems, setCartItems] = useState10(null);
2826
+ const lifePlanApplication = useApplicationData();
2827
+ const [openDialog, setOpenDialog] = useState10(false);
2828
+ const [pendingCheck, setPendingCheck] = useState10(null);
2829
+ const [acceptedAgreements, setAcceptedAgreements] = useState10(
2776
2830
  () => checkboxList.map(() => false)
2777
2831
  );
2778
- useEffect6(() => {
2832
+ useEffect7(() => {
2779
2833
  const loadStoredData = () => {
2780
2834
  try {
2781
2835
  const checkoutStored = sessionStorage.getItem("CheckoutCart");
2782
2836
  const cartStored = sessionStorage.getItem("Cart");
2783
- const lifePlanApplicationStored = localStorage.getItem(
2784
- "LifePlanApplication"
2785
- );
2786
- const parsedApplicationData = lifePlanApplicationStored ? JSON.parse(lifePlanApplicationStored) : null;
2787
- setLifePlanApplication(parsedApplicationData);
2788
2837
  if (checkoutStored) {
2789
2838
  const parsedCheckout = JSON.parse(checkoutStored);
2790
2839
  setCartItems(
@@ -2810,23 +2859,18 @@ var Confirmation = ({ onAllAcceptedChange, onEdit }) => {
2810
2859
  const acceptedCount = acceptedAgreements.filter(Boolean).length;
2811
2860
  const allAccepted = checkboxList.length > 0 && acceptedCount === checkboxList.length;
2812
2861
  const pendingAgreement = pendingCheck !== null ? checkboxList[pendingCheck] : null;
2813
- useEffect6(() => {
2862
+ useEffect7(() => {
2814
2863
  onAllAcceptedChange?.(allAccepted);
2815
2864
  }, [allAccepted, onAllAcceptedChange]);
2816
- const beneficiaries = [
2817
- {
2818
- name: "John Doe",
2819
- relationship: "Relative",
2820
- dob: "1990-11-02",
2821
- address: "Sample Street, Sample Barangay, Sample City"
2822
- },
2823
- {
2824
- name: "Jane Smith",
2825
- relationship: "Relative",
2826
- dob: "1992-04-15",
2827
- address: "Sample Avenue, Sample District, Sample City"
2828
- }
2829
- ];
2865
+ const beneficiaries = (lifePlanApplication?.beneficiaries ?? []).map(
2866
+ (beneficiary) => ({
2867
+ name: [beneficiary.firstName, beneficiary.middleInitial, beneficiary.lastName].map((part) => part?.trim()).filter(Boolean).join(" "),
2868
+ beneficiaryClass: classLabel(beneficiary.beneficiaryClass),
2869
+ relationship: beneficiary.relationship,
2870
+ dob: beneficiary.birthDate,
2871
+ address: beneficiary.address
2872
+ })
2873
+ );
2830
2874
  const confirmAgreement = () => {
2831
2875
  if (pendingCheck === null) return;
2832
2876
  setAcceptedAgreements((prev) => {
@@ -2845,75 +2889,54 @@ var Confirmation = ({ onAllAcceptedChange, onEdit }) => {
2845
2889
  value: selectedPlan ? `\u20B1 ${selectedPlan.total}` : void 0
2846
2890
  }
2847
2891
  ];
2892
+ const personal = lifePlanApplication?.personalInfo;
2893
+ const address = lifePlanApplication?.address;
2894
+ const employment = lifePlanApplication?.employment;
2848
2895
  const personalRows = [
2849
- { label: "Uploaded ID", value: lifePlanApplication?.personalInfo.idType },
2850
- { label: "Last Name", value: lifePlanApplication?.personalInfo.lastName },
2851
- { label: "First Name", value: lifePlanApplication?.personalInfo.firstName },
2852
- {
2853
- label: "Middle Name",
2854
- value: lifePlanApplication?.personalInfo.middleName
2855
- },
2856
- { label: "Suffix", value: lifePlanApplication?.personalInfo.suffix },
2857
- {
2858
- label: "Date of Birth",
2859
- value: lifePlanApplication?.personalInfo.birthDate
2860
- },
2861
- { label: "Gender", value: lifePlanApplication?.personalInfo.gender },
2862
- {
2863
- label: "Contact Number",
2864
- value: lifePlanApplication?.personalInfo.mobileNumber
2865
- },
2866
- { label: "Email", value: lifePlanApplication?.personalInfo.emailAddress },
2867
- {
2868
- label: "Landline Number",
2869
- value: lifePlanApplication?.personalInfo.landLineNumber
2870
- },
2871
- {
2872
- label: "Mailing Address",
2873
- value: lifePlanApplication?.personalInfo.mailingAddress
2874
- },
2875
- {
2876
- label: "Civil Status",
2877
- value: lifePlanApplication?.personalInfo.civilStatus
2878
- }
2896
+ { label: "Uploaded ID", value: display(personal?.idType) },
2897
+ { label: "ID Number", value: display(personal?.idNumber) },
2898
+ { label: "Last Name", value: display(personal?.lastName) },
2899
+ { label: "First Name", value: display(personal?.firstName) },
2900
+ { label: "Middle Name", value: display(personal?.middleName) },
2901
+ { label: "Suffix", value: display(personal?.suffix) },
2902
+ { label: "Date of Birth", value: display(personal?.birthDate) },
2903
+ { label: "Gender", value: display(personal?.gender) },
2904
+ { label: "Civil Status", value: display(personal?.civilStatus) },
2905
+ { label: "Nationality", value: display(personal?.nationality) },
2906
+ { label: "Height", value: display(personal?.height) },
2907
+ { label: "Weight", value: display(personal?.weight) },
2908
+ { label: "Contact Number", value: display(personal?.mobileNumber) },
2909
+ { label: "Email", value: display(personal?.emailAddress) },
2910
+ { label: "Landline Number", value: display(personal?.landLineNumber) },
2911
+ { label: "Mailing Address", value: display(personal?.mailingAddress) }
2879
2912
  ];
2880
2913
  const addressRows = [
2881
- { label: "Lot #", value: lifePlanApplication?.address.lot },
2882
- { label: "Street", value: lifePlanApplication?.address.street },
2883
- { label: "Barangay", value: lifePlanApplication?.address.barangay },
2884
- { label: "City", value: lifePlanApplication?.address.city },
2885
- { label: "Province", value: lifePlanApplication?.address.province }
2914
+ { label: "Lot #", value: display(address?.lot) },
2915
+ { label: "Street", value: display(address?.street) },
2916
+ { label: "Barangay", value: display(address?.barangay) },
2917
+ { label: "District", value: display(address?.district) },
2918
+ { label: "City", value: display(address?.city) },
2919
+ { label: "Province", value: display(address?.province) }
2886
2920
  ];
2887
2921
  const employmentRows = [
2888
- { label: "Occupation", value: lifePlanApplication?.employment.occupation },
2889
- {
2890
- label: "Employer Name",
2891
- value: lifePlanApplication?.employment.employerName
2892
- },
2893
- {
2894
- label: "Employment Status",
2895
- value: lifePlanApplication?.employment.employmentStatus
2896
- },
2897
- {
2898
- label: "Office Address",
2899
- value: lifePlanApplication?.employment.officeAddress
2900
- },
2901
- { label: "TIN", value: lifePlanApplication?.employment.TIN },
2902
- { label: "SSS/GSIS", value: lifePlanApplication?.employment.SSS },
2903
- {
2904
- label: "Source of Income",
2905
- value: lifePlanApplication?.employment.sourceOfIncome
2906
- }
2922
+ { label: "Occupation", value: display(employment?.occupation) },
2923
+ { label: "Employer Name", value: display(employment?.employerName) },
2924
+ { label: "Employment Status", value: display(employment?.employmentStatus) },
2925
+ { label: "Office Address", value: display(employment?.officeAddress) },
2926
+ { label: "TIN", value: display(employment?.TIN) },
2927
+ { label: "SSS/GSIS", value: display(employment?.SSS) },
2928
+ { label: "Source of Income", value: display(employment?.sourceOfIncome) }
2907
2929
  ];
2908
- const beneficiaryItems = /* @__PURE__ */ jsx13(VStack6, { align: "stretch", gap: 4, children: beneficiaries.map((beneficiary, index) => /* @__PURE__ */ jsxs13(Box12, { children: [
2909
- /* @__PURE__ */ jsx13(Text7, { fontWeight: "semibold", fontSize: "sm", mb: 1, children: beneficiary.name }),
2930
+ const beneficiaryItems = beneficiaries.length === 0 ? /* @__PURE__ */ jsx13(Text7, { fontSize: "sm", color: "gray.500", children: "No beneficiaries added." }) : /* @__PURE__ */ jsx13(VStack6, { align: "stretch", gap: 4, children: beneficiaries.map((beneficiary, index) => /* @__PURE__ */ jsxs13(Box12, { children: [
2931
+ /* @__PURE__ */ jsx13(Text7, { fontWeight: "semibold", fontSize: "sm", mb: 1, children: display(beneficiary.name) ?? "-" }),
2910
2932
  /* @__PURE__ */ jsx13(
2911
2933
  ReviewRows2,
2912
2934
  {
2913
2935
  rows: [
2914
- { label: "Relationship", value: beneficiary.relationship },
2915
- { label: "Date of Birth", value: beneficiary.dob },
2916
- { label: "Address", value: beneficiary.address }
2936
+ { label: "Type", value: beneficiary.beneficiaryClass },
2937
+ { label: "Relationship", value: display(beneficiary.relationship) },
2938
+ { label: "Date of Birth", value: display(beneficiary.dob) },
2939
+ { label: "Address", value: display(beneficiary.address) }
2917
2940
  ]
2918
2941
  }
2919
2942
  )
@@ -3166,7 +3189,7 @@ var createLifePlanSteps = (confirmationProps) => [
3166
3189
  ];
3167
3190
 
3168
3191
  // src/NewSaleForm/ui/horizontal-stepper.tsx
3169
- import { useRef, useState as useState10 } from "react";
3192
+ import { useRef, useState as useState11 } from "react";
3170
3193
  import { Box as Box13, ButtonGroup, Flex as Flex7, Steps, Text as Text8 } from "@chakra-ui/react";
3171
3194
  import { PrimaryMdButton as PrimaryMdButton2, SecondaryMdButton as SecondaryMdButton2 } from "st-peter-ui";
3172
3195
  import { LuChevronLeft, LuChevronRight, LuCheck as LuCheck2 } from "react-icons/lu";
@@ -3185,7 +3208,7 @@ var HorizontalStepper = ({
3185
3208
  nextDisabled,
3186
3209
  submitButtonText = "Proceed To Payment"
3187
3210
  }) => {
3188
- const [localActiveStep, setLocalActiveStep] = useState10(0);
3211
+ const [localActiveStep, setLocalActiveStep] = useState11(0);
3189
3212
  const activeStep = controlledActiveStep !== void 0 ? controlledActiveStep : localActiveStep;
3190
3213
  const formTopRef = useRef(null);
3191
3214
  const isCompact = steps.length < 3;
@@ -3503,8 +3526,131 @@ var HorizontalStepper = ({
3503
3526
  };
3504
3527
  var horizontal_stepper_default = HorizontalStepper;
3505
3528
 
3529
+ // src/services/MainAPIClient.ts
3530
+ import axios from "axios";
3531
+ var APIError = class extends Error {
3532
+ status;
3533
+ constructor(message, status) {
3534
+ super(message);
3535
+ this.name = "APIError";
3536
+ this.status = status;
3537
+ }
3538
+ };
3539
+ var readEnvBaseUrl = () => {
3540
+ try {
3541
+ return process.env.NEXT_PUBLIC_API_URL;
3542
+ } catch {
3543
+ return void 0;
3544
+ }
3545
+ };
3546
+ var apiClient = axios.create({
3547
+ baseURL: readEnvBaseUrl() ?? "",
3548
+ timeout: 15e3,
3549
+ headers: {
3550
+ "Content-Type": "application/json"
3551
+ }
3552
+ });
3553
+ var configureApi = (options) => {
3554
+ apiClient.defaults.baseURL = options.baseUrl;
3555
+ };
3556
+ apiClient.interceptors.request.use((config) => {
3557
+ if (!config.baseURL) {
3558
+ throw new APIError(
3559
+ "API URL is not set. Add NEXT_PUBLIC_API_URL to .env.local or call configureApi({ baseUrl })."
3560
+ );
3561
+ }
3562
+ return config;
3563
+ });
3564
+ apiClient.interceptors.response.use(
3565
+ (response) => response,
3566
+ (error) => {
3567
+ if (error instanceof APIError) return Promise.reject(error);
3568
+ const status = error.response?.status;
3569
+ const message = error.response?.data?.message || error.message || "Something went wrong";
3570
+ console.error(`[API] ${error.config?.method?.toUpperCase()} ${error.config?.url} failed (${status ?? "no response"}):`, message);
3571
+ return Promise.reject(new APIError(message, status));
3572
+ }
3573
+ );
3574
+ var api = {
3575
+ get: (url, params, config) => apiClient.get(url, { ...config, params }).then((res) => res.data),
3576
+ post: (url, payload, config) => apiClient.post(url, payload, config).then((res) => res.data),
3577
+ put: (url, payload, config) => apiClient.put(url, payload, config).then((res) => res.data),
3578
+ delete: (url, config) => apiClient.delete(url, config).then((res) => res.data)
3579
+ };
3580
+
3581
+ // src/services/GeoApifyService.ts
3582
+ var ENDPOINTS = {
3583
+ parse: "/Address/Parse"
3584
+ };
3585
+ var GeoApifyService = {
3586
+ async parseAddress(text) {
3587
+ return api.get(ENDPOINTS.parse, {
3588
+ text: text.replace(/\s+/g, " ").trim()
3589
+ });
3590
+ }
3591
+ };
3592
+
3593
+ // src/services/PayMongoService.ts
3594
+ var ENDPOINTS2 = {
3595
+ checkout: "/PayMongoAPI/CreateCheckout",
3596
+ newSalesCheckout: "/PayMongoAPI/CreateNewSalesCheckout"
3597
+ };
3598
+ var toWholeNumber = (value) => {
3599
+ const n = Number(value);
3600
+ return value !== void 0 && value !== "" && Number.isFinite(n) ? Math.trunc(n) : void 0;
3601
+ };
3602
+ var toApiItem = (item) => ({
3603
+ planDesc: item.planDesc,
3604
+ ipInstAmt: Number(item.ipInstAmt),
3605
+ quantity: toWholeNumber(item.quantity) ?? 1,
3606
+ planTerm: toWholeNumber(item.planTerm),
3607
+ productCode: item.productCode,
3608
+ contractPrice: item.contractPrice
3609
+ });
3610
+ var PayMongoService = {
3611
+ async createCheckout(items) {
3612
+ const body = { items: items.map(toApiItem) };
3613
+ console.log("PayMongoService: body =", body);
3614
+ console.log("PayMongoService: ENDPOINTS.checkout =", ENDPOINTS2.checkout);
3615
+ const res = await api.post(ENDPOINTS2.checkout, body);
3616
+ return { checkoutUrl: res?.checkoutUrl };
3617
+ },
3618
+ async createNewSalesCheckout(request) {
3619
+ const body = {
3620
+ items: request.items.map((item) => ({
3621
+ planDesc: item.planDesc,
3622
+ mode: item.mode,
3623
+ ipInstAmt: Number(item.ipInstAmt),
3624
+ quantity: toWholeNumber(item.quantity) ?? 1,
3625
+ planTerm: toWholeNumber(item.planTerm)
3626
+ })),
3627
+ application: request.application,
3628
+ accountNo: request.accountNo ?? "",
3629
+ empCode: request.empCode ?? ""
3630
+ };
3631
+ const res = await api.post(
3632
+ ENDPOINTS2.newSalesCheckout,
3633
+ body,
3634
+ { timeout: 6e4 }
3635
+ );
3636
+ return { checkoutUrl: res?.checkoutUrl, requestId: res?.requestId };
3637
+ }
3638
+ };
3639
+
3506
3640
  // src/NewSaleForm/SharedLifePlanApplication.tsx
3507
3641
  import { jsx as jsx16 } from "react/jsx-runtime";
3642
+ var TEST_ACCOUNT_NO = "SPLPI-22-000021";
3643
+ var defaultCheckout = async ({
3644
+ items,
3645
+ application
3646
+ }) => {
3647
+ const { checkoutUrl } = await PayMongoService.createNewSalesCheckout({
3648
+ items,
3649
+ application,
3650
+ accountNo: TEST_ACCOUNT_NO
3651
+ });
3652
+ return checkoutUrl;
3653
+ };
3508
3654
  var safeParse = (value) => {
3509
3655
  if (!value) return null;
3510
3656
  try {
@@ -3517,21 +3663,21 @@ var SharedLifePlanApplication = ({
3517
3663
  title = "Life Plan Application",
3518
3664
  description = "Please fill out the form below to apply for a life plan.",
3519
3665
  onPaymentError,
3520
- onCheckout,
3521
- parseAddress
3666
+ onCheckout = defaultCheckout,
3667
+ parseAddress = GeoApifyService.parseAddress
3522
3668
  }) => {
3523
- const [currentStep, setCurrentStep] = useState11(0);
3524
- const [loading, setLoading] = useState11(false);
3525
- const [allAgreementsAccepted, setAllAgreementsAccepted] = useState11(false);
3526
- const [applicationSection, setApplicationSection] = useState11();
3527
- const [applicationSectionKey, setApplicationSectionKey] = useState11(0);
3528
- const [applicationValid, setApplicationValid] = useState11(false);
3669
+ const [currentStep, setCurrentStep] = useState12(0);
3670
+ const [loading, setLoading] = useState12(false);
3671
+ const [allAgreementsAccepted, setAllAgreementsAccepted] = useState12(false);
3672
+ const [applicationSection, setApplicationSection] = useState12();
3673
+ const [applicationSectionKey, setApplicationSectionKey] = useState12(0);
3674
+ const [applicationValid, setApplicationValid] = useState12(false);
3529
3675
  const steps = createLifePlanSteps({
3530
3676
  onAllAcceptedChange: setAllAgreementsAccepted,
3531
3677
  ...applicationSection ? { applicationSection } : {},
3532
3678
  applicationSectionKey,
3533
3679
  onApplicationValidChange: setApplicationValid,
3534
- ...parseAddress ? { parseAddress } : {},
3680
+ parseAddress,
3535
3681
  onEdit: (section) => {
3536
3682
  setApplicationSection(section ?? "personal");
3537
3683
  setApplicationSectionKey((key) => key + 1);
@@ -3543,9 +3689,6 @@ var SharedLifePlanApplication = ({
3543
3689
  if (!allAgreementsAccepted) return;
3544
3690
  setLoading(true);
3545
3691
  try {
3546
- if (!onCheckout) {
3547
- throw new Error("onCheckout prop is not provided");
3548
- }
3549
3692
  const checkoutRaw = sessionStorage.getItem("CheckoutCart");
3550
3693
  const cartRaw = sessionStorage.getItem("Cart");
3551
3694
  const parsed = safeParse(checkoutRaw) ?? safeParse(cartRaw);
@@ -3553,7 +3696,7 @@ var SharedLifePlanApplication = ({
3553
3696
  if (items.length === 0) {
3554
3697
  throw new Error("No items to checkout");
3555
3698
  }
3556
- const applicationData = loadApplicationDataFromLocalStorage() ?? createEmptyApplicationData();
3699
+ const applicationData = loadApplicationData() ?? createEmptyApplicationData();
3557
3700
  const checkoutPayload = items.map((item) => ({
3558
3701
  planDesc: item.planDesc,
3559
3702
  mode: item.mode,
@@ -3597,11 +3740,11 @@ var LifePlanApplicationStepWrapper = (props) => {
3597
3740
  var LifePlanApplicationStepWrapper_default = LifePlanApplicationStepWrapper;
3598
3741
 
3599
3742
  // src/hooks/useOcr.ts
3600
- import { useCallback as useCallback2, useState as useState12 } from "react";
3743
+ import { useCallback as useCallback2, useState as useState13 } from "react";
3601
3744
  function useOcr(scanIdFn) {
3602
- const [data, setData] = useState12(null);
3603
- const [loading, setLoading] = useState12(false);
3604
- const [error, setError] = useState12(null);
3745
+ const [data, setData] = useState13(null);
3746
+ const [loading, setLoading] = useState13(false);
3747
+ const [error, setError] = useState13(null);
3605
3748
  const scanId = useCallback2(
3606
3749
  async (file) => {
3607
3750
  setLoading(true);
@@ -3642,7 +3785,7 @@ import {
3642
3785
  CloseButton as CloseButton3,
3643
3786
  Input as Input4
3644
3787
  } from "@chakra-ui/react";
3645
- import { useState as useState14 } from "react";
3788
+ import { useState as useState15 } from "react";
3646
3789
  import { LuIdCard, LuSignature } from "react-icons/lu";
3647
3790
 
3648
3791
  // src/GetStarted/Container.tsx
@@ -3665,7 +3808,7 @@ var Container = ({ children }) => {
3665
3808
  var Container_default = Container;
3666
3809
 
3667
3810
  // src/GetStarted/DocumentUploadCard.tsx
3668
- import { useEffect as useEffect7, useRef as useRef2, useState as useState13 } from "react";
3811
+ import { useEffect as useEffect8, useRef as useRef2, useState as useState14 } from "react";
3669
3812
  import { Box as Box16, Flex as Flex8, Spinner, Text as Text9, useBreakpointValue as useBreakpointValue2 } from "@chakra-ui/react";
3670
3813
  import {
3671
3814
  LuUpload,
@@ -3704,7 +3847,7 @@ var validate = (file, config) => {
3704
3847
  return null;
3705
3848
  };
3706
3849
  var useDocumentSlot = (config, onProcess, notifyError = defaultNotifyError) => {
3707
- const [slot, setSlot] = useState13({ status: "idle" });
3850
+ const [slot, setSlot] = useState14({ status: "idle" });
3708
3851
  const timers = useRef2([]);
3709
3852
  const runId = useRef2(0);
3710
3853
  const clearTimers = () => {
@@ -3949,12 +4092,12 @@ function DocumentUploadCard({
3949
4092
  const notifyError = onError ?? defaultNotifyError;
3950
4093
  const { slot, uploadDocument, retryDocument, removeDocument } = useDocumentSlot(config, onProcess, notifyError);
3951
4094
  const status = slot?.status ?? "idle";
3952
- useEffect7(() => {
4095
+ useEffect8(() => {
3953
4096
  onStatusChange?.(status);
3954
4097
  }, [status, onStatusChange]);
3955
4098
  const browseRef = useRef2(null);
3956
4099
  const cameraRef = useRef2(null);
3957
- const [dragging, setDragging] = useState13(false);
4100
+ const [dragging, setDragging] = useState14(false);
3958
4101
  const Icon6 = config.icon;
3959
4102
  const isPdf = slot?.fileType === "application/pdf";
3960
4103
  const handleFiles = (files) => {
@@ -4270,6 +4413,96 @@ function DocumentUploadCard({
4270
4413
  );
4271
4414
  }
4272
4415
 
4416
+ // src/services/OcrService.ts
4417
+ var ENDPOINTS3 = {
4418
+ scan: "/Ocr/Scan"
4419
+ };
4420
+ var isObject = (value) => !!value && typeof value === "object" && !Array.isArray(value);
4421
+ var readField = (source, keys) => {
4422
+ if (!source) return "";
4423
+ for (const key of keys) {
4424
+ const match = Object.keys(source).find(
4425
+ (k) => k.toLowerCase() === key.toLowerCase()
4426
+ );
4427
+ const value = match ? source[match] : void 0;
4428
+ if (typeof value === "string" && value.trim()) return value.trim();
4429
+ if (typeof value === "number") return String(value);
4430
+ }
4431
+ return "";
4432
+ };
4433
+ var pad = (value) => String(value).padStart(2, "0");
4434
+ var toIsoDate = (value) => {
4435
+ if (!value) return "";
4436
+ if (/^\d{4}-\d{2}-\d{2}/.test(value)) return value.slice(0, 10);
4437
+ const parts = value.split(/[/-]/).map((part) => part.trim());
4438
+ if (parts.length === 3 && parts.every(Boolean)) {
4439
+ const [first = "", second = "", third = ""] = parts;
4440
+ if (first.length === 4) return `${first}-${pad(second)}-${pad(third)}`;
4441
+ if (third.length === 4) return `${third}-${pad(first)}-${pad(second)}`;
4442
+ }
4443
+ const parsed = new Date(value);
4444
+ if (Number.isNaN(parsed.getTime())) return "";
4445
+ return `${parsed.getFullYear()}-${pad(parsed.getMonth() + 1)}-${pad(parsed.getDate())}`;
4446
+ };
4447
+ var toIdType = (value) => {
4448
+ const text = value.toLowerCase();
4449
+ if (!text) return "";
4450
+ if (text.includes("passport")) return "passport";
4451
+ if (text.includes("driver")) return "driver_license";
4452
+ if (text.includes("national") || text.includes("id")) return "national_id";
4453
+ return "";
4454
+ };
4455
+ var toOcrValue = (body) => {
4456
+ const root = isObject(body) ? body : void 0;
4457
+ const nested = root ? Object.entries(root).find(
4458
+ ([key, value]) => key.toLowerCase() === "response" && isObject(value)
4459
+ )?.[1] : void 0;
4460
+ const source = isObject(nested) ? nested : root;
4461
+ return {
4462
+ firstName: readField(source, ["firstName"]),
4463
+ middleName: readField(source, ["middleName"]),
4464
+ lastName: readField(source, ["lastName"]),
4465
+ birthDate: toIsoDate(readField(source, ["birthDate", "dateOfBirth"])),
4466
+ idType: toIdType(readField(source, ["idType"])),
4467
+ idNumber: readField(source, ["idNumber", "idNo"]),
4468
+ addressLine: readField(source, ["addressLine", "address", "completeAddress"])
4469
+ };
4470
+ };
4471
+ var toFormData = (docType, source) => {
4472
+ const formData = new FormData();
4473
+ formData.append("DocType", docType);
4474
+ if (typeof source === "string") {
4475
+ formData.append("OCRType", "URL");
4476
+ formData.append("ImageUrl", source.trim());
4477
+ } else {
4478
+ formData.append("OCRType", "File");
4479
+ formData.append("File", source);
4480
+ }
4481
+ return formData;
4482
+ };
4483
+ var OcrService = {
4484
+ async scan(docType, source) {
4485
+ return api.post(ENDPOINTS3.scan, toFormData(docType, source), {
4486
+ headers: { "Content-Type": "multipart/form-data" },
4487
+ timeout: 9e4
4488
+ });
4489
+ },
4490
+ async scanId(source) {
4491
+ const body = await OcrService.scan("ID", source);
4492
+ const result = toOcrValue(body);
4493
+ if (!result.firstName && !result.lastName && !result.idNumber) {
4494
+ const description = isObject(body) ? readField(body, ["description", "message"]) : "";
4495
+ throw new APIError(
4496
+ description || "We couldn't read your ID. Please upload a clearer photo."
4497
+ );
4498
+ }
4499
+ return result;
4500
+ },
4501
+ async scanLpa(source) {
4502
+ return OcrService.scan("LPA", source);
4503
+ }
4504
+ };
4505
+
4273
4506
  // src/GetStarted/GetStarted.tsx
4274
4507
  import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
4275
4508
  var defaultNotify = (type, message) => {
@@ -4299,13 +4532,13 @@ var SIGNATURE_CONFIG = {
4299
4532
  icon: LuSignature
4300
4533
  };
4301
4534
  var GetStarted = ({
4302
- scanId: scanIdFn,
4535
+ scanId: scanIdFn = OcrService.scanId,
4303
4536
  onContinue,
4304
4537
  notify = defaultNotify
4305
4538
  }) => {
4306
- const [uploadDialogOpen, setUploadDialogOpen] = useState14(false);
4307
- const [referralDialogOpen, setReferralDialogOpen] = useState14(false);
4308
- const [governmentIdStatus, setGovernmentIdStatus] = useState14("idle");
4539
+ const [uploadDialogOpen, setUploadDialogOpen] = useState15(false);
4540
+ const [referralDialogOpen, setReferralDialogOpen] = useState15(false);
4541
+ const [governmentIdStatus, setGovernmentIdStatus] = useState15("idle");
4309
4542
  const { scanId } = useOcr(scanIdFn);
4310
4543
  return /* @__PURE__ */ jsx20(Container_default, { children: /* @__PURE__ */ jsxs16(
4311
4544
  Box17,
@@ -4751,18 +4984,18 @@ var BottomQuickActions = ({
4751
4984
  var BottomQuickActions_default = BottomQuickActions;
4752
4985
 
4753
4986
  // src/Generic/NotifyInstall.tsx
4754
- import { useEffect as useEffect9, useState as useState16 } from "react";
4987
+ import { useEffect as useEffect10, useState as useState17 } from "react";
4755
4988
  import { Button as Button4, Flex as Flex10, HStack as HStack5, Icon as Icon5, Text as Text11, VStack as VStack9 } from "@chakra-ui/react";
4756
4989
  import { AnimatePresence, motion } from "motion/react";
4757
4990
  import { FiDownload, FiPlusSquare, FiShare, FiX } from "react-icons/fi";
4758
4991
 
4759
4992
  // src/hooks/useNotifyInstall.ts
4760
- import { useEffect as useEffect8, useState as useState15 } from "react";
4993
+ import { useEffect as useEffect9, useState as useState16 } from "react";
4761
4994
  function useNotifyInstall() {
4762
- const [isInstalled, setIsInstalled] = useState15(false);
4763
- const [isMobile, setIsMobile] = useState15(false);
4764
- const [installPrompt, setInstallPrompt] = useState15(null);
4765
- useEffect8(() => {
4995
+ const [isInstalled, setIsInstalled] = useState16(false);
4996
+ const [isMobile, setIsMobile] = useState16(false);
4997
+ const [installPrompt, setInstallPrompt] = useState16(null);
4998
+ useEffect9(() => {
4766
4999
  const mobile = /Android|iPhone|iPad|iPod/i.test(navigator.userAgent);
4767
5000
  setIsMobile(mobile);
4768
5001
  const installed = window.matchMedia("(display-mode: standalone)").matches || window.navigator.standalone === true;
@@ -4805,8 +5038,8 @@ function NotifyInstall({
4805
5038
  appName
4806
5039
  }) {
4807
5040
  const { isInstalled, isMobile, canInstall, install } = useNotifyInstall();
4808
- const [isDismissed, setIsDismissed] = useState16(true);
4809
- useEffect9(() => {
5041
+ const [isDismissed, setIsDismissed] = useState17(true);
5042
+ useEffect10(() => {
4810
5043
  if (localStorage.getItem(DISMISSED_KEY) !== "true") {
4811
5044
  setIsDismissed(false);
4812
5045
  }
@@ -4963,7 +5196,7 @@ function NotifyInstall({
4963
5196
  }
4964
5197
 
4965
5198
  // src/UserProfile/UserProfile.tsx
4966
- import { useEffect as useEffect10, useMemo, useState as useState17 } from "react";
5199
+ import { useEffect as useEffect11, useMemo, useState as useState18 } from "react";
4967
5200
  import {
4968
5201
  Avatar,
4969
5202
  Badge as Badge2,
@@ -5319,28 +5552,28 @@ function ReusableProfile({
5319
5552
  onTwoFactorChange,
5320
5553
  onToast = noopToast
5321
5554
  }) {
5322
- const [profileView, setProfileView] = useState17("main");
5323
- const [fallbackColorMode, setFallbackColorMode] = useState17("light");
5555
+ const [profileView, setProfileView] = useState18("main");
5556
+ const [fallbackColorMode, setFallbackColorMode] = useState18("light");
5324
5557
  const colorMode = controlledColorMode ?? fallbackColorMode;
5325
- const [fontSize, setFontSizeLocal] = useState17("md");
5326
- const [quickNavHrefs, setQuickNavHrefs] = useState17(initialQuickNavHrefs);
5327
- const [replacingIdx, setReplacingIdx] = useState17(null);
5328
- const [editName, setEditName] = useState17(user.displayName);
5329
- const [editLoading, setEditLoading] = useState17(false);
5330
- const [currentPw, setCurrentPw] = useState17("");
5331
- const [newPw, setNewPw] = useState17("");
5332
- const [confirmPw, setConfirmPw] = useState17("");
5333
- const [showCurrentPw, setShowCurrentPw] = useState17(false);
5334
- const [showNewPw, setShowNewPw] = useState17(false);
5335
- const [showConfirmPw, setShowConfirmPw] = useState17(false);
5336
- const [pwLoading, setPwLoading] = useState17(false);
5337
- const [twoFactorEnabled, setTwoFactorEnabled] = useState17(
5558
+ const [fontSize, setFontSizeLocal] = useState18("md");
5559
+ const [quickNavHrefs, setQuickNavHrefs] = useState18(initialQuickNavHrefs);
5560
+ const [replacingIdx, setReplacingIdx] = useState18(null);
5561
+ const [editName, setEditName] = useState18(user.displayName);
5562
+ const [editLoading, setEditLoading] = useState18(false);
5563
+ const [currentPw, setCurrentPw] = useState18("");
5564
+ const [newPw, setNewPw] = useState18("");
5565
+ const [confirmPw, setConfirmPw] = useState18("");
5566
+ const [showCurrentPw, setShowCurrentPw] = useState18(false);
5567
+ const [showNewPw, setShowNewPw] = useState18(false);
5568
+ const [showConfirmPw, setShowConfirmPw] = useState18(false);
5569
+ const [pwLoading, setPwLoading] = useState18(false);
5570
+ const [twoFactorEnabled, setTwoFactorEnabled] = useState18(
5338
5571
  initialTwoFactorEnabled
5339
5572
  );
5340
- const [isMounted, setIsMounted] = useState17(false);
5573
+ const [isMounted, setIsMounted] = useState18(false);
5341
5574
  const isDesktopRaw = useBreakpointValue3({ base: false, md: true });
5342
5575
  const isDesktop = isMounted ? isDesktopRaw ?? false : false;
5343
- useEffect10(() => {
5576
+ useEffect11(() => {
5344
5577
  setIsMounted(true);
5345
5578
  if (!enableLocalStorage || typeof window === "undefined") return;
5346
5579
  setFontSizeLocal(localStorage.getItem(FONT_SIZE_STORAGE_KEY) ?? "md");
@@ -5351,7 +5584,7 @@ function ReusableProfile({
5351
5584
  setQuickNavHrefs(initialQuickNavHrefs);
5352
5585
  }
5353
5586
  }, [enableLocalStorage, initialQuickNavHrefs, storageKey]);
5354
- useEffect10(() => {
5587
+ useEffect11(() => {
5355
5588
  setEditName(user.displayName);
5356
5589
  }, [user.displayName]);
5357
5590
  const availableOptions = useMemo(
@@ -6469,11 +6702,15 @@ function ReusableProfile({
6469
6702
  }
6470
6703
  var UserProfile_default = ReusableProfile;
6471
6704
  export {
6705
+ APIError,
6706
+ APPLICATION_DATA_CHANGE_EVENT,
6472
6707
  beneficiary_default as Beneficiary,
6473
6708
  BottomQuickActions_default as BottomQuickActions,
6474
6709
  DocumentUploadCard,
6710
+ GeoApifyService,
6475
6711
  GetStarted_default as GetStarted,
6476
6712
  HealthDeclaration_default as HealthDeclaration,
6713
+ LIFE_PLAN_APPLICATION_KEY,
6477
6714
  LifePlanApplication1_default as LifePlanApplication1,
6478
6715
  LifePlanApplication2_default as LifePlanApplication2,
6479
6716
  LifePlanApplication3_default as LifePlanApplication3,
@@ -6481,15 +6718,25 @@ export {
6481
6718
  LifePlanApplicationStepWrapper_default as LifePlanApplicationStepWrapper,
6482
6719
  NotifyInstall,
6483
6720
  OCR_STORAGE_KEY,
6721
+ OcrService,
6722
+ PayMongoService,
6484
6723
  SharedLifePlanApplication_default as SharedLifePlanApplication,
6485
6724
  UserProfile_default as UserProfile,
6725
+ api,
6726
+ apiClient,
6727
+ clearApplicationData,
6486
6728
  clearOcrResult,
6729
+ configureApi,
6487
6730
  createEmptyApplicationData,
6731
+ loadApplicationData,
6488
6732
  loadApplicationDataFromLocalStorage,
6489
6733
  markOcrApplied,
6490
6734
  readOcrResult,
6735
+ saveApplicationData,
6491
6736
  saveApplicationDataToLocalStorage,
6492
6737
  saveOcrResult,
6738
+ updateApplicationData,
6739
+ useApplicationData,
6493
6740
  useOcr
6494
6741
  };
6495
6742
  //# sourceMappingURL=index.mjs.map