fds-vue-core 8.6.5 → 8.6.6
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/fds-vue-core.cjs.js +29 -3
- package/dist/fds-vue-core.cjs.js.map +1 -1
- package/dist/fds-vue-core.es.js +29 -3
- package/dist/fds-vue-core.es.js.map +1 -1
- package/dist/helpers/validateSsn.d.ts +13 -2
- package/dist/index.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/components/Form/FdsSsn/FdsSsn.vue +2 -2
- package/src/helpers/validateSsn.ts +42 -4
- package/src/index.ts +2 -0
package/dist/fds-vue-core.cjs.js
CHANGED
|
@@ -20517,21 +20517,45 @@ function resolveSsnValidationOptions(options) {
|
|
|
20517
20517
|
function stripSsnSeparators(value) {
|
|
20518
20518
|
return normalizePidSearchValue(value);
|
|
20519
20519
|
}
|
|
20520
|
+
function convertPidTo12Digits(pid) {
|
|
20521
|
+
const stripped = stripSsnSeparators(pid);
|
|
20522
|
+
if (stripped.length < 2) return stripped;
|
|
20523
|
+
if (stripped.length === 12) return stripped;
|
|
20524
|
+
if (stripped.length !== 10) return stripped;
|
|
20525
|
+
const yy = stripped.slice(0, 2);
|
|
20526
|
+
const year = (/* @__PURE__ */ new Date()).getFullYear().toString();
|
|
20527
|
+
const yearToday = year.slice(2);
|
|
20528
|
+
const centuryToday = year.slice(0, 2);
|
|
20529
|
+
const lastCentury = (Number(centuryToday) - 1).toString();
|
|
20530
|
+
const pidCentury = yearToday < yy ? lastCentury : centuryToday;
|
|
20531
|
+
return `${pidCentury}${stripped}`;
|
|
20532
|
+
}
|
|
20520
20533
|
function validateSsnNumber(value, options) {
|
|
20521
20534
|
const trimmed = value.trim();
|
|
20522
20535
|
if (!trimmed) {
|
|
20523
20536
|
return INVALID_RESULT;
|
|
20524
20537
|
}
|
|
20538
|
+
const digits = convertPidTo12Digits(trimmed);
|
|
20539
|
+
if (digits.length !== 12) {
|
|
20540
|
+
return INVALID_RESULT;
|
|
20541
|
+
}
|
|
20525
20542
|
const resolvedOptions = resolveSsnValidationOptions(options);
|
|
20526
|
-
const isValid2 = src_default.valid(
|
|
20543
|
+
const isValid2 = src_default.valid(digits, resolvedOptions);
|
|
20527
20544
|
return {
|
|
20528
20545
|
isValid: isValid2,
|
|
20529
|
-
digits: isValid2 ?
|
|
20546
|
+
digits: isValid2 ? digits : null
|
|
20530
20547
|
};
|
|
20531
20548
|
}
|
|
20532
20549
|
function validateSsn(value, options) {
|
|
20533
20550
|
return validateSsnNumber(value, options).isValid;
|
|
20534
20551
|
}
|
|
20552
|
+
function normalizeSsn(value, options) {
|
|
20553
|
+
const result2 = validateSsnNumber(value, options);
|
|
20554
|
+
if (result2.digits) {
|
|
20555
|
+
return result2.digits;
|
|
20556
|
+
}
|
|
20557
|
+
return convertPidTo12Digits(value.trim());
|
|
20558
|
+
}
|
|
20535
20559
|
function getSsnValidationState(value, options) {
|
|
20536
20560
|
if (!value.trim()) {
|
|
20537
20561
|
return null;
|
|
@@ -20639,7 +20663,7 @@ const _sfc_main$9 = /* @__PURE__ */ vue.defineComponent({
|
|
|
20639
20663
|
return props.valid;
|
|
20640
20664
|
});
|
|
20641
20665
|
function normalizeValue2() {
|
|
20642
|
-
const normalized =
|
|
20666
|
+
const normalized = normalizeSsn(modelValue.value ?? "", validationOptions.value);
|
|
20643
20667
|
if (normalized !== (modelValue.value ?? "")) {
|
|
20644
20668
|
modelValue.value = normalized;
|
|
20645
20669
|
}
|
|
@@ -22002,6 +22026,7 @@ exports.bankid = bankid;
|
|
|
22002
22026
|
exports.buildCountryOptions = buildCountryOptions;
|
|
22003
22027
|
exports.capitalizeFirstLetter = capitalizeFirstLetter;
|
|
22004
22028
|
exports.clearUnsavedChanges = clearUnsavedChanges;
|
|
22029
|
+
exports.convertPidTo12Digits = convertPidTo12Digits;
|
|
22005
22030
|
exports.countryCodeToFlag = countryCodeToFlag;
|
|
22006
22031
|
exports.debounce = debounce;
|
|
22007
22032
|
exports.default = FdsVueCorePlugin;
|
|
@@ -22018,6 +22043,7 @@ exports.isRelativeHref = isRelativeHref;
|
|
|
22018
22043
|
exports.logoFeelgoodColored = logoFeelgoodColored;
|
|
22019
22044
|
exports.logoFeelgoodLight = logoFeelgoodLight;
|
|
22020
22045
|
exports.normalizePidSearchValue = normalizePidSearchValue;
|
|
22046
|
+
exports.normalizeSsn = normalizeSsn;
|
|
22021
22047
|
exports.parseRouteFiltersFromQuery = parseRouteFiltersFromQuery;
|
|
22022
22048
|
exports.resolveRouterLinkTarget = resolveRouterLinkTarget;
|
|
22023
22049
|
exports.serializeRouteFiltersToQuery = serializeRouteFiltersToQuery;
|