@pelcro/react-pelcro-js 3.10.1-beta.8 → 3.11.0-beta.1

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
@@ -15405,6 +15405,9 @@ const PaymentMethodContainerWithoutStripe = ({
15405
15405
  selectedPaymentMethodId,
15406
15406
  couponCode
15407
15407
  } = usePelcro();
15408
+ const {
15409
+ whenUserReady
15410
+ } = usePelcro.getStore();
15408
15411
  const product = (_props$product = props.product) !== null && _props$product !== void 0 ? _props$product : pelcroStore.product;
15409
15412
  const plan = (_props$plan = props.plan) !== null && _props$plan !== void 0 ? _props$plan : pelcroStore.plan;
15410
15413
  const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
@@ -15413,6 +15416,7 @@ const PaymentMethodContainerWithoutStripe = ({
15413
15416
  const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
15414
15417
  const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
15415
15418
  const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
15419
+ const cardProcessor = getSiteCardProcessor();
15416
15420
  React.useEffect(() => {
15417
15421
  if (window.Pelcro.coupon.getFromUrl()) {
15418
15422
  dispatch({
@@ -15686,6 +15690,52 @@ const PaymentMethodContainerWithoutStripe = ({
15686
15690
  }
15687
15691
  }
15688
15692
  }
15693
+
15694
+ const initTapScript = () => {
15695
+ var _window$Pelcro$site$r;
15696
+
15697
+ 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);
15698
+ let elements = tapKey.elements({});
15699
+ let style = {
15700
+ base: {
15701
+ color: "#535353",
15702
+ lineHeight: "18px",
15703
+ fontFamily: "sans-serif",
15704
+ fontSmoothing: "antialiased",
15705
+ fontSize: "16px",
15706
+ "::placeholder": {
15707
+ color: "rgba(0, 0, 0, 0.26)",
15708
+ fontSize: "15px"
15709
+ }
15710
+ },
15711
+ invalid: {
15712
+ color: "red"
15713
+ }
15714
+ }; // input labels/placeholders
15715
+
15716
+ let labels = {
15717
+ cardNumber: "Card Number",
15718
+ expirationDate: "MM/YY",
15719
+ cvv: "CVV",
15720
+ cardHolder: "Card Holder Name"
15721
+ }; //payment options
15722
+
15723
+ let paymentOptions = {
15724
+ labels: labels,
15725
+ TextDirection: "ltr"
15726
+ }; //create element, pass style and payment options
15727
+
15728
+ let card = elements.create("card", {
15729
+ style: style
15730
+ }, paymentOptions); //mount element
15731
+
15732
+ card.mount("#tapPaymentIframe"); //card change event listener
15733
+
15734
+ card.addEventListener("change", function (event) {//If needed
15735
+ });
15736
+ tapInstanceRef.current = tapKey;
15737
+ tapInstanceCard.current = card;
15738
+ };
15689
15739
  /*====== End Tap integration ========*/
15690
15740
 
15691
15741
 
@@ -15868,13 +15918,11 @@ const PaymentMethodContainerWithoutStripe = ({
15868
15918
  const tapInstanceRef = React__default['default'].useRef(null);
15869
15919
  const tapInstanceCard = React__default['default'].useRef(null);
15870
15920
  React.useEffect(() => {
15871
- const cardProcessor = getSiteCardProcessor();
15872
-
15873
15921
  if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
15874
- var _window$Pelcro$site$r, _window$Pelcro$site$r2;
15922
+ var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
15875
15923
 
15876
- const payPageId = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings.pay_page_id;
15877
- const reportGroup = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.report_group;
15924
+ 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;
15925
+ 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;
15878
15926
  vantivInstanceRef.current = new window.EprotectIframeClient({
15879
15927
  paypageId: payPageId,
15880
15928
  reportGroup: reportGroup,
@@ -15896,75 +15944,21 @@ const PaymentMethodContainerWithoutStripe = ({
15896
15944
  }
15897
15945
  });
15898
15946
  }
15947
+ }, [selectedPaymentMethodId]);
15948
+ React.useEffect(() => {
15949
+ whenUserReady(() => {
15950
+ if (cardProcessor === "tap" && !window.Tapjsli) {
15951
+ window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
15952
+ window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
15953
+ document.querySelector('script[src="https://secure.gosell.io/js/sdk/tap.min.js"]').addEventListener("load", () => {
15954
+ initTapScript();
15955
+ });
15956
+ }
15899
15957
 
15900
- if (cardProcessor === "tap" && !selectedPaymentMethodId) {
15901
- if (window.Tapjsli) {
15902
- var _window$Pelcro$site$r3;
15903
-
15904
- console.log("Yes Tap JSLI is enabled");
15905
- const tapKey = Tapjsli((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.tap_gateway_settings.publishable_key);
15906
- let elements = tapKey.elements({});
15907
- let style = {
15908
- base: {
15909
- color: "#535353",
15910
- lineHeight: "18px",
15911
- fontFamily: "sans-serif",
15912
- fontSmoothing: "antialiased",
15913
- fontSize: "16px",
15914
- "::placeholder": {
15915
- color: "rgba(0, 0, 0, 0.26)",
15916
- fontSize: "15px"
15917
- }
15918
- },
15919
- invalid: {
15920
- color: "red"
15921
- }
15922
- }; // input labels/placeholders
15923
-
15924
- let labels = {
15925
- cardNumber: "Card Number",
15926
- expirationDate: "MM/YY",
15927
- cvv: "CVV",
15928
- cardHolder: "Card Holder Name"
15929
- }; //payment options
15930
-
15931
- let paymentOptions = {
15932
- labels: labels,
15933
- TextDirection: "ltr"
15934
- }; //create element, pass style and payment options
15935
-
15936
- let card = elements.create("card", {
15937
- style: style
15938
- }, paymentOptions); //mount element
15939
-
15940
- card.mount("#tapPaymentIframe"); //card change event listener
15941
-
15942
- card.addEventListener("change", function (event) {// if (event.error_interactive) {
15943
- // onFailure(event.error_interactive);
15944
- // return dispatch({
15945
- // type: SHOW_ALERT,
15946
- // payload: {
15947
- // type: "error",
15948
- // content: getErrorMessages(event.error_interactive)
15949
- // }
15950
- // });
15951
- // } else {
15952
- // dispatch({
15953
- // type: SHOW_ALERT,
15954
- // payload: { type: "error", content: "" }
15955
- // });
15956
- // }
15957
- // let displayError = document.getElementById("error-handler");
15958
- // if (event.error) {
15959
- // displayError.textContent = event.error.message;
15960
- // } else {
15961
- // displayError.textContent = "";
15962
- // }
15963
- });
15964
- tapInstanceRef.current = tapKey;
15965
- tapInstanceCard.current = card;
15958
+ if (cardProcessor === "tap" && !selectedPaymentMethodId && window.Tapjsli) {
15959
+ initTapScript();
15966
15960
  }
15967
- }
15961
+ });
15968
15962
  }, [selectedPaymentMethodId]);
15969
15963
 
15970
15964
  const initPaymentRequest = (state, dispatch) => {
package/dist/index.esm.js CHANGED
@@ -15375,6 +15375,9 @@ const PaymentMethodContainerWithoutStripe = ({
15375
15375
  selectedPaymentMethodId,
15376
15376
  couponCode
15377
15377
  } = usePelcro();
15378
+ const {
15379
+ whenUserReady
15380
+ } = usePelcro.getStore();
15378
15381
  const product = (_props$product = props.product) !== null && _props$product !== void 0 ? _props$product : pelcroStore.product;
15379
15382
  const plan = (_props$plan = props.plan) !== null && _props$plan !== void 0 ? _props$plan : pelcroStore.plan;
15380
15383
  const subscriptionIdToRenew = (_props$subscriptionId = props.subscriptionIdToRenew) !== null && _props$subscriptionId !== void 0 ? _props$subscriptionId : pelcroStore.subscriptionIdToRenew;
@@ -15383,6 +15386,7 @@ const PaymentMethodContainerWithoutStripe = ({
15383
15386
  const isGift = (_props$isGift = props.isGift) !== null && _props$isGift !== void 0 ? _props$isGift : pelcroStore.isGift;
15384
15387
  const isRenewingGift = (_props$isRenewingGift = props.isRenewingGift) !== null && _props$isRenewingGift !== void 0 ? _props$isRenewingGift : pelcroStore.isRenewingGift;
15385
15388
  const invoice = (_props$invoice = props.invoice) !== null && _props$invoice !== void 0 ? _props$invoice : pelcroStore.invoice;
15389
+ const cardProcessor = getSiteCardProcessor();
15386
15390
  useEffect(() => {
15387
15391
  if (window.Pelcro.coupon.getFromUrl()) {
15388
15392
  dispatch({
@@ -15656,6 +15660,52 @@ const PaymentMethodContainerWithoutStripe = ({
15656
15660
  }
15657
15661
  }
15658
15662
  }
15663
+
15664
+ const initTapScript = () => {
15665
+ var _window$Pelcro$site$r;
15666
+
15667
+ 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);
15668
+ let elements = tapKey.elements({});
15669
+ let style = {
15670
+ base: {
15671
+ color: "#535353",
15672
+ lineHeight: "18px",
15673
+ fontFamily: "sans-serif",
15674
+ fontSmoothing: "antialiased",
15675
+ fontSize: "16px",
15676
+ "::placeholder": {
15677
+ color: "rgba(0, 0, 0, 0.26)",
15678
+ fontSize: "15px"
15679
+ }
15680
+ },
15681
+ invalid: {
15682
+ color: "red"
15683
+ }
15684
+ }; // input labels/placeholders
15685
+
15686
+ let labels = {
15687
+ cardNumber: "Card Number",
15688
+ expirationDate: "MM/YY",
15689
+ cvv: "CVV",
15690
+ cardHolder: "Card Holder Name"
15691
+ }; //payment options
15692
+
15693
+ let paymentOptions = {
15694
+ labels: labels,
15695
+ TextDirection: "ltr"
15696
+ }; //create element, pass style and payment options
15697
+
15698
+ let card = elements.create("card", {
15699
+ style: style
15700
+ }, paymentOptions); //mount element
15701
+
15702
+ card.mount("#tapPaymentIframe"); //card change event listener
15703
+
15704
+ card.addEventListener("change", function (event) {//If needed
15705
+ });
15706
+ tapInstanceRef.current = tapKey;
15707
+ tapInstanceCard.current = card;
15708
+ };
15659
15709
  /*====== End Tap integration ========*/
15660
15710
 
15661
15711
 
@@ -15838,13 +15888,11 @@ const PaymentMethodContainerWithoutStripe = ({
15838
15888
  const tapInstanceRef = React__default.useRef(null);
15839
15889
  const tapInstanceCard = React__default.useRef(null);
15840
15890
  useEffect(() => {
15841
- const cardProcessor = getSiteCardProcessor();
15842
-
15843
15891
  if (cardProcessor === "vantiv" && !selectedPaymentMethodId) {
15844
- var _window$Pelcro$site$r, _window$Pelcro$site$r2;
15892
+ var _window$Pelcro$site$r2, _window$Pelcro$site$r3;
15845
15893
 
15846
- const payPageId = (_window$Pelcro$site$r = window.Pelcro.site.read()) === null || _window$Pelcro$site$r === void 0 ? void 0 : _window$Pelcro$site$r.vantiv_gateway_settings.pay_page_id;
15847
- const reportGroup = (_window$Pelcro$site$r2 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r2 === void 0 ? void 0 : _window$Pelcro$site$r2.vantiv_gateway_settings.report_group;
15894
+ 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;
15895
+ 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;
15848
15896
  vantivInstanceRef.current = new window.EprotectIframeClient({
15849
15897
  paypageId: payPageId,
15850
15898
  reportGroup: reportGroup,
@@ -15866,75 +15914,21 @@ const PaymentMethodContainerWithoutStripe = ({
15866
15914
  }
15867
15915
  });
15868
15916
  }
15917
+ }, [selectedPaymentMethodId]);
15918
+ useEffect(() => {
15919
+ whenUserReady(() => {
15920
+ if (cardProcessor === "tap" && !window.Tapjsli) {
15921
+ window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
15922
+ window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
15923
+ document.querySelector('script[src="https://secure.gosell.io/js/sdk/tap.min.js"]').addEventListener("load", () => {
15924
+ initTapScript();
15925
+ });
15926
+ }
15869
15927
 
15870
- if (cardProcessor === "tap" && !selectedPaymentMethodId) {
15871
- if (window.Tapjsli) {
15872
- var _window$Pelcro$site$r3;
15873
-
15874
- console.log("Yes Tap JSLI is enabled");
15875
- const tapKey = Tapjsli((_window$Pelcro$site$r3 = window.Pelcro.site.read()) === null || _window$Pelcro$site$r3 === void 0 ? void 0 : _window$Pelcro$site$r3.tap_gateway_settings.publishable_key);
15876
- let elements = tapKey.elements({});
15877
- let style = {
15878
- base: {
15879
- color: "#535353",
15880
- lineHeight: "18px",
15881
- fontFamily: "sans-serif",
15882
- fontSmoothing: "antialiased",
15883
- fontSize: "16px",
15884
- "::placeholder": {
15885
- color: "rgba(0, 0, 0, 0.26)",
15886
- fontSize: "15px"
15887
- }
15888
- },
15889
- invalid: {
15890
- color: "red"
15891
- }
15892
- }; // input labels/placeholders
15893
-
15894
- let labels = {
15895
- cardNumber: "Card Number",
15896
- expirationDate: "MM/YY",
15897
- cvv: "CVV",
15898
- cardHolder: "Card Holder Name"
15899
- }; //payment options
15900
-
15901
- let paymentOptions = {
15902
- labels: labels,
15903
- TextDirection: "ltr"
15904
- }; //create element, pass style and payment options
15905
-
15906
- let card = elements.create("card", {
15907
- style: style
15908
- }, paymentOptions); //mount element
15909
-
15910
- card.mount("#tapPaymentIframe"); //card change event listener
15911
-
15912
- card.addEventListener("change", function (event) {// if (event.error_interactive) {
15913
- // onFailure(event.error_interactive);
15914
- // return dispatch({
15915
- // type: SHOW_ALERT,
15916
- // payload: {
15917
- // type: "error",
15918
- // content: getErrorMessages(event.error_interactive)
15919
- // }
15920
- // });
15921
- // } else {
15922
- // dispatch({
15923
- // type: SHOW_ALERT,
15924
- // payload: { type: "error", content: "" }
15925
- // });
15926
- // }
15927
- // let displayError = document.getElementById("error-handler");
15928
- // if (event.error) {
15929
- // displayError.textContent = event.error.message;
15930
- // } else {
15931
- // displayError.textContent = "";
15932
- // }
15933
- });
15934
- tapInstanceRef.current = tapKey;
15935
- tapInstanceCard.current = card;
15928
+ if (cardProcessor === "tap" && !selectedPaymentMethodId && window.Tapjsli) {
15929
+ initTapScript();
15936
15930
  }
15937
- }
15931
+ });
15938
15932
  }, [selectedPaymentMethodId]);
15939
15933
 
15940
15934
  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.10.1-beta.8",
4
+ "version": "3.11.0-beta.1",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",