@bigbinary/neeto-molecules 3.16.19 → 3.16.21

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.
@@ -7,52 +7,648 @@ var neetoCist = require('@bigbinary/neeto-cist');
7
7
  var Stepper = require('@bigbinary/neetoui/Stepper');
8
8
  var _defineProperty = require('@babel/runtime/helpers/defineProperty');
9
9
  var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
10
- var withT = require('@bigbinary/neeto-commons-frontend/react-utils/withT');
11
10
  var Button = require('@bigbinary/neetoui/Button');
12
11
  var Typography = require('@bigbinary/neetoui/Typography');
13
12
  var jsxRuntime = require('react/jsx-runtime');
14
- var injectCss = require('./inject-css-vQvjPR2x.js');
13
+ var reactI18next = require('react-i18next');
15
14
  var i18next = require('i18next');
16
15
  var useBreakpoints = require('@bigbinary/neeto-commons-frontend/react-utils/useBreakpoints');
17
16
  var RightArrow = require('@bigbinary/neeto-icons/RightArrow');
18
- var reactI18next = require('react-i18next');
17
+ var injectCss = require('./inject-css-vQvjPR2x.js');
18
+ var withT = require('@bigbinary/neeto-commons-frontend/react-utils/withT');
19
19
 
20
- function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
21
- function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
22
- var CompletedScreen = withT(function (_ref) {
23
- var t = _ref.t,
24
- completeButtonProps = _ref.completeButtonProps;
25
- return /*#__PURE__*/jsxRuntime.jsxs("div", {
26
- className: "neeto-molecules-onboarding__wrapper",
27
- "data-testid": "onboarding-congratulations-wrapper",
28
- children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
29
- className: "mx-auto mb-6 w-full max-w-2xl space-y-2 px-6 pt-16",
30
- children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
31
- className: "text-center",
32
- "data-cy": "onboarding-congratulations-emoji",
33
- style: "h1",
34
- children: "\uD83C\uDF89"
35
- }), /*#__PURE__*/jsxRuntime.jsxs(Typography, {
36
- className: "text-center",
37
- "data-cy": "onboarding-congratulations-title",
38
- "data-testid": "onboarding-congratulations-title",
39
- style: "h1",
40
- children: [/*#__PURE__*/jsxRuntime.jsx("span", {
41
- className: "neeto-ui-text-success-500",
42
- children: t("neetoMolecules.onboarding.congratulations")
43
- }), /*#__PURE__*/jsxRuntime.jsx("br", {}), t("neetoMolecules.onboarding.readyToUse", {
44
- appName: neetoCist.capitalize(initializers.globalProps.appName)
45
- })]
46
- })]
47
- }), /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread$1({
48
- "data-cy": "onboarding-congratulations-button",
49
- "data-testid": "onboarding-congratulations-button",
50
- label: t("neetoMolecules.onboarding.helpScreen.startUsingButton", {
51
- appName: initializers.globalProps.appName
52
- })
53
- }, completeButtonProps))]
54
- });
55
- });
20
+ // t: current time, b: beginning value, _c: final value, d: total duration
21
+ var tweenFunctions = {
22
+ linear: function(t, b, _c, d) {
23
+ var c = _c - b;
24
+ return c * t / d + b;
25
+ },
26
+ easeInQuad: function(t, b, _c, d) {
27
+ var c = _c - b;
28
+ return c * (t /= d) * t + b;
29
+ },
30
+ easeOutQuad: function(t, b, _c, d) {
31
+ var c = _c - b;
32
+ return -c * (t /= d) * (t - 2) + b;
33
+ },
34
+ easeInOutQuad: function(t, b, _c, d) {
35
+ var c = _c - b;
36
+ if ((t /= d / 2) < 1) {
37
+ return c / 2 * t * t + b;
38
+ } else {
39
+ return -c / 2 * ((--t) * (t - 2) - 1) + b;
40
+ }
41
+ },
42
+ easeInCubic: function(t, b, _c, d) {
43
+ var c = _c - b;
44
+ return c * (t /= d) * t * t + b;
45
+ },
46
+ easeOutCubic: function(t, b, _c, d) {
47
+ var c = _c - b;
48
+ return c * ((t = t / d - 1) * t * t + 1) + b;
49
+ },
50
+ easeInOutCubic: function(t, b, _c, d) {
51
+ var c = _c - b;
52
+ if ((t /= d / 2) < 1) {
53
+ return c / 2 * t * t * t + b;
54
+ } else {
55
+ return c / 2 * ((t -= 2) * t * t + 2) + b;
56
+ }
57
+ },
58
+ easeInQuart: function(t, b, _c, d) {
59
+ var c = _c - b;
60
+ return c * (t /= d) * t * t * t + b;
61
+ },
62
+ easeOutQuart: function(t, b, _c, d) {
63
+ var c = _c - b;
64
+ return -c * ((t = t / d - 1) * t * t * t - 1) + b;
65
+ },
66
+ easeInOutQuart: function(t, b, _c, d) {
67
+ var c = _c - b;
68
+ if ((t /= d / 2) < 1) {
69
+ return c / 2 * t * t * t * t + b;
70
+ } else {
71
+ return -c / 2 * ((t -= 2) * t * t * t - 2) + b;
72
+ }
73
+ },
74
+ easeInQuint: function(t, b, _c, d) {
75
+ var c = _c - b;
76
+ return c * (t /= d) * t * t * t * t + b;
77
+ },
78
+ easeOutQuint: function(t, b, _c, d) {
79
+ var c = _c - b;
80
+ return c * ((t = t / d - 1) * t * t * t * t + 1) + b;
81
+ },
82
+ easeInOutQuint: function(t, b, _c, d) {
83
+ var c = _c - b;
84
+ if ((t /= d / 2) < 1) {
85
+ return c / 2 * t * t * t * t * t + b;
86
+ } else {
87
+ return c / 2 * ((t -= 2) * t * t * t * t + 2) + b;
88
+ }
89
+ },
90
+ easeInSine: function(t, b, _c, d) {
91
+ var c = _c - b;
92
+ return -c * Math.cos(t / d * (Math.PI / 2)) + c + b;
93
+ },
94
+ easeOutSine: function(t, b, _c, d) {
95
+ var c = _c - b;
96
+ return c * Math.sin(t / d * (Math.PI / 2)) + b;
97
+ },
98
+ easeInOutSine: function(t, b, _c, d) {
99
+ var c = _c - b;
100
+ return -c / 2 * (Math.cos(Math.PI * t / d) - 1) + b;
101
+ },
102
+ easeInExpo: function(t, b, _c, d) {
103
+ var c = _c - b;
104
+ return (t==0) ? b : c * Math.pow(2, 10 * (t/d - 1)) + b;
105
+ },
106
+ easeOutExpo: function(t, b, _c, d) {
107
+ var c = _c - b;
108
+ return (t==d) ? b+c : c * (-Math.pow(2, -10 * t/d) + 1) + b;
109
+ },
110
+ easeInOutExpo: function(t, b, _c, d) {
111
+ var c = _c - b;
112
+ if (t === 0) {
113
+ return b;
114
+ }
115
+ if (t === d) {
116
+ return b + c;
117
+ }
118
+ if ((t /= d / 2) < 1) {
119
+ return c / 2 * Math.pow(2, 10 * (t - 1)) + b;
120
+ } else {
121
+ return c / 2 * (-Math.pow(2, -10 * --t) + 2) + b;
122
+ }
123
+ },
124
+ easeInCirc: function(t, b, _c, d) {
125
+ var c = _c - b;
126
+ return -c * (Math.sqrt(1 - (t /= d) * t) - 1) + b;
127
+ },
128
+ easeOutCirc: function(t, b, _c, d) {
129
+ var c = _c - b;
130
+ return c * Math.sqrt(1 - (t = t / d - 1) * t) + b;
131
+ },
132
+ easeInOutCirc: function(t, b, _c, d) {
133
+ var c = _c - b;
134
+ if ((t /= d / 2) < 1) {
135
+ return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b;
136
+ } else {
137
+ return c / 2 * (Math.sqrt(1 - (t -= 2) * t) + 1) + b;
138
+ }
139
+ },
140
+ easeInElastic: function(t, b, _c, d) {
141
+ var c = _c - b;
142
+ var a, p, s;
143
+ s = 1.70158;
144
+ p = 0;
145
+ a = c;
146
+ if (t === 0) {
147
+ return b;
148
+ } else if ((t /= d) === 1) {
149
+ return b + c;
150
+ }
151
+ if (!p) {
152
+ p = d * 0.3;
153
+ }
154
+ if (a < Math.abs(c)) {
155
+ a = c;
156
+ s = p / 4;
157
+ } else {
158
+ s = p / (2 * Math.PI) * Math.asin(c / a);
159
+ }
160
+ return -(a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
161
+ },
162
+ easeOutElastic: function(t, b, _c, d) {
163
+ var c = _c - b;
164
+ var a, p, s;
165
+ s = 1.70158;
166
+ p = 0;
167
+ a = c;
168
+ if (t === 0) {
169
+ return b;
170
+ } else if ((t /= d) === 1) {
171
+ return b + c;
172
+ }
173
+ if (!p) {
174
+ p = d * 0.3;
175
+ }
176
+ if (a < Math.abs(c)) {
177
+ a = c;
178
+ s = p / 4;
179
+ } else {
180
+ s = p / (2 * Math.PI) * Math.asin(c / a);
181
+ }
182
+ return a * Math.pow(2, -10 * t) * Math.sin((t * d - s) * (2 * Math.PI) / p) + c + b;
183
+ },
184
+ easeInOutElastic: function(t, b, _c, d) {
185
+ var c = _c - b;
186
+ var a, p, s;
187
+ s = 1.70158;
188
+ p = 0;
189
+ a = c;
190
+ if (t === 0) {
191
+ return b;
192
+ } else if ((t /= d / 2) === 2) {
193
+ return b + c;
194
+ }
195
+ if (!p) {
196
+ p = d * (0.3 * 1.5);
197
+ }
198
+ if (a < Math.abs(c)) {
199
+ a = c;
200
+ s = p / 4;
201
+ } else {
202
+ s = p / (2 * Math.PI) * Math.asin(c / a);
203
+ }
204
+ if (t < 1) {
205
+ return -0.5 * (a * Math.pow(2, 10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p)) + b;
206
+ } else {
207
+ return a * Math.pow(2, -10 * (t -= 1)) * Math.sin((t * d - s) * (2 * Math.PI) / p) * 0.5 + c + b;
208
+ }
209
+ },
210
+ easeInBack: function(t, b, _c, d, s) {
211
+ var c = _c - b;
212
+ if (s === void 0) {
213
+ s = 1.70158;
214
+ }
215
+ return c * (t /= d) * t * ((s + 1) * t - s) + b;
216
+ },
217
+ easeOutBack: function(t, b, _c, d, s) {
218
+ var c = _c - b;
219
+ if (s === void 0) {
220
+ s = 1.70158;
221
+ }
222
+ return c * ((t = t / d - 1) * t * ((s + 1) * t + s) + 1) + b;
223
+ },
224
+ easeInOutBack: function(t, b, _c, d, s) {
225
+ var c = _c - b;
226
+ if (s === void 0) {
227
+ s = 1.70158;
228
+ }
229
+ if ((t /= d / 2) < 1) {
230
+ return c / 2 * (t * t * (((s *= 1.525) + 1) * t - s)) + b;
231
+ } else {
232
+ return c / 2 * ((t -= 2) * t * (((s *= 1.525) + 1) * t + s) + 2) + b;
233
+ }
234
+ },
235
+ easeInBounce: function(t, b, _c, d) {
236
+ var c = _c - b;
237
+ var v;
238
+ v = tweenFunctions.easeOutBounce(d - t, 0, c, d);
239
+ return c - v + b;
240
+ },
241
+ easeOutBounce: function(t, b, _c, d) {
242
+ var c = _c - b;
243
+ if ((t /= d) < 1 / 2.75) {
244
+ return c * (7.5625 * t * t) + b;
245
+ } else if (t < 2 / 2.75) {
246
+ return c * (7.5625 * (t -= 1.5 / 2.75) * t + 0.75) + b;
247
+ } else if (t < 2.5 / 2.75) {
248
+ return c * (7.5625 * (t -= 2.25 / 2.75) * t + 0.9375) + b;
249
+ } else {
250
+ return c * (7.5625 * (t -= 2.625 / 2.75) * t + 0.984375) + b;
251
+ }
252
+ },
253
+ easeInOutBounce: function(t, b, _c, d) {
254
+ var c = _c - b;
255
+ var v;
256
+ if (t < d / 2) {
257
+ v = tweenFunctions.easeInBounce(t * 2, 0, c, d);
258
+ return v * 0.5 + b;
259
+ } else {
260
+ v = tweenFunctions.easeOutBounce(t * 2 - d, 0, c, d);
261
+ return v * 0.5 + c * 0.5 + b;
262
+ }
263
+ }
264
+ };
265
+
266
+ var tweenFunctions_1 = tweenFunctions;
267
+
268
+ function degreesToRads(degrees) {
269
+ return (degrees * Math.PI) / 180;
270
+ }
271
+ function randomRange(min, max) {
272
+ return min + Math.random() * (max - min);
273
+ }
274
+ function randomInt(min, max) {
275
+ return Math.floor(min + Math.random() * (max - min + 1));
276
+ }
277
+
278
+ var ParticleShape;
279
+ (function (ParticleShape) {
280
+ ParticleShape[ParticleShape["Circle"] = 0] = "Circle";
281
+ ParticleShape[ParticleShape["Square"] = 1] = "Square";
282
+ ParticleShape[ParticleShape["Strip"] = 2] = "Strip";
283
+ })(ParticleShape || (ParticleShape = {}));
284
+ var RotationDirection;
285
+ (function (RotationDirection) {
286
+ RotationDirection[RotationDirection["Positive"] = 1] = "Positive";
287
+ RotationDirection[RotationDirection["Negative"] = -1] = "Negative";
288
+ })(RotationDirection || (RotationDirection = {}));
289
+ const DEFAULT_FRAME_TIME = 1000 / 60;
290
+ class Particle {
291
+ constructor(context, getOptions, x, y) {
292
+ this.getOptions = getOptions;
293
+ const { colors, initialVelocityX, initialVelocityY } = this.getOptions();
294
+ this.context = context;
295
+ this.x = x;
296
+ this.y = y;
297
+ this.w = randomRange(5, 20);
298
+ this.h = randomRange(5, 20);
299
+ this.radius = randomRange(5, 10);
300
+ this.vx =
301
+ typeof initialVelocityX === 'number'
302
+ ? randomRange(-initialVelocityX, initialVelocityX)
303
+ : randomRange(initialVelocityX.min, initialVelocityX.max);
304
+ this.vy =
305
+ typeof initialVelocityY === 'number'
306
+ ? randomRange(-initialVelocityY, 0)
307
+ : randomRange(initialVelocityY.min, initialVelocityY.max);
308
+ this.shape = randomInt(0, 2);
309
+ this.angle = degreesToRads(randomRange(0, 360));
310
+ this.angularSpin = randomRange(-0.2, 0.2);
311
+ this.color = colors[Math.floor(Math.random() * colors.length)];
312
+ this.rotateY = randomRange(0, 1);
313
+ this.rotationDirection = randomRange(0, 1)
314
+ ? RotationDirection.Positive
315
+ : RotationDirection.Negative;
316
+ }
317
+ update(elapsed) {
318
+ const { gravity, wind, friction, opacity, drawShape } = this.getOptions();
319
+ const frameTimeMultiplier = elapsed / DEFAULT_FRAME_TIME;
320
+ this.x += this.vx * frameTimeMultiplier;
321
+ this.y += this.vy * frameTimeMultiplier;
322
+ this.vy += gravity * frameTimeMultiplier;
323
+ this.vx += wind * frameTimeMultiplier;
324
+ this.vx *= friction ** frameTimeMultiplier;
325
+ this.vy *= friction ** frameTimeMultiplier;
326
+ if (this.rotateY >= 1 &&
327
+ this.rotationDirection === RotationDirection.Positive) {
328
+ this.rotationDirection = RotationDirection.Negative;
329
+ }
330
+ else if (this.rotateY <= -1 &&
331
+ this.rotationDirection === RotationDirection.Negative) {
332
+ this.rotationDirection = RotationDirection.Positive;
333
+ }
334
+ const rotateDelta = 0.1 * this.rotationDirection * frameTimeMultiplier;
335
+ this.rotateY += rotateDelta;
336
+ this.angle += this.angularSpin;
337
+ this.context.save();
338
+ this.context.translate(this.x, this.y);
339
+ this.context.rotate(this.angle);
340
+ this.context.scale(1, this.rotateY);
341
+ this.context.rotate(this.angle);
342
+ this.context.beginPath();
343
+ this.context.fillStyle = this.color;
344
+ this.context.strokeStyle = this.color;
345
+ this.context.globalAlpha = opacity;
346
+ this.context.lineCap = 'round';
347
+ this.context.lineWidth = 2;
348
+ if (drawShape && typeof drawShape === 'function') {
349
+ drawShape.call(this, this.context);
350
+ }
351
+ else {
352
+ switch (this.shape) {
353
+ case ParticleShape.Circle: {
354
+ this.context.beginPath();
355
+ this.context.arc(0, 0, this.radius, 0, 2 * Math.PI);
356
+ this.context.fill();
357
+ break;
358
+ }
359
+ case ParticleShape.Square: {
360
+ this.context.fillRect(-this.w / 2, -this.h / 2, this.w, this.h);
361
+ break;
362
+ }
363
+ case ParticleShape.Strip: {
364
+ this.context.fillRect(-this.w / 6, -this.h / 2, this.w / 3, this.h);
365
+ break;
366
+ }
367
+ }
368
+ }
369
+ this.context.closePath();
370
+ this.context.restore();
371
+ }
372
+ }
373
+
374
+ class ParticleGenerator {
375
+ constructor(canvas, getOptions) {
376
+ this.x = 0;
377
+ this.y = 0;
378
+ this.w = 0;
379
+ this.h = 0;
380
+ this.lastNumberOfPieces = 0;
381
+ this.tweenProgress = 0;
382
+ this.tweenFrom = 0;
383
+ this.particles = [];
384
+ this.particlesGenerated = 0;
385
+ this.removeParticleAt = (i) => {
386
+ this.particles.splice(i, 1);
387
+ };
388
+ this.getParticle = () => {
389
+ const newParticleX = randomRange(this.x, this.w + this.x);
390
+ const newParticleY = randomRange(this.y, this.h + this.y);
391
+ return new Particle(this.context, this.getOptions, newParticleX, newParticleY);
392
+ };
393
+ this.animate = (elapsed) => {
394
+ const { canvas, context, particlesGenerated, lastNumberOfPieces } = this;
395
+ const { run, recycle, numberOfPieces, debug, tweenFunction, tweenDuration, } = this.getOptions();
396
+ if (!run) {
397
+ return false;
398
+ }
399
+ const nP = this.particles.length;
400
+ const activeCount = recycle ? nP : particlesGenerated;
401
+ // Initial population
402
+ if (activeCount < numberOfPieces) {
403
+ // Use the numberOfPieces prop as a key to reset the easing timing
404
+ if (lastNumberOfPieces !== numberOfPieces) {
405
+ this.tweenProgress = 0;
406
+ this.tweenFrom = activeCount;
407
+ this.lastNumberOfPieces = numberOfPieces;
408
+ }
409
+ // Clamp tweenProgress between 0 and tweenDuration
410
+ this.tweenProgress = Math.min(tweenDuration, Math.max(0, this.tweenProgress + elapsed));
411
+ const tweenedVal = tweenFunction(this.tweenProgress, this.tweenFrom, numberOfPieces, tweenDuration);
412
+ const numToAdd = Math.round(tweenedVal - activeCount);
413
+ for (let i = 0; i < numToAdd; i++) {
414
+ this.particles.push(this.getParticle());
415
+ }
416
+ this.particlesGenerated += numToAdd;
417
+ }
418
+ if (debug) {
419
+ // Draw debug text
420
+ context.font = '12px sans-serif';
421
+ context.fillStyle = '#333';
422
+ context.textAlign = 'right';
423
+ context.fillText(`Particles: ${nP}`, canvas.width - 10, canvas.height - 20);
424
+ }
425
+ // Maintain the population, iterating backwards to prevent issues when removing particles
426
+ for (let i = this.particles.length - 1; i >= 0; i--) {
427
+ const p = this.particles[i];
428
+ // Update each particle's position
429
+ p.update(elapsed);
430
+ // Prune the off-canvas particles
431
+ if (p.y > canvas.height ||
432
+ p.y < -100 ||
433
+ p.x > canvas.width + 100 ||
434
+ p.x < -100) {
435
+ if (recycle && activeCount <= numberOfPieces) {
436
+ // Replace the particle with a brand new one
437
+ this.particles[i] = this.getParticle();
438
+ }
439
+ else {
440
+ this.removeParticleAt(i);
441
+ }
442
+ }
443
+ }
444
+ return nP > 0 || activeCount < numberOfPieces;
445
+ };
446
+ this.canvas = canvas;
447
+ const ctx = this.canvas.getContext('2d');
448
+ if (!ctx) {
449
+ throw new Error('Could not get canvas context');
450
+ }
451
+ this.context = ctx;
452
+ this.getOptions = getOptions;
453
+ }
454
+ }
455
+
456
+ const confettiDefaults = {
457
+ width: typeof window !== 'undefined' ? window.innerWidth : 300,
458
+ height: typeof window !== 'undefined' ? window.innerHeight : 200,
459
+ numberOfPieces: 200,
460
+ friction: 0.99,
461
+ wind: 0,
462
+ gravity: 0.1,
463
+ initialVelocityX: 4,
464
+ initialVelocityY: 10,
465
+ colors: [
466
+ '#f44336',
467
+ '#e91e63',
468
+ '#9c27b0',
469
+ '#673ab7',
470
+ '#3f51b5',
471
+ '#2196f3',
472
+ '#03a9f4',
473
+ '#00bcd4',
474
+ '#009688',
475
+ '#4CAF50',
476
+ '#8BC34A',
477
+ '#CDDC39',
478
+ '#FFEB3B',
479
+ '#FFC107',
480
+ '#FF9800',
481
+ '#FF5722',
482
+ '#795548',
483
+ ],
484
+ opacity: 1.0,
485
+ debug: false,
486
+ tweenFunction: tweenFunctions_1.easeInOutQuad,
487
+ tweenDuration: 5000,
488
+ recycle: true,
489
+ run: true,
490
+ };
491
+ class Confetti {
492
+ constructor(canvas, opts) {
493
+ this.lastFrameTime = 0;
494
+ this.setOptionsWithDefaults = (opts) => {
495
+ const computedConfettiDefaults = {
496
+ confettiSource: {
497
+ x: 0,
498
+ y: 0,
499
+ w: this.canvas.width,
500
+ h: 0,
501
+ },
502
+ };
503
+ this._options = {
504
+ ...computedConfettiDefaults,
505
+ ...confettiDefaults,
506
+ ...opts,
507
+ };
508
+ Object.assign(this, opts.confettiSource);
509
+ };
510
+ this.update = (timestamp = 0) => {
511
+ const { options: { run, onConfettiComplete, frameRate }, canvas, context, } = this;
512
+ // Cap elapsed time to 50ms to prevent large time steps
513
+ const elapsed = Math.min(timestamp - this.lastFrameTime, 50);
514
+ // Throttle the frame rate if set
515
+ if (frameRate && elapsed < 1000 / frameRate) {
516
+ this.rafId = requestAnimationFrame(this.update);
517
+ return;
518
+ }
519
+ this.lastFrameTime = timestamp - (frameRate ? elapsed % frameRate : 0);
520
+ if (run) {
521
+ context.fillStyle = 'white';
522
+ context.clearRect(0, 0, canvas.width, canvas.height);
523
+ }
524
+ if (this.generator.animate(elapsed)) {
525
+ this.rafId = requestAnimationFrame(this.update);
526
+ }
527
+ else {
528
+ if (onConfettiComplete &&
529
+ typeof onConfettiComplete === 'function' &&
530
+ this.generator.particlesGenerated > 0) {
531
+ onConfettiComplete.call(this, this);
532
+ }
533
+ this._options.run = false;
534
+ }
535
+ };
536
+ this.reset = () => {
537
+ if (this.generator && this.generator.particlesGenerated > 0) {
538
+ this.generator.particlesGenerated = 0;
539
+ this.generator.particles = [];
540
+ this.generator.lastNumberOfPieces = 0;
541
+ }
542
+ };
543
+ this.stop = () => {
544
+ this.options = { run: false };
545
+ if (this.rafId) {
546
+ cancelAnimationFrame(this.rafId);
547
+ this.rafId = undefined;
548
+ }
549
+ };
550
+ this.canvas = canvas;
551
+ const ctx = this.canvas.getContext('2d');
552
+ if (!ctx) {
553
+ throw new Error('Could not get canvas context');
554
+ }
555
+ this.context = ctx;
556
+ this.generator = new ParticleGenerator(this.canvas, () => this.options);
557
+ this.options = opts;
558
+ this.update();
559
+ }
560
+ get options() {
561
+ return this._options;
562
+ }
563
+ set options(opts) {
564
+ const lastRunState = this._options?.run;
565
+ const lastRecycleState = this._options?.recycle;
566
+ this.setOptionsWithDefaults(opts);
567
+ if (this.generator) {
568
+ Object.assign(this.generator, this.options.confettiSource);
569
+ if (typeof opts.recycle === 'boolean' &&
570
+ opts.recycle &&
571
+ lastRecycleState === false) {
572
+ this.generator.lastNumberOfPieces = this.generator.particles.length;
573
+ }
574
+ }
575
+ if (typeof opts.run === 'boolean' && opts.run && lastRunState === false) {
576
+ this.update();
577
+ }
578
+ }
579
+ }
580
+
581
+ const ref = React.createRef();
582
+ class ReactConfettiInternal extends React.Component {
583
+ constructor(props) {
584
+ super(props);
585
+ this.canvas = React.createRef();
586
+ this.canvas = props.canvasRef || ref;
587
+ }
588
+ componentDidMount() {
589
+ if (this.canvas.current) {
590
+ const opts = extractCanvasProps(this.props)[0];
591
+ this.confetti = new Confetti(this.canvas.current, opts);
592
+ }
593
+ }
594
+ componentDidUpdate() {
595
+ const confettiOptions = extractCanvasProps(this.props)[0];
596
+ if (this.confetti) {
597
+ this.confetti.options = confettiOptions;
598
+ }
599
+ }
600
+ componentWillUnmount() {
601
+ if (this.confetti) {
602
+ this.confetti.stop();
603
+ }
604
+ this.confetti = undefined;
605
+ }
606
+ render() {
607
+ const [confettiOptions, passedProps] = extractCanvasProps(this.props);
608
+ const canvasStyles = {
609
+ zIndex: 2,
610
+ position: 'absolute',
611
+ pointerEvents: 'none',
612
+ top: 0,
613
+ left: 0,
614
+ bottom: 0,
615
+ right: 0,
616
+ ...passedProps.style,
617
+ };
618
+ return (jsxRuntime.jsx("canvas", { width: confettiOptions.width, height: confettiOptions.height, ref: this.canvas, ...passedProps, style: canvasStyles }));
619
+ }
620
+ }
621
+ ReactConfettiInternal.defaultProps = {
622
+ ...confettiDefaults,
623
+ };
624
+ ReactConfettiInternal.displayName = 'ReactConfetti';
625
+ function extractCanvasProps(props) {
626
+ const confettiOptions = {};
627
+ const refs = {};
628
+ const rest = {};
629
+ const confettiOptionKeys = [
630
+ ...Object.keys(confettiDefaults),
631
+ 'confettiSource',
632
+ 'drawShape',
633
+ 'onConfettiComplete',
634
+ 'frameRate',
635
+ ];
636
+ const refProps = ['canvasRef'];
637
+ for (const prop in props) {
638
+ const val = props[prop];
639
+ if (confettiOptionKeys.includes(prop)) {
640
+ confettiOptions[prop] = val;
641
+ }
642
+ else if (refProps.includes(prop)) {
643
+ refProps[prop] = val;
644
+ }
645
+ else {
646
+ rest[prop] = val;
647
+ }
648
+ }
649
+ return [confettiOptions, rest, refs];
650
+ }
651
+ const ReactConfetti = React.forwardRef((props, ref) => jsxRuntime.jsx(ReactConfettiInternal, { canvasRef: ref, ...props }));
56
652
 
57
653
  var GENERAL_ONBOARDING_STEPS = {
58
654
  WELCOME: "welcome",
@@ -60,9 +656,6 @@ var GENERAL_ONBOARDING_STEPS = {
60
656
  FINISH: "finish"
61
657
  };
62
658
 
63
- var css = ".neeto-molecules-onboarding__wrapper{align-items:center;display:flex;flex-direction:column;flex-grow:1;height:100vh;overflow-y:auto;padding:0;width:100%}.neeto-molecules-onboarding__container{display:flex;flex-direction:column;height:100vh;overflow-y:auto;position:relative;width:100%}.neeto-molecules-onboarding__stepper-wrapper{background-color:rgb(var(--neeto-ui-white));border-bottom:1px solid rgb(var(--neeto-ui-gray-200));display:flex;flex-shrink:0;padding:.5rem 1rem;width:100%}@media (min-width:1024px){.neeto-molecules-onboarding__stepper-wrapper{justify-content:center}}.neeto-molecules-onboarding__content{flex-grow:1;min-height:0;overflow-y:auto;width:100%}.neeto-molecules-onboarding__content--forward{animation:slideInRight .4s ease backwards}.neeto-molecules-onboarding__content--backward{animation:slideInLeft .4s ease backwards}@keyframes slideInRight{0%{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}@keyframes slideInLeft{0%{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}";
64
- injectCss.n(css,{});
65
-
66
659
  var HelpScreen = function HelpScreen(_ref) {
67
660
  var setCurrentStep = _ref.setCurrentStep,
68
661
  helpScreenClassName = _ref.helpScreenClassName;
@@ -111,8 +704,8 @@ var HelpScreen = function HelpScreen(_ref) {
111
704
  });
112
705
  };
113
706
 
114
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
115
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
707
+ function ownKeys$1(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
708
+ function _objectSpread$1(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$1(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$1(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
116
709
  var createSteps = function createSteps(onboardingSteps, setCurrentStep, currentStep, helpScreenClassName) {
117
710
  var helpStep = {
118
711
  key: GENERAL_ONBOARDING_STEPS.HELP,
@@ -124,11 +717,101 @@ var createSteps = function createSteps(onboardingSteps, setCurrentStep, currentS
124
717
  })
125
718
  };
126
719
  return onboardingSteps.concat(helpStep).map(function (step, idx) {
127
- return _objectSpread(_objectSpread({}, step), {}, {
720
+ return _objectSpread$1(_objectSpread$1({}, step), {}, {
128
721
  id: idx + 1
129
722
  });
130
723
  });
131
724
  };
725
+ var getWindowDimensions = function getWindowDimensions() {
726
+ return typeof window !== "undefined" ? {
727
+ width: window.innerWidth,
728
+ height: window.innerHeight
729
+ } : {
730
+ width: 100,
731
+ height: 100
732
+ };
733
+ };
734
+
735
+ var useWindowDimensions = function useWindowDimensions() {
736
+ var _useState = React.useState({
737
+ width: 100,
738
+ height: 100
739
+ }),
740
+ _useState2 = _slicedToArray(_useState, 2),
741
+ windowDimensions = _useState2[0],
742
+ setWindowDimensions = _useState2[1];
743
+ React.useLayoutEffect(function () {
744
+ setWindowDimensions(getWindowDimensions());
745
+ function handleResize() {
746
+ setWindowDimensions(getWindowDimensions());
747
+ }
748
+ window.addEventListener("resize", handleResize);
749
+ return function () {
750
+ return window.removeEventListener("resize", handleResize);
751
+ };
752
+ }, []);
753
+ return windowDimensions;
754
+ };
755
+
756
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
757
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
758
+ var CompletedScreen = function CompletedScreen(_ref) {
759
+ var completeButtonProps = _ref.completeButtonProps;
760
+ var _useTranslation = reactI18next.useTranslation(),
761
+ t = _useTranslation.t;
762
+ var _useState = React.useState(true),
763
+ _useState2 = _slicedToArray(_useState, 2),
764
+ dropConfetti = _useState2[0],
765
+ setDropConfetti = _useState2[1];
766
+ var _useWindowDimensions = useWindowDimensions(),
767
+ height = _useWindowDimensions.height,
768
+ width = _useWindowDimensions.width;
769
+ React.useEffect(function () {
770
+ var timer = setTimeout(function () {
771
+ return setDropConfetti(false);
772
+ }, 10000);
773
+ return function () {
774
+ return clearTimeout(timer);
775
+ };
776
+ }, []);
777
+ return /*#__PURE__*/jsxRuntime.jsxs("div", {
778
+ className: "neeto-molecules-onboarding__wrapper",
779
+ "data-testid": "onboarding-congratulations-wrapper",
780
+ children: [/*#__PURE__*/jsxRuntime.jsx(ReactConfetti, {
781
+ height: height,
782
+ width: width,
783
+ recycle: dropConfetti
784
+ }), /*#__PURE__*/jsxRuntime.jsxs("div", {
785
+ className: "mx-auto mb-6 w-full max-w-2xl space-y-2 px-6 pt-16",
786
+ children: [/*#__PURE__*/jsxRuntime.jsx(Typography, {
787
+ className: "text-center",
788
+ "data-cy": "onboarding-congratulations-emoji",
789
+ style: "h1",
790
+ children: "\uD83C\uDF89"
791
+ }), /*#__PURE__*/jsxRuntime.jsxs(Typography, {
792
+ className: "text-center",
793
+ "data-cy": "onboarding-congratulations-title",
794
+ "data-testid": "onboarding-congratulations-title",
795
+ style: "h1",
796
+ children: [/*#__PURE__*/jsxRuntime.jsx("span", {
797
+ className: "neeto-ui-text-success-500",
798
+ children: t("neetoMolecules.onboarding.congratulations")
799
+ }), /*#__PURE__*/jsxRuntime.jsx("br", {}), t("neetoMolecules.onboarding.readyToUse", {
800
+ appName: neetoCist.capitalize(initializers.globalProps.appName)
801
+ })]
802
+ })]
803
+ }), /*#__PURE__*/jsxRuntime.jsx(Button, _objectSpread({
804
+ "data-cy": "onboarding-congratulations-button",
805
+ "data-testid": "onboarding-congratulations-button",
806
+ label: t("neetoMolecules.onboarding.helpScreen.startUsingButton", {
807
+ appName: initializers.globalProps.appName
808
+ })
809
+ }, completeButtonProps))]
810
+ });
811
+ };
812
+
813
+ var css = ".neeto-molecules-onboarding__wrapper{align-items:center;display:flex;flex-direction:column;flex-grow:1;height:100vh;overflow-y:auto;padding:0;width:100%}.neeto-molecules-onboarding__container{display:flex;flex-direction:column;height:100vh;overflow-y:auto;position:relative;width:100%}.neeto-molecules-onboarding__stepper-wrapper{background-color:rgb(var(--neeto-ui-white));border-bottom:1px solid rgb(var(--neeto-ui-gray-200));display:flex;flex-shrink:0;padding:.5rem 1rem;width:100%}@media (min-width:1024px){.neeto-molecules-onboarding__stepper-wrapper{justify-content:center}}.neeto-molecules-onboarding__content{flex-grow:1;min-height:0;overflow-y:auto;width:100%}.neeto-molecules-onboarding__content--forward{animation:slideInRight .4s ease backwards}.neeto-molecules-onboarding__content--backward{animation:slideInLeft .4s ease backwards}@keyframes slideInRight{0%{opacity:0;transform:translateX(100%)}to{opacity:1;transform:translateX(0)}}@keyframes slideInLeft{0%{opacity:0;transform:translateX(-100%)}to{opacity:1;transform:translateX(0)}}";
814
+ injectCss.n(css,{});
132
815
 
133
816
  var WelcomeScreen = withT(function (_ref) {
134
817
  var t = _ref.t,