@saasquatch/mint-components 1.5.0-0 → 1.5.0-4

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 (93) hide show
  1. package/dist/cjs/loader.cjs.js +1 -1
  2. package/dist/cjs/mint-components.cjs.js +1 -1
  3. package/dist/cjs/{sqm-divided-layout_30.cjs.entry.js → sqm-brand_31.cjs.entry.js} +27134 -26654
  4. package/dist/cjs/sqm-program-explainer-step-view-74863815.js +70 -0
  5. package/dist/cjs/sqm-program-explainer-step.cjs.entry.js +22 -0
  6. package/dist/cjs/sqm-program-explainer-view-afed92f5.js +45 -0
  7. package/dist/cjs/sqm-program-explainer.cjs.entry.js +23 -0
  8. package/dist/cjs/sqm-share-code.cjs.entry.js +19 -0
  9. package/dist/collection/collection-manifest.json +3 -0
  10. package/dist/collection/components/sqm-brand/SqmBrand.stories.js +93 -0
  11. package/dist/collection/components/sqm-brand/sqm-brand.js +97 -0
  12. package/dist/collection/components/sqm-program-explainer/ProgramExplainer.stories.js +49 -0
  13. package/dist/collection/components/sqm-program-explainer/sqm-program-explainer-view.js +41 -0
  14. package/dist/collection/components/sqm-program-explainer/sqm-program-explainer.js +131 -0
  15. package/dist/collection/components/sqm-program-explainer-step/ProgramExplainerStep.stories.js +22 -0
  16. package/dist/collection/components/sqm-program-explainer-step/sqm-program-explainer-step-view.js +66 -0
  17. package/dist/collection/components/sqm-program-explainer-step/sqm-program-explainer-step.js +123 -0
  18. package/dist/collection/components/sqm-reward-exchange-list/RewardExchangeList.stories.js +5 -3
  19. package/dist/collection/components/sqm-reward-exchange-list/RewardExchangeListData.js +38 -19
  20. package/dist/collection/components/sqm-reward-exchange-list/SVGs.js +3 -0
  21. package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.js +142 -102
  22. package/dist/collection/components/sqm-reward-exchange-list/sqm-reward-exchange-list.js +349 -3
  23. package/dist/collection/components/sqm-reward-exchange-list/useRewardExchangeList.js +28 -4
  24. package/dist/collection/components/sqm-rewards-table/useRewardsTable.js +0 -1
  25. package/dist/collection/components/sqm-share-code/useShareCode.js +20 -1
  26. package/dist/collection/components/sqm-share-link/useShareLink.js +20 -1
  27. package/dist/collection/components/sqm-stencilbook/AutoColor.js +32 -4
  28. package/dist/collection/components/sqm-stencilbook/Themes.js +14 -0
  29. package/dist/collection/components/sqm-stencilbook/sqm-stencilbook.js +6 -0
  30. package/dist/collection/components/sqm-task-card/TaskCard.stories.js +26 -18
  31. package/dist/collection/components/sqm-task-card/progress-bar/progress-bar-view.js +37 -0
  32. package/dist/collection/components/sqm-task-card/sqm-task-card-view.js +8 -6
  33. package/dist/collection/components/sqm-task-card/sqm-task-card.js +5 -6
  34. package/dist/collection/fonts/GoogleFonts.js +12 -0
  35. package/dist/esm/loader.js +1 -1
  36. package/dist/esm/mint-components.js +1 -1
  37. package/dist/esm/{sqm-divided-layout_30.entry.js → sqm-brand_31.entry.js} +27128 -26649
  38. package/dist/esm/sqm-program-explainer-step-view-f190277a.js +68 -0
  39. package/dist/esm/sqm-program-explainer-step.entry.js +18 -0
  40. package/dist/esm/sqm-program-explainer-view-1c603bb7.js +43 -0
  41. package/dist/esm/sqm-program-explainer.entry.js +19 -0
  42. package/dist/esm/sqm-share-code.entry.js +20 -1
  43. package/dist/esm-es5/loader.js +1 -1
  44. package/dist/esm-es5/mint-components.js +1 -1
  45. package/dist/esm-es5/sqm-brand_31.entry.js +58 -0
  46. package/dist/esm-es5/sqm-program-explainer-step-view-f190277a.js +1 -0
  47. package/dist/esm-es5/sqm-program-explainer-step.entry.js +1 -0
  48. package/dist/esm-es5/sqm-program-explainer-view-1c603bb7.js +1 -0
  49. package/dist/esm-es5/sqm-program-explainer.entry.js +1 -0
  50. package/dist/esm-es5/sqm-share-code.entry.js +1 -1
  51. package/dist/mint-components/mint-components.esm.js +1 -1
  52. package/dist/mint-components/mint-components.js +1 -1
  53. package/dist/mint-components/p-16f5a7cb.system.js +1 -1
  54. package/dist/mint-components/p-2d6421b6.system.js +1 -0
  55. package/dist/mint-components/p-3b6228f4.system.js +1 -0
  56. package/dist/mint-components/p-49cbd0a2.entry.js +13 -0
  57. package/dist/mint-components/p-5f4d838e.system.entry.js +58 -0
  58. package/dist/mint-components/p-6c9c4477.js +1 -0
  59. package/dist/mint-components/p-84dc4854.entry.js +397 -0
  60. package/dist/mint-components/p-96a1967b.entry.js +1 -0
  61. package/dist/mint-components/p-9e4e397a.system.entry.js +1 -0
  62. package/dist/mint-components/p-bc8b6125.js +1 -0
  63. package/dist/mint-components/p-bf1b79ba.entry.js +1 -0
  64. package/dist/mint-components/p-c3f91add.system.entry.js +1 -0
  65. package/dist/mint-components/p-e6d77d20.system.entry.js +1 -0
  66. package/dist/types/components/sqm-brand/SqmBrand.stories.d.ts +7 -0
  67. package/dist/types/components/sqm-brand/sqm-brand.d.ts +23 -0
  68. package/dist/types/components/sqm-program-explainer/ProgramExplainer.stories.d.ts +7 -0
  69. package/dist/types/components/sqm-program-explainer/sqm-program-explainer-view.d.ts +9 -0
  70. package/dist/types/components/sqm-program-explainer/sqm-program-explainer.d.ts +31 -0
  71. package/dist/types/components/sqm-program-explainer-step/ProgramExplainerStep.stories.d.ts +5 -0
  72. package/dist/types/components/sqm-program-explainer-step/sqm-program-explainer-step-view.d.ts +8 -0
  73. package/dist/types/components/sqm-program-explainer-step/sqm-program-explainer-step.d.ts +29 -0
  74. package/dist/types/components/sqm-reward-exchange-list/RewardExchangeList.stories.d.ts +2 -0
  75. package/dist/types/components/sqm-reward-exchange-list/RewardExchangeListData.d.ts +85 -0
  76. package/dist/types/components/sqm-reward-exchange-list/SVGs.d.ts +1 -0
  77. package/dist/types/components/sqm-reward-exchange-list/sqm-reward-exchange-list-view.d.ts +3 -0
  78. package/dist/types/components/sqm-reward-exchange-list/sqm-reward-exchange-list.d.ts +53 -0
  79. package/dist/types/components/sqm-reward-exchange-list/useRewardExchangeList.d.ts +17 -0
  80. package/dist/types/components/sqm-stencilbook/AutoColor.d.ts +15 -0
  81. package/dist/types/components/sqm-stencilbook/Themes.d.ts +1 -0
  82. package/dist/types/components/sqm-task-card/TaskCard.stories.d.ts +1 -0
  83. package/dist/types/components/sqm-task-card/sqm-task-card-view.d.ts +1 -1
  84. package/dist/types/components/sqm-task-card/sqm-task-card.d.ts +1 -1
  85. package/dist/types/components.d.ts +253 -2
  86. package/dist/types/fonts/GoogleFonts.d.ts +9 -0
  87. package/grapesjs/grapesjs.js +1 -1
  88. package/package.json +2 -2
  89. package/dist/esm-es5/sqm-divided-layout_30.entry.js +0 -58
  90. package/dist/mint-components/p-55508395.system.entry.js +0 -1
  91. package/dist/mint-components/p-925ccb31.system.entry.js +0 -58
  92. package/dist/mint-components/p-cd410a05.entry.js +0 -9
  93. package/dist/mint-components/p-fdb484a0.entry.js +0 -392
