@connectedxm/client 0.1.9 → 0.1.24
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 +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +139 -395
- package/dist/index.mjs +139 -395
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -4324,58 +4324,36 @@ var useUnfollowAccount = (options = {}) => {
|
|
|
4324
4324
|
};
|
|
4325
4325
|
|
|
4326
4326
|
// src/mutations/activities/optimistic/UpdateReshares.ts
|
|
4327
|
+
import { produce as produce2 } from "immer";
|
|
4327
4328
|
var UpdateResharesSingle = (increment, queryClient, KEY) => {
|
|
4328
|
-
queryClient.setQueryData(
|
|
4329
|
-
|
|
4330
|
-
|
|
4331
|
-
|
|
4332
|
-
|
|
4333
|
-
|
|
4334
|
-
|
|
4335
|
-
|
|
4336
|
-
|
|
4337
|
-
|
|
4338
|
-
...data._count,
|
|
4339
|
-
reshares: increment ? data._count.reshares + 1 : data._count.reshares - 1
|
|
4340
|
-
},
|
|
4341
|
-
reshares: increment ? [{}] : void 0
|
|
4342
|
-
}
|
|
4343
|
-
};
|
|
4344
|
-
}
|
|
4345
|
-
});
|
|
4329
|
+
queryClient.setQueryData(
|
|
4330
|
+
KEY,
|
|
4331
|
+
(originalData) => produce2(originalData, (draft) => {
|
|
4332
|
+
if (!draft?.data) {
|
|
4333
|
+
return;
|
|
4334
|
+
}
|
|
4335
|
+
draft.data._count.reshares += increment ? 1 : -1;
|
|
4336
|
+
draft.data.reshares = increment ? [{ id: Date.now().toString() }] : [];
|
|
4337
|
+
})
|
|
4338
|
+
);
|
|
4346
4339
|
};
|
|
4347
4340
|
var UpdateResharesInfinite = (increment, queryClient, KEY, activityId) => {
|
|
4348
|
-
queryClient.setQueriesData(
|
|
4349
|
-
|
|
4350
|
-
|
|
4351
|
-
|
|
4352
|
-
|
|
4353
|
-
|
|
4354
|
-
|
|
4355
|
-
|
|
4356
|
-
|
|
4357
|
-
|
|
4358
|
-
|
|
4359
|
-
|
|
4360
|
-
pageIndex = x;
|
|
4361
|
-
activityIndex = y;
|
|
4362
|
-
}
|
|
4363
|
-
if (pages?.[x]?.data?.[y]?.reshared?.id === activityId) {
|
|
4364
|
-
resharePageIndex = x;
|
|
4365
|
-
reshareActivityIndex = y;
|
|
4341
|
+
queryClient.setQueriesData(
|
|
4342
|
+
{ queryKey: KEY, exact: false },
|
|
4343
|
+
(originalData) => produce2(originalData, (draft) => {
|
|
4344
|
+
if (!draft?.pages || draft.pages.length === 0) {
|
|
4345
|
+
return;
|
|
4346
|
+
}
|
|
4347
|
+
for (const page of draft.pages) {
|
|
4348
|
+
for (const activity of page.data) {
|
|
4349
|
+
if (activity.id === activityId) {
|
|
4350
|
+
activity._count.reshares += increment ? 1 : -1;
|
|
4351
|
+
activity.reshares = increment ? [{ id: Date.now().toString() }] : [];
|
|
4352
|
+
}
|
|
4366
4353
|
}
|
|
4367
4354
|
}
|
|
4368
|
-
}
|
|
4369
|
-
|
|
4370
|
-
pages[pageIndex].data[activityIndex]._count.reshares = increment ? pages?.[pageIndex]?.data[activityIndex]._count.reshares + 1 : pages?.[pageIndex]?.data[activityIndex]._count.reshares - 1;
|
|
4371
|
-
pages[pageIndex].data[activityIndex].reshares = increment ? [{}] : void 0;
|
|
4372
|
-
}
|
|
4373
|
-
if (typeof resharePageIndex != "undefined" && typeof reshareActivityIndex != "undefined") {
|
|
4374
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared._count.reshares = increment ? pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.reshares + 1 : pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.reshares - 1;
|
|
4375
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared.reshares = increment ? [{}] : void 0;
|
|
4376
|
-
}
|
|
4377
|
-
return { ...data, pages };
|
|
4378
|
-
});
|
|
4355
|
+
})
|
|
4356
|
+
);
|
|
4379
4357
|
};
|
|
4380
4358
|
|
|
4381
4359
|
// src/mutations/activities/useDeleteReshare.ts
|
|
@@ -4385,7 +4363,10 @@ var DeleteReshare = async ({
|
|
|
4385
4363
|
queryClient
|
|
4386
4364
|
}) => {
|
|
4387
4365
|
if (queryClient) {
|
|
4388
|
-
UpdateResharesSingle(false, queryClient,
|
|
4366
|
+
UpdateResharesSingle(false, queryClient, [
|
|
4367
|
+
...ACTIVITY_QUERY_KEY(activityId),
|
|
4368
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
4369
|
+
]);
|
|
4389
4370
|
UpdateResharesInfinite(
|
|
4390
4371
|
false,
|
|
4391
4372
|
queryClient,
|
|
@@ -4404,58 +4385,36 @@ var useDeleteReshare = (options = {}) => {
|
|
|
4404
4385
|
};
|
|
4405
4386
|
|
|
4406
4387
|
// src/mutations/activities/optimistic/UpdateLikes.ts
|
|
4388
|
+
import { produce as produce3 } from "immer";
|
|
4407
4389
|
var UpdateLikesSingle = (increment, queryClient, KEY) => {
|
|
4408
|
-
queryClient.setQueryData(
|
|
4409
|
-
|
|
4410
|
-
|
|
4411
|
-
|
|
4412
|
-
|
|
4413
|
-
|
|
4414
|
-
|
|
4415
|
-
|
|
4416
|
-
|
|
4417
|
-
|
|
4418
|
-
...data._count,
|
|
4419
|
-
likes: increment ? data._count.likes + 1 : data._count.likes - 1
|
|
4420
|
-
},
|
|
4421
|
-
likes: increment ? [{}] : void 0
|
|
4422
|
-
}
|
|
4423
|
-
};
|
|
4424
|
-
}
|
|
4425
|
-
});
|
|
4390
|
+
queryClient.setQueryData(
|
|
4391
|
+
KEY,
|
|
4392
|
+
(originalData) => produce3(originalData, (draft) => {
|
|
4393
|
+
if (!draft?.data) {
|
|
4394
|
+
return;
|
|
4395
|
+
}
|
|
4396
|
+
draft.data._count.likes += increment ? 1 : -1;
|
|
4397
|
+
draft.data.likes = increment ? [{ createdAt: (/* @__PURE__ */ new Date()).toISOString() }] : [];
|
|
4398
|
+
})
|
|
4399
|
+
);
|
|
4426
4400
|
};
|
|
4427
4401
|
var UpdateLikesInfinite = (increment, queryClient, KEY, activityId) => {
|
|
4428
|
-
queryClient.setQueriesData(
|
|
4429
|
-
|
|
4430
|
-
|
|
4431
|
-
|
|
4432
|
-
|
|
4433
|
-
|
|
4434
|
-
|
|
4435
|
-
|
|
4436
|
-
|
|
4437
|
-
|
|
4438
|
-
|
|
4439
|
-
|
|
4440
|
-
pageIndex = x;
|
|
4441
|
-
activityIndex = y;
|
|
4442
|
-
}
|
|
4443
|
-
if (pages?.[x]?.data?.[y]?.reshared?.id === activityId) {
|
|
4444
|
-
resharePageIndex = x;
|
|
4445
|
-
reshareActivityIndex = y;
|
|
4402
|
+
queryClient.setQueriesData(
|
|
4403
|
+
{ queryKey: KEY, exact: false },
|
|
4404
|
+
(originalData) => produce3(originalData, (draft) => {
|
|
4405
|
+
if (!draft?.pages || draft.pages.length === 0) {
|
|
4406
|
+
return;
|
|
4407
|
+
}
|
|
4408
|
+
for (const page of draft.pages) {
|
|
4409
|
+
for (const activity of page.data) {
|
|
4410
|
+
if (activity.id === activityId) {
|
|
4411
|
+
activity._count.likes += increment ? 1 : -1;
|
|
4412
|
+
activity.likes = increment ? [{ createdAt: (/* @__PURE__ */ new Date()).toISOString() }] : [];
|
|
4413
|
+
}
|
|
4446
4414
|
}
|
|
4447
4415
|
}
|
|
4448
|
-
}
|
|
4449
|
-
|
|
4450
|
-
pages[pageIndex].data[activityIndex]._count.likes = increment ? pages?.[pageIndex]?.data[activityIndex]._count.likes + 1 : pages?.[pageIndex]?.data[activityIndex]._count.likes - 1;
|
|
4451
|
-
pages[pageIndex].data[activityIndex].likes = increment ? [{}] : void 0;
|
|
4452
|
-
}
|
|
4453
|
-
if (typeof resharePageIndex != "undefined" && typeof reshareActivityIndex != "undefined") {
|
|
4454
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared._count.likes = increment ? pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.likes + 1 : pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.likes - 1;
|
|
4455
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared.likes = increment ? [{}] : void 0;
|
|
4456
|
-
}
|
|
4457
|
-
return { ...data, pages };
|
|
4458
|
-
});
|
|
4416
|
+
})
|
|
4417
|
+
);
|
|
4459
4418
|
};
|
|
4460
4419
|
|
|
4461
4420
|
// src/mutations/activities/useLikeActivity.ts
|
|
@@ -4465,7 +4424,10 @@ var LikeActivity = async ({
|
|
|
4465
4424
|
queryClient
|
|
4466
4425
|
}) => {
|
|
4467
4426
|
if (queryClient) {
|
|
4468
|
-
UpdateLikesSingle(true, queryClient,
|
|
4427
|
+
UpdateLikesSingle(true, queryClient, [
|
|
4428
|
+
...ACTIVITY_QUERY_KEY(activityId),
|
|
4429
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
4430
|
+
]);
|
|
4469
4431
|
UpdateLikesInfinite(true, queryClient, ACTIVITIES_QUERY_KEY(), activityId);
|
|
4470
4432
|
}
|
|
4471
4433
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
@@ -4485,7 +4447,10 @@ var ReshareActivity = async ({
|
|
|
4485
4447
|
clientApiParams
|
|
4486
4448
|
}) => {
|
|
4487
4449
|
if (queryClient) {
|
|
4488
|
-
UpdateResharesSingle(true, queryClient,
|
|
4450
|
+
UpdateResharesSingle(true, queryClient, [
|
|
4451
|
+
...ACTIVITY_QUERY_KEY(activityId),
|
|
4452
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
4453
|
+
]);
|
|
4489
4454
|
UpdateResharesInfinite(
|
|
4490
4455
|
true,
|
|
4491
4456
|
queryClient,
|
|
@@ -4513,7 +4478,10 @@ var UnlikeActivity = async ({
|
|
|
4513
4478
|
queryClient
|
|
4514
4479
|
}) => {
|
|
4515
4480
|
if (queryClient) {
|
|
4516
|
-
UpdateLikesSingle(false, queryClient,
|
|
4481
|
+
UpdateLikesSingle(false, queryClient, [
|
|
4482
|
+
...ACTIVITY_QUERY_KEY(activityId),
|
|
4483
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
4484
|
+
]);
|
|
4517
4485
|
UpdateLikesInfinite(false, queryClient, ACTIVITIES_QUERY_KEY(), activityId);
|
|
4518
4486
|
}
|
|
4519
4487
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
@@ -5543,36 +5511,10 @@ var AddSelfEventListingSession = async ({
|
|
|
5543
5511
|
}
|
|
5544
5512
|
);
|
|
5545
5513
|
if (queryClient && data.status === "ok") {
|
|
5546
|
-
|
|
5547
|
-
|
|
5548
|
-
|
|
5549
|
-
|
|
5550
|
-
const event = oldData ? JSON.parse(JSON.stringify(oldData)) : void 0;
|
|
5551
|
-
if (event && event.data) {
|
|
5552
|
-
if (event.data?.sessions) {
|
|
5553
|
-
event.data.sessions.push(data.data);
|
|
5554
|
-
} else {
|
|
5555
|
-
event.data.sessions = [data.data];
|
|
5556
|
-
}
|
|
5557
|
-
}
|
|
5558
|
-
return event;
|
|
5559
|
-
}
|
|
5560
|
-
);
|
|
5561
|
-
queryClient.setQueryData(
|
|
5562
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
5563
|
-
(oldData) => {
|
|
5564
|
-
const event = oldData ? JSON.parse(JSON.stringify(oldData)) : void 0;
|
|
5565
|
-
if (event && event.data) {
|
|
5566
|
-
if (event.data?.sessions) {
|
|
5567
|
-
event.data.sessions.push(data.data);
|
|
5568
|
-
} else {
|
|
5569
|
-
event.data.sessions = [data.data];
|
|
5570
|
-
}
|
|
5571
|
-
}
|
|
5572
|
-
return event;
|
|
5573
|
-
}
|
|
5574
|
-
);
|
|
5575
|
-
}
|
|
5514
|
+
queryClient.invalidateQueries({
|
|
5515
|
+
queryKey: EVENT_SESSIONS_QUERY_KEY(eventId)
|
|
5516
|
+
});
|
|
5517
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
5576
5518
|
}
|
|
5577
5519
|
return data;
|
|
5578
5520
|
};
|
|
@@ -5595,36 +5537,10 @@ var AddSelfEventListingSpeaker = async ({
|
|
|
5595
5537
|
}
|
|
5596
5538
|
);
|
|
5597
5539
|
if (queryClient && data.status === "ok") {
|
|
5598
|
-
|
|
5599
|
-
|
|
5600
|
-
|
|
5601
|
-
|
|
5602
|
-
const event = oldData ? JSON.parse(JSON.stringify(oldData)) : void 0;
|
|
5603
|
-
if (event && event.data) {
|
|
5604
|
-
if (event.data?.speakers) {
|
|
5605
|
-
event.data.speakers.push(data.data);
|
|
5606
|
-
} else {
|
|
5607
|
-
event.data.speakers = [data.data];
|
|
5608
|
-
}
|
|
5609
|
-
}
|
|
5610
|
-
return event;
|
|
5611
|
-
}
|
|
5612
|
-
);
|
|
5613
|
-
queryClient.setQueryData(
|
|
5614
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
5615
|
-
(oldData) => {
|
|
5616
|
-
const event = oldData ? JSON.parse(JSON.stringify(oldData)) : void 0;
|
|
5617
|
-
if (event && event.data) {
|
|
5618
|
-
if (event.data?.speakers) {
|
|
5619
|
-
event.data.speakers.push(data.data);
|
|
5620
|
-
} else {
|
|
5621
|
-
event.data.speakers = [data.data];
|
|
5622
|
-
}
|
|
5623
|
-
}
|
|
5624
|
-
return event;
|
|
5625
|
-
}
|
|
5626
|
-
);
|
|
5627
|
-
}
|
|
5540
|
+
queryClient.invalidateQueries({
|
|
5541
|
+
queryKey: EVENT_SPEAKERS_QUERY_KEY(eventId)
|
|
5542
|
+
});
|
|
5543
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
5628
5544
|
}
|
|
5629
5545
|
return data;
|
|
5630
5546
|
};
|
|
@@ -5639,36 +5555,6 @@ var AddSelfEventListingSponsor = async ({
|
|
|
5639
5555
|
clientApiParams,
|
|
5640
5556
|
queryClient
|
|
5641
5557
|
}) => {
|
|
5642
|
-
if (queryClient) {
|
|
5643
|
-
queryClient.setQueryData(
|
|
5644
|
-
[...EVENT_QUERY_KEY(eventId), clientApiParams.locale],
|
|
5645
|
-
(oldData) => {
|
|
5646
|
-
const event = oldData ? JSON.parse(JSON.stringify(oldData)) : void 0;
|
|
5647
|
-
if (event && event.data) {
|
|
5648
|
-
if (event.data?.sponsors) {
|
|
5649
|
-
event.data.sponsors.push(sponsor);
|
|
5650
|
-
} else {
|
|
5651
|
-
event.data.sponsors = [sponsor];
|
|
5652
|
-
}
|
|
5653
|
-
}
|
|
5654
|
-
return event;
|
|
5655
|
-
}
|
|
5656
|
-
);
|
|
5657
|
-
queryClient.setQueryData(
|
|
5658
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
5659
|
-
(oldData) => {
|
|
5660
|
-
const event = oldData ? JSON.parse(JSON.stringify(oldData)) : void 0;
|
|
5661
|
-
if (event && event.data) {
|
|
5662
|
-
if (event.data?.sponsors) {
|
|
5663
|
-
event.data.sponsors.push(sponsor);
|
|
5664
|
-
} else {
|
|
5665
|
-
event.data.sponsors = [sponsor];
|
|
5666
|
-
}
|
|
5667
|
-
}
|
|
5668
|
-
return event;
|
|
5669
|
-
}
|
|
5670
|
-
);
|
|
5671
|
-
}
|
|
5672
5558
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
5673
5559
|
const { data } = await clientApi.post(
|
|
5674
5560
|
`/self/events/listings/${eventId}/sponsors`,
|
|
@@ -5676,6 +5562,12 @@ var AddSelfEventListingSponsor = async ({
|
|
|
5676
5562
|
sponsorId: sponsor.id
|
|
5677
5563
|
}
|
|
5678
5564
|
);
|
|
5565
|
+
if (queryClient && data.status === "ok") {
|
|
5566
|
+
queryClient.invalidateQueries({
|
|
5567
|
+
queryKey: EVENT_SPONSORS_QUERY_KEY(eventId)
|
|
5568
|
+
});
|
|
5569
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
5570
|
+
}
|
|
5679
5571
|
return data;
|
|
5680
5572
|
};
|
|
5681
5573
|
var useAddSelfEventListingSponsor = (options = {}) => {
|
|
@@ -5848,40 +5740,16 @@ var RemoveSelfEventListingSession = async ({
|
|
|
5848
5740
|
clientApiParams,
|
|
5849
5741
|
queryClient
|
|
5850
5742
|
}) => {
|
|
5851
|
-
if (queryClient) {
|
|
5852
|
-
queryClient.setQueryData(
|
|
5853
|
-
[...EVENT_QUERY_KEY(eventId), clientApiParams.locale],
|
|
5854
|
-
(event) => {
|
|
5855
|
-
if (event && event.data) {
|
|
5856
|
-
const index = event?.data?.sessions?.findIndex(
|
|
5857
|
-
(session) => session.id === sessionId
|
|
5858
|
-
);
|
|
5859
|
-
if (index !== -1 && event.data.sessions) {
|
|
5860
|
-
event.data.sessions.splice(index, 1);
|
|
5861
|
-
}
|
|
5862
|
-
}
|
|
5863
|
-
return event;
|
|
5864
|
-
}
|
|
5865
|
-
);
|
|
5866
|
-
queryClient.setQueryData(
|
|
5867
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
5868
|
-
(event) => {
|
|
5869
|
-
if (event && event.data) {
|
|
5870
|
-
const index = event?.data?.sessions?.findIndex(
|
|
5871
|
-
(session) => session.id === sessionId
|
|
5872
|
-
);
|
|
5873
|
-
if (index !== -1 && event.data.sessions) {
|
|
5874
|
-
event.data.sessions.splice(index, 1);
|
|
5875
|
-
}
|
|
5876
|
-
}
|
|
5877
|
-
return event;
|
|
5878
|
-
}
|
|
5879
|
-
);
|
|
5880
|
-
}
|
|
5881
5743
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
5882
5744
|
const { data } = await clientApi.delete(
|
|
5883
5745
|
`/self/events/listings/${eventId}/sessions/${sessionId}`
|
|
5884
5746
|
);
|
|
5747
|
+
if (queryClient && data.status === "ok") {
|
|
5748
|
+
queryClient.invalidateQueries({
|
|
5749
|
+
queryKey: EVENT_SESSIONS_QUERY_KEY(eventId)
|
|
5750
|
+
});
|
|
5751
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
5752
|
+
}
|
|
5885
5753
|
return data;
|
|
5886
5754
|
};
|
|
5887
5755
|
var useRemoveSelfEventListingSession = (options = {}) => {
|
|
@@ -5895,40 +5763,16 @@ var RemoveSelfEventListingSpeaker = async ({
|
|
|
5895
5763
|
clientApiParams,
|
|
5896
5764
|
queryClient
|
|
5897
5765
|
}) => {
|
|
5898
|
-
if (queryClient) {
|
|
5899
|
-
queryClient.setQueryData(
|
|
5900
|
-
[...EVENT_QUERY_KEY(eventId), clientApiParams.locale],
|
|
5901
|
-
(event) => {
|
|
5902
|
-
if (event && event.data) {
|
|
5903
|
-
const index = event?.data?.speakers?.findIndex(
|
|
5904
|
-
(speaker) => speaker.id === speakerId
|
|
5905
|
-
);
|
|
5906
|
-
if (index !== -1 && event.data.speakers) {
|
|
5907
|
-
event.data.speakers.splice(index, 1);
|
|
5908
|
-
}
|
|
5909
|
-
}
|
|
5910
|
-
return event;
|
|
5911
|
-
}
|
|
5912
|
-
);
|
|
5913
|
-
queryClient.setQueryData(
|
|
5914
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
5915
|
-
(event) => {
|
|
5916
|
-
if (event && event.data) {
|
|
5917
|
-
const index = event?.data?.speakers?.findIndex(
|
|
5918
|
-
(speaker) => speaker.id === speakerId
|
|
5919
|
-
);
|
|
5920
|
-
if (index !== -1 && event.data.speakers) {
|
|
5921
|
-
event.data.speakers.splice(index, 1);
|
|
5922
|
-
}
|
|
5923
|
-
}
|
|
5924
|
-
return event;
|
|
5925
|
-
}
|
|
5926
|
-
);
|
|
5927
|
-
}
|
|
5928
5766
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
5929
5767
|
const { data } = await clientApi.delete(
|
|
5930
5768
|
`/self/events/listings/${eventId}/speakers/${speakerId}`
|
|
5931
5769
|
);
|
|
5770
|
+
if (queryClient && data.status === "ok") {
|
|
5771
|
+
queryClient.invalidateQueries({
|
|
5772
|
+
queryKey: EVENT_SPEAKERS_QUERY_KEY(eventId)
|
|
5773
|
+
});
|
|
5774
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
5775
|
+
}
|
|
5932
5776
|
return data;
|
|
5933
5777
|
};
|
|
5934
5778
|
var useRemoveSelfEventListingSpeaker = (options = {}) => {
|
|
@@ -5942,40 +5786,16 @@ var RemoveSelfEventListingSponsor = async ({
|
|
|
5942
5786
|
clientApiParams,
|
|
5943
5787
|
queryClient
|
|
5944
5788
|
}) => {
|
|
5945
|
-
if (queryClient) {
|
|
5946
|
-
queryClient.setQueryData(
|
|
5947
|
-
[...EVENT_QUERY_KEY(eventId), clientApiParams.locale],
|
|
5948
|
-
(event) => {
|
|
5949
|
-
if (event && event.data) {
|
|
5950
|
-
const index = event?.data?.sponsors?.findIndex(
|
|
5951
|
-
(sponsor) => sponsor.id === sponsorId
|
|
5952
|
-
);
|
|
5953
|
-
if (index !== -1 && event.data.sponsors) {
|
|
5954
|
-
event.data.sponsors.splice(index, 1);
|
|
5955
|
-
}
|
|
5956
|
-
}
|
|
5957
|
-
return event;
|
|
5958
|
-
}
|
|
5959
|
-
);
|
|
5960
|
-
queryClient.setQueryData(
|
|
5961
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
5962
|
-
(event) => {
|
|
5963
|
-
if (event && event.data) {
|
|
5964
|
-
const index = event?.data?.sponsors?.findIndex(
|
|
5965
|
-
(sponsor) => sponsor.id === sponsorId
|
|
5966
|
-
);
|
|
5967
|
-
if (index !== -1 && event.data.sponsors) {
|
|
5968
|
-
event.data.sponsors.splice(index, 1);
|
|
5969
|
-
}
|
|
5970
|
-
}
|
|
5971
|
-
return event;
|
|
5972
|
-
}
|
|
5973
|
-
);
|
|
5974
|
-
}
|
|
5975
5789
|
const clientApi = await GetClientAPI(clientApiParams);
|
|
5976
5790
|
const { data } = await clientApi.delete(
|
|
5977
5791
|
`/self/events/listings/${eventId}/sponsors/${sponsorId}`
|
|
5978
5792
|
);
|
|
5793
|
+
if (queryClient && data.status === "ok") {
|
|
5794
|
+
queryClient.invalidateQueries({
|
|
5795
|
+
queryKey: EVENT_SPONSORS_QUERY_KEY(eventId)
|
|
5796
|
+
});
|
|
5797
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
5798
|
+
}
|
|
5979
5799
|
return data;
|
|
5980
5800
|
};
|
|
5981
5801
|
var useRemoveSelfEventListingSponsor = (options = {}) => {
|
|
@@ -6030,63 +5850,35 @@ var useSelfCheckinRegistration = (options = {}) => {
|
|
|
6030
5850
|
};
|
|
6031
5851
|
|
|
6032
5852
|
// src/mutations/activities/optimistic/UpdateComments.ts
|
|
5853
|
+
import { produce as produce4 } from "immer";
|
|
6033
5854
|
var UpdateCommentsSingle = (increment, queryClient, KEY) => {
|
|
6034
|
-
queryClient.setQueryData(
|
|
6035
|
-
|
|
6036
|
-
|
|
6037
|
-
|
|
6038
|
-
|
|
6039
|
-
|
|
6040
|
-
|
|
6041
|
-
|
|
6042
|
-
|
|
6043
|
-
|
|
6044
|
-
...data._count,
|
|
6045
|
-
comments: increment ? data._count.comments + 1 : data._count.comments - 1
|
|
6046
|
-
},
|
|
6047
|
-
comments: increment ? [{}] : void 0
|
|
6048
|
-
}
|
|
6049
|
-
};
|
|
6050
|
-
}
|
|
6051
|
-
});
|
|
5855
|
+
queryClient.setQueryData(
|
|
5856
|
+
KEY,
|
|
5857
|
+
(originalData) => produce4(originalData, (draft) => {
|
|
5858
|
+
if (!draft?.data) {
|
|
5859
|
+
return;
|
|
5860
|
+
}
|
|
5861
|
+
draft.data._count.comments += increment ? 1 : -1;
|
|
5862
|
+
draft.data.comments = increment ? [{ id: Date.now().toString() }] : [];
|
|
5863
|
+
})
|
|
5864
|
+
);
|
|
6052
5865
|
};
|
|
6053
5866
|
var UpdateCommentsInfinite = (increment, queryClient, KEY, activityId) => {
|
|
6054
5867
|
queryClient.setQueriesData(
|
|
6055
|
-
{
|
|
6056
|
-
|
|
6057
|
-
|
|
6058
|
-
|
|
6059
|
-
(data) => {
|
|
6060
|
-
if (!data?.pages || data?.pages?.length === 0) {
|
|
6061
|
-
return data;
|
|
5868
|
+
{ queryKey: KEY, exact: false },
|
|
5869
|
+
(originalData) => produce4(originalData, (draft) => {
|
|
5870
|
+
if (!draft?.pages || draft.pages.length === 0) {
|
|
5871
|
+
return;
|
|
6062
5872
|
}
|
|
6063
|
-
const
|
|
6064
|
-
|
|
6065
|
-
|
|
6066
|
-
|
|
6067
|
-
|
|
6068
|
-
for (let x = 0; x < pages?.length; x++) {
|
|
6069
|
-
for (let y = 0; y < pages?.[x]?.data?.length; y++) {
|
|
6070
|
-
if (pages?.[x]?.data?.[y]?.id === activityId) {
|
|
6071
|
-
pageIndex = x;
|
|
6072
|
-
activityIndex = y;
|
|
6073
|
-
}
|
|
6074
|
-
if (pages?.[x]?.data?.[y]?.reshared?.id === activityId) {
|
|
6075
|
-
resharePageIndex = x;
|
|
6076
|
-
reshareActivityIndex = y;
|
|
5873
|
+
for (const page of draft.pages) {
|
|
5874
|
+
for (const activity of page.data) {
|
|
5875
|
+
if (activity.id === activityId) {
|
|
5876
|
+
activity._count.comments += increment ? 1 : -1;
|
|
5877
|
+
activity.comments = increment ? [{ id: Date.now().toString() }] : [];
|
|
6077
5878
|
}
|
|
6078
5879
|
}
|
|
6079
5880
|
}
|
|
6080
|
-
|
|
6081
|
-
pages[pageIndex].data[activityIndex]._count.comments = increment ? pages?.[pageIndex]?.data[activityIndex]._count.comments + 1 : pages?.[pageIndex]?.data[activityIndex]._count.comments - 1;
|
|
6082
|
-
pages[pageIndex].data[activityIndex].comments = increment ? [{}] : void 0;
|
|
6083
|
-
}
|
|
6084
|
-
if (typeof resharePageIndex != "undefined" && typeof reshareActivityIndex != "undefined") {
|
|
6085
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared._count.comments = increment ? pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.comments + 1 : pages?.[resharePageIndex]?.data[reshareActivityIndex].reshared._count.comments - 1;
|
|
6086
|
-
pages[resharePageIndex].data[reshareActivityIndex].reshared.comments = increment ? [{}] : void 0;
|
|
6087
|
-
}
|
|
6088
|
-
return { ...data, pages };
|
|
6089
|
-
}
|
|
5881
|
+
})
|
|
6090
5882
|
);
|
|
6091
5883
|
};
|
|
6092
5884
|
|
|
@@ -6102,7 +5894,7 @@ var SelfCreateActivity = async ({
|
|
|
6102
5894
|
if (activity.commentedId) {
|
|
6103
5895
|
UpdateCommentsSingle(true, queryClient, [
|
|
6104
5896
|
...ACTIVITY_QUERY_KEY(activity.commentedId),
|
|
6105
|
-
clientApiParams.locale
|
|
5897
|
+
...GetBaseSingleQueryKeys(clientApiParams.locale)
|
|
6106
5898
|
]);
|
|
6107
5899
|
UpdateCommentsInfinite(
|
|
6108
5900
|
true,
|
|
@@ -6117,51 +5909,51 @@ var SelfCreateActivity = async ({
|
|
|
6117
5909
|
`/self/activities`,
|
|
6118
5910
|
{
|
|
6119
5911
|
activity,
|
|
6120
|
-
|
|
6121
|
-
videoUri: videoUri
|
|
5912
|
+
imageUri: base64Image ?? void 0,
|
|
5913
|
+
videoUri: videoUri ?? void 0
|
|
6122
5914
|
}
|
|
6123
5915
|
);
|
|
6124
5916
|
if (queryClient && data.status === "ok") {
|
|
6125
5917
|
let nested = false;
|
|
6126
|
-
if (
|
|
5918
|
+
if (activity.commentedId) {
|
|
6127
5919
|
nested = true;
|
|
6128
5920
|
AppendInfiniteQuery(
|
|
6129
5921
|
queryClient,
|
|
6130
5922
|
[
|
|
6131
|
-
...ACTIVITY_COMMENTS_QUERY_KEY(
|
|
5923
|
+
...ACTIVITY_COMMENTS_QUERY_KEY(activity.commentedId),
|
|
6132
5924
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6133
5925
|
],
|
|
6134
5926
|
data.data
|
|
6135
5927
|
);
|
|
6136
5928
|
}
|
|
6137
|
-
if (
|
|
5929
|
+
if (activity.contentId) {
|
|
6138
5930
|
nested = true;
|
|
6139
5931
|
AppendInfiniteQuery(
|
|
6140
5932
|
queryClient,
|
|
6141
5933
|
[
|
|
6142
|
-
...CONTENT_ACTIVITIES_QUERY_KEY(
|
|
5934
|
+
...CONTENT_ACTIVITIES_QUERY_KEY(activity.contentId),
|
|
6143
5935
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6144
5936
|
],
|
|
6145
5937
|
data.data
|
|
6146
5938
|
);
|
|
6147
5939
|
}
|
|
6148
|
-
if (
|
|
5940
|
+
if (activity.eventId) {
|
|
6149
5941
|
nested = true;
|
|
6150
5942
|
AppendInfiniteQuery(
|
|
6151
5943
|
queryClient,
|
|
6152
5944
|
[
|
|
6153
|
-
...EVENT_ACTIVITIES_QUERY_KEY(
|
|
5945
|
+
...EVENT_ACTIVITIES_QUERY_KEY(activity.eventId),
|
|
6154
5946
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6155
5947
|
],
|
|
6156
5948
|
data.data
|
|
6157
5949
|
);
|
|
6158
5950
|
}
|
|
6159
|
-
if (
|
|
5951
|
+
if (activity.communityId) {
|
|
6160
5952
|
nested = true;
|
|
6161
5953
|
AppendInfiniteQuery(
|
|
6162
5954
|
queryClient,
|
|
6163
5955
|
[
|
|
6164
|
-
...COMMUNITY_ACTIVITIES_QUERY_KEY(
|
|
5956
|
+
...COMMUNITY_ACTIVITIES_QUERY_KEY(activity.communityId),
|
|
6165
5957
|
...GetBaseInfiniteQueryKeys(clientApiParams.locale)
|
|
6166
5958
|
],
|
|
6167
5959
|
data.data
|
|
@@ -6326,7 +6118,7 @@ var UpdateSelfEventListing = async ({
|
|
|
6326
6118
|
`/self/events/listings/${eventId}`,
|
|
6327
6119
|
{
|
|
6328
6120
|
event,
|
|
6329
|
-
image: base64
|
|
6121
|
+
image: base64 ?? void 0
|
|
6330
6122
|
}
|
|
6331
6123
|
);
|
|
6332
6124
|
if (queryClient && data.status === "ok") {
|
|
@@ -6369,34 +6161,10 @@ var UpdateSelfEventListingSession = async ({
|
|
|
6369
6161
|
}
|
|
6370
6162
|
);
|
|
6371
6163
|
if (queryClient && data.status === "ok") {
|
|
6372
|
-
queryClient.
|
|
6373
|
-
|
|
6374
|
-
|
|
6375
|
-
|
|
6376
|
-
const index = event?.data?.sessions?.findIndex(
|
|
6377
|
-
(session2) => session2.id === data.data.id
|
|
6378
|
-
);
|
|
6379
|
-
if (index !== -1 && event.data.sessions) {
|
|
6380
|
-
event.data.sessions[index] = data.data;
|
|
6381
|
-
}
|
|
6382
|
-
}
|
|
6383
|
-
return event;
|
|
6384
|
-
}
|
|
6385
|
-
);
|
|
6386
|
-
queryClient.setQueryData(
|
|
6387
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6388
|
-
(event) => {
|
|
6389
|
-
if (event && event.data) {
|
|
6390
|
-
const index = event?.data?.sessions?.findIndex(
|
|
6391
|
-
(session2) => session2.id === data.data.id
|
|
6392
|
-
);
|
|
6393
|
-
if (index !== -1 && event.data.sessions) {
|
|
6394
|
-
event.data.sessions[index] = data.data;
|
|
6395
|
-
}
|
|
6396
|
-
}
|
|
6397
|
-
return event;
|
|
6398
|
-
}
|
|
6399
|
-
);
|
|
6164
|
+
queryClient.invalidateQueries({
|
|
6165
|
+
queryKey: EVENT_SESSIONS_QUERY_KEY(eventId)
|
|
6166
|
+
});
|
|
6167
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
6400
6168
|
}
|
|
6401
6169
|
return data;
|
|
6402
6170
|
};
|
|
@@ -6422,34 +6190,10 @@ var UpdateSelfEventListingSpeaker = async ({
|
|
|
6422
6190
|
}
|
|
6423
6191
|
);
|
|
6424
6192
|
if (queryClient && data.status === "ok") {
|
|
6425
|
-
queryClient.
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
const index = event?.data?.speakers?.findIndex(
|
|
6430
|
-
(speaker2) => speaker2.id === data.data.id
|
|
6431
|
-
);
|
|
6432
|
-
if (index !== -1 && event.data.speakers) {
|
|
6433
|
-
event.data.speakers[index] = data.data;
|
|
6434
|
-
}
|
|
6435
|
-
}
|
|
6436
|
-
return event;
|
|
6437
|
-
}
|
|
6438
|
-
);
|
|
6439
|
-
queryClient.setQueryData(
|
|
6440
|
-
[...SELF_EVENT_LISTING_QUERY_KEY(eventId), clientApiParams.locale],
|
|
6441
|
-
(event) => {
|
|
6442
|
-
if (event && event.data) {
|
|
6443
|
-
const index = event?.data?.speakers?.findIndex(
|
|
6444
|
-
(speaker2) => speaker2.id === data.data.id
|
|
6445
|
-
);
|
|
6446
|
-
if (index !== -1 && event.data.speakers) {
|
|
6447
|
-
event.data.speakers[index] = data.data;
|
|
6448
|
-
}
|
|
6449
|
-
}
|
|
6450
|
-
return event;
|
|
6451
|
-
}
|
|
6452
|
-
);
|
|
6193
|
+
queryClient.invalidateQueries({
|
|
6194
|
+
queryKey: EVENT_SPEAKERS_QUERY_KEY(eventId)
|
|
6195
|
+
});
|
|
6196
|
+
SET_SELF_EVENT_LISTING_QUERY_DATA(queryClient, [eventId], data);
|
|
6453
6197
|
}
|
|
6454
6198
|
return data;
|
|
6455
6199
|
};
|