superposition-provider 0.99.0 → 0.99.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/dist/index.esm.js CHANGED
@@ -3180,7 +3180,7 @@ var runtimeConfig = {};
3180
3180
 
3181
3181
  var name = "superposition-sdk";
3182
3182
  var description = "superposition-sdk client";
3183
- var version = "0.99.0";
3183
+ var version = "0.99.2";
3184
3184
  var repository = {
3185
3185
  type: "git",
3186
3186
  url: "git+https://github.com/juspay/superposition.git"
@@ -16804,6 +16804,14 @@ class ExperimentationClient {
16804
16804
  }
16805
16805
  }
16806
16806
  }
16807
+ // If cache is empty, fetch on-demand regardless of strategy
16808
+ if (!this.cachedExperiments) {
16809
+ const experiments = await this.fetchExperiments();
16810
+ if (experiments) {
16811
+ this.cachedExperiments = experiments;
16812
+ this.lastUpdated = new Date();
16813
+ }
16814
+ }
16807
16815
  return this.cachedExperiments || [];
16808
16816
  }
16809
16817
  async getExperimentGroups() {
@@ -16833,6 +16841,14 @@ class ExperimentationClient {
16833
16841
  }
16834
16842
  }
16835
16843
  }
16844
+ // If cache is empty, fetch on-demand regardless of strategy
16845
+ if (!this.cachedExperimentGroups) {
16846
+ const experimentGroups = await this.fetchExperimentGroups();
16847
+ if (experimentGroups) {
16848
+ this.cachedExperimentGroups = experimentGroups;
16849
+ this.lastUpdated = new Date();
16850
+ }
16851
+ }
16836
16852
  return this.cachedExperimentGroups || [];
16837
16853
  }
16838
16854
  generateCacheKey(queryData) {
@@ -16904,7 +16920,7 @@ class ConfigurationClient {
16904
16920
  }
16905
16921
  async eval(queryData, filterPrefixes, targetingKey) {
16906
16922
  try {
16907
- const configData = await this.fetchConfigData();
16923
+ const configData = this.currentConfigData || await this.fetchConfigData();
16908
16924
  let experimentationArgs;
16909
16925
  if (this.experimentationClient && targetingKey) {
16910
16926
  const experiments = await this.experimentationClient.getExperiments();
@@ -16956,7 +16972,7 @@ class ConfigurationClient {
16956
16972
  // TODO: Remove this function all together and use eval for getAllConfigValue as well
16957
16973
  async getAllConfigValue(defaultValue, context, targetingKey) {
16958
16974
  try {
16959
- const configData = await this.fetchConfigData();
16975
+ const configData = this.currentConfigData || await this.fetchConfigData();
16960
16976
  // Prepare query data with experiment variants if applicable
16961
16977
  let queryData = { ...context };
16962
16978
  if (this.experimentationClient && targetingKey) {