@@ -18,7 +18,60 @@ export class SqmRewardExchangeList {
18
18
  /**
19
19
  * @uiName Exchange button text
20
20
  */
21
- this.notAvailableError = "{unavailableReason, select, US_TAX {US Tax limit} INSUFFICIENT_REDEEMABLE_CREDIT {Not enough points} other {Not available} }";
21
+ this.notAvailableError = "{unavailableReason, select, US_TAX {US Tax limit} INSUFFICIENT_REDEEMABLE_CREDIT {{sourceValue} required} other {Not available} }";
22
+ /**
23
+ * @uiName Choose Reward Progress Title
24
+ */
25
+ this.chooseRewardTitle = "Choose reward";
26
+ /**
27
+ * @uiName Choose Amount Progress Title
28
+ */
29
+ this.chooseAmountTitle = "Amount";
30
+ /**
31
+ * @uiName Confirmation Progress Title
32
+ */
33
+ this.confirmationTitle = "Confirm";
34
+ /**
35
+ * @uiName Cancel Button Text
36
+ */
37
+ this.cancelText = "Cancel";
38
+ /**
39
+ * @uiName Back Button Text
40
+ */
41
+ this.backText = "Back";
42
+ /**
43
+ * @uiName Continue Button Text
44
+ */
45
+ this.continueText = "Continue";
46
+ /**
47
+ * @uiName Continue to Confirmation Button Text
48
+ */
49
+ this.continueToConfirmationText = "Continue to confirmation";
50
+ /**
51
+ * @uiName Redeem Button Text
52
+ */
53
+ this.redeemText = "Redeem";
54
+ /**
55
+ * @uiName Confirmation Title Text
56
+ */
57
+ this.redeemTitle = "Confirm and redeem";
58
+ this.redemptionSuccessText = "Successfully redeemed {sourceValue} for {destinationValue}";
59
+ /**
60
+ * @uiName Done Text
61
+ */
62
+ this.doneText = "Done";
63
+ /**
64
+ * @uiName Reward List Error Message
65
+ */
66
+ this.queryError = "Unable to load reward exchange list";
67
+ /**
68
+ * @uiName Redemption Error Message
69
+ */
70
+ this.redemptionError = "An error occured trying to redeem this reward. Please try again";
71
+ /**
72
+ * @uiName Not Enough Available Error Message
73
+ */
74
+ this.notEnoughError = "Not enough {sourceUnit} to redeem for this reward";
22
75
  withHooks(this);
23
76
  }
