@kimafinance/kima-transaction-widget 1.1.4 → 1.1.5
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/components/KimaTransactionWidget.d.ts +3 -2
- package/dist/components/TransferWidget.d.ts +3 -2
- package/dist/components/reusable/SingleForm.d.ts +4 -1
- package/dist/index.js +33 -9
- package/dist/index.js.map +1 -1
- package/dist/index.modern.js +34 -9
- package/dist/index.modern.js.map +1 -1
- package/dist/interface.d.ts +6 -0
- package/dist/utils/constants.d.ts +2 -1
- package/package.json +1 -1
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DefaultProps, TransactionOption, ModeOptions, TitleOption } from '../interface';
|
|
2
|
+
import { DefaultProps, TransactionOption, ModeOptions, TitleOption, PaymentTitleOption } from '../interface';
|
|
3
3
|
import '../index.css';
|
|
4
4
|
interface Props extends DefaultProps {
|
|
5
5
|
mode: ModeOptions;
|
|
6
6
|
txId?: number;
|
|
7
7
|
titleOption?: TitleOption;
|
|
8
|
+
paymentTitleOption?: PaymentTitleOption;
|
|
8
9
|
kimaBackendUrl: string;
|
|
9
10
|
transactionOption?: TransactionOption;
|
|
10
11
|
kimaNodeProviderQuery: string;
|
|
@@ -12,5 +13,5 @@ interface Props extends DefaultProps {
|
|
|
12
13
|
closeHandler?: (e: any) => void;
|
|
13
14
|
successHandler?: (e: any) => void;
|
|
14
15
|
}
|
|
15
|
-
export declare const KimaTransactionWidget: ({ mode, txId, theme, fontSize, titleOption, transactionOption, kimaBackendUrl, kimaNodeProviderQuery, errorHandler, closeHandler, successHandler }: Props) => JSX.Element;
|
|
16
|
+
export declare const KimaTransactionWidget: ({ mode, txId, theme, fontSize, titleOption, paymentTitleOption, transactionOption, kimaBackendUrl, kimaNodeProviderQuery, errorHandler, closeHandler, successHandler }: Props) => JSX.Element;
|
|
16
17
|
export {};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { DefaultProps, TitleOption } from '../interface';
|
|
2
|
+
import { DefaultProps, PaymentTitleOption, TitleOption } from '../interface';
|
|
3
3
|
import '../index.css';
|
|
4
4
|
interface Props extends DefaultProps {
|
|
5
5
|
titleOption?: TitleOption;
|
|
6
|
+
paymentTitleOption?: PaymentTitleOption;
|
|
6
7
|
}
|
|
7
|
-
export declare const TransferWidget: ({ theme, fontSize, titleOption }: Props) => JSX.Element;
|
|
8
|
+
export declare const TransferWidget: ({ theme, fontSize, titleOption, paymentTitleOption }: Props) => JSX.Element;
|
|
8
9
|
export {};
|
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
|
|
2
|
+
import { PaymentTitleOption } from '../../interface';
|
|
3
|
+
declare const SingleForm: ({ paymentTitleOption }: {
|
|
4
|
+
paymentTitleOption?: PaymentTitleOption | undefined;
|
|
5
|
+
}) => JSX.Element;
|
|
3
6
|
export default SingleForm;
|
package/dist/index.js
CHANGED
|
@@ -640,7 +640,8 @@ var TransactionStatus;
|
|
|
640
640
|
TransactionStatus["CONFIRMED"] = "Confirmed";
|
|
641
641
|
TransactionStatus["PAID"] = "Paid";
|
|
642
642
|
TransactionStatus["COMPLETED"] = "Completed";
|
|
643
|
-
TransactionStatus["
|
|
643
|
+
TransactionStatus["FAILEDTOPAY"] = "FailedToPay";
|
|
644
|
+
TransactionStatus["FAILEDTOPULL"] = "FailedToPull";
|
|
644
645
|
TransactionStatus["UNAVAILABLE"] = "UnAvailable";
|
|
645
646
|
TransactionStatus["KEYSIGNED"] = "KeySigned";
|
|
646
647
|
})(TransactionStatus || (TransactionStatus = {}));
|
|
@@ -667,8 +668,8 @@ var TransactionStatus;
|
|
|
667
668
|
var initialState = {
|
|
668
669
|
theme: exports.ThemeOptions.light,
|
|
669
670
|
mode: exports.ModeOptions.bridge,
|
|
670
|
-
originNetwork: '
|
|
671
|
-
targetNetwork: '
|
|
671
|
+
originNetwork: '',
|
|
672
|
+
targetNetwork: '',
|
|
672
673
|
targetAddress: '',
|
|
673
674
|
connectModal: false,
|
|
674
675
|
helpPopup: false,
|
|
@@ -2505,6 +2506,7 @@ var TransactionWidget = function TransactionWidget(_ref) {
|
|
|
2505
2506
|
setPercent(25);
|
|
2506
2507
|
setErrorStep(1);
|
|
2507
2508
|
setLoadingStep(-1);
|
|
2509
|
+
console.log(data.failReason);
|
|
2508
2510
|
} else if (status === TransactionStatus.KEYSIGNED) {
|
|
2509
2511
|
setStep(3);
|
|
2510
2512
|
setPercent(75);
|
|
@@ -2513,11 +2515,18 @@ var TransactionWidget = function TransactionWidget(_ref) {
|
|
|
2513
2515
|
setStep(3);
|
|
2514
2516
|
setPercent(90);
|
|
2515
2517
|
setLoadingStep(3);
|
|
2516
|
-
} else if (status === TransactionStatus.
|
|
2518
|
+
} else if (status === TransactionStatus.FAILEDTOPAY) {
|
|
2517
2519
|
setStep(3);
|
|
2518
2520
|
setPercent(90);
|
|
2519
2521
|
setErrorStep(3);
|
|
2520
2522
|
setLoadingStep(-1);
|
|
2523
|
+
console.log(data.failReason);
|
|
2524
|
+
} else if (status === TransactionStatus.FAILEDTOPULL) {
|
|
2525
|
+
setStep(1);
|
|
2526
|
+
setPercent(25);
|
|
2527
|
+
setErrorStep(1);
|
|
2528
|
+
setLoadingStep(-1);
|
|
2529
|
+
console.log(data.failReason);
|
|
2521
2530
|
} else if (status === TransactionStatus.COMPLETED) {
|
|
2522
2531
|
setStep(4);
|
|
2523
2532
|
setPercent(100);
|
|
@@ -2608,7 +2617,8 @@ var TransactionWidget = function TransactionWidget(_ref) {
|
|
|
2608
2617
|
})));
|
|
2609
2618
|
};
|
|
2610
2619
|
|
|
2611
|
-
var SingleForm = function SingleForm() {
|
|
2620
|
+
var SingleForm = function SingleForm(_ref) {
|
|
2621
|
+
var paymentTitleOption = _ref.paymentTitleOption;
|
|
2612
2622
|
var dispatch = reactRedux.useDispatch();
|
|
2613
2623
|
var mode = reactRedux.useSelector(selectMode);
|
|
2614
2624
|
var theme = reactRedux.useSelector(selectTheme);
|
|
@@ -2617,7 +2627,14 @@ var SingleForm = function SingleForm() {
|
|
|
2617
2627
|
var selectedCoin = reactRedux.useSelector(selectCurrencyOptions);
|
|
2618
2628
|
return React__default.createElement("div", {
|
|
2619
2629
|
className: 'single-form'
|
|
2620
|
-
}, React__default.createElement("
|
|
2630
|
+
}, mode === exports.ModeOptions.payment ? React__default.createElement("p", {
|
|
2631
|
+
className: 'payment-title',
|
|
2632
|
+
style: {
|
|
2633
|
+
fontSize: paymentTitleOption === null || paymentTitleOption === void 0 ? void 0 : paymentTitleOption.fontSize,
|
|
2634
|
+
fontWeight: paymentTitleOption === null || paymentTitleOption === void 0 ? void 0 : paymentTitleOption.fontWeight,
|
|
2635
|
+
color: paymentTitleOption === null || paymentTitleOption === void 0 ? void 0 : paymentTitleOption.color
|
|
2636
|
+
}
|
|
2637
|
+
}, paymentTitleOption === null || paymentTitleOption === void 0 ? void 0 : paymentTitleOption.title) : null, React__default.createElement("div", {
|
|
2621
2638
|
className: 'form-item'
|
|
2622
2639
|
}, React__default.createElement("span", {
|
|
2623
2640
|
className: 'label'
|
|
@@ -6870,7 +6887,8 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
6870
6887
|
theme = _ref$theme === void 0 ? exports.ThemeOptions.light : _ref$theme,
|
|
6871
6888
|
_ref$fontSize = _ref.fontSize,
|
|
6872
6889
|
fontSize = _ref$fontSize === void 0 ? exports.FontSizeOptions.medium : _ref$fontSize,
|
|
6873
|
-
titleOption = _ref.titleOption
|
|
6890
|
+
titleOption = _ref.titleOption,
|
|
6891
|
+
paymentTitleOption = _ref.paymentTitleOption;
|
|
6874
6892
|
var dispatch = reactRedux.useDispatch();
|
|
6875
6893
|
var _useState = React.useState(false),
|
|
6876
6894
|
isWizard = _useState[0],
|
|
@@ -7098,7 +7116,9 @@ var TransferWidget = function TransferWidget(_ref) {
|
|
|
7098
7116
|
isOriginChain: false
|
|
7099
7117
|
}) : wizardStep === 3 ? React__default.createElement(AddressInputWizard, null) : wizardStep === 4 ? React__default.createElement(CoinSelect, null) : React__default.createElement(ConfirmDetails, {
|
|
7100
7118
|
isApproved: isApproved
|
|
7101
|
-
}) : formStep === 0 ? React__default.createElement(SingleForm,
|
|
7119
|
+
}) : formStep === 0 ? React__default.createElement(SingleForm, {
|
|
7120
|
+
paymentTitleOption: paymentTitleOption
|
|
7121
|
+
}) : React__default.createElement(ConfirmDetails, {
|
|
7102
7122
|
isApproved: isApproved
|
|
7103
7123
|
})), React__default.createElement("div", {
|
|
7104
7124
|
className: 'kima-card-footer'
|
|
@@ -7134,6 +7154,7 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
|
|
|
7134
7154
|
_ref$fontSize = _ref.fontSize,
|
|
7135
7155
|
fontSize = _ref$fontSize === void 0 ? exports.FontSizeOptions.medium : _ref$fontSize,
|
|
7136
7156
|
titleOption = _ref.titleOption,
|
|
7157
|
+
paymentTitleOption = _ref.paymentTitleOption,
|
|
7137
7158
|
transactionOption = _ref.transactionOption,
|
|
7138
7159
|
kimaBackendUrl = _ref.kimaBackendUrl,
|
|
7139
7160
|
kimaNodeProviderQuery = _ref.kimaNodeProviderQuery,
|
|
@@ -7181,6 +7202,8 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
|
|
|
7181
7202
|
} else if (mode === exports.ModeOptions.status) {
|
|
7182
7203
|
dispatch(setTxId(txId || 1));
|
|
7183
7204
|
dispatch(setSubmitted(true));
|
|
7205
|
+
} else {
|
|
7206
|
+
dispatch(setOriginNetwork('ETH'));
|
|
7184
7207
|
}
|
|
7185
7208
|
}, [theme, transactionOption, errorHandler, closeHandler, mode]);
|
|
7186
7209
|
return submitted ? React__default.createElement(TransactionWidget, {
|
|
@@ -7189,7 +7212,8 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
|
|
|
7189
7212
|
}) : React__default.createElement(TransferWidget, {
|
|
7190
7213
|
theme: theme,
|
|
7191
7214
|
fontSize: fontSize,
|
|
7192
|
-
titleOption: titleOption
|
|
7215
|
+
titleOption: titleOption,
|
|
7216
|
+
paymentTitleOption: paymentTitleOption
|
|
7193
7217
|
});
|
|
7194
7218
|
};
|
|
7195
7219
|
|