@unimaze/billing 1.0.0 → 1.0.1

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.
@@ -15,6 +15,10 @@ export declare const translationMessages: {
15
15
  id: string;
16
16
  defaultMessage: string;
17
17
  };
18
+ sessionBar_logout: {
19
+ id: string;
20
+ defaultMessage: string;
21
+ };
18
22
  };
19
23
  interface Props extends WrappedComponentProps {
20
24
  person: LoggedInPerson;
@@ -24,6 +28,8 @@ interface Props extends WrappedComponentProps {
24
28
  onChangeSeller: () => void;
25
29
  /** Link to the delegation pages, shown only to procuration holders */
26
30
  delegationsUrl?: string;
31
+ /** Shows "Log out" at the end of the bar */
32
+ onLogout?: () => void;
27
33
  isMobile?: boolean;
28
34
  }
29
35
  declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<Props, "intl"> & {
@@ -50,6 +50,10 @@ exports.translationMessages = (0, react_intl_1.defineMessages)({
50
50
  id: "sessionBar_delegations",
51
51
  defaultMessage: "Powers of attorney",
52
52
  },
53
+ sessionBar_logout: {
54
+ id: "sessionBar_logout",
55
+ defaultMessage: "Log out",
56
+ },
53
57
  });
54
58
  /** Who is logged in and for whom the invoice is sent, on every step of a portal that requires login */
55
59
  var SessionBar = function (props) {
@@ -58,8 +62,9 @@ var SessionBar = function (props) {
58
62
  : undefined;
59
63
  var changeLabel = props.intl.formatMessage(exports.translationMessages.sessionBar_change);
60
64
  var delegationsLabel = props.intl.formatMessage(exports.translationMessages.sessionBar_delegations);
65
+ var logoutLabel = props.intl.formatMessage(exports.translationMessages.sessionBar_logout);
61
66
  if (props.isMobile) {
62
- var items = __spreadArray(__spreadArray(__spreadArray([], (onBehalfOf ? [{ key: "seller", label: onBehalfOf, disabled: true }] : []), true), (props.canChangeSeller ? [{ key: "change", label: changeLabel, onClick: props.onChangeSeller }] : []), true), (props.delegationsUrl ? [{ key: "delegations", label: React.createElement("a", { href: props.delegationsUrl }, delegationsLabel) }] : []), true);
67
+ var items = __spreadArray(__spreadArray(__spreadArray(__spreadArray([], (onBehalfOf ? [{ key: "seller", label: onBehalfOf, disabled: true }] : []), true), (props.canChangeSeller ? [{ key: "change", label: changeLabel, onClick: props.onChangeSeller }] : []), true), (props.delegationsUrl ? [{ key: "delegations", label: React.createElement("a", { href: props.delegationsUrl }, delegationsLabel) }] : []), true), (props.onLogout ? [{ key: "logout", label: logoutLabel, onClick: props.onLogout }] : []), true);
63
68
  return (React.createElement(antd_1.Flex, { justify: "end", style: { width: "100%", padding: "0 20px" } },
64
69
  React.createElement(antd_1.Dropdown, { menu: { items: items }, trigger: ["click"], disabled: items.length === 0 },
65
70
  React.createElement(antd_1.Button, { type: "text", icon: React.createElement(icons_1.UserOutlined, null) }, props.person.name))));
@@ -74,6 +79,9 @@ var SessionBar = function (props) {
74
79
  changeLabel)),
75
80
  props.delegationsUrl && (React.createElement(antd_1.Typography.Link, { href: props.delegationsUrl },
76
81
  "\u00B7 ",
77
- delegationsLabel))));
82
+ delegationsLabel)),
83
+ props.onLogout && (React.createElement(antd_1.Typography.Link, { onClick: props.onLogout },
84
+ "\u00B7 ",
85
+ logoutLabel))));
78
86
  };
79
87
  exports.default = (0, react_intl_1.injectIntl)(SessionBar);
