UNPKG

@sheerid/jslib-nightly

Version:

SheerID JavaScript Library

306 lines (304 loc) • 10.2 kB
/** * VERSION: 2.113.0-alpha.0 * BUILD_TIMESTAMP: 1750184600854 * BUILD_DATE: Tue Jun 17 2025 18:23:20 GMT+0000 (Coordinated Universal Time) * BUILD_COMMIT: 896154e79f58fffa6d52f3ed37f2db760a63df88 */ import { i as U, h as G, R as $, j as s, t as Q, P as X, a8 as Y, E as F, g as l, u as t, b as r, v as J, w as Z, Q as _, a2 as S, ak as v, ab as ee, al as ae, am as se, U as oe, x as le, y as ne, W as te, B as de, e as re, D as me, X as ie, G as pe, M as ue, H as be, f as ge, V as Ce, a1 as xe } from "../sheerid.js"; import { u as he } from "./useCollectFieldsEndpoint-kmLFyUA-.js"; import { u as Me, E as Ee } from "./useEmailFirstExperiment-CgU-itQI.js"; const Ie = { AT: "gbrNummer", ES: "numeroColegiado", DK: "autorisationsId", CH: "globalLocationNumber", IE: "registrationNumber", GB: "registrationNumber" }, k = (i) => { const a = Ie[i] || "registrationNumber"; return { labelKey: `step.collectMedicalPersonalInfo.${a}Label`, explanationKey: `step.collectMedicalPersonalInfo.${a}Explanation` }; }, je = ({ intl: i, verificationService: a }) => { var g, C, x, h, M, E, I, j, N, y, f, P, c; const o = a.viewModel, { fieldValidationErrors: n } = a, m = a.verificationResponse, R = G(m), D = J(), L = o.localeChoice.value, d = (e, W) => { const A = xe(o, e, W); a.updateViewModel(A); }, { isFieldOptional: w } = he({ verificationId: m.verificationId, currentStep: m.currentStep, viewModel: o }), p = w("memberId"), { isEmailUpTop: u, isEmailValidationLoading: K, showFormFields: T, emailLookupResponse: b, emailOnBlur: B, emailOnKeyDown: V, handleResendClick: O, showEmailLookupResponseMessages: z, enableFormFields: H, handleOnClickProceedHere: q } = Me( a.programId, o.email, a.verificationResponse.segment ); return $.useEffect(() => { p ? a.updateViewModel({ fieldsToSkipValidation: [] }, { partial: !0 }) : a.updateViewModel( { fieldsToSkipValidation: ["memberId"] }, { partial: !0 } ); }, [p]), /* @__PURE__ */ s.jsxs( Q, { verificationService: a, step: m.currentStep, children: [ /* @__PURE__ */ s.jsx( X, { verificationService: a, classNameIdentifier: "medical-personal-info" } ), // #region email-first-experiment u && /* @__PURE__ */ s.jsxs("div", { className: "email-input-wrapper", children: [ K && /* @__PURE__ */ s.jsx("div", { className: "email-input-wrapper-frame", children: /* @__PURE__ */ s.jsx("div", { className: "transform-scale", children: /* @__PURE__ */ s.jsx(Y, {}) }) }), /* @__PURE__ */ s.jsx( F, { value: o.email, isErrored: !!n.email, explanation: /* @__PURE__ */ s.jsx( r, { id: "emailExplanation", defaultMessage: "Personal email address is recommended" } ), onChange: (e) => { d("email", e), t("email", e, a); }, onKeyDown: V, onBlur: B, disabled: (g = l("email")) == null ? void 0 : g.disabled } ) ] }), z && b && /* @__PURE__ */ s.jsx( Ee, { emailLookupResponse: b, onResendClick: O, onHandleClickLink: q } ), T && /* @__PURE__ */ s.jsxs("div", { className: H || !u ? "" : "sid-disable-elements", children: [ /* @__PURE__ */ s.jsx(Z, { verificationService: a }), /* @__PURE__ */ s.jsx( _, { verificationService: a, disabled: (C = l("country")) == null ? void 0 : C.disabled } ), /* @__PURE__ */ s.jsx( S, { segmentId: "medical", value: { value: o.status, label: ee( i, o.status, ae ) }, isErrored: !!n.status, options: v(i, m.availableStatuses), disabled: (x = l("status")) == null ? void 0 : x.disabled, onChange: (e) => { d("status", e ? e.value : ""), t( "status", e ? e.value : "", a ); } } ), /* @__PURE__ */ s.jsx( se, { isErrored: !!n.organization, onChange: (e) => { oe(e, a), t("organization", e, a); }, value: a.viewModel.organization, verificationService: a, disabled: (h = l("organization")) == null ? void 0 : h.disabled } ), /* @__PURE__ */ s.jsxs("div", { className: "sid-names", children: [ /* @__PURE__ */ s.jsx( le, { value: o.firstName, isErrored: !!n.firstName, disabled: (M = l("firstName")) == null ? void 0 : M.disabled, onChange: (e) => { d("firstName", e), t("firstName", e, a); } } ), /* @__PURE__ */ s.jsx( ne, { value: o.lastName, isErrored: !!n.lastName, disabled: (E = l("lastName")) == null ? void 0 : E.disabled, onChange: (e) => { d("lastName", e), t("lastName", e, a); } } ) ] }), /* @__PURE__ */ s.jsx( te, { errorId: n.birthDate, locale: L, disabled: (I = l("birthDate")) == null ? void 0 : I.disabled, onChange: (e) => { d("birthDate", e), t("birthDate", e, a); }, value: o.birthDate } ), /* @__PURE__ */ s.jsx( de, { isErrored: !!n.postalCode, onChange: (e) => { d("postalCode", e), t("postalCode", e, a); }, value: o.postalCode, disabled: (j = l("postalCode")) == null ? void 0 : j.disabled, explanation: /* @__PURE__ */ s.jsx( r, { id: "postalCodeExplanation", defaultMessage: "Use the location on file with your licensing body" } ) } ), !u && /* @__PURE__ */ s.jsx( F, { value: o.email, isErrored: !!n.email, explanation: /* @__PURE__ */ s.jsx( r, { id: "emailExplanation", defaultMessage: "Needed to send you your unique code" } ), onChange: (e) => { d("email", e), t("email", e, a); }, onKeyDown: (e) => re(e), disabled: (N = l("email")) == null ? void 0 : N.disabled } ), a.programTheme.isSmsNotifierConfigured || a.programTheme.smsLoopEnabled ? /* @__PURE__ */ s.jsx( me, { isRequired: !!a.programTheme.smsLoopEnabled, value: o.phoneNumber, isErrored: !!n.phoneNumber, onChange: (e) => { d("phoneNumber", e), t("phoneNumber", e, a); }, selectedCountryCode: o.countryChoice && o.countryChoice.value, disabled: (y = l("phoneNumber")) == null ? void 0 : y.disabled } ) : null, p && /* @__PURE__ */ s.jsx( ie, { value: o.memberId, isErrored: !!n.memberId, isRequired: (f = l("memberId")) == null ? void 0 : f.requireIfOptional, disabled: (P = l("memberId")) == null ? void 0 : P.disabled, onChange: (e) => { d("memberId", e), t("memberId", e, a); }, explanation: /* @__PURE__ */ s.jsx( r, { id: k(o.country).explanationKey, defaultMessage: "Your Professional Membership Registration Number" } ), label: /* @__PURE__ */ s.jsx( r, { id: k(o.country).labelKey, defaultMessage: "Registration Number" } ) } ), D.customFormFields.map((e) => /* @__PURE__ */ s.jsx(pe, { config: e, verificationService: a })), /* @__PURE__ */ s.jsx( ue, { verificationService: a, isErrored: !!n.marketConsentValue, onChange: (e) => { d("metadata", { ...a.viewModel.metadata, marketConsentValue: e }), t( "marketConsentValue", e, a ); }, viewModel: o, disabled: (c = l("marketConsentValue")) == null ? void 0 : c.disabled } ), /* @__PURE__ */ s.jsx(be, { verificationService: a, suffix: "CollectAboveSubmit" }), /* @__PURE__ */ s.jsx( ge, { step: Ce.collectMedicalProfessionalPersonalInfo, verificationService: a, viewModel: o, failedInstantMatch: R, buttonText: /* @__PURE__ */ s.jsx( r, { id: "step.personalInfo.submitButtonText", defaultMessage: "Verify My Medical Professional Status" } ) } ) ] }) ] } ); }, Pe = U( je ); export { Pe as default };