@product7/feedback-sdk 1.2.3 → 1.2.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.
package/dist/feedback-sdk.js
CHANGED
|
@@ -4796,6 +4796,25 @@
|
|
|
4796
4796
|
this.eventBus.emit('sdk:destroyed');
|
|
4797
4797
|
}
|
|
4798
4798
|
|
|
4799
|
+
_detectEnvironment() {
|
|
4800
|
+
if (typeof window === 'undefined') {
|
|
4801
|
+
return 'production';
|
|
4802
|
+
}
|
|
4803
|
+
|
|
4804
|
+
const hostname = window.location.hostname.toLowerCase();
|
|
4805
|
+
|
|
4806
|
+
if (
|
|
4807
|
+
hostname.includes('staging') ||
|
|
4808
|
+
hostname.includes('localhost') ||
|
|
4809
|
+
hostname.includes('127.0.0.1') ||
|
|
4810
|
+
hostname.includes('.local')
|
|
4811
|
+
) {
|
|
4812
|
+
return 'staging';
|
|
4813
|
+
}
|
|
4814
|
+
|
|
4815
|
+
return 'production';
|
|
4816
|
+
}
|
|
4817
|
+
|
|
4799
4818
|
_validateAndMergeConfig(newConfig, existingConfig = {}) {
|
|
4800
4819
|
const defaultConfig = {
|
|
4801
4820
|
apiUrl: null,
|
|
@@ -4807,7 +4826,7 @@
|
|
|
4807
4826
|
autoShow: true,
|
|
4808
4827
|
debug: false,
|
|
4809
4828
|
mock: false,
|
|
4810
|
-
env:
|
|
4829
|
+
env: this._detectEnvironment(),
|
|
4811
4830
|
};
|
|
4812
4831
|
|
|
4813
4832
|
const mergedConfig = deepMerge(
|
|
@@ -4815,6 +4834,10 @@
|
|
|
4815
4834
|
newConfig
|
|
4816
4835
|
);
|
|
4817
4836
|
|
|
4837
|
+
if (!newConfig.env && !existingConfig.env) {
|
|
4838
|
+
mergedConfig.env = this._detectEnvironment();
|
|
4839
|
+
}
|
|
4840
|
+
|
|
4818
4841
|
if (!mergedConfig.workspace) {
|
|
4819
4842
|
throw new ConfigError('Missing required configuration: workspace');
|
|
4820
4843
|
}
|