@funnelsgrove/payments 0.58.0 → 0.59.0
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PAYMENTS_PACKAGE_VERSION = "0.
|
|
1
|
+
export declare const PAYMENTS_PACKAGE_VERSION = "0.59.0";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by scripts/generate-package-version.mjs.
|
|
2
|
-
export const PAYMENTS_PACKAGE_VERSION = "0.
|
|
2
|
+
export const PAYMENTS_PACKAGE_VERSION = "0.59.0";
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { FunnelSdkHttpError } from '@funnelsgrove/runtime';
|
|
2
|
+
// Network rejection text from Chrome, Safari and Firefox.
|
|
3
|
+
const BROWSER_TRANSPORT_FAILURE = /^(?:Failed to fetch|Load failed|NetworkError when attempting to fetch resource\.?)$/i;
|
|
2
4
|
const readRetryAfterMs = (retryAfter) => {
|
|
3
5
|
const value = retryAfter === null || retryAfter === void 0 ? void 0 : retryAfter.trim();
|
|
4
6
|
if (!value) {
|
|
@@ -24,7 +26,9 @@ export const describeStripeCheckoutFailure = (error) => {
|
|
|
24
26
|
? 'Enter a valid email address to continue.'
|
|
25
27
|
: rawMessage === 'Internal server error'
|
|
26
28
|
? 'Unable to initialize checkout. Stripe settings may be missing for this funnel.'
|
|
27
|
-
: rawMessage
|
|
29
|
+
: error instanceof TypeError && BROWSER_TRANSPORT_FAILURE.test(rawMessage)
|
|
30
|
+
? "We couldn't reach checkout. Check your network connection and try again."
|
|
31
|
+
: rawMessage;
|
|
28
32
|
const retryAfterMs = error instanceof FunnelSdkHttpError
|
|
29
33
|
? readRetryAfterMs(error.retryAfter)
|
|
30
34
|
: null;
|