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