@swan-io/shared-business 13.7.12 → 13.7.14

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swan-io/shared-business",
3
- "version": "13.7.12",
3
+ "version": "13.7.14",
4
4
  "engines": {
5
5
  "node": ">22.12.0"
6
6
  },
@@ -25,7 +25,7 @@
25
25
  ],
26
26
  "license": "MIT",
27
27
  "peerDependencies": {
28
- "@swan-io/lake": "13.7.12"
28
+ "@swan-io/lake": "13.7.14"
29
29
  },
30
30
  "dependencies": {
31
31
  "@formatjs/intl": "^4.1.2",
@@ -50,6 +50,6 @@
50
50
  "@types/react-dom": "^19.2.3",
51
51
  "@types/react-native": "^0.72.8",
52
52
  "type-fest": "^5.4.3",
53
- "@swan-io/lake": "13.7.12"
53
+ "@swan-io/lake": "13.7.14"
54
54
  }
55
55
  }
@@ -1,14 +1,10 @@
1
1
  import { jsx as _jsx } from "react/jsx-runtime";
2
- import { Icon } from "@swan-io/lake/src/components/Icon";
3
2
  import { LakeLabel } from "@swan-io/lake/src/components/LakeLabel";
4
3
  import { LakeTextInput } from "@swan-io/lake/src/components/LakeTextInput";
5
- import { LakeTooltip } from "@swan-io/lake/src/components/LakeTooltip";
6
- import { colors } from "@swan-io/lake/src/constants/design";
7
4
  import { t } from "../utils/i18n";
8
- import { getCompanyTaxNumberHelp, getCompanyTaxNumberPlaceholder, getIndividualTaxNumberHelp, getIndividualTaxNumberPlaceholder, getTaxNumberTooltip, } from "../utils/validation";
5
+ import { getCompanyTaxNumberHelp, getCompanyTaxNumberPlaceholder, getIndividualTaxNumberHelp, getIndividualTaxNumberPlaceholder, } from "../utils/validation";
9
6
  export const TaxIdentificationNumberInput = ({ ref, value, error, valid, disabled, onChange, onBlur, country, isCompany, required, label = t("taxIdentificationNumber.label"), placeholder = isCompany
10
7
  ? getCompanyTaxNumberPlaceholder(country)
11
8
  : getIndividualTaxNumberPlaceholder(country), }) => {
12
- const tooltipContents = getTaxNumberTooltip(country, isCompany);
13
- return (_jsx(LakeLabel, { label: label, optionalLabel: required === true ? undefined : t("common.optional"), help: tooltipContents != null ? (_jsx(LakeTooltip, { content: tooltipContents, placement: "right", children: _jsx(Icon, { name: "question-circle-regular", size: 16, color: colors.gray[600] }) })) : null, render: id => (_jsx(LakeTextInput, { id: id, ref: ref, placeholder: placeholder, help: isCompany ? getCompanyTaxNumberHelp(country) : getIndividualTaxNumberHelp(country), value: value, error: error, valid: valid, disabled: disabled, onChangeText: onChange, onBlur: onBlur })) }));
9
+ return (_jsx(LakeLabel, { label: label, optionalLabel: required === true ? undefined : t("common.optional"), render: id => (_jsx(LakeTextInput, { id: id, ref: ref, placeholder: placeholder, help: isCompany ? getCompanyTaxNumberHelp(country) : getIndividualTaxNumberHelp(country), value: value, error: error, valid: valid, disabled: disabled, onChangeText: onChange, onBlur: onBlur })) }));
14
10
  };
@@ -1,5 +1,5 @@
1
1
  import { describe, expect, test } from "vitest";
