paymob-pixel-alpha 1.1.1 → 1.1.3

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/main.js CHANGED
@@ -10216,7 +10216,8 @@ function ModalView_ModalView(props) {
10216
10216
  const {
10217
10217
  onClose,
10218
10218
  showModal,
10219
- children
10219
+ children,
10220
+ customStyle
10220
10221
  } = props;
10221
10222
  const stopPropagation = e => {
10222
10223
  e.stopPropagation();
@@ -10233,6 +10234,9 @@ function ModalView_ModalView(props) {
10233
10234
  className: "relative w-auto max-h-full mobile:w-11/12",
10234
10235
  children: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
10235
10236
  className: `relative bg-white shadow ${borderStyle === borderStyle_borderStyleConstants.RECTANGULAR ? 'rounded-none' : 'rounded-lg'}`,
10237
+ style: {
10238
+ borderRadius: (customStyle == null ? void 0 : customStyle['borderRadius']) || ''
10239
+ },
10236
10240
  children: children
10237
10241
  })
10238
10242
  })
@@ -10488,7 +10492,7 @@ function OTPViewTwo_OTP(props) {
10488
10492
  const [value, setValue] = (0,react.useState)(otpValue || '');
10489
10493
  const {
10490
10494
  borderStyle
10491
- } = useSelector_useSelector(state => state.customization);
10495
+ } = useSafeSelector(state => state.customization);
10492
10496
 
10493
10497
  //regular expression to tests whether a string is a digit
10494
10498
  const RExp_DIGIT = new RegExp(/^\d+$/);
@@ -10644,7 +10648,7 @@ const GenericOTP = props => {
10644
10648
  } = props;
10645
10649
  const {
10646
10650
  borderStyle
10647
- } = useSelector_useSelector(state => state.customization);
10651
+ } = useSafeSelector(state => state.customization);
10648
10652
  const [otp, setOTP] = (0,react.useState)('');
10649
10653
  const handleOTPChange = e => {
10650
10654
  const value = e.target.value.replace(/\D/g, '');
@@ -10696,7 +10700,8 @@ function OTPModal_OTPModal(props) {
10696
10700
  setResetCounter,
10697
10701
  loading,
10698
10702
  error,
10699
- onErrorMessage
10703
+ onErrorMessage,
10704
+ customStyle
10700
10705
  } = props;
10701
10706
  const {
10702
10707
  t
@@ -10706,7 +10711,7 @@ function OTPModal_OTPModal(props) {
10706
10711
  const [resendingOTP, setResendingOTP] = (0,react.useState)(false);
10707
10712
  const {
10708
10713
  borderStyle
10709
- } = useSelector_useSelector(state => state.customization);
10714
+ } = useSafeSelector(state => state.customization);
10710
10715
  (0,react.useEffect)(() => {
10711
10716
  if (!loading && resendingOTP) {
10712
10717
  if (error) {
@@ -10733,8 +10738,10 @@ function OTPModal_OTPModal(props) {
10733
10738
  };
10734
10739
  return /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
10735
10740
  className: "max-w-[400px]",
10741
+ style: customStyle == null ? void 0 : customStyle['container'],
10736
10742
  children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
10737
10743
  className: "flex px-6 py-6 flex-col gap-2 items-start",
10744
+ style: customStyle == null ? void 0 : customStyle['label'],
10738
10745
  children: [length && /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
10739
10746
  className: "text-lg font-semibold",
10740
10747
  children: modalHeader
@@ -10756,6 +10763,7 @@ function OTPModal_OTPModal(props) {
10756
10763
  onErrorMessage: onErrorMessage
10757
10764
  }), error && /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
10758
10765
  className: "text-red-600 text-sm font-normal leading-[1.125rem] tracking-[.01rem]",
10766
+ style: customStyle == null ? void 0 : customStyle['error'],
10759
10767
  children: error
10760
10768
  })]
10761
10769
  }, resetOtpComponent.toString()), onResend && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
@@ -10769,6 +10777,7 @@ function OTPModal_OTPModal(props) {
10769
10777
  })]
10770
10778
  }), (loading || resendingOTP) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
10771
10779
  className: "flex justify-center items-center bg-white w-full h-20 flex-col gap-4",
