@saasquatch/vanilla-components 1.3.0-2 → 1.4.0-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.
Files changed (92) hide show
  1. package/LICENSE +21 -21
  2. package/dist/cjs/{WidgetHost-d7b870ce.js → WidgetHost-71b013eb.js} +615 -615
  3. package/dist/cjs/loader.cjs.js +1 -1
  4. package/dist/cjs/sqh-close-button.cjs.entry.js +25 -25
  5. package/dist/cjs/sqh-copy-button_12.cjs.entry.js +1015 -1148
  6. package/dist/cjs/sqh-referral-code.cjs.entry.js +22 -22
  7. package/dist/cjs/sqh-rewards-actions.cjs.entry.js +26 -26
  8. package/dist/cjs/widget-components.cjs.js +1 -1
  9. package/dist/collection/components/close-button/close-button.js +68 -67
  10. package/dist/collection/components/copy-button/copy-button.js +380 -332
  11. package/dist/collection/components/copy-link-button/copy-link-button.js +230 -203
  12. package/dist/collection/components/global-container/global-container.js +158 -144
  13. package/dist/collection/components/image-component/image-component.js +175 -153
  14. package/dist/collection/components/partner-stat-component/partner-stat-component.js +196 -173
  15. package/dist/collection/components/referral-code/referral-code.js +36 -33
  16. package/dist/collection/components/referral-component/referral-component.js +255 -254
  17. package/dist/collection/components/referral-list/referral-list.js +911 -818
  18. package/dist/collection/components/rewards-actions/rewards-actions.js +105 -104
  19. package/dist/collection/components/share-button/share-button.js +301 -291
  20. package/dist/collection/components/share-button-container/share-button-container.js +2384 -2194
  21. package/dist/collection/components/stat-component/stat-component.js +196 -173
  22. package/dist/collection/components/stats-container/stats-container.js +210 -197
  23. package/dist/collection/components/text-component/text-component.js +304 -264
  24. package/dist/collection/entrypoint.js +34 -32
  25. package/dist/collection/global/global.js +4 -4
  26. package/dist/collection/services/FormatJs.js +15 -15
  27. package/dist/collection/services/WidgetHost.js +621 -621
  28. package/dist/collection/utilities.js +81 -81
  29. package/dist/esm/{WidgetHost-a27e693d.js → WidgetHost-9c337319.js} +615 -615
  30. package/dist/esm/loader.mjs +1 -1
  31. package/dist/esm/polyfills/core-js.js +0 -0
  32. package/dist/esm/polyfills/dom.js +0 -0
  33. package/dist/esm/polyfills/es5-html-element.js +0 -0
  34. package/dist/esm/polyfills/index.js +0 -0
  35. package/dist/esm/polyfills/system.js +0 -0
  36. package/dist/esm/sqh-close-button.entry.js +25 -25
  37. package/dist/esm/sqh-copy-button_12.entry.js +1015 -1148
  38. package/dist/esm/sqh-referral-code.entry.js +22 -22
  39. package/dist/esm/sqh-rewards-actions.entry.js +26 -26
  40. package/dist/esm/widget-components.mjs +1 -1
  41. package/dist/esm-es5/{WidgetHost-a27e693d.js → WidgetHost-9c337319.js} +9432 -9432
  42. package/dist/esm-es5/_commonjsHelpers-1d681858.js +17 -17
  43. package/dist/esm-es5/css-shim-a659079f.js +122 -122
  44. package/dist/esm-es5/dom-4061ceba.js +468 -468
  45. package/dist/esm-es5/en-be593af0.js +1471 -1471
  46. package/dist/esm-es5/index-8ea8b6d8.js +1758 -1758
  47. package/dist/esm-es5/loader.mjs +11 -11
  48. package/dist/esm-es5/sqh-close-button.entry.js +35 -35
  49. package/dist/esm-es5/sqh-copy-button_12.entry.js +9535 -9657
  50. package/dist/esm-es5/sqh-referral-code.entry.js +29 -29
  51. package/dist/esm-es5/sqh-rewards-actions.entry.js +31 -31
  52. package/dist/esm-es5/widget-components.mjs +6 -6
  53. package/dist/types/components/close-button/close-button.d.ts +16 -15
  54. package/dist/types/components/copy-button/copy-button.d.ts +90 -86
  55. package/dist/types/components/copy-link-button/copy-link-button.d.ts +53 -50
  56. package/dist/types/components/global-container/global-container.d.ts +39 -37
  57. package/dist/types/components/image-component/image-component.d.ts +45 -42
  58. package/dist/types/components/partner-stat-component/partner-stat-component.d.ts +51 -44
  59. package/dist/types/components/referral-code/referral-code.d.ts +12 -9
  60. package/dist/types/components/referral-component/referral-component.d.ts +46 -45
  61. package/dist/types/components/referral-list/referral-list.d.ts +234 -211
  62. package/dist/types/components/rewards-actions/rewards-actions.d.ts +25 -24
  63. package/dist/types/components/share-button/share-button.d.ts +77 -75
  64. package/dist/types/components/share-button-container/share-button-container.d.ts +593 -591
  65. package/dist/types/components/stat-component/stat-component.d.ts +48 -44
  66. package/dist/types/components/stats-container/stats-container.d.ts +47 -41
  67. package/dist/types/components/text-component/text-component.d.ts +74 -73
  68. package/dist/types/components.d.ts +722 -536
  69. package/dist/types/global/global.d.ts +4 -4
  70. package/dist/types/saasquatch.d.ts +105 -103
  71. package/dist/types/services/FormatJs.d.ts +7 -7
  72. package/dist/types/services/WidgetHost.d.ts +45 -45
  73. package/dist/types/utilities.d.ts +7 -7
  74. package/dist/widget-components/entrypoint.js +34 -32
  75. package/dist/widget-components/p-24fc4ba9.js +1 -1
  76. package/dist/widget-components/{p-d4b27c72.entry.js → p-366f1663.entry.js} +1 -1
  77. package/dist/widget-components/p-46109683.js +3 -3
  78. package/dist/widget-components/{p-650d012d.entry.js → p-54ea7a00.entry.js} +1 -1
  79. package/dist/widget-components/p-58be1132.system.js +1 -1
  80. package/dist/widget-components/{p-d7059393.entry.js → p-95fe9766.entry.js} +17 -16
  81. package/dist/widget-components/{p-c0cdba77.system.entry.js → p-b17efca4.system.entry.js} +1 -1
  82. package/dist/widget-components/p-c8bc8c77.system.entry.js +1 -0
  83. package/dist/widget-components/p-d1f56be8.system.entry.js +8 -0
  84. package/dist/widget-components/widget-components.esm.js +1 -1
  85. package/docs/raisins.json +1 -1
  86. package/package.json +97 -94
  87. package/readme.md +52 -52
  88. package/CHANGELOG.md +0 -143
  89. package/dist/widget-components/p-908068c2.system.entry.js +0 -1
  90. package/dist/widget-components/p-fba5ea7f.system.entry.js +0 -8
  91. /package/dist/widget-components/{p-9adc7c50.system.js → p-8e232564.system.js} +0 -0
  92. /package/dist/widget-components/{p-9525bf4a.js → p-edd43dbc.js} +0 -0
