@funnelsgrove/payments 0.11.3 → 0.11.4
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.
|
@@ -284,10 +284,44 @@ const currentCheckoutUrl = () => {
|
|
|
284
284
|
}
|
|
285
285
|
return sanitizeCheckoutUrl((_a = window.location) === null || _a === void 0 ? void 0 : _a.href);
|
|
286
286
|
};
|
|
287
|
+
const readMetaCookieValue = (name) => {
|
|
288
|
+
var _a;
|
|
289
|
+
if (typeof document === 'undefined') {
|
|
290
|
+
return undefined;
|
|
291
|
+
}
|
|
292
|
+
let cookieHeader;
|
|
293
|
+
try {
|
|
294
|
+
cookieHeader = document.cookie;
|
|
295
|
+
}
|
|
296
|
+
catch (_b) {
|
|
297
|
+
return undefined;
|
|
298
|
+
}
|
|
299
|
+
const encodedValue = (_a = cookieHeader
|
|
300
|
+
.split(';')
|
|
301
|
+
.map((part) => part.trim())
|
|
302
|
+
.find((part) => part.startsWith(`${name}=`))) === null || _a === void 0 ? void 0 : _a.slice(name.length + 1);
|
|
303
|
+
if (!encodedValue) {
|
|
304
|
+
return undefined;
|
|
305
|
+
}
|
|
306
|
+
try {
|
|
307
|
+
const value = decodeURIComponent(encodedValue).trim();
|
|
308
|
+
return value && value.length <= 2048 ? value : undefined;
|
|
309
|
+
}
|
|
310
|
+
catch (_c) {
|
|
311
|
+
const value = encodedValue.trim();
|
|
312
|
+
return value && value.length <= 2048 ? value : undefined;
|
|
313
|
+
}
|
|
314
|
+
};
|
|
287
315
|
const normalizeAnalyticsMetadata = (metadata) => {
|
|
288
316
|
const normalized = Object.fromEntries(Object.entries(isRecord(metadata) ? metadata : {}).filter(([, value]) => value !== undefined && value !== null && value !== ''));
|
|
317
|
+
const fbc = asTrimmedStringOrNull(normalized.fbc)
|
|
318
|
+
|| asTrimmedStringOrNull(normalized._fbc)
|
|
319
|
+
|| readMetaCookieValue('_fbc');
|
|
320
|
+
const fbp = asTrimmedStringOrNull(normalized.fbp)
|
|
321
|
+
|| asTrimmedStringOrNull(normalized._fbp)
|
|
322
|
+
|| readMetaCookieValue('_fbp');
|
|
289
323
|
const checkoutUrl = sanitizeCheckoutUrl(normalized.url) || currentCheckoutUrl();
|
|
290
|
-
const withCheckoutUrl =
|
|
324
|
+
const withCheckoutUrl = Object.assign(Object.assign(Object.assign(Object.assign({}, normalized), (fbc ? { fbc } : {})), (fbp ? { fbp } : {})), (checkoutUrl ? { url: checkoutUrl } : {}));
|
|
291
325
|
return Object.keys(withCheckoutUrl).length > 0 ? withCheckoutUrl : undefined;
|
|
292
326
|
};
|
|
293
327
|
const normalizeCheckoutAnalyticsMetadata = (metadata, plan) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@funnelsgrove/payments",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.4",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/The-Solid-Grove/funnelsgrove.git",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
"test:run": "vitest run --passWithNoTests"
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@funnelsgrove/analytics": "^0.1.
|
|
36
|
-
"@funnelsgrove/runtime": "^0.11.
|
|
35
|
+
"@funnelsgrove/analytics": "^0.1.86",
|
|
36
|
+
"@funnelsgrove/runtime": "^0.11.2",
|
|
37
37
|
"@solidgate/react-sdk": "1.34.0",
|
|
38
38
|
"@stripe/react-stripe-js": "^5.6.0",
|
|
39
39
|
"@stripe/stripe-js": "^8.7.0",
|