@amityco/ts-sdk-react-native 7.21.0 → 7.21.1-28cb8278.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.
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
* const success = await Client.secureLogout()
|
|
5
5
|
* ```
|
|
6
6
|
*
|
|
7
|
-
* Revoke access token for current user and disconnects an {@link Amity.Client} instance from ASC servers
|
|
7
|
+
* Revoke access token for current user and disconnects an {@link Amity.Client} instance from ASC servers.
|
|
8
|
+
* Automatically unregisters push notifications and clears all cache before disconnecting.
|
|
8
9
|
*
|
|
9
10
|
* @returns a success boolean if disconnected
|
|
10
11
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"secureLogout.d.ts","sourceRoot":"","sources":["../../../src/client/api/secureLogout.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"secureLogout.d.ts","sourceRoot":"","sources":["../../../src/client/api/secureLogout.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,YAAY,QAAa,QAAQ,OAAO,CAoBpD,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -10481,6 +10481,21 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
10481
10481
|
return client;
|
|
10482
10482
|
};
|
|
10483
10483
|
|
|
10484
|
+
const unregisterPushNotification = async () => {
|
|
10485
|
+
const client = getActiveClient();
|
|
10486
|
+
const deviceId = await getDeviceId();
|
|
10487
|
+
const { data: { status, error }, } = await client.http.delete('/v1/notification', {
|
|
10488
|
+
params: {
|
|
10489
|
+
deviceId,
|
|
10490
|
+
},
|
|
10491
|
+
headers: { 'X-API-Key': client.apiKey },
|
|
10492
|
+
});
|
|
10493
|
+
if (error) {
|
|
10494
|
+
throw new ASCApiError(error, 500000 /* Amity.ServerError.BUSINESS_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
10495
|
+
}
|
|
10496
|
+
return status === 'success';
|
|
10497
|
+
};
|
|
10498
|
+
|
|
10484
10499
|
/* begin_public_function
|
|
10485
10500
|
id: client.secureLogout
|
|
10486
10501
|
*/
|
|
@@ -10490,7 +10505,8 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
10490
10505
|
* const success = await Client.secureLogout()
|
|
10491
10506
|
* ```
|
|
10492
10507
|
*
|
|
10493
|
-
* Revoke access token for current user and disconnects an {@link Amity.Client} instance from ASC servers
|
|
10508
|
+
* Revoke access token for current user and disconnects an {@link Amity.Client} instance from ASC servers.
|
|
10509
|
+
* Automatically unregisters push notifications and clears all cache before disconnecting.
|
|
10494
10510
|
*
|
|
10495
10511
|
* @returns a success boolean if disconnected
|
|
10496
10512
|
*
|
|
@@ -10503,6 +10519,14 @@ const secureLogout = async () => {
|
|
|
10503
10519
|
if (!success) {
|
|
10504
10520
|
throw new Error('Failed to logout');
|
|
10505
10521
|
}
|
|
10522
|
+
// Unregister push notification before clearing the session.
|
|
10523
|
+
// logout() clears cache, disconnects MQTT and emitter — so this must run first.
|
|
10524
|
+
try {
|
|
10525
|
+
await unregisterPushNotification();
|
|
10526
|
+
}
|
|
10527
|
+
catch (e) {
|
|
10528
|
+
client.log('client/api/secureLogout: failed to unregister push notification', e);
|
|
10529
|
+
}
|
|
10506
10530
|
const result = await logout();
|
|
10507
10531
|
return result;
|
|
10508
10532
|
};
|
|
@@ -10709,21 +10733,6 @@ const registerPushNotification = async (deviceToken) => {
|
|
|
10709
10733
|
return status === 'success';
|
|
10710
10734
|
};
|
|
10711
10735
|
|
|
10712
|
-
const unregisterPushNotification = async () => {
|
|
10713
|
-
const client = getActiveClient();
|
|
10714
|
-
const deviceId = getDeviceId();
|
|
10715
|
-
const { data: { status, error }, } = await client.http.delete('/v1/notification', {
|
|
10716
|
-
data: {
|
|
10717
|
-
deviceId,
|
|
10718
|
-
},
|
|
10719
|
-
headers: { 'X-API-Key': client.apiKey },
|
|
10720
|
-
});
|
|
10721
|
-
if (error) {
|
|
10722
|
-
throw new ASCApiError(error, 500000 /* Amity.ServerError.BUSINESS_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
10723
|
-
}
|
|
10724
|
-
return status === 'success';
|
|
10725
|
-
};
|
|
10726
|
-
|
|
10727
10736
|
/**
|
|
10728
10737
|
* @deprecated This function will to be deprecated and use the new getLinkPreviewMetadata
|
|
10729
10738
|
*/
|
|
@@ -13393,7 +13402,7 @@ const getWatchSessionStorage = () => {
|
|
|
13393
13402
|
return storageInstance;
|
|
13394
13403
|
};
|
|
13395
13404
|
|
|
13396
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
13405
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDAARz+hmBgi8pJ\nQb8LeY41gtHhk+ACMwRfhsn7GqpqRQNG2qU0755mzZuVDUqjQMGSo8THJB7O+OJs\nflbZRkFXlFoFOVNw1UpNOgwEQZ6wB9oRwzepTJAfF1sVhm/o/ixvXh1zDFNDy6yZ\npXyiiJHUVxqyjllZhxnwdvjoVtDs6hW6awG09bB9nh/TTejlUKXoAgzqVwu/1QMu\nUVViET495elEe19aUarEy+oL2iKeXCEvqda/pWNBdbieFyJvvZ08HN8dPuT88wq2\njZLEAth1vrwQ2IAa4ktaLcBQdLJgIkrbDvAiVZ8lQAjS/bq5vXQikTGvoPlC5bbn\nvuOM/3eLAgMBAAECggEAVZ+peHAghq2QVj71nX5lxsNCKaCyYwixSJBpfouTt7Rz\nE6PpzMOXFi1W1o+I22jDakuSM2SOQKqI/u0QefB0r0O/KVk5NrZHXk0mkrdYtxOp\nUgaGyf8UvmjB+8VqHrNKyZdk9qtmbnNj01kTTcAtmE4H39zPR7eR/8Rul94vaZbs\nwCnKJS3mLT3JxyGug6lxanveKkjG+CKC1nJQYWaxCJxaFSzbwXQPvDhB+TvrIbee\npd5v4EAyEJohpr+T9oDGGJkb/KARBZCtwLyB976PKJwwBA8MRVL1i5QwawuMiMq5\nUtnOnbGKtCeFzaLbNU0Qi8bqyims84EQxC6DOu1fkQKBgQDdvsoBsEhsOXV7hlIJ\naEd0eSJZVkdqimxH8uGoMM2FeNaOrcB6yBXqTSP0R3OIyf8eaY6yjRvP30ZNXcll\n/gD3O1Mu6YmWQdt1W2WA6pKOsUuPXasf0pdOF7IiFZKlSabz5YHXFqwVuqm8loaj\nsXel3YWqPVdHiankE7tz+3ssnQKBgQDdqi4TNdD1MdEpihx19jr0QjUiXW3939FK\nqp30HESPEGDGQzXdmJgif9HhZb+cJSuWaHEbjgBrYahvgCF+y6LbEpOD+D/dmT+s\nDEAQaR84sah6dokwPjV8fjBSrcVFjCS+doxv0d3p/9OUEeyUhFrY03nxtIEYkLIE\n/Zvn37b4RwKBgQCLENVFe9XfsaVhQ5r9dV2iyTlmh7qgMZG5CbTFs12hQGhm8McO\n+Z7s41YSJCFr/yq1WwP4LJDtrBw99vyQr1zRsG35tNLp3gGRNzGQSQyC2uQFVHw2\np+7mNewsfhUK/gbrXNsyFnDz6635rPlhfbII3sWuP2wWXFqkxE9CbMwR7QKBgQC6\nawDMzxmo2/iYArrkyevSuEuPVxvFwpF1RgAI6C0QVCnPE38dmdN4UB7mfHekje4W\nVEercMURidPp0cxZolCYBQtilUjAyL0vqC3In1/Ogjq6oy3FEMxSop1pKxMY5j+Q\nnoqFD+6deLUrddeNH7J3X4LSr4dSbX4JjG+tlgt+yQKBgQCuwTL4hA6KqeInQ0Ta\n9VQX5Qr8hFlqJz1gpymi/k63tW/Ob8yedbg3WWNWyShwRMFYyY9S81ITFWM95uL6\nvF3x9rmRjwElJw9PMwVu6dmf/CO0Z1wzXSp2VVD12gbrUD/0/d7MUoJ9LgC8X8f/\nn0txLHYGHbx+nf95+JUg6lV3hg==\n-----END PRIVATE KEY-----";
|
|
13397
13406
|
/*
|
|
13398
13407
|
* The crypto algorithm used for importing key and signing string
|
|
13399
13408
|
*/
|
package/dist/index.esm.js
CHANGED
|
@@ -26554,6 +26554,21 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
26554
26554
|
return client;
|
|
26555
26555
|
};
|
|
26556
26556
|
|
|
26557
|
+
const unregisterPushNotification = async () => {
|
|
26558
|
+
const client = getActiveClient();
|
|
26559
|
+
const deviceId = await getDeviceId();
|
|
26560
|
+
const { data: { status, error }, } = await client.http.delete('/v1/notification', {
|
|
26561
|
+
params: {
|
|
26562
|
+
deviceId,
|
|
26563
|
+
},
|
|
26564
|
+
headers: { 'X-API-Key': client.apiKey },
|
|
26565
|
+
});
|
|
26566
|
+
if (error) {
|
|
26567
|
+
throw new ASCApiError(error, 500000 /* Amity.ServerError.BUSINESS_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
26568
|
+
}
|
|
26569
|
+
return status === 'success';
|
|
26570
|
+
};
|
|
26571
|
+
|
|
26557
26572
|
/* begin_public_function
|
|
26558
26573
|
id: client.secureLogout
|
|
26559
26574
|
*/
|
|
@@ -26563,7 +26578,8 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
26563
26578
|
* const success = await Client.secureLogout()
|
|
26564
26579
|
* ```
|
|
26565
26580
|
*
|
|
26566
|
-
* Revoke access token for current user and disconnects an {@link Amity.Client} instance from ASC servers
|
|
26581
|
+
* Revoke access token for current user and disconnects an {@link Amity.Client} instance from ASC servers.
|
|
26582
|
+
* Automatically unregisters push notifications and clears all cache before disconnecting.
|
|
26567
26583
|
*
|
|
26568
26584
|
* @returns a success boolean if disconnected
|
|
26569
26585
|
*
|
|
@@ -26576,6 +26592,14 @@ const secureLogout = async () => {
|
|
|
26576
26592
|
if (!success) {
|
|
26577
26593
|
throw new Error('Failed to logout');
|
|
26578
26594
|
}
|
|
26595
|
+
// Unregister push notification before clearing the session.
|
|
26596
|
+
// logout() clears cache, disconnects MQTT and emitter — so this must run first.
|
|
26597
|
+
try {
|
|
26598
|
+
await unregisterPushNotification();
|
|
26599
|
+
}
|
|
26600
|
+
catch (e) {
|
|
26601
|
+
client.log('client/api/secureLogout: failed to unregister push notification', e);
|
|
26602
|
+
}
|
|
26579
26603
|
const result = await logout();
|
|
26580
26604
|
return result;
|
|
26581
26605
|
};
|
|
@@ -26782,21 +26806,6 @@ const registerPushNotification = async (deviceToken) => {
|
|
|
26782
26806
|
return status === 'success';
|
|
26783
26807
|
};
|
|
26784
26808
|
|
|
26785
|
-
const unregisterPushNotification = async () => {
|
|
26786
|
-
const client = getActiveClient();
|
|
26787
|
-
const deviceId = getDeviceId();
|
|
26788
|
-
const { data: { status, error }, } = await client.http.delete('/v1/notification', {
|
|
26789
|
-
data: {
|
|
26790
|
-
deviceId,
|
|
26791
|
-
},
|
|
26792
|
-
headers: { 'X-API-Key': client.apiKey },
|
|
26793
|
-
});
|
|
26794
|
-
if (error) {
|
|
26795
|
-
throw new ASCApiError(error, 500000 /* Amity.ServerError.BUSINESS_ERROR */, "error" /* Amity.ErrorLevel.ERROR */);
|
|
26796
|
-
}
|
|
26797
|
-
return status === 'success';
|
|
26798
|
-
};
|
|
26799
|
-
|
|
26800
26809
|
/**
|
|
26801
26810
|
* @deprecated This function will to be deprecated and use the new getLinkPreviewMetadata
|
|
26802
26811
|
*/
|
|
@@ -29466,7 +29475,7 @@ const getWatchSessionStorage = () => {
|
|
|
29466
29475
|
return storageInstance;
|
|
29467
29476
|
};
|
|
29468
29477
|
|
|
29469
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
29478
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDAARz+hmBgi8pJ\nQb8LeY41gtHhk+ACMwRfhsn7GqpqRQNG2qU0755mzZuVDUqjQMGSo8THJB7O+OJs\nflbZRkFXlFoFOVNw1UpNOgwEQZ6wB9oRwzepTJAfF1sVhm/o/ixvXh1zDFNDy6yZ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fbII3sWuP2wWXFqkxE9CbMwR7QKBgQC6\nawDMzxmo2/iYArrkyevSuEuPVxvFwpF1RgAI6C0QVCnPE38dmdN4UB7mfHekje4W\nVEercMURidPp0cxZolCYBQtilUjAyL0vqC3In1/Ogjq6oy3FEMxSop1pKxMY5j+Q\nnoqFD+6deLUrddeNH7J3X4LSr4dSbX4JjG+tlgt+yQKBgQCuwTL4hA6KqeInQ0Ta\n9VQX5Qr8hFlqJz1gpymi/k63tW/Ob8yedbg3WWNWyShwRMFYyY9S81ITFWM95uL6\nvF3x9rmRjwElJw9PMwVu6dmf/CO0Z1wzXSp2VVD12gbrUD/0/d7MUoJ9LgC8X8f/\nn0txLHYGHbx+nf95+JUg6lV3hg==\n-----END PRIVATE KEY-----";
|
|
29470
29479
|
/*
|
|
29471
29480
|
* The crypto algorithm used for importing key and signing string
|
|
29472
29481
|
*/
|