@moonbase.sh/vue 0.2.27 → 0.2.30

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
@@ -58,6 +58,7 @@ function debounce(func, waitMs = 100) {
58
58
  }
59
59
 
60
60
  // src/utils/iframe-checkout.ts
61
+ var import_schemas = require("@moonbase.sh/storefront-api/src/orders/schemas");
61
62
  var import_zod = require("zod");
62
63
  var closeEventSchema = import_zod.z.object({
63
64
  source: import_zod.z.literal("moonbase-checkout"),
@@ -66,9 +67,17 @@ var closeEventSchema = import_zod.z.object({
66
67
  });
67
68
  var completedEventSchema = import_zod.z.object({
68
69
  source: import_zod.z.literal("moonbase-checkout"),
69
- event: import_zod.z.literal("completed")
70
+ event: import_zod.z.literal("completed"),
71
+ order: import_schemas.completedOrderSchema
70
72
  });
71
73
  var eventSchema = import_zod.z.discriminatedUnion("event", [closeEventSchema, completedEventSchema]);
74
+ function closeCheckout() {
75
+ var _a;
76
+ const iframe = document.getElementById("moonbase-checkout");
77
+ if (!iframe || !(iframe instanceof HTMLIFrameElement))
78
+ return;
79
+ (_a = iframe.contentWindow) == null ? void 0 : _a.postMessage("close", "*");
80
+ }
72
81
  function mountCheckout(endpoint) {
73
82
  if (typeof window === "undefined") {
74
83
  console.warn("Can not mount checkout server side");
@@ -107,6 +116,7 @@ function mountCheckout(endpoint) {
107
116
  }));
108
117
  }
109
118
  if (evnt.event === "completed") {
119
+ console.log("Moonbase checkout completed", evnt.order);
110
120
  window.dispatchEvent(new CustomEvent("moonbase-checkout-completed", {
111
121
  detail: evnt
112
122
  }));
@@ -219,8 +229,11 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
219
229
  }, { immediate: true });
220
230
  });
221
231
  }
232
+ closeCheckout() {
233
+ closeCheckout();
234
+ }
222
235
  onCheckoutCompleted(callback) {
223
- window.addEventListener("moonbase-checkout-completed", () => callback());
236
+ window.addEventListener("moonbase-checkout-completed", (e) => callback(e.detail.order));
224
237
  }
