@placetopay/lightbox-sdk 2.3.0 → 2.4.0
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.
- package/dist/constants.d.ts +2 -1
- package/dist/constants.js +1 -0
- package/dist/helpers.js +36 -34
- package/package.json +30 -30
package/dist/constants.d.ts
CHANGED
|
@@ -7,7 +7,8 @@ export declare enum ElementIds {
|
|
|
7
7
|
export declare enum LightboxEvents {
|
|
8
8
|
CLOSE = "close",
|
|
9
9
|
UPDATE_STYLES = "updateStyles",
|
|
10
|
-
HIDE_CLOSE_BUTTON = "hideCloseButton"
|
|
10
|
+
HIDE_CLOSE_BUTTON = "hideCloseButton",
|
|
11
|
+
CLOSE_BY_USER = "closeByUser"
|
|
11
12
|
}
|
|
12
13
|
export declare enum Styles {
|
|
13
14
|
BACKDROP_COLOR = "--placetopay-lightbox-backdrop-color",
|
package/dist/constants.js
CHANGED
|
@@ -10,6 +10,7 @@ export var LightboxEvents;
|
|
|
10
10
|
LightboxEvents["CLOSE"] = "close";
|
|
11
11
|
LightboxEvents["UPDATE_STYLES"] = "updateStyles";
|
|
12
12
|
LightboxEvents["HIDE_CLOSE_BUTTON"] = "hideCloseButton";
|
|
13
|
+
LightboxEvents["CLOSE_BY_USER"] = "closeByUser";
|
|
13
14
|
})(LightboxEvents || (LightboxEvents = {}));
|
|
14
15
|
export var Styles;
|
|
15
16
|
(function (Styles) {
|
package/dist/helpers.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { LightboxEvents as LE } from './constants';
|
|
1
2
|
export const postMessage = (type, payload, preventClose) => {
|
|
2
3
|
const target = globalThis.opener || globalThis.parent;
|
|
3
4
|
return target.postMessage({ type, preventClose, payload }, '*');
|
|
@@ -38,51 +39,51 @@ export const mountBackdrop = () => {
|
|
|
38
39
|
return;
|
|
39
40
|
backdropElement = document.createElement('div');
|
|
40
41
|
backdropElement.className = 'placetopay-lightbox-backdrop-overlay';
|
|
41
|
-
backdropElement.style.cssText = `
|
|
42
|
-
position: fixed;
|
|
43
|
-
top: 0;
|
|
44
|
-
left: 0;
|
|
45
|
-
width: 100%;
|
|
46
|
-
height: 100%;
|
|
47
|
-
background-color: rgba(0, 0, 0, 0.7);
|
|
48
|
-
z-index: 9998;
|
|
49
|
-
display: flex;
|
|
50
|
-
align-items: center;
|
|
51
|
-
justify-content: center;
|
|
52
|
-
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
42
|
+
backdropElement.style.cssText = `
|
|
43
|
+
position: fixed;
|
|
44
|
+
top: 0;
|
|
45
|
+
left: 0;
|
|
46
|
+
width: 100%;
|
|
47
|
+
height: 100%;
|
|
48
|
+
background-color: rgba(0, 0, 0, 0.7);
|
|
49
|
+
z-index: 9998;
|
|
50
|
+
display: flex;
|
|
51
|
+
align-items: center;
|
|
52
|
+
justify-content: center;
|
|
53
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
53
54
|
`;
|
|
54
55
|
const messageContainer = document.createElement('div');
|
|
55
56
|
messageContainer.className = 'placetopay-lightbox-backdrop-message-container';
|
|
56
|
-
messageContainer.style.cssText = `
|
|
57
|
-
background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
|
|
58
|
-
border-radius: 16px;
|
|
59
|
-
padding: 40px;
|
|
60
|
-
max-width: 420px;
|
|
61
|
-
margin: 20px;
|
|
62
|
-
text-align: center;
|
|
63
|
-
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
|
|
64
|
-
backdrop-filter: blur(20px);
|
|
65
|
-
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
57
|
+
messageContainer.style.cssText = `
|
|
58
|
+
background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
|
|
59
|
+
border-radius: 16px;
|
|
60
|
+
padding: 40px;
|
|
61
|
+
max-width: 420px;
|
|
62
|
+
margin: 20px;
|
|
63
|
+
text-align: center;
|
|
64
|
+
box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25), 0 0 0 1px rgba(255, 255, 255, 0.1);
|
|
65
|
+
backdrop-filter: blur(20px);
|
|
66
|
+
border: 1px solid rgba(255, 255, 255, 0.1);
|
|
66
67
|
`;
|
|
67
68
|
const title = document.createElement('h2');
|
|
68
69
|
title.className = 'placetopay-lightbox-backdrop-title';
|
|
69
70
|
title.textContent = getText('popupTitle');
|
|
70
|
-
title.style.cssText = `
|
|
71
|
-
margin: 0 0 20px 0;
|
|
72
|
-
font-size: 22px;
|
|
73
|
-
font-weight: 700;
|
|
74
|
-
color: #ffffff;
|
|
75
|
-
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
71
|
+
title.style.cssText = `
|
|
72
|
+
margin: 0 0 20px 0;
|
|
73
|
+
font-size: 22px;
|
|
74
|
+
font-weight: 700;
|
|
75
|
+
color: #ffffff;
|
|
76
|
+
text-shadow: 0 2px 4px rgba(0, 0, 0, 0.3);
|
|
76
77
|
`;
|
|
77
78
|
const message = document.createElement('p');
|
|
78
79
|
message.className = 'placetopay-lightbox-backdrop-message';
|
|
79
80
|
message.textContent = getText('popupMessage');
|
|
80
|
-
message.style.cssText = `
|
|
81
|
-
margin: 0;
|
|
82
|
-
font-size: 15px;
|
|
83
|
-
line-height: 1.6;
|
|
84
|
-
color: #d1d5db;
|
|
85
|
-
opacity: 0.9;
|
|
81
|
+
message.style.cssText = `
|
|
82
|
+
margin: 0;
|
|
83
|
+
font-size: 15px;
|
|
84
|
+
line-height: 1.6;
|
|
85
|
+
color: #d1d5db;
|
|
86
|
+
opacity: 0.9;
|
|
86
87
|
`;
|
|
87
88
|
messageContainer.appendChild(title);
|
|
88
89
|
messageContainer.appendChild(message);
|
|
@@ -110,6 +111,7 @@ export const unmountBackdrop = () => {
|
|
|
110
111
|
document.body.style.overflow = '';
|
|
111
112
|
document.body.classList.remove('placetopay-lightbox-open');
|
|
112
113
|
openedWindow = null;
|
|
114
|
+
postMessage(LE.CLOSE_BY_USER);
|
|
113
115
|
};
|
|
114
116
|
export const openWithBackup = (url, backupTarget = 'self', lightboxId) => {
|
|
115
117
|
switch (backupTarget) {
|
package/package.json
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@placetopay/lightbox-sdk",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Small javascript library to encapsulate websites in a lightbox with configurable styles and behaviors",
|
|
5
|
-
"main": "dist/index.js",
|
|
6
|
-
"types": "dist/index.d.ts",
|
|
7
|
-
"files": [
|
|
8
|
-
"/dist"
|
|
9
|
-
],
|
|
10
|
-
"repository": {
|
|
11
|
-
"type": "git",
|
|
12
|
-
"url": "git+https://github.com/placetopay-org/lightbox-sdk.git"
|
|
13
|
-
},
|
|
14
|
-
"keywords": [
|
|
15
|
-
"lightbox",
|
|
16
|
-
"sdk",
|
|
17
|
-
"placetopay",
|
|
18
|
-
"javascript",
|
|
19
|
-
"typescript"
|
|
20
|
-
],
|
|
21
|
-
"author": "JuanZea",
|
|
22
|
-
"license": "ISC",
|
|
23
|
-
"bugs": {
|
|
24
|
-
"url": "https://github.com/placetopay-org/lightbox-sdk/issues"
|
|
25
|
-
},
|
|
26
|
-
"homepage": "https://placetopay-org.github.io/lightbox-sdk",
|
|
27
|
-
"devDependencies": {
|
|
28
|
-
"typescript": "^5.1.6"
|
|
29
|
-
}
|
|
30
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@placetopay/lightbox-sdk",
|
|
3
|
+
"version": "2.4.0",
|
|
4
|
+
"description": "Small javascript library to encapsulate websites in a lightbox with configurable styles and behaviors",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"/dist"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/placetopay-org/lightbox-sdk.git"
|
|
13
|
+
},
|
|
14
|
+
"keywords": [
|
|
15
|
+
"lightbox",
|
|
16
|
+
"sdk",
|
|
17
|
+
"placetopay",
|
|
18
|
+
"javascript",
|
|
19
|
+
"typescript"
|
|
20
|
+
],
|
|
21
|
+
"author": "JuanZea",
|
|
22
|
+
"license": "ISC",
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/placetopay-org/lightbox-sdk/issues"
|
|
25
|
+
},
|
|
26
|
+
"homepage": "https://placetopay-org.github.io/lightbox-sdk",
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"typescript": "^5.1.6"
|
|
29
|
+
}
|
|
30
|
+
}
|