@unimaze/billing 0.21.61 → 0.21.62

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.
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { WrappedComponentProps } from "react-intl";
3
+ interface AttachmentUploadStatusProps extends WrappedComponentProps {
4
+ name: string;
5
+ status: SubmittingStatus;
6
+ }
7
+ export declare enum SubmittingStatus {
8
+ Pending = "PENDING",
9
+ Done = "DONE",
10
+ Failed = "FAILED"
11
+ }
12
+ declare const _default: React.ForwardRefExoticComponent<import("react-intl").Omit<AttachmentUploadStatusProps, "intl"> & {
13
+ forwardedRef?: React.Ref<any>;
14
+ } & React.RefAttributes<any>> & {
15
+ WrappedComponent: React.ComponentType<AttachmentUploadStatusProps>;
16
+ };
17
+ export default _default;
@@ -0,0 +1,58 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.SubmittingStatus = void 0;
7
+ var react_1 = __importDefault(require("react"));
8
+ var icons_1 = require("@ant-design/icons");
9
+ var antd_1 = require("antd");
10
+ var react_intl_1 = require("react-intl");
11
+ var SubmittingStatus;
12
+ (function (SubmittingStatus) {
13
+ SubmittingStatus["Pending"] = "PENDING";
14
+ SubmittingStatus["Done"] = "DONE";
15
+ SubmittingStatus["Failed"] = "FAILED";
16
+ })(SubmittingStatus = exports.SubmittingStatus || (exports.SubmittingStatus = {}));
17
+ // const getSubmittingStatusIcon = (_name: string, _numberOfSuccessCalls: number, _namesOfFailedUploads: string[], _attachments: string[]) => {
18
+ // const _index = _attachments.findIndex((att) => att === _name);
19
+ // if (_namesOfFailedUploads.includes(_name)) return <CloseCircleTwoTone twoToneColor={"red"} style={{marginRight: 5}}/>
20
+ // if (_index <= _numberOfSuccessCalls && !_namesOfFailedUploads.includes(_name)) return <CheckCircleTwoTone twoToneColor={"green"} style={{marginRight: 5}}/>
21
+ // if (_index < _numberOfSuccessCalls || _index > _numberOfSuccessCalls) return <LoadingOutlined style={{marginRight: 5}}/>
22
+ // }
23
+ // const SingleSubmittingStatus: React.FC<AttachmentUploadStatusProps> = (props) => {
24
+ //
25
+ // const {name, index, numberOfSuccessCalls, namesOfFailedUploads, attachments, otherNameForDisplay} = props;
26
+ //
27
+ // return <Flex gap={5} align={"center"}>
28
+ // <>{getSubmittingStatusIcon(name, numberOfSuccessCalls - 1, namesOfFailedUploads, attachments)}</>
29
+ // <Typography.Text>
30
+ // { otherNameForDisplay
31
+ // ? otherNameForDisplay
32
+ // : `${props.intl.formatMessage(translationMessages.submitConfirmation_SuccessfullyUploadedAttachment)} ${name}`
33
+ // }
34
+ // </Typography.Text>
35
+ // </Flex>
36
+ // };
37
+ var SingleSubmittingStatus = function (props) {
38
+ var name = props.name, status = props.status;
39
+ var iconStyle = {
40
+ marginRight: 5
41
+ };
42
+ var getIcon = function (_status) {
43
+ switch (_status) {
44
+ case SubmittingStatus.Failed:
45
+ return react_1.default.createElement(icons_1.CloseCircleTwoTone, { twoToneColor: "red", style: iconStyle });
46
+ case SubmittingStatus.Done:
47
+ return react_1.default.createElement(icons_1.CheckCircleTwoTone, { twoToneColor: "green", style: iconStyle });
48
+ case SubmittingStatus.Pending:
49
+ return react_1.default.createElement(icons_1.LoadingOutlined, { style: iconStyle });
50
+ default:
51
+ return react_1.default.createElement(icons_1.LoadingOutlined, { style: iconStyle });
52
+ }
53
+ };
54
+ return react_1.default.createElement(antd_1.Flex, { gap: 5, align: "center" },
55
+ getIcon(status),
56
+ react_1.default.createElement(antd_1.Typography.Text, null, name));
57
+ };
58
+ exports.default = (0, react_intl_1.injectIntl)(SingleSubmittingStatus);
@@ -33,6 +33,17 @@ var __importStar = (this && this.__importStar) || function (mod) {
33
33
  __setModuleDefault(result, mod);
34
34
  return result;
35
35
  };
