@placetopay/lightbox-sdk 2.4.0 → 2.5.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.
Files changed (2) hide show
  1. package/dist/helpers.js +42 -0
  2. package/package.json +1 -1
package/dist/helpers.js CHANGED
@@ -20,10 +20,14 @@ const translations = {
20
20
  en: {
21
21
  popupTitle: 'Popup Opened',
22
22
  popupMessage: 'Please complete the process in the popup window. This window will remain blocked until finished.',
23
+ continueButton: 'Continue',
24
+ cancelButton: 'Cancel',
23
25
  },
24
26
  es: {
25
27
  popupTitle: 'Popup Abierto',
26
28
  popupMessage: 'Por favor, complete el proceso en la ventana emergente. Esta ventana permanecerá bloqueada hasta que finalice.',
29
+ continueButton: 'Continuar',
30
+ cancelButton: 'Cancelar',
27
31
  },
28
32
  };
29
33
  function getLanguage() {
@@ -85,8 +89,46 @@ export const mountBackdrop = () => {
85
89
  color: #d1d5db;
86
90
  opacity: 0.9;
87
91
  `;
92
+ const continueButton = document.createElement('button');
93
+ continueButton.textContent = getText('continueButton');
94
+ continueButton.style.cssText = `
95
+ margin-top: 20px;
96
+ margin-right: 10px;
97
+ padding: 10px 18px;
98
+ cursor: pointer;
99
+ border-radius: 8px;
100
+ border: none;
101
+ background: #ffffff;
102
+ color: #000000;
103
+ font-weight: 600;
104
+ `;
105
+ continueButton.onclick = () => {
106
+ if (openedWindow && !openedWindow.closed) {
107
+ openedWindow.focus();
108
+ }
109
+ };
110
+ const cancelButton = document.createElement('button');
111
+ cancelButton.textContent = getText('cancelButton');
112
+ cancelButton.style.cssText = `
113
+ margin-top: 20px;
114
+ padding: 10px 18px;
115
+ cursor: pointer;
116
+ border-radius: 8px;
117
+ border: 1px solid #ffffff;
118
+ background: transparent;
119
+ color: #ffffff;
120
+ font-weight: 600;
121
+ `;
122
+ cancelButton.onclick = () => {
123
+ if (openedWindow && !openedWindow.closed) {
124
+ openedWindow.close();
125
+ }
126
+ unmountBackdrop();
127
+ };
88
128
  messageContainer.appendChild(title);
89
129
  messageContainer.appendChild(message);
130
+ messageContainer.appendChild(continueButton);
131
+ messageContainer.appendChild(cancelButton);
90
132
  backdropElement.appendChild(messageContainer);
91
133
  document.body.appendChild(backdropElement);
92
134
  document.body.classList.add('placetopay-lightbox-open');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@placetopay/lightbox-sdk",
3
- "version": "2.4.0",
3
+ "version": "2.5.0",
4
4
  "description": "Small javascript library to encapsulate websites in a lightbox with configurable styles and behaviors",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",