@saasquatch/mint-components 1.7.0-21 → 1.7.0-22

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