@medipass/utils 12.0.1 → 12.0.2-fix-type-issues.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/dist/build-validation-schema.js +1 -1
- package/dist/build-validation-schema.js.map +1 -1
- package/dist/documents/workflow-state-formatted.js +1 -1
- package/dist/documents/workflow-state-formatted.js.map +1 -1
- package/dist/funders.js +1 -1
- package/dist/funders.js.map +1 -1
- package/dist/get-env.js +3 -3
- package/dist/get-env.js.map +1 -1
- package/dist/get-select-options.js +1 -1
- package/dist/get-select-options.js.map +1 -1
- package/dist/google-addresses.js +2 -2
- package/dist/google-addresses.js.map +1 -1
- package/dist/masked.js +2 -2
- package/dist/masked.js.map +1 -1
- package/dist/products.js +1 -1
- package/dist/products.js.map +1 -1
- package/dist/redux-actions.js +1 -1
- package/dist/redux-actions.js.map +1 -1
- package/dist/redux-reducer.js +2 -2
- package/dist/redux-reducer.js.map +1 -1
- package/dist/sentry.js +2 -2
- package/dist/sentry.js.map +1 -1
- package/dist/service-items.js +3 -3
- package/dist/service-items.js.map +1 -1
- package/dist/transaction-status-helpers.js +1 -1
- package/dist/transaction-status-helpers.js.map +1 -1
- package/dist/transaction-status.js +1 -1
- package/dist/transaction-status.js.map +1 -1
- package/dist/validate-form.js +2 -2
- package/dist/validate-form.js.map +1 -1
- package/dist/workflow-state-formatted.js +1 -1
- package/dist/workflow-state-formatted.js.map +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build-validation-schema.js","names":[],"sources":["../src/build-validation-schema.ts"],"sourcesContent":["import * as yup from 'yup';\n// @ts-expect-error TS(7016): Could not find a declaration file for module 'paym... Remove this comment to see the full error message\nimport payment from 'payment';\nimport _get from 'lodash/get';\n\nimport { isMobileNumber } from './validate';\n\nexport const FIELD_VALIDATORS = {\n firstName: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter your first name'\n }\n ]\n },\n lastName: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter your last name'\n }\n ]\n },\n dob: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter your date of birth'\n },\n {\n type: 'test',\n message: 'Please enter a valid day between 01 and 31',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => {\n if (!value) {\n return;\n }\n\n const day = _get(value.split('/'), '[0]', '').split(' ').join('');\n\n return day ? /^0[1-9]|[12][0-9]|3[01]$/.test(day) : true;\n }\n },\n {\n type: 'test',\n message: 'Please enter a valid month between 01 and 12',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => {\n if (!value) {\n return;\n }\n\n const month = _get(value.split('/'), '[1]', '');\n\n return month ? /^(0[1-9]|1[012])$/.test(month) : true;\n }\n },\n {\n type: 'test',\n message: 'Please enter a valid year',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => {\n if (!value) {\n return;\n }\n\n const year = _get(value.split('/'), '[2]', '');\n\n return year ? /^[0-9]{4}$/.test(year) : true;\n }\n },\n {\n type: 'test',\n message: 'Please enter a year greater than 1900',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => {\n if (!value) {\n return;\n }\n\n const year = _get(value.split('/'), '[2]', '');\n\n return year ? parseInt(year, 10) >= 1900 : true;\n }\n },\n {\n type: 'test',\n message: `Please enter a year before ${new Date().getFullYear() + 1}`,\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => {\n if (!value) {\n return;\n }\n\n const year = _get(value.split('/'), '[2]', '');\n\n return year ? parseInt(year, 10) <= new Date().getFullYear() : true;\n }\n }\n ]\n },\n email: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter your email address'\n },\n {\n type: 'email',\n message: 'Please enter a valid email address'\n }\n ]\n },\n mobile: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter your mobile number'\n },\n {\n type: 'test',\n message: 'Please enter a valid Australian mobile number',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => (value ? isMobileNumber(value, 'AU') : true)\n }\n ]\n },\n password: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter your password'\n }\n ]\n },\n newPassword: {\n type: 'string',\n validators: [\n {\n key: 'required',\n type: 'required',\n message: 'Please enter your new password'\n },\n {\n key: 'min-characters',\n type: 'min',\n length: 8,\n message: 'Your password must have at least 8 characters'\n },\n {\n key: 'uppercase',\n type: 'matches',\n pattern: /[A-Z]/,\n message: 'Your password must have an uppercase character'\n },\n {\n key: 'number',\n type: 'matches',\n pattern: /[0-9]/,\n message: 'Your password must have a number'\n },\n {\n key: 'special-character',\n type: 'matches',\n pattern: /[!@?#$%^&*)(+=._-]/,\n message: 'Your password must have a special character (e.g. ! or @ or #)'\n }\n ]\n },\n repeatPassword: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Enter your new password again'\n },\n {\n type: 'oneOf',\n fieldName: 'password',\n message: 'This password does not match the other password'\n }\n ]\n },\n cardNumber: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter a card number'\n },\n {\n type: 'test',\n message: 'Please enter a valid card number',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => payment.fns.validateCardNumber(value)\n }\n ]\n },\n expiry: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter an expiry'\n },\n {\n type: 'test',\n message: 'Please enter a valid expiry',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => payment.fns.validateCardExpiry(value)\n }\n ]\n },\n cvc: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter a CVC'\n },\n {\n type: 'test',\n message: 'Please enter a valid CVC',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => payment.fns.validateCardCVC(value)\n }\n ]\n }\n};\n\n// @ts-expect-error TS(7006): Parameter 'field' implicitly has an 'any' type.\nconst getFieldSchema = field => {\n const key = field.key || field.name;\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n const defaultFieldExists = Boolean(FIELD_VALIDATORS[key]);\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n const fieldAttributes = defaultFieldExists ? FIELD_VALIDATORS[key] : field;\n let schema = yup;\n\n switch (fieldAttributes.type) {\n case 'string': {\n // @ts-expect-error TS(2740): Type 'StringSchema<string, Record<string, any>, st... Remove this comment to see the full error message\n schema = schema.string();\n break;\n }\n\n case 'object': {\n // @ts-expect-error TS(2740): Type 'OptionalObjectSchema<ObjectShape, Record<str... Remove this comment to see the full error message\n schema = schema.object();\n break;\n }\n\n case 'array': {\n // @ts-expect-error TS(2740): Type 'OptionalArraySchema<AnySchema<any, any, any>... Remove this comment to see the full error message\n schema = schema.array();\n break;\n }\n\n case 'boolean': {\n // @ts-expect-error TS(2740): Type 'BooleanSchema<boolean, Record<string, any>, ... Remove this comment to see the full error message\n schema = schema.boolean();\n break;\n }\n\n case 'date': {\n // @ts-expect-error TS(2740): Type 'DateSchema<Date, Record<string, any>, Date>'... Remove this comment to see the full error message\n schema = schema.date();\n break;\n }\n\n case 'number': {\n // @ts-expect-error TS(2740): Type 'NumberSchema<number, Record<string, any>, nu... Remove this comment to see the full error message\n schema = schema.number();\n break;\n }\n\n default: {\n // @ts-expect-error TS(2322): Type 'StringSchema<string, Record<string, any>, st... Remove this comment to see the full error message\n schema = schema.string();\n }\n }\n\n if (fieldAttributes.validators) {\n // @ts-expect-error TS(7006): Parameter 'validator' implicitly has an 'any' type... Remove this comment to see the full error message\n fieldAttributes.validators.forEach(validator => {\n switch (validator.type) {\n case 'required': {\n if (defaultFieldExists && !field.required) {\n return;\n }\n\n // @ts-expect-error TS(2339): Property 'required' does not exist on type 'typeof... Remove this comment to see the full error message\n schema = schema.required(validator.message);\n break;\n }\n\n case 'test': {\n // @ts-expect-error TS(2339): Property 'test' does not exist on type 'typeof imp... Remove this comment to see the full error message\n schema = schema.test(field.name, validator.message, validator.fn);\n break;\n }\n\n case 'email': {\n // @ts-expect-error TS(2339): Property 'email' does not exist on type 'typeof im... Remove this comment to see the full error message\n schema = schema.email(validator.message);\n break;\n }\n\n case 'min': {\n // @ts-expect-error TS(2339): Property 'min' does not exist on type 'typeof impo... Remove this comment to see the full error message\n schema = schema.min(validator.length, validator.message);\n break;\n }\n\n case 'matches': {\n // @ts-expect-error TS(2339): Property 'matches' does not exist on type 'typeof ... Remove this comment to see the full error message\n schema = schema.matches(validator.pattern, validator.message);\n break;\n }\n\n case 'oneOf': {\n // @ts-expect-error TS(2339): Property 'oneOf' does not exist on type 'typeof im... Remove this comment to see the full error message\n schema = schema.oneOf([yup.ref(validator.fieldName), null], validator.message);\n break;\n }\n\n default: {\n break;\n }\n }\n });\n }\n\n return schema;\n};\n\nconst buildValidationSchema = (\n fields: Array<{\n name: string;\n key?: string;\n required?: boolean;\n validators?: Array<Record<string, any>>;\n }>,\n overrideSchema: Record<string, any> = {}\n) => {\n const schema = {};\n fields.forEach(field => {\n if (!field) {\n return;\n }\n\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n schema[field.name] = getFieldSchema(field);\n });\n return yup.object().shape({ ...schema, ...overrideSchema });\n};\n\nexport default buildValidationSchema;\n/* ===== CUSTOM OVERRIDE SCHEMAS ===== */\n\n// @ts-expect-error TS(7006): Parameter 'schema' implicitly has an 'any' type.\nconst validateHealthFundDate = (schema, { cardFields, fieldKey, dayKey, monthKey, yearKey }) => {\n let newSchema = schema;\n\n if (cardFields[dayKey]) {\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n newSchema = newSchema.test(fieldKey, _get(cardFields, `${dayKey}.validation.message`), value => {\n const dateArray = value ? value.split('/') : [];\n const day = dateArray[0];\n return new RegExp(_get(cardFields, `${dayKey}.validation.regex`)).test(day);\n });\n }\n\n if (cardFields[monthKey]) {\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n newSchema = newSchema.test(fieldKey, _get(cardFields, `${monthKey}.validation.message`), value => {\n const dateArray = value ? value.split('/') : [];\n const month = dateArray[dateArray.length - 2];\n return new RegExp(_get(cardFields, `${monthKey}.validation.regex`)).test(month);\n });\n }\n\n if (cardFields[yearKey]) {\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n newSchema = newSchema.test(fieldKey, _get(cardFields, `${yearKey}.validation.message`), value => {\n const dateArray = value ? value.split('/') : [];\n const year = dateArray[dateArray.length - 1];\n return new RegExp(_get(cardFields, `${yearKey}.validation.regex`)).test(year);\n });\n }\n\n return newSchema;\n};\n\nexport const paymentMethodValidationSchema = [\n {\n name: 'cardNumber'\n },\n {\n name: 'expiry'\n },\n {\n name: 'cvc'\n }\n];\nexport const getHealthFundAccountValidationSchema = (cardFields: Record<string, any>) => ({\n ...(cardFields.cardNumber\n ? {\n cardNumber: yup\n .string()\n .matches(\n new RegExp(_get(cardFields, 'cardNumber.validation.regex')),\n _get(cardFields, 'cardNumber.validation.message')\n )\n .required(`Please enter a ${_get(cardFields, 'cardNumber.displayName', 'card number').toLowerCase()}`)\n }\n : {}),\n ...(cardFields.membershipNumber\n ? {\n membershipNumber: yup\n .string()\n .min(\n _get(cardFields, 'membershipNumber.minLength'),\n `${_get(cardFields, 'membershipNumber.displayName', 'membership number')} must be at least ${_get(\n cardFields,\n 'membershipNumber.minLength'\n )} numbers`\n )\n .max(\n _get(cardFields, 'membershipNumber.maxLength', 99),\n `${_get(cardFields, 'membershipNumber.displayName', 'membership number')} must be less than ${_get(\n cardFields,\n 'membershipNumber.maxLength'\n )} numbers`\n )\n .matches(\n new RegExp(_get(cardFields, 'membershipNumber.validation.regex')),\n _get(cardFields, 'membershipNumber.validation.message')\n )\n .required(\n `Please enter a ${_get(cardFields, 'membershipNumber.displayName', 'membership number').toLowerCase()}`\n )\n }\n : {}),\n ...(cardFields.cardRank\n ? {\n cardRank: yup\n .string()\n .min(\n _get(cardFields, 'cardRank.minLength'),\n `${_get(cardFields, 'cardRank.displayName', 'card rank')} must be at least ${_get(\n cardFields,\n 'cardRank.minLength'\n )} numbers`\n )\n .max(\n _get(cardFields, 'cardRank.maxLength', 99),\n `${_get(cardFields, 'cardRank.displayName', 'card rank')} must be less than ${_get(\n cardFields,\n 'cardRank.maxLength'\n )} numbers`\n )\n .matches(\n new RegExp(_get(cardFields, 'cardRank.validation.regex')),\n _get(cardFields, 'cardRank.validation.message')\n )\n .required(`Please enter a ${_get(cardFields, 'cardRank.displayName', 'card rank').toLowerCase()}`)\n }\n : {}),\n ...(cardFields.issueDay || cardFields.issueMonth || cardFields.issueYear\n ? (() => {\n let issueDateSchema = yup.string().required('Please enter an issue date');\n issueDateSchema = validateHealthFundDate(issueDateSchema, {\n cardFields,\n fieldKey: 'issueDate',\n dayKey: 'issueDay',\n monthKey: 'issueMonth',\n yearKey: 'issueYear'\n });\n return {\n issueDate: issueDateSchema\n };\n })()\n : {}),\n ...(cardFields.expiryDay || cardFields.expiryMonth || cardFields.expiryYear\n ? (() => {\n let expiryDateSchema = yup.string().required('Please enter an expiry date');\n expiryDateSchema = validateHealthFundDate(expiryDateSchema, {\n cardFields,\n fieldKey: 'expiryDate',\n dayKey: 'expiryDay',\n monthKey: 'expiryMonth',\n yearKey: 'expiryYear'\n });\n return {\n expiryDate: expiryDateSchema\n };\n })()\n : {}),\n ...(cardFields.cardIssueNumber\n ? {\n cardIssueNumber: yup\n .string()\n .min(\n _get(cardFields, 'cardIssueNumber.minLength'),\n `${_get(cardFields, 'cardIssueNumber.displayName', 'issue number')} must be at least ${_get(\n cardFields,\n 'cardIssueNumber.minLength'\n )} numbers`\n )\n .max(\n _get(cardFields, 'cardIssueNumber.maxLength', 99),\n `${_get(cardFields, 'cardIssueNumber.displayName', 'issue number')} must be less than ${_get(\n cardFields,\n 'cardIssueNumber.maxLength'\n )} numbers`\n )\n .matches(\n new RegExp(_get(cardFields, 'cardIssueNumber.validation.regex')),\n _get(cardFields, 'cardIssueNumber.validation.message')\n )\n .required(`Please enter a ${_get(cardFields, 'cardIssueNumber.displayName', 'issue number').toLowerCase()}`)\n }\n : {})\n});\n"],"mappings":";;;;;;AAOA,MAAa,mBAAmB;CAC9B,WAAW;EACT,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,CACF;EACF;CACD,UAAU;EACR,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,CACF;EACF;CACD,KAAK;EACH,MAAM;EACN,YAAY;GACV;IACE,MAAM;IACN,SAAS;IACV;GACD;IACE,MAAM;IACN,SAAS;IAET,KAAI,UAAS;AACX,SAAI,CAAC,MACH;KAGF,MAAM,MAAM,KAAK,MAAM,MAAM,IAAI,EAAE,OAAO,GAAG,CAAC,MAAM,IAAI,CAAC,KAAK,GAAG;AAEjE,YAAO,MAAM,2BAA2B,KAAK,IAAI,GAAG;;IAEvD;GACD;IACE,MAAM;IACN,SAAS;IAET,KAAI,UAAS;AACX,SAAI,CAAC,MACH;KAGF,MAAM,QAAQ,KAAK,MAAM,MAAM,IAAI,EAAE,OAAO,GAAG;AAE/C,YAAO,QAAQ,oBAAoB,KAAK,MAAM,GAAG;;IAEpD;GACD;IACE,MAAM;IACN,SAAS;IAET,KAAI,UAAS;AACX,SAAI,CAAC,MACH;KAGF,MAAM,OAAO,KAAK,MAAM,MAAM,IAAI,EAAE,OAAO,GAAG;AAE9C,YAAO,OAAO,aAAa,KAAK,KAAK,GAAG;;IAE3C;GACD;IACE,MAAM;IACN,SAAS;IAET,KAAI,UAAS;AACX,SAAI,CAAC,MACH;KAGF,MAAM,OAAO,KAAK,MAAM,MAAM,IAAI,EAAE,OAAO,GAAG;AAE9C,YAAO,OAAO,SAAS,MAAM,GAAG,IAAI,OAAO;;IAE9C;GACD;IACE,MAAM;IACN,SAAS,+CAA8B,IAAI,MAAM,EAAC,aAAa,GAAG;IAElE,KAAI,UAAS;AACX,SAAI,CAAC,MACH;KAGF,MAAM,OAAO,KAAK,MAAM,MAAM,IAAI,EAAE,OAAO,GAAG;AAE9C,YAAO,OAAO,SAAS,MAAM,GAAG,qBAAI,IAAI,MAAM,EAAC,aAAa,GAAG;;IAElE;GACF;EACF;CACD,OAAO;EACL,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,EACD;GACE,MAAM;GACN,SAAS;GACV,CACF;EACF;CACD,QAAQ;EACN,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,EACD;GACE,MAAM;GACN,SAAS;GAET,KAAI,UAAU,QAAQ,eAAe,OAAO,KAAK,GAAG;GACrD,CACF;EACF;CACD,UAAU;EACR,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,CACF;EACF;CACD,aAAa;EACX,MAAM;EACN,YAAY;GACV;IACE,KAAK;IACL,MAAM;IACN,SAAS;IACV;GACD;IACE,KAAK;IACL,MAAM;IACN,QAAQ;IACR,SAAS;IACV;GACD;IACE,KAAK;IACL,MAAM;IACN,SAAS;IACT,SAAS;IACV;GACD;IACE,KAAK;IACL,MAAM;IACN,SAAS;IACT,SAAS;IACV;GACD;IACE,KAAK;IACL,MAAM;IACN,SAAS;IACT,SAAS;IACV;GACF;EACF;CACD,gBAAgB;EACd,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,EACD;GACE,MAAM;GACN,WAAW;GACX,SAAS;GACV,CACF;EACF;CACD,YAAY;EACV,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,EACD;GACE,MAAM;GACN,SAAS;GAET,KAAI,UAAS,QAAQ,IAAI,mBAAmB,MAAM;GACnD,CACF;EACF;CACD,QAAQ;EACN,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,EACD;GACE,MAAM;GACN,SAAS;GAET,KAAI,UAAS,QAAQ,IAAI,mBAAmB,MAAM;GACnD,CACF;E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oBAAkB,uBAAuB,iBAAiB;GACxD;GACA,UAAU;GACV,QAAQ;GACR,UAAU;GACV,SAAS;GACV,CAAC;AACF,SAAO,EACL,WAAW,iBACZ;KACC,GACJ,EAAE;CACN,GAAI,WAAW,aAAa,WAAW,eAAe,WAAW,oBACtD;EACL,IAAI,mBAAmB,IAAI,QAAQ,CAAC,SAAS,8BAA8B;AAC3E,qBAAmB,uBAAuB,kBAAkB;GAC1D;GACA,UAAU;GACV,QAAQ;GACR,UAAU;GACV,SAAS;GACV,CAAC;AACF,SAAO,EACL,YAAY,kBACb;KACC,GACJ,EAAE;CACN,GAAI,WAAW,kBACX,EACE,iBAAiB,IACd,QAAQ,CACR,IACC,KAAK,YAAY,4BAA4B,EAC7C,GAAG,KAAK,YAAY,+BAA+B,eAAe,CAAC,oBAAoB,KACrF,YACA,4BACD,CAAC,UACH,CACA,IACC,KAAK,YAAY,6BAA6B,GAAG,EACjD,GAAG,KAAK,YAAY,+BAA+B,eAAe,CAAC,qBAAqB,KACtF,YACA,4BACD,CAAC,UACH,CACA,QACC,IAAI,OAAO,KAAK,YAAY,mCAAmC,CAAC,EAChE,KAAK,YAAY,qCAAqC,CACvD,CACA,SAAS,kBAAkB,KAAK,YAAY,+BAA+B,eAAe,CAAC,aAAa,GAAG,EAC/G,GACD,EAAE;CACP"}
|
|
1
|
+
{"version":3,"file":"build-validation-schema.js","names":[],"sources":["../src/build-validation-schema.ts"],"sourcesContent":["import * as yup from 'yup';\n// @ts-expect-error TS(7016): Could not find a declaration file for module 'paym... Remove this comment to see the full error message\nimport payment from 'payment';\nimport _get from 'lodash/get.js';\n\nimport { isMobileNumber } from './validate';\n\nexport const FIELD_VALIDATORS = {\n firstName: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter your first name'\n }\n ]\n },\n lastName: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter your last name'\n }\n ]\n },\n dob: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter your date of birth'\n },\n {\n type: 'test',\n message: 'Please enter a valid day between 01 and 31',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => {\n if (!value) {\n return;\n }\n\n const day = _get(value.split('/'), '[0]', '').split(' ').join('');\n\n return day ? /^0[1-9]|[12][0-9]|3[01]$/.test(day) : true;\n }\n },\n {\n type: 'test',\n message: 'Please enter a valid month between 01 and 12',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => {\n if (!value) {\n return;\n }\n\n const month = _get(value.split('/'), '[1]', '');\n\n return month ? /^(0[1-9]|1[012])$/.test(month) : true;\n }\n },\n {\n type: 'test',\n message: 'Please enter a valid year',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => {\n if (!value) {\n return;\n }\n\n const year = _get(value.split('/'), '[2]', '');\n\n return year ? /^[0-9]{4}$/.test(year) : true;\n }\n },\n {\n type: 'test',\n message: 'Please enter a year greater than 1900',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => {\n if (!value) {\n return;\n }\n\n const year = _get(value.split('/'), '[2]', '');\n\n return year ? parseInt(year, 10) >= 1900 : true;\n }\n },\n {\n type: 'test',\n message: `Please enter a year before ${new Date().getFullYear() + 1}`,\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => {\n if (!value) {\n return;\n }\n\n const year = _get(value.split('/'), '[2]', '');\n\n return year ? parseInt(year, 10) <= new Date().getFullYear() : true;\n }\n }\n ]\n },\n email: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter your email address'\n },\n {\n type: 'email',\n message: 'Please enter a valid email address'\n }\n ]\n },\n mobile: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter your mobile number'\n },\n {\n type: 'test',\n message: 'Please enter a valid Australian mobile number',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => (value ? isMobileNumber(value, 'AU') : true)\n }\n ]\n },\n password: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter your password'\n }\n ]\n },\n newPassword: {\n type: 'string',\n validators: [\n {\n key: 'required',\n type: 'required',\n message: 'Please enter your new password'\n },\n {\n key: 'min-characters',\n type: 'min',\n length: 8,\n message: 'Your password must have at least 8 characters'\n },\n {\n key: 'uppercase',\n type: 'matches',\n pattern: /[A-Z]/,\n message: 'Your password must have an uppercase character'\n },\n {\n key: 'number',\n type: 'matches',\n pattern: /[0-9]/,\n message: 'Your password must have a number'\n },\n {\n key: 'special-character',\n type: 'matches',\n pattern: /[!@?#$%^&*)(+=._-]/,\n message: 'Your password must have a special character (e.g. ! or @ or #)'\n }\n ]\n },\n repeatPassword: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Enter your new password again'\n },\n {\n type: 'oneOf',\n fieldName: 'password',\n message: 'This password does not match the other password'\n }\n ]\n },\n cardNumber: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter a card number'\n },\n {\n type: 'test',\n message: 'Please enter a valid card number',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => payment.fns.validateCardNumber(value)\n }\n ]\n },\n expiry: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter an expiry'\n },\n {\n type: 'test',\n message: 'Please enter a valid expiry',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => payment.fns.validateCardExpiry(value)\n }\n ]\n },\n cvc: {\n type: 'string',\n validators: [\n {\n type: 'required',\n message: 'Please enter a CVC'\n },\n {\n type: 'test',\n message: 'Please enter a valid CVC',\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n fn: value => payment.fns.validateCardCVC(value)\n }\n ]\n }\n};\n\n// @ts-expect-error TS(7006): Parameter 'field' implicitly has an 'any' type.\nconst getFieldSchema = field => {\n const key = field.key || field.name;\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n const defaultFieldExists = Boolean(FIELD_VALIDATORS[key]);\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n const fieldAttributes = defaultFieldExists ? FIELD_VALIDATORS[key] : field;\n let schema = yup;\n\n switch (fieldAttributes.type) {\n case 'string': {\n // @ts-expect-error TS(2740): Type 'StringSchema<string, Record<string, any>, st... Remove this comment to see the full error message\n schema = schema.string();\n break;\n }\n\n case 'object': {\n // @ts-expect-error TS(2740): Type 'OptionalObjectSchema<ObjectShape, Record<str... Remove this comment to see the full error message\n schema = schema.object();\n break;\n }\n\n case 'array': {\n // @ts-expect-error TS(2740): Type 'OptionalArraySchema<AnySchema<any, any, any>... Remove this comment to see the full error message\n schema = schema.array();\n break;\n }\n\n case 'boolean': {\n // @ts-expect-error TS(2740): Type 'BooleanSchema<boolean, Record<string, any>, ... Remove this comment to see the full error message\n schema = schema.boolean();\n break;\n }\n\n case 'date': {\n // @ts-expect-error TS(2740): Type 'DateSchema<Date, Record<string, any>, Date>'... Remove this comment to see the full error message\n schema = schema.date();\n break;\n }\n\n case 'number': {\n // @ts-expect-error TS(2740): Type 'NumberSchema<number, Record<string, any>, nu... Remove this comment to see the full error message\n schema = schema.number();\n break;\n }\n\n default: {\n // @ts-expect-error TS(2322): Type 'StringSchema<string, Record<string, any>, st... Remove this comment to see the full error message\n schema = schema.string();\n }\n }\n\n if (fieldAttributes.validators) {\n // @ts-expect-error TS(7006): Parameter 'validator' implicitly has an 'any' type... Remove this comment to see the full error message\n fieldAttributes.validators.forEach(validator => {\n switch (validator.type) {\n case 'required': {\n if (defaultFieldExists && !field.required) {\n return;\n }\n\n // @ts-expect-error TS(2339): Property 'required' does not exist on type 'typeof... Remove this comment to see the full error message\n schema = schema.required(validator.message);\n break;\n }\n\n case 'test': {\n // @ts-expect-error TS(2339): Property 'test' does not exist on type 'typeof imp... Remove this comment to see the full error message\n schema = schema.test(field.name, validator.message, validator.fn);\n break;\n }\n\n case 'email': {\n // @ts-expect-error TS(2339): Property 'email' does not exist on type 'typeof im... Remove this comment to see the full error message\n schema = schema.email(validator.message);\n break;\n }\n\n case 'min': {\n // @ts-expect-error TS(2339): Property 'min' does not exist on type 'typeof impo... Remove this comment to see the full error message\n schema = schema.min(validator.length, validator.message);\n break;\n }\n\n case 'matches': {\n // @ts-expect-error TS(2339): Property 'matches' does not exist on type 'typeof ... Remove this comment to see the full error message\n schema = schema.matches(validator.pattern, validator.message);\n break;\n }\n\n case 'oneOf': {\n // @ts-expect-error TS(2339): Property 'oneOf' does not exist on type 'typeof im... Remove this comment to see the full error message\n schema = schema.oneOf([yup.ref(validator.fieldName), null], validator.message);\n break;\n }\n\n default: {\n break;\n }\n }\n });\n }\n\n return schema;\n};\n\nconst buildValidationSchema = (\n fields: Array<{\n name: string;\n key?: string;\n required?: boolean;\n validators?: Array<Record<string, any>>;\n }>,\n overrideSchema: Record<string, any> = {}\n) => {\n const schema = {};\n fields.forEach(field => {\n if (!field) {\n return;\n }\n\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n schema[field.name] = getFieldSchema(field);\n });\n return yup.object().shape({ ...schema, ...overrideSchema });\n};\n\nexport default buildValidationSchema;\n/* ===== CUSTOM OVERRIDE SCHEMAS ===== */\n\n// @ts-expect-error TS(7006): Parameter 'schema' implicitly has an 'any' type.\nconst validateHealthFundDate = (schema, { cardFields, fieldKey, dayKey, monthKey, yearKey }) => {\n let newSchema = schema;\n\n if (cardFields[dayKey]) {\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n newSchema = newSchema.test(fieldKey, _get(cardFields, `${dayKey}.validation.message`), value => {\n const dateArray = value ? value.split('/') : [];\n const day = dateArray[0];\n return new RegExp(_get(cardFields, `${dayKey}.validation.regex`)).test(day);\n });\n }\n\n if (cardFields[monthKey]) {\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n newSchema = newSchema.test(fieldKey, _get(cardFields, `${monthKey}.validation.message`), value => {\n const dateArray = value ? value.split('/') : [];\n const month = dateArray[dateArray.length - 2];\n return new RegExp(_get(cardFields, `${monthKey}.validation.regex`)).test(month);\n });\n }\n\n if (cardFields[yearKey]) {\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n newSchema = newSchema.test(fieldKey, _get(cardFields, `${yearKey}.validation.message`), value => {\n const dateArray = value ? value.split('/') : [];\n const year = dateArray[dateArray.length - 1];\n return new RegExp(_get(cardFields, `${yearKey}.validation.regex`)).test(year);\n });\n }\n\n return newSchema;\n};\n\nexport const paymentMethodValidationSchema = [\n {\n name: 'cardNumber'\n },\n {\n name: 'expiry'\n },\n {\n name: 'cvc'\n }\n];\nexport const getHealthFundAccountValidationSchema = (cardFields: Record<string, any>) => ({\n ...(cardFields.cardNumber\n ? {\n cardNumber: yup\n .string()\n .matches(\n new RegExp(_get(cardFields, 'cardNumber.validation.regex')),\n _get(cardFields, 'cardNumber.validation.message')\n )\n .required(`Please enter a ${_get(cardFields, 'cardNumber.displayName', 'card number').toLowerCase()}`)\n }\n : {}),\n ...(cardFields.membershipNumber\n ? {\n membershipNumber: yup\n .string()\n .min(\n _get(cardFields, 'membershipNumber.minLength'),\n `${_get(cardFields, 'membershipNumber.displayName', 'membership number')} must be at least ${_get(\n cardFields,\n 'membershipNumber.minLength'\n )} numbers`\n )\n .max(\n _get(cardFields, 'membershipNumber.maxLength', 99),\n `${_get(cardFields, 'membershipNumber.displayName', 'membership number')} must be less than ${_get(\n cardFields,\n 'membershipNumber.maxLength'\n )} numbers`\n )\n .matches(\n new RegExp(_get(cardFields, 'membershipNumber.validation.regex')),\n _get(cardFields, 'membershipNumber.validation.message')\n )\n .required(\n `Please enter a ${_get(cardFields, 'membershipNumber.displayName', 'membership number').toLowerCase()}`\n )\n }\n : {}),\n ...(cardFields.cardRank\n ? {\n cardRank: yup\n .string()\n .min(\n _get(cardFields, 'cardRank.minLength'),\n `${_get(cardFields, 'cardRank.displayName', 'card rank')} must be at least ${_get(\n cardFields,\n 'cardRank.minLength'\n )} numbers`\n )\n .max(\n _get(cardFields, 'cardRank.maxLength', 99),\n `${_get(cardFields, 'cardRank.displayName', 'card rank')} must be less than ${_get(\n cardFields,\n 'cardRank.maxLength'\n )} numbers`\n )\n .matches(\n new RegExp(_get(cardFields, 'cardRank.validation.regex')),\n _get(cardFields, 'cardRank.validation.message')\n )\n .required(`Please enter a ${_get(cardFields, 'cardRank.displayName', 'card rank').toLowerCase()}`)\n }\n : {}),\n ...(cardFields.issueDay || cardFields.issueMonth || cardFields.issueYear\n ? (() => {\n let issueDateSchema = yup.string().required('Please enter an issue date');\n issueDateSchema = validateHealthFundDate(issueDateSchema, {\n cardFields,\n fieldKey: 'issueDate',\n dayKey: 'issueDay',\n monthKey: 'issueMonth',\n yearKey: 'issueYear'\n });\n return {\n issueDate: issueDateSchema\n };\n })()\n : {}),\n ...(cardFields.expiryDay || cardFields.expiryMonth || cardFields.expiryYear\n ? (() => {\n let expiryDateSchema = yup.string().required('Please enter an expiry date');\n expiryDateSchema = validateHealthFundDate(expiryDateSchema, {\n cardFields,\n fieldKey: 'expiryDate',\n dayKey: 'expiryDay',\n monthKey: 'expiryMonth',\n yearKey: 'expiryYear'\n });\n return {\n expiryDate: expiryDateSchema\n };\n })()\n : {}),\n ...(cardFields.cardIssueNumber\n ? {\n cardIssueNumber: yup\n .string()\n .min(\n _get(cardFields, 'cardIssueNumber.minLength'),\n `${_get(cardFields, 'cardIssueNumber.displayName', 'issue number')} must be at least ${_get(\n cardFields,\n 'cardIssueNumber.minLength'\n )} numbers`\n )\n .max(\n _get(cardFields, 'cardIssueNumber.maxLength', 99),\n `${_get(cardFields, 'cardIssueNumber.displayName', 'issue number')} must be less than ${_get(\n cardFields,\n 'cardIssueNumber.maxLength'\n )} numbers`\n )\n .matches(\n new RegExp(_get(cardFields, 'cardIssueNumber.validation.regex')),\n _get(cardFields, 'cardIssueNumber.validation.message')\n )\n .required(`Please enter a ${_get(cardFields, 'c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,OAAO,SAAS,MAAM,GAAG,qBAAI,IAAI,MAAM,EAAC,aAAa,GAAG;;IAElE;GACF;EACF;CACD,OAAO;EACL,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,EACD;GACE,MAAM;GACN,SAAS;GACV,CACF;EACF;CACD,QAAQ;EACN,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,EACD;GACE,MAAM;GACN,SAAS;GAET,KAAI,UAAU,QAAQ,eAAe,OAAO,KAAK,GAAG;GACrD,CACF;EACF;CACD,UAAU;EACR,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,CACF;EACF;CACD,aAAa;EACX,MAAM;EACN,YAAY;GACV;IACE,KAAK;IACL,MAAM;IACN,SAAS;IACV;GACD;IACE,KAAK;IACL,MAAM;IACN,QAAQ;IACR,SAAS;IACV;GACD;IACE,KAAK;IACL,MAAM;IACN,SAAS;IACT,SAAS;IACV;GACD;IACE,KAAK;IACL,MAAM;IACN,SAAS;IACT,SAAS;IACV;GACD;IACE,KAAK;IACL,MAAM;IACN,SAAS;IACT,SAAS;IACV;GACF;EACF;CACD,gBAAgB;EACd,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,EACD;GACE,MAAM;GACN,WAAW;GACX,SAAS;GACV,CACF;EACF;CACD,YAAY;EACV,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,EACD;GACE,MAAM;GACN,SAAS;GAET,KAAI,UAAS,QAAQ,IAAI,mBAAmB,MAAM;GACnD,CACF;EACF;CACD,QAAQ;EACN,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,EACD;GACE,MAAM;GACN,SAAS;GAET,KAAI,UAAS,QAAQ,IAAI,mBAAmB,MAAM;GACnD,CACF;EACF;CACD,KAAK;EACH,MAAM;EACN,YAAY,CACV;GACE,MAAM;GACN,SAAS;GACV,EACD;GACE,MAAM;GACN,SAAS;GAET,KAAI,U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W,iBACZ;KACC,GACJ,EAAE;CACN,GAAI,WAAW,aAAa,WAAW,eAAe,WAAW,oBACtD;EACL,IAAI,mBAAmB,IAAI,QAAQ,CAAC,SAAS,8BAA8B;AAC3E,qBAAmB,uBAAuB,kBAAkB;GAC1D;GACA,UAAU;GACV,QAAQ;GACR,UAAU;GACV,SAAS;GACV,CAAC;AACF,SAAO,EACL,YAAY,kBACb;KACC,GACJ,EAAE;CACN,GAAI,WAAW,kBACX,EACE,iBAAiB,IACd,QAAQ,CACR,IACC,KAAK,YAAY,4BAA4B,EAC7C,GAAG,KAAK,YAAY,+BAA+B,eAAe,CAAC,oBAAoB,KACrF,YACA,4BACD,CAAC,UACH,CACA,IACC,KAAK,YAAY,6BAA6B,GAAG,EACjD,GAAG,KAAK,YAAY,+BAA+B,eAAe,CAAC,qBAAqB,KACtF,YACA,4BACD,CAAC,UACH,CACA,QACC,IAAI,OAAO,KAAK,YAAY,mCAAmC,CAAC,EAChE,KAAK,YAAY,qCAAqC,CACvD,CACA,SAAS,kBAAkB,KAAK,YAAY,+BAA+B,eAAe,CAAC,aAAa,GAAG,EAC/G,GACD,EAAE;CACP"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DOCUMENT_WORKFLOW_STATES, DOCUMENT_WORKFLOW_STATES_HUMANIZED } from "../constants.js";
|
|
2
|
-
import _capitalize from "lodash/capitalize";
|
|
2
|
+
import _capitalize from "lodash/capitalize.js";
|
|
3
3
|
|
|
4
4
|
//#region src/documents/workflow-state-formatted.ts
|
|
5
5
|
const workflowStateFormatted = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-state-formatted.js","names":[],"sources":["../../src/documents/workflow-state-formatted.ts"],"sourcesContent":["import { DOCUMENT_WORKFLOW_STATES_HUMANIZED, DOCUMENT_WORKFLOW_STATES } from '../constants';\nimport _capitalize from 'lodash/capitalize';\nconst workflowStateFormatted = {\n _default: 'primary',\n [DOCUMENT_WORKFLOW_STATES.ASSIGNED]: DOCUMENT_WORKFLOW_STATES_HUMANIZED.UNDER_REVIEW,\n [DOCUMENT_WORKFLOW_STATES.PARKED]: DOCUMENT_WORKFLOW_STATES_HUMANIZED.UNDER_REVIEW,\n [DOCUMENT_WORKFLOW_STATES.CANCELLED]: _capitalize(DOCUMENT_WORKFLOW_STATES.CANCELLED),\n // @ts-expect-error TS(2339): Property 'ERRORED' does not exist on type '{ INBOX... Remove this comment to see the full error message\n [DOCUMENT_WORKFLOW_STATES.ERRORED]: _capitalize(DOCUMENT_WORKFLOW_STATES.ERRORED),\n [DOCUMENT_WORKFLOW_STATES.INBOX]: DOCUMENT_WORKFLOW_STATES_HUMANIZED.SUBMITTED,\n [DOCUMENT_WORKFLOW_STATES.APPROVED]: DOCUMENT_WORKFLOW_STATES_HUMANIZED.APPROVED,\n [DOCUMENT_WORKFLOW_STATES.DECLINED]: _capitalize(DOCUMENT_WORKFLOW_STATES.DECLINED),\n // @ts-expect-error TS(2339): Property 'ARCHIVED' does not exist on type '{ INBO... Remove this comment to see the full error message\n [DOCUMENT_WORKFLOW_STATES.ARCHIVED]: _capitalize(DOCUMENT_WORKFLOW_STATES.ARCHIVED)\n};\n\nexport default workflowStateFormatted;\n"],"mappings":";;;;AAEA,MAAM,yBAAyB;CAC7B,UAAU;EACT,yBAAyB,WAAW,mCAAmC;EACvE,yBAAyB,SAAS,mCAAmC;EACrE,yBAAyB,YAAY,YAAY,yBAAyB,UAAU;EAEpF,yBAAyB,UAAU,YAAY,yBAAyB,QAAQ;EAChF,yBAAyB,QAAQ,mCAAmC;EACpE,yBAAyB,WAAW,mCAAmC;EACvE,yBAAyB,WAAW,YAAY,yBAAyB,SAAS;EAElF,yBAAyB,WAAW,YAAY,yBAAyB,SAAS;CACpF;AAED,uCAAe"}
|
|
1
|
+
{"version":3,"file":"workflow-state-formatted.js","names":[],"sources":["../../src/documents/workflow-state-formatted.ts"],"sourcesContent":["import { DOCUMENT_WORKFLOW_STATES_HUMANIZED, DOCUMENT_WORKFLOW_STATES } from '../constants';\nimport _capitalize from 'lodash/capitalize.js';\nconst workflowStateFormatted = {\n _default: 'primary',\n [DOCUMENT_WORKFLOW_STATES.ASSIGNED]: DOCUMENT_WORKFLOW_STATES_HUMANIZED.UNDER_REVIEW,\n [DOCUMENT_WORKFLOW_STATES.PARKED]: DOCUMENT_WORKFLOW_STATES_HUMANIZED.UNDER_REVIEW,\n [DOCUMENT_WORKFLOW_STATES.CANCELLED]: _capitalize(DOCUMENT_WORKFLOW_STATES.CANCELLED),\n // @ts-expect-error TS(2339): Property 'ERRORED' does not exist on type '{ INBOX... Remove this comment to see the full error message\n [DOCUMENT_WORKFLOW_STATES.ERRORED]: _capitalize(DOCUMENT_WORKFLOW_STATES.ERRORED),\n [DOCUMENT_WORKFLOW_STATES.INBOX]: DOCUMENT_WORKFLOW_STATES_HUMANIZED.SUBMITTED,\n [DOCUMENT_WORKFLOW_STATES.APPROVED]: DOCUMENT_WORKFLOW_STATES_HUMANIZED.APPROVED,\n [DOCUMENT_WORKFLOW_STATES.DECLINED]: _capitalize(DOCUMENT_WORKFLOW_STATES.DECLINED),\n // @ts-expect-error TS(2339): Property 'ARCHIVED' does not exist on type '{ INBO... Remove this comment to see the full error message\n [DOCUMENT_WORKFLOW_STATES.ARCHIVED]: _capitalize(DOCUMENT_WORKFLOW_STATES.ARCHIVED)\n};\n\nexport default workflowStateFormatted;\n"],"mappings":";;;;AAEA,MAAM,yBAAyB;CAC7B,UAAU;EACT,yBAAyB,WAAW,mCAAmC;EACvE,yBAAyB,SAAS,mCAAmC;EACrE,yBAAyB,YAAY,YAAY,yBAAyB,UAAU;EAEpF,yBAAyB,UAAU,YAAY,yBAAyB,QAAQ;EAChF,yBAAyB,QAAQ,mCAAmC;EACpE,yBAAyB,WAAW,mCAAmC;EACvE,yBAAyB,WAAW,YAAY,yBAAyB,SAAS;EAElF,yBAAyB,WAAW,YAAY,yBAAyB,SAAS;CACpF;AAED,uCAAe"}
|
package/dist/funders.js
CHANGED
package/dist/funders.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"funders.js","names":[],"sources":["../src/funders.ts"],"sourcesContent":["import _get from 'lodash/get';\nimport { FUNDERS } from './constants';\nexport const FUNDERS_WITH_ONBOARDING = [\n FUNDERS.HICAPS,\n FUNDERS.MEDICARE,\n FUNDERS.EASYCLAIM,\n FUNDERS.ICARE,\n FUNDERS.WCQ,\n FUNDERS.COMCARE,\n FUNDERS.WSV,\n FUNDERS.NIB,\n FUNDERS.QBE,\n FUNDERS.AGED_CARE\n] as const;\nexport const CLAIMABLE_FUNDERS = [\n FUNDERS.COMCARE,\n FUNDERS.DVA,\n FUNDERS.ECLIPSE,\n FUNDERS.HEALTHPOINT,\n FUNDERS.HICAPS,\n FUNDERS.ICARE,\n FUNDERS.MEDICARE,\n FUNDERS.EASYCLAIM,\n FUNDERS.NIB,\n FUNDERS.OHC,\n FUNDERS.QBE,\n FUNDERS.WCQ,\n FUNDERS.WSV,\n FUNDERS.AGED_CARE\n] as const;\nexport const getFunderCodeFromTransaction = (transaction: Record<string, any>, funderCode?: string) => {\n if (transaction.isPatientFunded || _get(transaction, 'claims[0].isPatientFunded')) {\n return FUNDERS.PATIENT;\n } else if (funderCode === FUNDERS.HICAPS) {\n return FUNDERS.HICAPS;\n } else if (funderCode === FUNDERS.PATIENT) {\n return FUNDERS.PATIENT;\n } else if (funderCode === FUNDERS.MEDICARE) {\n return FUNDERS.MEDICARE;\n } else if (funderCode === FUNDERS.EASYCLAIM) {\n return FUNDERS.EASYCLAIM;\n } else if (funderCode === FUNDERS.HBF) {\n return FUNDERS.HBF;\n } else if (funderCode === FUNDERS.ICARE) {\n return FUNDERS.ICARE;\n } else if (funderCode === FUNDERS.NDIS) {\n return FUNDERS.NDIS;\n } else if (funderCode === FUNDERS.OHC) {\n return FUNDERS.OHC;\n } else if (funderCode === FUNDERS.DVA) {\n return FUNDERS.DVA;\n } else if (funderCode === FUNDERS.WCQ) {\n return FUNDERS.WCQ;\n } else if (funderCode === FUNDERS.COMCARE) {\n return FUNDERS.COMCARE;\n } else if (funderCode === FUNDERS.HEALTHPOINT) {\n return FUNDERS.HEALTHPOINT;\n } else if (funderCode === FUNDERS.WSV) {\n return FUNDERS.WSV;\n } else if (funderCode === FUNDERS.NIB) {\n return FUNDERS.NIB;\n } else if (funderCode === FUNDERS.ECLIPSE) {\n return FUNDERS.ECLIPSE;\n } else if (funderCode === FUNDERS.QBE) {\n return FUNDERS.QBE;\n } else if (funderCode === FUNDERS.AGED_CARE) {\n return FUNDERS.AGED_CARE;\n }\n\n return FUNDERS.PATIENT;\n};\n\nexport const isComcare = (funderCode: string) => funderCode === FUNDERS.COMCARE;\nexport const isDVA = (funderCode: string) => funderCode === FUNDERS.DVA;\nexport const isEclipse = (funderCode: string) => funderCode === FUNDERS.ECLIPSE;\nexport const isHBF = (funderCode: string) => funderCode === FUNDERS.HBF;\nexport const isHICAPS = (funderCode: string) => funderCode === FUNDERS.HICAPS;\nexport const isIcare = (funderCode: string) => funderCode === FUNDERS.ICARE;\nexport const isHealthPoint = (funderCode: string) => funderCode === FUNDERS.HEALTHPOINT;\nexport const isMedicare = (funderCode: string) => funderCode === FUNDERS.MEDICARE;\nexport const isEasyClaim = (funderCode: string) => funderCode === FUNDERS.EASYCLAIM;\nexport const isNDIS = (funderCode: string) => funderCode === FUNDERS.NDIS;\nexport const isNib = (funderCode: string) => funderCode === FUNDERS.NIB;\nexport const isOHC = (funderCode: string) => funderCode === FUNDERS.OHC;\nexport const isPatientFunded = (funderCode: string) => funderCode === FUNDERS.PATIENT;\nexport const isQBE = (funderCode: string) => funderCode === FUNDERS.QBE;\nexport const isWCQ = (funderCode: string) => funderCode === FUNDERS.WCQ;\nexport const isWSV = (funderCode: string) => funderCode === FUNDERS.WSV;\nexport const isAgedCare = (funderCode: string) => funderCode === FUNDERS.AGED_CARE;\n// @ts-expect-error\nexport const isFunderClaimable = (funderCode: string) => CLAIMABLE_FUNDERS.includes(funderCode);\n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E,MAAa,SAAS,eAAuB,eAAe,QAAQ;AACpE,MAAa,YAAY,eAAuB,eAAe,QAAQ;AACvE,MAAa,WAAW,eAAuB,eAAe,QAAQ;AACtE,MAAa,iBAAiB,eAAuB,eAAe,QAAQ;AAC5E,MAAa,cAAc,eAAuB,eAAe,QAAQ;AACzE,MAAa,eAAe,eAAuB,eAAe,QAAQ;AAC1E,MAAa,UAAU,eAAuB,eAAe,QAAQ;AACrE,MAAa,SAAS,eAAuB,eAAe,QAAQ;AACpE,MAAa,SAAS,eAAuB,eAAe,QAAQ;AACpE,MAAa,mBAAmB,eAAuB,eAAe,QAAQ;AAC9E,MAAa,SAAS,eAAuB,eAAe,QAAQ;AACpE,MAAa,SAAS,eAAuB,eAAe,QAAQ;AACpE,MAAa,SAAS,eAAuB,eAAe,QAAQ;AACpE,MAAa,cAAc,eAAuB,eAAe,QAAQ;AAEzE,MAAa,qBAAqB,eAAuB,kBAAkB,SAAS,WAAW"}
|
|
1
|
+
{"version":3,"file":"funders.js","names":[],"sources":["../src/funders.ts"],"sourcesContent":["import _get from 'lodash/get.js';\nimport { FUNDERS } from './constants';\nexport const FUNDERS_WITH_ONBOARDING = [\n FUNDERS.HICAPS,\n FUNDERS.MEDICARE,\n FUNDERS.EASYCLAIM,\n FUNDERS.ICARE,\n FUNDERS.WCQ,\n FUNDERS.COMCARE,\n FUNDERS.WSV,\n FUNDERS.NIB,\n FUNDERS.QBE,\n FUNDERS.AGED_CARE\n] as const;\nexport const CLAIMABLE_FUNDERS = [\n FUNDERS.COMCARE,\n FUNDERS.DVA,\n FUNDERS.ECLIPSE,\n FUNDERS.HEALTHPOINT,\n FUNDERS.HICAPS,\n FUNDERS.ICARE,\n FUNDERS.MEDICARE,\n FUNDERS.EASYCLAIM,\n FUNDERS.NIB,\n FUNDERS.OHC,\n FUNDERS.QBE,\n FUNDERS.WCQ,\n FUNDERS.WSV,\n FUNDERS.AGED_CARE\n] as const;\nexport const getFunderCodeFromTransaction = (transaction: Record<string, any>, funderCode?: string) => {\n if (transaction.isPatientFunded || _get(transaction, 'claims[0].isPatientFunded')) {\n return FUNDERS.PATIENT;\n } else if (funderCode === FUNDERS.HICAPS) {\n return FUNDERS.HICAPS;\n } else if (funderCode === FUNDERS.PATIENT) {\n return FUNDERS.PATIENT;\n } else if (funderCode === FUNDERS.MEDICARE) {\n return FUNDERS.MEDICARE;\n } else if (funderCode === FUNDERS.EASYCLAIM) {\n return FUNDERS.EASYCLAIM;\n } else if (funderCode === FUNDERS.HBF) {\n return FUNDERS.HBF;\n } else if (funderCode === FUNDERS.ICARE) {\n return FUNDERS.ICARE;\n } else if (funderCode === FUNDERS.NDIS) {\n return FUNDERS.NDIS;\n } else if (funderCode === FUNDERS.OHC) {\n return FUNDERS.OHC;\n } else if (funderCode === FUNDERS.DVA) {\n return FUNDERS.DVA;\n } else if (funderCode === FUNDERS.WCQ) {\n return FUNDERS.WCQ;\n } else if (funderCode === FUNDERS.COMCARE) {\n return FUNDERS.COMCARE;\n } else if (funderCode === FUNDERS.HEALTHPOINT) {\n return FUNDERS.HEALTHPOINT;\n } else if (funderCode === FUNDERS.WSV) {\n return FUNDERS.WSV;\n } else if (funderCode === FUNDERS.NIB) {\n return FUNDERS.NIB;\n } else if (funderCode === FUNDERS.ECLIPSE) {\n return FUNDERS.ECLIPSE;\n } else if (funderCode === FUNDERS.QBE) {\n return FUNDERS.QBE;\n } else if (funderCode === FUNDERS.AGED_CARE) {\n return FUNDERS.AGED_CARE;\n }\n\n return FUNDERS.PATIENT;\n};\n\nexport const isComcare = (funderCode: string) => funderCode === FUNDERS.COMCARE;\nexport const isDVA = (funderCode: string) => funderCode === FUNDERS.DVA;\nexport const isEclipse = (funderCode: string) => funderCode === FUNDERS.ECLIPSE;\nexport const isHBF = (funderCode: string) => funderCode === FUNDERS.HBF;\nexport const isHICAPS = (funderCode: string) => funderCode === FUNDERS.HICAPS;\nexport const isIcare = (funderCode: string) => funderCode === FUNDERS.ICARE;\nexport const isHealthPoint = (funderCode: string) => funderCode === FUNDERS.HEALTHPOINT;\nexport const isMedicare = (funderCode: string) => funderCode === FUNDERS.MEDICARE;\nexport const isEasyClaim = (funderCode: string) => funderCode === FUNDERS.EASYCLAIM;\nexport const isNDIS = (funderCode: string) => funderCode === FUNDERS.NDIS;\nexport const isNib = (funderCode: string) => funderCode === FUNDERS.NIB;\nexport const isOHC = (funderCode: string) => funderCode === FUNDERS.OHC;\nexport const isPatientFunded = (funderCode: string) => funderCode === FUNDERS.PATIENT;\nexport const isQBE = (funderCode: string) => funderCode === FUNDERS.QBE;\nexport const isWCQ = (funderCode: string) => funderCode === FUNDERS.WCQ;\nexport const isWSV = (funderCode: string) => funderCode === FUNDERS.WSV;\nexport const isAgedCare = (funderCode: string) => funderCode === FUNDERS.AGED_CARE;\n// @ts-expect-error\nexport const isFunderClaimable = (funderCode: string) => CLAIMABLE_FUNDERS.includes(funderCode);\n"],"mappings":";;;;AAEA,MAAa,0BAA0B;CACrC,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACT;AACD,MAAa,oBAAoB;CAC/B,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACR,QAAQ;CACT;AACD,MAAa,gCAAgC,aAAkC,eAAwB;AACrG,KAAI,YAAY,mBAAmB,KAAK,aAAa,4BAA4B,CAC/E,QAAO,QAAQ;UACN,eAAe,QAAQ,OAChC,QAAO,QAAQ;UACN,eAAe,QAAQ,QAChC,QAAO,QAAQ;UACN,eAAe,QAAQ,SAChC,QAAO,QAAQ;UACN,eAAe,QAAQ,UAChC,QAAO,QAAQ;UACN,eAAe,QAAQ,IAChC,QAAO,QAAQ;UACN,eAAe,QAAQ,MAChC,QAAO,QA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js";
|
|
2
|
-
import _get from "lodash/get";
|
|
3
|
-
import _omitBy from "lodash/omitBy";
|
|
4
|
-
import _isEmpty from "lodash/isEmpty";
|
|
2
|
+
import _get from "lodash/get.js";
|
|
3
|
+
import _omitBy from "lodash/omitBy.js";
|
|
4
|
+
import _isEmpty from "lodash/isEmpty.js";
|
|
5
5
|
|
|
6
6
|
//#region src/get-env.ts
|
|
7
7
|
const REQUIRED_VARIABLES = ["APP_URL"];
|
package/dist/get-env.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-env.js","names":["processEnv","LOCAL: { ENV: SingleEnvironment }","DEV: { ENV: SingleEnvironment }","STAGING: { ENV: SingleEnvironment }","PERF: { ENV: SingleEnvironment }","DR: { ENV: SingleEnvironment }","PREPROD: { ENV: SingleEnvironment }","PROD: { ENV: SingleEnvironment }","environmentsMissingVariables: string[]","missingVariables: Record<string, any>"],"sources":["../src/get-env.ts"],"sourcesContent":["import _get from 'lodash/get';\nimport _omitBy from 'lodash/omitBy';\nimport _isEmpty from 'lodash/isEmpty';\nimport { getProcessEnv } from './process-env';\n\nexport interface SingleEnvironment {\n INTERCOM_APP_ID?: string;\n HPF_SCRIPT_URL?: string;\n GOOGLE_MERCHANT_ID?: string;\n APP_URL: string | string[];\n GOOGLE_ANALYTICS_TRACKING_ID?: string;\n GOOGLE_TAG_MANAGER_ID?: string;\n ENV_NAME: string;\n FUNDER_URL?: string;\n CONNECT_URL?: string;\n CONSUMER_URL?: string;\n ACCOUNTS_URL?: string;\n QUOTES_URL?: string;\n CHECKOUT_URL?: string;\n}\n\nexport interface SingleEnvironmentPayload {\n INTERCOM_APP_ID?: string;\n HPF_SCRIPT_URL?: string;\n GOOGLE_MERCHANT_ID?: string;\n APP_URL: string | string[];\n GOOGLE_ANALYTICS_TRACKING_ID?: string;\n GOOGLE_TAG_MANAGER_ID?: string;\n}\n\nexport interface EnvironmentPayload {\n _global?: Record<string, any>;\n local: SingleEnvironmentPayload;\n dev: SingleEnvironmentPayload;\n staging: SingleEnvironmentPayload;\n perf: SingleEnvironmentPayload;\n dr: SingleEnvironmentPayload;\n preprod: SingleEnvironmentPayload;\n prod: SingleEnvironmentPayload;\n}\n\nexport const REQUIRED_VARIABLES = ['APP_URL'];\n\nexport const ENV_NAMES = {\n LOCAL: 'local',\n DEV: 'dev',\n STG: 'staging',\n PERF: 'perf',\n DR: 'dr',\n PREPROD: 'pre-prod',\n PROD: 'prod'\n} as const;\n\nconst doesAppUrlMatchOrigin = ({ appUrl, origin }: { appUrl: string | string[]; origin: string }) => {\n if (typeof appUrl === 'string' || appUrl instanceof String) {\n return appUrl === origin;\n }\n\n return appUrl?.includes(origin);\n};\n\nconst getEnv = (env: EnvironmentPayload) => {\n const processEnv = getProcessEnv();\n const LOCAL: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.local || {}),\n ENV_NAME: ENV_NAMES.LOCAL,\n FUNDER_URL: 'https://dev-funder.medipass.io',\n CONNECT_URL: 'https://dev-connect.medipass.io',\n CONSUMER_URL: 'https://dev-my.medipass.io',\n ACCOUNTS_URL: 'https://dev-accounts.medipass.io',\n QUOTES_URL: 'https://dev-quotes.medipass.io',\n CHECKOUT_URL: 'https://dev-checkout.medipass.io'\n }\n };\n const DEV: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.dev || {}),\n ENV_NAME: ENV_NAMES.DEV,\n FUNDER_URL: 'https://dev-funder.medipass.io',\n CONNECT_URL: 'https://dev-connect.medipass.io',\n CONSUMER_URL: 'https://dev-my.medipass.io',\n ACCOUNTS_URL: 'https://dev-accounts.medipass.io',\n QUOTES_URL: 'https://dev-quotes.medipass.io',\n CHECKOUT_URL: 'https://dev-checkout.medipass.io'\n }\n };\n const STAGING: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.staging || {}),\n ENV_NAME: ENV_NAMES.STG,\n FUNDER_URL: 'https://stg-funder.medipass.io',\n CONNECT_URL: 'https://stg-connect.medipass.io',\n CONSUMER_URL: 'https://stg-my.medipass.io',\n ACCOUNTS_URL: 'https://stg-accounts.medipass.io',\n QUOTES_URL: 'https://stg-quotes.medipass.io',\n CHECKOUT_URL: 'https://stg-checkout.medipass.io'\n }\n };\n const PERF: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.perf || {}),\n ENV_NAME: ENV_NAMES.PERF,\n FUNDER_URL: 'https://perf-funder.medipass.io',\n CONNECT_URL: 'https://perf-connect.medipass.io',\n CONSUMER_URL: 'https://perf-my.medipass.io',\n ACCOUNTS_URL: 'https://perf-accounts.medipass.io',\n QUOTES_URL: 'https://perf-quotes.medipass.io',\n CHECKOUT_URL: 'https://perf-checkout.medipass.io'\n }\n };\n const DR: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.dr || {}),\n ENV_NAME: ENV_NAMES.DR,\n FUNDER_URL: 'https://dr-funder.medipass.io',\n CONNECT_URL: 'https://dr-connect.medipass.io',\n CONSUMER_URL: 'https://dr-my.medipass.io',\n ACCOUNTS_URL: 'https://dr-accounts.medipass.io',\n QUOTES_URL: 'https://dr-quotes.medipass.io',\n CHECKOUT_URL: 'https://dr-checkout.medipass.io'\n }\n };\n const PREPROD: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.preprod || {}),\n ENV_NAME: ENV_NAMES.PREPROD,\n FUNDER_URL: 'https://funder-blue.medipass.io',\n CONNECT_URL: 'https://connect-blue.medipass.io',\n CONSUMER_URL: 'https://my-blue.medipass.io',\n ACCOUNTS_URL: 'https://accounts-blue.medipass.io',\n QUOTES_URL: 'https://quotes-blue.medipass.io',\n CHECKOUT_URL: 'https://checkout-blue.medipass.io'\n }\n };\n const PROD: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.prod || {}),\n ENV_NAME: ENV_NAMES.PROD,\n FUNDER_URL: 'https://funder.medipass.io',\n CONNECT_URL: 'https://connect.medipass.io',\n CONSUMER_URL: 'https://my.medipass.io',\n ACCOUNTS_URL: 'https://accounts.medipass.io',\n QUOTES_URL: 'https://quotes.medipass.io',\n CHECKOUT_URL: 'https://checkout.medipass.io'\n }\n };\n\n const fabSettings = _get(window, 'FAB_SETTINGS', {}) as { REACT_APP_ENV?: string };\n\n const origin = window.location.origin;\n\n if (\n processEnv.REACT_APP_ENV === 'dev' ||\n fabSettings.REACT_APP_ENV === 'dev' ||\n doesAppUrlMatchOrigin({ appUrl: DEV?.ENV?.APP_URL || '', origin })\n ) {\n return DEV.ENV;\n } else if (\n processEnv.REACT_APP_ENV === 'staging' ||\n fabSettings.REACT_APP_ENV === 'staging' ||\n doesAppUrlMatchOrigin({ appUrl: STAGING?.ENV?.APP_URL || '', origin })\n ) {\n return STAGING.ENV;\n } else if (\n processEnv.REACT_APP_ENV === 'perf' ||\n fabSettings.REACT_APP_ENV === 'perf' ||\n doesAppUrlMatchOrigin({ appUrl: PERF?.ENV?.APP_URL || '', origin })\n ) {\n return PERF.ENV;\n } else if (\n processEnv.REACT_APP_ENV === 'dr' ||\n fabSettings.REACT_APP_ENV === 'dr' ||\n doesAppUrlMatchOrigin({ appUrl: DR?.ENV?.APP_URL || '', origin })\n ) {\n return DR.ENV;\n } else if (\n processEnv.REACT_APP_ENV === 'pre-prod' ||\n doesAppUrlMatchOrigin({ appUrl: PREPROD?.ENV?.APP_URL || '', origin })\n ) {\n return PREPROD.ENV;\n } else if (\n processEnv.REACT_APP_ENV === 'local' ||\n doesAppUrlMatchOrigin({ appUrl: LOCAL?.ENV?.APP_URL || '', origin })\n ) {\n return LOCAL.ENV;\n } else if (\n processEnv.REACT_APP_ENV === 'prod' ||\n doesAppUrlMatchOrigin({ appUrl: PROD?.ENV?.APP_URL || '', origin })\n ) {\n return PROD.ENV;\n }\n\n return DEV.ENV;\n};\n\nconst getEnvironmentsMissingVariables = (envVariables: Record<string, any>) => {\n let environmentsMissingVariables: string[] = [];\n\n for (const requiredVariable of REQUIRED_VARIABLES) {\n if (!envVariables[requiredVariable]) {\n environmentsMissingVariables = [...environmentsMissingVariables, requiredVariable];\n }\n }\n\n return environmentsMissingVariables;\n};\n\nconst getRequiredEnvironmentVariables = (env: EnvironmentPayload) => {\n const missingVariables: Record<string, any> = {};\n\n for (const key in env) {\n if (key.includes('_')) {\n continue;\n }\n\n if (Object.prototype.hasOwnProperty.call(env, key)) {\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n missingVariables[key] = getEnvironmentsMissingVariables(env[key]);\n }\n }\n\n return _omitBy(missingVariables, _isEmpty);\n};\n\nconst logWarningForMissingRequiredEnvironmentVariables = (missingRequiredEnvironmentVariables: Record<string, any>) => {\n for (const key in missingRequiredEnvironmentVariables) {\n if (Object.prototype.hasOwnProperty.call(missingRequiredEnvironmentVariables, key)) {\n console.error(\n `Warning: Required variables ${missingRequiredEnvironmentVariables[key]} not defined in the '${key}' environment.`\n );\n }\n }\n};\n\nclass Env {\n [index: string]: any;\n ENV_NAME: typeof ENV_NAMES[keyof typeof ENV_NAMES] | null;\n FUNDER_URL: string | null;\n CONNECT_URL: string | null;\n CONSUMER_URL: string | null;\n ACCOUNTS_URL: string | null;\n QUOTES_URL: string | null;\n CHECKOUT_URL: string | null;\n\n constructor() {\n this.ENV_NAME = null;\n this.FUNDER_URL = null;\n this.CONNECT_URL = null;\n this.CONSUMER_URL = null;\n this.ACCOUNTS_URL = null;\n this.QUOTES_URL = null;\n this.CHECKOUT_URL = null;\n }\n\n setup(env: EnvironmentPayload) {\n this.clear();\n const missingRequiredEnvironmentVariables = getRequiredEnvironmentVariables(env);\n logWarningForMissingRequiredEnvironmentVariables(missingRequiredEnvironmentVariables);\n const newEnv = getEnv(env);\n\n for (const key in newEnv) {\n if (Object.prototype.hasOwnProperty.call(newEnv, key)) {\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n this[key] = newEnv[key];\n }\n }\n }\n\n clear() {\n for (const key in this) {\n if (Object.prototype.hasOwnProperty.call(this, key)) {\n delete this[key];\n }\n }\n }\n}\n\nexport default new Env();\nconst processEnv = getProcessEnv();\nexport const ERROR_MESSAGE__INTERNET_ERROR =\n processEnv.REACT_APP_ERROR_MESSAGE__INTERNET_ERROR ||\n 'We are unable to establish an internet connection. We will take you back once you are connected to the internet.';\nexport const ERROR_MESSAGE__NETWORK_ERROR =\n processEnv.REACT_APP_ERROR_MESSAGE__NETWORK_ERROR ||\n 'There are issues connecting to the Tyro Health platform. Please refresh the page and try again.';\nexport const ERROR_MESSAGE__SERVER_ERROR =\n processEnv.REACT_APP_ERROR_MESSAGE__SERVER_ERROR ||\n 'There are issues connecting to the Tyro Health platform. Please refresh the page and try again.';\nexport const ERROR_MESSAGE__PAYMENT_GATEWAY_ERROR =\n processEnv.REACT_APP_ERROR_MESSAGE__PAYMENT_GATEWAY_ERROR ||\n 'There are issues connecting to the payment gateway. Please refresh the page and try again.';\nexport const ERROR_MESSAGE__PAYMENT_ERROR =\n processEnv.REACT_APP_ERROR_MESSAGE__PAYMENT_ERROR ||\n 'An error occurred when processing the payment. Please try again. The card was not charged.';\nexport const ERROR_MESSAGE__PAYMENT_GATEWAY_FIELDS =\n processEnv.REACT_APP_ERROR_MESSAGE__PAYMENT_GATEWAY_FIELDS ||\n 'The payment card details you entered were invalid, please review the payment card credentials and try again.';\n"],"mappings":";;;;;;AAyCA,MAAa,qBAAqB,CAAC,UAAU;AAE7C,MAAa,YAAY;CACvB,OAAO;CACP,KAAK;CACL,KAAK;CACL,MAAM;CACN,IAAI;CACJ,SAAS;CACT,MAAM;CACP;AAED,MAAM,yBAAyB,EAAE,QAAQ,aAA4D;AACnG,KAAI,OAAO,WAAW,YAAY,kBAAkB,OAClD,QAAO,WAAW;AAGpB,QAAO,QAAQ,SAAS,OAAO;;AAGjC,MAAM,UAAU,QAA4B;CAC1C,MAAMA,eAAa,eAAe;CAClC,MAAMC,QAAoC,EACxC,KAA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,MAAM,OAAO,KAAK;AACrB,MAAI,IAAI,SAAS,IAAI,CACnB;AAGF,MAAI,OAAO,UAAU,eAAe,KAAK,KAAK,IAAI,CAEhD,kBAAiB,OAAO,gCAAgC,IAAI,KAAK;;AAIrE,QAAO,QAAQ,kBAAkB,SAAS;;AAG5C,MAAM,oDAAoD,wCAA6D;AACrH,MAAK,MAAM,OAAO,oCAChB,KAAI,OAAO,UAAU,eAAe,KAAK,qCAAqC,IAAI,CAChF,SAAQ,MACN,+BAA+B,oCAAoC,KAAK,uBAAuB,IAAI,gBACpG;;AAKP,IAAM,MAAN,MAAU;CAUR,cAAc;AACZ,OAAK,WAAW;AAChB,OAAK,aAAa;AAClB,OAAK,cAAc;AACnB,OAAK,eAAe;AACpB,OAAK,eAAe;AACpB,OAAK,aAAa;AAClB,OAAK,eAAe;;CAGtB,MAAM,KAAyB;AAC7B,OAAK,OAAO;AAEZ,mDAD4C,gCAAgC,IAAI,CACK;EACrF,MAAM,SAAS,OAAO,IAAI;AAE1B,OAAK,MAAM,OAAO,OAChB,KAAI,OAAO,UAAU,eAAe,KAAK,QAAQ,IAAI,CAEnD,MAAK,OAAO,OAAO;;CAKzB,QAAQ;AACN,OAAK,MAAM,OAAO,KAChB,KAAI,OAAO,UAAU,eAAe,KAAK,MAAM,IAAI,CACjD,QAAO,KAAK;;;AAMpB,sBAAe,IAAI,KAAK;AACxB,MAAM,aAAa,eAAe;AAClC,MAAa,gCACX,WAAW,2CACX;AACF,MAAa,+BACX,WAAW,0CACX;AACF,MAAa,8BACX,WAAW,yCACX;AACF,MAAa,uCACX,WAAW,kDACX;AACF,MAAa,+BACX,WAAW,0CACX;AACF,MAAa,wCACX,WAAW,mDACX"}
|
|
1
|
+
{"version":3,"file":"get-env.js","names":["processEnv","LOCAL: { ENV: SingleEnvironment }","DEV: { ENV: SingleEnvironment }","STAGING: { ENV: SingleEnvironment }","PERF: { ENV: SingleEnvironment }","DR: { ENV: SingleEnvironment }","PREPROD: { ENV: SingleEnvironment }","PROD: { ENV: SingleEnvironment }","environmentsMissingVariables: string[]","missingVariables: Record<string, any>"],"sources":["../src/get-env.ts"],"sourcesContent":["import _get from 'lodash/get.js';\nimport _omitBy from 'lodash/omitBy.js';\nimport _isEmpty from 'lodash/isEmpty.js';\nimport { getProcessEnv } from './process-env';\n\nexport interface SingleEnvironment {\n INTERCOM_APP_ID?: string;\n HPF_SCRIPT_URL?: string;\n GOOGLE_MERCHANT_ID?: string;\n APP_URL: string | string[];\n GOOGLE_ANALYTICS_TRACKING_ID?: string;\n GOOGLE_TAG_MANAGER_ID?: string;\n ENV_NAME: string;\n FUNDER_URL?: string;\n CONNECT_URL?: string;\n CONSUMER_URL?: string;\n ACCOUNTS_URL?: string;\n QUOTES_URL?: string;\n CHECKOUT_URL?: string;\n}\n\nexport interface SingleEnvironmentPayload {\n INTERCOM_APP_ID?: string;\n HPF_SCRIPT_URL?: string;\n GOOGLE_MERCHANT_ID?: string;\n APP_URL: string | string[];\n GOOGLE_ANALYTICS_TRACKING_ID?: string;\n GOOGLE_TAG_MANAGER_ID?: string;\n}\n\nexport interface EnvironmentPayload {\n _global?: Record<string, any>;\n local: SingleEnvironmentPayload;\n dev: SingleEnvironmentPayload;\n staging: SingleEnvironmentPayload;\n perf: SingleEnvironmentPayload;\n dr: SingleEnvironmentPayload;\n preprod: SingleEnvironmentPayload;\n prod: SingleEnvironmentPayload;\n}\n\nexport const REQUIRED_VARIABLES = ['APP_URL'];\n\nexport const ENV_NAMES = {\n LOCAL: 'local',\n DEV: 'dev',\n STG: 'staging',\n PERF: 'perf',\n DR: 'dr',\n PREPROD: 'pre-prod',\n PROD: 'prod'\n} as const;\n\nconst doesAppUrlMatchOrigin = ({ appUrl, origin }: { appUrl: string | string[]; origin: string }) => {\n if (typeof appUrl === 'string' || appUrl instanceof String) {\n return appUrl === origin;\n }\n\n return appUrl?.includes(origin);\n};\n\nconst getEnv = (env: EnvironmentPayload) => {\n const processEnv = getProcessEnv();\n const LOCAL: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.local || {}),\n ENV_NAME: ENV_NAMES.LOCAL,\n FUNDER_URL: 'https://dev-funder.medipass.io',\n CONNECT_URL: 'https://dev-connect.medipass.io',\n CONSUMER_URL: 'https://dev-my.medipass.io',\n ACCOUNTS_URL: 'https://dev-accounts.medipass.io',\n QUOTES_URL: 'https://dev-quotes.medipass.io',\n CHECKOUT_URL: 'https://dev-checkout.medipass.io'\n }\n };\n const DEV: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.dev || {}),\n ENV_NAME: ENV_NAMES.DEV,\n FUNDER_URL: 'https://dev-funder.medipass.io',\n CONNECT_URL: 'https://dev-connect.medipass.io',\n CONSUMER_URL: 'https://dev-my.medipass.io',\n ACCOUNTS_URL: 'https://dev-accounts.medipass.io',\n QUOTES_URL: 'https://dev-quotes.medipass.io',\n CHECKOUT_URL: 'https://dev-checkout.medipass.io'\n }\n };\n const STAGING: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.staging || {}),\n ENV_NAME: ENV_NAMES.STG,\n FUNDER_URL: 'https://stg-funder.medipass.io',\n CONNECT_URL: 'https://stg-connect.medipass.io',\n CONSUMER_URL: 'https://stg-my.medipass.io',\n ACCOUNTS_URL: 'https://stg-accounts.medipass.io',\n QUOTES_URL: 'https://stg-quotes.medipass.io',\n CHECKOUT_URL: 'https://stg-checkout.medipass.io'\n }\n };\n const PERF: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.perf || {}),\n ENV_NAME: ENV_NAMES.PERF,\n FUNDER_URL: 'https://perf-funder.medipass.io',\n CONNECT_URL: 'https://perf-connect.medipass.io',\n CONSUMER_URL: 'https://perf-my.medipass.io',\n ACCOUNTS_URL: 'https://perf-accounts.medipass.io',\n QUOTES_URL: 'https://perf-quotes.medipass.io',\n CHECKOUT_URL: 'https://perf-checkout.medipass.io'\n }\n };\n const DR: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.dr || {}),\n ENV_NAME: ENV_NAMES.DR,\n FUNDER_URL: 'https://dr-funder.medipass.io',\n CONNECT_URL: 'https://dr-connect.medipass.io',\n CONSUMER_URL: 'https://dr-my.medipass.io',\n ACCOUNTS_URL: 'https://dr-accounts.medipass.io',\n QUOTES_URL: 'https://dr-quotes.medipass.io',\n CHECKOUT_URL: 'https://dr-checkout.medipass.io'\n }\n };\n const PREPROD: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.preprod || {}),\n ENV_NAME: ENV_NAMES.PREPROD,\n FUNDER_URL: 'https://funder-blue.medipass.io',\n CONNECT_URL: 'https://connect-blue.medipass.io',\n CONSUMER_URL: 'https://my-blue.medipass.io',\n ACCOUNTS_URL: 'https://accounts-blue.medipass.io',\n QUOTES_URL: 'https://quotes-blue.medipass.io',\n CHECKOUT_URL: 'https://checkout-blue.medipass.io'\n }\n };\n const PROD: { ENV: SingleEnvironment } = {\n ENV: {\n ...(env?._global || {}),\n ...(env?.prod || {}),\n ENV_NAME: ENV_NAMES.PROD,\n FUNDER_URL: 'https://funder.medipass.io',\n CONNECT_URL: 'https://connect.medipass.io',\n CONSUMER_URL: 'https://my.medipass.io',\n ACCOUNTS_URL: 'https://accounts.medipass.io',\n QUOTES_URL: 'https://quotes.medipass.io',\n CHECKOUT_URL: 'https://checkout.medipass.io'\n }\n };\n\n const fabSettings = _get(window, 'FAB_SETTINGS', {}) as { REACT_APP_ENV?: string };\n\n const origin = window.location.origin;\n\n if (\n processEnv.REACT_APP_ENV === 'dev' ||\n fabSettings.REACT_APP_ENV === 'dev' ||\n doesAppUrlMatchOrigin({ appUrl: DEV?.ENV?.APP_URL || '', origin })\n ) {\n return DEV.ENV;\n } else if (\n processEnv.REACT_APP_ENV === 'staging' ||\n fabSettings.REACT_APP_ENV === 'staging' ||\n doesAppUrlMatchOrigin({ appUrl: STAGING?.ENV?.APP_URL || '', origin })\n ) {\n return STAGING.ENV;\n } else if (\n processEnv.REACT_APP_ENV === 'perf' ||\n fabSettings.REACT_APP_ENV === 'perf' ||\n doesAppUrlMatchOrigin({ appUrl: PERF?.ENV?.APP_URL || '', origin })\n ) {\n return PERF.ENV;\n } else if (\n processEnv.REACT_APP_ENV === 'dr' ||\n fabSettings.REACT_APP_ENV === 'dr' ||\n doesAppUrlMatchOrigin({ appUrl: DR?.ENV?.APP_URL || '', origin })\n ) {\n return DR.ENV;\n } else if (\n processEnv.REACT_APP_ENV === 'pre-prod' ||\n doesAppUrlMatchOrigin({ appUrl: PREPROD?.ENV?.APP_URL || '', origin })\n ) {\n return PREPROD.ENV;\n } else if (\n processEnv.REACT_APP_ENV === 'local' ||\n doesAppUrlMatchOrigin({ appUrl: LOCAL?.ENV?.APP_URL || '', origin })\n ) {\n return LOCAL.ENV;\n } else if (\n processEnv.REACT_APP_ENV === 'prod' ||\n doesAppUrlMatchOrigin({ appUrl: PROD?.ENV?.APP_URL || '', origin })\n ) {\n return PROD.ENV;\n }\n\n return DEV.ENV;\n};\n\nconst getEnvironmentsMissingVariables = (envVariables: Record<string, any>) => {\n let environmentsMissingVariables: string[] = [];\n\n for (const requiredVariable of REQUIRED_VARIABLES) {\n if (!envVariables[requiredVariable]) {\n environmentsMissingVariables = [...environmentsMissingVariables, requiredVariable];\n }\n }\n\n return environmentsMissingVariables;\n};\n\nconst getRequiredEnvironmentVariables = (env: EnvironmentPayload) => {\n const missingVariables: Record<string, any> = {};\n\n for (const key in env) {\n if (key.includes('_')) {\n continue;\n }\n\n if (Object.prototype.hasOwnProperty.call(env, key)) {\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n missingVariables[key] = getEnvironmentsMissingVariables(env[key]);\n }\n }\n\n return _omitBy(missingVariables, _isEmpty);\n};\n\nconst logWarningForMissingRequiredEnvironmentVariables = (missingRequiredEnvironmentVariables: Record<string, any>) => {\n for (const key in missingRequiredEnvironmentVariables) {\n if (Object.prototype.hasOwnProperty.call(missingRequiredEnvironmentVariables, key)) {\n console.error(\n `Warning: Required variables ${missingRequiredEnvironmentVariables[key]} not defined in the '${key}' environment.`\n );\n }\n }\n};\n\nclass Env {\n [index: string]: any;\n ENV_NAME: typeof ENV_NAMES[keyof typeof ENV_NAMES] | null;\n FUNDER_URL: string | null;\n CONNECT_URL: string | null;\n CONSUMER_URL: string | null;\n ACCOUNTS_URL: string | null;\n QUOTES_URL: string | null;\n CHECKOUT_URL: string | null;\n\n constructor() {\n this.ENV_NAME = null;\n this.FUNDER_URL = null;\n this.CONNECT_URL = null;\n this.CONSUMER_URL = null;\n this.ACCOUNTS_URL = null;\n this.QUOTES_URL = null;\n this.CHECKOUT_URL = null;\n }\n\n setup(env: EnvironmentPayload) {\n this.clear();\n const missingRequiredEnvironmentVariables = getRequiredEnvironmentVariables(env);\n logWarningForMissingRequiredEnvironmentVariables(missingRequiredEnvironmentVariables);\n const newEnv = getEnv(env);\n\n for (const key in newEnv) {\n if (Object.prototype.hasOwnProperty.call(newEnv, key)) {\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n this[key] = newEnv[key];\n }\n }\n }\n\n clear() {\n for (const key in this) {\n if (Object.prototype.hasOwnProperty.call(this, key)) {\n delete this[key];\n }\n }\n }\n}\n\nexport default new Env();\nconst processEnv = getProcessEnv();\nexport const ERROR_MESSAGE__INTERNET_ERROR =\n processEnv.REACT_APP_ERROR_MESSAGE__INTERNET_ERROR ||\n 'We are unable to establish an internet connection. We will take you back once you are connected to the internet.';\nexport const ERROR_MESSAGE__NETWORK_ERROR =\n processEnv.REACT_APP_ERROR_MESSAGE__NETWORK_ERROR ||\n 'There are issues connecting to the Tyro Health platform. Please refresh the page and try again.';\nexport const ERROR_MESSAGE__SERVER_ERROR =\n processEnv.REACT_APP_ERROR_MESSAGE__SERVER_ERROR ||\n 'There are issues connecting to the Tyro Health platform. Please refresh the page and try again.';\nexport const ERROR_MESSAGE__PAYMENT_GATEWAY_ERROR =\n processEnv.REACT_APP_ERROR_MESSAGE__PAYMENT_GATEWAY_ERROR ||\n 'There are issues connecting to the payment gateway. Please refresh the page and try again.';\nexport const ERROR_MESSAGE__PAYMENT_ERROR =\n processEnv.REACT_APP_ERROR_MESSAGE__PAYMENT_ERROR ||\n 'An error occurred when processing the payment. Please try again. The card was not charged.';\nexport const ERROR_MESSAGE__PAYMENT_GATEWAY_FIELDS =\n processEnv.REACT_APP_ERROR_MESSAGE__PAYMENT_GATEWAY_FIELDS ||\n 'The payment card details you entered were invalid, please review the payment card credentials and try again.';\n"],"mappings":";;;;;;AAyCA,MAAa,qBAAqB,CAAC,UAAU;AAE7C,MAAa,YAAY;CACvB,OAAO;CACP,KAAK;CACL,KAAK;CACL,MAAM;CACN,IAAI;CACJ,SAAS;CACT,MAAM;CACP;AAED,MAAM,yBAAyB,EAAE,QAAQ,aAA4D;AACnG,KAAI,OAAO,WAAW,YAAY,kBAAkB,OAClD,QAAO,WAAW;AAGpB,QAAO,QAAQ,SAAS,OAAO;;AAGjC,MAAM,UAAU,QAA4B;CAC1C,MAAMA,eAAa,eAAe;CAClC,MAAMC,QAAoC,EACxC,KAAK;EACH,GAAI,KAAK,WAAW,EAAE;EACtB,GAAI,KAAK,SAAS,EAAE;EACpB,UAAU,UAAU;EACpB,YAAY;EACZ,aAAa;EACb,cAAc;EACd,cAAc;EACd,YAAY;EACZ,cAAc;EACf,EACF;CACD,MAAMC,MAAkC,EACtC,KAAK;EACH,GAAI,KAAK,WAAW,EAAE;EACtB,GAAI,KAAK,OAAO,EAAE;EAClB,UAAU,UAAU;EACpB,YAAY;EACZ,aAAa;EACb,cAAc;EACd,cAAc;EACd,YAAY;EACZ,cAAc;EACf,EACF;CACD,MAAMC,UAAsC,EAC1C,KAAK;EACH,GAAI,KAAK,WAAW,EAAE;EACtB,GAAI,KAAK,WAAW,EAAE;EACtB,UAAU,UAAU;EACpB,YAAY;EACZ,aAAa;EACb,cAAc;EACd,cAAc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AClB,OAAK,eAAe;;CAGtB,MAAM,KAAyB;AAC7B,OAAK,OAAO;AAEZ,mDAD4C,gCAAgC,IAAI,CACK;EACrF,MAAM,SAAS,OAAO,IAAI;AAE1B,OAAK,MAAM,OAAO,OAChB,KAAI,OAAO,UAAU,eAAe,KAAK,QAAQ,IAAI,CAEnD,MAAK,OAAO,OAAO;;CAKzB,QAAQ;AACN,OAAK,MAAM,OAAO,KAChB,KAAI,OAAO,UAAU,eAAe,KAAK,MAAM,IAAI,CACjD,QAAO,KAAK;;;AAMpB,sBAAe,IAAI,KAAK;AACxB,MAAM,aAAa,eAAe;AAClC,MAAa,gCACX,WAAW,2CACX;AACF,MAAa,+BACX,WAAW,0CACX;AACF,MAAa,8BACX,WAAW,yCACX;AACF,MAAa,uCACX,WAAW,kDACX;AACF,MAAa,+BACX,WAAW,0CACX;AACF,MAAa,wCACX,WAAW,mDACX"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"get-select-options.js","names":[],"sources":["../src/get-select-options.ts"],"sourcesContent":["import _get from 'lodash/get';\n\n// @ts-expect-error TS(7006): Parameter 'values' implicitly has an 'any' type.\nconst getSelectOptions = (values, labelKey, valueKey = null, opts = {}) => {\n if (!values) {\n return [];\n }\n\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n return values.map((value, i) => ({\n key: _get(value, '_id', i),\n // @ts-expect-error TS(2339): Property 'labelKeyFunc' does not exist on type '{}... Remove this comment to see the full error message\n label: opts.labelKeyFunc ? opts.labelKeyFunc(value) : _get(value, labelKey),\n value: valueKey ? _get(value, valueKey) : value\n }));\n};\n\nexport default getSelectOptions;\nexport const getNameMobileEmail = (value: Record<string, any>) =>\n `${_get(value, 'firstName')} ${_get(value, 'lastName')} ${_get(value, 'mobile', '')} ${_get(value, 'email', '')}`;\nexport const getDisplayNameAndICDCode = (value: Record<string, any>) =>\n `${_get(value, 'icdCode')} - ${_get(value, 'displayName')}`;\nexport const getFullName = (value: Record<string, any>) => `${_get(value, 'firstName')} ${_get(value, 'lastName')}`;\nexport const getSelectOptionsWithNameMobileEmail = (data: Array<Record<string, any>>) =>\n getSelectOptions(data, null, null, {\n labelKeyFunc: getNameMobileEmail || []\n });\nexport const getSelectOptionsWithDisplayName = (data: Array<Record<string, any>>) =>\n getSelectOptions(data, 'displayName');\nexport const getSelectOptionsWithDisplayNameAndICDCode = (data: Array<Record<string, any>>) =>\n getSelectOptions(data, null, null, {\n labelKeyFunc: getDisplayNameAndICDCode || []\n });\nexport const getSelectOptionsWithFullName = (data: Array<Record<string, any>>) =>\n getSelectOptions(data, null, null, {\n labelKeyFunc: getFullName || []\n });\n"],"mappings":";;;AAGA,MAAM,oBAAoB,QAAQ,UAAU,WAAW,MAAM,OAAO,EAAE,KAAK;AACzE,KAAI,CAAC,OACH,QAAO,EAAE;AAIX,QAAO,OAAO,KAAK,OAAO,OAAO;EAC/B,KAAK,KAAK,OAAO,OAAO,EAAE;EAE1B,OAAO,KAAK,eAAe,KAAK,aAAa,MAAM,GAAG,KAAK,OAAO,SAAS;EAC3E,OAAO,WAAW,KAAK,OAAO,SAAS,GAAG;EAC3C,EAAE;;AAGL,iCAAe;AACf,MAAa,sBAAsB,UACjC,GAAG,KAAK,OAAO,YAAY,CAAC,GAAG,KAAK,OAAO,WAAW,CAAC,GAAG,KAAK,OAAO,UAAU,GAAG,CAAC,GAAG,KAAK,OAAO,SAAS,GAAG;AACjH,MAAa,4BAA4B,UACvC,GAAG,KAAK,OAAO,UAAU,CAAC,KAAK,KAAK,OAAO,cAAc;AAC3D,MAAa,eAAe,UAA+B,GAAG,KAAK,OAAO,YAAY,CAAC,GAAG,KAAK,OAAO,WAAW;AACjH,MAAa,uCAAuC,SAClD,iBAAiB,MAAM,MAAM,MAAM,EACjC,cAAc,sBAAsB,EAAE,EACvC,CAAC;AACJ,MAAa,mCAAmC,SAC9C,iBAAiB,MAAM,cAAc;AACvC,MAAa,6CAA6C,SACxD,iBAAiB,MAAM,MAAM,MAAM,EACjC,cAAc,4BAA4B,EAAE,EAC7C,CAAC;AACJ,MAAa,gCAAgC,SAC3C,iBAAiB,MAAM,MAAM,MAAM,EACjC,cAAc,eAAe,EAAE,EAChC,CAAC"}
|
|
1
|
+
{"version":3,"file":"get-select-options.js","names":[],"sources":["../src/get-select-options.ts"],"sourcesContent":["import _get from 'lodash/get.js';\n\n// @ts-expect-error TS(7006): Parameter 'values' implicitly has an 'any' type.\nconst getSelectOptions = (values, labelKey, valueKey = null, opts = {}) => {\n if (!values) {\n return [];\n }\n\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n return values.map((value, i) => ({\n key: _get(value, '_id', i),\n // @ts-expect-error TS(2339): Property 'labelKeyFunc' does not exist on type '{}... Remove this comment to see the full error message\n label: opts.labelKeyFunc ? opts.labelKeyFunc(value) : _get(value, labelKey),\n value: valueKey ? _get(value, valueKey) : value\n }));\n};\n\nexport default getSelectOptions;\nexport const getNameMobileEmail = (value: Record<string, any>) =>\n `${_get(value, 'firstName')} ${_get(value, 'lastName')} ${_get(value, 'mobile', '')} ${_get(value, 'email', '')}`;\nexport const getDisplayNameAndICDCode = (value: Record<string, any>) =>\n `${_get(value, 'icdCode')} - ${_get(value, 'displayName')}`;\nexport const getFullName = (value: Record<string, any>) => `${_get(value, 'firstName')} ${_get(value, 'lastName')}`;\nexport const getSelectOptionsWithNameMobileEmail = (data: Array<Record<string, any>>) =>\n getSelectOptions(data, null, null, {\n labelKeyFunc: getNameMobileEmail || []\n });\nexport const getSelectOptionsWithDisplayName = (data: Array<Record<string, any>>) =>\n getSelectOptions(data, 'displayName');\nexport const getSelectOptionsWithDisplayNameAndICDCode = (data: Array<Record<string, any>>) =>\n getSelectOptions(data, null, null, {\n labelKeyFunc: getDisplayNameAndICDCode || []\n });\nexport const getSelectOptionsWithFullName = (data: Array<Record<string, any>>) =>\n getSelectOptions(data, null, null, {\n labelKeyFunc: getFullName || []\n });\n"],"mappings":";;;AAGA,MAAM,oBAAoB,QAAQ,UAAU,WAAW,MAAM,OAAO,EAAE,KAAK;AACzE,KAAI,CAAC,OACH,QAAO,EAAE;AAIX,QAAO,OAAO,KAAK,OAAO,OAAO;EAC/B,KAAK,KAAK,OAAO,OAAO,EAAE;EAE1B,OAAO,KAAK,eAAe,KAAK,aAAa,MAAM,GAAG,KAAK,OAAO,SAAS;EAC3E,OAAO,WAAW,KAAK,OAAO,SAAS,GAAG;EAC3C,EAAE;;AAGL,iCAAe;AACf,MAAa,sBAAsB,UACjC,GAAG,KAAK,OAAO,YAAY,CAAC,GAAG,KAAK,OAAO,WAAW,CAAC,GAAG,KAAK,OAAO,UAAU,GAAG,CAAC,GAAG,KAAK,OAAO,SAAS,GAAG;AACjH,MAAa,4BAA4B,UACvC,GAAG,KAAK,OAAO,UAAU,CAAC,KAAK,KAAK,OAAO,cAAc;AAC3D,MAAa,eAAe,UAA+B,GAAG,KAAK,OAAO,YAAY,CAAC,GAAG,KAAK,OAAO,WAAW;AACjH,MAAa,uCAAuC,SAClD,iBAAiB,MAAM,MAAM,MAAM,EACjC,cAAc,sBAAsB,EAAE,EACvC,CAAC;AACJ,MAAa,mCAAmC,SAC9C,iBAAiB,MAAM,cAAc;AACvC,MAAa,6CAA6C,SACxD,iBAAiB,MAAM,MAAM,MAAM,EACjC,cAAc,4BAA4B,EAAE,EAC7C,CAAC;AACJ,MAAa,gCAAgC,SAC3C,iBAAiB,MAAM,MAAM,MAAM,EACjC,cAAc,eAAe,EAAE,EAChC,CAAC"}
|
package/dist/google-addresses.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as reactPlacesAutocomplete from "react-places-autocomplete";
|
|
2
|
-
import _forEach from "lodash/forEach";
|
|
3
|
-
import _forOwn from "lodash/forOwn";
|
|
2
|
+
import _forEach from "lodash/forEach.js";
|
|
3
|
+
import _forOwn from "lodash/forOwn.js";
|
|
4
4
|
|
|
5
5
|
//#region src/google-addresses.ts
|
|
6
6
|
const { geocodeByAddress, geocodeByPlaceId, getLatLng } = reactPlacesAutocomplete;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-addresses.js","names":["components: Record<string, any>","requestData: {\n address?: string;\n countryCode?: string;\n country?: string;\n state?: string;\n city?: string;\n postcode?: string;\n }"],"sources":["../src/google-addresses.ts"],"sourcesContent":["import * as reactPlacesAutocomplete from 'react-places-autocomplete';\nimport _forEach from 'lodash/forEach';\nimport _forOwn from 'lodash/forOwn';\n\nconst { geocodeByAddress, geocodeByPlaceId, getLatLng } = reactPlacesAutocomplete;\nconst ADDRESS_COMPONENT_MAPPINGS = {\n subpremise: 'subpremise',\n streetNumber: 'street_number',\n route: 'route',\n country: 'country',\n state: 'administrative_area_level_1',\n city: 'locality',\n postcode: 'postal_code'\n};\nexport function geocodeAddress(\n address: string\n): Promise<{ results: google.maps.GeocoderResult[]; latLng: google.maps.LatLngLiteral }> {\n return new Promise(async (res, rej) => {\n try {\n const results = await geocodeByAddress(address);\n const latLng = await getLatLng(results[0]);\n res({\n results,\n latLng\n });\n } catch (err) {\n if (err === 'OVER_QUERY_LIMIT') {\n setTimeout(async () => {\n const result = geocodeAddress(address);\n res(result);\n }, 1000);\n } else {\n rej(err);\n }\n }\n });\n}\nexport const mapAddressComponents = (addressComponents: google.maps.GeocoderAddressComponent[]) => {\n const components: Record<string, any> = {};\n\n _forEach(addressComponents, component => {\n _forOwn(ADDRESS_COMPONENT_MAPPINGS, (mapping, key) => {\n if (component?.types?.[0] === mapping) {\n components[key] = {\n longName: component.long_name,\n shortName: component.short_name\n };\n }\n });\n });\n\n return components;\n};\nexport const parseAddress = (addressComponents: google.maps.GeocoderAddressComponent[]) => {\n const requestData: {\n address?: string;\n countryCode?: string;\n country?: string;\n state?: string;\n city?: string;\n postcode?: string;\n } = {};\n\n if (addressComponents) {\n const address = mapAddressComponents(addressComponents);\n\n if (address.route) {\n requestData.address =\n `${address.subpremise ? `${address.subpremise.longName}/` : ''}` +\n `${address.streetNumber ? address.streetNumber.longName : ''} ` +\n `${address.route.longName}`;\n }\n\n if (address.country) {\n requestData.countryCode = address.country.shortName;\n requestData.country = address.country.longName;\n }\n\n requestData.state = address.state ? address.state.longName : null;\n requestData.city = address.city ? address.city.longName : null;\n requestData.postcode = address.postcode ? address.postcode.longName : null;\n }\n\n return requestData;\n};\n\nexport const getAddressFromPlaceId = async (placeId: string) => {\n const results = await geocodeByPlaceId(placeId);\n const result = results?.[0];\n const latLng = await getLatLng(result);\n\n const addressComponents = parseAddress(result?.address_components);\n\n return {\n addressComponents,\n latLng\n };\n};\n"],"mappings":";;;;;AAIA,MAAM,EAAE,kBAAkB,kBAAkB,cAAc;AAC1D,MAAM,6BAA6B;CACjC,YAAY;CACZ,cAAc;CACd,OAAO;CACP,SAAS;CACT,OAAO;CACP,MAAM;CACN,UAAU;CACX;AACD,SAAgB,eACd,SACuF;AACvF,QAAO,IAAI,QAAQ,OAAO,KAAK,QAAQ;AACrC,MAAI;GACF,MAAM,UAAU,MAAM,iBAAiB,QAAQ;AAE/C,OAAI;IACF;IACA,QAHa,MAAM,UAAU,QAAQ,GAAG;IAIzC,CAAC;WACK,KAAK;AACZ,OAAI,QAAQ,mBACV,YAAW,YAAY;AAErB,QADe,eAAe,QAAQ,CAC3B;MACV,IAAK;OAER,KAAI,IAAI;;GAGZ;;AAEJ,MAAa,wBAAwB,sBAA8D;CACjG,MAAMA,aAAkC,EAAE;AAE1C,UAAS,oBAAmB,cAAa;AACvC,UAAQ,6BAA6B,SAAS,QAAQ;AACpD,OAAI,WAAW,QAAQ,OAAO,QAC5B,YAAW,OAAO;IAChB,UAAU,UAAU;IACpB,WAAW,UAAU;IACtB;IAEH;GACF;AAEF,QAAO;;AAET,MAAa,gBAAgB,sBAA8D;CACzF,MAAMC,cAOF,EAAE;AAEN,KAAI,mBAAmB;EACrB,MAAM,UAAU,qBAAqB,kBAAkB;AAEvD,MAAI,QAAQ,MACV,aAAY,UACV,GAAG,QAAQ,aAAa,GAAG,QAAQ,WAAW,SAAS,KAAK,KACzD,QAAQ,eAAe,QAAQ,aAAa,WAAW,GAAG,GAC1D,QAAQ,MAAM;AAGrB,MAAI,QAAQ,SAAS;AACnB,eAAY,cAAc,QAAQ,QAAQ;AAC1C,eAAY,UAAU,QAAQ,QAAQ;;AAGxC,cAAY,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,WAAW;AAC7D,cAAY,OAAO,QAAQ,OAAO,QAAQ,KAAK,WAAW;AAC1D,cAAY,WAAW,QAAQ,WAAW,QAAQ,SAAS,WAAW;;AAGxE,QAAO;;AAGT,MAAa,wBAAwB,OAAO,YAAoB;CAE9D,MAAM,UADU,MAAM,iBAAiB,QAAQ,IACtB;CACzB,MAAM,SAAS,MAAM,UAAU,OAAO;AAItC,QAAO;EACL,mBAHwB,aAAa,QAAQ,mBAAmB;EAIhE;EACD"}
|
|
1
|
+
{"version":3,"file":"google-addresses.js","names":["components: Record<string, any>","requestData: {\n address?: string;\n countryCode?: string;\n country?: string;\n state?: string;\n city?: string;\n postcode?: string;\n }"],"sources":["../src/google-addresses.ts"],"sourcesContent":["import * as reactPlacesAutocomplete from 'react-places-autocomplete';\nimport _forEach from 'lodash/forEach.js';\nimport _forOwn from 'lodash/forOwn.js';\n\nconst { geocodeByAddress, geocodeByPlaceId, getLatLng } = reactPlacesAutocomplete;\nconst ADDRESS_COMPONENT_MAPPINGS = {\n subpremise: 'subpremise',\n streetNumber: 'street_number',\n route: 'route',\n country: 'country',\n state: 'administrative_area_level_1',\n city: 'locality',\n postcode: 'postal_code'\n};\nexport function geocodeAddress(\n address: string\n): Promise<{ results: google.maps.GeocoderResult[]; latLng: google.maps.LatLngLiteral }> {\n return new Promise(async (res, rej) => {\n try {\n const results = await geocodeByAddress(address);\n const latLng = await getLatLng(results[0]);\n res({\n results,\n latLng\n });\n } catch (err) {\n if (err === 'OVER_QUERY_LIMIT') {\n setTimeout(async () => {\n const result = geocodeAddress(address);\n res(result);\n }, 1000);\n } else {\n rej(err);\n }\n }\n });\n}\nexport const mapAddressComponents = (addressComponents: google.maps.GeocoderAddressComponent[]) => {\n const components: Record<string, any> = {};\n\n _forEach(addressComponents, component => {\n _forOwn(ADDRESS_COMPONENT_MAPPINGS, (mapping, key) => {\n if (component?.types?.[0] === mapping) {\n components[key] = {\n longName: component.long_name,\n shortName: component.short_name\n };\n }\n });\n });\n\n return components;\n};\nexport const parseAddress = (addressComponents: google.maps.GeocoderAddressComponent[]) => {\n const requestData: {\n address?: string;\n countryCode?: string;\n country?: string;\n state?: string;\n city?: string;\n postcode?: string;\n } = {};\n\n if (addressComponents) {\n const address = mapAddressComponents(addressComponents);\n\n if (address.route) {\n requestData.address =\n `${address.subpremise ? `${address.subpremise.longName}/` : ''}` +\n `${address.streetNumber ? address.streetNumber.longName : ''} ` +\n `${address.route.longName}`;\n }\n\n if (address.country) {\n requestData.countryCode = address.country.shortName;\n requestData.country = address.country.longName;\n }\n\n requestData.state = address.state ? address.state.longName : null;\n requestData.city = address.city ? address.city.longName : null;\n requestData.postcode = address.postcode ? address.postcode.longName : null;\n }\n\n return requestData;\n};\n\nexport const getAddressFromPlaceId = async (placeId: string) => {\n const results = await geocodeByPlaceId(placeId);\n const result = results?.[0];\n const latLng = await getLatLng(result);\n\n const addressComponents = parseAddress(result?.address_components);\n\n return {\n addressComponents,\n latLng\n };\n};\n"],"mappings":";;;;;AAIA,MAAM,EAAE,kBAAkB,kBAAkB,cAAc;AAC1D,MAAM,6BAA6B;CACjC,YAAY;CACZ,cAAc;CACd,OAAO;CACP,SAAS;CACT,OAAO;CACP,MAAM;CACN,UAAU;CACX;AACD,SAAgB,eACd,SACuF;AACvF,QAAO,IAAI,QAAQ,OAAO,KAAK,QAAQ;AACrC,MAAI;GACF,MAAM,UAAU,MAAM,iBAAiB,QAAQ;AAE/C,OAAI;IACF;IACA,QAHa,MAAM,UAAU,QAAQ,GAAG;IAIzC,CAAC;WACK,KAAK;AACZ,OAAI,QAAQ,mBACV,YAAW,YAAY;AAErB,QADe,eAAe,QAAQ,CAC3B;MACV,IAAK;OAER,KAAI,IAAI;;GAGZ;;AAEJ,MAAa,wBAAwB,sBAA8D;CACjG,MAAMA,aAAkC,EAAE;AAE1C,UAAS,oBAAmB,cAAa;AACvC,UAAQ,6BAA6B,SAAS,QAAQ;AACpD,OAAI,WAAW,QAAQ,OAAO,QAC5B,YAAW,OAAO;IAChB,UAAU,UAAU;IACpB,WAAW,UAAU;IACtB;IAEH;GACF;AAEF,QAAO;;AAET,MAAa,gBAAgB,sBAA8D;CACzF,MAAMC,cAOF,EAAE;AAEN,KAAI,mBAAmB;EACrB,MAAM,UAAU,qBAAqB,kBAAkB;AAEvD,MAAI,QAAQ,MACV,aAAY,UACV,GAAG,QAAQ,aAAa,GAAG,QAAQ,WAAW,SAAS,KAAK,KACzD,QAAQ,eAAe,QAAQ,aAAa,WAAW,GAAG,GAC1D,QAAQ,MAAM;AAGrB,MAAI,QAAQ,SAAS;AACnB,eAAY,cAAc,QAAQ,QAAQ;AAC1C,eAAY,UAAU,QAAQ,QAAQ;;AAGxC,cAAY,QAAQ,QAAQ,QAAQ,QAAQ,MAAM,WAAW;AAC7D,cAAY,OAAO,QAAQ,OAAO,QAAQ,KAAK,WAAW;AAC1D,cAAY,WAAW,QAAQ,WAAW,QAAQ,SAAS,WAAW;;AAGxE,QAAO;;AAGT,MAAa,wBAAwB,OAAO,YAAoB;CAE9D,MAAM,UADU,MAAM,iBAAiB,QAAQ,IACtB;CACzB,MAAM,SAAS,MAAM,UAAU,OAAO;AAItC,QAAO;EACL,mBAHwB,aAAa,QAAQ,mBAAmB;EAIhE;EACD"}
|
package/dist/masked.js
CHANGED
package/dist/masked.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"masked.js","names":["newData"],"sources":["../src/masked.ts"],"sourcesContent":["import _repeat from 'lodash/repeat';\nimport _forOwn from 'lodash/forOwn';\n\nconst MASK_CHAR = '*';\n\nconst _parse = (string: string | Record<string, any>) => {\n if (typeof string === 'string') {\n try {\n return JSON.parse(string);\n } catch (err) {\n return null;\n }\n }\n return null;\n};\nconst _maskedString = ({ length, maskChar }: { length: number; maskChar: string }) => _repeat(maskChar, length);\n\nconst masked = (\n data: Record<string, any> | string,\n keys: string[] | string,\n { omitKeys }: { omitKeys?: boolean } = {}\n) => {\n if (!data) {\n return null;\n }\n if (typeof data !== 'object' && !_parse(data)) {\n return data;\n }\n if (!keys || (!Array.isArray(keys) && typeof keys !== 'string')) {\n if (!keys) {\n throw new Error('Second parameter `keys` not given');\n }\n throw new TypeError(`Expected a string or array, got ${typeof keys}`);\n }\n\n let newData = _parse(data) || data;\n if (Array.isArray(newData)) {\n newData = newData.map(newData => {\n if (typeof newData !== 'object') {\n return newData;\n }\n return masked(newData, keys, { omitKeys });\n });\n } else {\n newData = { ...newData };\n _forOwn(newData, (value, key) => {\n if (typeof value === 'object') {\n if (Array.isArray(value) && Array.isArray(keys) && keys.includes(key)) {\n if (omitKeys) {\n delete newData[key];\n } else {\n newData[key] = value.map(() => _maskedString({ length: 8, maskChar: MASK_CHAR }));\n }\n } else {\n newData[key] = masked(value, keys, { omitKeys });\n }\n } else if (key === keys || (Array.isArray(keys) && keys.includes(key))) {\n if (omitKeys) {\n delete newData[key];\n } else {\n newData[key] = _maskedString({ length: 8, maskChar: MASK_CHAR });\n }\n }\n });\n }\n\n return typeof data === 'string' && _parse(data) ? JSON.stringify(newData) : newData;\n};\n\nexport default masked;\n"],"mappings":";;;;AAGA,MAAM,YAAY;AAElB,MAAM,UAAU,WAAyC;AACvD,KAAI,OAAO,WAAW,SACpB,KAAI;AACF,SAAO,KAAK,MAAM,OAAO;UAClB,KAAK;AACZ,SAAO;;AAGX,QAAO;;AAET,MAAM,iBAAiB,EAAE,QAAQ,eAAqD,QAAQ,UAAU,OAAO;AAE/G,MAAM,UACJ,MACA,MACA,EAAE,aAAqC,EAAE,KACtC;AACH,KAAI,CAAC,KACH,QAAO;AAET,KAAI,OAAO,SAAS,YAAY,CAAC,OAAO,KAAK,CAC3C,QAAO;AAET,KAAI,CAAC,QAAS,CAAC,MAAM,QAAQ,KAAK,IAAI,OAAO,SAAS,UAAW;AAC/D,MAAI,CAAC,KACH,OAAM,IAAI,MAAM,oCAAoC;AAEtD,QAAM,IAAI,UAAU,mCAAmC,OAAO,OAAO;;CAGvE,IAAI,UAAU,OAAO,KAAK,IAAI;AAC9B,KAAI,MAAM,QAAQ,QAAQ,CACxB,WAAU,QAAQ,KAAI,cAAW;AAC/B,MAAI,OAAOA,cAAY,SACrB,QAAOA;AAET,SAAO,OAAOA,WAAS,MAAM,EAAE,UAAU,CAAC;GAC1C;MACG;AACL,YAAU,EAAE,GAAG,SAAS;AACxB,UAAQ,UAAU,OAAO,QAAQ;AAC/B,OAAI,OAAO,UAAU,SACnB,KAAI,MAAM,QAAQ,MAAM,IAAI,MAAM,QAAQ,KAAK,IAAI,KAAK,SAAS,IAAI,CACnE,KAAI,SACF,QAAO,QAAQ;OAEf,SAAQ,OAAO,MAAM,UAAU,cAAc;IAAE,QAAQ;IAAG,UAAU;IAAW,CAAC,CAAC;OAGnF,SAAQ,OAAO,OAAO,OAAO,MAAM,EAAE,UAAU,CAAC;YAEzC,QAAQ,QAAS,MAAM,QAAQ,KAAK,IAAI,KAAK,SAAS,IAAI,CACnE,KAAI,SACF,QAAO,QAAQ;OAEf,SAAQ,OAAO,cAAc;IAAE,QAAQ;IAAG,UAAU;IAAW,CAAC;IAGpE;;AAGJ,QAAO,OAAO,SAAS,YAAY,OAAO,KAAK,GAAG,KAAK,UAAU,QAAQ,GAAG;;AAG9E,qBAAe"}
|
|
1
|
+
{"version":3,"file":"masked.js","names":["newData"],"sources":["../src/masked.ts"],"sourcesContent":["import _repeat from 'lodash/repeat.js';\nimport _forOwn from 'lodash/forOwn.js';\n\nconst MASK_CHAR = '*';\n\nconst _parse = (string: string | Record<string, any>) => {\n if (typeof string === 'string') {\n try {\n return JSON.parse(string);\n } catch (err) {\n return null;\n }\n }\n return null;\n};\nconst _maskedString = ({ length, maskChar }: { length: number; maskChar: string }) => _repeat(maskChar, length);\n\nconst masked = (\n data: Record<string, any> | string,\n keys: string[] | string,\n { omitKeys }: { omitKeys?: boolean } = {}\n) => {\n if (!data) {\n return null;\n }\n if (typeof data !== 'object' && !_parse(data)) {\n return data;\n }\n if (!keys || (!Array.isArray(keys) && typeof keys !== 'string')) {\n if (!keys) {\n throw new Error('Second parameter `keys` not given');\n }\n throw new TypeError(`Expected a string or array, got ${typeof keys}`);\n }\n\n let newData = _parse(data) || data;\n if (Array.isArray(newData)) {\n newData = newData.map(newData => {\n if (typeof newData !== 'object') {\n return newData;\n }\n return masked(newData, keys, { omitKeys });\n });\n } else {\n newData = { ...newData };\n _forOwn(newData, (value, key) => {\n if (typeof value === 'object') {\n if (Array.isArray(value) && Array.isArray(keys) && keys.includes(key)) {\n if (omitKeys) {\n delete newData[key];\n } else {\n newData[key] = value.map(() => _maskedString({ length: 8, maskChar: MASK_CHAR }));\n }\n } else {\n newData[key] = masked(value, keys, { omitKeys });\n }\n } else if (key === keys || (Array.isArray(keys) && keys.includes(key))) {\n if (omitKeys) {\n delete newData[key];\n } else {\n newData[key] = _maskedString({ length: 8, maskChar: MASK_CHAR });\n }\n }\n });\n }\n\n return typeof data === 'string' && _parse(data) ? JSON.stringify(newData) : newData;\n};\n\nexport default masked;\n"],"mappings":";;;;AAGA,MAAM,YAAY;AAElB,MAAM,UAAU,WAAyC;AACvD,KAAI,OAAO,WAAW,SACpB,KAAI;AACF,SAAO,KAAK,MAAM,OAAO;UAClB,KAAK;AACZ,SAAO;;AAGX,QAAO;;AAET,MAAM,iBAAiB,EAAE,QAAQ,eAAqD,QAAQ,UAAU,OAAO;AAE/G,MAAM,UACJ,MACA,MACA,EAAE,aAAqC,EAAE,KACtC;AACH,KAAI,CAAC,KACH,QAAO;AAET,KAAI,OAAO,SAAS,YAAY,CAAC,OAAO,KAAK,CAC3C,QAAO;AAET,KAAI,CAAC,QAAS,CAAC,MAAM,QAAQ,KAAK,IAAI,OAAO,SAAS,UAAW;AAC/D,MAAI,CAAC,KACH,OAAM,IAAI,MAAM,oCAAoC;AAEtD,QAAM,IAAI,UAAU,mCAAmC,OAAO,OAAO;;CAGvE,IAAI,UAAU,OAAO,KAAK,IAAI;AAC9B,KAAI,MAAM,QAAQ,QAAQ,CACxB,WAAU,QAAQ,KAAI,cAAW;AAC/B,MAAI,OAAOA,cAAY,SACrB,QAAOA;AAET,SAAO,OAAOA,WAAS,MAAM,EAAE,UAAU,CAAC;GAC1C;MACG;AACL,YAAU,EAAE,GAAG,SAAS;AACxB,UAAQ,UAAU,OAAO,QAAQ;AAC/B,OAAI,OAAO,UAAU,SACnB,KAAI,MAAM,QAAQ,MAAM,IAAI,MAAM,QAAQ,KAAK,IAAI,KAAK,SAAS,IAAI,CACnE,KAAI,SACF,QAAO,QAAQ;OAEf,SAAQ,OAAO,MAAM,UAAU,cAAc;IAAE,QAAQ;IAAG,UAAU;IAAW,CAAC,CAAC;OAGnF,SAAQ,OAAO,OAAO,OAAO,MAAM,EAAE,UAAU,CAAC;YAEzC,QAAQ,QAAS,MAAM,QAAQ,KAAK,IAAI,KAAK,SAAS,IAAI,CACnE,KAAI,SACF,QAAO,QAAQ;OAEf,SAAQ,OAAO,cAAc;IAAE,QAAQ;IAAG,UAAU;IAAW,CAAC;IAGpE;;AAGJ,QAAO,OAAO,SAAS,YAAY,OAAO,KAAK,GAAG,KAAK,UAAU,QAAQ,GAAG;;AAG9E,qBAAe"}
|
package/dist/products.js
CHANGED
package/dist/products.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"products.js","names":[],"sources":["../src/products.ts"],"sourcesContent":["import _get from 'lodash/get';\nimport { PRODUCTS } from './constants';\nexport const getProductType = (product: Record<string, any>) => {\n if (!product.fullName) {\n return;\n }\n\n const productType = product.fullName.split(':')[1];\n return productType;\n};\nexport const isBusinessProduct = (product: Record<string, any>) => _get(product, 'fullName', '').includes('business:');\nexport const isBasic = (product: Record<string, any>) => _get(product, 'fullName', '').includes(PRODUCTS.BASIC);\nexport const isPro = (product: Record<string, any>) => _get(product, 'fullName', '').includes(PRODUCTS.PRO);\n"],"mappings":";;;;AAEA,MAAa,kBAAkB,YAAiC;AAC9D,KAAI,CAAC,QAAQ,SACX;AAIF,QADoB,QAAQ,SAAS,MAAM,IAAI,CAAC;;AAGlD,MAAa,qBAAqB,YAAiC,KAAK,SAAS,YAAY,GAAG,CAAC,SAAS,YAAY;AACtH,MAAa,WAAW,YAAiC,KAAK,SAAS,YAAY,GAAG,CAAC,SAAS,SAAS,MAAM;AAC/G,MAAa,SAAS,YAAiC,KAAK,SAAS,YAAY,GAAG,CAAC,SAAS,SAAS,IAAI"}
|
|
1
|
+
{"version":3,"file":"products.js","names":[],"sources":["../src/products.ts"],"sourcesContent":["import _get from 'lodash/get.js';\nimport { PRODUCTS } from './constants';\nexport const getProductType = (product: Record<string, any>) => {\n if (!product.fullName) {\n return;\n }\n\n const productType = product.fullName.split(':')[1];\n return productType;\n};\nexport const isBusinessProduct = (product: Record<string, any>) => _get(product, 'fullName', '').includes('business:');\nexport const isBasic = (product: Record<string, any>) => _get(product, 'fullName', '').includes(PRODUCTS.BASIC);\nexport const isPro = (product: Record<string, any>) => _get(product, 'fullName', '').includes(PRODUCTS.PRO);\n"],"mappings":";;;;AAEA,MAAa,kBAAkB,YAAiC;AAC9D,KAAI,CAAC,QAAQ,SACX;AAIF,QADoB,QAAQ,SAAS,MAAM,IAAI,CAAC;;AAGlD,MAAa,qBAAqB,YAAiC,KAAK,SAAS,YAAY,GAAG,CAAC,SAAS,YAAY;AACtH,MAAa,WAAW,YAAiC,KAAK,SAAS,YAAY,GAAG,CAAC,SAAS,SAAS,MAAM;AAC/G,MAAa,SAAS,YAAiC,KAAK,SAAS,YAAY,GAAG,CAAC,SAAS,SAAS,IAAI"}
|
package/dist/redux-actions.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redux-actions.js","names":[],"sources":["../src/redux-actions.ts"],"sourcesContent":["import _get from 'lodash/get';\nconst REQUEST = 'REQUEST';\nconst SUCCESS = 'SUCCESS';\nconst FAILURE = 'FAILURE';\nexport const CLEAR_ALL_STATE = 'CLEAR_ALL_STATE';\nexport const CLEAR_VALUE = 'CLEAR_VALUE';\nexport const SET_VALUE = 'SET_VALUE';\n// @ts-expect-error TS(7006): Parameter 'type' implicitly has an 'any' type.\nexport const action = (type, payload = {}) => ({\n type,\n ...payload\n});\n// @ts-expect-error TS(7006): Parameter 'keys' implicitly has an 'any' type.\nexport const clear = keys => ({\n type: CLEAR_VALUE,\n keys\n});\n// @ts-expect-error TS(7006): Parameter 'key' implicitly has an 'any' type.\nexport const set = (key, value) => ({\n type: SET_VALUE,\n key,\n value\n});\n// @ts-expect-error TS(7006): Parameter 'base' implicitly has an 'any' type.\nexport function createRequestTypes(base): { REQUEST?: string; SUCCESS?: string; FAILURE?: string } {\n return [REQUEST, SUCCESS, FAILURE].reduce((acc, type) => {\n const a = acc;\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n a[type] = `${base}_${type}`;\n return a;\n }, {});\n}\n\nexport function clearAllState() {\n return {\n type: CLEAR_ALL_STATE\n };\n}\n// @ts-expect-error TS(7006): Parameter 'type' implicitly has an 'any' type.\nexport function receiveError(type, err) {\n return {\n type,\n err\n };\n}\n// @ts-expect-error TS(7006): Parameter 'type' implicitly has an 'any' type.\nexport function receiveSuccess(type, data) {\n return {\n type,\n data\n };\n}\n// @ts-expect-error TS(7006): Parameter 'type' implicitly has an 'any' type.\nexport function request(type, endpoint, data = null) {\n return {\n type,\n endpoint,\n data\n };\n}\nexport const sdkActionCreator =\n // @ts-expect-error TS(7006): Parameter 'sdkAction' implicitly has an 'any' type... Remove this comment to see the full error message\n\n\n (sdkAction, actions = {}, funcs = {}) =>\n // @ts-expect-error TS(7006): Parameter 'dispatch' implicitly has an 'any' type.\n async dispatch => {\n // @ts-expect-error TS(2339): Property 'request' does not exist on type '{}'.\n if (actions.request) {\n // @ts-expect-error TS(2339): Property 'request' does not exist on type '{}'.\n dispatch(actions.request());\n }\n\n try {\n const data = await sdkAction();\n\n // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.\n if (actions.success) {\n // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.\n dispatch(actions.success(data));\n }\n\n // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.\n if (funcs.success) {\n // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.\n funcs.success(data);\n }\n\n return data;\n } catch (err) {\n const errorData = _get(err, 'data', err || 'An error occured!') as { statusCode?: number; message?: string };\n\n if (errorData.statusCode === 403 && !errorData.message) {\n errorData.message = 'You are forbidden to view this resource.';\n }\n\n // @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.\n if (actions.failure) {\n // @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.\n dispatch(actions.failure(errorData));\n }\n\n // @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.\n if (funcs.failure) {\n // @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.\n funcs.failure(errorData);\n }\n\n throw err;\n }\n };\nconst reduxActions = {};\n\nexport default reduxActions;\n"],"mappings":";;;AACA,MAAM,UAAU;AAChB,MAAM,UAAU;AAChB,MAAM,UAAU;AAChB,MAAa,kBAAkB;AAC/B,MAAa,cAAc;AAC3B,MAAa,YAAY;AAEzB,MAAa,UAAU,MAAM,UAAU,EAAE,MAAM;CAC7C;CACA,GAAG;CACJ;AAED,MAAa,SAAQ,UAAS;CAC5B,MAAM;CACN;CACD;AAED,MAAa,OAAO,KAAK,WAAW;CAClC,MAAM;CACN;CACA;CACD;AAED,SAAgB,mBAAmB,MAAgE;AACjG,QAAO;EAAC;EAAS;EAAS;EAAQ,CAAC,QAAQ,KAAK,SAAS;EACvD,MAAM,IAAI;AAEV,IAAE,QAAQ,GAAG,KAAK,GAAG;AACrB,SAAO;IACN,EAAE,CAAC;;AAGR,SAAgB,gBAAgB;AAC9B,QAAO,EACL,MAAM,iBACP;;AAGH,SAAgB,aAAa,MAAM,KAAK;AACtC,QAAO;EACL;EACA;EACD;;AAGH,SAAgB,eAAe,MAAM,MAAM;AACzC,QAAO;EACL;EACA;EACD;;AAGH,SAAgB,QAAQ,MAAM,UAAU,OAAO,MAAM;AACnD,QAAO;EACL;EACA;EACA;EACD;;AAEH,MAAa,oBAIR,WAAW,UAAU,EAAE,EAAE,QAAQ,EAAE,KAEpC,OAAM,aAAY;AAEhB,KAAI,QAAQ,QAEV,UAAS,QAAQ,SAAS,CAAC;AAG7B,KAAI;EACF,MAAM,OAAO,MAAM,WAAW;AAG9B,MAAI,QAAQ,QAEV,UAAS,QAAQ,QAAQ,KAAK,CAAC;AAIjC,MAAI,MAAM,QAER,OAAM,QAAQ,KAAK;AAGrB,SAAO;UACA,KAAK;EACZ,MAAM,YAAY,KAAK,KAAK,QAAQ,OAAO,oBAAoB;AAE/D,MAAI,UAAU,eAAe,OAAO,CAAC,UAAU,QAC7C,WAAU,UAAU;AAItB,MAAI,QAAQ,QAEV,UAAS,QAAQ,QAAQ,UAAU,CAAC;AAItC,MAAI,MAAM,QAER,OAAM,QAAQ,UAAU;AAG1B,QAAM;;;AAGd,MAAM,eAAe,EAAE;AAEvB,4BAAe"}
|
|
1
|
+
{"version":3,"file":"redux-actions.js","names":[],"sources":["../src/redux-actions.ts"],"sourcesContent":["import _get from 'lodash/get.js';\nconst REQUEST = 'REQUEST';\nconst SUCCESS = 'SUCCESS';\nconst FAILURE = 'FAILURE';\nexport const CLEAR_ALL_STATE = 'CLEAR_ALL_STATE';\nexport const CLEAR_VALUE = 'CLEAR_VALUE';\nexport const SET_VALUE = 'SET_VALUE';\n// @ts-expect-error TS(7006): Parameter 'type' implicitly has an 'any' type.\nexport const action = (type, payload = {}) => ({\n type,\n ...payload\n});\n// @ts-expect-error TS(7006): Parameter 'keys' implicitly has an 'any' type.\nexport const clear = keys => ({\n type: CLEAR_VALUE,\n keys\n});\n// @ts-expect-error TS(7006): Parameter 'key' implicitly has an 'any' type.\nexport const set = (key, value) => ({\n type: SET_VALUE,\n key,\n value\n});\n// @ts-expect-error TS(7006): Parameter 'base' implicitly has an 'any' type.\nexport function createRequestTypes(base): { REQUEST?: string; SUCCESS?: string; FAILURE?: string } {\n return [REQUEST, SUCCESS, FAILURE].reduce((acc, type) => {\n const a = acc;\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n a[type] = `${base}_${type}`;\n return a;\n }, {});\n}\n\nexport function clearAllState() {\n return {\n type: CLEAR_ALL_STATE\n };\n}\n// @ts-expect-error TS(7006): Parameter 'type' implicitly has an 'any' type.\nexport function receiveError(type, err) {\n return {\n type,\n err\n };\n}\n// @ts-expect-error TS(7006): Parameter 'type' implicitly has an 'any' type.\nexport function receiveSuccess(type, data) {\n return {\n type,\n data\n };\n}\n// @ts-expect-error TS(7006): Parameter 'type' implicitly has an 'any' type.\nexport function request(type, endpoint, data = null) {\n return {\n type,\n endpoint,\n data\n };\n}\nexport const sdkActionCreator =\n // @ts-expect-error TS(7006): Parameter 'sdkAction' implicitly has an 'any' type... Remove this comment to see the full error message\n\n\n (sdkAction, actions = {}, funcs = {}) =>\n // @ts-expect-error TS(7006): Parameter 'dispatch' implicitly has an 'any' type.\n async dispatch => {\n // @ts-expect-error TS(2339): Property 'request' does not exist on type '{}'.\n if (actions.request) {\n // @ts-expect-error TS(2339): Property 'request' does not exist on type '{}'.\n dispatch(actions.request());\n }\n\n try {\n const data = await sdkAction();\n\n // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.\n if (actions.success) {\n // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.\n dispatch(actions.success(data));\n }\n\n // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.\n if (funcs.success) {\n // @ts-expect-error TS(2339): Property 'success' does not exist on type '{}'.\n funcs.success(data);\n }\n\n return data;\n } catch (err) {\n const errorData = _get(err, 'data', err || 'An error occured!') as { statusCode?: number; message?: string };\n\n if (errorData.statusCode === 403 && !errorData.message) {\n errorData.message = 'You are forbidden to view this resource.';\n }\n\n // @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.\n if (actions.failure) {\n // @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.\n dispatch(actions.failure(errorData));\n }\n\n // @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.\n if (funcs.failure) {\n // @ts-expect-error TS(2339): Property 'failure' does not exist on type '{}'.\n funcs.failure(errorData);\n }\n\n throw err;\n }\n };\nconst reduxActions = {};\n\nexport default reduxActions;\n"],"mappings":";;;AACA,MAAM,UAAU;AAChB,MAAM,UAAU;AAChB,MAAM,UAAU;AAChB,MAAa,kBAAkB;AAC/B,MAAa,cAAc;AAC3B,MAAa,YAAY;AAEzB,MAAa,UAAU,MAAM,UAAU,EAAE,MAAM;CAC7C;CACA,GAAG;CACJ;AAED,MAAa,SAAQ,UAAS;CAC5B,MAAM;CACN;CACD;AAED,MAAa,OAAO,KAAK,WAAW;CAClC,MAAM;CACN;CACA;CACD;AAED,SAAgB,mBAAmB,MAAgE;AACjG,QAAO;EAAC;EAAS;EAAS;EAAQ,CAAC,QAAQ,KAAK,SAAS;EACvD,MAAM,IAAI;AAEV,IAAE,QAAQ,GAAG,KAAK,GAAG;AACrB,SAAO;IACN,EAAE,CAAC;;AAGR,SAAgB,gBAAgB;AAC9B,QAAO,EACL,MAAM,iBACP;;AAGH,SAAgB,aAAa,MAAM,KAAK;AACtC,QAAO;EACL;EACA;EACD;;AAGH,SAAgB,eAAe,MAAM,MAAM;AACzC,QAAO;EACL;EACA;EACD;;AAGH,SAAgB,QAAQ,MAAM,UAAU,OAAO,MAAM;AACnD,QAAO;EACL;EACA;EACA;EACD;;AAEH,MAAa,oBAIR,WAAW,UAAU,EAAE,EAAE,QAAQ,EAAE,KAEpC,OAAM,aAAY;AAEhB,KAAI,QAAQ,QAEV,UAAS,QAAQ,SAAS,CAAC;AAG7B,KAAI;EACF,MAAM,OAAO,MAAM,WAAW;AAG9B,MAAI,QAAQ,QAEV,UAAS,QAAQ,QAAQ,KAAK,CAAC;AAIjC,MAAI,MAAM,QAER,OAAM,QAAQ,KAAK;AAGrB,SAAO;UACA,KAAK;EACZ,MAAM,YAAY,KAAK,KAAK,QAAQ,OAAO,oBAAoB;AAE/D,MAAI,UAAU,eAAe,OAAO,CAAC,UAAU,QAC7C,WAAU,UAAU;AAItB,MAAI,QAAQ,QAEV,UAAS,QAAQ,QAAQ,UAAU,CAAC;AAItC,MAAI,MAAM,QAER,OAAM,QAAQ,UAAU;AAG1B,QAAM;;;AAGd,MAAM,eAAe,EAAE;AAEvB,4BAAe"}
|
package/dist/redux-reducer.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { CLEAR_ALL_STATE, CLEAR_VALUE, SET_VALUE } from "./redux-actions.js";
|
|
2
|
-
import _set from "lodash/set";
|
|
3
|
-
import _pick from "lodash/pick";
|
|
2
|
+
import _set from "lodash/set.js";
|
|
3
|
+
import _pick from "lodash/pick.js";
|
|
4
4
|
|
|
5
5
|
//#region src/redux-reducer.ts
|
|
6
6
|
const request = (state, { isFetchingKey = "isFetching", hasFetchedKey = "hasFetched", persistState = true } = {}) => ({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"redux-reducer.js","names":[],"sources":["../src/redux-reducer.ts"],"sourcesContent":["import _set from 'lodash/set';\nimport _pick from 'lodash/pick';\nimport { CLEAR_ALL_STATE, CLEAR_VALUE, SET_VALUE } from './redux-actions';\nexport const request = (\n // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.\n state,\n { isFetchingKey = 'isFetching', hasFetchedKey = 'hasFetched', persistState = true } = {}\n) => ({ ...(persistState ? state : {}), [isFetchingKey]: true, [hasFetchedKey]: false });\nexport const oneSuccess = (\n // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.\n state,\n // @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.\n action,\n { isFetchingKey = 'isFetching', hasFetchedKey = 'hasFetched', persistState = false } = {}\n) => ({ ...(persistState ? state : {}), [isFetchingKey]: false, [hasFetchedKey]: true, data: action.payload });\nexport const paginatedListSuccess = (\n // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.\n state,\n // @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.\n action,\n { isFetchingKey = 'isFetching', hasFetchedKey = 'hasFetched' } = {}\n) => {\n const payload = { ...action.payload };\n\n if (payload.meta) {\n payload.meta = { ...payload.meta, currentPage: action.currentPage || 1 };\n }\n\n return { ...payload, [isFetchingKey]: false, [hasFetchedKey]: true };\n};\nexport const failure = (\n // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.\n state,\n // @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.\n action,\n { isFetchingKey = 'isFetching', hasFetchedKey = 'hasFetched', persistState = false } = {}\n) => ({ ...(persistState ? state : {}), [isFetchingKey]: false, [hasFetchedKey]: false, error: action.payload });\nexport const getRootReducer =\n (\n // @ts-expect-error TS(7006): Parameter 'appReducer' implicitly has an 'any' typ... Remove this comment to see the full error message\n appReducer,\n { persistKeys } = {\n persistKeys: {}\n }\n ) =>\n // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.\n (state, action) => {\n let newState = { ...state };\n\n if (action.type === CLEAR_ALL_STATE) {\n // @ts-expect-error TS(2769): No overload matches this call.\n newState = { ..._pick(state, persistKeys) };\n }\n\n if (action.type === CLEAR_VALUE) {\n // @ts-expect-error TS(7006): Parameter 'key' implicitly has an 'any' type.\n action.keys.forEach(key => _set(newState, key, {}));\n newState = { ...state, ...newState };\n }\n\n if (action.type === SET_VALUE) {\n newState = { ...newState, [action.key]: action.value };\n }\n\n return appReducer(newState, action);\n };\nconst reduxReducer = {};\n\nexport default reduxReducer;\n"],"mappings":";;;;;AAGA,MAAa,WAEX,OACA,EAAE,gBAAgB,cAAc,gBAAgB,cAAc,eAAe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],"sources":["../src/redux-reducer.ts"],"sourcesContent":["import _set from 'lodash/set.js';\nimport _pick from 'lodash/pick.js';\nimport { CLEAR_ALL_STATE, CLEAR_VALUE, SET_VALUE } from './redux-actions';\nexport const request = (\n // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.\n state,\n { isFetchingKey = 'isFetching', hasFetchedKey = 'hasFetched', persistState = true } = {}\n) => ({ ...(persistState ? state : {}), [isFetchingKey]: true, [hasFetchedKey]: false });\nexport const oneSuccess = (\n // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.\n state,\n // @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.\n action,\n { isFetchingKey = 'isFetching', hasFetchedKey = 'hasFetched', persistState = false } = {}\n) => ({ ...(persistState ? state : {}), [isFetchingKey]: false, [hasFetchedKey]: true, data: action.payload });\nexport const paginatedListSuccess = (\n // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.\n state,\n // @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.\n action,\n { isFetchingKey = 'isFetching', hasFetchedKey = 'hasFetched' } = {}\n) => {\n const payload = { ...action.payload };\n\n if (payload.meta) {\n payload.meta = { ...payload.meta, currentPage: action.currentPage || 1 };\n }\n\n return { ...payload, [isFetchingKey]: false, [hasFetchedKey]: true };\n};\nexport const failure = (\n // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.\n state,\n // @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.\n action,\n { isFetchingKey = 'isFetching', hasFetchedKey = 'hasFetched', persistState = false } = {}\n) => ({ ...(persistState ? state : {}), [isFetchingKey]: false, [hasFetchedKey]: false, error: action.payload });\nexport const getRootReducer =\n (\n // @ts-expect-error TS(7006): Parameter 'appReducer' implicitly has an 'any' typ... Remove this comment to see the full error message\n appReducer,\n { persistKeys } = {\n persistKeys: {}\n }\n ) =>\n // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.\n (state, action) => {\n let newState = { ...state };\n\n if (action.type === CLEAR_ALL_STATE) {\n // @ts-expect-error TS(2769): No overload matches this call.\n newState = { ..._pick(state, persistKeys) };\n }\n\n if (action.type === CLEAR_VALUE) {\n // @ts-expect-error TS(7006): Parameter 'key' implicitly has an 'any' type.\n action.keys.forEach(key => _set(newState, key, {}));\n newState = { ...state, ...newState };\n }\n\n if (action.type === SET_VALUE) {\n newState = { ...newState, [action.key]: action.value };\n }\n\n return appReducer(newState, action);\n };\nconst reduxReducer = {};\n\nexport default reduxReducer;\n"],"mappings":";;;;;AAGA,MAAa,WAEX,OACA,EAAE,gBAAgB,cAAc,gBAAgB,cAAc,eAAe,SAAS,EAAE,MACpF;CAAE,GAAI,eAAe,QAAQ,EAAE;EAAI,gBAAgB;EAAO,gBAAgB;CAAO;AACvF,MAAa,cAEX,OAEA,QACA,EAAE,gBAAgB,cAAc,gBAAgB,cAAc,eAAe,UAAU,EAAE,MACrF;CAAE,GAAI,eAAe,QAAQ,EAAE;EAAI,gBAAgB;EAAQ,gBAAgB;CAAM,MAAM,OAAO;CAAS;AAC7G,MAAa,wBAEX,OAEA,QACA,EAAE,gBAAgB,cAAc,gBAAgB,iBAAiB,EAAE,KAChE;CACH,MAAM,UAAU,EAAE,GAAG,OAAO,SAAS;AAErC,KAAI,QAAQ,KACV,SAAQ,OAAO;EAAE,GAAG,QAAQ;EAAM,aAAa,OAAO,eAAe;EAAG;AAG1E,QAAO;EAAE,GAAG;GAAU,gBAAgB;GAAQ,gBAAgB;EAAM;;AAEtE,MAAa,WAEX,OAEA,QACA,EAAE,gBAAgB,cAAc,gBAAgB,cAAc,eAAe,UAAU,EAAE,MACrF;CAAE,GAAI,eAAe,QAAQ,EAAE;EAAI,gBAAgB;EAAQ,gBAAgB;CAAO,OAAO,OAAO;CAAS;AAC/G,MAAa,kBAGT,YACA,EAAE,gBAAgB,EAChB,aAAa,EAAE,EAChB,MAGF,OAAO,WAAW;CACjB,IAAI,WAAW,EAAE,GAAG,OAAO;AAE3B,KAAI,OAAO,SAAS,gBAElB,YAAW,EAAE,GAAG,MAAM,OAAO,YAAY,EAAE;AAG7C,KAAI,OAAO,SAAS,aAAa;AAE/B,SAAO,KAAK,SAAQ,QAAO,KAAK,UAAU,KAAK,EAAE,CAAC,CAAC;AACnD,aAAW;GAAE,GAAG;GAAO,GAAG;GAAU;;AAGtC,KAAI,OAAO,SAAS,UAClB,YAAW;EAAE,GAAG;GAAW,OAAO,MAAM,OAAO;EAAO;AAGxD,QAAO,WAAW,UAAU,OAAO;;AAEvC,MAAM,eAAe,EAAE;AAEvB,4BAAe"}
|
package/dist/sentry.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { getProcessEnv } from "./process-env.js";
|
|
2
2
|
import masked_default from "./masked.js";
|
|
3
3
|
import sensitive_keys_default from "./sensitive-keys.js";
|
|
4
|
-
import _get from "lodash/get";
|
|
4
|
+
import _get from "lodash/get.js";
|
|
5
5
|
import * as Sentry from "@sentry/browser";
|
|
6
6
|
import createSentryMiddleware from "redux-sentry-middleware";
|
|
7
|
-
import _set from "lodash/set";
|
|
7
|
+
import _set from "lodash/set.js";
|
|
8
8
|
|
|
9
9
|
//#region src/sentry.ts
|
|
10
10
|
const ERROR_CODES = { INVALID_AUTHENTICATION: 10007 };
|
package/dist/sentry.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sentry.js","names":["masked","sensitiveKeys"],"sources":["../src/sentry.ts"],"sourcesContent":["import * as Sentry from '@sentry/browser';\n// @ts-expect-error TS(7016): Could not find a declaration file for module 'redu... Remove this comment to see the full error message\nimport createSentryMiddleware from 'redux-sentry-middleware';\nimport masked from './masked';\nimport _get from 'lodash/get';\nimport _set from 'lodash/set';\nimport sensitiveKeys from './sensitive-keys';\nimport { getProcessEnv } from './process-env';\nconst ERROR_CODES = {\n INVALID_AUTHENTICATION: 10007\n};\nconst ERROR_MESSAGES = {\n NETWORK_ERROR: 'Network Error'\n};\nconst STATUS_CODES = {\n UNAUTHORIZED: 401,\n SERVER_ERROR: 500\n};\n\n// @ts-expect-error TS(7006): Parameter 'error' implicitly has an 'any' type.\nconst _ignore = error =>\n getProcessEnv().NODE_ENV === 'test' ||\n error.message === ERROR_MESSAGES.NETWORK_ERROR ||\n _get(error, 'data.statusCode') === STATUS_CODES.UNAUTHORIZED ||\n _get(error, 'data.statusCode') >= STATUS_CODES.SERVER_ERROR ||\n _get(error, 'data.errorCode') === ERROR_CODES.INVALID_AUTHENTICATION;\n\n// @ts-expect-error TS(2554): Expected 1 arguments, but got 0.\nexport const clearUserContext = () => Sentry.setUser();\nexport const createReduxMiddleware = () =>\n createSentryMiddleware(Sentry, {\n // @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.\n actionTransformer: action => masked(action, sensitiveKeys),\n // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.\n stateTransformer: state => masked(state, sensitiveKeys)\n });\nexport const logError = (\n // @ts-expect-error TS(7006): Parameter '_error' implicitly has an 'any' type.\n _error,\n {\n // @ts-expect-error TS(2525): Initializer provides no value for this binding ele... Remove this comment to see the full error message\n name,\n // @ts-expect-error TS(2525): Initializer provides no value for this binding ele... Remove this comment to see the full error message\n data\n } = {}\n) => {\n let error = _error;\n\n if (error instanceof Error) {\n // @ts-expect-error TS(2339): Property 'config' does not exist on type 'Error'.\n const errorHeaders = error?.config?.headers;\n const maskedErrorHeaders = masked(errorHeaders, ['Authorization']);\n error = _set(error, 'config.headers', maskedErrorHeaders);\n\n try {\n const errorData = error?.config?.data;\n const maskedErrorData = masked(JSON.parse(errorData), sensitiveKeys);\n error = _set(error, 'config.data', JSON.stringify(maskedErrorData));\n } catch (err) {}\n }\n\n if (_ignore(error)) {\n return null;\n }\n\n Sentry.withScope(scope => {\n scope.setExtra('error', error);\n scope.setExtra('data', masked(data, sensitiveKeys));\n\n const message = _get(error, 'data.message', error.message);\n\n const sentryError = error instanceof Error ? error : new Error(message);\n\n if (name) {\n sentryError.name = name || message;\n }\n\n Sentry.captureException(sentryError);\n });\n console.error(error);\n};\n// @ts-expect-error TS(7031): Binding element 'environment' implicitly has an 'a... Remove this comment to see the full error message\nexport const setup = ({ environment, url, version }) => {\n if (window.location.hostname !== 'localhost') {\n Sentry.init({\n dsn: url,\n environment,\n release: version\n });\n }\n};\n// @ts-expect-error TS(7006): Parameter 'user' implicitly has an 'any' type.\nexport const setUserContext = user => Sentry.setUser(masked(user, sensitiveKeys));\n// @ts-expect-error TS(7006): Parameter 'key' implicitly has an 'any' type.\nexport const setTag = (key, value) => Sentry.setTag(key, value);\nconst sentry = {};\n\nexport default sentry;\n"],"mappings":";;;;;;;;;AAQA,MAAM,cAAc,EAClB,wBAAwB,OACzB;AACD,MAAM,iBAAiB,EACrB,eAAe,iBAChB;AACD,MAAM,eAAe;CACnB,cAAc;CACd,cAAc;CACf;AAGD,MAAM,WAAU,UACd,eAAe,CAAC,aAAa,UAC7B,MAAM,YAAY,eAAe,iBACjC,KAAK,OAAO,kBAAkB,KAAK,aAAa,gBAChD,KAAK,OAAO,kBAAkB,IAAI,aAAa,gBAC/C,KAAK,OAAO,iBAAiB,KAAK,YAAY;AAGhD,MAAa,yBAAyB,OAAO,SAAS;AACtD,MAAa,8BACX,uBAAuB,QAAQ;CAE7B,oBAAmB,WAAUA,eAAO,QAAQC,uBAAc;CAE1D,mBAAkB,UAASD,eAAO,OAAOC,uBAAc;CACxD,CAAC;AACJ,MAAa,YAEX,QACA,EAEE,MAEA,SACE,EAAE,KACH;CACH,IAAI,QAAQ;AAEZ,KAAI,iBAAiB,OAAO;EAE1B,MAAM,eAAe,OAAO,QAAQ;EACpC,MAAM,qBAAqBD,eAAO,cAAc,CAAC,gBAAgB,CAAC;AAClE,UAAQ,KAAK,OAAO,kBAAkB,mBAAmB;AAEzD,MAAI;GACF,MAAM,YAAY,OAAO,QAAQ;GACjC,MAAM,kBAAkBA,eAAO,KAAK,MAAM,UAAU,EAAEC,uBAAc;AACpE,WAAQ,KAAK,OAAO,eAAe,KAAK,UAAU,gBAAgB,CAAC;WAC5D,KAAK;;AAGhB,KAAI,QAAQ,MAAM,CAChB,QAAO;AAGT,QAAO,WAAU,UAAS;AACxB,QAAM,SAAS,SAAS,MAAM;AAC9B,QAAM,SAAS,QAAQD,eAAO,MAAMC,uBAAc,CAAC;EAEnD,MAAM,UAAU,KAAK,OAAO,gBAAgB,MAAM,QAAQ;EAE1D,MAAM,cAAc,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,QAAQ;AAEvE,MAAI,KACF,aAAY,OAAO,QAAQ;AAG7B,SAAO,iBAAiB,YAAY;GACpC;AACF,SAAQ,MAAM,MAAM;;AAGtB,MAAa,SAAS,EAAE,aAAa,KAAK,cAAc;AACtD,KAAI,OAAO,SAAS,aAAa,YAC/B,QAAO,KAAK;EACV,KAAK;EACL;EACA,SAAS;EACV,CAAC;;AAIN,MAAa,kBAAiB,SAAQ,OAAO,QAAQD,eAAO,MAAMC,uBAAc,CAAC;AAEjF,MAAa,UAAU,KAAK,UAAU,OAAO,OAAO,KAAK,MAAM;AAC/D,MAAM,SAAS,EAAE;AAEjB,qBAAe"}
|
|
1
|
+
{"version":3,"file":"sentry.js","names":["masked","sensitiveKeys"],"sources":["../src/sentry.ts"],"sourcesContent":["import * as Sentry from '@sentry/browser';\n// @ts-expect-error TS(7016): Could not find a declaration file for module 'redu... Remove this comment to see the full error message\nimport createSentryMiddleware from 'redux-sentry-middleware';\nimport masked from './masked';\nimport _get from 'lodash/get.js';\nimport _set from 'lodash/set.js';\nimport sensitiveKeys from './sensitive-keys';\nimport { getProcessEnv } from './process-env';\nconst ERROR_CODES = {\n INVALID_AUTHENTICATION: 10007\n};\nconst ERROR_MESSAGES = {\n NETWORK_ERROR: 'Network Error'\n};\nconst STATUS_CODES = {\n UNAUTHORIZED: 401,\n SERVER_ERROR: 500\n};\n\n// @ts-expect-error TS(7006): Parameter 'error' implicitly has an 'any' type.\nconst _ignore = error =>\n getProcessEnv().NODE_ENV === 'test' ||\n error.message === ERROR_MESSAGES.NETWORK_ERROR ||\n _get(error, 'data.statusCode') === STATUS_CODES.UNAUTHORIZED ||\n _get(error, 'data.statusCode') >= STATUS_CODES.SERVER_ERROR ||\n _get(error, 'data.errorCode') === ERROR_CODES.INVALID_AUTHENTICATION;\n\n// @ts-expect-error TS(2554): Expected 1 arguments, but got 0.\nexport const clearUserContext = () => Sentry.setUser();\nexport const createReduxMiddleware = () =>\n createSentryMiddleware(Sentry, {\n // @ts-expect-error TS(7006): Parameter 'action' implicitly has an 'any' type.\n actionTransformer: action => masked(action, sensitiveKeys),\n // @ts-expect-error TS(7006): Parameter 'state' implicitly has an 'any' type.\n stateTransformer: state => masked(state, sensitiveKeys)\n });\nexport const logError = (\n // @ts-expect-error TS(7006): Parameter '_error' implicitly has an 'any' type.\n _error,\n {\n // @ts-expect-error TS(2525): Initializer provides no value for this binding ele... Remove this comment to see the full error message\n name,\n // @ts-expect-error TS(2525): Initializer provides no value for this binding ele... Remove this comment to see the full error message\n data\n } = {}\n) => {\n let error = _error;\n\n if (error instanceof Error) {\n // @ts-expect-error TS(2339): Property 'config' does not exist on type 'Error'.\n const errorHeaders = error?.config?.headers;\n const maskedErrorHeaders = masked(errorHeaders, ['Authorization']);\n error = _set(error, 'config.headers', maskedErrorHeaders);\n\n try {\n const errorData = error?.config?.data;\n const maskedErrorData = masked(JSON.parse(errorData), sensitiveKeys);\n error = _set(error, 'config.data', JSON.stringify(maskedErrorData));\n } catch (err) {}\n }\n\n if (_ignore(error)) {\n return null;\n }\n\n Sentry.withScope(scope => {\n scope.setExtra('error', error);\n scope.setExtra('data', masked(data, sensitiveKeys));\n\n const message = _get(error, 'data.message', error.message);\n\n const sentryError = error instanceof Error ? error : new Error(message);\n\n if (name) {\n sentryError.name = name || message;\n }\n\n Sentry.captureException(sentryError);\n });\n console.error(error);\n};\n// @ts-expect-error TS(7031): Binding element 'environment' implicitly has an 'a... Remove this comment to see the full error message\nexport const setup = ({ environment, url, version }) => {\n if (window.location.hostname !== 'localhost') {\n Sentry.init({\n dsn: url,\n environment,\n release: version\n });\n }\n};\n// @ts-expect-error TS(7006): Parameter 'user' implicitly has an 'any' type.\nexport const setUserContext = user => Sentry.setUser(masked(user, sensitiveKeys));\n// @ts-expect-error TS(7006): Parameter 'key' implicitly has an 'any' type.\nexport const setTag = (key, value) => Sentry.setTag(key, value);\nconst sentry = {};\n\nexport default sentry;\n"],"mappings":";;;;;;;;;AAQA,MAAM,cAAc,EAClB,wBAAwB,OACzB;AACD,MAAM,iBAAiB,EACrB,eAAe,iBAChB;AACD,MAAM,eAAe;CACnB,cAAc;CACd,cAAc;CACf;AAGD,MAAM,WAAU,UACd,eAAe,CAAC,aAAa,UAC7B,MAAM,YAAY,eAAe,iBACjC,KAAK,OAAO,kBAAkB,KAAK,aAAa,gBAChD,KAAK,OAAO,kBAAkB,IAAI,aAAa,gBAC/C,KAAK,OAAO,iBAAiB,KAAK,YAAY;AAGhD,MAAa,yBAAyB,OAAO,SAAS;AACtD,MAAa,8BACX,uBAAuB,QAAQ;CAE7B,oBAAmB,WAAUA,eAAO,QAAQC,uBAAc;CAE1D,mBAAkB,UAASD,eAAO,OAAOC,uBAAc;CACxD,CAAC;AACJ,MAAa,YAEX,QACA,EAEE,MAEA,SACE,EAAE,KACH;CACH,IAAI,QAAQ;AAEZ,KAAI,iBAAiB,OAAO;EAE1B,MAAM,eAAe,OAAO,QAAQ;EACpC,MAAM,qBAAqBD,eAAO,cAAc,CAAC,gBAAgB,CAAC;AAClE,UAAQ,KAAK,OAAO,kBAAkB,mBAAmB;AAEzD,MAAI;GACF,MAAM,YAAY,OAAO,QAAQ;GACjC,MAAM,kBAAkBA,eAAO,KAAK,MAAM,UAAU,EAAEC,uBAAc;AACpE,WAAQ,KAAK,OAAO,eAAe,KAAK,UAAU,gBAAgB,CAAC;WAC5D,KAAK;;AAGhB,KAAI,QAAQ,MAAM,CAChB,QAAO;AAGT,QAAO,WAAU,UAAS;AACxB,QAAM,SAAS,SAAS,MAAM;AAC9B,QAAM,SAAS,QAAQD,eAAO,MAAMC,uBAAc,CAAC;EAEnD,MAAM,UAAU,KAAK,OAAO,gBAAgB,MAAM,QAAQ;EAE1D,MAAM,cAAc,iBAAiB,QAAQ,QAAQ,IAAI,MAAM,QAAQ;AAEvE,MAAI,KACF,aAAY,OAAO,QAAQ;AAG7B,SAAO,iBAAiB,YAAY;GACpC;AACF,SAAQ,MAAM,MAAM;;AAGtB,MAAa,SAAS,EAAE,aAAa,KAAK,cAAc;AACtD,KAAI,OAAO,SAAS,aAAa,YAC/B,QAAO,KAAK;EACV,KAAK;EACL;EACA,SAAS;EACV,CAAC;;AAIN,MAAa,kBAAiB,SAAQ,OAAO,QAAQD,eAAO,MAAMC,uBAAc,CAAC;AAEjF,MAAa,UAAU,KAAK,UAAU,OAAO,OAAO,KAAK,MAAM;AAC/D,MAAM,SAAS,EAAE;AAEjB,qBAAe"}
|
package/dist/service-items.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import _get from "lodash/get";
|
|
2
|
-
import _isEmpty from "lodash/isEmpty";
|
|
3
|
-
import _difference from "lodash/difference";
|
|
1
|
+
import _get from "lodash/get.js";
|
|
2
|
+
import _isEmpty from "lodash/isEmpty.js";
|
|
3
|
+
import _difference from "lodash/difference.js";
|
|
4
4
|
|
|
5
5
|
//#region src/service-items.ts
|
|
6
6
|
function round(value, step) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"service-items.js","names":["claimItem","item"],"sources":["../src/service-items.ts"],"sourcesContent":["import _get from 'lodash/get';\nimport _isEmpty from 'lodash/isEmpty';\nimport _difference from 'lodash/difference';\n\nexport function round(value: number, step: number) {\n const inv = 1.0 / step;\n return Math.round(value * inv) / inv;\n}\nexport const calculateTotalAmount = (\n serviceItems: Array<Record<string, any>>,\n opts: {\n includeDiscount?: boolean;\n includeQuantity?: boolean;\n includeGST?: boolean;\n isSubTotal?: boolean;\n funder?: Record<string, any>;\n } = {}\n) => {\n if (_isEmpty(serviceItems)) {\n return 0;\n }\n\n const total = serviceItems.reduce((total: number, item: Record<string, any>) => {\n const prices = calculateAmounts(\n item?.grossAmount ? parseFloat(item?.grossAmount || 0) : parseFloat(item?.feeAmount || 0),\n Boolean(opts.includeGST && item.isTaxable)\n );\n let itemTotal = undefined;\n\n if (opts.isSubTotal) {\n itemTotal = prices?.feeAmount;\n } else {\n itemTotal = prices?.grossAmount;\n }\n\n if (opts.includeDiscount && item.discountAmount) {\n const discountAmount = parseFloat(_get(item, 'discountAmount', '0'));\n itemTotal -= discountAmount;\n }\n\n return total + itemTotal;\n }, 0);\n return total;\n};\nexport const calculateTotalDiscountAmount = (serviceItems: Array<Record<string, any>>) => {\n return serviceItems.reduce((total, item) => {\n return total + parseFloat(_get(item, 'discountAmount', '0'));\n }, 0);\n};\nexport const calculateTotalGSTAmount = (\n serviceItems: Array<Record<string, any>>,\n opts: {\n includeQuantity?: boolean;\n funder?: Record<string, any>;\n } = {}\n) => {\n return serviceItems.reduce((total, item) => {\n const prices = calculateAmounts(parseFloat(item?.grossAmount || 0), item.isTaxable);\n const gstAmount = prices?.taxAmount;\n return total + gstAmount;\n }, 0);\n};\nexport const applyDiscountToServiceItems = (\n serviceItems: Array<Record<string, any>>,\n {\n discount,\n discountType\n }: {\n discount: string;\n discountType: string;\n }\n) => {\n if (serviceItems && discount) {\n const totalAmount = calculateTotalAmount(serviceItems);\n let percentage = parseFloat(discount) / totalAmount;\n\n if (discountType === 'percentage') {\n percentage = parseFloat(discount) / 100;\n }\n\n return serviceItems.map(serviceItem => ({\n ...serviceItem,\n discountAmount: (serviceItem.feeAmount * percentage).toFixed(2)\n }));\n }\n\n return serviceItems;\n};\nexport const getEarliestServiceDate = (\n serviceItems: Array<Record<string, any>>,\n dateKey: string = 'serviceDateString'\n): string =>\n serviceItems.reduce((currentEarliestDate: string, serviceItem: Record<string, any>) => {\n if (!currentEarliestDate) {\n return serviceItem[dateKey];\n }\n\n if (Date.parse(serviceItem[dateKey]) < Date.parse(currentEarliestDate)) {\n return serviceItem[dateKey];\n }\n\n return currentEarliestDate;\n }, '');\nexport const getChargeAmount = (serviceItems: Array<Record<string, any>>) =>\n calculateTotalAmount(serviceItems, {\n includeDiscount: true\n }).toFixed(2);\nexport const getDiscountAmount = (\n discountType: string,\n currentServiceItems: Array<Record<string, any>>,\n currentDiscountValue: string\n) =>\n discountType === 'price'\n ? parseFloat(currentDiscountValue).toFixed(2)\n : (\n calculateTotalAmount(currentServiceItems, {\n includeDiscount: false\n }) *\n (parseFloat(currentDiscountValue) / 100)\n ).toFixed(2);\nexport const getTotalAmount = (serviceItems: Array<Record<string, any>>) =>\n calculateTotalAmount(serviceItems, {\n includeDiscount: false\n }).toFixed(2);\nexport const getItemValue = (item: Record<string, any>, opts: Record<string, any>) => {\n const { useBenefitAsPrice = false } = opts || {};\n\n const benefit = _get(item, 'benefit', 0);\n\n const benefitAmount = (benefit / 100).toFixed(2);\n\n const price = _get(item, 'price');\n\n const feeAmount = (price / 100).toFixed(2);\n const option = {\n label: item.displayName,\n value: item\n };\n return {\n service: option,\n quantity: 1,\n ...item,\n benefitAmount,\n hasSeenPatientToday: 'no',\n ...(price\n ? {\n feeAmount\n }\n : {\n feeAmount: undefined\n }),\n ...(useBenefitAsPrice && benefit > 0\n ? {\n feeAmount: benefitAmount\n }\n : {})\n };\n};\nexport function mapItemsToClaimItems(transaction: Record<string, any>) {\n const claimItems = _get(transaction, 'claims[0].claimItems', []);\n\n const items = _get(transaction, 'items', []);\n\n if (items.length === 0) {\n return claimItems;\n }\n\n // @ts-expect-error TS(7006): Parameter 'item' implicitly has an 'any' type.\n const newItems = items.map(item => {\n // @ts-expect-error TS(7006): Parameter 'claimItem' implicitly has an 'any' type... Remove this comment to see the full error message\n const claimItem = claimItems.find(claimItem => claimItem.itemId === item.itemId) || {};\n\n const isNonClaimable = _isEmpty(claimItem);\n\n return {\n ...item,\n ...claimItem,\n displayName: _get(item, 'displayName') || _get(claimItem, 'displayName'),\n itemCode: _get(claimItem, 'icare.itemCode') || _get(claimItem, 'itemCode'),\n description:\n _get(item, 'customDescription') ||\n _get(item, 'description') ||\n _get(claimItem, 'icare.description') ||\n _get(claimItem, 'description'),\n notes: _get(item, 'description'),\n serviceDateString: item?.serviceDateString || item.serviceDate,\n isNonClaimable\n };\n });\n\n // @ts-expect-error TS(7006): Parameter 'claimItem' implicitly has an 'any' type... Remove this comment to see the full error message\n const claimItemIds = claimItems.map(claimItem => claimItem.claimItemId);\n // @ts-expect-error TS(7006): Parameter 'newItem' implicitly has an 'any' type.\n const newItemIds = newItems.map(newItem => newItem.claimItemId);\n const extraItemIds = _difference(claimItemIds, newItemIds) || [];\n\n const extraItems = extraItemIds.map(extraItemId => {\n // @ts-expect-error TS(7006): Parameter 'claimItem' implicitly has an 'any' type... Remove this comment to see the full error message\n const claimItem = claimItems.find(claimItem => claimItem.claimItemId === extraItemId);\n // @ts-expect-error TS(7006): Parameter 'item' implicitly has an 'any' type.\n const item = items.find(item => item.itemId === claimItem.itemId);\n return {\n ...item,\n ...claimItem,\n displayName: _get(claimItem, 'displayName'),\n itemCode: _get(claimItem, 'icare.itemCode') || _get(claimItem, 'itemCode'),\n description: undefined,\n notes: undefined,\n serviceDateString: item?.serviceDateString || item.serviceDate,\n isExtraItem: true\n };\n });\n\n return [...newItems, ...extraItems];\n}\nexport const calculateAmounts = (grossAmount: number, isTaxable: boolean) => {\n let feeAmount = grossAmount;\n let taxAmount = 0;\n\n if (!isTaxable) {\n return {\n taxAmount,\n feeAmount,\n grossAmount\n };\n }\n\n feeAmount = feeAmount - feeAmount / 11;\n taxAmount = parseFloat((feeAmount * 1.1).toFixed(6)) - feeAmount;\n return {\n taxAmount,\n feeAmount,\n grossAmount\n };\n};\n"],"mappings":";;;;;AAIA,SAAgB,MAAM,OAAe,MAAc;CACjD,MAAM,MAAM,IAAM;AAClB,QAAO,KAAK,MAAM,QAAQ,IAAI,GAAG;;AAEnC,MAAa,wBACX,cACA,OAMI,EAAE,KACH;AACH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Ac;GACxE,UAAU,KAAK,WAAW,iBAAiB,IAAI,KAAK,WAAW,WAAW;GAC1E,aACE,KAAK,MAAM,oBAAoB,IAC/B,KAAK,MAAM,cAAc,IACzB,KAAK,WAAW,oBAAoB,IACpC,KAAK,WAAW,cAAc;GAChC,OAAO,KAAK,MAAM,cAAc;GAChC,mBAAmB,MAAM,qBAAqB,KAAK;GACnD;GACD;GACD;CAQF,MAAM,cAFe,YAHA,WAAW,KAAI,cAAa,UAAU,YAAY,EAEpD,SAAS,KAAI,YAAW,QAAQ,YAAY,CACL,IAAI,EAAE,EAEhC,KAAI,gBAAe;EAEjD,MAAM,YAAY,WAAW,MAAK,gBAAaA,YAAU,gBAAgB,YAAY;EAErF,MAAM,OAAO,MAAM,MAAK,WAAQC,OAAK,WAAW,UAAU,OAAO;AACjE,SAAO;GACL,GAAG;GACH,GAAG;GACH,aAAa,KAAK,WAAW,cAAc;GAC3C,UAAU,KAAK,WAAW,iBAAiB,IAAI,KAAK,WAAW,WAAW;GAC1E,aAAa;GACb,OAAO;GACP,mBAAmB,MAAM,qBAAqB,KAAK;GACnD,aAAa;GACd;GACD;AAEF,QAAO,CAAC,GAAG,UAAU,GAAG,WAAW;;AAErC,MAAa,oBAAoB,aAAqB,cAAuB;CAC3E,IAAI,YAAY;CAChB,IAAI,YAAY;AAEhB,KAAI,CAAC,UACH,QAAO;EACL;EACA;EACA;EACD;AAGH,aAAY,YAAY,YAAY;AACpC,aAAY,YAAY,YAAY,KAAK,QAAQ,EAAE,CAAC,GAAG;AACvD,QAAO;EACL;EACA;EACA;EACD"}
|
|
1
|
+
{"version":3,"file":"service-items.js","names":["claimItem","item"],"sources":["../src/service-items.ts"],"sourcesContent":["import _get from 'lodash/get.js';\nimport _isEmpty from 'lodash/isEmpty.js';\nimport _difference from 'lodash/difference.js';\n\nexport function round(value: number, step: number) {\n const inv = 1.0 / step;\n return Math.round(value * inv) / inv;\n}\nexport const calculateTotalAmount = (\n serviceItems: Array<Record<string, any>>,\n opts: {\n includeDiscount?: boolean;\n includeQuantity?: boolean;\n includeGST?: boolean;\n isSubTotal?: boolean;\n funder?: Record<string, any>;\n } = {}\n) => {\n if (_isEmpty(serviceItems)) {\n return 0;\n }\n\n const total = serviceItems.reduce((total: number, item: Record<string, any>) => {\n const prices = calculateAmounts(\n item?.grossAmount ? parseFloat(item?.grossAmount || 0) : parseFloat(item?.feeAmount || 0),\n Boolean(opts.includeGST && item.isTaxable)\n );\n let itemTotal = undefined;\n\n if (opts.isSubTotal) {\n itemTotal = prices?.feeAmount;\n } else {\n itemTotal = prices?.grossAmount;\n }\n\n if (opts.includeDiscount && item.discountAmount) {\n const discountAmount = parseFloat(_get(item, 'discountAmount', '0'));\n itemTotal -= discountAmount;\n }\n\n return total + itemTotal;\n }, 0);\n return total;\n};\nexport const calculateTotalDiscountAmount = (serviceItems: Array<Record<string, any>>) => {\n return serviceItems.reduce((total, item) => {\n return total + parseFloat(_get(item, 'discountAmount', '0'));\n }, 0);\n};\nexport const calculateTotalGSTAmount = (\n serviceItems: Array<Record<string, any>>,\n opts: {\n includeQuantity?: boolean;\n funder?: Record<string, any>;\n } = {}\n) => {\n return serviceItems.reduce((total, item) => {\n const prices = calculateAmounts(parseFloat(item?.grossAmount || 0), item.isTaxable);\n const gstAmount = prices?.taxAmount;\n return total + gstAmount;\n }, 0);\n};\nexport const applyDiscountToServiceItems = (\n serviceItems: Array<Record<string, any>>,\n {\n discount,\n discountType\n }: {\n discount: string;\n discountType: string;\n }\n) => {\n if (serviceItems && discount) {\n const totalAmount = calculateTotalAmount(serviceItems);\n let percentage = parseFloat(discount) / totalAmount;\n\n if (discountType === 'percentage') {\n percentage = parseFloat(discount) / 100;\n }\n\n return serviceItems.map(serviceItem => ({\n ...serviceItem,\n discountAmount: (serviceItem.feeAmount * percentage).toFixed(2)\n }));\n }\n\n return serviceItems;\n};\nexport const getEarliestServiceDate = (\n serviceItems: Array<Record<string, any>>,\n dateKey: string = 'serviceDateString'\n): string =>\n serviceItems.reduce((currentEarliestDate: string, serviceItem: Record<string, any>) => {\n if (!currentEarliestDate) {\n return serviceItem[dateKey];\n }\n\n if (Date.parse(serviceItem[dateKey]) < Date.parse(currentEarliestDate)) {\n return serviceItem[dateKey];\n }\n\n return currentEarliestDate;\n }, '');\nexport const getChargeAmount = (serviceItems: Array<Record<string, any>>) =>\n calculateTotalAmount(serviceItems, {\n includeDiscount: true\n }).toFixed(2);\nexport const getDiscountAmount = (\n discountType: string,\n currentServiceItems: Array<Record<string, any>>,\n currentDiscountValue: string\n) =>\n discountType === 'price'\n ? parseFloat(currentDiscountValue).toFixed(2)\n : (\n calculateTotalAmount(currentServiceItems, {\n includeDiscount: false\n }) *\n (parseFloat(currentDiscountValue) / 100)\n ).toFixed(2);\nexport const getTotalAmount = (serviceItems: Array<Record<string, any>>) =>\n calculateTotalAmount(serviceItems, {\n includeDiscount: false\n }).toFixed(2);\nexport const getItemValue = (item: Record<string, any>, opts: Record<string, any>) => {\n const { useBenefitAsPrice = false } = opts || {};\n\n const benefit = _get(item, 'benefit', 0);\n\n const benefitAmount = (benefit / 100).toFixed(2);\n\n const price = _get(item, 'price');\n\n const feeAmount = (price / 100).toFixed(2);\n const option = {\n label: item.displayName,\n value: item\n };\n return {\n service: option,\n quantity: 1,\n ...item,\n benefitAmount,\n hasSeenPatientToday: 'no',\n ...(price\n ? {\n feeAmount\n }\n : {\n feeAmount: undefined\n }),\n ...(useBenefitAsPrice && benefit > 0\n ? {\n feeAmount: benefitAmount\n }\n : {})\n };\n};\nexport function mapItemsToClaimItems(transaction: Record<string, any>) {\n const claimItems = _get(transaction, 'claims[0].claimItems', []);\n\n const items = _get(transaction, 'items', []);\n\n if (items.length === 0) {\n return claimItems;\n }\n\n // @ts-expect-error TS(7006): Parameter 'item' implicitly has an 'any' type.\n const newItems = items.map(item => {\n // @ts-expect-error TS(7006): Parameter 'claimItem' implicitly has an 'any' type... Remove this comment to see the full error message\n const claimItem = claimItems.find(claimItem => claimItem.itemId === item.itemId) || {};\n\n const isNonClaimable = _isEmpty(claimItem);\n\n return {\n ...item,\n ...claimItem,\n displayName: _get(item, 'displayName') || _get(claimItem, 'displayName'),\n itemCode: _get(claimItem, 'icare.itemCode') || _get(claimItem, 'itemCode'),\n description:\n _get(item, 'customDescription') ||\n _get(item, 'description') ||\n _get(claimItem, 'icare.description') ||\n _get(claimItem, 'description'),\n notes: _get(item, 'description'),\n serviceDateString: item?.serviceDateString || item.serviceDate,\n isNonClaimable\n };\n });\n\n // @ts-expect-error TS(7006): Parameter 'claimItem' implicitly has an 'any' type... Remove this comment to see the full error message\n const claimItemIds = claimItems.map(claimItem => claimItem.claimItemId);\n // @ts-expect-error TS(7006): Parameter 'newItem' implicitly has an 'any' type.\n const newItemIds = newItems.map(newItem => newItem.claimItemId);\n const extraItemIds = _difference(claimItemIds, newItemIds) || [];\n\n const extraItems = extraItemIds.map(extraItemId => {\n // @ts-expect-error TS(7006): Parameter 'claimItem' implicitly has an 'any' type... Remove this comment to see the full error message\n const claimItem = claimItems.find(claimItem => claimItem.claimItemId === extraItemId);\n // @ts-expect-error TS(7006): Parameter 'item' implicitly has an 'any' type.\n const item = items.find(item => item.itemId === claimItem.itemId);\n return {\n ...item,\n ...claimItem,\n displayName: _get(claimItem, 'displayName'),\n itemCode: _get(claimItem, 'icare.itemCode') || _get(claimItem, 'itemCode'),\n description: undefined,\n notes: undefined,\n serviceDateString: item?.serviceDateString || item.serviceDate,\n isExtraItem: true\n };\n });\n\n return [...newItems, ...extraItems];\n}\nexport const calculateAmounts = (grossAmount: number, isTaxable: boolean) => {\n let feeAmount = grossAmount;\n let taxAmount = 0;\n\n if (!isTaxable) {\n return {\n taxAmount,\n feeAmount,\n grossAmount\n };\n }\n\n feeAmount = feeAmount - feeAmount / 11;\n taxAmount = parseFloat((feeAmount * 1.1).toFixed(6)) - feeAmount;\n return {\n taxAmount,\n feeAmount,\n grossAmount\n };\n};\n"],"mappings":";;;;;AAIA,SAAgB,MAAM,OAAe,MAAc;CACjD,M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,iBAAiB,SAAS,UAAU;AAE1C,SAAO;GACL,GAAG;GACH,GAAG;GACH,aAAa,KAAK,MAAM,cAAc,IAAI,KAAK,WAAW,cAAc;GACxE,UAAU,KAAK,WAAW,iBAAiB,IAAI,KAAK,WAAW,WAAW;GAC1E,aACE,KAAK,MAAM,oBAAoB,IAC/B,KAAK,MAAM,cAAc,IACzB,KAAK,WAAW,oBAAoB,IACpC,KAAK,WAAW,cAAc;GAChC,OAAO,KAAK,MAAM,cAAc;GAChC,mBAAmB,MAAM,qBAAqB,KAAK;GACnD;GACD;GACD;CAQF,MAAM,cAFe,YAHA,WAAW,KAAI,cAAa,UAAU,YAAY,EAEpD,SAAS,KAAI,YAAW,QAAQ,YAAY,CACL,IAAI,EAAE,EAEhC,KAAI,gBAAe;EAEjD,MAAM,YAAY,WAAW,MAAK,gBAAaA,YAAU,gBAAgB,YAAY;EAErF,MAAM,OAAO,MAAM,MAAK,WAAQC,OAAK,WAAW,UAAU,OAAO;AACjE,SAAO;GACL,GAAG;GACH,GAAG;GACH,aAAa,KAAK,WAAW,cAAc;GAC3C,UAAU,KAAK,WAAW,iBAAiB,IAAI,KAAK,WAAW,WAAW;GAC1E,aAAa;GACb,OAAO;GACP,mBAAmB,MAAM,qBAAqB,KAAK;GACnD,aAAa;GACd;GACD;AAEF,QAAO,CAAC,GAAG,UAAU,GAAG,WAAW;;AAErC,MAAa,oBAAoB,aAAqB,cAAuB;CAC3E,IAAI,YAAY;CAChB,IAAI,YAAY;AAEhB,KAAI,CAAC,UACH,QAAO;EACL;EACA;EACA;EACD;AAGH,aAAY,YAAY,YAAY;AACpC,aAAY,YAAY,YAAY,KAAK,QAAQ,EAAE,CAAC,GAAG;AACvD,QAAO;EACL;EACA;EACA;EACD"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TRANSACTION_STATUSES } from "./constants.js";
|
|
2
2
|
import claim_payment_status_icons_default from "./claim-payment-status-icons.js";
|
|
3
3
|
import claim_payment_status_text_classes_default from "./claim-payment-status-text-classes.js";
|
|
4
|
-
import _capitalize from "lodash/capitalize";
|
|
4
|
+
import _capitalize from "lodash/capitalize.js";
|
|
5
5
|
|
|
6
6
|
//#region src/transaction-status-helpers.ts
|
|
7
7
|
const getPaymentStatus = ({ paymentStatus, transactionStatus, hasNoGap, paidInPerson }) => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-status-helpers.js","names":["claimPaymentStatusTextClasses","claimPaymentStatusIcons"],"sources":["../src/transaction-status-helpers.ts"],"sourcesContent":["import _capitalize from 'lodash/capitalize';\nimport { TRANSACTION_STATUSES } from './constants';\nimport claimPaymentStatusIcons from './claim-payment-status-icons';\nimport claimPaymentStatusTextClasses from './claim-payment-status-text-classes';\n// @ts-expect-error TS(7031): Binding element 'paymentStatus' implicitly has an ... Remove this comment to see the full error message\nexport const getPaymentStatus = ({ paymentStatus, transactionStatus, hasNoGap, paidInPerson }) => {\n if (transactionStatus === TRANSACTION_STATUSES.CANCELLED) {\n return 'Voided';\n }\n\n if (hasNoGap) {\n return 'Not needed';\n }\n\n if (paidInPerson) {\n return 'Paid in person';\n }\n\n return paymentStatus ? _capitalize(paymentStatus) : 'Pending';\n};\n// @ts-expect-error TS(7031): Binding element 'paymentStatus' implicitly has an ... Remove this comment to see the full error message\nexport const getPaymentTextClass = ({ paymentStatus, transactionStatus, hasNoGap, paidInPerson }) => {\n if (transactionStatus === TRANSACTION_STATUSES.CANCELLED) {\n return 'danger';\n }\n\n if (hasNoGap) {\n return 'success';\n }\n\n if (paidInPerson) {\n return 'gray';\n }\n\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n return claimPaymentStatusTextClasses[paymentStatus] || 'warning';\n};\n// @ts-expect-error TS(7031): Binding element 'paymentStatus' implicitly has an ... Remove this comment to see the full error message\nexport const getPaymentIcon = ({ paymentStatus, transactionStatus, hasNoGap, paidInPerson }) => {\n if (transactionStatus === TRANSACTION_STATUSES.CANCELLED) {\n return 'fa-times-circle';\n }\n\n if (hasNoGap) {\n return 'fa-check-circle';\n }\n\n if (paidInPerson) {\n return '';\n }\n\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n return claimPaymentStatusIcons[paymentStatus] || 'fa-clock';\n};\nconst transactionStatusHelper = {};\n\nexport default transactionStatusHelper;\n"],"mappings":";;;;;;AAKA,MAAa,oBAAoB,EAAE,eAAe,mBAAmB,UAAU,mBAAmB;AAChG,KAAI,sBAAsB,qBAAqB,UAC7C,QAAO;AAGT,KAAI,SACF,QAAO;AAGT,KAAI,aACF,QAAO;AAGT,QAAO,gBAAgB,YAAY,cAAc,GAAG;;AAGtD,MAAa,uBAAuB,EAAE,eAAe,mBAAmB,UAAU,mBAAmB;AACnG,KAAI,sBAAsB,qBAAqB,UAC7C,QAAO;AAGT,KAAI,SACF,QAAO;AAGT,KAAI,aACF,QAAO;AAIT,QAAOA,0CAA8B,kBAAkB;;AAGzD,MAAa,kBAAkB,EAAE,eAAe,mBAAmB,UAAU,mBAAmB;AAC9F,KAAI,sBAAsB,qBAAqB,UAC7C,QAAO;AAGT,KAAI,SACF,QAAO;AAGT,KAAI,aACF,QAAO;AAIT,QAAOC,mCAAwB,kBAAkB;;AAEnD,MAAM,0BAA0B,EAAE;AAElC,yCAAe"}
|
|
1
|
+
{"version":3,"file":"transaction-status-helpers.js","names":["claimPaymentStatusTextClasses","claimPaymentStatusIcons"],"sources":["../src/transaction-status-helpers.ts"],"sourcesContent":["import _capitalize from 'lodash/capitalize.js';\nimport { TRANSACTION_STATUSES } from './constants';\nimport claimPaymentStatusIcons from './claim-payment-status-icons';\nimport claimPaymentStatusTextClasses from './claim-payment-status-text-classes';\n// @ts-expect-error TS(7031): Binding element 'paymentStatus' implicitly has an ... Remove this comment to see the full error message\nexport const getPaymentStatus = ({ paymentStatus, transactionStatus, hasNoGap, paidInPerson }) => {\n if (transactionStatus === TRANSACTION_STATUSES.CANCELLED) {\n return 'Voided';\n }\n\n if (hasNoGap) {\n return 'Not needed';\n }\n\n if (paidInPerson) {\n return 'Paid in person';\n }\n\n return paymentStatus ? _capitalize(paymentStatus) : 'Pending';\n};\n// @ts-expect-error TS(7031): Binding element 'paymentStatus' implicitly has an ... Remove this comment to see the full error message\nexport const getPaymentTextClass = ({ paymentStatus, transactionStatus, hasNoGap, paidInPerson }) => {\n if (transactionStatus === TRANSACTION_STATUSES.CANCELLED) {\n return 'danger';\n }\n\n if (hasNoGap) {\n return 'success';\n }\n\n if (paidInPerson) {\n return 'gray';\n }\n\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n return claimPaymentStatusTextClasses[paymentStatus] || 'warning';\n};\n// @ts-expect-error TS(7031): Binding element 'paymentStatus' implicitly has an ... Remove this comment to see the full error message\nexport const getPaymentIcon = ({ paymentStatus, transactionStatus, hasNoGap, paidInPerson }) => {\n if (transactionStatus === TRANSACTION_STATUSES.CANCELLED) {\n return 'fa-times-circle';\n }\n\n if (hasNoGap) {\n return 'fa-check-circle';\n }\n\n if (paidInPerson) {\n return '';\n }\n\n // @ts-expect-error TS(7053): Element implicitly has an 'any' type because expre... Remove this comment to see the full error message\n return claimPaymentStatusIcons[paymentStatus] || 'fa-clock';\n};\nconst transactionStatusHelper = {};\n\nexport default transactionStatusHelper;\n"],"mappings":";;;;;;AAKA,MAAa,oBAAoB,EAAE,eAAe,mBAAmB,UAAU,mBAAmB;AAChG,KAAI,sBAAsB,qBAAqB,UAC7C,QAAO;AAGT,KAAI,SACF,QAAO;AAGT,KAAI,aACF,QAAO;AAGT,QAAO,gBAAgB,YAAY,cAAc,GAAG;;AAGtD,MAAa,uBAAuB,EAAE,eAAe,mBAAmB,UAAU,mBAAmB;AACnG,KAAI,sBAAsB,qBAAqB,UAC7C,QAAO;AAGT,KAAI,SACF,QAAO;AAGT,KAAI,aACF,QAAO;AAIT,QAAOA,0CAA8B,kBAAkB;;AAGzD,MAAa,kBAAkB,EAAE,eAAe,mBAAmB,UAAU,mBAAmB;AAC9F,KAAI,sBAAsB,qBAAqB,UAC7C,QAAO;AAGT,KAAI,SACF,QAAO;AAGT,KAAI,aACF,QAAO;AAIT,QAAOC,mCAAwB,kBAAkB;;AAEnD,MAAM,0BAA0B,EAAE;AAElC,yCAAe"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { TRANSACTION_STATUSES } from "./constants.js";
|
|
2
2
|
import { isIcare, isMedicare } from "./funders.js";
|
|
3
|
-
import _get from "lodash/get";
|
|
3
|
+
import _get from "lodash/get.js";
|
|
4
4
|
|
|
5
5
|
//#region src/transaction-status.ts
|
|
6
6
|
function getOverrideStatus(transaction, defaultStatus) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"transaction-status.js","names":[],"sources":["../src/transaction-status.ts"],"sourcesContent":["import _get from 'lodash/get';\nimport { TRANSACTION_STATUSES } from './constants';\nimport { isMedicare, isIcare } from './funders';\n// @ts-expect-error TS(7006): Parameter 'transaction' implicitly has an 'any' ty... Remove this comment to see the full error message\nexport function getOverrideStatus(transaction, defaultStatus) {\n let status = defaultStatus;\n\n if (isMedicare(_get(transaction, 'claims[0].funder.code'))) {\n const isClaimRejected = _get(transaction, 'claims[0].status') === TRANSACTION_STATUSES.REJECTED;\n const isTransactionCompleted = transaction.status === TRANSACTION_STATUSES.COMPLETED;\n\n const hasMedicareErrored = _get(transaction, 'medicare.hasFatalError');\n\n if (isClaimRejected && isTransactionCompleted && !hasMedicareErrored) {\n status = TRANSACTION_STATUSES.UNDER_REVIEW;\n }\n\n const isClaimPending =\n _get(transaction, 'claims[0].status') === TRANSACTION_STATUSES.PENDING &&\n transaction.status !== TRANSACTION_STATUSES.CANCELLED;\n\n if (isClaimPending) {\n status = TRANSACTION_STATUSES.PENDING;\n }\n }\n\n if (isIcare(_get(transaction, 'claims[0].funder.code')) && _get(transaction, '_schemaVersion') === '2') {\n const isClaimPending = _get(transaction, 'status') === TRANSACTION_STATUSES.PENDING;\n\n if (isClaimPending) {\n status = TRANSACTION_STATUSES.SUBMITTED;\n }\n }\n\n return status;\n}\n"],"mappings":";;;;;AAIA,SAAgB,kBAAkB,aAAa,eAAe;CAC5D,IAAI,SAAS;AAEb,KAAI,WAAW,KAAK,aAAa,wBAAwB,CAAC,EAAE;EAC1D,MAAM,kBAAkB,KAAK,aAAa,mBAAmB,KAAK,qBAAqB;EACvF,MAAM,yBAAyB,YAAY,WAAW,qBAAqB;EAE3E,MAAM,qBAAqB,KAAK,aAAa,yBAAyB;AAEtE,MAAI,mBAAmB,0BAA0B,CAAC,mBAChD,UAAS,qBAAqB;AAOhC,MAHE,KAAK,aAAa,mBAAmB,KAAK,qBAAqB,WAC/D,YAAY,WAAW,qBAAqB,UAG5C,UAAS,qBAAqB;;AAIlC,KAAI,QAAQ,KAAK,aAAa,wBAAwB,CAAC,IAAI,KAAK,aAAa,iBAAiB,KAAK,KAGjG;MAFuB,KAAK,aAAa,SAAS,KAAK,qBAAqB,QAG1E,UAAS,qBAAqB;;AAIlC,QAAO"}
|
|
1
|
+
{"version":3,"file":"transaction-status.js","names":[],"sources":["../src/transaction-status.ts"],"sourcesContent":["import _get from 'lodash/get.js';\nimport { TRANSACTION_STATUSES } from './constants';\nimport { isMedicare, isIcare } from './funders';\n// @ts-expect-error TS(7006): Parameter 'transaction' implicitly has an 'any' ty... Remove this comment to see the full error message\nexport function getOverrideStatus(transaction, defaultStatus) {\n let status = defaultStatus;\n\n if (isMedicare(_get(transaction, 'claims[0].funder.code'))) {\n const isClaimRejected = _get(transaction, 'claims[0].status') === TRANSACTION_STATUSES.REJECTED;\n const isTransactionCompleted = transaction.status === TRANSACTION_STATUSES.COMPLETED;\n\n const hasMedicareErrored = _get(transaction, 'medicare.hasFatalError');\n\n if (isClaimRejected && isTransactionCompleted && !hasMedicareErrored) {\n status = TRANSACTION_STATUSES.UNDER_REVIEW;\n }\n\n const isClaimPending =\n _get(transaction, 'claims[0].status') === TRANSACTION_STATUSES.PENDING &&\n transaction.status !== TRANSACTION_STATUSES.CANCELLED;\n\n if (isClaimPending) {\n status = TRANSACTION_STATUSES.PENDING;\n }\n }\n\n if (isIcare(_get(transaction, 'claims[0].funder.code')) && _get(transaction, '_schemaVersion') === '2') {\n const isClaimPending = _get(transaction, 'status') === TRANSACTION_STATUSES.PENDING;\n\n if (isClaimPending) {\n status = TRANSACTION_STATUSES.SUBMITTED;\n }\n }\n\n return status;\n}\n"],"mappings":";;;;;AAIA,SAAgB,kBAAkB,aAAa,eAAe;CAC5D,IAAI,SAAS;AAEb,KAAI,WAAW,KAAK,aAAa,wBAAwB,CAAC,EAAE;EAC1D,MAAM,kBAAkB,KAAK,aAAa,mBAAmB,KAAK,qBAAqB;EACvF,MAAM,yBAAyB,YAAY,WAAW,qBAAqB;EAE3E,MAAM,qBAAqB,KAAK,aAAa,yBAAyB;AAEtE,MAAI,mBAAmB,0BAA0B,CAAC,mBAChD,UAAS,qBAAqB;AAOhC,MAHE,KAAK,aAAa,mBAAmB,KAAK,qBAAqB,WAC/D,YAAY,WAAW,qBAAqB,UAG5C,UAAS,qBAAqB;;AAIlC,KAAI,QAAQ,KAAK,aAAa,wBAAwB,CAAC,IAAI,KAAK,aAAa,iBAAiB,KAAK,KAGjG;MAFuB,KAAK,aAAa,SAAS,KAAK,qBAAqB,QAG1E,UAAS,qBAAqB;;AAIlC,QAAO"}
|
package/dist/validate-form.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { isValidAbn as isValidAbn$1 } from "./abn.js";
|
|
2
2
|
import { isEmail, isLandlineNumber, isMobileNumber, isUrl } from "./validate.js";
|
|
3
|
-
import _get from "lodash/get";
|
|
4
|
-
import _isArray from "lodash/isArray";
|
|
3
|
+
import _get from "lodash/get.js";
|
|
4
|
+
import _isArray from "lodash/isArray.js";
|
|
5
5
|
import format from "date-fns/format";
|
|
6
6
|
import isBefore from "date-fns/isBefore";
|
|
7
7
|
import isFuture from "date-fns/isFuture";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-form.js","names":["_isValidAbn"],"sources":["../src/validate-form.ts"],"sourcesContent":["import _isArray from 'lodash/isArray';\nimport _get from 'lodash/get';\nimport format from 'date-fns/format';\nimport isBefore from 'date-fns/isBefore';\nimport isFuture from 'date-fns/isFuture';\nimport isValid from 'date-fns/isValid';\nimport parse from 'date-fns/parse';\n\nimport { isEmail, isUrl, isMobileNumber, isLandlineNumber } from './validate';\n\nimport { isValidAbn as _isValidAbn } from './abn';\n\nexport const IS_VALID_BANK_ACCOUNT_NAME_REGEX = new RegExp(/^[A-Za-z0-9^_[\\]',?;:=#/.*()&%!$ @+-]+$/);\nexport const IS_VALID_NUMBER_REGEX = new RegExp(/^\\d+$/);\n\nexport const IS_VALID_BANK_ACCOUNT_NAME_REGEX_OPTIONAL = new RegExp(/^$|^[A-Za-z0-9^_[\\]',?;:=#/.*()&%!$ @+-]+$/);\nexport const IS_VALID_NUMBER_REGEX_OPTIONAL = new RegExp(/^$|^\\d+$/);\n\nexport const IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX = new RegExp(/[A-Z]{1}[0-9]{5,6}[A-Z]{1,2}/);\n\nexport const validEmailRegex = new RegExp(\n \"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$\"\n);\n\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isRequired = value =>\n !value || (value.trim && !value.trim()) || (_isArray(value) && value.length === 0)\n ? 'This field is required'\n : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isNumber = value => (value && value.match(/[^0-9]/) ? 'This field must only contain numbers' : undefined);\nexport const isEqualTo =\n // @ts-expect-error TS(7006): Parameter 'target' implicitly has an 'any' type.\n\n\n (target, message = `This field must be equal to ${target}`) =>\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n value =>\n target === value ? undefined : message;\nexport const isSameValueAsField =\n // @ts-expect-error TS(7006): Parameter 'targetField' implicitly has an 'any' ty... Remove this comment to see the full error message\n\n\n (targetField, message = 'Fields must be the same') =>\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n (value, values) =>\n value === values[targetField] ? undefined : message;\nexport const isLengthEqualTo =\n // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\n\n\n (length, message = `Field must contain ${length} characters`) =>\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n value =>\n !value || value.length === length ? undefined : message;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isLengthGreaterThanOrEqualTo = length => value =>\n !value || value.split(' ').join('').length >= length\n ? undefined\n : `Must be greater than or equal to ${length} characters`;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isLengthLessThanOrEqualTo = length => value =>\n !value || value.split(' ').join('').length <= length\n ? undefined\n : `Must be less than or equal to ${length} characters`;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isLengthWithSpacesLessThanOrEqualTo = length => value =>\n !value || value.length <= length ? undefined : `Must be less than or equal to ${length} characters`;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isLengthWithSpacesGreaterThanOrEqualTo = length => value =>\n !value || value.length >= length ? undefined : `Must be greater than or equal to ${length} characters`;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isGreaterThanOrEqualTo = length => value =>\n !value || parseFloat(value) >= length ? undefined : `Must be greater than or equal to ${length}`;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isGreaterThan = length => value =>\n !value || parseFloat(value) > length ? undefined : `Must be greater than ${length}`;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isLessThanOrEqualTo = length => value =>\n !value || parseFloat(value) <= length ? undefined : `Must be less than or equal to ${length}`;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasUppercaseLetter = value => (/[A-Z]/.test(value) ? undefined : 'Field must contain an uppercase letter');\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasNumber = value => (/[0-9]/.test(value) ? undefined : 'Field must contain a number');\n// Adheres to the 'BECS EBCDIC' character set.\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isValidBankAccountName = value =>\n IS_VALID_BANK_ACCOUNT_NAME_REGEX.test(value)\n ? undefined\n : 'Bank account name must not contain any special characters';\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasSpecialChar = value =>\n /[!@?#$%^&*)(+=._-]/.test(value) ? undefined : 'Field must contain a special character (e.g. !@#)';\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n// eslint-disable-line no-useless-escape\nexport const isValidEmailAsync = async value =>\n !value || (await isEmail(value)) ? undefined : 'Please enter a valid email';\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isValidEmail = value =>\n !value || validEmailRegex?.test(value) ? undefined : 'Please enter a valid email';\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isValidMobile = value =>\n !value || isMobileNumber(value, 'AU') ? undefined : 'Please enter a valid mobile number';\n\nexport const isValidLandline = (value: string | undefined) =>\n !value || isLandlineNumber(value, 'AU') ? undefined : 'Please enter a valid landline number';\n\nexport const isValidDatePatterns =\n ({\n day,\n month,\n year\n }: {\n day?: { message: string; regex: string; index: number };\n month?: { message: string; regex: string; index: number };\n year?: { message: string; regex: string; index: number };\n }) =>\n (value?: string) => {\n if (!value) {\n return undefined;\n }\n\n if (day) {\n const valueArray = value.split('/');\n\n const dayValue = _get(valueArray, `[${day.index}]`, '').split(' ').join('');\n\n if (!new RegExp(day.regex).test(dayValue)) {\n return day.message;\n }\n }\n\n if (month) {\n const valueArray = value.split('/');\n\n const monthValue = _get(valueArray, `[${month.index}]`, '').split(' ').join('');\n\n if (!new RegExp(month.regex).test(monthValue)) {\n return month.message;\n }\n }\n\n if (year) {\n const valueArray = value.split('/');\n\n const yearValue = _get(valueArray, `[${year.index}]`, '').split(' ').join('');\n\n if (!new RegExp(year.regex).test(yearValue)) {\n return year.message;\n }\n }\n\n return undefined;\n };\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isValidDate = value =>\n value && !isValid(parse(value, 'dd/MM/yyyy', new Date())) ? 'Date is invalid' : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isValidUrlAsync = async value =>\n !value || (await isUrl(value)) ? undefined : 'Please enter a valid URL (starting with http:// or https://).';\nexport const isYearInRange =\n ({\n index,\n isShortYearFormat,\n lessThanCurrentYear\n }: {\n index: number;\n isShortYearFormat?: boolean;\n lessThanCurrentYear?: boolean;\n }) =>\n (value = '') => {\n const year = value.split('/')[index];\n const currentYear = format(new Date(), isShortYearFormat ? 'yy' : 'yyyy');\n\n if (\n !lessThanCurrentYear &&\n (parseInt(year, 10) < parseInt(currentYear, 10) || parseInt(year, 10) > parseInt(currentYear, 10) + 15)\n ) {\n if (parseInt(year, 10) < parseInt(currentYear, 10)) {\n return `Year must be a year equal or greater than ${parseInt(currentYear, 10)}`;\n }\n\n if (parseInt(year, 10) > parseInt(currentYear, 10) + 15) {\n return `Year must be a year less than ${parseInt(currentYear, 10) + 15}`;\n }\n\n return 'Please enter a valid year';\n }\n\n if (lessThanCurrentYear && parseInt(year, 10) > parseInt(currentYear, 10)) {\n return `Year must be a year equal or less than ${parseInt(currentYear, 10)}`;\n }\n\n return undefined;\n };\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isValidDOB = value => {\n const invalidDate = isValidDate(value);\n if (invalidDate) return invalidDate;\n const year = value.split('/')[2];\n const currentYear = format(new Date(), 'yyyy');\n\n if (parseInt(year, 10) > parseInt(currentYear, 10)) {\n return 'Year must be before current year.';\n }\n\n if (parseInt(year, 10) < 1900) {\n return 'Year must be greater than 1900';\n }\n\n return undefined;\n};\n// @ts-expect-error TS(7006): Parameter 'pattern' implicitly has an 'any' type.\nexport const matchesRegex = (pattern, message) => value =>\n !value || new RegExp(pattern).test(value) ? undefined : message;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isFutureDate = value => {\n const date = value && new Date(value.split('/')[2], value.split('/')[1] - 1, value.split('/')[0]);\n return isFuture(date) ? 'Date must not be in the future.' : undefined;\n};\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isMoreThanThreeYears = value => {\n const dateToValidate = new Date(value.split('/')[2], value.split('/')[1] - 1, value.split('/')[0]);\n const dateThreeYearsAgo = new Date(new Date().getFullYear() - 3, new Date().getMonth(), new Date().getDate() - 1);\n return isBefore(dateToValidate, dateThreeYearsAgo) ? 'Date must not be more than 3 years ago.' : undefined;\n};\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasInvalidCharacters = value =>\n value && /[()]/.test(value) ? 'This field cannot contain ( or )' : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasStrictInvalidCharacters = value =>\n value && /[^A-Za-z0-9-' ]/.test(value)\n ? 'This field cannot contain any special characters except for space, hyphen and apostrophe under certain conditions'\n : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasDoubleSpaces = value => {\n return value && /\\s\\s+/g.test(value) ? 'There can be no double spaces in the supplied value' : undefined;\n};\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasWhitespaceAtStartOrEnd = value => {\n return value && /(^\\s+)|(\\s+$)/.test(value)\n ? 'There can be no spaces at the start or end of the supplied value'\n : undefined;\n};\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasSpaceAfterHyphen = value =>\n value && /([-]\\s)/.test(value) ? 'Name cannot have a space after a hyphen (-)' : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasSpaceBeforeHyphen = value =>\n value && /(\\s[-])/.test(value) ? 'Name cannot have a space before a hyphen (-)' : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasSpaceAfterApostrophe = value =>\n value && /([']\\s)/.test(value) ? \"Name cannot have a space after an apostrophe (')\" : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasSpaceBeforeApostrophe = value =>\n value && /(\\s['])/.test(value) ? \"Name cannot have a space before an apostrophe (')\" : undefined;\n\nexport const isValidAbn = (value: string) => {\n const isValid = _isValidAbn(value);\n if (isValid) return undefined;\n return 'Please enter a valid 11 digit ABN';\n};\n\nconst combineValidators =\n // @ts-expect-error TS(7019): Rest parameter 'fns' implicitly has an 'any[]' typ... Remove this comment to see the full error message\n\n\n (...fns) =>\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n value => {\n const validator = fns.find(fn => fn(value));\n\n if (validator) {\n return validator(value);\n }\n\n return undefined;\n };\n\nexport default combineValidators;\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,mDAAmC,IAAI,OAAO,0CAA0C;AACrG,MAAa,wCAAwB,IAAI,OAAO,QAAQ;AAExD,MAAa,4DAA4C,IAAI,OAAO,6CAA6C;AACjH,MAAa,iDAAiC,IAAI,OAAO,WAAW;AAEpE,MAAa,0DAA0C,IAAI,OAAO,+BAA+B;AAEjG,MAAa,kCAAkB,IAAI,OACjC,wIACD;AAGD,MAAa,cAAa,UACxB,CAAC,SAAU,MAAM,QAAQ,CAAC,MAAM,MAAM,IAAM,SAAS,MAAM,IAAI,MAAM,WAAW,IAC5E,2BACA;AAEN,MAAa,YAAW,UAAU,SAAS,MAAM,MAAM,SAAS,GAAG,yCAAyC;A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AG,oBAAG,IAAI,MAAM,EAAC,UAAU,mBAAE,IAAI,MAAM,EAAC,SAAS,GAAG,EAAE,CAC/D,GAAG,4CAA4C;;AAGnG,MAAa,wBAAuB,UAClC,SAAS,OAAO,KAAK,MAAM,GAAG,qCAAqC;AAErE,MAAa,8BAA6B,UACxC,SAAS,kBAAkB,KAAK,MAAM,GAClC,sHACA;AAEN,MAAa,mBAAkB,UAAS;AACtC,QAAO,SAAS,SAAS,KAAK,MAAM,GAAG,wDAAwD;;AAGjG,MAAa,6BAA4B,UAAS;AAChD,QAAO,SAAS,gBAAgB,KAAK,MAAM,GACvC,qEACA;;AAGN,MAAa,uBAAsB,UACjC,SAAS,UAAU,KAAK,MAAM,GAAG,gDAAgD;AAEnF,MAAa,wBAAuB,UAClC,SAAS,UAAU,KAAK,MAAM,GAAG,iDAAiD;AAEpF,MAAa,2BAA0B,UACrC,SAAS,UAAU,KAAK,MAAM,GAAG,qDAAqD;AAExF,MAAa,4BAA2B,UACtC,SAAS,UAAU,KAAK,MAAM,GAAG,sDAAsD;AAEzF,MAAa,cAAc,UAAkB;AAE3C,KADgBA,aAAY,MAAM,CACrB,QAAO;AACpB,QAAO;;AAGT,MAAM,qBAID,GAAG,SAEJ,UAAS;CACP,MAAM,YAAY,IAAI,MAAK,OAAM,GAAG,MAAM,CAAC;AAE3C,KAAI,UACF,QAAO,UAAU,MAAM;;AAM/B,4BAAe"}
|
|
1
|
+
{"version":3,"file":"validate-form.js","names":["_isValidAbn"],"sources":["../src/validate-form.ts"],"sourcesContent":["import _isArray from 'lodash/isArray.js';\nimport _get from 'lodash/get.js';\nimport format from 'date-fns/format';\nimport isBefore from 'date-fns/isBefore';\nimport isFuture from 'date-fns/isFuture';\nimport isValid from 'date-fns/isValid';\nimport parse from 'date-fns/parse';\n\nimport { isEmail, isUrl, isMobileNumber, isLandlineNumber } from './validate';\n\nimport { isValidAbn as _isValidAbn } from './abn';\n\nexport const IS_VALID_BANK_ACCOUNT_NAME_REGEX = new RegExp(/^[A-Za-z0-9^_[\\]',?;:=#/.*()&%!$ @+-]+$/);\nexport const IS_VALID_NUMBER_REGEX = new RegExp(/^\\d+$/);\n\nexport const IS_VALID_BANK_ACCOUNT_NAME_REGEX_OPTIONAL = new RegExp(/^$|^[A-Za-z0-9^_[\\]',?;:=#/.*()&%!$ @+-]+$/);\nexport const IS_VALID_NUMBER_REGEX_OPTIONAL = new RegExp(/^$|^\\d+$/);\n\nexport const IS_VALID_MEDIBANK_PROVIDER_NUMBER_REGEX = new RegExp(/[A-Z]{1}[0-9]{5,6}[A-Z]{1,2}/);\n\nexport const validEmailRegex = new RegExp(\n \"^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$\"\n);\n\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isRequired = value =>\n !value || (value.trim && !value.trim()) || (_isArray(value) && value.length === 0)\n ? 'This field is required'\n : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isNumber = value => (value && value.match(/[^0-9]/) ? 'This field must only contain numbers' : undefined);\nexport const isEqualTo =\n // @ts-expect-error TS(7006): Parameter 'target' implicitly has an 'any' type.\n\n\n (target, message = `This field must be equal to ${target}`) =>\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n value =>\n target === value ? undefined : message;\nexport const isSameValueAsField =\n // @ts-expect-error TS(7006): Parameter 'targetField' implicitly has an 'any' ty... Remove this comment to see the full error message\n\n\n (targetField, message = 'Fields must be the same') =>\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n (value, values) =>\n value === values[targetField] ? undefined : message;\nexport const isLengthEqualTo =\n // @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\n\n\n (length, message = `Field must contain ${length} characters`) =>\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n value =>\n !value || value.length === length ? undefined : message;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isLengthGreaterThanOrEqualTo = length => value =>\n !value || value.split(' ').join('').length >= length\n ? undefined\n : `Must be greater than or equal to ${length} characters`;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isLengthLessThanOrEqualTo = length => value =>\n !value || value.split(' ').join('').length <= length\n ? undefined\n : `Must be less than or equal to ${length} characters`;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isLengthWithSpacesLessThanOrEqualTo = length => value =>\n !value || value.length <= length ? undefined : `Must be less than or equal to ${length} characters`;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isLengthWithSpacesGreaterThanOrEqualTo = length => value =>\n !value || value.length >= length ? undefined : `Must be greater than or equal to ${length} characters`;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isGreaterThanOrEqualTo = length => value =>\n !value || parseFloat(value) >= length ? undefined : `Must be greater than or equal to ${length}`;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isGreaterThan = length => value =>\n !value || parseFloat(value) > length ? undefined : `Must be greater than ${length}`;\n// @ts-expect-error TS(7006): Parameter 'length' implicitly has an 'any' type.\nexport const isLessThanOrEqualTo = length => value =>\n !value || parseFloat(value) <= length ? undefined : `Must be less than or equal to ${length}`;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasUppercaseLetter = value => (/[A-Z]/.test(value) ? undefined : 'Field must contain an uppercase letter');\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasNumber = value => (/[0-9]/.test(value) ? undefined : 'Field must contain a number');\n// Adheres to the 'BECS EBCDIC' character set.\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isValidBankAccountName = value =>\n IS_VALID_BANK_ACCOUNT_NAME_REGEX.test(value)\n ? undefined\n : 'Bank account name must not contain any special characters';\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasSpecialChar = value =>\n /[!@?#$%^&*)(+=._-]/.test(value) ? undefined : 'Field must contain a special character (e.g. !@#)';\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n// eslint-disable-line no-useless-escape\nexport const isValidEmailAsync = async value =>\n !value || (await isEmail(value)) ? undefined : 'Please enter a valid email';\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isValidEmail = value =>\n !value || validEmailRegex?.test(value) ? undefined : 'Please enter a valid email';\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isValidMobile = value =>\n !value || isMobileNumber(value, 'AU') ? undefined : 'Please enter a valid mobile number';\n\nexport const isValidLandline = (value: string | undefined) =>\n !value || isLandlineNumber(value, 'AU') ? undefined : 'Please enter a valid landline number';\n\nexport const isValidDatePatterns =\n ({\n day,\n month,\n year\n }: {\n day?: { message: string; regex: string; index: number };\n month?: { message: string; regex: string; index: number };\n year?: { message: string; regex: string; index: number };\n }) =>\n (value?: string) => {\n if (!value) {\n return undefined;\n }\n\n if (day) {\n const valueArray = value.split('/');\n\n const dayValue = _get(valueArray, `[${day.index}]`, '').split(' ').join('');\n\n if (!new RegExp(day.regex).test(dayValue)) {\n return day.message;\n }\n }\n\n if (month) {\n const valueArray = value.split('/');\n\n const monthValue = _get(valueArray, `[${month.index}]`, '').split(' ').join('');\n\n if (!new RegExp(month.regex).test(monthValue)) {\n return month.message;\n }\n }\n\n if (year) {\n const valueArray = value.split('/');\n\n const yearValue = _get(valueArray, `[${year.index}]`, '').split(' ').join('');\n\n if (!new RegExp(year.regex).test(yearValue)) {\n return year.message;\n }\n }\n\n return undefined;\n };\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isValidDate = value =>\n value && !isValid(parse(value, 'dd/MM/yyyy', new Date())) ? 'Date is invalid' : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isValidUrlAsync = async value =>\n !value || (await isUrl(value)) ? undefined : 'Please enter a valid URL (starting with http:// or https://).';\nexport const isYearInRange =\n ({\n index,\n isShortYearFormat,\n lessThanCurrentYear\n }: {\n index: number;\n isShortYearFormat?: boolean;\n lessThanCurrentYear?: boolean;\n }) =>\n (value = '') => {\n const year = value.split('/')[index];\n const currentYear = format(new Date(), isShortYearFormat ? 'yy' : 'yyyy');\n\n if (\n !lessThanCurrentYear &&\n (parseInt(year, 10) < parseInt(currentYear, 10) || parseInt(year, 10) > parseInt(currentYear, 10) + 15)\n ) {\n if (parseInt(year, 10) < parseInt(currentYear, 10)) {\n return `Year must be a year equal or greater than ${parseInt(currentYear, 10)}`;\n }\n\n if (parseInt(year, 10) > parseInt(currentYear, 10) + 15) {\n return `Year must be a year less than ${parseInt(currentYear, 10) + 15}`;\n }\n\n return 'Please enter a valid year';\n }\n\n if (lessThanCurrentYear && parseInt(year, 10) > parseInt(currentYear, 10)) {\n return `Year must be a year equal or less than ${parseInt(currentYear, 10)}`;\n }\n\n return undefined;\n };\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isValidDOB = value => {\n const invalidDate = isValidDate(value);\n if (invalidDate) return invalidDate;\n const year = value.split('/')[2];\n const currentYear = format(new Date(), 'yyyy');\n\n if (parseInt(year, 10) > parseInt(currentYear, 10)) {\n return 'Year must be before current year.';\n }\n\n if (parseInt(year, 10) < 1900) {\n return 'Year must be greater than 1900';\n }\n\n return undefined;\n};\n// @ts-expect-error TS(7006): Parameter 'pattern' implicitly has an 'any' type.\nexport const matchesRegex = (pattern, message) => value =>\n !value || new RegExp(pattern).test(value) ? undefined : message;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isFutureDate = value => {\n const date = value && new Date(value.split('/')[2], value.split('/')[1] - 1, value.split('/')[0]);\n return isFuture(date) ? 'Date must not be in the future.' : undefined;\n};\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const isMoreThanThreeYears = value => {\n const dateToValidate = new Date(value.split('/')[2], value.split('/')[1] - 1, value.split('/')[0]);\n const dateThreeYearsAgo = new Date(new Date().getFullYear() - 3, new Date().getMonth(), new Date().getDate() - 1);\n return isBefore(dateToValidate, dateThreeYearsAgo) ? 'Date must not be more than 3 years ago.' : undefined;\n};\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasInvalidCharacters = value =>\n value && /[()]/.test(value) ? 'This field cannot contain ( or )' : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasStrictInvalidCharacters = value =>\n value && /[^A-Za-z0-9-' ]/.test(value)\n ? 'This field cannot contain any special characters except for space, hyphen and apostrophe under certain conditions'\n : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasDoubleSpaces = value => {\n return value && /\\s\\s+/g.test(value) ? 'There can be no double spaces in the supplied value' : undefined;\n};\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasWhitespaceAtStartOrEnd = value => {\n return value && /(^\\s+)|(\\s+$)/.test(value)\n ? 'There can be no spaces at the start or end of the supplied value'\n : undefined;\n};\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasSpaceAfterHyphen = value =>\n value && /([-]\\s)/.test(value) ? 'Name cannot have a space after a hyphen (-)' : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasSpaceBeforeHyphen = value =>\n value && /(\\s[-])/.test(value) ? 'Name cannot have a space before a hyphen (-)' : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasSpaceAfterApostrophe = value =>\n value && /([']\\s)/.test(value) ? \"Name cannot have a space after an apostrophe (')\" : undefined;\n// @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\nexport const hasSpaceBeforeApostrophe = value =>\n value && /(\\s['])/.test(value) ? \"Name cannot have a space before an apostrophe (')\" : undefined;\n\nexport const isValidAbn = (value: string) => {\n const isValid = _isValidAbn(value);\n if (isValid) return undefined;\n return 'Please enter a valid 11 digit ABN';\n};\n\nconst combineValidators =\n // @ts-expect-error TS(7019): Rest parameter 'fns' implicitly has an 'any[]' typ... Remove this comment to see the full error message\n\n\n (...fns) =>\n // @ts-expect-error TS(7006): Parameter 'value' implicitly has an 'any' type.\n value => {\n const validator = fns.find(fn => fn(value));\n\n if (validator) {\n return validator(value);\n }\n\n return undefined;\n };\n\nexport default combineValidators;\n"],"mappings":";;;;;;;;;;;AAYA,MAAa,mDAAmC,IAAI,OAAO,0CAA0C;AACrG,MAAa,wCAAwB,IAAI,OAAO,QAAQ;AAExD,MAAa,4DAA4C,IAAI,OAAO,6CAA6C;AACjH,MAAa,iDAAiC,IAAI,OAAO,WAAW;AAEpE,MAAa,0DAA0C,IAAI,OAAO,+BAA+B;AAEjG,MAAa,kCAAkB,IAAI,OACjC,wIACD;AAGD,MAAa,cAAa,UACxB,CAAC,SAAU,MAAM,QAAQ,CAAC,MAAM,MAAM,IAAM,SAAS,MAAM,IAAI,MAAM,WAAW,IAC5E,2BACA;AAEN,MAAa,YAAW,UAAU,SAAS,MAAM,MAAM,SAAS,GAAG,yCAAyC;AAC5G,MAAa,aAIR,QAAQ,UAAU,+BAA+B,cAElD,UACE,WAAW,QAAQ,SAAY;AACrC,MAAa,sBAIR,aAAa,UAAU,+BAEvB,OAAO,WACN,UAAU,OAAO,eAAe,SAAY;AAClD,MAAa,mBAIR,QAAQ,UAAU,sBAAsB,OAAO,kBAEhD,UACE,CAAC,SAAS,MAAM,WAAW,SAAS,SAAY;AAEtD,MAAa,gCAA+B,YAAU,UACpD,CAAC,SAAS,MAAM,MAAM,IAAI,CAAC,KAAK,GAAG,CAAC,UAAU,SAC1C,SACA,oCAAoC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S,gBAAgB,KAAK,MAAM,GACvC,qEACA;;AAGN,MAAa,uBAAsB,UACjC,SAAS,UAAU,KAAK,MAAM,GAAG,gDAAgD;AAEnF,MAAa,wBAAuB,UAClC,SAAS,UAAU,KAAK,MAAM,GAAG,iDAAiD;AAEpF,MAAa,2BAA0B,UACrC,SAAS,UAAU,KAAK,MAAM,GAAG,qDAAqD;AAExF,MAAa,4BAA2B,UACtC,SAAS,UAAU,KAAK,MAAM,GAAG,sDAAsD;AAEzF,MAAa,cAAc,UAAkB;AAE3C,KADgBA,aAAY,MAAM,CACrB,QAAO;AACpB,QAAO;;AAGT,MAAM,qBAID,GAAG,SAEJ,UAAS;CACP,MAAM,YAAY,IAAI,MAAK,OAAM,GAAG,MAAM,CAAC;AAE3C,KAAI,UACF,QAAO,UAAU,MAAM;;AAM/B,4BAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-state-formatted.js","names":[],"sources":["../src/workflow-state-formatted.ts"],"sourcesContent":["import { WORKFLOW_STATES } from './constants';\nimport _capitalize from 'lodash/capitalize';\n\nconst workflowStateFormatted = {\n [WORKFLOW_STATES.ERRORED]: _capitalize(WORKFLOW_STATES.ERRORED),\n [WORKFLOW_STATES.ARCHIVED]: _capitalize(WORKFLOW_STATES.ARCHIVED),\n [WORKFLOW_STATES.CANCELLED]: _capitalize(WORKFLOW_STATES.CANCELLED)\n};\n\nexport default workflowStateFormatted;\n"],"mappings":";;;;AAGA,MAAM,yBAAyB;EAC5B,gBAAgB,UAAU,YAAY,gBAAgB,QAAQ;EAC9D,gBAAgB,WAAW,YAAY,gBAAgB,SAAS;EAChE,gBAAgB,YAAY,YAAY,gBAAgB,UAAU;CACpE;AAED,uCAAe"}
|
|
1
|
+
{"version":3,"file":"workflow-state-formatted.js","names":[],"sources":["../src/workflow-state-formatted.ts"],"sourcesContent":["import { WORKFLOW_STATES } from './constants';\nimport _capitalize from 'lodash/capitalize.js';\n\nconst workflowStateFormatted = {\n [WORKFLOW_STATES.ERRORED]: _capitalize(WORKFLOW_STATES.ERRORED),\n [WORKFLOW_STATES.ARCHIVED]: _capitalize(WORKFLOW_STATES.ARCHIVED),\n [WORKFLOW_STATES.CANCELLED]: _capitalize(WORKFLOW_STATES.CANCELLED)\n};\n\nexport default workflowStateFormatted;\n"],"mappings":";;;;AAGA,MAAM,yBAAyB;EAC5B,gBAAgB,UAAU,YAAY,gBAAgB,QAAQ;EAC9D,gBAAgB,WAAW,YAAY,gBAAgB,SAAS;EAChE,gBAAgB,YAAY,YAAY,gBAAgB,UAAU;CACpE;AAED,uCAAe"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@medipass/utils",
|
|
3
|
-
"version": "12.0.
|
|
3
|
+
"version": "12.0.2-fix-type-issues.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -139,5 +139,5 @@
|
|
|
139
139
|
"vite-tsconfig-paths": "6.1.1",
|
|
140
140
|
"vitest": "4.1.5"
|
|
141
141
|
},
|
|
142
|
-
"gitHead": "
|
|
142
|
+
"gitHead": "ad8958c085a1d7e04bf85122ffb46c6cc108e13d"
|
|
143
143
|
}
|