launchdarkly-js-sdk-common 5.5.0-beta.2 → 5.5.0-beta.3

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/index.js +10 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "launchdarkly-js-sdk-common",
3
- "version": "5.5.0-beta.2",
3
+ "version": "5.5.0-beta.3",
4
4
  "description": "LaunchDarkly SDK for JavaScript - common code",
5
5
  "author": "LaunchDarkly <team@launchdarkly.com>",
6
6
  "license": "Apache-2.0",
package/src/index.js CHANGED
@@ -682,10 +682,16 @@ function initialize(env, context, specifiedOptions, platform, extraOptionDefs) {
682
682
  if (!env) {
683
683
  return Promise.reject(new errors.LDInvalidEnvironmentIdError(messages.environmentNotSpecified()));
684
684
  }
685
+ let afterIdentify;
685
686
  return anonymousContextProcessor
686
687
  .processContext(context)
687
688
  .then(verifyContext)
689
+ .then(context => {
690
+ afterIdentify = hookRunner.identify(context, undefined);
691
+ return context;
692
+ })
688
693
  .then(validatedContext => {
694
+ afterIdentify?.({ status: 'completed' });
689
695
  ident.setContext(validatedContext);
690
696
  if (typeof options.bootstrap === 'object') {
691
697
  // flags have already been set earlier
@@ -695,6 +701,10 @@ function initialize(env, context, specifiedOptions, platform, extraOptionDefs) {
695
701
  } else {
696
702
  return finishInitWithPolling();
697
703
  }
704
+ })
705
+ .catch(err => {
706
+ afterIdentify?.({ status: 'error' });
707
+ throw err;
698
708
  });
699
709
  }
700
710