@kimafinance/kima-transaction-widget 1.1.4 → 1.1.6

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,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
- declare const SingleForm: () => JSX.Element;
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["FAILED"] = "FailedToPay";
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: 'ETH',
671
- targetNetwork: 'POL',
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.FAILED) {
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,10 @@ 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("div", {
2630
+ }, mode === exports.ModeOptions.payment ? React__default.createElement("p", {
2631
+ className: 'payment-title',
2632
+ style: paymentTitleOption === null || paymentTitleOption === void 0 ? void 0 : paymentTitleOption.style
2633
+ }, paymentTitleOption === null || paymentTitleOption === void 0 ? void 0 : paymentTitleOption.title) : null, React__default.createElement("div", {
2621
2634
  className: 'form-item'
2622
2635
  }, React__default.createElement("span", {
2623
2636
  className: 'label'
@@ -6870,7 +6883,8 @@ var TransferWidget = function TransferWidget(_ref) {
6870
6883
  theme = _ref$theme === void 0 ? exports.ThemeOptions.light : _ref$theme,
6871
6884
  _ref$fontSize = _ref.fontSize,
6872
6885
  fontSize = _ref$fontSize === void 0 ? exports.FontSizeOptions.medium : _ref$fontSize,
6873
- titleOption = _ref.titleOption;
6886
+ titleOption = _ref.titleOption,
6887
+ paymentTitleOption = _ref.paymentTitleOption;
6874
6888
  var dispatch = reactRedux.useDispatch();
6875
6889
  var _useState = React.useState(false),
6876
6890
  isWizard = _useState[0],
@@ -7006,7 +7020,7 @@ var TransferWidget = function TransferWidget(_ref) {
7006
7020
  }, function (e) {
7007
7021
  errorHandler(e);
7008
7022
  dispatch(setSubmitting(false));
7009
- console.log('rpc disconnected', e);
7023
+ console.log((e === null || e === void 0 ? void 0 : e.status) !== 500 ? 'rpc disconnected' : '', e);
7010
7024
  }));
7011
7025
  } catch (e) {
7012
7026
  return Promise.reject(e);
@@ -7098,7 +7112,9 @@ var TransferWidget = function TransferWidget(_ref) {
7098
7112
  isOriginChain: false
7099
7113
  }) : wizardStep === 3 ? React__default.createElement(AddressInputWizard, null) : wizardStep === 4 ? React__default.createElement(CoinSelect, null) : React__default.createElement(ConfirmDetails, {
7100
7114
  isApproved: isApproved
7101
- }) : formStep === 0 ? React__default.createElement(SingleForm, null) : React__default.createElement(ConfirmDetails, {
7115
+ }) : formStep === 0 ? React__default.createElement(SingleForm, {
7116
+ paymentTitleOption: paymentTitleOption
7117
+ }) : React__default.createElement(ConfirmDetails, {
7102
7118
  isApproved: isApproved
7103
7119
  })), React__default.createElement("div", {
7104
7120
  className: 'kima-card-footer'
@@ -7134,6 +7150,7 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
7134
7150
  _ref$fontSize = _ref.fontSize,
7135
7151
  fontSize = _ref$fontSize === void 0 ? exports.FontSizeOptions.medium : _ref$fontSize,
7136
7152
  titleOption = _ref.titleOption,
7153
+ paymentTitleOption = _ref.paymentTitleOption,
7137
7154
  transactionOption = _ref.transactionOption,
7138
7155
  kimaBackendUrl = _ref.kimaBackendUrl,
7139
7156
  kimaNodeProviderQuery = _ref.kimaNodeProviderQuery,
@@ -7181,6 +7198,8 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
7181
7198
  } else if (mode === exports.ModeOptions.status) {
7182
7199
  dispatch(setTxId(txId || 1));
7183
7200
  dispatch(setSubmitted(true));
7201
+ } else {
7202
+ dispatch(setOriginNetwork('ETH'));
7184
7203
  }
7185
7204
  }, [theme, transactionOption, errorHandler, closeHandler, mode]);
7186
7205
  return submitted ? React__default.createElement(TransactionWidget, {
@@ -7189,7 +7208,8 @@ var KimaTransactionWidget = function KimaTransactionWidget(_ref) {
7189
7208
  }) : React__default.createElement(TransferWidget, {
7190
7209
  theme: theme,
7191
7210
  fontSize: fontSize,
7192
- titleOption: titleOption
7211
+ titleOption: titleOption,
7212
+ paymentTitleOption: paymentTitleOption
7193
7213
  });
7194
7214
  };
7195
7215