24
77
  disconnectedCallback() { }
@@ -82,14 +135,305 @@ export class SqmRewardExchangeList {
82
135
  },
83
136
  "attribute": "not-available-error",
84
137
  "reflect": false,
85
- "defaultValue": "\"{unavailableReason, select, US_TAX {US Tax limit} INSUFFICIENT_REDEEMABLE_CREDIT {Not enough points} other {Not available} }\""
138
+ "defaultValue": "\"{unavailableReason, select, US_TAX {US Tax limit} INSUFFICIENT_REDEEMABLE_CREDIT {{sourceValue} required} other {Not available} }\""
139
+ },
140
+ "chooseRewardTitle": {
141
+ "type": "string",
142
+ "mutable": false,
143
+ "complexType": {
144
+ "original": "string",
145
+ "resolved": "string",
146
+ "references": {}
147
+ },
148
+ "required": false,
149
+ "optional": false,
150
+ "docs": {
151
+ "tags": [{
152
+ "text": "Choose Reward Progress Title",
153
+ "name": "uiName"
154
+ }],
155
+ "text": ""
156
+ },
157
+ "attribute": "choose-reward-title",
158
+ "reflect": false,
159
+ "defaultValue": "\"Choose reward\""
160
+ },
161
+ "chooseAmountTitle": {
162
+ "type": "string",
163
+ "mutable": false,
164
+ "complexType": {
165
+ "original": "string",
166
+ "resolved": "string",
167
+ "references": {}
168
+ },
169
+ "required": false,
170
+ "optional": false,
171
+ "docs": {
172
+ "tags": [{
173
+ "text": "Choose Amount Progress Title",
174
+ "name": "uiName"
175
+ }],
176
+ "text": ""
177
+ },
178
+ "attribute": "choose-amount-title",
179
+ "reflect": false,
180
+ "defaultValue": "\"Amount\""
181
+ },
182
+ "confirmationTitle": {
183
+ "type": "string",
184
+ "mutable": false,
185
+ "complexType": {
186
+ "original": "string",
187
+ "resolved": "string",
188
+ "references": {}
189
+ },
190
+ "required": false,
191
+ "optional": false,
192
+ "docs": {
193
+ "tags": [{
194
+ "text": "Confirmation Progress Title",
195
+ "name": "uiName"
196
+ }],
197
+ "text": ""
198
+ },
199
+ "attribute": "confirmation-title",
200
+ "reflect": false,
201
+ "defaultValue": "\"Confirm\""
202
+ },
203
+ "cancelText": {
204
+ "type": "string",
205
+ "mutable": false,
206
+ "complexType": {
207
+ "original": "string",
208
+ "resolved": "string",
209
+ "references": {}
210
+ },
211
+ "required": false,
212
+ "optional": false,
213
+ "docs": {
214
+ "tags": [{
215
+ "text": "Cancel Button Text",
216
+ "name": "uiName"
217
+ }],
218
+ "text": ""
219
+ },
220
+ "attribute": "cancel-text",
221
+ "reflect": false,
222
+ "defaultValue": "\"Cancel\""
223
+ },
224
+ "backText": {
225
+ "type": "string",
226
+ "mutable": false,
227
+ "complexType": {
228
+ "original": "string",
229
+ "resolved": "string",
230
+ "references": {}
231
+ },
232
+ "required": false,
233
+ "optional": false,
234
+ "docs": {
235
+ "tags": [{
236
+ "text": "Back Button Text",
237
+ "name": "uiName"
238
+ }],
239
+ "text": ""
240
+ },
241
+ "attribute": "back-text",
242
+ "reflect": false,
243
+ "defaultValue": "\"Back\""
244
+ },
245
+ "continueText": {
246
+ "type": "string",
247
+ "mutable": false,
248
+ "complexType": {
249
+ "original": "string",
250
+ "resolved": "string",
251
+ "references": {}
252
+ },
253
+ "required": false,
254
+ "optional": false,
255
+ "docs": {
256
+ "tags": [{
257
+ "text": "Continue Button Text",
258
+ "name": "uiName"
259
+ }],
260
+ "text": ""
261
+ },
262
+ "attribute": "continue-text",
263
+ "reflect": false,
264
+ "defaultValue": "\"Continue\""
265
+ },
266
+ "continueToConfirmationText": {
267
+ "type": "string",
268
+ "mutable": false,
269
+ "complexType": {
270
+ "original": "string",
271
+ "resolved": "string",
272
+ "references": {}
273
+ },
274
+ "required": false,
275
+ "optional": false,
276
+ "docs": {
277
+ "tags": [{
278
+ "text": "Continue to Confirmation Button Text",
279
+ "name": "uiName"
280
+ }],
281
+ "text": ""
282
+ },
283
+ "attribute": "continue-to-confirmation-text",
284
+ "reflect": false,
285
+ "defaultValue": "\"Continue to confirmation\""
286
+ },
287
+ "redeemText": {
288
+ "type": "string",
289
+ "mutable": false,
290
+ "complexType": {
291
+ "original": "string",
292
+ "resolved": "string",
293
+ "references": {}
294
+ },
295
+ "required": false,
296
+ "optional": false,
297
+ "docs": {
298
+ "tags": [{
299
+ "text": "Redeem Button Text",
300
+ "name": "uiName"
301
+ }],
302
+ "text": ""
303
+ },
304
+ "attribute": "redeem-text",
305
+ "reflect": false,
306
+ "defaultValue": "\"Redeem\""
307
+ },
308
+ "redeemTitle": {
309
+ "type": "string",
310
+ "mutable": false,
311
+ "complexType": {
312
+ "original": "string",
313
+ "resolved": "string",
314
+ "references": {}
315
+ },
316
+ "required": false,
317
+ "optional": false,
318
+ "docs": {
319
+ "tags": [{
320
+ "text": "Confirmation Title Text",
321
+ "name": "uiName"
322
+ }],
323
+ "text": ""
324
+ },
325
+ "attribute": "redeem-title",
326
+ "reflect": false,
327
+ "defaultValue": "\"Confirm and redeem\""
328
+ },
329
+ "redemptionSuccessText": {
330
+ "type": "string",
331
+ "mutable": false,
332
+ "complexType": {
333
+ "original": "string",
334
+ "resolved": "string",
335
+ "references": {}
336
+ },
337
+ "required": false,
338
+ "optional": false,
339
+ "docs": {
340
+ "tags": [],
341
+ "text": ""
342
+ },
343
+ "attribute": "redemption-success-text",
344
+ "reflect": false,
345
+ "defaultValue": "\"Successfully redeemed {sourceValue} for {destinationValue}\""
346
+ },
347
+ "doneText": {
348
+ "type": "string",
349
+ "mutable": false,
350
+ "complexType": {
351
+ "original": "string",
352
+ "resolved": "string",
353
+ "references": {}
354
+ },
355
+ "required": false,
356
+ "optional": false,
357
+ "docs": {
358
+ "tags": [{
359
+ "text": "Done Text",
360
+ "name": "uiName"
361
+ }],
362
+ "text": ""
363
+ },
364
+ "attribute": "done-text",
365
+ "reflect": false,
366
+ "defaultValue": "\"Done\""
367
+ },
368
+ "queryError": {
369
+ "type": "string",
370
+ "mutable": false,
371
+ "complexType": {
372
+ "original": "string",
373
+ "resolved": "string",
374
+ "references": {}
375
+ },
376
+ "required": false,
377
+ "optional": false,
378
+ "docs": {
379
+ "tags": [{
380
+ "text": "Reward List Error Message",
381
+ "name": "uiName"
382
+ }],
383
+ "text": ""
384
+ },
385
+ "attribute": "query-error",
386
+ "reflect": false,
387
+ "defaultValue": "\"Unable to load reward exchange list\""
388
+ },
389
+ "redemptionError": {
390
+ "type": "string",
391
+ "mutable": false,
392
+ "complexType": {
393
+ "original": "string",
394
+ "resolved": "string",
395
+ "references": {}
396
+ },
397
+ "required": false,
398
+ "optional": false,
399
+ "docs": {
400
+ "tags": [{
401
+ "text": "Redemption Error Message",
402
+ "name": "uiName"
403
+ }],
404
+ "text": ""
405
+ },
406
+ "attribute": "redemption-error",
407
+ "reflect": false,
408
+ "defaultValue": "\"An error occured trying to redeem this reward. Please try again\""
409
+ },
410
+ "notEnoughError": {
411
+ "type": "string",
412
+ "mutable": false,
413
+ "complexType": {
414
+ "original": "string",
415
+ "resolved": "string",
416
+ "references": {}
417
+ },
418
+ "required": false,
419
+ "optional": false,
420
+ "docs": {
421
+ "tags": [{
422
+ "text": "Not Enough Available Error Message",
423
+ "name": "uiName"
424
+ }],
425
+ "text": ""
426
+ },
427
+ "attribute": "not-enough-error",
428
+ "reflect": false,
429
+ "defaultValue": "\"Not enough {sourceUnit} to redeem for this reward\""
86
430
  },
