@pelcro/react-pelcro-js 3.25.0-beta.1 → 3.25.0-beta.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/dist/index.cjs.js CHANGED
@@ -17711,7 +17711,6 @@ class CybersourceGateway {
17711
17711
  isExistingSource,
17712
17712
  fingerprint_session_id
17713
17713
  } = options;
17714
- console.log("Options 1", options);
17715
17714
  const params = isExistingSource ? {
17716
17715
  source_id: token
17717
17716
  } : {
@@ -17744,7 +17743,6 @@ class CybersourceGateway {
17744
17743
  addressId,
17745
17744
  isExistingSource
17746
17745
  } = options;
17747
- console.log("Options 2", options);
17748
17746
  const params = isExistingSource ? {
17749
17747
  source_id: token
17750
17748
  } : {
@@ -17777,7 +17775,6 @@ class CybersourceGateway {
17777
17775
  addressId,
17778
17776
  isExistingSource
17779
17777
  } = options;
17780
- console.log("Options 3", options);
17781
17778
  const params = isExistingSource ? {
17782
17779
  source_id: token
17783
17780
  } : {
@@ -17814,7 +17811,6 @@ class CybersourceGateway {
17814
17811
  addressId,
17815
17812
  isExistingSource
17816
17813
  } = options;
17817
- console.log("Options 4", options);
17818
17814
  const params = isExistingSource ? {
17819
17815
  source_id: token
17820
17816
  } : {
@@ -17843,7 +17839,6 @@ class CybersourceGateway {
17843
17839
  addressId,
17844
17840
  isExistingSource
17845
17841
  } = options;
17846
- console.log("Options 5", options);
17847
17842
  const params = isExistingSource ? {
17848
17843
  source_id: token
17849
17844
  } : {
@@ -17870,7 +17865,6 @@ class CybersourceGateway {
17870
17865
  token,
17871
17866
  invoiceId
17872
17867
  } = options;
17873
- console.log("Options 6", options);
17874
17868
  const params = options.isExistingSource ? {
17875
17869
  source_id: token,
17876
17870
  invoice_id: invoiceId
@@ -18077,7 +18071,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18077
18071
  });
18078
18072
  };
18079
18073
  function handleCybersourcePayment(paymentRequest, state) {
18080
- console.log("Cybersource Session ID: ", state.cyberSourceSessionId);
18081
18074
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
18082
18075
  if (type === "createPayment") {
18083
18076
  handleCybersourceSubscription();
@@ -18215,18 +18208,22 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18215
18208
  const uniqueId = crypto.randomUUID();
18216
18209
  const sessionID = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.cybersource_gateway_settings) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.merchant_id) + uniqueId;
18217
18210
  const orgID = (_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : (_window$Pelcro$site$r4 = _window$Pelcro$site$r3.cybersource_gateway_settings) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.org_id;
18218
- window.Pelcro.helpers.loadSDK(`https://h.online-metrix.net/fp/tags.js?org_id=${orgID}&session_id=${sessionID}`, "cybersource-fingerprint-script");
18219
- const body = document.getElementsByTagName("body")[0];
18220
- const noscript = document.createElement("noscript");
18221
- const iframe = document.createElement("iframe");
18222
- iframe.style.cssText = "width: 100px; height: 100px; border: 0; position:absolute; top: -5000px;";
18223
- iframe.src = `https://h.online-metrix.net/fp/tags?org_id=${orgID}&session_id=${sessionID}`;
18224
- noscript.appendChild(iframe);
18225
- body.insertBefore(noscript, body.firstChild);
18226
- dispatch({
18227
- type: UPDATE_CYBERSOURCE_SESSION_ID,
18228
- payload: uniqueId
18229
- });
18211
+ const fingerPrintScript = document.querySelector(`script[src="https://h.online-metrix.net/fp/tags.js?org_id=${orgID}&session_id=${sessionID}"]`);
18212
+ const fingerPringIframe = document.querySelector(`iframe[src="https://h.online-metrix.net/fp/tags?org_id=${orgID}&session_id=${sessionID}"]`);
18213
+ if (!fingerPrintScript && !fingerPringIframe) {
18214
+ window.Pelcro.helpers.loadSDK(`https://h.online-metrix.net/fp/tags.js?org_id=${orgID}&session_id=${sessionID}`, "cybersource-fingerprint-script");
18215
+ const body = document.getElementsByTagName("body")[0];
18216
+ const noscript = document.createElement("noscript");
18217
+ const iframe = document.createElement("iframe");
18218
+ iframe.style.cssText = "width: 100px; height: 100px; border: 0; position:absolute; top: -5000px;";
18219
+ iframe.src = `https://h.online-metrix.net/fp/tags?org_id=${orgID}&session_id=${sessionID}`;
18220
+ noscript.appendChild(iframe);
18221
+ body.insertBefore(noscript, body.firstChild);
18222
+ dispatch({
18223
+ type: UPDATE_CYBERSOURCE_SESSION_ID,
18224
+ payload: uniqueId
18225
+ });
18226
+ }
18230
18227
  };
18231
18228
  const initCybersourceScript = () => {
18232
18229
  // jwk api call
@@ -18252,7 +18249,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18252
18249
  }
18253
18250
  });
18254
18251
  }
