@connectedxm/client 0.5.23 → 0.5.25
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/index.d.mts +75 -63
- package/dist/index.d.ts +75 -63
- package/dist/index.js +18 -36
- package/dist/index.mjs +18 -36
- package/package.json +7 -4
package/dist/index.js
CHANGED
|
@@ -818,8 +818,7 @@ var useConnectedXM = () => {
|
|
|
818
818
|
// src/hooks/useIsAccountFollowing.ts
|
|
819
819
|
var useIsAccountFollowing = (accountId) => {
|
|
820
820
|
const { data: relationships } = useGetSelfRelationships();
|
|
821
|
-
if (!accountId)
|
|
822
|
-
return false;
|
|
821
|
+
if (!accountId) return false;
|
|
823
822
|
if (!isUUID(accountId)) {
|
|
824
823
|
throw new Error("Invalid accountId. Did you pass in the username?");
|
|
825
824
|
}
|
|
@@ -829,8 +828,7 @@ var useIsAccountFollowing = (accountId) => {
|
|
|
829
828
|
// src/hooks/useGroupStatus.ts
|
|
830
829
|
var useGroupStatus = (groupId) => {
|
|
831
830
|
const { data: relationships } = useGetSelfRelationships();
|
|
832
|
-
if (!groupId)
|
|
833
|
-
return false;
|
|
831
|
+
if (!groupId) return false;
|
|
834
832
|
if (!isUUID(groupId)) {
|
|
835
833
|
throw new Error("Invalid groupId. Did you pass in the slug?");
|
|
836
834
|
}
|
|
@@ -840,8 +838,7 @@ var useGroupStatus = (groupId) => {
|
|
|
840
838
|
// src/hooks/useIsEventRegistered.ts
|
|
841
839
|
var useIsEventRegistered = (eventId) => {
|
|
842
840
|
const { data: relationships } = useGetSelfRelationships();
|
|
843
|
-
if (!eventId)
|
|
844
|
-
return false;
|
|
841
|
+
if (!eventId) return false;
|
|
845
842
|
if (!isUUID(eventId)) {
|
|
846
843
|
throw new Error("Invalid eventId. Did you pass in the slug?");
|
|
847
844
|
}
|
|
@@ -851,8 +848,7 @@ var useIsEventRegistered = (eventId) => {
|
|
|
851
848
|
// src/hooks/useIsChannelSubscribed.ts
|
|
852
849
|
var useIsChannelSubscribed = (channelId) => {
|
|
853
850
|
const { data: relationships } = useGetSelfRelationships();
|
|
854
|
-
if (!channelId)
|
|
855
|
-
return false;
|
|
851
|
+
if (!channelId) return false;
|
|
856
852
|
if (!isUUID(channelId)) {
|
|
857
853
|
throw new Error("Invalid channelId. Did you pass in the slug?");
|
|
858
854
|
}
|
|
@@ -1242,22 +1238,18 @@ var useConnectedSingleQuery = (queryKeys, queryFn, options = {}) => {
|
|
|
1242
1238
|
// 60 Seconds
|
|
1243
1239
|
retry: (failureCount, error) => {
|
|
1244
1240
|
if (error.response?.status === 404) {
|
|
1245
|
-
if (onNotFound)
|
|
1246
|
-
onNotFound(error, queryKeys, options.shouldRedirect || false);
|
|
1241
|
+
if (onNotFound) onNotFound(error, queryKeys, options.shouldRedirect || false);
|
|
1247
1242
|
return false;
|
|
1248
1243
|
}
|
|
1249
1244
|
if (error.response?.status === 403 || error.response?.status === 453) {
|
|
1250
|
-
if (onModuleForbidden)
|
|
1251
|
-
onModuleForbidden(error, queryKeys, options.shouldRedirect || false);
|
|
1245
|
+
if (onModuleForbidden) onModuleForbidden(error, queryKeys, options.shouldRedirect || false);
|
|
1252
1246
|
return false;
|
|
1253
1247
|
}
|
|
1254
1248
|
if (error.response?.status === 401) {
|
|
1255
|
-
if (onNotAuthorized)
|
|
1256
|
-
onNotAuthorized(error, queryKeys, options.shouldRedirect || false);
|
|
1249
|
+
if (onNotAuthorized) onNotAuthorized(error, queryKeys, options.shouldRedirect || false);
|
|
1257
1250
|
return false;
|
|
1258
1251
|
}
|
|
1259
|
-
if (failureCount < 3)
|
|
1260
|
-
return true;
|
|
1252
|
+
if (failureCount < 3) return true;
|
|
1261
1253
|
return false;
|
|
1262
1254
|
},
|
|
1263
1255
|
...options,
|
|
@@ -1364,8 +1356,7 @@ var setFirstPageData = (response) => {
|
|
|
1364
1356
|
var useConnectedInfiniteQuery = (queryKeys, queryFn, params = {}, options = {
|
|
1365
1357
|
shouldRedirect: false
|
|
1366
1358
|
}) => {
|
|
1367
|
-
if (typeof params.pageSize === "undefined")
|
|
1368
|
-
params.pageSize = 10;
|
|
1359
|
+
if (typeof params.pageSize === "undefined") params.pageSize = 10;
|
|
1369
1360
|
const {
|
|
1370
1361
|
locale,
|
|
1371
1362
|
onModuleForbidden,
|
|
@@ -1388,22 +1379,18 @@ var useConnectedInfiniteQuery = (queryKeys, queryFn, params = {}, options = {
|
|
|
1388
1379
|
// 60 Seconds
|
|
1389
1380
|
retry: (failureCount, error) => {
|
|
1390
1381
|
if (error.response?.status === 404) {
|
|
1391
|
-
if (onNotFound)
|
|
1392
|
-
onNotFound(error, queryKeys, options.shouldRedirect || false);
|
|
1382
|
+
if (onNotFound) onNotFound(error, queryKeys, options.shouldRedirect || false);
|
|
1393
1383
|
return false;
|
|
1394
1384
|
}
|
|
1395
1385
|
if (error.response?.status === 403 || error.response?.status === 453) {
|
|
1396
|
-
if (onModuleForbidden)
|
|
1397
|
-
onModuleForbidden(error, queryKeys, options.shouldRedirect || false);
|
|
1386
|
+
if (onModuleForbidden) onModuleForbidden(error, queryKeys, options.shouldRedirect || false);
|
|
1398
1387
|
return false;
|
|
1399
1388
|
}
|
|
1400
1389
|
if (error.response?.status === 401) {
|
|
1401
|
-
if (onNotAuthorized)
|
|
1402
|
-
onNotAuthorized(error, queryKeys, options.shouldRedirect || false);
|
|
1390
|
+
if (onNotAuthorized) onNotAuthorized(error, queryKeys, options.shouldRedirect || false);
|
|
1403
1391
|
return false;
|
|
1404
1392
|
}
|
|
1405
|
-
if (failureCount < 3)
|
|
1406
|
-
return true;
|
|
1393
|
+
if (failureCount < 3) return true;
|
|
1407
1394
|
return false;
|
|
1408
1395
|
},
|
|
1409
1396
|
...options,
|
|
@@ -1754,8 +1741,7 @@ var useGetAccountByShareCode = (shareCode = "", options = {}) => {
|
|
|
1754
1741
|
// src/queries/groups/useGetGroups.ts
|
|
1755
1742
|
var GROUPS_QUERY_KEY = (access) => {
|
|
1756
1743
|
const keys = ["GROUPS"];
|
|
1757
|
-
if (access)
|
|
1758
|
-
keys.push(access);
|
|
1744
|
+
if (access) keys.push(access);
|
|
1759
1745
|
return keys;
|
|
1760
1746
|
};
|
|
1761
1747
|
var SET_GROUPS_QUERY_DATA = (client, keyParams, response, baseKeys = ["en"]) => {
|
|
@@ -4166,8 +4152,7 @@ var useGetOrganizationPaymentIntegration = (options = {}) => {
|
|
|
4166
4152
|
// src/queries/self/useGetSelf.ts
|
|
4167
4153
|
var SELF_QUERY_KEY = (ignoreExecuteAs) => {
|
|
4168
4154
|
const keys = ["SELF"];
|
|
4169
|
-
if (ignoreExecuteAs)
|
|
4170
|
-
keys.push("IGNORE_EXECUTEAS");
|
|
4155
|
+
if (ignoreExecuteAs) keys.push("IGNORE_EXECUTEAS");
|
|
4171
4156
|
return keys;
|
|
4172
4157
|
};
|
|
4173
4158
|
var SET_SELF_QUERY_DATA = (client, keyParams, response, baseKeys = ["en"]) => {
|
|
@@ -5540,8 +5525,7 @@ var useGetSelfPushDevice = (pushDeviceId, options = {}) => {
|
|
|
5540
5525
|
// src/queries/self/useGetSelfRecommendations.ts
|
|
5541
5526
|
var SELF_RECOMMENDATIONS_QUERY_KEY = (type, eventId) => {
|
|
5542
5527
|
const keys = [...SELF_QUERY_KEY(), "RECOMMENDATIONS", type];
|
|
5543
|
-
if (typeof eventId !== "undefined")
|
|
5544
|
-
keys.push(eventId);
|
|
5528
|
+
if (typeof eventId !== "undefined") keys.push(eventId);
|
|
5545
5529
|
return keys;
|
|
5546
5530
|
};
|
|
5547
5531
|
var GetSelfRecommendations = async ({
|
|
@@ -6524,10 +6508,8 @@ var useConnectedMutation = (mutation, options) => {
|
|
|
6524
6508
|
}),
|
|
6525
6509
|
...options,
|
|
6526
6510
|
onError: (error, variables, context) => {
|
|
6527
|
-
if (onMutationError)
|
|
6528
|
-
|
|
6529
|
-
if (options?.onError)
|
|
6530
|
-
options.onError(error, variables, context);
|
|
6511
|
+
if (onMutationError) onMutationError(error, variables, context);
|
|
6512
|
+
if (options?.onError) options.onError(error, variables, context);
|
|
6531
6513
|
}
|
|
6532
6514
|
});
|
|
6533
6515
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -71,8 +71,7 @@ var useConnectedXM = () => {
|
|
|
71
71
|
// src/hooks/useIsAccountFollowing.ts
|
|
72
72
|
var useIsAccountFollowing = (accountId) => {
|
|
73
73
|
const { data: relationships } = useGetSelfRelationships();
|
|
74
|
-
if (!accountId)
|
|
75
|
-
return false;
|
|
74
|
+
if (!accountId) return false;
|
|
76
75
|
if (!isUUID(accountId)) {
|
|
77
76
|
throw new Error("Invalid accountId. Did you pass in the username?");
|
|
78
77
|
}
|
|
@@ -82,8 +81,7 @@ var useIsAccountFollowing = (accountId) => {
|
|
|
82
81
|
// src/hooks/useGroupStatus.ts
|
|
83
82
|
var useGroupStatus = (groupId) => {
|
|
84
83
|
const { data: relationships } = useGetSelfRelationships();
|
|
85
|
-
if (!groupId)
|
|
86
|
-
return false;
|
|
84
|
+
if (!groupId) return false;
|
|
87
85
|
if (!isUUID(groupId)) {
|
|
88
86
|
throw new Error("Invalid groupId. Did you pass in the slug?");
|
|
89
87
|
}
|
|
@@ -93,8 +91,7 @@ var useGroupStatus = (groupId) => {
|
|
|
93
91
|
// src/hooks/useIsEventRegistered.ts
|
|
94
92
|
var useIsEventRegistered = (eventId) => {
|
|
95
93
|
const { data: relationships } = useGetSelfRelationships();
|
|
96
|
-
if (!eventId)
|
|
97
|
-
return false;
|
|
94
|
+
if (!eventId) return false;
|
|
98
95
|
if (!isUUID(eventId)) {
|
|
99
96
|
throw new Error("Invalid eventId. Did you pass in the slug?");
|
|
100
97
|
}
|
|
@@ -104,8 +101,7 @@ var useIsEventRegistered = (eventId) => {
|
|
|
104
101
|
// src/hooks/useIsChannelSubscribed.ts
|
|
105
102
|
var useIsChannelSubscribed = (channelId) => {
|
|
106
103
|
const { data: relationships } = useGetSelfRelationships();
|
|
107
|
-
if (!channelId)
|
|
108
|
-
return false;
|
|
104
|
+
if (!channelId) return false;
|
|
109
105
|
if (!isUUID(channelId)) {
|
|
110
106
|
throw new Error("Invalid channelId. Did you pass in the slug?");
|
|
111
107
|
}
|
|
@@ -495,22 +491,18 @@ var useConnectedSingleQuery = (queryKeys, queryFn, options = {}) => {
|
|
|
495
491
|
// 60 Seconds
|
|
496
492
|
retry: (failureCount, error) => {
|
|
497
493
|
if (error.response?.status === 404) {
|
|
498
|
-
if (onNotFound)
|
|
499
|
-
onNotFound(error, queryKeys, options.shouldRedirect || false);
|
|
494
|
+
if (onNotFound) onNotFound(error, queryKeys, options.shouldRedirect || false);
|
|
500
495
|
return false;
|
|
501
496
|
}
|
|
502
497
|
if (error.response?.status === 403 || error.response?.status === 453) {
|
|
503
|
-
if (onModuleForbidden)
|
|
504
|
-
onModuleForbidden(error, queryKeys, options.shouldRedirect || false);
|
|
498
|
+
if (onModuleForbidden) onModuleForbidden(error, queryKeys, options.shouldRedirect || false);
|
|
505
499
|
return false;
|
|
506
500
|
}
|
|
507
501
|
if (error.response?.status === 401) {
|
|
508
|
-
if (onNotAuthorized)
|
|
509
|
-
onNotAuthorized(error, queryKeys, options.shouldRedirect || false);
|
|
502
|
+
if (onNotAuthorized) onNotAuthorized(error, queryKeys, options.shouldRedirect || false);
|
|
510
503
|
return false;
|
|
511
504
|
}
|
|
512
|
-
if (failureCount < 3)
|
|
513
|
-
return true;
|
|
505
|
+
if (failureCount < 3) return true;
|
|
514
506
|
return false;
|
|
515
507
|
},
|
|
516
508
|
...options,
|
|
@@ -619,8 +611,7 @@ var setFirstPageData = (response) => {
|
|
|
619
611
|
var useConnectedInfiniteQuery = (queryKeys, queryFn, params = {}, options = {
|
|
620
612
|
shouldRedirect: false
|
|
621
613
|
}) => {
|
|
622
|
-
if (typeof params.pageSize === "undefined")
|
|
623
|
-
params.pageSize = 10;
|
|
614
|
+
if (typeof params.pageSize === "undefined") params.pageSize = 10;
|
|
624
615
|
const {
|
|
625
616
|
locale,
|
|
626
617
|
onModuleForbidden,
|
|
@@ -643,22 +634,18 @@ var useConnectedInfiniteQuery = (queryKeys, queryFn, params = {}, options = {
|
|
|
643
634
|
// 60 Seconds
|
|
644
635
|
retry: (failureCount, error) => {
|
|
645
636
|
if (error.response?.status === 404) {
|
|
646
|
-
if (onNotFound)
|
|
647
|
-
onNotFound(error, queryKeys, options.shouldRedirect || false);
|
|
637
|
+
if (onNotFound) onNotFound(error, queryKeys, options.shouldRedirect || false);
|
|
648
638
|
return false;
|
|
649
639
|
}
|
|
650
640
|
if (error.response?.status === 403 || error.response?.status === 453) {
|
|
651
|
-
if (onModuleForbidden)
|
|
652
|
-
onModuleForbidden(error, queryKeys, options.shouldRedirect || false);
|
|
641
|
+
if (onModuleForbidden) onModuleForbidden(error, queryKeys, options.shouldRedirect || false);
|
|
653
642
|
return false;
|
|
654
643
|
}
|
|
655
644
|
if (error.response?.status === 401) {
|
|
656
|
-
if (onNotAuthorized)
|
|
657
|
-
onNotAuthorized(error, queryKeys, options.shouldRedirect || false);
|
|
645
|
+
if (onNotAuthorized) onNotAuthorized(error, queryKeys, options.shouldRedirect || false);
|
|
658
646
|
return false;
|
|
659
647
|
}
|
|
660
|
-
if (failureCount < 3)
|
|
661
|
-
return true;
|
|
648
|
+
if (failureCount < 3) return true;
|
|
662
649
|
return false;
|
|
663
650
|
},
|
|
664
651
|
...options,
|
|
@@ -1009,8 +996,7 @@ var useGetAccountByShareCode = (shareCode = "", options = {}) => {
|
|
|
1009
996
|
// src/queries/groups/useGetGroups.ts
|
|
1010
997
|
var GROUPS_QUERY_KEY = (access) => {
|
|
1011
998
|
const keys = ["GROUPS"];
|
|
1012
|
-
if (access)
|
|
1013
|
-
keys.push(access);
|
|
999
|
+
if (access) keys.push(access);
|
|
1014
1000
|
return keys;
|
|
1015
1001
|
};
|
|
1016
1002
|
var SET_GROUPS_QUERY_DATA = (client, keyParams, response, baseKeys = ["en"]) => {
|
|
@@ -3421,8 +3407,7 @@ var useGetOrganizationPaymentIntegration = (options = {}) => {
|
|
|
3421
3407
|
// src/queries/self/useGetSelf.ts
|
|
3422
3408
|
var SELF_QUERY_KEY = (ignoreExecuteAs) => {
|
|
3423
3409
|
const keys = ["SELF"];
|
|
3424
|
-
if (ignoreExecuteAs)
|
|
3425
|
-
keys.push("IGNORE_EXECUTEAS");
|
|
3410
|
+
if (ignoreExecuteAs) keys.push("IGNORE_EXECUTEAS");
|
|
3426
3411
|
return keys;
|
|
3427
3412
|
};
|
|
3428
3413
|
var SET_SELF_QUERY_DATA = (client, keyParams, response, baseKeys = ["en"]) => {
|
|
@@ -4795,8 +4780,7 @@ var useGetSelfPushDevice = (pushDeviceId, options = {}) => {
|
|
|
4795
4780
|
// src/queries/self/useGetSelfRecommendations.ts
|
|
4796
4781
|
var SELF_RECOMMENDATIONS_QUERY_KEY = (type, eventId) => {
|
|
4797
4782
|
const keys = [...SELF_QUERY_KEY(), "RECOMMENDATIONS", type];
|
|
4798
|
-
if (typeof eventId !== "undefined")
|
|
4799
|
-
keys.push(eventId);
|
|
4783
|
+
if (typeof eventId !== "undefined") keys.push(eventId);
|
|
4800
4784
|
return keys;
|
|
4801
4785
|
};
|
|
4802
4786
|
var GetSelfRecommendations = async ({
|
|
@@ -5782,10 +5766,8 @@ var useConnectedMutation = (mutation, options) => {
|
|
|
5782
5766
|
}),
|
|
5783
5767
|
...options,
|
|
5784
5768
|
onError: (error, variables, context) => {
|
|
5785
|
-
if (onMutationError)
|
|
5786
|
-
|
|
5787
|
-
if (options?.onError)
|
|
5788
|
-
options.onError(error, variables, context);
|
|
5769
|
+
if (onMutationError) onMutationError(error, variables, context);
|
|
5770
|
+
if (options?.onError) options.onError(error, variables, context);
|
|
5789
5771
|
}
|
|
5790
5772
|
});
|
|
5791
5773
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@connectedxm/client",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.25",
|
|
4
4
|
"description": "Client API javascript SDK",
|
|
5
5
|
"author": "ConnectedXM Inc.",
|
|
6
6
|
"repository": {
|
|
@@ -14,11 +14,11 @@
|
|
|
14
14
|
"types": "dist/index.d.ts",
|
|
15
15
|
"scripts": {
|
|
16
16
|
"dev": "vitest",
|
|
17
|
-
"lint": "
|
|
17
|
+
"lint": "npx tsc && eslint src/**/*.ts",
|
|
18
18
|
"test": "vitest run",
|
|
19
19
|
"build": "tsup src/index.ts --format cjs,esm --dts",
|
|
20
|
-
"release": "
|
|
21
|
-
"local": "
|
|
20
|
+
"release": "npm run lint && npm run test && npm run build",
|
|
21
|
+
"local": "npm run release && npm pack"
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"axios": "^1.6.5",
|
|
@@ -41,5 +41,8 @@
|
|
|
41
41
|
"tsup": "^8.0.1",
|
|
42
42
|
"typescript": "^5.4.2",
|
|
43
43
|
"vitest": "^1.3.1"
|
|
44
|
+
},
|
|
45
|
+
"optionalDependencies": {
|
|
46
|
+
"@rollup/rollup-linux-x64-gnu": "4.9.5"
|
|
44
47
|
}
|
|
45
48
|
}
|