87
431
  "demoData": {
88
432
  "type": "unknown",
89
433
  "mutable": false,
90
434
  "complexType": {
91
435
  "original": "DemoData<RewardExchangeViewProps>",
92
- "resolved": "{ states?: { selectedItem: ExchangeItem; selectedStep: ExchangeStep; redeemStage: string; amount: number; exchangeError?: boolean; loading: boolean; content: { text: any; }; }; data?: { exchangeList: any; fuelTankCode?: string; }; }",
436
+ "resolved": "{ states?: { selectedItem: ExchangeItem; selectedStep: ExchangeStep; redeemStage: string; amount: number; exchangeError?: boolean; queryError?: boolean; loading: boolean; open: boolean; content: { text: any; }; }; data?: { exchangeList: any; fuelTankCode?: string; }; }",
93
437
  "references": {
94
438
  "DemoData": {
95
439
  "location": "import",
@@ -129,6 +473,7 @@ function useRewardExchangeListDemo(props) {
129
473
  amount: 0,
130
474
  selectedStep: undefined,
131
475
  exchangeError: false,
476
+ queryError: false,
132
477
  loading: false,
133
478
  },
134
479
  data: {
@@ -139,6 +484,7 @@ function useRewardExchangeListDemo(props) {
139
484
  setExchangeState: (_) => { },
140
485
  setStage: (_) => { },
141
486
  resetState: () => { },
487
+ copyFuelTankCode: () => { },
142
488
  },
143
489
  }, props.demoData || {}, { arrayMerge: (_, a) => a });
144
490
  }
@@ -1,6 +1,7 @@
1
1
  import { useUserIdentity, useQuery, useMutation, } from "@saasquatch/component-boilerplate";
2
2
  import { gql } from "graphql-request";
3
- import { useEffect, useReducer, } from "@saasquatch/universal-hooks";
3
+ import { useEffect, useReducer, useState, } from "@saasquatch/universal-hooks";
4
+ // TODO: add rewardInput once it works
4
5
  const GET_EXCHANGE_LIST = gql `
5
6
  query getExchangeList {
6
7
  viewer {
@@ -34,6 +35,7 @@ const GET_EXCHANGE_LIST = gql `
34
35
  destinationValue
35
36
  prettyDestinationValue
36
37
  available
38
+ globalRewardKey
37
39
  unavailableReasonCode
38
40
  }
39
41
  }