10780
+ style: customStyle == null ? void 0 : customStyle['container'],
10772
10781
  children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
10773
10782
  className: "flex animate-pulse",
10774
10783
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
@@ -10792,17 +10801,18 @@ function OTPModal_OTPModal(props) {
10792
10801
  onClick: onClose,
10793
10802
  type: "button",
10794
10803
  className: `py-[10px] px-4 md:py-3 md:px-4 text-gray-500 bg-white hover:bg-gray-200 focus:ring-4 focus:outline-none focus:ring-gray-200 ${borderStyle === borderStyle_borderStyleConstants.RECTANGULAR ? 'rounded-none' : 'rounded-lg'} border border-gray-200 text-base hover:text-gray-900 focus:z-10`,
10804
+ style: customStyle == null ? void 0 : customStyle['cancelButton'],
10795
10805
  children: "Cancel"
10796
10806
  }), /*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button, {
10797
10807
  label: "Submit",
10798
10808
  id: "pay-button",
10799
10809
  onClick: handleOtpSubmit,
10800
10810
  disabled: !otp || loading,
10801
- customStyle: {
10811
+ customStyle: Object.assign({
10802
10812
  height: 'unset',
10803
10813
  padding: '0.625rem 1rem'
10804
- },
10805
- className: "mt-0"
10814
+ }, customStyle == null ? void 0 : customStyle['button']),
10815
+ className: "!mt-0"
10806
10816
  })]
10807
10817
  })]
10808
10818
  });
@@ -17089,38 +17099,8 @@ function SecureCheckout(props) {
17089
17099
  });
17090
17100
  }
17091
17101
  /* harmony default export */ const components_SecureCheckout = ((/* unused pure expression or super */ null && (SecureCheckout)));
