@moonbase.sh/vue 0.1.83 → 0.1.85

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
@@ -23,6 +23,7 @@ var src_exports = {};
23
23
  __export(src_exports, {
24
24
  createStorefront: () => createStorefront,
25
25
  storefrontKey: () => storefrontKey,
26
+ useActivationRequest: () => useActivationRequest,
26
27
  useAuth: () => useAuth,
27
28
  useBundle: () => useBundle,
28
29
  useBundles: () => useBundles,
@@ -33,8 +34,8 @@ __export(src_exports, {
33
34
  useVoucher: () => useVoucher
34
35
  });
35
36
  module.exports = __toCommonJS(src_exports);
36
- var import_storefront_api2 = require("@moonbase.sh/storefront-api");
37
- var import_vue10 = require("vue");
37
+ var import_storefront_api3 = require("@moonbase.sh/storefront-api");
38
+ var import_vue11 = require("vue");
38
39
 
39
40
  // src/context.ts
40
41
  var import_uuid = require("uuid");
@@ -255,10 +256,58 @@ function useInventory() {
255
256
  };
256
257
  }
257
258
 
258
- // src/composables/useVoucher.ts
259
+ // src/composables/useActivationRequest.ts
260
+ var import_storefront_api2 = require("@moonbase.sh/storefront-api");
259
261
  var import_vue7 = require("vue");
260
- function useVoucher() {
262
+ function useActivationRequest(requestId) {
261
263
  const storefront = (0, import_vue7.inject)(storefrontKey);
264
+ if (!storefront)
265
+ throw new Error("No storefront configured");
266
+ const activationRequest = storefront.stateFactory(`activation-request-${requestId}`, null);
267
+ const error = storefront.stateFactory(`activation-request-${requestId}-error`, null);
268
+ const loading = storefront.stateFactory(`activation-request-${requestId}-loading`, true);
269
+ const completionTimeout = storefront.stateFactory(`activation-request-${requestId}-completion-timeout`, null);
270
+ storefront.client.activationRequests.get(requestId).then((result) => {
271
+ activationRequest.value = result;
272
+ loading.value = false;
273
+ }).catch((e) => {
274
+ error.value = e;
275
+ loading.value = false;
276
+ });
277
+ (0, import_vue7.onBeforeUnmount)(() => {
278
+ if (completionTimeout.value)
279
+ clearTimeout(completionTimeout.value);
280
+ });
281
+ const checkCompletion = async () => {
282
+ const completed = await storefront.client.activationRequests.isCompleted(requestId);
283
+ if (completed && activationRequest.value)
284
+ activationRequest.value.status = import_storefront_api2.ActivationRequestStatus.Completed;
285
+ else
286
+ completionTimeout.value = setTimeout(checkCompletion, 1500);
287
+ };
288
+ return {
289
+ activationRequest,
290
+ loading,
291
+ error,
292
+ isInstalled: (0, import_vue7.computed)(() => {
293
+ var _a;
294
+ return activationRequest && ((_a = activationRequest.value) == null ? void 0 : _a.status) === import_storefront_api2.ActivationRequestStatus.Completed;
295
+ }),
296
+ fulfillLicense: async () => {
297
+ activationRequest.value = await storefront.client.activationRequests.fulfillLicense(requestId);
298
+ const _ = checkCompletion();
299
+ },
300
+ fulfillTrial: async () => {
301
+ activationRequest.value = await storefront.client.activationRequests.fulfillTrial(requestId);
302
+ const _ = checkCompletion();
303
+ }
304
+ };
305
+ }
306
+
307
+ // src/composables/useVoucher.ts
308
+ var import_vue8 = require("vue");
309
+ function useVoucher() {
310
+ const storefront = (0, import_vue8.inject)(storefrontKey);
262
311
  if (!storefront)
263
312
  throw new Error("No storefront configured");
264
313
  return {
@@ -272,13 +321,13 @@ function useVoucher() {
272
321
  }
273
322
 
274
323
  // src/composables/useCart.ts
275
- var import_vue8 = require("vue");
324
+ var import_vue9 = require("vue");
276
325
  function useCart() {
277
- const storefront = (0, import_vue8.inject)(storefrontKey);
326
+ const storefront = (0, import_vue9.inject)(storefrontKey);
278
327
  if (!storefront)
279
328
  throw new Error("No storefront configured");
280
329
  return {
281
- items: (0, import_vue8.computed)(() => storefront.currentOrder.value.items.map((item) => {
330
+ items: (0, import_vue9.computed)(() => storefront.currentOrder.value.items.map((item) => {
282
331
  if (item.type === "Product") {
283
332
  const product = storefront.storefront.value.products.find((p) => p.id === item.productId);
284
333
  const variations = (product == null ? void 0 : product.variations) || [];
@@ -301,8 +350,8 @@ function useCart() {
301
350
  };
302
351
  }
303
352
  })),
304
- currency: (0, import_vue8.computed)(() => storefront.currentOrder.value.currency || storefront.storefront.value.suggestedCurrency),
305
- total: (0, import_vue8.computed)(() => {
353
+ currency: (0, import_vue9.computed)(() => storefront.currentOrder.value.currency || storefront.storefront.value.suggestedCurrency),
354
+ total: (0, import_vue9.computed)(() => {
306
355
  const currency = storefront.currentOrder.value.currency || storefront.storefront.value.suggestedCurrency;
307
356
  const total = storefront.currentOrder.value.items.reduce((agg, item) => {
308
357
  var _a, _b, _c, _d, _e, _f;
@@ -323,7 +372,7 @@ function useCart() {
323
372
  return { amount: total, currency };
324
373
  }),
325
374
  addToCart: (item, variation) => {
326
- item = (0, import_vue8.unref)(item);
375
+ item = (0, import_vue9.unref)(item);
327
376
  variation != null ? variation : variation = item.defaultVariation;
328
377
  if (!variation)
329
378
  throw new Error("Added item does not have a default variation, and none have been specified");
@@ -391,9 +440,9 @@ function useCart() {
391
440
  }
392
441
 
393
442
  // src/composables/useAuth.ts
394
- var import_vue9 = require("vue");
443
+ var import_vue10 = require("vue");
395
444
  function useAuth() {
396
- const storefront = (0, import_vue9.inject)(storefrontKey);
445
+ const storefront = (0, import_vue10.inject)(storefrontKey);
397
446
  if (!storefront)
398
447
  throw new Error("No storefront configured");
399
448
  return {
@@ -450,15 +499,16 @@ function createStorefront(endpoint, stateFactory) {
450
499
  };
451
500
  return new StorefrontContextImpl(
452
501
  configuration,
453
- new import_storefront_api2.MoonbaseClient(configuration),
502
+ new import_storefront_api3.MoonbaseClient(configuration),
454
503
  // Default to vue refs but allow stuff like Nuxt useState wrappers
455
- stateFactory || ((_, state) => (0, import_vue10.ref)(state))
504
+ stateFactory || ((_, state) => (0, import_vue11.ref)(state))
456
505
  );
457
506
  }
458
507
  // Annotate the CommonJS export names for ESM import in node:
459
508
  0 && (module.exports = {
460
509
  createStorefront,
461
510
  storefrontKey,
511
+ useActivationRequest,
462
512
  useAuth,
463
513
  useBundle,
464
514
  useBundles,
package/dist/index.d.cts CHANGED
@@ -1,11 +1,14 @@
1
1
  import * as _moonbase_sh_storefront_api from '@moonbase.sh/storefront-api';
2
- import { Storefront, Order, User, MoonbaseClient, StorefrontBundle, StorefrontProduct, Activation, PricingVariation, LineItem } from '@moonbase.sh/storefront-api';
2
+ import { MoonbaseConfiguration, Storefront, Order, User, MoonbaseClient, StorefrontBundle, StorefrontProduct, Activation, PricingVariation, LineItem } from '@moonbase.sh/storefront-api';
3
3
  export * from '@moonbase.sh/storefront-api';
4
4
  import * as vue from 'vue';
5
- import { Plugin, Ref, App, InjectionKey } from 'vue';
5
+ import { Plugin, Ref, App, UnwrapRef, InjectionKey } from 'vue';
6
+ import * as _moonbase_sh_storefront_api_src from '@moonbase.sh/storefront-api/src';
6
7
  import { Address } from '@moonbase.sh/storefront-api/src';
7
8
 
8
9
  interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
10
+ configuration: MoonbaseConfiguration;
11
+ stateFactory: StateFactory;
9
12
  storefront: Ref<Storefront>;
10
13
  loadedStorefront: Ref<boolean>;
11
14
  currentOrder: Ref<Order>;
@@ -23,7 +26,7 @@ interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
23
26
  */
24
27
  install(app: App): any;
25
28
  }
26
- type StateFactory = (key: string, state: any) => Ref<typeof state>;
29
+ type StateFactory = <T>(key: string, state: T) => Ref<T> | Ref<UnwrapRef<T>>;
27
30
 
28
31
  declare function useBundle(bundleId: string): Ref<StorefrontBundle | null>;
29
32
 
@@ -130,6 +133,154 @@ declare function useInventory(): {
130
133
  revokeActivation: (activation: Activation) => Promise<void>;
131
134
  };
132
135
 
136
+ declare function useActivationRequest(requestId: string): {
137
+ activationRequest: vue.Ref<{
138
+ status: _moonbase_sh_storefront_api_src.ActivationRequestStatus;
139
+ id: string;
140
+ product: {
141
+ type: "product";
142
+ id: string;
143
+ name: string;
144
+ tagline: string;
145
+ iconUrl: string | null;
146
+ owned: boolean;
147
+ currentVersion?: string | undefined;
148
+ downloads?: {
149
+ name: string;
150
+ path: string | null;
151
+ key: string;
152
+ platform: _moonbase_sh_storefront_api_src.Platform;
153
+ size: number;
154
+ }[] | undefined;
155
+ defaultVariation?: {
156
+ id: string;
157
+ price: Record<string, number>;
158
+ name: string;
159
+ originalPrice: Record<string, number>;
160
+ hasDiscount: boolean;
161
+ discount?: {
162
+ type: "PercentageOffDiscount";
163
+ name: string;
164
+ percentage: number;
165
+ total: Record<string, number>;
166
+ description?: string | undefined;
167
+ } | {
168
+ type: "FlatAmountOffDiscount";
169
+ name: string;
170
+ total: Record<string, number>;
171
+ description?: string | undefined;
172
+ } | undefined;
173
+ } | undefined;
174
+ variations?: {
175
+ id: string;
176
+ price: Record<string, number>;
177
+ name: string;
178
+ originalPrice: Record<string, number>;
179
+ hasDiscount: boolean;
180
+ discount?: {
181
+ type: "PercentageOffDiscount";
182
+ name: string;
183
+ percentage: number;
184
+ total: Record<string, number>;
185
+ description?: string | undefined;
186
+ } | {
187
+ type: "FlatAmountOffDiscount";
188
+ name: string;
189
+ total: Record<string, number>;
190
+ description?: string | undefined;
191
+ } | undefined;
192
+ }[] | undefined;
193
+ };
194
+ trialEligibility?: {
195
+ eligible: boolean;
196
+ existing: boolean;
197
+ requiresAccount: boolean;
198
+ numberOfDaysPerProduct: number;
199
+ numberOfDaysRemaining: number;
200
+ } | undefined;
201
+ licenseEligibility?: {
202
+ eligible: boolean;
203
+ } | undefined;
204
+ } | null> | vue.Ref<{
205
+ status: _moonbase_sh_storefront_api_src.ActivationRequestStatus;
206
+ id: string;
207
+ product: {
208
+ type: "product";
209
+ id: string;
210
+ name: string;
211
+ tagline: string;
212
+ iconUrl: string | null;
213
+ owned: boolean;
214
+ currentVersion?: string | undefined;
215
+ downloads?: {
216
+ name: string;
217
+ path: string | null;
218
+ key: string;
219
+ platform: _moonbase_sh_storefront_api_src.Platform;
220
+ size: number;
221
+ }[] | undefined;
222
+ defaultVariation?: {
223
+ id: string;
224
+ price: Record<string, number>;
225
+ name: string;
226
+ originalPrice: Record<string, number>;
227
+ hasDiscount: boolean;
228
+ discount?: {
229
+ type: "PercentageOffDiscount";
230
+ name: string;
231
+ percentage: number;
232
+ total: Record<string, number>;
233
+ description?: string | undefined;
234
+ } | {
235
+ type: "FlatAmountOffDiscount";
236
+ name: string;
237
+ total: Record<string, number>;
238
+ description?: string | undefined;
239
+ } | undefined;
240
+ } | undefined;
241
+ variations?: {
242
+ id: string;
243
+ price: Record<string, number>;
244
+ name: string;
245
+ originalPrice: Record<string, number>;
246
+ hasDiscount: boolean;
247
+ discount?: {
248
+ type: "PercentageOffDiscount";
249
+ name: string;
250
+ percentage: number;
251
+ total: Record<string, number>;
252
+ description?: string | undefined;
253
+ } | {
254
+ type: "FlatAmountOffDiscount";
255
+ name: string;
256
+ total: Record<string, number>;
257
+ description?: string | undefined;
258
+ } | undefined;
259
+ }[] | undefined;
260
+ };
261
+ trialEligibility?: {
262
+ eligible: boolean;
263
+ existing: boolean;
264
+ requiresAccount: boolean;
265
+ numberOfDaysPerProduct: number;
266
+ numberOfDaysRemaining: number;
267
+ } | undefined;
268
+ licenseEligibility?: {
269
+ eligible: boolean;
270
+ } | undefined;
271
+ } | null>;
272
+ loading: vue.Ref<boolean>;
273
+ error: vue.Ref<Error | null> | vue.Ref<{
274
+ name: string;
275
+ message: string;
276
+ stack?: string | undefined;
277
+ cause?: unknown;
278
+ } | null>;
279
+ isInstalled: vue.ComputedRef<boolean>;
280
+ fulfillLicense: () => Promise<void>;
281
+ fulfillTrial: () => Promise<void>;
282
+ };
283
+
133
284
  declare function useVoucher(): {
134
285
  peek: (code: string) => Promise<{
135
286
  code: string;
@@ -793,4 +944,4 @@ interface Cart {
793
944
  type CartItem = LineItem;
794
945
  declare function createStorefront(endpoint: string, stateFactory?: StateFactory): StorefrontContext;
795
946
 
796
- export { type Cart, type CartItem, createStorefront, storefrontKey, useAuth, useBundle, useBundles, useCart, useInventory, useProduct, useProducts, useVoucher };
947
+ export { type Cart, type CartItem, createStorefront, storefrontKey, useActivationRequest, useAuth, useBundle, useBundles, useCart, useInventory, useProduct, useProducts, useVoucher };
package/dist/index.d.ts CHANGED
@@ -1,11 +1,14 @@
1
1
  import * as _moonbase_sh_storefront_api from '@moonbase.sh/storefront-api';
2
- import { Storefront, Order, User, MoonbaseClient, StorefrontBundle, StorefrontProduct, Activation, PricingVariation, LineItem } from '@moonbase.sh/storefront-api';
2
+ import { MoonbaseConfiguration, Storefront, Order, User, MoonbaseClient, StorefrontBundle, StorefrontProduct, Activation, PricingVariation, LineItem } from '@moonbase.sh/storefront-api';
3
3
  export * from '@moonbase.sh/storefront-api';
4
4
  import * as vue from 'vue';
5
- import { Plugin, Ref, App, InjectionKey } from 'vue';
5
+ import { Plugin, Ref, App, UnwrapRef, InjectionKey } from 'vue';
6
+ import * as _moonbase_sh_storefront_api_src from '@moonbase.sh/storefront-api/src';
6
7
  import { Address } from '@moonbase.sh/storefront-api/src';
7
8
 
8
9
  interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
10
+ configuration: MoonbaseConfiguration;
11
+ stateFactory: StateFactory;
9
12
  storefront: Ref<Storefront>;
10
13
  loadedStorefront: Ref<boolean>;
11
14
  currentOrder: Ref<Order>;
@@ -23,7 +26,7 @@ interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
23
26
  */
24
27
  install(app: App): any;
25
28
  }
26
- type StateFactory = (key: string, state: any) => Ref<typeof state>;
29
+ type StateFactory = <T>(key: string, state: T) => Ref<T> | Ref<UnwrapRef<T>>;
27
30
 
28
31
  declare function useBundle(bundleId: string): Ref<StorefrontBundle | null>;
29
32
 
@@ -130,6 +133,154 @@ declare function useInventory(): {
130
133
  revokeActivation: (activation: Activation) => Promise<void>;
131
134
  };
132
135
 
136
+ declare function useActivationRequest(requestId: string): {
137
+ activationRequest: vue.Ref<{
138
+ status: _moonbase_sh_storefront_api_src.ActivationRequestStatus;
139
+ id: string;
140
+ product: {
141
+ type: "product";
142
+ id: string;
143
+ name: string;
144
+ tagline: string;
145
+ iconUrl: string | null;
146
+ owned: boolean;
147
+ currentVersion?: string | undefined;
148
+ downloads?: {
149
+ name: string;
150
+ path: string | null;
151
+ key: string;
152
+ platform: _moonbase_sh_storefront_api_src.Platform;
153
+ size: number;
154
+ }[] | undefined;
155
+ defaultVariation?: {
156
+ id: string;
157
+ price: Record<string, number>;
158
+ name: string;
159
+ originalPrice: Record<string, number>;
160
+ hasDiscount: boolean;
161
+ discount?: {
162
+ type: "PercentageOffDiscount";
163
+ name: string;
164
+ percentage: number;
165
+ total: Record<string, number>;
166
+ description?: string | undefined;
167
+ } | {
168
+ type: "FlatAmountOffDiscount";
169
+ name: string;
170
+ total: Record<string, number>;
171
+ description?: string | undefined;
172
+ } | undefined;
173
+ } | undefined;
174
+ variations?: {
175
+ id: string;
176
+ price: Record<string, number>;
177
+ name: string;
178
+ originalPrice: Record<string, number>;
179
+ hasDiscount: boolean;
180
+ discount?: {
181
+ type: "PercentageOffDiscount";
182
+ name: string;
183
+ percentage: number;
184
+ total: Record<string, number>;
185
+ description?: string | undefined;
186
+ } | {
187
+ type: "FlatAmountOffDiscount";
188
+ name: string;
189
+ total: Record<string, number>;
190
+ description?: string | undefined;
191
+ } | undefined;
192
+ }[] | undefined;
193
+ };
194
+ trialEligibility?: {
195
+ eligible: boolean;
196
+ existing: boolean;
197
+ requiresAccount: boolean;
198
+ numberOfDaysPerProduct: number;
199
+ numberOfDaysRemaining: number;
200
+ } | undefined;
201
+ licenseEligibility?: {
202
+ eligible: boolean;
203
+ } | undefined;
204
+ } | null> | vue.Ref<{
205
+ status: _moonbase_sh_storefront_api_src.ActivationRequestStatus;
206
+ id: string;
207
+ product: {
208
+ type: "product";
209
+ id: string;
210
+ name: string;
211
+ tagline: string;
212
+ iconUrl: string | null;
213
+ owned: boolean;
214
+ currentVersion?: string | undefined;
215
+ downloads?: {
216
+ name: string;
217
+ path: string | null;
218
+ key: string;
219
+ platform: _moonbase_sh_storefront_api_src.Platform;
220
+ size: number;
221
+ }[] | undefined;
222
+ defaultVariation?: {
223
+ id: string;
224
+ price: Record<string, number>;
225
+ name: string;
226
+ originalPrice: Record<string, number>;
227
+ hasDiscount: boolean;
228
+ discount?: {
229
+ type: "PercentageOffDiscount";
230
+ name: string;
231
+ percentage: number;
232
+ total: Record<string, number>;
233
+ description?: string | undefined;
234
+ } | {
235
+ type: "FlatAmountOffDiscount";
236
+ name: string;
237
+ total: Record<string, number>;
238
+ description?: string | undefined;
239
+ } | undefined;
240
+ } | undefined;
241
+ variations?: {
242
+ id: string;
243
+ price: Record<string, number>;
244
+ name: string;
245
+ originalPrice: Record<string, number>;
246
+ hasDiscount: boolean;
247
+ discount?: {
248
+ type: "PercentageOffDiscount";
249
+ name: string;
250
+ percentage: number;
251
+ total: Record<string, number>;
252
+ description?: string | undefined;
253
+ } | {
254
+ type: "FlatAmountOffDiscount";
255
+ name: string;
256
+ total: Record<string, number>;
257
+ description?: string | undefined;
258
+ } | undefined;
259
+ }[] | undefined;
260
+ };
261
+ trialEligibility?: {
262
+ eligible: boolean;
263
+ existing: boolean;
264
+ requiresAccount: boolean;
265
+ numberOfDaysPerProduct: number;
266
+ numberOfDaysRemaining: number;
267
+ } | undefined;
268
+ licenseEligibility?: {
269
+ eligible: boolean;
270
+ } | undefined;
271
+ } | null>;
272
+ loading: vue.Ref<boolean>;
273
+ error: vue.Ref<Error | null> | vue.Ref<{
274
+ name: string;
275
+ message: string;
276
+ stack?: string | undefined;
277
+ cause?: unknown;
278
+ } | null>;
279
+ isInstalled: vue.ComputedRef<boolean>;
280
+ fulfillLicense: () => Promise<void>;
281
+ fulfillTrial: () => Promise<void>;
282
+ };
283
+
133
284
  declare function useVoucher(): {
134
285
  peek: (code: string) => Promise<{
135
286
  code: string;
@@ -793,4 +944,4 @@ interface Cart {
793
944
  type CartItem = LineItem;
794
945
  declare function createStorefront(endpoint: string, stateFactory?: StateFactory): StorefrontContext;
795
946
 
796
- export { type Cart, type CartItem, createStorefront, storefrontKey, useAuth, useBundle, useBundles, useCart, useInventory, useProduct, useProducts, useVoucher };
947
+ export { type Cart, type CartItem, createStorefront, storefrontKey, useActivationRequest, useAuth, useBundle, useBundles, useCart, useInventory, useProduct, useProducts, useVoucher };
package/dist/index.js CHANGED
@@ -221,10 +221,58 @@ function useInventory() {
221
221
  };
222
222
  }
223
223
 
224
+ // src/composables/useActivationRequest.ts
225
+ import { ActivationRequestStatus } from "@moonbase.sh/storefront-api";
226
+ import { computed as computed5, inject as inject6, onBeforeUnmount } from "vue";
227
+ function useActivationRequest(requestId) {
228
+ const storefront = inject6(storefrontKey);
229
+ if (!storefront)
230
+ throw new Error("No storefront configured");
231
+ const activationRequest = storefront.stateFactory(`activation-request-${requestId}`, null);
232
+ const error = storefront.stateFactory(`activation-request-${requestId}-error`, null);
233
+ const loading = storefront.stateFactory(`activation-request-${requestId}-loading`, true);
234
+ const completionTimeout = storefront.stateFactory(`activation-request-${requestId}-completion-timeout`, null);
235
+ storefront.client.activationRequests.get(requestId).then((result) => {
236
+ activationRequest.value = result;
237
+ loading.value = false;
238
+ }).catch((e) => {
239
+ error.value = e;
240
+ loading.value = false;
241
+ });
242
+ onBeforeUnmount(() => {
243
+ if (completionTimeout.value)
244
+ clearTimeout(completionTimeout.value);
245
+ });
246
+ const checkCompletion = async () => {
247
+ const completed = await storefront.client.activationRequests.isCompleted(requestId);
248
+ if (completed && activationRequest.value)
249
+ activationRequest.value.status = ActivationRequestStatus.Completed;
250
+ else
251
+ completionTimeout.value = setTimeout(checkCompletion, 1500);
252
+ };
253
+ return {
254
+ activationRequest,
255
+ loading,
256
+ error,
257
+ isInstalled: computed5(() => {
258
+ var _a;
259
+ return activationRequest && ((_a = activationRequest.value) == null ? void 0 : _a.status) === ActivationRequestStatus.Completed;
260
+ }),
261
+ fulfillLicense: async () => {
262
+ activationRequest.value = await storefront.client.activationRequests.fulfillLicense(requestId);
263
+ const _ = checkCompletion();
264
+ },
265
+ fulfillTrial: async () => {
266
+ activationRequest.value = await storefront.client.activationRequests.fulfillTrial(requestId);
267
+ const _ = checkCompletion();
268
+ }
269
+ };
270
+ }
271
+
224
272
  // src/composables/useVoucher.ts
225
- import { inject as inject6 } from "vue";
273
+ import { inject as inject7 } from "vue";
226
274
  function useVoucher() {
227
- const storefront = inject6(storefrontKey);
275
+ const storefront = inject7(storefrontKey);
228
276
  if (!storefront)
229
277
  throw new Error("No storefront configured");
230
278
  return {
@@ -238,13 +286,13 @@ function useVoucher() {
238
286
  }
239
287
 
240
288
  // src/composables/useCart.ts
241
- import { computed as computed5, inject as inject7, unref } from "vue";
289
+ import { computed as computed6, inject as inject8, unref } from "vue";
242
290
  function useCart() {
243
- const storefront = inject7(storefrontKey);
291
+ const storefront = inject8(storefrontKey);
244
292
  if (!storefront)
245
293
  throw new Error("No storefront configured");
246
294
  return {
247
- items: computed5(() => storefront.currentOrder.value.items.map((item) => {
295
+ items: computed6(() => storefront.currentOrder.value.items.map((item) => {
248
296
  if (item.type === "Product") {
249
297
  const product = storefront.storefront.value.products.find((p) => p.id === item.productId);
250
298
  const variations = (product == null ? void 0 : product.variations) || [];
@@ -267,8 +315,8 @@ function useCart() {
267
315
  };
268
316
  }
269
317
  })),
270
- currency: computed5(() => storefront.currentOrder.value.currency || storefront.storefront.value.suggestedCurrency),
271
- total: computed5(() => {
318
+ currency: computed6(() => storefront.currentOrder.value.currency || storefront.storefront.value.suggestedCurrency),
319
+ total: computed6(() => {
272
320
  const currency = storefront.currentOrder.value.currency || storefront.storefront.value.suggestedCurrency;
273
321
  const total = storefront.currentOrder.value.items.reduce((agg, item) => {
274
322
  var _a, _b, _c, _d, _e, _f;
@@ -357,9 +405,9 @@ function useCart() {
357
405
  }
358
406
 
359
407
  // src/composables/useAuth.ts
360
- import { inject as inject8 } from "vue";
408
+ import { inject as inject9 } from "vue";
361
409
  function useAuth() {
362
- const storefront = inject8(storefrontKey);
410
+ const storefront = inject9(storefrontKey);
363
411
  if (!storefront)
364
412
  throw new Error("No storefront configured");
365
413
  return {
@@ -424,6 +472,7 @@ function createStorefront(endpoint, stateFactory) {
424
472
  export {
425
473
  createStorefront,
426
474
  storefrontKey,
475
+ useActivationRequest,
427
476
  useAuth,
428
477
  useBundle,
429
478
  useBundles,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/vue",
3
3
  "type": "module",
4
- "version": "0.1.83",
4
+ "version": "0.1.85",
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",
@@ -18,7 +18,7 @@
18
18
  "dependencies": {
19
19
  "@vue/devtools-api": "^6.5.1",
20
20
  "uuid": "^9.0.1",
21
- "@moonbase.sh/storefront-api": "0.1.83"
21
+ "@moonbase.sh/storefront-api": "0.1.85"
22
22
  },
23
23
  "devDependencies": {
24
24
  "@types/uuid": "^9.0.7",