@moonbase.sh/vue 0.2.82 → 0.2.83
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 +22 -2
- package/dist/index.d.cts +8 -2
- package/dist/index.d.ts +8 -2
- package/dist/index.js +21 -2
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -31,11 +31,12 @@ __export(src_exports, {
|
|
|
31
31
|
useInventory: () => useInventory,
|
|
32
32
|
useProduct: () => useProduct,
|
|
33
33
|
useProducts: () => useProducts,
|
|
34
|
+
useVendor: () => useVendor,
|
|
34
35
|
useVoucher: () => useVoucher
|
|
35
36
|
});
|
|
36
37
|
module.exports = __toCommonJS(src_exports);
|
|
37
38
|
var import_storefront_api6 = require("@moonbase.sh/storefront-api");
|
|
38
|
-
var
|
|
39
|
+
var import_vue12 = require("vue");
|
|
39
40
|
|
|
40
41
|
// src/context.ts
|
|
41
42
|
var import_uuid = require("uuid");
|
|
@@ -759,6 +760,24 @@ function useAuth(context) {
|
|
|
759
760
|
};
|
|
760
761
|
}
|
|
761
762
|
|
|
763
|
+
// src/composables/useVendor.ts
|
|
764
|
+
var import_vue11 = require("vue");
|
|
765
|
+
function useVendor(context) {
|
|
766
|
+
const storefront = context != null ? context : (0, import_vue11.inject)(storefrontKey);
|
|
767
|
+
if (!storefront)
|
|
768
|
+
throw new Error("No storefront configured");
|
|
769
|
+
const vendor = (0, import_vue11.ref)(null);
|
|
770
|
+
const loading = (0, import_vue11.ref)(true);
|
|
771
|
+
storefront.client.vendor.get().then((v) => {
|
|
772
|
+
vendor.value = v;
|
|
773
|
+
loading.value = false;
|
|
774
|
+
});
|
|
775
|
+
return {
|
|
776
|
+
vendor,
|
|
777
|
+
loading
|
|
778
|
+
};
|
|
779
|
+
}
|
|
780
|
+
|
|
762
781
|
// src/index.ts
|
|
763
782
|
function createStorefront(endpoint, stateFactory, config) {
|
|
764
783
|
const configuration = {
|
|
@@ -769,7 +788,7 @@ function createStorefront(endpoint, stateFactory, config) {
|
|
|
769
788
|
configuration,
|
|
770
789
|
new import_storefront_api6.MoonbaseClient(configuration),
|
|
771
790
|
// Default to vue refs but allow stuff like Nuxt useState wrappers
|
|
772
|
-
stateFactory || ((_, state) => (0,
|
|
791
|
+
stateFactory || ((_, state) => (0, import_vue12.ref)(state))
|
|
773
792
|
);
|
|
774
793
|
}
|
|
775
794
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -784,6 +803,7 @@ function createStorefront(endpoint, stateFactory, config) {
|
|
|
784
803
|
useInventory,
|
|
785
804
|
useProduct,
|
|
786
805
|
useProducts,
|
|
806
|
+
useVendor,
|
|
787
807
|
useVoucher,
|
|
788
808
|
...require("@moonbase.sh/storefront-api")
|
|
789
809
|
});
|
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, LineItem } 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';
|
|
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';
|
|
@@ -825,6 +825,12 @@ declare function useAuth(context?: StorefrontContext): {
|
|
|
825
825
|
} | null>;
|
|
826
826
|
};
|
|
827
827
|
|
|
828
|
+
interface VendorComposable {
|
|
829
|
+
vendor: Ref<null | Vendor>;
|
|
830
|
+
loading: Ref<boolean>;
|
|
831
|
+
}
|
|
832
|
+
declare function useVendor(context?: StorefrontContext): VendorComposable;
|
|
833
|
+
|
|
828
834
|
declare const storefrontKey: InjectionKey<StorefrontContext>;
|
|
829
835
|
|
|
830
836
|
interface Cart {
|
|
@@ -833,4 +839,4 @@ interface Cart {
|
|
|
833
839
|
type CartItem = LineItem;
|
|
834
840
|
declare function createStorefront(endpoint: string, stateFactory?: StateFactory, config?: Omit<MoonbaseConfiguration, 'endpoint'>): StorefrontContext;
|
|
835
841
|
|
|
836
|
-
export { type ActivationRequestComposable, type Cart, type CartItem, createStorefront, storefrontKey, useActivationRequest, useAuth, useBundle, useBundles, useCart, useInventory, useProduct, useProducts, useVoucher };
|
|
842
|
+
export { type ActivationRequestComposable, type Cart, type CartItem, type VendorComposable, createStorefront, storefrontKey, useActivationRequest, useAuth, useBundle, useBundles, useCart, useInventory, useProduct, useProducts, useVendor, useVoucher };
|
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, UrchinTrackingModule, MoonbaseClient, CompletedOrder, StorefrontBundle, StorefrontProduct, ActivationMethod, Activation, Download, ActivationRequest, PricingVariation, CommunicationPreferences, LineItem } 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';
|
|
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';
|
|
@@ -825,6 +825,12 @@ declare function useAuth(context?: StorefrontContext): {
|
|
|
825
825
|
} | null>;
|
|
826
826
|
};
|
|
827
827
|
|
|
828
|
+
interface VendorComposable {
|
|
829
|
+
vendor: Ref<null | Vendor>;
|
|
830
|
+
loading: Ref<boolean>;
|
|
831
|
+
}
|
|
832
|
+
declare function useVendor(context?: StorefrontContext): VendorComposable;
|
|
833
|
+
|
|
828
834
|
declare const storefrontKey: InjectionKey<StorefrontContext>;
|
|
829
835
|
|
|
830
836
|
interface Cart {
|
|
@@ -833,4 +839,4 @@ interface Cart {
|
|
|
833
839
|
type CartItem = LineItem;
|
|
834
840
|
declare function createStorefront(endpoint: string, stateFactory?: StateFactory, config?: Omit<MoonbaseConfiguration, 'endpoint'>): StorefrontContext;
|
|
835
841
|
|
|
836
|
-
export { type ActivationRequestComposable, type Cart, type CartItem, createStorefront, storefrontKey, useActivationRequest, useAuth, useBundle, useBundles, useCart, useInventory, useProduct, useProducts, useVoucher };
|
|
842
|
+
export { type ActivationRequestComposable, type Cart, type CartItem, type VendorComposable, createStorefront, storefrontKey, useActivationRequest, useAuth, useBundle, useBundles, useCart, useInventory, useProduct, useProducts, useVendor, useVoucher };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
2
|
import { MoonbaseClient } from "@moonbase.sh/storefront-api";
|
|
3
|
-
import { ref as
|
|
3
|
+
import { ref as ref3 } from "vue";
|
|
4
4
|
|
|
5
5
|
// src/context.ts
|
|
6
6
|
import { v4 as uuidv4 } from "uuid";
|
|
@@ -724,6 +724,24 @@ function useAuth(context) {
|
|
|
724
724
|
};
|
|
725
725
|
}
|
|
726
726
|
|
|
727
|
+
// src/composables/useVendor.ts
|
|
728
|
+
import { inject as inject10, ref as ref2 } from "vue";
|
|
729
|
+
function useVendor(context) {
|
|
730
|
+
const storefront = context != null ? context : inject10(storefrontKey);
|
|
731
|
+
if (!storefront)
|
|
732
|
+
throw new Error("No storefront configured");
|
|
733
|
+
const vendor = ref2(null);
|
|
734
|
+
const loading = ref2(true);
|
|
735
|
+
storefront.client.vendor.get().then((v) => {
|
|
736
|
+
vendor.value = v;
|
|
737
|
+
loading.value = false;
|
|
738
|
+
});
|
|
739
|
+
return {
|
|
740
|
+
vendor,
|
|
741
|
+
loading
|
|
742
|
+
};
|
|
743
|
+
}
|
|
744
|
+
|
|
727
745
|
// src/index.ts
|
|
728
746
|
function createStorefront(endpoint, stateFactory, config) {
|
|
729
747
|
const configuration = {
|
|
@@ -734,7 +752,7 @@ function createStorefront(endpoint, stateFactory, config) {
|
|
|
734
752
|
configuration,
|
|
735
753
|
new MoonbaseClient(configuration),
|
|
736
754
|
// Default to vue refs but allow stuff like Nuxt useState wrappers
|
|
737
|
-
stateFactory || ((_, state) =>
|
|
755
|
+
stateFactory || ((_, state) => ref3(state))
|
|
738
756
|
);
|
|
739
757
|
}
|
|
740
758
|
export {
|
|
@@ -748,5 +766,6 @@ export {
|
|
|
748
766
|
useInventory,
|
|
749
767
|
useProduct,
|
|
750
768
|
useProducts,
|
|
769
|
+
useVendor,
|
|
751
770
|
useVoucher
|
|
752
771
|
};
|
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.83",
|
|
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.83"
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
25
|
"@types/uuid": "^9.0.8",
|