17092
- ;// CONCATENATED MODULE: ../../libs/kit-components/src/assets/icons/close-icon.svg
17093
- var close_icon_path;
17094
- var close_icon_excluded = (/* unused pure expression or super */ null && (["title", "titleId"]));
17095
- function close_icon_extends() { return close_icon_extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, close_icon_extends.apply(null, arguments); }
17096
- function close_icon_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = close_icon_objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
17097
- function close_icon_objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
17098
-
17099
-
17100
- var SvgCloseIcon = function SvgCloseIcon(_ref, ref) {
17101
- var title = _ref.title,
17102
- titleId = _ref.titleId,
17103
- props = close_icon_objectWithoutProperties(_ref, close_icon_excluded);
17104
- return /*#__PURE__*/React.createElement("svg", close_icon_extends({
17105
- width: "800px",
17106
- height: "800px",
17107
- viewBox: "0 0 24 24",
17108
- fill: "none",
17109
- xmlns: "http://www.w3.org/2000/svg",
17110
- ref: ref,
17111
- "aria-labelledby": titleId
17112
- }, props), title ? /*#__PURE__*/React.createElement("title", {
17113
- id: titleId
17114
- }, title) : null, close_icon_path || (close_icon_path = /*#__PURE__*/React.createElement("path", {
17115
- fillRule: "evenodd",
17116
- clipRule: "evenodd",
17117
- d: "M5.29289 5.29289C5.68342 4.90237 6.31658 4.90237 6.70711 5.29289L12 10.5858L17.2929 5.29289C17.6834 4.90237 18.3166 4.90237 18.7071 5.29289C19.0976 5.68342 19.0976 6.31658 18.7071 6.70711L13.4142 12L18.7071 17.2929C19.0976 17.6834 19.0976 18.3166 18.7071 18.7071C18.3166 19.0976 17.6834 19.0976 17.2929 18.7071L12 13.4142L6.70711 18.7071C6.31658 19.0976 5.68342 19.0976 5.29289 18.7071C4.90237 18.3166 4.90237 17.6834 5.29289 17.2929L10.5858 12L5.29289 6.70711C4.90237 6.31658 4.90237 5.68342 5.29289 5.29289Z",
17118
- fill: "#667085"
17119
- })));
17120
- };
17121
- var close_icon_ForwardRef = /*#__PURE__*/(/* unused pure expression or super */ null && (forwardRef(SvgCloseIcon)));
17122
-
17123
- /* harmony default export */ const close_icon = (__webpack_require__.p + "close-icon.371f61902d3cf35dc76286080a72af1f.svg");
17102
+ ;// CONCATENATED MODULE: ../../libs/kit-components/src/assets/icons/close-icon.png
17103
+ const close_icon_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEYAAABGCAYAAABxLuKEAAAACXBIWXMAAAFKAAABSgHphfmiAAAAGXRFWHRTb2Z0d2FyZQB3d3cuaW5rc2NhcGUub3Jnm+48GgAAAu5JREFUeJztms9u2kAQh38D4U6u8AwR4pGCgpq0lYLEIZIvlg9N6aGCtLRCUJEnqpTkHeAa7q69uQQRFY0x+9eR5rtwwMyOPtZrz+ySUgrCPrXQCVQVEcMgYhhEDIOIYRAxDCKGQcQwiBgGEcMgYhhEDIOIYTgxDXA1HHVVlp/lhKf5OHqwkVQVciGTtsOHwZevILoBQACUAqbtZjqI4zg3SepYkiSprTaNCQGft7kQMJqNo0g3praYq+Gom+f539dE3rJsNdO+LzlJktTWm8YCQO+/rxTV6t3Z95tHnbjaa4zK8jPsSwGA3nrTWCRJ4nz9KpACAIQs6+jG1k4+JzwB4KabczkHpACAQr2uNVsAAzHzcfSggGnBJc7klJACBUx1byPA8HG9mETXSmFWcElv/Xzyx6YcItDqufELBVKg1H27mQ5MxjFKWCmoxV30sVAO0bktOUSg/vXtbyJcFiR13zr9d2G6+Bsn60uOTymApTdf13J8SwEslgSu5ISQAliulWzLCSUFcFBE2pITUgrgqLo2lRNaCuCw7aArpwpSAMf9mGPlVEUKYNh2KEuZV3gAy9fPwmt8Ve5exAAlb5EiPM2ULd5am6VuK/7HXqUAnnu+WnICSAECNMOPkhNICiC7BCzexRy1CFtsWRyL1wG1nkyB5HgbzOhxHUCOvOAxOP8HyvZoW820P59EF757yBxOBzi29vHdQy7CWXDdgrAqcpwENq2SqyDHelBbrYPQcqwGtN1PCSnH6g6hiyZTKDlWArnuvIWQ8262TX3LMQrgu0frU47Rj/uD27sDtc/Sdj9FKaj2afoJuxJiH6Lz1aYxMRnHxVGzLU7rmjIHh6p21AzwUOzFcZy3mmkf/Myp3FEzbxXwATnhjpoRMMJOjgLRD58nNoGdHAX8fJsLASOTo2bG/ZjL4bcOsqyDev3RJBEb2MzF24bbe0N2CRhEDIOIYRAxDCKGQcQwiBgGEcMgYhhEDIOIYRAxDCKG4QXD79JL5r6MQwAAAABJRU5ErkJggg==";
17124
17104
  ;// CONCATENATED MODULE: ../../libs/kit-components/src/components/OrderDetailsModal/index.tsx
17125
17105
 
17126
17106
 
@@ -17377,7 +17357,8 @@ function MobileOTPModal_MobileOTPModal(props) {
17377
17357
  setResetCounter,
17378
17358
  error,
17379
17359
  onErrorMessage,
17380
- loading
17360
+ loading,
17361
+ customStyle
17381
17362
  } = props;
17382
17363
  const {
17383
17364
  t
@@ -17421,13 +17402,15 @@ function MobileOTPModal_MobileOTPModal(props) {
17421
17402
  children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
17422
17403
  onClick: e => e.stopPropagation(),
17423
17404
  className: "flex relative flex-col gap-2 py-8 w-full bg-white h-[88%] rounded-3xl",
17405
+ style: customStyle == null ? void 0 : customStyle['container'],
17424
17406
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
17425
17407
  onClick: onClose,
17426
17408
  className: "absolute top-4 right-4 w-6 cursor-pointer",
17427
- src: close_icon,
17409
+ src: close_icon_namespaceObject,
17428
17410
  alt: "close"
17429
17411
  }), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
17430
17412
  className: "flex flex-col gap-2 px-6 items-start",
