saltfish 0.3.70 → 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/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 +70 -49
- 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, ".*");
|
|
@@ -3012,51 +3078,6 @@ class PlaylistOrchestrator {
|
|
|
3012
3078
|
destroy() {
|
|
3013
3079
|
}
|
|
3014
3080
|
}
|
|
3015
|
-
function validateUrlRequirement(urlRequirement) {
|
|
3016
|
-
const { pattern, matchType } = urlRequirement;
|
|
3017
|
-
if (!pattern) {
|
|
3018
|
-
return true;
|
|
3019
|
-
}
|
|
3020
|
-
const currentUrl = window.location.href;
|
|
3021
|
-
const currentPath = window.location.pathname;
|
|
3022
|
-
if (matchType === "regex") {
|
|
3023
|
-
try {
|
|
3024
|
-
const regex = new RegExp(pattern);
|
|
3025
|
-
const fullUrlMatch = regex.test(currentUrl);
|
|
3026
|
-
const pathMatch = regex.test(currentPath);
|
|
3027
|
-
const matches2 = fullUrlMatch || pathMatch;
|
|
3028
|
-
log(`urlValidation: Result (regex) - matches: ${matches2}`);
|
|
3029
|
-
return matches2;
|
|
3030
|
-
} catch (error2) {
|
|
3031
|
-
return false;
|
|
3032
|
-
}
|
|
3033
|
-
}
|
|
3034
|
-
if (matchType === "contains") {
|
|
3035
|
-
const matches2 = currentUrl.includes(pattern) || currentPath.includes(pattern);
|
|
3036
|
-
return matches2;
|
|
3037
|
-
}
|
|
3038
|
-
const matches = currentUrl === pattern || currentPath === pattern;
|
|
3039
|
-
return matches;
|
|
3040
|
-
}
|
|
3041
|
-
async function validateUrlRequirementWithRetry(urlRequirement, maxRetries = 20, retryDelay = 100) {
|
|
3042
|
-
if (!urlRequirement) {
|
|
3043
|
-
return true;
|
|
3044
|
-
}
|
|
3045
|
-
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
3046
|
-
if (validateUrlRequirement(urlRequirement)) {
|
|
3047
|
-
return true;
|
|
3048
|
-
}
|
|
3049
|
-
if (attempt < maxRetries - 1) {
|
|
3050
|
-
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
3051
|
-
const saltfishPlayer = window._saltfishPlayer;
|
|
3052
|
-
if (!saltfishPlayer) {
|
|
3053
|
-
return false;
|
|
3054
|
-
}
|
|
3055
|
-
}
|
|
3056
|
-
}
|
|
3057
|
-
log(`urlValidation: Expected pattern: '${urlRequirement.pattern}' (matchType: ${urlRequirement.matchType})`);
|
|
3058
|
-
return false;
|
|
3059
|
-
}
|
|
3060
3081
|
class StateMachineActionHandler {
|
|
3061
3082
|
constructor(managers) {
|
|
3062
3083
|
__publicField(this, "managers");
|
|
@@ -9726,7 +9747,7 @@ class TransitionManager {
|
|
|
9726
9747
|
if (!pattern) {
|
|
9727
9748
|
return false;
|
|
9728
9749
|
}
|
|
9729
|
-
const currentUrl = window.location.href;
|
|
9750
|
+
const currentUrl = stripShareIdFromUrl(window.location.href);
|
|
9730
9751
|
const currentPath = window.location.pathname;
|
|
9731
9752
|
const escapedPattern = pattern.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
9732
9753
|
const regexPattern = escapedPattern.replace(/\\\*/g, ".*");
|
|
@@ -10241,7 +10262,7 @@ class TriggerManager {
|
|
|
10241
10262
|
if (!pattern) {
|
|
10242
10263
|
return true;
|
|
10243
10264
|
}
|
|
10244
|
-
const currentUrl = this.normalizeUrl(window.location.href.split("#")[0]);
|
|
10265
|
+
const currentUrl = this.normalizeUrl(stripShareIdFromUrl(window.location.href.split("#")[0]));
|
|
10245
10266
|
const currentPath = window.location.pathname;
|
|
10246
10267
|
if (triggers.urlMatchType === "regex") {
|
|
10247
10268
|
try {
|
|
@@ -12569,7 +12590,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
|
|
|
12569
12590
|
__proto__: null,
|
|
12570
12591
|
SaltfishPlayer
|
|
12571
12592
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
12572
|
-
const version = "0.3.
|
|
12593
|
+
const version = "0.3.71";
|
|
12573
12594
|
const packageJson = {
|
|
12574
12595
|
version
|
|
12575
12596
|
};
|