@powerhousedao/contributor-billing 0.0.12 → 0.0.13

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.
@@ -1 +1 @@
1
- {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,wCAAwC,CAAC;AA4BhD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,2CA6xB3C"}
1
+ {"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../../../editors/invoice/editor.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,wCAAwC,CAAC;AA4BhD,MAAM,MAAM,MAAM,GAAG,WAAW,CAAC,eAAe,CAAC,CAAC;AAElD,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,MAAM,2CAsyB3C"}
@@ -37,7 +37,6 @@ export default function Editor(props) {
37
37
  const [invoiceValidation, setInvoiceValidation] = useState(null);
38
38
  const [walletValidation, setWalletValidation] = useState(null);
39
39
  const [currencyValidation, setCurrencyValidation] = useState(null);
40
- const [countryValidation, setCountryValidation] = useState(null);
41
40
  const [ibanValidation, setIbanValidation] = useState(null);
42
41
  const [bicValidation, setBicValidation] = useState(null);
43
42
  const [bankNameValidation, setBankNameValidation] = useState(null);
@@ -46,6 +45,8 @@ export default function Editor(props) {
46
45
  const [postalCodeValidation, setPostalCodeValidation] = useState(null);
47
46
  const [payerEmailValidation, setPayerEmailValidation] = useState(null);
48
47
  const [lineItemValidation, setLineItemValidation] = useState(null);
48
+ const [mainCountryValidation, setMainCountryValidation] = useState(null);
49
+ const [bankCountryValidation, setBankCountryValidation] = useState(null);
49
50
  const prevStatus = useRef(state.status);
50
51
  const invoiceRootStyle = {
51
52
  width: "100vw",
@@ -267,15 +268,19 @@ export default function Editor(props) {
267
268
  if (currencyValidation && !currencyValidation.isValid) {
268
269
  validationErrors.push(currencyValidation);
269
270
  }
270
- // Validate country
271
- const country = state.issuer.paymentRouting?.bank?.address?.country &&
272
- state.issuer.country
273
- ? state.issuer.paymentRouting?.bank?.address?.country
274
- : "";
275
- const countryValidation = validateField("country", country, context);
276
- setCountryValidation(countryValidation);
277
- if (countryValidation && !countryValidation.isValid) {
278
- validationErrors.push(countryValidation);
271
+ // Validate main country
272
+ const mainCountry = state.issuer.country ?? "";
273
+ const mainCountryValidation = validateField("mainCountry", mainCountry, context);
274
+ setMainCountryValidation(mainCountryValidation);
275
+ if (mainCountryValidation && !mainCountryValidation.isValid) {
276
+ validationErrors.push(mainCountryValidation);
277
+ }
278
+ // Validate bank country
279
+ const bankCountry = state.issuer.paymentRouting?.bank?.address?.country ?? "";
280
+ const bankCountryValidation = validateField("bankCountry", bankCountry, context);
281
+ setBankCountryValidation(bankCountryValidation);
282
+ if (bankCountryValidation && !bankCountryValidation.isValid) {
283
+ validationErrors.push(bankCountryValidation);
279
284
  }
280
285
  // Validate EUR&GBP IBAN account number
281
286
  const ibanValidation = validateField("accountNum", state.issuer.paymentRouting?.bank?.accountNum, context);
@@ -386,7 +391,7 @@ export default function Editor(props) {
386
391
  dateDelivered: newValue,
387
392
  }));
388
393
  }
389
- }, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, countryvalidation: countryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-6", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className: "w-full", onChange: (e) => dispatch(actions.editInvoice({
394
+ }, value: state.dateDelivered || "" })] })] }), _jsx(LegalEntityForm, { legalEntity: state.issuer, onChangeInfo: (input) => dispatch(actions.editIssuer(input)), onChangeBank: (input) => dispatch(actions.editIssuerBank(input)), onChangeWallet: (input) => dispatch(actions.editIssuerWallet(input)), basicInfoDisabled: false, bankDisabled: !fiatMode, walletDisabled: fiatMode, currency: state.currency, status: state.status, walletvalidation: walletValidation, mainCountryValidation: mainCountryValidation, bankCountryValidation: bankCountryValidation, ibanvalidation: ibanValidation, bicvalidation: bicValidation, banknamevalidation: bankNameValidation, streetaddressvalidation: streetAddressValidation, cityvalidation: cityValidation, postalcodevalidation: postalCodeValidation, payeremailvalidation: payerEmailValidation })] }), _jsxs("div", { className: "border border-gray-200 rounded-lg p-6", children: [_jsx("h3", { className: "text-lg font-semibold mb-4", children: "Payer" }), _jsxs("div", { className: "mb-2", children: [_jsx("label", { className: "block mb-1 text-sm", children: "Due Date:" }), _jsx(DatePicker, { name: "dateDue", className: "w-full", onChange: (e) => dispatch(actions.editInvoice({
390
395
  dateDue: e.target.value.split("T")[0],
391
396
  })), value: state.dateDue })] }), _jsx(LegalEntityForm, { bankDisabled: true, legalEntity: state.payer, onChangeInfo: (input) => dispatch(actions.editPayer(input)), currency: state.currency, status: state.status, payeremailvalidation: payerEmailValidation })] })] }), _jsx("div", { className: "mb-8", children: _jsx(LineItemsTable, { currency: state.currency, lineItems: state.lineItems.map((item) => ({
392
397
  ...item,
@@ -401,5 +406,5 @@ export default function Editor(props) {
401
406
  }
402
407
  }, onChange: (e) => {
403
408
  setNotes(e.target.value);
404
- }, className: "p-2 mb-4" }) }) }), _jsx("div", { className: "col-span-1", children: _jsx("div", { className: "rounded-lg border border-gray-200 bg-gray-50 pt-6 pb-5 px-6 shadow-sm h-32", children: _jsxs("div", { className: "space-y-6", children: [_jsxs("div", { className: "flex justify-between text-gray-700", children: [_jsx("span", { className: "font-medium", children: "Subtotal (excl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxExcl), " ", state.currency] })] }), _jsxs("div", { className: "flex justify-between border-t border-gray-200 pt-6 text-lg font-bold text-gray-900", children: [_jsx("span", { children: "Total (incl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxIncl), " ", state.currency] })] })] }) }) })] }), state.status === "PAYMENTSCHEDULED" && (_jsx("div", { className: "mt-8", children: !isFiatCurrency(state.currency) ? (_jsx(InvoiceToGnosis, { docState: state })) : (_jsx(RequestFinance, { docState: state })) }))] }));
409
+ }, className: "p-2 mb-4" }) }) }), _jsx("div", { className: "col-span-1", children: _jsx("div", { className: "rounded-lg border border-gray-200 bg-gray-50 p-6 shadow-sm h-32", children: _jsxs("div", { className: "", children: [_jsxs("div", { className: "flex justify-between text-gray-700", children: [_jsx("span", { className: "font-medium", children: "Subtotal (excl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxExcl), " ", state.currency] })] }), _jsxs("div", { className: "flex justify-between border-t border-gray-200 pt-6 text-lg font-bold text-gray-900", children: [_jsx("span", { children: "Total (incl. tax):" }), _jsxs("span", { children: [formatNumber(itemsTotalTaxIncl), " ", state.currency] })] })] }) }) })] }), state.status === "PAYMENTSCHEDULED" && (_jsx("div", { className: "mt-8", children: !isFiatCurrency(state.currency) ? (_jsx(InvoiceToGnosis, { docState: state })) : (_jsx(RequestFinance, { docState: state })) }))] }));
405
410
  }
@@ -8,7 +8,8 @@ export type LegalEntityMainSectionProps = Omit<ComponentPropsWithRef<"div">, "ch
8
8
  readonly value: EditLegalEntityInput;
9
9
  readonly onChange: (value: EditLegalEntityInput) => void;
10
10
  readonly disabled?: boolean;
11
- readonly countryvalidation?: ValidationResult | null;
11
+ readonly mainCountryValidation?: ValidationResult | null;
12
+ readonly bankCountryValidation?: ValidationResult | null;
12
13
  readonly streetaddressvalidation?: ValidationResult | null;
13
14
  readonly cityvalidation?: ValidationResult | null;
14
15
  readonly postalcodevalidation?: ValidationResult | null;
@@ -26,7 +27,8 @@ type LegalEntityFormProps = {
26
27
  readonly currency: string;
27
28
  readonly status: string;
28
29
  readonly walletvalidation?: ValidationResult | null;
29
- readonly countryvalidation?: ValidationResult | null;
30
+ readonly mainCountryValidation?: ValidationResult | null;
31
+ readonly bankCountryValidation?: ValidationResult | null;
30
32
  readonly ibanvalidation?: ValidationResult | null;
31
33
  readonly bicvalidation?: ValidationResult | null;
32
34
  readonly banknamevalidation?: ValidationResult | null;
@@ -35,6 +37,6 @@ type LegalEntityFormProps = {
35
37
  readonly postalcodevalidation?: ValidationResult | null;
36
38
  readonly payeremailvalidation?: ValidationResult | null;
37
39
  };
38
- export declare function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, countryvalidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation }: LegalEntityFormProps): import("react/jsx-runtime").JSX.Element;
40
+ export declare function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, mainCountryValidation, bankCountryValidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, }: LegalEntityFormProps): import("react/jsx-runtime").JSX.Element;
39
41
  export {};
40
42
  //# sourceMappingURL=legalEntity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"legalEntity.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/legalEntity/legalE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E,gBAAgB,GAAG,IAAI,CAAC;IACxD,QAAQ,CAAC,oBAAoB,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;CACzD,CAAC;AA+BF,wBAAgB,eAAe,CAAC,EAC9B,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,MAAM,EACN,gBAAgB,EAChB,qBAAqB,EACrB,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,EACd,oBAAoB,EACpB,oBAAoB,GACrB,EAAE,oBAAoB,2CAyCtB"}
@@ -6,7 +6,7 @@ import { CountryForm } from "../components/countryForm.js";
6
6
  import { InputField } from "../components/inputField.js";
7
7
  const FieldLabel = ({ children }) => (_jsx("label", { className: "block text-sm font-medium text-gray-700", children: children }));
8
8
  export const LegalEntityMainSection = (props) => {
9
- const { value, onChange, disabled, countryvalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, ...divProps } = props;
9
+ const { value, onChange, disabled, mainCountryValidation, bankCountryValidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, ...divProps } = props;
10
10
  const handleInputChange = (field) => (e) => {
11
11
  // No-op
12
12
  };
@@ -23,7 +23,7 @@ export const LegalEntityMainSection = (props) => {
23
23
  onChange({ [field]: e.target.value });
24
24
  }
25
25
  };
26
- return (_jsxs("div", { ...divProps, className: twMerge("rounded-lg border border-gray-200 bg-white p-6 mb-2", props.className), children: [_jsx("h3", { className: "mb-4 text-lg font-semibold text-gray-900", children: "Basic Information" }), _jsxs("div", { className: "space-y-6", children: [_jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.name ?? "", label: "Name", placeholder: "Legal Entity Name", onBlur: handleTextareaBlur("name"), handleInputChange: handleTextareaChange("name"), className: "h-10 w-full text-md mb-2" }) }), _jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.id ?? "", label: "Tax ID / Corp. Reg", placeholder: "332...", onBlur: handleTextareaBlur("id"), handleInputChange: handleTextareaChange("id"), className: "h-10 w-full text-md mb-2" }) }), _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "space-y-4", children: [_jsx(InputField, { value: value.streetAddress ?? "", label: "Address", placeholder: "Street Address", onBlur: handleTextareaBlur("streetAddress"), handleInputChange: handleTextareaChange("streetAddress"), className: "h-10 w-full text-md mb-2", validation: streetaddressvalidation }), _jsx(InputField, { value: value.extendedAddress ?? "", placeholder: "Extended Address", onBlur: handleTextareaBlur("extendedAddress"), handleInputChange: handleTextareaChange("extendedAddress"), className: "h-10 w-full text-md mb-2" })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.city ?? "", label: "City", placeholder: "City", onBlur: handleTextareaBlur("city"), handleInputChange: handleTextareaChange("city"), className: "h-10 w-full text-md mb-2", validation: cityvalidation }) }), _jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.stateProvince ?? "", label: "State/Province", placeholder: "State/Province", onBlur: handleTextareaBlur("stateProvince"), handleInputChange: handleTextareaChange("stateProvince"), className: "h-10 w-full text-md mb-2" }) })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.postalCode ?? "", label: "Postal Code", placeholder: "Postal Code", onBlur: handleTextareaBlur("postalCode"), handleInputChange: handleTextareaChange("postalCode"), className: "h-10 w-full text-md mb-2", validation: postalcodevalidation }) }), _jsxs("div", { className: "space-y-2", children: [_jsx(FieldLabel, { children: "Country" }), _jsx(CountryForm, { country: value.country ?? "", handleInputChange: handleInputChange("country"), handleBlur: handleBlur("country"), className: "h-10 w-full text-md mb-2", validation: countryvalidation })] })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.email ?? "", label: "Email", placeholder: "Email", onBlur: handleTextareaBlur("email"), handleInputChange: handleTextareaChange("email"), className: "h-10 w-full text-md mb-2", validation: payeremailvalidation }) }), _jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.tel ?? "", label: "Telephone", placeholder: "Telephone", onBlur: handleTextareaBlur("tel"), handleInputChange: handleTextareaChange("tel"), className: "h-10 w-full text-md mb-2" }) })] })] })] }));
26
+ return (_jsxs("div", { ...divProps, className: twMerge("rounded-lg border border-gray-200 bg-white p-6 mb-2", props.className), children: [_jsx("h3", { className: "mb-4 text-lg font-semibold text-gray-900", children: "Basic Information" }), _jsxs("div", { className: "space-y-6", children: [_jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.name ?? "", label: "Name", placeholder: "Legal Entity Name", onBlur: handleTextareaBlur("name"), handleInputChange: handleTextareaChange("name"), className: "h-10 w-full text-md mb-2" }) }), _jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.id ?? "", label: "Tax ID / Corp. Reg", placeholder: "332...", onBlur: handleTextareaBlur("id"), handleInputChange: handleTextareaChange("id"), className: "h-10 w-full text-md mb-2" }) }), _jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "space-y-4", children: [_jsx(InputField, { value: value.streetAddress ?? "", label: "Address", placeholder: "Street Address", onBlur: handleTextareaBlur("streetAddress"), handleInputChange: handleTextareaChange("streetAddress"), className: "h-10 w-full text-md mb-2", validation: streetaddressvalidation }), _jsx(InputField, { value: value.extendedAddress ?? "", placeholder: "Extended Address", onBlur: handleTextareaBlur("extendedAddress"), handleInputChange: handleTextareaChange("extendedAddress"), className: "h-10 w-full text-md mb-2" })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.city ?? "", label: "City", placeholder: "City", onBlur: handleTextareaBlur("city"), handleInputChange: handleTextareaChange("city"), className: "h-10 w-full text-md mb-2", validation: cityvalidation }) }), _jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.stateProvince ?? "", label: "State/Province", placeholder: "State/Province", onBlur: handleTextareaBlur("stateProvince"), handleInputChange: handleTextareaChange("stateProvince"), className: "h-10 w-full text-md mb-2" }) })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.postalCode ?? "", label: "Postal Code", placeholder: "Postal Code", onBlur: handleTextareaBlur("postalCode"), handleInputChange: handleTextareaChange("postalCode"), className: "h-10 w-full text-md mb-2", validation: postalcodevalidation }) }), _jsxs("div", { className: "space-y-2", children: [_jsx(FieldLabel, { children: "Country" }), _jsx(CountryForm, { country: value.country ?? "", handleInputChange: handleInputChange("country"), handleBlur: handleBlur("country"), className: "h-10 w-full text-md mb-2", validation: mainCountryValidation })] })] })] }), _jsxs("div", { className: "grid grid-cols-2 gap-4", children: [_jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.email ?? "", label: "Email", placeholder: "Email", onBlur: handleTextareaBlur("email"), handleInputChange: handleTextareaChange("email"), className: "h-10 w-full text-md mb-2", validation: payeremailvalidation }) }), _jsx("div", { className: "space-y-2", children: _jsx(InputField, { value: value.tel ?? "", label: "Telephone", placeholder: "Telephone", onBlur: handleTextareaBlur("tel"), handleInputChange: handleTextareaChange("tel"), className: "h-10 w-full text-md mb-2" }) })] })] })] }));
27
27
  };
