@moonbase.sh/vue 0.2.115 → 0.2.117

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.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, UrchinTrackingModule, MoonbaseClient, CompletedOrder, StorefrontBundle, StorefrontProduct, ActivationMethod, Activation, Download, ActivationRequest, PricingVariation, CommunicationPreferences, Vendor, LineItem } from '@moonbase.sh/storefront-api';
2
+ import { MoonbaseConfiguration, Storefront, Order, User, UrchinTrackingModule, MoonbaseClient, CompletedOrder, ActivationRequest, CommunicationPreferences, StorefrontBundle, StorefrontProduct, PricingVariation, ActivationMethod, Activation, Download, Vendor, 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';
@@ -37,13 +37,253 @@ interface StorefrontContext extends Pick<Plugin, keyof Plugin> {
37
37
  }
38
38
  type StateFactory = <T>(key: string, state: T) => Ref<T> | Ref<UnwrapRef<T>>;
39
39
 
40
+ interface ActivationRequestComposable {
41
+ activationRequest: Ref<null | ActivationRequest>;
42
+ loading: Ref<boolean>;
43
+ fulfilling: Ref<boolean>;
44
+ completing: Ref<boolean>;
45
+ error: Ref<null | Error>;
46
+ isInstalled: Ref<boolean>;
47
+ fulfillLicense: () => Promise<void>;
48
+ fulfillTrial: () => Promise<void>;
49
+ cancel: () => Promise<void>;
50
+ }
51
+ declare function useActivationRequest(token: string | Ref<string>, context?: StorefrontContext): ActivationRequestComposable;
52
+
53
+ declare function useAuth(context?: StorefrontContext): {
54
+ user: vue.Ref<{
55
+ id: string;
56
+ email: string;
57
+ name: string;
58
+ tenantId: string;
59
+ communicationPreferences: {
60
+ newsletterOptIn: boolean;
61
+ };
62
+ address?: {
63
+ countryCode: string;
64
+ streetAddress1: string;
65
+ streetAddress2: string | null;
66
+ locality: string | null;
67
+ region: string | null;
68
+ postCode: string;
69
+ } | undefined;
70
+ ownedProducts?: string[] | undefined;
71
+ } | null, {
72
+ id: string;
73
+ email: string;
74
+ name: string;
75
+ tenantId: string;
76
+ communicationPreferences: {
77
+ newsletterOptIn: boolean;
78
+ };
79
+ address?: {
80
+ countryCode: string;
81
+ streetAddress1: string;
82
+ streetAddress2: string | null;
83
+ locality: string | null;
84
+ region: string | null;
85
+ postCode: string;
86
+ } | undefined;
87
+ ownedProducts?: string[] | undefined;
88
+ } | null>;
89
+ loaded: vue.Ref<boolean, boolean>;
90
+ loadedPromise: Promise<void>;
91
+ signIn: (email: string, password: string) => Promise<{
92
+ id: string;
93
+ email: string;
94
+ name: string;
95
+ tenantId: string;
96
+ communicationPreferences: {
97
+ newsletterOptIn: boolean;
98
+ };
99
+ address?: {
100
+ countryCode: string;
101
+ streetAddress1: string;
102
+ streetAddress2: string | null;
103
+ locality: string | null;
104
+ region: string | null;
105
+ postCode: string;
106
+ } | undefined;
107
+ ownedProducts?: string[] | undefined;
108
+ }>;
109
+ signUp: (name: string, email: string, password: string, address: Address | null | undefined, acceptedPrivacyPolicy: boolean, acceptedTermsAndConditions: boolean, communicationOptIn?: boolean) => Promise<{
110
+ id: string;
111
+ email: string;
112
+ name: string;
113
+ tenantId: string;
114
+ communicationPreferences: {
115
+ newsletterOptIn: boolean;
116
+ };
117
+ address?: {
118
+ countryCode: string;
119
+ streetAddress1: string;
120
+ streetAddress2: string | null;
121
+ locality: string | null;
122
+ region: string | null;
123
+ postCode: string;
124
+ } | undefined;
125
+ ownedProducts?: string[] | undefined;
126
+ }>;
127
+ signOut: () => Promise<void>;
128
+ update: (name: string, email: string, emailConfirmationToken?: string, communicationPreferences?: CommunicationPreferences) => Promise<{
129
+ needsEmailConfirmationToken: boolean;
130
+ }>;
131
+ setPassword: (currentPassword: string, newPassword: string) => Promise<void>;
132
+ forgotPassword: (email: string) => Promise<void>;
133
+ resetPassword: (email: string, newPassword: string, code: string) => Promise<void>;
134
+ confirmAccount: (email: string, code: string) => Promise<{
135
+ id: string;
136
+ email: string;
137
+ name: string;
138
+ resetPasswordToken: string | null;
139
+ }>;
140
+ confirmEmail: (email: string, code: string) => Promise<void>;
141
+ confirmEmailChange: (email: string, code: string) => Promise<{
142
+ id: string;
143
+ email: string;
144
+ name: string;
145
+ tenantId: string;
146
+ communicationPreferences: {
147
+ newsletterOptIn: boolean;
148
+ };
149
+ address?: {
150
+ countryCode: string;
151
+ streetAddress1: string;
152
+ streetAddress2: string | null;
153
+ locality: string | null;
154
+ region: string | null;
155
+ postCode: string;
156
+ } | undefined;
157
+ ownedProducts?: string[] | undefined;
158
+ } | null>;
159
+ };
160
+
40
161
  declare function useBundle(bundleId: string, context?: StorefrontContext): Ref<StorefrontBundle | null>;
41
162
 
42
163
  declare function useBundles(context?: StorefrontContext): Ref<StorefrontBundle[]>;
43
164
 
44
- declare function useProduct(productId: string, context?: StorefrontContext): Ref<StorefrontProduct | null>;
45
-
46
- declare function useProducts(context?: StorefrontContext): Ref<StorefrontProduct[]>;
165
+ declare function useCart(context?: StorefrontContext): {
166
+ items: vue.ComputedRef<({
167
+ type: "Product";
168
+ id: string;
169
+ quantity: number;
170
+ productId: string;
171
+ variationId: string;
172
+ price?: Record<string, number> | undefined;
173
+ product?: {
174
+ id: string;
175
+ name: string;
176
+ tagline: string;
177
+ iconUrl: string | null;
178
+ } | undefined;
179
+ variation?: {
180
+ id: string;
181
+ name: string;
182
+ originalPrice: Record<string, number>;
183
+ price: Record<string, number>;
184
+ hasDiscount: boolean;
185
+ discount?: {
186
+ type: "PercentageOffDiscount";
187
+ name: string;
188
+ percentage: number;
189
+ isExclusive: boolean;
190
+ description?: string | undefined;
191
+ total?: Record<string, number> | undefined;
192
+ } | {
193
+ type: "FlatAmountOffDiscount";
194
+ name: string;
195
+ isExclusive: boolean;
196
+ description?: string | undefined;
197
+ total?: Record<string, number> | undefined;
198
+ } | undefined;
199
+ } | undefined;
200
+ appliedDiscount?: {
201
+ type: "PercentageOffDiscount";
202
+ name: string;
203
+ percentage: number;
204
+ isExclusive: boolean;
205
+ description?: string | undefined;
206
+ total?: Record<string, number> | undefined;
207
+ } | {
208
+ type: "FlatAmountOffDiscount";
209
+ name: string;
210
+ isExclusive: boolean;
211
+ description?: string | undefined;
212
+ total?: Record<string, number> | undefined;
213
+ } | undefined;
214
+ } | {
215
+ type: "Bundle";
216
+ id: string;
217
+ quantity: number;
218
+ variationId: string;
219
+ bundleId: string;
220
+ price?: Record<string, number> | undefined;
221
+ partial?: boolean | undefined;
222
+ bundle?: {
223
+ id: string;
224
+ name: string;
225
+ tagline: string;
226
+ iconUrl: string | null;
227
+ products: ({
228
+ id: string;
229
+ name: string;
230
+ tagline: string;
231
+ iconUrl: string | null;
232
+ } & {
233
+ included?: boolean | undefined;
234
+ })[];
235
+ } | undefined;
236
+ variation?: {
237
+ id: string;
238
+ name: string;
239
+ originalPrice: Record<string, number>;
240
+ price: Record<string, number>;
241
+ hasDiscount: boolean;
242
+ discount?: {
243
+ type: "PercentageOffDiscount";
244
+ name: string;
245
+ percentage: number;
246
+ isExclusive: boolean;
247
+ description?: string | undefined;
248
+ total?: Record<string, number> | undefined;
249
+ } | {
250
+ type: "FlatAmountOffDiscount";
251
+ name: string;
252
+ isExclusive: boolean;
253
+ description?: string | undefined;
254
+ total?: Record<string, number> | undefined;
255
+ } | undefined;
256
+ } | undefined;
257
+ appliedDiscount?: {
258
+ type: "PercentageOffDiscount";
259
+ name: string;
260
+ percentage: number;
261
+ isExclusive: boolean;
262
+ description?: string | undefined;
263
+ total?: Record<string, number> | undefined;
264
+ } | {
265
+ type: "FlatAmountOffDiscount";
266
+ name: string;
267
+ isExclusive: boolean;
268
+ description?: string | undefined;
269
+ total?: Record<string, number> | undefined;
270
+ } | undefined;
271
+ })[]>;
272
+ currency: vue.ComputedRef<string>;
273
+ total: vue.ComputedRef<{
274
+ amount: number;
275
+ currency: string;
276
+ }>;
277
+ addToCart: (item: StorefrontProduct | StorefrontBundle | Ref<StorefrontProduct> | Ref<StorefrontBundle>, variation?: PricingVariation) => CartItem;
278
+ setQuantity: (cartItem: CartItem, quantity: number) => CartItem;
279
+ removeFromCart: (cartItem: CartItem) => void;
280
+ checkout: (options: {
281
+ redirect: boolean;
282
+ returnUrl?: string;
283
+ }) => Promise<{
284
+ next: string | undefined;
285
+ } | undefined>;
286
+ };
47
287
 
48
288
  declare function useInventory(context?: StorefrontContext): {
49
289
  getLicenses: (nextUrl?: string) => Promise<_moonbase_sh_storefront_api.Page<{
@@ -250,18 +490,15 @@ declare function useInventory(context?: StorefrontContext): {
250
490
  downloadProduct: (download: Download) => Promise<void>;
251
491
  };
252
492
 
253
- interface ActivationRequestComposable {
254
- activationRequest: Ref<null | ActivationRequest>;
493
+ declare function useProduct(productId: string, context?: StorefrontContext): Ref<StorefrontProduct | null>;
494
+
495
+ declare function useProducts(context?: StorefrontContext): Ref<StorefrontProduct[]>;
496
+
497
+ interface VendorComposable {
498
+ vendor: Ref<null | Vendor>;
255
499
  loading: Ref<boolean>;
256
- fulfilling: Ref<boolean>;
257
- completing: Ref<boolean>;
258
- error: Ref<null | Error>;
259
- isInstalled: Ref<boolean>;
260
- fulfillLicense: () => Promise<void>;
261
- fulfillTrial: () => Promise<void>;
262
- cancel: () => Promise<void>;
263
500
  }
264
- declare function useActivationRequest(token: string | Ref<string>, context?: StorefrontContext): ActivationRequestComposable;
501
+ declare function useVendor(context?: StorefrontContext): VendorComposable;
265
502
 
266
503
  declare function useVoucher(context?: StorefrontContext): {
267
504
  peek: (code: string) => Promise<{
@@ -668,243 +905,6 @@ declare function useVoucher(context?: StorefrontContext): {
668
905
  }>;
669
906
  };
670
907
 
671
- declare function useCart(context?: StorefrontContext): {
672
- items: vue.ComputedRef<({
673
- type: "Product";
674
- id: string;
675
- quantity: number;
676
- productId: string;
677
- variationId: string;
678
- price?: Record<string, number> | undefined;
679
- product?: {
680
- id: string;
681
- name: string;
682
- tagline: string;
683
- iconUrl: string | null;
684
- } | undefined;
685
- variation?: {
686
- id: string;
687
- name: string;
688
- originalPrice: Record<string, number>;
689
- price: Record<string, number>;
690
- hasDiscount: boolean;
691
- discount?: {
692
- type: "PercentageOffDiscount";
693
- name: string;
694
- percentage: number;
695
- isExclusive: boolean;
696
- description?: string | undefined;
697
- total?: Record<string, number> | undefined;
698
- } | {
699
- type: "FlatAmountOffDiscount";
700
- name: string;
701
- isExclusive: boolean;
702
- description?: string | undefined;
703
- total?: Record<string, number> | undefined;
704
- } | undefined;
705
- } | undefined;
706
- appliedDiscount?: {
707
- type: "PercentageOffDiscount";
708
- name: string;
709
- percentage: number;
710
- isExclusive: boolean;
711
- description?: string | undefined;
712
- total?: Record<string, number> | undefined;
713
- } | {
714
- type: "FlatAmountOffDiscount";
715
- name: string;
716
- isExclusive: boolean;
717
- description?: string | undefined;
718
- total?: Record<string, number> | undefined;
719
- } | undefined;
720
- } | {
721
- type: "Bundle";
722
- id: string;
723
- quantity: number;
724
- variationId: string;
725
- bundleId: string;
726
- price?: Record<string, number> | undefined;
727
- partial?: boolean | undefined;
728
- bundle?: {
729
- id: string;
730
- name: string;
731
- tagline: string;
732
- iconUrl: string | null;
733
- products: ({
734
- id: string;
735
- name: string;
736
- tagline: string;
737
- iconUrl: string | null;
738
- } & {
739
- included?: boolean | undefined;
740
- })[];
741
- } | undefined;
742
- variation?: {
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
- appliedDiscount?: {
764
- type: "PercentageOffDiscount";
765
- name: string;
766
- percentage: number;
767
- isExclusive: boolean;
768
- description?: string | undefined;
769
- total?: Record<string, number> | undefined;
770
- } | {
771
- type: "FlatAmountOffDiscount";
772
- name: string;
773
- isExclusive: boolean;
774
- description?: string | undefined;
775
- total?: Record<string, number> | undefined;
776
- } | undefined;
777
- })[]>;
778
- currency: vue.ComputedRef<string>;
779
- total: vue.ComputedRef<{
780
- amount: number;
781
- currency: string;
782
- }>;
783
- addToCart: (item: StorefrontProduct | StorefrontBundle | Ref<StorefrontProduct> | Ref<StorefrontBundle>, variation?: PricingVariation) => CartItem;
784
- setQuantity: (cartItem: CartItem, quantity: number) => CartItem;
785
- removeFromCart: (cartItem: CartItem) => void;
786
- checkout: (options: {
787
- redirect: boolean;
788
- returnUrl?: string;
789
- }) => Promise<{
790
- next: string | undefined;
791
- } | undefined>;
792
- };
793
-
794
- declare function useAuth(context?: StorefrontContext): {
795
- user: vue.Ref<{
796
- id: string;
797
- email: string;
798
- name: string;
799
- tenantId: string;
800
- communicationPreferences: {
801
- newsletterOptIn: boolean;
802
- };
803
- address?: {
804
- countryCode: string;
805
- streetAddress1: string;
806
- streetAddress2: string | null;
807
- locality: string | null;
808
- region: string | null;
809
- postCode: string;
810
- } | undefined;
811
- ownedProducts?: string[] | undefined;
812
- } | null, {
813
- id: string;
814
- email: string;
815
- name: string;
816
- tenantId: string;
817
- communicationPreferences: {
818
- newsletterOptIn: boolean;
819
- };
820
- address?: {
821
- countryCode: string;
822
- streetAddress1: string;
823
- streetAddress2: string | null;
824
- locality: string | null;
825
- region: string | null;
826
- postCode: string;
827
- } | undefined;
828
- ownedProducts?: string[] | undefined;
829
- } | null>;
830
- loaded: vue.Ref<boolean, boolean>;
831
- loadedPromise: Promise<void>;
832
- signIn: (email: string, password: string) => Promise<{
833
- id: string;
834
- email: string;
835
- name: string;
836
- tenantId: string;
837
- communicationPreferences: {
838
- newsletterOptIn: boolean;
839
- };
840
- address?: {
841
- countryCode: string;
842
- streetAddress1: string;
843
- streetAddress2: string | null;
844
- locality: string | null;
845
- region: string | null;
846
- postCode: string;
847
- } | undefined;
848
- ownedProducts?: string[] | undefined;
849
- }>;
850
- signUp: (name: string, email: string, password: string, address: Address | null | undefined, acceptedPrivacyPolicy: boolean, acceptedTermsAndConditions: boolean, communicationOptIn?: boolean) => Promise<{
851
- id: string;
852
- email: string;
853
- name: string;
854
- tenantId: string;
855
- communicationPreferences: {
856
- newsletterOptIn: boolean;
857
- };
858
- address?: {
859
- countryCode: string;
860
- streetAddress1: string;
861
- streetAddress2: string | null;
862
- locality: string | null;
863
- region: string | null;
864
- postCode: string;
865
- } | undefined;
866
- ownedProducts?: string[] | undefined;
867
- }>;
868
- signOut: () => Promise<void>;
869
- update: (name: string, email: string, emailConfirmationToken?: string, communicationPreferences?: CommunicationPreferences) => Promise<{
870
- needsEmailConfirmationToken: boolean;
871
- }>;
872
- setPassword: (currentPassword: string, newPassword: string) => Promise<void>;
873
- forgotPassword: (email: string) => Promise<void>;
874
- resetPassword: (email: string, newPassword: string, code: string) => Promise<void>;
875
- confirmAccount: (email: string, code: string) => Promise<{
876
- id: string;
877
- email: string;
878
- name: string;
879
- resetPasswordToken: string | null;
880
- }>;
881
- confirmEmail: (email: string, code: string) => Promise<void>;
882
- confirmEmailChange: (email: string, code: string) => Promise<{
883
- id: string;
884
- email: string;
885
- name: string;
886
- tenantId: string;
887
- communicationPreferences: {
888
- newsletterOptIn: boolean;
889
- };
890
- address?: {
891
- countryCode: string;
892
- streetAddress1: string;
893
- streetAddress2: string | null;
894
- locality: string | null;
895
- region: string | null;
896
- postCode: string;
897
- } | undefined;
898
- ownedProducts?: string[] | undefined;
899
- } | null>;
900
- };
901
-
902
- interface VendorComposable {
903
- vendor: Ref<null | Vendor>;
904
- loading: Ref<boolean>;
905
- }
906
- declare function useVendor(context?: StorefrontContext): VendorComposable;
907
-
908
908
  declare const storefrontKey: InjectionKey<StorefrontContext>;
909
909
 
910
910
  interface Cart {