@builder.io/sdk-qwik 0.1.1 → 0.1.2
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/lib/index.qwik.cjs
CHANGED
|
@@ -2192,6 +2192,7 @@ const fetch$1 = getFetch();
|
|
|
2192
2192
|
* wwww.example.com -> example.com
|
|
2193
2193
|
* www.example.co.uk -> example.co.uk
|
|
2194
2194
|
*/ const getTopLevelDomain = (host)=>{
|
|
2195
|
+
if (host === 'localhost' || host === '127.0.0.1') return host;
|
|
2195
2196
|
const parts = host.split('.');
|
|
2196
2197
|
if (parts.length > 2) return parts.slice(1).join('.');
|
|
2197
2198
|
return host;
|
|
@@ -2208,9 +2209,10 @@ const fetch$1 = getFetch();
|
|
|
2208
2209
|
*/ return document.cookie.split('; ').find((row)=>row.startsWith(`${name}=`))?.split('=')[1];
|
|
2209
2210
|
} catch (err) {
|
|
2210
2211
|
console.debug('[COOKIE] GET error: ', err);
|
|
2212
|
+
return undefined;
|
|
2211
2213
|
}
|
|
2212
2214
|
};
|
|
2213
|
-
const stringifyCookie = (cookie)=>cookie.map(([key, value])=>value ? `${key}=${value}` : key).join('; ');
|
|
2215
|
+
const stringifyCookie = (cookie)=>cookie.map(([key, value])=>value ? `${key}=${value}` : key).filter(checkIsDefined).join('; ');
|
|
2214
2216
|
const SECURE_CONFIG = [
|
|
2215
2217
|
[
|
|
2216
2218
|
'secure',
|
|
@@ -2258,7 +2260,7 @@ const createCookieString = ({ name , value , expires })=>{
|
|
|
2258
2260
|
* NOTE: This function is `async` because its react-native override is async. Do not remove the `async` keyword!
|
|
2259
2261
|
*/ const setCookie = async ({ name , value , expires , canTrack })=>{
|
|
2260
2262
|
try {
|
|
2261
|
-
if (!canTrack) return
|
|
2263
|
+
if (!canTrack) return;
|
|
2262
2264
|
const cookie = createCookieString({
|
|
2263
2265
|
name,
|
|
2264
2266
|
value,
|
|
@@ -2505,6 +2507,7 @@ const getSessionId = async ({ canTrack })=>{
|
|
|
2505
2507
|
id: newSessionId,
|
|
2506
2508
|
canTrack
|
|
2507
2509
|
});
|
|
2510
|
+
return newSessionId;
|
|
2508
2511
|
}
|
|
2509
2512
|
};
|
|
2510
2513
|
const createSessionId = ()=>uuid();
|
|
@@ -2521,6 +2524,7 @@ const getLocalStorageItem = ({ key , canTrack })=>{
|
|
|
2521
2524
|
return undefined;
|
|
2522
2525
|
} catch (err) {
|
|
2523
2526
|
console.debug('[LocalStorage] GET error: ', err);
|
|
2527
|
+
return undefined;
|
|
2524
2528
|
}
|
|
2525
2529
|
};
|
|
2526
2530
|
const setLocalStorageItem = ({ key , canTrack , value })=>{
|
|
@@ -2545,6 +2549,7 @@ const getVisitorId = ({ canTrack })=>{
|
|
|
2545
2549
|
id: newVisitorId,
|
|
2546
2550
|
canTrack
|
|
2547
2551
|
});
|
|
2552
|
+
return newVisitorId;
|
|
2548
2553
|
}
|
|
2549
2554
|
};
|
|
2550
2555
|
const createVisitorId = ()=>uuid();
|
|
@@ -2683,7 +2688,7 @@ const useContent = function useContent(props, state, elementRef) {
|
|
|
2683
2688
|
return mergedContent;
|
|
2684
2689
|
};
|
|
2685
2690
|
const canTrackToUse = function canTrackToUse(props, state, elementRef) {
|
|
2686
|
-
return props.canTrack
|
|
2691
|
+
return checkIsDefined(props.canTrack) ? props.canTrack : true;
|
|
2687
2692
|
};
|
|
2688
2693
|
const contentState = function contentState(props, state, elementRef) {
|
|
2689
2694
|
return {
|
package/lib/index.qwik.mjs
CHANGED
|
@@ -2188,6 +2188,7 @@ const fetch$1 = getFetch();
|
|
|
2188
2188
|
* wwww.example.com -> example.com
|
|
2189
2189
|
* www.example.co.uk -> example.co.uk
|
|
2190
2190
|
*/ const getTopLevelDomain = (host)=>{
|
|
2191
|
+
if (host === 'localhost' || host === '127.0.0.1') return host;
|
|
2191
2192
|
const parts = host.split('.');
|
|
2192
2193
|
if (parts.length > 2) return parts.slice(1).join('.');
|
|
2193
2194
|
return host;
|
|
@@ -2204,9 +2205,10 @@ const fetch$1 = getFetch();
|
|
|
2204
2205
|
*/ return document.cookie.split('; ').find((row)=>row.startsWith(`${name}=`))?.split('=')[1];
|
|
2205
2206
|
} catch (err) {
|
|
2206
2207
|
console.debug('[COOKIE] GET error: ', err);
|
|
2208
|
+
return undefined;
|
|
2207
2209
|
}
|
|
2208
2210
|
};
|
|
2209
|
-
const stringifyCookie = (cookie)=>cookie.map(([key, value])=>value ? `${key}=${value}` : key).join('; ');
|
|
2211
|
+
const stringifyCookie = (cookie)=>cookie.map(([key, value])=>value ? `${key}=${value}` : key).filter(checkIsDefined).join('; ');
|
|
2210
2212
|
const SECURE_CONFIG = [
|
|
2211
2213
|
[
|
|
2212
2214
|
'secure',
|
|
@@ -2254,7 +2256,7 @@ const createCookieString = ({ name , value , expires })=>{
|
|
|
2254
2256
|
* NOTE: This function is `async` because its react-native override is async. Do not remove the `async` keyword!
|
|
2255
2257
|
*/ const setCookie = async ({ name , value , expires , canTrack })=>{
|
|
2256
2258
|
try {
|
|
2257
|
-
if (!canTrack) return
|
|
2259
|
+
if (!canTrack) return;
|
|
2258
2260
|
const cookie = createCookieString({
|
|
2259
2261
|
name,
|
|
2260
2262
|
value,
|
|
@@ -2501,6 +2503,7 @@ const getSessionId = async ({ canTrack })=>{
|
|
|
2501
2503
|
id: newSessionId,
|
|
2502
2504
|
canTrack
|
|
2503
2505
|
});
|
|
2506
|
+
return newSessionId;
|
|
2504
2507
|
}
|
|
2505
2508
|
};
|
|
2506
2509
|
const createSessionId = ()=>uuid();
|
|
@@ -2517,6 +2520,7 @@ const getLocalStorageItem = ({ key , canTrack })=>{
|
|
|
2517
2520
|
return undefined;
|
|
2518
2521
|
} catch (err) {
|
|
2519
2522
|
console.debug('[LocalStorage] GET error: ', err);
|
|
2523
|
+
return undefined;
|
|
2520
2524
|
}
|
|
2521
2525
|
};
|
|
2522
2526
|
const setLocalStorageItem = ({ key , canTrack , value })=>{
|
|
@@ -2541,6 +2545,7 @@ const getVisitorId = ({ canTrack })=>{
|
|
|
2541
2545
|
id: newVisitorId,
|
|
2542
2546
|
canTrack
|
|
2543
2547
|
});
|
|
2548
|
+
return newVisitorId;
|
|
2544
2549
|
}
|
|
2545
2550
|
};
|
|
2546
2551
|
const createVisitorId = ()=>uuid();
|
|
@@ -2679,7 +2684,7 @@ const useContent = function useContent(props, state, elementRef) {
|
|
|
2679
2684
|
return mergedContent;
|
|
2680
2685
|
};
|
|
2681
2686
|
const canTrackToUse = function canTrackToUse(props, state, elementRef) {
|
|
2682
|
-
return props.canTrack
|
|
2687
|
+
return checkIsDefined(props.canTrack) ? props.canTrack : true;
|
|
2683
2688
|
};
|
|
2684
2689
|
const contentState = function contentState(props, state, elementRef) {
|
|
2685
2690
|
return {
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { CanTrack } from '../types/can-track.js';
|
|
2
|
+
import type { Nullable } from './nullable.js';
|
|
2
3
|
export declare const getLocalStorageItem: ({ key, canTrack, }: {
|
|
3
4
|
key: string;
|
|
4
|
-
} & CanTrack) => string
|
|
5
|
+
} & CanTrack) => Nullable<string>;
|
|
5
6
|
export declare const setLocalStorageItem: ({ key, canTrack, value, }: {
|
|
6
7
|
key: string;
|
|
7
8
|
value: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { CanTrack } from '../types/can-track.js';
|
|
2
|
-
export declare const getSessionId: ({ canTrack }: CanTrack) => Promise<string | undefined>;
|
|
2
|
+
export declare const getSessionId: ({ canTrack, }: CanTrack) => Promise<string | undefined>;
|
|
3
3
|
export declare const createSessionId: () => string;
|
|
4
4
|
export declare const setSessionId: ({ id, canTrack, }: {
|
|
5
5
|
id: string;
|
|
6
|
-
} & CanTrack) => Promise<
|
|
6
|
+
} & CanTrack) => Promise<void>;
|