@meeovi/layer-commerce 1.0.10 → 1.0.13
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/app/components/catalog/product/ProductAccordion/ProductAccordion.vue +39 -0
- package/app/components/catalog/product/ProductAccordion/__tests__/ProductAccordion.spec.ts +15 -0
- package/app/components/catalog/product/ProductAccordion/types.ts +5 -0
- package/app/components/catalog/product/ProductProperties/ProductProperties.vue +50 -0
- package/app/components/catalog/product/ProductProperties/__tests__/ProductProperties.spec.ts +15 -0
- package/app/components/catalog/product/ProductProperties/types.ts +5 -0
- package/app/components/catalog/product/ProductSlider/ProductSlider.vue +28 -0
- package/app/components/catalog/product/ProductSlider/__tests__/ProductSlider.spec.ts +14 -0
- package/app/components/catalog/product/ProductSlider/types.ts +7 -0
- package/app/components/catalog/product/RecommendedProducts/RecommendedProducts.vue +12 -0
- package/app/components/catalog/product/RecommendedProducts/types.ts +5 -0
- package/app/components/catalog/product/RenderContentProductSlider/RenderContentProductSlider.vue +11 -0
- package/app/components/catalog/product/add-attribute.vue +54 -0
- package/app/components/catalog/product/add-product-type.vue +54 -0
- package/app/components/catalog/product/add-product.vue +53 -0
- package/app/components/catalog/product/add-showcase.vue +52 -0
- package/app/components/catalog/product/add-station.vue +54 -0
- package/app/components/catalog/product/bestsellers.vue +57 -0
- package/app/components/catalog/product/bidding.vue +93 -0
- package/app/components/catalog/product/colorOptions.vue +58 -0
- package/app/components/catalog/product/deals.vue +46 -0
- package/app/components/catalog/product/exclusives.vue +56 -0
- package/app/components/catalog/product/featuredproducts.vue +57 -0
- package/app/components/catalog/product/giftCard.vue +63 -0
- package/app/components/catalog/product/latestproducts.vue +46 -0
- package/app/components/catalog/product/productCard.vue +105 -0
- package/app/components/catalog/product/productCompare.vue +60 -0
- package/app/components/catalog/product/productCompareTable.vue +441 -0
- package/app/components/catalog/product/productDetails.vue +126 -0
- package/app/components/catalog/product/productFaqs.vue +17 -0
- package/app/components/catalog/product/productGallery.vue +16 -0
- package/app/components/catalog/product/productQty.vue +54 -0
- package/app/components/catalog/product/productReviews.vue +56 -0
- package/app/components/catalog/product/productSpecs.vue +116 -0
- package/app/components/catalog/product/radiostation.vue +36 -0
- package/app/components/catalog/product/recentlyviewed.vue +43 -0
- package/app/components/catalog/product/relatedbrands.vue +54 -0
- package/app/components/catalog/product/relatedproducts.vue +43 -0
- package/app/components/catalog/product/relatedstations.vue +40 -0
- package/app/components/catalog/product/shippingOptions.vue +41 -0
- package/app/components/catalog/product/sizeOptions.vue +42 -0
- package/app/components/catalog/product/update-attribute-set.vue +209 -0
- package/app/components/catalog/product/update-attribute.vue +118 -0
- package/app/components/catalog/product/update-product.vue +372 -0
- package/app/components/catalog/product/update-showcase.vue +153 -0
- package/app/components/catalog/shops/relatedstores.vue +37 -0
- package/app/components/catalog/shops/restaurant.vue +66 -0
- package/app/components/catalog/shops/stores.vue +44 -0
- package/app/components/catalog/vendor/README.md +3 -0
- package/app/components/catalog/vendor/blocks/biggestcustomers.vue +33 -0
- package/app/components/catalog/vendor/blocks/lowestselling.vue +33 -0
- package/app/components/catalog/vendor/blocks/topcategories.vue +33 -0
- package/app/components/catalog/vendor/blocks/topproducts.vue +27 -0
- package/app/components/catalog/vendor/pages/attributes.vue +43 -0
- package/app/components/catalog/vendor/pages/commissions.vue +43 -0
- package/app/components/catalog/vendor/pages/crm.vue +67 -0
- package/app/components/catalog/vendor/pages/dashboard.vue +46 -0
- package/app/components/catalog/vendor/pages/emails.vue +43 -0
- package/app/components/catalog/vendor/pages/enquiries.vue +43 -0
- package/app/components/catalog/vendor/pages/invoices.vue +43 -0
- package/app/components/catalog/vendor/pages/orders.vue +68 -0
- package/app/components/catalog/vendor/pages/products.vue +55 -0
- package/app/components/catalog/vendor/pages/reviews.vue +48 -0
- package/app/components/catalog/vendor/pages/shipments.vue +43 -0
- package/app/components/catalog/vendor/pages/stores.vue +43 -0
- package/app/components/categories/chart/[id].vue +200 -0
- package/app/components/categories/chart/add-chart.vue +142 -0
- package/app/components/categories/chart/chart.vue +82 -0
- package/app/components/categories/chart/monthlyChart.vue +46 -0
- package/app/components/categories/chart/weeklyChart.vue +46 -0
- package/app/components/categories/chart/yearlyChart.vue +46 -0
- package/app/components/categories/charts.vue +118 -0
- package/app/components/categories/deals.vue +101 -0
- package/app/components/categories/eats.vue +49 -0
- package/app/components/categories/restaurants.vue +26 -0
- package/app/components/categories/station/[id].vue +72 -0
- package/app/components/categories/stations.vue +124 -0
- package/app/components/categories/time/time.vue +63 -0
- package/app/components/categories/travel.vue +75 -0
- package/app/components/categories/weather/weather.vue +44 -0
- package/app/components/content/blocks/breadcrumbs.vue +0 -0
- package/app/components/content/blocks/currencySwitcher.vue +0 -0
- package/app/components/content/blocks/languageSwitcher.vue +0 -0
- package/app/components/content/blocks/videoproduct.vue +9 -0
- package/app/components/content/pages/checkout.vue +118 -0
- package/app/components/content/pages/meeoviGlobal.vue +68 -0
- package/app/components/content/pages/pickup-locations.vue +238 -0
- package/app/components/content/pages/showcases.vue +90 -0
- package/app/components/content/pages/success.vue +60 -0
- package/app/components/marketing/add-brand.vue +54 -0
- package/app/components/marketing/add-incentive.vue +54 -0
- package/app/components/marketing/promotions/giftcards.vue +102 -0
- package/app/components/marketing/promotions/subscriptions.vue +121 -0
- package/app/components/marketing/update-incentive.vue +326 -0
- package/app/components/menus/lowernav.vue +78 -0
- package/app/components/partials/LocaleSelector.vue +24 -0
- package/app/components/partials/ShoppingCart.vue +128 -0
- package/app/components/partials/StripePayment.vue +149 -0
- package/app/components/partials/addToCartBtn.vue +40 -0
- package/app/components/partials/cartItem.vue +124 -0
- package/app/components/partials/checkoutButton.vue +44 -0
- package/app/components/partials/compareBtn.vue +68 -0
- package/app/components/partials/ratings.vue +13 -0
- package/app/components/partials/store/CurrencySelector.vue +133 -0
- package/app/components/partials/store/StoreSwitcher.vue +13 -0
- package/app/components/placeholders/Comments.vue +15 -0
- package/app/components/placeholders/CreateListBtn.vue +7 -0
- package/app/components/placeholders/Event.vue +9 -0
- package/app/components/placeholders/ListShowcases.vue +9 -0
- package/app/components/placeholders/Short.vue +9 -0
- package/app/components/placeholders/Space.vue +9 -0
- package/app/components/placeholders/Tag.vue +7 -0
- package/app/components/related/brandCard.vue +41 -0
- package/app/components/related/incentiveCard.vue +44 -0
- package/app/components/related/invoiceCard.vue +43 -0
- package/app/components/related/orderCard.vue +43 -0
- package/app/components/related/relatedproducts.vue +17 -0
- package/app/components/sales/CartPageContent/CartPageContent.vue +37 -0
- package/app/components/sales/CheckoutAddress/CheckoutAddress.vue +50 -0
- package/app/components/sales/CheckoutAddress/__tests__/CheckoutAddress.spec.ts +16 -0
- package/app/components/sales/CheckoutAddress/types.ts +16 -0
- package/app/components/sales/CheckoutPayment/CheckoutPayment.vue +68 -0
- package/app/components/sales/CheckoutPayment/__tests__/CheckoutPayment.spec.ts +14 -0
- package/app/components/sales/CheckoutPayment/types.ts +12 -0
- package/app/components/sales/OrderSummary/OrderSummary.vue +57 -0
- package/app/components/sales/OrderSummary/__tests__/ContactInformation.spec.ts +52 -0
- package/app/components/sales/OrderSummary/types.ts +5 -0
- package/app/components/sales/incentives.vue +223 -0
- package/app/components/sales/invoices.vue +107 -0
- package/app/components/sales/orders.vue +378 -0
- package/app/components/sales/shipments.vue +65 -0
- package/app/components/sales/transactions.vue +109 -0
- package/app/components/shop/add-shop.vue +54 -0
- package/app/components/shop/cart/cartItem.vue +182 -0
- package/app/components/shop/cart/checkout.vue +415 -0
- package/app/components/shop/checkout/StripeCardElement.vue +206 -0
- package/app/components/shop/checkout/StripeCheckout.vue +49 -0
- package/app/components/shop/checkout/addressBilling.vue +263 -0
- package/app/components/shop/checkout/addressShipping.vue +175 -0
- package/app/components/shop/checkout/cart/ProductItem.vue +56 -0
- package/app/components/shop/checkout/cart/PromotionItem.vue +53 -0
- package/app/composables/_types.ts +18 -0
- package/app/composables/adapters/abstract/cartAdapter.ts +0 -0
- package/app/composables/adapters/abstract/categoryAdapter.ts +0 -0
- package/app/composables/adapters/abstract/customerAdapter.ts +0 -0
- package/app/composables/adapters/abstract/inventoryAdapter.ts +0 -0
- package/app/composables/adapters/abstract/orderAdapter.ts +0 -0
- package/app/composables/adapters/abstract/productAdapter.ts +7 -0
- package/app/composables/cart/registry.ts +20 -0
- package/app/composables/cart/types.ts +18 -0
- package/app/composables/cart/useCart.ts +15 -0
- package/app/composables/config.ts +19 -0
- package/app/composables/defs/apiDefinitions.ts +55 -0
- package/app/composables/defs/extension.feature +40 -0
- package/app/composables/defs/extension.mocks.ts +39 -0
- package/app/composables/defs/extension.test.ts +280 -0
- package/app/composables/defs/extension.ts +236 -0
- package/app/composables/defs/index.ts +3 -0
- package/app/composables/defs/types.ts +136 -0
- package/app/composables/domain/cart.ts +0 -0
- package/app/composables/domain/category.ts +0 -0
- package/app/composables/domain/order.ts +0 -0
- package/app/composables/domain/price.ts +0 -0
- package/app/composables/domain/product.ts +8 -0
- package/app/composables/domain/reward.ts +0 -0
- package/app/composables/domain/transactions.ts +0 -0
- package/app/composables/helpers/contextualizedNormalizers.feature +14 -0
- package/app/composables/helpers/contextualizedNormalizers.test.ts +85 -0
- package/app/composables/helpers/contextualizedNormalizers.ts +20 -0
- package/app/composables/helpers/index.ts +1 -0
- package/app/composables/index.ts +6 -0
- package/app/composables/methods/auth.ts +83 -0
- package/app/composables/methods/cart.ts +119 -0
- package/app/composables/methods/category.ts +27 -0
- package/app/composables/methods/checkout.ts +54 -0
- package/app/composables/methods/customer.ts +52 -0
- package/app/composables/methods/helpers.ts +5 -0
- package/app/composables/methods/index.ts +75 -0
- package/app/composables/methods/order.ts +39 -0
- package/app/composables/methods/product.ts +95 -0
- package/app/composables/methods/settings.ts +16 -0
- package/app/composables/models/cart.ts +95 -0
- package/app/composables/models/category.ts +13 -0
- package/app/composables/models/checkout.ts +17 -0
- package/app/composables/models/customer.ts +16 -0
- package/app/composables/models/facets.ts +25 -0
- package/app/composables/models/index.ts +94 -0
- package/app/composables/models/order.ts +43 -0
- package/app/composables/models/product.ts +73 -0
- package/app/composables/models/shared.ts +75 -0
- package/app/composables/products/registry.ts +20 -0
- package/app/composables/products/types.ts +13 -0
- package/app/composables/products/useEvents.ts +0 -0
- package/app/composables/products/useGiftCards.ts +0 -0
- package/app/composables/products/useProducts.ts +12 -0
- package/app/composables/products/useSubscriptions.ts +0 -0
- package/app/composables/registry.ts +21 -0
- package/app/composables/stores/cart.ts +218 -0
- package/app/composables/stores/cartStore.ts +300 -0
- package/app/composables/stores/checkout.ts +19 -0
- package/app/composables/stores/compare.ts +65 -0
- package/app/composables/stores/currency.js +29 -0
- package/app/composables/stores/digital-products.js +11 -0
- package/app/composables/stores/index.js +0 -0
- package/app/composables/stores/orders.ts +161 -0
- package/app/composables/stores/product.ts +26 -0
- package/app/composables/stores/productList.ts +0 -0
- package/app/composables/stores/productListInfo.ts +0 -0
- package/app/composables/stores/products.ts +112 -0
- package/app/composables/stores/recentlyViewedProducts.ts +0 -0
- package/app/composables/stores/review.ts +25 -0
- package/app/composables/stores/storeInPickUp.ts +22 -0
- package/app/composables/stores/user.ts +20 -0
- package/app/composables/stores/wishlist.ts +19 -0
- package/app/composables/types/Order.type.ts +181 -0
- package/app/composables/types/index.ts +285 -0
- package/app/composables/types/product.ts +14 -0
- package/app/composables/useBreakpoints/index.ts +1 -0
- package/app/composables/useBreakpoints/useBreakpoints.ts +28 -0
- package/app/composables/useCart/__tests__/useCart.spec.ts +11 -0
- package/app/composables/useCart/index.ts +1 -0
- package/app/composables/useCart/types.ts +17 -0
- package/app/composables/useCart/useCart.ts +46 -0
- package/app/composables/useCartShippingMethods/__tests__/useCartShippingMethods.spec.ts +11 -0
- package/app/composables/useCartShippingMethods/index.ts +1 -0
- package/app/composables/useCartShippingMethods/types.ts +17 -0
- package/app/composables/useCartShippingMethods/useCartShippingMethods.ts +47 -0
- package/app/composables/useCatalog.ts +64 -0
- package/app/composables/useContent/index.ts +1 -0
- package/app/composables/useContent/types.ts +44 -0
- package/app/composables/useContent/useContent.ts +45 -0
- package/app/composables/useContent.ts +57 -0
- package/app/composables/useCustomer/__tests__/useCustomer.spec.ts +25 -0
- package/app/composables/useCustomer/index.ts +2 -0
- package/app/composables/useCustomer/types.ts +17 -0
- package/app/composables/useCustomer/useCustomer.ts +40 -0
- package/app/composables/useCustomerAddress/__tests__/useCustomerAddress.spec.ts +11 -0
- package/app/composables/useCustomerAddress/index.ts +2 -0
- package/app/composables/useCustomerAddress/types.ts +17 -0
- package/app/composables/useCustomerAddress/useCustomerAddress.ts +55 -0
- package/app/composables/useCustomerOrder/__tests__/useCustomerOrder.spec.ts +11 -0
- package/app/composables/useCustomerOrder/adress.ts +10 -0
- package/app/composables/useCustomerOrder/index.ts +2 -0
- package/app/composables/useCustomerOrder/product.ts +37 -0
- package/app/composables/useCustomerOrder/types.ts +40 -0
- package/app/composables/useCustomerOrder/useCustomerOrder.ts +63 -0
- package/app/composables/useCustomerOrders/__tests__/useCustomerOrders.spec.ts +11 -0
- package/app/composables/useCustomerOrders/index.ts +2 -0
- package/app/composables/useCustomerOrders/types.ts +20 -0
- package/app/composables/useCustomerOrders/useCustomerOrders.ts +56 -0
- package/app/composables/useCustomerReturns/__tests__/useCustomerReturns.spec.ts +11 -0
- package/app/composables/useCustomerReturns/index.ts +2 -0
- package/app/composables/useCustomerReturns/types.ts +17 -0
- package/app/composables/useCustomerReturns/useCustomerReturns.ts +41 -0
- package/app/composables/useHandleError/index.ts +1 -0
- package/app/composables/useHandleError/types.ts +11 -0
- package/app/composables/useHandleError/useHandleError.ts +27 -0
- package/app/composables/usePageTitle.ts +16 -0
- package/app/composables/useProduct/index.ts +2 -0
- package/app/composables/useProduct/types.ts +17 -0
- package/app/composables/useProduct/useProduct.ts +42 -0
- package/app/composables/useProductAttribute/__tests__/useProduct.mock.ts +31 -0
- package/app/composables/useProductAttribute/__tests__/useProductAttribute.spec.ts +14 -0
- package/app/composables/useProductAttribute/index.ts +1 -0
- package/app/composables/useProductAttribute/useProductAttribute.ts +37 -0
- package/app/composables/useProductRecommended/__tests__/useProductRecommended.spec.ts +12 -0
- package/app/composables/useProductRecommended/index.ts +1 -0
- package/app/composables/useProductRecommended/types.ts +17 -0
- package/app/composables/useProductRecommended/useProductRecommended.ts +43 -0
- package/app/composables/useProductReviews/__tests__/productReviews.mock.ts +20 -0
- package/app/composables/useProductReviews/__tests__/useProductReviews.spec.ts +22 -0
- package/app/composables/useProductReviews/index.ts +2 -0
- package/app/composables/useProductReviews/types.ts +17 -0
- package/app/composables/useProductReviews/useProductReviews.ts +46 -0
- package/app/composables/useProducts/__tests__/useProducts.spec.ts +11 -0
- package/app/composables/useProducts/types.ts +22 -0
- package/app/composables/useProducts/useProducts.ts +41 -0
- package/app/composables/utils/countryList.ts +14 -0
- package/app/composables/utils/currency.js +56 -0
- package/app/composables/utils/glossary.ts +0 -0
- package/app/composables/utils/importExport.ts +0 -0
- package/app/composables/utils/index.js +0 -0
- package/app/composables/utils/print.ts +0 -0
- package/app/composables/utils/shopThemes.ts +0 -0
- package/app/composables/utils/statistics.ts +0 -0
- package/app/composables/utils/stock.ts +0 -0
- package/app/composables/utils/stripe.ts +16 -0
- package/app/composables/utils/taxation.ts +0 -0
- package/app/composables/utils/tellFriends.ts +0 -0
- package/app/composables/validationRules/index.ts +1 -0
- package/app/composables/validationRules/password.feature +67 -0
- package/app/composables/validationRules/password.test.ts +89 -0
- package/app/composables/validationRules/password.ts +25 -0
- package/app/composables/vendors/index.ts +0 -0
- package/app/composables/vendors/registry.ts +0 -0
- package/app/composables/vendors/useAffiliates.ts +0 -0
- package/app/composables/vendors/useCommission.ts +0 -0
- package/app/modules/vue-head/composables/useHead.ts +3 -0
- package/app/pages/brand/[...slug].vue +92 -0
- package/app/pages/brands.vue +90 -0
- package/app/pages/cart.vue +142 -0
- package/app/pages/compare.vue +166 -0
- package/app/pages/departments/[...slug].vue +385 -0
- package/app/pages/departments/category/[...slug].vue +135 -0
- package/app/pages/incentive/[...id].vue +66 -0
- package/app/pages/invoice/[id].vue +309 -0
- package/app/pages/order/[id].vue +327 -0
- package/app/pages/product/[...id].vue +309 -0
- package/app/pages/product/showcases/index.vue +86 -0
- package/app/pages/shipment/[...id].vue +176 -0
- package/app/pages/shop/[...slug].vue +158 -0
- package/app/pages/shops.vue +76 -0
- package/app/pages/subscription/[...id].vue +147 -0
- package/app/pages/transaction/[...id].vue +74 -0
- package/app/types/shims-imports.d.ts +13 -0
- package/app/utils/client.ts +26 -0
- package/app/utils/index.ts +53 -0
- package/app/utils/normalizer.ts +23 -0
- package/app/utils/normalizers/magento.ts +29 -0
- package/app/utils/normalizers/shopify.ts +29 -0
- package/global.d.ts +149 -0
- package/index.js +3 -0
- package/package.json +3 -9
- package/tsconfig.json +31 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
type ApiMethods = Record<string, (...args: any[]) => any>;
|
|
3
|
+
|
|
4
|
+
interface ApiClientExtension {
|
|
5
|
+
name: string;
|
|
6
|
+
extendApiMethods?: Record<string, (...args: any[]) => any>;
|
|
7
|
+
hooks?: (req: any, res: any) => any;
|
|
8
|
+
isNamespaced?: boolean;
|
|
9
|
+
}
|
|
10
|
+
import { mergeDeepRight } from "ramda";
|
|
11
|
+
import { toContextualizedNormalizers } from "../helpers";
|
|
12
|
+
const Logger: any = console;
|
|
13
|
+
import type {
|
|
14
|
+
BaseNormalizerContext,
|
|
15
|
+
CreateUnifiedExtensionParams,
|
|
16
|
+
DefineAddCustomFields,
|
|
17
|
+
GetAdditionalNormalizerContextConstraint,
|
|
18
|
+
GetAdditionalNormalizerContextParams,
|
|
19
|
+
NormalizersConstraint,
|
|
20
|
+
UnifiedCmsConfig,
|
|
21
|
+
UnifiedConfig,
|
|
22
|
+
UnifiedExtensionContextConstraint,
|
|
23
|
+
UnifiedExtensionFactoryParams,
|
|
24
|
+
} from "./types";
|
|
25
|
+
|
|
26
|
+
const CURRENCY_COOKIE = "vsf-currency";
|
|
27
|
+
const LOCALE_COOKIE = "vsf-locale";
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @description A factory function which builds the default normalizers and default API methods into unified extension.
|
|
31
|
+
* It expects the type of the API methods, normalizers, and config as generics.
|
|
32
|
+
*
|
|
33
|
+
* @returns A `createUnifiedExtension` function which can be used by the user to create a unified extension.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* export const createUnifiedExtension = unifiedExtensionFactory<
|
|
38
|
+
* typeof apiMethods,
|
|
39
|
+
* Normalizers,
|
|
40
|
+
* Config
|
|
41
|
+
* >({
|
|
42
|
+
* extendApiMethods: apiMethods,
|
|
43
|
+
* normalizers,
|
|
44
|
+
* });
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export function unifiedExtensionFactory<
|
|
48
|
+
TApiMethods extends ApiMethods,
|
|
49
|
+
TNormalizers extends NormalizersConstraint,
|
|
50
|
+
TConfig extends UnifiedConfig,
|
|
51
|
+
>(factoryParams: UnifiedExtensionFactoryParams<TApiMethods, TNormalizers>) {
|
|
52
|
+
return function createUnifiedExtension<
|
|
53
|
+
TAddCustomFieldsArray extends [
|
|
54
|
+
DefineAddCustomFields<TNormalizers>,
|
|
55
|
+
...DefineAddCustomFields<TNormalizers>[],
|
|
56
|
+
],
|
|
57
|
+
>(
|
|
58
|
+
params: CreateUnifiedExtensionParams<TConfig, TApiMethods, TNormalizers, TAddCustomFieldsArray>,
|
|
59
|
+
) {
|
|
60
|
+
const {
|
|
61
|
+
extendApiMethods: defaultApiMethods,
|
|
62
|
+
normalizers: defaultNormalizers,
|
|
63
|
+
getAdditionalNormalizerContext,
|
|
64
|
+
} = factoryParams;
|
|
65
|
+
const baseNormalizers = { ...defaultNormalizers, ...params.normalizers.override };
|
|
66
|
+
const normalizers = mergeNormalizers(baseNormalizers, params.normalizers.addCustomFields);
|
|
67
|
+
const { config: extensionConfig, methods, isNamespaced = factoryParams.isNamespaced } = params;
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
name: "unified",
|
|
71
|
+
extendApiMethods: {
|
|
72
|
+
...defaultApiMethods,
|
|
73
|
+
...methods?.override,
|
|
74
|
+
} as TApiMethods,
|
|
75
|
+
hooks(req: any, res: any) {
|
|
76
|
+
return {
|
|
77
|
+
beforeCall({ args, configuration }: { args: any; configuration: any }) {
|
|
78
|
+
if (!req.cookies[CURRENCY_COOKIE] && extensionConfig) {
|
|
79
|
+
req.cookies[CURRENCY_COOKIE] = extensionConfig.defaultCurrency;
|
|
80
|
+
}
|
|
81
|
+
configuration.unified = extensionConfig;
|
|
82
|
+
if (!configuration.normalizerContext) {
|
|
83
|
+
configuration.normalizerContext = createNormalizerContext(
|
|
84
|
+
normalizers,
|
|
85
|
+
getAdditionalNormalizerContext,
|
|
86
|
+
{ req, res, config: configuration },
|
|
87
|
+
);
|
|
88
|
+
configuration.normalizerContext.currency =
|
|
89
|
+
req.cookies?.[CURRENCY_COOKIE] ?? extensionConfig.defaultCurrency ?? "USD";
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return args;
|
|
93
|
+
},
|
|
94
|
+
};
|
|
95
|
+
},
|
|
96
|
+
isNamespaced,
|
|
97
|
+
normalizers,
|
|
98
|
+
/**
|
|
99
|
+
* @internal You shouldn't use this field. It's present only to infer the type of addCustomFields
|
|
100
|
+
*/
|
|
101
|
+
_addCustomFields: {} as TAddCustomFieldsArray,
|
|
102
|
+
} satisfies ApiClientExtension & Record<string, any>;
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
/**
|
|
107
|
+
* @description A factory function which builds the default normalizers and default API methods into unified extension.
|
|
108
|
+
* It expects the type of the API methods, normalizers, and config as generics.
|
|
109
|
+
*
|
|
110
|
+
* @returns A Middleware extension which can be registered in the API client.
|
|
111
|
+
*
|
|
112
|
+
* @example
|
|
113
|
+
* ```ts
|
|
114
|
+
* export const createUnifiedExtension = createUnifiedCmsExtension({
|
|
115
|
+
* extendApiMethods: {
|
|
116
|
+
* getPage,
|
|
117
|
+
* },
|
|
118
|
+
* normalizers,
|
|
119
|
+
* getAdditionalNormalizerContext: () => ({
|
|
120
|
+
* documentToHtmlString,
|
|
121
|
+
* }),
|
|
122
|
+
* });
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export function createUnifiedCmsExtension<
|
|
126
|
+
TApiMethods extends ApiMethods,
|
|
127
|
+
TNormalizers extends NormalizersConstraint,
|
|
128
|
+
>(params: UnifiedExtensionFactoryParams<TApiMethods, TNormalizers>) {
|
|
129
|
+
const {
|
|
130
|
+
extendApiMethods,
|
|
131
|
+
normalizers: defaultNormalizers,
|
|
132
|
+
getAdditionalNormalizerContext,
|
|
133
|
+
isNamespaced = true,
|
|
134
|
+
} = params;
|
|
135
|
+
|
|
136
|
+
return {
|
|
137
|
+
name: "unified",
|
|
138
|
+
extendApiMethods,
|
|
139
|
+
isNamespaced,
|
|
140
|
+
hooks(req: any, res: any) {
|
|
141
|
+
return {
|
|
142
|
+
beforeCall({ args, configuration }: { args: any; configuration: any }) {
|
|
143
|
+
if (!configuration.normalizerContext) {
|
|
144
|
+
const unifiedConfig = configuration?.unified ?? ({} as UnifiedCmsConfig<TNormalizers>);
|
|
145
|
+
const baseNormalizers = {
|
|
146
|
+
...defaultNormalizers,
|
|
147
|
+
...unifiedConfig.normalizers?.override,
|
|
148
|
+
};
|
|
149
|
+
const normalizers = mergeNormalizers(
|
|
150
|
+
baseNormalizers,
|
|
151
|
+
unifiedConfig.normalizers?.addCustomFields ?? [],
|
|
152
|
+
);
|
|
153
|
+
|
|
154
|
+
configuration.normalizerContext = createNormalizerContext(
|
|
155
|
+
normalizers,
|
|
156
|
+
getAdditionalNormalizerContext,
|
|
157
|
+
{ req, res, config: configuration },
|
|
158
|
+
);
|
|
159
|
+
}
|
|
160
|
+
return args;
|
|
161
|
+
},
|
|
162
|
+
};
|
|
163
|
+
},
|
|
164
|
+
} satisfies ApiClientExtension;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
/**
|
|
168
|
+
* A helper function to get the normalizers from the context.
|
|
169
|
+
* @param context Context passed to the API method
|
|
170
|
+
* @returns normalizers
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```ts
|
|
174
|
+
* const { normalizeProduct } = getNormalizers(context);
|
|
175
|
+
* ```
|
|
176
|
+
*/
|
|
177
|
+
export function getNormalizers<TContext extends UnifiedExtensionContextConstraint>(
|
|
178
|
+
context: TContext,
|
|
179
|
+
): TContext["config"]["normalizerContext"]["normalizers"] {
|
|
180
|
+
return context.config.normalizerContext.normalizers;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/**
|
|
184
|
+
* A helper function to assign values to the normalizer context.
|
|
185
|
+
* @param context Context passed to the API method
|
|
186
|
+
* @param overrides Object with the values to override in the normalizer context
|
|
187
|
+
* @returns void - it mutates the context
|
|
188
|
+
*
|
|
189
|
+
* @example
|
|
190
|
+
* ```ts
|
|
191
|
+
* assignToNormalizerContext(context, { locale: "de" });
|
|
192
|
+
* ```
|
|
193
|
+
*/
|
|
194
|
+
export function assignToNormalizerContext<TContext extends UnifiedExtensionContextConstraint>(
|
|
195
|
+
context: TContext,
|
|
196
|
+
overrides: Partial<TContext["config"]["normalizerContext"]>,
|
|
197
|
+
) {
|
|
198
|
+
Object.assign(context.config.normalizerContext, overrides);
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
function createNormalizerContext<TNormalizers extends NormalizersConstraint>(
|
|
202
|
+
normalizers: TNormalizers,
|
|
203
|
+
getAdditionalNormalizerContext: GetAdditionalNormalizerContextConstraint,
|
|
204
|
+
{ req, res, config }: GetAdditionalNormalizerContextParams,
|
|
205
|
+
) {
|
|
206
|
+
const logger = Logger;
|
|
207
|
+
const normalizerContext: BaseNormalizerContext<TNormalizers> = {
|
|
208
|
+
locale: req.cookies?.[LOCALE_COOKIE] ?? "en",
|
|
209
|
+
...getAdditionalNormalizerContext({ req, res, config }),
|
|
210
|
+
logger,
|
|
211
|
+
};
|
|
212
|
+
normalizerContext.normalizers = toContextualizedNormalizers(normalizers, () => normalizerContext);
|
|
213
|
+
|
|
214
|
+
return normalizerContext;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export function mergeNormalizers<TNormalizers extends NormalizersConstraint>(
|
|
218
|
+
baseNormalizers: TNormalizers,
|
|
219
|
+
addCustomFields: DefineAddCustomFields<TNormalizers>[],
|
|
220
|
+
): TNormalizers {
|
|
221
|
+
const normalizers: any = { ...baseNormalizers };
|
|
222
|
+
|
|
223
|
+
addCustomFields.forEach((customFieldsNormalizers) => {
|
|
224
|
+
Object.entries(customFieldsNormalizers).forEach(([name, customFields]) => {
|
|
225
|
+
const currentNormalizer = normalizers[name]!;
|
|
226
|
+
if (normalizers[name] && customFields) {
|
|
227
|
+
normalizers[name] = (input: any, context: any) =>
|
|
228
|
+
mergeDeepRight(currentNormalizer(input, context), {
|
|
229
|
+
$custom: customFields(input, context),
|
|
230
|
+
});
|
|
231
|
+
}
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
return normalizers;
|
|
236
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/* eslint-disable no-use-before-define */
|
|
3
|
+
type ApiMethods = Record<string, (...args: any[]) => any>;
|
|
4
|
+
import type { MergeDeep } from "type-fest";
|
|
5
|
+
import type { ContextualizedNormalizers } from "../helpers";
|
|
6
|
+
import type { Maybe, SfCurrency, SfFacetType } from "../models";
|
|
7
|
+
|
|
8
|
+
// Minimal local IntegrationContext replacement
|
|
9
|
+
export interface IntegrationContext<CLIENT = any, CONFIG = any, API = any> {
|
|
10
|
+
client: CLIENT;
|
|
11
|
+
config: CONFIG;
|
|
12
|
+
api: API;
|
|
13
|
+
req?: any;
|
|
14
|
+
res?: any;
|
|
15
|
+
[x: string]: any;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export interface VSFLogger {
|
|
19
|
+
debug(message?: any, ...args: any[]): void;
|
|
20
|
+
info(message?: any, ...args: any[]): void;
|
|
21
|
+
warn(message?: any, ...args: any[]): void;
|
|
22
|
+
error(message?: any, ...args: any[]): void;
|
|
23
|
+
}
|
|
24
|
+
export interface UnifiedConfig {
|
|
25
|
+
currencies?: SfCurrency[];
|
|
26
|
+
defaultCurrency: SfCurrency;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export interface BaseNormalizerContext<TNormalizers extends NormalizersConstraint = any> {
|
|
30
|
+
locale: string;
|
|
31
|
+
currency: string;
|
|
32
|
+
normalizers: ContextualizedNormalizers<TNormalizers>;
|
|
33
|
+
logger: VSFLogger;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export type NormalizerConstraint<
|
|
37
|
+
TNormalizerContext extends BaseNormalizerContext = BaseNormalizerContext,
|
|
38
|
+
> = (rawData: any, context: TNormalizerContext) => any;
|
|
39
|
+
|
|
40
|
+
export type NormalizersConstraint<TNormalizerContext extends BaseNormalizerContext = any> = Record<
|
|
41
|
+
string,
|
|
42
|
+
NormalizerConstraint<TNormalizerContext>
|
|
43
|
+
>;
|
|
44
|
+
|
|
45
|
+
export type UnifiedExtensionContextConstraint<
|
|
46
|
+
TNormalizerContext extends BaseNormalizerContext = any,
|
|
47
|
+
> = IntegrationContext & { config: { normalizerContext: TNormalizerContext } };
|
|
48
|
+
|
|
49
|
+
export type GetFacetTypeFn<TInput> = (input: TInput) => Maybe<SfFacetType | string>;
|
|
50
|
+
export type FilterFacetsFn<TInput> = (input: TInput) => boolean;
|
|
51
|
+
|
|
52
|
+
export type GetAdditionalNormalizerContextParams<TConfig extends Record<string, any> = any> = {
|
|
53
|
+
req: IntegrationContext["req"];
|
|
54
|
+
res: IntegrationContext["res"];
|
|
55
|
+
config: TConfig;
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
export type GetAdditionalNormalizerContextConstraint = (
|
|
59
|
+
params: GetAdditionalNormalizerContextParams,
|
|
60
|
+
) => any;
|
|
61
|
+
|
|
62
|
+
export type GetAdditionalNormalizerContext<
|
|
63
|
+
TIntegrationContext extends IntegrationContext,
|
|
64
|
+
TNormalizerContext extends BaseNormalizerContext,
|
|
65
|
+
> = (
|
|
66
|
+
params: GetAdditionalNormalizerContextParams<TIntegrationContext["config"]>,
|
|
67
|
+
) => Omit<TNormalizerContext, keyof BaseNormalizerContext>;
|
|
68
|
+
|
|
69
|
+
export interface AddCustomFields {}
|
|
70
|
+
|
|
71
|
+
export type InferAddCustomFieldsFromArray<
|
|
72
|
+
TArray extends Record<string, (...args: any) => any>[],
|
|
73
|
+
TResult = {},
|
|
74
|
+
> = TArray extends [
|
|
75
|
+
infer THead extends Record<string, (...args: any) => any>,
|
|
76
|
+
...infer TTail extends Record<string, (...args: any) => any>[],
|
|
77
|
+
]
|
|
78
|
+
? InferAddCustomFieldsFromArray<
|
|
79
|
+
TTail,
|
|
80
|
+
MergeDeep<
|
|
81
|
+
TResult,
|
|
82
|
+
{
|
|
83
|
+
[TKey in keyof THead]: Exclude<ReturnType<THead[TKey]>, null | undefined>;
|
|
84
|
+
}
|
|
85
|
+
>
|
|
86
|
+
>
|
|
87
|
+
: TResult;
|
|
88
|
+
|
|
89
|
+
export type InferAddCustomFields<TUnifiedExtension extends { _addCustomFields: any }> =
|
|
90
|
+
InferAddCustomFieldsFromArray<TUnifiedExtension["_addCustomFields"]>;
|
|
91
|
+
|
|
92
|
+
export type InferCustom<TNormalizer extends string> =
|
|
93
|
+
AddCustomFields extends Record<TNormalizer, infer TCustom> ? TCustom : object;
|
|
94
|
+
|
|
95
|
+
export type DefineAddCustomFields<TNormalizers extends NormalizersConstraint> = {
|
|
96
|
+
[Key in keyof TNormalizers]?: (...args: Parameters<TNormalizers[Key]>) => any;
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export interface NormalizersConfig<
|
|
100
|
+
TNormalizers extends NormalizersConstraint,
|
|
101
|
+
TAddCustomFieldsArray,
|
|
102
|
+
> {
|
|
103
|
+
override?: Partial<TNormalizers>;
|
|
104
|
+
addCustomFields: TAddCustomFieldsArray;
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
export interface UnifiedExtensionFactoryParams<
|
|
108
|
+
TApiMethods extends ApiMethods,
|
|
109
|
+
TNormalizers extends NormalizersConstraint,
|
|
110
|
+
> {
|
|
111
|
+
normalizers: TNormalizers;
|
|
112
|
+
extendApiMethods: TApiMethods;
|
|
113
|
+
getAdditionalNormalizerContext: GetAdditionalNormalizerContextConstraint;
|
|
114
|
+
isNamespaced?: boolean;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface CreateUnifiedExtensionParams<
|
|
118
|
+
TConfig extends Record<string, any>,
|
|
119
|
+
TApiMethods extends ApiMethods,
|
|
120
|
+
TNormalizers extends NormalizersConstraint,
|
|
121
|
+
TAddCustomFieldsArray extends DefineAddCustomFields<TNormalizers>[],
|
|
122
|
+
> {
|
|
123
|
+
config: TConfig;
|
|
124
|
+
normalizers: NormalizersConfig<TNormalizers, TAddCustomFieldsArray>;
|
|
125
|
+
methods?: {
|
|
126
|
+
override?: Partial<TApiMethods>;
|
|
127
|
+
};
|
|
128
|
+
isNamespaced?: boolean;
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export interface UnifiedCmsConfig<
|
|
132
|
+
TNormalizers extends NormalizersConstraint,
|
|
133
|
+
TAddCustomFieldsArray = DefineAddCustomFields<TNormalizers>[],
|
|
134
|
+
> {
|
|
135
|
+
normalizers?: NormalizersConfig<TNormalizers, TAddCustomFieldsArray>;
|
|
136
|
+
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
Feature: Contextualized normalizers
|
|
2
|
+
|
|
3
|
+
Scenario: Context is passed to normalizers
|
|
4
|
+
Given a normalizer that requires a context as a second argument
|
|
5
|
+
When toContextualizedNormalizers function is called
|
|
6
|
+
And the normalizer is called with just an input
|
|
7
|
+
Then the normalizer should also receive the context
|
|
8
|
+
|
|
9
|
+
Scenario: Context changes
|
|
10
|
+
Given a normalizer that requires a context as a second argument
|
|
11
|
+
When toContextualizedNormalizers function is called
|
|
12
|
+
And the context changes
|
|
13
|
+
And the normalizer is called with just an input
|
|
14
|
+
Then the normalizer should use the recent version of the context
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { defineFeature, loadFeature } from "jest-cucumber";
|
|
2
|
+
import type { ContextualizedNormalizers } from "./contextualizedNormalizers";
|
|
3
|
+
import { toContextualizedNormalizers } from "./contextualizedNormalizers";
|
|
4
|
+
import type { SfMoney } from "../models";
|
|
5
|
+
import { beforeEach, expect, vi } from "vitest";
|
|
6
|
+
|
|
7
|
+
const feature = loadFeature("./contextualizedNormalizers.feature", { loadRelativePath: true });
|
|
8
|
+
|
|
9
|
+
defineFeature(feature, (test) => {
|
|
10
|
+
type TestContext = {
|
|
11
|
+
locale: string;
|
|
12
|
+
currency: string;
|
|
13
|
+
};
|
|
14
|
+
type Normalizers = {
|
|
15
|
+
normalizeMoney(context: TestContext, input: number): SfMoney;
|
|
16
|
+
};
|
|
17
|
+
let testNormalizers: Normalizers;
|
|
18
|
+
let output: ContextualizedNormalizers<Normalizers>;
|
|
19
|
+
let context: TestContext;
|
|
20
|
+
|
|
21
|
+
beforeEach(() => {
|
|
22
|
+
context = {
|
|
23
|
+
currency: "USD",
|
|
24
|
+
locale: "en",
|
|
25
|
+
};
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
test("Context is passed to normalizers", ({ given, when, and, then }) => {
|
|
29
|
+
given("a normalizer that requires a context as a second argument", () => {
|
|
30
|
+
testNormalizers = {
|
|
31
|
+
normalizeMoney: vi.fn((context, input) => {
|
|
32
|
+
return {
|
|
33
|
+
amount: input,
|
|
34
|
+
currency: context.currency,
|
|
35
|
+
precisionAmount: input.toFixed(2),
|
|
36
|
+
};
|
|
37
|
+
}),
|
|
38
|
+
};
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
when("toContextualizedNormalizers function is called", () => {
|
|
42
|
+
output = toContextualizedNormalizers(testNormalizers, () => context);
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
and("the normalizer is called with just an input", () => {
|
|
46
|
+
output.normalizeMoney(100);
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
then("the normalizer should also receive the context", () => {
|
|
50
|
+
expect(testNormalizers.normalizeMoney).toHaveBeenCalledWith(context, 100);
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
test("Context changes", ({ given, when, and, then }) => {
|
|
54
|
+
given("a normalizer that requires a context as a second argument", () => {
|
|
55
|
+
testNormalizers = {
|
|
56
|
+
normalizeMoney: vi.fn((context, input) => {
|
|
57
|
+
return {
|
|
58
|
+
amount: input,
|
|
59
|
+
currency: context.currency,
|
|
60
|
+
precisionAmount: input.toFixed(2),
|
|
61
|
+
};
|
|
62
|
+
}),
|
|
63
|
+
};
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
when("toContextualizedNormalizers function is called", () => {
|
|
67
|
+
output = toContextualizedNormalizers(testNormalizers, () => context);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
and("the context changes", () => {
|
|
71
|
+
context.currency = "EUR";
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
and("the normalizer is called with just an input", () => {
|
|
75
|
+
output.normalizeMoney(100);
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
then("the normalizer should use the recent version of the context", () => {
|
|
79
|
+
expect(testNormalizers.normalizeMoney).toHaveBeenCalledWith(
|
|
80
|
+
expect.objectContaining({ currency: "EUR" }),
|
|
81
|
+
expect.anything(),
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
});
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { NormalizersConstraint } from "../defs";
|
|
2
|
+
|
|
3
|
+
export type ContextualizedNormalizers<TNormalizers extends NormalizersConstraint> = {
|
|
4
|
+
[TKey in keyof TNormalizers]: (
|
|
5
|
+
input: Parameters<TNormalizers[TKey]>[1],
|
|
6
|
+
) => ReturnType<TNormalizers[TKey]>;
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export function toContextualizedNormalizers<
|
|
10
|
+
TNormalizers extends NormalizersConstraint,
|
|
11
|
+
TNormalizerContext extends Record<string, any>,
|
|
12
|
+
>(
|
|
13
|
+
normalizers: TNormalizers,
|
|
14
|
+
getContext: () => TNormalizerContext,
|
|
15
|
+
): ContextualizedNormalizers<TNormalizers> {
|
|
16
|
+
return Object.keys(normalizers).reduce((acc: any, key) => {
|
|
17
|
+
acc[key] = (input: any) => normalizers[key]!(getContext(), input);
|
|
18
|
+
return { ...acc };
|
|
19
|
+
}, {});
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./contextualizedNormalizers";
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import type { Simplify } from "type-fest";
|
|
2
|
+
import type { Maybe, SfCustomer } from "../models";
|
|
3
|
+
|
|
4
|
+
export interface RegisterCustomerExtendedArgs {}
|
|
5
|
+
export interface RegisterCustomerCustomArgs {}
|
|
6
|
+
|
|
7
|
+
export type RegisterCustomerArgs = {
|
|
8
|
+
email: string;
|
|
9
|
+
firstName: string;
|
|
10
|
+
lastName: string;
|
|
11
|
+
password: string;
|
|
12
|
+
//$extended?: RegisterCustomerExtendedArgs;
|
|
13
|
+
//$custom?: RegisterCustomerCustomArgs;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export type RegisterCustomer = (args: Simplify<RegisterCustomerArgs>) => Promise<{
|
|
17
|
+
customer: SfCustomer;
|
|
18
|
+
}>;
|
|
19
|
+
|
|
20
|
+
export interface LoginCustomerExtendedArgs {}
|
|
21
|
+
export interface LoginCustomerCustomArgs {}
|
|
22
|
+
|
|
23
|
+
export type LoginCustomerArgs = {
|
|
24
|
+
email: string;
|
|
25
|
+
password: string;
|
|
26
|
+
//$extended?: LoginCustomerExtendedArgs;
|
|
27
|
+
//$custom?: LoginCustomerCustomArgs;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type LoginCustomer = (args: Simplify<LoginCustomerArgs>) => Promise<{
|
|
31
|
+
customer: SfCustomer;
|
|
32
|
+
}>;
|
|
33
|
+
|
|
34
|
+
export interface GetCustomerExtendedArgs {}
|
|
35
|
+
export interface GetCustomerCustomArgs {}
|
|
36
|
+
|
|
37
|
+
export type GetCustomerArgs = {
|
|
38
|
+
//$extended?: GetCustomerExtendedArgs;
|
|
39
|
+
//$custom?: GetCustomerCustomArgs;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export type GetCustomer = (args?: Simplify<GetCustomerArgs>) => Promise<{
|
|
43
|
+
customer: Maybe<SfCustomer>;
|
|
44
|
+
}>;
|
|
45
|
+
|
|
46
|
+
export interface LogoutCustomerExtendedArgs {}
|
|
47
|
+
export interface LogoutCustomerCustomArgs {}
|
|
48
|
+
|
|
49
|
+
export type LogoutCustomerArgs = {
|
|
50
|
+
//$extended?: LogoutCustomerExtendedArgs;
|
|
51
|
+
//$custom?: LogoutCustomerCustomArgs;
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export type LogoutCustomer = (args?: Simplify<LogoutCustomerArgs>) => Promise<void>;
|
|
55
|
+
|
|
56
|
+
export interface UpdateCustomerExtendedArgs {}
|
|
57
|
+
export interface UpdateCustomerCustomArgs {}
|
|
58
|
+
|
|
59
|
+
export type UpdateCustomerArgs = {
|
|
60
|
+
email?: string;
|
|
61
|
+
firstName?: string;
|
|
62
|
+
lastName?: string;
|
|
63
|
+
//$extended?: UpdateCustomerExtendedArgs;
|
|
64
|
+
//$custom?: UpdateCustomerCustomArgs;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type UpdateCustomer = (args: Simplify<UpdateCustomerArgs>) => Promise<{
|
|
68
|
+
customer: SfCustomer;
|
|
69
|
+
}>;
|
|
70
|
+
|
|
71
|
+
export interface ChangeCustomerPasswordExtendedArgs {}
|
|
72
|
+
export interface ChangeCustomerPasswordCustomArgs {}
|
|
73
|
+
|
|
74
|
+
export type ChangeCustomerPasswordArgs = {
|
|
75
|
+
currentPassword: string;
|
|
76
|
+
// eslint-disable-next-line unicorn/no-keyword-prefix
|
|
77
|
+
newPassword: string;
|
|
78
|
+
confirmPassword: string;
|
|
79
|
+
//$extended?: ChangeCustomerPasswordExtendedArgs;
|
|
80
|
+
//$custom?: ChangeCustomerPasswordCustomArgs;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export type ChangeCustomerPassword = (args: Simplify<ChangeCustomerPasswordArgs>) => Promise<void>;
|