@imtbl/sdk 0.45.5 → 1.0.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.
- package/dist/blockchain_data.js +24 -2
- package/dist/browser/checkout/sdk.js +6 -6
- package/dist/browser/checkout/widgets.js +61 -61
- package/dist/checkout.js +38 -9
- package/dist/config.js +9 -2
- package/dist/index.browser.js +12 -12
- package/dist/index.browser.js.map +1 -1
- package/dist/index.cjs +74 -12
- package/dist/index.js +74 -12
- package/dist/orderbook.js +23 -1
- package/dist/passport.js +59 -4
- package/dist/x.js +24 -2
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -150,7 +150,7 @@ const getDetail$1 = (key) => {
|
|
|
150
150
|
const getAllDetails$1 = () => RUNTIME_DETAILS$1;
|
|
151
151
|
// Events
|
|
152
152
|
const getEvents$1 = () => EVENT_STORE$1;
|
|
153
|
-
const addEvent = (event) => {
|
|
153
|
+
const addEvent$1 = (event) => {
|
|
154
154
|
EVENT_STORE$1.push(event);
|
|
155
155
|
setItem$1(Store$1.EVENTS, EVENT_STORE$1);
|
|
156
156
|
};
|
|
@@ -161,7 +161,10 @@ const removeSentEvents$1 = (numberOfEvents) => {
|
|
|
161
161
|
const flattenProperties$1 = (properties) => {
|
|
162
162
|
const propertyMap = [];
|
|
163
163
|
Object.entries(properties).forEach(([key, value]) => {
|
|
164
|
-
if (typeof
|
|
164
|
+
if (typeof key === 'string'
|
|
165
|
+
|| typeof value === 'string'
|
|
166
|
+
|| typeof value === 'number'
|
|
167
|
+
|| typeof value === 'boolean') {
|
|
165
168
|
propertyMap.push([key, value.toString()]);
|
|
166
169
|
}
|
|
167
170
|
});
|
|
@@ -250,15 +253,15 @@ function isTestEnvironment$1() {
|
|
|
250
253
|
}
|
|
251
254
|
|
|
252
255
|
// Store the event in the event store
|
|
253
|
-
const trackFn = (moduleName, eventName, properties) => {
|
|
256
|
+
const trackFn$1 = (moduleName, eventName, properties) => {
|
|
254
257
|
const event = {
|
|
255
258
|
event: `${moduleName}.${eventName}`,
|
|
256
259
|
time: new Date().toISOString(),
|
|
257
260
|
...(properties && { properties: flattenProperties$1(properties) }),
|
|
258
261
|
};
|
|
259
|
-
addEvent(event);
|
|
262
|
+
addEvent$1(event);
|
|
260
263
|
};
|
|
261
|
-
const track = errorBoundary$1(trackFn);
|
|
264
|
+
const track$1 = errorBoundary$1(trackFn$1);
|
|
262
265
|
// Sending events to the server
|
|
263
266
|
const flushFn$1 = async () => {
|
|
264
267
|
// Don't flush if not initialised
|
|
@@ -299,15 +302,44 @@ if (!isTestEnvironment$1()) {
|
|
|
299
302
|
errorBoundary$1(flushPoll$1)();
|
|
300
303
|
}
|
|
301
304
|
|
|
305
|
+
const parseIdentity = (params) => {
|
|
306
|
+
if (params.passportId) {
|
|
307
|
+
const key = `passport:${params.passportId.toLowerCase()}`;
|
|
308
|
+
return key;
|
|
309
|
+
}
|
|
310
|
+
if (params.ethAddress) {
|
|
311
|
+
const key = `ethAddress:${params.ethAddress.toLowerCase()}`;
|
|
312
|
+
return key;
|
|
313
|
+
}
|
|
314
|
+
throw new Error('invalid_identity');
|
|
315
|
+
};
|
|
316
|
+
const identifyFn = (params) => {
|
|
317
|
+
const identity = parseIdentity(params);
|
|
318
|
+
if (!identity) {
|
|
319
|
+
return;
|
|
320
|
+
}
|
|
321
|
+
storeDetail$1(Detail$1.IDENTITY, identity);
|
|
322
|
+
track$1('metrics', 'identify', params.traits);
|
|
323
|
+
};
|
|
324
|
+
const identify = errorBoundary$1(identifyFn);
|
|
325
|
+
|
|
302
326
|
const setEnvironmentFn = (env) => {
|
|
303
327
|
storeDetail$1(Detail$1.ENVIRONMENT, env);
|
|
304
328
|
};
|
|
305
329
|
const setEnvironment = errorBoundary$1(setEnvironmentFn);
|
|
330
|
+
const setPassportClientIdFn = (passportClientId) => {
|
|
331
|
+
storeDetail$1(Detail$1.PASSPORT_CLIENT_ID, passportClientId);
|
|
332
|
+
};
|
|
333
|
+
const setPassportClientId = errorBoundary$1(setPassportClientIdFn);
|
|
306
334
|
const setPublishableApiKeyFn = (publishableApiKey) => {
|
|
307
335
|
storeDetail$1(Detail$1.PUBLISHABLE_API_KEY, publishableApiKey);
|
|
308
336
|
};
|
|
309
337
|
const setPublishableApiKey = errorBoundary$1(setPublishableApiKeyFn);
|
|
310
338
|
|
|
339
|
+
track$1('metrics', 'sdk_version', {
|
|
340
|
+
version: '1.0.0',
|
|
341
|
+
});
|
|
342
|
+
|
|
311
343
|
var Environment$1;
|
|
312
344
|
(function (Environment) {
|
|
313
345
|
Environment["PRODUCTION"] = "production";
|
|
@@ -321,7 +353,7 @@ class ImmutableConfiguration {
|
|
|
321
353
|
constructor(options) {
|
|
322
354
|
this.environment = options.environment;
|
|
323
355
|
setEnvironment(options.environment);
|
|
324
|
-
track('config', '
|
|
356
|
+
track$1('config', 'created_imtbl_config');
|
|
325
357
|
}
|
|
326
358
|
}
|
|
327
359
|
const API_KEY_PREFIX = 'sk_imapik-';
|
|
@@ -10906,7 +10938,7 @@ class MultiRollupApiClients {
|
|
|
10906
10938
|
}
|
|
10907
10939
|
|
|
10908
10940
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10909
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
10941
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.0.0' };
|
|
10910
10942
|
const createConfig = ({ basePath, headers, }) => {
|
|
10911
10943
|
if (!basePath.trim()) {
|
|
10912
10944
|
throw Error('basePath can not be empty');
|
|
@@ -10978,7 +11010,7 @@ class APIError extends Error {
|
|
|
10978
11010
|
|
|
10979
11011
|
/* eslint-disable implicit-arrow-linebreak */
|
|
10980
11012
|
const defaultHeaders = {
|
|
10981
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
11013
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.0.0',
|
|
10982
11014
|
};
|
|
10983
11015
|
/**
|
|
10984
11016
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -11417,7 +11449,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
11417
11449
|
chainID,
|
|
11418
11450
|
coreContractAddress,
|
|
11419
11451
|
registrationContractAddress,
|
|
11420
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
11452
|
+
sdkVersion: 'ts-immutable-sdk-1.0.0',
|
|
11421
11453
|
});
|
|
11422
11454
|
/**
|
|
11423
11455
|
* Sets `sdkVersion` at the time of build
|
|
@@ -18158,7 +18190,8 @@ class Passport {
|
|
|
18158
18190
|
this.multiRollupApiClients = new MultiRollupApiClients(this.config.multiRollupConfig);
|
|
18159
18191
|
this.passportEventEmitter = new TypedEventEmitter();
|
|
18160
18192
|
const imxClientConfig = this.config.baseConfig.environment === Environment$1.PRODUCTION
|
|
18161
|
-
? imxApiConfig.getProduction()
|
|
18193
|
+
? imxApiConfig.getProduction()
|
|
18194
|
+
: imxApiConfig.getSandbox();
|
|
18162
18195
|
const imxApiClients = passportModuleConfiguration.overrides?.imxApiClients
|
|
18163
18196
|
|| new ImxApiClients(imxClientConfig);
|
|
18164
18197
|
this.passportImxProviderFactory = new PassportImxProviderFactory({
|
|
@@ -18170,6 +18203,8 @@ class Passport {
|
|
|
18170
18203
|
passportEventEmitter: this.passportEventEmitter,
|
|
18171
18204
|
imxApiClients,
|
|
18172
18205
|
});
|
|
18206
|
+
setPassportClientId(passportModuleConfiguration.clientId);
|
|
18207
|
+
track$1('passport', 'initialised');
|
|
18173
18208
|
}
|
|
18174
18209
|
/**
|
|
18175
18210
|
* @deprecated The method `login` with an argument of `{ useCachedSession: true }` should be used in conjunction with
|
|
@@ -18215,6 +18250,11 @@ class Passport {
|
|
|
18215
18250
|
if (!user && !useCachedSession) {
|
|
18216
18251
|
user = await this.authManager.login();
|
|
18217
18252
|
}
|
|
18253
|
+
if (user) {
|
|
18254
|
+
identify({
|
|
18255
|
+
passportId: user.profile.sub,
|
|
18256
|
+
});
|
|
18257
|
+
}
|
|
18218
18258
|
return user ? user.profile : null;
|
|
18219
18259
|
}
|
|
18220
18260
|
async loginCallback() {
|
|
@@ -36675,6 +36715,10 @@ const getDetail = (key) => {
|
|
|
36675
36715
|
const getAllDetails = () => RUNTIME_DETAILS;
|
|
36676
36716
|
// Events
|
|
36677
36717
|
const getEvents = () => EVENT_STORE;
|
|
36718
|
+
const addEvent = (event) => {
|
|
36719
|
+
EVENT_STORE.push(event);
|
|
36720
|
+
setItem(Store.EVENTS, EVENT_STORE);
|
|
36721
|
+
};
|
|
36678
36722
|
const removeSentEvents = (numberOfEvents) => {
|
|
36679
36723
|
EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
|
|
36680
36724
|
setItem(Store.EVENTS, EVENT_STORE);
|
|
@@ -36682,7 +36726,10 @@ const removeSentEvents = (numberOfEvents) => {
|
|
|
36682
36726
|
const flattenProperties = (properties) => {
|
|
36683
36727
|
const propertyMap = [];
|
|
36684
36728
|
Object.entries(properties).forEach(([key, value]) => {
|
|
36685
|
-
if (typeof
|
|
36729
|
+
if (typeof key === 'string'
|
|
36730
|
+
|| typeof value === 'string'
|
|
36731
|
+
|| typeof value === 'number'
|
|
36732
|
+
|| typeof value === 'boolean') {
|
|
36686
36733
|
propertyMap.push([key, value.toString()]);
|
|
36687
36734
|
}
|
|
36688
36735
|
});
|
|
@@ -36769,6 +36816,17 @@ function isTestEnvironment() {
|
|
|
36769
36816
|
}
|
|
36770
36817
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
36771
36818
|
}
|
|
36819
|
+
|
|
36820
|
+
// Store the event in the event store
|
|
36821
|
+
const trackFn = (moduleName, eventName, properties) => {
|
|
36822
|
+
const event = {
|
|
36823
|
+
event: `${moduleName}.${eventName}`,
|
|
36824
|
+
time: new Date().toISOString(),
|
|
36825
|
+
...(properties && { properties: flattenProperties(properties) }),
|
|
36826
|
+
};
|
|
36827
|
+
addEvent(event);
|
|
36828
|
+
};
|
|
36829
|
+
const track = errorBoundary(trackFn);
|
|
36772
36830
|
// Sending events to the server
|
|
36773
36831
|
const flushFn = async () => {
|
|
36774
36832
|
// Don't flush if not initialised
|
|
@@ -36809,6 +36867,10 @@ if (!isTestEnvironment()) {
|
|
|
36809
36867
|
errorBoundary(flushPoll)();
|
|
36810
36868
|
}
|
|
36811
36869
|
|
|
36870
|
+
track('metrics', 'sdk_version', {
|
|
36871
|
+
version: '1.0.0',
|
|
36872
|
+
});
|
|
36873
|
+
|
|
36812
36874
|
var Environment;
|
|
36813
36875
|
(function (Environment) {
|
|
36814
36876
|
Environment["PRODUCTION"] = "production";
|
|
@@ -41788,7 +41850,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
41788
41850
|
maxPriorityFeePerGas: ethers.BigNumber.from(10e9),
|
|
41789
41851
|
};
|
|
41790
41852
|
|
|
41791
|
-
const SDK_VERSION_MARKER = '0.
|
|
41853
|
+
const SDK_VERSION_MARKER = '1.0.0';
|
|
41792
41854
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
41793
41855
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
41794
41856
|
|
package/dist/index.js
CHANGED
|
@@ -128,7 +128,7 @@ const getDetail$1 = (key) => {
|
|
|
128
128
|
const getAllDetails$1 = () => RUNTIME_DETAILS$1;
|
|
129
129
|
// Events
|
|
130
130
|
const getEvents$1 = () => EVENT_STORE$1;
|
|
131
|
-
const addEvent = (event) => {
|
|
131
|
+
const addEvent$1 = (event) => {
|
|
132
132
|
EVENT_STORE$1.push(event);
|
|
133
133
|
setItem$1(Store$1.EVENTS, EVENT_STORE$1);
|
|
134
134
|
};
|
|
@@ -139,7 +139,10 @@ const removeSentEvents$1 = (numberOfEvents) => {
|
|
|
139
139
|
const flattenProperties$1 = (properties) => {
|
|
140
140
|
const propertyMap = [];
|
|
141
141
|
Object.entries(properties).forEach(([key, value]) => {
|
|
142
|
-
if (typeof
|
|
142
|
+
if (typeof key === 'string'
|
|
143
|
+
|| typeof value === 'string'
|
|
144
|
+
|| typeof value === 'number'
|
|
145
|
+
|| typeof value === 'boolean') {
|
|
143
146
|
propertyMap.push([key, value.toString()]);
|
|
144
147
|
}
|
|
145
148
|
});
|
|
@@ -228,15 +231,15 @@ function isTestEnvironment$1() {
|
|
|
228
231
|
}
|
|
229
232
|
|
|
230
233
|
// Store the event in the event store
|
|
231
|
-
const trackFn = (moduleName, eventName, properties) => {
|
|
234
|
+
const trackFn$1 = (moduleName, eventName, properties) => {
|
|
232
235
|
const event = {
|
|
233
236
|
event: `${moduleName}.${eventName}`,
|
|
234
237
|
time: new Date().toISOString(),
|
|
235
238
|
...(properties && { properties: flattenProperties$1(properties) }),
|
|
236
239
|
};
|
|
237
|
-
addEvent(event);
|
|
240
|
+
addEvent$1(event);
|
|
238
241
|
};
|
|
239
|
-
const track = errorBoundary$1(trackFn);
|
|
242
|
+
const track$1 = errorBoundary$1(trackFn$1);
|
|
240
243
|
// Sending events to the server
|
|
241
244
|
const flushFn$1 = async () => {
|
|
242
245
|
// Don't flush if not initialised
|
|
@@ -277,15 +280,44 @@ if (!isTestEnvironment$1()) {
|
|
|
277
280
|
errorBoundary$1(flushPoll$1)();
|
|
278
281
|
}
|
|
279
282
|
|
|
283
|
+
const parseIdentity = (params) => {
|
|
284
|
+
if (params.passportId) {
|
|
285
|
+
const key = `passport:${params.passportId.toLowerCase()}`;
|
|
286
|
+
return key;
|
|
287
|
+
}
|
|
288
|
+
if (params.ethAddress) {
|
|
289
|
+
const key = `ethAddress:${params.ethAddress.toLowerCase()}`;
|
|
290
|
+
return key;
|
|
291
|
+
}
|
|
292
|
+
throw new Error('invalid_identity');
|
|
293
|
+
};
|
|
294
|
+
const identifyFn = (params) => {
|
|
295
|
+
const identity = parseIdentity(params);
|
|
296
|
+
if (!identity) {
|
|
297
|
+
return;
|
|
298
|
+
}
|
|
299
|
+
storeDetail$1(Detail$1.IDENTITY, identity);
|
|
300
|
+
track$1('metrics', 'identify', params.traits);
|
|
301
|
+
};
|
|
302
|
+
const identify = errorBoundary$1(identifyFn);
|
|
303
|
+
|
|
280
304
|
const setEnvironmentFn = (env) => {
|
|
281
305
|
storeDetail$1(Detail$1.ENVIRONMENT, env);
|
|
282
306
|
};
|
|
283
307
|
const setEnvironment = errorBoundary$1(setEnvironmentFn);
|
|
308
|
+
const setPassportClientIdFn = (passportClientId) => {
|
|
309
|
+
storeDetail$1(Detail$1.PASSPORT_CLIENT_ID, passportClientId);
|
|
310
|
+
};
|
|
311
|
+
const setPassportClientId = errorBoundary$1(setPassportClientIdFn);
|
|
284
312
|
const setPublishableApiKeyFn = (publishableApiKey) => {
|
|
285
313
|
storeDetail$1(Detail$1.PUBLISHABLE_API_KEY, publishableApiKey);
|
|
286
314
|
};
|
|
287
315
|
const setPublishableApiKey = errorBoundary$1(setPublishableApiKeyFn);
|
|
288
316
|
|
|
317
|
+
track$1('metrics', 'sdk_version', {
|
|
318
|
+
version: '1.0.0',
|
|
319
|
+
});
|
|
320
|
+
|
|
289
321
|
var Environment$1;
|
|
290
322
|
(function (Environment) {
|
|
291
323
|
Environment["PRODUCTION"] = "production";
|
|
@@ -299,7 +331,7 @@ class ImmutableConfiguration {
|
|
|
299
331
|
constructor(options) {
|
|
300
332
|
this.environment = options.environment;
|
|
301
333
|
setEnvironment(options.environment);
|
|
302
|
-
track('config', '
|
|
334
|
+
track$1('config', 'created_imtbl_config');
|
|
303
335
|
}
|
|
304
336
|
}
|
|
305
337
|
const API_KEY_PREFIX = 'sk_imapik-';
|
|
@@ -10884,7 +10916,7 @@ class MultiRollupApiClients {
|
|
|
10884
10916
|
}
|
|
10885
10917
|
|
|
10886
10918
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
10887
|
-
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
10919
|
+
const defaultHeaders$1 = { 'x-sdk-version': 'ts-immutable-sdk-1.0.0' };
|
|
10888
10920
|
const createConfig = ({ basePath, headers, }) => {
|
|
10889
10921
|
if (!basePath.trim()) {
|
|
10890
10922
|
throw Error('basePath can not be empty');
|
|
@@ -10956,7 +10988,7 @@ class APIError extends Error {
|
|
|
10956
10988
|
|
|
10957
10989
|
/* eslint-disable implicit-arrow-linebreak */
|
|
10958
10990
|
const defaultHeaders = {
|
|
10959
|
-
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-0.
|
|
10991
|
+
sdkVersion: 'ts-immutable-sdk-multi-rollup-api-client-1.0.0',
|
|
10960
10992
|
};
|
|
10961
10993
|
/**
|
|
10962
10994
|
* createAPIConfiguration to create a custom Configuration
|
|
@@ -11395,7 +11427,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
11395
11427
|
chainID,
|
|
11396
11428
|
coreContractAddress,
|
|
11397
11429
|
registrationContractAddress,
|
|
11398
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
11430
|
+
sdkVersion: 'ts-immutable-sdk-1.0.0',
|
|
11399
11431
|
});
|
|
11400
11432
|
/**
|
|
11401
11433
|
* Sets `sdkVersion` at the time of build
|
|
@@ -18136,7 +18168,8 @@ class Passport {
|
|
|
18136
18168
|
this.multiRollupApiClients = new MultiRollupApiClients(this.config.multiRollupConfig);
|
|
18137
18169
|
this.passportEventEmitter = new TypedEventEmitter();
|
|
18138
18170
|
const imxClientConfig = this.config.baseConfig.environment === Environment$1.PRODUCTION
|
|
18139
|
-
? imxApiConfig.getProduction()
|
|
18171
|
+
? imxApiConfig.getProduction()
|
|
18172
|
+
: imxApiConfig.getSandbox();
|
|
18140
18173
|
const imxApiClients = passportModuleConfiguration.overrides?.imxApiClients
|
|
18141
18174
|
|| new ImxApiClients(imxClientConfig);
|
|
18142
18175
|
this.passportImxProviderFactory = new PassportImxProviderFactory({
|
|
@@ -18148,6 +18181,8 @@ class Passport {
|
|
|
18148
18181
|
passportEventEmitter: this.passportEventEmitter,
|
|
18149
18182
|
imxApiClients,
|
|
18150
18183
|
});
|
|
18184
|
+
setPassportClientId(passportModuleConfiguration.clientId);
|
|
18185
|
+
track$1('passport', 'initialised');
|
|
18151
18186
|
}
|
|
18152
18187
|
/**
|
|
18153
18188
|
* @deprecated The method `login` with an argument of `{ useCachedSession: true }` should be used in conjunction with
|
|
@@ -18193,6 +18228,11 @@ class Passport {
|
|
|
18193
18228
|
if (!user && !useCachedSession) {
|
|
18194
18229
|
user = await this.authManager.login();
|
|
18195
18230
|
}
|
|
18231
|
+
if (user) {
|
|
18232
|
+
identify({
|
|
18233
|
+
passportId: user.profile.sub,
|
|
18234
|
+
});
|
|
18235
|
+
}
|
|
18196
18236
|
return user ? user.profile : null;
|
|
18197
18237
|
}
|
|
18198
18238
|
async loginCallback() {
|
|
@@ -36653,6 +36693,10 @@ const getDetail = (key) => {
|
|
|
36653
36693
|
const getAllDetails = () => RUNTIME_DETAILS;
|
|
36654
36694
|
// Events
|
|
36655
36695
|
const getEvents = () => EVENT_STORE;
|
|
36696
|
+
const addEvent = (event) => {
|
|
36697
|
+
EVENT_STORE.push(event);
|
|
36698
|
+
setItem(Store.EVENTS, EVENT_STORE);
|
|
36699
|
+
};
|
|
36656
36700
|
const removeSentEvents = (numberOfEvents) => {
|
|
36657
36701
|
EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
|
|
36658
36702
|
setItem(Store.EVENTS, EVENT_STORE);
|
|
@@ -36660,7 +36704,10 @@ const removeSentEvents = (numberOfEvents) => {
|
|
|
36660
36704
|
const flattenProperties = (properties) => {
|
|
36661
36705
|
const propertyMap = [];
|
|
36662
36706
|
Object.entries(properties).forEach(([key, value]) => {
|
|
36663
|
-
if (typeof
|
|
36707
|
+
if (typeof key === 'string'
|
|
36708
|
+
|| typeof value === 'string'
|
|
36709
|
+
|| typeof value === 'number'
|
|
36710
|
+
|| typeof value === 'boolean') {
|
|
36664
36711
|
propertyMap.push([key, value.toString()]);
|
|
36665
36712
|
}
|
|
36666
36713
|
});
|
|
@@ -36747,6 +36794,17 @@ function isTestEnvironment() {
|
|
|
36747
36794
|
}
|
|
36748
36795
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
36749
36796
|
}
|
|
36797
|
+
|
|
36798
|
+
// Store the event in the event store
|
|
36799
|
+
const trackFn = (moduleName, eventName, properties) => {
|
|
36800
|
+
const event = {
|
|
36801
|
+
event: `${moduleName}.${eventName}`,
|
|
36802
|
+
time: new Date().toISOString(),
|
|
36803
|
+
...(properties && { properties: flattenProperties(properties) }),
|
|
36804
|
+
};
|
|
36805
|
+
addEvent(event);
|
|
36806
|
+
};
|
|
36807
|
+
const track = errorBoundary(trackFn);
|
|
36750
36808
|
// Sending events to the server
|
|
36751
36809
|
const flushFn = async () => {
|
|
36752
36810
|
// Don't flush if not initialised
|
|
@@ -36787,6 +36845,10 @@ if (!isTestEnvironment()) {
|
|
|
36787
36845
|
errorBoundary(flushPoll)();
|
|
36788
36846
|
}
|
|
36789
36847
|
|
|
36848
|
+
track('metrics', 'sdk_version', {
|
|
36849
|
+
version: '1.0.0',
|
|
36850
|
+
});
|
|
36851
|
+
|
|
36790
36852
|
var Environment;
|
|
36791
36853
|
(function (Environment) {
|
|
36792
36854
|
Environment["PRODUCTION"] = "production";
|
|
@@ -41766,7 +41828,7 @@ const IMMUTABLE_ZKVEM_GAS_OVERRIDES = {
|
|
|
41766
41828
|
maxPriorityFeePerGas: BigNumber$1.from(10e9),
|
|
41767
41829
|
};
|
|
41768
41830
|
|
|
41769
|
-
const SDK_VERSION_MARKER = '0.
|
|
41831
|
+
const SDK_VERSION_MARKER = '1.0.0';
|
|
41770
41832
|
// This SDK version is replaced by the `yarn build` command ran on the root level
|
|
41771
41833
|
const globalPackageVersion = () => SDK_VERSION_MARKER;
|
|
41772
41834
|
|
package/dist/orderbook.js
CHANGED
|
@@ -107,6 +107,10 @@ const getDetail = (key) => {
|
|
|
107
107
|
const getAllDetails = () => RUNTIME_DETAILS;
|
|
108
108
|
// Events
|
|
109
109
|
const getEvents = () => EVENT_STORE;
|
|
110
|
+
const addEvent = (event) => {
|
|
111
|
+
EVENT_STORE.push(event);
|
|
112
|
+
setItem(Store.EVENTS, EVENT_STORE);
|
|
113
|
+
};
|
|
110
114
|
const removeSentEvents = (numberOfEvents) => {
|
|
111
115
|
EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
|
|
112
116
|
setItem(Store.EVENTS, EVENT_STORE);
|
|
@@ -114,7 +118,10 @@ const removeSentEvents = (numberOfEvents) => {
|
|
|
114
118
|
const flattenProperties = (properties) => {
|
|
115
119
|
const propertyMap = [];
|
|
116
120
|
Object.entries(properties).forEach(([key, value]) => {
|
|
117
|
-
if (typeof
|
|
121
|
+
if (typeof key === 'string'
|
|
122
|
+
|| typeof value === 'string'
|
|
123
|
+
|| typeof value === 'number'
|
|
124
|
+
|| typeof value === 'boolean') {
|
|
118
125
|
propertyMap.push([key, value.toString()]);
|
|
119
126
|
}
|
|
120
127
|
});
|
|
@@ -201,6 +208,17 @@ function isTestEnvironment() {
|
|
|
201
208
|
}
|
|
202
209
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
203
210
|
}
|
|
211
|
+
|
|
212
|
+
// Store the event in the event store
|
|
213
|
+
const trackFn = (moduleName, eventName, properties) => {
|
|
214
|
+
const event = {
|
|
215
|
+
event: `${moduleName}.${eventName}`,
|
|
216
|
+
time: new Date().toISOString(),
|
|
217
|
+
...(properties && { properties: flattenProperties(properties) }),
|
|
218
|
+
};
|
|
219
|
+
addEvent(event);
|
|
220
|
+
};
|
|
221
|
+
const track = errorBoundary(trackFn);
|
|
204
222
|
// Sending events to the server
|
|
205
223
|
const flushFn = async () => {
|
|
206
224
|
// Don't flush if not initialised
|
|
@@ -241,6 +259,10 @@ if (!isTestEnvironment()) {
|
|
|
241
259
|
errorBoundary(flushPoll)();
|
|
242
260
|
}
|
|
243
261
|
|
|
262
|
+
track('metrics', 'sdk_version', {
|
|
263
|
+
version: '1.0.0',
|
|
264
|
+
});
|
|
265
|
+
|
|
244
266
|
var Environment;
|
|
245
267
|
(function (Environment) {
|
|
246
268
|
Environment["PRODUCTION"] = "production";
|
package/dist/passport.js
CHANGED
|
@@ -8724,7 +8724,7 @@ class MultiRollupApiClients {
|
|
|
8724
8724
|
}
|
|
8725
8725
|
|
|
8726
8726
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
8727
|
-
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-0.
|
|
8727
|
+
const defaultHeaders = { 'x-sdk-version': 'ts-immutable-sdk-1.0.0' };
|
|
8728
8728
|
const createConfig = ({ basePath, headers, }) => {
|
|
8729
8729
|
if (!basePath.trim()) {
|
|
8730
8730
|
throw Error('basePath can not be empty');
|
|
@@ -8881,6 +8881,10 @@ const getDetail = (key) => {
|
|
|
8881
8881
|
const getAllDetails = () => RUNTIME_DETAILS;
|
|
8882
8882
|
// Events
|
|
8883
8883
|
const getEvents = () => EVENT_STORE;
|
|
8884
|
+
const addEvent = (event) => {
|
|
8885
|
+
EVENT_STORE.push(event);
|
|
8886
|
+
setItem(Store.EVENTS, EVENT_STORE);
|
|
8887
|
+
};
|
|
8884
8888
|
const removeSentEvents = (numberOfEvents) => {
|
|
8885
8889
|
EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
|
|
8886
8890
|
setItem(Store.EVENTS, EVENT_STORE);
|
|
@@ -8888,7 +8892,10 @@ const removeSentEvents = (numberOfEvents) => {
|
|
|
8888
8892
|
const flattenProperties = (properties) => {
|
|
8889
8893
|
const propertyMap = [];
|
|
8890
8894
|
Object.entries(properties).forEach(([key, value]) => {
|
|
8891
|
-
if (typeof
|
|
8895
|
+
if (typeof key === 'string'
|
|
8896
|
+
|| typeof value === 'string'
|
|
8897
|
+
|| typeof value === 'number'
|
|
8898
|
+
|| typeof value === 'boolean') {
|
|
8892
8899
|
propertyMap.push([key, value.toString()]);
|
|
8893
8900
|
}
|
|
8894
8901
|
});
|
|
@@ -8975,6 +8982,17 @@ function isTestEnvironment() {
|
|
|
8975
8982
|
}
|
|
8976
8983
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
8977
8984
|
}
|
|
8985
|
+
|
|
8986
|
+
// Store the event in the event store
|
|
8987
|
+
const trackFn = (moduleName, eventName, properties) => {
|
|
8988
|
+
const event = {
|
|
8989
|
+
event: `${moduleName}.${eventName}`,
|
|
8990
|
+
time: new Date().toISOString(),
|
|
8991
|
+
...(properties && { properties: flattenProperties(properties) }),
|
|
8992
|
+
};
|
|
8993
|
+
addEvent(event);
|
|
8994
|
+
};
|
|
8995
|
+
const track = errorBoundary(trackFn);
|
|
8978
8996
|
// Sending events to the server
|
|
8979
8997
|
const flushFn = async () => {
|
|
8980
8998
|
// Don't flush if not initialised
|
|
@@ -9015,6 +9033,35 @@ if (!isTestEnvironment()) {
|
|
|
9015
9033
|
errorBoundary(flushPoll)();
|
|
9016
9034
|
}
|
|
9017
9035
|
|
|
9036
|
+
const parseIdentity = (params) => {
|
|
9037
|
+
if (params.passportId) {
|
|
9038
|
+
const key = `passport:${params.passportId.toLowerCase()}`;
|
|
9039
|
+
return key;
|
|
9040
|
+
}
|
|
9041
|
+
if (params.ethAddress) {
|
|
9042
|
+
const key = `ethAddress:${params.ethAddress.toLowerCase()}`;
|
|
9043
|
+
return key;
|
|
9044
|
+
}
|
|
9045
|
+
throw new Error('invalid_identity');
|
|
9046
|
+
};
|
|
9047
|
+
const identifyFn = (params) => {
|
|
9048
|
+
const identity = parseIdentity(params);
|
|
9049
|
+
if (!identity) {
|
|
9050
|
+
return;
|
|
9051
|
+
}
|
|
9052
|
+
storeDetail(Detail.IDENTITY, identity);
|
|
9053
|
+
track('metrics', 'identify', params.traits);
|
|
9054
|
+
};
|
|
9055
|
+
const identify = errorBoundary(identifyFn);
|
|
9056
|
+
const setPassportClientIdFn = (passportClientId) => {
|
|
9057
|
+
storeDetail(Detail.PASSPORT_CLIENT_ID, passportClientId);
|
|
9058
|
+
};
|
|
9059
|
+
const setPassportClientId = errorBoundary(setPassportClientIdFn);
|
|
9060
|
+
|
|
9061
|
+
track('metrics', 'sdk_version', {
|
|
9062
|
+
version: '1.0.0',
|
|
9063
|
+
});
|
|
9064
|
+
|
|
9018
9065
|
var Environment;
|
|
9019
9066
|
(function (Environment) {
|
|
9020
9067
|
Environment["PRODUCTION"] = "production";
|
|
@@ -9030,7 +9077,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
9030
9077
|
chainID,
|
|
9031
9078
|
coreContractAddress,
|
|
9032
9079
|
registrationContractAddress,
|
|
9033
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
9080
|
+
sdkVersion: 'ts-immutable-sdk-1.0.0',
|
|
9034
9081
|
});
|
|
9035
9082
|
/**
|
|
9036
9083
|
* Sets `sdkVersion` at the time of build
|
|
@@ -15762,7 +15809,8 @@ class Passport {
|
|
|
15762
15809
|
this.multiRollupApiClients = new MultiRollupApiClients(this.config.multiRollupConfig);
|
|
15763
15810
|
this.passportEventEmitter = new TypedEventEmitter();
|
|
15764
15811
|
const imxClientConfig = this.config.baseConfig.environment === Environment.PRODUCTION
|
|
15765
|
-
? imxApiConfig.getProduction()
|
|
15812
|
+
? imxApiConfig.getProduction()
|
|
15813
|
+
: imxApiConfig.getSandbox();
|
|
15766
15814
|
const imxApiClients = passportModuleConfiguration.overrides?.imxApiClients
|
|
15767
15815
|
|| new ImxApiClients(imxClientConfig);
|
|
15768
15816
|
this.passportImxProviderFactory = new PassportImxProviderFactory({
|
|
@@ -15774,6 +15822,8 @@ class Passport {
|
|
|
15774
15822
|
passportEventEmitter: this.passportEventEmitter,
|
|
15775
15823
|
imxApiClients,
|
|
15776
15824
|
});
|
|
15825
|
+
setPassportClientId(passportModuleConfiguration.clientId);
|
|
15826
|
+
track('passport', 'initialised');
|
|
15777
15827
|
}
|
|
15778
15828
|
/**
|
|
15779
15829
|
* @deprecated The method `login` with an argument of `{ useCachedSession: true }` should be used in conjunction with
|
|
@@ -15819,6 +15869,11 @@ class Passport {
|
|
|
15819
15869
|
if (!user && !useCachedSession) {
|
|
15820
15870
|
user = await this.authManager.login();
|
|
15821
15871
|
}
|
|
15872
|
+
if (user) {
|
|
15873
|
+
identify({
|
|
15874
|
+
passportId: user.profile.sub,
|
|
15875
|
+
});
|
|
15876
|
+
}
|
|
15822
15877
|
return user ? user.profile : null;
|
|
15823
15878
|
}
|
|
15824
15879
|
async loginCallback() {
|
package/dist/x.js
CHANGED
|
@@ -112,6 +112,10 @@ const getDetail = (key) => {
|
|
|
112
112
|
const getAllDetails = () => RUNTIME_DETAILS;
|
|
113
113
|
// Events
|
|
114
114
|
const getEvents = () => EVENT_STORE;
|
|
115
|
+
const addEvent = (event) => {
|
|
116
|
+
EVENT_STORE.push(event);
|
|
117
|
+
setItem(Store.EVENTS, EVENT_STORE);
|
|
118
|
+
};
|
|
115
119
|
const removeSentEvents = (numberOfEvents) => {
|
|
116
120
|
EVENT_STORE = EVENT_STORE.slice(numberOfEvents);
|
|
117
121
|
setItem(Store.EVENTS, EVENT_STORE);
|
|
@@ -119,7 +123,10 @@ const removeSentEvents = (numberOfEvents) => {
|
|
|
119
123
|
const flattenProperties = (properties) => {
|
|
120
124
|
const propertyMap = [];
|
|
121
125
|
Object.entries(properties).forEach(([key, value]) => {
|
|
122
|
-
if (typeof
|
|
126
|
+
if (typeof key === 'string'
|
|
127
|
+
|| typeof value === 'string'
|
|
128
|
+
|| typeof value === 'number'
|
|
129
|
+
|| typeof value === 'boolean') {
|
|
123
130
|
propertyMap.push([key, value.toString()]);
|
|
124
131
|
}
|
|
125
132
|
});
|
|
@@ -206,6 +213,17 @@ function isTestEnvironment() {
|
|
|
206
213
|
}
|
|
207
214
|
return process.env.JEST_WORKER_ID !== undefined;
|
|
208
215
|
}
|
|
216
|
+
|
|
217
|
+
// Store the event in the event store
|
|
218
|
+
const trackFn = (moduleName, eventName, properties) => {
|
|
219
|
+
const event = {
|
|
220
|
+
event: `${moduleName}.${eventName}`,
|
|
221
|
+
time: new Date().toISOString(),
|
|
222
|
+
...(properties && { properties: flattenProperties(properties) }),
|
|
223
|
+
};
|
|
224
|
+
addEvent(event);
|
|
225
|
+
};
|
|
226
|
+
const track = errorBoundary(trackFn);
|
|
209
227
|
// Sending events to the server
|
|
210
228
|
const flushFn = async () => {
|
|
211
229
|
// Don't flush if not initialised
|
|
@@ -246,6 +264,10 @@ if (!isTestEnvironment()) {
|
|
|
246
264
|
errorBoundary(flushPoll)();
|
|
247
265
|
}
|
|
248
266
|
|
|
267
|
+
track('metrics', 'sdk_version', {
|
|
268
|
+
version: '1.0.0',
|
|
269
|
+
});
|
|
270
|
+
|
|
249
271
|
var Environment;
|
|
250
272
|
(function (Environment) {
|
|
251
273
|
Environment["PRODUCTION"] = "production";
|
|
@@ -261,7 +283,7 @@ const createImmutableXConfiguration = ({ basePath, chainID, coreContractAddress,
|
|
|
261
283
|
chainID,
|
|
262
284
|
coreContractAddress,
|
|
263
285
|
registrationContractAddress,
|
|
264
|
-
sdkVersion: 'ts-immutable-sdk-0.
|
|
286
|
+
sdkVersion: 'ts-immutable-sdk-1.0.0',
|
|
265
287
|
});
|
|
266
288
|
/**
|
|
267
289
|
* Sets `sdkVersion` at the time of build
|
package/package.json
CHANGED