@dxos/react-client 2.19.12-dev.15870405 → 2.19.12-dev.205501cf

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.
@@ -0,0 +1,4 @@
1
+ import { InvitationRequest } from '@dxos/client';
2
+ import { PublicKey } from '@dxos/crypto';
3
+ export declare const usePartyInvitations: (partyKey?: PublicKey | undefined) => InvitationRequest[];
4
+ //# sourceMappingURL=usePartyInvitations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePartyInvitations.d.ts","sourceRoot":"","sources":["../../../../src/hooks/invitations/usePartyInvitations.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAIzC,eAAO,MAAM,mBAAmB,2DAe/B,CAAC"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ //
3
+ // Copyright 2022 DXOS.org
4
+ //
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.usePartyInvitations = void 0;
7
+ const react_1 = require("react");
8
+ const echo_queries_1 = require("../echo-queries");
9
+ const usePartyInvitations = (partyKey) => {
10
+ var _a;
11
+ const party = (0, echo_queries_1.useParty)(partyKey);
12
+ const [invitations, setInvitations] = (0, react_1.useState)((_a = party === null || party === void 0 ? void 0 : party.activeInvitations) !== null && _a !== void 0 ? _a : []);
13
+ (0, react_1.useEffect)(() => {
14
+ return party === null || party === void 0 ? void 0 : party.invitationsUpdate.on(() => {
15
+ setInvitations([...party.activeInvitations]);
16
+ });
17
+ }, [party]);
18
+ (0, react_1.useEffect)(() => {
19
+ setInvitations([]);
20
+ }, [party === null || party === void 0 ? void 0 : party.key.toHex()]);
21
+ return invitations;
22
+ };
23
+ exports.usePartyInvitations = usePartyInvitations;
24
+ //# sourceMappingURL=usePartyInvitations.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"usePartyInvitations.js","sourceRoot":"","sources":["../../../../src/hooks/invitations/usePartyInvitations.ts"],"names":[],"mappings":";AAAA,EAAE;AACF,0BAA0B;AAC1B,EAAE;;;AAEF,iCAA4C;AAK5C,kDAA2C;AAEpC,MAAM,mBAAmB,GAAG,CAAC,QAAoB,EAAE,EAAE;;IAC1D,MAAM,KAAK,GAAG,IAAA,uBAAQ,EAAC,QAAQ,CAAC,CAAC;IACjC,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,IAAA,gBAAQ,EAAsB,MAAA,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,mCAAI,EAAE,CAAC,CAAC;IAEpG,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,OAAO,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,iBAAiB,CAAC,EAAE,CAAC,GAAG,EAAE;YACtC,cAAc,CAAC,CAAC,GAAG,KAAK,CAAC,iBAAiB,CAAC,CAAC,CAAC;QAC/C,CAAC,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC;IAEZ,IAAA,iBAAS,EAAC,GAAG,EAAE;QACb,cAAc,CAAC,EAAE,CAAC,CAAC;IACrB,CAAC,EAAE,CAAC,KAAK,aAAL,KAAK,uBAAL,KAAK,CAAE,GAAG,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC;IAEzB,OAAO,WAAW,CAAC;AACrB,CAAC,CAAC;AAfW,QAAA,mBAAmB,uBAe9B"}