@moonbase.sh/vue 0.4.54 → 0.4.56

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/index.cjs CHANGED
@@ -85,12 +85,17 @@ function closeCheckout() {
85
85
  (_a = iframe.contentWindow) == null ? void 0 : _a.postMessage("close", "*");
86
86
  }
87
87
  function mountCheckout(endpoint) {
88
+ var _a;
88
89
  if (typeof window === "undefined") {
89
90
  console.warn("Can not mount checkout server side");
90
91
  return;
91
92
  }
92
93
  if (document.getElementById("moonbase-checkout"))
93
94
  return;
95
+ const colorScheme = (_a = document.head.querySelector('meta[name="color-scheme"]')) == null ? void 0 : _a.getAttribute("content");
96
+ if (colorScheme) {
97
+ endpoint += `${endpoint.includes("?") ? "&" : "?"}color_scheme=${encodeURIComponent(colorScheme)}`;
98
+ }
94
99
  const iframe = document.createElement("iframe");
95
100
  iframe.id = "moonbase-checkout";
96
101
  iframe.src = endpoint;
@@ -111,7 +116,7 @@ function mountCheckout(endpoint) {
111
116
  document.body.append(iframe);
112
117
  document.documentElement.style.overflow = "hidden";
113
118
  window.onmessage = function(e) {
114
- var _a;
119
+ var _a2;
115
120
  try {
116
121
  const evnt = eventSchema.parse(e.data);
117
122
  if (evnt.event === "close") {
@@ -129,7 +134,7 @@ function mountCheckout(endpoint) {
129
134
  }));
130
135
  }
131
136
  } catch (err) {
132
- if (((_a = e.data) == null ? void 0 : _a.source) === "moonbase-checkout") {
137
+ if (((_a2 = e.data) == null ? void 0 : _a2.source) === "moonbase-checkout") {
133
138
  console.error("Could not parse event:", e.data, err);
134
139
  }
135
140
  }
package/dist/index.js CHANGED
@@ -53,12 +53,17 @@ function closeCheckout() {
53
53
  (_a = iframe.contentWindow) == null ? void 0 : _a.postMessage("close", "*");
54
54
  }
55
55
  function mountCheckout(endpoint) {
56
+ var _a;
56
57
  if (typeof window === "undefined") {
57
58
  console.warn("Can not mount checkout server side");
58
59
  return;
59
60
  }
60
61
  if (document.getElementById("moonbase-checkout"))
61
62
  return;
63
+ const colorScheme = (_a = document.head.querySelector('meta[name="color-scheme"]')) == null ? void 0 : _a.getAttribute("content");
64
+ if (colorScheme) {
65
+ endpoint += `${endpoint.includes("?") ? "&" : "?"}color_scheme=${encodeURIComponent(colorScheme)}`;
66
+ }
62
67
  const iframe = document.createElement("iframe");
63
68
  iframe.id = "moonbase-checkout";
64
69
  iframe.src = endpoint;
@@ -79,7 +84,7 @@ function mountCheckout(endpoint) {
79
84
  document.body.append(iframe);
80
85
  document.documentElement.style.overflow = "hidden";
81
86
  window.onmessage = function(e) {
82
- var _a;
87
+ var _a2;
83
88
  try {
84
89
  const evnt = eventSchema.parse(e.data);
85
90
  if (evnt.event === "close") {
@@ -97,7 +102,7 @@ function mountCheckout(endpoint) {
97
102
  }));
98
103
  }
99
104
  } catch (err) {
100
- if (((_a = e.data) == null ? void 0 : _a.source) === "moonbase-checkout") {
105
+ if (((_a2 = e.data) == null ? void 0 : _a2.source) === "moonbase-checkout") {
101
106
  console.error("Could not parse event:", e.data, err);
102
107
  }
103
108
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/vue",
3
3
  "type": "module",
4
- "version": "0.4.54",
4
+ "version": "0.4.56",
5
5
  "description": "Package to let you build vue.js storefronts with Moonbase.sh as payment and delivery provider",
6
6
  "author": "Tobias Lønnerød Madsen <m@dsen.tv>",
7
7
  "license": "MIT",
@@ -19,7 +19,7 @@
19
19
  "@vue/devtools-api": "^6.6.3",
20
20
  "uuid": "^9.0.1",
21
21
  "zod": "^3.23.8",
22
- "@moonbase.sh/storefront-api": "0.4.54"
22
+ "@moonbase.sh/storefront-api": "0.4.56"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@types/uuid": "^9.0.8",