@saasquatch/vanilla-components 1.2.4-1 → 1.2.4-12

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/dist/cjs/{WidgetHost-71b013eb.js → WidgetHost-f349e877.js} +157 -0
  2. package/dist/cjs/{en-a49a5ef5.js → en-3a7cb52e.js} +2 -2
  3. package/dist/cjs/{index-deb40352.js → index-09a04159.js} +54 -3
  4. package/dist/cjs/loader.cjs.js +3 -3
  5. package/dist/cjs/sqh-close-button.cjs.entry.js +2 -2
  6. package/dist/cjs/{sqh-copy-button_12.cjs.entry.js → sqh-copy-button_14.cjs.entry.js} +1182 -42
  7. package/dist/cjs/sqh-referral-code.cjs.entry.js +2 -2
  8. package/dist/cjs/sqh-rewards-actions.cjs.entry.js +1 -1
  9. package/dist/cjs/widget-components.cjs.js +3 -3
  10. package/dist/collection/collection-manifest.json +2 -0
  11. package/dist/collection/components/close-button/close-button.js +3 -0
  12. package/dist/collection/components/copy-button/copy-button.js +22 -28
  13. package/dist/collection/components/copy-link-button/copy-link-button.js +16 -16
  14. package/dist/collection/components/cta-component/cta-component.css +6 -0
  15. package/dist/collection/components/cta-component/cta-component.js +393 -0
  16. package/dist/collection/components/global-container/global-container.js +9 -20
  17. package/dist/collection/components/image-component/image-component.js +13 -12
  18. package/dist/collection/components/partner-stat-component/partner-stat-component.js +20 -9
  19. package/dist/collection/components/progress-indicator/progress-indicator.css +73 -0
  20. package/dist/collection/components/progress-indicator/progress-indicator.js +557 -0
  21. package/dist/collection/components/referral-code/referral-code.js +3 -0
  22. package/dist/collection/components/referral-component/referral-component.js +1 -0
  23. package/dist/collection/components/referral-list/referral-list.js +70 -88
  24. package/dist/collection/components/rewards-actions/rewards-actions.js +1 -0
  25. package/dist/collection/components/share-button/share-button.js +4 -12
  26. package/dist/collection/components/share-button-container/share-button-container.js +90 -173
  27. package/dist/collection/components/stat-component/stat-component.js +22 -10
  28. package/dist/collection/components/stats-container/stats-container.js +15 -9
  29. package/dist/collection/components/text-component/text-component.js +42 -17
  30. package/dist/collection/services/WidgetHost.js +157 -0
  31. package/dist/esm/{WidgetHost-9c337319.js → WidgetHost-c033b6ac.js} +157 -0
  32. package/dist/esm/{en-be593af0.js → en-a652ab83.js} +1 -1
  33. package/dist/esm/{index-8ea8b6d8.js → index-342d7c26.js} +54 -3
  34. package/dist/esm/loader.mjs +3 -3
  35. package/dist/esm/sqh-close-button.entry.js +2 -2
  36. package/dist/esm/{sqh-copy-button_12.entry.js → sqh-copy-button_14.entry.js} +1181 -43
  37. package/dist/esm/sqh-referral-code.entry.js +2 -2
  38. package/dist/esm/sqh-rewards-actions.entry.js +1 -1
  39. package/dist/esm/widget-components.mjs +3 -3
  40. package/dist/esm-es5/{WidgetHost-9c337319.js → WidgetHost-c033b6ac.js} +96 -4
  41. package/dist/esm-es5/{en-be593af0.js → en-a652ab83.js} +1 -1
  42. package/dist/esm-es5/{index-8ea8b6d8.js → index-342d7c26.js} +53 -3
  43. package/dist/esm-es5/loader.mjs +3 -3
  44. package/dist/esm-es5/sqh-close-button.entry.js +2 -2
  45. package/dist/esm-es5/{sqh-copy-button_12.entry.js → sqh-copy-button_14.entry.js} +1073 -56
  46. package/dist/esm-es5/sqh-referral-code.entry.js +2 -2
  47. package/dist/esm-es5/sqh-rewards-actions.entry.js +1 -1
  48. package/dist/esm-es5/widget-components.mjs +3 -3
  49. package/dist/types/components/close-button/close-button.d.ts +3 -0
  50. package/dist/types/components/copy-button/copy-button.d.ts +14 -28
  51. package/dist/types/components/copy-link-button/copy-link-button.d.ts +10 -16
  52. package/dist/types/components/cta-component/cta-component.d.ts +88 -0
  53. package/dist/types/components/global-container/global-container.d.ts +7 -14
  54. package/dist/types/components/image-component/image-component.d.ts +8 -13
  55. package/dist/types/components/partner-stat-component/partner-stat-component.d.ts +12 -9
  56. package/dist/types/components/progress-indicator/progress-indicator.d.ts +96 -0
  57. package/dist/types/components/referral-code/referral-code.d.ts +3 -0
  58. package/dist/types/components/referral-component/referral-component.d.ts +1 -0
  59. package/dist/types/components/referral-list/referral-list.d.ts +63 -77
  60. package/dist/types/components/rewards-actions/rewards-actions.d.ts +1 -0
  61. package/dist/types/components/share-button/share-button.d.ts +3 -7
  62. package/dist/types/components/share-button-container/share-button-container.d.ts +49 -137
  63. package/dist/types/components/stat-component/stat-component.d.ts +13 -11
  64. package/dist/types/components/stats-container/stats-container.d.ts +10 -7
  65. package/dist/types/components/text-component/text-component.d.ts +17 -21
  66. package/dist/types/components.d.ts +634 -542
  67. package/dist/types/saasquatch.d.ts +3 -1
  68. package/dist/types/services/WidgetHost.d.ts +6 -0
  69. package/dist/widget-components/p-0e55cfb5.system.entry.js +10 -0
  70. package/dist/widget-components/p-0ec230df.entry.js +233 -0
  71. package/dist/widget-components/{p-44a6559d.js → p-17d80384.js} +1 -1
  72. package/dist/widget-components/{p-54ea7a00.entry.js → p-3ba562d0.entry.js} +1 -1
  73. package/dist/widget-components/{p-366f1663.entry.js → p-4293e873.entry.js} +1 -1
  74. package/dist/widget-components/{p-8e232564.system.js → p-54e83dfb.system.js} +2 -2
  75. package/dist/widget-components/{p-e2b4739f.system.entry.js → p-665b8d42.system.entry.js} +1 -1
  76. package/dist/widget-components/{p-edd43dbc.js → p-6e753d23.js} +68 -3
  77. package/dist/widget-components/{p-a846f503.system.js → p-aaf44379.system.js} +1 -1
  78. package/dist/widget-components/{p-b17efca4.system.entry.js → p-abf8a511.system.entry.js} +1 -1
  79. package/dist/widget-components/p-ad5121cf.system.js +1 -0
  80. package/dist/widget-components/p-d9e9c55c.system.entry.js +1 -0
  81. package/dist/widget-components/{p-58be1132.system.js → p-e82def83.system.js} +1 -1
  82. package/dist/widget-components/{p-9746ae26.entry.js → p-fb528be6.entry.js} +1 -1
  83. package/dist/widget-components/p-fbf0c7fe.js +1 -0
  84. package/dist/widget-components/widget-components.esm.js +1 -1
  85. package/dist/widget-components/widget-components.js +1 -1
  86. package/docs/raisins.json +1 -1
  87. package/package.json +4 -3
  88. package/dist/widget-components/p-485eaf44.js +0 -1
  89. package/dist/widget-components/p-c8bc8c77.system.entry.js +0 -1
  90. package/dist/widget-components/p-d416634a.entry.js +0 -148
  91. package/dist/widget-components/p-d97c955d.system.entry.js +0 -8
  92. package/dist/widget-components/p-e61a8100.system.js +0 -1
