saltfish 0.3.69 → 0.3.71
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/core/services/PlayerInitializationService.d.ts.map +1 -1
- package/dist/core/services/PlaylistOrchestrator.d.ts.map +1 -1
- package/dist/managers/TransitionManager.d.ts.map +1 -1
- package/dist/managers/TriggerManager.d.ts.map +1 -1
- package/dist/player.js +2 -2
- package/dist/player.min.js +2 -2
- package/dist/saltfish-playlist-player.es.js +74 -50
- package/dist/saltfish-playlist-player.umd.js +1 -1
- package/dist/utils/urlValidation.d.ts +7 -0
- package/dist/utils/urlValidation.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1905,6 +1905,72 @@ const THRESHOLDS = {
|
|
|
1905
1905
|
/** Minimum scroll distance in pixels to trigger scroll events */
|
|
1906
1906
|
SCROLL_THRESHOLD_PX: 10
|
|
1907
1907
|
};
|
|
1908
|
+
function stripShareIdFromUrl(url) {
|
|
1909
|
+
try {
|
|
1910
|
+
let cleanedUrl = url.replace(/[?&]saltfish-share-id=[^&#]*/g, (match, offset) => {
|
|
1911
|
+
if (match.startsWith("?")) {
|
|
1912
|
+
const afterMatch = url.substring(offset + match.length);
|
|
1913
|
+
if (afterMatch.startsWith("&")) {
|
|
1914
|
+
return "?";
|
|
1915
|
+
}
|
|
1916
|
+
return "";
|
|
1917
|
+
}
|
|
1918
|
+
return "";
|
|
1919
|
+
});
|
|
1920
|
+
cleanedUrl = cleanedUrl.replace(/\?&/g, "?");
|
|
1921
|
+
cleanedUrl = cleanedUrl.replace(/&&/g, "&");
|
|
1922
|
+
cleanedUrl = cleanedUrl.replace(/\?$/g, "");
|
|
1923
|
+
cleanedUrl = cleanedUrl.replace(/&$/g, "");
|
|
1924
|
+
return cleanedUrl;
|
|
1925
|
+
} catch (error2) {
|
|
1926
|
+
return url;
|
|
1927
|
+
}
|
|
1928
|
+
}
|
|
1929
|
+
function validateUrlRequirement(urlRequirement) {
|
|
1930
|
+
const { pattern, matchType } = urlRequirement;
|
|
1931
|
+
if (!pattern) {
|
|
1932
|
+
return true;
|
|
1933
|
+
}
|
|
1934
|
+
const currentUrl = stripShareIdFromUrl(window.location.href);
|
|
1935
|
+
const currentPath = window.location.pathname;
|
|
1936
|
+
if (matchType === "regex") {
|
|
1937
|
+
try {
|
|
1938
|
+
const regex = new RegExp(pattern);
|
|
1939
|
+
const fullUrlMatch = regex.test(currentUrl);
|
|
1940
|
+
const pathMatch = regex.test(currentPath);
|
|
1941
|
+
const matches2 = fullUrlMatch || pathMatch;
|
|
1942
|
+
log(`urlValidation: Result (regex) - matches: ${matches2}`);
|
|
1943
|
+
return matches2;
|
|
1944
|
+
} catch (error2) {
|
|
1945
|
+
return false;
|
|
1946
|
+
}
|
|
1947
|
+
}
|
|
1948
|
+
if (matchType === "contains") {
|
|
1949
|
+
const matches2 = currentUrl.includes(pattern) || currentPath.includes(pattern);
|
|
1950
|
+
return matches2;
|
|
1951
|
+
}
|
|
1952
|
+
const matches = currentUrl === pattern || currentPath === pattern;
|
|
1953
|
+
return matches;
|
|
1954
|
+
}
|
|
1955
|
+
async function validateUrlRequirementWithRetry(urlRequirement, maxRetries = 20, retryDelay = 100) {
|
|
1956
|
+
if (!urlRequirement) {
|
|
1957
|
+
return true;
|
|
1958
|
+
}
|
|
1959
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
1960
|
+
if (validateUrlRequirement(urlRequirement)) {
|
|
1961
|
+
return true;
|
|
1962
|
+
}
|
|
1963
|
+
if (attempt < maxRetries - 1) {
|
|
1964
|
+
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
1965
|
+
const saltfishPlayer = window._saltfishPlayer;
|
|
1966
|
+
if (!saltfishPlayer) {
|
|
1967
|
+
return false;
|
|
1968
|
+
}
|
|
1969
|
+
}
|
|
1970
|
+
}
|
|
1971
|
+
log(`urlValidation: Expected pattern: '${urlRequirement.pattern}' (matchType: ${urlRequirement.matchType})`);
|
|
1972
|
+
return false;
|
|
1973
|
+
}
|
|
1908
1974
|
class PlayerInitializationService {
|
|
1909
1975
|
constructor(managers) {
|
|
1910
1976
|
__publicField(this, "managers");
|
|
@@ -2282,7 +2348,7 @@ class PlayerInitializationService {
|
|
|
2282
2348
|
if (!pattern || typeof window === "undefined") {
|
|
2283
2349
|
return false;
|
|
2284
2350
|
}
|
|
2285
|
-
const currentUrl = window.location.href;
|
|
2351
|
+
const currentUrl = stripShareIdFromUrl(window.location.href);
|
|
2286
2352
|
const currentPath = window.location.pathname;
|
|
2287
2353
|
const escapedPattern = pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
2288
2354
|
const regexPattern = escapedPattern.replace(/\\\*/g, ".*");
|
|
@@ -2856,11 +2922,14 @@ class PlaylistOrchestrator {
|
|
|
2856
2922
|
if (this.userManagementService) {
|
|
2857
2923
|
await this.userManagementService.recordABTestAttempt(playlistId);
|
|
2858
2924
|
}
|
|
2859
|
-
if (true) {
|
|
2925
|
+
if ((options == null ? void 0 : options._startedFromShareLink) !== true) {
|
|
2860
2926
|
if (!this.managers.abTestManager.isPlaylistAvailable(playlistId)) {
|
|
2861
2927
|
log(`[PlaylistOrchestrator.startPlaylist] Playlist ${playlistId} not available due to A/B test assignment`);
|
|
2862
2928
|
return;
|
|
2863
2929
|
}
|
|
2930
|
+
} else if (false) ;
|
|
2931
|
+
else if ((options == null ? void 0 : options._startedFromShareLink) === true) {
|
|
2932
|
+
log(`[PlaylistOrchestrator.startPlaylist] Share link - skipping A/B test check for playlist ${playlistId}`);
|
|
2864
2933
|
}
|
|
2865
2934
|
const validator = new PlaylistValidator();
|
|
2866
2935
|
const validationResult = await validator.validatePlaylistStart({
|
|
@@ -3009,51 +3078,6 @@ class PlaylistOrchestrator {
|
|
|
3009
3078
|
destroy() {
|
|
3010
3079
|
}
|
|
3011
3080
|
}
|
|
3012
|
-
function validateUrlRequirement(urlRequirement) {
|
|
3013
|
-
const { pattern, matchType } = urlRequirement;
|
|
3014
|
-
if (!pattern) {
|
|
3015
|
-
return true;
|
|
3016
|
-
}
|
|
3017
|
-
const currentUrl = window.location.href;
|
|
3018
|
-
const currentPath = window.location.pathname;
|
|
3019
|
-
if (matchType === "regex") {
|
|
3020
|
-
try {
|
|
3021
|
-
const regex = new RegExp(pattern);
|
|
3022
|
-
const fullUrlMatch = regex.test(currentUrl);
|
|
3023
|
-
const pathMatch = regex.test(currentPath);
|
|
3024
|
-
const matches2 = fullUrlMatch || pathMatch;
|
|
3025
|
-
log(`urlValidation: Result (regex) - matches: ${matches2}`);
|
|
3026
|
-
return matches2;
|
|
3027
|
-
} catch (error2) {
|
|
3028
|
-
return false;
|
|
3029
|
-
}
|
|
3030
|
-
}
|
|
3031
|
-
if (matchType === "contains") {
|
|
3032
|
-
const matches2 = currentUrl.includes(pattern) || currentPath.includes(pattern);
|
|
3033
|
-
return matches2;
|
|
3034
|
-
}
|
|
3035
|
-
const matches = currentUrl === pattern || currentPath === pattern;
|
|
3036
|
-
return matches;
|
|
3037
|
-
}
|
|
3038
|
-
async function validateUrlRequirementWithRetry(urlRequirement, maxRetries = 20, retryDelay = 100) {
|
|
3039
|
-
if (!urlRequirement) {
|
|
3040
|
-
return true;
|
|
3041
|
-
}
|
|
3042
|
-
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
3043
|
-
if (validateUrlRequirement(urlRequirement)) {
|
|
3044
|
-
return true;
|
|
3045
|
-
}
|
|
3046
|
-
if (attempt < maxRetries - 1) {
|
|
3047
|
-
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
3048
|
-
const saltfishPlayer = window._saltfishPlayer;
|
|
3049
|
-
if (!saltfishPlayer) {
|
|
3050
|
-
return false;
|
|
3051
|
-
}
|
|
3052
|
-
}
|
|
3053
|
-
}
|
|
3054
|
-
log(`urlValidation: Expected pattern: '${urlRequirement.pattern}' (matchType: ${urlRequirement.matchType})`);
|
|
3055
|
-
return false;
|
|
3056
|
-
}
|
|
3057
3081
|
class StateMachineActionHandler {
|
|
3058
3082
|
constructor(managers) {
|
|
3059
3083
|
__publicField(this, "managers");
|
|
@@ -9723,7 +9747,7 @@ class TransitionManager {
|
|
|
9723
9747
|
if (!pattern) {
|
|
9724
9748
|
return false;
|
|
9725
9749
|
}
|
|
9726
|
-
const currentUrl = window.location.href;
|
|
9750
|
+
const currentUrl = stripShareIdFromUrl(window.location.href);
|
|
9727
9751
|
const currentPath = window.location.pathname;
|
|
9728
9752
|
const escapedPattern = pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
9729
9753
|
const regexPattern = escapedPattern.replace(/\\\*/g, ".*");
|
|
@@ -10238,7 +10262,7 @@ class TriggerManager {
|
|
|
10238
10262
|
if (!pattern) {
|
|
10239
10263
|
return true;
|
|
10240
10264
|
}
|
|
10241
|
-
const currentUrl = this.normalizeUrl(window.location.href.split("#")[0]);
|
|
10265
|
+
const currentUrl = this.normalizeUrl(stripShareIdFromUrl(window.location.href.split("#")[0]));
|
|
10242
10266
|
const currentPath = window.location.pathname;
|
|
10243
10267
|
if (triggers.urlMatchType === "regex") {
|
|
10244
10268
|
try {
|
|
@@ -12566,7 +12590,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
|
|
|
12566
12590
|
__proto__: null,
|
|
12567
12591
|
SaltfishPlayer
|
|
12568
12592
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
12569
|
-
const version = "0.3.
|
|
12593
|
+
const version = "0.3.71";
|
|
12570
12594
|
const packageJson = {
|
|
12571
12595
|
version
|
|
12572
12596
|
};
|