@saasquatch/mint-components 1.15.0-116 → 1.15.0-117

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 (75) hide show
  1. package/dist/cjs/RewardExchangeListData-a787ce54.js +1144 -0
  2. package/dist/cjs/{ShadowViewAddon-c468a0a7.js → ShadowViewAddon-f1bd9b26.js} +1 -1
  3. package/dist/cjs/{copy-text-view-b9a8fbb1.js → copy-text-view-44dfefc7.js} +1 -1
  4. package/dist/cjs/copy-text-view-f0313f78.js +121 -0
  5. package/dist/cjs/sqm-big-stat_43.cjs.entry.js +2 -2
  6. package/dist/cjs/sqm-coupon-code-view-a869384e.js +35 -0
  7. package/dist/cjs/sqm-coupon-code.cjs.entry.js +285 -0
  8. package/dist/cjs/sqm-pagination_3.cjs.entry.js +1 -1
  9. package/dist/cjs/sqm-referral-code.cjs.entry.js +177 -0
  10. package/dist/cjs/sqm-reward-exchange-list.cjs.entry.js +1018 -0
  11. package/dist/cjs/sqm-share-code.cjs.entry.js +147 -0
  12. package/dist/cjs/sqm-share-link.cjs.entry.js +102 -0
  13. package/dist/cjs/sqm-stencilbook.cjs.entry.js +2 -2
  14. package/dist/collection/components/views/copy-text-view.js +1 -1
  15. package/dist/esm/RewardExchangeListData-11c043e3.js +1122 -0
  16. package/dist/esm/{ShadowViewAddon-518e026d.js → ShadowViewAddon-c0600f22.js} +1 -1
  17. package/dist/esm/copy-text-view-3129fb22.js +119 -0
  18. package/dist/esm/{copy-text-view-b219d166.js → copy-text-view-a319c261.js} +1 -1
  19. package/dist/esm/sqm-big-stat_43.entry.js +2 -2
  20. package/dist/esm/sqm-coupon-code-view-af016712.js +33 -0
  21. package/dist/esm/sqm-coupon-code.entry.js +281 -0
  22. package/dist/esm/sqm-pagination_3.entry.js +1 -1
  23. package/dist/esm/sqm-referral-code.entry.js +173 -0
  24. package/dist/esm/sqm-reward-exchange-list.entry.js +1014 -0
  25. package/dist/esm/sqm-share-code.entry.js +143 -0
  26. package/dist/esm/sqm-share-link.entry.js +98 -0
  27. package/dist/esm/sqm-stencilbook.entry.js +2 -2
  28. package/dist/esm-es5/RewardExchangeListData-11c043e3.js +1 -0
  29. package/dist/esm-es5/{ShadowViewAddon-518e026d.js → ShadowViewAddon-c0600f22.js} +1 -1
  30. package/dist/esm-es5/copy-text-view-3129fb22.js +1 -0
  31. package/dist/esm-es5/copy-text-view-a319c261.js +1 -0
  32. package/dist/esm-es5/sqm-big-stat_43.entry.js +1 -1
  33. package/dist/esm-es5/sqm-coupon-code-view-af016712.js +1 -0
  34. package/dist/esm-es5/sqm-coupon-code.entry.js +1 -0
  35. package/dist/esm-es5/sqm-pagination_3.entry.js +1 -1
  36. package/dist/esm-es5/sqm-referral-code.entry.js +1 -0
  37. package/dist/esm-es5/sqm-reward-exchange-list.entry.js +1 -0
  38. package/dist/esm-es5/sqm-share-code.entry.js +1 -0
  39. package/dist/esm-es5/sqm-share-link.entry.js +1 -0
  40. package/dist/esm-es5/sqm-stencilbook.entry.js +1 -1
  41. package/dist/mint-components/RewardExchangeListData-11c043e3.js +1122 -0
  42. package/dist/mint-components/RewardExchangeListData-546ffbb9.system.js +1 -0
  43. package/dist/mint-components/copy-text-view-3129fb22.js +119 -0
  44. package/dist/mint-components/copy-text-view-33cac657.system.js +1 -0
  45. package/dist/mint-components/mint-components.esm.js +1 -1
  46. package/dist/mint-components/{p-5cbcff66.entry.js → p-1276830a.entry.js} +1 -1
  47. package/dist/mint-components/p-1de49f76.js +1 -0
  48. package/dist/mint-components/{p-761a02d5.js → p-6b904749.js} +1 -1
  49. package/dist/mint-components/p-a89baf7b.system.js +1 -1
  50. package/dist/mint-components/{p-8432d8c2.system.entry.js → p-aa77d858.system.entry.js} +1 -1
  51. package/dist/mint-components/{p-b8ddc820.system.js → p-bdc86ee3.system.js} +1 -1
  52. package/dist/mint-components/{p-b5fe3d2c.system.entry.js → p-be770d69.system.entry.js} +1 -1
  53. package/dist/mint-components/{p-5aeb80dc.entry.js → p-e34b460e.entry.js} +1 -1
  54. package/dist/mint-components/{p-db14cf82.system.entry.js → p-ed69dc98.system.entry.js} +1 -1
  55. package/dist/mint-components/p-f4f57363.system.js +1 -0
  56. package/dist/mint-components/{p-53eaaebf.entry.js → p-f9f67437.entry.js} +1 -1
  57. package/dist/mint-components/sqm-coupon-code-view-40fd8d8b.system.js +1 -0
  58. package/dist/mint-components/sqm-coupon-code-view-af016712.js +33 -0
  59. package/dist/mint-components/sqm-coupon-code.entry.js +281 -0
  60. package/dist/mint-components/sqm-coupon-code.system.entry.js +1 -0
  61. package/dist/mint-components/sqm-referral-code.entry.js +173 -0
  62. package/dist/mint-components/sqm-referral-code.system.entry.js +1 -0
  63. package/dist/mint-components/sqm-reward-exchange-list.entry.js +1014 -0
  64. package/dist/mint-components/sqm-reward-exchange-list.system.entry.js +1 -0
  65. package/dist/mint-components/sqm-share-code.entry.js +143 -0
  66. package/dist/mint-components/sqm-share-code.system.entry.js +1 -0
  67. package/dist/mint-components/sqm-share-link.entry.js +98 -0
  68. package/dist/mint-components/sqm-share-link.system.entry.js +1 -0
  69. package/dist/mint-components/sqm-stencilbook.entry.js +20330 -0
  70. package/dist/mint-components/sqm-stencilbook.system.entry.js +1 -0
  71. package/docs/docs.docx +0 -0
  72. package/package.json +1 -1
  73. package/dist/esm-es5/copy-text-view-b219d166.js +0 -1
  74. package/dist/mint-components/p-25e70b59.js +0 -1
  75. package/dist/mint-components/p-a4bbb947.system.js +0 -1