@@ -2,6 +2,12 @@ import { h, Component, Prop, Event, Element, Watch, } from "@stencil/core";
2
2
  import { css } from "emotion";
3
3
  /**
4
4
  * @uiName Stat Component
5
+ * @canvasRenderer always-replace
6
+ * @exampleGroup Statistics
7
+ * @example Referral Count - <sqh-stat-component ishidden="false" statcolor="#4caf50" stattype="/referralsCount" statdescription="Friends Referred" paddingtop="10" paddingbottom="10"></sqh-stat-component>
8
+ * @example Reward Count - <sqh-stat-component ishidden="false" stattype="/rewardsCount" statdescription="Total Rewards" paddingtop="10" paddingbottom="10" statcolor="#000000"></sqh-stat-component>
9
+ * @example Credit Earned - <sqh-stat-component ishidden="false" stattype="/rewardBalance/CREDIT/CENTS/prettyAssignedCredit" statdescription="Credit earned" paddingtop="10" paddingbottom="10" statcolor="#000000"></sqh-stat-component>
10
+ * @example Points Earned - <sqh-stat-component statcolor="#000000" stattype="/rewardBalance/CREDIT/POINT/totalAssignedCredit" statdescription="Points Earned" paddingtop="10" paddingbottom="10"></sqh-stat-component>
5
11
  */