17413
+ style: customStyle == null ? void 0 : customStyle['label'],
17431
17414
  children: [length && /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
17432
17415
  className: "text-lg font-semibold",
17433
17416
  children: modalHeader
@@ -17449,6 +17432,7 @@ function MobileOTPModal_MobileOTPModal(props) {
17449
17432
  onErrorMessage: onErrorMessage
17450
17433
  }), error && /*#__PURE__*/(0,jsx_runtime.jsx)("p", {
17451
17434
  className: "text-red-600 text-sm font-normal leading-[1.125rem] tracking-[.01rem]",
17435
+ style: customStyle == null ? void 0 : customStyle['error'],
17452
17436
  children: error
17453
17437
  })]
17454
17438
  }, resetOtpComponent.toString()), onResend && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
@@ -17462,6 +17446,7 @@ function MobileOTPModal_MobileOTPModal(props) {
17462
17446
  })]
17463
17447
  }), (loading || resendingOTP) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
17464
17448
  className: "flex justify-center items-center bg-white w-full h-20 flex-col gap-4",
17449
+ style: customStyle == null ? void 0 : customStyle['container'],
17465
17450
  children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
17466
17451
  className: "flex animate-pulse",
17467
17452
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
@@ -17486,7 +17471,8 @@ function MobileOTPModal_MobileOTPModal(props) {
17486
17471
  id: "pay-button",
17487
17472
  onClick: handleOtpSubmit,
17488
17473
  disabled: !otp || loading,
17489
- className: "w-full"
17474
+ className: "w-full",
17475
+ customStyle: customStyle == null ? void 0 : customStyle['button']
17490
17476
  })
17491
17477
  })]
17492
17478
  })
@@ -19862,6 +19848,45 @@ const payWithSavedCard = payload => {
19862
19848
  api_source: 'PIXEL'
19863
19849
  }).then(res => res).catch(err => err == null ? void 0 : err.response);
19864
19850
  };
19851
+ ;// CONCATENATED MODULE: ./src/utils/getErrorMsg.ts
19852
+ const getErrorMsg_isString = data => typeof data === 'string';
19853
+ const DECLINED_MESSAGE = 'Payment is declined';
19854
+ const getErrorMsg = err => {
19855
+ var _data$data, _data$data2;
19856
+ const data = err == null ? void 0 : err.data;
19857
+ if (!err) {
19858
+ return DECLINED_MESSAGE;
19859
+ }
19860
+ if (getErrorMsg_isString(err)) {
19861
+ return err;
19862
+ }
19863
+ if (data != null && data['data.message'] && getErrorMsg_isString(data['data.message'])) {
19864
+ return data['data.message'];
19865
+ }
19866
+ if (data != null && data.message && getErrorMsg_isString(data.message)) {
19867
+ return data.message;
19868
+ }
19869
+ if (data != null && data.msg && getErrorMsg_isString(data.msg)) {
19870
+ return data.msg;
19871
+ }
19872
+ if (data != null && data.detail && getErrorMsg_isString(data.detail)) {
19873
+ return data.detail;
19874
+ }
19875
+ if (data != null && data.error && getErrorMsg_isString(data.error)) {
19876
+ return data.error;
19877
+ }
19878
+ if (data != null && data.error_message && getErrorMsg_isString(data.error_message)) {
19879
+ return data.error_message;
19880
+ }
19881
+ if (data != null && (_data$data = data.data) != null && _data$data.message && getErrorMsg_isString((_data$data2 = data.data) == null ? void 0 : _data$data2.message)) {
19882
+ var _data$data3;
19883
+ return (_data$data3 = data.data) == null ? void 0 : _data$data3.message;
19884
+ }
19885
+ if (Array.isArray(data) && getErrorMsg_isString(data[0])) {
19886
+ return data[0];
19887
+ }
19888
+ return DECLINED_MESSAGE;
19889
+ };
19865
19890
  ;// CONCATENATED MODULE: ./src/components/Payments/Card/index.tsx
19866
19891
 
19867
19892
 
