@pelcro/react-pelcro-js 3.10.1-beta.3 → 3.10.1-beta.5

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
@@ -10117,15 +10117,18 @@ const loadPaymentSDKs = () => {
10117
10117
  const scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? PRODUCTION_URL : PRELIVE_URL;
10118
10118
  window.Pelcro.helpers.loadSDK(scriptUrlToUse, "vantiv-eprotect-sdk");
10119
10119
  }
10120
- } // Load Tap SDKs
10120
+ } //Lazy load Tap SDK
10121
10121
 
10122
10122
 
10123
- const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
10123
+ whenUserReady(() => {
10124
+ // Load Tap SDKs
10125
+ const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
10124
10126
 
10125
- if (supportsTap) {
10126
- window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
10127
- window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
10128
- }
10127
+ if (supportsTap) {
10128
+ window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
10129
+ window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
10130
+ }
10131
+ });
10129
10132
  };
10130
10133
  const loadAuth0SDK = () => {
10131
10134
  const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url);
@@ -17084,12 +17087,17 @@ const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
17084
17087
 
17085
17088
  const PaymentMethodContainer = props => {
17086
17089
  const [isStripeLoaded, setIsStripeLoaded] = React.useState(Boolean(window.Stripe));
17090
+ const {
17091
+ whenUserReady
17092
+ } = usePelcro.getStore();
17087
17093
  React.useEffect(() => {
17088
- if (!window.Stripe) {
17089
- document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
17090
- setIsStripeLoaded(true);
17091
- });
17092
- }
17094
+ whenUserReady(() => {
17095
+ if (!window.Stripe) {
17096
+ document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
17097
+ setIsStripeLoaded(true);
17098
+ });
17099
+ }
17100
+ });
17093
17101
  }, []);
17094
17102
 
17095
17103
  if (isStripeLoaded) {
package/dist/index.esm.js CHANGED
@@ -10087,15 +10087,18 @@ const loadPaymentSDKs = () => {
10087
10087
  const scriptUrlToUse = window.Pelcro.site.read().vantiv_gateway_settings.environment === "production" ? PRODUCTION_URL : PRELIVE_URL;
10088
10088
  window.Pelcro.helpers.loadSDK(scriptUrlToUse, "vantiv-eprotect-sdk");
10089
10089
  }
10090
- } // Load Tap SDKs
10090
+ } //Lazy load Tap SDK
10091
10091
 
10092
10092
 
10093
- const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
10093
+ whenUserReady(() => {
10094
+ // Load Tap SDKs
10095
+ const supportsTap = Boolean(window.Pelcro.site.read().tap_gateway_settings);
10094
10096
 
10095
- if (supportsTap) {
10096
- window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
10097
- window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
10098
- }
10097
+ if (supportsTap) {
10098
+ window.Pelcro.helpers.loadSDK("https://cdnjs.cloudflare.com/ajax/libs/bluebird/3.3.4/bluebird.min.js", "tap-bluebird");
10099
+ window.Pelcro.helpers.loadSDK("https://secure.gosell.io/js/sdk/tap.min.js", "tap-sdk");
10100
+ }
10101
+ });
10099
10102
  };
10100
10103
  const loadAuth0SDK = () => {
10101
10104
  const auth0Enabled = Boolean(window.Pelcro.site.read().auth0_client_id && window.Pelcro.site.read().auth0_base_url);
@@ -17054,12 +17057,17 @@ const UnwrappedForm = es_12(PaymentMethodContainerWithoutStripe);
17054
17057
 
17055
17058
  const PaymentMethodContainer = props => {
17056
17059
  const [isStripeLoaded, setIsStripeLoaded] = useState(Boolean(window.Stripe));
17060
+ const {
17061
+ whenUserReady
17062
+ } = usePelcro.getStore();
17057
17063
  useEffect(() => {
17058
- if (!window.Stripe) {
17059
- document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
17060
- setIsStripeLoaded(true);
17061
- });
17062
- }
17064
+ whenUserReady(() => {
17065
+ if (!window.Stripe) {
17066
+ document.querySelector('script[src="https://js.stripe.com/v3"]').addEventListener("load", () => {
17067
+ setIsStripeLoaded(true);
17068
+ });
17069
+ }
17070
+ });
17063
17071
  }, []);
17064
17072
 
17065
17073
  if (isStripeLoaded) {
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.3",
4
+ "version": "3.10.1-beta.5",
5
5
  "license": "MIT",
6
6
  "private": false,
7
7
  "main": "dist/index.cjs.js",