paymob-pixel-alpha 1.1.5 → 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.
Files changed (2) hide show
  1. package/main.js +9 -6
  2. package/package.json +1 -1
package/main.js CHANGED
@@ -18914,7 +18914,7 @@ function IframeCard(props) {
18914
18914
  } else {
18915
18915
  handleCardSubmit({
18916
18916
  data,
18917
- cardHolderName,
18917
+ cardHolderName: cardHolderName || 'n/a',
18918
18918
  paymentToken: hasOmanNetIntegration && isOmanNetCard ? subType.paymentToken : paymentToken,
18919
18919
  subType: hasOmanNetIntegration && isOmanNetCard ? subType.type : 'CARD',
18920
18920
  saveCard,
@@ -20016,7 +20016,7 @@ const CardElement = /*#__PURE__*/(0,react.forwardRef)(({
20016
20016
  var _iframeRef$current2;
20017
20017
  const cardNameField = (_iframeRef$current2 = iframeRef.current) == null || (_iframeRef$current2 = _iframeRef$current2.nextElementSibling) == null ? void 0 : _iframeRef$current2.querySelector(`input[name=name]`);
20018
20018
  if (cardNameField !== null) {
20019
- cardNameField.focus();
20019
+ cardNameField == null || cardNameField.focus();
20020
20020
  }
20021
20021
  }
20022
20022
  if (event.data.iframeCardHight) {
@@ -20455,7 +20455,7 @@ const CardElement = /*#__PURE__*/(0,react.forwardRef)(({
20455
20455
  }), /*#__PURE__*/(0,jsx_runtime.jsx)(dist_Skeleton, {
20456
20456
  height: 37
20457
20457
  })]
20458
- }), /*#__PURE__*/(0,jsx_runtime.jsx)(dist_Skeleton, {
20458
+ }), !hideCardHolderName && /*#__PURE__*/(0,jsx_runtime.jsx)(dist_Skeleton, {
20459
20459
  height: 37
20460
20460
  })]
20461
20461
  }), /*#__PURE__*/(0,jsx_runtime.jsx)("iframe", {
@@ -31761,7 +31761,10 @@ class Pixel {
31761
31761
  this._options.cardValidationChanged(isValid);
31762
31762
  }
31763
31763
  }
31764
- static getInstance(instanceId) {
31764
+ static getInstance(instanceId, callingMethodName) {
31765
+ if (Object.keys(this._instances).length > 1 && !instanceId) {
31766
+ throw new Error(`Multiple Pixel instances detected. Please provide an instance ID for the ${callingMethodName || 'requested'} method.`);
31767
+ }
31765
31768
  const targetId = instanceId || this._lastInstanceId;
31766
31769
  if (!targetId || !this._instances[targetId]) {
31767
31770
  throw new Error('Invalid ID or Pixel not initialized');
@@ -31770,7 +31773,7 @@ class Pixel {
31770
31773
  }
31771
31774
  static async updateIntentionData(instanceId) {
31772
31775
  var _instance$_paymentsRe;
31773
- const instance = this.getInstance(instanceId);
31776
+ const instance = this.getInstance(instanceId, 'updateIntentionData');
31774
31777
  if (!((_instance$_paymentsRe = instance._paymentsRef) != null && (_instance$_paymentsRe = _instance$_paymentsRe.current) != null && _instance$_paymentsRe.getData)) {
31775
31778
  throw new Error('Pixel not initialized');
31776
31779
  }
@@ -31778,7 +31781,7 @@ class Pixel {
31778
31781
  }
31779
31782
  static async submit(instanceId) {
31780
31783
  var _instance$_paymentsRe2;
31781
- const instance = this.getInstance(instanceId);
31784
+ const instance = this.getInstance(instanceId, 'submit');
31782
31785
  if (!((_instance$_paymentsRe2 = instance._paymentsRef) != null && (_instance$_paymentsRe2 = _instance$_paymentsRe2.current) != null && _instance$_paymentsRe2.handleGenerateToken)) {
31783
31786
  throw new Error('Pixel not initialized');
31784
31787
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "paymob-pixel-alpha",
3
- "version": "1.1.5",
3
+ "version": "1.1.6",
4
4
  "keywords": ["paymob","pixel","paymob-pixel"],
5
5
  "main": "./main.js",
6
6
  "license": "MIT",