28
28
  // Helper to flatten LegalEntity to EditLegalEntityInput
29
29
  function flattenLegalEntityToEditInput(legalEntity) {
@@ -52,12 +52,12 @@ function flattenLegalEntityToEditInput(legalEntity) {
52
52
  email: legalEntity.contactInfo?.email ?? "",
53
53
  };
54
54
  }
55
- export function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, countryvalidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation }) {
55
+ export function LegalEntityForm({ legalEntity, onChangeInfo, onChangeBank, onChangeWallet, basicInfoDisabled, bankDisabled, walletDisabled, currency, status, walletvalidation, mainCountryValidation, bankCountryValidation, ibanvalidation, bicvalidation, banknamevalidation, streetaddressvalidation, cityvalidation, postalcodevalidation, payeremailvalidation, }) {
56
56
  // Handler for main info section
57
57
  const handleChangeInfo = (update) => {
58
58
  if (!onChangeInfo)
59
59
  return;
60
60
  onChangeInfo(update);
61
61
  };
62
- return (_jsxs("div", { className: "space-y-8", children: [!basicInfoDisabled && !!onChangeInfo && (_jsx(LegalEntityMainSection, { onChange: handleChangeInfo, value: flattenLegalEntityToEditInput(legalEntity), countryvalidation: countryvalidation, streetaddressvalidation: streetaddressvalidation, cityvalidation: cityvalidation, postalcodevalidation: postalcodevalidation, payeremailvalidation: payeremailvalidation })), !walletDisabled && !!onChangeWallet && (_jsx(LegalEntityWalletSection, { onChange: onChangeWallet, value: legalEntity.paymentRouting?.wallet || {}, currency: currency, status: status, walletvalidation: walletvalidation })), !bankDisabled && !!onChangeBank && (_jsx(LegalEntityBankSection, { onChange: onChangeBank, value: legalEntity.paymentRouting?.bank || {}, countryvalidation: countryvalidation, ibanvalidation: ibanvalidation, bicvalidation: bicvalidation, banknamevalidation: banknamevalidation }))] }));
62
+ return (_jsxs("div", { className: "space-y-8", children: [!basicInfoDisabled && !!onChangeInfo && (_jsx(LegalEntityMainSection, { onChange: handleChangeInfo, value: flattenLegalEntityToEditInput(legalEntity), mainCountryValidation: mainCountryValidation, streetaddressvalidation: streetaddressvalidation, cityvalidation: cityvalidation, postalcodevalidation: postalcodevalidation, payeremailvalidation: payeremailvalidation })), !walletDisabled && !!onChangeWallet && (_jsx(LegalEntityWalletSection, { onChange: onChangeWallet, value: legalEntity.paymentRouting?.wallet || {}, currency: currency, status: status, walletvalidation: walletvalidation })), !bankDisabled && !!onChangeBank && (_jsx(LegalEntityBankSection, { onChange: onChangeBank, value: legalEntity.paymentRouting?.bank || {}, countryvalidation: bankCountryValidation, ibanvalidation: ibanvalidation, bicvalidation: bicvalidation, banknamevalidation: banknamevalidation }))] }));
63
63
  }
@@ -1 +1 @@
1
- {"version":3,"file":"validationManager.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/validation/validationManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAInE,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,kBAAkB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,gBAAgB,CAAC;IAC1D,SAAS,EAAE;QACP,UAAU,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;QAClC,iBAAiB,EAAE;YACf,IAAI,EAAE,MAAM,EAAE,CAAC;YACf,EAAE,EAAE,MAAM,EAAE,CAAC;SAChB,CAAC;KACL,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC;AA8BF,wBAAgB,aAAa,CACzB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,iBAAiB,GAC3B,gBAAgB,GAAG,IAAI,CAqBzB;AAGD,wBAAgB,wBAAwB,CACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,OAAO,EAAE,iBAAiB,GAC3B,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAalC;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAE5D;AAGD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKxD"}
1
+ {"version":3,"file":"validationManager.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/validation/validationManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,2CAA2C,CAAC;AAInE,MAAM,MAAM,kBAAkB,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;AAE9D,MAAM,MAAM,gBAAgB,GAAG;IAC3B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,kBAAkB,CAAC;CAChC,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,OAAO,CAAC,EAAE,GAAG,KAAK,gBAAgB,CAAC;IAC1D,SAAS,EAAE;QACP,UAAU,EAAE,KAAK,CAAC,MAAM,GAAG,KAAK,CAAC,CAAC;QAClC,iBAAiB,EAAE;YACf,IAAI,EAAE,MAAM,EAAE,CAAC;YACf,EAAE,EAAE,MAAM,EAAE,CAAC;SAChB,CAAC;KACL,CAAC;CACL,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,aAAa,EAAE,MAAM,CAAC;IACtB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAC;AA+BF,wBAAgB,aAAa,CACzB,KAAK,EAAE,MAAM,EACb,KAAK,EAAE,GAAG,EACV,OAAO,EAAE,iBAAiB,GAC3B,gBAAgB,GAAG,IAAI,CAqBzB;AAGD,wBAAgB,wBAAwB,CACpC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAC3B,OAAO,EAAE,iBAAiB,GAC3B,MAAM,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAalC;AAGD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,cAAc,GAAG,IAAI,CAE5D;AAGD,wBAAgB,oBAAoB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAKxD"}
@@ -1,11 +1,12 @@
1
- import { accountNumberRule, bicNumberRule, bankNameRule, countryRule, currencyRule, ethereumAddressRule, invoiceNumberRule, issuerPostalCodeRule, issuerStreetAddressRule, issuerCityRule, payerEmailRule, lineItemRule } from "./validationRules.js";
1
+ import { accountNumberRule, bicNumberRule, bankNameRule, currencyRule, ethereumAddressRule, invoiceNumberRule, issuerPostalCodeRule, issuerStreetAddressRule, issuerCityRule, payerEmailRule, lineItemRule, mainCountryRule, bankCountryRule } from "./validationRules.js";
2
2
  // Validation rules registry
3
3
  const validationRules = [];
4
4
  // Register rules
5
5
  validationRules.push(invoiceNumberRule);
6
6
  validationRules.push(ethereumAddressRule);
7
7
  validationRules.push(currencyRule);
8
- validationRules.push(countryRule);
8
+ validationRules.push(mainCountryRule);
9
+ validationRules.push(bankCountryRule);
9
10
  validationRules.push(accountNumberRule);
10
11
  validationRules.push(bicNumberRule);
11
12
  validationRules.push(bankNameRule);
@@ -2,7 +2,8 @@ import { ValidationRule } from "./validationManager.js";
2
2
  export declare const invoiceNumberRule: ValidationRule;
3
3
  export declare const ethereumAddressRule: ValidationRule;
4
4
  export declare const currencyRule: ValidationRule;
5
- export declare const countryRule: ValidationRule;
5
+ export declare const mainCountryRule: ValidationRule;
6
+ export declare const bankCountryRule: ValidationRule;
6
7
  export declare const accountNumberRule: ValidationRule;
7
8
  export declare const bicNumberRule: ValidationRule;
8
9
  export declare const bankNameRule: ValidationRule;
@@ -1 +1 @@
1
- {"version":3,"file":"validationRules.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/validation/validationRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAmBxD,eAAO,MAAM,iBAAiB,EAAE,cAuB/B,CAAC;AAGF,eAAO,MAAM,mBAAmB,EAAE,cA8BjC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAuB1B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,cAuBzB,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,cA8B/B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,cAkC3B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAuB1B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,cAuBrC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cAuB5B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,cAuBlC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cA8B5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAuB1B,CAAC"}
1
+ {"version":3,"file":"validationRules.d.ts","sourceRoot":"","sources":["../../../../editors/invoice/validation/validationRules.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AAmBxD,eAAO,MAAM,iBAAiB,EAAE,cAuB/B,CAAC;AAGF,eAAO,MAAM,mBAAmB,EAAE,cA8BjC,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAuB1B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAuB7B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,cAuB7B,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,cA8B/B,CAAC;AAEF,eAAO,MAAM,aAAa,EAAE,cAkC3B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAuB1B,CAAC;AAEF,eAAO,MAAM,uBAAuB,EAAE,cAuBrC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cAuB5B,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,cAuBlC,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,cA8B5B,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,cAuB1B,CAAC"}
@@ -92,8 +92,8 @@ export const currencyRule = {
92
92
  }
93
93
  }
94
94
  };
