@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,33 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { GraphQLClient, Product, Cluster, Contact, Customer, MediaImageProductSearchInput, TransformationsInput } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
export interface UseProductInfoOptions {
|
|
4
|
+
graphqlClient: GraphQLClient;
|
|
5
|
+
language?: Ref<string>;
|
|
6
|
+
taxZone?: string;
|
|
7
|
+
user?: Ref<Contact | Customer | null>;
|
|
8
|
+
companyId?: Ref<number | undefined>;
|
|
9
|
+
/** Attribute names to include in attributeResultSearchInput (productTrackAttributes). */
|
|
10
|
+
productTrackAttributes?: string[];
|
|
11
|
+
configuration?: {
|
|
12
|
+
imageSearchFiltersGrid?: MediaImageProductSearchInput;
|
|
13
|
+
/** Used for products (ProductInfo). */
|
|
14
|
+
imageVariantFiltersLarge?: TransformationsInput;
|
|
15
|
+
/** Used for clusters (ClusterInfo). */
|
|
16
|
+
imageVariantFiltersMedium?: TransformationsInput;
|
|
17
|
+
/** Alias: some configs use imageVariantFiltersSmall for product images. */
|
|
18
|
+
imageVariantFiltersSmall?: TransformationsInput;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
export interface UseProductInfoReturn {
|
|
22
|
+
product: Ref<Product | null>;
|
|
23
|
+
cluster: Ref<Cluster | null>;
|
|
24
|
+
loading: Ref<boolean>;
|
|
25
|
+
error: Ref<string | null>;
|
|
26
|
+
fetchProduct: (productId: number, imageSearchFilters?: MediaImageProductSearchInput, imageVariantFilters?: TransformationsInput) => Promise<void>;
|
|
27
|
+
fetchCluster: (clusterId: number, imageSearchFilters?: MediaImageProductSearchInput, imageVariantFilters?: TransformationsInput) => Promise<void>;
|
|
28
|
+
clusterName: ComputedRef<string>;
|
|
29
|
+
clusterSku: ComputedRef<string>;
|
|
30
|
+
clusterPrice: ComputedRef<number | null>;
|
|
31
|
+
clusterImageUrl: ComputedRef<string>;
|
|
32
|
+
}
|
|
33
|
+
export declare function useProductInfo(options: UseProductInfoOptions): UseProductInfoReturn;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { GraphQLClient, Product, Cluster, Contact, Customer, ProductsResponse, AttributeFilter, ProductTextFilterInput, Category, MediaImageProductSearchInput, TransformationsInput } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
export interface UseProductSearchOptions {
|
|
4
|
+
graphqlClient?: GraphQLClient;
|
|
5
|
+
/** Controlled mode: pass products in, skip internal fetch */
|
|
6
|
+
products?: Ref<(Product | Cluster)[] | undefined>;
|
|
7
|
+
categoryId?: Ref<number | undefined>;
|
|
8
|
+
term?: Ref<string | undefined>;
|
|
9
|
+
brand?: Ref<string | undefined>;
|
|
10
|
+
language?: Ref<string>;
|
|
11
|
+
taxZone?: string;
|
|
12
|
+
user?: Ref<Contact | Customer | null>;
|
|
13
|
+
companyId?: Ref<number | undefined>;
|
|
14
|
+
textFilters?: Ref<ProductTextFilterInput[] | undefined>;
|
|
15
|
+
priceFilterMin?: Ref<number | undefined>;
|
|
16
|
+
priceFilterMax?: Ref<number | undefined>;
|
|
17
|
+
sortField?: Ref<string | undefined>;
|
|
18
|
+
sortOrder?: Ref<string | undefined>;
|
|
19
|
+
page?: Ref<number | undefined>;
|
|
20
|
+
pageSize?: Ref<number>;
|
|
21
|
+
configuration: {
|
|
22
|
+
baseCategoryId?: number;
|
|
23
|
+
imageSearchFiltersGrid?: MediaImageProductSearchInput;
|
|
24
|
+
imageVariantFiltersMedium?: TransformationsInput;
|
|
25
|
+
};
|
|
26
|
+
onFiltersChange?: (filters: AttributeFilter[]) => void;
|
|
27
|
+
onPriceBoundsChange?: (min: number, max: number) => void;
|
|
28
|
+
onItemsFoundChange?: (count: number) => void;
|
|
29
|
+
onPageChange?: (page: number) => void;
|
|
30
|
+
onProductsResponse?: (products: ProductsResponse) => void;
|
|
31
|
+
onCategoryChange?: (category: Category) => void;
|
|
32
|
+
}
|
|
33
|
+
export interface UseProductSearchReturn {
|
|
34
|
+
displayProducts: ComputedRef<(Product | Cluster)[]>;
|
|
35
|
+
itemsFound: Ref<number>;
|
|
36
|
+
isLoading: ComputedRef<boolean>;
|
|
37
|
+
currentSortField: Ref<string>;
|
|
38
|
+
currentSortOrder: Ref<string>;
|
|
39
|
+
currentPage: Ref<number>;
|
|
40
|
+
totalPages: Ref<number>;
|
|
41
|
+
searchTerm: Ref<string>;
|
|
42
|
+
searchResults: Ref<(Product | Cluster)[]>;
|
|
43
|
+
searchItemsFound: Ref<number>;
|
|
44
|
+
searchLoading: Ref<boolean>;
|
|
45
|
+
fetchProducts: () => Promise<void>;
|
|
46
|
+
search: (term: string) => void;
|
|
47
|
+
goToPage: (page: number) => void;
|
|
48
|
+
}
|
|
49
|
+
export declare function useProductSearch(options: UseProductSearchOptions): UseProductSearchReturn;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { CrossupsellType, GraphQLClient, Product, Cluster, Contact, Customer, MediaImageProductSearchInput, TransformationsInput } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
export interface FetchCrossupsellsInput {
|
|
4
|
+
productId?: number;
|
|
5
|
+
clusterId?: number;
|
|
6
|
+
types?: CrossupsellType[];
|
|
7
|
+
}
|
|
8
|
+
export interface UseProductSliderOptions {
|
|
9
|
+
graphqlClient: GraphQLClient;
|
|
10
|
+
language?: Ref<string>;
|
|
11
|
+
taxZone?: string;
|
|
12
|
+
user?: Ref<Contact | Customer | null>;
|
|
13
|
+
companyId?: Ref<number | undefined>;
|
|
14
|
+
configuration?: {
|
|
15
|
+
imageSearchFiltersGrid?: MediaImageProductSearchInput;
|
|
16
|
+
imageVariantFiltersMedium?: TransformationsInput;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export interface UseProductSliderReturn {
|
|
20
|
+
products: Ref<(Product | Cluster)[]>;
|
|
21
|
+
loading: Ref<boolean>;
|
|
22
|
+
error: Ref<string | null>;
|
|
23
|
+
canScrollLeft: Ref<boolean>;
|
|
24
|
+
canScrollRight: Ref<boolean>;
|
|
25
|
+
fetchCrossupsells: (input: FetchCrossupsellsInput) => Promise<void>;
|
|
26
|
+
fetchProducts: (productIds: number[], clusterIds?: number[]) => Promise<void>;
|
|
27
|
+
scrollLeft: (containerEl: HTMLElement, itemWidth?: number) => void;
|
|
28
|
+
scrollRight: (containerEl: HTMLElement, itemWidth?: number) => void;
|
|
29
|
+
onScroll: (containerEl: HTMLElement) => void;
|
|
30
|
+
}
|
|
31
|
+
export declare function useProductSlider(options: UseProductSliderOptions): UseProductSliderReturn;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { GraphQLClient, AttributeResult } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
export interface AttributeGroup {
|
|
4
|
+
name: string;
|
|
5
|
+
attributes: AttributeDisplayItem[];
|
|
6
|
+
}
|
|
7
|
+
export interface AttributeDisplayItem {
|
|
8
|
+
name: string;
|
|
9
|
+
displayName: string;
|
|
10
|
+
values: string[];
|
|
11
|
+
type: string;
|
|
12
|
+
}
|
|
13
|
+
export interface UseProductSpecsOptions {
|
|
14
|
+
graphqlClient: GraphQLClient;
|
|
15
|
+
language?: Ref<string>;
|
|
16
|
+
}
|
|
17
|
+
export interface UseProductSpecsReturn {
|
|
18
|
+
attributes: Ref<AttributeResult[]>;
|
|
19
|
+
groupedAttributes: Ref<AttributeGroup[]>;
|
|
20
|
+
loading: Ref<boolean>;
|
|
21
|
+
error: Ref<string | null>;
|
|
22
|
+
fetchSpecs: (productId: number) => Promise<void>;
|
|
23
|
+
}
|
|
24
|
+
export declare function useProductSpecs(options: UseProductSpecsOptions): UseProductSpecsReturn;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
import { Ref, ComputedRef } from 'vue';
|
|
2
|
+
import { GraphQLClient, Company, Cart, CartMainItem, Contact, Customer, PurchaseAuthorizationConfig, PurchaseAuthorizationConfigCreateInput, RegisterContactInput } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
export interface RowEdit {
|
|
4
|
+
role: string;
|
|
5
|
+
limit: number | undefined;
|
|
6
|
+
dirty: boolean;
|
|
7
|
+
}
|
|
8
|
+
export interface AddContactFormState {
|
|
9
|
+
gender: string;
|
|
10
|
+
email: string;
|
|
11
|
+
firstName: string;
|
|
12
|
+
middleName: string;
|
|
13
|
+
lastName: string;
|
|
14
|
+
phone: string;
|
|
15
|
+
}
|
|
16
|
+
export interface UsePurchaseAuthorizationConfiguratorOptions {
|
|
17
|
+
graphqlClient: GraphQLClient;
|
|
18
|
+
user: Ref<Contact | Customer | null>;
|
|
19
|
+
companyId: Ref<number>;
|
|
20
|
+
/** Rows per page (default 10) */
|
|
21
|
+
pageOffset?: number;
|
|
22
|
+
beforeContactCreate?: (input: RegisterContactInput) => void;
|
|
23
|
+
onContactCreate?: (input: RegisterContactInput) => void;
|
|
24
|
+
afterContactCreate?: (contact: Contact) => void;
|
|
25
|
+
onPurchaseAuthorizationCreate?: (pac: PurchaseAuthorizationConfigCreateInput) => void;
|
|
26
|
+
afterPurchaseAuthorizationCreate?: (pac: PurchaseAuthorizationConfig) => void;
|
|
27
|
+
onPurchaseAuthorizationUpdate?: (pac: PurchaseAuthorizationConfig) => void;
|
|
28
|
+
afterPurchaseAuthorizationUpdate?: (pac: PurchaseAuthorizationConfig) => void;
|
|
29
|
+
onPurchaseAuthorizationDelete?: (pac: PurchaseAuthorizationConfig) => void;
|
|
30
|
+
afterPurchaseAuthorizationDelete?: (deleted: boolean) => void;
|
|
31
|
+
}
|
|
32
|
+
export interface UsePurchaseAuthorizationConfiguratorReturn {
|
|
33
|
+
company: Ref<Company | null>;
|
|
34
|
+
loading: Ref<boolean>;
|
|
35
|
+
contacts: ComputedRef<Contact[]>;
|
|
36
|
+
totalPages: ComputedRef<number>;
|
|
37
|
+
currentPage: Ref<number>;
|
|
38
|
+
isAuthManager: ComputedRef<boolean>;
|
|
39
|
+
rowEdits: Ref<Record<number, RowEdit>>;
|
|
40
|
+
pacMap: Ref<Record<number, PurchaseAuthorizationConfig>>;
|
|
41
|
+
actionLoading: Ref<Record<number, boolean>>;
|
|
42
|
+
showAddContactModal: Ref<boolean>;
|
|
43
|
+
addContactForm: Ref<AddContactFormState>;
|
|
44
|
+
addContactLoading: Ref<boolean>;
|
|
45
|
+
addContactError: Ref<string>;
|
|
46
|
+
hasPac: (contactId: number) => boolean;
|
|
47
|
+
isCurrentUser: (contactId: number) => boolean;
|
|
48
|
+
isRowDirty: (contactId: number) => boolean;
|
|
49
|
+
getRowRole: (contactId: number) => string;
|
|
50
|
+
getRowLimit: (contactId: number) => number | undefined;
|
|
51
|
+
isRowLoading: (contactId: number) => boolean;
|
|
52
|
+
loadCompany: (page: number) => Promise<void>;
|
|
53
|
+
handleRoleChange: (contactId: number, role: string) => void;
|
|
54
|
+
handleLimitChange: (contactId: number, value: string) => void;
|
|
55
|
+
handleCreate: (contactId: number) => Promise<void>;
|
|
56
|
+
handleSave: (contactId: number) => Promise<void>;
|
|
57
|
+
handleDelete: (contactId: number) => Promise<void>;
|
|
58
|
+
handlePageChange: (page: number) => void;
|
|
59
|
+
openAddContactModal: () => void;
|
|
60
|
+
closeAddContactModal: () => void;
|
|
61
|
+
handleAddContactSubmit: () => Promise<void>;
|
|
62
|
+
}
|
|
63
|
+
export declare function usePurchaseAuthorizationConfigurator(options: UsePurchaseAuthorizationConfiguratorOptions): UsePurchaseAuthorizationConfiguratorReturn;
|
|
64
|
+
export interface UsePurchaseAuthorizationRequestsOptions {
|
|
65
|
+
graphqlClient: GraphQLClient;
|
|
66
|
+
user: Ref<Contact | Customer | null>;
|
|
67
|
+
companyId: Ref<number>;
|
|
68
|
+
configuration?: {
|
|
69
|
+
language?: string;
|
|
70
|
+
imageSearchFiltersGrid?: any;
|
|
71
|
+
imageVariantFiltersSmall?: any;
|
|
72
|
+
};
|
|
73
|
+
onAcceptRequest?: (cartId: string) => void;
|
|
74
|
+
afterAcceptRequest?: (cart: Cart) => void;
|
|
75
|
+
/**
|
|
76
|
+
* Called BEFORE deleting; receives the cart id. Lets the host short-circuit
|
|
77
|
+
* the SDK call and run its own deletion logic, following the same pattern as
|
|
78
|
+
* onAcceptRequest.
|
|
79
|
+
*/
|
|
80
|
+
onDeleteRequest?: (cartId: string) => void;
|
|
81
|
+
/** Called AFTER a successful delete. Receives the deleted cart's id. */
|
|
82
|
+
afterDeleteRequest?: (cartId: string) => void;
|
|
83
|
+
onError?: (err: Error) => void;
|
|
84
|
+
}
|
|
85
|
+
export interface UsePurchaseAuthorizationRequestsReturn {
|
|
86
|
+
carts: Ref<Cart[]>;
|
|
87
|
+
loading: Ref<boolean>;
|
|
88
|
+
selectedCart: Ref<Cart | null>;
|
|
89
|
+
modalLoading: Ref<boolean>;
|
|
90
|
+
acceptLoading: Ref<boolean>;
|
|
91
|
+
deleteLoading: Ref<boolean>;
|
|
92
|
+
isAuthManager: ComputedRef<boolean>;
|
|
93
|
+
getTotalQuantity: (cart: Cart) => number;
|
|
94
|
+
getContactName: (contact: Contact | null | undefined) => string;
|
|
95
|
+
getModalItems: () => CartMainItem[];
|
|
96
|
+
loadCarts: () => Promise<void>;
|
|
97
|
+
handleViewCart: (cart: Cart) => Promise<void>;
|
|
98
|
+
handleAcceptRequest: () => Promise<void>;
|
|
99
|
+
handleDeleteRequest: () => Promise<void>;
|
|
100
|
+
closeModal: () => void;
|
|
101
|
+
}
|
|
102
|
+
export declare function usePurchaseAuthorizationRequests(options: UsePurchaseAuthorizationRequestsOptions): UsePurchaseAuthorizationRequestsReturn;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ProductGridConfig } from '../../context/ProductGridContext';
|
|
2
|
+
import { PropellerInfra } from '../../context/PropellerContext';
|
|
3
|
+
/**
|
|
4
|
+
* Declarative resolver for the two-tier prop precedence used by
|
|
5
|
+
* `ProductCard` / `ClusterCard`:
|
|
6
|
+
*
|
|
7
|
+
* explicit prop > ProductGrid context (Tier 2) > Propeller infra (Tier 1) > default
|
|
8
|
+
*
|
|
9
|
+
* Without this, each card hand-writes a ~25–40 line object literal of
|
|
10
|
+
* `props.x ?? grid?.x ?? infra.x ?? d` lines — easy to get the precedence
|
|
11
|
+
* order wrong per key and impossible to scan. This collapses it to a spec
|
|
12
|
+
* table. It internally calls the same non-throwing `useInfraProps` and
|
|
13
|
+
* `useProductGridConfig`, so standalone usage (no provider) still works.
|
|
14
|
+
*
|
|
15
|
+
* Spec per key:
|
|
16
|
+
* - `infra` : fall back to PropellerInfra[key] (Tier 1)
|
|
17
|
+
* - `grid` : fall back to ProductGridConfig[key] (Tier 2)
|
|
18
|
+
* - `default`: final fallback when nothing else resolved
|
|
19
|
+
* - `transform(gridValue)`: when the grid value needs wrapping before use
|
|
20
|
+
*
|
|
21
|
+
* A key absent from the spec passes through unchanged.
|
|
22
|
+
*/
|
|
23
|
+
type InfraKey = keyof PropellerInfra;
|
|
24
|
+
type GridKey = keyof ProductGridConfig;
|
|
25
|
+
interface ResolveSpecEntry {
|
|
26
|
+
/** Tier-1 infra key to fall back to (after the explicit prop). */
|
|
27
|
+
infra?: InfraKey;
|
|
28
|
+
/** Tier-2 grid-config key to fall back to (after the explicit prop). */
|
|
29
|
+
grid?: GridKey;
|
|
30
|
+
/** Final fallback when neither explicit prop nor context resolved a value. */
|
|
31
|
+
default?: unknown;
|
|
32
|
+
/** Optional adapter applied to the grid value when it is the one chosen. */
|
|
33
|
+
transform?: (gridValue: NonNullable<ProductGridConfig[GridKey]>) => unknown;
|
|
34
|
+
}
|
|
35
|
+
export type ResolveSpec<P> = Partial<Record<keyof P, ResolveSpecEntry>>;
|
|
36
|
+
/**
|
|
37
|
+
* Resolve `rawProps` against the spec. Call inside `setup()` (it injects the
|
|
38
|
+
* grid + infra contexts). Wrap the call in a `computed` if the resolved
|
|
39
|
+
* result must track prop changes.
|
|
40
|
+
*/
|
|
41
|
+
export declare function useResolvedProps<P extends object>(rawProps: P, spec: ResolveSpec<P>): P;
|
|
42
|
+
export {};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Services } from '@propeller-commerce/propeller-v2-core-ui';
|
|
2
|
+
/**
|
|
3
|
+
* Read the SDK services bundle from the Propeller plugin.
|
|
4
|
+
*
|
|
5
|
+
* The package ships no default `graphqlClient` / `services`. The consumer
|
|
6
|
+
* constructs both at app startup and installs them via
|
|
7
|
+
* `app.use(propellerVue, { graphqlClient, services, ... })`. Anything in
|
|
8
|
+
* the app tree calls `useServices()` to get the bundle.
|
|
9
|
+
*
|
|
10
|
+
* Throws when the plugin wasn't installed — that's an integration error the
|
|
11
|
+
* consumer fixes at app startup, not something to paper over with a singleton.
|
|
12
|
+
*/
|
|
13
|
+
export declare function useServices(): Services;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { InjectionKey, Component } from 'vue';
|
|
2
|
+
import { Cart, CartMainItem, Product, Cluster } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
/**
|
|
4
|
+
* Tier 2 grid config context. Collapses the feature-flag / display and
|
|
5
|
+
* callback props that `ProductGrid` otherwise cascades through
|
|
6
|
+
* `ProductCard` / `ClusterCard` down to `AddToCart` / `ItemStock`.
|
|
7
|
+
* `ProductGrid` is the provider; the card subtree consumes via
|
|
8
|
+
* `useProductGridConfig()` instead of receiving ~20 threaded props.
|
|
9
|
+
*/
|
|
10
|
+
export interface ProductGridConfig {
|
|
11
|
+
columns: number;
|
|
12
|
+
showPrice?: boolean;
|
|
13
|
+
showStock?: boolean;
|
|
14
|
+
showAvailability?: boolean;
|
|
15
|
+
enableAddFavorite?: boolean;
|
|
16
|
+
allowAddToCart?: boolean;
|
|
17
|
+
createCart?: boolean;
|
|
18
|
+
showModal?: boolean;
|
|
19
|
+
allowIncrDecr?: boolean;
|
|
20
|
+
enableStockValidation?: boolean;
|
|
21
|
+
cartId?: string;
|
|
22
|
+
childItems?: number[];
|
|
23
|
+
notes?: string;
|
|
24
|
+
price?: number;
|
|
25
|
+
stockLabels?: Record<string, string>;
|
|
26
|
+
priceLabels?: Record<string, string>;
|
|
27
|
+
addToCartLabels?: Record<string, string>;
|
|
28
|
+
onCartCreated?: (cart: Cart) => void;
|
|
29
|
+
afterAddToCart?: (cart: Cart, item?: CartMainItem) => void;
|
|
30
|
+
onProceedToCheckout?: () => void;
|
|
31
|
+
onRequestQuoteClick?: (cart: Cart) => void;
|
|
32
|
+
onToggleFavorite?: (item: Product | Cluster, isFavorite: boolean) => void;
|
|
33
|
+
onProductClick?: (product: Product) => void;
|
|
34
|
+
onClusterClick?: (cluster: Cluster) => void;
|
|
35
|
+
priceComponent?: Component;
|
|
36
|
+
stockComponent?: Component;
|
|
37
|
+
addToCartComponent?: Component;
|
|
38
|
+
imageComponent?: Component;
|
|
39
|
+
badgesComponent?: Component;
|
|
40
|
+
favoriteComponent?: Component;
|
|
41
|
+
bundlesComponent?: Component;
|
|
42
|
+
bulkPricesComponent?: Component;
|
|
43
|
+
surchargesComponent?: Component;
|
|
44
|
+
productCardComponent?: Component;
|
|
45
|
+
clusterCardComponent?: Component;
|
|
46
|
+
}
|
|
47
|
+
/** Injection key for the Tier 2 grid config. Symbol-keyed, collision-free. */
|
|
48
|
+
export declare const ProductGridInjectionKey: InjectionKey<ProductGridConfig>;
|
|
49
|
+
/**
|
|
50
|
+
* Install the grid config for the card subtree. `ProductGrid` calls this in
|
|
51
|
+
* its `setup()`; `ProductCard` / `ClusterCard` and their children read it.
|
|
52
|
+
*/
|
|
53
|
+
export declare function provideProductGridConfig(value: ProductGridConfig): void;
|
|
54
|
+
/**
|
|
55
|
+
* Non-throwing: `ProductCard` / `ClusterCard` used outside a grid
|
|
56
|
+
* (`ProductSlider`, standalone, tests) get `null` and fall back to explicit
|
|
57
|
+
* props / defaults.
|
|
58
|
+
*/
|
|
59
|
+
export declare function useProductGridConfig(): ProductGridConfig | null;
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
import { Contact, Customer } from '@propeller-commerce/propeller-sdk-v2';
|
|
3
|
+
import { ShopMode, UserMode } from '@propeller-commerce/propeller-v2-core-ui';
|
|
4
|
+
import { PropellerDeps } from '../plugin';
|
|
5
|
+
/**
|
|
6
|
+
* Tier 2 — per-scope state. Bound by `<PropellerProvider>` and replaceable
|
|
7
|
+
* by nesting a second provider deeper in the tree (for impersonation,
|
|
8
|
+
* multi-cart, multi-language widgets, …). Distinct from the Tier 1 deps
|
|
9
|
+
* installed by the `propellerVue` plugin.
|
|
10
|
+
*/
|
|
11
|
+
export interface PropellerScope {
|
|
12
|
+
user: Contact | Customer | null;
|
|
13
|
+
companyId: number | undefined;
|
|
14
|
+
language: string;
|
|
15
|
+
includeTax: boolean;
|
|
16
|
+
portalMode: string;
|
|
17
|
+
/**
|
|
18
|
+
* Shop mode declared in `propeller.json`. Combined with `user` to derive
|
|
19
|
+
* `userMode` on the composite context. Defaults to `'hybrid'` when omitted
|
|
20
|
+
* so existing call sites keep their current branching semantics.
|
|
21
|
+
*/
|
|
22
|
+
shopMode?: ShopMode;
|
|
23
|
+
}
|
|
24
|
+
/** Symbol-keyed scope injection — never collides with consumer keys. */
|
|
25
|
+
export declare const PropellerScopeKey: InjectionKey<PropellerScope>;
|
|
26
|
+
/**
|
|
27
|
+
* Composite read of Tier 1 deps + Tier 2 scope. Mirrors the previous
|
|
28
|
+
* `PropellerInfra` shape so existing consumers (cards, useResolvedProps,
|
|
29
|
+
* useInfraProps) keep working unchanged.
|
|
30
|
+
*
|
|
31
|
+
* Composables that only need services should call `useServices()` /
|
|
32
|
+
* `usePropellerDeps()` instead — they don't depend on a scope provider.
|
|
33
|
+
*/
|
|
34
|
+
export interface PropellerInfra extends PropellerDeps, PropellerScope {
|
|
35
|
+
userMode: UserMode;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Non-throwing accessor: returns `null` if either tier is missing so
|
|
39
|
+
* components stay usable standalone / in tests.
|
|
40
|
+
*/
|
|
41
|
+
export declare function usePropellerContext(): PropellerInfra | null;
|
|
42
|
+
/**
|
|
43
|
+
* Throwing accessor — call when both tiers are required and a missing
|
|
44
|
+
* provider is an integration bug, not a render-standalone scenario.
|
|
45
|
+
*/
|
|
46
|
+
export declare function useRequiredPropellerContext(): PropellerInfra;
|
|
47
|
+
/**
|
|
48
|
+
* Read the active `userMode` directly. Returns `'anonymous'` outside the
|
|
49
|
+
* provider so components stay usable standalone / in tests.
|
|
50
|
+
*/
|
|
51
|
+
export declare function useUserMode(): UserMode;
|