@amityco/ts-sdk-react-native 7.21.1-28cb8278.0 → 7.21.1-744e59bb.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,8 +4,7 @@
|
|
|
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
|
|
8
|
-
* Automatically unregisters push notifications and clears all cache before disconnecting.
|
|
7
|
+
* Revoke access token for current user and disconnects an {@link Amity.Client} instance from ASC servers
|
|
9
8
|
*
|
|
10
9
|
* @returns a success boolean if disconnected
|
|
11
10
|
*
|
|
@@ -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":"AAMA;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,YAAY,QAAa,QAAQ,OAAO,CAYpD,CAAC"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -10481,21 +10481,6 @@ 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
|
-
|
|
10499
10484
|
/* begin_public_function
|
|
10500
10485
|
id: client.secureLogout
|
|
10501
10486
|
*/
|
|
@@ -10505,8 +10490,7 @@ const unregisterPushNotification = async () => {
|
|
|
10505
10490
|
* const success = await Client.secureLogout()
|
|
10506
10491
|
* ```
|
|
10507
10492
|
*
|
|
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.
|
|
10493
|
+
* Revoke access token for current user and disconnects an {@link Amity.Client} instance from ASC servers
|
|
10510
10494
|
*
|
|
10511
10495
|
* @returns a success boolean if disconnected
|
|
10512
10496
|
*
|
|
@@ -10519,14 +10503,6 @@ const secureLogout = async () => {
|
|
|
10519
10503
|
if (!success) {
|
|
10520
10504
|
throw new Error('Failed to logout');
|
|
10521
10505
|
}
|
|
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
|
-
}
|
|
10530
10506
|
const result = await logout();
|
|
10531
10507
|
return result;
|
|
10532
10508
|
};
|
|
@@ -10733,6 +10709,21 @@ const registerPushNotification = async (deviceToken) => {
|
|
|
10733
10709
|
return status === 'success';
|
|
10734
10710
|
};
|
|
10735
10711
|
|
|
10712
|
+
const unregisterPushNotification = async () => {
|
|
10713
|
+
const client = getActiveClient();
|
|
10714
|
+
const deviceId = await getDeviceId();
|
|
10715
|
+
const { data: { status, error }, } = await client.http.delete('/v1/notification', {
|
|
10716
|
+
params: {
|
|
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
|
+
|
|
10736
10727
|
/**
|
|
10737
10728
|
* @deprecated This function will to be deprecated and use the new getLinkPreviewMetadata
|
|
10738
10729
|
*/
|
package/dist/index.esm.js
CHANGED
|
@@ -26554,21 +26554,6 @@ 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
|
-
|
|
26572
26557
|
/* begin_public_function
|
|
26573
26558
|
id: client.secureLogout
|
|
26574
26559
|
*/
|
|
@@ -26578,8 +26563,7 @@ const unregisterPushNotification = async () => {
|
|
|
26578
26563
|
* const success = await Client.secureLogout()
|
|
26579
26564
|
* ```
|
|
26580
26565
|
*
|
|
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.
|
|
26566
|
+
* Revoke access token for current user and disconnects an {@link Amity.Client} instance from ASC servers
|
|
26583
26567
|
*
|
|
26584
26568
|
* @returns a success boolean if disconnected
|
|
26585
26569
|
*
|
|
@@ -26592,14 +26576,6 @@ const secureLogout = async () => {
|
|
|
26592
26576
|
if (!success) {
|
|
26593
26577
|
throw new Error('Failed to logout');
|
|
26594
26578
|
}
|
|
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
|
-
}
|
|
26603
26579
|
const result = await logout();
|
|
26604
26580
|
return result;
|
|
26605
26581
|
};
|
|
@@ -26806,6 +26782,21 @@ const registerPushNotification = async (deviceToken) => {
|
|
|
26806
26782
|
return status === 'success';
|
|
26807
26783
|
};
|
|
26808
26784
|
|
|
26785
|
+
const unregisterPushNotification = async () => {
|
|
26786
|
+
const client = getActiveClient();
|
|
26787
|
+
const deviceId = await getDeviceId();
|
|
26788
|
+
const { data: { status, error }, } = await client.http.delete('/v1/notification', {
|
|
26789
|
+
params: {
|
|
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
|
+
|
|
26809
26800
|
/**
|
|
26810
26801
|
* @deprecated This function will to be deprecated and use the new getLinkPreviewMetadata
|
|
26811
26802
|
*/
|