@imtbl/sdk 1.1.0 → 1.1.1-alpha

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/checkout.js CHANGED
@@ -22,6 +22,7 @@ var Detail$1;
22
22
  Detail["PUBLISHABLE_API_KEY"] = "pak";
23
23
  Detail["IDENTITY"] = "uid";
24
24
  Detail["DOMAIN"] = "domain";
25
+ Detail["SDK_VERSION"] = "sdkVersion";
25
26
  })(Detail$1 || (Detail$1 = {}));
26
27
  var Store$1;
27
28
  (function (Store) {
@@ -115,7 +116,7 @@ const getDetail$1 = (key) => {
115
116
  const getAllDetails$1 = () => RUNTIME_DETAILS$1;
116
117
  // Events
117
118
  const getEvents$1 = () => EVENT_STORE$1;
118
- const addEvent$1 = (event) => {
119
+ const addEvent = (event) => {
119
120
  EVENT_STORE$1.push(event);
120
121
  setItem$1(Store$1.EVENTS, EVENT_STORE$1);
121
122
  };
@@ -136,6 +137,8 @@ const flattenProperties$1 = (properties) => {
136
137
  return propertyMap;
137
138
  };
138
139
 
140
+ // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
141
+ const SDK_VERSION$1 = '1.1.1-alpha';
139
142
  let initialised$1 = false;
140
143
  const isInitialised$1 = () => initialised$1;
141
144
  const getReferrer$1 = () => {
@@ -158,14 +161,16 @@ const runtimeHost$1 = () => {
158
161
  return new URL(window.location.href).hostname;
159
162
  };
160
163
  const getRuntimeDetails$1 = () => {
164
+ storeDetail$1(Detail$1.SDK_VERSION, SDK_VERSION$1);
161
165
  if (isNode$1()) {
162
- return { browser: 'nodejs' };
166
+ return { browser: 'nodejs', sdkVersion: SDK_VERSION$1 };
163
167
  }
164
168
  const domain = runtimeHost$1();
165
169
  if (domain) {
166
170
  storeDetail$1(Detail$1.DOMAIN, domain);
167
171
  }
168
172
  return {
173
+ sdkVersion: SDK_VERSION$1,
169
174
  browser: window.navigator.userAgent,
170
175
  domain,
171
176
  tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
@@ -174,7 +179,6 @@ const getRuntimeDetails$1 = () => {
174
179
  };
175
180
  const initialise$2 = async () => {
176
181
  const runtimeDetails = flattenProperties$1(getRuntimeDetails$1());
177
- // Get any existing runtimeId and send it along with the initialise
178
182
  const existingRuntimeId = getDetail$1(Detail$1.RUNTIME_ID);
179
183
  const body = {
180
184
  version: 1,
@@ -214,19 +218,21 @@ function isTestEnvironment$1() {
214
218
  if (typeof process === 'undefined') {
215
219
  return false;
216
220
  }
221
+ // Consider using `ci-info` package for better results, though might fail as not browser safe.
222
+ // Just use process.env.CI for now.
217
223
  return process.env.JEST_WORKER_ID !== undefined;
218
224
  }
219
225
 
220
226
  // Store the event in the event store
221
- const trackFn$1 = (moduleName, eventName, properties) => {
227
+ const trackFn = (moduleName, eventName, properties) => {
222
228
  const event = {
223
229
  event: `${moduleName}.${eventName}`,
224
230
  time: new Date().toISOString(),
225
231
  ...(properties && { properties: flattenProperties$1(properties) }),
226
232
  };
227
- addEvent$1(event);
233
+ addEvent(event);
228
234
  };
229
- const track$1 = errorBoundary$1(trackFn$1);
235
+ const track = errorBoundary$1(trackFn);
230
236
  // Sending events to the server
231
237
  const flushFn$1 = async () => {
232
238
  // Don't flush if not initialised
@@ -272,10 +278,6 @@ const setEnvironmentFn = (env) => {
272
278
  };
273
279
  const setEnvironment = errorBoundary$1(setEnvironmentFn);
274
280
 
275
- track$1('metrics', 'sdk_version', {
276
- version: '1.1.0',
277
- });
278
-
279
281
  var Environment$1;
280
282
  (function (Environment) {
281
283
  Environment["PRODUCTION"] = "production";
@@ -289,7 +291,7 @@ class ImmutableConfiguration {
289
291
  constructor(options) {
290
292
  this.environment = options.environment;
291
293
  setEnvironment(options.environment);
292
- track$1('config', 'created_imtbl_config');
294
+ track('config', 'created_imtbl_config');
293
295
  }
294
296
  }
295
297
 
@@ -16973,6 +16975,7 @@ var Detail;
16973
16975
  Detail["PUBLISHABLE_API_KEY"] = "pak";
16974
16976
  Detail["IDENTITY"] = "uid";
16975
16977
  Detail["DOMAIN"] = "domain";
16978
+ Detail["SDK_VERSION"] = "sdkVersion";
16976
16979
  })(Detail || (Detail = {}));
16977
16980
  var Store;
16978
16981
  (function (Store) {
@@ -17066,10 +17069,6 @@ const getDetail = (key) => {
17066
17069
  const getAllDetails = () => RUNTIME_DETAILS;
17067
17070
  // Events
17068
17071
  const getEvents = () => EVENT_STORE;
17069
- const addEvent = (event) => {
17070
- EVENT_STORE.push(event);
17071
- setItem(Store.EVENTS, EVENT_STORE);
17072
- };
17073
17072
  const removeSentEvents = (numberOfEvents) => {
17074
17073
  EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
17075
17074
  setItem(Store.EVENTS, EVENT_STORE);
@@ -17087,6 +17086,8 @@ const flattenProperties = (properties) => {
17087
17086
  return propertyMap;
17088
17087
  };
17089
17088
 
17089
+ // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
17090
+ const SDK_VERSION = '1.1.1-alpha';
17090
17091
  let initialised = false;
17091
17092
  const isInitialised = () => initialised;
17092
17093
  const getReferrer = () => {
@@ -17109,14 +17110,16 @@ const runtimeHost = () => {
17109
17110
  return new URL(window.location.href).hostname;
17110
17111
  };
17111
17112
  const getRuntimeDetails = () => {
17113
+ storeDetail(Detail.SDK_VERSION, SDK_VERSION);
17112
17114
  if (isNode()) {
17113
- return { browser: 'nodejs' };
17115
+ return { browser: 'nodejs', sdkVersion: SDK_VERSION };
17114
17116
  }
17115
17117
  const domain = runtimeHost();
17116
17118
  if (domain) {
17117
17119
  storeDetail(Detail.DOMAIN, domain);
17118
17120
  }
17119
17121
  return {
17122
+ sdkVersion: SDK_VERSION,
17120
17123
  browser: window.navigator.userAgent,
17121
17124
  domain,
17122
17125
  tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
@@ -17125,7 +17128,6 @@ const getRuntimeDetails = () => {
17125
17128
  };
17126
17129
  const initialise = async () => {
17127
17130
  const runtimeDetails = flattenProperties(getRuntimeDetails());
17128
- // Get any existing runtimeId and send it along with the initialise
17129
17131
  const existingRuntimeId = getDetail(Detail.RUNTIME_ID);
17130
17132
  const body = {
17131
17133
  version: 1,
@@ -17165,19 +17167,10 @@ function isTestEnvironment() {
17165
17167
  if (typeof process === 'undefined') {
17166
17168
  return false;
17167
17169
  }
17170
+ // Consider using `ci-info` package for better results, though might fail as not browser safe.
17171
+ // Just use process.env.CI for now.
17168
17172
  return process.env.JEST_WORKER_ID !== undefined;
17169
17173
  }
17170
-
17171
- // Store the event in the event store
17172
- const trackFn = (moduleName, eventName, properties) => {
17173
- const event = {
17174
- event: `${moduleName}.${eventName}`,
17175
- time: new Date().toISOString(),
17176
- ...(properties && { properties: flattenProperties(properties) }),
17177
- };
17178
- addEvent(event);
17179
- };
17180
- const track = errorBoundary(trackFn);
17181
17174
  // Sending events to the server
17182
17175
  const flushFn = async () => {
17183
17176
  // Don't flush if not initialised
@@ -17218,10 +17211,6 @@ if (!isTestEnvironment()) {
17218
17211
  errorBoundary(flushPoll)();
17219
17212
  }
17220
17213
 
17221
- track('metrics', 'sdk_version', {
17222
- version: '1.1.0',
17223
- });
17224
-
17225
17214
  var Environment;
17226
17215
  (function (Environment) {
17227
17216
  Environment["PRODUCTION"] = "production";
@@ -26863,7 +26852,7 @@ class APIError extends Error {
26863
26852
 
26864
26853
  /* eslint-disable implicit-arrow-linebreak */
26865
26854
  const defaultHeaders = {
26866
- sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.1.0',
26855
+ sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.1.1-alpha',
26867
26856
  };
26868
26857
  /**
26869
26858
  * createAPIConfiguration to create a custom Configuration
@@ -28225,7 +28214,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
28225
28214
  maxPriorityFeePerGas: BigNumber$1.from(10e9),
28226
28215
  };
28227
28216
 
28228
- const SDK_VERSION_MARKER = '1.1.0';
28217
+ const SDK_VERSION_MARKER = '1.1.1-alpha';
28229
28218
  // This SDK version is replaced by the `yarn build` command ran on the root level
28230
28219
  const globalPackageVersion = () => SDK_VERSION_MARKER;
28231
28220
 
@@ -31911,6 +31900,7 @@ class Checkout {
31911
31900
  this.readOnlyProviders = new Map();
31912
31901
  this.availability = availabilityService(this.config.isDevelopment, this.config.isProduction);
31913
31902
  this.passport = config.passport;
31903
+ track('checkout_sdk', 'initialised');
31914
31904
  }
31915
31905
  /**
31916
31906
  * Loads the widgets bundle and initiate the widgets factory.
package/dist/config.js CHANGED
@@ -11,6 +11,7 @@ var Detail;
11
11
  Detail["PUBLISHABLE_API_KEY"] = "pak";
12
12
  Detail["IDENTITY"] = "uid";
13
13
  Detail["DOMAIN"] = "domain";
14
+ Detail["SDK_VERSION"] = "sdkVersion";
14
15
  })(Detail || (Detail = {}));
15
16
  var Store;
16
17
  (function (Store) {
@@ -125,6 +126,8 @@ const flattenProperties = (properties) => {
125
126
  return propertyMap;
126
127
  };
127
128
 
129
+ // WARNING: DO NOT CHANGE THE STRING BELOW. IT GETS REPLACED AT BUILD TIME.
130
+ const SDK_VERSION = '1.1.1-alpha';
128
131
  let initialised = false;
129
132
  const isInitialised = () => initialised;
130
133
  const getReferrer = () => {
@@ -147,14 +150,16 @@ const runtimeHost = () => {
147
150
  return new URL(window.location.href).hostname;
148
151
  };
149
152
  const getRuntimeDetails = () => {
153
+ storeDetail(Detail.SDK_VERSION, SDK_VERSION);
150
154
  if (isNode()) {
151
- return { browser: 'nodejs' };
155
+ return { browser: 'nodejs', sdkVersion: SDK_VERSION };
152
156
  }
153
157
  const domain = runtimeHost();
154
158
  if (domain) {
155
159
  storeDetail(Detail.DOMAIN, domain);
156
160
  }
157
161
  return {
162
+ sdkVersion: SDK_VERSION,
158
163
  browser: window.navigator.userAgent,
159
164
  domain,
160
165
  tz: Intl.DateTimeFormat().resolvedOptions().timeZone,
@@ -163,7 +168,6 @@ const getRuntimeDetails = () => {
163
168
  };
164
169
  const initialise = async () => {
165
170
  const runtimeDetails = flattenProperties(getRuntimeDetails());
166
- // Get any existing runtimeId and send it along with the initialise
167
171
  const existingRuntimeId = getDetail(Detail.RUNTIME_ID);
168
172
  const body = {
169
173
  version: 1,
@@ -203,6 +207,8 @@ function isTestEnvironment() {
203
207
  if (typeof process === 'undefined') {
204
208
  return false;
205
209
  }
210
+ // Consider using `ci-info` package for better results, though might fail as not browser safe.
211
+ // Just use process.env.CI for now.
206
212
  return process.env.JEST_WORKER_ID !== undefined;
207
213
  }
208
214
 
@@ -265,10 +271,6 @@ const setPublishableApiKeyFn = (publishableApiKey) => {
265
271
  };
266
272
  const setPublishableApiKey = errorBoundary(setPublishableApiKeyFn);
267
273
 
268
- track('metrics', 'sdk_version', {
269
- version: '1.1.0',
270
- });
271
-
272
274
  var Environment;
273
275
  (function (Environment) {
274
276
  Environment["PRODUCTION"] = "production";