18255
- appendCybersourceFingerprintScripts();
18256
18252
  const {
18257
18253
  key: jwk
18258
18254
  } = res;
@@ -18796,6 +18792,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18796
18792
  if (cardProcessor === "cybersource" && !selectedPaymentMethodId && window.FLEX) {
18797
18793
  initCybersourceScript();
18798
18794
  }
18795
+ if (cardProcessor === "cybersource") {
18796
+ appendCybersourceFingerprintScripts();
18797
+ }
18799
18798
  });
18800
18799
  }, [selectedPaymentMethodId]);
18801
18800
  const initPaymentRequest = (state, dispatch) => {
package/dist/index.esm.js CHANGED
@@ -17681,7 +17681,6 @@ class CybersourceGateway {
17681
17681
  isExistingSource,
17682
17682
  fingerprint_session_id
17683
17683
  } = options;
17684
- console.log("Options 1", options);
17685
17684
  const params = isExistingSource ? {
17686
17685
  source_id: token
17687
17686
  } : {
@@ -17714,7 +17713,6 @@ class CybersourceGateway {
17714
17713
  addressId,
17715
17714
  isExistingSource
17716
17715
  } = options;
17717
- console.log("Options 2", options);
17718
17716
  const params = isExistingSource ? {
17719
17717
  source_id: token
17720
17718
  } : {
@@ -17747,7 +17745,6 @@ class CybersourceGateway {
17747
17745
  addressId,
17748
17746
  isExistingSource
17749
17747
  } = options;
17750
- console.log("Options 3", options);
17751
17748
  const params = isExistingSource ? {
17752
17749
  source_id: token
17753
17750
  } : {
@@ -17784,7 +17781,6 @@ class CybersourceGateway {
17784
17781
  addressId,
17785
17782
  isExistingSource
17786
17783
  } = options;
17787
- console.log("Options 4", options);
17788
17784
  const params = isExistingSource ? {
17789
17785
  source_id: token
17790
17786
  } : {
@@ -17813,7 +17809,6 @@ class CybersourceGateway {
17813
17809
  addressId,
17814
17810
  isExistingSource
17815
17811
  } = options;
17816
- console.log("Options 5", options);
17817
17812
  const params = isExistingSource ? {
17818
17813
  source_id: token
17819
17814
  } : {
@@ -17840,7 +17835,6 @@ class CybersourceGateway {
17840
17835
  token,
17841
17836
  invoiceId
17842
17837
  } = options;
17843
- console.log("Options 6", options);
17844
17838
  const params = options.isExistingSource ? {
17845
17839
  source_id: token,
17846
17840
  invoice_id: invoiceId
@@ -18047,7 +18041,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18047
18041
  });
18048
18042
  };
18049
18043
  function handleCybersourcePayment(paymentRequest, state) {
18050
- console.log("Cybersource Session ID: ", state.cyberSourceSessionId);
18051
18044
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
18052
18045
  if (type === "createPayment") {
18053
18046
  handleCybersourceSubscription();
@@ -18185,18 +18178,22 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18185
18178
  const uniqueId = crypto.randomUUID();
18186
18179
  const sessionID = ((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : (_window$Pelcro$site$r2 = _window$Pelcro$site$r.cybersource_gateway_settings) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.merchant_id) + uniqueId;
18187
18180
  const orgID = (_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : (_window$Pelcro$site$r4 = _window$Pelcro$site$r3.cybersource_gateway_settings) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.org_id;
18188
- window.Pelcro.helpers.loadSDK(`https://h.online-metrix.net/fp/tags.js?org_id=${orgID}&session_id=${sessionID}`, "cybersource-fingerprint-script");
18189
- const body = document.getElementsByTagName("body")[0];
18190
- const noscript = document.createElement("noscript");
18191
- const iframe = document.createElement("iframe");
18192
- iframe.style.cssText = "width: 100px; height: 100px; border: 0; position:absolute; top: -5000px;";
18193
- iframe.src = `https://h.online-metrix.net/fp/tags?org_id=${orgID}&session_id=${sessionID}`;
18194
- noscript.appendChild(iframe);
18195
- body.insertBefore(noscript, body.firstChild);
18196
- dispatch({
18197
- type: UPDATE_CYBERSOURCE_SESSION_ID,
18198
- payload: uniqueId
18199
- });
18181
+ const fingerPrintScript = document.querySelector(`script[src="https://h.online-metrix.net/fp/tags.js?org_id=${orgID}&session_id=${sessionID}"]`);
18182
+ const fingerPringIframe = document.querySelector(`iframe[src="https://h.online-metrix.net/fp/tags?org_id=${orgID}&session_id=${sessionID}"]`);
18183
+ if (!fingerPrintScript && !fingerPringIframe) {
18184
+ window.Pelcro.helpers.loadSDK(`https://h.online-metrix.net/fp/tags.js?org_id=${orgID}&session_id=${sessionID}`, "cybersource-fingerprint-script");
18185
+ const body = document.getElementsByTagName("body")[0];
18186
+ const noscript = document.createElement("noscript");
18187
+ const iframe = document.createElement("iframe");
18188
+ iframe.style.cssText = "width: 100px; height: 100px; border: 0; position:absolute; top: -5000px;";
18189
+ iframe.src = `https://h.online-metrix.net/fp/tags?org_id=${orgID}&session_id=${sessionID}`;
18190
+ noscript.appendChild(iframe);
18191
+ body.insertBefore(noscript, body.firstChild);
18192
+ dispatch({
18193
+ type: UPDATE_CYBERSOURCE_SESSION_ID,
18194
+ payload: uniqueId
18195
+ });
18196
+ }
18200
18197
  };
18201
18198
  const initCybersourceScript = () => {
18202
18199
  // jwk api call
@@ -18222,7 +18219,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18222
18219
  }
18223
18220
  });
18224
18221
  }
18225
- appendCybersourceFingerprintScripts();
18226
18222
  const {
18227
18223
  key: jwk
18228
18224
  } = res;
@@ -18766,6 +18762,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18766
18762
  if (cardProcessor === "cybersource" && !selectedPaymentMethodId && window.FLEX) {
18767
18763
  initCybersourceScript();
18768
18764
  }
18765
+ if (cardProcessor === "cybersource") {
18766
+ appendCybersourceFingerprintScripts();
18767
+ }
18769
18768
  });
18770
18769
  }, [selectedPaymentMethodId]);
18771
18770
  const initPaymentRequest = (state, dispatch) => {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pelcro/react-pelcro-js",
3
3
  "description": "Pelcro's React UI Elements",
4
- "version": "3.25.0-beta.1",
4
+ "version": "3.25.0-beta.3",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",