@incodetech/core 0.0.0-dev-20261029-4549e47f → 0.0.0-dev-20261029-ab9a031d
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/{FaceDetectionProvider-3B7fUYME.esm.js → FaceDetectionProvider-BPw6Sztf.esm.js} +7 -7
- package/dist/{WasmUtilProvider-BmtXHqwK.esm.js → WasmUtilProvider-DqtPEKsY.esm.js} +5 -1
- package/dist/ae-signature.esm.js +1 -1
- package/dist/{apiError-DfAHobE4.esm.js → apiError-DT3rvcZJ.esm.js} +1 -1
- package/dist/authentication.d.ts +3 -3
- package/dist/authentication.esm.js +2 -2
- package/dist/{authenticationManager-CC67pNoL.d.ts → authenticationManager-BPpSImsv.d.ts} +1 -1
- package/dist/{authenticationManager-MOUMpv0i.esm.js → authenticationManager-SVrl1zgN.esm.js} +4 -4
- package/dist/{authenticationStateMachine-VF200fHF.esm.js → authenticationStateMachine-BS1iPaFn.esm.js} +3 -3
- package/dist/camera.esm.js +1 -1
- package/dist/cnpj-Co1ottYN.esm.js +77 -0
- package/dist/consent.d.ts +1 -1
- package/dist/{consentManager-BQ6BKInw.d.ts → consentManager-Cegv5Kth.d.ts} +12 -12
- package/dist/{createCameraCycleOwnership-EMOiqj48.esm.js → createCameraCycleOwnership-c3noNWxH.esm.js} +1 -1
- package/dist/curp-validation.d.ts +1 -1
- package/dist/{curpValidationManager-HRSYsugw.d.ts → curpValidationManager-CpmlWHkv.d.ts} +1 -1
- package/dist/{deepsightLoader-BRIf9bdH.esm.js → deepsightLoader-Dvcd1yov.esm.js} +6 -6
- package/dist/{deepsightService-B2kZtVtE.esm.js → deepsightService-CXrhNb9c.esm.js} +1 -1
- package/dist/document-capture.esm.js +2 -2
- package/dist/{documentCaptureManager-B4E3Pgl9.esm.js → documentCaptureManager-DuITDiyf.esm.js} +1 -1
- package/dist/{documentCaptureStateMachine-M_jFgj_c.esm.js → documentCaptureStateMachine-C9uhv5g5.esm.js} +2 -2
- package/dist/dynamic-forms.d.ts +2 -2
- package/dist/dynamic-forms.esm.js +2 -2
- package/dist/{dynamicFormsManager-C0dHs1ty.d.ts → dynamicFormsManager-9kwY8Bf5.d.ts} +1 -1
- package/dist/{dynamicFormsManager-D1q6py8K.esm.js → dynamicFormsManager-CuxtO7jB.esm.js} +1 -1
- package/dist/{dynamicFormsStateMachine-CTUvietg.esm.js → dynamicFormsStateMachine-C4yVGxpH.esm.js} +1 -1
- package/dist/ekyb.d.ts +1 -1
- package/dist/ekyb.esm.js +3 -3
- package/dist/{ekybManager-xo2wOfZ3.esm.js → ekybManager-DZ0ksIav.esm.js} +1 -1
- package/dist/{ekybStateMachine-BiYuYpLh.esm.js → ekybStateMachine-L7ZHcHvF.esm.js} +2 -30
- package/dist/electronic-signature.esm.js +1 -1
- package/dist/{electronicSignatureManager-DawHPSFr.esm.js → electronicSignatureManager-ROM4Plhh.esm.js} +1 -1
- package/dist/extensibility.d.ts +11 -11
- package/dist/extensibility.esm.js +13 -13
- package/dist/{faceCaptureManagerFactory-zqryGnj6.esm.js → faceCaptureManagerFactory-CUBuV__c.esm.js} +3 -3
- package/dist/{faceCaptureManagerFactory-vchnR2CA.d.ts → faceCaptureManagerFactory-DER3G7QA.d.ts} +3 -3
- package/dist/{faceCaptureSetup-B8TaHy7d.esm.js → faceCaptureSetup-BrkJNhcx.esm.js} +6 -6
- package/dist/{feature-management-DnxqsfNa.esm.js → feature-management-BqM3DDh5.esm.js} +1 -1
- package/dist/feature-management.esm.js +1 -1
- package/dist/flow-events.d.ts +1 -1
- package/dist/flow.d.ts +6 -6
- package/dist/flow.esm.js +3 -3
- package/dist/{flowCompletionService-BDm9m8t6.esm.js → flowCompletionService-CCnpKFwV.esm.js} +1 -1
- package/dist/{flowServices-laW5iMbd.esm.js → flowServices-Bc07mt2O.esm.js} +6 -48
- package/dist/geolocation.esm.js +2 -2
- package/dist/{geolocationManager-C7pGYdJ6.esm.js → geolocationManager-BApTeGjv.esm.js} +1 -1
- package/dist/{geolocationStateMachine-BGBLAIne.esm.js → geolocationStateMachine-BvJqeBfE.esm.js} +1 -1
- package/dist/home.d.ts +1 -1
- package/dist/id-selfie-flow.d.ts +1 -1
- package/dist/id-selfie-flow.esm.js +8 -8
- package/dist/id.d.ts +2 -2
- package/dist/id.esm.js +3 -3
- package/dist/{idCaptureDefaults-DP06AgjJ.esm.js → idCaptureDefaults-Bf57Ll9V.esm.js} +2 -2
- package/dist/{idCaptureManager-D08q23Mr.esm.js → idCaptureManager-C05md8rp.esm.js} +5 -5
- package/dist/{idCaptureManager-7n59S4Fc.d.ts → idCaptureManager-C74EPLTw.d.ts} +2 -2
- package/dist/{idCaptureServices-BD3v9edY.esm.js → idCaptureServices-CBLzfhvC.esm.js} +4 -4
- package/dist/{idCaptureStateMachine-BD_pEwVO.esm.js → idCaptureStateMachine-BWjnqb5C.esm.js} +84 -16
- package/dist/{index-tLPVy1zj.d.ts → index-BSf46iwq.d.ts} +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/mandatory-consent.d.ts +2 -2
- package/dist/{mandatoryConsentManager-B1WidW8w.d.ts → mandatoryConsentManager-CEOyGn4H.d.ts} +7 -7
- package/dist/{permissionGuards-DJkhXYNj.esm.js → permissionGuards-CL5GLmDp.esm.js} +1 -1
- package/dist/{permissionServices-DXlzBQ7G.esm.js → permissionServices-DJyei2yK.esm.js} +1 -1
- package/dist/qe-signature.esm.js +1 -1
- package/dist/{runChildModule-C2mw_TMD.esm.js → runChildModule-BntL2Brs.esm.js} +1 -1
- package/dist/{sdkVersion-B5tBv0Hp.esm.js → sdkVersion-BruWW52r.esm.js} +1 -1
- package/dist/selfie.d.ts +3 -3
- package/dist/selfie.esm.js +8 -8
- package/dist/{selfieErrorUtils-Sp0VcxB1.esm.js → selfieErrorUtils-FzSnBvLY.esm.js} +1 -1
- package/dist/{selfieManager-BtjTvMOg.esm.js → selfieManager-DuOwQuxL.esm.js} +4 -4
- package/dist/{selfieManager-ClCgI2fn.d.ts → selfieManager-vEXd5SHA.d.ts} +1 -1
- package/dist/{selfieStateMachine-B8I8Dvez.esm.js → selfieStateMachine-3s-ydjDp.esm.js} +3 -3
- package/dist/{session-C88PQz0B.esm.js → session-CHr7fZVV.esm.js} +3 -3
- package/dist/session.d.ts +10 -2
- package/dist/session.esm.js +4 -4
- package/dist/{sessionInitializer-Di-5i9ip.esm.js → sessionInitializer-1QwlJLQ3.esm.js} +261 -104
- package/dist/{setup-q6QhQRkI.esm.js → setup-DAOCrvRl.esm.js} +16 -11
- package/dist/{trueSightService-DCa_x3yL.esm.js → trueSightService-D7F7hn4q.esm.js} +1 -1
- package/dist/types-B9C8W01q.d.ts +34 -0
- package/dist/{types-DJBn6wVV.d.ts → types-Bqj4SDHk.d.ts} +1 -1
- package/dist/{types-ClQspDyT.d.ts → types-BzuFtfjm.d.ts} +1 -1
- package/dist/{types-GbGmnFsh.d.ts → types-CEuM1Qph.d.ts} +1 -1
- package/dist/{types-tsXa6u2J.d.ts → types-CK0dj_Vu.d.ts} +2 -1
- package/dist/{types-DPGYNu5C.d.ts → types-iF96ENvX.d.ts} +3 -3
- package/dist/types-qs9PgHtG.d.ts +6 -0
- package/dist/video-selfie.d.ts +1 -1
- package/dist/video-selfie.esm.js +4 -4
- package/dist/{videoSelfieCameraWarmer-Dfthbl1b.esm.js → videoSelfieCameraWarmer-D4exP4rK.esm.js} +5 -5
- package/dist/{videoSelfieStepDetector-NTgtiQJp.d.ts → videoSelfieStepDetector-B2bakrqI.d.ts} +2 -2
- package/dist/{warmup-CH_bd9h8.esm.js → warmup-D-Y2iAoP.esm.js} +28 -2
- package/dist/wasm.esm.js +2 -2
- package/dist/{wasmDsFlagSync-Co_fMpyM.esm.js → wasmDsFlagSync-CWvvmM2E.esm.js} +1 -1
- package/dist/watchlist-for-business.d.ts +2 -1
- package/dist/watchlist-for-business.esm.js +2 -2
- package/dist/{watchlistForBusinessManager-B3GDPZrr.d.ts → watchlistForBusinessManager-DX2AyM4Y.d.ts} +54 -18
- package/dist/{watchlistForBusinessManager-UD1i94xo.esm.js → watchlistForBusinessManager-PKTQ09-2.esm.js} +36 -6
- package/dist/watchlistForBusinessStateMachine-CBgJuLJC.esm.js +166 -0
- package/dist/workflow.d.ts +5 -5
- package/dist/workflow.esm.js +16 -16
- package/package.json +1 -1
- package/dist/types-Cp_84WIM.d.ts +0 -6
- package/dist/watchlistForBusinessStateMachine-CQXOjGhS.esm.js +0 -78
- /package/dist/{types-BSBzhHRH2.d.ts → types-BSBzhHRH.d.ts} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { y as IncodeCanvas } from "./createFaceAvatar-lYX0VTYs.js";
|
|
2
|
-
import { a as RegulationTypes, n as Flow, o as TutorialIdConfig } from "./types-
|
|
2
|
+
import { a as RegulationTypes, n as Flow, o as TutorialIdConfig } from "./types-CK0dj_Vu.js";
|
|
3
3
|
import { a as IStorageCapability } from "./IWasmUtilCapability-GF2n7sfm.js";
|
|
4
4
|
import { t as PermissionResult } from "./types-BEwVKkLJ.js";
|
|
5
5
|
import { n as DeepsightService, t as StreamCanvasCapture } from "./StreamCanvasCapture-7JRf-2ck.js";
|
|
@@ -98,14 +98,14 @@ type RedirectReturnParams = {
|
|
|
98
98
|
//#region src/modules/id/digitalIdRegistry.d.ts
|
|
99
99
|
/**
|
|
100
100
|
* True when a digital-ID method uses a full-page web-redirect flow (Trinsic
|
|
101
|
-
* iDIN
|
|
101
|
+
* iDIN, FTN, itsme, …). Accepts both the module `FlowType` value (`REDIRECT`) and the
|
|
102
102
|
* backend value (`WEB_REDIRECT`). (Lives here rather than in
|
|
103
103
|
* `idCaptureHelpers` to keep the registry free of circular imports; the
|
|
104
104
|
* helpers re-export it.)
|
|
105
105
|
*/
|
|
106
106
|
declare function isRedirectFlowType(flowType: string): boolean;
|
|
107
107
|
/** Digital-ID document schemes the SDK knows how to verify. */
|
|
108
|
-
type DigitalIdDocumentType = 'mDL' | 'iDIN' | 'FTN';
|
|
108
|
+
type DigitalIdDocumentType = 'mDL' | 'iDIN' | 'FTN' | 'itsme' | 'SPID' | 'MitID' | 'BankIDSweden' | 'FranceIdentite' | 'IdentiteNumerique' | 'LAWallet' | 'DigiLocker';
|
|
109
109
|
/** One way to fulfil a `DigitalIdDocumentType`, in funnel priority order. */
|
|
110
110
|
type DigitalIdFunnelEntry = {
|
|
111
111
|
/**
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { i as FlowModuleConfig } from "./types-CK0dj_Vu.js";
|
|
2
|
+
import { t as BaseFaceCaptureConfig } from "./types-BzuFtfjm.js";
|
|
3
|
+
//#region src/modules/authentication/types.d.ts
|
|
4
|
+
type AuthenticationConfig = FlowModuleConfig['AUTHENTICATION'] & BaseFaceCaptureConfig;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { AuthenticationConfig as t };
|
package/dist/video-selfie.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ import "./Actor-DpTj5PFb.js";
|
|
|
5
5
|
import { t as IVisibilityObserverCapability } from "./IVisibilityObserverCapability-D4tvIB5v.js";
|
|
6
6
|
import { t as CameraStream } from "./camera-9wWD-pwg.js";
|
|
7
7
|
import { t as DetectionOrientation } from "./IIdCaptureCapability-CGcEt2Cw.js";
|
|
8
|
-
import { a as FacingMode, c as VideoSelfieStep, i as CameraCompositor, n as VideoSelfieDetectionStatus, o as VideoSelfieConfig, r as VideoSelfieValidationFailure, s as VideoSelfieSpeechResult, t as StepDetector } from "./videoSelfieStepDetector-
|
|
8
|
+
import { a as FacingMode, c as VideoSelfieStep, i as CameraCompositor, n as VideoSelfieDetectionStatus, o as VideoSelfieConfig, r as VideoSelfieValidationFailure, s as VideoSelfieSpeechResult, t as StepDetector } from "./videoSelfieStepDetector-B2bakrqI.js";
|
|
9
9
|
//#region ../infra/src/capabilities/ITimerCapability.d.ts
|
|
10
10
|
type TimerHandle = ReturnType<typeof setTimeout>;
|
|
11
11
|
type ITimerCapability = {
|
package/dist/video-selfie.esm.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { t as ensureWasmPipelines } from "./setup-
|
|
2
|
-
import { t as WasmUtilProvider } from "./WasmUtilProvider-
|
|
1
|
+
import { t as ensureWasmPipelines } from "./setup-DAOCrvRl.esm.js";
|
|
2
|
+
import { t as WasmUtilProvider } from "./WasmUtilProvider-DqtPEKsY.esm.js";
|
|
3
3
|
import { t as api, u as endpoints } from "./api-BG98lkot.esm.js";
|
|
4
4
|
import { t as BrowserTimerProvider } from "./BrowserTimerProvider-BXhgNxLt.esm.js";
|
|
5
5
|
import { t as BrowserLazyImportProvider } from "./BrowserLazyImportProvider-BhoA957O.esm.js";
|
|
6
|
-
import { d as facingModeForStep, f as resolveVideoSelfieSteps, p as videoSelfieWasmPipelines } from "./flowServices-
|
|
6
|
+
import { d as facingModeForStep, f as resolveVideoSelfieSteps, p as videoSelfieWasmPipelines } from "./flowServices-Bc07mt2O.esm.js";
|
|
7
7
|
import { i as assign, l as raise, r as sendTo, s as createActor, t as setup, u as createManager } from "./xstate.esm-DSajW7CJ.esm.js";
|
|
8
8
|
import { n as fromPromise, t as fromCallback } from "./xstate-actors.esm-8Gzepa_A.esm.js";
|
|
9
9
|
import { t as BrowserVisibilityObserverProvider } from "./BrowserVisibilityObserverProvider-BrJN1B8A.esm.js";
|
|
10
10
|
import { t as carryAttempts } from "./attemptCarry-DpuNCHQS.esm.js";
|
|
11
11
|
import { i as createRecordingCompositor, n as WorkerEncoderRecordingProvider, t as MultipartRecordingService } from "./multipartRecordingService-YhlbyjI4.esm.js";
|
|
12
12
|
import { t as VIDEO_SELFIE_VALIDATION_ATTEMPTS_EXHAUSTED_CODE } from "./advanceableErrors-k-U-cL5m.esm.js";
|
|
13
|
-
import { n as defaultAcquireCamera, r as createDefaultStepDetector, s as isConnectionError, t as createVideoSelfieCameraWarmer } from "./videoSelfieCameraWarmer-
|
|
13
|
+
import { n as defaultAcquireCamera, r as createDefaultStepDetector, s as isConnectionError, t as createVideoSelfieCameraWarmer } from "./videoSelfieCameraWarmer-D4exP4rK.esm.js";
|
|
14
14
|
import { t as videoSelfieFlowModuleMachine } from "./videoSelfieFlowModuleMachine-BCFVHBQ1.esm.js";
|
|
15
15
|
//#region ../../node_modules/.pnpm/audio-recorder-polyfill@0.4.1/node_modules/audio-recorder-polyfill/wave-encoder/index.js
|
|
16
16
|
var wave_encoder_default = () => {
|
package/dist/{videoSelfieCameraWarmer-Dfthbl1b.esm.js → videoSelfieCameraWarmer-D4exP4rK.esm.js}
RENAMED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { t as api, u as endpoints } from "./api-BG98lkot.esm.js";
|
|
2
2
|
import { t as BrowserTimerProvider } from "./BrowserTimerProvider-BXhgNxLt.esm.js";
|
|
3
|
-
import { d as facingModeForStep, f as resolveVideoSelfieSteps } from "./flowServices-
|
|
3
|
+
import { d as facingModeForStep, f as resolveVideoSelfieSteps } from "./flowServices-Bc07mt2O.esm.js";
|
|
4
4
|
import { a as requestCameraWithFallback, i as requestCameraAccess } from "./camera-sIa9ceW2.esm.js";
|
|
5
|
-
import { t as checkPermission } from "./permissionServices-
|
|
6
|
-
import { c as processFace, d as FACE_ERROR_CODES, l as uploadSelfie, n as encryptSelfieImage, o as startDetection, t as FaceDetectionProvider } from "./FaceDetectionProvider-
|
|
5
|
+
import { t as checkPermission } from "./permissionServices-DJyei2yK.esm.js";
|
|
6
|
+
import { c as processFace, d as FACE_ERROR_CODES, l as uploadSelfie, n as encryptSelfieImage, o as startDetection, t as FaceDetectionProvider } from "./FaceDetectionProvider-BPw6Sztf.esm.js";
|
|
7
7
|
import { o as StreamCanvasProcessingSession } from "./multipartRecordingService-YhlbyjI4.esm.js";
|
|
8
8
|
import { n as getBackCameraStream } from "./backCameraStream-CMvXj4X4.esm.js";
|
|
9
9
|
import { n as getWindowDimensions } from "./getDeviceClass-CeBiEayS.esm.js";
|
|
10
|
-
import { t as getFaceErrorCodeFromUnknown } from "./selfieErrorUtils-
|
|
11
|
-
import { n as DEFAULT_ID_CAPTURE_THRESHOLDS, r as IdCaptureProvider, t as DEFAULT_ID_CAPTURE_GEOMETRY } from "./idCaptureDefaults-
|
|
10
|
+
import { t as getFaceErrorCodeFromUnknown } from "./selfieErrorUtils-FzSnBvLY.esm.js";
|
|
11
|
+
import { n as DEFAULT_ID_CAPTURE_THRESHOLDS, r as IdCaptureProvider, t as DEFAULT_ID_CAPTURE_GEOMETRY } from "./idCaptureDefaults-Bf57Ll9V.esm.js";
|
|
12
12
|
import { t as StreamCanvasCapture } from "./StreamCanvasCapture-C9jtgBdT.esm.js";
|
|
13
13
|
//#region src/modules/video-selfie/videoSelfieCompareService.ts
|
|
14
14
|
async function postVideoSelfieCompare(endpoint, base64Image) {
|
package/dist/{videoSelfieStepDetector-NTgtiQJp.d.ts → videoSelfieStepDetector-B2bakrqI.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { i as FlowModuleConfig } from "./types-
|
|
1
|
+
import { i as FlowModuleConfig } from "./types-CK0dj_Vu.js";
|
|
2
2
|
import "./IWasmUtilCapability-GF2n7sfm.js";
|
|
3
|
-
import { n as DetectionStatus } from "./types-
|
|
3
|
+
import { n as DetectionStatus } from "./types-BzuFtfjm.js";
|
|
4
4
|
import { t as CameraStream } from "./camera-9wWD-pwg.js";
|
|
5
5
|
import { t as DetectionOrientation } from "./IIdCaptureCapability-CGcEt2Cw.js";
|
|
6
6
|
//#region src/modules/video-selfie/types.d.ts
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { n as __exportAll } from "./rolldown-runtime-B-1-B7_t.esm.js";
|
|
1
2
|
import { A as buildModelVariantSources, C as isDefaultCdnWasmConfig, D as WASM_PIPELINE_MODELS, M as resolveWasmSource, N as reportWasmIntegritySummary, T as WASM_MODEL_FILES, f as rearmWasmCallDiagnostics, g as emitWasmDiagnostic, h as acquireWasmStorageFallback, j as missingWasmModelError, k as WASM_PIPELINE_OPTIONAL_MODEL_NAMES, l as notePipelineStatePulled, m as loadWasmModule, n as createWebApiHostAdapter, p as resetWasmCallDiagnostics, v as SemaphoreProvider, y as DEFAULT_WASM_VERSION } from "./wasmWebClient-DpRiJOHd.esm.js";
|
|
2
3
|
import { n as getTimestamp } from "./IBrowserEnvironmentCapability-D7JG7ML3.esm.js";
|
|
3
4
|
//#region ../infra/src/wasm/wasmEnumMaps.ts
|
|
@@ -752,6 +753,18 @@ WasmRuntime.UNINITIALIZED_ENUM_MAP_MESSAGE = "Unable to map pipeline type, cpp A
|
|
|
752
753
|
const wasmRuntime = new WasmRuntime();
|
|
753
754
|
//#endregion
|
|
754
755
|
//#region ../infra/src/wasm/warmup.ts
|
|
756
|
+
var warmup_exports = /* @__PURE__ */ __exportAll({
|
|
757
|
+
WASM_PIPELINES: () => WASM_PIPELINES,
|
|
758
|
+
getResolvedModelSource: () => getResolvedModelSource,
|
|
759
|
+
getResolvedModelsBasePath: () => getResolvedModelsBasePath,
|
|
760
|
+
getWarmupFacts: () => getWarmupFacts,
|
|
761
|
+
getWasmStatus: () => getWasmStatus,
|
|
762
|
+
isWasmReady: () => isWasmReady,
|
|
763
|
+
setWasmOnDeviceMode: () => setWasmOnDeviceMode,
|
|
764
|
+
waitForWasm: () => waitForWasm,
|
|
765
|
+
warmupWasm: () => warmupWasm,
|
|
766
|
+
whenWasmRuntimeReady: () => whenWasmRuntimeReady
|
|
767
|
+
});
|
|
755
768
|
/**
|
|
756
769
|
* Pipelines preloaded when no explicit `pipelines` array is passed to
|
|
757
770
|
* {@link warmupWasm}. The on-device selfie bundle is opt-in (loaded only when
|
|
@@ -767,6 +780,7 @@ let lastConfig = null;
|
|
|
767
780
|
let lastModelVariant = null;
|
|
768
781
|
let warmupFacts = null;
|
|
769
782
|
let pipelinesInFlight = [];
|
|
783
|
+
let runtimeReadyPromise = null;
|
|
770
784
|
function mapPipelineToWasmType(pipeline) {
|
|
771
785
|
switch (pipeline) {
|
|
772
786
|
case "selfie": return 4;
|
|
@@ -968,10 +982,13 @@ async function warmupWasm(config) {
|
|
|
968
982
|
try {
|
|
969
983
|
const pipelinesMap = buildPipelinesMap(pipelines, config);
|
|
970
984
|
if (config.onDeviceMode !== void 0) wasmRuntime.setOnDeviceMode(config.onDeviceMode);
|
|
971
|
-
const
|
|
985
|
+
const runtimeReady = wasmRuntime.initialize({
|
|
972
986
|
module: config,
|
|
973
987
|
pipelines: pipelinesMap
|
|
974
988
|
});
|
|
989
|
+
runtimeReadyPromise = runtimeReady.then(() => void 0);
|
|
990
|
+
runtimeReadyPromise.catch(() => void 0);
|
|
991
|
+
const simdUsed = await runtimeReady;
|
|
975
992
|
await wasmRuntime.loadModels();
|
|
976
993
|
await wasmRuntime.initializePipelines();
|
|
977
994
|
state = "ready";
|
|
@@ -1045,6 +1062,15 @@ function waitForWasm() {
|
|
|
1045
1062
|
return Promise.reject(/* @__PURE__ */ new Error("WASM warmup was not started. Call warmupWasm() first."));
|
|
1046
1063
|
}
|
|
1047
1064
|
/**
|
|
1065
|
+
* Resolves once the WASM runtime is up, before the models of the warmup that
|
|
1066
|
+
* started it finish loading: enough for the utility API (fingerprint signals).
|
|
1067
|
+
* Rejects when no warmup was started or the runtime failed to start.
|
|
1068
|
+
*/
|
|
1069
|
+
function whenWasmRuntimeReady() {
|
|
1070
|
+
if (wasmRuntime.isInitialized()) return Promise.resolve();
|
|
1071
|
+
return runtimeReadyPromise ?? Promise.reject(/* @__PURE__ */ new Error("WASM warmup was not started. Call warmupWasm() first."));
|
|
1072
|
+
}
|
|
1073
|
+
/**
|
|
1048
1074
|
* Retained compatibility surface for callers that used the removed native
|
|
1049
1075
|
* on-device-mode setter. Both values are native-free no-ops for the pinned
|
|
1050
1076
|
* runtime and do not alter initialization, capture, or fingerprint lifecycle.
|
|
@@ -1053,4 +1079,4 @@ function setWasmOnDeviceMode(enabled) {
|
|
|
1053
1079
|
wasmRuntime.setOnDeviceMode(enabled);
|
|
1054
1080
|
}
|
|
1055
1081
|
//#endregion
|
|
1056
|
-
export { setWasmOnDeviceMode as a,
|
|
1082
|
+
export { setWasmOnDeviceMode as a, warmup_exports as c, getCameraCycleOwnershipDomain as d, drainWasmDiagnostics as f, isWasmReady as i, wasmRuntime as l, rearmWasmDiagnostics as m, getWarmupFacts as n, waitForWasm as o, getWasmDiagnosticsMode as p, getWasmStatus as r, warmupWasm as s, getResolvedModelSource as t, CAMERA_CYCLE_OWNERSHIP_DOMAIN as u };
|
package/dist/wasm.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { E as WASM_PIPELINE_LAZY_MODEL_NAMES, O as WASM_PIPELINE_MODEL_NAMES, T as WASM_MODEL_FILES, b as buildDefaultWasmConfig, w as resolveWasmConfig, x as buildWasmConfigFromBasePath, y as DEFAULT_WASM_VERSION } from "./wasmWebClient-DpRiJOHd.esm.js";
|
|
2
|
-
import { s as warmupWasm } from "./warmup-
|
|
3
|
-
import { a as resolveWasmConfigForPipelines, c as upgradeToWasmHttpClient, n as initializeWasmUtil, o as setWasmConfig, t as ensureWasmPipelines } from "./setup-
|
|
2
|
+
import { s as warmupWasm } from "./warmup-D-Y2iAoP.esm.js";
|
|
3
|
+
import { a as resolveWasmConfigForPipelines, c as upgradeToWasmHttpClient, n as initializeWasmUtil, o as setWasmConfig, t as ensureWasmPipelines } from "./setup-DAOCrvRl.esm.js";
|
|
4
4
|
//#region src/defineWasm.ts
|
|
5
5
|
function requiredModels(pipelines) {
|
|
6
6
|
const models = /* @__PURE__ */ new Set();
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { i as utilityWasmApi } from "./WasmUtilProvider-
|
|
1
|
+
import { i as utilityWasmApi } from "./WasmUtilProvider-DqtPEKsY.esm.js";
|
|
2
2
|
//#region ../infra/src/wasm/wasmDsFlagSync.ts
|
|
3
3
|
/**
|
|
4
4
|
* Sets the Deepsight (ds) flag that the WASM utility API receives on every
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n as WatchlistForBusinessValidationErrors, t as WatchlistForBusinessConfig } from "./types-B9C8W01q.js";
|
|
2
|
+
import { a as createWatchlistForBusinessManager, c as watchlistForBusinessMachine, i as WatchlistForBusinessState, n as WatchlistForBusinessFormState, o as createWatchlistForBusinessManagerFromActor, r as WatchlistForBusinessManager, s as WatchlistForBusinessActor, t as WatchlistForBusinessFinishedState } from "./watchlistForBusinessManager-DX2AyM4Y.js";
|
|
2
3
|
export { type WatchlistForBusinessActor, type WatchlistForBusinessConfig, type WatchlistForBusinessFinishedState, type WatchlistForBusinessFormState, type WatchlistForBusinessManager, type WatchlistForBusinessState, type WatchlistForBusinessValidationErrors, createWatchlistForBusinessManager, createWatchlistForBusinessManagerFromActor, watchlistForBusinessMachine };
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as createWatchlistForBusinessManagerFromActor, t as createWatchlistForBusinessManager } from "./watchlistForBusinessManager-
|
|
1
|
+
import { n as watchlistForBusinessMachine } from "./watchlistForBusinessStateMachine-CBgJuLJC.esm.js";
|
|
2
|
+
import { n as createWatchlistForBusinessManagerFromActor, t as createWatchlistForBusinessManager } from "./watchlistForBusinessManager-PKTQ09-2.esm.js";
|
|
3
3
|
export { createWatchlistForBusinessManager, createWatchlistForBusinessManagerFromActor, watchlistForBusinessMachine };
|
package/dist/{watchlistForBusinessManager-B3GDPZrr.d.ts → watchlistForBusinessManager-DX2AyM4Y.d.ts}
RENAMED
|
@@ -1,36 +1,47 @@
|
|
|
1
1
|
import { i as ActorRefFrom } from "./spawn-D9jgw9pW.js";
|
|
2
2
|
import { t as Manager } from "./Manager-C9T5amUN.js";
|
|
3
3
|
import "./Actor-DpTj5PFb.js";
|
|
4
|
+
import { n as WatchlistForBusinessValidationErrors, t as WatchlistForBusinessConfig } from "./types-B9C8W01q.js";
|
|
4
5
|
//#region src/modules/watchlist-for-business/watchlistForBusinessStateMachine.d.ts
|
|
5
6
|
declare const watchlistForBusinessMachine: any;
|
|
6
7
|
type WatchlistForBusinessMachine = typeof watchlistForBusinessMachine;
|
|
7
8
|
//#endregion
|
|
8
9
|
//#region src/modules/watchlist-for-business/watchlistForBusinessActor.d.ts
|
|
9
|
-
type
|
|
10
|
-
|
|
11
|
-
//#region src/modules/watchlist-for-business/types.d.ts
|
|
12
|
-
/**
|
|
13
|
-
* Configuration for the watchlist-for-business module.
|
|
14
|
-
*
|
|
15
|
-
* No server-side configuration is required — the module collects
|
|
16
|
-
* country and business name from the user and submits them to the
|
|
17
|
-
* business watchlist endpoint.
|
|
18
|
-
*/
|
|
19
|
-
type WatchlistForBusinessConfig = Record<string, never>;
|
|
20
|
-
type WatchlistForBusinessValidationErrors = {
|
|
21
|
-
businessName?: string;
|
|
10
|
+
type CreateWatchlistForBusinessActorOptions = {
|
|
11
|
+
config?: WatchlistForBusinessConfig;
|
|
22
12
|
};
|
|
13
|
+
type WatchlistForBusinessActor = ActorRefFrom<WatchlistForBusinessMachine>;
|
|
23
14
|
//#endregion
|
|
24
15
|
//#region src/modules/watchlist-for-business/watchlistForBusinessManager.d.ts
|
|
25
16
|
/** Waiting for `load()` to be called. */
|
|
26
17
|
type WatchlistForBusinessIdleState = {
|
|
27
18
|
status: 'idle';
|
|
28
19
|
};
|
|
29
|
-
/**
|
|
20
|
+
/**
|
|
21
|
+
* Form is ready — use `setCountry()`, `setBusinessName()`, `setTaxId()`,
|
|
22
|
+
* `setDateOfIncorporation()`, and `submit()`.
|
|
23
|
+
*/
|
|
30
24
|
type WatchlistForBusinessFormState = {
|
|
31
25
|
status: 'form';
|
|
32
26
|
country: string;
|
|
33
27
|
businessName: string;
|
|
28
|
+
/** Optional. Sent only when `showTaxId` is true and the value is not blank. */
|
|
29
|
+
taxId: string;
|
|
30
|
+
/**
|
|
31
|
+
* Optional, `YYYY-MM-DD`. Sent only when `showDateOfIncorporation` is true
|
|
32
|
+
* and the value is not blank.
|
|
33
|
+
*/
|
|
34
|
+
dateOfIncorporation: string;
|
|
35
|
+
/** Whether the module config enables the optional Tax ID input. */
|
|
36
|
+
showTaxId: boolean;
|
|
37
|
+
/** Whether the module config enables the optional date-of-incorporation input. */
|
|
38
|
+
showDateOfIncorporation: boolean;
|
|
39
|
+
/**
|
|
40
|
+
* Latest allowed date of incorporation (`YYYY-MM-DD`): today in the user's
|
|
41
|
+
* local time. Use it as the date input's `max`; a later date fails submit.
|
|
42
|
+
*/
|
|
43
|
+
maxDateOfIncorporation: string;
|
|
44
|
+
/** Whether the required business name is filled. Optional fields never affect it. */
|
|
34
45
|
isValid: boolean;
|
|
35
46
|
validationErrors?: WatchlistForBusinessValidationErrors;
|
|
36
47
|
canSubmit: boolean;
|
|
@@ -59,6 +70,11 @@ type WatchlistForBusinessState = WatchlistForBusinessIdleState | WatchlistForBus
|
|
|
59
70
|
*
|
|
60
71
|
* On API error the module completes silently (fire-and-forget).
|
|
61
72
|
*
|
|
73
|
+
* @param options.config - Optional module config. `taxIdEnabled` and
|
|
74
|
+
* `dateOfIncorporationEnabled` turn on the optional Tax ID and date-of-
|
|
75
|
+
* incorporation inputs. Without config only country and business name are
|
|
76
|
+
* collected.
|
|
77
|
+
*
|
|
62
78
|
* @example Headless usage
|
|
63
79
|
* ```typescript
|
|
64
80
|
* import { createWatchlistForBusinessManager } from '@incodetech/core/watchlist-for-business';
|
|
@@ -74,14 +90,24 @@ type WatchlistForBusinessState = WatchlistForBusinessIdleState | WatchlistForBus
|
|
|
74
90
|
* manager.stop();
|
|
75
91
|
* ```
|
|
76
92
|
*/
|
|
77
|
-
declare function createWatchlistForBusinessManager(): Manager<WatchlistForBusinessState> & {
|
|
93
|
+
declare function createWatchlistForBusinessManager(options?: CreateWatchlistForBusinessActorOptions): Manager<WatchlistForBusinessState> & {
|
|
78
94
|
/** Transitions from `idle` to the form. Must be called before any other method. */
|
|
79
95
|
load(): void;
|
|
80
96
|
/** Updates the selected country code (ISO 3166-1 alpha-2). */
|
|
81
97
|
setCountry(country: string): void;
|
|
82
98
|
/** Updates the business name field and recomputes validity. */
|
|
83
99
|
setBusinessName(value: string): void;
|
|
84
|
-
/**
|
|
100
|
+
/** Updates the optional Tax ID field. A blank value is not sent. */
|
|
101
|
+
setTaxId(value: string): void;
|
|
102
|
+
/**
|
|
103
|
+
* Updates the optional date of incorporation (`YYYY-MM-DD`). A blank value
|
|
104
|
+
* is not sent; a future date blocks submit.
|
|
105
|
+
*/
|
|
106
|
+
setDateOfIncorporation(value: string): void;
|
|
107
|
+
/**
|
|
108
|
+
* Submits the form. Transitions only when the business name is filled and
|
|
109
|
+
* every filled optional field is valid; otherwise sets `validationErrors`.
|
|
110
|
+
*/
|
|
85
111
|
submit(): void;
|
|
86
112
|
};
|
|
87
113
|
declare function createWatchlistForBusinessManagerFromActor(actor: WatchlistForBusinessActor): Manager<WatchlistForBusinessState> & {
|
|
@@ -91,9 +117,19 @@ declare function createWatchlistForBusinessManagerFromActor(actor: WatchlistForB
|
|
|
91
117
|
setCountry(country: string): void;
|
|
92
118
|
/** Updates the business name field and recomputes validity. */
|
|
93
119
|
setBusinessName(value: string): void;
|
|
94
|
-
/**
|
|
120
|
+
/** Updates the optional Tax ID field. A blank value is not sent. */
|
|
121
|
+
setTaxId(value: string): void;
|
|
122
|
+
/**
|
|
123
|
+
* Updates the optional date of incorporation (`YYYY-MM-DD`). A blank value
|
|
124
|
+
* is not sent; a future date blocks submit.
|
|
125
|
+
*/
|
|
126
|
+
setDateOfIncorporation(value: string): void;
|
|
127
|
+
/**
|
|
128
|
+
* Submits the form. Transitions only when the business name is filled and
|
|
129
|
+
* every filled optional field is valid; otherwise sets `validationErrors`.
|
|
130
|
+
*/
|
|
95
131
|
submit(): void;
|
|
96
132
|
};
|
|
97
133
|
type WatchlistForBusinessManager = ReturnType<typeof createWatchlistForBusinessManager>;
|
|
98
134
|
//#endregion
|
|
99
|
-
export { createWatchlistForBusinessManager as a,
|
|
135
|
+
export { createWatchlistForBusinessManager as a, watchlistForBusinessMachine as c, WatchlistForBusinessState as i, WatchlistForBusinessFormState as n, createWatchlistForBusinessManagerFromActor as o, WatchlistForBusinessManager as r, WatchlistForBusinessActor as s, WatchlistForBusinessFinishedState as t };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-Dh1gMk0J.esm.js";
|
|
2
2
|
import { t as topLevelStateName } from "./topLevelStateName-B5i2avbh.esm.js";
|
|
3
3
|
import { s as createActor, u as createManager } from "./xstate.esm-DSajW7CJ.esm.js";
|
|
4
|
-
import {
|
|
4
|
+
import { n as watchlistForBusinessMachine, t as getMaxDateOfIncorporation } from "./watchlistForBusinessStateMachine-CBgJuLJC.esm.js";
|
|
5
5
|
//#region src/modules/watchlist-for-business/watchlistForBusinessActor.ts
|
|
6
|
-
function createWatchlistForBusinessActor() {
|
|
7
|
-
return createActor(watchlistForBusinessMachine).start();
|
|
6
|
+
function createWatchlistForBusinessActor(options = {}) {
|
|
7
|
+
return createActor(watchlistForBusinessMachine, { input: { config: options.config ?? {} } }).start();
|
|
8
8
|
}
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/modules/watchlist-for-business/watchlistForBusinessManager.ts
|
|
@@ -38,6 +38,11 @@ function mapState(snapshot) {
|
|
|
38
38
|
status: "form",
|
|
39
39
|
country: context.country,
|
|
40
40
|
businessName: context.businessName,
|
|
41
|
+
taxId: context.taxId,
|
|
42
|
+
dateOfIncorporation: context.dateOfIncorporation,
|
|
43
|
+
showTaxId: context.config?.taxIdEnabled === true,
|
|
44
|
+
showDateOfIncorporation: context.config?.dateOfIncorporationEnabled === true,
|
|
45
|
+
maxDateOfIncorporation: getMaxDateOfIncorporation(),
|
|
41
46
|
isValid: context.isValid,
|
|
42
47
|
validationErrors: context.validationErrors,
|
|
43
48
|
canSubmit: Object.keys(context.validationErrors ?? {}).length === 0
|
|
@@ -67,7 +72,27 @@ function createApi({ actor, trackElementClicked }) {
|
|
|
67
72
|
value
|
|
68
73
|
});
|
|
69
74
|
},
|
|
70
|
-
/**
|
|
75
|
+
/** Updates the optional Tax ID field. A blank value is not sent. */
|
|
76
|
+
setTaxId(value) {
|
|
77
|
+
actor.send({
|
|
78
|
+
type: "SET_TAX_ID",
|
|
79
|
+
value
|
|
80
|
+
});
|
|
81
|
+
},
|
|
82
|
+
/**
|
|
83
|
+
* Updates the optional date of incorporation (`YYYY-MM-DD`). A blank value
|
|
84
|
+
* is not sent; a future date blocks submit.
|
|
85
|
+
*/
|
|
86
|
+
setDateOfIncorporation(value) {
|
|
87
|
+
actor.send({
|
|
88
|
+
type: "SET_DATE_OF_INCORPORATION",
|
|
89
|
+
value
|
|
90
|
+
});
|
|
91
|
+
},
|
|
92
|
+
/**
|
|
93
|
+
* Submits the form. Transitions only when the business name is filled and
|
|
94
|
+
* every filled optional field is valid; otherwise sets `validationErrors`.
|
|
95
|
+
*/
|
|
71
96
|
submit() {
|
|
72
97
|
trackElementClicked?.("submit");
|
|
73
98
|
actor.send({ type: "SUBMIT" });
|
|
@@ -79,6 +104,11 @@ function createApi({ actor, trackElementClicked }) {
|
|
|
79
104
|
*
|
|
80
105
|
* On API error the module completes silently (fire-and-forget).
|
|
81
106
|
*
|
|
107
|
+
* @param options.config - Optional module config. `taxIdEnabled` and
|
|
108
|
+
* `dateOfIncorporationEnabled` turn on the optional Tax ID and date-of-
|
|
109
|
+
* incorporation inputs. Without config only country and business name are
|
|
110
|
+
* collected.
|
|
111
|
+
*
|
|
82
112
|
* @example Headless usage
|
|
83
113
|
* ```typescript
|
|
84
114
|
* import { createWatchlistForBusinessManager } from '@incodetech/core/watchlist-for-business';
|
|
@@ -94,8 +124,8 @@ function createApi({ actor, trackElementClicked }) {
|
|
|
94
124
|
* manager.stop();
|
|
95
125
|
* ```
|
|
96
126
|
*/
|
|
97
|
-
function createWatchlistForBusinessManager() {
|
|
98
|
-
return createWatchlistForBusinessManagerFromActor(createWatchlistForBusinessActor());
|
|
127
|
+
function createWatchlistForBusinessManager(options = {}) {
|
|
128
|
+
return createWatchlistForBusinessManagerFromActor(createWatchlistForBusinessActor(options));
|
|
99
129
|
}
|
|
100
130
|
function createWatchlistForBusinessManagerFromActor(actor) {
|
|
101
131
|
return createManager({
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
import { n as getTimestamp } from "./IBrowserEnvironmentCapability-D7JG7ML3.esm.js";
|
|
2
|
+
import { t as api, u as endpoints } from "./api-BG98lkot.esm.js";
|
|
3
|
+
import { i as assign, t as setup } from "./xstate.esm-DSajW7CJ.esm.js";
|
|
4
|
+
import { n as fromPromise } from "./xstate-actors.esm-8Gzepa_A.esm.js";
|
|
5
|
+
import { r as validateCNPJ, t as COUNTRIES_WITH_CNPJ_VALIDATION } from "./cnpj-Co1ottYN.esm.js";
|
|
6
|
+
//#region ../infra/src/time/epochMsToLocalIsoDate.ts
|
|
7
|
+
/**
|
|
8
|
+
* Converts an epoch-milliseconds timestamp to the user's local calendar date
|
|
9
|
+
* as `YYYY-MM-DD` — the format of an `<input type="date">` value.
|
|
10
|
+
*
|
|
11
|
+
* Use it to compare a user-entered date with "today" as the user sees it.
|
|
12
|
+
* `DateFormattingProvider.utcToIsoDateString` returns the UTC date, which is a
|
|
13
|
+
* day off near midnight outside UTC. Lives in Infra (L0) because Core cannot
|
|
14
|
+
* touch the `Date` global (`no-browser-api-in-core`); see `epochMsToIsoString`.
|
|
15
|
+
*/
|
|
16
|
+
function epochMsToLocalIsoDate(epochMs) {
|
|
17
|
+
const date = new Date(epochMs);
|
|
18
|
+
const month = String(date.getMonth() + 1).padStart(2, "0");
|
|
19
|
+
const day = String(date.getDate()).padStart(2, "0");
|
|
20
|
+
return `${date.getFullYear()}-${month}-${day}`;
|
|
21
|
+
}
|
|
22
|
+
//#endregion
|
|
23
|
+
//#region src/modules/watchlist-for-business/watchlistForBusinessServices.ts
|
|
24
|
+
async function submitWatchlistForBusiness(data, signal) {
|
|
25
|
+
const res = await api.post(endpoints.watchlistForBusinessSubmit, data, { signal });
|
|
26
|
+
if (!res.ok) throw new Error(`POST ${endpoints.watchlistForBusinessSubmit} failed: ${res.status} ${res.statusText}`);
|
|
27
|
+
return res.data;
|
|
28
|
+
}
|
|
29
|
+
//#endregion
|
|
30
|
+
//#region src/modules/watchlist-for-business/watchlistForBusinessStateMachine.ts
|
|
31
|
+
const DEFAULT_COUNTRY = "US";
|
|
32
|
+
const BUSINESS_NAME_REQUIRED_ERROR = "dynamicForms.fieldRequired";
|
|
33
|
+
const INVALID_TAX_ID_ERROR = "ekyb.error.invalidTaxId";
|
|
34
|
+
const FUTURE_DATE_OF_INCORPORATION_ERROR = "watchlistForBusiness.dateOfIncorporationFuture";
|
|
35
|
+
/**
|
|
36
|
+
* Country-specific Tax ID format checks, applied only to a filled Tax ID.
|
|
37
|
+
* Countries without an entry accept any value. The CNPJ countries come from
|
|
38
|
+
* the shared list eKYB also uses, so the two modules cannot drift.
|
|
39
|
+
*/
|
|
40
|
+
const TAX_ID_VALIDATORS = Object.fromEntries(COUNTRIES_WITH_CNPJ_VALIDATION.map((country) => [country, validateCNPJ]));
|
|
41
|
+
/**
|
|
42
|
+
* Latest allowed date of incorporation: today in the user's local time, as
|
|
43
|
+
* `YYYY-MM-DD`. The single source for both the future-date check and the
|
|
44
|
+
* date picker's `max` (exposed through the manager's `form` state).
|
|
45
|
+
*/
|
|
46
|
+
function getMaxDateOfIncorporation() {
|
|
47
|
+
return epochMsToLocalIsoDate(getTimestamp());
|
|
48
|
+
}
|
|
49
|
+
function computeIsValid(businessName) {
|
|
50
|
+
return businessName.trim().length > 0;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Returns the trimmed value of an optional field, or `undefined` when the
|
|
54
|
+
* field is disabled or blank — a blank optional field is never sent.
|
|
55
|
+
*/
|
|
56
|
+
function optionalValue(enabled, value) {
|
|
57
|
+
if (!enabled) return void 0;
|
|
58
|
+
const trimmed = value.trim();
|
|
59
|
+
return trimmed.length > 0 ? trimmed : void 0;
|
|
60
|
+
}
|
|
61
|
+
function getTaxId(context) {
|
|
62
|
+
return optionalValue(context.config?.taxIdEnabled, context.taxId);
|
|
63
|
+
}
|
|
64
|
+
function getDateOfIncorporation(context) {
|
|
65
|
+
return optionalValue(context.config?.dateOfIncorporationEnabled, context.dateOfIncorporation);
|
|
66
|
+
}
|
|
67
|
+
function computeValidationErrors(context) {
|
|
68
|
+
const errors = {};
|
|
69
|
+
if (!computeIsValid(context.businessName)) errors.businessName = BUSINESS_NAME_REQUIRED_ERROR;
|
|
70
|
+
const taxId = getTaxId(context);
|
|
71
|
+
const validateTaxId = TAX_ID_VALIDATORS[context.country];
|
|
72
|
+
if (taxId && validateTaxId && !validateTaxId(taxId)) errors.taxId = INVALID_TAX_ID_ERROR;
|
|
73
|
+
const dateOfIncorporation = getDateOfIncorporation(context);
|
|
74
|
+
if (dateOfIncorporation && dateOfIncorporation > getMaxDateOfIncorporation()) errors.dateOfIncorporation = FUTURE_DATE_OF_INCORPORATION_ERROR;
|
|
75
|
+
return Object.keys(errors).length > 0 ? errors : void 0;
|
|
76
|
+
}
|
|
77
|
+
function buildSubmitRequest(context) {
|
|
78
|
+
const request = {
|
|
79
|
+
countryCodes: [context.country],
|
|
80
|
+
businessName: context.businessName.trim()
|
|
81
|
+
};
|
|
82
|
+
const taxId = getTaxId(context);
|
|
83
|
+
if (taxId) request.taxId = taxId;
|
|
84
|
+
const dateOfIncorporation = getDateOfIncorporation(context);
|
|
85
|
+
if (dateOfIncorporation) request.dateOfIncorporation = dateOfIncorporation;
|
|
86
|
+
return request;
|
|
87
|
+
}
|
|
88
|
+
/** Drops one field's error once the user edits what it depends on. */
|
|
89
|
+
function withoutValidationError(context, field) {
|
|
90
|
+
if (!context.validationErrors?.[field]) return {};
|
|
91
|
+
const remaining = { ...context.validationErrors };
|
|
92
|
+
delete remaining[field];
|
|
93
|
+
return { validationErrors: Object.keys(remaining).length > 0 ? remaining : void 0 };
|
|
94
|
+
}
|
|
95
|
+
const watchlistForBusinessMachine = setup({
|
|
96
|
+
types: {
|
|
97
|
+
context: {},
|
|
98
|
+
events: {},
|
|
99
|
+
input: {}
|
|
100
|
+
},
|
|
101
|
+
actors: { submitWatchlistForBusiness: fromPromise(async ({ input, signal }) => {
|
|
102
|
+
await submitWatchlistForBusiness(input, signal);
|
|
103
|
+
}) },
|
|
104
|
+
actions: {
|
|
105
|
+
setCountry: assign(({ event }) => {
|
|
106
|
+
const { country } = event;
|
|
107
|
+
return { country };
|
|
108
|
+
}),
|
|
109
|
+
setBusinessName: assign(({ event }) => {
|
|
110
|
+
const { value } = event;
|
|
111
|
+
return {
|
|
112
|
+
businessName: value,
|
|
113
|
+
isValid: computeIsValid(value)
|
|
114
|
+
};
|
|
115
|
+
}),
|
|
116
|
+
setTaxId: assign(({ event }) => {
|
|
117
|
+
const { value } = event;
|
|
118
|
+
return { taxId: value };
|
|
119
|
+
}),
|
|
120
|
+
setDateOfIncorporation: assign(({ event }) => {
|
|
121
|
+
const { value } = event;
|
|
122
|
+
return { dateOfIncorporation: value };
|
|
123
|
+
}),
|
|
124
|
+
clearBusinessNameValidationError: assign(({ context }) => withoutValidationError(context, "businessName")),
|
|
125
|
+
clearTaxIdValidationError: assign(({ context }) => withoutValidationError(context, "taxId")),
|
|
126
|
+
clearDateOfIncorporationValidationError: assign(({ context }) => withoutValidationError(context, "dateOfIncorporation")),
|
|
127
|
+
setValidationErrors: assign(({ context }) => ({ validationErrors: computeValidationErrors(context) }))
|
|
128
|
+
},
|
|
129
|
+
guards: { canSubmit: ({ context }) => computeValidationErrors(context) === void 0 }
|
|
130
|
+
}).createMachine({
|
|
131
|
+
id: "watchlist-for-business",
|
|
132
|
+
initial: "idle",
|
|
133
|
+
context: ({ input }) => ({
|
|
134
|
+
config: input?.config ?? {},
|
|
135
|
+
country: DEFAULT_COUNTRY,
|
|
136
|
+
businessName: "",
|
|
137
|
+
taxId: "",
|
|
138
|
+
dateOfIncorporation: "",
|
|
139
|
+
isValid: false,
|
|
140
|
+
validationErrors: void 0
|
|
141
|
+
}),
|
|
142
|
+
states: {
|
|
143
|
+
idle: { on: { LOAD: { target: "form" } } },
|
|
144
|
+
form: { on: {
|
|
145
|
+
SET_COUNTRY: { actions: ["setCountry", "clearTaxIdValidationError"] },
|
|
146
|
+
SET_BUSINESS_NAME: { actions: ["setBusinessName", "clearBusinessNameValidationError"] },
|
|
147
|
+
SET_TAX_ID: { actions: ["setTaxId", "clearTaxIdValidationError"] },
|
|
148
|
+
SET_DATE_OF_INCORPORATION: { actions: ["setDateOfIncorporation", "clearDateOfIncorporationValidationError"] },
|
|
149
|
+
SUBMIT: [{
|
|
150
|
+
target: "submitting",
|
|
151
|
+
guard: "canSubmit"
|
|
152
|
+
}, { actions: "setValidationErrors" }]
|
|
153
|
+
} },
|
|
154
|
+
submitting: { invoke: {
|
|
155
|
+
id: "submitWatchlistForBusiness",
|
|
156
|
+
src: "submitWatchlistForBusiness",
|
|
157
|
+
input: ({ context }) => buildSubmitRequest(context),
|
|
158
|
+
onDone: { target: "success" },
|
|
159
|
+
onError: { target: "finished" }
|
|
160
|
+
} },
|
|
161
|
+
success: { after: { 3e3: { target: "finished" } } },
|
|
162
|
+
finished: { type: "final" }
|
|
163
|
+
}
|
|
164
|
+
});
|
|
165
|
+
//#endregion
|
|
166
|
+
export { watchlistForBusinessMachine as n, getMaxDateOfIncorporation as t };
|
package/dist/workflow.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { A as StateMachine, C as StateValue, D as PromiseActorLogic, a as ActorR
|
|
|
2
2
|
import { t as CallbackActorLogic } from "./callback-645_omgz.js";
|
|
3
3
|
import { t as Manager } from "./Manager-C9T5amUN.js";
|
|
4
4
|
import { a as TotalScore, i as GetTotalScoreStatusFn, n as FinishStatus, r as GetFinishStatusFn } from "./flowCompletionService-BlAHsKyv.js";
|
|
5
|
-
import { o as FlowEventSubscribable } from "./index-
|
|
5
|
+
import { o as FlowEventSubscribable } from "./index-BSf46iwq.js";
|
|
6
6
|
import { a as WorkflowModuleRegistry, i as RunChildModuleInput, r as RunChildModuleEvent, t as ModuleConfigMappers } from "./types-BQA7lRDV.js";
|
|
7
7
|
//#region src/modules/workflow/types.d.ts
|
|
8
8
|
/** Possible node types returned by the workflow server. */
|
|
@@ -364,10 +364,6 @@ declare const workflowMachine: StateMachine<WorkflowContext, {
|
|
|
364
364
|
id: string | undefined;
|
|
365
365
|
};
|
|
366
366
|
}>, Values<{
|
|
367
|
-
setError: {
|
|
368
|
-
type: "setError";
|
|
369
|
-
params: NonReducibleUnknown;
|
|
370
|
-
};
|
|
371
367
|
setLoadingResult: {
|
|
372
368
|
type: "setLoadingResult";
|
|
373
369
|
params: NonReducibleUnknown;
|
|
@@ -400,6 +396,10 @@ declare const workflowMachine: StateMachine<WorkflowContext, {
|
|
|
400
396
|
type: "setFinishStatusFailed";
|
|
401
397
|
params: NonReducibleUnknown;
|
|
402
398
|
};
|
|
399
|
+
setError: {
|
|
400
|
+
type: "setError";
|
|
401
|
+
params: NonReducibleUnknown;
|
|
402
|
+
};
|
|
403
403
|
setModuleError: {
|
|
404
404
|
type: "setModuleError";
|
|
405
405
|
params: NonReducibleUnknown;
|