@incodetech/core 0.0.0-dev-20260317-ce5d28b → 0.0.0-dev-20260317-5e90a15

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.
@@ -62,7 +62,7 @@ declare const documentUploadMachine: xstate0.StateMachine<DocumentUploadContext,
62
62
  type: "stopStream";
63
63
  params: xstate0.NonReducibleUnknown;
64
64
  };
65
- }>, never, never, "error" | "initCamera" | "idle" | "capturing" | "closed" | "uploading" | "finished", string, DocumentUploadInput, xstate0.NonReducibleUnknown, xstate0.EventObject, xstate0.MetaObject, {
65
+ }>, never, never, "initCamera" | "error" | "idle" | "capturing" | "closed" | "uploading" | "finished", string, DocumentUploadInput, xstate0.NonReducibleUnknown, xstate0.EventObject, xstate0.MetaObject, {
66
66
  readonly id: "documentUpload";
67
67
  readonly initial: "idle";
68
68
  readonly context: ({
package/dist/ekyb.d.ts CHANGED
@@ -86,6 +86,8 @@ declare function createEkybManager(options: CreateEkybActorOptions): Manager<Eky
86
86
  setCountry(country: string): void;
87
87
  /** Sets a form field value and triggers revalidation */
88
88
  setField(name: string, value: string): void;
89
+ /** Marks a field as touched on blur, triggering "required" errors if empty */
90
+ blurField(name: string): void;
89
91
  /** Adds a new UBO entry (max 8) */
90
92
  addUbo(): void;
91
93
  /** Removes a UBO entry by index */
package/dist/ekyb.esm.js CHANGED
@@ -476,6 +476,20 @@ const ekybMachine = setup({
476
476
  errorParams
477
477
  };
478
478
  }),
479
+ blurField: assign(({ context, event }) => {
480
+ const { name } = event;
481
+ if (context.touched[name]) return {};
482
+ const newTouched = {
483
+ ...context.touched,
484
+ [name]: true
485
+ };
486
+ const { displayErrors, errorParams } = computeDisplayErrors(context.errors, newTouched, context.submitAttempted, context.country, context.fields);
487
+ return {
488
+ touched: newTouched,
489
+ displayErrors,
490
+ errorParams
491
+ };
492
+ }),
479
493
  addUbo: assign(({ context }) => {
480
494
  const newId = context._nextUboId;
481
495
  const ubos = [...context.ubos, {
@@ -667,6 +681,7 @@ const ekybMachine = setup({
667
681
  actions: "setCountry"
668
682
  },
669
683
  SET_FIELD: { actions: "updateField" },
684
+ BLUR_FIELD: { actions: "blurField" },
670
685
  SEARCH_ADDRESS: {
671
686
  target: ".searching",
672
687
  actions: assign(({ event }) => ({
@@ -777,6 +792,12 @@ function createApi({ actor }) {
777
792
  value
778
793
  });
779
794
  },
795
+ blurField(name) {
796
+ actor.send({
797
+ type: "BLUR_FIELD",
798
+ name
799
+ });
800
+ },
780
801
  addUbo() {
781
802
  actor.send({ type: "ADD_UBO" });
782
803
  },
package/dist/ekyc.d.ts CHANGED
@@ -19,6 +19,7 @@ type EkycVerificationFields = {
19
19
  idNum?: EkycFieldSource;
20
20
  idNum1?: EkycFieldSource;
21
21
  gender?: EkycFieldSource;
22
+ panNumber?: EkycFieldSource;
22
23
  };
23
24
  type EkycModuleConfig = {
24
25
  source: string;
@@ -51,6 +52,8 @@ type EkycModuleConfig = {
51
52
  idNum1Source?: string;
52
53
  checkGender?: boolean;
53
54
  genderSource?: string;
55
+ checkPanNumber?: boolean;
56
+ panNumberSource?: string;
54
57
  };
55
58
  type EkycFormValues = Record<string, string | undefined>;
56
59
  /** Manager creation config */
@@ -122,6 +125,8 @@ declare function createEkycManager(options: CreateEkycActorOptions): Manager<Eky
122
125
  load(): void;
123
126
  /** Sets a form field value and triggers revalidation */
124
127
  setField(name: string, value: string): void;
128
+ /** Marks a field as touched on blur, triggering "required" errors if empty */
129
+ blurField(name: string): void;
125
130
  /** Initiates a debounced address autocomplete search */
126
131
  searchAddress(query: string): void;
127
132
  /** Selects an address suggestion and populates address fields */
package/dist/ekyc.esm.js CHANGED
@@ -9857,7 +9857,8 @@ function getEKYCFields(config) {
9857
9857
  last4SSN: config.checkLast4SSN ? mapToEKYCvalue(config.last4SSNSource ?? "") : false,
9858
9858
  idNum: config.checkIdNum ? mapToEKYCvalue(config.idNumSource ?? "") : false,
9859
9859
  idNum1: config.checkIdNum1 ? mapToEKYCvalue(config.idNum1Source ?? "") : false,
9860
- gender: config.checkGender ? mapToEKYCvalue(config.genderSource ?? "") : false
9860
+ gender: config.checkGender ? mapToEKYCvalue(config.genderSource ?? "") : false,
9861
+ panNumber: config.checkPanNumber ? mapToEKYCvalue(config.panNumberSource ?? "") : false
9861
9862
  };
9862
9863
  }
9863
9864
  /** Maps a verification source string to a country code */
@@ -9875,6 +9876,7 @@ function getEKYCCountry(source) {
9875
9876
  case "CO_1": return "CO";
9876
9877
  case "CR_1": return "CR";
9877
9878
  case "CA_RES_CREDIT": return "CA";
9879
+ case "INDIA_PAN": return "IN";
9878
9880
  default: return "US";
9879
9881
  }
9880
9882
  }
@@ -9971,14 +9973,14 @@ function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false)
9971
9973
  maxLength: 100,
9972
9974
  placeholder: "verification.placeholder.firstName"
9973
9975
  });
9974
- if (configSource === "US_CREDIT_BUREAU_1" || configSource === "CA_RES_CREDIT") add("middleName", "text", "verification.labels.middleName", fields.name, {
9976
+ if (configSource === "US_CREDIT_BUREAU_1" || configSource === "CA_RES_CREDIT" || country === "IN") add("middleName", "text", "verification.labels.middleName", fields.name, {
9975
9977
  maxLength: 100,
9976
9978
  placeholder: "verification.placeholder.middleName",
9977
9979
  optional: true
9978
9980
  });
9979
9981
  add("surName", "text", country === "US" ? "verification.labels.lastName" : "verification.labels.surName", fields.name, {
9980
9982
  maxLength: 100,
9981
- placeholder: "verification.placeholder.lastName"
9983
+ placeholder: country === "US" ? "verification.placeholder.lastName" : "verification.placeholder.surname"
9982
9984
  });
9983
9985
  if (country === "MX") add("maternalSurname", "text", "verification.labels.maternalSurname", fields.name, {
9984
9986
  maxLength: 100,
@@ -10026,6 +10028,7 @@ function buildFieldDefs(fields, configSource, country, enablePhoneRisk = false)
10026
10028
  value: "M",
10027
10029
  label: "common.male"
10028
10030
  }] });
10031
+ if (fields.panNumber) add("panNumber", "text", "verification.labels.panNumber", fields.panNumber, { maxLength: 10 });
10029
10032
  if (fields.address) {
10030
10033
  add("street", "text", "verification.labels.street", fields.address, { section: "address" });
10031
10034
  add("houseNo", "text", "verification.labels.houseNo", fields.address, { section: "address" });
@@ -10066,6 +10069,7 @@ function validateField(name, value, required, country, configSource) {
10066
10069
  if (!isFieldOptional("phone", configSource) || val) return validatePhone(val, country) ? void 0 : "verification.errors.invalidPhone";
10067
10070
  }
10068
10071
  if (name === "email" && val) return /^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(val) ? void 0 : "verification.errors.invalidEmail";
10072
+ if (name === "panNumber" && val) return val.length === 10 ? void 0 : "verification.errors.exactly10Characters";
10069
10073
  }
10070
10074
  function computeValidation(fields, values, country, configSource) {
10071
10075
  const errors = {};
@@ -10360,6 +10364,20 @@ const ekycMachine = setup({
10360
10364
  submitError: ""
10361
10365
  };
10362
10366
  }),
10367
+ blurField: assign(({ context, event }) => {
10368
+ const { name } = event;
10369
+ if (context.touched[name]) return {};
10370
+ const newTouched = {
10371
+ ...context.touched,
10372
+ [name]: true
10373
+ };
10374
+ const { displayErrors, errorParams } = computeDisplayErrors(context.errors, newTouched, context.submitAttempted, context.fieldsCountry, context.fields);
10375
+ return {
10376
+ touched: newTouched,
10377
+ displayErrors,
10378
+ errorParams
10379
+ };
10380
+ }),
10363
10381
  fillAddressFields: assign(({ context, event }) => {
10364
10382
  const { suggestion } = event;
10365
10383
  const { values: newValues, touched: newTouched } = fillFromSuggestion(context.values, context.touched, suggestion);
@@ -10525,6 +10543,7 @@ const ekycMachine = setup({
10525
10543
  },
10526
10544
  on: {
10527
10545
  SET_FIELD: { actions: "updateField" },
10546
+ BLUR_FIELD: { actions: "blurField" },
10528
10547
  SEARCH_ADDRESS: {
10529
10548
  target: ".searching",
10530
10549
  actions: assign(({ event }) => ({
@@ -10634,6 +10653,12 @@ function createApi({ actor }) {
10634
10653
  value
10635
10654
  });
10636
10655
  },
10656
+ blurField(name) {
10657
+ actor.send({
10658
+ type: "BLUR_FIELD",
10659
+ name
10660
+ });
10661
+ },
10637
10662
  searchAddress(query) {
10638
10663
  actor.send({
10639
10664
  type: "SEARCH_ADDRESS",
@@ -12,6 +12,6 @@ import { n as faceCaptureMachine } from "./faceCaptureSetup-I9wFuT1d.esm.js";
12
12
  import { n as createAuthenticationManagerFromActor } from "./authenticationManager-IChdnUM9.esm.js";
13
13
  import { n as createEmailManagerFromActor } from "./emailManager-BRFO9OW6.esm.js";
14
14
  import { n as createSelfieManagerFromActor } from "./selfieManager-BeVNeGVa.esm.js";
15
- import { n as createPhoneManagerFromActor } from "./phoneManager-TWj65pNG.esm.js";
15
+ import { n as createPhoneManagerFromActor } from "./phoneManager-D-Mi06el.esm.js";
16
16
 
17
17
  export { BrowserStorageProvider, WasmUtilProvider, createActor, createAuthenticationManagerFromActor, createEmailManagerFromActor, createIdCaptureManagerFromActor, createPhoneManagerFromActor, createSelfieManagerFromActor, faceCaptureMachine, fromPromise };
package/dist/phone.esm.js CHANGED
@@ -3,6 +3,6 @@ import "./src-D0bFtylT.esm.js";
3
3
  import "./xstate.esm-CcoTezCZ.esm.js";
4
4
  import "./api-C2uzxrpN.esm.js";
5
5
  import "./endpoints-IAlXA1zN.esm.js";
6
- import { r as phoneMachine, t as createPhoneManager } from "./phoneManager-TWj65pNG.esm.js";
6
+ import { r as phoneMachine, t as createPhoneManager } from "./phoneManager-D-Mi06el.esm.js";
7
7
 
8
8
  export { createPhoneManager, phoneMachine };
@@ -105,7 +105,7 @@ const phoneMachine = setup({
105
105
  return {
106
106
  phone: e.phone,
107
107
  isValid: e.isValid,
108
- phoneError: e.isValid ? void 0 : "Invalid phone number"
108
+ phoneError: e.isValid ? void 0 : "phone.invalid"
109
109
  };
110
110
  }),
111
111
  setPhoneError: assign(({ event }) => ({ phoneError: String(event.error) })),
@@ -283,7 +283,7 @@ const phoneMachine = setup({
283
283
  target: "otpError",
284
284
  guard: "hasAttemptsRemaining",
285
285
  actions: assign(({ context }) => ({
286
- otpError: "Invalid OTP code",
286
+ otpError: "otp.errorv2",
287
287
  attemptsRemaining: context.attemptsRemaining - 1
288
288
  }))
289
289
  },
@@ -445,7 +445,7 @@ function mapState(snapshot) {
445
445
  if (typedSnapshot.matches("verifyingOtp")) return { status: "verifyingOtp" };
446
446
  if (typedSnapshot.matches("otpError")) return {
447
447
  status: "otpError",
448
- error: context.otpError ?? "Invalid OTP code",
448
+ error: context.otpError ?? "otp.errorv2",
449
449
  attemptsRemaining: context.attemptsRemaining
450
450
  };
451
451
  if (typedSnapshot.matches("finished")) return { status: "finished" };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@incodetech/core",
3
- "version": "0.0.0-dev-20260317-ce5d28b",
3
+ "version": "0.0.0-dev-20260317-5e90a15",
4
4
  "type": "module",
5
5
  "main": "./dist/index.esm.js",
6
6
  "types": "./dist/index.d.ts",
@@ -90,8 +90,8 @@
90
90
  "tsdown": "^0.16.6",
91
91
  "typescript": "^5.9.3",
92
92
  "vitest": "^4.0.13",
93
- "@incodetech/infra": "1.0.0",
94
- "@incodetech/config": "1.0.0"
93
+ "@incodetech/config": "1.0.0",
94
+ "@incodetech/infra": "1.0.0"
95
95
  },
96
96
  "scripts": {
97
97
  "build": "tsdown -c tsdown.config.ts",