@@ -19873,6 +19898,7 @@ const payWithSavedCard = payload => {
19873
19898
  // import { DeleteCard } from '@unified-checkout/card';
19874
19899
 
19875
19900
 
19901
+
19876
19902
  function CardElement({
19877
19903
  payment,
19878
19904
  customStyle,
@@ -19890,7 +19916,7 @@ function CardElement({
19890
19916
  hideCardHolderName,
19891
19917
  isLoading
19892
19918
  }) {
19893
- var _customStyle$containe;
19919
+ var _customStyle$containe, _customStyle$containe2, _customStyle$button, _customStyle$containe3;
19894
19920
  const {
19895
19921
  token,
19896
19922
  amount,
@@ -19919,9 +19945,11 @@ function CardElement({
19919
19945
  const [selectedCardCVV, setSelectedCardCVV] = (0,react.useState)('');
19920
19946
  const [showCardModal, setShowCardModal] = (0,react.useState)(false);
19921
19947
  const [showCVVTooltipModal, setShowCVVTooltipModal] = (0,react.useState)(false);
19948
+ const previousValidationRef = (0,react.useRef)(false);
19922
19949
  const [showOTP, setShowOTP] = (0,react.useState)(false);
19923
19950
  const [sendOTPLoading, setSendOTPLoading] = (0,react.useState)(false);
19924
- const previousValidationRef = (0,react.useRef)(false);
19951
+ const [paymentId, setPaymentId] = (0,react.useState)('');
19952
+ const [otpErrorMessage, setOTPErrorMessage] = (0,react.useState)('');
19925
19953
  const isCardValid = hideCardHolderName ? !isActionBtnDisabled : !(isActionBtnDisabled || !cardHolderName);
19926
19954
  const isAmexCardSelected = (selectedCard == null ? void 0 : selectedCard.type) === constants_CARD_TYPES.AMEX;
19927
19955
  const selectedCardCvvLength = selectedCardCVV.length;
@@ -19966,7 +19994,8 @@ function CardElement({
19966
19994
  };
19967
19995
  const handlePaymentResponse = ({
19968
19996
  res,
19969
- requiresOTP
19997
+ requiresOTP,
19998
+ isOTPResponse
19970
19999
  }) => {
19971
20000
  var _res$data, _res$data2, _res$data3;
19972
20001
  setShouldSubmitData(false);
@@ -19975,20 +20004,29 @@ function CardElement({
19975
20004
  if (cardHolderInput) {
19976
20005
  setTimeout(() => cardHolderInput.disabled = false, 1000);
19977
20006
  }
20007
+ const redirectionUrl = ((_res$data = res.data) == null ? void 0 : _res$data.redirection_url) || ((_res$data2 = res.data) == null ? void 0 : _res$data2.redirect_url);
19978
20008
  if (requiresOTP) {
20009
+ setPaymentId(res.data.payment_id);
19979
20010
  setShowOTP(true);
19980
- } else if (onAfterPaymentComplete && ((_res$data = res.data) == null ? void 0 : _res$data.is_3d_secure) !== 'true') {
20011
+ } else if (onAfterPaymentComplete && ((_res$data3 = res.data) == null ? void 0 : _res$data3.is_3d_secure) !== 'true') {
19981
20012
  onAfterPaymentComplete(res);
19982
- } else if (res.status === 200 && ((_res$data2 = res.data) != null && _res$data2.redirection_url || (_res$data3 = res.data) != null && _res$data3.redirect_url)) {
19983
- var _res$data4, _res$data5;
19984
- window.location.href = ((_res$data4 = res.data) == null ? void 0 : _res$data4.redirection_url) || ((_res$data5 = res.data) == null ? void 0 : _res$data5.redirect_url);
20013
+ } else if (res.status === 200 && isOTPResponse) {
20014
+ if (redirectionUrl && (res.data.result === 'CAPTURED' || res.data.result === 'APPROVED')) {
20015
+ window.location.href = redirectionUrl;
20016
+ } else {
20017
+ setOTPErrorMessage(getErrorMsg(res));
20018
+ }
20019
+ } else if (res.status !== 200 && isOTPResponse) {
20020
+ setOTPErrorMessage(getErrorMsg(res));
20021
+ } else if (res.status === 200 && redirectionUrl) {
20022
+ window.location.href = redirectionUrl;
19985
20023
  } else if (res.status === 400) {
19986
- var _res$data6, _res$data7, _res$data8;
19987
- if (res.data instanceof Array && res.data[0] === 'Retry limit reached.' || ((_res$data6 = res.data) == null ? void 0 : _res$data6.msg) === 'Retry limit reached.') {
20024
+ var _res$data4, _res$data5, _res$data6;
20025
+ if (res.data instanceof Array && res.data[0] === 'Retry limit reached.' || ((_res$data4 = res.data) == null ? void 0 : _res$data4.msg) === 'Retry limit reached.') {
19988
20026
  setErrorMessage(t('ERR_MSG_EXCEEDED_TRIALS'));
19989
- } else if (((_res$data7 = res.data) == null ? void 0 : _res$data7.message) === 'Session Error') {
20027
+ } else if (((_res$data5 = res.data) == null ? void 0 : _res$data5.message) === 'Session Error') {
19990
20028
  setErrorMessage(t('ERR_MSG_ALREADY_PROCESSED'));
19991
- } else if (res.data instanceof Array && res.data[0] === 'Order has already paid.' || ((_res$data8 = res.data) == null ? void 0 : _res$data8.msg) === 'Order has already paid.') {
20029
+ } else if (res.data instanceof Array && res.data[0] === 'Order has already paid.' || ((_res$data6 = res.data) == null ? void 0 : _res$data6.msg) === 'Order has already paid.') {
19992
20030
  setErrorMessage(t('ERR_MSG_ALREADY_PAID'));
19993
20031
  } else {
19994
20032
  setErrorMessage(t('ERR_MSG_DECLINED'));
@@ -20180,12 +20218,12 @@ function CardElement({
20180
20218
  window.location.href = res.data.redirection_url;
20181
20219
  }
20182
20220
  } else if (res.status === 400) {
20183
- var _res$data9, _res$data10, _res$data11;
20184
- if (res.data instanceof Array && res.data[0] === 'Retry limit reached.' || ((_res$data9 = res.data) == null ? void 0 : _res$data9.msg) === 'Retry limit reached.') {
20221
+ var _res$data7, _res$data8, _res$data9;
20222
+ if (res.data instanceof Array && res.data[0] === 'Retry limit reached.' || ((_res$data7 = res.data) == null ? void 0 : _res$data7.msg) === 'Retry limit reached.') {
20185
20223
  setErrorMessage(t('ERR_MSG_EXCEEDED_TRIALS'));
20186
- } else if (((_res$data10 = res.data) == null ? void 0 : _res$data10.message) === 'Session Error') {
20224
+ } else if (((_res$data8 = res.data) == null ? void 0 : _res$data8.message) === 'Session Error') {
20187
20225
  setErrorMessage(t('ERR_MSG_ALREADY_PROCESSED'));
20188
- } else if (res.data instanceof Array && res.data[0] === 'Order has already paid.' || ((_res$data11 = res.data) == null ? void 0 : _res$data11.msg) === 'Order has already paid.') {
20226
+ } else if (res.data instanceof Array && res.data[0] === 'Order has already paid.' || ((_res$data9 = res.data) == null ? void 0 : _res$data9.msg) === 'Order has already paid.') {
20189
20227
  setErrorMessage(t('ERR_MSG_ALREADY_PAID'));
20190
20228
  } else {
20191
20229
  setErrorMessage(t('ERR_MSG_DECLINED'));
@@ -20212,7 +20250,8 @@ function CardElement({
20212
20250
  subType: {
20213
20251
  paymentToken: (_payment$subType3 = payment.subType) == null ? void 0 : _payment$subType3.token
20214
20252
  },
20215
- otp
20253
+ otp,
20254
+ paymentId
20216
20255
  }
20217
20256
  }, '*');
20218
20257
  };
@@ -20249,16 +20288,43 @@ function CardElement({
20249
20288
  onSubmit: handleOTPSubmit,
20250
20289
  length: 4,
20251
20290
  modalHeader: `${4}-digit code`,
20252
- loading: sendOTPLoading
20291
+ loading: sendOTPLoading,
20292
+ onErrorMessage: setOTPErrorMessage,
20293
+ error: otpErrorMessage,
20294
+ customStyle: {
20295
+ container: {
20296
+ backgroundColor: (customStyle == null || (_customStyle$containe2 = customStyle.container) == null ? void 0 : _customStyle$containe2.backgroundColor) || '',
20297
+ borderRadius: (customStyle == null || (_customStyle$button = customStyle.button) == null ? void 0 : _customStyle$button.borderRadius) || ''
20298
+ },
20299
+ button: customStyle == null ? void 0 : customStyle.button,
20300
+ label: customStyle == null ? void 0 : customStyle.label,
20301
+ error: customStyle == null ? void 0 : customStyle.error
20302
+ }
20253
20303
  }), !isMobile && showOTP && /*#__PURE__*/(0,jsx_runtime.jsx)(ModalView_ModalView, {
20254
20304
  showModal: showOTP,
20255
20305
  onClose: handleCloseOTP,
20306
+ customStyle: customStyle == null ? void 0 : customStyle.button,
20256
20307
  children: /*#__PURE__*/(0,jsx_runtime.jsx)(OTPModal_OTPModal, {
20257
20308
  onClose: handleCloseOTP,
20258
20309
  onSubmit: handleOTPSubmit,
20259
20310
  length: 4,
20260
20311
  modalHeader: `${4}-digit code`,
20261
- loading: sendOTPLoading
20312
+ loading: sendOTPLoading,
20313
+ onErrorMessage: setOTPErrorMessage,
20314
+ error: otpErrorMessage,
20315
+ customStyle: {
20316
+ container: {
20317
+ backgroundColor: (customStyle == null || (_customStyle$containe3 = customStyle.container) == null ? void 0 : _customStyle$containe3.backgroundColor) || ''
20318
+ },
20319
+ cancelButton: Object.assign({}, customStyle == null ? void 0 : customStyle.button, {
20320
+ backgroundColor: '#fff',
20321
+ lineHeight: 'normal',
20322
+ color: ''
20323
+ }),
20324
+ button: customStyle == null ? void 0 : customStyle.button,
20325
+ label: customStyle == null ? void 0 : customStyle.label,
20326
+ error: customStyle == null ? void 0 : customStyle.error
20327
+ }
20262
20328
  })
20263
20329
  }), /*#__PURE__*/(0,jsx_runtime.jsx)(CVVToolTipModal_CVVToolTipModal, {
20264
20330
  onClose: () => setShowCVVTooltipModal(false),
@@ -20284,7 +20350,7 @@ function CardElement({
20284
20350
  })]
20285
20351
  }), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
20286
20352
  className: "[&>div:nth-child(even)]:w-[calc(100%-1px)]",
20287
- children: [!isIframeLoaded && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
20353
+ children: [(!isIframeLoaded || !payment.token) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
20288
20354
  className: "-mt-1",
20289
20355
  children: [/*#__PURE__*/(0,jsx_runtime.jsx)(dist_Skeleton, {
20290
20356
  height: 37
@@ -20308,14 +20374,18 @@ function CardElement({
20308
20374
  style: {
20309
20375
  border: '0',
20310
20376
  overflow: 'hidden',
20311
- display: isIframeLoaded ? 'block' : 'none'
20377
+ display: isIframeLoaded && payment.token ? 'block' : 'none'
20312
20378
  },
20313
20379
  frameBorder: "0",
20314
20380
  scrolling: "no",
20315
20381
  width: "100%",
20316
20382
  height: height,
20317
- onLoad: () => setIsIframeLoaded(true)
20318
- }), isIframeLoaded && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
20383
+ onLoad: () => {
20384
+ setTimeout(() => {
20385
+ setIsIframeLoaded(true);
20386
+ }, 200);
20387
+ }
20388
+ }), isIframeLoaded && payment.token && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
20319
20389
  children: [!hideCardHolderName && /*#__PURE__*/(0,jsx_runtime.jsx)(components_CardHolder_CardHolder, {
20320
20390
  onChange: handleCardHolderChange,
20321
20391
  focusToPrevInput: handleFocusToPrevInput,
@@ -27042,7 +27112,7 @@ function ApplePay(props) {
27042
27112
  icon: apple_pay_namespaceObject,
27043
27113
  fullWidth: true,
27044
27114
  onClick: handleSubmit,
27045
- className: `!mt-0 !p-0 ${discount.hasDiscount ? 'min-h-[2.875rem]' : ''}`,
27115
+ className: `!bg-black !mt-0 !p-0 ${discount.hasDiscount ? 'min-h-[2.875rem]' : ''}`,
27046
27116
  customStyle: customStyle,
27047
27117
  disabled: loading || isLoading,
27048
27118
  loading: loading || isLoading
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paymob-pixel-alpha",
3
- "version": "1.1.1",
3
+ "version": "1.1.3",
4
4
  "keywords": ["paymob","pixel","paymob-pixel"],
5
5
  "main": "./main.js",
6
6
  "license": "MIT",
package/styles.css CHANGED
@@ -1698,6 +1698,11 @@ video {
1698
1698
  border-top-color: rgb(255 21 82 / var(--tw-border-opacity));
1699
1699
  }
1700
1700
 
1701
+ .\!bg-black {
1702
+ --tw-bg-opacity: 1 !important;
1703
+ background-color: rgb(0 0 0 / var(--tw-bg-opacity)) !important;
1704
+ }
1705
+
1701
1706
  .bg-\[\#0002\] {
1702
1707
  background-color: #0002;
1703
1708
  }
@@ -1,19 +0,0 @@
1
- var _path;
2
- function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
3
- import * as React from "react";
4
- var SvgCloseIcon = function SvgCloseIcon(props) {
5
- return /*#__PURE__*/React.createElement("svg", _extends({
6
- xmlns: "http://www.w3.org/2000/svg",
7
- width: 800,
8
- height: 800,
9
- fill: "none",
10
- viewBox: "0 0 24 24"
11
- }, props), _path || (_path = /*#__PURE__*/React.createElement("path", {
12
- fill: "#667085",
13
- fillRule: "evenodd",
14
- d: "M5.293 5.293a1 1 0 0 1 1.414 0L12 10.586l5.293-5.293a1 1 0 1 1 1.414 1.414L13.414 12l5.293 5.293a1 1 0 0 1-1.414 1.414L12 13.414l-5.293 5.293a1 1 0 0 1-1.414-1.414L10.586 12 5.293 6.707a1 1 0 0 1 0-1.414",
15
- clipRule: "evenodd"
16
- })));
17
- };
18
- export { SvgCloseIcon as ReactComponent };
19
- export default "data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiPz48IS0tIFVwbG9hZGVkIHRvOiBTVkcgUmVwbywgd3d3LnN2Z3JlcG8uY29tLCBHZW5lcmF0b3I6IFNWRyBSZXBvIE1peGVyIFRvb2xzIC0tPgo8c3ZnIHdpZHRoPSI4MDBweCIgaGVpZ2h0PSI4MDBweCIgdmlld0JveD0iMCAwIDI0IDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTUuMjkyODkgNS4yOTI4OUM1LjY4MzQyIDQuOTAyMzcgNi4zMTY1OCA0LjkwMjM3IDYuNzA3MTEgNS4yOTI4OUwxMiAxMC41ODU4TDE3LjI5MjkgNS4yOTI4OUMxNy42ODM0IDQuOTAyMzcgMTguMzE2NiA0LjkwMjM3IDE4LjcwNzEgNS4yOTI4OUMxOS4wOTc2IDUuNjgzNDIgMTkuMDk3NiA2LjMxNjU4IDE4LjcwNzEgNi43MDcxMUwxMy40MTQyIDEyTDE4LjcwNzEgMTcuMjkyOUMxOS4wOTc2IDE3LjY4MzQgMTkuMDk3NiAxOC4zMTY2IDE4LjcwNzEgMTguNzA3MUMxOC4zMTY2IDE5LjA5NzYgMTcuNjgzNCAxOS4wOTc2IDE3LjI5MjkgMTguNzA3MUwxMiAxMy40MTQyTDYuNzA3MTEgMTguNzA3MUM2LjMxNjU4IDE5LjA5NzYgNS42ODM0MiAxOS4wOTc2IDUuMjkyODkgMTguNzA3MUM0LjkwMjM3IDE4LjMxNjYgNC45MDIzNyAxNy42ODM0IDUuMjkyODkgMTcuMjkyOUwxMC41ODU4IDEyTDUuMjkyODkgNi43MDcxMUM0LjkwMjM3IDYuMzE2NTggNC45MDIzNyA1LjY4MzQyIDUuMjkyODkgNS4yOTI4OVoiIGZpbGw9IiM2NjcwODUiLz4KPC9zdmc+";