@moonbase.sh/vue 0.2.109 → 0.2.114
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 +8 -2
- package/dist/index.js +10 -4
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -39,9 +39,11 @@ var import_storefront_api6 = require("@moonbase.sh/storefront-api");
|
|
|
39
39
|
var import_vue12 = require("vue");
|
|
40
40
|
|
|
41
41
|
// src/context.ts
|
|
42
|
+
var import_storefront_api2 = require("@moonbase.sh/storefront-api");
|
|
43
|
+
var import_schemas = require("@moonbase.sh/storefront-api/src/identity/schemas");
|
|
44
|
+
var import_tokenStore = require("@moonbase.sh/storefront-api/src/utils/tokenStore");
|
|
42
45
|
var import_uuid = require("uuid");
|
|
43
46
|
var import_vue = require("vue");
|
|
44
|
-
var import_storefront_api2 = require("@moonbase.sh/storefront-api");
|
|
45
47
|
|
|
46
48
|
// src/symbols.ts
|
|
47
49
|
var storefrontKey = Symbol("storefront");
|
|
@@ -206,7 +208,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
|
|
|
206
208
|
this.loadedStorefront = stateFactory(`${_StorefrontContextImpl.storefrontKey}_loaded`, false);
|
|
207
209
|
}
|
|
208
210
|
if (this.client.tokenStore.hasAccessToken) {
|
|
209
|
-
this.currentUser.value = this.client.tokenStore.user;
|
|
211
|
+
this.currentUser.value = import_schemas.userSchema.parse(this.client.tokenStore.user);
|
|
210
212
|
}
|
|
211
213
|
this.updateStorefront();
|
|
212
214
|
this.updateUser();
|
|
@@ -305,6 +307,10 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
|
|
|
305
307
|
case _StorefrontContextImpl.utmKey:
|
|
306
308
|
this.utm.value = JSON.parse(event.newValue);
|
|
307
309
|
break;
|
|
310
|
+
case import_tokenStore.TokenStore.storageKey:
|
|
311
|
+
if (!event.newValue) {
|
|
312
|
+
this.currentUser.value = null;
|
|
313
|
+
}
|
|
308
314
|
}
|
|
309
315
|
}
|
|
310
316
|
async refreshOrder() {
|
package/dist/index.js
CHANGED
|
@@ -3,9 +3,11 @@ import { MoonbaseClient } from "@moonbase.sh/storefront-api";
|
|
|
3
3
|
import { ref as ref3 } from "vue";
|
|
4
4
|
|
|
5
5
|
// src/context.ts
|
|
6
|
+
import { NotAuthenticatedError, NotFoundError, OrderStatus } from "@moonbase.sh/storefront-api";
|
|
7
|
+
import { userSchema } from "@moonbase.sh/storefront-api/src/identity/schemas";
|
|
8
|
+
import { TokenStore } from "@moonbase.sh/storefront-api/src/utils/tokenStore";
|
|
6
9
|
import { v4 as uuidv4 } from "uuid";
|
|
7
10
|
import { ref, watch } from "vue";
|
|
8
|
-
import { NotAuthenticatedError, NotFoundError, OrderStatus } from "@moonbase.sh/storefront-api";
|
|
9
11
|
|
|
10
12
|
// src/symbols.ts
|
|
11
13
|
var storefrontKey = Symbol("storefront");
|
|
@@ -170,7 +172,7 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
|
|
|
170
172
|
this.loadedStorefront = stateFactory(`${_StorefrontContextImpl.storefrontKey}_loaded`, false);
|
|
171
173
|
}
|
|
172
174
|
if (this.client.tokenStore.hasAccessToken) {
|
|
173
|
-
this.currentUser.value = this.client.tokenStore.user;
|
|
175
|
+
this.currentUser.value = userSchema.parse(this.client.tokenStore.user);
|
|
174
176
|
}
|
|
175
177
|
this.updateStorefront();
|
|
176
178
|
this.updateUser();
|
|
@@ -269,6 +271,10 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
|
|
|
269
271
|
case _StorefrontContextImpl.utmKey:
|
|
270
272
|
this.utm.value = JSON.parse(event.newValue);
|
|
271
273
|
break;
|
|
274
|
+
case TokenStore.storageKey:
|
|
275
|
+
if (!event.newValue) {
|
|
276
|
+
this.currentUser.value = null;
|
|
277
|
+
}
|
|
272
278
|
}
|
|
273
279
|
}
|
|
274
280
|
async refreshOrder() {
|
|
@@ -520,7 +526,7 @@ function useVoucher(context) {
|
|
|
520
526
|
|
|
521
527
|
// src/composables/useCart.ts
|
|
522
528
|
import { computed as computed6, inject as inject8, unref } from "vue";
|
|
523
|
-
import { MoonbaseError
|
|
529
|
+
import { MoonbaseError } from "@moonbase.sh/storefront-api";
|
|
524
530
|
function useCart(context) {
|
|
525
531
|
const storefront = context != null ? context : inject8(storefrontKey);
|
|
526
532
|
if (!storefront)
|
|
@@ -608,7 +614,7 @@ function useCart(context) {
|
|
|
608
614
|
};
|
|
609
615
|
storefront.currentOrder.value.items.push(lineItem);
|
|
610
616
|
} else {
|
|
611
|
-
throw new
|
|
617
|
+
throw new MoonbaseError("Invalid input", `Could not handle item of type '${item.type}'`);
|
|
612
618
|
}
|
|
613
619
|
} else {
|
|
614
620
|
lineItem.quantity += 1;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moonbase.sh/vue",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.114",
|
|
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.2.
|
|
22
|
+
"@moonbase.sh/storefront-api": "0.2.114"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/uuid": "^9.0.8",
|