@splitsoftware/splitio-commons 2.4.1 → 2.4.2-rc.0

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.
@@ -38,6 +38,7 @@ function sdkClientFactory(params, isSharedClient) {
38
38
  (0, clientInputValidation_1.clientInputValidationDecorator)(settings, (0, client_1.clientFactory)(params), sdkReadinessManager.readinessManager),
39
39
  // Sdk destroy
40
40
  {
41
+ __ctx: params,
41
42
  flush: function () {
42
43
  // @TODO define cooldown time
43
44
  return __cooldown(__flush, COOLDOWN_TIME_IN_MILLIS);
@@ -87,8 +87,7 @@ function sdkFactory(params) {
87
87
  initCallbacks.length = 0;
88
88
  }
89
89
  log.info(constants_1.NEW_FACTORY);
90
- // @ts-ignore
91
- return (0, objectAssign_1.objectAssign)({
90
+ var factory = (0, objectAssign_1.objectAssign)({
92
91
  // Split evaluation and event tracking engine
93
92
  client: clientMethod,
94
93
  // Manager API to explore available information
@@ -102,7 +101,15 @@ function sdkFactory(params) {
102
101
  destroy: function () {
103
102
  hasInit = false;
104
103
  return Promise.all(Object.keys(clients).map(function (key) { return clients[key].destroy(); })).then(function () { });
105
- }
104
+ },
105
+ __ctx: ctx
106
106
  }, extraProps && extraProps(ctx), lazyInit ? { init: init } : init());
107
+ // append factory to global
108
+ if (typeof window === 'object') { // @ts-ignore
109
+ // eslint-disable-next-line no-undef
110
+ (window.__HARNESS_FME__ = window.__HARNESS_FME__ || []).push(factory);
111
+ }
112
+ // @ts-ignore
113
+ return factory;
107
114
  }
108
115
  exports.sdkFactory = sdkFactory;
@@ -35,6 +35,7 @@ export function sdkClientFactory(params, isSharedClient) {
35
35
  clientInputValidationDecorator(settings, clientFactory(params), sdkReadinessManager.readinessManager),
36
36
  // Sdk destroy
37
37
  {
38
+ __ctx: params,
38
39
  flush: function () {
39
40
  // @TODO define cooldown time
40
41
  return __cooldown(__flush, COOLDOWN_TIME_IN_MILLIS);
@@ -84,8 +84,7 @@ export function sdkFactory(params) {
84
84
  initCallbacks.length = 0;
85
85
  }
86
86
  log.info(NEW_FACTORY);
87
- // @ts-ignore
88
- return objectAssign({
87
+ var factory = objectAssign({
89
88
  // Split evaluation and event tracking engine
90
89
  client: clientMethod,
91
90
  // Manager API to explore available information
@@ -99,6 +98,14 @@ export function sdkFactory(params) {
99
98
  destroy: function () {
100
99
  hasInit = false;
101
100
  return Promise.all(Object.keys(clients).map(function (key) { return clients[key].destroy(); })).then(function () { });
102
- }
101
+ },
102
+ __ctx: ctx
103
103
  }, extraProps && extraProps(ctx), lazyInit ? { init: init } : init());
104
+ // append factory to global
105
+ if (typeof window === 'object') { // @ts-ignore
106
+ // eslint-disable-next-line no-undef
107
+ (window.__HARNESS_FME__ = window.__HARNESS_FME__ || []).push(factory);
108
+ }
109
+ // @ts-ignore
110
+ return factory;
104
111
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splitsoftware/splitio-commons",
3
- "version": "2.4.1",
3
+ "version": "2.4.2-rc.0",
4
4
  "description": "Split JavaScript SDK common components",
5
5
  "main": "cjs/index.js",
6
6
  "module": "esm/index.js",
@@ -48,6 +48,7 @@ export function sdkClientFactory(params: ISdkFactoryContext, isSharedClient?: bo
48
48
 
49
49
  // Sdk destroy
50
50
  {
51
+ __ctx: params,
51
52
  flush() {
52
53
  // @TODO define cooldown time
53
54
  return __cooldown(__flush, COOLDOWN_TIME_IN_MILLIS);
@@ -107,8 +107,7 @@ export function sdkFactory(params: ISdkFactoryParams): SplitIO.ISDK | SplitIO.IA
107
107
 
108
108
  log.info(NEW_FACTORY);
109
109
 
110
- // @ts-ignore
111
- return objectAssign({
110
+ const factory = objectAssign({
112
111
  // Split evaluation and event tracking engine
113
112
  client: clientMethod,
114
113
 
@@ -126,6 +125,17 @@ export function sdkFactory(params: ISdkFactoryParams): SplitIO.ISDK | SplitIO.IA
126
125
  destroy() {
127
126
  hasInit = false;
128
127
  return Promise.all(Object.keys(clients).map(key => clients[key].destroy())).then(() => { });
129
- }
128
+ },
129
+
130
+ __ctx: ctx
130
131
  }, extraProps && extraProps(ctx), lazyInit ? { init } : init());
132
+
133
+ // append factory to global
134
+ if (typeof window === 'object') { // @ts-ignore
135
+ // eslint-disable-next-line no-undef
136
+ (window.__HARNESS_FME__ = window.__HARNESS_FME__ || []).push(factory);
137
+ }
138
+
139
+ // @ts-ignore
140
+ return factory;
131
141
  }