@moonbase.sh/storefront 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.
@@ -1,12 +1,79 @@
1
+ import { ActivationRequestFulfillmentType } from '@moonbase.sh/vue';
2
+ import { CartItem } from '@moonbase.sh/vue';
3
+ import { Download } from '@moonbase.sh/vue';
1
4
  import { InjectionKey } from 'vue';
5
+ import { Order } from '@moonbase.sh/vue';
6
+ import { OwnedProduct } from '@moonbase.sh/vue';
7
+ import { StorefrontProduct } from '@moonbase.sh/vue';
8
+ import { User } from '@moonbase.sh/vue';
9
+ import { Voucher } from '@moonbase.sh/vue';
2
10
 
3
11
  declare type DeepPartial<T> = T extends object ? {
4
12
  [P in keyof T]?: T[P] extends HTMLElement | undefined ? T[P] : DeepPartial<T[P]>;
5
13
  } : T;
6
14
 
15
+ export declare const eventEmitterKey: InjectionKey<MoonbaseEventEmitter>;
16
+
7
17
  declare const Moonbase_2: MoonbaseImpl;
8
18
  export default Moonbase_2;
9
19
 
20
+ declare enum MoonbaseEvent {
21
+ SignedIn = "signed-in",
22
+ SignedUp = "signed-up",
23
+ SignedOut = "signed-out",
24
+ RedeemedVoucher = "redeemed-voucher",
25
+ DownloadedProduct = "downloaded-product",
26
+ ActivatedProduct = "activated-product",
27
+ AddedToCart = "added-to-cart",
28
+ CheckoutInitiated = "checkout-initiated",
29
+ CheckoutClosed = "checkout-closed",
30
+ CheckoutCompleted = "checkout-completed"
31
+ }
32
+
33
+ declare interface MoonbaseEventArgs {
34
+ [MoonbaseEvent.SignedIn]: {
35
+ user: User;
36
+ };
37
+ [MoonbaseEvent.SignedUp]: {
38
+ user: User;
39
+ };
40
+ [MoonbaseEvent.SignedOut]: {
41
+ user: User;
42
+ };
43
+ [MoonbaseEvent.RedeemedVoucher]: {
44
+ voucher: Voucher;
45
+ user: User;
46
+ };
47
+ [MoonbaseEvent.DownloadedProduct]: {
48
+ product: OwnedProduct;
49
+ download: Download;
50
+ user?: User | null;
51
+ };
52
+ [MoonbaseEvent.ActivatedProduct]: {
53
+ product: StorefrontProduct;
54
+ fulfillmentType: ActivationRequestFulfillmentType;
55
+ user?: User | null;
56
+ };
57
+ [MoonbaseEvent.AddedToCart]: {
58
+ item: CartItem;
59
+ user?: User | null;
60
+ };
61
+ [MoonbaseEvent.CheckoutInitiated]: {
62
+ order: Order;
63
+ user?: User | null;
64
+ };
65
+ [MoonbaseEvent.CheckoutClosed]: {
66
+ order: Order;
67
+ user?: User | null;
68
+ };
69
+ [MoonbaseEvent.CheckoutCompleted]: {
70
+ order: Order;
71
+ user?: User | null;
72
+ };
73
+ }
74
+
75
+ declare type MoonbaseEventEmitter = <TEvent extends MoonbaseEvent>(eventType: TEvent, event: MoonbaseEventArgs[TEvent]) => void;
76
+
10
77
  declare class MoonbaseImpl implements MoonbaseInstance {
11
78
  private initialized;
12
79
  private pinia;
@@ -14,6 +81,7 @@ declare class MoonbaseImpl implements MoonbaseInstance {
14
81
  private options;
15
82
  setup(url: string, options?: DeepPartial<MoonbaseOptions>): Promise<void>;
16
83
  configure(options: DeepPartial<MoonbaseOptions>): void;
84
+ on<TEvent extends MoonbaseEvent>(eventType: TEvent, callback: (event: MoonbaseEventArgs[TEvent]) => void): void;
17
85
  sign_in(parameters?: MoonbaseIntentArgs['sign_in']): void;
18
86
  sign_up(parameters?: MoonbaseIntentArgs['sign_up']): void;
19
87
  forgot_password(parameters?: MoonbaseIntentArgs['forgot_password']): void;
@@ -37,6 +105,7 @@ declare class MoonbaseImpl implements MoonbaseInstance {
37
105
  export declare type MoonbaseInstance = MoonbaseInstanceIntents & {
38
106
  setup: (url: string, options: DeepPartial<MoonbaseOptions>) => Promise<void>;
39
107
  configure: (options: DeepPartial<MoonbaseOptions>) => void;
108
+ on: <TEvent extends MoonbaseEvent>(eventType: TEvent, callback: (event: MoonbaseEventArgs[TEvent]) => void) => void;
40
109
  };
41
110
 
42
111
  declare type MoonbaseInstanceIntents = {
@@ -140,7 +209,7 @@ declare interface MoonbaseOptions {
140
209
  };
141
210
  theme: {
142
211
  colors: {
143
- primary: Record<number, string>;
212
+ primary: Record<number, string> | string;
144
213
  background: 'white' | 'gray';
145
214
  };
146
215
  fonts: {