225
238
  onCheckoutClosed(callback) {
226
239
  window.addEventListener("moonbase-checkout-closed", (e) => callback(e.detail.intent));
@@ -612,12 +625,12 @@ function useCart(context) {
612
625
  storefront.currentOrder.value.items.splice(index, 1);
613
626
  const _ = storefront.pushOrderContent();
614
627
  },
615
- checkout: async (returnUrl) => {
616
- const absoluteReturnUrl = new URL(returnUrl, document.baseURI).href;
628
+ checkout: async (options) => {
629
+ const absoluteReturnUrl = new URL(options.returnUrl, document.baseURI).href;
617
630
  const updatedOrder = await storefront.client.orders.pushContent(storefront.currentOrder.value, {
618
631
  returnUrl: absoluteReturnUrl
619
632
  });
620
- if (updatedOrder.embeddedCheckoutUrl && typeof window !== "undefined") {
633
+ if (!options.redirect && updatedOrder.embeddedCheckoutUrl && typeof window !== "undefined") {
621
634
  const embeddedUrl = updatedOrder.embeddedCheckoutUrl;
622
635
  return new Promise((resolve) => {
623
636
  mountCheckout(embeddedUrl.replace("acme-co.beta.moonbase.sh", "localhost:3002"));
@@ -625,7 +638,7 @@ function useCart(context) {
625
638
  resolve({ next: e.detail.next });
626
639
  });
627
640
  });
628
- } else if (updatedOrder.checkoutUrl && typeof window !== "undefined") {
641
+ } else if (options.redirect && updatedOrder.checkoutUrl && typeof window !== "undefined") {
629
642
  window.location.href = updatedOrder.checkoutUrl;
630
643
  return { next: void 0 };
631
644
  } else {
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _moonbase_sh_storefront_api from '@moonbase.sh/storefront-api';
2
- import { MoonbaseConfiguration, Storefront, Order, User, MoonbaseClient, StorefrontBundle, StorefrontProduct, ActivationMethod, Activation, Download, ActivationRequest, PricingVariation, CommunicationPreferences, LineItem } from '@moonbase.sh/storefront-api';
2
+ import { MoonbaseConfiguration, Storefront, Order, User, MoonbaseClient, CompletedOrder, StorefrontBundle, StorefrontProduct, ActivationMethod, Activation, Download, ActivationRequest, PricingVariation, CommunicationPreferences, LineItem } from '@moonbase.sh/storefront-api';
3
3
  export * from '@moonbase.sh/storefront-api';
4
4
  import * as vue from 'vue';
5
5
  import { Plugin, Ref, App, UnwrapRef, InjectionKey } from 'vue';
@@ -20,7 +20,8 @@ interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
20
20
  updateStorefront: () => Promise<void>;
21
21
  pushOrderContent: () => Promise<void>;
22
22
  resetOrder: () => void;
23
- onCheckoutCompleted: (callback: () => void) => void;
23
+ closeCheckout: () => void;
24
+ onCheckoutCompleted: (callback: (order: CompletedOrder) => void) => void;
24
25
  onCheckoutClosed: (callback: (intent: string | undefined) => void) => void;
25
26
  /**
26
27
  * Called automatically by `app.use(storefront)`. Should not be called manually by
@@ -594,63 +595,10 @@ declare function useCart(context?: StorefrontContext): {
594
595
  variationId: string;
595
596
  price?: Record<string, number> | undefined;
596
597
  product?: {
597
- type: "product";
598
598
  id: string;
599
599
  name: string;
600
600
  tagline: string;
601
601
  iconUrl: string | null;
602
- owned: boolean;
603
- website?: string | null | undefined;
604
- currentVersion?: string | undefined;
605
- downloads?: {
606
- path: string | null;
607
- name: string;
608
- key: string;
609
- platform: _moonbase_sh_storefront_api.Platform;
610
- size: number;
611
- }[] | undefined;
612
- defaultVariation?: {
613
- id: string;
614
- name: string;
615
- originalPrice: Record<string, number>;
616
- price: Record<string, number>;
617
- hasDiscount: boolean;
618
- discount?: {
619
- type: "PercentageOffDiscount";
620
- name: string;
621
- percentage: number;
622
- isExclusive: boolean;
623
- description?: string | undefined;
624
- total?: Record<string, number> | undefined;
625
- } | {
626
- type: "FlatAmountOffDiscount";
627
- name: string;
628
- isExclusive: boolean;
629
- description?: string | undefined;
630
- total?: Record<string, number> | undefined;
631
- } | undefined;
632
- } | undefined;
633
- variations?: {
634
- id: string;
635
- name: string;
636
- originalPrice: Record<string, number>;
637
- price: Record<string, number>;
638
- hasDiscount: boolean;
639
- discount?: {
640
- type: "PercentageOffDiscount";
641
- name: string;
642
- percentage: number;
643
- isExclusive: boolean;
644
- description?: string | undefined;
645
- total?: Record<string, number> | undefined;
646
- } | {
647
- type: "FlatAmountOffDiscount";
648
- name: string;
649
- isExclusive: boolean;
650
- description?: string | undefined;
651
- total?: Record<string, number> | undefined;
652
- } | undefined;
653
- }[] | undefined;
654
602
  } | undefined;
655
603
  variation?: {
656
604
  id: string;
@@ -695,116 +643,19 @@ declare function useCart(context?: StorefrontContext): {
695
643
  bundleId: string;
696
644
  price?: Record<string, number> | undefined;
697
645
  bundle?: {
698
- type: "bundle";
699
646
  id: string;
700
647
  name: string;
701
648
  tagline: string;
702
649
  iconUrl: string | null;
703
- owned: boolean;
704
650
  partial: boolean;
705
651
  products: ({
706
- type: "product";
707
652
  id: string;
708
653
  name: string;
709
654
  tagline: string;
710
655
  iconUrl: string | null;
711
- owned: boolean;
712
- website?: string | null | undefined;
713
- currentVersion?: string | undefined;
714
- downloads?: {
715
- path: string | null;
716
- name: string;
717
- key: string;
718
- platform: _moonbase_sh_storefront_api.Platform;
719
- size: number;
720
- }[] | undefined;
721
- defaultVariation?: {
722
- id: string;
723
- name: string;
724
- originalPrice: Record<string, number>;
725
- price: Record<string, number>;
726
- hasDiscount: boolean;
727
- discount?: {
728
- type: "PercentageOffDiscount";
729
- name: string;
730
- percentage: number;
731
- isExclusive: boolean;
732
- description?: string | undefined;
733
- total?: Record<string, number> | undefined;
734
- } | {
735
- type: "FlatAmountOffDiscount";
736
- name: string;
737
- isExclusive: boolean;
738
- description?: string | undefined;
739
- total?: Record<string, number> | undefined;
740
- } | undefined;
741
- } | undefined;
742
- variations?: {
743
- id: string;
744
- name: string;
745
- originalPrice: Record<string, number>;
746
- price: Record<string, number>;
747
- hasDiscount: boolean;
748
- discount?: {
749
- type: "PercentageOffDiscount";
750
- name: string;
751
- percentage: number;
752
- isExclusive: boolean;
753
- description?: string | undefined;
754
- total?: Record<string, number> | undefined;
755
- } | {
756
- type: "FlatAmountOffDiscount";
757
- name: string;
758
- isExclusive: boolean;
759
- description?: string | undefined;
760
- total?: Record<string, number> | undefined;
761
- } | undefined;
762
- }[] | undefined;
763
656
  } & {
764
657
  included?: boolean | undefined;
765
658
  })[];
766
- defaultVariation?: {
767
- id: string;
768
- name: string;
769
- originalPrice: Record<string, number>;
770
- price: Record<string, number>;
771
- hasDiscount: boolean;
772
- discount?: {
773
- type: "PercentageOffDiscount";
774
- name: string;
775
- percentage: number;
776
- isExclusive: boolean;
777
- description?: string | undefined;
778
- total?: Record<string, number> | undefined;
779
- } | {
780
- type: "FlatAmountOffDiscount";
781
- name: string;
782
- isExclusive: boolean;
783
- description?: string | undefined;
784
- total?: Record<string, number> | undefined;
785
- } | undefined;
786
- } | undefined;
787
- variations?: {
788
- id: string;
789
- name: string;
790
- originalPrice: Record<string, number>;
791
- price: Record<string, number>;
792
- hasDiscount: boolean;
793
- discount?: {
794
- type: "PercentageOffDiscount";
795
- name: string;
796
- percentage: number;
797
- isExclusive: boolean;
798
- description?: string | undefined;
799
- total?: Record<string, number> | undefined;
800
- } | {
801
- type: "FlatAmountOffDiscount";
802
- name: string;
803
- isExclusive: boolean;
804
- description?: string | undefined;
805
- total?: Record<string, number> | undefined;
806
- } | undefined;
807
- }[] | undefined;
808
659
  } | undefined;
809
660
  variation?: {
810
661
  id: string;
@@ -850,7 +701,10 @@ declare function useCart(context?: StorefrontContext): {
850
701
  addToCart: (item: StorefrontProduct | StorefrontBundle | Ref<StorefrontProduct> | Ref<StorefrontBundle>, variation?: PricingVariation) => void;
851
702
  setQuantity: (cartItem: CartItem, quantity: number) => void;
852
703
  removeFromCart: (cartItem: CartItem) => void;
853
- checkout: (returnUrl: string) => Promise<{
704
+ checkout: (options: {
705
+ redirect: boolean;
706
+ returnUrl: string;
707
+ }) => Promise<{
854
708
  next: string | undefined;
855
709
  } | undefined>;
856
710
  };
@@ -873,8 +727,25 @@ declare function useAuth(context?: StorefrontContext): {
873
727
  postCode: string;
874
728
  } | undefined;
875
729
  ownedProducts?: string[] | undefined;
730
+ } | null, {
731
+ id: string;
732
+ email: string;
733
+ name: string;
734
+ tenantId: string;
735
+ communicationPreferences: {
736
+ newsletterOptIn: boolean;
737
+ };
738
+ address?: {
739
+ countryCode: string;
740
+ streetAddress1: string;
741
+ streetAddress2: string | null;
742
+ locality: string | null;
743
+ region: string | null;
744
+ postCode: string;
745
+ } | undefined;
746
+ ownedProducts?: string[] | undefined;
876
747
  } | null>;
877
- loaded: vue.Ref<boolean>;
748
+ loaded: vue.Ref<boolean, boolean>;
878
749
  loadedPromise: Promise<void>;
879
750
  signIn: (email: string, password: string) => Promise<{
880
751
  id: string;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import * as _moonbase_sh_storefront_api from '@moonbase.sh/storefront-api';
2
- import { MoonbaseConfiguration, Storefront, Order, User, MoonbaseClient, StorefrontBundle, StorefrontProduct, ActivationMethod, Activation, Download, ActivationRequest, PricingVariation, CommunicationPreferences, LineItem } from '@moonbase.sh/storefront-api';
2
+ import { MoonbaseConfiguration, Storefront, Order, User, MoonbaseClient, CompletedOrder, StorefrontBundle, StorefrontProduct, ActivationMethod, Activation, Download, ActivationRequest, PricingVariation, CommunicationPreferences, LineItem } from '@moonbase.sh/storefront-api';
3
3
  export * from '@moonbase.sh/storefront-api';
4
4
  import * as vue from 'vue';
5
5
  import { Plugin, Ref, App, UnwrapRef, InjectionKey } from 'vue';
@@ -20,7 +20,8 @@ interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
20
20
  updateStorefront: () => Promise<void>;
21
21
  pushOrderContent: () => Promise<void>;
22
22
  resetOrder: () => void;
23
- onCheckoutCompleted: (callback: () => void) => void;
23
+ closeCheckout: () => void;
24
+ onCheckoutCompleted: (callback: (order: CompletedOrder) => void) => void;
24
25
  onCheckoutClosed: (callback: (intent: string | undefined) => void) => void;
25
26
  /**
26
27
  * Called automatically by `app.use(storefront)`. Should not be called manually by
@@ -594,63 +595,10 @@ declare function useCart(context?: StorefrontContext): {
594
595
  variationId: string;
595
596
  price?: Record<string, number> | undefined;
596
597
  product?: {
597
- type: "product";
598
598
  id: string;
599
599
  name: string;
600
600
  tagline: string;
601
601
  iconUrl: string | null;
602
- owned: boolean;
603
- website?: string | null | undefined;
604
- currentVersion?: string | undefined;
605
- downloads?: {
606
- path: string | null;
607
- name: string;
608
- key: string;
609
- platform: _moonbase_sh_storefront_api.Platform;
610
- size: number;
611
- }[] | undefined;
612
- defaultVariation?: {
613
- id: string;
614
- name: string;
615
- originalPrice: Record<string, number>;
616
- price: Record<string, number>;
617
- hasDiscount: boolean;
618
- discount?: {
619
- type: "PercentageOffDiscount";
620
- name: string;
621
- percentage: number;
622
- isExclusive: boolean;
623
- description?: string | undefined;
624
- total?: Record<string, number> | undefined;
625
- } | {
626
- type: "FlatAmountOffDiscount";
627
- name: string;
628
- isExclusive: boolean;
629
- description?: string | undefined;
630
- total?: Record<string, number> | undefined;
631
- } | undefined;
632
- } | undefined;
633
- variations?: {
634
- id: string;
635
- name: string;
636
- originalPrice: Record<string, number>;
637
- price: Record<string, number>;
638
- hasDiscount: boolean;
639
- discount?: {
640
- type: "PercentageOffDiscount";
641
- name: string;
642
- percentage: number;
643
- isExclusive: boolean;
644
- description?: string | undefined;
645
- total?: Record<string, number> | undefined;
646
- } | {
647
- type: "FlatAmountOffDiscount";
648
- name: string;
649
- isExclusive: boolean;
650
- description?: string | undefined;
651
- total?: Record<string, number> | undefined;
652
- } | undefined;
653
- }[] | undefined;
654
602
  } | undefined;
655
603
  variation?: {
656
604
  id: string;
@@ -695,116 +643,19 @@ declare function useCart(context?: StorefrontContext): {
695
643
  bundleId: string;
696
644
  price?: Record<string, number> | undefined;
697
645
  bundle?: {
698
- type: "bundle";
699
646
  id: string;
700
647
  name: string;
701
648
  tagline: string;
702
649
  iconUrl: string | null;
703
- owned: boolean;
704
650
  partial: boolean;
705
651
  products: ({
706
- type: "product";
707
652
  id: string;
708
653
  name: string;
709
654
  tagline: string;
710
655
  iconUrl: string | null;
711
- owned: boolean;
712
- website?: string | null | undefined;
713
- currentVersion?: string | undefined;
714
- downloads?: {
715
- path: string | null;
716
- name: string;
717
- key: string;
718
- platform: _moonbase_sh_storefront_api.Platform;
719
- size: number;
720
- }[] | undefined;
721
- defaultVariation?: {
722
- id: string;
723
- name: string;
724
- originalPrice: Record<string, number>;
725
- price: Record<string, number>;
726
- hasDiscount: boolean;
727
- discount?: {
728
- type: "PercentageOffDiscount";
729
- name: string;
730
- percentage: number;
731
- isExclusive: boolean;
732
- description?: string | undefined;
733
- total?: Record<string, number> | undefined;
734
- } | {
735
- type: "FlatAmountOffDiscount";
736
- name: string;
737
- isExclusive: boolean;
738
- description?: string | undefined;
739
- total?: Record<string, number> | undefined;
740
- } | undefined;
741
- } | undefined;
742
- variations?: {
743
- id: string;
744
- name: string;
745
- originalPrice: Record<string, number>;
746
- price: Record<string, number>;
747
- hasDiscount: boolean;
748
- discount?: {
749
- type: "PercentageOffDiscount";
750
- name: string;
751
- percentage: number;
752
- isExclusive: boolean;
753
- description?: string | undefined;
754
- total?: Record<string, number> | undefined;
755
- } | {
756
- type: "FlatAmountOffDiscount";
757
- name: string;
758
- isExclusive: boolean;
759
- description?: string | undefined;
760
- total?: Record<string, number> | undefined;
761
- } | undefined;
762
- }[] | undefined;
763
656
  } & {
764
657
  included?: boolean | undefined;
765
658
  })[];
766
- defaultVariation?: {
767
- id: string;
768
- name: string;
769
- originalPrice: Record<string, number>;
770
- price: Record<string, number>;
771
- hasDiscount: boolean;
772
- discount?: {
773
- type: "PercentageOffDiscount";
774
- name: string;
775
- percentage: number;
776
- isExclusive: boolean;
777
- description?: string | undefined;
778
- total?: Record<string, number> | undefined;
779
- } | {
780
- type: "FlatAmountOffDiscount";
781
- name: string;
782
- isExclusive: boolean;
783
- description?: string | undefined;
784
- total?: Record<string, number> | undefined;
785
- } | undefined;
786
- } | undefined;
787
- variations?: {
788
- id: string;
789
- name: string;
790
- originalPrice: Record<string, number>;
791
- price: Record<string, number>;
792
- hasDiscount: boolean;
793
- discount?: {
794
- type: "PercentageOffDiscount";
795
- name: string;
796
- percentage: number;
797
- isExclusive: boolean;
798
- description?: string | undefined;
799
- total?: Record<string, number> | undefined;
800
- } | {
801
- type: "FlatAmountOffDiscount";
802
- name: string;
803
- isExclusive: boolean;
804
- description?: string | undefined;
805
- total?: Record<string, number> | undefined;
806
- } | undefined;
807
- }[] | undefined;
808
659
  } | undefined;
809
660
  variation?: {
810
661
  id: string;
@@ -850,7 +701,10 @@ declare function useCart(context?: StorefrontContext): {
850
701
  addToCart: (item: StorefrontProduct | StorefrontBundle | Ref<StorefrontProduct> | Ref<StorefrontBundle>, variation?: PricingVariation) => void;
851
702
  setQuantity: (cartItem: CartItem, quantity: number) => void;
852
703
  removeFromCart: (cartItem: CartItem) => void;
853
- checkout: (returnUrl: string) => Promise<{
704
+ checkout: (options: {
705
+ redirect: boolean;
706
+ returnUrl: string;
707
+ }) => Promise<{
854
708
  next: string | undefined;
855
709
  } | undefined>;
856
710
  };
@@ -873,8 +727,25 @@ declare function useAuth(context?: StorefrontContext): {
873
727
  postCode: string;
874
728
  } | undefined;
875
729
  ownedProducts?: string[] | undefined;
730
+ } | null, {
731
+ id: string;
732
+ email: string;
733
+ name: string;
734
+ tenantId: string;
735
+ communicationPreferences: {
736
+ newsletterOptIn: boolean;
737
+ };
738
+ address?: {
739
+ countryCode: string;
740
+ streetAddress1: string;
741
+ streetAddress2: string | null;
742
+ locality: string | null;
743
+ region: string | null;
744
+ postCode: string;
745
+ } | undefined;
746
+ ownedProducts?: string[] | undefined;
876
747
  } | null>;
877
- loaded: vue.Ref<boolean>;
748
+ loaded: vue.Ref<boolean, boolean>;
878
749
  loadedPromise: Promise<void>;
879
750
  signIn: (email: string, password: string) => Promise<{
880
751
  id: string;
package/dist/index.js CHANGED
@@ -23,6 +23,7 @@ function debounce(func, waitMs = 100) {
23
23
  }
24
24
 
25
25
  // src/utils/iframe-checkout.ts
26
+ import { completedOrderSchema } from "@moonbase.sh/storefront-api/src/orders/schemas";
26
27
  import { z } from "zod";
27
28
  var closeEventSchema = z.object({
28
29
  source: z.literal("moonbase-checkout"),
@@ -31,9 +32,17 @@ var closeEventSchema = z.object({
31
32
  });
32
33
  var completedEventSchema = z.object({
33
34
  source: z.literal("moonbase-checkout"),
34
- event: z.literal("completed")
35
+ event: z.literal("completed"),
36
+ order: completedOrderSchema
35
37
  });
36
38
  var eventSchema = z.discriminatedUnion("event", [closeEventSchema, completedEventSchema]);
39
+ function closeCheckout() {
40
+ var _a;
41
+ const iframe = document.getElementById("moonbase-checkout");
42
+ if (!iframe || !(iframe instanceof HTMLIFrameElement))
43
+ return;
44
+ (_a = iframe.contentWindow) == null ? void 0 : _a.postMessage("close", "*");
45
+ }
37
46
  function mountCheckout(endpoint) {
38
47
  if (typeof window === "undefined") {
39
48
  console.warn("Can not mount checkout server side");
@@ -72,6 +81,7 @@ function mountCheckout(endpoint) {
72
81
  }));
73
82
  }
74
83
  if (evnt.event === "completed") {
84
+ console.log("Moonbase checkout completed", evnt.order);
75
85
  window.dispatchEvent(new CustomEvent("moonbase-checkout-completed", {
76
86
  detail: evnt
77
87
  }));
@@ -184,8 +194,11 @@ var _StorefrontContextImpl = class _StorefrontContextImpl {
184
194
  }, { immediate: true });
185
195
  });
186
196
  }
197
+ closeCheckout() {
198
+ closeCheckout();
199
+ }
187
200
  onCheckoutCompleted(callback) {
188
- window.addEventListener("moonbase-checkout-completed", () => callback());
201
+ window.addEventListener("moonbase-checkout-completed", (e) => callback(e.detail.order));
189
202
  }
190
203
  onCheckoutClosed(callback) {
191
204
  window.addEventListener("moonbase-checkout-closed", (e) => callback(e.detail.intent));
@@ -577,12 +590,12 @@ function useCart(context) {
577
590
  storefront.currentOrder.value.items.splice(index, 1);
578
591
  const _ = storefront.pushOrderContent();
579
592
  },
580
- checkout: async (returnUrl) => {
581
- const absoluteReturnUrl = new URL(returnUrl, document.baseURI).href;
593
+ checkout: async (options) => {
594
+ const absoluteReturnUrl = new URL(options.returnUrl, document.baseURI).href;
582
595
  const updatedOrder = await storefront.client.orders.pushContent(storefront.currentOrder.value, {
583
596
  returnUrl: absoluteReturnUrl
584
597
  });
585
- if (updatedOrder.embeddedCheckoutUrl && typeof window !== "undefined") {
598
+ if (!options.redirect && updatedOrder.embeddedCheckoutUrl && typeof window !== "undefined") {
586
599
  const embeddedUrl = updatedOrder.embeddedCheckoutUrl;
587
600
  return new Promise((resolve) => {
588
601
  mountCheckout(embeddedUrl.replace("acme-co.beta.moonbase.sh", "localhost:3002"));
@@ -590,7 +603,7 @@ function useCart(context) {
590
603
  resolve({ next: e.detail.next });
591
604
  });
592
605
  });
593
- } else if (updatedOrder.checkoutUrl && typeof window !== "undefined") {
606
+ } else if (options.redirect && updatedOrder.checkoutUrl && typeof window !== "undefined") {
594
607
  window.location.href = updatedOrder.checkoutUrl;
595
608
  return { next: void 0 };
596
609
  } else {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moonbase.sh/vue",
3
3
  "type": "module",
4
- "version": "0.2.27",
4
+ "version": "0.2.30",
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",
@@ -16,17 +16,17 @@
16
16
  "vue": "^3.2.0"
17
17
  },
18
18
  "dependencies": {
19
- "@vue/devtools-api": "^6.5.1",
19
+ "@vue/devtools-api": "^6.6.3",
20
20
  "uuid": "^9.0.1",
21
- "zod": "^3.21.4",
22
- "@moonbase.sh/storefront-api": "0.2.27"
21
+ "zod": "^3.23.8",
22
+ "@moonbase.sh/storefront-api": "0.2.30"
23
23
  },
24
24
  "devDependencies": {
25
- "@types/uuid": "^9.0.7",
26
- "rimraf": "^5.0.5",
25
+ "@types/uuid": "^9.0.8",
26
+ "rimraf": "^5.0.10",
27
27
  "tsup": "^7.2.0",
28
28
  "typescript": "~5.1.6",
29
- "vue": "^3.3.9"
29
+ "vue": "^3.5.3"
30
30
  },
31
31
  "scripts": {
32
32
  "build": "tsup src/index.ts --format esm,cjs --dts",