@@ -65,10 +67,11 @@ export function useRewardExchangeList(props) {
65
67
  amount: 0,
66
68
  exchangeError: false,
67
69
  });
70
+ const [open, setOpen] = useState(false);
68
71
  const { selectedItem, selectedStep, redeemStage, amount, exchangeError } = exchangeState;
69
72
  const user = useUserIdentity();
70
- const [exchange, { data: exchangeResponse, errors }] = useMutation(EXCHANGE);
71
- const { data, loading, refetch } = useQuery(GET_EXCHANGE_LIST, !(user === null || user === void 0 ? void 0 : user.jwt));
73
+ const [exchange, { data: exchangeResponse, loading: exchangeLoading, errors },] = useMutation(EXCHANGE);
74
+ const { data, loading, refetch, errors: queryError, } = useQuery(GET_EXCHANGE_LIST, !(user === null || user === void 0 ? void 0 : user.jwt));
72
75
  useEffect(() => {
73
76
  var _a, _b;
74
77
  if ((_b = (_a = exchangeResponse === null || exchangeResponse === void 0 ? void 0 : exchangeResponse.exchangeReward) === null || _a === void 0 ? void 0 : _a.reward) === null || _b === void 0 ? void 0 : _b.id) {
@@ -96,6 +99,16 @@ export function useRewardExchangeList(props) {
96
99
  globalRewardKey: selectedItem.globalRewardKey,
97
100
  };
98
101
  break;
102
+ case "STEPPED_FIXED_GLOBAL_REWARD":
103
+ exchangeVariables = {
104
+ ...exchangeVariables,
105
+ redeemCreditInput: {
106
+ amount: selectedStep.sourceValue,
107
+ unit: selectedItem.sourceUnit,
108
+ },
109
+ globalRewardKey: selectedStep.globalRewardKey,
110
+ };
111
+ break;
99
112
  case "VARIABLE_GLOBAL_REWARD":
100
113
  exchangeVariables = {
101
114
  ...exchangeVariables,
@@ -148,6 +161,14 @@ export function useRewardExchangeList(props) {
148
161
  function setStage(stage) {
149
162
  setExchangeState({ redeemStage: stage });
150
163
  }
164
+ function copyFuelTankCode() {
165
+ var _a, _b;
166
+ // Should well supported: https://developer.mozilla.org/en-US/docs/Web/API/Clipboard#browser_compatibility
167
+ // Only if called from a user-initiated event
168
+ navigator.clipboard.writeText((_b = (_a = exchangeResponse === null || exchangeResponse === void 0 ? void 0 : exchangeResponse.exchangeReward) === null || _a === void 0 ? void 0 : _a.reward) === null || _b === void 0 ? void 0 : _b.fuelTankCode);
169
+ setOpen(true);
170
+ setTimeout(() => setOpen(false), 1000);
171
+ }
151
172
  return {
152
173
  states: {
153
174
  content: {
@@ -158,7 +179,9 @@ export function useRewardExchangeList(props) {
158
179
  amount,
159
180
  selectedStep,
160
181
  exchangeError,
161
- loading,
182
+ queryError: !!queryError,
183
+ loading: loading || exchangeLoading,
184
+ open,
162
185
  },
163
186
  data: {
164
187
  exchangeList: (_b = (_a = data === null || data === void 0 ? void 0 : data.viewer) === null || _a === void 0 ? void 0 : _a.visibleRewardExchangeItems) === null || _b === void 0 ? void 0 : _b.data,
@@ -169,6 +192,7 @@ export function useRewardExchangeList(props) {
169
192
  setExchangeState,
170
193
  setStage,
171
194
  resetState,
195
+ copyFuelTankCode,
172
196
  },
173
197
  };
174
198
  }
@@ -109,7 +109,6 @@ export function useRewardsTable(props, emptyElement, loadingElement) {
109
109
  rewardsData && getComponentData(components);
110
110
  }, [rewardsData, components, tick]);
111
111
  const isEmpty = !((_b = content === null || content === void 0 ? void 0 : content.rows) === null || _b === void 0 ? void 0 : _b.length) && !(data === null || data === void 0 ? void 0 : data.length);
112
- console.log(states.loading, content.loading, rewardsData);
113
112
  const show =
114
113
  // 1 - Loading if loading
115
114
  states.loading || content.loading
@@ -1,4 +1,4 @@
1
- import { useProgramId, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
1
+ import { useEngagementMedium, useMutation, useProgramId, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
2
2
  import { useState } from "@saasquatch/universal-hooks";
3
3
  import { gql } from "graphql-request";
4
4
  const MessageLinkQuery = gql `
@@ -10,11 +10,18 @@ const MessageLinkQuery = gql `
10
10
  }
11
11
  }
12
12
  `;
13
+ const WIDGET_ENGAGEMENT_EVENT = gql `
14
+ mutation loadEvent($eventMeta: UserAnalyticsEvent!) {
15
+ createUserAnalyticsEvent(eventMeta: $eventMeta)
16
+ }
17
+ `;
13
18
  export function useShareCode(props) {
14
19
  var _a, _b;
15
20
  const programId = useProgramId();
16
21
  const user = useUserIdentity();
22
+ const engagementMedium = useEngagementMedium();
17
23
  const { data } = useQuery(MessageLinkQuery, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt));
24
+ const [sendLoadEvent] = useMutation(WIDGET_ENGAGEMENT_EVENT);
18
25
  const shareString = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.referralCode) !== null && _b !== void 0 ? _b :
19
26
  // Shown during loading
20
27
  "...";
@@ -25,6 +32,18 @@ export function useShareCode(props) {
25
32
  navigator.clipboard.writeText(shareString);
26
33
  setOpen(true);
27
34
  setTimeout(() => setOpen(false), props.tooltiplifespan);
35
+ sendLoadEvent({
36
+ eventMeta: {
37
+ programId,
38
+ id: user === null || user === void 0 ? void 0 : user.id,
39
+ accountId: user === null || user === void 0 ? void 0 : user.accountId,
40
+ type: "USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",
41
+ meta: {
42
+ engagementMedium,
43
+ shareMedium: "DIRECT",
44
+ },
45
+ },
46
+ });
28
47
  }
29
48
  return { ...props, onClick, open, shareString };
30
49
  }
@@ -1,4 +1,4 @@
1
- import { useProgramId, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
1
+ import { useEngagementMedium, useMutation, useProgramId, useQuery, useUserIdentity, } from "@saasquatch/component-boilerplate";
2
2
  import { useState } from "@saasquatch/universal-hooks";
3
3
  import { gql } from "graphql-request";
4
4
  const MessageLinkQuery = gql `
@@ -10,11 +10,18 @@ const MessageLinkQuery = gql `
10
10
  }
11
11
  }
12
12
  `;
13
+ const WIDGET_ENGAGEMENT_EVENT = gql `
14
+ mutation loadEvent($eventMeta: UserAnalyticsEvent!) {
15
+ createUserAnalyticsEvent(eventMeta: $eventMeta)
16
+ }
17
+ `;
13
18
  export function useShareLink(props) {
14
19
  var _a, _b;
15
20
  const { programId = useProgramId() } = props;
16
21
  const user = useUserIdentity();
22
+ const engagementMedium = useEngagementMedium();
17
23
  const { data } = useQuery(MessageLinkQuery, { programId }, !(user === null || user === void 0 ? void 0 : user.jwt));
24
+ const [sendLoadEvent] = useMutation(WIDGET_ENGAGEMENT_EVENT);
18
25
  const shareString = (_b = (_a = data === null || data === void 0 ? void 0 : data.user) === null || _a === void 0 ? void 0 : _a.shareLink) !== null && _b !== void 0 ? _b :
19
26
  // Shown during loading
20
27
  "...";
@@ -25,6 +32,18 @@ export function useShareLink(props) {
25
32
  navigator.clipboard.writeText(shareString);
26
33
  setOpen(true);
27
34
  setTimeout(() => setOpen(false), props.tooltiplifespan);
35
+ sendLoadEvent({
36
+ eventMeta: {
37
+ programId,
38
+ id: user === null || user === void 0 ? void 0 : user.id,
39
+ accountId: user === null || user === void 0 ? void 0 : user.accountId,
40
+ type: "USER_REFERRAL_PROGRAM_ENGAGEMENT_EVENT",
41
+ meta: {
42
+ engagementMedium,
43
+ shareMedium: "DIRECT",
44
+ },
45
+ },
46
+ });
28
47
  }
29
48
  return { ...props, onClick, open, shareString };
30
49
  }
@@ -1,8 +1,38 @@
1
1
  import chroma from "chroma-js";
2
+ /**
3
+ * Generated a Shoelace color scale css string from a base color
4
+ *
5
+ * @param color
6
+ * @param name
7
+ * @returns
8
+ */
2
9
  export function autoColorScaleCss(color, name = "primary") {
3
10
  if (!chroma.valid(color)) {
4
- return;
11
+ return "";
5
12
  }
13
+ const { scale, colorScale } = makeColorScale(color);
14
+ return scale
15
+ .map((color, index) => `--sl-color-${name}-${colorScale[index]}: ${chroma(color).hex()};`)
16
+ .join("\n");
17
+ }
18
+ /**
19
+ * Generate a Shoelace color scale style objects from a base color
20
+ *
21
+ * @param color
22
+ * @param name
23
+ * @returns
24
+ */
25
+ export function autoColorScaleStyleObject(color, name = "primary") {
26
+ if (!chroma.valid(color)) {
27
+ return {};
28
+ }
29
+ const { scale, colorScale } = makeColorScale(color);
30
+ return scale.reduce((agg, color, index) => ({
31
+ ...agg,
32
+ [`--sl-color-${name}-${colorScale[index]}`]: `${chroma(color).hex()};`,
33
+ }), { color: "blue", "--sl-color-primary-50": "#eaffea;" });
34
+ }
35
+ function makeColorScale(color) {
6
36
  const colorScale = [50, 100, 200, 300, 400, 500, 600, 700, 800, 900, 950];
7
37
  const hex = chroma(color).hex();
8
38
  const scale = chroma
@@ -20,7 +50,5 @@ export function autoColorScaleCss(color, name = "primary") {
20
50
  chroma(hex).luminance(0.02),
21
51
  ])
22
52
  .colors(colorScale.length);
23
- return scale
24
- .map((color, index) => `--sl-color-${name}-${colorScale[index]}: ${chroma(color).hex()};`)
25
- .join("\n");
53
+ return { scale, colorScale };
26
54
  }
@@ -36,3 +36,17 @@ export const NYTimes = `
36
36
  --sl-font-sans: Georgia, 'Times New Roman', serif;
37
37
  }
38
38
  `;
39
+ export const Klip = `
40
+ :root{
41
+ --sl-color-primary-50: #E8E5F8;
42
+ --sl-color-primary-100: #C6BEED;
43
+ --sl-color-primary-200: #A192E2;
44
+ --sl-color-primary-300: #7B66D6;
45
+ --sl-color-primary-400: #5E46CD;
46
+ --sl-color-primary-500: #4225C4;
47
+ --sl-color-primary-600: #3C21BE;
48
+ --sl-color-primary-700: #331BB6;
49
+ --sl-color-primary-800: #2B16AF;
50
+ --sl-color-primary-900: #1D0DA2;
51
+ }
52
+ `;
@@ -45,6 +45,9 @@ import * as Hero from "../sqm-hero/Hero.stories";
45
45
  import * as ReferralIframe from "../sqm-referral-iframe/ReferralIframe.stories";
46
46
  import * as NameFields from "../sqm-name-fields/NameFields.stories";
47
47
  import * as RewardExchangeList from "../sqm-reward-exchange-list/RewardExchangeList.stories";
48
+ import * as ProgramExplainer from "../sqm-program-explainer/ProgramExplainer.stories";
49
+ import * as ProgramExplainerStep from "../sqm-program-explainer-step/ProgramExplainerStep.stories";
50
+ import * as BrandStories from "../sqm-brand/SqmBrand.stories";
48
51
  import * as Themes from "./Themes";
49
52
  import { CucumberAddon } from "./CucumberAddon";
50
53
  import { HookStoryAddon } from "./HookStoryAddon";
@@ -95,6 +98,9 @@ const stories = [
95
98
  UseRewardExchangeList,
96
99
  UseTaskCard,
97
100
  UseRewardsTable,
101
+ ProgramExplainer,
102
+ ProgramExplainerStep,
103
+ BrandStories
98
104
  ];
99
105
  /**
100
106
  * For internal documentation