36
+ var __rest = (this && this.__rest) || function (s, e) {
37
+ var t = {};
38
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
39
+ t[p] = s[p];
40
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
41
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
42
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
43
+ t[p[i]] = s[p[i]];
44
+ }
45
+ return t;
46
+ };
36
47
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
37
48
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
38
49
  if (ar || !(i in from)) {
@@ -295,8 +306,7 @@ var CreateInvoiceConstructor = function (props) {
295
306
  file1: { file: undefined, description: undefined },
296
307
  file2: { file: undefined, description: undefined },
297
308
  file3: { file: undefined, description: undefined },
298
- },
299
- issueDate: (0, dayjs_1.default)(),
309
+ }
300
310
  },
301
311
  };
302
312
  (0, LocalStorageUtility_1.setFormToLocalStorage)(objectForLocalStorage, props.localStorageFormDataVersion);
@@ -337,7 +347,8 @@ var CreateInvoiceConstructor = function (props) {
337
347
  var customerFromLocalStorage = (_c = savedValuesObject.invoice) === null || _c === void 0 ? void 0 : _c.customer;
338
348
  setChosenCustomer(customerFromLocalStorage);
339
349
  }
340
- form.setFieldsValue(savedValuesObject);
350
+ var issueDate = savedValuesObject.issueDate, rest = __rest(savedValuesObject, ["issueDate"]);
351
+ form.setFieldsValue(rest);
341
352
  }
342
353
  }, []);
343
354
  (0, react_1.useEffect)(function () {
@@ -0,0 +1,4 @@
1
+ import { SubmittingStatus } from "../common/components/submit-confirmation/AttachmentUploadStatus";
2
+ declare const getSubmittingStatus: (name: string, failedUploads: string[], attachments: string[], numberOfAttemptedCalls: number) => SubmittingStatus;
3
+ declare const isRetryButtonVisible: (numberOfAttemptedCalls: number, totalNumberOfCalls: number, numberOfSuccessfulCalls: number, failedAttachments: string[], alreadyRetried: boolean) => boolean;
4
+ export { getSubmittingStatus, isRetryButtonVisible };
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isRetryButtonVisible = exports.getSubmittingStatus = void 0;
4
+ var AttachmentUploadStatus_1 = require("../common/components/submit-confirmation/AttachmentUploadStatus");
5
+ var getSubmittingStatus = function (name, failedUploads, attachments, numberOfAttemptedCalls) {
6
+ var index = attachments.findIndex(function (att) { return att === name; });
7
+ if (failedUploads.includes(name))
8
+ return AttachmentUploadStatus_1.SubmittingStatus.Failed;
9
+ if (index < numberOfAttemptedCalls && !failedUploads.includes(name))
10
+ return AttachmentUploadStatus_1.SubmittingStatus.Done;
11
+ if (index <= numberOfAttemptedCalls || index > numberOfAttemptedCalls)
12
+ return AttachmentUploadStatus_1.SubmittingStatus.Pending;
13
+ };
14
+ exports.getSubmittingStatus = getSubmittingStatus;
15
+ var isRetryButtonVisible = function (numberOfAttemptedCalls, totalNumberOfCalls, numberOfSuccessfulCalls, failedAttachments, alreadyRetried) {
16
+ if (numberOfAttemptedCalls === totalNumberOfCalls && (numberOfSuccessfulCalls + (failedAttachments === null || failedAttachments === void 0 ? void 0 : failedAttachments.length) === totalNumberOfCalls)) {
17
+ return (failedAttachments === null || failedAttachments === void 0 ? void 0 : failedAttachments.length) > 0 && !alreadyRetried;
18
+ }
19
+ };
20
+ exports.isRetryButtonVisible = isRetryButtonVisible;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@unimaze/billing",
3
- "version": "0.21.61",
3
+ "version": "0.21.62",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",