95
- export const countryRule = {
96
- field: 'country',
95
+ export const mainCountryRule = {
96
+ field: 'mainCountry',
97
97
  validate: (value) => {
98
98
  if (!value || value.trim() === '') {
99
99
  return {
@@ -116,6 +116,30 @@ export const countryRule = {
116
116
  }
117
117
  }
118
118
  };
119
+ export const bankCountryRule = {
120
+ field: 'bankCountry',
121
+ validate: (value) => {
122
+ if (!value || value.trim() === '') {
123
+ return {
124
+ isValid: false,
125
+ message: 'Bank country is required',
126
+ severity: 'warning'
127
+ };
128
+ }
129
+ return {
130
+ isValid: true,
131
+ message: '',
132
+ severity: 'none'
133
+ };
134
+ },
135
+ appliesTo: {
136
+ currencies: ['USD', 'EUR', 'GBP', 'JPY', 'CNY', 'CHF'],
137
+ statusTransitions: {
138
+ from: ['DRAFT'],
139
+ to: ['ISSUED']
140
+ }
141
+ }
142
+ };
119
143
  export const accountNumberRule = {
120
144
  field: 'accountNum',
121
145
  validate: (value) => {
package/dist/style.css CHANGED
@@ -660,9 +660,6 @@
660
660
  .pr-8 {
661
661
  padding-right: calc(var(--spacing) * 8);
662
662
  }
663
- .pb-5 {
664
- padding-bottom: calc(var(--spacing) * 5);
665
- }
666
663
  .text-center {
667
664
  text-align: center;
668
665
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@powerhousedao/contributor-billing",
3
3
  "description": "Document models that help contributors of open organisations get paid anonymously for their work on a monthly basis.",
4
- "version": "0.0.12",
4
+ "version": "0.0.13",
5
5
  "license": "AGPL-3.0-only",
6
6
  "type": "module",
7
7
  "files": [