@@ -0,0 +1,1018 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ const index = require('./index-ad175903.js');
6
+ require('./global-aae86f09.js');
7
+ const domContextHooks_module = require('./dom-context-hooks.module-baf97805.js');
8
+ const index_module = require('./index.module-0ec494e5.js');
9
+ require('./GoogleFonts-039d880f.js');
10
+ require('./jss-preset-default.esm-b48f0c33.js');
11
+ require('./JSS-518e9b4d.js');
12
+ require('./mixins-f51b04f1.js');
13
+ const utils = require('./utils-ebe923b6.js');
14
+ const cjs = require('./cjs-2bf512b9.js');
15
+ require('./copy-text-view-f0313f78.js');
16
+ const RewardExchangeListData = require('./RewardExchangeListData-a787ce54.js');
17
+ const parseStates = require('./parseStates-d1effc19.js');
18
+
19
+ // canvas-confetti v1.4.0 built on 2021-03-10T12:32:33.488Z
20
+ var module$1 = {};
21
+
22
+ // source content
23
+ (function main(global, module, isWorker, workerSize) {
24
+ var canUseWorker = !!(
25
+ global.Worker &&
26
+ global.Blob &&
27
+ global.Promise &&
28
+ global.OffscreenCanvas &&
29
+ global.OffscreenCanvasRenderingContext2D &&
30
+ global.HTMLCanvasElement &&
31
+ global.HTMLCanvasElement.prototype.transferControlToOffscreen &&
32
+ global.URL &&
33
+ global.URL.createObjectURL);
34
+
35
+ function noop() {}
36
+
37
+ // create a promise if it exists, otherwise, just
38
+ // call the function directly
39
+ function promise(func) {
40
+ var ModulePromise = module.exports.Promise;
41
+ var Prom = ModulePromise !== void 0 ? ModulePromise : global.Promise;
42
+
43
+ if (typeof Prom === 'function') {
44
+ return new Prom(func);
45
+ }
46
+
47
+ func(noop, noop);
48
+
49
+ return null;
50
+ }
51
+
52
+ var raf = (function () {
53
+ var TIME = Math.floor(1000 / 60);
54
+ var frame, cancel;
55
+ var frames = {};
56
+ var lastFrameTime = 0;
57
+
58
+ if (typeof requestAnimationFrame === 'function' && typeof cancelAnimationFrame === 'function') {
59
+ frame = function (cb) {
60
+ var id = Math.random();
61
+
62
+ frames[id] = requestAnimationFrame(function onFrame(time) {
63
+ if (lastFrameTime === time || lastFrameTime + TIME - 1 < time) {
64
+ lastFrameTime = time;
65
+ delete frames[id];
66
+
67
+ cb();
68
+ } else {
69
+ frames[id] = requestAnimationFrame(onFrame);
70
+ }
71
+ });
72
+
73
+ return id;
74
+ };
75
+ cancel = function (id) {
76
+ if (frames[id]) {
77
+ cancelAnimationFrame(frames[id]);
78
+ }
79
+ };
80
+ } else {
81
+ frame = function (cb) {
82
+ return setTimeout(cb, TIME);
83
+ };
84
+ cancel = function (timer) {
85
+ return clearTimeout(timer);
86
+ };
87
+ }
88
+
89
+ return { frame: frame, cancel: cancel };
90
+ }());
91
+
92
+ var getWorker = (function () {
93
+ var worker;
94
+ var prom;
95
+ var resolves = {};
96
+
97
+ function decorate(worker) {
98
+ function execute(options, callback) {
99
+ worker.postMessage({ options: options || {}, callback: callback });
100
+ }
101
+ worker.init = function initWorker(canvas) {
102
+ var offscreen = canvas.transferControlToOffscreen();
103
+ worker.postMessage({ canvas: offscreen }, [offscreen]);
104
+ };
105
+
106
+ worker.fire = function fireWorker(options, size, done) {
107
+ if (prom) {
108
+ execute(options, null);
109
+ return prom;
110
+ }
111
+
112
+ var id = Math.random().toString(36).slice(2);
113
+
114
+ prom = promise(function (resolve) {
115
+ function workerDone(msg) {
116
+ if (msg.data.callback !== id) {
117
+ return;
118
+ }
119
+
120
+ delete resolves[id];
121
+ worker.removeEventListener('message', workerDone);
122
+
123
+ prom = null;
124
+ done();
125
+ resolve();
126
+ }
127
+
128
+ worker.addEventListener('message', workerDone);
129
+ execute(options, id);
130
+
131
+ resolves[id] = workerDone.bind(null, { data: { callback: id }});
132
+ });
133
+
134
+ return prom;
135
+ };
136
+
137
+ worker.reset = function resetWorker() {
138
+ worker.postMessage({ reset: true });
139
+
140
+ for (var id in resolves) {
141
+ resolves[id]();
142
+ delete resolves[id];
143
+ }
144
+ };
145
+ }
146
+
147
+ return function () {
148
+ if (worker) {
149
+ return worker;
150
+ }
151
+
152
+ if (!isWorker && canUseWorker) {
153
+ var code = [
154
+ 'var CONFETTI, SIZE = {}, module = {};',
155
+ '(' + main.toString() + ')(this, module, true, SIZE);',
156
+ 'onmessage = function(msg) {',
157
+ ' if (msg.data.options) {',
158
+ ' CONFETTI(msg.data.options).then(function () {',
159
+ ' if (msg.data.callback) {',
160
+ ' postMessage({ callback: msg.data.callback });',
161
+ ' }',
162
+ ' });',
163
+ ' } else if (msg.data.reset) {',
164
+ ' CONFETTI.reset();',
165
+ ' } else if (msg.data.resize) {',
166
+ ' SIZE.width = msg.data.resize.width;',
167
+ ' SIZE.height = msg.data.resize.height;',
168
+ ' } else if (msg.data.canvas) {',
169
+ ' SIZE.width = msg.data.canvas.width;',
170
+ ' SIZE.height = msg.data.canvas.height;',
171
+ ' CONFETTI = module.exports.create(msg.data.canvas);',
172
+ ' }',
173
+ '}',
174
+ ].join('\n');
175
+ try {
176
+ worker = new Worker(URL.createObjectURL(new Blob([code])));
177
+ } catch (e) {
178
+ // eslint-disable-next-line no-console
179
+ typeof console !== undefined && typeof console.warn === 'function' ? console.warn('🎊 Could not load worker', e) : null;
180
+
181
+ return null;
182
+ }
183
+
184
+ decorate(worker);
185
+ }
186
+
187
+ return worker;
188
+ };
189
+ })();
190
+
191
+ var defaults = {
192
+ particleCount: 50,
193
+ angle: 90,
194
+ spread: 45,
195
+ startVelocity: 45,
196
+ decay: 0.9,
197
+ gravity: 1,
198
+ drift: 0,
199
+ ticks: 200,
200
+ x: 0.5,
201
+ y: 0.5,
202
+ shapes: ['square', 'circle'],
203
+ zIndex: 100,
204
+ colors: [
205
+ '#26ccff',
206
+ '#a25afd',
207
+ '#ff5e7e',
208
+ '#88ff5a',
209
+ '#fcff42',
210
+ '#ffa62d',
211
+ '#ff36ff'
212
+ ],
213
+ // probably should be true, but back-compat
214
+ disableForReducedMotion: false,
215
+ scalar: 1
216
+ };
217
+
218
+ function convert(val, transform) {
219
+ return transform ? transform(val) : val;
220
+ }
221
+
222
+ function isOk(val) {
223
+ return !(val === null || val === undefined);
224
+ }
225
+
226
+ function prop(options, name, transform) {
227
+ return convert(
228
+ options && isOk(options[name]) ? options[name] : defaults[name],
229
+ transform
230
+ );
231
+ }
232
+
233
+ function onlyPositiveInt(number){
234
+ return number < 0 ? 0 : Math.floor(number);
235
+ }
236
+
237
+ function randomInt(min, max) {
238
+ // [min, max)
239
+ return Math.floor(Math.random() * (max - min)) + min;
240
+ }
241
+
242
+ function toDecimal(str) {
243
+ return parseInt(str, 16);
244
+ }
245
+
246
+ function colorsToRgb(colors) {
247
+ return colors.map(hexToRgb);
248
+ }
249
+
250
+ function hexToRgb(str) {
251
+ var val = String(str).replace(/[^0-9a-f]/gi, '');
252
+
253
+ if (val.length < 6) {
254
+ val = val[0]+val[0]+val[1]+val[1]+val[2]+val[2];
255
+ }
256
+
257
+ return {
258
+ r: toDecimal(val.substring(0,2)),
259
+ g: toDecimal(val.substring(2,4)),
260
+ b: toDecimal(val.substring(4,6))
261
+ };
262
+ }
263
+
264
+ function getOrigin(options) {
265
+ var origin = prop(options, 'origin', Object);
266
+ origin.x = prop(origin, 'x', Number);
267
+ origin.y = prop(origin, 'y', Number);
268
+
269
+ return origin;
270
+ }
271
+
272
+ function setCanvasWindowSize(canvas) {
273
+ canvas.width = document.documentElement.clientWidth;
274
+ canvas.height = document.documentElement.clientHeight;
275
+ }
276
+
277
+ function setCanvasRectSize(canvas) {
278
+ var rect = canvas.getBoundingClientRect();
279
+ canvas.width = rect.width;
280
+ canvas.height = rect.height;
281
+ }
282
+
283
+ function getCanvas(zIndex) {
284
+ var canvas = document.createElement('canvas');
285
+
286
+ canvas.style.position = 'fixed';
287
+ canvas.style.top = '0px';
288
+ canvas.style.left = '0px';
289
+ canvas.style.pointerEvents = 'none';
290
+ canvas.style.zIndex = zIndex;
291
+
292
+ return canvas;
293
+ }
294
+
295
+ function ellipse(context, x, y, radiusX, radiusY, rotation, startAngle, endAngle, antiClockwise) {
296
+ context.save();
297
+ context.translate(x, y);
298
+ context.rotate(rotation);
299
+ context.scale(radiusX, radiusY);
300
+ context.arc(0, 0, 1, startAngle, endAngle, antiClockwise);
301
+ context.restore();
302
+ }
303
+
304
+ function randomPhysics(opts) {
305
+ var radAngle = opts.angle * (Math.PI / 180);
306
+ var radSpread = opts.spread * (Math.PI / 180);
307
+
308
+ return {
309
+ x: opts.x,
310
+ y: opts.y,
311
+ wobble: Math.random() * 10,
312
+ velocity: (opts.startVelocity * 0.5) + (Math.random() * opts.startVelocity),
313
+ angle2D: -radAngle + ((0.5 * radSpread) - (Math.random() * radSpread)),
314
+ tiltAngle: Math.random() * Math.PI,
315
+ color: opts.color,
316
+ shape: opts.shape,
317
+ tick: 0,
318
+ totalTicks: opts.ticks,
319
+ decay: opts.decay,
320
+ drift: opts.drift,
321
+ random: Math.random() + 5,
322
+ tiltSin: 0,
323
+ tiltCos: 0,
324
+ wobbleX: 0,
325
+ wobbleY: 0,
326
+ gravity: opts.gravity * 3,
327
+ ovalScalar: 0.6,
328
+ scalar: opts.scalar
329
+ };
330
+ }
331
+
332
+ function updateFetti(context, fetti) {
333
+ fetti.x += Math.cos(fetti.angle2D) * fetti.velocity + fetti.drift;
334
+ fetti.y += Math.sin(fetti.angle2D) * fetti.velocity + fetti.gravity;
335
+ fetti.wobble += 0.1;
336
+ fetti.velocity *= fetti.decay;
337
+ fetti.tiltAngle += 0.1;
338
+ fetti.tiltSin = Math.sin(fetti.tiltAngle);
339
+ fetti.tiltCos = Math.cos(fetti.tiltAngle);
340
+ fetti.random = Math.random() + 5;
341
+ fetti.wobbleX = fetti.x + ((10 * fetti.scalar) * Math.cos(fetti.wobble));
342
+ fetti.wobbleY = fetti.y + ((10 * fetti.scalar) * Math.sin(fetti.wobble));
343
+
344
+ var progress = (fetti.tick++) / fetti.totalTicks;
345
+
346
+ var x1 = fetti.x + (fetti.random * fetti.tiltCos);
347
+ var y1 = fetti.y + (fetti.random * fetti.tiltSin);
348
+ var x2 = fetti.wobbleX + (fetti.random * fetti.tiltCos);
349
+ var y2 = fetti.wobbleY + (fetti.random * fetti.tiltSin);
350
+
351
+ context.fillStyle = 'rgba(' + fetti.color.r + ', ' + fetti.color.g + ', ' + fetti.color.b + ', ' + (1 - progress) + ')';
352
+ context.beginPath();
353
+
354
+ if (fetti.shape === 'circle') {
355
+ context.ellipse ?
356
+ context.ellipse(fetti.x, fetti.y, Math.abs(x2 - x1) * fetti.ovalScalar, Math.abs(y2 - y1) * fetti.ovalScalar, Math.PI / 10 * fetti.wobble, 0, 2 * Math.PI) :
357
+ ellipse(context, fetti.x, fetti.y, Math.abs(x2 - x1) * fetti.ovalScalar, Math.abs(y2 - y1) * fetti.ovalScalar, Math.PI / 10 * fetti.wobble, 0, 2 * Math.PI);
358
+ } else {
359
+ context.moveTo(Math.floor(fetti.x), Math.floor(fetti.y));
360
+ context.lineTo(Math.floor(fetti.wobbleX), Math.floor(y1));
361
+ context.lineTo(Math.floor(x2), Math.floor(y2));
362
+ context.lineTo(Math.floor(x1), Math.floor(fetti.wobbleY));
363
+ }
364
+
365
+ context.closePath();
366
+ context.fill();
367
+
368
+ return fetti.tick < fetti.totalTicks;
369
+ }
370
+
371
+ function animate(canvas, fettis, resizer, size, done) {
372
+ var animatingFettis = fettis.slice();
373
+ var context = canvas.getContext('2d');
374
+ var animationFrame;
375
+ var destroy;
376
+
377
+ var prom = promise(function (resolve) {
378
+ function onDone() {
379
+ animationFrame = destroy = null;
380
+
381
+ context.clearRect(0, 0, size.width, size.height);
382
+
383
+ done();
384
+ resolve();
385
+ }
386
+
387
+ function update() {
388
+ if (isWorker && !(size.width === workerSize.width && size.height === workerSize.height)) {
389
+ size.width = canvas.width = workerSize.width;
390
+ size.height = canvas.height = workerSize.height;
391
+ }
392
+
393
+ if (!size.width && !size.height) {
394
+ resizer(canvas);
395
+ size.width = canvas.width;
396
+ size.height = canvas.height;
397
+ }
398
+
399
+ context.clearRect(0, 0, size.width, size.height);
400
+
401
+ animatingFettis = animatingFettis.filter(function (fetti) {
402
+ return updateFetti(context, fetti);
403
+ });
404
+
405
+ if (animatingFettis.length) {
406
+ animationFrame = raf.frame(update);
407
+ } else {
408
+ onDone();
409
+ }
410
+ }
411
+
412
+ animationFrame = raf.frame(update);
413
+ destroy = onDone;
414
+ });
415
+
416
+ return {
417
+ addFettis: function (fettis) {
418
+ animatingFettis = animatingFettis.concat(fettis);
419
+
420
+ return prom;
421
+ },
422
+ canvas: canvas,
423
+ promise: prom,
424
+ reset: function () {
425
+ if (animationFrame) {
426
+ raf.cancel(animationFrame);
427
+ }
428
+
429
+ if (destroy) {
430
+ destroy();
431
+ }
432
+ }
433
+ };
434
+ }
435
+
436
+ function confettiCannon(canvas, globalOpts) {
437
+ var isLibCanvas = !canvas;
438
+ var allowResize = !!prop(globalOpts || {}, 'resize');
439
+ var globalDisableForReducedMotion = prop(globalOpts, 'disableForReducedMotion', Boolean);
440
+ var shouldUseWorker = canUseWorker && !!prop(globalOpts || {}, 'useWorker');
441
+ var worker = shouldUseWorker ? getWorker() : null;
442
+ var resizer = isLibCanvas ? setCanvasWindowSize : setCanvasRectSize;
443
+ var initialized = (canvas && worker) ? !!canvas.__confetti_initialized : false;
444
+ var preferLessMotion = typeof matchMedia === 'function' && matchMedia('(prefers-reduced-motion)').matches;
445
+ var animationObj;
446
+
447
+ function fireLocal(options, size, done) {
448
+ var particleCount = prop(options, 'particleCount', onlyPositiveInt);
449
+ var angle = prop(options, 'angle', Number);
450
+ var spread = prop(options, 'spread', Number);
451
+ var startVelocity = prop(options, 'startVelocity', Number);
452
+ var decay = prop(options, 'decay', Number);
453
+ var gravity = prop(options, 'gravity', Number);
454
+ var drift = prop(options, 'drift', Number);
455
+ var colors = prop(options, 'colors', colorsToRgb);
456
+ var ticks = prop(options, 'ticks', Number);
457
+ var shapes = prop(options, 'shapes');
458
+ var scalar = prop(options, 'scalar');
459
+ var origin = getOrigin(options);
460
+
461
+ var temp = particleCount;
462
+ var fettis = [];
463
+
464
+ var startX = canvas.width * origin.x;
465
+ var startY = canvas.height * origin.y;
466
+
467
+ while (temp--) {
468
+ fettis.push(
469
+ randomPhysics({
470
+ x: startX,
471
+ y: startY,
472
+ angle: angle,
473
+ spread: spread,
474
+ startVelocity: startVelocity,
475
+ color: colors[temp % colors.length],
476
+ shape: shapes[randomInt(0, shapes.length)],
477
+ ticks: ticks,
478
+ decay: decay,
479
+ gravity: gravity,
480
+ drift: drift,
481
+ scalar: scalar
482
+ })
483
+ );
484
+ }
485
+
486
+ // if we have a previous canvas already animating,
487
+ // add to it
488
+ if (animationObj) {
489
+ return animationObj.addFettis(fettis);
490
+ }
491
+
492
+ animationObj = animate(canvas, fettis, resizer, size , done);
493
+
494
+ return animationObj.promise;
495
+ }
496
+
497
+ function fire(options) {
498
+ var disableForReducedMotion = globalDisableForReducedMotion || prop(options, 'disableForReducedMotion', Boolean);
499
+ var zIndex = prop(options, 'zIndex', Number);
500
+
501
+ if (disableForReducedMotion && preferLessMotion) {
502
+ return promise(function (resolve) {
503
+ resolve();
504
+ });
505
+ }
506
+
507
+ if (isLibCanvas && animationObj) {
508
+ // use existing canvas from in-progress animation
509
+ canvas = animationObj.canvas;
510
+ } else if (isLibCanvas && !canvas) {
511
+ // create and initialize a new canvas
512
+ canvas = getCanvas(zIndex);
513
+ document.body.appendChild(canvas);
514
+ }
515
+
516
+ if (allowResize && !initialized) {
517
+ // initialize the size of a user-supplied canvas
518
+ resizer(canvas);
519
+ }
520
+
521
+ var size = {
522
+ width: canvas.width,
523
+ height: canvas.height
524
+ };
525
+
526
+ if (worker && !initialized) {
527
+ worker.init(canvas);
528
+ }
529
+
530
+ initialized = true;
531
+
532
+ if (worker) {
533
+ canvas.__confetti_initialized = true;
534
+ }
535
+
536
+ function onResize() {
537
+ if (worker) {
538
+ // TODO this really shouldn't be immediate, because it is expensive
539
+ var obj = {
540
+ getBoundingClientRect: function () {
541
+ if (!isLibCanvas) {
542
+ return canvas.getBoundingClientRect();
543
+ }
544
+ }
545
+ };
546
+
547
+ resizer(obj);
548
+
549
+ worker.postMessage({
550
+ resize: {
551
+ width: obj.width,
552
+ height: obj.height
553
+ }
554
+ });
555
+ return;
556
+ }
557
+
558
+ // don't actually query the size here, since this
559
+ // can execute frequently and rapidly
560
+ size.width = size.height = null;
561
+ }
562
+
563
+ function done() {
564
+ animationObj = null;
565
+
566
+ if (allowResize) {
567
+ global.removeEventListener('resize', onResize);
568
+ }
569
+
570
+ if (isLibCanvas && canvas) {
571
+ document.body.removeChild(canvas);
572
+ canvas = null;
573
+ initialized = false;
574
+ }
575
+ }
576
+
577
+ if (allowResize) {
578
+ global.addEventListener('resize', onResize, false);
579
+ }
580
+
581
+ if (worker) {
582
+ return worker.fire(options, size, done);
583
+ }
584
+
585
+ return fireLocal(options, size, done);
586
+ }
587
+
588
+ fire.reset = function () {
589
+ if (worker) {
590
+ worker.reset();
591
+ }
592
+
593
+ if (animationObj) {
594
+ animationObj.reset();
595
+ }
596
+ };
597
+
598
+ return fire;
599
+ }
600
+
601
+ module.exports = confettiCannon(null, { useWorker: true, resize: true });
602
+ module.exports.create = confettiCannon;
603
+ }((function () {
604
+ if (typeof window !== 'undefined') {
605
+ return window;
606
+ }
607
+
608
+ if (typeof self !== 'undefined') {
609
+ return self;
610
+ }
611
+
612
+ return this || {};
613
+ })(), module$1, false));
614
+
615
+ // end source content
616
+
617
+ const confetti = module$1.exports;
618
+ var create = module$1.exports.create;
619
+
620
+ const GET_EXCHANGE_LIST = index_module.dist.gql `
621
+ query getExchangeList {
622
+ viewer {
623
+ ... on User {
624
+ visibleRewardExchangeItems(limit: 20, offset: 0) {
625
+ data {
626
+ key
627
+ name
628
+ description
629
+ imageUrl
630
+ available
631
+ unavailableReasonCode
632
+ ruleType
633
+ sourceUnit
634
+ sourceValue
635
+ prettySourceValue
636
+ sourceMinValue
637
+ prettySourceMinValue
638
+ sourceMaxValue
639
+ prettySourceMaxValue
640
+ destinationMinValue
641
+ prettyDestinationMinValue
642
+ destinationMaxValue
643
+ prettyDestinationMaxValue
644
+ globalRewardKey
645
+ destinationUnit
646
+ steps {
647
+ sourceValue
648
+ prettySourceValue
649
+ destinationValue
650
+ prettyDestinationValue
651
+ available
652
+ globalRewardKey
653
+ unavailableReasonCode
654
+ rewardInput
655
+ }
656
+ }
657
+ totalCount
658
+ }
659
+ }
660
+ }
661
+ }
662
+ `;
663
+ const EXCHANGE = index_module.dist.gql `
664
+ mutation exchange($exchangeRewardInput: ExchangeRewardInput!) {
665
+ exchangeReward(exchangeRewardInput: $exchangeRewardInput) {
666
+ reward {
667
+ id
668
+ fuelTankCode
669
+ }
670
+ }
671
+ }
672
+ `;
673
+ function useRewardExchangeList(props) {
674
+ var _a, _b, _c, _d, _e;
675
+ const [exchangeState, setExchangeState] = domContextHooks_module.useReducer((state, next) => ({
676
+ ...state,
677
+ ...next,
678
+ }), {
679
+ selectedItem: undefined,
680
+ selectedStep: undefined,
681
+ redeemStage: "chooseReward",
682
+ amount: 0,
683
+ exchangeError: false,
684
+ });
685
+ const [open, setOpen] = domContextHooks_module.useState(false);
686
+ const { selectedItem, selectedStep, redeemStage, amount, exchangeError } = exchangeState;
687
+ const user = index_module.J();
688
+ const [exchange, { data: exchangeResponse, loading: exchangeLoading, errors },] = index_module.$e(EXCHANGE);
689
+ const { data, loading, refetch, errors: queryError, } = index_module.wn(GET_EXCHANGE_LIST, {}, !(user === null || user === void 0 ? void 0 : user.jwt));
690
+ domContextHooks_module.useEffect(() => {
691
+ var _a, _b;
692
+ 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) {
693
+ setExchangeState({ redeemStage: "success", exchangeError: false });
694
+ }
695
+ if (!!errors) {
696
+ setExchangeState({ exchangeError: true });
697
+ }
698
+ }, [exchangeResponse, errors]);
699
+ const canvasRef = domContextHooks_module.useRef();
700
+ domContextHooks_module.useEffect(() => {
701
+ if (!canvasRef.current)
702
+ return;
703
+ const canvas = canvasRef.current;
704
+ canvas.confetti =
705
+ canvas.confetti || confetti.create(canvas, { resize: true });
706
+ canvas.confetti();
707
+ }, [canvasRef.current]);
708
+ const { refresh } = index_module.Qe();
709
+ async function exchangeReward() {
710
+ if (!selectedItem)
711
+ return;
712
+ let exchangeVariables = {
713
+ accountId: user === null || user === void 0 ? void 0 : user.accountId,
714
+ userId: user.id,
715
+ };
716
+ switch (selectedItem.ruleType) {
717
+ case "FIXED_GLOBAL_REWARD":
718
+ exchangeVariables = {
719
+ ...exchangeVariables,
720
+ redeemCreditInput: {
721
+ amount: selectedItem.sourceValue,
722
+ unit: selectedItem.sourceUnit,
723
+ },
724
+ globalRewardKey: selectedItem.globalRewardKey,
725
+ };
726
+ break;
727
+ case "STEPPED_FIXED_GLOBAL_REWARD":
728
+ exchangeVariables = {
729
+ ...exchangeVariables,
730
+ redeemCreditInput: {
731
+ amount: selectedStep.sourceValue,
732
+ unit: selectedItem.sourceUnit,
733
+ },
734
+ globalRewardKey: selectedStep.globalRewardKey,
735
+ };
736
+ break;
737
+ case "VARIABLE_GLOBAL_REWARD":
738
+ exchangeVariables = {
739
+ ...exchangeVariables,
740
+ redeemCreditInput: {
741
+ amount: amount,
742
+ unit: selectedItem.sourceUnit,
743
+ },
744
+ globalRewardKey: selectedItem.globalRewardKey,
745
+ rewardInput: selectedStep.rewardInput,
746
+ };
747
+ break;
748
+ case "VARIABLE_CREDIT_REWARD":
749
+ exchangeVariables = {
750
+ ...exchangeVariables,
751
+ redeemCreditInput: {
752
+ amount: amount,
753
+ unit: selectedItem.sourceUnit,
754
+ },
755
+ rewardInput: {
756
+ type: "CREDIT",
757
+ unit: selectedItem.destinationUnit,
758
+ assignedCredit: selectedStep.destinationValue,
759
+ },
760
+ };
761
+ break;
762
+ default:
763
+ exchangeVariables = {
764
+ ...exchangeVariables,
765
+ ...selectedStep.rewardInput,
766
+ };
767
+ }
768
+ await exchange({ exchangeRewardInput: exchangeVariables });
769
+ refresh();
770
+ }
771
+ const resetState = (refresh) => {
772
+ refresh && refetch();
773
+ setExchangeState({
774
+ amount: 0,
775
+ selectedStep: undefined,
776
+ selectedItem: undefined,
777
+ exchangeError: false,
778
+ redeemStage: "chooseReward",
779
+ });
780
+ };
781
+ function setStage(stage) {
782
+ setExchangeState({ redeemStage: stage });
783
+ }
784
+ function copyFuelTankCode() {
785
+ var _a, _b;
786
+ 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);
787
+ setOpen(true);
788
+ setTimeout(() => setOpen(false), 1000);
789
+ }
790
+ return {
791
+ states: {
792
+ content: {
793
+ text: props,
794
+ },
795
+ selectedItem,
796
+ redeemStage,
797
+ amount,
798
+ selectedStep,
799
+ exchangeError,
800
+ queryError: !!queryError,
801
+ loading: loading || exchangeLoading,
802
+ open,
803
+ noExchangeOptions: ((_a = data === null || data === void 0 ? void 0 : data.viewer) === null || _a === void 0 ? void 0 : _a.visibleRewardExchangeItems.totalCount) === 0,
804
+ },
805
+ data: {
806
+ exchangeList: (_c = (_b = data === null || data === void 0 ? void 0 : data.viewer) === null || _b === void 0 ? void 0 : _b.visibleRewardExchangeItems) === null || _c === void 0 ? void 0 : _c.data,
807
+ fuelTankCode: (_e = (_d = exchangeResponse === null || exchangeResponse === void 0 ? void 0 : exchangeResponse.exchangeReward) === null || _d === void 0 ? void 0 : _d.reward) === null || _e === void 0 ? void 0 : _e.fuelTankCode,
808
+ },
809
+ callbacks: {
810
+ exchangeReward,
811
+ setExchangeState,
812
+ setStage,
813
+ resetState,
814
+ copyFuelTankCode,
815
+ },
816
+ refs: {
817
+ canvasRef,
818
+ },
819
+ };
820
+ }
821
+
822
+ const SqmRewardExchangeList = class {
823
+ constructor(hostRef) {
824
+ index.registerInstance(this, hostRef);
825
+ this.ignored = true;
826
+ /**
827
+ * Error message shown when reward is not available
828
+ *
829
+ * @uiName Not available error
830
+ * @uiWidget textArea
831
+ */
832
+ this.notAvailableError = "{unavailableReasonCode, select, US_TAX {US Tax limit} INSUFFICIENT_REDEEMABLE_CREDIT {{sourceValue} required} AVAILABILITY_PREDICATE {Not available} other {{unavailableReasonCode}} }";
833
+ /**
834
+ * @uiName Choose reward progress title
835
+ */
836
+ this.chooseRewardTitle = "Rewards";
837
+ /**
838
+ * @uiName Choose amount progress title
839
+ */
840
+ this.chooseAmountTitle = "Select";
841
+ /**
842
+ * @uiName Confirmation progress title
843
+ */
844
+ this.confirmationTitle = "Confirm";
845
+ /**
846
+ * @uiName Reward title text
847
+ */
848
+ this.rewardTitle = "Choose a reward";
849
+ /**
850
+ * @uiName Cancel button text
851
+ */
852
+ this.cancelText = "Cancel";
853
+ /**
854
+ * @uiName Back button text
855
+ */
856
+ this.backText = "Back";
857
+ /**
858
+ * @uiName Continue button text
859
+ */
860
+ this.continueText = "Continue";
861
+ /**
862
+ * Displayed on the reward selection page.
863
+ * @uiName Continue to confirmation button text
864
+ */
865
+ this.continueToConfirmationText = "Continue to confirmation";
866
+ /**
867
+ * @uiName Redeem button text
868
+ */
869
+ this.redeemText = "Redeem";
870
+ /**
871
+ * Displayed as the header for the confirmation page.
872
+ *
873
+ * @uiName Confirmation title text
874
+ */
875
+ this.redeemTitle = "Confirm and redeem";
876
+ /**
877
+ * Displayed on the success screen when a user successfully exchanges for a reward.
878
+ *
879
+ * @uiName Redemption success message
880
+ * @uiWidget textArea
881
+ */
882
+ this.redemptionSuccessText = "Redeemed {sourceValue} for {destinationValue}";
883
+ /**
884
+ * Displayed on the reward exchange cards.
885
+ *
886
+ * @uiName Reward exchange amount text
887
+ * @uiWidget textArea
888
+ */
889
+ this.sourceAmountMessage = "{ruleType, select, FIXED_GLOBAL_REWARD {{sourceValue}} other {{sourceMinValue} to {sourceMaxValue}}}";
890
+ /**
891
+ * Shown when a user copies a fuel tank code
892
+ *
893
+ * @uiName Tooltip text
894
+ */
895
+ this.tooltipText = "Copied";
896
+ /**
897
+ * @uiName Done text
898
+ */
899
+ this.doneText = "Done";
900
+ /**
901
+ * @uiName Select amount text
902
+ * @uiWidget textArea
903
+ */
904
+ this.selectText = "Select amount to receive";
905
+ /**
906
+ * Shown if an error occurs when loading the reward exchange.
907
+ *
908
+ * @uiName Reward list error message
909
+ * @uiWidget textArea
910
+ */
911
+ this.queryError = "Unable to load reward exchange list. Please try again";
912
+ /**
913
+ * Shown if an error occurs during the reward exchange.
914
+ *
915
+ * @uiName Redemption error message
916
+ * @uiWidget textArea
917
+ */
918
+ this.redemptionError = "An error occured trying to redeem this reward. Please try again";
919
+ /**
920
+ * @uiName Not enough error message
921
+ * @uiWidget textArea
922
+ */
923
+ this.notEnoughError = "Not enough {sourceUnit} to redeem for this reward";
924
+ /**
925
+ * @uiName Reward redeemed text
926
+ */
927
+ this.rewardRedeemedText = "Reward redeemed";
928
+ /**
929
+ * @uiName Promo code text
930
+ */
931
+ this.promoCode = "Promo Code";
932
+ /**
933
+ * Set the number of placeholder cards to be shown in loading state.
934
+ *
935
+ * @uiName Loading cards
936
+ */
937
+ this.skeletonCardNum = 8;
938
+ /**
939
+ * Shown in the confirmation state.
940
+ *
941
+ * @uiName Reward row title
942
+ */
943
+ this.rewardNameTitle = "Reward";
944
+ /**
945
+ * Shown in the confirmation state.
946
+ *
947
+ * @uiName Reward amount row title
948
+ */
949
+ this.rewardAmountTitle = "Reward Amount";
950
+ /**
951
+ * Shown in the confirmation state.
952
+ *
953
+ * @uiName Cost row title
954
+ */
955
+ this.costTitle = "Cost to Redeem";
956
+ /**
957
+ * @componentState { "title": "Choose reward", "props": { "redeemStage": "chooseReward" }, "dependencies": ["sqm-reward-exchange-list"] }
958
+ * @componentState { "title": "Reward details", "props": { "redeemStage": "chooseAmount" }, "dependencies": ["sqm-reward-exchange-list"] }
959
+ * @componentState { "title": "Confirm exchange", "props": { "redeemStage": "confirmation" }, "dependencies": ["sqm-reward-exchange-list"] }
960
+ * @componentState { "title": "Exchange successful", "props": { "redeemStage": "success" }, "dependencies": ["sqm-reward-exchange-list"] }
961
+ */
962
+ this.stateController = "{}";
963
+ domContextHooks_module.h$1(this);
964
+ }
965
+ disconnectedCallback() { }
966
+ render() {
967
+ const props = {
968
+ ...utils.getProps(this),
969
+ empty: index.h(EmptySlot, null),
970
+ };
971
+ const { states, data, callbacks, refs } = index_module.isDemo()
972
+ ? useRewardExchangeListDemo(props)
973
+ : useRewardExchangeList(props);
974
+ return (index.h(index.Host, { style: { display: "contents" } }, index.h(RewardExchangeListData.RewardExchangeView, { states: states, data: data, callbacks: callbacks, refs: refs })));
975
+ }
976
+ static get assetsDirs() { return ["assets"]; }
977
+ };
978
+ function EmptySlot() {
979
+ return (index.h("slot", { name: "empty" }, index.h("sqm-empty", { emptyStateImage: "https://res.cloudinary.com/saasquatch/image/upload/v1644360953/squatch-assets/empty_exchange2.png", emptyStateHeader: "Redeem rewards", emptyStateText: "Use your points to redeem rewards once they become available" })));
980
+ }
981
+ function useRewardExchangeListDemo(props) {
982
+ const states = parseStates.parseStates(props.stateController);
983
+ const formatted = Object.keys(states).reduce((prev, key) => key === "reward-exchange-list"
984
+ ? { ...prev, ...states[key] }
985
+ : { ...prev, [`${key}_stateController`]: states[key] }, {});
986
+ return cjs.cjs({
987
+ states: {
988
+ content: {
989
+ text: props,
990
+ },
991
+ redeemStage: "chooseReward",
992
+ amount: 0,
993
+ selectedStep: undefined,
994
+ selectedItem: undefined,
995
+ open: false,
996
+ exchangeError: false,
997
+ queryError: false,
998
+ loading: false,
999
+ noExchangeOptions: false,
1000
+ },
1001
+ data: {
1002
+ // shareCode: "SHARECODE123",
1003
+ exchangeList: RewardExchangeListData.demoRewardExchange.data.exchangeList,
1004
+ },
1005
+ callbacks: {
1006
+ exchangeReward: () => { },
1007
+ setExchangeState: (_) => { },
1008
+ setStage: (_) => { },
1009
+ resetState: () => { },
1010
+ copyFuelTankCode: () => { },
1011
+ },
1012
+ refs: {
1013
+ canvasRef: {},
1014
+ },
1015
+ }, props.demoData || formatted || {}, { arrayMerge: (_, a) => a });
1016
+ }
1017
+
1018
+ exports.sqm_reward_exchange_list = SqmRewardExchangeList;