@amityco/ts-sdk-react-native 7.21.1-3f070be.0 → 7.21.1-89754953.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,CAmBpD,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
|
*
|
|
@@ -10499,12 +10515,18 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
10499
10515
|
*/
|
|
10500
10516
|
const secureLogout = async () => {
|
|
10501
10517
|
const client = getActiveClient();
|
|
10518
|
+
// Unregister push notification before clearing the session.
|
|
10519
|
+
try {
|
|
10520
|
+
await unregisterPushNotification();
|
|
10521
|
+
}
|
|
10522
|
+
catch (e) {
|
|
10523
|
+
client.log('client/api/secureLogout: failed to unregister push notification', e);
|
|
10524
|
+
}
|
|
10502
10525
|
const { data: { success }, } = await client.http.delete('/api/v4/sessions');
|
|
10503
10526
|
if (!success) {
|
|
10504
10527
|
throw new Error('Failed to logout');
|
|
10505
10528
|
}
|
|
10506
|
-
|
|
10507
|
-
return result;
|
|
10529
|
+
return logout();
|
|
10508
10530
|
};
|
|
10509
10531
|
/* end_public_function */
|
|
10510
10532
|
|
|
@@ -10709,21 +10731,6 @@ const registerPushNotification = async (deviceToken) => {
|
|
|
10709
10731
|
return status === 'success';
|
|
10710
10732
|
};
|
|
10711
10733
|
|
|
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
10734
|
/**
|
|
10728
10735
|
* @deprecated This function will to be deprecated and use the new getLinkPreviewMetadata
|
|
10729
10736
|
*/
|
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
|
*
|
|
@@ -26572,12 +26588,18 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
26572
26588
|
*/
|
|
26573
26589
|
const secureLogout = async () => {
|
|
26574
26590
|
const client = getActiveClient();
|
|
26591
|
+
// Unregister push notification before clearing the session.
|
|
26592
|
+
try {
|
|
26593
|
+
await unregisterPushNotification();
|
|
26594
|
+
}
|
|
26595
|
+
catch (e) {
|
|
26596
|
+
client.log('client/api/secureLogout: failed to unregister push notification', e);
|
|
26597
|
+
}
|
|
26575
26598
|
const { data: { success }, } = await client.http.delete('/api/v4/sessions');
|
|
26576
26599
|
if (!success) {
|
|
26577
26600
|
throw new Error('Failed to logout');
|
|
26578
26601
|
}
|
|
26579
|
-
|
|
26580
|
-
return result;
|
|
26602
|
+
return logout();
|
|
26581
26603
|
};
|
|
26582
26604
|
/* end_public_function */
|
|
26583
26605
|
|
|
@@ -26782,21 +26804,6 @@ const registerPushNotification = async (deviceToken) => {
|
|
|
26782
26804
|
return status === 'success';
|
|
26783
26805
|
};
|
|
26784
26806
|
|
|
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
26807
|
/**
|
|
26801
26808
|
* @deprecated This function will to be deprecated and use the new getLinkPreviewMetadata
|
|
26802
26809
|
*/
|