@zenky/storefront-vue 0.9.40 → 0.9.43
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/cjs/index.js +346 -204
- package/dist/esm/index.js +348 -206
- package/dist/zenky.d.ts +82 -17
- package/package.json +2 -3
package/dist/zenky.d.ts
CHANGED
|
@@ -1,13 +1,18 @@
|
|
|
1
1
|
import * as vue from 'vue';
|
|
2
2
|
import { Ref, ComputedRef, WritableComputedRef } from 'vue';
|
|
3
3
|
import * as _zenky_api from '@zenky/api';
|
|
4
|
-
import { PaginationRequest, Pagination, PaginatedResponse, ResourceRequest, Address, City, NestedCategory, ProductsCollection, Feature, FeaturesGroupContainer, Article, ArticlesPaginationRequest, ArticleCategory, ArticleCategoriesPaginationRequest, Customer, AuthenticationPhone, Order, OrderCredentials, CustomerPaymentMethod, Medium, Image, Offer, OffersPaginationRequest, OrderSettings, OrderCheckoutTotal, ProductVariant, OrderProductVariant, ProductModifiersGroup, ProductModifier, ProductVariantPriceCalculation, Enum, VariantOptionValue, Product, ProductRequest, ProductsPaginationRequest, ProductsPricesRange, Schedule, Stock, Store, StoreSettings } from '@zenky/api';
|
|
4
|
+
import { ZenkyError, PaginationRequest, Pagination, PaginatedResponse, ResourceRequest, Address, City, NestedCategory, ProductsCollection, Feature, FeaturesGroupContainer, Article, ArticlesPaginationRequest, ArticleCategory, ArticleCategoriesPaginationRequest, Customer, AuthenticationPhone, Order, OrderCredentials, CustomerPaymentMethod, Medium, Image, Offer, OffersPaginationRequest, OrderSettings, OrderCheckoutTotal, ProductVariant, OrderProductVariant, ProductModifiersGroup, ProductModifier, ProductVariantPriceCalculation, Enum, VariantOptionValue, Product, ProductRequest, ProductsPaginationRequest, ProductsPricesRange, Schedule, Stock, Store, StoreSettings } from '@zenky/api';
|
|
5
5
|
import * as pinia from 'pinia';
|
|
6
6
|
import Pusher from 'pusher-js';
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
interface ApiErrorHandlerData {
|
|
9
|
+
e: any;
|
|
10
|
+
error?: ZenkyError | null;
|
|
11
|
+
message?: string | null;
|
|
12
|
+
}
|
|
13
|
+
declare type ApiErrorHandler = (data: ApiErrorHandlerData) => any;
|
|
9
14
|
declare type OptionalApiErrorHandler = ApiErrorHandler | null | undefined;
|
|
10
|
-
declare function getApiErrorHandler(providedHandler: OptionalApiErrorHandler,
|
|
15
|
+
declare function getApiErrorHandler(providedHandler: OptionalApiErrorHandler, composableName: string, defaultMessage: string): ApiErrorHandler;
|
|
11
16
|
|
|
12
17
|
interface DataDestroyer {
|
|
13
18
|
destroying: Ref<boolean>;
|
|
@@ -117,6 +122,14 @@ interface AddressFormValueProvider {
|
|
|
117
122
|
errors: string[];
|
|
118
123
|
data: AddressFormValue;
|
|
119
124
|
}
|
|
125
|
+
declare enum AddressFormValueError {
|
|
126
|
+
DaDataSuggestionRequired = "dadata.suggestion_required",
|
|
127
|
+
CityRequired = "plain.city_required",
|
|
128
|
+
StreetRequired = "plain.street_required",
|
|
129
|
+
HouseRequired = "plain.house_required",
|
|
130
|
+
StockRequired = "stock_required",
|
|
131
|
+
TableRequired = "table_required"
|
|
132
|
+
}
|
|
120
133
|
declare function useAddressFormValue(form: AddressForm, resolver: string, address?: Address | null): AddressFormValueProvider;
|
|
121
134
|
|
|
122
135
|
interface DadataProvider {
|
|
@@ -226,12 +239,19 @@ declare enum AuthenticationEvent {
|
|
|
226
239
|
Completed = "completed"
|
|
227
240
|
}
|
|
228
241
|
declare enum AuthenticationResultType {
|
|
229
|
-
Pending = "pending",
|
|
230
242
|
Validation = "validation",
|
|
231
243
|
Failed = "failed",
|
|
232
244
|
Completed = "completed",
|
|
233
245
|
Stage = "stage"
|
|
234
246
|
}
|
|
247
|
+
declare enum AuthenticationFailureReason {
|
|
248
|
+
ApiError = "api_error",
|
|
249
|
+
InProgress = "in_progress",
|
|
250
|
+
Cooldown = "cooldown",
|
|
251
|
+
PhoneRequired = "phone_required",
|
|
252
|
+
PasswordRequired = "password_required",
|
|
253
|
+
CodeRequired = "code_required"
|
|
254
|
+
}
|
|
235
255
|
declare type EmitAuthenticationEvent = (e: AuthenticationEvent, payload?: any) => void;
|
|
236
256
|
declare type CustomerStore = {
|
|
237
257
|
inclusions: string;
|
|
@@ -253,6 +273,8 @@ interface AuthenticationFormProvider {
|
|
|
253
273
|
interface AuthenticationResult {
|
|
254
274
|
type: AuthenticationResultType;
|
|
255
275
|
data?: any;
|
|
276
|
+
reason?: AuthenticationFailureReason;
|
|
277
|
+
error?: ZenkyError | null;
|
|
256
278
|
}
|
|
257
279
|
interface AuthenticationStatusCheckerProvider {
|
|
258
280
|
active: Ref<boolean>;
|
|
@@ -285,10 +307,25 @@ interface ConfirmationProvider {
|
|
|
285
307
|
resend: () => Promise<AuthenticationResult>;
|
|
286
308
|
confirm: (withPassword: boolean) => Promise<AuthenticationResult>;
|
|
287
309
|
}
|
|
310
|
+
declare enum AddressResultType {
|
|
311
|
+
Failed = "failed",
|
|
312
|
+
Completed = "completed"
|
|
313
|
+
}
|
|
314
|
+
declare enum AddressResultReason {
|
|
315
|
+
InProgress = "in_progress",
|
|
316
|
+
Validation = "validation",
|
|
317
|
+
ApiError = "api_error"
|
|
318
|
+
}
|
|
319
|
+
interface AddressResult {
|
|
320
|
+
type: AddressResultType;
|
|
321
|
+
reason?: AddressResultReason;
|
|
322
|
+
data?: any;
|
|
323
|
+
error?: ZenkyError | null;
|
|
324
|
+
}
|
|
288
325
|
interface EditAddressFormProvider {
|
|
289
326
|
form: Ref<AddressForm>;
|
|
290
327
|
saving: Ref<boolean>;
|
|
291
|
-
save: () => Promise<
|
|
328
|
+
save: () => Promise<AddressResult>;
|
|
292
329
|
}
|
|
293
330
|
|
|
294
331
|
declare function useAuthenticationStatusChecker(form: Ref<AuthenticationForm>, emit: EmitAuthenticationEvent): AuthenticationStatusCheckerProvider;
|
|
@@ -1084,6 +1121,37 @@ interface OrderProductVariantPromotion {
|
|
|
1084
1121
|
id: string;
|
|
1085
1122
|
reward_id: string;
|
|
1086
1123
|
}
|
|
1124
|
+
declare type ProductVariantControlsCallbackHandler = (type: string, result: boolean) => void;
|
|
1125
|
+
declare enum OrderCheckoutResultType {
|
|
1126
|
+
Validation = "validation",
|
|
1127
|
+
Completed = "completed",
|
|
1128
|
+
Failed = "failed"
|
|
1129
|
+
}
|
|
1130
|
+
declare enum OrderCheckoutResultReason {
|
|
1131
|
+
InProgress = "in_progress",
|
|
1132
|
+
Cooldown = "cooldown",
|
|
1133
|
+
ApiError = "api_error",
|
|
1134
|
+
OrderNotReady = "order_not_ready",
|
|
1135
|
+
PhoneRequired = "phone_required",
|
|
1136
|
+
FirstNameRequired = "first_name_required",
|
|
1137
|
+
CodeRequired = "code_required",
|
|
1138
|
+
AddressError = "address_error"
|
|
1139
|
+
}
|
|
1140
|
+
interface OrderCheckoutResult {
|
|
1141
|
+
type: OrderCheckoutResultType;
|
|
1142
|
+
reason?: OrderCheckoutResultReason;
|
|
1143
|
+
data?: any;
|
|
1144
|
+
error?: ZenkyError | null;
|
|
1145
|
+
}
|
|
1146
|
+
declare enum BillSuggestionType {
|
|
1147
|
+
Bill = "bill",
|
|
1148
|
+
NoChange = "no_change",
|
|
1149
|
+
Custom = "custom"
|
|
1150
|
+
}
|
|
1151
|
+
interface BillSuggestion {
|
|
1152
|
+
type: BillSuggestionType;
|
|
1153
|
+
value: string | number;
|
|
1154
|
+
}
|
|
1087
1155
|
|
|
1088
1156
|
declare const useOrderStore: pinia.StoreDefinition<"zenky:storefront:order", OrderStoreState, {
|
|
1089
1157
|
credentials(): OrderCredentials | null;
|
|
@@ -4438,9 +4506,9 @@ declare function useCheckoutConfirmation(order: Ref<Order>): {
|
|
|
4438
4506
|
code: string;
|
|
4439
4507
|
}>;
|
|
4440
4508
|
confirming: Ref<boolean>;
|
|
4441
|
-
confirm: () => Promise<
|
|
4509
|
+
confirm: () => Promise<OrderCheckoutResult>;
|
|
4442
4510
|
resending: Ref<boolean>;
|
|
4443
|
-
resendCode: () => Promise<
|
|
4511
|
+
resendCode: () => Promise<OrderCheckoutResult>;
|
|
4444
4512
|
};
|
|
4445
4513
|
|
|
4446
4514
|
declare function useCustomerCheckoutForm(emit: (event: string) => any): {
|
|
@@ -4699,7 +4767,7 @@ declare function useCustomerCheckoutForm(emit: (event: string) => any): {
|
|
|
4699
4767
|
first_name: string;
|
|
4700
4768
|
last_name: string;
|
|
4701
4769
|
}>;
|
|
4702
|
-
save: () => Promise<
|
|
4770
|
+
save: () => Promise<OrderCheckoutResult>;
|
|
4703
4771
|
};
|
|
4704
4772
|
|
|
4705
4773
|
declare function useDeliveryCheckoutForm(emit: (event: string) => any): {
|
|
@@ -4790,14 +4858,11 @@ declare function useDeliveryCheckoutForm(emit: (event: string) => any): {
|
|
|
4790
4858
|
addressesResolver: Ref<string | null>;
|
|
4791
4859
|
priceIsNotEnough: vue.ComputedRef<boolean>;
|
|
4792
4860
|
saving: Ref<boolean>;
|
|
4793
|
-
save: () => Promise<
|
|
4861
|
+
save: () => Promise<OrderCheckoutResult>;
|
|
4794
4862
|
};
|
|
4795
4863
|
|
|
4796
4864
|
declare function useBillSuggestions(unpaidAmount: Ref<number>, staticAmounts?: number[], availableBills?: number[]): {
|
|
4797
|
-
suggestions: vue.ComputedRef<
|
|
4798
|
-
label: string;
|
|
4799
|
-
value: string | number;
|
|
4800
|
-
}[]>;
|
|
4865
|
+
suggestions: vue.ComputedRef<BillSuggestion[]>;
|
|
4801
4866
|
};
|
|
4802
4867
|
declare function useDeliveryPaymentsForm(emit: (event: string) => any): {
|
|
4803
4868
|
form: Ref<{
|
|
@@ -4824,7 +4889,7 @@ declare function useDeliveryPaymentsForm(emit: (event: string) => any): {
|
|
|
4824
4889
|
} | undefined>;
|
|
4825
4890
|
bonusesAreChecking: Ref<boolean>;
|
|
4826
4891
|
saving: Ref<boolean>;
|
|
4827
|
-
save: () => Promise<
|
|
4892
|
+
save: () => Promise<OrderCheckoutResult>;
|
|
4828
4893
|
};
|
|
4829
4894
|
|
|
4830
4895
|
declare function useCheckoutSummary(emit: (event: string, payload?: any) => any): {
|
|
@@ -4834,7 +4899,7 @@ declare function useCheckoutSummary(emit: (event: string, payload?: any) => any)
|
|
|
4834
4899
|
}>;
|
|
4835
4900
|
hasPersonsCount: vue.ComputedRef<boolean>;
|
|
4836
4901
|
saving: vue.Ref<boolean>;
|
|
4837
|
-
save: () => Promise<
|
|
4902
|
+
save: () => Promise<OrderCheckoutResult>;
|
|
4838
4903
|
};
|
|
4839
4904
|
|
|
4840
4905
|
declare function useCheckoutTotal(): {
|
|
@@ -9977,7 +10042,7 @@ declare function useOrderVariants(): {
|
|
|
9977
10042
|
} | null;
|
|
9978
10043
|
}[]>;
|
|
9979
10044
|
};
|
|
9980
|
-
declare const useVariantControls: (variant: Ref<ProductVariant>, modifiers: Ref<any[]>, modifiersHash: Ref<string | null>, promotion: Ref<OrderProductVariantPromotion | null
|
|
10045
|
+
declare const useVariantControls: (variant: Ref<ProductVariant>, modifiers: Ref<any[]>, modifiersHash: Ref<string | null>, promotion: Ref<OrderProductVariantPromotion | null>, callback?: ProductVariantControlsCallbackHandler) => {
|
|
9981
10046
|
orderVariant: ComputedRef<OrderProductVariant | null | undefined>;
|
|
9982
10047
|
totalQuantity: ComputedRef<number>;
|
|
9983
10048
|
quantityModel: Ref<string | number>;
|
|
@@ -10307,4 +10372,4 @@ declare function createWebsocketsConnection(store: Store): Pusher;
|
|
|
10307
10372
|
declare function getWebsocketsConnection(): Pusher;
|
|
10308
10373
|
declare function subscribeToOrderEvents(order: Order): void;
|
|
10309
10374
|
|
|
10310
|
-
export { AddressForm, AddressFormValue, AddressFormValueProvider, ApiErrorHandler, AuthenticationEvent, AuthenticationForm, AuthenticationFormProvider, AuthenticationResult, AuthenticationResultType, AuthenticationStage, AuthenticationStatusCheckerProvider, CalculatedProductVariantPrice, CategoriesProvider, CategoriesState, CategoriesTreeProvider, CategoryProvider, CheckoutStage, CollectionsState, ConfirmableDataDestroyer, ConfirmationProvider, CustomerStore, DadataProvider, DataDestroyer, DataDestroyerHandler, DataLoader, DataProvider, EditAddressFormProvider, EmitAuthenticationEvent, FlatCategoriesTreeProvider, FlattenNestedCategory, InjectedProductsSource, ItemLoader, ItemProvider, ListLoader, ListProvider, LoaderState, LoginProvider, LogoutProvider, ModifiersGroupModifiersList, ModifiersGroupProps, OptionalApiErrorHandler, OrderInclusions, OrderProductVariantPromotion, OrderSettingsState, OrderStoreState, PaginatedItemsProvider, PaginatedLoader, PaginatedLoaderState, PasswordResetProvider, ProductCardModifiersList, ProductCardProduct, ProductCardVariantOption, ProductModifierModel, ProductModifiersGroupModifierModel, ProductVariantPriceCalcuator, ProductsCollectionProvider, ProductsCollectionsProvider, ProductsFilters, ProductsFiltersType, ProductsListConfig, ProductsListProvider, ProductsLoader, ProductsPriceFilters, ProductsPromotion, ProductsRequestCallback, ProductsSorting, ProductsSource, ProductsSourceType, PromotionsCheckerCompletedPayload, PromotionsCheckerSelector, PromotionsRewardsSelectorProvider, PromotionsSelector, PromotionsSelectorContext, PromotionsSelectorOffer, PromotionsStoreState, RegistrationProvider, ReversedTreeProvider, SelectedProductModifier, SelectedVariantOptionsList, SingleModifierProps, SplittedCategoriesTreeProvider, StateDataLoader, StateDataLoaderState, StoreState, ZenkyInjection, ZenkyStorage, ZenkyWebsocketEvent, createStorage, createWebsocketsConnection, getAddressForm, getApiErrorHandler, getExistedAddress, getExistedAddressDisplayValue, getFirstMedium, getProductVariantsPricesRange, getProductsListParamsFromQuery, getProductsListQueryParams, getProductsPaginationRequest, getProductsSource, getSelectedAddress, getSelectedAddressDisplayValue, getStockAddress, getStockSchedule, getStorage, getUpdatedVariants, getWebsocketsConnection, initializeOrderCustomer, initializePromotions, subscribeToOrderEvents, useAddressFormValue, useArticleCategoriesList, useArticleItem, useArticlesList, useAuthenticationForm, useAuthenticationStatusChecker, useBillSuggestions, useCategories, useCategoriesStore, useCategoriesTree, useCategory, useCategoryFeaturesGroupsList, useCategoryFeaturesList, useCheckoutConfirmation, useCheckoutSummary, useCheckoutTotal, useCollection, useCollections, useCollectionsStore, useCustomer, useCustomerCheckoutForm, useCustomerStore, useDadata, useDataDestroyer, useDataLoader, useDeliveryAddressDestroyer, useDeliveryAddressesList, useDeliveryCheckoutForm, useDeliveryPaymentsForm, useEditAddressForm, useFeaturesFilters, useFeaturesGroupsFilters, useFlatCategoriesTree, useItemLoader, useListLoader, useLogin, useLogout, useModifiers, useModifiersGroup, useOfferItem, useOffersList, useOrderCheckout, useOrderItem, useOrderStore, useOrderVariants, useOrdersList, usePaginatedLoader, usePasswordReset, usePaymentMethodDestroyer, usePaymentMethodsList, usePhoneConfirmation, useProductCard, useProductItem, useProductsList, useProductsPricesRange, useProductsPricesRangeFilters, usePromotionsStore, useRegistration, useReversedTree, useRewardsSelector, useSingleModifier, useSplittedCategoriesTree, useStateDataLoader, useStoreStore, useSuggestionsRestrictedToCity, useTotalPrice, useTotalQuantity, useVariant, useVariantControls, useVariantPrice };
|
|
10375
|
+
export { AddressForm, AddressFormValue, AddressFormValueError, AddressFormValueProvider, AddressResult, AddressResultReason, AddressResultType, ApiErrorHandler, ApiErrorHandlerData, AuthenticationEvent, AuthenticationFailureReason, AuthenticationForm, AuthenticationFormProvider, AuthenticationResult, AuthenticationResultType, AuthenticationStage, AuthenticationStatusCheckerProvider, BillSuggestion, BillSuggestionType, CalculatedProductVariantPrice, CategoriesProvider, CategoriesState, CategoriesTreeProvider, CategoryProvider, CheckoutStage, CollectionsState, ConfirmableDataDestroyer, ConfirmationProvider, CustomerStore, DadataProvider, DataDestroyer, DataDestroyerHandler, DataLoader, DataProvider, EditAddressFormProvider, EmitAuthenticationEvent, FlatCategoriesTreeProvider, FlattenNestedCategory, InjectedProductsSource, ItemLoader, ItemProvider, ListLoader, ListProvider, LoaderState, LoginProvider, LogoutProvider, ModifiersGroupModifiersList, ModifiersGroupProps, OptionalApiErrorHandler, OrderCheckoutResult, OrderCheckoutResultReason, OrderCheckoutResultType, OrderInclusions, OrderProductVariantPromotion, OrderSettingsState, OrderStoreState, PaginatedItemsProvider, PaginatedLoader, PaginatedLoaderState, PasswordResetProvider, ProductCardModifiersList, ProductCardProduct, ProductCardVariantOption, ProductModifierModel, ProductModifiersGroupModifierModel, ProductVariantControlsCallbackHandler, ProductVariantPriceCalcuator, ProductsCollectionProvider, ProductsCollectionsProvider, ProductsFilters, ProductsFiltersType, ProductsListConfig, ProductsListProvider, ProductsLoader, ProductsPriceFilters, ProductsPromotion, ProductsRequestCallback, ProductsSorting, ProductsSource, ProductsSourceType, PromotionsCheckerCompletedPayload, PromotionsCheckerSelector, PromotionsRewardsSelectorProvider, PromotionsSelector, PromotionsSelectorContext, PromotionsSelectorOffer, PromotionsStoreState, RegistrationProvider, ReversedTreeProvider, SelectedProductModifier, SelectedVariantOptionsList, SingleModifierProps, SplittedCategoriesTreeProvider, StateDataLoader, StateDataLoaderState, StoreState, ZenkyInjection, ZenkyStorage, ZenkyWebsocketEvent, createStorage, createWebsocketsConnection, getAddressForm, getApiErrorHandler, getExistedAddress, getExistedAddressDisplayValue, getFirstMedium, getProductVariantsPricesRange, getProductsListParamsFromQuery, getProductsListQueryParams, getProductsPaginationRequest, getProductsSource, getSelectedAddress, getSelectedAddressDisplayValue, getStockAddress, getStockSchedule, getStorage, getUpdatedVariants, getWebsocketsConnection, initializeOrderCustomer, initializePromotions, subscribeToOrderEvents, useAddressFormValue, useArticleCategoriesList, useArticleItem, useArticlesList, useAuthenticationForm, useAuthenticationStatusChecker, useBillSuggestions, useCategories, useCategoriesStore, useCategoriesTree, useCategory, useCategoryFeaturesGroupsList, useCategoryFeaturesList, useCheckoutConfirmation, useCheckoutSummary, useCheckoutTotal, useCollection, useCollections, useCollectionsStore, useCustomer, useCustomerCheckoutForm, useCustomerStore, useDadata, useDataDestroyer, useDataLoader, useDeliveryAddressDestroyer, useDeliveryAddressesList, useDeliveryCheckoutForm, useDeliveryPaymentsForm, useEditAddressForm, useFeaturesFilters, useFeaturesGroupsFilters, useFlatCategoriesTree, useItemLoader, useListLoader, useLogin, useLogout, useModifiers, useModifiersGroup, useOfferItem, useOffersList, useOrderCheckout, useOrderItem, useOrderStore, useOrderVariants, useOrdersList, usePaginatedLoader, usePasswordReset, usePaymentMethodDestroyer, usePaymentMethodsList, usePhoneConfirmation, useProductCard, useProductItem, useProductsList, useProductsPricesRange, useProductsPricesRangeFilters, usePromotionsStore, useRegistration, useReversedTree, useRewardsSelector, useSingleModifier, useSplittedCategoriesTree, useStateDataLoader, useStoreStore, useSuggestionsRestrictedToCity, useTotalPrice, useTotalQuantity, useVariant, useVariantControls, useVariantPrice };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zenky/storefront-vue",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.43",
|
|
4
4
|
"description": "Zenky Storefront library for Vue 3.",
|
|
5
5
|
"author": "Timur Zurbaev <hello@zurbaev.ru>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,8 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"peerDependencies": {
|
|
22
22
|
"@zenky/api": "^0.9.51",
|
|
23
|
-
"@zenky/events": "^1.0.
|
|
24
|
-
"@zenky/ui": "^0.9.63",
|
|
23
|
+
"@zenky/events": "^1.0.3",
|
|
25
24
|
"date-fns": "^2.29.2",
|
|
26
25
|
"lodash-es": "^4.17.21",
|
|
27
26
|
"pinia": "^2.0.14",
|