@pelcro/react-pelcro-js 3.23.0-beta.14 → 3.23.0-beta.16

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
@@ -12741,6 +12741,7 @@ const HANDLE_REMOVE_MEMBER = "HANDLE_REMOVE_MEMBER";
12741
12741
  const UPDATE_INVITE_BUTTON = "UPDATE_INVITE_BUTTON";
12742
12742
  const UPDATE_MEMBERS = "UPDATE_MEMBERS";
12743
12743
  const UPDATE_REMOVE_MEMBER_ID = "UPDATE_REMOVE_MEMBER_ID";
12744
+ const UPDATE_CYBERSOURCE_SESSION_ID = "UPDATE_CYBERSOURCE_SESSION_ID";
12744
12745
 
12745
12746
  const initialState$m = {
12746
12747
  email: "",
@@ -17707,7 +17708,8 @@ class CybersourceGateway {
17707
17708
  product,
17708
17709
  quantity = 1,
17709
17710
  addressId,
17710
- isExistingSource
17711
+ isExistingSource,
17712
+ fingerprint_session_id
17711
17713
  } = options;
17712
17714
  const params = isExistingSource ? {
17713
17715
  source_id: token
@@ -17722,6 +17724,7 @@ class CybersourceGateway {
17722
17724
  campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
17723
17725
  coupon_code: couponCode,
17724
17726
  address_id: product.address_required ? addressId : null,
17727
+ fingerprint_session_id,
17725
17728
  ...params
17726
17729
  }, (err, res) => {
17727
17730
  callback(err, res);
@@ -17923,6 +17926,7 @@ const initialState$k = {
17923
17926
  month: "",
17924
17927
  year: "",
17925
17928
  passwordError: null,
17929
+ cyberSourceSessionId: null,
17926
17930
  alert: {
17927
17931
  type: "error",
17928
17932
  content: ""
@@ -18032,6 +18036,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18032
18036
  };
18033
18037
  const submitUsingCybersource = (state, dispatch) => {
18034
18038
  var _cybersourceInstanceR;
18039
+ console.log("State", state);
18035
18040
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
18036
18041
  if (isUsingExistingPaymentMethod) {
18037
18042
  // no need to create a new source using cybersrce
@@ -18066,6 +18071,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18066
18071
  });
18067
18072
  };
18068
18073
  function handleCybersourcePayment(paymentRequest, state) {
18074
+ console.log("Cybersource Session ID: ", state.cyberSourceSessionId);
18069
18075
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
18070
18076
  if (type === "createPayment") {
18071
18077
  handleCybersourceSubscription();
@@ -18181,7 +18187,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18181
18187
  couponCode,
18182
18188
  product,
18183
18189
  isExistingSource: isUsingExistingPaymentMethod,
18184
- addressId: selectedAddressId
18190
+ addressId: selectedAddressId,
18191
+ fingerprint_session_id: state.cyberSourceSessionId
18185
18192
  }, (err, res) => {
18186
18193
  if (err) {
18187
18194
  return handlePaymentError(err);
@@ -18197,6 +18204,24 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18197
18204
  }
18198
18205
  cybersourceInstanceRef.current = microformInstance;
18199
18206
  };
18207
+ const appendCybersourceFingerprintScripts = () => {
18208
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro$site$r4;
18209
+ const uniqueId = crypto.randomUUID();
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;
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;
18212
+ window.Pelcro.helpers.loadSDK(`https://h.online-metrix.net/fp/tags.js?org_id=${orgID}&session_id=${sessionID}`, "cybersource-fingerprint-script");
18213
+ const body = document.getElementsByTagName("body")[0];
18214
+ const noscript = document.createElement("noscript");
18215
+ const iframe = document.createElement("iframe");
18216
+ iframe.style.cssText = "width: 100px; height: 100px; border: 0; position:absolute; top: -5000px;";
18217
+ iframe.src = `https://h.online-metrix.net/fp/tags?org_id=${orgID}&session_id=${sessionID}`;
18218
+ noscript.appendChild(iframe);
18219
+ body.insertBefore(noscript, body.firstChild);
18220
+ dispatch({
18221
+ type: UPDATE_CYBERSOURCE_SESSION_ID,
18222
+ payload: uniqueId
18223
+ });
18224
+ };
18200
18225
  const initCybersourceScript = () => {
18201
18226
  // jwk api call
18202
18227
  window.Pelcro.payment.getJWK({
@@ -18221,6 +18246,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18221
18246
  }
18222
18247
  });
18223
18248
  }
18249
+ appendCybersourceFingerprintScripts();
18224
18250
  const {
18225
18251
  key: jwk
18226
18252
  } = res;
@@ -18499,8 +18525,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18499
18525
  }
18500
18526
  }
18501
18527
  const initTapScript = () => {
18502
- var _window$Pelcro$site$r;
18503
- const tapKey = window.Tapjsli((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings.publishable_key);
18528
+ var _window$Pelcro$site$r5;
18529
+ const tapKey = window.Tapjsli((_window$Pelcro$site$r5 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r5 === void 0 ? void 0 : _window$Pelcro$site$r5.tap_gateway_settings.publishable_key);
18504
18530
  let elements = tapKey.elements({});
18505
18531
  let style = {
18506
18532
  base: {
@@ -18710,9 +18736,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18710
18736
  React.useEffect(() => {
18711
18737
  if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
18712
18738
  if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
18713
- var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
18714
- const payPageId = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.pay_page_id;
18715
- const reportGroup = (_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.vantiv_gateway_settings.report_group;
18739
+ var _window$Pelcro$site$r6, _window$Pelcro$site$r7;
18740
+ const payPageId = (_window$Pelcro$site$r6 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r6 === void 0 ? void 0 : _window$Pelcro$site$r6.vantiv_gateway_settings.pay_page_id;
18741
+ const reportGroup = (_window$Pelcro$site$r7 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r7 === void 0 ? void 0 : _window$Pelcro$site$r7.vantiv_gateway_settings.report_group;
18716
18742
  vantivInstanceRef.current = new window.EprotectIframeClient({
18717
18743
  paypageId: payPageId,
18718
18744
  reportGroup: reportGroup,
@@ -18848,9 +18874,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18848
18874
  * Updates the total amount after adding taxes only if site taxes are enabled
18849
18875
  */
18850
18876
  const updateTotalAmountWithTax = () => {
18851
- var _window$Pelcro$site$r4;
18877
+ var _window$Pelcro$site$r8;
18852
18878
  if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
18853
- const taxesEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.taxes_enabled;
18879
+ const taxesEnabled = (_window$Pelcro$site$r8 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r8 === void 0 ? void 0 : _window$Pelcro$site$r8.taxes_enabled;
18854
18880
  if (taxesEnabled && type === "createPayment") {
18855
18881
  dispatch({
18856
18882
  type: DISABLE_SUBMIT,
@@ -19599,11 +19625,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19599
19625
  * @return {Promise}
19600
19626
  */
19601
19627
  const resolveTaxCalculation = () => {
19602
- var _window$Pelcro$site$r5;
19628
+ var _window$Pelcro$site$r9;
19603
19629
  if (type === "invoicePayment") {
19604
19630
  return new Promise(resolve => resolve());
19605
19631
  }
19606
- const taxesEnabled = (_window$Pelcro$site$r5 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r5 === void 0 ? void 0 : _window$Pelcro$site$r5.taxes_enabled;
19632
+ const taxesEnabled = (_window$Pelcro$site$r9 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r9 === void 0 ? void 0 : _window$Pelcro$site$r9.taxes_enabled;
19607
19633
  return new Promise((resolve, reject) => {
19608
19634
  // resolve early if taxes isn't enabled
19609
19635
  if (!taxesEnabled) {
@@ -19970,6 +19996,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19970
19996
  ...state,
19971
19997
  alert: action.payload
19972
19998
  });
19999
+ case UPDATE_CYBERSOURCE_SESSION_ID:
20000
+ return lib_7({
20001
+ ...state,
20002
+ cyberSourceSessionId: action.payload
20003
+ });
19973
20004
  default:
19974
20005
  return state;
19975
20006
  }
package/dist/index.esm.js CHANGED
@@ -12711,6 +12711,7 @@ const HANDLE_REMOVE_MEMBER = "HANDLE_REMOVE_MEMBER";
12711
12711
  const UPDATE_INVITE_BUTTON = "UPDATE_INVITE_BUTTON";
12712
12712
  const UPDATE_MEMBERS = "UPDATE_MEMBERS";
12713
12713
  const UPDATE_REMOVE_MEMBER_ID = "UPDATE_REMOVE_MEMBER_ID";
12714
+ const UPDATE_CYBERSOURCE_SESSION_ID = "UPDATE_CYBERSOURCE_SESSION_ID";
12714
12715
 
12715
12716
  const initialState$m = {
12716
12717
  email: "",
@@ -17677,7 +17678,8 @@ class CybersourceGateway {
17677
17678
  product,
17678
17679
  quantity = 1,
17679
17680
  addressId,
17680
- isExistingSource
17681
+ isExistingSource,
17682
+ fingerprint_session_id
17681
17683
  } = options;
17682
17684
  const params = isExistingSource ? {
17683
17685
  source_id: token
@@ -17692,6 +17694,7 @@ class CybersourceGateway {
17692
17694
  campaign_key: window.Pelcro.helpers.getURLParameter("campaign_key"),
17693
17695
  coupon_code: couponCode,
17694
17696
  address_id: product.address_required ? addressId : null,
17697
+ fingerprint_session_id,
17695
17698
  ...params
17696
17699
  }, (err, res) => {
17697
17700
  callback(err, res);
@@ -17893,6 +17896,7 @@ const initialState$k = {
17893
17896
  month: "",
17894
17897
  year: "",
17895
17898
  passwordError: null,
17899
+ cyberSourceSessionId: null,
17896
17900
  alert: {
17897
17901
  type: "error",
17898
17902
  content: ""
@@ -18002,6 +18006,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18002
18006
  };
18003
18007
  const submitUsingCybersource = (state, dispatch) => {
18004
18008
  var _cybersourceInstanceR;
18009
+ console.log("State", state);
18005
18010
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
18006
18011
  if (isUsingExistingPaymentMethod) {
18007
18012
  // no need to create a new source using cybersrce
@@ -18036,6 +18041,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18036
18041
  });
18037
18042
  };
18038
18043
  function handleCybersourcePayment(paymentRequest, state) {
18044
+ console.log("Cybersource Session ID: ", state.cyberSourceSessionId);
18039
18045
  const isUsingExistingPaymentMethod = Boolean(selectedPaymentMethodId);
18040
18046
  if (type === "createPayment") {
18041
18047
  handleCybersourceSubscription();
@@ -18151,7 +18157,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18151
18157
  couponCode,
18152
18158
  product,
18153
18159
  isExistingSource: isUsingExistingPaymentMethod,
18154
- addressId: selectedAddressId
18160
+ addressId: selectedAddressId,
18161
+ fingerprint_session_id: state.cyberSourceSessionId
18155
18162
  }, (err, res) => {
18156
18163
  if (err) {
18157
18164
  return handlePaymentError(err);
@@ -18167,6 +18174,24 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18167
18174
  }
18168
18175
  cybersourceInstanceRef.current = microformInstance;
18169
18176
  };
18177
+ const appendCybersourceFingerprintScripts = () => {
18178
+ var _window$Pelcro$site$r, _window$Pelcro$site$r2, _window$Pelcro$site$r3, _window$Pelcro$site$r4;
18179
+ const uniqueId = crypto.randomUUID();
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;
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;
18182
+ window.Pelcro.helpers.loadSDK(`https://h.online-metrix.net/fp/tags.js?org_id=${orgID}&session_id=${sessionID}`, "cybersource-fingerprint-script");
18183
+ const body = document.getElementsByTagName("body")[0];
18184
+ const noscript = document.createElement("noscript");
18185
+ const iframe = document.createElement("iframe");
18186
+ iframe.style.cssText = "width: 100px; height: 100px; border: 0; position:absolute; top: -5000px;";
18187
+ iframe.src = `https://h.online-metrix.net/fp/tags?org_id=${orgID}&session_id=${sessionID}`;
18188
+ noscript.appendChild(iframe);
18189
+ body.insertBefore(noscript, body.firstChild);
18190
+ dispatch({
18191
+ type: UPDATE_CYBERSOURCE_SESSION_ID,
18192
+ payload: uniqueId
18193
+ });
18194
+ };
18170
18195
  const initCybersourceScript = () => {
18171
18196
  // jwk api call
18172
18197
  window.Pelcro.payment.getJWK({
@@ -18191,6 +18216,7 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18191
18216
  }
18192
18217
  });
18193
18218
  }
18219
+ appendCybersourceFingerprintScripts();
18194
18220
  const {
18195
18221
  key: jwk
18196
18222
  } = res;
@@ -18469,8 +18495,8 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18469
18495
  }
18470
18496
  }
18471
18497
  const initTapScript = () => {
18472
- var _window$Pelcro$site$r;
18473
- const tapKey = window.Tapjsli((_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.tap_gateway_settings.publishable_key);
18498
+ var _window$Pelcro$site$r5;
18499
+ const tapKey = window.Tapjsli((_window$Pelcro$site$r5 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r5 === void 0 ? void 0 : _window$Pelcro$site$r5.tap_gateway_settings.publishable_key);
18474
18500
  let elements = tapKey.elements({});
18475
18501
  let style = {
18476
18502
  base: {
@@ -18680,9 +18706,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18680
18706
  useEffect(() => {
18681
18707
  if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
18682
18708
  if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
18683
- var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
18684
- const payPageId = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.pay_page_id;
18685
- const reportGroup = (_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.vantiv_gateway_settings.report_group;
18709
+ var _window$Pelcro$site$r6, _window$Pelcro$site$r7;
18710
+ const payPageId = (_window$Pelcro$site$r6 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r6 === void 0 ? void 0 : _window$Pelcro$site$r6.vantiv_gateway_settings.pay_page_id;
18711
+ const reportGroup = (_window$Pelcro$site$r7 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r7 === void 0 ? void 0 : _window$Pelcro$site$r7.vantiv_gateway_settings.report_group;
18686
18712
  vantivInstanceRef.current = new window.EprotectIframeClient({
18687
18713
  paypageId: payPageId,
18688
18714
  reportGroup: reportGroup,
@@ -18818,9 +18844,9 @@ const PaymentMethodContainerWithoutStripe = _ref => {
18818
18844
  * Updates the total amount after adding taxes only if site taxes are enabled
18819
18845
  */
18820
18846
  const updateTotalAmountWithTax = () => {
18821
- var _window$Pelcro$site$r4;
18847
+ var _window$Pelcro$site$r8;
18822
18848
  if (skipPayment && ((plan === null || plan === void 0 ? void 0 : plan.amount) === 0 || props !== null && props !== void 0 && props.freeOrders)) return;
18823
- const taxesEnabled = (_window$Pelcro$site$r4 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r4 === void 0 ? void 0 : _window$Pelcro$site$r4.taxes_enabled;
18849
+ const taxesEnabled = (_window$Pelcro$site$r8 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r8 === void 0 ? void 0 : _window$Pelcro$site$r8.taxes_enabled;
18824
18850
  if (taxesEnabled && type === "createPayment") {
18825
18851
  dispatch({
18826
18852
  type: DISABLE_SUBMIT,
@@ -19569,11 +19595,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19569
19595
  * @return {Promise}
19570
19596
  */
19571
19597
  const resolveTaxCalculation = () => {
19572
- var _window$Pelcro$site$r5;
19598
+ var _window$Pelcro$site$r9;
19573
19599
  if (type === "invoicePayment") {
19574
19600
  return new Promise(resolve => resolve());
19575
19601
  }
19576
- const taxesEnabled = (_window$Pelcro$site$r5 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r5 === void 0 ? void 0 : _window$Pelcro$site$r5.taxes_enabled;
19602
+ const taxesEnabled = (_window$Pelcro$site$r9 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r9 === void 0 ? void 0 : _window$Pelcro$site$r9.taxes_enabled;
19577
19603
  return new Promise((resolve, reject) => {
19578
19604
  // resolve early if taxes isn't enabled
19579
19605
  if (!taxesEnabled) {
@@ -19940,6 +19966,11 @@ const PaymentMethodContainerWithoutStripe = _ref => {
19940
19966
  ...state,
19941
19967
  alert: action.payload
19942
19968
  });
19969
+ case UPDATE_CYBERSOURCE_SESSION_ID:
19970
+ return lib_7({
19971
+ ...state,
19972
+ cyberSourceSessionId: action.payload
19973
+ });
19943
19974
  default:
19944
19975
  return state;
19945
19976
  }
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.23.0-beta.14",
4
+ "version": "3.23.0-beta.16",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",