@incodetech/core 2.2.0 → 2.3.0-rc.0
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/THIRD_PARTY_NOTICES.txt +281 -0
- package/dist/BaseWasmProvider-Dyi6dKp1.d.ts +65 -0
- package/dist/{BrowserDiagnosticsCryptoProvider-B8vorxN5.esm.js → BrowserDiagnosticsCryptoProvider-C_9o3L2L.esm.js} +1 -1
- package/dist/{BrowserVisibilityObserverProvider-BX1BiLDK.esm.js → BrowserVisibilityObserverProvider-BrJN1B8A.esm.js} +2 -0
- package/dist/FaceDetectionProvider-DTetAE8H.esm.js +476 -0
- package/dist/FaceDetectionProvider-LdZ47bWy.d.ts +36 -0
- package/dist/{IIdCaptureCapability-DHTT3FC2.d.ts → IIdCaptureCapability-RNiFhvXR.d.ts} +7 -33
- package/dist/IWasmUtilCapability-CXXDA5l1.d.ts +159 -0
- package/dist/{MotionSensorProvider-DGiV77J_.esm.js → MotionSensorProvider-BgTYwg9L.esm.js} +1 -1
- package/dist/{deepsightService-DLVQS_RH.d.ts → StreamCanvasCapture-B3YT2Bt6.d.ts} +54 -41
- package/dist/{StreamCanvasCapture-D2XcXCZ4.esm.js → StreamCanvasCapture-C9jtgBdT.esm.js} +2 -2
- package/dist/{addressSearch-D1XpBdUS.esm.js → addressSearch-BRSu_aGA.esm.js} +1 -1
- package/dist/advanceableErrors-CpF2cBy6.esm.js +21 -0
- package/dist/ae-signature.d.ts +4 -2
- package/dist/ae-signature.esm.js +1 -1
- package/dist/antifraud.esm.js +2 -2
- package/dist/{antifraudManager-CQFNgSPt.esm.js → antifraudManager-Bg9ynGum.esm.js} +2 -2
- package/dist/{antifraudStateMachine-Bf_JVNwn.esm.js → antifraudStateMachine-BHxehiJZ.esm.js} +1 -1
- package/dist/{apiError-BA1d_au0.esm.js → apiError-D0v5hFyN.esm.js} +14 -2
- package/dist/authentication.d.ts +3 -3
- package/dist/authentication.esm.js +2 -2
- package/dist/{authenticationManager-zh9TC62P.esm.js → authenticationManager-C4B4-29g.esm.js} +5 -5
- package/dist/{authenticationManager-BBMGTcwW.d.ts → authenticationManager-DXTIUcma.d.ts} +7 -1
- package/dist/{authenticationStateMachine-xzi-vnvE.esm.js → authenticationStateMachine-DJ0zUm-A.esm.js} +6 -62
- package/dist/avatar.d.ts +1 -2
- package/dist/avatar.esm.js +1 -1
- package/dist/{backCameraStream-CUeYm5eu.esm.js → backCameraStream-BOtyQowf.esm.js} +83 -22
- package/dist/{camera-_2sXMXiF.esm.js → camera-sIa9ceW2.esm.js} +19 -1
- package/dist/camera.esm.js +1 -1
- package/dist/{canvas-E1zGkel4.esm.js → canvas-BxFzWTt-.esm.js} +19 -0
- package/dist/certificate-issuance.d.ts +2 -302
- package/dist/certificate-issuance.esm.js +3 -66
- package/dist/certificateIssuanceManager-Bfvkq7Cy.esm.js +69 -0
- package/dist/certificateIssuanceManager-DCgEidHz.d.ts +312 -0
- package/dist/{certificateIssuanceStateMachine-D_R92TYu.esm.js → certificateIssuanceStateMachine-BBD5h8c4.esm.js} +1 -1
- package/dist/consent.d.ts +1 -1
- package/dist/consent.esm.js +2 -2
- package/dist/{consentManager-BxjpLZAG.esm.js → consentManager-B5Vqdez-.esm.js} +2 -2
- package/dist/{consentManager-3Pbtj-RV.d.ts → consentManager-uhDPdU6i.d.ts} +4 -4
- package/dist/{consentStateMachine-D9D4ON8Z.esm.js → consentStateMachine-DbUmqWgV.esm.js} +1 -1
- package/dist/createCameraCycleOwnership-DQ5-F2oW.esm.js +826 -0
- package/dist/{createFaceAvatar-DQKaRise.esm.js → createFaceAvatar-BNHdeFj8.esm.js} +2 -2
- package/dist/createFaceAvatar-BlcTYgJv.d.ts +497 -0
- package/dist/cross-document-data-match.esm.js +1 -1
- package/dist/{crossDocumentDataMatchManager-CGT0V6RV.esm.js → crossDocumentDataMatchManager-QMOGwHXR.esm.js} +2 -2
- package/dist/curp-validation.d.ts +1 -1
- package/dist/curp-validation.esm.js +2 -2
- package/dist/{curpValidationManager-6Nmkn5u1.esm.js → curpValidationManager-D1ppROcF.esm.js} +2 -2
- package/dist/{curpValidationManager-DVGr7Fq7.d.ts → curpValidationManager-SSKNrm5Z.d.ts} +1 -1
- package/dist/{curpValidationStateMachine-Ds7KMacK.esm.js → curpValidationStateMachine-DvUPC_8S.esm.js} +1 -1
- package/dist/custom-fields.d.ts +2 -114
- package/dist/custom-fields.esm.js +2 -232
- package/dist/custom-watchlist.d.ts +2 -51
- package/dist/custom-watchlist.esm.js +3 -70
- package/dist/customFieldsManager-2j_PBq4U.esm.js +264 -0
- package/dist/customFieldsManager-8-W2KY4n.d.ts +141 -0
- package/dist/customWatchlistManager-DUVrEdw9.esm.js +73 -0
- package/dist/customWatchlistManager-PBWHr_oM.d.ts +64 -0
- package/dist/{customWatchlistStateMachine-YWSgKLbF.esm.js → customWatchlistStateMachine-qZVgkKgP.esm.js} +1 -1
- package/dist/{deepsightLoader--wMKWECS.esm.js → deepsightLoader-Dm7ejW4v.esm.js} +27 -71
- package/dist/device.d.ts +25 -2
- package/dist/device.esm.js +69 -7
- package/dist/document-capture.d.ts +2 -2
- package/dist/document-capture.esm.js +2 -2
- package/dist/{documentCaptureManager-DsQQhWry.esm.js → documentCaptureManager-DR_Wv-3H.esm.js} +2 -2
- package/dist/{documentCaptureManager-B3t0ydtg.d.ts → documentCaptureManager-DensIj5F.d.ts} +83 -83
- package/dist/{documentCaptureStateMachine-BM4Ex_5x.esm.js → documentCaptureStateMachine-CWOATHfE.esm.js} +5 -5
- package/dist/dynamic-forms.d.ts +1 -1
- package/dist/dynamic-forms.esm.js +2 -2
- package/dist/{dynamicFormsManager-fhK0yINk.d.ts → dynamicFormsManager-D5R_uxLQ.d.ts} +25 -3
- package/dist/{dynamicFormsManager-fFVIRBNv.esm.js → dynamicFormsManager-Dt98SDfV.esm.js} +16 -5
- package/dist/{dynamicFormsStateMachine-D6D7oEYk.esm.js → dynamicFormsStateMachine-obKr4IIp.esm.js} +35 -3
- package/dist/ekyb.d.ts +1 -1
- package/dist/ekyb.esm.js +3 -3
- package/dist/{ekybManager-Y3MkoXpC.esm.js → ekybManager-DNZKrKF3.esm.js} +2 -2
- package/dist/{ekybStateMachine-3nlnqdlr.esm.js → ekybStateMachine-DjhHQXZ8.esm.js} +3 -3
- package/dist/ekyc.esm.js +2 -2
- package/dist/{ekycManager-DgT48ky6.esm.js → ekycManager-CmQBpeiI.esm.js} +2 -2
- package/dist/{ekycStateMachine-CQwqiR-R.esm.js → ekycStateMachine-CmdW2gVm.esm.js} +2 -2
- package/dist/electronic-signature.d.ts +3 -3
- package/dist/electronic-signature.esm.js +2 -2
- package/dist/electronicSignatureManager-Ds-KEVTq.d.ts +2786 -0
- package/dist/{electronicSignatureManager-DGbAJ00W.esm.js → electronicSignatureManager-DzulxM4_.esm.js} +357 -51
- package/dist/email.esm.js +2 -2
- package/dist/{emailManager-BY0jeYwR.esm.js → emailManager-B5ek_UfM.esm.js} +2 -2
- package/dist/{emailStateMachine-Crw8QVmc.esm.js → emailStateMachine-CyPFZ7dW.esm.js} +1 -1
- package/dist/{endpoints-CCzL3XD_.esm.js → endpoints-D3B9mUHh.esm.js} +24 -7
- package/dist/{events-DYiyoSlx.esm.js → events-ijlbX_Wx.esm.js} +2 -2
- package/dist/events.d.ts +1 -1
- package/dist/events.esm.js +1 -1
- package/dist/extensibility.d.ts +24 -64
- package/dist/extensibility.esm.js +35 -29
- package/dist/face-match.esm.js +2 -2
- package/dist/{faceCaptureManagerFactory-BxWPpxyd.d.ts → faceCaptureManagerFactory-CvtqcLxs.d.ts} +87 -54
- package/dist/{faceCaptureManagerFactory-CVnZ0fa5.esm.js → faceCaptureManagerFactory-pCmG4MeF.esm.js} +68 -7
- package/dist/faceCaptureSetup-BSextack.esm.js +2106 -0
- package/dist/{faceMatchManager-Ri4UbNz0.esm.js → faceMatchManager-Caal2zyV.esm.js} +2 -2
- package/dist/{faceMatchStateMachine-20DdZ3jg.esm.js → faceMatchStateMachine-BUc5FXYy.esm.js} +1 -1
- package/dist/{feature-management-CPQ4qv3F.esm.js → feature-management-B0sGlozZ.esm.js} +32 -7
- package/dist/feature-management.d.ts +1 -1
- package/dist/feature-management.esm.js +1 -1
- package/dist/field-comparison.esm.js +1 -1
- package/dist/{fieldComparisonManager-Cg6kPQQx.esm.js → fieldComparisonManager-BIs6HPJG.esm.js} +2 -2
- package/dist/fiscal-qr.d.ts +2 -56
- package/dist/fiscal-qr.esm.js +2 -308
- package/dist/fiscalQrManager-Bp_-3LJr.esm.js +34131 -0
- package/dist/fiscalQrManager-CHcBJwUM.d.ts +68 -0
- package/dist/flow-events.d.ts +1 -1
- package/dist/flow.d.ts +212 -185
- package/dist/flow.esm.js +119 -30
- package/dist/{flowCompletionService-tfeoGre9.esm.js → flowCompletionService-CLtbWhSK.esm.js} +2 -2
- package/dist/{flowServices-f5Ruz7R9.esm.js → flowServices-B5FwukTQ.esm.js} +91 -26
- package/dist/geolocation.esm.js +2 -2
- package/dist/{geolocationManager-CH6RfqFH.esm.js → geolocationManager-DIw-xq9a.esm.js} +2 -2
- package/dist/{geolocationStateMachine-DmbWFely.esm.js → geolocationStateMachine-DpG0TFOU.esm.js} +3 -3
- package/dist/getBrowser-CBiibsL-.esm.js +19 -0
- package/dist/{getBrowser-DNrQeL4T.esm.js → getBrowser-Cbe1C4Tn.esm.js} +2 -1
- package/dist/{getDeviceClass-9y-kbVDw.esm.js → getDeviceClass-5NYZg9s6.esm.js} +2 -2
- package/dist/getParsedUserAgent-B2iFDql1.esm.js +1278 -0
- package/dist/government-validation.d.ts +2 -85
- package/dist/government-validation.esm.js +3 -120
- package/dist/governmentValidationManager-D02vT4yY.d.ts +63 -0
- package/dist/governmentValidationManager-TjC9iVjH.esm.js +79 -0
- package/dist/governmentValidationStateMachine-D1ZnEqdd.esm.js +54 -0
- package/dist/home.d.ts +1 -1
- package/dist/home.esm.js +1 -1
- package/dist/id-ocr.d.ts +2 -2
- package/dist/id-ocr.esm.js +2 -2
- package/dist/id-selfie-flow.d.ts +3 -2
- package/dist/id-selfie-flow.esm.js +11 -10
- package/dist/id-verification.esm.js +2 -2
- package/dist/id.d.ts +29 -5
- package/dist/id.esm.js +48 -46
- package/dist/idCaptureDefaults-BcxjQDI3.esm.js +484 -0
- package/dist/{idCaptureManager-CqrqSjJV.d.ts → idCaptureManager-CvmHOWWd.d.ts} +227 -39
- package/dist/{idCaptureManager-BYwTZ2H8.esm.js → idCaptureManager-Vby8oYqh.esm.js} +259 -46
- package/dist/{idCaptureServices-44kwQItl.esm.js → idCaptureServices-CJIxD9ep.esm.js} +342 -31
- package/dist/idCaptureStateMachine-CmqihkUy.esm.js +5343 -0
- package/dist/{idOcrManager-DXc_xRN7.d.ts → idOcrManager-BF_cXZq8.d.ts} +1 -1
- package/dist/{idOcrManager-BIQYQXXj.esm.js → idOcrManager-DHU22hVn.esm.js} +2 -2
- package/dist/{idOcrStateMachine-cSxzHpHt.esm.js → idOcrStateMachine-33UvRAHE.esm.js} +1 -1
- package/dist/{idVerificationManager-JpV_SAsl.esm.js → idVerificationManager-CyaixD0D.esm.js} +2 -2
- package/dist/{idVerificationStateMachine-nPeUNyFq.esm.js → idVerificationStateMachine-BPGrQZEm.esm.js} +1 -1
- package/dist/identity-reuse.esm.js +2 -2
- package/dist/{identityReuseManager-kNCg9AbD.esm.js → identityReuseManager-CWaNHBO3.esm.js} +2 -2
- package/dist/{identityReuseStateMachine-DyulxDjP.esm.js → identityReuseStateMachine-CQgnATo5.esm.js} +1 -1
- package/dist/{index-CLMF0QLQ.d.ts → index-DLcJT5YP.d.ts} +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/{invokeOnCaptureCallback-GpvMuz9o.esm.js → invokeOnCaptureCallback-BjzPjJ_p.esm.js} +1 -1
- package/dist/mandatory-consent.d.ts +2 -2
- package/dist/mandatory-consent.esm.js +2 -2
- package/dist/{mandatoryConsentManager-DyPzUmsZ.d.ts → mandatoryConsentManager-CJSyhTpi.d.ts} +5 -5
- package/dist/{mandatoryConsentManager-B4Niyg_u.esm.js → mandatoryConsentManager-Du-m-tZ_.esm.js} +2 -2
- package/dist/{mandatoryConsentStateMachine-B4-1u-L8.esm.js → mandatoryConsentStateMachine-DSDAk7WZ.esm.js} +1 -1
- package/dist/multipartRecordingService-B3C_zlev.esm.js +594 -0
- package/dist/{permissionGuards-KINpmKtI.esm.js → permissionGuards-uYZYFu4J.esm.js} +1 -1
- package/dist/{permissionServices-UvUcOSRb.esm.js → permissionServices-Bj_fyWtv.esm.js} +5 -5
- package/dist/personhood.d.ts +6 -5
- package/dist/personhood.esm.js +10 -10
- package/dist/phone.esm.js +2 -2
- package/dist/{phoneManager-FsJ0W2Ei.esm.js → phoneManager-N1-sbrY4.esm.js} +2 -2
- package/dist/{phoneStateMachine-Ba0wKHyX.esm.js → phoneStateMachine-jl8LJKCo.esm.js} +1 -1
- package/dist/{platform-BJrm5nzZ.esm.js → platform-DkcRc9JV.esm.js} +29 -1
- package/dist/qe-signature.d.ts +5 -3
- package/dist/qe-signature.esm.js +2 -2
- package/dist/recordingsRepository-CCWy13M-.esm.js +72 -0
- package/dist/redirect-to-mobile.esm.js +2 -2
- package/dist/{redirectToMobileManager-y4VQB11M.esm.js → redirectToMobileManager-DsFzdTwA.esm.js} +2 -2
- package/dist/{redirectToMobileStateMachine-Cyv2x0PP.esm.js → redirectToMobileStateMachine-v3otpT-L.esm.js} +1 -1
- package/dist/{rolldown-runtime-FZ4Itg2g.esm.js → rolldown-runtime-FDOR9p9I.esm.js} +1 -19
- package/dist/{runChildModule-Dukuw23X.esm.js → runChildModule-TuyGE00X.esm.js} +3 -21
- package/dist/safeStorage-B-trhxg6.esm.js +423 -0
- package/dist/{sdkVersion-D1Bm59g6.esm.js → sdkVersion-CLxKvdyz.esm.js} +1 -1
- package/dist/selfie.d.ts +5 -5
- package/dist/selfie.esm.js +14 -76
- package/dist/{selfieErrorUtils-C2PYBVsp.esm.js → selfieErrorUtils-C77GXJH6.esm.js} +30 -4
- package/dist/{selfieManager-Bj6B2ZVy.esm.js → selfieManager-CihVnODO.esm.js} +5 -5
- package/dist/{selfieManager-DwlCppg0.d.ts → selfieManager-D1KRJ39M.d.ts} +8 -11
- package/dist/selfieStateMachine-fwMmNtOi.esm.js +69 -0
- package/dist/{session-BFdLgN4i.esm.js → session-BHIeAamR.esm.js} +4 -5
- package/dist/session.d.ts +21 -11
- package/dist/session.esm.js +5 -5
- package/dist/{sessionInitializer-dlfDehHk.esm.js → sessionInitializer-BLoK7SP9.esm.js} +187 -68
- package/dist/{setup-BgoWtvIS.d.ts → setup-Cv-JM9QC.d.ts} +63 -69
- package/dist/{setup-BIAtLa8k.esm.js → setup-msLybMbC.esm.js} +226 -100
- package/dist/signature.esm.js +2 -2
- package/dist/{signatureManager-Ca43yhwk.esm.js → signatureManager-ChsB-nMD.esm.js} +2 -2
- package/dist/{signatureStateMachine-K1LMRrxG.esm.js → signatureStateMachine-BHPwkJZS.esm.js} +1 -1
- package/dist/{src-0Jurt29N.esm.js → src-35ekGRzK.esm.js} +1 -1
- package/dist/{stats-B0nFKawG.esm.js → stats-DkK-f8JT.esm.js} +1 -1
- package/dist/stats.esm.js +1 -1
- package/dist/{trueSightService---iW2KKJ.esm.js → trueSightService-CKrrfV0Q.esm.js} +7 -7
- package/dist/trust-graph.esm.js +1 -1
- package/dist/{types-BX_XkMsQ2.d.ts → types-9_esGTPj.d.ts} +1 -1
- package/dist/types-BT_Oalip.d.ts +1 -0
- package/dist/{types-DelMqZLe.d.ts → types-BjSly8cp.d.ts} +1 -1
- package/dist/{types-Hmd7U0JA.d.ts → types-CM-jtjJ2.d.ts} +6 -81
- package/dist/{types-Bdf8_LYB2.d.ts → types-CjKBS37a2.d.ts} +303 -13
- package/dist/{types-DVmXIdzW.d.ts → types-D0gekt4U.d.ts} +38 -5
- package/dist/types-DgDvvzg0.d.ts +10 -0
- package/dist/{types-KPvmag_B.d.ts → types-Do5rEXij.d.ts} +7 -4
- package/dist/types-ZT1XFIJ8.d.ts +6 -0
- package/dist/video-selfie.d.ts +59 -35
- package/dist/video-selfie.esm.js +510 -601
- package/dist/{videoSelfieCameraWarmer-NEhFZvWx.esm.js → videoSelfieCameraWarmer-CB1IzZkt.esm.js} +14 -153
- package/dist/videoSelfieFlowModuleMachine-BUe2uACW.esm.js +32 -0
- package/dist/{videoSelfieStepDetector-D3oo2ofo.d.ts → videoSelfieStepDetector-5YHFe0Mq.d.ts} +21 -5
- package/dist/virtualCameraCheck-WOloJ-do.esm.js +48 -0
- package/dist/warmup-CUUnwYxe.esm.js +714 -0
- package/dist/warmup-Cis2p6O0.d.ts +128 -0
- package/dist/wasm.d.ts +30 -6
- package/dist/wasm.esm.js +36 -4
- package/dist/{wasmDsFlagSync-BqUCwLY8.esm.js → wasmDsFlagSync-B2e8p268.esm.js} +2 -2
- package/dist/{wasmWebClient-DM8lkb0z.esm.js → wasmWebClient-B7baE-Wf.esm.js} +358 -28
- package/dist/watchlist-for-business.d.ts +2 -78
- package/dist/watchlist-for-business.esm.js +3 -102
- package/dist/watchlist.esm.js +2 -2
- package/dist/watchlistForBusinessManager-CpuuB1J2.esm.js +107 -0
- package/dist/watchlistForBusinessManager-CsnJnG-C.d.ts +99 -0
- package/dist/{watchlistForBusinessStateMachine-CxFnlshm.esm.js → watchlistForBusinessStateMachine-DEzgjz7C.esm.js} +13 -6
- package/dist/{watchlistManager-LoNZH9qm.esm.js → watchlistManager-CI8BHFob.esm.js} +2 -2
- package/dist/{watchlistStateMachine-DIKQDoUT.esm.js → watchlistStateMachine-DvOby3a-.esm.js} +1 -1
- package/dist/workflow.d.ts +12 -8
- package/dist/workflow.esm.js +48 -39
- package/package.json +4 -10
- package/dist/BrowserStorageProvider-k-FDkC4W.esm.js +0 -67
- package/dist/FaceDetectionProvider-Mh6q3EbA.d.ts +0 -349
- package/dist/IFaceAvatarCapability-BrL19G0s.d.ts +0 -23
- package/dist/IStorageCapability-ORkQfK3F.d.ts +0 -242
- package/dist/OpenViduRecordingProvider-Du98qevC.esm.js +0 -85
- package/dist/createFaceAvatar-BEj18KXi.d.ts +0 -50
- package/dist/document-upload.d.ts +0 -325
- package/dist/document-upload.esm.js +0 -197
- package/dist/electronicSignatureManager-CcUXQZS7.d.ts +0 -1300
- package/dist/faceCaptureSetup-Cd-04W_X.esm.js +0 -863
- package/dist/getBrowser-Cb8Zgrgp.esm.js +0 -7
- package/dist/getParsedUserAgent-pJjATANs.esm.js +0 -1622
- package/dist/governmentValidationStateMachine-CK9DrZXX.esm.js +0 -226
- package/dist/idCaptureDefaults-WeHbQM7W.esm.js +0 -225
- package/dist/idCaptureStateMachine-kZ5OpdfM.esm.js +0 -3342
- package/dist/lib-DAyUtOTj.esm.js +0 -12420
- package/dist/manualReviewService-D4IkipnN.esm.js +0 -15
- package/dist/mediaRecorderOptions-dALSV8af.esm.js +0 -40
- package/dist/onDeviceFaceResults-CUHwyZT4.esm.js +0 -646
- package/dist/openviduLazy-CCDpFWg1.esm.js +0 -10
- package/dist/recordingService-3NSENVwp.esm.js +0 -329
- package/dist/safeStorage-Ep56I-f_.esm.js +0 -982
- package/dist/selfieStateMachine-CHV_WNst.esm.js +0 -55
- package/dist/trueSight-B_icM8r2.esm.js +0 -1
- package/dist/types-EELWyWpd.d.ts +0 -6
- package/dist/types-Vb4P9ovf.d.ts +0 -22
- package/dist/warmup-Dv2alr2-.d.ts +0 -82
- package/dist/wasmDefaults-DTUrftxR.esm.js +0 -125
- package/dist/{Face2DProvider-UUQt_vRC.esm.js → Face2DProvider-BF48sz5c.esm.js} +1 -1
- package/dist/{PrivacyLensProvider-D8PS7AJa.esm.js → PrivacyLensProvider-EwnC_C5n.esm.js} +1 -1
- /package/dist/{types-BfgmV7s72.d.ts → types-BfgmV7s7.d.ts} +0 -0
- /package/dist/{types-CJ7Yl9K-2.d.ts → types-CJ7Yl9K-.d.ts} +0 -0
|
@@ -1,232 +1,2 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
|
|
3
|
-
import { t as topLevelStateName } from "./topLevelStateName-B5i2avbh.esm.js";
|
|
4
|
-
import { t as endpoints } from "./endpoints-CCzL3XD_.esm.js";
|
|
5
|
-
import { i as assign, s as createActor, t as setup, u as createManager } from "./xstate.esm-BuFLFuzz.esm.js";
|
|
6
|
-
import { n as fromPromise } from "./xstate-actors.esm-BXeQ-Ucz.esm.js";
|
|
7
|
-
import { t as isoDateToMs } from "./dateUtils-CvG0FvK8.esm.js";
|
|
8
|
-
//#region src/modules/custom-fields/customFieldsServices.ts
|
|
9
|
-
async function submitCustomFields(params, signal) {
|
|
10
|
-
const res = await api.post(endpoints.addCustomFields, params.fields, { signal });
|
|
11
|
-
if (!res.ok) throw new Error(`POST ${endpoints.addCustomFields} failed: ${res.status} ${res.statusText}`);
|
|
12
|
-
return res.data;
|
|
13
|
-
}
|
|
14
|
-
//#endregion
|
|
15
|
-
//#region src/modules/custom-fields/customFieldsStateMachine.ts
|
|
16
|
-
function transformFields(fields, customFields) {
|
|
17
|
-
const result = {};
|
|
18
|
-
for (const [key, value] of Object.entries(fields)) if (customFields.find((f) => f.name === key)?.type === "DATE" && typeof value === "string" && value !== "") result[key] = isoDateToMs(value);
|
|
19
|
-
else result[key] = value;
|
|
20
|
-
return result;
|
|
21
|
-
}
|
|
22
|
-
const customFieldsMachine = setup({
|
|
23
|
-
types: {
|
|
24
|
-
context: {},
|
|
25
|
-
events: {},
|
|
26
|
-
input: {}
|
|
27
|
-
},
|
|
28
|
-
actors: { submitFields: fromPromise(async ({ input, signal }) => {
|
|
29
|
-
return submitCustomFields({ fields: transformFields(input.fields, input.customFields) }, signal);
|
|
30
|
-
}) },
|
|
31
|
-
actions: {
|
|
32
|
-
setField: assign(({ context, event }) => {
|
|
33
|
-
const e = event;
|
|
34
|
-
return { fields: {
|
|
35
|
-
...context.fields,
|
|
36
|
-
[e.name]: e.value
|
|
37
|
-
} };
|
|
38
|
-
}),
|
|
39
|
-
markSuccess: assign({ result: "success" }),
|
|
40
|
-
markFailed: assign({ result: "failed" })
|
|
41
|
-
},
|
|
42
|
-
guards: { apiSucceeded: ({ event }) => event.output.success }
|
|
43
|
-
}).createMachine({
|
|
44
|
-
id: "customFields",
|
|
45
|
-
initial: "idle",
|
|
46
|
-
context: ({ input }) => ({
|
|
47
|
-
config: input.config,
|
|
48
|
-
fields: {},
|
|
49
|
-
result: null
|
|
50
|
-
}),
|
|
51
|
-
states: {
|
|
52
|
-
idle: { on: { LOAD: { target: "inputting" } } },
|
|
53
|
-
inputting: { on: {
|
|
54
|
-
FIELD_CHANGED: { actions: "setField" },
|
|
55
|
-
SUBMIT: { target: "submitting" }
|
|
56
|
-
} },
|
|
57
|
-
submitting: { invoke: {
|
|
58
|
-
id: "submitFields",
|
|
59
|
-
src: "submitFields",
|
|
60
|
-
input: ({ context }) => ({
|
|
61
|
-
fields: context.fields,
|
|
62
|
-
customFields: context.config.customFields
|
|
63
|
-
}),
|
|
64
|
-
onDone: [{
|
|
65
|
-
target: "success",
|
|
66
|
-
guard: "apiSucceeded"
|
|
67
|
-
}, {
|
|
68
|
-
target: "finished",
|
|
69
|
-
actions: "markFailed"
|
|
70
|
-
}],
|
|
71
|
-
onError: {
|
|
72
|
-
target: "finished",
|
|
73
|
-
actions: "markFailed"
|
|
74
|
-
}
|
|
75
|
-
} },
|
|
76
|
-
success: { after: { 3e3: {
|
|
77
|
-
target: "finished",
|
|
78
|
-
actions: "markSuccess"
|
|
79
|
-
} } },
|
|
80
|
-
finished: { type: "final" }
|
|
81
|
-
}
|
|
82
|
-
});
|
|
83
|
-
//#endregion
|
|
84
|
-
//#region src/modules/custom-fields/customFieldsActor.ts
|
|
85
|
-
function createCustomFieldsActor(options) {
|
|
86
|
-
return createActor(customFieldsMachine, { input: { config: options.config } }).start();
|
|
87
|
-
}
|
|
88
|
-
//#endregion
|
|
89
|
-
//#region src/modules/custom-fields/customFieldsManager.ts
|
|
90
|
-
/**
|
|
91
|
-
* Maps a custom-fields state-machine snapshot to the exact Figma "Tracked
|
|
92
|
-
* Events" screen name. Returned strings are the Figma-verbatim absolute
|
|
93
|
-
* analytics path emitted as-is on `event.screen` by
|
|
94
|
-
* `createManagerInstrumentation`'s `getEventScreenName` path. See
|
|
95
|
-
* `docs/patterns/INSTRUMENTATION.md`.
|
|
96
|
-
*
|
|
97
|
-
* Source of truth: Custom Fields Figma file → Tracked Events canvas
|
|
98
|
-
* (`https://www.figma.com/design/Fb4Jp6kal8clAD05Kh6l4e/Custom-fields---Latest-Design?node-id=2026-30075`).
|
|
99
|
-
* The canvas mixes two casings — sections name the input surfaces
|
|
100
|
-
* `Customfield.{empty,filled}` (capital `C`) and the post-input surfaces
|
|
101
|
-
* `customfield.{processing,complete}` (lowercase `c`). Both spellings are
|
|
102
|
-
* preserved verbatim as Figma is the source of truth.
|
|
103
|
-
*
|
|
104
|
-
* State → screen mapping rationale:
|
|
105
|
-
*
|
|
106
|
-
* - `idle`/`inputting` collapse to `Customfield.empty` — the SM stays in
|
|
107
|
-
* `inputting` throughout typing (field-level `FIELD_CHANGED` events are
|
|
108
|
-
* context-only and don't fire a new `screenOpened`). The Figma
|
|
109
|
-
* `Customfield.filled` surface is therefore a UI sub-state of `inputting`
|
|
110
|
-
* (computed in `mapState` as `canSubmit`), not a discrete SM state, and
|
|
111
|
-
* collapses onto the section's primary `Customfield.empty` screen.
|
|
112
|
-
* - `submitting` → `customfield.processing` — submit in-flight.
|
|
113
|
-
* - `success` → `customfield.complete` — happy-path success surface (auto-
|
|
114
|
-
* advances to `finished` after 3 s).
|
|
115
|
-
* - `finished` is intentionally unmapped: it is dual-outcome (success or
|
|
116
|
-
* failed — failures route here with `result: 'failed'` since the machine
|
|
117
|
-
* has no `error` state) and Figma defines no failure screen. Mapping
|
|
118
|
-
* `finished` onto `customfield.complete` would mis-report failures, so the
|
|
119
|
-
* adapter falls back to the generic `<module>.finished` default.
|
|
120
|
-
*/
|
|
121
|
-
function getCustomFieldsScreenName(snapshot) {
|
|
122
|
-
const stateName = topLevelStateName(snapshot.value);
|
|
123
|
-
if (stateName === void 0) return void 0;
|
|
124
|
-
switch (stateName) {
|
|
125
|
-
case "idle":
|
|
126
|
-
case "inputting": return "Customfield.empty";
|
|
127
|
-
case "submitting": return "customfield.processing";
|
|
128
|
-
case "success": return "customfield.complete";
|
|
129
|
-
default: return;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
function toDisplayLabel(field) {
|
|
133
|
-
if (field.alias) return field.alias;
|
|
134
|
-
return field.name.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
|
|
135
|
-
}
|
|
136
|
-
function isFormComplete(fields, customFields) {
|
|
137
|
-
return customFields.every((f) => {
|
|
138
|
-
if (f.type === "BOOLEAN") return true;
|
|
139
|
-
const value = fields[f.name];
|
|
140
|
-
return value !== void 0 && value !== "";
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
function mapState(snapshot) {
|
|
144
|
-
const typedSnapshot = snapshot;
|
|
145
|
-
const { context } = typedSnapshot;
|
|
146
|
-
if (typedSnapshot.matches("idle")) return { status: "idle" };
|
|
147
|
-
if (typedSnapshot.matches("inputting")) return {
|
|
148
|
-
status: "inputting",
|
|
149
|
-
title: context.config.title,
|
|
150
|
-
customFields: context.config.customFields.map((f) => ({
|
|
151
|
-
...f,
|
|
152
|
-
label: toDisplayLabel(f)
|
|
153
|
-
})),
|
|
154
|
-
canSubmit: isFormComplete(context.fields, context.config.customFields)
|
|
155
|
-
};
|
|
156
|
-
if (typedSnapshot.matches("submitting")) return {
|
|
157
|
-
status: "submitting",
|
|
158
|
-
title: context.config.title
|
|
159
|
-
};
|
|
160
|
-
if (typedSnapshot.matches("success")) return { status: "success" };
|
|
161
|
-
return {
|
|
162
|
-
status: "finished",
|
|
163
|
-
result: typedSnapshot.context.result
|
|
164
|
-
};
|
|
165
|
-
}
|
|
166
|
-
function createApi({ actor }) {
|
|
167
|
-
return {
|
|
168
|
-
/**
|
|
169
|
-
* Initializes the custom fields flow.
|
|
170
|
-
* Transitions from 'idle' to 'inputting'.
|
|
171
|
-
* Must be called before any other method.
|
|
172
|
-
*/
|
|
173
|
-
load() {
|
|
174
|
-
actor.send({ type: "LOAD" });
|
|
175
|
-
},
|
|
176
|
-
/**
|
|
177
|
-
* Updates the value of a single field.
|
|
178
|
-
* Should be called when state is 'inputting'.
|
|
179
|
-
*
|
|
180
|
-
* @param name - The field name (matches CustomField.name)
|
|
181
|
-
* @param value - The field value (string, number, or boolean)
|
|
182
|
-
*/
|
|
183
|
-
setField(name, value) {
|
|
184
|
-
actor.send({
|
|
185
|
-
type: "FIELD_CHANGED",
|
|
186
|
-
name,
|
|
187
|
-
value
|
|
188
|
-
});
|
|
189
|
-
},
|
|
190
|
-
/**
|
|
191
|
-
* Submits all custom field values to the backend.
|
|
192
|
-
* Transitions to 'submitting', then 'finished' regardless of outcome.
|
|
193
|
-
*/
|
|
194
|
-
submit() {
|
|
195
|
-
actor.send({ type: "SUBMIT" });
|
|
196
|
-
}
|
|
197
|
-
};
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Creates a custom fields manager for headless or UI-driven usage.
|
|
201
|
-
*
|
|
202
|
-
* @param options - Configuration options
|
|
203
|
-
* @param options.config - Custom fields configuration (title + field definitions)
|
|
204
|
-
*
|
|
205
|
-
* @returns Custom fields manager with state, API methods, and subscription
|
|
206
|
-
*
|
|
207
|
-
* @example Headless usage
|
|
208
|
-
* ```typescript
|
|
209
|
-
* const manager = createCustomFieldsManager({
|
|
210
|
-
* config: {
|
|
211
|
-
* title: 'Additional Information',
|
|
212
|
-
* customFields: [{ name: 'company', alias: 'Company', type: 'STRING' }],
|
|
213
|
-
* },
|
|
214
|
-
* });
|
|
215
|
-
*
|
|
216
|
-
* manager.subscribe((state) => console.log(state.status));
|
|
217
|
-
* manager.load();
|
|
218
|
-
* manager.setField('company', 'Incode');
|
|
219
|
-
* manager.submit();
|
|
220
|
-
* manager.stop();
|
|
221
|
-
* ```
|
|
222
|
-
*/
|
|
223
|
-
function createCustomFieldsManager(options) {
|
|
224
|
-
return createManager({
|
|
225
|
-
actor: createCustomFieldsActor(options),
|
|
226
|
-
mapState,
|
|
227
|
-
createApi,
|
|
228
|
-
instrumentation: createManagerInstrumentation(eventModuleNames.customFields, { getEventScreenName: getCustomFieldsScreenName })
|
|
229
|
-
});
|
|
230
|
-
}
|
|
231
|
-
//#endregion
|
|
232
|
-
export { createCustomFieldsManager, customFieldsMachine };
|
|
1
|
+
import { n as createCustomFieldsManagerFromActor, r as customFieldsMachine, t as createCustomFieldsManager } from "./customFieldsManager-2j_PBq4U.esm.js";
|
|
2
|
+
export { createCustomFieldsManager, createCustomFieldsManagerFromActor, customFieldsMachine };
|
|
@@ -1,53 +1,4 @@
|
|
|
1
|
-
import { t as
|
|
2
|
-
//#region src/modules/custom-watchlist/customWatchlistStateMachine.d.ts
|
|
3
|
-
type CustomWatchlistResult = 'success' | 'skipped';
|
|
4
|
-
declare const customWatchlistMachine: any;
|
|
5
|
-
//#endregion
|
|
6
|
-
//#region src/modules/custom-watchlist/customWatchlistManager.d.ts
|
|
7
|
-
type CustomWatchlistIdleState = {
|
|
8
|
-
status: 'idle';
|
|
9
|
-
};
|
|
10
|
-
type CustomWatchlistProcessingState = {
|
|
11
|
-
status: 'processing';
|
|
12
|
-
};
|
|
13
|
-
type CustomWatchlistSuccessState = {
|
|
14
|
-
status: 'success';
|
|
15
|
-
};
|
|
16
|
-
type CustomWatchlistFinishedState = {
|
|
17
|
-
status: 'finished';
|
|
18
|
-
result: CustomWatchlistResult;
|
|
19
|
-
};
|
|
20
|
-
/**
|
|
21
|
-
* Union of all possible custom watchlist manager states.
|
|
22
|
-
*
|
|
23
|
-
* @example
|
|
24
|
-
* ```typescript
|
|
25
|
-
* const state = customWatchlistManager.getState();
|
|
26
|
-
* if (state.status === 'finished') {
|
|
27
|
-
* console.log('Custom watchlist check complete');
|
|
28
|
-
* }
|
|
29
|
-
* ```
|
|
30
|
-
*/
|
|
31
|
-
type CustomWatchlistState = CustomWatchlistIdleState | CustomWatchlistProcessingState | CustomWatchlistSuccessState | CustomWatchlistFinishedState;
|
|
32
|
-
/**
|
|
33
|
-
* Creates a custom watchlist manager for headless or UI-driven usage.
|
|
34
|
-
*
|
|
35
|
-
* @example Headless usage
|
|
36
|
-
* ```typescript
|
|
37
|
-
* const manager = createCustomWatchlistManager();
|
|
38
|
-
* manager.subscribe((state) => console.log(state.status));
|
|
39
|
-
* manager.load();
|
|
40
|
-
* ```
|
|
41
|
-
*/
|
|
42
|
-
declare function createCustomWatchlistManager(): Manager<CustomWatchlistState> & {
|
|
43
|
-
/**
|
|
44
|
-
* Kicks off the custom watchlist check.
|
|
45
|
-
* Transitions from 'idle' to 'processing'.
|
|
46
|
-
*/
|
|
47
|
-
load(): void;
|
|
48
|
-
};
|
|
49
|
-
type CustomWatchlistManager = ReturnType<typeof createCustomWatchlistManager>;
|
|
50
|
-
//#endregion
|
|
1
|
+
import { a as CustomWatchlistActor, i as createCustomWatchlistManagerFromActor, n as CustomWatchlistState, o as customWatchlistMachine, r as createCustomWatchlistManager, t as CustomWatchlistManager } from "./customWatchlistManager-PBWHr_oM.js";
|
|
51
2
|
//#region src/modules/custom-watchlist/types.d.ts
|
|
52
3
|
/**
|
|
53
4
|
* Configuration for the custom watchlist module (INCODE_WATCHLIST flow key).
|
|
@@ -62,4 +13,4 @@ type CustomWatchlistConfig = {
|
|
|
62
13
|
autoExecution: boolean;
|
|
63
14
|
};
|
|
64
15
|
//#endregion
|
|
65
|
-
export { type CustomWatchlistConfig, type CustomWatchlistManager, type CustomWatchlistState, createCustomWatchlistManager, customWatchlistMachine };
|
|
16
|
+
export { type CustomWatchlistActor, type CustomWatchlistConfig, type CustomWatchlistManager, type CustomWatchlistState, createCustomWatchlistManager, createCustomWatchlistManagerFromActor, customWatchlistMachine };
|
|
@@ -1,70 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { t as
|
|
3
|
-
|
|
4
|
-
import { t as customWatchlistMachine } from "./customWatchlistStateMachine-YWSgKLbF.esm.js";
|
|
5
|
-
//#region src/modules/custom-watchlist/customWatchlistActor.ts
|
|
6
|
-
function createCustomWatchlistActor() {
|
|
7
|
-
return createActor(customWatchlistMachine).start();
|
|
8
|
-
}
|
|
9
|
-
//#endregion
|
|
10
|
-
//#region src/modules/custom-watchlist/customWatchlistManager.ts
|
|
11
|
-
/**
|
|
12
|
-
* Maps a Custom Watchlist state-machine snapshot to the exact Figma
|
|
13
|
-
* "Tracked Events" screen name. Source: Watchlist | Custom Watchlist
|
|
14
|
-
* Figma file (`https://www.figma.com/design/Xm4BgXotNwdi5iRdHTIX0N/Watchlist-%7C-Custom-Watchlist----Latest-Design?node-id=3031-82920`).
|
|
15
|
-
* Family is `watchlist.*`, shared with the global watchlist manager — both
|
|
16
|
-
* keep their own module token (`watchlist` vs `customWatchlist`) per the
|
|
17
|
-
* AdSign/QSign precedent.
|
|
18
|
-
*
|
|
19
|
-
* `idle` and `finished` are intentionally unmapped — the Figma canvas does
|
|
20
|
-
* not define screens for them; `finished` collapses into `moduleClosed`.
|
|
21
|
-
*/
|
|
22
|
-
function getCustomWatchlistScreenName(snapshot) {
|
|
23
|
-
const stateName = topLevelStateName(snapshot.value);
|
|
24
|
-
if (stateName === void 0) return void 0;
|
|
25
|
-
switch (stateName) {
|
|
26
|
-
case "processing": return "watchlist.processing";
|
|
27
|
-
case "success": return "watchlist.success";
|
|
28
|
-
default: return;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
function mapState(snapshot) {
|
|
32
|
-
const typedSnapshot = snapshot;
|
|
33
|
-
if (typedSnapshot.matches("processing")) return { status: "processing" };
|
|
34
|
-
if (typedSnapshot.matches("success")) return { status: "success" };
|
|
35
|
-
if (typedSnapshot.matches("finished")) return {
|
|
36
|
-
status: "finished",
|
|
37
|
-
result: typedSnapshot.context.result ?? "skipped"
|
|
38
|
-
};
|
|
39
|
-
return { status: "idle" };
|
|
40
|
-
}
|
|
41
|
-
function createApi({ actor }) {
|
|
42
|
-
return {
|
|
43
|
-
/**
|
|
44
|
-
* Kicks off the custom watchlist check.
|
|
45
|
-
* Transitions from 'idle' to 'processing'.
|
|
46
|
-
*/
|
|
47
|
-
load() {
|
|
48
|
-
actor.send({ type: "LOAD" });
|
|
49
|
-
} };
|
|
50
|
-
}
|
|
51
|
-
/**
|
|
52
|
-
* Creates a custom watchlist manager for headless or UI-driven usage.
|
|
53
|
-
*
|
|
54
|
-
* @example Headless usage
|
|
55
|
-
* ```typescript
|
|
56
|
-
* const manager = createCustomWatchlistManager();
|
|
57
|
-
* manager.subscribe((state) => console.log(state.status));
|
|
58
|
-
* manager.load();
|
|
59
|
-
* ```
|
|
60
|
-
*/
|
|
61
|
-
function createCustomWatchlistManager() {
|
|
62
|
-
return createManager({
|
|
63
|
-
actor: createCustomWatchlistActor(),
|
|
64
|
-
mapState,
|
|
65
|
-
createApi,
|
|
66
|
-
instrumentation: createManagerInstrumentation(eventModuleNames.customWatchList, { getEventScreenName: getCustomWatchlistScreenName })
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
//#endregion
|
|
70
|
-
export { createCustomWatchlistManager, customWatchlistMachine };
|
|
1
|
+
import { t as customWatchlistMachine } from "./customWatchlistStateMachine-qZVgkKgP.esm.js";
|
|
2
|
+
import { n as createCustomWatchlistManagerFromActor, t as createCustomWatchlistManager } from "./customWatchlistManager-DUVrEdw9.esm.js";
|
|
3
|
+
export { createCustomWatchlistManager, createCustomWatchlistManagerFromActor, customWatchlistMachine };
|
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { t as api } from "./api-Bx3gKW_y.esm.js";
|
|
2
|
+
import { n as eventModuleNames, o as createManagerInstrumentation } from "./events-ijlbX_Wx.esm.js";
|
|
3
|
+
import { t as topLevelStateName } from "./topLevelStateName-B5i2avbh.esm.js";
|
|
4
|
+
import { t as endpoints } from "./endpoints-D3B9mUHh.esm.js";
|
|
5
|
+
import { i as assign, s as createActor, t as setup, u as createManager } from "./xstate.esm-BuFLFuzz.esm.js";
|
|
6
|
+
import { n as fromPromise } from "./xstate-actors.esm-BXeQ-Ucz.esm.js";
|
|
7
|
+
import { t as isoDateToMs } from "./dateUtils-CvG0FvK8.esm.js";
|
|
8
|
+
//#region src/modules/custom-fields/customFieldsServices.ts
|
|
9
|
+
async function submitCustomFields(params, signal) {
|
|
10
|
+
const res = await api.post(endpoints.addCustomFields, params.fields, { signal });
|
|
11
|
+
if (!res.ok) throw new Error(`POST ${endpoints.addCustomFields} failed: ${res.status} ${res.statusText}`);
|
|
12
|
+
return res.data;
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
//#region src/modules/custom-fields/customFieldsStateMachine.ts
|
|
16
|
+
const REQUIRED_FIELD_ERROR = "dynamicForms.fieldRequired";
|
|
17
|
+
function transformFields(fields, customFields) {
|
|
18
|
+
const result = {};
|
|
19
|
+
for (const [key, value] of Object.entries(fields)) if (customFields.find((f) => f.name === key)?.type === "DATE" && typeof value === "string" && value !== "") result[key] = isoDateToMs(value);
|
|
20
|
+
else result[key] = value;
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
23
|
+
function isFormComplete(fields, customFields) {
|
|
24
|
+
return customFields.every((field) => {
|
|
25
|
+
if (field.type === "BOOLEAN") return true;
|
|
26
|
+
const value = fields[field.name];
|
|
27
|
+
return value !== void 0 && value !== "";
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
function validateRequiredFields(fields, customFields) {
|
|
31
|
+
const errors = {};
|
|
32
|
+
for (const field of customFields) {
|
|
33
|
+
if (field.type === "BOOLEAN") continue;
|
|
34
|
+
const value = fields[field.name];
|
|
35
|
+
if (value === void 0 || value === "") errors[field.name] = REQUIRED_FIELD_ERROR;
|
|
36
|
+
}
|
|
37
|
+
return Object.keys(errors).length > 0 ? errors : void 0;
|
|
38
|
+
}
|
|
39
|
+
const customFieldsMachine = setup({
|
|
40
|
+
types: {
|
|
41
|
+
context: {},
|
|
42
|
+
events: {},
|
|
43
|
+
input: {}
|
|
44
|
+
},
|
|
45
|
+
actors: { submitFields: fromPromise(async ({ input, signal }) => {
|
|
46
|
+
return submitCustomFields({ fields: transformFields(input.fields, input.customFields) }, signal);
|
|
47
|
+
}) },
|
|
48
|
+
actions: {
|
|
49
|
+
setField: assign(({ context, event }) => {
|
|
50
|
+
const e = event;
|
|
51
|
+
const validationErrors = { ...context.validationErrors };
|
|
52
|
+
delete validationErrors[e.name];
|
|
53
|
+
return {
|
|
54
|
+
fields: {
|
|
55
|
+
...context.fields,
|
|
56
|
+
[e.name]: e.value
|
|
57
|
+
},
|
|
58
|
+
validationErrors: Object.keys(validationErrors).length > 0 ? validationErrors : void 0
|
|
59
|
+
};
|
|
60
|
+
}),
|
|
61
|
+
setValidationErrors: assign(({ context }) => ({ validationErrors: validateRequiredFields(context.fields, context.config.customFields) })),
|
|
62
|
+
markSuccess: assign({ result: "success" }),
|
|
63
|
+
markFailed: assign({ result: "failed" })
|
|
64
|
+
},
|
|
65
|
+
guards: {
|
|
66
|
+
apiSucceeded: ({ event }) => event.output.success,
|
|
67
|
+
isFormComplete: ({ context }) => isFormComplete(context.fields, context.config.customFields)
|
|
68
|
+
}
|
|
69
|
+
}).createMachine({
|
|
70
|
+
id: "customFields",
|
|
71
|
+
initial: "idle",
|
|
72
|
+
context: ({ input }) => ({
|
|
73
|
+
config: input.config,
|
|
74
|
+
fields: {},
|
|
75
|
+
validationErrors: void 0,
|
|
76
|
+
result: null
|
|
77
|
+
}),
|
|
78
|
+
states: {
|
|
79
|
+
idle: { on: { LOAD: { target: "inputting" } } },
|
|
80
|
+
inputting: { on: {
|
|
81
|
+
FIELD_CHANGED: { actions: "setField" },
|
|
82
|
+
SUBMIT: [{
|
|
83
|
+
guard: "isFormComplete",
|
|
84
|
+
target: "submitting"
|
|
85
|
+
}, { actions: "setValidationErrors" }]
|
|
86
|
+
} },
|
|
87
|
+
submitting: { invoke: {
|
|
88
|
+
id: "submitFields",
|
|
89
|
+
src: "submitFields",
|
|
90
|
+
input: ({ context }) => ({
|
|
91
|
+
fields: context.fields,
|
|
92
|
+
customFields: context.config.customFields
|
|
93
|
+
}),
|
|
94
|
+
onDone: [{
|
|
95
|
+
target: "success",
|
|
96
|
+
guard: "apiSucceeded"
|
|
97
|
+
}, {
|
|
98
|
+
target: "finished",
|
|
99
|
+
actions: "markFailed"
|
|
100
|
+
}],
|
|
101
|
+
onError: {
|
|
102
|
+
target: "finished",
|
|
103
|
+
actions: "markFailed"
|
|
104
|
+
}
|
|
105
|
+
} },
|
|
106
|
+
success: { after: { 3e3: {
|
|
107
|
+
target: "finished",
|
|
108
|
+
actions: "markSuccess"
|
|
109
|
+
} } },
|
|
110
|
+
finished: { type: "final" }
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
//#endregion
|
|
114
|
+
//#region src/modules/custom-fields/customFieldsActor.ts
|
|
115
|
+
function createCustomFieldsActor(options) {
|
|
116
|
+
return createActor(customFieldsMachine, { input: { config: options.config } }).start();
|
|
117
|
+
}
|
|
118
|
+
//#endregion
|
|
119
|
+
//#region src/modules/custom-fields/customFieldsManager.ts
|
|
120
|
+
/**
|
|
121
|
+
* Maps a custom-fields state-machine snapshot to the exact Figma "Tracked
|
|
122
|
+
* Events" screen name. Returned strings are the Figma-verbatim absolute
|
|
123
|
+
* analytics path emitted as-is on `event.screen` by
|
|
124
|
+
* `createManagerInstrumentation`'s `getEventScreenName` path. See
|
|
125
|
+
* `docs/patterns/INSTRUMENTATION.md`.
|
|
126
|
+
*
|
|
127
|
+
* Source of truth: Custom Fields Figma file → Tracked Events canvas
|
|
128
|
+
* (`https://www.figma.com/design/Fb4Jp6kal8clAD05Kh6l4e/Custom-fields---Latest-Design?node-id=2026-30075`).
|
|
129
|
+
* The canvas mixes two casings — sections name the input surfaces
|
|
130
|
+
* `Customfield.{empty,filled}` (capital `C`) and the post-input surfaces
|
|
131
|
+
* `customfield.{processing,complete}` (lowercase `c`). Both spellings are
|
|
132
|
+
* preserved verbatim as Figma is the source of truth.
|
|
133
|
+
*
|
|
134
|
+
* State → screen mapping rationale:
|
|
135
|
+
*
|
|
136
|
+
* - `idle`/`inputting` collapse to `Customfield.empty` — the SM stays in
|
|
137
|
+
* `inputting` throughout typing (field-level `FIELD_CHANGED` events are
|
|
138
|
+
* context-only and don't fire a new `screenOpened`). The Figma
|
|
139
|
+
* `Customfield.filled` surface is therefore a UI sub-state of `inputting`,
|
|
140
|
+
* not a discrete SM state, and collapses onto the section's primary
|
|
141
|
+
* `Customfield.empty` screen.
|
|
142
|
+
* - `submitting` → `customfield.processing` — submit in-flight.
|
|
143
|
+
* - `success` → `customfield.complete` — happy-path success surface (auto-
|
|
144
|
+
* advances to `finished` after 3 s).
|
|
145
|
+
* - `finished` is intentionally unmapped: it is dual-outcome (success or
|
|
146
|
+
* failed — failures route here with `result: 'failed'` since the machine
|
|
147
|
+
* has no `error` state) and Figma defines no failure screen. Mapping
|
|
148
|
+
* `finished` onto `customfield.complete` would mis-report failures, so the
|
|
149
|
+
* adapter falls back to the generic `<module>.finished` default.
|
|
150
|
+
*/
|
|
151
|
+
function getCustomFieldsScreenName(snapshot) {
|
|
152
|
+
const stateName = topLevelStateName(snapshot.value);
|
|
153
|
+
if (stateName === void 0) return void 0;
|
|
154
|
+
switch (stateName) {
|
|
155
|
+
case "idle":
|
|
156
|
+
case "inputting": return "Customfield.empty";
|
|
157
|
+
case "submitting": return "customfield.processing";
|
|
158
|
+
case "success": return "customfield.complete";
|
|
159
|
+
default: return;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
function toDisplayLabel(field) {
|
|
163
|
+
if (field.alias) return field.alias;
|
|
164
|
+
return field.name.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
|
|
165
|
+
}
|
|
166
|
+
function mapState(snapshot) {
|
|
167
|
+
const typedSnapshot = snapshot;
|
|
168
|
+
const { context } = typedSnapshot;
|
|
169
|
+
if (typedSnapshot.matches("idle")) return { status: "idle" };
|
|
170
|
+
if (typedSnapshot.matches("inputting")) return {
|
|
171
|
+
status: "inputting",
|
|
172
|
+
title: context.config.title,
|
|
173
|
+
customFields: context.config.customFields.map((f) => ({
|
|
174
|
+
...f,
|
|
175
|
+
label: toDisplayLabel(f)
|
|
176
|
+
})),
|
|
177
|
+
validationErrors: context.validationErrors,
|
|
178
|
+
canSubmit: Object.keys(context.validationErrors ?? {}).length === 0
|
|
179
|
+
};
|
|
180
|
+
if (typedSnapshot.matches("submitting")) return {
|
|
181
|
+
status: "submitting",
|
|
182
|
+
title: context.config.title
|
|
183
|
+
};
|
|
184
|
+
if (typedSnapshot.matches("success")) return { status: "success" };
|
|
185
|
+
return {
|
|
186
|
+
status: "finished",
|
|
187
|
+
result: typedSnapshot.context.result
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
function createApi({ actor }) {
|
|
191
|
+
return {
|
|
192
|
+
/**
|
|
193
|
+
* Initializes the custom fields flow.
|
|
194
|
+
* Transitions from 'idle' to 'inputting'.
|
|
195
|
+
* Must be called before any other method.
|
|
196
|
+
*/
|
|
197
|
+
load() {
|
|
198
|
+
actor.send({ type: "LOAD" });
|
|
199
|
+
},
|
|
200
|
+
/**
|
|
201
|
+
* Updates the value of a single field.
|
|
202
|
+
* Should be called when state is 'inputting'.
|
|
203
|
+
*
|
|
204
|
+
* @param name - The field name (matches CustomField.name)
|
|
205
|
+
* @param value - The field value (string, number, or boolean)
|
|
206
|
+
*/
|
|
207
|
+
setField(name, value) {
|
|
208
|
+
actor.send({
|
|
209
|
+
type: "FIELD_CHANGED",
|
|
210
|
+
name,
|
|
211
|
+
value
|
|
212
|
+
});
|
|
213
|
+
},
|
|
214
|
+
/**
|
|
215
|
+
* Submits all custom field values to the backend.
|
|
216
|
+
* Transitions to 'submitting', then 'finished' regardless of outcome.
|
|
217
|
+
*/
|
|
218
|
+
submit() {
|
|
219
|
+
actor.send({ type: "SUBMIT" });
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Creates a custom fields manager for headless or UI-driven usage.
|
|
225
|
+
*
|
|
226
|
+
* @param options - Configuration options
|
|
227
|
+
* @param options.config - Custom fields configuration (title + field definitions)
|
|
228
|
+
*
|
|
229
|
+
* @returns Custom fields manager with state, API methods, and subscription
|
|
230
|
+
*
|
|
231
|
+
* @example Headless usage
|
|
232
|
+
* ```typescript
|
|
233
|
+
* const manager = createCustomFieldsManager({
|
|
234
|
+
* config: {
|
|
235
|
+
* title: 'Additional Information',
|
|
236
|
+
* customFields: [{ name: 'company', alias: 'Company', type: 'STRING' }],
|
|
237
|
+
* },
|
|
238
|
+
* });
|
|
239
|
+
*
|
|
240
|
+
* manager.subscribe((state) => console.log(state.status));
|
|
241
|
+
* manager.load();
|
|
242
|
+
* manager.setField('company', 'Incode');
|
|
243
|
+
* manager.submit();
|
|
244
|
+
* manager.stop();
|
|
245
|
+
* ```
|
|
246
|
+
*/
|
|
247
|
+
function createCustomFieldsManager(options) {
|
|
248
|
+
return createManager({
|
|
249
|
+
actor: createCustomFieldsActor(options),
|
|
250
|
+
mapState,
|
|
251
|
+
createApi,
|
|
252
|
+
instrumentation: createManagerInstrumentation(eventModuleNames.customFields, { getEventScreenName: getCustomFieldsScreenName })
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
function createCustomFieldsManagerFromActor(actor) {
|
|
256
|
+
return createManager({
|
|
257
|
+
actor,
|
|
258
|
+
mapState,
|
|
259
|
+
createApi,
|
|
260
|
+
instrumentation: createManagerInstrumentation(eventModuleNames.customFields, { getEventScreenName: getCustomFieldsScreenName })
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
//#endregion
|
|
264
|
+
export { createCustomFieldsManagerFromActor as n, customFieldsMachine as r, createCustomFieldsManager as t };
|