@pelcro/react-pelcro-js 3.25.0-beta.1 → 3.25.0-beta.2

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
@@ -18045,6 +18039,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18045
18039
  console.log("State", state);
18046
18040
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
18047
18041
  if (isUsingExistingPaymentMethod) {
18042
+ appendCybersourceFingerprintScripts();
18048
18043
  // no need to create a new source using cybersrce
18049
18044
  return handleCybersourcePayment(null, state);
18050
18045
  }
@@ -18077,7 +18072,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18077
18072
  });
18078
18073
  };
18079
18074
  function handleCybersourcePayment(paymentRequest, state) {
18080
- console.log("Cybersource Session ID: ", state.cyberSourceSessionId);
18081
18075
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
18082
18076
  if (type === "createPayment") {
18083
18077
  handleCybersourceSubscription();
@@ -18215,18 +18209,22 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18215
18209
  const uniqueId = crypto.randomUUID();
18216
18210
  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
18211
  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
- });
18212
+ const fingerPrintScript = document.querySelector(`script[src="https://h.online-metrix.net/fp/tags.js?org_id=${orgID}&session_id=${sessionID}"]`);
18213
+ const fingerPringIframe = document.querySelector(`iframe[src="https://h.online-metrix.net/fp/tags?org_id=${orgID}&session_id=${sessionID}"]`);
18214
+ if (!fingerPrintScript && !fingerPringIframe) {
18215
+ window.Pelcro.helpers.loadSDK(`https://h.online-metrix.net/fp/tags.js?org_id=${orgID}&session_id=${sessionID}`, "cybersource-fingerprint-script");
18216
+ const body = document.getElementsByTagName("body")[0];
18217
+ const noscript = document.createElement("noscript");
18218
+ const iframe = document.createElement("iframe");
18219
+ iframe.style.cssText = "width: 100px; height: 100px; border: 0; position:absolute; top: -5000px;";
18220
+ iframe.src = `https://h.online-metrix.net/fp/tags?org_id=${orgID}&session_id=${sessionID}`;
18221
+ noscript.appendChild(iframe);
18222
+ body.insertBefore(noscript, body.firstChild);
18223
+ dispatch({
18224
+ type: UPDATE_CYBERSOURCE_SESSION_ID,
18225
+ payload: uniqueId
18226
+ });
18227
+ }
18230
18228
  };
18231
18229
  const initCybersourceScript = () => {
18232
18230
  // jwk api call
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
@@ -18015,6 +18009,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18015
18009
  console.log("State", state);
18016
18010
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
18017
18011
  if (isUsingExistingPaymentMethod) {
18012
+ appendCybersourceFingerprintScripts();
18018
18013
  // no need to create a new source using cybersrce
18019
18014
  return handleCybersourcePayment(null, state);
18020
18015
  }
@@ -18047,7 +18042,6 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18047
18042
  });
18048
18043
  };
18049
18044
  function handleCybersourcePayment(paymentRequest, state) {
18050
- console.log("Cybersource Session ID: ", state.cyberSourceSessionId);
18051
18045
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
18052
18046
  if (type === "createPayment") {
18053
18047
  handleCybersourceSubscription();
@@ -18185,18 +18179,22 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18185
18179
  const uniqueId = crypto.randomUUID();
18186
18180
  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
18181
  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
- });
18182
+ const fingerPrintScript = document.querySelector(`script[src="https://h.online-metrix.net/fp/tags.js?org_id=${orgID}&session_id=${sessionID}"]`);
18183
+ const fingerPringIframe = document.querySelector(`iframe[src="https://h.online-metrix.net/fp/tags?org_id=${orgID}&session_id=${sessionID}"]`);
18184
+ if (!fingerPrintScript && !fingerPringIframe) {
18185
+ window.Pelcro.helpers.loadSDK(`https://h.online-metrix.net/fp/tags.js?org_id=${orgID}&session_id=${sessionID}`, "cybersource-fingerprint-script");
18186
+ const body = document.getElementsByTagName("body")[0];
18187
+ const noscript = document.createElement("noscript");
18188
+ const iframe = document.createElement("iframe");
18189
+ iframe.style.cssText = "width: 100px; height: 100px; border: 0; position:absolute; top: -5000px;";
18190
+ iframe.src = `https://h.online-metrix.net/fp/tags?org_id=${orgID}&session_id=${sessionID}`;
18191
+ noscript.appendChild(iframe);
18192
+ body.insertBefore(noscript, body.firstChild);
18193
+ dispatch({
18194
+ type: UPDATE_CYBERSOURCE_SESSION_ID,
18195
+ payload: uniqueId
18196
+ });
18197
+ }
18200
18198
  };
18201
18199
  const initCybersourceScript = () => {
18202
18200
  // jwk api call
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.2",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",