@propeller-commerce/propeller-v2-vue-ui 0.3.14
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/CHANGELOG.md +549 -0
- package/LICENSE +21 -0
- package/MIGRATION.md +178 -0
- package/README.md +282 -0
- package/STYLING.md +119 -0
- package/dist/ProductVideos.vue_vue_type_script_setup_true_lang-BSXOpWBD.js +1706 -0
- package/dist/ProductVideos.vue_vue_type_script_setup_true_lang-BSXOpWBD.js.map +1 -0
- package/dist/ProductVideos.vue_vue_type_script_setup_true_lang-cfRT3L_k.cjs +1705 -0
- package/dist/ProductVideos.vue_vue_type_script_setup_true_lang-cfRT3L_k.cjs.map +1 -0
- package/dist/__mocks__/decorators.d.ts +17 -0
- package/dist/__mocks__/fixtures.d.ts +43 -0
- package/dist/__mocks__/mockServices.d.ts +7 -0
- package/dist/components/AccountIconAndMenu.vue.d.ts +152 -0
- package/dist/components/ActionCode.vue.d.ts +29 -0
- package/dist/components/AddToCart.vue.d.ts +122 -0
- package/dist/components/AddToFavorite.vue.d.ts +19 -0
- package/dist/components/AddressCard.vue.d.ts +169 -0
- package/dist/components/AddressSelector.vue.d.ts +30 -0
- package/dist/components/Breadcrumbs.vue.d.ts +69 -0
- package/dist/components/CartBonusItems.vue.d.ts +21 -0
- package/dist/components/CartCarriers.vue.d.ts +24 -0
- package/dist/components/CartIconAndSidebar.vue.d.ts +104 -0
- package/dist/components/CartItem.vue.d.ts +178 -0
- package/dist/components/CartOverview.vue.d.ts +41 -0
- package/dist/components/CartPaymethods.vue.d.ts +23 -0
- package/dist/components/CartSummary.vue.d.ts +58 -0
- package/dist/components/CategoryDescription.vue.d.ts +29 -0
- package/dist/components/CategoryShortDescription.vue.d.ts +18 -0
- package/dist/components/ClusterCard.vue.d.ts +251 -0
- package/dist/components/ClusterConfigurator.vue.d.ts +41 -0
- package/dist/components/ClusterInfo.vue.d.ts +73 -0
- package/dist/components/ClusterJsonLd.vue.d.ts +10 -0
- package/dist/components/ClusterOptions.vue.d.ts +44 -0
- package/dist/components/CompanySwitcher.vue.d.ts +18 -0
- package/dist/components/DeliveryDate.vue.d.ts +27 -0
- package/dist/components/FavoriteListDetails.vue.d.ts +94 -0
- package/dist/components/FavoriteListItem.vue.d.ts +141 -0
- package/dist/components/FavoriteLists.vue.d.ts +73 -0
- package/dist/components/ForgotPassword.vue.d.ts +35 -0
- package/dist/components/GridFilters.vue.d.ts +64 -0
- package/dist/components/GridPagination.vue.d.ts +34 -0
- package/dist/components/GridTitle.vue.d.ts +22 -0
- package/dist/components/GridToolbar.vue.d.ts +117 -0
- package/dist/components/ItemListJsonLd.vue.d.ts +10 -0
- package/dist/components/ItemStock.vue.d.ts +31 -0
- package/dist/components/ItemsOverview.vue.d.ts +40 -0
- package/dist/components/LoginForm.vue.d.ts +139 -0
- package/dist/components/Menu.vue.d.ts +73 -0
- package/dist/components/OrderActions.vue.d.ts +25 -0
- package/dist/components/OrderBonusItems.vue.d.ts +19 -0
- package/dist/components/OrderItemCard.vue.d.ts +47 -0
- package/dist/components/OrderList.vue.d.ts +66 -0
- package/dist/components/OrderShipments.vue.d.ts +11 -0
- package/dist/components/OrderSummary.vue.d.ts +49 -0
- package/dist/components/OrderTotals.vue.d.ts +34 -0
- package/dist/components/PriceToggle.vue.d.ts +24 -0
- package/dist/components/ProductBulkPrices.vue.d.ts +35 -0
- package/dist/components/ProductBundles.vue.d.ts +88 -0
- package/dist/components/ProductCard.vue.d.ts +332 -0
- package/dist/components/ProductDescription.vue.d.ts +30 -0
- package/dist/components/ProductDownloads.vue.d.ts +22 -0
- package/dist/components/ProductGallery.vue.d.ts +25 -0
- package/dist/components/ProductGrid.vue.d.ts +290 -0
- package/dist/components/ProductInfo.vue.d.ts +179 -0
- package/dist/components/ProductJsonLd.vue.d.ts +10 -0
- package/dist/components/ProductPrice.vue.d.ts +42 -0
- package/dist/components/ProductShortDescription.vue.d.ts +18 -0
- package/dist/components/ProductSlider.vue.d.ts +176 -0
- package/dist/components/ProductSpecifications.vue.d.ts +37 -0
- package/dist/components/ProductTabs.vue.d.ts +83 -0
- package/dist/components/ProductVideos.vue.d.ts +22 -0
- package/dist/components/PropellerProvider.vue.d.ts +40 -0
- package/dist/components/PurchaseAuthorizationConfigurator.vue.d.ts +44 -0
- package/dist/components/PurchaseAuthorizationRequests.vue.d.ts +50 -0
- package/dist/components/QuoteActions.vue.d.ts +22 -0
- package/dist/components/RegisterForm.vue.d.ts +87 -0
- package/dist/components/SearchBar.vue.d.ts +71 -0
- package/dist/components/UserDetails.vue.d.ts +44 -0
- package/dist/components/defaults/DefaultProductBadges.vue.d.ts +3 -0
- package/dist/components/defaults/DefaultProductImage.vue.d.ts +3 -0
- package/dist/components/defaults/DefaultProductSurcharges.vue.d.ts +3 -0
- package/dist/composables/shared/usePagination.d.ts +19 -0
- package/dist/composables/shared/useServiceFetch.d.ts +9 -0
- package/dist/composables/shared/useUserIdentity.d.ts +13 -0
- package/dist/composables/shared/utils/cartInit.d.ts +18 -0
- package/dist/composables/shared/utils/fetchActiveCart.d.ts +10 -0
- package/dist/composables/shared/utils/mergeAnonymousCart.d.ts +12 -0
- package/dist/composables/vue/useAddress.d.ts +50 -0
- package/dist/composables/vue/useAuth.d.ts +80 -0
- package/dist/composables/vue/useCart.d.ts +64 -0
- package/dist/composables/vue/useCheckout.d.ts +41 -0
- package/dist/composables/vue/useClusterConfigurator.d.ts +26 -0
- package/dist/composables/vue/useCompany.d.ts +31 -0
- package/dist/composables/vue/useFavorites.d.ts +39 -0
- package/dist/composables/vue/useInfraProps.d.ts +27 -0
- package/dist/composables/vue/useMenu.d.ts +24 -0
- package/dist/composables/vue/useOrders.d.ts +64 -0
- package/dist/composables/vue/useProductBundles.d.ts +37 -0
- package/dist/composables/vue/useProductInfo.d.ts +33 -0
- package/dist/composables/vue/useProductSearch.d.ts +49 -0
- package/dist/composables/vue/useProductSlider.d.ts +31 -0
- package/dist/composables/vue/useProductSpecs.d.ts +24 -0
- package/dist/composables/vue/usePurchaseAuthorization.d.ts +102 -0
- package/dist/composables/vue/useResolvedProps.d.ts +42 -0
- package/dist/composables/vue/useServices.d.ts +13 -0
- package/dist/context/ProductGridContext.d.ts +59 -0
- package/dist/context/PropellerContext.d.ts +51 -0
- package/dist/index-BN8nyGRL.js +518 -0
- package/dist/index-BN8nyGRL.js.map +1 -0
- package/dist/index-CrrZsxTR.cjs +517 -0
- package/dist/index-CrrZsxTR.cjs.map +1 -0
- package/dist/index.cjs +20086 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +109 -0
- package/dist/index.js +20088 -0
- package/dist/index.js.map +1 -0
- package/dist/plugin.d.ts +67 -0
- package/dist/pure.cjs +16 -0
- package/dist/pure.cjs.map +1 -0
- package/dist/pure.d.ts +37 -0
- package/dist/pure.js +16 -0
- package/dist/pure.js.map +1 -0
- package/dist/shared.cjs +50 -0
- package/dist/shared.cjs.map +1 -0
- package/dist/shared.d.ts +14 -0
- package/dist/shared.js +50 -0
- package/dist/shared.js.map +1 -0
- package/dist/styles.css +2 -0
- package/package.json +91 -0
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Contact, Customer, Company } from '@propeller-commerce/propeller-sdk-v2';
|
|
2
|
+
export interface UserDetailsProps {
|
|
3
|
+
/** The currently logged in user (Contact or Customer). Resolved from `<PropellerProvider>` when omitted. */
|
|
4
|
+
user?: Contact | Customer;
|
|
5
|
+
/**
|
|
6
|
+
* The currently active company
|
|
7
|
+
*/
|
|
8
|
+
activeCompany: Company | null;
|
|
9
|
+
/**
|
|
10
|
+
* Display basic company information for the default company if the user is Contact
|
|
11
|
+
* @default true
|
|
12
|
+
*/
|
|
13
|
+
showCompanyInfo?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Display a list of all companies if the user is Contact
|
|
16
|
+
* @default false
|
|
17
|
+
*/
|
|
18
|
+
listAllContactCompanies?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Display details of the user's default invoice address
|
|
21
|
+
* @default true
|
|
22
|
+
*/
|
|
23
|
+
showDefaultInvoiceAddress?: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Display details of the user's default delivery address
|
|
26
|
+
* @default false
|
|
27
|
+
*/
|
|
28
|
+
showDefaultDeliveryAddress?: boolean;
|
|
29
|
+
/** Country code-to-name mapping for address display */
|
|
30
|
+
countries?: {
|
|
31
|
+
code: string;
|
|
32
|
+
name: string;
|
|
33
|
+
}[];
|
|
34
|
+
/** Translated labels keyed by the slugs used inside the component (see
|
|
35
|
+
* `getLabel` calls). Missing keys fall back to the English defaults. */
|
|
36
|
+
labels?: Record<string, string>;
|
|
37
|
+
}
|
|
38
|
+
declare const _default: import('vue').DefineComponent<UserDetailsProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<UserDetailsProps> & Readonly<{}>, {
|
|
39
|
+
showCompanyInfo: boolean;
|
|
40
|
+
listAllContactCompanies: boolean;
|
|
41
|
+
showDefaultInvoiceAddress: boolean;
|
|
42
|
+
showDefaultDeliveryAddress: boolean;
|
|
43
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, HTMLDivElement>;
|
|
44
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { BadgesComponentProps } from '@propeller-commerce/propeller-v2-core-ui';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<BadgesComponentProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<BadgesComponentProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ImageComponentProps } from '@propeller-commerce/propeller-v2-core-ui';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<ImageComponentProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ImageComponentProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { ProductSurchargesComponentProps } from '@propeller-commerce/propeller-v2-core-ui';
|
|
2
|
+
declare const _default: import('vue').DefineComponent<ProductSurchargesComponentProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {}, string, import('vue').PublicProps, Readonly<ProductSurchargesComponentProps> & Readonly<{}>, {}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
3
|
+
export default _default;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
export interface PaginationState {
|
|
3
|
+
currentPage: Ref<number>;
|
|
4
|
+
totalPages: Ref<number>;
|
|
5
|
+
totalItems: Ref<number>;
|
|
6
|
+
itemsPerPage: Ref<number>;
|
|
7
|
+
hasNextPage: ComputedRef<boolean>;
|
|
8
|
+
hasPreviousPage: ComputedRef<boolean>;
|
|
9
|
+
goToPage: (page: number) => void;
|
|
10
|
+
nextPage: () => void;
|
|
11
|
+
previousPage: () => void;
|
|
12
|
+
setFromResponse: (response: {
|
|
13
|
+
itemsFound?: number;
|
|
14
|
+
pages?: number;
|
|
15
|
+
offset?: number;
|
|
16
|
+
}) => void;
|
|
17
|
+
reset: () => void;
|
|
18
|
+
}
|
|
19
|
+
export declare function usePagination(initialItemsPerPage?: number): PaginationState;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
export interface ServiceFetchState<T> {
|
|
3
|
+
data: Ref<T>;
|
|
4
|
+
loading: Ref<boolean>;
|
|
5
|
+
error: Ref<string | null>;
|
|
6
|
+
execute: (...args: any[]) => Promise<T | undefined>;
|
|
7
|
+
reset: () => void;
|
|
8
|
+
}
|
|
9
|
+
export declare function useServiceFetch<T>(fetchFn: (...args: any[]) => Promise<T>, defaultValue: T): ServiceFetchState<T>;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { Contact, Customer, Address, Company } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
export interface UserIdentity {
|
|
4
|
+
isContact: ComputedRef<boolean>;
|
|
5
|
+
isCustomer: ComputedRef<boolean>;
|
|
6
|
+
userId: ComputedRef<number | null>;
|
|
7
|
+
companyId: ComputedRef<number | null>;
|
|
8
|
+
company: ComputedRef<Company | null>;
|
|
9
|
+
addresses: ComputedRef<Address[]>;
|
|
10
|
+
defaultInvoiceAddress: ComputedRef<Address | undefined>;
|
|
11
|
+
defaultDeliveryAddress: ComputedRef<Address | undefined>;
|
|
12
|
+
}
|
|
13
|
+
export declare function useUserIdentity(user: Ref<Contact | Customer | null>): UserIdentity;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Cart, GraphQLClient, MediaImageProductSearchInput, TransformationsInput } from '@propeller-commerce/propeller-sdk-v2';
|
|
2
|
+
import { AnyUser } from '@propeller-commerce/propeller-v2-core-ui';
|
|
3
|
+
export interface CartInitConfig {
|
|
4
|
+
graphqlClient: GraphQLClient;
|
|
5
|
+
user: AnyUser;
|
|
6
|
+
/** Active company ID — overrides user's default company for cart lookup and creation */
|
|
7
|
+
companyId?: number;
|
|
8
|
+
language?: string;
|
|
9
|
+
imageSearchFilters?: MediaImageProductSearchInput;
|
|
10
|
+
imageVariantFilters?: TransformationsInput;
|
|
11
|
+
onCartCreated?: (cart: Cart) => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Resolves the active cart for the current user.
|
|
15
|
+
* Returns an existing OPEN cart if one exists, otherwise creates and
|
|
16
|
+
* initialises a new cart with default addresses.
|
|
17
|
+
*/
|
|
18
|
+
export declare function initCart(config: CartInitConfig): Promise<Cart>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Cart, Contact, Customer, GraphQLClient, MediaImageProductSearchInput, TransformationsInput } from '@propeller-commerce/propeller-sdk-v2';
|
|
2
|
+
export interface FetchActiveCartConfig {
|
|
3
|
+
graphqlClient: GraphQLClient;
|
|
4
|
+
user: Contact | Customer;
|
|
5
|
+
companyId?: number;
|
|
6
|
+
language: string;
|
|
7
|
+
imageSearchFilters: MediaImageProductSearchInput;
|
|
8
|
+
imageVariantFilters: TransformationsInput;
|
|
9
|
+
}
|
|
10
|
+
export declare function fetchActiveCart(cfg: FetchActiveCartConfig): Promise<Cart | null>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Cart, GraphQLClient, MediaImageProductSearchInput, TransformationsInput } from '@propeller-commerce/propeller-sdk-v2';
|
|
2
|
+
export interface MergeAnonymousCartConfig {
|
|
3
|
+
graphqlClient: GraphQLClient;
|
|
4
|
+
/** The authenticated user's cart that anonymous items will be added to. */
|
|
5
|
+
targetCartId: string;
|
|
6
|
+
/** The anonymous cart from the store/state captured before authentication. */
|
|
7
|
+
anonymousCart: Cart | null;
|
|
8
|
+
language: string;
|
|
9
|
+
imageSearchFilters: MediaImageProductSearchInput;
|
|
10
|
+
imageVariantFilters: TransformationsInput;
|
|
11
|
+
}
|
|
12
|
+
export declare function mergeAnonymousCart(cfg: MergeAnonymousCartConfig): Promise<Cart | null>;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { AddressType, Gender, YesNo, GraphQLClient, Address } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
import { AnyUser } from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
|
+
export interface AddressInput {
|
|
5
|
+
type?: AddressType;
|
|
6
|
+
firstName?: string;
|
|
7
|
+
lastName?: string;
|
|
8
|
+
middleName?: string;
|
|
9
|
+
company?: string;
|
|
10
|
+
street: string;
|
|
11
|
+
number?: string;
|
|
12
|
+
numberExtension?: string;
|
|
13
|
+
postalCode: string;
|
|
14
|
+
city: string;
|
|
15
|
+
country: string;
|
|
16
|
+
email?: string;
|
|
17
|
+
phone?: string;
|
|
18
|
+
mobile?: string;
|
|
19
|
+
gender?: Gender;
|
|
20
|
+
isDefault?: YesNo;
|
|
21
|
+
notes?: string;
|
|
22
|
+
}
|
|
23
|
+
export interface UseAddressOptions {
|
|
24
|
+
graphqlClient: GraphQLClient;
|
|
25
|
+
user: Ref<AnyUser>;
|
|
26
|
+
companyId?: Ref<number | undefined>;
|
|
27
|
+
}
|
|
28
|
+
export interface UseAddressReturn {
|
|
29
|
+
loading: Ref<boolean>;
|
|
30
|
+
error: Ref<string | null>;
|
|
31
|
+
createAddress: (input: AddressInput) => Promise<{
|
|
32
|
+
success: boolean;
|
|
33
|
+
address?: Address;
|
|
34
|
+
error?: string;
|
|
35
|
+
}>;
|
|
36
|
+
updateAddress: (addressId: number, input: Partial<AddressInput>) => Promise<{
|
|
37
|
+
success: boolean;
|
|
38
|
+
address?: Address;
|
|
39
|
+
error?: string;
|
|
40
|
+
}>;
|
|
41
|
+
deleteAddress: (addressId: number) => Promise<{
|
|
42
|
+
success: boolean;
|
|
43
|
+
error?: string;
|
|
44
|
+
}>;
|
|
45
|
+
setDefaultAddress: (addressId: number) => Promise<{
|
|
46
|
+
success: boolean;
|
|
47
|
+
error?: string;
|
|
48
|
+
}>;
|
|
49
|
+
}
|
|
50
|
+
export declare function useAddress(options: UseAddressOptions): UseAddressReturn;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { Gender, GraphQLClient, Contact, Customer } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
import { Result } from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
|
+
/**
|
|
5
|
+
* Success payload for login / registerContact / registerCustomer.
|
|
6
|
+
*
|
|
7
|
+
* `user` + tokens are optional: the `autoLogin: false` branches of the
|
|
8
|
+
* register flows complete server-side but deliberately drop the session,
|
|
9
|
+
* yielding an `ok({})`.
|
|
10
|
+
*/
|
|
11
|
+
export interface AuthSuccess {
|
|
12
|
+
user?: Contact | Customer;
|
|
13
|
+
accessToken?: string;
|
|
14
|
+
refreshToken?: string;
|
|
15
|
+
expiresAt?: string;
|
|
16
|
+
}
|
|
17
|
+
/** Backwards-friendly alias kept for the public `UseAuth*` type re-exports. */
|
|
18
|
+
export type LoginResult = Result<AuthSuccess, string>;
|
|
19
|
+
export interface RegisterContactInput {
|
|
20
|
+
email: string;
|
|
21
|
+
password: string;
|
|
22
|
+
firstName: string;
|
|
23
|
+
middleName?: string;
|
|
24
|
+
lastName: string;
|
|
25
|
+
phone?: string;
|
|
26
|
+
gender?: Gender;
|
|
27
|
+
companyName?: string;
|
|
28
|
+
vatNumber?: string;
|
|
29
|
+
cocNumber?: string;
|
|
30
|
+
street?: string;
|
|
31
|
+
number?: string;
|
|
32
|
+
numberExtension?: string;
|
|
33
|
+
postalCode?: string;
|
|
34
|
+
city?: string;
|
|
35
|
+
country?: string;
|
|
36
|
+
deliveryStreet?: string;
|
|
37
|
+
deliveryNumber?: string;
|
|
38
|
+
deliveryNumberExtension?: string;
|
|
39
|
+
deliveryPostalCode?: string;
|
|
40
|
+
deliveryCity?: string;
|
|
41
|
+
deliveryCountry?: string;
|
|
42
|
+
sameDeliveryAsBilling?: boolean;
|
|
43
|
+
}
|
|
44
|
+
export interface RegisterCustomerInput {
|
|
45
|
+
email: string;
|
|
46
|
+
password: string;
|
|
47
|
+
firstName: string;
|
|
48
|
+
middleName?: string;
|
|
49
|
+
lastName: string;
|
|
50
|
+
phone?: string;
|
|
51
|
+
gender?: Gender;
|
|
52
|
+
street?: string;
|
|
53
|
+
number?: string;
|
|
54
|
+
numberExtension?: string;
|
|
55
|
+
postalCode?: string;
|
|
56
|
+
city?: string;
|
|
57
|
+
country?: string;
|
|
58
|
+
deliveryStreet?: string;
|
|
59
|
+
deliveryNumber?: string;
|
|
60
|
+
deliveryNumberExtension?: string;
|
|
61
|
+
deliveryPostalCode?: string;
|
|
62
|
+
deliveryCity?: string;
|
|
63
|
+
deliveryCountry?: string;
|
|
64
|
+
sameDeliveryAsBilling?: boolean;
|
|
65
|
+
}
|
|
66
|
+
export interface UseAuthOptions {
|
|
67
|
+
graphqlClient: GraphQLClient;
|
|
68
|
+
language?: string;
|
|
69
|
+
onAuthHeaderUpdate?: (token: string) => void;
|
|
70
|
+
configuration?: any;
|
|
71
|
+
}
|
|
72
|
+
export interface UseAuthReturn {
|
|
73
|
+
loading: Ref<boolean>;
|
|
74
|
+
error: Ref<string | null>;
|
|
75
|
+
login: (email: string, password: string, onLoginSubmit?: (email: string, password: string) => Promise<Contact | Customer>) => Promise<Result<AuthSuccess, string>>;
|
|
76
|
+
registerContact: (input: RegisterContactInput, preferredLanguage?: string, autoLogin?: boolean) => Promise<Result<AuthSuccess, string>>;
|
|
77
|
+
registerCustomer: (input: RegisterCustomerInput, preferredLanguage?: string, autoLogin?: boolean) => Promise<Result<AuthSuccess, string>>;
|
|
78
|
+
forgotPassword: (email: string) => Promise<Result<void, string>>;
|
|
79
|
+
}
|
|
80
|
+
export declare function useAuth(options: UseAuthOptions): UseAuthReturn;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { GraphQLClient, Cart, CartMainItem, Product, Cluster, MediaImageProductSearchInput, TransformationsInput, Crossupsell, CartProcessResponse } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
import { AnyUser, Result } from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
|
+
export interface UseCartOptions {
|
|
5
|
+
graphqlClient: GraphQLClient;
|
|
6
|
+
user: Ref<AnyUser>;
|
|
7
|
+
/** Initial cart id. Accepts a plain string or a (computed) ref. */
|
|
8
|
+
cartId?: string | Ref<string | undefined>;
|
|
9
|
+
companyId?: Ref<number | undefined>;
|
|
10
|
+
language?: Ref<string>;
|
|
11
|
+
configuration: {
|
|
12
|
+
language?: string;
|
|
13
|
+
imageSearchFiltersGrid: MediaImageProductSearchInput;
|
|
14
|
+
imageVariantFiltersSmall: TransformationsInput;
|
|
15
|
+
};
|
|
16
|
+
onCartCreated?: (cart: Cart) => void;
|
|
17
|
+
}
|
|
18
|
+
export interface AddItemOptions {
|
|
19
|
+
product: Product;
|
|
20
|
+
cluster?: Cluster;
|
|
21
|
+
childItems?: number[];
|
|
22
|
+
quantity: number;
|
|
23
|
+
notes?: string;
|
|
24
|
+
price?: number;
|
|
25
|
+
onAddToCart?: (product: Product, clusterId?: number, quantity?: number, childItems?: {
|
|
26
|
+
productId: number;
|
|
27
|
+
quantity: number;
|
|
28
|
+
}[], notes?: string, price?: number) => Cart;
|
|
29
|
+
afterAddToCart?: (cart: Cart, item: CartMainItem | null) => void;
|
|
30
|
+
enableStockValidation?: boolean;
|
|
31
|
+
cartId?: string;
|
|
32
|
+
createCart?: boolean;
|
|
33
|
+
}
|
|
34
|
+
export interface GetCrossupsellsOptions {
|
|
35
|
+
productId?: number;
|
|
36
|
+
clusterId?: number;
|
|
37
|
+
types?: string[];
|
|
38
|
+
taxZone?: string;
|
|
39
|
+
imageVariantFilters?: TransformationsInput;
|
|
40
|
+
}
|
|
41
|
+
export interface UseCartReturn {
|
|
42
|
+
cart: Ref<Cart | null>;
|
|
43
|
+
cartId: Ref<string>;
|
|
44
|
+
loading: Ref<boolean>;
|
|
45
|
+
error: Ref<string | null>;
|
|
46
|
+
checkoutAllowed: ComputedRef<boolean>;
|
|
47
|
+
resolveCart: () => Promise<Cart>;
|
|
48
|
+
fetchActiveCart: () => Promise<Cart | null>;
|
|
49
|
+
addItem: (options: AddItemOptions) => Promise<Result<{
|
|
50
|
+
cart: Cart;
|
|
51
|
+
item: CartMainItem | null;
|
|
52
|
+
}, string>>;
|
|
53
|
+
updateItemQuantity: (cartItemId: string, quantity: number) => Promise<Cart | undefined>;
|
|
54
|
+
updateItemNotes: (cartItemId: string, notes: string, debounceMs?: number) => void;
|
|
55
|
+
deleteItem: (cartItemId: string) => Promise<Cart | undefined>;
|
|
56
|
+
addActionCode: (code: string) => Promise<Cart | undefined>;
|
|
57
|
+
removeActionCode: (code: string) => Promise<Cart | undefined>;
|
|
58
|
+
requestAuthorization: () => Promise<Result<void, string>>;
|
|
59
|
+
processCart: (orderStatus?: string) => Promise<Result<CartProcessResponse, string>>;
|
|
60
|
+
getCrossupsells: (options: GetCrossupsellsOptions) => Promise<Crossupsell[]>;
|
|
61
|
+
getMinQuantity: (product: Product | null | undefined) => number;
|
|
62
|
+
getStep: (product: Product | null | undefined) => number;
|
|
63
|
+
}
|
|
64
|
+
export declare function useCart(options: UseCartOptions): UseCartReturn;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { GraphQLClient, Cart, CartUpdateAddressInput, MediaImageProductSearchInput, TransformationsInput, Address } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
import { AnyUser, Result } from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
|
+
export interface UseCheckoutOptions {
|
|
5
|
+
graphqlClient: GraphQLClient;
|
|
6
|
+
user: Ref<AnyUser>;
|
|
7
|
+
companyId?: Ref<number | undefined>;
|
|
8
|
+
language?: Ref<string>;
|
|
9
|
+
configuration: {
|
|
10
|
+
imageSearchFiltersGrid: MediaImageProductSearchInput;
|
|
11
|
+
imageVariantFiltersSmall: TransformationsInput;
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
export interface CartSettingsInput {
|
|
15
|
+
paymentMethod?: string;
|
|
16
|
+
carrier?: string;
|
|
17
|
+
requestDate?: string;
|
|
18
|
+
reference?: string;
|
|
19
|
+
notes?: string;
|
|
20
|
+
}
|
|
21
|
+
export interface PlaceOrderOptions {
|
|
22
|
+
isQuoteMode?: boolean;
|
|
23
|
+
reference?: string;
|
|
24
|
+
notes?: string;
|
|
25
|
+
}
|
|
26
|
+
/** Backwards-friendly alias kept for the public `UseCheckout*` type re-exports. */
|
|
27
|
+
export type PlaceOrderResult = Result<{
|
|
28
|
+
orderId: number;
|
|
29
|
+
}, string>;
|
|
30
|
+
export interface UseCheckoutReturn {
|
|
31
|
+
loading: Ref<boolean>;
|
|
32
|
+
error: Ref<string | null>;
|
|
33
|
+
updateCartAddress: (cartId: string, type: 'INVOICE' | 'DELIVERY', address: any) => Promise<Cart | null>;
|
|
34
|
+
updateCartSettings: (cartId: string, input: CartSettingsInput) => Promise<Cart | null>;
|
|
35
|
+
placeOrder: (cartId: string, options?: PlaceOrderOptions) => Promise<Result<{
|
|
36
|
+
orderId: number;
|
|
37
|
+
}, string>>;
|
|
38
|
+
getUserDefaultAddress: (type: 'invoice' | 'delivery') => Address | undefined;
|
|
39
|
+
buildAddressInput: (type: 'INVOICE' | 'DELIVERY', addr: any) => CartUpdateAddressInput;
|
|
40
|
+
}
|
|
41
|
+
export declare function useCheckout(options: UseCheckoutOptions): UseCheckoutReturn;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { Product, ClusterConfig } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
export interface ConfiguredSetting {
|
|
4
|
+
id: number;
|
|
5
|
+
name: string;
|
|
6
|
+
displayType: string;
|
|
7
|
+
priority: string;
|
|
8
|
+
displayName: string;
|
|
9
|
+
availableValues: string[];
|
|
10
|
+
selectedValue: string;
|
|
11
|
+
disabled: boolean;
|
|
12
|
+
}
|
|
13
|
+
export interface UseClusterConfiguratorOptions {
|
|
14
|
+
products: Ref<Product[]>;
|
|
15
|
+
config: Ref<ClusterConfig>;
|
|
16
|
+
language?: Ref<string>;
|
|
17
|
+
onConfigurationChange?: (product: Product) => void;
|
|
18
|
+
}
|
|
19
|
+
export interface UseClusterConfiguratorReturn {
|
|
20
|
+
selectedAttributes: Ref<Record<string, string>>;
|
|
21
|
+
settingsWithValues: ComputedRef<ConfiguredSetting[]>;
|
|
22
|
+
handleAttributeSelect: (settingName: string, value: string) => void;
|
|
23
|
+
initFromProduct: (product: Product) => void;
|
|
24
|
+
reset: () => void;
|
|
25
|
+
}
|
|
26
|
+
export declare function useClusterConfigurator(options: UseClusterConfiguratorOptions): UseClusterConfiguratorReturn;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { GraphQLClient, Company, Cart, CompanyVariables, PurchaseAuthorizationConfigCreateInput, PurchaseAuthorizationConfigUpdateInput } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
export interface UseCompanyOptions {
|
|
4
|
+
graphqlClient: GraphQLClient;
|
|
5
|
+
language?: Ref<string>;
|
|
6
|
+
}
|
|
7
|
+
export interface UseCompanyReturn {
|
|
8
|
+
company: Ref<Company | null>;
|
|
9
|
+
pendingCarts: Ref<Cart[]>;
|
|
10
|
+
loading: Ref<boolean>;
|
|
11
|
+
error: Ref<string | null>;
|
|
12
|
+
fetchCompany: (companyId: number, overrides?: Partial<Omit<CompanyVariables, 'id'>>) => Promise<void>;
|
|
13
|
+
fetchPendingCarts: (companyId: number) => Promise<void>;
|
|
14
|
+
createPac: (input: PurchaseAuthorizationConfigCreateInput) => Promise<{
|
|
15
|
+
success: boolean;
|
|
16
|
+
error?: string;
|
|
17
|
+
}>;
|
|
18
|
+
updatePac: (pacId: string, input: PurchaseAuthorizationConfigUpdateInput) => Promise<{
|
|
19
|
+
success: boolean;
|
|
20
|
+
error?: string;
|
|
21
|
+
}>;
|
|
22
|
+
deletePac: (pacId: string) => Promise<{
|
|
23
|
+
success: boolean;
|
|
24
|
+
error?: string;
|
|
25
|
+
}>;
|
|
26
|
+
acceptCartRequest: (cartId: string) => Promise<{
|
|
27
|
+
success: boolean;
|
|
28
|
+
error?: string;
|
|
29
|
+
}>;
|
|
30
|
+
}
|
|
31
|
+
export declare function useCompany(options: UseCompanyOptions): UseCompanyReturn;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { GraphQLClient, FavoriteList } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
import { AnyUser } from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
|
+
export interface FavoriteListFormData {
|
|
5
|
+
name: string;
|
|
6
|
+
isDefault: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface UseFavoritesOptions {
|
|
9
|
+
graphqlClient: GraphQLClient;
|
|
10
|
+
user: Ref<AnyUser>;
|
|
11
|
+
language?: Ref<string>;
|
|
12
|
+
onCreate?: (data: FavoriteListFormData) => void;
|
|
13
|
+
onEdit?: (id: string, data: FavoriteListFormData) => void;
|
|
14
|
+
onDelete?: (id: string) => void;
|
|
15
|
+
onListChanged?: () => void;
|
|
16
|
+
}
|
|
17
|
+
export interface UseFavoritesReturn {
|
|
18
|
+
lists: Ref<FavoriteList[]>;
|
|
19
|
+
loading: Ref<boolean>;
|
|
20
|
+
saving: Ref<boolean>;
|
|
21
|
+
error: Ref<string | null>;
|
|
22
|
+
editingListId: Ref<string | null>;
|
|
23
|
+
editListName: Ref<string>;
|
|
24
|
+
editSetAsDefault: Ref<boolean>;
|
|
25
|
+
newListName: Ref<string>;
|
|
26
|
+
newSetAsDefault: Ref<boolean>;
|
|
27
|
+
listToDelete: Ref<FavoriteList | null>;
|
|
28
|
+
fetchLists: () => void;
|
|
29
|
+
startEdit: (list: FavoriteList) => void;
|
|
30
|
+
cancelEdit: () => void;
|
|
31
|
+
updateList: (listId: string) => Promise<void>;
|
|
32
|
+
confirmDelete: (list: FavoriteList) => void;
|
|
33
|
+
deleteList: () => Promise<void>;
|
|
34
|
+
createList: (name: string, isDefault: boolean) => Promise<void>;
|
|
35
|
+
addToList: (listId: string, productId?: number, clusterId?: number) => Promise<void>;
|
|
36
|
+
removeFromList: (listId: string, productId?: number | number[], clusterId?: number | number[]) => Promise<void>;
|
|
37
|
+
isProductInList: (listId: string, productId: number) => ComputedRef<boolean>;
|
|
38
|
+
}
|
|
39
|
+
export declare function useFavorites(options: UseFavoritesOptions): UseFavoritesReturn;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { PropellerInfra } from '../../context/PropellerContext';
|
|
2
|
+
type InfraKey = keyof PropellerInfra;
|
|
3
|
+
/**
|
|
4
|
+
* Resolves the Tier 1 (deps) + Tier 2 (scope) infrastructure props for a
|
|
5
|
+
* component.
|
|
6
|
+
*
|
|
7
|
+
* Precedence: an explicit prop value (defined and non-null) always wins —
|
|
8
|
+
* existing call sites keep working unchanged. Otherwise the value is taken
|
|
9
|
+
* from the composite of plugin deps and `<PropellerProvider>` scope. Non-infra
|
|
10
|
+
* props pass through untouched.
|
|
11
|
+
*
|
|
12
|
+
* Null-context safe: with no plugin or no provider the props are returned
|
|
13
|
+
* as-is, so components still work standalone / in tests.
|
|
14
|
+
*
|
|
15
|
+
* MUST be called from `setup()` — Vue's `inject()` only works there. Calling
|
|
16
|
+
* this lazily from inside a `computed` getter, an effect, or a click handler
|
|
17
|
+
* yields `null` for the provider context (and a console warning), which is
|
|
18
|
+
* what the previous "wrap in computed" pattern caused for any prop that hadn't
|
|
19
|
+
* been read synchronously during setup.
|
|
20
|
+
*
|
|
21
|
+
* The returned object is a `reactive` proxy whose infra-key reads always
|
|
22
|
+
* reflect (explicit prop OR provider snapshot OR undefined). Non-infra props
|
|
23
|
+
* pass through unchanged via getter forwarding, so consumers can iterate or
|
|
24
|
+
* destructure it as they would a plain object.
|
|
25
|
+
*/
|
|
26
|
+
export declare function useInfraProps<P extends Partial<Record<InfraKey, unknown>>>(props: P): P & Partial<PropellerInfra>;
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { GraphQLClient } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
export interface MenuCategory {
|
|
4
|
+
categoryId: number;
|
|
5
|
+
name: string;
|
|
6
|
+
slug: string;
|
|
7
|
+
children: MenuCategory[];
|
|
8
|
+
}
|
|
9
|
+
export interface UseMenuOptions {
|
|
10
|
+
graphqlClient: GraphQLClient;
|
|
11
|
+
language?: Ref<string>;
|
|
12
|
+
/** Nesting depth for the category tree. Default: 3. */
|
|
13
|
+
depth?: number;
|
|
14
|
+
/** Cache TTL in milliseconds. Default: 12h. */
|
|
15
|
+
cacheTtlMs?: number;
|
|
16
|
+
}
|
|
17
|
+
export interface UseMenuReturn {
|
|
18
|
+
categories: Ref<MenuCategory[]>;
|
|
19
|
+
loading: Ref<boolean>;
|
|
20
|
+
error: Ref<string | null>;
|
|
21
|
+
fetchMenu: (rootCategoryId: number, userKey?: string) => Promise<void>;
|
|
22
|
+
clearCache: (rootCategoryId: number, language: string, userKey?: string) => void;
|
|
23
|
+
}
|
|
24
|
+
export declare function useMenu(options: UseMenuOptions): UseMenuReturn;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { OrderSearchFields, OrderType, GraphQLClient, Order, Cart, DateSearchInput, DecimalSearchInput, OrderSortInput, MediaImageProductSearchInput, TransformationsInput } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
import { AnyUser } from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
|
+
export interface OrderSearchForm {
|
|
5
|
+
term?: string;
|
|
6
|
+
createdAt?: DateSearchInput;
|
|
7
|
+
lastModifiedAt?: DateSearchInput;
|
|
8
|
+
price?: DecimalSearchInput;
|
|
9
|
+
sortInput?: Partial<OrderSortInput>;
|
|
10
|
+
type?: OrderType;
|
|
11
|
+
}
|
|
12
|
+
export interface UseOrdersOptions {
|
|
13
|
+
graphqlClient: GraphQLClient;
|
|
14
|
+
user: Ref<AnyUser>;
|
|
15
|
+
companyId?: Ref<number | undefined>;
|
|
16
|
+
language?: Ref<string>;
|
|
17
|
+
itemsPerPage?: number;
|
|
18
|
+
/** Default statuses to filter by */
|
|
19
|
+
orderStatuses?: string[];
|
|
20
|
+
termFields?: OrderSearchFields[];
|
|
21
|
+
configuration?: {
|
|
22
|
+
imageSearchFiltersGrid?: MediaImageProductSearchInput;
|
|
23
|
+
imageVariantFiltersSmall?: TransformationsInput;
|
|
24
|
+
};
|
|
25
|
+
channelIds?: number[];
|
|
26
|
+
onCartCreated?: (cart: Cart) => void;
|
|
27
|
+
afterReorder?: (cart: Cart) => void;
|
|
28
|
+
}
|
|
29
|
+
export interface UseOrdersReturn {
|
|
30
|
+
orders: Ref<Order[]>;
|
|
31
|
+
loading: Ref<boolean>;
|
|
32
|
+
error: Ref<string | null>;
|
|
33
|
+
searchForm: Ref<OrderSearchForm>;
|
|
34
|
+
currentOrder: Ref<Order | null>;
|
|
35
|
+
orderLoading: Ref<boolean>;
|
|
36
|
+
currentPage: Ref<number>;
|
|
37
|
+
totalPages: Ref<number>;
|
|
38
|
+
totalItems: Ref<number>;
|
|
39
|
+
itemsPerPage: Ref<number>;
|
|
40
|
+
fetchOrders: (page?: number) => Promise<void>;
|
|
41
|
+
fetchOrder: (orderId: number) => Promise<Order | null>;
|
|
42
|
+
goToPage: (page: number) => void;
|
|
43
|
+
resetSearch: () => void;
|
|
44
|
+
downloadPdf: (order: Order) => Promise<{
|
|
45
|
+
success: boolean;
|
|
46
|
+
error?: string;
|
|
47
|
+
}>;
|
|
48
|
+
downloadQuotePdf: (quoteId: number) => Promise<{
|
|
49
|
+
success: boolean;
|
|
50
|
+
error?: string;
|
|
51
|
+
}>;
|
|
52
|
+
reorder: (order: Order, cartId?: string) => Promise<{
|
|
53
|
+
success: boolean;
|
|
54
|
+
cart?: Cart;
|
|
55
|
+
error?: string;
|
|
56
|
+
}>;
|
|
57
|
+
setQuoteStatus: (orderId: number, flags: {
|
|
58
|
+
status?: string;
|
|
59
|
+
}) => Promise<{
|
|
60
|
+
success: boolean;
|
|
61
|
+
error?: string;
|
|
62
|
+
}>;
|
|
63
|
+
}
|
|
64
|
+
export declare function useOrders(options: UseOrdersOptions): UseOrdersReturn;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { GraphQLClient, Cart, Bundle, MediaImageProductSearchInput, TransformationsInput } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
import { AnyUser } from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
|
+
export interface UseProductBundlesOptions {
|
|
5
|
+
graphqlClient: GraphQLClient;
|
|
6
|
+
user: Ref<AnyUser>;
|
|
7
|
+
companyId?: Ref<number | undefined>;
|
|
8
|
+
language?: Ref<string>;
|
|
9
|
+
configuration: {
|
|
10
|
+
language?: string;
|
|
11
|
+
imageSearchFiltersGrid: MediaImageProductSearchInput;
|
|
12
|
+
imageVariantFiltersSmall: TransformationsInput;
|
|
13
|
+
};
|
|
14
|
+
onCartCreated?: (cart: Cart) => void;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* A bundle as the component consumes it. `BundleService.getBundles`
|
|
18
|
+
* returns `BundlesResponse` whose `items` are SDK `Bundle` objects
|
|
19
|
+
* (`id`, `name`, `description`, `condition`, `price`, `items`), so this
|
|
20
|
+
* is an alias of the SDK type.
|
|
21
|
+
*/
|
|
22
|
+
export type BundleItem = Bundle;
|
|
23
|
+
export interface UseProductBundlesReturn {
|
|
24
|
+
bundles: Ref<BundleItem[]>;
|
|
25
|
+
loading: Ref<boolean>;
|
|
26
|
+
adding: Ref<boolean>;
|
|
27
|
+
error: Ref<string | null>;
|
|
28
|
+
cartId: Ref<string>;
|
|
29
|
+
fetchBundles: (productId: number) => Promise<void>;
|
|
30
|
+
addBundleToCart: (bundleId: string, existingCartId?: string) => Promise<{
|
|
31
|
+
success: boolean;
|
|
32
|
+
cart?: Cart;
|
|
33
|
+
error?: string;
|
|
34
|
+
}>;
|
|
35
|
+
calcDiscountPercent: (original: number, discounted: number) => number;
|
|
36
|
+
}
|
|
37
|
+
export declare function useProductBundles(options: UseProductBundlesOptions): UseProductBundlesReturn;
|