@splash-tech/jackpot-sdk 1.1.4 → 1.1.6

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.
@@ -90,7 +90,7 @@ export class FooterWidget extends BaseWidget {
90
90
  }
91
91
  }
92
92
  removeAllEventListeners() {
93
- this.removeAllEventListeners();
93
+ super.removeAllEventListeners();
94
94
  }
95
95
  destroy() {
96
96
  window.removeEventListener('message', this.childMessageHandler);
@@ -6,6 +6,8 @@ export declare class WinWidget extends BaseWidget {
6
6
  static getInstance(): WinWidget;
7
7
  private childMessageHandler;
8
8
  launch(params: WinWidgetParams): void;
9
+ private animateEnter;
10
+ private cleanupAnimation;
9
11
  removeAllEventListeners(): void;
10
12
  destroy(): void;
11
13
  }
@@ -20,6 +20,7 @@ export class WinWidget extends BaseWidget {
20
20
  });
21
21
  break;
22
22
  case WinWidgetIframeIncomingEvent.winWidgetClose:
23
+ this.destroy();
23
24
  this.emit('close');
24
25
  break;
25
26
  }
@@ -42,18 +43,87 @@ export class WinWidget extends BaseWidget {
42
43
  this.iframe.style.left = '0';
43
44
  this.iframe.style.width = '100%';
44
45
  this.iframe.style.height = '100%';
45
- this.iframe.style.zIndex = '9999999'; // 7
46
+ this.iframe.style.zIndex = '99999999'; // 8
46
47
  this.iframe.style.backgroundColor = 'rgba(0, 0, 0, 0.5)';
47
48
  this.iframe.src = `${this.childAppOrigin}/win-animation-widget`;
48
- this.appendIframe(this.iframe, params.container);
49
- this.setLaunched(true);
49
+ this.animateEnter(this.iframe, params.container);
50
50
  window.addEventListener('message', this.childMessageHandler);
51
51
  }
52
+ animateEnter(iframe, containerSelector) {
53
+ if (!iframe) {
54
+ console.error('Failed to show win widget. Iframe not found.');
55
+ return;
56
+ }
57
+ const targetContainer = containerSelector
58
+ ? document.querySelector(containerSelector)
59
+ : document.body;
60
+ if (!targetContainer) {
61
+ console.error(`Failed to show win widget. Container "${containerSelector}" not found`);
62
+ return;
63
+ }
64
+ const isCustomContainer = !!containerSelector;
65
+ if (isCustomContainer) {
66
+ const style = window.getComputedStyle(targetContainer);
67
+ if (style.position === 'static') {
68
+ targetContainer.style.position = 'relative';
69
+ }
70
+ }
71
+ // create circular container
72
+ const container = document.createElement('div');
73
+ container.dataset.winWidget = 'container';
74
+ Object.assign(container.style, {
75
+ position: isCustomContainer ? 'absolute' : 'fixed',
76
+ inset: '0',
77
+ width: '100%',
78
+ height: '100%',
79
+ overflow: 'hidden',
80
+ zIndex: '99999999', // 8
81
+ clipPath: 'circle(0% at 50% 50%)',
82
+ transition: 'clip-path 1.2s cubic-bezier(0.22, 1, 0.36, 1)',
83
+ });
84
+ // append circular container into targetContainer, and iframe into circular container
85
+ targetContainer.appendChild(container);
86
+ container.appendChild(iframe);
87
+ // create overlay
88
+ const overlay = document.createElement('div');
89
+ overlay.dataset.winWidget = 'overlay';
90
+ Object.assign(overlay.style, {
91
+ position: isCustomContainer ? 'absolute' : 'fixed',
92
+ inset: '0',
93
+ width: '100%',
94
+ height: '100%',
95
+ background: 'rgba(0,0,0,0)',
96
+ zIndex: '9999999', // 7
97
+ backdropFilter: 'blur(0px)',
98
+ transition: 'background 0.8s ease, backdrop-filter 0.8s ease',
99
+ });
100
+ // append overlay
101
+ targetContainer.appendChild(overlay);
102
+ // animate overlay blur
103
+ requestAnimationFrame(() => {
104
+ overlay.style.background = 'rgba(0,0,0,0.4)';
105
+ overlay.style.backdropFilter = 'blur(8px)';
106
+ });
107
+ // animate circular container growth
108
+ setTimeout(() => {
109
+ container.style.clipPath = 'circle(150% at 50% 50%)';
110
+ }, 800);
111
+ this.setLaunched(true);
112
+ }
113
+ cleanupAnimation(containerSelector) {
114
+ var _a, _b;
115
+ const container = containerSelector
116
+ ? document.querySelector(containerSelector) || document
117
+ : document;
118
+ (_a = container.querySelector('[data-win-widget="overlay"]')) === null || _a === void 0 ? void 0 : _a.remove();
119
+ (_b = container.querySelector('[data-win-widget="container"]')) === null || _b === void 0 ? void 0 : _b.remove();
120
+ }
52
121
  removeAllEventListeners() {
53
- this.removeAllEventListeners();
122
+ super.removeAllEventListeners();
54
123
  }
55
124
  destroy() {
56
125
  window.removeEventListener('message', this.childMessageHandler);
126
+ this.cleanupAnimation();
57
127
  this.removeIframe();
58
128
  }
59
129
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@splash-tech/jackpot-sdk",
3
- "version": "1.1.4",
3
+ "version": "1.1.6",
4
4
  "description": "SDK for managing jackpot widgets in iframes",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,11 +10,8 @@
10
10
  ],
11
11
  "scripts": {
12
12
  "clean": "rm -rf dist",
13
- "build:local": "npm run clean && tsc",
14
- "build:dev": "npm run clean && tsc",
15
- "build:staging": "npm run clean && tsc",
16
- "build:prod": "npm run clean && tsc",
17
- "publish": "npm run build:prod && npm publish",
13
+ "build": "npm run clean && tsc",
14
+ "publish:npm": "npm run build && npm publish",
18
15
  "test": "echo \"Error: no test specified\" && exit 1"
19
16
  },
20
17
  "keywords": [