{"version":3,"file":"phoneNumber-97c10cd3.js","sources":["../../../client-app/src/common/validation/common/amount.ts","../../../client-app/src/common/validation/common/string.ts","../../../client-app/src/common/validation/common/email.ts","../../../client-app/src/common/validation/no/phoneNumber.ts"],"sourcesContent":["import { TFunction } from 'i18next';\nimport * as Yup from 'yup';\n\nexport const amount = (min: number, max: number, t: TFunction, formattedMinAmount?: string, formattedMaxAmount?: string) =>\n Yup.number()\n .min(min, t('validation:amount.min', { amount: formattedMinAmount ?? min }))\n .typeError(t('validation:amount.typeError'))\n .max(max, t('validation:amount.max', { amount: formattedMaxAmount ?? max }))\n .required(t('validation:amount.required'));\n\nexport const amountNotEmpty = (fieldLabel: string, t: TFunction) =>\n Yup.number()\n .typeError(t('validation:amount.requiredZeroForEmpty', { fieldLabel }))\n .required(t('validation:amount.requiredZeroForEmpty', { fieldLabel }));\n\nexport const amountNotNull = (t: TFunction) =>\n Yup.number().typeError(t('validation:amount.typeError')).required(t('validation:amount.required'));\n","\nimport { TFunction } from 'i18next';\nimport * as Yup from 'yup';\n\n\nexport const stringRequired =(t: TFunction) => Yup.string().nullable()\n .required(t(\"validation:string.required\"));\n\nexport const stringRequiredAndMaxLength = (t: TFunction) => Yup.string()\n .required(t(\"validation:string.required\"))\n .max(100, t(\"validation:string.maxlength\", { size: 100 }));\n","\nimport { TFunction } from 'i18next';\nimport * as Yup from 'yup';\n\nconst regex = /^[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?$/i;\n\nexport const emailRequired =(t: TFunction) => Yup.string().email(t(\"validation:email.invalidFormat\"))\n\n .nullable().typeError(t(\"validation:email.required\")).required(t(\"validation:email.required\"))\n .matches(regex, t(\"validation:email.invalidFormat\"));\n ","\nimport { TFunction } from 'i18next';\nimport * as Yup from 'yup';\n\n\nexport const norwegianPhoneNumber =(t: TFunction) => Yup.string().nullable().typeError(t(\"validation:phonenumber.required\"))\n.required(t(\"validation:phonenumber.required\")).test('test-norwegianphoneNumber', // this is used internally by yup\nt(\"validation:phonenumber.invalid\"), //validation: message\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n value => {\n if (!value) { return false;\n }\n if (value.length != 8) {\n return false;\n }\n if (!value.startsWith(\"9\") && !value.startsWith(\"4\")) {\n return false;\n }\n return true;\n }) // return true false based on validation:\n"],"names":["amount","min","max","t","formattedMinAmount","formattedMaxAmount","Yup.number","amountNotEmpty","fieldLabel","amountNotNull","stringRequired","Yup.string","regex","emailRequired","norwegianPhoneNumber","value"],"mappings":"qDAGO,MAAMA,EAAS,CAACC,EAAaC,EAAaC,EAAcC,EAA6BC,IACxFC,EAAI,EACC,IAAIL,EAAKE,EAAU,wBAAyB,CAAE,OAAQC,GAAsBH,EAAK,CAAC,EAClF,UAAUE,EAAU,6BAA6B,CAAC,EAClD,IAAID,EAAKC,EAAU,wBAAyB,CAAE,OAAQE,GAAsBH,EAAK,CAAC,EAClF,SAASC,EAAU,4BAA4B,CAAC,EAE5CI,EAAiB,CAACC,EAAoBL,IAC/CG,EAAW,EACN,UAAUH,EAAU,yCAA0C,CAAE,WAAAK,CAAY,CAAA,CAAC,EAC7E,SAASL,EAAU,yCAA0C,CAAE,WAAAK,CAAW,CAAC,CAAC,EAExEC,EAAiBN,GAC1BG,IAAa,UAAUH,EAAU,6BAA6B,CAAC,EAAE,SAASA,EAAU,4BAA4B,CAAC,ECXxGO,EAAiBP,GAAiBQ,EAAa,EAAA,SAAA,EACvD,SAASR,EAAU,4BAA4B,CAAC,ECF/CS,EAAQ,2IAEDC,EAAgBV,GAAiBQ,IAAa,MAAMR,EAAU,gCAAgC,CAAC,EAEvG,SAAS,EAAE,UAAUA,EAAU,2BAA2B,CAAC,EAAE,SAASA,EAAU,2BAA2B,CAAC,EAC5G,QAAQS,EAAOT,EAAU,gCAAgC,CAAC,ECJlDW,EAAuBX,GAAiBQ,EAAI,EAAS,SAAS,EAAE,UAAUR,EAAU,iCAAiC,CAAC,EAClI,SAASA,EAAU,iCAAiC,CAAC,EAAE,KAAK,4BAC7DA,EAAU,gCAAgC,EAEhCY,GACA,GAACA,GAEDA,EAAM,QAAU,GAGhB,CAACA,EAAM,WAAW,GAAG,GAAK,CAACA,EAAM,WAAW,GAAG,EAIvD"}