@@ -190,8 +190,9 @@ var Supplier = function (props) {
190
190
  return !props.outsideVatScope;
191
191
  };
192
192
  (0, react_1.useEffect)(function () {
193
- if (participantInfo !== null && participantInfo !== undefined) {
194
- // TODO: this will override the Form Initial values. consider changing so that it only overrides if there is a value
193
+ // only the anonymous lookup (by typed identifier) populates legalName; skip the mount-time empty state so it
194
+ // doesn't clear the supplier name/address that the "Myself"/"On behalf of" selection just filled in
195
+ if (participantInfo === null || participantInfo === void 0 ? void 0 : participantInfo.legalName) {
195
196
  props.form.setFieldsValue({
196
197
  invoice: {
197
198
  supplier: {
@@ -39,6 +39,8 @@ export interface CommonProps {
39
39
  onLoginRequired?: () => void;
40
40
  /** IdentityServer page where a procuration holder grants or revokes delegations (umboð) */
41
41
  delegationsUrl?: string;
42
+ /** Shows "Log out" in the session bar; called when the person wants to end their session */
43
+ onLogout?: () => void;
42
44
  }
43
45
  export interface LoggedInPerson {
44
46
  /** e.g. 0196:0101019990 */
@@ -111,6 +111,6 @@ var CreateInvoice = function (props) {
111
111
  react_1.default.createElement(react_intl_1.IntlProvider, { locale: languageString, defaultLocale: "is", key: languageString, messages: locales_1.default[languageString] },
112
112
  react_1.default.createElement(index_1.default, { customers: props.customers, language: languageString, mapiBaseUrl: props.mapiBaseUrl, rapiBaseUrl: props.rapiBaseUrl, localStorageFormDataVersion: props.localStorageFormDataVersion, rapiApiKey: props.rapiApiKey, receiverRequirements: props.receiverRequirements, getReceiverRequirements: props.getReceiverRequirements, updateReceiverRequirementsProp: props.updateReceiverRequirementsProp,
113
113
  // legalIdentifier={props.legalIdentifier}
114
- uploadSizeLimit: props.uploadSizeLimit, attachmentTooltipText: props.attachmentTooltipText, referenceIdentifiersHelpText: props.referenceIdentifiersHelpText, referenceIdentifiersLabelText: props.referenceIdentifiersLabelText, dueDateMinimumOffset: props.dueDateMinimumOffset, defaultPaymentType: props.defaultPaymentType, supportEmail: props.supportEmail, welcomeModalTitle: props.welcomeModalTitle, welcomeModalParagraph: props.welcomeModalParagraph, welcomeModalImageUrl: props.welcomeModalImageUrl, colorPrimary: props.colorPrimary, colorError: props.colorError, accessToken: props.accessToken, loggedInPerson: props.loggedInPerson, accessTokenExpiresAt: props.accessTokenExpiresAt, onLoginRequired: props.onLoginRequired, delegationsUrl: props.delegationsUrl }))));
114
+ uploadSizeLimit: props.uploadSizeLimit, attachmentTooltipText: props.attachmentTooltipText, referenceIdentifiersHelpText: props.referenceIdentifiersHelpText, referenceIdentifiersLabelText: props.referenceIdentifiersLabelText, dueDateMinimumOffset: props.dueDateMinimumOffset, defaultPaymentType: props.defaultPaymentType, supportEmail: props.supportEmail, welcomeModalTitle: props.welcomeModalTitle, welcomeModalParagraph: props.welcomeModalParagraph, welcomeModalImageUrl: props.welcomeModalImageUrl, colorPrimary: props.colorPrimary, colorError: props.colorError, accessToken: props.accessToken, loggedInPerson: props.loggedInPerson, accessTokenExpiresAt: props.accessTokenExpiresAt, onLoginRequired: props.onLoginRequired, delegationsUrl: props.delegationsUrl, onLogout: props.onLogout }))));
115
115
  };
116
116
  exports.default = CreateInvoice;
@@ -722,7 +722,7 @@ var CreateInvoiceConstructor = function (props) {
722
722
  ];
723
723
  return (react_1.default.createElement(react_1.default.Fragment, null,
724
724
  react_1.default.createElement(antd_1.Flex, { vertical: true, gap: "middle", style: { alignItems: "center", marginBottom: "50px" } },
725
- isLoginRequired && props.loggedInPerson && (react_1.default.createElement(session_bar_1.default, { person: props.loggedInPerson, seller: seller, canChangeSeller: !!seller && activeStep !== 1 && activeStep <= items.length, onChangeSeller: goToSupplierStep, delegationsUrl: holdsProcuration ? props.delegationsUrl : undefined, isMobile: isMobile })),
725
+ isLoginRequired && props.loggedInPerson && (react_1.default.createElement(session_bar_1.default, { person: props.loggedInPerson, seller: seller, canChangeSeller: !!seller && activeStep !== 1 && activeStep <= items.length, onChangeSeller: goToSupplierStep, delegationsUrl: holdsProcuration ? props.delegationsUrl : undefined, onLogout: props.onLogout, isMobile: isMobile })),
726
726
  activeStep === items.length ? (react_1.default.createElement(components_1.InvoicePreviewHeader, { form: form, colorPrimary: props.colorPrimary })) : (activeStep < items.length && (react_1.default.createElement(antd_1.Steps, { style: { maxWidth: "900px", margin: isMobile ? 0 : "30px 0" }, current: activeStep, initial: 0, labelPlacement: "vertical", items: items, type: isMobile ? "navigation" : "default", size: isMobile ? "small" : "default", direction: "horizontal", responsive: false }))),
727
727
  react_1.default.createElement(antd_1.Layout.Content, null,
728
728
  react_1.default.createElement(antd_1.Flex, { style: { width: "100vw", padding: isMobile ? "0 20px" : 0 } },
@@ -176,6 +176,7 @@
176
176
  "sendOnBehalf_title": "On whose behalf are you sending the invoice?",
177
177
  "sessionBar_change": "Change",
178
178
  "sessionBar_delegations": "Powers of attorney",
179
+ "sessionBar_logout": "Log out",
179
180
  "sessionBar_onBehalfOf": "on behalf of {seller}",
180
181
  "submitConfirmation_SuccessfullyUploadedAttachment": "Successfully uploaded attachment:",
181
182
  "submitConfirmation_attachmentFailedToUpload": "Attachment failed to upload:",
@@ -176,6 +176,7 @@
176
176
  "sendOnBehalf_title": "Fyrir hönd hvers sendir þú reikninginn?",
177
177
  "sessionBar_change": "Breyta",
178
178
  "sessionBar_delegations": "Umboð",
179
+ "sessionBar_logout": "Útskrá",
179
180
  "sessionBar_onBehalfOf": "f.h. {seller}",
180
181
  "submitConfirmation_SuccessfullyUploadedAttachment": "Viðhengi sem hefur verið sent:",
181
182
  "submitConfirmation_attachmentFailedToUpload": "Ekki tókst að hlaða upp viðhengi:",
@@ -177,6 +177,7 @@ declare const _default: {
177
177
  sendOnBehalf_title: string;
178
178
  sessionBar_change: string;
179
179
  sessionBar_delegations: string;
180
+ sessionBar_logout: string;
180
181
  sessionBar_onBehalfOf: string;
181
182
  submitConfirmation_SuccessfullyUploadedAttachment: string;
182
183
  submitConfirmation_attachmentFailedToUpload: string;
@@ -410,6 +411,7 @@ declare const _default: {
410
411
  sendOnBehalf_title: string;
411
412
  sessionBar_change: string;
412
413
  sessionBar_delegations: string;
414
+ sessionBar_logout: string;
413
415
  sessionBar_onBehalfOf: string;
414
416
  submitConfirmation_SuccessfullyUploadedAttachment: string;
415
417
  submitConfirmation_attachmentFailedToUpload: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unimaze/billing",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",