@@ -1,621 +1,621 @@
1
- import { ApolloClient } from "apollo-client";
2
- import { HttpLink } from "apollo-link-http";
3
- import { InMemoryCache } from "apollo-cache-inmemory";
4
- import gql from "graphql-tag";
5
- if (!window["widgetIdent"]) {
6
- window["widgetIdent"] = {
7
- env: "demo",
8
- };
9
- }
10
- export function widgetIdent() {
11
- //@ts-ignore
12
- return window.widgetIdent;
13
- }
14
- const today = new Date();
15
- const demoUser = {
16
- shareLink: "http://ssqt.co",
17
- fueltankCode: "12AS3F",
18
- referralcode: "RIDDIKULUS",
19
- locale: "en_US",
20
- messageLink: {
21
- EMAIL: "http://short.staging.referralsaasquatch.com/mJjFXu",
22
- FACEBOOK: "http://short.staging.referralsaasquatch.com/mwjFXu",
23
- TWITTER: "http://short.staging.referralsaasquatch.com/mwjFXu",
24
- SMS: "http://short.staging.referralsaasquatch.com/mwjFXu",
25
- WHATSAPP: "http://short.staging.referralsaasquatch.com/mwjFXu",
26
- LINKEDIN: "http://short.staging.referralsaasquatch.com/mwjFXu",
27
- PINTEREST: "http://short.staging.referralsaasquatch.com/mwjFXu",
28
- FBMESSENGER: "http://short.staging.referralsaasquatch.com/mwjFXu",
29
- },
30
- referrals: {
31
- totalCount: 9,
32
- data: [
33
- {
34
- dateReferralStarted: today.setDate(today.getDate() - 2),
35
- referredUser: { firstName: "Remus", lastName: "Lupin" },
36
- rewards: [
37
- {
38
- prettyValue: "$20.00",
39
- dateExpires: today.setDate(today.getDate() + 4),
40
- statuses: ["EXPIRED"],
41
- meta: { message: "Applied to Invoice #1234" },
42
- },
43
- { prettyValue: "$10.00", statuses: ["AVAILABLE"] },
44
- { prettyValue: "$5.00", statuses: ["AVAILABLE"] },
45
- ],
46
- },
47
- {
48
- dateReferralStarted: today.setDate(today.getDate() - 1),
49
- referredUser: { firstName: "Gellert", lastName: "Grindelwald" },
50
- rewards: [],
51
- },
52
- // Blank string becomes an unknown user, which is editable
53
- {
54
- dateReferralStarted: today.setDate(today.getDate() - 1),
55
- referredUser: { firstName: "", lastName: "" },
56
- rewards: [
57
- {
58
- prettyValue: "$20.00",
59
- dateExpires: today.setDate(today.getDate() - 2),
60
- statuses: ["EXPIRED"],
61
- },
62
- ],
63
- },
64
- {
65
- dateReferralStarted: today.setDate(today.getDate() - 5),
66
- referredUser: { firstName: "Lavender", lastName: "Brown" },
67
- rewards: [{ prettyValue: "$20.00", statuses: ["CANCELLED"] }],
68
- },
69
- {
70
- dateReferralStarted: today.setDate(today.getDate() - 4),
71
- referredUser: { firstName: "Blaise", lastName: "Zabini" },
72
- rewards: [
73
- { prettyValue: "$20.00", statuses: ["AVAILABLE"] },
74
- { prettyValue: "$10.00", statuses: ["AVAILABLE"] },
75
- ],
76
- },
77
- {
78
- dateReferralStarted: today.setDate(today.getDate() - 10),
79
- referredUser: { firstName: "Argus", lastName: "Filch" },
80
- rewards: [],
81
- },
82
- {
83
- dateReferralStarted: today.setDate(today.getDate() - 15),
84
- referredUser: { firstName: "Ron", lastName: "Weasley" },
85
- rewards: [{ prettyValue: "$20.00", statuses: ["AVAILABLE"] }],
86
- },
87
- {
88
- dateReferralStarted: today.setDate(today.getDate() - 2),
89
- referredUser: { firstName: "Hermione", lastName: "Granger" },
90
- rewards: [
91
- { prettyValue: "$20.00", statuses: ["AVAILABLE"] },
92
- { prettyValue: "$10.00", statuses: ["AVAILABLE"] },
93
- { prettyValue: "$5.00", statuses: ["AVAILABLE"] },
94
- { prettyValue: "5%", statuses: ["AVAILABLE"] },
95
- { prettyValue: "5%", statuses: ["AVAILABLE"] },
96
- { prettyValue: "5%", statuses: ["AVAILABLE"] },
97
- ],
98
- },
99
- {
100
- dateConverted: 1606943971468,
101
- dateReferralStarted: 1606943971468,
102
- referredUser: {
103
- imageUrl: "",
104
- firstName: "Seamus",
105
- lastName: "Finnigan",
106
- },
107
- rewards: [],
108
- },
109
- ],
110
- },
111
- referredByReferral: {
112
- dateReferralStarted: today.setDate(today.getDate() - 2),
113
- referrerUser: {
114
- firstName: "Rubeus",
115
- lastName: "Hagrid",
116
- referralCode: "RUBEUSHAGRID12",
117
- },
118
- rewards: [
119
- {
120
- fuelTankCode: "CODE1234",
121
- prettyValue: "$10.00",
122
- statuses: ["AVAILABLE"],
123
- },
124
- ],
125
- },
126
- referralsMonth: { totalCount: 6 },
127
- referralsWeek: { totalCount: 3 },
128
- rewardsCount: { totalCount: 14 },
129
- rewardsMonth: { totalCount: 7 },
130
- rewardsWeek: { totalCount: 4 },
131
- rewardBalancesGlobal: [
132
- {
133
- type: "CREDIT",
134
- unit: "CENTS",
135
- value: 17000,
136
- prettyValue: "$170.00",
137
- totalAssignedCredit: "17000",
138
- totalRedeemedCredit: "1500",
139
- prettyAssignedCredit: "$1000.00",
140
- prettyRedeemedCredit: "$15.00",
141
- },
142
- { type: "PCT_DISCOUNT", unit: "%", value: 15, prettyValue: "15%" },
143
- {
144
- type: "CREDIT",
145
- unit: "CASH/CAD",
146
- count: 3,
147
- totalPendingCredit: 20000,
148
- totalAssignedCredit: 30000,
149
- totalRedeemedCredit: 10000,
150
- totalExpiredCredit: 0,
151
- totalCancelledCredit: 0,
152
- prettyPendingCredit: "$200.00",
153
- prettyAssignedCredit: "$300.00",
154
- prettyRedeemedCredit: "$100.00",
155
- value: 30000,
156
- prettyValue: "$300.00",
157
- },
158
- {
159
- type: "CREDIT",
160
- unit: "CASH/USD",
161
- count: 6,
162
- totalPendingCredit: 25000,
163
- totalAssignedCredit: 40000,
164
- totalRedeemedCredit: 10000,
165
- totalExpiredCredit: 15000,
166
- totalCancelledCredit: 10000,
167
- prettyPendingCredit: "USD250.00",
168
- prettyAssignedCredit: "USD400.00",
169
- prettyRedeemedCredit: "USD150.00",
170
- value: 40000,
171
- prettyValue: "USD400.00",
172
- },
173
- ],
174
- rewardBalances: [
175
- {
176
- type: "CREDIT",
177
- unit: "CENTS",
178
- value: 17000,
179
- prettyValue: "$170.00",
180
- totalAssignedCredit: "17000",
181
- totalRedeemedCredit: "1500",
182
- prettyAssignedCredit: "$170.00",
183
- prettyRedeemedCredit: "$15.00",
184
- },
185
- { type: "PCT_DISCOUNT", unit: "%", value: 15, prettyValue: "15%" },
186
- {
187
- type: "CREDIT",
188
- unit: "CASH/CAD",
189
- count: 3,
190
- totalPendingCredit: 20000,
191
- totalAssignedCredit: 30000,
192
- totalRedeemedCredit: 10000,
193
- totalExpiredCredit: 0,
194
- totalCancelledCredit: 0,
195
- prettyPendingCredit: "$200.00",
196
- prettyAssignedCredit: "$300.00",
197
- prettyRedeemedCredit: "$100.00",
198
- value: 30000,
199
- prettyValue: "$300.00",
200
- },
201
- {
202
- type: "CREDIT",
203
- unit: "CASH/USD",
204
- count: 6,
205
- totalPendingCredit: 25000,
206
- totalAssignedCredit: 40000,
207
- totalRedeemedCredit: 10000,
208
- totalExpiredCredit: 15000,
209
- totalCancelledCredit: 10000,
210
- prettyPendingCredit: "USD250.00",
211
- prettyAssignedCredit: "USD400.00",
212
- prettyRedeemedCredit: "USD150.00",
213
- value: 40000,
214
- prettyValue: "USD400.00",
215
- },
216
- ],
217
- rewardBalanceDetails: [
218
- {
219
- prettyAvailableValue: "$5.00",
220
- },
221
- {
222
- prettyAvailableValue: "18%",
223
- },
224
- ],
225
- };
226
- //@ts-ignore
227
- const squatchJsApi = window.frameElement
228
- ? window.frameElement.squatchJsApi
229
- : {};
230
- const apolloClient = () => {
231
- const { tenantAlias, appDomain, token } = widgetIdent();
232
- const uri = appDomain + "/api/v1/" + tenantAlias + "/graphql";
233
- const headers = {
234
- Authorization: `Bearer ${token}`,
235
- };
236
- const client = new ApolloClient({
237
- link: new HttpLink({ uri, headers }),
238
- cache: new InMemoryCache(),
239
- });
240
- return client;
241
- };
242
- const API = {
243
- version: "Welcome to widget-host",
244
- analytics: {
245
- shareEvent(shareMedium) {
246
- const widgetId = widgetIdent();
247
- if (widgetId["env"] === "demo" || !widgetId)
248
- return Promise.resolve({});
249
- const { userId, accountId, programId = "classic", engagementMedium, } = widgetId;
250
- const variables = {
251
- eventMeta: {
252
- id: userId,
253
- accountId,
254
- programId,
255
- type: "USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",
256
- meta: {
257
- engagementMedium,
258
- shareMedium,
259
- },
260
- },
261
- };
262
- return apolloClient()
263
- .mutate({
264
- mutation: gql `
265
- mutation ($eventMeta: UserAnalyticsEvent!) {
266
- createUserAnalyticsEvent(eventMeta: $eventMeta)
267
- }
268
- `,
269
- variables,
270
- })
271
- .then((result) => {
272
- return result.data.createUserAnalyticsEvent;
273
- });
274
- },
275
- loadEvent() {
276
- return Promise.resolve({ event: "loadEvent" });
277
- },
278
- },
279
- graphql: {
280
- getClient() {
281
- return apolloClient();
282
- },
283
- getUserFragment(userFragment, fragmentVariables) {
284
- const fragment = gql `
285
- fragment UserFragment on User {
286
- ${userFragment}
287
- }`;
288
- const { userId, accountId } = widgetIdent();
289
- const variables = Object.assign(Object.assign({}, fragmentVariables), { userId,
290
- accountId });
291
- return this.getClient().query({
292
- query: gql `
293
- query ($userId: String!, $accountId: String!, $offset: Int) {
294
- user(id: $userId, accountId: $accountId) {
295
- ...UserFragment
296
- }
297
- }
298
- ${fragment}
299
- `,
300
- variables,
301
- });
302
- },
303
- getShareLink() {
304
- const widgetId = widgetIdent();
305
- if (widgetId["env"] === "demo" || !widgetId)
306
- return Promise.resolve(demoUser.shareLink);
307
- const { userId, accountId, programId = null, engagementMedium, } = widgetId;
308
- const variables = {
309
- userId,
310
- accountId,
311
- programId,
312
- engagementMedium,
313
- };
314
- return this.getClient()
315
- .query({
316
- query: gql `
317
- query (
318
- $userId: String!
319
- $accountId: String!
320
- $programId: ID
321
- $engagementMedium: UserEngagementMedium!
322
- ) {
323
- user(id: $userId, accountId: $accountId) {
324
- shareLink(
325
- programId: $programId
326
- engagementMedium: $engagementMedium
327
- shareMedium: DIRECT
328
- useCleanLink: true
329
- )
330
- }
331
- }
332
- `,
333
- variables,
334
- })
335
- .then((res) => res.data.user.shareLink);
336
- },
337
- getReferrals(showReferrer, offset = 0, limit = 3) {
338
- const widgetId = widgetIdent();
339
- if (widgetId["env"] === "demo" || !widgetId) {
340
- const { referrals: refs, referredByReferral, locale } = demoUser;
341
- const referrals = {
342
- totalCount: refs.totalCount,
343
- data: refs.data.slice(offset, offset + limit),
344
- };
345
- const user = { referrals, referredByReferral, locale };
346
- return Promise.resolve(user);
347
- }
348
- const { userId, accountId, programId = null } = widgetId;
349
- const variables = {
350
- limit,
351
- offset,
352
- userId,
353
- accountId,
354
- programId,
355
- programId_exists: programId ? true : false,
356
- };
357
- return this.getClient()
358
- .query({
359
- query: gql `
360
- query (
361
- $userId: String!
362
- $accountId: String!
363
- $offset: Int!
364
- $limit: Int!
365
- $programId: ID
366
- $programId_exists: Boolean!
367
- ) {
368
- user(id: $userId, accountId: $accountId) {
369
- locale
370
- referrals(
371
- limit: $limit
372
- offset: $offset
373
- filter: {
374
- programId_eq: $programId
375
- programId_exists: $programId_exists
376
- }
377
- ) {
378
- totalCount
379
- data {
380
- dateConverted
381
- dateReferralStarted
382
- referredUser {
383
- firstName
384
- lastName
385
- }
386
- rewards(
387
- filter: { userId_eq: $userId, accountId_eq: $accountId }
388
- ) {
389
- prettyValue
390
- dateExpires
391
- statuses
392
- meta {
393
- message
394
- }
395
- }
396
- }
397
- }
398
- ${showReferrer
399
- ? `referredByReferral(programId: $programId) {
400
- referrerUser {
401
- firstName
402
- lastName
403
- }
404
- dateReferralStarted
405
- rewards(
406
- filter: { userId_eq: $userId, accountId_eq: $accountId }
407
- ) {
408
- prettyValue
409
- statuses
410
- }
411
- }`
412
- : ""}
413
- }
414
- }
415
- `,
416
- variables,
417
- })
418
- .then((res) => res.data.user);
419
- },
420
- getStats() {
421
- const widgetId = widgetIdent();
422
- if (widgetId["env"] === "demo" || !widgetId) {
423
- const { referrals: referralsCount, referralsMonth, referralsWeek, rewardsCount, rewardsMonth, rewardsWeek, rewardBalances, rewardBalancesGlobal, } = demoUser;
424
- const user = {
425
- referralsCount,
426
- referralsMonth,
427
- referralsWeek,
428
- rewardsCount,
429
- rewardsMonth,
430
- rewardsWeek,
431
- rewardBalances,
432
- rewardBalancesGlobal,
433
- };
434
- return Promise.resolve(user);
435
- }
436
- const { userId, accountId, programId = null } = widgetId;
437
- const variables = {
438
- userId,
439
- accountId,
440
- programId,
441
- programId_exists: programId ? true : false,
442
- };
443
- return this.getClient()
444
- .query({
445
- query: gql `
446
- query (
447
- $userId: String!
448
- $accountId: String!
449
- $programId: ID
450
- $programId_exists: Boolean!
451
- ) {
452
- user(id: $userId, accountId: $accountId) {
453
- referralsCount: referrals(
454
- filter: {
455
- programId_eq: $programId
456
- programId_exists: $programId_exists
457
- }
458
- ) {
459
- totalCount
460
- }
461
- referralsMonth: referrals(
462
- filter: {
463
- programId_eq: $programId
464
- programId_exists: $programId_exists
465
- dateReferralStarted_timeframe: "this_month"
466
- }
467
- ) {
468
- totalCount
469
- }
470
- referralsWeek: referrals(
471
- filter: {
472
- programId_eq: $programId
473
- programId_exists: $programId_exists
474
- dateReferralStarted_timeframe: "this_week"
475
- }
476
- ) {
477
- totalCount
478
- }
479
- rewardsCount: rewards(
480
- filter: {
481
- programId_eq: $programId
482
- programId_exists: $programId_exists
483
- }
484
- ) {
485
- totalCount
486
- }
487
- rewardsMonth: rewards(
488
- filter: {
489
- programId_eq: $programId
490
- programId_exists: $programId_exists
491
- dateGiven_timeframe: "this_month"
492
- }
493
- ) {
494
- totalCount
495
- }
496
- rewardsWeek: rewards(
497
- filter: {
498
- programId_eq: $programId
499
- programId_exists: $programId_exists
500
- dateGiven_timeframe: "this_week"
501
- }
502
- ) {
503
- totalCount
504
- }
505
- rewardBalances(programId: $programId)
506
- rewardBalancesGlobal: rewardBalances
507
- }
508
- }
509
- `,
510
- variables,
511
- })
512
- .then((res) => res.data.user);
513
- },
514
- async getReferralCode() {
515
- const widgetId = widgetIdent();
516
- if (widgetId["env"] === "demo" || !widgetId)
517
- return demoUser.referralcode;
518
- const { userId, accountId, programId } = widgetId;
519
- const variables = {
520
- userId,
521
- accountId,
522
- programId,
523
- };
524
- return this.getClient()
525
- .query({
526
- query: gql `
527
- query ($userId: String!, $accountId: String!, $programId: ID!) {
528
- user(id: $userId, accountId: $accountId) {
529
- referralCode(programId: $programId)
530
- }
531
- }
532
- `,
533
- variables,
534
- })
535
- .then((res) => res.data.user.referralCode);
536
- },
537
- async getFueltankCode(rewardKey) {
538
- const widgetId = widgetIdent();
539
- if (widgetId["env"] === "demo" || !widgetId) {
540
- return {
541
- referredByReferral: demoUser.referredByReferral,
542
- rewards: { data: demoUser.referredByReferral.rewards },
543
- };
544
- }
545
- const { userId, accountId, programId } = widgetId;
546
- const variables = {
547
- userId,
548
- accountId,
549
- programId,
550
- rewardKey,
551
- };
552
- return this.getClient()
553
- .query({
554
- query: gql `
555
- query (
556
- $userId: String!
557
- $accountId: String!
558
- $programId: ID!
559
- $rewardKey: String!
560
- ) {
561
- user(id: $userId, accountId: $accountId) {
562
- referredByReferral(programId: $programId) {
563
- referrerUser {
564
- referralCode(programId: $programId)
565
- }
566
- }
567
- rewards(
568
- filter: {
569
- programId_eq: $programId
570
- programRewardKey_eq: $rewardKey
571
- }
572
- ) {
573
- count
574
- totalCount
575
- data {
576
- fuelTankCode
577
- }
578
- }
579
- }
580
- }
581
- `,
582
- variables,
583
- })
584
- .then((res) => res.data.user);
585
- },
586
- getMessageLinks(mediums) {
587
- const widgetId = widgetIdent();
588
- if (widgetId["env"] === "demo" || !widgetId)
589
- return Promise.resolve(demoUser.messageLink);
590
- const { userId, accountId, programId = null, engagementMedium, } = widgetId;
591
- const variables = {
592
- userId,
593
- accountId,
594
- programId,
595
- engagementMedium,
596
- };
597
- return this.getClient()
598
- .query({
599
- query: gql `
600
- query($userId: String!, $accountId: String!, $programId: ID, $engagementMedium: UserEngagementMedium!) {
601
- user(id: $userId, accountId: $accountId) {
602
- ${mediums[0]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[0]})
603
- ${mediums[1]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[1]})
604
- ${mediums[2]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[2]})
605
- ${mediums[3]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[3]})
606
- ${mediums[4]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[4]})
607
- ${mediums[5]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[5]})
608
- ${mediums[6]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[6]})
609
- ${mediums[7]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[7]})
610
- ${mediums[8]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[8]})
611
- }
612
- }
613
- `,
614
- variables,
615
- })
616
- .then((res) => res.data.user);
617
- },
618
- },
619
- ui: squatchJsApi,
620
- };
621
- export { API };
1
+ import { ApolloClient } from "apollo-client";
2
+ import { HttpLink } from "apollo-link-http";
3
+ import { InMemoryCache } from "apollo-cache-inmemory";
4
+ import gql from "graphql-tag";
5
+ if (!window["widgetIdent"]) {
6
+ window["widgetIdent"] = {
7
+ env: "demo",
8
+ };
9
+ }
10
+ export function widgetIdent() {
11
+ //@ts-ignore
12
+ return window.widgetIdent;
13
+ }
14
+ const today = new Date();
15
+ const demoUser = {
16
+ shareLink: "http://ssqt.co",
17
+ fueltankCode: "12AS3F",
18
+ referralcode: "RIDDIKULUS",
19
+ locale: "en_US",
20
+ messageLink: {
21
+ EMAIL: "http://short.staging.referralsaasquatch.com/mJjFXu",
22
+ FACEBOOK: "http://short.staging.referralsaasquatch.com/mwjFXu",
23
+ TWITTER: "http://short.staging.referralsaasquatch.com/mwjFXu",
24
+ SMS: "http://short.staging.referralsaasquatch.com/mwjFXu",
25
+ WHATSAPP: "http://short.staging.referralsaasquatch.com/mwjFXu",
26
+ LINKEDIN: "http://short.staging.referralsaasquatch.com/mwjFXu",
27
+ PINTEREST: "http://short.staging.referralsaasquatch.com/mwjFXu",
28
+ FBMESSENGER: "http://short.staging.referralsaasquatch.com/mwjFXu",
29
+ },
30
+ referrals: {
31
+ totalCount: 9,
32
+ data: [
33
+ {
34
+ dateReferralStarted: today.setDate(today.getDate() - 2),
35
+ referredUser: { firstName: "Remus", lastName: "Lupin" },
36
+ rewards: [
37
+ {
38
+ prettyValue: "$20.00",
39
+ dateExpires: today.setDate(today.getDate() + 4),
40
+ statuses: ["EXPIRED"],
41
+ meta: { message: "Applied to Invoice #1234" },
42
+ },
43
+ { prettyValue: "$10.00", statuses: ["AVAILABLE"] },
44
+ { prettyValue: "$5.00", statuses: ["AVAILABLE"] },
45
+ ],
46
+ },
47
+ {
48
+ dateReferralStarted: today.setDate(today.getDate() - 1),
49
+ referredUser: { firstName: "Gellert", lastName: "Grindelwald" },
50
+ rewards: [],
51
+ },
52
+ // Blank string becomes an unknown user, which is editable
53
+ {
54
+ dateReferralStarted: today.setDate(today.getDate() - 1),
55
+ referredUser: { firstName: "", lastName: "" },
56
+ rewards: [
57
+ {
58
+ prettyValue: "$20.00",
59
+ dateExpires: today.setDate(today.getDate() - 2),
60
+ statuses: ["EXPIRED"],
61
+ },
62
+ ],
63
+ },
64
+ {
65
+ dateReferralStarted: today.setDate(today.getDate() - 5),
66
+ referredUser: { firstName: "Lavender", lastName: "Brown" },
67
+ rewards: [{ prettyValue: "$20.00", statuses: ["CANCELLED"] }],
68
+ },
69
+ {
70
+ dateReferralStarted: today.setDate(today.getDate() - 4),
71
+ referredUser: { firstName: "Blaise", lastName: "Zabini" },
72
+ rewards: [
73
+ { prettyValue: "$20.00", statuses: ["AVAILABLE"] },
74
+ { prettyValue: "$10.00", statuses: ["AVAILABLE"] },
75
+ ],
76
+ },
77
+ {
78
+ dateReferralStarted: today.setDate(today.getDate() - 10),
79
+ referredUser: { firstName: "Argus", lastName: "Filch" },
80
+ rewards: [],
81
+ },
82
+ {
83
+ dateReferralStarted: today.setDate(today.getDate() - 15),
84
+ referredUser: { firstName: "Ron", lastName: "Weasley" },
85
+ rewards: [{ prettyValue: "$20.00", statuses: ["AVAILABLE"] }],
86
+ },
87
+ {
88
+ dateReferralStarted: today.setDate(today.getDate() - 2),
89
+ referredUser: { firstName: "Hermione", lastName: "Granger" },
90
+ rewards: [
91
+ { prettyValue: "$20.00", statuses: ["AVAILABLE"] },
92
+ { prettyValue: "$10.00", statuses: ["AVAILABLE"] },
93
+ { prettyValue: "$5.00", statuses: ["AVAILABLE"] },
94
+ { prettyValue: "5%", statuses: ["AVAILABLE"] },
95
+ { prettyValue: "5%", statuses: ["AVAILABLE"] },
96
+ { prettyValue: "5%", statuses: ["AVAILABLE"] },
97
+ ],
98
+ },
99
+ {
100
+ dateConverted: 1606943971468,
101
+ dateReferralStarted: 1606943971468,
102
+ referredUser: {
103
+ imageUrl: "",
104
+ firstName: "Seamus",
105
+ lastName: "Finnigan",
106
+ },
107
+ rewards: [],
108
+ },
109
+ ],
110
+ },
111
+ referredByReferral: {
112
+ dateReferralStarted: today.setDate(today.getDate() - 2),
113
+ referrerUser: {
114
+ firstName: "Rubeus",
115
+ lastName: "Hagrid",
116
+ referralCode: "RUBEUSHAGRID12",
117
+ },
118
+ rewards: [
119
+ {
120
+ fuelTankCode: "CODE1234",
121
+ prettyValue: "$10.00",
122
+ statuses: ["AVAILABLE"],
123
+ },
124
+ ],
125
+ },
126
+ referralsMonth: { totalCount: 6 },
127
+ referralsWeek: { totalCount: 3 },
128
+ rewardsCount: { totalCount: 14 },
129
+ rewardsMonth: { totalCount: 7 },
130
+ rewardsWeek: { totalCount: 4 },
131
+ rewardBalancesGlobal: [
132
+ {
133
+ type: "CREDIT",
134
+ unit: "CENTS",
135
+ value: 17000,
136
+ prettyValue: "$170.00",
137
+ totalAssignedCredit: "17000",
138
+ totalRedeemedCredit: "1500",
139
+ prettyAssignedCredit: "$1000.00",
140
+ prettyRedeemedCredit: "$15.00",
141
+ },
142
+ { type: "PCT_DISCOUNT", unit: "%", value: 15, prettyValue: "15%" },
143
+ {
144
+ type: "CREDIT",
145
+ unit: "CASH/CAD",
146
+ count: 3,
147
+ totalPendingCredit: 20000,
148
+ totalAssignedCredit: 30000,
149
+ totalRedeemedCredit: 10000,
150
+ totalExpiredCredit: 0,
151
+ totalCancelledCredit: 0,
152
+ prettyPendingCredit: "$200.00",
153
+ prettyAssignedCredit: "$300.00",
154
+ prettyRedeemedCredit: "$100.00",
155
+ value: 30000,
156
+ prettyValue: "$300.00",
157
+ },
158
+ {
159
+ type: "CREDIT",
160
+ unit: "CASH/USD",
161
+ count: 6,
162
+ totalPendingCredit: 25000,
163
+ totalAssignedCredit: 40000,
164
+ totalRedeemedCredit: 10000,
165
+ totalExpiredCredit: 15000,
166
+ totalCancelledCredit: 10000,
167
+ prettyPendingCredit: "USD250.00",
168
+ prettyAssignedCredit: "USD400.00",
169
+ prettyRedeemedCredit: "USD150.00",
170
+ value: 40000,
171
+ prettyValue: "USD400.00",
172
+ },
173
+ ],
174
+ rewardBalances: [
175
+ {
176
+ type: "CREDIT",
177
+ unit: "CENTS",
178
+ value: 17000,
179
+ prettyValue: "$170.00",
180
+ totalAssignedCredit: "17000",
181
+ totalRedeemedCredit: "1500",
182
+ prettyAssignedCredit: "$170.00",
183
+ prettyRedeemedCredit: "$15.00",
184
+ },
185
+ { type: "PCT_DISCOUNT", unit: "%", value: 15, prettyValue: "15%" },
186
+ {
187
+ type: "CREDIT",
188
+ unit: "CASH/CAD",
189
+ count: 3,
190
+ totalPendingCredit: 20000,
191
+ totalAssignedCredit: 30000,
192
+ totalRedeemedCredit: 10000,
193
+ totalExpiredCredit: 0,
194
+ totalCancelledCredit: 0,
195
+ prettyPendingCredit: "$200.00",
196
+ prettyAssignedCredit: "$300.00",
197
+ prettyRedeemedCredit: "$100.00",
198
+ value: 30000,
199
+ prettyValue: "$300.00",
200
+ },
201
+ {
202
+ type: "CREDIT",
203
+ unit: "CASH/USD",
204
+ count: 6,
205
+ totalPendingCredit: 25000,
206
+ totalAssignedCredit: 40000,
207
+ totalRedeemedCredit: 10000,
208
+ totalExpiredCredit: 15000,
209
+ totalCancelledCredit: 10000,
210
+ prettyPendingCredit: "USD250.00",
211
+ prettyAssignedCredit: "USD400.00",
212
+ prettyRedeemedCredit: "USD150.00",
213
+ value: 40000,
214
+ prettyValue: "USD400.00",
215
+ },
216
+ ],
217
+ rewardBalanceDetails: [
218
+ {
219
+ prettyAvailableValue: "$5.00",
220
+ },
221
+ {
222
+ prettyAvailableValue: "18%",
223
+ },
224
+ ],
225
+ };
226
+ //@ts-ignore
227
+ const squatchJsApi = window.frameElement
228
+ ? window.frameElement.squatchJsApi
229
+ : {};
230
+ const apolloClient = () => {
231
+ const { tenantAlias, appDomain, token } = widgetIdent();
232
+ const uri = appDomain + "/api/v1/" + tenantAlias + "/graphql";
233
+ const headers = {
234
+ Authorization: `Bearer ${token}`,
235
+ };
236
+ const client = new ApolloClient({
237
+ link: new HttpLink({ uri, headers }),
238
+ cache: new InMemoryCache(),
239
+ });
240
+ return client;
241
+ };
242
+ const API = {
243
+ version: "Welcome to widget-host",
244
+ analytics: {
245
+ shareEvent(shareMedium) {
246
+ const widgetId = widgetIdent();
247
+ if (widgetId["env"] === "demo" || !widgetId)
248
+ return Promise.resolve({});
249
+ const { userId, accountId, programId = "classic", engagementMedium, } = widgetId;
250
+ const variables = {
251
+ eventMeta: {
252
+ id: userId,
253
+ accountId,
254
+ programId,
255
+ type: "USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",
256
+ meta: {
257
+ engagementMedium,
258
+ shareMedium,
259
+ },
260
+ },
261
+ };
262
+ return apolloClient()
263
+ .mutate({
264
+ mutation: gql `
265
+ mutation ($eventMeta: UserAnalyticsEvent!) {
266
+ createUserAnalyticsEvent(eventMeta: $eventMeta)
267
+ }
268
+ `,
269
+ variables,
270
+ })
271
+ .then((result) => {
272
+ return result.data.createUserAnalyticsEvent;
273
+ });
274
+ },
275
+ loadEvent() {
276
+ return Promise.resolve({ event: "loadEvent" });
277
+ },
278
+ },
279
+ graphql: {
280
+ getClient() {
281
+ return apolloClient();
282
+ },
283
+ getUserFragment(userFragment, fragmentVariables) {
284
+ const fragment = gql `
285
+ fragment UserFragment on User {
286
+ ${userFragment}
287
+ }`;
288
+ const { userId, accountId } = widgetIdent();
289
+ const variables = Object.assign(Object.assign({}, fragmentVariables), { userId,
290
+ accountId });
291
+ return this.getClient().query({
292
+ query: gql `
293
+ query ($userId: String!, $accountId: String!, $offset: Int) {
294
+ user(id: $userId, accountId: $accountId) {
295
+ ...UserFragment
296
+ }
297
+ }
298
+ ${fragment}
299
+ `,
300
+ variables,
301
+ });
302
+ },
303
+ getShareLink() {
304
+ const widgetId = widgetIdent();
305
+ if (widgetId["env"] === "demo" || !widgetId)
306
+ return Promise.resolve(demoUser.shareLink);
307
+ const { userId, accountId, programId = null, engagementMedium, } = widgetId;
308
+ const variables = {
309
+ userId,
310
+ accountId,
311
+ programId,
312
+ engagementMedium,
313
+ };
314
+ return this.getClient()
315
+ .query({
316
+ query: gql `
317
+ query (
318
+ $userId: String!
319
+ $accountId: String!
320
+ $programId: ID
321
+ $engagementMedium: UserEngagementMedium!
322
+ ) {
323
+ user(id: $userId, accountId: $accountId) {
324
+ shareLink(
325
+ programId: $programId
326
+ engagementMedium: $engagementMedium
327
+ shareMedium: DIRECT
328
+ useCleanLink: true
329
+ )
330
+ }
331
+ }
332
+ `,
333
+ variables,
334
+ })
335
+ .then((res) => res.data.user.shareLink);
336
+ },
337
+ getReferrals(showReferrer, offset = 0, limit = 3) {
338
+ const widgetId = widgetIdent();
339
+ if (widgetId["env"] === "demo" || !widgetId) {
340
+ const { referrals: refs, referredByReferral, locale } = demoUser;
341
+ const referrals = {
342
+ totalCount: refs.totalCount,
343
+ data: refs.data.slice(offset, offset + limit),
344
+ };
345
+ const user = { referrals, referredByReferral, locale };
346
+ return Promise.resolve(user);
347
+ }
348
+ const { userId, accountId, programId = null } = widgetId;
349
+ const variables = {
350
+ limit,
351
+ offset,
352
+ userId,
353
+ accountId,
354
+ programId,
355
+ programId_exists: programId ? true : false,
356
+ };
357
+ return this.getClient()
358
+ .query({
359
+ query: gql `
360
+ query (
361
+ $userId: String!
362
+ $accountId: String!
363
+ $offset: Int!
364
+ $limit: Int!
365
+ $programId: ID
366
+ $programId_exists: Boolean!
367
+ ) {
368
+ user(id: $userId, accountId: $accountId) {
369
+ locale
370
+ referrals(
371
+ limit: $limit
372
+ offset: $offset
373
+ filter: {
374
+ programId_eq: $programId
375
+ programId_exists: $programId_exists
376
+ }
377
+ ) {
378
+ totalCount
379
+ data {
380
+ dateConverted
381
+ dateReferralStarted
382
+ referredUser {
383
+ firstName
384
+ lastName
385
+ }
386
+ rewards(
387
+ filter: { userId_eq: $userId, accountId_eq: $accountId }
388
+ ) {
389
+ prettyValue
390
+ dateExpires
391
+ statuses
392
+ meta {
393
+ message
394
+ }
395
+ }
396
+ }
397
+ }
398
+ ${showReferrer
399
+ ? `referredByReferral(programId: $programId) {
400
+ referrerUser {
401
+ firstName
402
+ lastName
403
+ }
404
+ dateReferralStarted
405
+ rewards(
406
+ filter: { userId_eq: $userId, accountId_eq: $accountId }
407
+ ) {
408
+ prettyValue
409
+ statuses
410
+ }
411
+ }`
412
+ : ""}
413
+ }
414
+ }
415
+ `,
416
+ variables,
417
+ })
418
+ .then((res) => res.data.user);
419
+ },
420
+ getStats() {
421
+ const widgetId = widgetIdent();
422
+ if (widgetId["env"] === "demo" || !widgetId) {
423
+ const { referrals: referralsCount, referralsMonth, referralsWeek, rewardsCount, rewardsMonth, rewardsWeek, rewardBalances, rewardBalancesGlobal, } = demoUser;
424
+ const user = {
425
+ referralsCount,
426
+ referralsMonth,
427
+ referralsWeek,
428
+ rewardsCount,
429
+ rewardsMonth,
430
+ rewardsWeek,
431
+ rewardBalances,
432
+ rewardBalancesGlobal,
433
+ };
434
+ return Promise.resolve(user);
435
+ }
436
+ const { userId, accountId, programId = null } = widgetId;
437
+ const variables = {
438
+ userId,
439
+ accountId,
440
+ programId,
441
+ programId_exists: programId ? true : false,
442
+ };
443
+ return this.getClient()
444
+ .query({
445
+ query: gql `
446
+ query (
447
+ $userId: String!
448
+ $accountId: String!
449
+ $programId: ID
450
+ $programId_exists: Boolean!
451
+ ) {
452
+ user(id: $userId, accountId: $accountId) {
453
+ referralsCount: referrals(
454
+ filter: {
455
+ programId_eq: $programId
456
+ programId_exists: $programId_exists
457
+ }
458
+ ) {
459
+ totalCount
460
+ }
461
+ referralsMonth: referrals(
462
+ filter: {
463
+ programId_eq: $programId
464
+ programId_exists: $programId_exists
465
+ dateReferralStarted_timeframe: "this_month"
466
+ }
467
+ ) {
468
+ totalCount
469
+ }
470
+ referralsWeek: referrals(
471
+ filter: {
472
+ programId_eq: $programId
473
+ programId_exists: $programId_exists
474
+ dateReferralStarted_timeframe: "this_week"
475
+ }
476
+ ) {
477
+ totalCount
478
+ }
479
+ rewardsCount: rewards(
480
+ filter: {
481
+ programId_eq: $programId
482
+ programId_exists: $programId_exists
483
+ }
484
+ ) {
485
+ totalCount
486
+ }
487
+ rewardsMonth: rewards(
488
+ filter: {
489
+ programId_eq: $programId
490
+ programId_exists: $programId_exists
491
+ dateGiven_timeframe: "this_month"
492
+ }
493
+ ) {
494
+ totalCount
495
+ }
496
+ rewardsWeek: rewards(
497
+ filter: {
498
+ programId_eq: $programId
499
+ programId_exists: $programId_exists
500
+ dateGiven_timeframe: "this_week"
501
+ }
502
+ ) {
503
+ totalCount
504
+ }
505
+ rewardBalances(programId: $programId)
506
+ rewardBalancesGlobal: rewardBalances
507
+ }
508
+ }
509
+ `,
510
+ variables,
511
+ })
512
+ .then((res) => res.data.user);
513
+ },
514
+ async getReferralCode() {
515
+ const widgetId = widgetIdent();
516
+ if (widgetId["env"] === "demo" || !widgetId)
517
+ return demoUser.referralcode;
518
+ const { userId, accountId, programId } = widgetId;
519
+ const variables = {
520
+ userId,
521
+ accountId,
522
+ programId,
523
+ };
524
+ return this.getClient()
525
+ .query({
526
+ query: gql `
527
+ query ($userId: String!, $accountId: String!, $programId: ID!) {
528
+ user(id: $userId, accountId: $accountId) {
529
+ referralCode(programId: $programId)
530
+ }
531
+ }
532
+ `,
533
+ variables,
534
+ })
535
+ .then((res) => res.data.user.referralCode);
536
+ },
537
+ async getFueltankCode(rewardKey) {
538
+ const widgetId = widgetIdent();
539
+ if (widgetId["env"] === "demo" || !widgetId) {
540
+ return {
541
+ referredByReferral: demoUser.referredByReferral,
542
+ rewards: { data: demoUser.referredByReferral.rewards },
543
+ };
544
+ }
545
+ const { userId, accountId, programId } = widgetId;
546
+ const variables = {
547
+ userId,
548
+ accountId,
549
+ programId,
550
+ rewardKey,
551
+ };
552
+ return this.getClient()
553
+ .query({
554
+ query: gql `
555
+ query (
556
+ $userId: String!
557
+ $accountId: String!
558
+ $programId: ID!
559
+ $rewardKey: String!
560
+ ) {
561
+ user(id: $userId, accountId: $accountId) {
562
+ referredByReferral(programId: $programId) {
563
+ referrerUser {
564
+ referralCode(programId: $programId)
565
+ }
566
+ }
567
+ rewards(
568
+ filter: {
569
+ programId_eq: $programId
570
+ programRewardKey_eq: $rewardKey
571
+ }
572
+ ) {
573
+ count
574
+ totalCount
575
+ data {
576
+ fuelTankCode
577
+ }
578
+ }
579
+ }
580
+ }
581
+ `,
582
+ variables,
583
+ })
584
+ .then((res) => res.data.user);
585
+ },
586
+ getMessageLinks(mediums) {
587
+ const widgetId = widgetIdent();
588
+ if (widgetId["env"] === "demo" || !widgetId)
589
+ return Promise.resolve(demoUser.messageLink);
590
+ const { userId, accountId, programId = null, engagementMedium, } = widgetId;
591
+ const variables = {
592
+ userId,
593
+ accountId,
594
+ programId,
595
+ engagementMedium,
596
+ };
597
+ return this.getClient()
598
+ .query({
599
+ query: gql `
600
+ query($userId: String!, $accountId: String!, $programId: ID, $engagementMedium: UserEngagementMedium!) {
601
+ user(id: $userId, accountId: $accountId) {
602
+ ${mediums[0]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[0]})
603
+ ${mediums[1]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[1]})
604
+ ${mediums[2]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[2]})
605
+ ${mediums[3]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[3]})
606
+ ${mediums[4]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[4]})
607
+ ${mediums[5]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[5]})
608
+ ${mediums[6]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[6]})
609
+ ${mediums[7]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[7]})
610
+ ${mediums[8]}:messageLink(programId: $programId, engagementMedium: $engagementMedium, shareMedium: ${mediums[8]})
611
+ }
612
+ }
613
+ `,
614
+ variables,
615
+ })
616
+ .then((res) => res.data.user);
617
+ },
618
+ },
619
+ ui: squatchJsApi,
620
+ };
621
+ export { API };