@connectedxm/client 0.0.2

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.mjs ADDED
@@ -0,0 +1,340 @@
1
+ // src/interfaces.ts
2
+ var RegistrationStatus = /* @__PURE__ */ ((RegistrationStatus2) => {
3
+ RegistrationStatus2["registered"] = "registered";
4
+ RegistrationStatus2["checkedIn"] = "checkedIn";
5
+ RegistrationStatus2["checkedOut"] = "checkedOut";
6
+ RegistrationStatus2["waitlisted"] = "waitlisted";
7
+ RegistrationStatus2["cancelled"] = "cancelled";
8
+ RegistrationStatus2["transferred"] = "transferred";
9
+ RegistrationStatus2["invited"] = "invited";
10
+ RegistrationStatus2["rejected"] = "rejected";
11
+ RegistrationStatus2["draft"] = "draft";
12
+ return RegistrationStatus2;
13
+ })(RegistrationStatus || {});
14
+ var ImageType = /* @__PURE__ */ ((ImageType2) => {
15
+ ImageType2["admin"] = "admin";
16
+ ImageType2["people"] = "people";
17
+ ImageType2["activity"] = "activity";
18
+ ImageType2["banner"] = "banner";
19
+ return ImageType2;
20
+ })(ImageType || {});
21
+ var isTypeImage = (image) => {
22
+ return image.name !== void 0;
23
+ };
24
+ var isTypeIntegrations = (integrations) => {
25
+ return integrations.ghost !== void 0;
26
+ };
27
+ var Currency = /* @__PURE__ */ ((Currency2) => {
28
+ Currency2["USD"] = "USD";
29
+ return Currency2;
30
+ })(Currency || {});
31
+ var isTypeOrganization = (organization) => {
32
+ return organization.email !== void 0;
33
+ };
34
+ var isTypeAccountTier = (accountTier) => {
35
+ return accountTier.description !== void 0;
36
+ };
37
+ var AccountType = /* @__PURE__ */ ((AccountType2) => {
38
+ AccountType2["account"] = "account";
39
+ AccountType2["team"] = "team";
40
+ return AccountType2;
41
+ })(AccountType || {});
42
+ var isTypeAccount = (account) => {
43
+ return account._count !== void 0;
44
+ };
45
+ var isSelf = (account) => {
46
+ return account.email !== void 0;
47
+ };
48
+ var isTypeActivity = (activity) => {
49
+ return activity._count !== void 0;
50
+ };
51
+ var CommunityAccess = /* @__PURE__ */ ((CommunityAccess2) => {
52
+ CommunityAccess2["public"] = "public";
53
+ CommunityAccess2["private"] = "private";
54
+ return CommunityAccess2;
55
+ })(CommunityAccess || {});
56
+ var isTypeCommunity = (community) => {
57
+ return community._count !== void 0;
58
+ };
59
+ var EventSource = /* @__PURE__ */ ((EventSource2) => {
60
+ EventSource2["admin"] = "admin";
61
+ EventSource2["moderator"] = "moderator";
62
+ EventSource2["account"] = "account";
63
+ return EventSource2;
64
+ })(EventSource || {});
65
+ var EventType = /* @__PURE__ */ ((EventType2) => {
66
+ EventType2["physical"] = "physical";
67
+ EventType2["virtual"] = "virtual";
68
+ EventType2["hybrid"] = "hybrid";
69
+ return EventType2;
70
+ })(EventType || {});
71
+ var isTypeEvent = (event) => {
72
+ return event._count !== void 0;
73
+ };
74
+ var RegistrationQuestionType = /* @__PURE__ */ ((RegistrationQuestionType2) => {
75
+ RegistrationQuestionType2["text"] = "text";
76
+ RegistrationQuestionType2["textarea"] = "textarea";
77
+ RegistrationQuestionType2["number"] = "number";
78
+ RegistrationQuestionType2["time"] = "time";
79
+ RegistrationQuestionType2["date"] = "date";
80
+ RegistrationQuestionType2["toggle"] = "toggle";
81
+ RegistrationQuestionType2["select"] = "select";
82
+ RegistrationQuestionType2["radio"] = "radio";
83
+ RegistrationQuestionType2["checkbox"] = "checkbox";
84
+ RegistrationQuestionType2["search"] = "search";
85
+ return RegistrationQuestionType2;
86
+ })(RegistrationQuestionType || {});
87
+ var isListing = (event) => {
88
+ return event.newActivityCreatorEmailNotification !== void 0;
89
+ };
90
+ var TicketVisibility = /* @__PURE__ */ ((TicketVisibility2) => {
91
+ TicketVisibility2["public"] = "public";
92
+ TicketVisibility2["private"] = "private";
93
+ return TicketVisibility2;
94
+ })(TicketVisibility || {});
95
+ var TicketEventAccessLevel = /* @__PURE__ */ ((TicketEventAccessLevel2) => {
96
+ TicketEventAccessLevel2["regular"] = "regular";
97
+ TicketEventAccessLevel2["virtual"] = "virtual";
98
+ TicketEventAccessLevel2["vip"] = "vip";
99
+ return TicketEventAccessLevel2;
100
+ })(TicketEventAccessLevel || {});
101
+ var isTypeTicket = (ticket) => {
102
+ return ticket.visibility !== void 0;
103
+ };
104
+ var isTypePurchase = (purchase) => {
105
+ return purchase.createdAt !== void 0;
106
+ };
107
+ var isTypeTransfer = (transfer) => {
108
+ return transfer.createdAt !== void 0;
109
+ };
110
+ var NotificationType = /* @__PURE__ */ ((NotificationType2) => {
111
+ NotificationType2["ANNOUNCEMENT"] = "ANNOUNCEMENT";
112
+ NotificationType2["FOLLOW"] = "FOLLOW";
113
+ NotificationType2["INVITATION"] = "INVITATION";
114
+ NotificationType2["TRANSFER"] = "TRANSFER";
115
+ NotificationType2["LIKE"] = "LIKE";
116
+ NotificationType2["COMMENT"] = "COMMENT";
117
+ NotificationType2["RESHARE"] = "RESHARE";
118
+ NotificationType2["EVENT"] = "EVENT";
119
+ NotificationType2["ACTIVITY"] = "ACTIVITY";
120
+ return NotificationType2;
121
+ })(NotificationType || {});
122
+ var isTypeNotification = (notification) => {
123
+ return notification.createdAt !== void 0;
124
+ };
125
+ var CouponType = /* @__PURE__ */ ((CouponType2) => {
126
+ CouponType2["order"] = "order";
127
+ CouponType2["ticket"] = "ticket";
128
+ return CouponType2;
129
+ })(CouponType || {});
130
+ var isTypeCoupon = (coupon) => {
131
+ return coupon.description !== void 0;
132
+ };
133
+ var isManagedCoupon = (coupon) => {
134
+ return coupon.active !== void 0;
135
+ };
136
+ var isTypeInstance = (instance) => {
137
+ return instance.coupon !== void 0;
138
+ };
139
+ var isTypeTrack = (track) => {
140
+ return track.description !== void 0;
141
+ };
142
+ var isTypeSpeaker = (speaker) => {
143
+ return speaker.website !== void 0;
144
+ };
145
+ var isTypeSession = (session) => {
146
+ return session.longDescription !== void 0;
147
+ };
148
+ var isTypeEventPage = (page) => {
149
+ return page.html !== void 0;
150
+ };
151
+ var isTypeScan = (scan) => {
152
+ return scan.createdAt !== void 0;
153
+ };
154
+ var isTypeSponsorshipLevel = (sponsorshipLevel) => {
155
+ return sponsorshipLevel.description !== void 0;
156
+ };
157
+ var isTypeFaq = (faq) => {
158
+ return faq.section !== void 0;
159
+ };
160
+ var isTypeFaqSection = (faqSection) => {
161
+ return faqSection.faqs !== void 0;
162
+ };
163
+ var SupportTicketType = /* @__PURE__ */ ((SupportTicketType2) => {
164
+ SupportTicketType2["support"] = "support";
165
+ SupportTicketType2["inquiry"] = "inquiry";
166
+ return SupportTicketType2;
167
+ })(SupportTicketType || {});
168
+ var isTypeSupportTicket = (supportTicket) => {
169
+ return supportTicket.email !== void 0;
170
+ };
171
+ var isTypeSupportTicketNote = (supportTicketNote) => {
172
+ return supportTicketNote.createdAt !== void 0;
173
+ };
174
+ var AdvertisementType = /* @__PURE__ */ ((AdvertisementType2) => {
175
+ AdvertisementType2["square"] = "square";
176
+ AdvertisementType2["rectangle"] = "rectangle";
177
+ return AdvertisementType2;
178
+ })(AdvertisementType || {});
179
+ var isTypeAdvertisement = (advertisement) => {
180
+ return advertisement.title !== void 0;
181
+ };
182
+ var isTypeTeamMember = (teamMember) => {
183
+ return teamMember.email !== void 0;
184
+ };
185
+ var CommunityMembershipRole = /* @__PURE__ */ ((CommunityMembershipRole2) => {
186
+ CommunityMembershipRole2["member"] = "member";
187
+ CommunityMembershipRole2["moderator"] = "moderator";
188
+ return CommunityMembershipRole2;
189
+ })(CommunityMembershipRole || {});
190
+ var isTypeCommunityMembership = (communityMembership) => {
191
+ return communityMembership.createdAt !== void 0;
192
+ };
193
+ var ContentTypeFormat = /* @__PURE__ */ ((ContentTypeFormat2) => {
194
+ ContentTypeFormat2["article"] = "article";
195
+ ContentTypeFormat2["podcast"] = "podcast";
196
+ ContentTypeFormat2["video"] = "video";
197
+ return ContentTypeFormat2;
198
+ })(ContentTypeFormat || {});
199
+ var isTypeContentType = (contentType) => {
200
+ return contentType.priority !== void 0;
201
+ };
202
+ var isTypeContent = (content) => {
203
+ return content.body !== void 0;
204
+ };
205
+ var isTypeLead = (lead) => {
206
+ return lead.email !== void 0;
207
+ };
208
+ var PushDeviceAppType = /* @__PURE__ */ ((PushDeviceAppType2) => {
209
+ PushDeviceAppType2["EVENTXM"] = "EVENTXM";
210
+ PushDeviceAppType2["COMMUNITYXM"] = "COMMUNITYXM";
211
+ return PushDeviceAppType2;
212
+ })(PushDeviceAppType || {});
213
+ var PushService = /* @__PURE__ */ ((PushService2) => {
214
+ PushService2["apn"] = "apn";
215
+ PushService2["firebase"] = "firebase";
216
+ PushService2["huawei"] = "huawei";
217
+ PushService2["xiaomi"] = "xiaomi";
218
+ return PushService2;
219
+ })(PushService || {});
220
+ var isTypeAnnouncement = (announcement) => {
221
+ return announcement.updatedAt !== void 0;
222
+ };
223
+ var isTypeBenefit = (benefit) => {
224
+ return benefit.createdAt !== void 0;
225
+ };
226
+ var isTypeEventActivation = (eventActivation) => {
227
+ return eventActivation.createdAt !== void 0;
228
+ };
229
+ var isTypeEventActivationCompletion = (eventActivationCompletion) => {
230
+ return eventActivationCompletion.updatedAt !== void 0;
231
+ };
232
+
233
+ // src/hooks/useConnectedXM.ts
234
+ import React2 from "react";
235
+
236
+ // src/Context.ts
237
+ import React from "react";
238
+ var Context = React.createContext({});
239
+ var Context_default = Context;
240
+
241
+ // src/hooks/useConnectedXM.ts
242
+ var useConnectedXM = () => {
243
+ const context = React2.useContext(Context_default);
244
+ if (!context) {
245
+ throw new Error("useConnectedXM must be used within a ConnectedXMProvider");
246
+ }
247
+ return context;
248
+ };
249
+
250
+ // src/hooks/useSetAuthToken.ts
251
+ var useSetAuthToken = () => {
252
+ const { setAuthToken } = useConnectedXM();
253
+ return setAuthToken;
254
+ };
255
+
256
+ // src/ConnectedXM.tsx
257
+ import React3 from "react";
258
+ var ConnectedXM = ({
259
+ organizationId,
260
+ apiUrl = "https://api.connectedxm.app",
261
+ token,
262
+ executeAs,
263
+ locale = "en",
264
+ children
265
+ }) => {
266
+ const [authToken, setAuthToken] = React3.useState(token);
267
+ return /* @__PURE__ */ React3.createElement(
268
+ Context_default.Provider,
269
+ {
270
+ value: {
271
+ organizationId,
272
+ apiUrl,
273
+ token: authToken,
274
+ setAuthToken,
275
+ executeAs,
276
+ locale
277
+ }
278
+ },
279
+ children
280
+ );
281
+ };
282
+ export {
283
+ AccountType,
284
+ AdvertisementType,
285
+ CommunityAccess,
286
+ CommunityMembershipRole,
287
+ ConnectedXM,
288
+ ContentTypeFormat,
289
+ CouponType,
290
+ Currency,
291
+ EventSource,
292
+ EventType,
293
+ ImageType,
294
+ NotificationType,
295
+ PushDeviceAppType,
296
+ PushService,
297
+ RegistrationQuestionType,
298
+ RegistrationStatus,
299
+ SupportTicketType,
300
+ TicketEventAccessLevel,
301
+ TicketVisibility,
302
+ isListing,
303
+ isManagedCoupon,
304
+ isSelf,
305
+ isTypeAccount,
306
+ isTypeAccountTier,
307
+ isTypeActivity,
308
+ isTypeAdvertisement,
309
+ isTypeAnnouncement,
310
+ isTypeBenefit,
311
+ isTypeCommunity,
312
+ isTypeCommunityMembership,
313
+ isTypeContent,
314
+ isTypeContentType,
315
+ isTypeCoupon,
316
+ isTypeEvent,
317
+ isTypeEventActivation,
318
+ isTypeEventActivationCompletion,
319
+ isTypeEventPage,
320
+ isTypeFaq,
321
+ isTypeFaqSection,
322
+ isTypeImage,
323
+ isTypeInstance,
324
+ isTypeIntegrations,
325
+ isTypeLead,
326
+ isTypeNotification,
327
+ isTypeOrganization,
328
+ isTypePurchase,
329
+ isTypeScan,
330
+ isTypeSession,
331
+ isTypeSpeaker,
332
+ isTypeSponsorshipLevel,
333
+ isTypeSupportTicket,
334
+ isTypeSupportTicketNote,
335
+ isTypeTeamMember,
336
+ isTypeTicket,
337
+ isTypeTrack,
338
+ isTypeTransfer,
339
+ useSetAuthToken
340
+ };
package/package.json ADDED
@@ -0,0 +1,41 @@
1
+ {
2
+ "name": "@connectedxm/client",
3
+ "version": "0.0.2",
4
+ "description": "Client API javascript SDK",
5
+ "author": "ConnectedXM Inc.",
6
+ "license": "MIT",
7
+ "private": false,
8
+ "main": "dist/index.js",
9
+ "module": "dist/index.mjs",
10
+ "types": "dist/index.d.ts",
11
+ "scripts": {
12
+ "dev": "vitest",
13
+ "lint": "yarn tsc && eslint src/**/*.ts",
14
+ "test": "vitest run",
15
+ "build": "tsup src/index.ts --format cjs,esm --dts",
16
+ "ci": "yarn run lint && yarn run test && yarn run build",
17
+ "release": "yarn run lint && yarn run test && yarn run build && changeset publish"
18
+ },
19
+ "dependencies": {
20
+ "axios": "^1.6.5"
21
+ },
22
+ "peerDependencies": {
23
+ "@tanstack/react-query": "^4.0.0",
24
+ "react": "^18.0.0"
25
+ },
26
+ "devDependencies": {
27
+ "@changesets/cli": "^2.26.0",
28
+ "@swc/core": "^1.3.102",
29
+ "@tanstack/react-query": "^4.0.0",
30
+ "@typescript-eslint/eslint-plugin": "^6.4.0",
31
+ "@typescript-eslint/parser": "^6.18.1",
32
+ "@types/react": "^18.2.47",
33
+ "eslint": "^8.0.1",
34
+ "eslint-plugin-react": "^7.33.2",
35
+ "eslint-plugin-react-hooks": "^4.6.0",
36
+ "react": "^18.0.0",
37
+ "tsup": "^8.0.1",
38
+ "typescript": "*",
39
+ "vitest": "^1.1.3"
40
+ }
41
+ }