saltfish 0.2.76 → 0.2.77
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/StateMachineActionHandler.d.ts +2 -2
- package/dist/core/services/StateMachineActionHandler.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 +40 -27
- package/dist/saltfish-playlist-player.umd.js +1 -1
- package/package.json +1 -1
|
@@ -2920,11 +2920,11 @@ class StateMachineActionHandler {
|
|
|
2920
2920
|
destroy() {
|
|
2921
2921
|
}
|
|
2922
2922
|
/**
|
|
2923
|
-
* Validates URL requirement for a specific step
|
|
2923
|
+
* Validates URL requirement for a specific step with retry logic
|
|
2924
2924
|
* @param step - The step to validate
|
|
2925
|
-
* @returns true if validation passes
|
|
2925
|
+
* @returns Promise<boolean> - true if validation passes, false otherwise
|
|
2926
2926
|
*/
|
|
2927
|
-
validateStepUrlRequirement(step) {
|
|
2927
|
+
async validateStepUrlRequirement(step) {
|
|
2928
2928
|
if (!step.urlRequirement) {
|
|
2929
2929
|
return true;
|
|
2930
2930
|
}
|
|
@@ -2932,40 +2932,53 @@ class StateMachineActionHandler {
|
|
|
2932
2932
|
if (!pattern) {
|
|
2933
2933
|
return true;
|
|
2934
2934
|
}
|
|
2935
|
-
const
|
|
2936
|
-
|
|
2937
|
-
|
|
2938
|
-
|
|
2939
|
-
|
|
2940
|
-
|
|
2941
|
-
|
|
2942
|
-
|
|
2943
|
-
|
|
2944
|
-
|
|
2935
|
+
const checkUrl = () => {
|
|
2936
|
+
const currentUrl = window.location.href.split("#")[0];
|
|
2937
|
+
const currentPath = window.location.pathname;
|
|
2938
|
+
let matches = false;
|
|
2939
|
+
if (matchType === "regex") {
|
|
2940
|
+
try {
|
|
2941
|
+
const regex = new RegExp(pattern);
|
|
2942
|
+
matches = regex.test(currentUrl) || regex.test(currentPath);
|
|
2943
|
+
} catch (error2) {
|
|
2944
|
+
}
|
|
2945
|
+
} else if (matchType === "contains") {
|
|
2946
|
+
matches = currentUrl.includes(pattern) || currentPath.includes(pattern);
|
|
2947
|
+
} else {
|
|
2948
|
+
matches = currentUrl === pattern || currentPath === pattern;
|
|
2945
2949
|
}
|
|
2946
|
-
|
|
2947
|
-
|
|
2948
|
-
|
|
2949
|
-
|
|
2950
|
-
|
|
2951
|
-
|
|
2952
|
-
|
|
2953
|
-
|
|
2954
|
-
if (
|
|
2955
|
-
|
|
2950
|
+
return matches;
|
|
2951
|
+
};
|
|
2952
|
+
const maxRetries = 3;
|
|
2953
|
+
const retryDelay = 100;
|
|
2954
|
+
for (let attempt = 0; attempt < maxRetries; attempt++) {
|
|
2955
|
+
if (checkUrl()) {
|
|
2956
|
+
return true;
|
|
2957
|
+
}
|
|
2958
|
+
if (attempt < maxRetries - 1) {
|
|
2959
|
+
await new Promise((resolve) => setTimeout(resolve, retryDelay));
|
|
2960
|
+
const saltfishPlayer2 = window._saltfishPlayer;
|
|
2961
|
+
if (!saltfishPlayer2) {
|
|
2962
|
+
return false;
|
|
2963
|
+
}
|
|
2956
2964
|
}
|
|
2957
2965
|
}
|
|
2958
|
-
|
|
2966
|
+
log(`StateMachineActionHandler: URL requirement validation failed after ${maxRetries} retries for step '${step.id}'`);
|
|
2967
|
+
const saltfishPlayer = window._saltfishPlayer;
|
|
2968
|
+
if (saltfishPlayer && typeof saltfishPlayer.destroy === "function") {
|
|
2969
|
+
saltfishPlayer.destroy();
|
|
2970
|
+
}
|
|
2971
|
+
return false;
|
|
2959
2972
|
}
|
|
2960
2973
|
// Private action handler methods
|
|
2961
|
-
handleStartVideoPlayback(context) {
|
|
2974
|
+
async handleStartVideoPlayback(context) {
|
|
2962
2975
|
if (!context.currentStep) {
|
|
2963
2976
|
return;
|
|
2964
2977
|
}
|
|
2965
2978
|
const currentStep = context.currentStep;
|
|
2966
2979
|
if (currentStep.urlRequirement) {
|
|
2967
2980
|
log(`StateMachineActionHandler: Validating URL requirement for step ${currentStep.id}`);
|
|
2968
|
-
const isValid = this.validateStepUrlRequirement(currentStep);
|
|
2981
|
+
const isValid = await this.validateStepUrlRequirement(currentStep);
|
|
2969
2982
|
if (!isValid) {
|
|
2970
2983
|
return;
|
|
2971
2984
|
}
|
|
@@ -10815,7 +10828,7 @@ const SaltfishPlayer$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.de
|
|
|
10815
10828
|
__proto__: null,
|
|
10816
10829
|
SaltfishPlayer
|
|
10817
10830
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
10818
|
-
const version = "0.2.
|
|
10831
|
+
const version = "0.2.77";
|
|
10819
10832
|
const packageJson = {
|
|
10820
10833
|
version
|
|
10821
10834
|
};
|