@mopay/node-sdk 0.1.2 → 0.1.4

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/base.js CHANGED
@@ -1,6 +1,8 @@
1
1
  import { MoPayAPIError } from "./errors.js";
2
2
  const DEFAULT_BASE_URL = "https://mopay.co.ls";
3
3
  const DEFAULT_TIMEOUT_MS = 30000;
4
+ const SDK_NAME = "@mopay/node-sdk";
5
+ const SDK_VERSION = "0.1.4";
4
6
  export class Base {
5
7
  apiKey;
6
8
  baseUrl;
@@ -16,7 +18,7 @@ export class Base {
16
18
  this.baseUrl = normalizeBaseUrl(config.baseUrl || DEFAULT_BASE_URL);
17
19
  this.timeoutMs = config.timeoutMs ?? DEFAULT_TIMEOUT_MS;
18
20
  this.fetchImpl = config.fetch || getNativeFetch();
19
- this.userAgent = config.userAgent || "@mopay/node-sdk/0.1.1";
21
+ this.userAgent = config.userAgent || `${SDK_NAME}/${SDK_VERSION}`;
20
22
  this.checkoutOptions = config.checkout || {};
21
23
  }
22
24
  getDefaultCheckoutOptions() {
@@ -39,6 +41,9 @@ export class Base {
39
41
  Authorization: `Bearer ${this.apiKey}`,
40
42
  "Content-Type": "application/json",
41
43
  "User-Agent": this.userAgent,
44
+ "X-MoPay-SDK": SDK_NAME,
45
+ "X-MoPay-SDK-Version": SDK_VERSION,
46
+ "X-MoPay-SDK-Language": "typescript",
42
47
  ...options.headers,
43
48
  },
44
49
  };
package/dist/checkout.js CHANGED
@@ -108,6 +108,10 @@ function openDialog(paymentUrl, options, controller) {
108
108
  const closeLineA = document.createElement("span");
109
109
  const closeLineB = document.createElement("span");
110
110
  const loader = document.createElement("div");
111
+ const footer = document.createElement("div");
112
+ const shield = document.createElementNS("http://www.w3.org/2000/svg", "svg");
113
+ const shieldPath = document.createElementNS("http://www.w3.org/2000/svg", "path");
114
+ const footerText = document.createElement("span");
111
115
  dialog.setAttribute("aria-label", "MoPay checkout");
112
116
  dialog.className = `mopay-checkout-dialog${options.resizable ? " is-resizable" : ""}`;
113
117
  dialog.style.setProperty("--mopay-checkout-width", toPixels(options.width || DEFAULT_DIALOG_WIDTH));
@@ -134,7 +138,19 @@ function openDialog(paymentUrl, options, controller) {
134
138
  closeButton.addEventListener("click", () => dialog.close());
135
139
  loader.className = "mopay-checkout-loader";
136
140
  loader.setAttribute("aria-hidden", "true");
137
- shell.append(loader, closeButton, frame);
141
+ shield.setAttribute("viewBox", "0 0 24 24");
142
+ shield.setAttribute("fill", "none");
143
+ shield.setAttribute("stroke", "currentColor");
144
+ shield.setAttribute("stroke-width", "2");
145
+ shield.setAttribute("stroke-linecap", "round");
146
+ shield.setAttribute("stroke-linejoin", "round");
147
+ shield.setAttribute("aria-hidden", "true");
148
+ shieldPath.setAttribute("d", "M12 22s8-4 8-10V5l-8-3-8 3v7c0 6 8 10 8 10Z");
149
+ shield.append(shieldPath);
150
+ footer.className = "mopay-checkout-footer";
151
+ footerText.textContent = "powered by MoPay";
152
+ footer.append(shield, footerText);
153
+ shell.append(loader, closeButton, frame, footer);
138
154
  dialog.append(shell);
139
155
  document.body.append(dialog);
140
156
  controller.setSource(frame.contentWindow);
@@ -189,6 +205,8 @@ function injectDialogStyles() {
189
205
 
190
206
  .mopay-checkout-shell {
191
207
  position: relative;
208
+ display: grid;
209
+ grid-template-rows: minmax(0, 1fr) 34px;
192
210
  width: 100%;
193
211
  height: 100%;
194
212
  border: 1px solid rgb(255 255 255 / 82%);
@@ -201,6 +219,7 @@ function injectDialogStyles() {
201
219
  display: block;
202
220
  width: 100%;
203
221
  height: 100%;
222
+ min-height: 0;
204
223
  border: 0;
205
224
  background: #ffffff;
206
225
  opacity: 0;
@@ -211,6 +230,25 @@ function injectDialogStyles() {
211
230
  opacity: 1;
212
231
  }
213
232
 
233
+ .mopay-checkout-footer {
234
+ display: flex;
235
+ align-items: center;
236
+ justify-content: center;
237
+ gap: 6px;
238
+ min-height: 34px;
239
+ border-top: 1px solid #eef2f6;
240
+ background: #ffffff;
241
+ color: #667085;
242
+ font: 600 12px/1.2 ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
243
+ }
244
+
245
+ .mopay-checkout-footer svg {
246
+ width: 14px;
247
+ height: 14px;
248
+ color: #10b981;
249
+ flex: 0 0 auto;
250
+ }
251
+
214
252
  .mopay-checkout-close {
215
253
  position: absolute;
216
254
  top: 6px;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mopay/node-sdk",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Official TypeScript SDK for the MoPay payment API.",
5
5
  "type": "module",
6
6
  "source": "src/index.ts",