2
- import { getCompanyTaxNumberHelp, getCompanyTaxNumberPlaceholder, getIndividualTaxNumberHelp, getIndividualTaxNumberPlaceholder, getTaxNumberTooltip, isValidEmail, isValidUsaTaxNumber, sanitizeDecimal, validateArrayRequired, validateBooleanRequired, validateBooleanTypeRequired, validateCompanyTaxNumber, validateDate, validateIndividualTaxNumber, validateName, validateNullableRequired, validateRequired, } from "../validation";
2
+ import { getCompanyTaxNumberHelp, getCompanyTaxNumberPlaceholder, getIndividualTaxNumberHelp, getIndividualTaxNumberPlaceholder, isValidEmail, isValidUsaTaxNumber, sanitizeDecimal, validateArrayRequired, validateBooleanRequired, validateBooleanTypeRequired, validateCompanyTaxNumber, validateDate, validateIndividualTaxNumber, validateName, validateNullableRequired, validateRequired, } from "../validation";
3
3
  describe("isValidEmail", () => {
4
4
  test("validates correct email addresses", () => {
5
5
  expect(isValidEmail("test@example.com")).toBe(true);
@@ -329,16 +329,6 @@ describe("Tax number helper functions", () => {
329
329
  expect(placeholder).toBeTypeOf("string");
330
330
  });
331
331
  });
332
- describe("getTaxNumberTooltip", () => {
333
- test("returns tooltips for specific countries", () => {
334
- expect(getTaxNumberTooltip("DEU")).toBeTypeOf("string");
335
- expect(getTaxNumberTooltip("ESP")).toBe("Número de Identificación Fiscal");
336
- expect(getTaxNumberTooltip("ITA")).toBeTypeOf("string");
337
- });
338
- test("returns undefined for countries without specific tooltips", () => {
339
- expect(getTaxNumberTooltip("FRA")).toBeUndefined();
340
- });
341
- });
342
332
  describe("getIndividualTaxNumberHelp", () => {
343
333
  test("returns correct help text for all countries", () => {
344
334
  expect(getIndividualTaxNumberHelp("BEL")).toBeTypeOf("string");
@@ -22,6 +22,5 @@ export declare const validateDate: (value: ExtractedDate | undefined) => string
22
22
  export declare const validateBirthdate: (value: ExtractedDate | undefined) => string | undefined;
23
23
  export declare const getIndividualTaxNumberPlaceholder: (country: IndividualCountryCCA3 | CompanyCountryCCA3) => string;
24
24
  export declare const getCompanyTaxNumberPlaceholder: (country: IndividualCountryCCA3 | CompanyCountryCCA3) => string;
25
- export declare const getTaxNumberTooltip: (country: IndividualCountryCCA3 | CompanyCountryCCA3, isCompany?: boolean) => string | undefined;
26
25
  export declare const getCompanyTaxNumberHelp: (country: CompanyCountryCCA3) => string;
27
26
  export declare const getIndividualTaxNumberHelp: (country: IndividualCountryCCA3) => string;
@@ -248,10 +248,5 @@ export const getCompanyTaxNumberPlaceholder = (country) => match(country)
248
248
  .with("ESP", () => `${t("common.form.taxIdentificationNumber.placeholder")} (Número de Identificación Fiscal)`)
249
249
  .with("ITA", () => `${t("common.form.taxIdentificationNumber.placeholder")} (Codice fiscale)`)
250
250
  .otherwise(() => t("common.form.taxIdentificationNumber.placeholder"));
251
- export const getTaxNumberTooltip = (country, isCompany = false) => match(country)
252
- .with("DEU", () => `Persönliche ${isCompany ? "Steuernummer" : "Steueridentifikationsnummer"} des wirtschaftlich Berechtigten`)
253
- .with("ESP", () => "Número de Identificación Fiscal") // no need to translate
254
- .with("ITA", () => t("common.form.taxIdentificationNumber.tooltip.ita"))
255
- .otherwise(() => undefined);
256
251
  export const getCompanyTaxNumberHelp = (country) => { var _a, _b; return (_b = (_a = TAX_NUMBER_REGEX.company[country]) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : ""; };
257
252
  export const getIndividualTaxNumberHelp = (country) => { var _a, _b; return (_b = (_a = TAX_NUMBER_REGEX.individual[country]) === null || _a === void 0 ? void 0 : _a.message) !== null && _b !== void 0 ? _b : ""; };