6
12
  export class StatComponent {
7
13
  componentWillLoad() {
@@ -45,10 +51,13 @@ export class StatComponent {
45
51
  "optional": false,
46
52
  "docs": {
47
53
  "tags": [{
48
- "text": "Hide Stat",
54
+ "text": undefined,
55
+ "name": "undocumented"
56
+ }, {
57
+ "text": "Hide Component",
49
58
  "name": "uiName"
50
59
  }],
51
- "text": "Hide or show the component"
60
+ "text": ""
52
61
  },
53
62
  "attribute": "ishidden",
54
63
  "reflect": false
@@ -73,6 +82,9 @@ export class StatComponent {
73
82
  }, {
74
83
  "text": undefined,
75
84
  "name": "required"
85
+ }, {
86
+ "text": "1",
87
+ "name": "minLength"
76
88
  }],
77
89
  "text": "Type of stat being displayed. e.g /rewardsCount"
78
90
  },
@@ -91,10 +103,13 @@ export class StatComponent {
91
103
  "optional": false,
92
104
  "docs": {
93
105
  "tags": [{
106
+ "text": undefined,
107
+ "name": "undocumented"
108
+ }, {
94
109
  "text": "Stat Value",
95
110
  "name": "uiName"
96
111
  }],
97
- "text": "Value shown inside stat"
112
+ "text": ""
98
113
  },
99
114
  "attribute": "statvalue",
100
115
  "reflect": false
@@ -111,10 +126,10 @@ export class StatComponent {
111
126
  "optional": false,
112
127
  "docs": {
113
128
  "tags": [{
114
- "text": "Stat Description",
129
+ "text": "Description",
115
130
  "name": "uiName"
116
131
  }],
117
- "text": "Description shown underneath stat value"
132
+ "text": "Text shown underneath the stat value"
118
133
  },
119
134
  "attribute": "statdescription",
120
135
  "reflect": false
@@ -131,16 +146,13 @@ export class StatComponent {
131
146
  "optional": false,
132
147
  "docs": {
133
148
  "tags": [{
134
- "text": "Stat Color",
149
+ "text": "Color",
135
150
  "name": "uiName"
136
151
  }, {
137
152
  "text": "color",
138
153
  "name": "uiWidget"
139
- }, {
140
- "text": "color",
141
- "name": "format"
142
154
  }],
143
- "text": "Text color of the stat"
155
+ "text": ""
144
156
  },
145
157
  "attribute": "statcolor",
146
158
  "reflect": false
@@ -4,14 +4,17 @@ import { pathToRegexp } from "path-to-regexp";
4
4
  import { css } from "emotion";
5
5
  /**
6
6
  * @uiName Stats Container
7
+ * @canvasRenderer always-replace
7
8
  * @slots [{"name":"","title":"Stats"}]
9
+ * @exampleGroup Statistics
10
+ * @example Referral Stat Group - <sqh-stats-container ishidden="false" paddingtop="0" paddingbottom="0"><sqh-stat-component ishidden="false" statcolor="#4caf50" stattype="/referralsCount" statdescription="Friends Referred" paddingtop="10" paddingbottom="10"></sqh-stat-component><sqh-stat-component ishidden="false" stattype="/rewardsCount" statdescription="Total Rewards" paddingtop="10" paddingbottom="10" statcolor="#000000"></sqh-stat-component><sqh-stat-component ishidden="false" stattype="/rewardBalance/CREDIT/CENTS/prettyAssignedCredit" statdescription="Credit earned" paddingtop="10" paddingbottom="10" statcolor="#000000"></sqh-stat-component></sqh-stats-container>
11
+ * @example Partner Stat Group - <sqh-stats-container ishidden="false" paddingtop="0" paddingbottom="0"><sqh-partner-stat-component ishidden="false" statcolor="#000000" stattype="/rewardBalance/CREDIT/CASH_CAD/prettyPendingCredit" statdescription="Pending Balance" paddingtop="10" paddingbottom="10"></sqh-partner-stat-component><sqh-partner-stat-component ishidden="false" stattype="/rewardBalance/CREDIT/CASH_CAD/prettyValue" statdescription="Available Balance" paddingtop="10" paddingbottom="10" statcolor="#4caf50"></sqh-partner-stat-component><sqh-partner-stat-component ishidden="false" stattype="/rewardBalance/CREDIT/CASH_CAD/prettyRedeemedCredit" statdescription="Redeemed Balance" paddingtop="10" paddingbottom="10" statcolor="#000000"></sqh-partner-stat-component></sqh-stats-container>
8
12
  */
9
13
  export class StatsContainer {
10
14
  constructor() {
11
15
  /**
12
- * Hide the component
13
- *
14
- * @uiName Is Hidden
16
+ * @undocumented
17
+ * @uiName Hide stats
15
18
  */
16
19
  this.ishidden = false;
17
20
  this.statPaths = [
@@ -127,10 +130,13 @@ export class StatsContainer {
127
130
  "optional": false,
128
131
  "docs": {
129
132
  "tags": [{
130
- "text": "Is Hidden",
133
+ "text": undefined,
134
+ "name": "undocumented"
135
+ }, {
136
+ "text": "Hide stats",
131
137
  "name": "uiName"
132
138
  }],
133
- "text": "Hide the component"
139
+ "text": ""
134
140
  },
135
141
  "attribute": "ishidden",
136
142
  "reflect": false,
@@ -151,10 +157,10 @@ export class StatsContainer {
151
157
  "text": "Padding Top",
152
158
  "name": "uiName"
153
159
  }, {
154
- "text": "\"0\"",
160
+ "text": "0",
155
161
  "name": "default"
156
162
  }],
157
- "text": "Configure the padding top of the container"
163
+ "text": "Define the bottom padding of the container with a pixel amount."
158
164
  },
159
165
  "attribute": "paddingtop",
160
166
  "reflect": false
@@ -174,10 +180,10 @@ export class StatsContainer {
174
180
  "text": "Padding Bottom",
175
181
  "name": "uiName"
176
182
  }, {
177
- "text": "\"0\"",
183
+ "text": "0",
178
184
  "name": "default"
179
185
  }],
180
- "text": "Configure the padding bottom of the container"
186
+ "text": "Define the top padding of the container with a pixel amount."
181
187
  },
182
188
  "attribute": "paddingbottom",
183
189
  "reflect": false
@@ -3,6 +3,10 @@ import { css } from "emotion";
3
3
  import marked from "marked";
4
4
  /**
5
5
  * @uiName Text Component
6
+ * @canvasRenderer always-replace
7
+ * @exampleGroup Common Components
8
+ * @example Header Text - <sqh-text-component sqhheader="true" ishidden="false" ismarkdown="false" text="Give $10 and Get $10!" color="#4486E1" fontsize="30" textalign="center" paddingtop="30" paddingbottom="10"></sqh-text-component>
9
+ * @example Paragraph Text - <sqh-text-component sqhbody="true" ishidden="false" ismarkdown="true" text="Give a friend a $10 and receive $10 for yourself when they purchase.<br/><br/>Share the link below or use the code **<sqh-referral-code />**" color="#000000" fontsize="13" textalign="center" paddingtop="5" paddingbottom="20"></sqh-text-component>
6
10
  */
7
11
  export class TextComponent {
8
12
  render() {
@@ -10,6 +14,7 @@ export class TextComponent {
10
14
  const textStyle = css `
11
15
  font-family: ${this.fontfamily || "inherit"};
12
16
  font-size: ${this.fontsize ? this.fontsize + "px" : "inherit"};
17
+ font-weight: ${this.fontweight ? this.fontweight : "inherit"};
13
18
  text-align: ${this.textalign};
14
19
  color: ${this.color || "inherit"};
15
20
  padding-top: ${this.paddingtop ? this.paddingtop + "px" : "inherit"};
@@ -51,10 +56,13 @@ export class TextComponent {
51
56
  "optional": false,
52
57
  "docs": {
53
58
  "tags": [{
59
+ "text": undefined,
60
+ "name": "undocumented"
61
+ }, {
54
62
  "text": "Hide Text",
55
63
  "name": "uiName"
56
64
  }],
57
- "text": "Hide or show the component"
65
+ "text": ""
58
66
  },
59
67
  "attribute": "ishidden",
60
68
  "reflect": false
@@ -71,10 +79,10 @@ export class TextComponent {
71
79
  "optional": false,
72
80
  "docs": {
73
81
  "tags": [{
74
- "text": "Is Markdown",
82
+ "text": "Use Markdown",
75
83
  "name": "uiName"
76
84
  }],
77
- "text": "Compiles plain text into markdown"
85
+ "text": "Compile plain text into HTML. See [markdown](https://www.markdownguide.org/getting-started/) for more details."
78
86
  },
79
87
  "attribute": "ismarkdown",
80
88
  "reflect": false
@@ -94,7 +102,7 @@ export class TextComponent {
94
102
  "text": "Text",
95
103
  "name": "uiName"
96
104
  }],
97
- "text": "The text content"
105
+ "text": ""
98
106
  },
99
107
  "attribute": "text",
100
108
  "reflect": false
@@ -114,7 +122,7 @@ export class TextComponent {
114
122
  "text": "Font Family",
115
123
  "name": "uiName"
116
124
  }],
117
- "text": "Font family of the text"
125
+ "text": ""
118
126
  },
119
127
  "attribute": "fontfamily",
120
128
  "reflect": false
@@ -131,16 +139,13 @@ export class TextComponent {
131
139
  "optional": false,
132
140
  "docs": {
133
141
  "tags": [{
134
- "text": "Color",
142
+ "text": "Text Color",
135
143
  "name": "uiName"
136
144
  }, {
137
145
  "text": "color",
138
146
  "name": "uiWidget"
139
- }, {
140
- "text": "color",
141
- "name": "format"
142
147
  }],
143
- "text": "Color of the text"
148
+ "text": ""
144
149
  },
145
150
  "attribute": "color",
146
151
  "reflect": false
@@ -160,7 +165,7 @@ export class TextComponent {
160
165
  "text": "Font Size",
161
166
  "name": "uiName"
162
167
  }],
163
- "text": "Size of the text"
168
+ "text": ""
164
169
  },
165
170
  "attribute": "fontsize",
166
171
  "reflect": false
@@ -180,11 +185,31 @@ export class TextComponent {
180
185
  "text": "Padding Top",
181
186
  "name": "uiName"
182
187
  }],
183
- "text": "Top padding on text"
188
+ "text": "Define the top padding of the container with a pixel amount."
184
189
  },
185
190
  "attribute": "paddingtop",
186
191
  "reflect": false
187
192
  },
193
+ "fontweight": {
194
+ "type": "string",
195
+ "mutable": false,
196
+ "complexType": {
197
+ "original": "string",
198
+ "resolved": "string",
199
+ "references": {}
200
+ },
201
+ "required": false,
202
+ "optional": false,
203
+ "docs": {
204
+ "tags": [{
205
+ "text": "Font Weight",
206
+ "name": "uiName"
207
+ }],
208
+ "text": ""
209
+ },
210
+ "attribute": "fontweight",
211
+ "reflect": false
212
+ },
188
213
  "paddingbottom": {
189
214
  "type": "string",
190
215
  "mutable": false,
@@ -200,7 +225,7 @@ export class TextComponent {
200
225
  "text": "Padding Bottom",
201
226
  "name": "uiName"
202
227
  }],
203
- "text": "Bottom padding on text"
228
+ "text": "Define the bottom padding of the container with a pixel amount."
204
229
  },
205
230
  "attribute": "paddingbottom",
206
231
  "reflect": false
@@ -217,7 +242,7 @@ export class TextComponent {
217
242
  "optional": false,
218
243
  "docs": {
219
244
  "tags": [{
220
- "text": "Text Align",
245
+ "text": "Text Alignment",
221
246
  "name": "uiName"
222
247
  }, {
223
248
  "text": "[\"left\", \"center\", \"right\"]",
@@ -226,7 +251,7 @@ export class TextComponent {
226
251
  "text": "[\"Left\", \"Center\", \"Right\"]",
227
252
  "name": "uiEnumNames"
228
253
  }],
229
- "text": "Text alignment"
254
+ "text": ""
230
255
  },
231
256
  "attribute": "textalign",
232
257
  "reflect": false
@@ -246,7 +271,7 @@ export class TextComponent {
246
271
  "text": "Background",
247
272
  "name": "uiName"
248
273
  }],
249
- "text": "Background the container, color or url"
274
+ "text": "Fill the background with a color or image. Input color values as a HEX code and an image as a URL."
250
275
  },
251
276
  "attribute": "background",
252
277
  "reflect": false
@@ -266,7 +291,7 @@ export class TextComponent {
266
291
  "text": "Height",
267
292
  "name": "uiName"
268
293
  }],
269
- "text": "Height of the container"
294
+ "text": "Define the height of the container with a pixel amount."
270
295
  },
271
296
  "attribute": "height",
272
297
  "reflect": false
@@ -511,6 +511,92 @@ const API = {
511
511
  })
512
512
  .then((res) => res.data.user);
513
513
  },
514
+ getBalanceDetails() {
515
+ const widgetId = widgetIdent();
516
+ if (widgetId["env"] === "demo" || !widgetId) {
517
+ const { rewardBalanceDetails } = demoUser;
518
+ const user = {
519
+ rewardBalanceDetails
520
+ };
521
+ return Promise.resolve(user);
522
+ }
523
+ const { userId, accountId, programId = null, locale } = widgetId;
524
+ const variables = {
525
+ userId,
526
+ accountId,
527
+ programId,
528
+ locale
529
+ };
530
+ return this.getClient().query({
531
+ query: gql `
532
+ query(
533
+ $userId: String!,
534
+ $accountId: String!,
535
+ $programId: ID,
536
+ $locale: String!
537
+ ) {
538
+ user(id: $userId, accountId: $accountId) {
539
+ rewardBalanceDetails(programId: $programId) {
540
+ prettyAvailableValue
541
+ unit
542
+ ... on CreditRewardBalance {
543
+ prettyAssignedCredit
544
+ prettyRedeemedCredit
545
+ rewardUnit {
546
+ currency {
547
+ displayName(locale: $locale)
548
+ symbol(locale: $locale)
549
+ currencyCode
550
+ }
551
+ }
552
+ }
553
+ }
554
+ }
555
+ }
556
+ `,
557
+ variables
558
+ }).then(res => res.data.user);
559
+ },
560
+ getRewardExpiries() {
561
+ const widgetId = widgetIdent();
562
+ if (widgetId["env"] === "demo" || !widgetId) {
563
+ const { rewardBalanceDetails } = demoUser;
564
+ const user = {
565
+ rewardBalanceDetails
566
+ };
567
+ return Promise.resolve(user);
568
+ }
569
+ const { userId, accountId, programId = null, locale } = widgetId;
570
+ const variables = {
571
+ userId,
572
+ accountId,
573
+ programId,
574
+ locale
575
+ };
576
+ return this.getClient().query({
577
+ query: gql `
578
+ query(
579
+ $userId: String!,
580
+ $accountId: String!,
581
+ $programId: ID,
582
+ $locale: String!
583
+ ) {
584
+ user(id: $userId, accountId: $accountId) {
585
+ rewards(programId_eq: $programId) {
586
+ data {
587
+ dateCreated
588
+ dateScheduledFor
589
+ dateExpires
590
+ prettyValue
591
+ unit
592
+ }
593
+ }
594
+ }
595
+ }
596
+ `,
597
+ variables
598
+ }).then(res => res.data.user);
599
+ },
514
600
  async getReferralCode() {
515
601
  const widgetId = widgetIdent();
516
602
  if (widgetId["env"] === "demo" || !widgetId)
@@ -615,6 +701,77 @@ const API = {
615
701
  })
616
702
  .then((res) => res.data.user);
617
703
  },
704
+ getUserProgress() {
705
+ const widgetId = widgetIdent();
706
+ if (widgetId["env"] === "demo" || !widgetId) {
707
+ const demoData = {
708
+ customFields: { demo_totalValue: 16 },
709
+ rewardBalanceDetails: [{
710
+ prettyAvailableValue: "$10.00"
711
+ }],
712
+ rewards: { count: 1 }
713
+ };
714
+ return Promise.resolve(demoData);
715
+ }
716
+ const { userId, accountId, programId } = widgetId;
717
+ const variables = {
718
+ userId,
719
+ accountId,
720
+ programId,
721
+ };
722
+ return this.getClient().query({
723
+ query: gql `
724
+ query($userId: String!, $accountId: String!, $programId: ID) {
725
+ user(id: $userId, accountId: $accountId){
726
+ customFields
727
+ locale
728
+ rewardBalanceDetails(programId: $programId) {
729
+ prettyAvailableValue(formatType:UNIT_FORMATTED)
730
+ }
731
+ rewards(limit:1000,offset:0, filter:{programId_eq: $programId}){
732
+ count
733
+ }
734
+ }
735
+ }
736
+ `,
737
+ variables
738
+ }).then(res => res.data.user);
739
+ },
740
+ getProgramRules() {
741
+ const widgetId = widgetIdent();
742
+ if (widgetId["env"] === "demo" || !widgetId) {
743
+ const demoData = {
744
+ id: "demo",
745
+ name: "Demo Program",
746
+ rules: {
747
+ programWindow: "",
748
+ rewardRules: {
749
+ rewardRulesType: 1,
750
+ rewardGoal: 24,
751
+ isRecurring: 1,
752
+ defaultCurrency: "CAD"
753
+ }
754
+ }
755
+ };
756
+ return Promise.resolve(demoData);
757
+ }
758
+ const { programId } = widgetId;
759
+ const variables = {
760
+ programId
761
+ };
762
+ return this.getClient().query({
763
+ query: gql `
764
+ query($programId: ID!) {
765
+ program(id:$programId){
766
+ id
767
+ name
768
+ rules
769
+ }
770
+ }
771
+ `,
772
+ variables
773
+ }).then(res => res.data.program);
774
+ },
618
775
  },
619
776
  ui: squatchJsApi,
620
777
  };
@@ -10417,6 +10417,92 @@ const API = {
10417
10417
  })
10418
10418
  .then((res) => res.data.user);
10419
10419
  },
10420
+ getBalanceDetails() {
10421
+ const widgetId = widgetIdent();
10422
+ if (widgetId["env"] === "demo" || !widgetId) {
10423
+ const { rewardBalanceDetails } = demoUser;
10424
+ const user = {
10425
+ rewardBalanceDetails
10426
+ };
10427
+ return Promise.resolve(user);
10428
+ }
10429
+ const { userId, accountId, programId = null, locale } = widgetId;
10430
+ const variables = {
10431
+ userId,
10432
+ accountId,
10433
+ programId,
10434
+ locale
10435
+ };
10436
+ return this.getClient().query({
10437
+ query: src `
10438
+ query(
10439
+ $userId: String!,
10440
+ $accountId: String!,
10441
+ $programId: ID,
10442
+ $locale: String!
10443
+ ) {
10444
+ user(id: $userId, accountId: $accountId) {
10445
+ rewardBalanceDetails(programId: $programId) {
10446
+ prettyAvailableValue
10447
+ unit
10448
+ ... on CreditRewardBalance {
10449
+ prettyAssignedCredit
10450
+ prettyRedeemedCredit
10451
+ rewardUnit {
10452
+ currency {
10453
+ displayName(locale: $locale)
10454
+ symbol(locale: $locale)
10455
+ currencyCode
10456
+ }
10457
+ }
10458
+ }
10459
+ }
10460
+ }
10461
+ }
10462
+ `,
10463
+ variables
10464
+ }).then(res => res.data.user);
10465
+ },
10466
+ getRewardExpiries() {
10467
+ const widgetId = widgetIdent();
10468
+ if (widgetId["env"] === "demo" || !widgetId) {
10469
+ const { rewardBalanceDetails } = demoUser;
10470
+ const user = {
10471
+ rewardBalanceDetails
10472
+ };
10473
+ return Promise.resolve(user);
10474
+ }
10475
+ const { userId, accountId, programId = null, locale } = widgetId;
10476
+ const variables = {
10477
+ userId,
10478
+ accountId,
10479
+ programId,
10480
+ locale
10481
+ };
10482
+ return this.getClient().query({
10483
+ query: src `
10484
+ query(
10485
+ $userId: String!,
10486
+ $accountId: String!,
10487
+ $programId: ID,
10488
+ $locale: String!
10489
+ ) {
10490
+ user(id: $userId, accountId: $accountId) {
10491
+ rewards(programId_eq: $programId) {
10492
+ data {
10493
+ dateCreated
10494
+ dateScheduledFor
10495
+ dateExpires
10496
+ prettyValue
10497
+ unit
10498
+ }
10499
+ }
10500
+ }
10501
+ }
10502
+ `,
10503
+ variables
10504
+ }).then(res => res.data.user);
10505
+ },
10420
10506
  async getReferralCode() {
10421
10507
  const widgetId = widgetIdent();
10422
10508
  if (widgetId["env"] === "demo" || !widgetId)
@@ -10521,6 +10607,77 @@ const API = {
10521
10607
  })
10522
10608
  .then((res) => res.data.user);
10523
10609
  },
10610
+ getUserProgress() {
10611
+ const widgetId = widgetIdent();
10612
+ if (widgetId["env"] === "demo" || !widgetId) {
10613
+ const demoData = {
10614
+ customFields: { demo_totalValue: 16 },
10615
+ rewardBalanceDetails: [{
10616
+ prettyAvailableValue: "$10.00"
10617
+ }],
10618
+ rewards: { count: 1 }
10619
+ };
10620
+ return Promise.resolve(demoData);
10621
+ }
10622
+ const { userId, accountId, programId } = widgetId;
10623
+ const variables = {
10624
+ userId,
10625
+ accountId,
10626
+ programId,
10627
+ };
10628
+ return this.getClient().query({
10629
+ query: src `
10630
+ query($userId: String!, $accountId: String!, $programId: ID) {
10631
+ user(id: $userId, accountId: $accountId){
10632
+ customFields
10633
+ locale
10634
+ rewardBalanceDetails(programId: $programId) {
10635
+ prettyAvailableValue(formatType:UNIT_FORMATTED)
10636
+ }
10637
+ rewards(limit:1000,offset:0, filter:{programId_eq: $programId}){
10638
+ count
10639
+ }
10640
+ }
10641
+ }
10642
+ `,
10643
+ variables
10644
+ }).then(res => res.data.user);
10645
+ },
10646
+ getProgramRules() {
10647
+ const widgetId = widgetIdent();
10648
+ if (widgetId["env"] === "demo" || !widgetId) {
10649
+ const demoData = {
10650
+ id: "demo",
10651
+ name: "Demo Program",
10652
+ rules: {
10653
+ programWindow: "",
10654
+ rewardRules: {
10655
+ rewardRulesType: 1,
10656
+ rewardGoal: 24,
10657
+ isRecurring: 1,
10658
+ defaultCurrency: "CAD"
10659
+ }
10660
+ }
10661
+ };
10662
+ return Promise.resolve(demoData);
10663
+ }
10664
+ const { programId } = widgetId;
10665
+ const variables = {
10666
+ programId
10667
+ };
10668
+ return this.getClient().query({
10669
+ query: src `
10670
+ query($programId: ID!) {
10671
+ program(id:$programId){
10672
+ id
10673
+ name
10674
+ rules
10675
+ }
10676
+ }
10677
+ `,
10678
+ variables
10679
+ }).then(res => res.data.program);
10680
+ },
10524
10681
  },
10525
10682
  ui: squatchJsApi,
10526
10683
  };
@@ -1,4 +1,4 @@
1
- import { C as CSS, p as plt, w as win, a as promiseResolve, d as doc, N as NAMESPACE, H } from './index-8ea8b6d8.js';
1
+ import { C as CSS, p as plt, w as win, a as promiseResolve, d as doc, N as NAMESPACE, H } from './index-342d7c26.js';
2
2
  import { c as createCommonjsModule, u as unwrapExports, a as commonjsGlobal } from './_commonjsHelpers-1d681858.js';
3
3
 
4
4
  /*