@liquidcommerce/cloud-sdk 1.5.0 → 1.7.0
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/README.md +154 -85
- package/dist/index.cjs +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/liquidcommerce-cloud-sdk.ssr.js +1 -1
- package/dist/types/core/authenticated.service.d.ts +6 -38
- package/dist/types/core/catalog-helper.service.d.ts +18 -5
- package/dist/types/core/checkout-helper.service.d.ts +9 -1
- package/dist/types/core/index.d.ts +3 -0
- package/dist/types/core/order-authenticated.service.d.ts +98 -0
- package/dist/types/core/order-singleton.service.d.ts +62 -0
- package/dist/types/core/payment-session-helper.service.d.ts +12 -0
- package/dist/types/core/singleton.service.d.ts +23 -3
- package/dist/types/core/utils.d.ts +48 -0
- package/dist/types/enums/enums.d.ts +70 -1
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.umd.d.ts +2 -2
- package/dist/types/interfaces/address.interface.d.ts +2 -0
- package/dist/types/interfaces/cart.interface.d.ts +5 -15
- package/dist/types/interfaces/catalog.interface.d.ts +54 -6
- package/dist/types/interfaces/checkout.interface.d.ts +40 -56
- package/dist/types/interfaces/index.d.ts +3 -0
- package/dist/types/interfaces/liquid-commerce-client.interface.d.ts +84 -5
- package/dist/types/interfaces/liquid-commerce-order-client.interface.d.ts +54 -0
- package/dist/types/interfaces/order.interface.d.ts +197 -0
- package/dist/types/interfaces/payment-element.interface.d.ts +88 -0
- package/dist/types/interfaces/payment.interface.d.ts +11 -1
- package/dist/types/interfaces/retailer.interface.d.ts +2 -0
- package/dist/types/interfaces/user.interface.d.ts +13 -11
- package/dist/types/liquid-commerce-order-client.d.ts +19 -0
- package/dist/types/liquid-commerce-payment-element.d.ts +10 -0
- package/dist/types/services/index.d.ts +3 -0
- package/dist/types/services/order.service.d.ts +15 -0
- package/dist/types/services/user.service.d.ts +25 -7
- package/dist/types/services/webhook.service.d.ts +14 -0
- package/dist/types/types.d.ts +9 -0
- package/package.json +4 -4
- package/umd/liquidcommerce-cloud-sdk.min.js +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var LIQUID_COMMERCE_ENV,t,e,r,i,s,o,E,n,a,I,l,d,R,h,N,u,c,T,A,O,S,p=require("@stripe/stripe-js");exports.LIQUID_COMMERCE_ENV=void 0,(LIQUID_COMMERCE_ENV=exports.LIQUID_COMMERCE_ENV||(exports.LIQUID_COMMERCE_ENV={})).LOC="loc",LIQUID_COMMERCE_ENV.STAGE="stage",LIQUID_COMMERCE_ENV.PROD="prod",LIQUID_COMMERCE_ENV.DEV="dev",exports.ENUM_MODALITIES=void 0,(t=exports.ENUM_MODALITIES||(exports.ENUM_MODALITIES={})).ON_DEMAND="onDemand",t.SHIPPING="shipping",exports.DAYS_OF_WEEK=void 0,(e=exports.DAYS_OF_WEEK||(exports.DAYS_OF_WEEK={})).MONDAY="monday",e.TUESDAY="tuesday",e.WEDNESDAY="wednesday",e.THURSDAY="thursday",e.FRIDAY="friday",e.SATURDAY="saturday",e.SUNDAY="sunday",exports.STATES_CODE=void 0,(r=exports.STATES_CODE||(exports.STATES_CODE={})).AL="AL",r.AK="AK",r.AR="AR",r.CA="CA",r.CO="CO",r.CT="CT",r.DE="DE",r.DC="DC",r.FL="FL",r.GA="GA",r.HI="HI",r.ID="ID",r.IL="IL",r.IN="IN",r.IA="IA",r.KS="KS",r.KY="KY",r.LA="LA",r.ME="ME",r.MD="MD",r.MA="MA",r.MI="MI",r.MN="MN",r.MS="MS",r.MO="MO",r.MT="MT",r.NE="NE",r.NV="NV",r.NH="NH",r.NJ="NJ",r.NM="NM",r.NY="NY",r.NC="NC",r.ND="ND",r.OH="OH",r.OK="OK",r.OR="OR",r.PA="PA",r.RI="RI",r.SC="SC",r.SD="SD",r.TN="TN",r.TX="TX",r.UT="UT",r.VT="VT",r.VA="VA",r.WA="WA",r.WV="WV",r.WI="WI",r.WY="WY",exports.STATES_NAME=void 0,(i=exports.STATES_NAME||(exports.STATES_NAME={})).ALABAMA="AL",i.ALASKA="AK",i.ARKANSAS="AR",i.CALIFORNIA="CA",i.COLORADO="CO",i.CONNECTICUT="CT",i.DELAWARE="DE",i.DISTRICT_OF_COLUMBIA="DC",i.FLORIDA="FL",i.GEORGIA="GA",i.HAWAII="HI",i.IDAHO="ID",i.ILLINOIS="IL",i.INDIANA="IN",i.IOWA="IA",i.KANSAS="KS",i.KENTUCKY="KY",i.LOUISIANA="LA",i.MAINE="ME",i.MARYLAND="MD",i.MASSACHUSETTS="MA",i.MICHIGAN="MI",i.MINNESOTA="MN",i.MISSISSIPPI="MS",i.MISSOURI="MO",i.MONTANA="MT",i.NEBRASKA="NE",i.NEVADA="NV",i.NEW_HAMPSHIRE="NH",i.NEW_JERSEY="NJ",i.NEW_MEXICO="NM",i.NEW_YORK="NY",i.NORTH_CAROLINA="NC",i.NORTH_DAKOTA="ND",i.OHIO="OH",i.OKLAHOMA="OK",i.OREGON="OR",i.PENNSYLVANIA="PA",i.RHODE_ISLAND="RI",i.SOUTH_CAROLINA="SC",i.SOUTH_DAKOTA="SD",i.TENNESSEE="TN",i.TEXAS="TX",i.UTAH="UT",i.VERMONT="VT",i.VIRGINIA="VA",i.WASHINGTON="WA",i.WEST_VIRGINIA="WV",i.WISCONSIN="WI",i.WYOMING="WY",exports.ENUM_ENGRAVING=void 0,(s=exports.ENUM_ENGRAVING||(exports.ENUM_ENGRAVING={})).YES="YES",s.NO="NO",exports.ENUM_FILTER_KEYS=void 0,(o=exports.ENUM_FILTER_KEYS||(exports.ENUM_FILTER_KEYS={})).BRANDS="brands",o.FLAVOR="flavor",o.FULFILLMENT="fulfillment",o.TAGS="tags",o.REGION="region",o.VARIETY="variety",o.ENGRAVING="engraving",o.PRICE="price",o.AVAILABILITY="availability",o.CATEGORIES="categories",o.SIZES="sizes",o.COLORS="colors",o.APPELLATION="appellation",o.COUNTRY="country",o.VINTAGE="vintage",o.MATERIALS="materials",o.COLLECTION_TAGS="collectionTags",exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE=void 0,(E=exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE||(exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE={})).ASC="asc",E.DESC="desc",exports.ENUM_ORDER_BY=void 0,(exports.ENUM_ORDER_BY||(exports.ENUM_ORDER_BY={})).PRICE="price",exports.ENUM_AVAILABILITY_VALUE=void 0,(n=exports.ENUM_AVAILABILITY_VALUE||(exports.ENUM_AVAILABILITY_VALUE={})).UNSPECIFIED="AVAILABILITY_UNSPECIFIED",n.IN_STOCK="IN_STOCK",n.OUT_OF_STOCK="OUT_OF_STOCK",n.PREORDER="PREORDER",n.BACKORDER="BACKORDER",exports.CART_PARAM_ERROR_ENUM=void 0,(a=exports.CART_PARAM_ERROR_ENUM||(exports.CART_PARAM_ERROR_ENUM={})).INVALID_ITEMS_TYPE="Items must be a non-empty array",a.INVALID_ITEMS_MAX="You can only send up to 25 items at a time!",a.INVALID_PART_NUMBER="The partnerNumber provided is invalid",a.INVALID_FULFILLMENT_ID="The fulfillmentId provided is invalid",exports.CART_EVENT_ENUM=void 0,(I=exports.CART_EVENT_ENUM||(exports.CART_EVENT_ENUM={})).OOS="OutOfStock",I.ITEMS_NOT_ADDED="ItemsNotAdded",I.ITEMS_REQUESTED_NOT_ADDED="ItemsRequestedNotAdded",I.ITEM_NOT_ENGRAVED="ItemEngravingError",I.ADDRESS_CHANGE="AddressChange",I.LOCATION_AVAILABILITY="LocationAvailability",I.PARTNER_PRODUCT_CONFIGS="PartnerProductConfigs",I.REMOVED_EXISTING_ITEMS="RemovedExistingCartItems",I.RETAILER_MIN="RetailerMinNotMet",I.NO_ITEMS_IN_CART="NoItemsInCart",I.INVALID_ID="InvalidId",I.NO_ID="NoId",I.CART_CHECKOUT_PROCESSED="CartCheckoutProcessed",I.NEW_CART="NewCart",I.DEFAULT="CartError",I.ITEM_QTY_CHANGE="ItemQuantityChange",I.ITEM_ID_NOT_FOUND="ItemIdNotFound",I.ITEMS_REMOVED="ItemsRemoved",exports.ENUM_ADDRESS_TYPE=void 0,(l=exports.ENUM_ADDRESS_TYPE||(exports.ENUM_ADDRESS_TYPE={})).SHIPPING="shipping",l.BILLING="billing",exports.ENUM_CHECKOUT_STATUS_CODE_ERROR=void 0,(d=exports.ENUM_CHECKOUT_STATUS_CODE_ERROR||(exports.ENUM_CHECKOUT_STATUS_CODE_ERROR={}))[d.REQUEST_DEFAULT_ERROR=5480]="REQUEST_DEFAULT_ERROR",d[d.REQUEST_LOCATION_OOS_ERROR=5481]="REQUEST_LOCATION_OOS_ERROR",d[d.REQUEST_LOCATION_MISMATCH_ERROR=5482]="REQUEST_LOCATION_MISMATCH_ERROR",d[d.REQUEST_BIRTHDATE_ERROR=5483]="REQUEST_BIRTHDATE_ERROR",d[d.REQUEST_CART_NOT_AVAILABLE_ERROR=5484]="REQUEST_CART_NOT_AVAILABLE_ERROR",d[d.REQUEST_CART_ID_ERROR=5485]="REQUEST_CART_ID_ERROR",d[d.REQUEST_CART_ITEM_ERROR=5486]="REQUEST_CART_ITEM_ERROR",d[d.REQUEST_VALIDATION_ERROR=5487]="REQUEST_VALIDATION_ERROR",d[d.REQUEST_TAX_ERROR=5488]="REQUEST_TAX_ERROR",d[d.REQUEST_COMPLETE_TOKEN=5489]="REQUEST_COMPLETE_TOKEN",d[d.REQUEST_DEFAULT_COMPLETE_ERROR=5490]="REQUEST_DEFAULT_COMPLETE_ERROR",d[d.REQUEST_CHECKOUT_COMPLETE_UPDATE_ERROR=5491]="REQUEST_CHECKOUT_COMPLETE_UPDATE_ERROR",d[d.REQUEST_CHECKOUT_COMPLETE_SAVE_ERROR=5492]="REQUEST_CHECKOUT_COMPLETE_SAVE_ERROR",d[d.REQUEST_CHECKOUT_HAS_COMPLETE_ERROR=5493]="REQUEST_CHECKOUT_HAS_COMPLETE_ERROR",d[d.REQUEST_NO_CART_ITEM_ERROR=5494]="REQUEST_NO_CART_ITEM_ERROR",d[d.REQUEST_NO_CUSTOMER_FOUND_ERROR=5495]="REQUEST_NO_CUSTOMER_FOUND_ERROR",d[d.REQUEST_PAYMENT_ATTACHED_ERROR=5496]="REQUEST_PAYMENT_ATTACHED_ERROR",d[d.REQUEST_SHIPPING_ADDRESS_ERROR=5497]="REQUEST_SHIPPING_ADDRESS_ERROR",d[d.REQUEST_BILLING_ADDRESS_ERROR=5498]="REQUEST_BILLING_ADDRESS_ERROR",d[d.REQUEST_PAYMENT_NOT_FOUND_ERROR=5499]="REQUEST_PAYMENT_NOT_FOUND_ERROR",d[d.REQUEST_CART_UPDATED_ERROR=5501]="REQUEST_CART_UPDATED_ERROR",d[d.REQUEST_ADDRESS_DEFAULT_ERROR=5502]="REQUEST_ADDRESS_DEFAULT_ERROR",d[d.REQUEST_TIPS_ERROR=5503]="REQUEST_TIPS_ERROR",exports.ENUM_CHECKOUT_STATUS_CODE_MESSAGE=void 0,(R=exports.ENUM_CHECKOUT_STATUS_CODE_MESSAGE||(exports.ENUM_CHECKOUT_STATUS_CODE_MESSAGE={})).REQUEST_DEFAULT_ERROR="There's been an error with your checkout request.",R.REQUEST_LOCATION_OOS_ERROR="The requested items are out of stock at this location.",R.REQUEST_LOCATION_MISMATCH_ERROR="The selected location doesn't match your cart items.",R.REQUEST_BIRTHDATE_ERROR="Please verify your birthdate and try again.",R.REQUEST_CART_NOT_AVAILABLE_ERROR="This cart is no longer available.",R.REQUEST_CART_ID_ERROR="The cartId requested is invalid, check and try again.",R.REQUEST_CART_ITEM_ERROR="There's an issue with one or more items in your cart.",R.REQUEST_VALIDATION_ERROR="There's been an error with your request parameters, check and try again.",R.REQUEST_TAX_ERROR="There was an error calculating tax for your order.",R.REQUEST_COMPLETE_TOKEN="The checkout token provided is invalid, check and try again.",R.REQUEST_DEFAULT_COMPLETE_ERROR="There was an error completing your checkout, confirm through the (prepare) method and try again.",R.REQUEST_CHECKOUT_COMPLETE_UPDATE_ERROR="Unable to update your checkout status.",R.REQUEST_CHECKOUT_COMPLETE_SAVE_ERROR="Unable to save your completed checkout.",R.REQUEST_CHECKOUT_HAS_COMPLETE_ERROR="This checkout has already been processed, create a new cart to process a new checkout.",R.REQUEST_NO_CART_ITEM_ERROR="No items found in your cart.",R.REQUEST_NO_CUSTOMER_FOUND_ERROR="The customer account was not found.",R.REQUEST_PAYMENT_ATTACHED_ERROR="The payment attached to the checkout is not a valid payment method for this customer.",R.REQUEST_SHIPPING_ADDRESS_ERROR="The address in your cart has changed, check and try again.",R.REQUEST_BILLING_ADDRESS_ERROR="The billing address in your checkout is not valid, check and try again.",R.REQUEST_PAYMENT_NOT_FOUND_ERROR="The payment method provided was not found.",R.REQUEST_CART_UPDATED_ERROR="The cart requested was updated during your checkout.",R.REQUEST_ADDRESS_DEFAULT_ERROR="There's been an error with your address configurations in cart and/or billing address, check and try again.",R.REQUEST_TIPS_ERROR="There's been an error applying your tips to the checkout.",exports.ENUM_BEER=void 0,(h=exports.ENUM_BEER||(exports.ENUM_BEER={})).ALE="BEER > ALE",h.LAGER="BEER > LAGER",h.BASE="BEER",h.NON_ALCOHOLIC="BEER > NON-ALCOHOLIC",h.OTHER_BEER="BEER > OTHER",h.OTHER_BEER_SOUR_BEER="BEER > SOUR BEER",h.OTHER_BEER_FLAVORED_BEER="BEER > FLAVORED BEER",h.OTHER_BEER_FRUIT_BEER="BEER > FRUIT BEER",exports.ENUM_FOOD=void 0,(N=exports.ENUM_FOOD||(exports.ENUM_FOOD={})).BASE="FOOD",N.PANTRY_OTHER="FOOD > PANTRY > OTHER",N.CANDY="FOOD > CANDY",N.CANDY_OTHER="FOOD > CANDY > OTHER",N.CBD="FOOD > CBD",N.CBD_OTHER="FOOD > CBD > OTHER",N.CHEESE="FOOD > CHEESE",N.CHEESE_OTHER="FOOD > CHEESE > OTHER",N.HOUSEHOLD="FOOD > HOUSEHOLD",N.HOUSEHOLD_SNACKS="FOOD > HOUSEHOLD > SNACKS",N.HOUSEHOLD_OTHER="FOOD > HOUSEHOLD > OTHER",N.PANTRY="FOOD > PANTRY",N.FRUIT="FOOD > FRUIT",N.OTHER="FOOD > OTHER",N.ICE="FOOD > ICE",N.ICE_CREAM="FOOD > ICE CREAM",N.PARTY_SUPPLIES="FOOD > PARTY SUPPLIES",N.PARTY_SUPPLIES_OTHER="FOOD > PARTY SUPPLIES > OTHER",N.SPIRITS_BASED="FOOD > SPIRITS BASED",N.GARNISHES="FOOD > GARNISHES",exports.ENUM_MERCHANDISE=void 0,(u=exports.ENUM_MERCHANDISE||(exports.ENUM_MERCHANDISE={})).BASE="MERCHANDISE",u.GLASSWARE="MERCHANDISE > GLASSWARE",u.GLASSWARE_OTHER="MERCHANDISE > GLASSWARE > OTHER",u.HUMIDOR="MERCHANDISE > HUMIDOR",u.ACCESSORY="MERCHANDISE > ACCESSORY",u.ACCESSORY_OTHER="MERCHANDISE > ACCESSORY > OTHER",u.GIFT_SET="MERCHANDISE > GIFT SET",u.GIFT_SET_GIFT_BAG="MERCHANDISE > GIFT SET > GIFT BAG",u.GIFT_SET_GIFT_CARD="MERCHANDISE > GIFT SET > GIFT CARD",u.BAR_TOOLS="MERCHANDISE > BAR TOOLS",u.BAR_TOOLS_ICE_BUCKET="MERCHANDISE > BAR TOOLS > ICE BUCKET",u.BAR_TOOLS_OTHER="MERCHANDISE > BAR TOOLS > OTHER",exports.ENUM_MISCELLANEOUS=void 0,(c=exports.ENUM_MISCELLANEOUS||(exports.ENUM_MISCELLANEOUS={})).BASE="MISCELLANEOUS",c.GIFT_CARD="MISCELLANEOUS > GIFT CARDS",c.PROMOTIONAL="MISCELLANEOUS > PROMOTIONAL",c.MEMBERSHIP="MISCELLANEOUS > MEMBERSHIP",exports.ENUM_NON_ALCOHOLIC=void 0,(T=exports.ENUM_NON_ALCOHOLIC||(exports.ENUM_NON_ALCOHOLIC={})).BASE="NON ALCOHOLIC",T.BITTERS="NON ALCOHOLIC > BITTERS",T.COCKTAIL_MIX="NON ALCOHOLIC > COCKTAIL MIX",T.COFFEE="NON ALCOHOLIC > COFFEE",T.ENERGY_DRINKS="NON ALCOHOLIC > ENERGY DRINKS",T.JUICE="NON ALCOHOLIC > JUICE",T.SODA="NON ALCOHOLIC > SODA",T.SPECIALTY_ITEM="NON ALCOHOLIC > SPECIALTY ITEM",T.SPECIALTY_ITEM_OTHER="NON ALCOHOLIC > SPECIALTY ITEM > OTHER",T.SPIRITS="NON ALCOHOLIC > SPIRITS",T.TEA="NON ALCOHOLIC > TEA",T.WATER="NON ALCOHOLIC > WATER",T.WINE="NON ALCOHOLIC > WINE",T.SPORTS_DRINKS="NON ALCOHOLIC > SPORTS DRINKS",T.SLURPEES="NON ALCOHOLIC > SLURPEES",T.GINGER_BEER="NON ALCOHOLIC > GINGER BEER",T.DAIRY="NON ALCOHOLIC > DAIRY",T.DAIRY_OTHER="NON ALCOHOLIC > DAIRY > OTHER",T.OTHER="NON ALCOHOLIC > OTHER",exports.ENUM_READY_TO_DRINK=void 0,(A=exports.ENUM_READY_TO_DRINK||(exports.ENUM_READY_TO_DRINK={})).BASE="READY TO DRINK",A.HARD_CIDER="READY TO DRINK > HARD CIDER",A.HARD_CIDER_PERRY_PEAR_CIDER="READY TO DRINK > HARD CIDER > PERRY (PEAR CIDER)",A.HARD_CIDER_APPLE_CIDER="READY TO DRINK > HARD CIDER > APPLE CIDER",A.HARD_CIDER_OTHER_FRUIT_CIDER="READY TO DRINK > HARD CIDER > FRUIT CIDER",A.HARD_TEA="READY TO DRINK > HARD TEA",A.HARD_SELTZER="READY TO DRINK > HARD SELTZER",A.MALT_BASED="READY TO DRINK > MALT BASED",A.SPIRITS_BASED_RTDS="READY TO DRINK > SPIRITS-BASED RTDS",A.SPIRITS_BASED_RTDS_AGAVE_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > AGAVE COCKTAILS",A.SPIRITS_BASED_RTDS_GIN_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > GIN COCKTAILS",A.SPIRITS_BASED_RTDS_RUM_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > RUM COCKTAILS",A.SPIRITS_BASED_RTDS_TEQUILA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEQUILA COCKTAILS",A.SPIRITS_BASED_RTDS_VODKA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > VODKA COCKTAILS",A.SPIRITS_BASED_RTDS_WHISKEY_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > WHISKEY COCKTAILS",A.SPIRITS_BASED_RTDS_OTHER="READY TO DRINK > SPIRITS-BASED RTDS > OTHER",A.SPIRITS_BASED_RTDS_FROZEN_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > FROZEN COCKTAILS",A.SPIRITS_BASED_RTDS_APERITIF_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > APERITIF COCKTAILS",A.SPIRITS_BASED_RTDS_DESSERT_COFFEE_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > DESSERT & COFFEE COCKTAILS",A.SPIRITS_BASED_RTDS_TEA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEA COCKTAILS",A.WINE_COCKTAILS="READY TO DRINK > WINE COCKTAILS",A.OTHER="READY TO DRINK > OTHER",exports.ENUM_SPIRITS=void 0,(O=exports.ENUM_SPIRITS||(exports.ENUM_SPIRITS={})).BASE="SPIRITS",O.AMARO_APERITIF_VERMOUTH="SPIRITS > AMARO APERITIF & VERMOUTH",O.AMARO_APERITIF_VERMOUTH_OTHER="SPIRITS > AMARO APERITIF & VERMOUTH > OTHER",O.BAIJIU="SPIRITS > BAIJIU",O.BITTERS="SPIRITS > BITTERS",O.BRANDY="SPIRITS > BRANDY",O.BRANDY_COGNAC="SPIRITS > BRANDY > COGNAC",O.CACHACA="SPIRITS > CACHACA",O.GIN="SPIRITS > GIN",O.GIN_DRY_GIN="SPIRITS > GIN > DRY GIN",O.GIN_FLAVORED_GIN="SPIRITS > GIN > FLAVORED GIN",O.GIN_OLD_TOM_GIN="SPIRITS > GIN > OLD TOM GIN",O.GIN_OTHER="SPIRITS > GIN > OTHER",O.GRAIN_ALCOHOL="SPIRITS > GRAIN ALCOHOL",O.LIQUEUR="SPIRITS > LIQUEUR",O.MEZCAL="SPIRITS > MEZCAL",O.OTHER_SPIRITS="SPIRITS > OTHER SPIRITS",O.RUM="SPIRITS > RUM",O.RUM_AGED_RUM="SPIRITS > RUM > AGED RUM",O.RUM_DARK_RUM="SPIRITS > RUM > DARK RUM",O.RUM_FLAVORED_RUM="SPIRITS > RUM > FLAVORED RUM",O.RUM_GOLD_RUM="SPIRITS > RUM > GOLD RUM",O.RUM_OTHER="SPIRITS > RUM > OTHER",O.RUM_SPICED="SPIRITS > RUM > SPICED",O.RUM_WHITE_RUM="SPIRITS > RUM > WHITE RUM",O.SHOCHU="SPIRITS > SHOCHU",O.SOJU="SPIRITS > SOJU",O.SOTOL="SPIRITS > SOTOL",O.TEQUILA="SPIRITS > TEQUILA",O.TEQUILA_ANEJO="SPIRITS > TEQUILA > AÑEJO",O.TEQUILA_BLANCO="SPIRITS > TEQUILA > BLANCO",O.TEQUILA_CRISTALINO="SPIRITS > TEQUILA > CRISTALINO",O.TEQUILA_EXTRA_ANEJO="SPIRITS > TEQUILA > EXTRA AÑEJO",O.TEQUILA_OTHER="SPIRITS > TEQUILA > OTHER",O.TEQUILA_REPOSADO="SPIRITS > TEQUILA > REPOSADO",O.VODKA="SPIRITS > VODKA",O.VODKA_FLAVORED_VODKA="SPIRITS > VODKA > FLAVORED VODKA",O.VODKA_OTHER="SPIRITS > VODKA > OTHER",O.VODKA_REGULAR_VODKA="SPIRITS > VODKA > REGULAR VODKA",O.WHISKEY="SPIRITS > WHISKEY",O.WHISKEY_AMERICAN_WHISKEY="SPIRITS > WHISKEY > AMERICAN WHISKEY",O.WHISKEY_BOURBON="SPIRITS > WHISKEY > BOURBON",O.WHISKEY_CANADIAN_WHISKEY="SPIRITS > WHISKEY > CANADIAN WHISKEY",O.WHISKEY_IRISH_WHISKEY="SPIRITS > WHISKEY > IRISH WHISKEY",O.WHISKEY_MOONSHINE="SPIRITS > WHISKEY > MOONSHINE",O.WHISKEY_FLAVORED="SPIRITS > WHISKEY > FLAVORED WHISKEY",O.WHISKEY_OTHER="SPIRITS > WHISKEY > OTHER",O.WHISKEY_SCOTCH="SPIRITS > WHISKEY > SCOTCH",exports.ENUM_WINE=void 0,(S=exports.ENUM_WINE||(exports.ENUM_WINE={})).BASE="WINE",S.CHAMPAGNE_SPARKLING="WINE > CHAMPAGNE & SPARKLING",S.CHAMPAGNE_SPARKLING_CAVA="WINE > CHAMPAGNE & SPARKLING > CAVA",S.CHAMPAGNE_SPARKLING_CHAMPAGNE="WINE > CHAMPAGNE & SPARKLING > CHAMPAGNE",S.CHAMPAGNE_SPARKLING_PROSECCO="WINE > CHAMPAGNE & SPARKLING > PROSECCO",S.CHAMPAGNE_SPARKLING_SPARKLING_WINE="WINE > CHAMPAGNE & SPARKLING > SPARKLING WINE",S.CHAMPAGNE_SPARKLING_OTHER="WINE > CHAMPAGNE & SPARKLING > OTHER",S.COOKING="WINE > COOKING",S.DESSERT_FORTIFIED_WINE="WINE > DESSERT & FORTIFIED WINE",S.DESSERT_FORTIFIED_WINE_MEAD="WINE > DESSERT & FORTIFIED WINE > MEAD",S.DESSERT_FORTIFIED_WINE_PORT="WINE > DESSERT & FORTIFIED WINE > PORT",S.DESSERT_FORTIFIED_WINE_SHERRY="WINE > DESSERT & FORTIFIED WINE > SHERRY",S.DESSERT_FORTIFIED_WINE_OTHER="WINE > DESSERT & FORTIFIED WINE > OTHER",S.RED_WINE="WINE > RED WINE",S.RED_WINE_AGIORGITIKO="WINE > RED WINE > AGIORGITIKO",S.RED_WINE_AGLIANICO="WINE > RED WINE > AGLIANICO",S.RED_WINE_ALICANTE_BOUSCHET="WINE > RED WINE > ALICANTE BOUSCHET",S.RED_WINE_BARBERA="WINE > RED WINE > BARBERA",S.RED_WINE_BARBARESCO="WINE > RED WINE > BARBARESCO",S.RED_WINE_BAROLO="WINE > RED WINE > BAROLO",S.RED_WINE_BEAUJOLAIS="WINE > RED WINE > BEAUJOLAIS",S.RED_WINE_BLAUER_ZWEIGELT="WINE > RED WINE > BLAUER ZWEIGELT",S.RED_WINE_BOBAL="WINE > RED WINE > BOBAL",S.RED_WINE_BONARDA="WINE > RED WINE > BONARDA",S.RED_WINE_BORDEAUX="WINE > RED WINE > BORDEAUX",S.RED_WINE_BORDEAUX_BLEND="WINE > RED WINE > BORDEAUX BLEND",S.RED_WINE_BURGUNDY="WINE > RED WINE > BURGUNDY",S.RED_WINE_CABERNET_FRANC="WINE > RED WINE > CABERNET FRANC",S.RED_WINE_CABERNET_SAUVIGNON="WINE > RED WINE > CABERNET SAUVIGNON",S.RED_WINE_CANNONAU="WINE > RED WINE > CANNONAU",S.RED_WINE_CARMENERE="WINE > RED WINE > CARMENERE",S.RED_WINE_CHAMBOURCIN="WINE > RED WINE > CHAMBOURCIN",S.RED_WINE_CHIANTI="WINE > RED WINE > CHIANTI",S.RED_WINE_CINSAULT="WINE > RED WINE > CINSAULT",S.RED_WINE_CORVINA="WINE > RED WINE > CORVINA",S.RED_WINE_DOLCETTO="WINE > RED WINE > DOLCETTO",S.RED_WINE_DORNFELDER="WINE > RED WINE > DORNFELDER",S.RED_WINE_FETEASCA_NEAGRA="WINE > RED WINE > FETEASCA NEAGRA",S.RED_WINE_GAMAY="WINE > RED WINE > GAMAY",S.RED_WINE_GRACIANO="WINE > RED WINE > GRACIANO",S.RED_WINE_GRENACHE="WINE > RED WINE > GRENACHE",S.RED_WINE_LIMNIO="WINE > RED WINE > LIMNIO",S.RED_WINE_MACABEO="WINE > RED WINE > MACABEO",S.RED_WINE_MALBEC="WINE > RED WINE > MALBEC",S.RED_WINE_MENCIA="WINE > RED WINE > MENCIA",S.RED_WINE_MERLOT="WINE > RED WINE > MERLOT",S.RED_WINE_MONICA="WINE > RED WINE > MONICA",S.RED_WINE_MONTEPULCIANO="WINE > RED WINE > MONTEPULCIANO",S.RED_WINE_MOURVEDRE_MONASTRELL="WINE > RED WINE > MOURVEDRE/MONASTRELL",S.RED_WINE_NEBBIOLO="WINE > RED WINE > NEBBIOLO",S.RED_WINE_NEGROAMARO="WINE > RED WINE > NEGROAMARO",S.RED_WINE_NERELLO_MASCALESE="WINE > RED WINE > NERELLO MASCALESE",S.RED_WINE_NERO_DAVOLA="WINE > RED WINE > NERO D'AVOLA",S.RED_WINE_PETIT_VERDOT="WINE > RED WINE > PETIT VERDOT",S.RED_WINE_PETITE_SIRAH="WINE > RED WINE > PETITE SIRAH",S.RED_WINE_PINOT_NOIR="WINE > RED WINE > PINOT NOIR",S.RED_WINE_PINOTAGE="WINE > RED WINE > PINOTAGE",S.RED_WINE_PRIMITIVO="WINE > RED WINE > PRIMITIVO",S.RED_WINE_RED_BLEND="WINE > RED WINE > RED BLEND",S.RED_WINE_RHONE_BLEND="WINE > RED WINE > RHONE BLEND",S.RED_WINE_RIOJA="WINE > RED WINE > RIOJA",S.RED_WINE_SAGRANTINO="WINE > RED WINE > SAGRANTINO",S.RED_WINE_SANGIOVESE="WINE > RED WINE > SANGIOVESE",S.RED_WINE_SAPERAVI="WINE > RED WINE > SAPERAVI",S.RED_WINE_SCHIAVA_TROLLINGER="WINE > RED WINE > SCHIAVA/TROLLINGER",S.RED_WINE_SYRAH_SHIRAZ="WINE > RED WINE > SYRAH/SHIRAZ",S.RED_WINE_TANNAT="WINE > RED WINE > TANNAT",S.RED_WINE_TEMPRANILLO="WINE > RED WINE > TEMPRANILLO",S.RED_WINE_TEROLDEGO="WINE > RED WINE > TEROLDEGO",S.RED_WINE_TINTA_DEL_TORO="WINE > RED WINE > TINTA DEL TORO",S.RED_WINE_TOURIGA_NACIONAL="WINE > RED WINE > TOURIGA NACIONAL",S.RED_WINE_VALPOLICELLA="WINE > RED WINE > VALPOLICELLA",S.RED_WINE_XINOMAVRO="WINE > RED WINE > XINOMAVRO",S.RED_WINE_ZINFANDEL="WINE > RED WINE > ZINFANDEL",S.RED_WINE_ZWEIGELT="WINE > RED WINE > ZWEIGELT",S.RED_WINE_OTHER="WINE > RED WINE > OTHER",S.ROSE_WINE="WINE > ROSE WINE",S.SAKE="WINE > SAKE",S.WHITE_WINE="WINE > WHITE WINE",S.WHITE_WINE_ALBARINO_ALVARINHO="WINE > WHITE WINE > ALBARINO/ALVARINHO",S.WHITE_WINE_ARNEIS="WINE > WHITE WINE > ARNEIS",S.WHITE_WINE_ASTI="WINE > WHITE WINE > ASTI",S.WHITE_WINE_ASSYRTIKO="WINE > WHITE WINE > ASSYRTIKO",S.WHITE_WINE_BURGUNDY="WINE > WHITE WINE > BURGUNDY",S.WHITE_WINE_CARRICANTE="WINE > WHITE WINE > CARRICANTE",S.WHITE_WINE_CATARRATTO="WINE > WHITE WINE > CATARRATTO",S.WHITE_WINE_CHABLIS="WINE > WHITE WINE > CHABLIS",S.WHITE_WINE_CHARDONNAY="WINE > WHITE WINE > CHARDONNAY",S.WHITE_WINE_CHENIN_BLANC="WINE > WHITE WINE > CHENIN BLANC",S.WHITE_WINE_CORTESE="WINE > WHITE WINE > CORTESE",S.WHITE_WINE_FALANGHINA="WINE > WHITE WINE > FALANGHINA",S.WHITE_WINE_FIANO="WINE > WHITE WINE > FIANO",S.WHITE_WINE_FRIULANO="WINE > WHITE WINE > FRIULANO",S.WHITE_WINE_FURMINT="WINE > WHITE WINE > FURMINT",S.WHITE_WINE_GARGANEGA="WINE > WHITE WINE > GARGANEGA",S.WHITE_WINE_GAVI="WINE > WHITE WINE > GAVI",S.WHITE_WINE_GEWURZTRAMINER="WINE > WHITE WINE > GEWURZTRAMINER",S.WHITE_WINE_GRECO_DI_TUFO="WINE > WHITE WINE > GRECO DI TUFO",S.WHITE_WINE_GRENACHE_BLANC="WINE > WHITE WINE > GRENACHE BLANC",S.WHITE_WINE_GRUNER_VELTLINER="WINE > WHITE WINE > GRUNER VELTLINER",S.WHITE_WINE_HUXELREBE="WINE > WHITE WINE > HUXELREBE",S.WHITE_WINE_INZOLIA="WINE > WHITE WINE > INZOLIA",S.WHITE_WINE_MALVASIA="WINE > WHITE WINE > MALVASIA",S.WHITE_WINE_MELON_DE_BOURGOGNE="WINE > WHITE WINE > MELON DE BOURGOGNE",S.WHITE_WINE_MOSCATO_BIANCO="WINE > WHITE WINE > MOSCATO BIANCO",S.WHITE_WINE_MOSCHOFILERO_FILERI="WINE > WHITE WINE > MOSCHOFILERO/FILERI",S.WHITE_WINE_MULLER_THURGAU_RIVANER="WINE > WHITE WINE > MULLER-THURGAU/RIVANER",S.WHITE_WINE_MUSCAT_MOSCATO="WINE > WHITE WINE > MUSCAT/MOSCATO",S.WHITE_WINE_PECORINO="WINE > WHITE WINE > PECORINO",S.WHITE_WINE_PICPOUL="WINE > WHITE WINE > PICPOUL",S.WHITE_WINE_PINOT_BLANC="WINE > WHITE WINE > PINOT BLANC",S.WHITE_WINE_PINOT_GRIGIO_PINOT_GRIS="WINE > WHITE WINE > PINOT GRIGIO/PINOT GRIS",S.WHITE_WINE_POUILLY_FUISSE="WINE > WHITE WINE > POUILLY-FUISSE",S.WHITE_WINE_POUILLY_FUME="WINE > WHITE WINE > POUILLY-FUME",S.WHITE_WINE_RIESLING="WINE > WHITE WINE > RIESLING",S.WHITE_WINE_RIOJA="WINE > WHITE WINE > RIOJA",S.WHITE_WINE_RODITIS="WINE > WHITE WINE > RODITIS",S.WHITE_WINE_SANCERRE="WINE > WHITE WINE > SANCERRE",S.WHITE_WINE_SAUVIGNON_BLANC="WINE > WHITE WINE > SAUVIGNON BLANC",S.WHITE_WINE_SEMILLON="WINE > WHITE WINE > SEMILLON",S.WHITE_WINE_SOAVE="WINE > WHITE WINE > SOAVE",S.WHITE_WINE_SYLVANER="WINE > WHITE WINE > SYLVANER",S.WHITE_WINE_TORRONTES="WINE > WHITE WINE > TORRONTES",S.WHITE_WINE_TREBBIANO_UGNI_BLANC="WINE > WHITE WINE > TREBBIANO/UGNI BLANC",S.WHITE_WINE_TURBIANA="WINE > WHITE WINE > TURBIANA",S.WHITE_WINE_TXAKOLINA="WINE > WHITE WINE > TXAKOLINA",S.WHITE_WINE_VERDEJO="WINE > WHITE WINE > VERDEJO",S.WHITE_WINE_VERDICCHIO="WINE > WHITE WINE > VERDICCHIO",S.WHITE_WINE_VERMENTINO="WINE > WHITE WINE > VERMENTINO",S.WHITE_WINE_VERNACCIA="WINE > WHITE WINE > VERNACCIA",S.WHITE_WINE_VIDIANO="WINE > WHITE WINE > VIDIANO",S.WHITE_WINE_VINHO_VERDE="WINE > WHITE WINE > VINHO VERDE",S.WHITE_WINE_VIOGNIER="WINE > WHITE WINE > VIOGNIER",S.WHITE_WINE_VIURA="WINE > WHITE WINE > VIURA",S.WHITE_WINE_OTHER="WINE > WHITE WINE > OTHER",S.WINE_OTHER="WINE > OTHER";const W={[exports.LIQUID_COMMERCE_ENV.LOC]:"https://dev.api.liquidcommerce.cloud",[exports.LIQUID_COMMERCE_ENV.DEV]:"https://dev.api.liquidcommerce.cloud",[exports.LIQUID_COMMERCE_ENV.STAGE]:"https://staging.api.liquidcommerce.cloud",[exports.LIQUID_COMMERCE_ENV.PROD]:"https://api.liquidcommerce.cloud"};class v{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=!1,this.xhrFetch=(t,e)=>new Promise(((r,i)=>{const s=new XMLHttpRequest;s.open(e.method||"GET",t),Object.entries(e.headers).forEach((([t,e])=>{s.setRequestHeader(t,e)})),s.onload=()=>{r({ok:s.status>=200&&s.status<300,status:s.status,statusText:s.statusText,headers:s.getAllResponseHeaders().split("\r\n").reduce(((t,e)=>{const[r,i]=e.split(": ");return r&&(t[r]=i),t}),{}),json:()=>Promise.resolve(JSON.parse(s.responseText)),text:()=>Promise.resolve(s.responseText)})},s.onerror=()=>{i(new TypeError("Network request failed"))},s.send(e.body)})),this.apiKey=t.apiKey,this.baseURL=t.baseURL,this.httpClient=this.getFetchImplementation()}static getInstance(t){return v.instance||(v.instance=new v(t)),v.instance}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):this.xhrFetch}fetchAdapter(t){return async(e,r)=>{var i;const s=await t(e,r);let o;return"function"==typeof(null===(i=s.headers)||void 0===i?void 0:i.entries)?o=Object.fromEntries(s.headers.entries()):(o={},s.headers.forEach(((t,e)=>{o[e]=t}))),{ok:s.ok,status:s.status,statusText:s.statusText,headers:o,json:()=>s.json(),text:()=>s.text()}}}getUniqueKey(){return`${this.apiKey}_${this.baseURL}`}async authenticate(){var t,e;if(this.isAuthenticating)await new Promise((t=>{const e=()=>{this.isAuthenticating?setTimeout(e,100):t(void 0)};e()}));else{this.isAuthenticating=!0;try{const r=await this.requestWithoutAuth("/authentication",{method:"GET"});this.accessToken=null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.token,this.tokenExpiration=Date.now()+1e3*(null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.exp)}catch(t){throw new Error("Failed to authenticate with LiquidCommerce API")}finally{this.isAuthenticating=!1}}}async requestWithoutAuth(t,e){const r=new URL(`api${t}`,this.baseURL),i={"Content-Type":"application/json","X-LIQUID-API-KEY":this.apiKey,...e.headers},s={method:e.method,headers:i,body:e.body?JSON.stringify(e.body):void 0},o=await this.httpClient(r.toString(),s);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}async request(t,e){this.accessToken&&!this.isTokenExpired()||await this.authenticate();const r=new URL(`api${t}`,this.baseURL),i={"Content-Type":"application/json","X-LIQUID-API-KEY":this.apiKey,Authorization:`Bearer ${this.accessToken}`,...e.headers},s={method:e.method,headers:i,body:e.body?JSON.stringify(e.body):void 0},o=await this.httpClient(r.toString(),s);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}async get(t,e){return this.request(t,{method:"GET",headers:e})}async post(t,e,r){return this.request(t,{method:"POST",body:e,headers:r})}async put(t,e,r){return this.request(t,{method:"PUT",body:e,headers:r})}async delete(t,e){return this.request(t,{method:"DELETE",headers:e})}}v.instance=null;class D{constructor(t){this.locationHelperService=t}validateAndNormalizeParams(t){const e={...t};return e.id=this.validateId(e.id),e.items=this.validateAndNormalizeItems(e.items),this.locationHelperService.validateAndNormalizeLocation(e.loc),e.refresh=Boolean(e.refresh),e}validateId(t){return t&&"string"==typeof t&&0!==t.trim().length?t.trim():""}validateAndNormalizeItems(t){if(!Array.isArray(t)||0===t.length)throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_ITEMS_TYPE);if(t.length>25)throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_ITEMS_MAX);return t.map((t=>this.validateAndNormalizeItem(t)))}validateAndNormalizeItem(t){const e={...t};if(!this.validatePartNumber(e.partNumber))throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_PART_NUMBER);if(!e.fulfillmentId||"string"!=typeof e.fulfillmentId||0===e.fulfillmentId.trim().length)throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_FULFILLMENT_ID);return e.quantity=Math.max(0,Math.floor(e.quantity)),e.engravingLines&&(e.engravingLines=e.engravingLines.map((t=>t.trim())).filter((t=>t.length>0))),e}validatePartNumber(t){if(!t||"string"!=typeof t)return!1;const e=t.split("_");return 2===e.length&&14===e[0].length&&e[1].length>0}}class C{constructor(t){this.locationServiceHelper=t,this.taxonomyValues=new Set([...Object.values(exports.ENUM_BEER),...Object.values(exports.ENUM_FOOD),...Object.values(exports.ENUM_MERCHANDISE),...Object.values(exports.ENUM_NON_ALCOHOLIC),...Object.values(exports.ENUM_READY_TO_DRINK),...Object.values(exports.ENUM_SPIRITS),...Object.values(exports.ENUM_WINE),...Object.values(exports.ENUM_MISCELLANEOUS)])}validateAndNormalizeParams(t){var e,r,i,s,o,E,n,a,I;const l={...t},d=null!==(e=null==l?void 0:l.upcs)&&void 0!==e?e:[],R=null!==(r=null==l?void 0:l.grouping)&&void 0!==r?r:[],h=null!==(i=null==l?void 0:l.ids)&&void 0!==i?i:[];if([d,R,h].every((t=>this.validateIdsExist(t))))throw new Error("Product identifiers must be a non-empty array of strings");return d.length>0&&(this.validateIds(null!==(s=null==l?void 0:l.upcs)&&void 0!==s?s:[]),l.upcs=d),R.length>0&&(this.validateIds(null!==(o=null==l?void 0:l.grouping)&&void 0!==o?o:[]),l.grouping=R),h.length>0&&(this.validateIds(null!==(E=null==l?void 0:l.ids)&&void 0!==E?E:[]),l.ids=h),this.validateIds(null!==(I=null!==(a=null!==(n=null==l?void 0:l.upcs)&&void 0!==n?n:null==l?void 0:l.grouping)&&void 0!==a?a:null==l?void 0:l.ids)&&void 0!==I?I:[]),this.locationServiceHelper.validateAndNormalizeLocation(l.loc),l}validateAndNormalizeSearchParams(t){const e=[],r={...t};return this.validateOrderBy(r.orderBy,e),this.validateOrderDirection(r.orderDirection,e),this.validateFilters(r.filters,e),this.validatePagination(r.page,r.perPage,e),this.locationServiceHelper.validateAndNormalizeLocation(r.loc),e.length>0?{...r,error:e.join(". ")}:r}validateIds(t){if(!t.every((t=>"string"==typeof t&&t.trim().length>0)))throw new Error("All product identifiers must be non-empty strings")}validateIdsExist(t){return!Array.isArray(t)||0===t.length}validateOrderBy(t,e){t&&!Object.values(exports.ENUM_ORDER_BY).includes(t)&&e.push(`Invalid orderBy value: ${t}`)}validateOrderDirection(t,e){t&&!Object.values(exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE).includes(t)&&e.push(`Invalid orderDirection value: ${t}`)}validateFilters(t,e){t&&(t.length>10&&e.push("Maximum of 10 filters allowed"),t.forEach((t=>{switch(Object.values(exports.ENUM_FILTER_KEYS).includes(t.key)||e.push(`Invalid filter key: ${t.key}`),t.key){case exports.ENUM_FILTER_KEYS.AVAILABILITY:this.validateAvailabilityFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.FULFILLMENT:this.validateFulfillmentFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.ENGRAVING:this.validateEngravingFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.CATEGORIES:this.validateCategoriesFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.BRANDS:this.validateArrayFilter(t.values,75,"brands",e);break;case exports.ENUM_FILTER_KEYS.FLAVOR:this.validateArrayFilter(t.values,25,"flavor",e);break;case exports.ENUM_FILTER_KEYS.REGION:this.validateArrayFilter(t.values,25,"region",e);break;case exports.ENUM_FILTER_KEYS.VARIETY:this.validateArrayFilter(t.values,25,"variety",e);break;case exports.ENUM_FILTER_KEYS.SIZES:this.validateArrayFilter(t.values,25,"sizes",e);break;case exports.ENUM_FILTER_KEYS.APPELLATION:this.validateArrayFilter(t.values,25,"appellation",e);break;case exports.ENUM_FILTER_KEYS.COUNTRY:this.validateArrayFilter(t.values,25,"country",e);break;case exports.ENUM_FILTER_KEYS.VINTAGE:this.validateArrayFilter(t.values,25,"vintage",e);break;case exports.ENUM_FILTER_KEYS.MATERIALS:this.validateArrayFilter(t.values,25,"materials",e);break;case exports.ENUM_FILTER_KEYS.COLORS:this.validateArrayFilter(t.values,25,"colors",e);break;case exports.ENUM_FILTER_KEYS.TAGS:this.validateArrayFilter(t.values,25,"tags",e)}})))}validateAvailabilityFilter(t,e){Object.values(exports.ENUM_AVAILABILITY_VALUE).includes(t)||e.push(`Invalid availability value: ${t}`)}validateFulfillmentFilter(t,e){if(!Array.isArray(t))return void e.push("Fulfillment filter must be an array");const r=Object.values(exports.ENUM_MODALITIES);t.forEach((t=>{r.includes(t)||e.push(`Invalid fulfillment value: ${t}`)}))}validateEngravingFilter(t,e){Object.values(exports.ENUM_ENGRAVING).includes(t)||e.push(`Invalid availability value: ${t}`)}validateArrayFilter(t,e,r,i){Array.isArray(t)?t.length>e&&i.push(`${r} filter can have a maximum of ${e} values`):i.push(`${r} filter must be an array`)}validateCategoriesFilter(t,e){Array.isArray(t)?t.every((t=>this.taxonomyValues.has(t)))||e.push("Invalid category value(s) in categories filter"):e.push("Categories filter must be an array")}validatePagination(t,e,r){void 0!==t&&("number"!=typeof t||t<0)&&r.push("Page must be a non-negative number"),void 0!==e&&("number"!=typeof e||e<=0)&&r.push("PerPage must be a positive number")}}class y{constructor(t){this.locationHelperService=t}validateAndNormalizePrepareParams(t){var e,r,i,s,o,E,n,a,I,l,d,R,h,N,u,c,T,A,O,S,p,W,v,D,C;let y={...t};if(!(null==y?void 0:y.cartId)||"string"!=typeof(null==y?void 0:y.cartId))throw new Error("Invalid cartId");return this.validateCustomer(y.customer),this.validateCustomer(y.recipient),(null==y?void 0:y.billingAddress)&&this.validateBillingAddress(y.billingAddress),y.hasAgeVerify=Boolean(null!==(o=null!==(i=null!==(e=null==y?void 0:y.hasAgeVerify)&&void 0!==e?e:null===(r=null==y?void 0:y.customer)||void 0===r?void 0:r.hasAgeVerify)&&void 0!==i?i:null===(s=null==y?void 0:y.recipient)||void 0===s?void 0:s.hasAgeVerify)&&void 0!==o&&o),y.hasSubstitutionPolicy=Boolean(null==y?void 0:y.hasSubstitutionPolicy),y.acceptedAccountCreation=Boolean(null==y?void 0:y.acceptedAccountCreation),y.isGift=Boolean(null==y?void 0:y.isGift),y.billingSameAsShipping=Boolean(null==y?void 0:y.billingSameAsShipping),y&&(null==y?void 0:y.billingAddress)&&""!==(null===(E=null==y?void 0:y.billingAddress)||void 0===E?void 0:E.phone)&&(y={...y,billingAddress:{...null!==(n=null==y?void 0:y.billingAddress)&&void 0!==n?n:{},phone:null!==(I=this.formatPhoneNumber(null===(a=y.billingAddress)||void 0===a?void 0:a.phone))&&void 0!==I?I:""}}),y&&(null==y?void 0:y.customer)&&""!==(null===(l=null==y?void 0:y.customer)||void 0===l?void 0:l.phone)&&(y={...y,customer:{...null!==(d=null==y?void 0:y.customer)&&void 0!==d?d:{},phone:null!==(h=this.formatPhoneNumber(null===(R=null==y?void 0:y.customer)||void 0===R?void 0:R.phone))&&void 0!==h?h:""}}),y&&(null==y?void 0:y.recipient)&&""!==(null===(N=null==y?void 0:y.recipient)||void 0===N?void 0:N.phone)&&(y={...y,customer:{...null!==(u=null==y?void 0:y.recipient)&&void 0!==u?u:{},phone:null!==(T=this.formatPhoneNumber(null===(c=null==y?void 0:y.recipient)||void 0===c?void 0:c.phone))&&void 0!==T?T:""}}),(null==y?void 0:y.isGift)&&(this.validateGiftOptions(y.giftOptions),y&&(null==y?void 0:y.giftOptions)&&""!==(null===(O=null===(A=null==y?void 0:y.giftOptions)||void 0===A?void 0:A.recipient)||void 0===O?void 0:O.phone)&&(y={...y,giftOptions:{...null!==(S=null==y?void 0:y.giftOptions)&&void 0!==S?S:{},recipient:{...null!==(W=null===(p=null==y?void 0:y.giftOptions)||void 0===p?void 0:p.recipient)&&void 0!==W?W:{},phone:null!==(C=this.formatPhoneNumber(null===(D=null===(v=y.giftOptions)||void 0===v?void 0:v.recipient)||void 0===D?void 0:D.phone))&&void 0!==C?C:""}}})),this.validateMarketingPreferences(y.marketingPreferences),(null==y?void 0:y.deliveryTips)&&this.validateDeliveryTips(y.deliveryTips),(null==y?void 0:y.refresh)&&(y.refresh=Boolean(y.refresh)),y}validateAndNormalizeCompleteParams(t){const e={...t};if(!e.token||"string"!=typeof(null==e?void 0:e.token))throw new Error("Invalid token");if(!(null==e?void 0:e.payment)||"string"!=typeof(null==e?void 0:e.payment))throw new Error("Invalid payment token");return void 0!==e.refresh&&(e.refresh=Boolean(e.refresh)),e}validateCustomer(t){if(t&&"object"==typeof t){const{firstName:e,lastName:r,phone:i,email:s}=t;if(e&&"string"!=typeof e)throw new Error("Invalid customer first name");if(r&&"string"!=typeof r)throw new Error("Invalid customer last name");if(i&&"string"!=typeof i)throw new Error("Invalid customer phone");if(s&&"string"!=typeof s)throw new Error("Invalid customer email");"hasAgeVerify"in t&&(t.hasAgeVerify=Boolean(t.hasAgeVerify))}}validateBillingAddress(t){if(!t)return{};if("object"!=typeof t||null===t)throw new Error("Invalid address: must be an object if provided");const e={...t};return["one","two","city","state","zip","country","firstName","lastName","email","phone","company"].forEach((t=>{if(t in e&&"string"!=typeof e[t])throw new Error(`Invalid billing address ${t}: must be a string if provided`)})),"state"in e&&e.state&&(e.state=this.locationHelperService.normalizeState(e.state)),e}validateGiftOptions(t){if(void 0!==t&&"object"!=typeof t)throw new Error("Invalid giftOptions: must be an object if provided");if(t){if("message"in t&&"string"!=typeof t.message)throw new Error("Invalid gift message: must be a string if provided");if("recipient"in t){if("object"!=typeof t.recipient)throw new Error("Invalid gift recipient: must be an object if provided");const{name:e,phone:r,email:i}=t.recipient;if("name"in t.recipient&&"string"!=typeof e)throw new Error("Invalid gift recipient name: must be a string if provided");if("phone"in t.recipient&&"string"!=typeof r)throw new Error("Invalid gift recipient phone: must be a string if provided");if("email"in t.recipient&&"string"!=typeof i)throw new Error("Invalid gift recipient email: must be a string if provided")}}}formatPhoneNumber(t){if(!t)return null;const e=t.replace(/[\s().\-_]/g,"").replace(/[^\d+]/g,"");if(e.startsWith("+1")){const t=e.substring(2);if(10===t.length)return`(${t.substring(0,3)}) ${t.substring(3,6)}-${t.substring(6)}`}if(11===e.length&&e.startsWith("1")){const t=e.substring(1);return`(${t.substring(0,3)}) ${t.substring(3,6)}-${t.substring(6)}`}return 10===e.length?`(${e.substring(0,3)}) ${e.substring(3,6)}-${e.substring(6)}`:e.startsWith("+")?e:t}validateMarketingPreferences(t){if(void 0!==t&&"object"!=typeof t)throw new Error("Invalid marketingPreferences: must be an object if provided");t&&("canEmail"in t&&(t.canEmail=Boolean(t.canEmail)),"canSms"in t&&(t.canSms=Boolean(t.canSms)))}validateDeliveryTips(t){if(!Array.isArray(t))throw new Error("Invalid deliveryTips");t.forEach((t=>{if(!t.fulfillmentId||"string"!=typeof t.fulfillmentId)throw new Error("Invalid fulfillmentId in deliveryTip");if("number"!=typeof t.tip||t.tip<0)throw new Error("Invalid tip amount in deliveryTip")}))}}class m{validateAndNormalizeLocation(t){if(!t)return;if("object"!=typeof t)throw new Error("Location must be a valid object");const{coords:e,address:r}=t;e?this.validateCoordinates(e):r&&this.validateAndNormalizeAddress(r)}validateCoordinates(t){if("number"!=typeof t.lat||"number"!=typeof t.long)throw new Error("Coordinates must be valid numbers");if(t.lat<-90||t.lat>90||t.long<-180||t.long>180)throw new Error("Coordinates are out of valid range")}validateAndNormalizeAddress(t){if(!(null==t?void 0:t.state)||"string"!=typeof(null==t?void 0:t.state))throw new Error("State is required and must be a string");if(t.state=this.normalizeState(t.state),!t.city||"string"!=typeof t.city)throw new Error("City is required and must be a string");if(!t.zip||"string"!=typeof t.zip)throw new Error("ZIP code is required and must be a string")}normalizeState(t){const e=t.toUpperCase();if(exports.STATES_CODE[e])return exports.STATES_CODE[e];const r=t.toUpperCase();if(exports.STATES_NAME[r])return exports.STATES_NAME[r];throw new Error(`Invalid state: ${t}`)}}class w{constructor(t){this.client=t,this.stripe=null,this.elements=null,this.paymentElement=null,this.events=["ready","change","loaderror","loaderstart"],this.eventsErrorMsg="The only Payment Element events allowed (change, ready, loaderstart, loadererror)",this.clientSecret=null}async mount(t){if(!document.getElementById(t.elementId))throw new Error(`Element with id "${t.elementId}" not found`);try{this.stripe=await p.loadStripe(t.key)}catch(t){throw new Error("Failed to initialize Stripe")}if(!this.stripe)throw new Error("Failed to initialize Stripe");this.clientSecret=t.clientSecret;try{const{setupIntent:t}=await this.stripe.retrieveSetupIntent(this.clientSecret);if("succeeded"===(null==t?void 0:t.status))throw new Error(`The client secret (${this.clientSecret}) has already been used previously. Generate a new one through a use session.`)}catch(t){throw t}const e={clientSecret:t.clientSecret,appearance:this.mapAppearance(t.appearance),paymentMethodCreation:"manual"};this.elements=this.stripe.elements(e);const r=this.mapElementOptions(t.elementOptions);this.paymentElement=this.elements.create("payment",r),this.paymentElement.mount(`#${t.elementId}`)}async generateToken(){var t,e,r,i,s,o,E,n,a,I;if(!this.stripe||!this.elements||!this.clientSecret)return{type:"client_error",message:"Payment form has not been initialized"};const{error:l}=await this.elements.submit();if(l)return{type:"validation_error",message:l.message,code:l.code};const{error:d,paymentMethod:R}=await this.stripe.createPaymentMethod({elements:this.elements});if(d)return{type:"validation_error"===d.type?"validation_error":"api_error",message:d.message,code:d.code,param:d.param};const{setupIntent:h}=await this.stripe.retrieveSetupIntent(this.clientSecret);if(!h)return{type:"confirm_error",message:"There's been an error during your session confirmation",code:"7190"};const{data:N}=await this.confirmSession({paymentMethodId:null!==(t=null==R?void 0:R.id)&&void 0!==t?t:"",sessionSecret:null!==(e=null==h?void 0:h.id)&&void 0!==e?e:""});return N?R?{id:R.id,type:R.type,card:(null==R?void 0:R.card)?{brand:null!==(i=null===(r=R.card)||void 0===r?void 0:r.brand)&&void 0!==i?i:"",country:null!==(s=R.card.country)&&void 0!==s?s:"",expMonth:null!==(o=R.card.exp_month)&&void 0!==o?o:0,expYear:null!==(E=R.card.exp_year)&&void 0!==E?E:0,last4:null!==(n=R.card.last4)&&void 0!==n?n:"",funding:null!==(a=R.card.funding)&&void 0!==a?a:""}:void 0,created:null!==(I=null==R?void 0:R.created)&&void 0!==I?I:0}:{type:"client_error",message:"Failed to generate payment token"}:{type:"confirm_error",message:"There's been an error during your session confirmation",code:"7191"}}async confirmSession({sessionSecret:t,paymentMethodId:e}){try{if(!t||!e)throw new Error("customerId, sessionSecret, paymentMethodId are required");return await this.client.post("/users/payments/confirm",{sessionSecret:t,paymentMethodId:e})}catch(t){throw t}}subscribe(t,e){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");if(!this.events.includes(t))throw new Error(this.eventsErrorMsg);this.paymentElement.on(t,e)}unsubscribe(t,e){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");if(!this.events.includes(t))throw new Error(this.eventsErrorMsg);this.paymentElement.off(t,e)}mapAppearance(t){if(t)return{theme:"night"===t.theme?"night":"stripe"}}mapElementOptions(t){return{layout:null==t?void 0:t.layout,wallets:{applePay:"auto",googlePay:"auto"}}}unmount(){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");this.paymentElement.unmount()}collapse(){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");this.paymentElement.collapse()}destroy(){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");this.paymentElement.destroy()}}class L{constructor(t){this.client=t}async autocomplete(t,e){try{return await this.client.post("/address/autocomplete",{...t,key:e})}catch(t){throw t}}async details(t,e){try{return await this.client.post("/address/details",{...t,key:e})}catch(t){throw t}}}class H{constructor(t,e){this.client=t,this.catalogHelperService=e,this.servicePath="/catalog/"}async availability(t){try{const e=this.catalogHelperService.validateAndNormalizeParams(t);return await this.client.post(`${this.servicePath}availability`,e)}catch(t){throw t}}async search(t){try{const e=this.catalogHelperService.validateAndNormalizeSearchParams(t);if(null==e?void 0:e.error)throw new Error(null==e?void 0:e.error);return await this.client.post(`${this.servicePath}search`,e)}catch(t){throw t}}}class f{constructor(t,e){this.client=t,this.checkoutHelperService=e,this.servicePath="/checkout"}async prepare(t){try{const e=this.checkoutHelperService.validateAndNormalizePrepareParams(t);return await this.client.post(`${this.servicePath}/prepare`,e)}catch(t){throw t}}async complete(t){try{const e=this.checkoutHelperService.validateAndNormalizeCompleteParams(t);return await this.client.post(`${this.servicePath}/complete`,e)}catch(t){throw t}}}class P{constructor(t){this.paymentProvider=t,this.collapse=()=>this.paymentProvider.collapse(),this.unmount=()=>this.paymentProvider.unmount(),this.destroy=()=>this.paymentProvider.destroy()}async mount(t){try{await this.paymentProvider.mount(t)}catch(t){throw t}}async generateToken(){return this.paymentProvider.generateToken()}subscribe(t,e){this.paymentProvider.subscribe(t,e)}unsubscribe(t,e){this.paymentProvider.unsubscribe(t,e)}}class g{constructor(t){this.client=t,this.servicePath="/users"}async createOrUpdateSession(t){try{if(!(null==t?void 0:t.id)&&!(null==t?void 0:t.email))throw new Error("Either id or email must be provided");return await this.client.post(`${this.servicePath}/session`,t)}catch(t){throw t}}async fetchUser(t){try{if(!t)throw new Error("Id is required");return await this.client.get(`${this.servicePath}/fetch/${t}`)}catch(t){throw t}}async purge(t){try{if(!t)throw new Error("User identifier (ID or email) must be provided");return await this.client.delete(`${this.servicePath}/purge/${t}`)}catch(t){throw t}}async addAddress(t){try{return this.validateAddressParams(t),await this.client.post(`${this.servicePath}/addresses/add`,t)}catch(t){throw t}}async updateAddress(t){try{const e=this.validateAddressParams(t);return await this.client.post(`${this.servicePath}/addresses/update`,e)}catch(t){throw t}}validateAddressParams(t){const e=this.hasUser(t),r=this.hasUserAddressObj(t),i=this.hasUserAddressCoords(t),s=this.hasUserAddressPlacesId(t);if(e)throw new Error("Missing required parameter customerId for address update.");if(r&&i&&s)throw new Error("Missing required parameters for address update, you need at least, an address object or lat and long, or a google placesId");return i||(t.lat=Number(null==t?void 0:t.lat),t.long=Number(null==t?void 0:t.long)),t}hasUser(t){return!(null==t?void 0:t.customerId)||"string"!=typeof(null==t?void 0:t.customerId)}hasUserAddressObj(t){return!((null==t?void 0:t.one)&&"string"==typeof(null==t?void 0:t.one)&&(null==t?void 0:t.city)&&"string"==typeof(null==t?void 0:t.city)&&(null==t?void 0:t.state)&&"string"==typeof(null==t?void 0:t.state)&&(null==t?void 0:t.zip)&&"string"==typeof(null==t?void 0:t.zip)&&(null==t?void 0:t.type)&&"string"==typeof(null==t?void 0:t.type))}hasUserAddressCoords(t){return!(null==t?void 0:t.lat)&&!(null==t?void 0:t.long)||"number"!=typeof Number(null==t?void 0:t.lat)&&"number"!=typeof Number(null==t?void 0:t.long)}hasUserAddressPlacesId(t){return!(null==t?void 0:t.placesId)||"string"!=typeof(null==t?void 0:t.placesId)}async purgeAddress(t){try{if(!t)throw new Error("Address ID must be provided");return await this.client.delete(`${this.servicePath}/addresses/purge/${t}`)}catch(t){throw t}}async addPayment(t){try{if(!t.customerId||!t.paymentMethodId)throw new Error("Missing required parameters to add payment");return void 0===(null==t?void 0:t.isDefault)&&(null==t||delete t.isDefault),await this.client.post(`${this.servicePath}/payments/add`,t)}catch(t){throw t}}async updatePayment(t){try{if(!t.customerId||!t.paymentMethodId||void 0===(null==t?void 0:t.isDefault)||"boolean"!=typeof(null==t?void 0:t.isDefault))throw new Error("Missing required parameters to add payment");return await this.client.post(`${this.servicePath}/payments/update`,t)}catch(t){throw t}}async purgePayment(t,e){try{if(!t||!e)throw new Error("Missing required parameters for payment purge");return await this.client.delete(`${this.servicePath}/payments/purge/${t}/${e}`)}catch(t){throw t}}}class b{constructor(t,e){this.client=t,this.cartHelperService=e,this.servicePath="/cart/update"}async get(t,e){try{let r=this.cartHelperService.validateId(t);if(r=""!==r&&r,r){const t={id:r};return"boolean"==typeof e&&(t.refresh=e),await this.client.post(this.servicePath,t)}return await this.client.post(this.servicePath)}catch(t){throw t}}async update(t){try{const e=this.cartHelperService.validateAndNormalizeParams(t);return await this.client.post(this.servicePath,e)}catch(t){throw t}}}class U{constructor(){this.services=new Map,this.liquidCommerceClientConstructor=null}static getInstance(){return U.instance||(U.instance=new U),U.instance}setLiquidCommerceClientConstructor(t){this.liquidCommerceClientConstructor=t}async getClient(t,e){const r=`LiquidCommerceClient_${t}_${JSON.stringify(e)}`;if(!this.services.has(r)){if(!this.liquidCommerceClientConstructor)throw new Error("LiquidCommerceClient constructor not set");const i=new this.liquidCommerceClientConstructor(t,e);await i.init(),this.services.set(r,i)}return this.services.get(r)}getOrCreateService(t,e,...r){if(!this.services.has(t)){const i="getInstance"in e?e.getInstance(...r):new e(...r);this.services.set(t,i)}return this.services.get(t)}getAuthenticatedClient(t){return this.getOrCreateService(`AuthenticatedClient_${JSON.stringify(t)}`,v,t)}getLocationHelperService(){return this.getOrCreateService("LocationHelperService",m)}getAddressService(t){return this.getOrCreateService(`AddressService_${t.getUniqueKey()}`,L,t)}getCatalogHelperService(){return this.getOrCreateService("CatalogHelperService",C,this.getLocationHelperService())}getCatalogService(t){return this.getOrCreateService(`CatalogService_${t.getUniqueKey()}`,H,t,this.getCatalogHelperService())}getCartHelperService(){return this.getOrCreateService("CartHelperService",D,this.getLocationHelperService())}getCartService(t){return this.getOrCreateService(`CartService_${t.getUniqueKey()}`,b,t,this.getCartHelperService())}getUserService(t){return this.getOrCreateService(`UserService_${t.getUniqueKey()}`,g,t)}getPaymentProviderService(t){return this.getOrCreateService(`PaymentProviderService_${t.getUniqueKey()}`,w,t)}getPaymentService(t){return this.getOrCreateService(`PaymentService_${t.getUniqueKey()}`,P,this.getPaymentProviderService(t))}getCheckoutHelperService(){return this.getOrCreateService("CheckoutHelperService",y,this.getLocationHelperService())}getCheckoutService(t){return this.getOrCreateService(`CheckoutService_${t.getUniqueKey()}`,f,t,this.getCheckoutHelperService())}}U.instance=null;class M{constructor(t,e){this.address={autocomplete:async t=>(await this.ensureAuthenticated(),this.addressService.autocomplete(t,this.config.googlePlacesApiKey)),details:async t=>(await this.ensureAuthenticated(),this.addressService.details(t,this.config.googlePlacesApiKey))},this.catalog={availability:async t=>(await this.ensureAuthenticated(),this.catalogService.availability(t)),search:async t=>(await this.ensureAuthenticated(),this.catalogService.search(t))},this.cart={get:async(t,e)=>(await this.ensureAuthenticated(),this.cartService.get(t,e)),update:async t=>(await this.ensureAuthenticated(),this.cartService.update(t))},this.user={session:async t=>(await this.ensureAuthenticated(),this.userService.createOrUpdateSession(t)),fetch:async t=>(await this.ensureAuthenticated(),this.userService.fetchUser(t)),purge:async t=>(await this.ensureAuthenticated(),this.userService.purge(t)),addAddress:async t=>(await this.ensureAuthenticated(),this.userService.addAddress(t)),updateAddress:async t=>(await this.ensureAuthenticated(),this.userService.updateAddress(t)),purgeAddress:async t=>(await this.ensureAuthenticated(),this.userService.purgeAddress(t)),addPayment:async t=>(await this.ensureAuthenticated(),this.userService.addPayment(t)),updatePayment:async t=>(await this.ensureAuthenticated(),this.userService.updatePayment(t)),purgePayment:async(t,e)=>(await this.ensureAuthenticated(),this.userService.purgePayment(t,e))},this.payment={mount:async t=>(await this.ensureAuthenticated(),this.paymentService.mount(t)),generateToken:async()=>(await this.ensureAuthenticated(),this.paymentService.generateToken()),subscribe:(t,e)=>{this.paymentService.subscribe(t,e)},unsubscribe:(t,e)=>{this.paymentService.unsubscribe(t,e)},collapse:()=>{this.paymentService.collapse()},unmount:()=>{this.paymentService.unmount()},destroy:()=>{this.paymentService.destroy()}},this.checkout={prepare:async t=>(await this.ensureAuthenticated(),this.checkoutService.prepare(t)),complete:async t=>(await this.ensureAuthenticated(),this.checkoutService.complete(t))},this.config=e,this.singletonManager=U.getInstance();const r=this.determineBaseURL(e);this.authenticatedClient=this.singletonManager.getAuthenticatedClient({apiKey:t,baseURL:r}),this.addressService=this.singletonManager.getAddressService(this.authenticatedClient),this.catalogService=this.singletonManager.getCatalogService(this.authenticatedClient),this.cartService=this.singletonManager.getCartService(this.authenticatedClient),this.userService=this.singletonManager.getUserService(this.authenticatedClient),this.paymentService=this.singletonManager.getPaymentService(this.authenticatedClient),this.checkoutService=this.singletonManager.getCheckoutService(this.authenticatedClient)}determineBaseURL(t){const e=t.env||exports.LIQUID_COMMERCE_ENV.STAGE;return W[e]}async init(){try{await this.authenticatedClient.authenticate()}catch(t){throw new Error("Authentication failed during initialization")}}async ensureAuthenticated(){this.authenticatedClient.isTokenExpired()&&await this.authenticatedClient.authenticate()}}exports.LiquidCommerce=async function(t,e){const r=U.getInstance();return r.setLiquidCommerceClientConstructor(M),await r.getClient(t,e)};
|
|
1
|
+
"use strict";var LIQUID_COMMERCE_ENV,t,e,i,r,s,o,n,a,E,I,l,d,h,u,c,N,R,p,T,A,O,v,S,y,m,W,w,D,C=require("@stripe/stripe-js");exports.LIQUID_COMMERCE_ENV=void 0,(LIQUID_COMMERCE_ENV=exports.LIQUID_COMMERCE_ENV||(exports.LIQUID_COMMERCE_ENV={})).LOC="loc",LIQUID_COMMERCE_ENV.STAGE="stage",LIQUID_COMMERCE_ENV.PROD="prod",LIQUID_COMMERCE_ENV.DEV="dev",exports.ENUM_MODALITIES=void 0,(t=exports.ENUM_MODALITIES||(exports.ENUM_MODALITIES={})).ON_DEMAND="onDemand",t.SHIPPING="shipping",exports.DAYS_OF_WEEK=void 0,(e=exports.DAYS_OF_WEEK||(exports.DAYS_OF_WEEK={})).MONDAY="monday",e.TUESDAY="tuesday",e.WEDNESDAY="wednesday",e.THURSDAY="thursday",e.FRIDAY="friday",e.SATURDAY="saturday",e.SUNDAY="sunday",exports.STATES_CODE=void 0,(i=exports.STATES_CODE||(exports.STATES_CODE={})).AL="AL",i.AK="AK",i.AR="AR",i.AZ="AZ",i.CA="CA",i.CO="CO",i.CT="CT",i.DE="DE",i.DC="DC",i.FL="FL",i.GA="GA",i.HI="HI",i.ID="ID",i.IL="IL",i.IN="IN",i.IA="IA",i.KS="KS",i.KY="KY",i.LA="LA",i.ME="ME",i.MD="MD",i.MA="MA",i.MI="MI",i.MN="MN",i.MS="MS",i.MO="MO",i.MT="MT",i.NE="NE",i.NV="NV",i.NH="NH",i.NJ="NJ",i.NM="NM",i.NY="NY",i.NC="NC",i.ND="ND",i.OH="OH",i.OK="OK",i.OR="OR",i.PA="PA",i.RI="RI",i.SC="SC",i.SD="SD",i.TN="TN",i.TX="TX",i.UT="UT",i.VT="VT",i.VA="VA",i.WA="WA",i.WV="WV",i.WI="WI",i.WY="WY",exports.STATES_NAME=void 0,(r=exports.STATES_NAME||(exports.STATES_NAME={})).ALABAMA="AL",r.ALASKA="AK",r.ARKANSAS="AR",r.ARIZONA="AZ",r.CALIFORNIA="CA",r.COLORADO="CO",r.CONNECTICUT="CT",r.DELAWARE="DE",r.DISTRICT_OF_COLUMBIA="DC",r.FLORIDA="FL",r.GEORGIA="GA",r.HAWAII="HI",r.IDAHO="ID",r.ILLINOIS="IL",r.INDIANA="IN",r.IOWA="IA",r.KANSAS="KS",r.KENTUCKY="KY",r.LOUISIANA="LA",r.MAINE="ME",r.MARYLAND="MD",r.MASSACHUSETTS="MA",r.MICHIGAN="MI",r.MINNESOTA="MN",r.MISSISSIPPI="MS",r.MISSOURI="MO",r.MONTANA="MT",r.NEBRASKA="NE",r.NEVADA="NV",r.NEW_HAMPSHIRE="NH",r.NEW_JERSEY="NJ",r.NEW_MEXICO="NM",r.NEW_YORK="NY",r.NORTH_CAROLINA="NC",r.NORTH_DAKOTA="ND",r.OHIO="OH",r.OKLAHOMA="OK",r.OREGON="OR",r.PENNSYLVANIA="PA",r.RHODE_ISLAND="RI",r.SOUTH_CAROLINA="SC",r.SOUTH_DAKOTA="SD",r.TENNESSEE="TN",r.TEXAS="TX",r.UTAH="UT",r.VERMONT="VT",r.VIRGINIA="VA",r.WASHINGTON="WA",r.WEST_VIRGINIA="WV",r.WISCONSIN="WI",r.WYOMING="WY",exports.ENUM_ENGRAVING=void 0,(s=exports.ENUM_ENGRAVING||(exports.ENUM_ENGRAVING={})).YES="YES",s.NO="NO",exports.ENUM_BINARY_FILTER=void 0,(o=exports.ENUM_BINARY_FILTER||(exports.ENUM_BINARY_FILTER={})).YES="YES",o.NO="NO",exports.ENUM_FILTER_KEYS=void 0,(n=exports.ENUM_FILTER_KEYS||(exports.ENUM_FILTER_KEYS={})).BRANDS="brands",n.FLAVOR="flavor",n.FULFILLMENT="fulfillment",n.TAGS="tags",n.REGION="region",n.VARIETY="variety",n.ENGRAVING="engraving",n.PRICE="price",n.PRESALE="presale",n.AVAILABILITY="availability",n.CATEGORIES="categories",n.SIZES="sizes",n.COLORS="colors",n.APPELLATION="appellation",n.COUNTRY="country",n.VINTAGE="vintage",n.MATERIALS="materials",n.COLLECTION_TAGS="collectionTags",exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE=void 0,(a=exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE||(exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE={})).ASC="asc",a.DESC="desc",exports.ENUM_ORDER_BY=void 0,(exports.ENUM_ORDER_BY||(exports.ENUM_ORDER_BY={})).PRICE="price",exports.ENUM_AVAILABILITY_VALUE=void 0,(E=exports.ENUM_AVAILABILITY_VALUE||(exports.ENUM_AVAILABILITY_VALUE={})).UNSPECIFIED="AVAILABILITY_UNSPECIFIED",E.IN_STOCK="IN_STOCK",E.OUT_OF_STOCK="OUT_OF_STOCK",E.PREORDER="PREORDER",E.BACKORDER="BACKORDER",exports.CART_PARAM_ERROR_ENUM=void 0,(I=exports.CART_PARAM_ERROR_ENUM||(exports.CART_PARAM_ERROR_ENUM={})).INVALID_ITEMS_TYPE="Items must be a non-empty array",I.INVALID_ITEMS_MAX="You can only send up to 25 items at a time!",I.INVALID_PART_NUMBER="The partnerNumber provided is invalid",I.INVALID_FULFILLMENT_ID="The fulfillmentId provided is invalid",exports.CART_EVENT_ENUM=void 0,(l=exports.CART_EVENT_ENUM||(exports.CART_EVENT_ENUM={})).OOS="OutOfStock",l.ITEMS_NOT_ADDED="ItemsNotAdded",l.ITEMS_REQUESTED_NOT_ADDED="ItemsRequestedNotAdded",l.ITEM_NOT_ENGRAVED="ItemEngravingError",l.ADDRESS_CHANGE="AddressChange",l.LOCATION_AVAILABILITY="LocationAvailability",l.PARTNER_PRODUCT_CONFIGS="PartnerProductConfigs",l.REMOVED_EXISTING_ITEMS="RemovedExistingCartItems",l.RETAILER_MIN="RetailerMinNotMet",l.NO_ITEMS_IN_CART="NoItemsInCart",l.INVALID_ID="InvalidId",l.NO_ID="NoId",l.CART_CHECKOUT_PROCESSED="CartCheckoutProcessed",l.NEW_CART="NewCart",l.DEFAULT="CartError",l.ITEM_QTY_CHANGE="ItemQuantityChange",l.ITEM_ID_NOT_FOUND="ItemIdNotFound",l.ITEMS_REMOVED="ItemsRemoved",l.RETAILER_FULFILLMENT_INVALID="RetailerFulfillmentInvalid",l.COUPON_PROCESSING_ERROR="CouponProcessingError",l.COUPON_NOT_FOUND="CouponNotFound",l.COUPON_EXPIRED="CouponExpired",l.NO_APPLICABLE_DISCOUNT="NoApplicableDiscount",l.COUPON_NOT_STARTED="CouponNotStarted",l.MINIMUM_ORDER_VALUE_NOT_MET="MinimumOrderValueNotMet",l.MINIMUM_ORDER_UNITS_NOT_MET="MinimumOrderUnitsNotMet",l.MINIMUM_DISTINCT_ITEMS_NOT_MET="MinimumDistinctItemsNotMet",l.QUOTA_EXCEEDED="QuotaExceeded",l.USER_LIMIT_EXCEEDED="UserLimitExceeded",l.NOT_FIRST_PURCHASE="NotFirstPurchase",l.INVALID_COUPON="InvalidCoupon",l.INVALID_MEMBERSHIP="InvalidMembership",l.INVALID_DOMAIN="InvalidDomain",l.INVALID_REQUIREMENTS="InvalidRequirements",l.INVALID_ORGANIZATION="InvalidOrganization",l.PRODUCT_NOT_ELIGIBLE="ProductNotEligible",l.NOT_ENOUGH_PREVIOUS_ORDERS="NotEnoughPreviousOrders",l.PRESALE_ITEMS_NOT_ALLOWED="PresaleItemsNotAllowed",l.PRESALE_LIMIT_EXCEEDED="PresaleLimitExceeded",l.PRESALE_NOT_STARTED="PresaleNotStarted",l.PRESALE_EXPIRED="PresaleExpired",l.PRESALE_MIXED_CART="PresaleMixedCart",exports.ENUM_ADDRESS_TYPE=void 0,(d=exports.ENUM_ADDRESS_TYPE||(exports.ENUM_ADDRESS_TYPE={})).SHIPPING="shipping",d.BILLING="billing",exports.ENUM_CHECKOUT_STATUS_CODE_ERROR=void 0,(h=exports.ENUM_CHECKOUT_STATUS_CODE_ERROR||(exports.ENUM_CHECKOUT_STATUS_CODE_ERROR={}))[h.REQUEST_DEFAULT_ERROR=5480]="REQUEST_DEFAULT_ERROR",h[h.REQUEST_LOCATION_OOS_ERROR=5481]="REQUEST_LOCATION_OOS_ERROR",h[h.REQUEST_LOCATION_MISMATCH_ERROR=5482]="REQUEST_LOCATION_MISMATCH_ERROR",h[h.REQUEST_BIRTHDATE_ERROR=5483]="REQUEST_BIRTHDATE_ERROR",h[h.REQUEST_CART_NOT_AVAILABLE_ERROR=5484]="REQUEST_CART_NOT_AVAILABLE_ERROR",h[h.REQUEST_CART_ID_ERROR=5485]="REQUEST_CART_ID_ERROR",h[h.REQUEST_CART_ITEM_ERROR=5486]="REQUEST_CART_ITEM_ERROR",h[h.REQUEST_VALIDATION_ERROR=5487]="REQUEST_VALIDATION_ERROR",h[h.REQUEST_TAX_ERROR=5488]="REQUEST_TAX_ERROR",h[h.REQUEST_COMPLETE_TOKEN=5489]="REQUEST_COMPLETE_TOKEN",h[h.REQUEST_DEFAULT_COMPLETE_ERROR=5490]="REQUEST_DEFAULT_COMPLETE_ERROR",h[h.REQUEST_CHECKOUT_COMPLETE_UPDATE_ERROR=5491]="REQUEST_CHECKOUT_COMPLETE_UPDATE_ERROR",h[h.REQUEST_CHECKOUT_COMPLETE_SAVE_ERROR=5492]="REQUEST_CHECKOUT_COMPLETE_SAVE_ERROR",h[h.REQUEST_CHECKOUT_HAS_COMPLETE_ERROR=5493]="REQUEST_CHECKOUT_HAS_COMPLETE_ERROR",h[h.REQUEST_NO_CART_ITEM_ERROR=5494]="REQUEST_NO_CART_ITEM_ERROR",h[h.REQUEST_NO_CUSTOMER_FOUND_ERROR=5495]="REQUEST_NO_CUSTOMER_FOUND_ERROR",h[h.REQUEST_PAYMENT_ATTACHED_ERROR=5496]="REQUEST_PAYMENT_ATTACHED_ERROR",h[h.REQUEST_SHIPPING_ADDRESS_ERROR=5497]="REQUEST_SHIPPING_ADDRESS_ERROR",h[h.REQUEST_BILLING_ADDRESS_ERROR=5498]="REQUEST_BILLING_ADDRESS_ERROR",h[h.REQUEST_PAYMENT_NOT_FOUND_ERROR=5499]="REQUEST_PAYMENT_NOT_FOUND_ERROR",h[h.REQUEST_CART_UPDATED_ERROR=5501]="REQUEST_CART_UPDATED_ERROR",h[h.REQUEST_ADDRESS_DEFAULT_ERROR=5502]="REQUEST_ADDRESS_DEFAULT_ERROR",h[h.REQUEST_TIPS_ERROR=5503]="REQUEST_TIPS_ERROR",exports.ENUM_CHECKOUT_STATUS_CODE_MESSAGE=void 0,(u=exports.ENUM_CHECKOUT_STATUS_CODE_MESSAGE||(exports.ENUM_CHECKOUT_STATUS_CODE_MESSAGE={})).REQUEST_DEFAULT_ERROR="There's been an error with your checkout request.",u.REQUEST_LOCATION_OOS_ERROR="The requested items are out of stock at this location.",u.REQUEST_LOCATION_MISMATCH_ERROR="The selected location doesn't match your cart items.",u.REQUEST_BIRTHDATE_ERROR="Please verify your birthdate and try again.",u.REQUEST_CART_NOT_AVAILABLE_ERROR="This cart is no longer available.",u.REQUEST_CART_ID_ERROR="The cartId requested is invalid, check and try again.",u.REQUEST_CART_ITEM_ERROR="There's an issue with one or more items in your cart.",u.REQUEST_VALIDATION_ERROR="There's been an error with your request parameters, check and try again.",u.REQUEST_TAX_ERROR="There was an error calculating tax for your order.",u.REQUEST_COMPLETE_TOKEN="The checkout token provided is invalid, check and try again.",u.REQUEST_DEFAULT_COMPLETE_ERROR="There was an error completing your checkout, confirm through the (prepare) method and try again.",u.REQUEST_CHECKOUT_COMPLETE_UPDATE_ERROR="Unable to update your checkout status.",u.REQUEST_CHECKOUT_COMPLETE_SAVE_ERROR="Unable to save your completed checkout.",u.REQUEST_CHECKOUT_HAS_COMPLETE_ERROR="This checkout has already been processed, create a new cart to process a new checkout.",u.REQUEST_NO_CART_ITEM_ERROR="No items found in your cart.",u.REQUEST_NO_CUSTOMER_FOUND_ERROR="The customer account was not found.",u.REQUEST_PAYMENT_ATTACHED_ERROR="The payment attached to the checkout is not a valid payment method for this customer.",u.REQUEST_SHIPPING_ADDRESS_ERROR="The address in your cart has changed, check and try again.",u.REQUEST_BILLING_ADDRESS_ERROR="The billing address in your checkout is not valid, check and try again.",u.REQUEST_PAYMENT_NOT_FOUND_ERROR="The payment method provided was not found.",u.REQUEST_CART_UPDATED_ERROR="The cart requested was updated during your checkout.",u.REQUEST_ADDRESS_DEFAULT_ERROR="There's been an error with your address configurations in cart and/or billing address, check and try again.",u.REQUEST_TIPS_ERROR="There's been an error applying your tips to the checkout.",exports.CHECKOUT_EVENT_ENUM=void 0,(c=exports.CHECKOUT_EVENT_ENUM||(exports.CHECKOUT_EVENT_ENUM={})).ERROR_PROCESSING_GIFT_CARDS="ErrorProcessingGiftCards",c.INVALID_GIFT_CARD_CODE="InvalidGiftCardCodes",c.INVALID_GIFT_CARD_PARTNER="InvalidGiftCardPartner",c.INACTIVE_GIFT_CARD="InactiveGiftCard",c.GIFT_CARD_ALREADY_IN_USE="GiftCardAlreadyInUse",c.GIFT_CARD_EXPIRED="GiftCardExpired",c.GIFT_CARD_BALANCE_DEPLETED="GiftCardBalanceDepleted",exports.ENUM_ORDER_STATUS=void 0,(N=exports.ENUM_ORDER_STATUS||(exports.ENUM_ORDER_STATUS={})).CREATED="created",N.PROCESSING="processing",N.CANCELED="canceled",N.DELIVERED="delivered",N.TEST="test",exports.ENUM_ORDER_SYSTEM=void 0,(R=exports.ENUM_ORDER_SYSTEM||(exports.ENUM_ORDER_SYSTEM={})).LIQUIDCOMMERCE="LiquidCommerce OMS",R.RESERVEBAR="ReserveBar OMS",exports.ENUM_ORDER_PACKAGE_STATUS=void 0,(p=exports.ENUM_ORDER_PACKAGE_STATUS||(exports.ENUM_ORDER_PACKAGE_STATUS={})).PENDING="pending",p.SHIPPED="shipped",p.DELIVERED="delivered",p.CANCELED="canceled",p.RETURNED="returned",exports.ENUM_ORDER_FULFILLMENT_TYPE=void 0,(T=exports.ENUM_ORDER_FULFILLMENT_TYPE||(exports.ENUM_ORDER_FULFILLMENT_TYPE={})).SHIPPING="shipping",T.ON_DEMAND="onDemand",T.DIGITAL="digital",T.BOPIS="bopis",exports.ENUM_CUSTOMER_PLACEMENT=void 0,(A=exports.ENUM_CUSTOMER_PLACEMENT||(exports.ENUM_CUSTOMER_PLACEMENT={})).STANDARD="standard",A.PRE_SALE="pre_sale",A.BACK_ORDER="back_order",exports.ENUM_BEER=void 0,(O=exports.ENUM_BEER||(exports.ENUM_BEER={})).ALE="BEER > ALE",O.LAGER="BEER > LAGER",O.BASE="BEER",O.NON_ALCOHOLIC="BEER > NON-ALCOHOLIC",O.OTHER_BEER="BEER > OTHER",O.OTHER_BEER_SOUR_BEER="BEER > SOUR BEER",O.OTHER_BEER_FLAVORED_BEER="BEER > FLAVORED BEER",O.OTHER_BEER_FRUIT_BEER="BEER > FRUIT BEER",exports.ENUM_FOOD=void 0,(v=exports.ENUM_FOOD||(exports.ENUM_FOOD={})).BASE="FOOD",v.PANTRY_OTHER="FOOD > PANTRY > OTHER",v.CANDY="FOOD > CANDY",v.CANDY_OTHER="FOOD > CANDY > OTHER",v.CBD="FOOD > CBD",v.CBD_OTHER="FOOD > CBD > OTHER",v.CHEESE="FOOD > CHEESE",v.CHEESE_OTHER="FOOD > CHEESE > OTHER",v.HOUSEHOLD="FOOD > HOUSEHOLD",v.HOUSEHOLD_SNACKS="FOOD > HOUSEHOLD > SNACKS",v.HOUSEHOLD_OTHER="FOOD > HOUSEHOLD > OTHER",v.PANTRY="FOOD > PANTRY",v.FRUIT="FOOD > FRUIT",v.OTHER="FOOD > OTHER",v.ICE="FOOD > ICE",v.ICE_CREAM="FOOD > ICE CREAM",v.PARTY_SUPPLIES="FOOD > PARTY SUPPLIES",v.PARTY_SUPPLIES_OTHER="FOOD > PARTY SUPPLIES > OTHER",v.SPIRITS_BASED="FOOD > SPIRITS BASED",v.GARNISHES="FOOD > GARNISHES",exports.ENUM_MERCHANDISE=void 0,(S=exports.ENUM_MERCHANDISE||(exports.ENUM_MERCHANDISE={})).BASE="MERCHANDISE",S.GLASSWARE="MERCHANDISE > GLASSWARE",S.GLASSWARE_OTHER="MERCHANDISE > GLASSWARE > OTHER",S.HUMIDOR="MERCHANDISE > HUMIDOR",S.ACCESSORY="MERCHANDISE > ACCESSORY",S.ACCESSORY_OTHER="MERCHANDISE > ACCESSORY > OTHER",S.GIFT_SET="MERCHANDISE > GIFT SET",S.GIFT_SET_GIFT_BAG="MERCHANDISE > GIFT SET > GIFT BAG",S.GIFT_SET_GIFT_CARD="MERCHANDISE > GIFT SET > GIFT CARD",S.BAR_TOOLS="MERCHANDISE > BAR TOOLS",S.BAR_TOOLS_ICE_BUCKET="MERCHANDISE > BAR TOOLS > ICE BUCKET",S.BAR_TOOLS_OTHER="MERCHANDISE > BAR TOOLS > OTHER",exports.ENUM_MISCELLANEOUS=void 0,(y=exports.ENUM_MISCELLANEOUS||(exports.ENUM_MISCELLANEOUS={})).BASE="MISCELLANEOUS",y.GIFT_CARD="MISCELLANEOUS > GIFT CARDS",y.PROMOTIONAL="MISCELLANEOUS > PROMOTIONAL",y.MEMBERSHIP="MISCELLANEOUS > MEMBERSHIP",exports.ENUM_NON_ALCOHOLIC=void 0,(m=exports.ENUM_NON_ALCOHOLIC||(exports.ENUM_NON_ALCOHOLIC={})).BASE="NON ALCOHOLIC",m.BITTERS="NON ALCOHOLIC > BITTERS",m.COCKTAIL_MIX="NON ALCOHOLIC > COCKTAIL MIX",m.COFFEE="NON ALCOHOLIC > COFFEE",m.ENERGY_DRINKS="NON ALCOHOLIC > ENERGY DRINKS",m.JUICE="NON ALCOHOLIC > JUICE",m.SODA="NON ALCOHOLIC > SODA",m.SPECIALTY_ITEM="NON ALCOHOLIC > SPECIALTY ITEM",m.SPECIALTY_ITEM_OTHER="NON ALCOHOLIC > SPECIALTY ITEM > OTHER",m.SPIRITS="NON ALCOHOLIC > SPIRITS",m.TEA="NON ALCOHOLIC > TEA",m.WATER="NON ALCOHOLIC > WATER",m.WINE="NON ALCOHOLIC > WINE",m.SPORTS_DRINKS="NON ALCOHOLIC > SPORTS DRINKS",m.SLURPEES="NON ALCOHOLIC > SLURPEES",m.GINGER_BEER="NON ALCOHOLIC > GINGER BEER",m.DAIRY="NON ALCOHOLIC > DAIRY",m.DAIRY_OTHER="NON ALCOHOLIC > DAIRY > OTHER",m.OTHER="NON ALCOHOLIC > OTHER",exports.ENUM_READY_TO_DRINK=void 0,(W=exports.ENUM_READY_TO_DRINK||(exports.ENUM_READY_TO_DRINK={})).BASE="READY TO DRINK",W.HARD_CIDER="READY TO DRINK > HARD CIDER",W.HARD_CIDER_PERRY_PEAR_CIDER="READY TO DRINK > HARD CIDER > PERRY (PEAR CIDER)",W.HARD_CIDER_APPLE_CIDER="READY TO DRINK > HARD CIDER > APPLE CIDER",W.HARD_CIDER_OTHER_FRUIT_CIDER="READY TO DRINK > HARD CIDER > FRUIT CIDER",W.HARD_TEA="READY TO DRINK > HARD TEA",W.HARD_SELTZER="READY TO DRINK > HARD SELTZER",W.MALT_BASED="READY TO DRINK > MALT BASED",W.SPIRITS_BASED_RTDS="READY TO DRINK > SPIRITS-BASED RTDS",W.SPIRITS_BASED_RTDS_AGAVE_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > AGAVE COCKTAILS",W.SPIRITS_BASED_RTDS_GIN_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > GIN COCKTAILS",W.SPIRITS_BASED_RTDS_RUM_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > RUM COCKTAILS",W.SPIRITS_BASED_RTDS_TEQUILA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEQUILA COCKTAILS",W.SPIRITS_BASED_RTDS_VODKA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > VODKA COCKTAILS",W.SPIRITS_BASED_RTDS_WHISKEY_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > WHISKEY COCKTAILS",W.SPIRITS_BASED_RTDS_OTHER="READY TO DRINK > SPIRITS-BASED RTDS > OTHER",W.SPIRITS_BASED_RTDS_FROZEN_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > FROZEN COCKTAILS",W.SPIRITS_BASED_RTDS_APERITIF_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > APERITIF COCKTAILS",W.SPIRITS_BASED_RTDS_DESSERT_COFFEE_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > DESSERT & COFFEE COCKTAILS",W.SPIRITS_BASED_RTDS_TEA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEA COCKTAILS",W.WINE_COCKTAILS="READY TO DRINK > WINE COCKTAILS",W.OTHER="READY TO DRINK > OTHER",exports.ENUM_SPIRITS=void 0,(w=exports.ENUM_SPIRITS||(exports.ENUM_SPIRITS={})).BASE="SPIRITS",w.AMARO_APERITIF_VERMOUTH="SPIRITS > AMARO APERITIF & VERMOUTH",w.AMARO_APERITIF_VERMOUTH_OTHER="SPIRITS > AMARO APERITIF & VERMOUTH > OTHER",w.BAIJIU="SPIRITS > BAIJIU",w.BITTERS="SPIRITS > BITTERS",w.BRANDY="SPIRITS > BRANDY",w.BRANDY_COGNAC="SPIRITS > BRANDY > COGNAC",w.CACHACA="SPIRITS > CACHACA",w.GIN="SPIRITS > GIN",w.GIN_DRY_GIN="SPIRITS > GIN > DRY GIN",w.GIN_FLAVORED_GIN="SPIRITS > GIN > FLAVORED GIN",w.GIN_OLD_TOM_GIN="SPIRITS > GIN > OLD TOM GIN",w.GIN_OTHER="SPIRITS > GIN > OTHER",w.GRAIN_ALCOHOL="SPIRITS > GRAIN ALCOHOL",w.LIQUEUR="SPIRITS > LIQUEUR",w.MEZCAL="SPIRITS > MEZCAL",w.OTHER_SPIRITS="SPIRITS > OTHER SPIRITS",w.RUM="SPIRITS > RUM",w.RUM_AGED_RUM="SPIRITS > RUM > AGED RUM",w.RUM_DARK_RUM="SPIRITS > RUM > DARK RUM",w.RUM_FLAVORED_RUM="SPIRITS > RUM > FLAVORED RUM",w.RUM_GOLD_RUM="SPIRITS > RUM > GOLD RUM",w.RUM_OTHER="SPIRITS > RUM > OTHER",w.RUM_SPICED="SPIRITS > RUM > SPICED",w.RUM_WHITE_RUM="SPIRITS > RUM > WHITE RUM",w.SHOCHU="SPIRITS > SHOCHU",w.SOJU="SPIRITS > SOJU",w.SOTOL="SPIRITS > SOTOL",w.TEQUILA="SPIRITS > TEQUILA",w.TEQUILA_ANEJO="SPIRITS > TEQUILA > AÑEJO",w.TEQUILA_BLANCO="SPIRITS > TEQUILA > BLANCO",w.TEQUILA_CRISTALINO="SPIRITS > TEQUILA > CRISTALINO",w.TEQUILA_EXTRA_ANEJO="SPIRITS > TEQUILA > EXTRA AÑEJO",w.TEQUILA_OTHER="SPIRITS > TEQUILA > OTHER",w.TEQUILA_REPOSADO="SPIRITS > TEQUILA > REPOSADO",w.VODKA="SPIRITS > VODKA",w.VODKA_FLAVORED_VODKA="SPIRITS > VODKA > FLAVORED VODKA",w.VODKA_OTHER="SPIRITS > VODKA > OTHER",w.VODKA_REGULAR_VODKA="SPIRITS > VODKA > REGULAR VODKA",w.WHISKEY="SPIRITS > WHISKEY",w.WHISKEY_AMERICAN_WHISKEY="SPIRITS > WHISKEY > AMERICAN WHISKEY",w.WHISKEY_BOURBON="SPIRITS > WHISKEY > BOURBON",w.WHISKEY_CANADIAN_WHISKEY="SPIRITS > WHISKEY > CANADIAN WHISKEY",w.WHISKEY_IRISH_WHISKEY="SPIRITS > WHISKEY > IRISH WHISKEY",w.WHISKEY_MOONSHINE="SPIRITS > WHISKEY > MOONSHINE",w.WHISKEY_FLAVORED="SPIRITS > WHISKEY > FLAVORED WHISKEY",w.WHISKEY_OTHER="SPIRITS > WHISKEY > OTHER",w.WHISKEY_SCOTCH="SPIRITS > WHISKEY > SCOTCH",exports.ENUM_WINE=void 0,(D=exports.ENUM_WINE||(exports.ENUM_WINE={})).BASE="WINE",D.CHAMPAGNE_SPARKLING="WINE > CHAMPAGNE & SPARKLING",D.CHAMPAGNE_SPARKLING_CAVA="WINE > CHAMPAGNE & SPARKLING > CAVA",D.CHAMPAGNE_SPARKLING_CHAMPAGNE="WINE > CHAMPAGNE & SPARKLING > CHAMPAGNE",D.CHAMPAGNE_SPARKLING_PROSECCO="WINE > CHAMPAGNE & SPARKLING > PROSECCO",D.CHAMPAGNE_SPARKLING_SPARKLING_WINE="WINE > CHAMPAGNE & SPARKLING > SPARKLING WINE",D.CHAMPAGNE_SPARKLING_OTHER="WINE > CHAMPAGNE & SPARKLING > OTHER",D.COOKING="WINE > COOKING",D.DESSERT_FORTIFIED_WINE="WINE > DESSERT & FORTIFIED WINE",D.DESSERT_FORTIFIED_WINE_MEAD="WINE > DESSERT & FORTIFIED WINE > MEAD",D.DESSERT_FORTIFIED_WINE_PORT="WINE > DESSERT & FORTIFIED WINE > PORT",D.DESSERT_FORTIFIED_WINE_SHERRY="WINE > DESSERT & FORTIFIED WINE > SHERRY",D.DESSERT_FORTIFIED_WINE_OTHER="WINE > DESSERT & FORTIFIED WINE > OTHER",D.RED_WINE="WINE > RED WINE",D.RED_WINE_AGIORGITIKO="WINE > RED WINE > AGIORGITIKO",D.RED_WINE_AGLIANICO="WINE > RED WINE > AGLIANICO",D.RED_WINE_ALICANTE_BOUSCHET="WINE > RED WINE > ALICANTE BOUSCHET",D.RED_WINE_BARBERA="WINE > RED WINE > BARBERA",D.RED_WINE_BARBARESCO="WINE > RED WINE > BARBARESCO",D.RED_WINE_BAROLO="WINE > RED WINE > BAROLO",D.RED_WINE_BEAUJOLAIS="WINE > RED WINE > BEAUJOLAIS",D.RED_WINE_BLAUER_ZWEIGELT="WINE > RED WINE > BLAUER ZWEIGELT",D.RED_WINE_BOBAL="WINE > RED WINE > BOBAL",D.RED_WINE_BONARDA="WINE > RED WINE > BONARDA",D.RED_WINE_BORDEAUX="WINE > RED WINE > BORDEAUX",D.RED_WINE_BORDEAUX_BLEND="WINE > RED WINE > BORDEAUX BLEND",D.RED_WINE_BURGUNDY="WINE > RED WINE > BURGUNDY",D.RED_WINE_CABERNET_FRANC="WINE > RED WINE > CABERNET FRANC",D.RED_WINE_CABERNET_SAUVIGNON="WINE > RED WINE > CABERNET SAUVIGNON",D.RED_WINE_CANNONAU="WINE > RED WINE > CANNONAU",D.RED_WINE_CARMENERE="WINE > RED WINE > CARMENERE",D.RED_WINE_CHAMBOURCIN="WINE > RED WINE > CHAMBOURCIN",D.RED_WINE_CHIANTI="WINE > RED WINE > CHIANTI",D.RED_WINE_CINSAULT="WINE > RED WINE > CINSAULT",D.RED_WINE_CORVINA="WINE > RED WINE > CORVINA",D.RED_WINE_DOLCETTO="WINE > RED WINE > DOLCETTO",D.RED_WINE_DORNFELDER="WINE > RED WINE > DORNFELDER",D.RED_WINE_FETEASCA_NEAGRA="WINE > RED WINE > FETEASCA NEAGRA",D.RED_WINE_GAMAY="WINE > RED WINE > GAMAY",D.RED_WINE_GRACIANO="WINE > RED WINE > GRACIANO",D.RED_WINE_GRENACHE="WINE > RED WINE > GRENACHE",D.RED_WINE_LIMNIO="WINE > RED WINE > LIMNIO",D.RED_WINE_MACABEO="WINE > RED WINE > MACABEO",D.RED_WINE_MALBEC="WINE > RED WINE > MALBEC",D.RED_WINE_MENCIA="WINE > RED WINE > MENCIA",D.RED_WINE_MERLOT="WINE > RED WINE > MERLOT",D.RED_WINE_MONICA="WINE > RED WINE > MONICA",D.RED_WINE_MONTEPULCIANO="WINE > RED WINE > MONTEPULCIANO",D.RED_WINE_MOURVEDRE_MONASTRELL="WINE > RED WINE > MOURVEDRE/MONASTRELL",D.RED_WINE_NEBBIOLO="WINE > RED WINE > NEBBIOLO",D.RED_WINE_NEGROAMARO="WINE > RED WINE > NEGROAMARO",D.RED_WINE_NERELLO_MASCALESE="WINE > RED WINE > NERELLO MASCALESE",D.RED_WINE_NERO_DAVOLA="WINE > RED WINE > NERO D'AVOLA",D.RED_WINE_PETIT_VERDOT="WINE > RED WINE > PETIT VERDOT",D.RED_WINE_PETITE_SIRAH="WINE > RED WINE > PETITE SIRAH",D.RED_WINE_PINOT_NOIR="WINE > RED WINE > PINOT NOIR",D.RED_WINE_PINOTAGE="WINE > RED WINE > PINOTAGE",D.RED_WINE_PRIMITIVO="WINE > RED WINE > PRIMITIVO",D.RED_WINE_RED_BLEND="WINE > RED WINE > RED BLEND",D.RED_WINE_RHONE_BLEND="WINE > RED WINE > RHONE BLEND",D.RED_WINE_RIOJA="WINE > RED WINE > RIOJA",D.RED_WINE_SAGRANTINO="WINE > RED WINE > SAGRANTINO",D.RED_WINE_SANGIOVESE="WINE > RED WINE > SANGIOVESE",D.RED_WINE_SAPERAVI="WINE > RED WINE > SAPERAVI",D.RED_WINE_SCHIAVA_TROLLINGER="WINE > RED WINE > SCHIAVA/TROLLINGER",D.RED_WINE_SYRAH_SHIRAZ="WINE > RED WINE > SYRAH/SHIRAZ",D.RED_WINE_TANNAT="WINE > RED WINE > TANNAT",D.RED_WINE_TEMPRANILLO="WINE > RED WINE > TEMPRANILLO",D.RED_WINE_TEROLDEGO="WINE > RED WINE > TEROLDEGO",D.RED_WINE_TINTA_DEL_TORO="WINE > RED WINE > TINTA DEL TORO",D.RED_WINE_TOURIGA_NACIONAL="WINE > RED WINE > TOURIGA NACIONAL",D.RED_WINE_VALPOLICELLA="WINE > RED WINE > VALPOLICELLA",D.RED_WINE_XINOMAVRO="WINE > RED WINE > XINOMAVRO",D.RED_WINE_ZINFANDEL="WINE > RED WINE > ZINFANDEL",D.RED_WINE_ZWEIGELT="WINE > RED WINE > ZWEIGELT",D.RED_WINE_OTHER="WINE > RED WINE > OTHER",D.ROSE_WINE="WINE > ROSE WINE",D.SAKE="WINE > SAKE",D.WHITE_WINE="WINE > WHITE WINE",D.WHITE_WINE_ALBARINO_ALVARINHO="WINE > WHITE WINE > ALBARINO/ALVARINHO",D.WHITE_WINE_ARNEIS="WINE > WHITE WINE > ARNEIS",D.WHITE_WINE_ASTI="WINE > WHITE WINE > ASTI",D.WHITE_WINE_ASSYRTIKO="WINE > WHITE WINE > ASSYRTIKO",D.WHITE_WINE_BURGUNDY="WINE > WHITE WINE > BURGUNDY",D.WHITE_WINE_CARRICANTE="WINE > WHITE WINE > CARRICANTE",D.WHITE_WINE_CATARRATTO="WINE > WHITE WINE > CATARRATTO",D.WHITE_WINE_CHABLIS="WINE > WHITE WINE > CHABLIS",D.WHITE_WINE_CHARDONNAY="WINE > WHITE WINE > CHARDONNAY",D.WHITE_WINE_CHENIN_BLANC="WINE > WHITE WINE > CHENIN BLANC",D.WHITE_WINE_CORTESE="WINE > WHITE WINE > CORTESE",D.WHITE_WINE_FALANGHINA="WINE > WHITE WINE > FALANGHINA",D.WHITE_WINE_FIANO="WINE > WHITE WINE > FIANO",D.WHITE_WINE_FRIULANO="WINE > WHITE WINE > FRIULANO",D.WHITE_WINE_FURMINT="WINE > WHITE WINE > FURMINT",D.WHITE_WINE_GARGANEGA="WINE > WHITE WINE > GARGANEGA",D.WHITE_WINE_GAVI="WINE > WHITE WINE > GAVI",D.WHITE_WINE_GEWURZTRAMINER="WINE > WHITE WINE > GEWURZTRAMINER",D.WHITE_WINE_GRECO_DI_TUFO="WINE > WHITE WINE > GRECO DI TUFO",D.WHITE_WINE_GRENACHE_BLANC="WINE > WHITE WINE > GRENACHE BLANC",D.WHITE_WINE_GRUNER_VELTLINER="WINE > WHITE WINE > GRUNER VELTLINER",D.WHITE_WINE_HUXELREBE="WINE > WHITE WINE > HUXELREBE",D.WHITE_WINE_INZOLIA="WINE > WHITE WINE > INZOLIA",D.WHITE_WINE_MALVASIA="WINE > WHITE WINE > MALVASIA",D.WHITE_WINE_MELON_DE_BOURGOGNE="WINE > WHITE WINE > MELON DE BOURGOGNE",D.WHITE_WINE_MOSCATO_BIANCO="WINE > WHITE WINE > MOSCATO BIANCO",D.WHITE_WINE_MOSCHOFILERO_FILERI="WINE > WHITE WINE > MOSCHOFILERO/FILERI",D.WHITE_WINE_MULLER_THURGAU_RIVANER="WINE > WHITE WINE > MULLER-THURGAU/RIVANER",D.WHITE_WINE_MUSCAT_MOSCATO="WINE > WHITE WINE > MUSCAT/MOSCATO",D.WHITE_WINE_PECORINO="WINE > WHITE WINE > PECORINO",D.WHITE_WINE_PICPOUL="WINE > WHITE WINE > PICPOUL",D.WHITE_WINE_PINOT_BLANC="WINE > WHITE WINE > PINOT BLANC",D.WHITE_WINE_PINOT_GRIGIO_PINOT_GRIS="WINE > WHITE WINE > PINOT GRIGIO/PINOT GRIS",D.WHITE_WINE_POUILLY_FUISSE="WINE > WHITE WINE > POUILLY-FUISSE",D.WHITE_WINE_POUILLY_FUME="WINE > WHITE WINE > POUILLY-FUME",D.WHITE_WINE_RIESLING="WINE > WHITE WINE > RIESLING",D.WHITE_WINE_RIOJA="WINE > WHITE WINE > RIOJA",D.WHITE_WINE_RODITIS="WINE > WHITE WINE > RODITIS",D.WHITE_WINE_SANCERRE="WINE > WHITE WINE > SANCERRE",D.WHITE_WINE_SAUVIGNON_BLANC="WINE > WHITE WINE > SAUVIGNON BLANC",D.WHITE_WINE_SEMILLON="WINE > WHITE WINE > SEMILLON",D.WHITE_WINE_SOAVE="WINE > WHITE WINE > SOAVE",D.WHITE_WINE_SYLVANER="WINE > WHITE WINE > SYLVANER",D.WHITE_WINE_TORRONTES="WINE > WHITE WINE > TORRONTES",D.WHITE_WINE_TREBBIANO_UGNI_BLANC="WINE > WHITE WINE > TREBBIANO/UGNI BLANC",D.WHITE_WINE_TURBIANA="WINE > WHITE WINE > TURBIANA",D.WHITE_WINE_TXAKOLINA="WINE > WHITE WINE > TXAKOLINA",D.WHITE_WINE_VERDEJO="WINE > WHITE WINE > VERDEJO",D.WHITE_WINE_VERDICCHIO="WINE > WHITE WINE > VERDICCHIO",D.WHITE_WINE_VERMENTINO="WINE > WHITE WINE > VERMENTINO",D.WHITE_WINE_VERNACCIA="WINE > WHITE WINE > VERNACCIA",D.WHITE_WINE_VIDIANO="WINE > WHITE WINE > VIDIANO",D.WHITE_WINE_VINHO_VERDE="WINE > WHITE WINE > VINHO VERDE",D.WHITE_WINE_VIOGNIER="WINE > WHITE WINE > VIOGNIER",D.WHITE_WINE_VIURA="WINE > WHITE WINE > VIURA",D.WHITE_WINE_OTHER="WINE > WHITE WINE > OTHER",D.WINE_OTHER="WINE > OTHER";const f={[exports.LIQUID_COMMERCE_ENV.LOC]:"https://dev.api.liquidcommerce.cloud",[exports.LIQUID_COMMERCE_ENV.DEV]:"https://dev.api.liquidcommerce.cloud",[exports.LIQUID_COMMERCE_ENV.STAGE]:"https://staging.api.liquidcommerce.cloud",[exports.LIQUID_COMMERCE_ENV.PROD]:"https://api.liquidcommerce.cloud"};function L(t){return async(e,i)=>{var r;const s=await t(e,i);let o;return"function"==typeof(null===(r=s.headers)||void 0===r?void 0:r.entries)?o=Object.fromEntries(s.headers.entries()):(o={},s.headers.forEach(((t,e)=>{o[e]=t}))),{ok:s.ok,status:s.status,statusText:s.statusText,headers:o,json:()=>s.json(),text:()=>s.text()}}}const g=(t,e)=>new Promise(((i,r)=>{const s=new XMLHttpRequest;s.open(e.method||"GET",t),Object.entries(e.headers).forEach((([t,e])=>{s.setRequestHeader(t,e)})),s.onload=()=>{i({ok:s.status>=200&&s.status<300,status:s.status,statusText:s.statusText,headers:s.getAllResponseHeaders().split("\r\n").reduce(((t,e)=>{const[i,r]=e.split(": ");return i&&(t[i]=r),t}),{}),json:()=>Promise.resolve(JSON.parse(s.responseText)),text:()=>Promise.resolve(s.responseText)})},s.onerror=()=>{r(new TypeError("Network request failed"))},s.send(e.body)}));function P(){return"undefined"!=typeof fetch?L(fetch):"undefined"!=typeof global&&global.fetch?L(global.fetch):g}class H{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=!1,this.apiKey=t.apiKey,this.env=t.env,this.baseURL=t.baseURL,this.httpClient=P()}getUniqueKey(){return`${this.apiKey}_${this.baseURL}`}async authenticate(){var t,e;if(this.isAuthenticating)await new Promise((t=>{const e=()=>{this.isAuthenticating?setTimeout(e,100):t(void 0)};e()}));else{this.isAuthenticating=!0;try{const i=await this.requestWithoutAuth("/authentication",{method:"GET"});this.accessToken=null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.token,this.tokenExpiration=null===(e=null==i?void 0:i.data)||void 0===e?void 0:e.exp}catch(t){throw new Error("Failed to authenticate with LiquidCommerce API")}finally{this.isAuthenticating=!1}}}async getAuth(){const t=await this.requestWithoutAuth("/authentication",{method:"GET"});return null==t?void 0:t.data}async requestWithoutAuth(t,e){const i=new URL(`api${t}`,this.baseURL),r={"Content-Type":"application/json","X-LIQUID-API-KEY":this.apiKey,"X-LIQUID-API-OBF":"true",...e.headers},s={method:e.method,headers:r,body:e.body?JSON.stringify(e.body):void 0},o=await this.httpClient(i.toString(),s);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}async request(t,e){try{this.accessToken&&!this.isTokenExpired()||await this.authenticate();const i=new URL(`api${t}`,this.baseURL),r={"Content-Type":"application/json","X-LIQUID-API-KEY":this.apiKey,"X-LIQUID-API-OBF":"true","X-LIQUID-API-SDK":"true",Authorization:`Bearer ${this.accessToken}`,...e.headers},s={method:e.method,headers:r,body:e.body?JSON.stringify(e.body):void 0},o=await this.httpClient(i.toString(),s);let n;try{n=await o.json()}catch(t){n={message:await o.text().catch((()=>`HTTP error! status: ${o.status}`))||t}}if(!o.ok)throw{...n,status:o.status,message:(null==n?void 0:n.message)||`HTTP error! status: ${o.status}`};return n}catch(t){throw t}}async get(t,e){return this.request(t,{method:"GET",headers:e})}async post(t,e,i){return this.request(t,{method:"POST",body:e,headers:i})}async put(t,e,i){return this.request(t,{method:"PUT",body:e,headers:i})}async delete(t,e){return this.request(t,{method:"DELETE",headers:e})}}class b{constructor(t){this.locationHelperService=t}validateAndNormalizeParams(t){const e={...t};return e.id=this.validateId(e.id),e.items=this.validateAndNormalizeItems(e.items),this.locationHelperService.validateAndNormalizeLocation(e.loc),e.refresh=Boolean(e.refresh),e}validateId(t){return t&&"string"==typeof t&&0!==t.trim().length?t.trim():""}validateAndNormalizeItems(t){if(!Array.isArray(t)||0===t.length)throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_ITEMS_TYPE);if(t.length>25)throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_ITEMS_MAX);return t.map((t=>this.validateAndNormalizeItem(t)))}validateAndNormalizeItem(t){const e={...t};if(!this.validatePartNumber(e.partNumber))throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_PART_NUMBER);if(!e.fulfillmentId||"string"!=typeof e.fulfillmentId||0===e.fulfillmentId.trim().length)throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_FULFILLMENT_ID);return e.quantity=Math.max(0,Math.floor(e.quantity)),e.engravingLines&&(e.engravingLines=e.engravingLines.map((t=>t.trim())).filter((t=>t.length>0))),e}validatePartNumber(t){if(!t||"string"!=typeof t)return!1;const e=t.split("_");return 2===e.length&&e[0].length>0&&e[1].length>0}}class x{constructor(t){this.locationServiceHelper=t,this.taxonomyValues=new Set([...Object.values(exports.ENUM_BEER),...Object.values(exports.ENUM_FOOD),...Object.values(exports.ENUM_MERCHANDISE),...Object.values(exports.ENUM_NON_ALCOHOLIC),...Object.values(exports.ENUM_READY_TO_DRINK),...Object.values(exports.ENUM_SPIRITS),...Object.values(exports.ENUM_WINE),...Object.values(exports.ENUM_MISCELLANEOUS)])}validateAndNormalizeParams(t){var e,i,r,s,o,n,a,E,I;const l={...t},d=null!==(e=null==l?void 0:l.upcs)&&void 0!==e?e:[],h=null!==(i=null==l?void 0:l.grouping)&&void 0!==i?i:[],u=null!==(r=null==l?void 0:l.ids)&&void 0!==r?r:[];if([d,h,u].every((t=>this.validateIdsExist(t))))throw new Error("Product identifiers must be a non-empty array of strings");return d.length>0&&(this.validateIds(null!==(s=null==l?void 0:l.upcs)&&void 0!==s?s:[]),l.upcs=d),h.length>0&&(this.validateIds(null!==(o=null==l?void 0:l.grouping)&&void 0!==o?o:[]),l.grouping=h),u.length>0&&(this.validateIds(null!==(n=null==l?void 0:l.ids)&&void 0!==n?n:[]),l.ids=u),this.validateIds(null!==(I=null!==(E=null!==(a=null==l?void 0:l.upcs)&&void 0!==a?a:null==l?void 0:l.grouping)&&void 0!==E?E:null==l?void 0:l.ids)&&void 0!==I?I:[]),this.locationServiceHelper.validateAndNormalizeLocation(l.loc),l}isValidObjectId(t){return!(!t||"string"!=typeof t)&&/^[0-9a-fA-F]{24}$/.test(t)}validateRetailers(t,e){void 0!==t&&(Array.isArray(t)?(t.length>20&&e.push("Retailers array can have a maximum of 20 values"),t.forEach(((t,i)=>{"string"!=typeof t?e.push(`Retailer at index ${i} must be a string`):this.isValidObjectId(t)||e.push(`Retailer ID at index ${i} must be a valid ObjectId string`)}))):e.push("Retailers must be an array"))}validateAndNormalizeSearchParams(t){const e=[],i={...t};return this.validateRetailers(i.retailers,e),this.validateOrderBy(i.orderBy,e),this.validateOrderDirection(i.orderDirection,e),this.validateFilters(i.filters,e),this.validatePagination(i.page,i.perPage,e),this.locationServiceHelper.validateAndNormalizeLocation(i.loc),e.length>0?{...i,error:e.join(". ")}:i}validateIds(t){if(!t.every((t=>"string"==typeof t&&t.trim().length>0)))throw new Error("All product identifiers must be non-empty strings")}validateIdsExist(t){return!Array.isArray(t)||0===t.length}validateOrderBy(t,e){t&&!Object.values(exports.ENUM_ORDER_BY).includes(t)&&e.push(`Invalid orderBy value: ${t}`)}validateOrderDirection(t,e){t&&!Object.values(exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE).includes(t)&&e.push(`Invalid orderDirection value: ${t}`)}validateFilters(t,e){t&&(t.length>10&&e.push("Maximum of 10 filters allowed"),t.forEach((t=>{switch(Object.values(exports.ENUM_FILTER_KEYS).includes(t.key)||e.push(`Invalid filter key: ${t.key}`),t.key){case exports.ENUM_FILTER_KEYS.AVAILABILITY:this.validateAvailabilityFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.FULFILLMENT:this.validateFulfillmentFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.ENGRAVING:case exports.ENUM_FILTER_KEYS.PRESALE:this.validateBinaryFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.CATEGORIES:this.validateCategoriesFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.BRANDS:this.validateArrayFilter(t.values,75,"brands",e);break;case exports.ENUM_FILTER_KEYS.FLAVOR:this.validateArrayFilter(t.values,25,"flavor",e);break;case exports.ENUM_FILTER_KEYS.REGION:this.validateArrayFilter(t.values,25,"region",e);break;case exports.ENUM_FILTER_KEYS.VARIETY:this.validateArrayFilter(t.values,25,"variety",e);break;case exports.ENUM_FILTER_KEYS.SIZES:this.validateArrayFilter(t.values,25,"sizes",e);break;case exports.ENUM_FILTER_KEYS.APPELLATION:this.validateArrayFilter(t.values,25,"appellation",e);break;case exports.ENUM_FILTER_KEYS.COUNTRY:this.validateArrayFilter(t.values,25,"country",e);break;case exports.ENUM_FILTER_KEYS.VINTAGE:this.validateArrayFilter(t.values,25,"vintage",e);break;case exports.ENUM_FILTER_KEYS.MATERIALS:this.validateArrayFilter(t.values,25,"materials",e);break;case exports.ENUM_FILTER_KEYS.COLORS:this.validateArrayFilter(t.values,25,"colors",e);break;case exports.ENUM_FILTER_KEYS.TAGS:this.validateArrayFilter(t.values,25,"tags",e)}})))}validateAvailabilityFilter(t,e){Object.values(exports.ENUM_AVAILABILITY_VALUE).includes(t)||e.push(`Invalid availability value: ${t}`)}validateFulfillmentFilter(t,e){if(!Array.isArray(t))return void e.push("Fulfillment filter must be an array");const i=Object.values(exports.ENUM_MODALITIES);t.forEach((t=>{i.includes(t)||e.push(`Invalid fulfillment value: ${t}`)}))}validateBinaryFilter(t,e){Object.values(exports.ENUM_BINARY_FILTER).includes(t)||e.push(`Invalid availability value: ${t}`)}validateArrayFilter(t,e,i,r){Array.isArray(t)?t.length>e&&r.push(`${i} filter can have a maximum of ${e} values`):r.push(`${i} filter must be an array`)}validateCategoriesFilter(t,e){Array.isArray(t)?t.every((t=>this.taxonomyValues.has(t)))||e.push("Invalid category value(s) in categories filter"):e.push("Categories filter must be an array")}validatePagination(t,e,i){void 0!==t&&("number"!=typeof t||t<0)&&i.push("Page must be a non-negative number"),void 0!==e&&("number"!=typeof e||e<=0)&&i.push("PerPage must be a positive number")}}class U{constructor(t){this.locationHelperService=t}validateAndNormalizePrepareParams(t){var e,i,r,s,o,n,a,E,I,l,d,h,u,c,N,R,p,T,A,O;let v={...t};if(!(null==v?void 0:v.cartId)||"string"!=typeof(null==v?void 0:v.cartId))throw new Error("Invalid cartId");return this.validateCustomer(v.customer),(null==v?void 0:v.billingAddress)&&this.validateBillingAddress(v.billingAddress),v.hasAgeVerify=Boolean(null!==(r=null!==(e=null==v?void 0:v.hasAgeVerify)&&void 0!==e?e:null===(i=null==v?void 0:v.customer)||void 0===i?void 0:i.hasAgeVerify)&&void 0!==r&&r),v.hasSubstitutionPolicy=Boolean(null==v?void 0:v.hasSubstitutionPolicy),v.acceptedAccountCreation=Boolean(null==v?void 0:v.acceptedAccountCreation),v.isGift=Boolean(null==v?void 0:v.isGift),v.billingSameAsShipping=Boolean(null==v?void 0:v.billingSameAsShipping),v&&(null==v?void 0:v.billingAddress)&&""!==(null===(s=null==v?void 0:v.billingAddress)||void 0===s?void 0:s.phone)&&(v={...v,billingAddress:{...null!==(o=null==v?void 0:v.billingAddress)&&void 0!==o?o:{},phone:null!==(a=this.formatPhoneNumber(null===(n=v.billingAddress)||void 0===n?void 0:n.phone))&&void 0!==a?a:""}}),v&&(null==v?void 0:v.customer)&&""!==(null===(E=null==v?void 0:v.customer)||void 0===E?void 0:E.phone)&&(v={...v,customer:{...null!==(I=null==v?void 0:v.customer)&&void 0!==I?I:{},phone:null!==(d=this.formatPhoneNumber(null===(l=null==v?void 0:v.customer)||void 0===l?void 0:l.phone))&&void 0!==d?d:""}}),(null==v?void 0:v.isGift)&&(this.validateGiftOptions(v.giftOptions),v&&(null==v?void 0:v.giftOptions)&&""!==(null===(u=null===(h=null==v?void 0:v.giftOptions)||void 0===h?void 0:h.recipient)||void 0===u?void 0:u.phone)&&(v={...v,giftOptions:{...null!==(c=null==v?void 0:v.giftOptions)&&void 0!==c?c:{},recipient:{...null!==(R=null===(N=null==v?void 0:v.giftOptions)||void 0===N?void 0:N.recipient)&&void 0!==R?R:{},phone:null!==(A=this.formatPhoneNumber(null===(T=null===(p=v.giftOptions)||void 0===p?void 0:p.recipient)||void 0===T?void 0:T.phone))&&void 0!==A?A:""}}})),this.validateMarketingPreferences(null==v?void 0:v.marketingPreferences),(null==v?void 0:v.giftCards)&&(v.giftCards=this.validateGiftCards(null!==(O=null==v?void 0:v.giftCards)&&void 0!==O?O:[])),(null==v?void 0:v.deliveryTips)&&this.validateDeliveryTips(v.deliveryTips),(null==v?void 0:v.refresh)&&(v.refresh=Boolean(v.refresh)),v}validateAndNormalizeCompleteParams(t){const e={...t};if(!e.token||"string"!=typeof(null==e?void 0:e.token))throw new Error("Invalid token");if(!(null==e?void 0:e.payment)||"string"!=typeof(null==e?void 0:e.payment))throw new Error("Invalid payment token");return void 0!==e.refresh&&(e.refresh=Boolean(e.refresh)),e}validateCustomer(t){if(t&&"object"==typeof t){const{firstName:e,lastName:i,phone:r,email:s}=t;if(e&&"string"!=typeof e)throw new Error("Invalid customer first name");if(i&&"string"!=typeof i)throw new Error("Invalid customer last name");if(r&&"string"!=typeof r)throw new Error("Invalid customer phone");if(s&&"string"!=typeof s)throw new Error("Invalid customer email");"hasAgeVerify"in t&&(t.hasAgeVerify=Boolean(t.hasAgeVerify))}}validateBillingAddress(t){if(!t)return{};if("object"!=typeof t||null===t)throw new Error("Invalid address: must be an object if provided");const e={...t};return["one","two","city","state","zip","country","firstName","lastName","email","phone","company"].forEach((t=>{if(t in e&&"string"!=typeof e[t])throw new Error(`Invalid billing address ${t}: must be a string if provided`)})),"state"in e&&e.state&&(e.state=this.locationHelperService.normalizeState(e.state)),e}validateGiftCards(t){if(!t||0===t.length)return[];if(!Array.isArray(t))throw new Error("Invalid gift cards: must be a string array if provided");const e=[...t];return e.forEach((t=>{if("string"!=typeof t)throw new Error("Invalid gift cards: must be a string array if provided")})),e}validateGiftOptions(t){if(void 0!==t&&"object"!=typeof t)throw new Error("Invalid giftOptions: must be an object if provided");if(t){if("message"in t&&"string"!=typeof t.message)throw new Error("Invalid gift message: must be a string if provided");if("recipient"in t){if("object"!=typeof t.recipient)throw new Error("Invalid gift recipient: must be an object if provided");const{name:e,phone:i,email:r}=t.recipient;if("name"in t.recipient&&"string"!=typeof e)throw new Error("Invalid gift recipient name: must be a string if provided");if("phone"in t.recipient&&"string"!=typeof i)throw new Error("Invalid gift recipient phone: must be a string if provided");if("email"in t.recipient&&"string"!=typeof r)throw new Error("Invalid gift recipient email: must be a string if provided")}}}formatPhoneNumber(t){if(!t)return null;const e=t.replace(/[\s().\-_]/g,"").replace(/[^\d+]/g,"");if(e.startsWith("+1")){const t=e.substring(2);if(10===t.length)return`(${t.substring(0,3)}) ${t.substring(3,6)}-${t.substring(6)}`}if(11===e.length&&e.startsWith("1")){const t=e.substring(1);return`(${t.substring(0,3)}) ${t.substring(3,6)}-${t.substring(6)}`}return 10===e.length?`(${e.substring(0,3)}) ${e.substring(3,6)}-${e.substring(6)}`:e.startsWith("+")?e:t}validateMarketingPreferences(t){if(void 0!==t&&"object"!=typeof t)throw new Error("Invalid marketingPreferences: must be an object if provided");t&&("canEmail"in t&&(t.canEmail=Boolean(t.canEmail)),"canSms"in t&&(t.canSms=Boolean(t.canSms)))}validateDeliveryTips(t){if(!Array.isArray(t))throw new Error("Invalid deliveryTips");t.forEach((t=>{if(!t.fulfillmentId||"string"!=typeof t.fulfillmentId)throw new Error("Invalid fulfillmentId in deliveryTip");if("number"!=typeof t.tip||t.tip<0)throw new Error("Invalid tip amount in deliveryTip")}))}}class M{validateAndNormalizeLocation(t){if(!t)return;if("object"!=typeof t)throw new Error("Location must be a valid object");const{coords:e,address:i}=t;e?this.validateCoordinates(e):i&&this.validateAndNormalizeAddress(i)}validateCoordinates(t){if("number"!=typeof t.lat||"number"!=typeof t.long)throw new Error("Coordinates must be valid numbers");if(t.lat<-90||t.lat>90||t.long<-180||t.long>180)throw new Error("Coordinates are out of valid range")}validateAndNormalizeAddress(t){if(!(null==t?void 0:t.state)||"string"!=typeof(null==t?void 0:t.state))throw new Error("State is required and must be a string");if(t.state=this.normalizeState(t.state),!t.city||"string"!=typeof t.city)throw new Error("City is required and must be a string");if(!t.zip||"string"!=typeof t.zip)throw new Error("ZIP code is required and must be a string")}normalizeState(t){const e=t.toUpperCase();if(exports.STATES_CODE[e])return exports.STATES_CODE[e];const i=t.toUpperCase();if(exports.STATES_NAME[i])return exports.STATES_NAME[i];throw new Error(`Invalid state: ${t}`)}}class _{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=!1,this.userID=t.userID,this.password=t.password,this.baseURL=t.baseURL,this.httpClient=P()}static getInstance(t){return _.instance||(_.instance=new _(t)),_.instance}getUniqueKey(){return`${this.userID}_${this.password}_${this.baseURL}`}async authenticate(){var t,e;if(this.isAuthenticating)await new Promise((t=>{const e=()=>{this.isAuthenticating?setTimeout(e,100):t(void 0)};e()}));else{this.isAuthenticating=!0;try{const i=await this.requestWithoutAuth("/order-authentication",{method:"GET"});this.accessToken=null===(t=null==i?void 0:i.data)||void 0===t?void 0:t.token,this.tokenExpiration=Date.now()+1e3*(null===(e=null==i?void 0:i.data)||void 0===e?void 0:e.exp)}catch(t){throw new Error("Failed to authenticate with LiquidCommerce Order API")}finally{this.isAuthenticating=!1}}}async requestWithoutAuth(t,e){const i=new URL(`api${t}`,this.baseURL),r={"Content-Type":"application/json",Authorization:`Basic ${btoa(`${this.userID}:${this.password}`)}`,...e.headers},s={method:e.method,headers:r,body:e.body?JSON.stringify(e.body):void 0},o=await this.httpClient(i.toString(),s);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}async request(t,e){try{this.accessToken&&!this.isTokenExpired()||await this.authenticate();const i=new URL(`api${t}`,this.baseURL),r={"Content-Type":"application/json",Authorization:`Bearer ${this.accessToken}`,...e.headers},s={method:e.method,headers:r,body:e.body?JSON.stringify(e.body):void 0},o=await this.httpClient(i.toString(),s);let n;try{n=await o.json()}catch(t){n={message:await o.text().catch((()=>`HTTP error! status: ${o.status}`))||t}}if(!o.ok)throw{...n,status:o.status,message:(null==n?void 0:n.message)||`HTTP error! status: ${o.status}`};return n}catch(t){throw t}}async get(t,e){return this.request(t,{method:"GET",headers:e})}async post(t,e,i){return this.request(t,{method:"POST",body:e,headers:i})}async put(t,e,i){return this.request(t,{method:"PUT",body:e,headers:i})}async delete(t,e){return this.request(t,{method:"DELETE",headers:e})}}_.instance=null;class B{constructor(t){this.client=t}async autocomplete(t,e){try{return await this.client.post("/address/autocomplete",{...t,key:e})}catch(t){throw t}}async details(t,e){try{return await this.client.post("/address/details",{...t,key:e})}catch(t){throw t}}}class G{constructor(t,e){this.client=t,this.cartHelperService=e,this.servicePath="/cart/update"}async get(t,e){try{let i=this.cartHelperService.validateId(t);if(i=""!==i&&i,i){const t={id:i};return"boolean"==typeof e&&(t.refresh=e),await this.client.post(this.servicePath,t)}return await this.client.post(this.servicePath)}catch(t){throw t}}async update(t){try{const e=this.cartHelperService.validateAndNormalizeParams(t);return await this.client.post(this.servicePath,e)}catch(t){throw t}}}class ${constructor(t,e){this.client=t,this.catalogHelperService=e,this.servicePath="/catalog/"}async availability(t){try{const e=this.catalogHelperService.validateAndNormalizeParams(t);return await this.client.post(`${this.servicePath}availability`,e)}catch(t){throw t}}async search(t){try{const e=this.catalogHelperService.validateAndNormalizeSearchParams(t);if(null==e?void 0:e.error)throw new Error(null==e?void 0:e.error);return await this.client.post(`${this.servicePath}search`,e)}catch(t){throw t}}}class F{constructor(t,e){this.client=t,this.checkoutHelperService=e,this.servicePath="/checkout"}async prepare(t){try{const e=this.checkoutHelperService.validateAndNormalizePrepareParams(t);return await this.client.post(`${this.servicePath}/prepare`,e)}catch(t){throw t}}async complete(t){try{const e=this.checkoutHelperService.validateAndNormalizeCompleteParams(t);return await this.client.post(`${this.servicePath}/complete`,e)}catch(t){throw t}}}class K{constructor(t){this.client=t}async fetch(t){try{return await this.client.get(`/orders/${t}`)}catch(t){throw t}}}class Y{constructor(t){this.paymentProvider=t,this.collapse=()=>this.paymentProvider.collapse(),this.unmount=()=>this.paymentProvider.unmount(),this.destroy=()=>this.paymentProvider.destroy()}async mount(t){try{await this.paymentProvider.mount(t)}catch(t){throw t}}async generateToken(){return this.paymentProvider.generateToken()}subscribe(t,e){this.paymentProvider.subscribe(t,e)}unsubscribe(t,e){this.paymentProvider.unsubscribe(t,e)}}class k{constructor(t,e){this.client=t,this.paymentSessionHelperService=e,this.servicePath="/users",this.env=t.env}async createOrUpdateSession(t){try{if(!(null==t?void 0:t.id)&&!(null==t?void 0:t.email))throw new Error("Either id or email must be provided");return await this.client.post(`${this.servicePath}/session`,t)}catch(t){throw t}}async createPaymentSession(t){try{const e=await this.client.post(`${this.servicePath}/payment-session`,t),i=this.paymentSessionHelperService.rcd(null==e?void 0:e.data,this.env);return{...e,data:i}}catch(t){throw t}}async finalizePaymentSession(t){try{if(!t)throw new Error("Token is required");const e=await this.client.get(`${this.servicePath}/finalize-payment-session/${t}`),i=this.paymentSessionHelperService.dd(null==e?void 0:e.data,t);return{...e,data:i}}catch(t){throw t}}async fetchUser(t){try{if(!t)throw new Error("Id is required");return await this.client.get(`${this.servicePath}/fetch/${t}`)}catch(t){throw t}}async purge(t){try{if(!t)throw new Error("User identifier (ID or email) must be provided");return await this.client.delete(`${this.servicePath}/purge/${t}`)}catch(t){throw t}}async addAddress(t){try{return this.validateAddressParams(t),await this.client.post(`${this.servicePath}/addresses/add`,t)}catch(t){throw t}}async updateAddress(t){try{const e=this.validateAddressParams(t);return await this.client.post(`${this.servicePath}/addresses/update`,e)}catch(t){throw t}}validateAddressParams(t){const e=this.hasUser(t),i=this.hasUserAddressObj(t),r=this.hasUserAddressCoords(t),s=this.hasUserAddressPlacesId(t);if(e)throw new Error("Missing required parameter customerId for address update.");if(i&&r&&s)throw new Error("Missing required parameters for address update, you need at least, an address object or lat and long, or a google placesId");return r||(t.lat=Number(null==t?void 0:t.lat),t.long=Number(null==t?void 0:t.long)),t}hasUser(t){return!(null==t?void 0:t.customerId)||"string"!=typeof(null==t?void 0:t.customerId)}hasUserAddressObj(t){return!((null==t?void 0:t.one)&&"string"==typeof(null==t?void 0:t.one)&&(null==t?void 0:t.city)&&"string"==typeof(null==t?void 0:t.city)&&(null==t?void 0:t.state)&&"string"==typeof(null==t?void 0:t.state)&&(null==t?void 0:t.zip)&&"string"==typeof(null==t?void 0:t.zip)&&(null==t?void 0:t.type)&&"string"==typeof(null==t?void 0:t.type))}hasUserAddressCoords(t){return!(null==t?void 0:t.lat)&&!(null==t?void 0:t.long)||"number"!=typeof Number(null==t?void 0:t.lat)&&"number"!=typeof Number(null==t?void 0:t.long)}hasUserAddressPlacesId(t){return!(null==t?void 0:t.placesId)||"string"!=typeof(null==t?void 0:t.placesId)}async purgeAddress(t){try{if(!t)throw new Error("Address ID must be provided");return await this.client.delete(`${this.servicePath}/addresses/purge/${t}`)}catch(t){throw t}}async addPayment(t){try{if(!t.customerId||!t.paymentMethodId)throw new Error("Missing required parameters to add payment");return void 0===(null==t?void 0:t.isDefault)&&(null==t||delete t.isDefault),await this.client.post(`${this.servicePath}/payments/add`,t)}catch(t){throw t}}async updatePayment(t){try{if(!t.customerId||!t.paymentMethodId)throw new Error("Missing required parameters to add payment");const{customerId:e,paymentMethodId:i}=t;return await this.client.get(`${this.servicePath}/payments/updateDefault/${e}/${i}`)}catch(t){throw t}}async purgePayment(t,e){try{if(!t||!e)throw new Error("Missing required parameters for payment purge");return await this.client.delete(`${this.servicePath}/payments/purge/${t}/${e}`)}catch(t){throw t}}}class V{constructor(t){this.client=t}async test(t){try{return 200===(await this.client.post("/webhook/test",{endpoint:t})).statusCode}catch(t){throw t}}}class q{constructor(){this.services=new Map,this.liquidCommerceOrderClientConstructor=null}static getInstance(){return q.instance||(q.instance=new q),q.instance}setLiquidCommerceOrderClientConstructor(t){this.liquidCommerceOrderClientConstructor=t}async getClient(t){const e=`LiquidCommerceOrderClient_${JSON.stringify(t)}`;if(!this.services.has(e)){if(!this.liquidCommerceOrderClientConstructor)throw new Error("LiquidCommerceOrderClient constructor not set");const i=new this.liquidCommerceOrderClientConstructor(t);await i.init(),this.services.set(e,i)}return this.services.get(e)}getOrCreateService(t,e,...i){if(!this.services.has(t)){const r="getInstance"in e?e.getInstance(...i):new e(...i);this.services.set(t,r)}return this.services.get(t)}getAuthenticatedClient(t){return this.getOrCreateService(`OrderAuthenticatedClient_${JSON.stringify(t)}`,_,t)}getOrderService(t){return this.getOrCreateService(`OrderService_${t.getUniqueKey()}`,K,t)}}q.instance=null;class j{constructor(t){this.client=t,this.stripe=null,this.elements=null,this.paymentElement=null,this.events=["ready","change","loaderror","loaderstart"],this.eventsErrorMsg="The only Payment Element events allowed (change, ready, loaderstart, loadererror)",this.clientSecret=null}async mount(t){if(!document.getElementById(t.elementId))throw new Error(`Element with id "${t.elementId}" not found`);try{this.stripe=await C.loadStripe(t.key)}catch(t){throw new Error("Failed to initialize Stripe")}if(!this.stripe)throw new Error("Failed to initialize Stripe");this.clientSecret=t.clientSecret;try{const{setupIntent:t}=await this.stripe.retrieveSetupIntent(this.clientSecret);if("succeeded"===(null==t?void 0:t.status))throw new Error(`The client secret (${this.clientSecret}) has already been used previously. Generate a new one through a use session.`)}catch(t){throw t}const e={clientSecret:t.clientSecret,appearance:this.mapAppearance(t.appearance),paymentMethodCreation:"manual"};this.elements=this.stripe.elements(e);const i=this.mapElementOptions(t.elementOptions);this.paymentElement=this.elements.create("payment",i),this.paymentElement.mount(`#${t.elementId}`)}async generateToken(){var t,e,i,r,s,o,n,a,E,I;if(!this.stripe||!this.elements||!this.clientSecret)return{type:"client_error",message:"Payment form has not been initialized"};const{error:l}=await this.elements.submit();if(l)return{type:"validation_error",message:l.message,code:l.code};const{error:d,paymentMethod:h}=await this.stripe.createPaymentMethod({elements:this.elements});if(d)return{type:"validation_error"===d.type?"validation_error":"api_error",message:d.message,code:d.code,param:d.param};const{setupIntent:u}=await this.stripe.retrieveSetupIntent(this.clientSecret);if(!u)return{type:"confirm_error",message:"There's been an error during your session confirmation",code:"7190"};const{data:c}=await this.confirmSession({paymentMethodId:null!==(t=null==h?void 0:h.id)&&void 0!==t?t:"",sessionSecret:null!==(e=null==u?void 0:u.id)&&void 0!==e?e:""});return c?h?{id:h.id,type:h.type,card:(null==h?void 0:h.card)?{brand:null!==(r=null===(i=h.card)||void 0===i?void 0:i.brand)&&void 0!==r?r:"",country:null!==(s=h.card.country)&&void 0!==s?s:"",expMonth:null!==(o=h.card.exp_month)&&void 0!==o?o:0,expYear:null!==(n=h.card.exp_year)&&void 0!==n?n:0,last4:null!==(a=h.card.last4)&&void 0!==a?a:"",funding:null!==(E=h.card.funding)&&void 0!==E?E:""}:void 0,created:null!==(I=null==h?void 0:h.created)&&void 0!==I?I:0}:{type:"client_error",message:"Failed to generate payment token"}:{type:"confirm_error",message:"There's been an error during your session confirmation",code:"7191"}}async confirmSession({sessionSecret:t,paymentMethodId:e}){try{if(!t||!e)throw new Error("customerId, sessionSecret, paymentMethodId are required");return await this.client.post("/users/payments/confirm",{sessionSecret:t,paymentMethodId:e})}catch(t){throw t}}subscribe(t,e){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");if(!this.events.includes(t))throw new Error(this.eventsErrorMsg);this.paymentElement.on(t,e)}unsubscribe(t,e){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");if(!this.events.includes(t))throw new Error(this.eventsErrorMsg);this.paymentElement.off(t,e)}mapAppearance(t){if(t)return{theme:"night"===t.theme?"night":"stripe"}}mapElementOptions(t){return{layout:null==t?void 0:t.layout,wallets:{applePay:"auto",googlePay:"auto"}}}unmount(){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");this.paymentElement.unmount()}collapse(){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");this.paymentElement.collapse()}destroy(){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");this.paymentElement.destroy()}}var Q,z,J,X,Z;!function(t){t[t.X=0]="X",t[t.Y=1]="Y"}(Q||(Q={})),function(t){t[t.I=0]="I",t[t.J=1]="J"}(z||(z={})),function(t){t.V="values",t.T="createdAt"}(J||(J={})),function(t){t.P="pk_live_",t.Q="pk_test_",t.R="seti_",t.S="_secret_",t.T_C="ctoken_",t.U="production"}(X||(X={})),function(t){t[t.M=2]="M",t.N="string",t.O="object"}(Z||(Z={}));class tt{rcd(t,e){try{const i=null==t?void 0:t[J.V];this.v(i,Array.isArray,Z.M,tt.F.G);const r=i[Q.X];this.v(r,(t=>typeof t===Z.N),null,tt.F.H);const s=i[Q.Y];return this.v(s,Array.isArray,Z.M,tt.F.I),{key:this.a(r,e),secret:this.b(s[z.I],s[z.J]),createdAt:(null==t?void 0:t[J.T])||new Date}}catch(t){throw new Error(`${tt.F.J}${null==t?void 0:t.message}`)}}v(t,e,i,r){if(!e(t)||null!==i&&t.length<i)throw new Error(r)}a(t,e){return`${e===X.U?X.P:X.Q}${t}`}b(t,e){return t&&e?`${X.R}${t}${X.S}${e}`:""}ocd(t,e){const i=this.gsi(e).replace(X.R,""),r=t.replace(X.T_C,""),s=JSON.stringify([r,i]);return"function"==typeof btoa?btoa(s):Buffer.from(s).toString("base64")}gsi(t){return t.split(X.S)[0]}gdk(t){try{const e="function"==typeof atob?atob(t):Buffer.from(t,"base64").toString("ascii"),[i,r]=JSON.parse(e);return`${X.T_C}${i}${X.R}${r}`}catch(t){throw new Error(`Failed to reconstruct the response data: ${t.message}`)}}dd(t,e){var i,r;const s=this.gdk(e);if(t&&s)try{const e="function"==typeof atob?atob(t):Buffer.from(t,"base64").toString("binary");let o="";for(let t=0;t<e.length;t++)o+=String.fromCharCode((null===(i=null==e?void 0:e.charCodeAt)||void 0===i?void 0:i.call(e,t))^(null===(r=null==s?void 0:s.charCodeAt)||void 0===r?void 0:r.call(s,t%s.length)));return JSON.parse(o)}catch(t){throw new Error(`Failed to reconstruct the response data: ${t.message}`)}return t}}tt.F={G:"Invalid response structure",H:"Invalid primary component",I:"Invalid secondary component",J:"Failed to reconstruct payment session data: "};class et{constructor(){this.services=new Map,this.liquidCommerceClientConstructor=null,this.paymentElementConstructor=null}static getInstance(){return et.instance||(et.instance=new et),et.instance}setLiquidCommerceClientConstructor(t){this.liquidCommerceClientConstructor=t}setPaymentElementConstructor(t){this.paymentElementConstructor=t}async getClient(t,e){const i=`LiquidCommerceClient_${t}_${JSON.stringify(e)}`;if(!this.services.has(i)){if(!this.liquidCommerceClientConstructor)throw new Error("LiquidCommerceClient constructor not set");const r=new this.liquidCommerceClientConstructor(t,e);await r.init(),this.services.set(i,r)}return this.services.get(i)}getPaymentElement(t){var e,i;const r=`PaymentElement_${null===(e=t.session)||void 0===e?void 0:e.key}_${null===(i=null==t?void 0:t.session)||void 0===i?void 0:i.secret}`;if(!this.services.has(r)){if(!this.paymentElementConstructor)throw new Error("PaymentElement constructor not set");const e=new this.paymentElementConstructor(t);this.services.set(r,e)}return this.services.get(r)}getOrCreateService(t,e,...i){if(!this.services.has(t)){const r="getInstance"in e?e.getInstance(...i):new e(...i);this.services.set(t,r)}return this.services.get(t)}getAuthenticatedClient(t){return this.getOrCreateService(`AuthenticatedClient_${JSON.stringify(t)}`,H,t)}getLocationHelperService(){return this.getOrCreateService("LocationHelperService",M)}getAddressService(t){return this.getOrCreateService(`AddressService_${t.getUniqueKey()}`,B,t)}getCatalogHelperService(){return this.getOrCreateService("CatalogHelperService",x,this.getLocationHelperService())}getCatalogService(t){return this.getOrCreateService(`CatalogService_${t.getUniqueKey()}`,$,t,this.getCatalogHelperService())}getCartHelperService(){return this.getOrCreateService("CartHelperService",b,this.getLocationHelperService())}getPaymentSessionHelperService(){return this.getOrCreateService("PaymentSessionHelperService",tt)}getCartService(t){return this.getOrCreateService(`CartService_${t.getUniqueKey()}`,G,t,this.getCartHelperService())}getUserService(t){return this.getOrCreateService(`UserService_${t.getUniqueKey()}`,k,t,this.getPaymentSessionHelperService())}getPaymentProviderService(t){return this.getOrCreateService(`PaymentProviderService_${t.getUniqueKey()}`,j,t)}getPaymentService(t){return this.getOrCreateService(`PaymentService_${t.getUniqueKey()}`,Y,this.getPaymentProviderService(t))}getCheckoutHelperService(){return this.getOrCreateService("CheckoutHelperService",U,this.getLocationHelperService())}getCheckoutService(t){return this.getOrCreateService(`CheckoutService_${t.getUniqueKey()}`,F,t,this.getCheckoutHelperService())}getWebhookService(t){return this.getOrCreateService(`WebhookService_${t.getUniqueKey()}`,V,t)}}et.instance=null;class it{constructor(t,e){this.address={autocomplete:async t=>(await this.ensureAuthenticated(),this.addressService.autocomplete(t,this.config.googlePlacesApiKey)),details:async t=>(await this.ensureAuthenticated(),this.addressService.details(t,this.config.googlePlacesApiKey))},this.catalog={availability:async t=>(await this.ensureAuthenticated(),this.catalogService.availability(t)),search:async t=>(await this.ensureAuthenticated(),this.catalogService.search(t))},this.cart={get:async(t,e)=>(await this.ensureAuthenticated(),this.cartService.get(t,e)),update:async t=>(await this.ensureAuthenticated(),this.cartService.update(t))},this.user={session:async t=>(await this.ensureAuthenticated(),this.userService.createOrUpdateSession(t)),paymentSession:async t=>(await this.ensureAuthenticated(),this.userService.createPaymentSession(t)),confirmPaymentSession:async t=>(await this.ensureAuthenticated(),this.userService.finalizePaymentSession(t)),fetch:async t=>(await this.ensureAuthenticated(),this.userService.fetchUser(t)),purge:async t=>(await this.ensureAuthenticated(),this.userService.purge(t)),addAddress:async t=>(await this.ensureAuthenticated(),this.userService.addAddress(t)),updateAddress:async t=>(await this.ensureAuthenticated(),this.userService.updateAddress(t)),purgeAddress:async t=>(await this.ensureAuthenticated(),this.userService.purgeAddress(t)),addPayment:async t=>(await this.ensureAuthenticated(),this.userService.addPayment(t)),updatePayment:async t=>(await this.ensureAuthenticated(),this.userService.updatePayment(t)),purgePayment:async(t,e)=>(await this.ensureAuthenticated(),this.userService.purgePayment(t,e))},this.payment={mount:async t=>(await this.ensureAuthenticated(),this.paymentService.mount(t)),generateToken:async()=>(await this.ensureAuthenticated(),this.paymentService.generateToken()),subscribe:(t,e)=>{this.paymentService.subscribe(t,e)},unsubscribe:(t,e)=>{this.paymentService.unsubscribe(t,e)},collapse:()=>{this.paymentService.collapse()},unmount:()=>{this.paymentService.unmount()},destroy:()=>{this.paymentService.destroy()}},this.checkout={prepare:async t=>(await this.ensureAuthenticated(),this.checkoutService.prepare(t)),complete:async t=>(await this.ensureAuthenticated(),this.checkoutService.complete(t))},this.webhook={test:async t=>(await this.ensureAuthenticated(),this.webhookService.test(t))},this.config=e,this.singletonManager=et.getInstance();const i=this.determineBaseURL(e);this.authenticatedClient=this.singletonManager.getAuthenticatedClient({apiKey:t,baseURL:i,env:e.env}),this.addressService=this.singletonManager.getAddressService(this.authenticatedClient),this.catalogService=this.singletonManager.getCatalogService(this.authenticatedClient),this.cartService=this.singletonManager.getCartService(this.authenticatedClient),this.userService=this.singletonManager.getUserService(this.authenticatedClient),this.paymentService=this.singletonManager.getPaymentService(this.authenticatedClient),this.checkoutService=this.singletonManager.getCheckoutService(this.authenticatedClient),this.webhookService=this.singletonManager.getWebhookService(this.authenticatedClient)}determineBaseURL(t){const e=t.env||exports.LIQUID_COMMERCE_ENV.STAGE;return f[e]}async init(){try{await this.authenticatedClient.authenticate()}catch(t){throw new Error("Authentication failed during initialization")}}async ensureAuthenticated(){this.authenticatedClient.isTokenExpired()&&await this.authenticatedClient.authenticate()}async auth(){try{return await this.authenticatedClient.getAuth()}catch(t){throw new Error("Authentication failed during initialization")}}}class rt{constructor(t){this.order={fetch:async t=>(await this.ensureOrderAuthenticated(),this.orderService.fetch(t))},this.config=t,this.singletonManager=q.getInstance();const e=this.determineBaseURL(t);this.orderAuthenticatedClient=this.singletonManager.getAuthenticatedClient({userID:t.userID,password:t.password,baseURL:e}),this.orderService=this.singletonManager.getOrderService(this.orderAuthenticatedClient)}determineBaseURL(t){const e=t.env||exports.LIQUID_COMMERCE_ENV.STAGE;return f[e]}async init(){try{await this.orderAuthenticatedClient.authenticate()}catch(t){throw new Error("Order Authentication failed during initialization")}}async ensureOrderAuthenticated(){this.orderAuthenticatedClient.isTokenExpired()&&await this.orderAuthenticatedClient.authenticate()}}class st{constructor(t){var e,i;if(this.provider=null,this.componentSet=null,this.uiComponent=null,this.isProviderLoading=!1,this.providerLoadPromise=null,this.allowedEvents=["ready","change","focus","blur","loaderror","loaderstart"],!(null==t?void 0:t.session.key)||!(null===(e=null==t?void 0:t.session)||void 0===e?void 0:e.secret))throw new Error("Authentication credentials are required.");this.k=t.session.key,this.s=null===(i=t.session)||void 0===i?void 0:i.secret,this.paymentSessionHelperService=new tt}async ensureProviderReady(){return this.provider?this.provider:(this.isProviderLoading&&this.providerLoadPromise||(this.isProviderLoading=!0,this.providerLoadPromise=C.loadStripe(this.k).then((t=>{if(this.isProviderLoading=!1,!t)throw new Error("Failed to initialize payment provider");return this.provider=t,this.provider})).catch((t=>{throw this.isProviderLoading=!1,this.providerLoadPromise=null,t}))),this.providerLoadPromise)}async mount(t){var e,i;if("undefined"==typeof document)throw new Error("Payment UI requires a browser environment.");const r=document.getElementById(t.elementId);if(!r)throw new Error(`Container element "${t.elementId}" not found.`);try{const s=await this.ensureProviderReady();if(!s)throw new Error("Provider initialization failed");const o=null!==(e=null==t?void 0:t.appearance)&&void 0!==e?e:{theme:"stipe"},n={clientSecret:this.s,appearance:o};this.componentSet=s.elements(n);const a={layout:(null===(i=t.elementOptions)||void 0===i?void 0:i.layout)||"tabs",...t.elementOptions||{},defaultValues:{billingDetails:{name:"Guest",address:{country:"US"}}},fields:{billingDetails:{address:{postalCode:"auto",country:"never"}}},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}};this.uiComponent=this.componentSet.create("payment",a),this.uiComponent.mount(r)}catch(t){throw this.logger.error("UI initialization failed:",t),new Error(`Failed to initialize payment UI: ${null==t?void 0:t.message}`)}}async createConfirmationToken(t){var e;if(!this.provider||!this.componentSet||!this.uiComponent)return{type:"client_error",message:"Payment component not initialized. Call mount() first."};try{const{error:i}=await this.componentSet.submit();if(i)return{type:"validation_error",message:i.message||"Form validation failed",code:i.code};const r={elements:this.componentSet,params:{return_url:null!==(e=null==t?void 0:t.returnUrl)&&void 0!==e?e:window.location.href,payment_method_data:{allow_redisplay:"always",billing_details:{name:"Guest",address:{country:"US"}}},shipping:{name:"Guest",address:{country:"US",city:null,line1:null,line2:null,postal_code:null,state:null}}}},{error:s,confirmationToken:o}=await this.provider.createConfirmationToken(r);return s?{type:"validation_error"===s.type?"validation_error":"api_error",message:s.message||"Token generation failed",code:s.code}:o&&o.id?{token:this.paymentSessionHelperService.ocd(o.id,this.s)}:{type:"api_error",message:"Token generation incomplete."}}catch(t){return this.logger.error("Token generation error:",t),{type:"client_error",message:`Unexpected error: ${null==t?void 0:t.message}`}}}get logger(){return{log:(...t)=>{},error:(...t)=>{}}}subscribe(t,e){this.uiComponent?this.allowedEvents.includes(t)?this.uiComponent.on(t,e):this.logger.error(`Event "${t}" not supported. Available: ${this.allowedEvents.join(", ")}`):this.logger.error("Cannot subscribe: Component not initialized.")}unsubscribe(t,e){this.uiComponent?this.allowedEvents.includes(t)?this.uiComponent.off(t,e):this.logger.error(`Event "${t}" not supported.`):this.logger.error("Cannot unsubscribe: Component not initialized.")}unmount(){this.uiComponent&&(this.uiComponent.unmount(),this.logger.log("Component unmounted."))}destroy(){this.uiComponent&&(this.uiComponent.destroy(),this.uiComponent=null,this.componentSet=null,this.logger.log("Component destroyed."))}collapse(){this.uiComponent&&"function"==typeof this.uiComponent.collapse?this.uiComponent.collapse():this.logger.error("Cannot collapse: Component not initialized or action not supported.")}}exports.LiquidCommerce=async function(t,e){const i=et.getInstance();return i.setLiquidCommerceClientConstructor(it),await i.getClient(t,e)},exports.LiquidCommerceOrders=async function(t){const e=q.getInstance();return e.setLiquidCommerceOrderClientConstructor(rt),await e.getClient(t)},exports.LiquidCommercePaymentElement=function(t){const e=et.getInstance();return"function"!=typeof e.setPaymentElementConstructor||"function"!=typeof e.getPaymentElement?(e.t||(e.t=new st(t)),e.t):(e.setPaymentElementConstructor(st),e.getPaymentElement(t))};
|
|
@@ -1,46 +1,22 @@
|
|
|
1
|
+
import type { LIQUID_COMMERCE_ENV } from '../enums';
|
|
2
|
+
import type { IAuth } from '../types';
|
|
1
3
|
interface IAuthConfig {
|
|
2
4
|
apiKey: string;
|
|
3
5
|
baseURL: string;
|
|
6
|
+
env: LIQUID_COMMERCE_ENV;
|
|
4
7
|
}
|
|
5
8
|
/**
|
|
6
9
|
* Represents an authenticated service for making HTTP requests.
|
|
7
10
|
*/
|
|
8
11
|
export declare class AuthenticatedService {
|
|
9
|
-
private static instance;
|
|
10
12
|
private readonly apiKey;
|
|
13
|
+
readonly env: LIQUID_COMMERCE_ENV;
|
|
11
14
|
private readonly baseURL;
|
|
12
15
|
private accessToken;
|
|
13
16
|
private tokenExpiration;
|
|
14
17
|
private isAuthenticating;
|
|
15
18
|
private readonly httpClient;
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* Returns an instance of AuthenticatedClient. This method follows the singleton pattern,
|
|
19
|
-
* meaning that it ensures only one instance of AuthenticatedClient is created.
|
|
20
|
-
*
|
|
21
|
-
* @param {IAuthConfig} config - The configuration object used to initialize the AuthenticatedClient instance.
|
|
22
|
-
* @return {AuthenticatedService} An instance of AuthenticatedClient.
|
|
23
|
-
*/
|
|
24
|
-
static getInstance(config: IAuthConfig): AuthenticatedService;
|
|
25
|
-
/**
|
|
26
|
-
* Returns the appropriate implementation of the `HttpClient` interface for making HTTP requests.
|
|
27
|
-
*
|
|
28
|
-
* If the `fetch` function is available, it will be used to create a new `HttpClient` instance by calling the `fetchAdapter` method.
|
|
29
|
-
* If the `fetch` function is not available but the `global.fetch` function is defined, the `global.fetch` function will be used.
|
|
30
|
-
* If neither the `fetch` function nor the `global.fetch` function is available, but the `window.fetch` function is defined, the `window.fetch` function will be used.
|
|
31
|
-
* If none of the above conditions are met, the `xhrFetch` property will be returned.
|
|
32
|
-
*
|
|
33
|
-
* @return The appropriate implementation of the `HttpClient` interface.
|
|
34
|
-
*/
|
|
35
|
-
private getFetchImplementation;
|
|
36
|
-
/**
|
|
37
|
-
* Returns a HttpClient function that wraps the provided fetch function.
|
|
38
|
-
*
|
|
39
|
-
* @param {FetchFunction} fetchFunc - The fetch function to be wrapped.
|
|
40
|
-
*
|
|
41
|
-
* @return {HttpClient} - The HttpClient function that makes network requests using the provided fetch function.
|
|
42
|
-
*/
|
|
43
|
-
private fetchAdapter;
|
|
19
|
+
constructor(config: IAuthConfig);
|
|
44
20
|
/**
|
|
45
21
|
* Retrieves a unique key based on the apiKey and baseURL properties.
|
|
46
22
|
* The unique key is generated by concatenating the apiKey and baseURL with an underscore.
|
|
@@ -48,15 +24,6 @@ export declare class AuthenticatedService {
|
|
|
48
24
|
* @return {string} The unique key generated by concatenating the apiKey and baseURL.
|
|
49
25
|
*/
|
|
50
26
|
getUniqueKey(): string;
|
|
51
|
-
/**
|
|
52
|
-
* Sends an HTTP request using XMLHttpRequest and returns a Promise that resolves to a custom response object.
|
|
53
|
-
*
|
|
54
|
-
* @param {string} url - The URL to send the request to.
|
|
55
|
-
* @param {IHttpClientOptions} options - The options for the HTTP request.
|
|
56
|
-
* @returns {Promise<ICustomResponse>} - A Promise that resolves to a custom response object.
|
|
57
|
-
* @throws {TypeError} - If the network request fails.
|
|
58
|
-
*/
|
|
59
|
-
private xhrFetch;
|
|
60
27
|
/**
|
|
61
28
|
* Authenticates the user with the LiquidCommerce API.
|
|
62
29
|
*
|
|
@@ -68,6 +35,7 @@ export declare class AuthenticatedService {
|
|
|
68
35
|
* @async
|
|
69
36
|
*/
|
|
70
37
|
authenticate(): Promise<void>;
|
|
38
|
+
getAuth(): Promise<IAuth>;
|
|
71
39
|
private requestWithoutAuth;
|
|
72
40
|
/**
|
|
73
41
|
* Checks if the token is expired.
|
|
@@ -15,6 +15,18 @@ export declare class CatalogHelperService {
|
|
|
15
15
|
* @returns {IAvailabilityParams} - The validated and normalized availability parameters.
|
|
16
16
|
*/
|
|
17
17
|
validateAndNormalizeParams(params: IAvailabilityParams): IAvailabilityParams;
|
|
18
|
+
/**
|
|
19
|
+
* Validates if a string is a valid MongoDB ObjectId format
|
|
20
|
+
* @param {string} id - The string to validate
|
|
21
|
+
* @returns {boolean} - Whether the string is a valid ObjectId format
|
|
22
|
+
*/
|
|
23
|
+
private isValidObjectId;
|
|
24
|
+
/**
|
|
25
|
+
* Validates the retailers array parameter
|
|
26
|
+
* @param {string[]} retailers - Array of retailer IDs to validate
|
|
27
|
+
* @param {string[]} errors - Array to collect validation errors
|
|
28
|
+
*/
|
|
29
|
+
private validateRetailers;
|
|
18
30
|
/**
|
|
19
31
|
* Validates and normalizes the search parameters for catalog search.
|
|
20
32
|
*
|
|
@@ -81,13 +93,14 @@ export declare class CatalogHelperService {
|
|
|
81
93
|
*/
|
|
82
94
|
private validateFulfillmentFilter;
|
|
83
95
|
/**
|
|
84
|
-
* Validates
|
|
96
|
+
* Validates the given binary filter value against the ENUM_BINARY_FILTER.
|
|
97
|
+
* If the value is not valid, it adds an appropriate error message to the errors array.
|
|
85
98
|
*
|
|
86
|
-
* @param value The
|
|
87
|
-
* @param errors
|
|
88
|
-
* @return void
|
|
99
|
+
* @param {ENUM_BINARY_FILTER} value - The binary filter value to validate.
|
|
100
|
+
* @param {string[]} errors - The array to push error messages into if validation fails.
|
|
101
|
+
* @return {void}
|
|
89
102
|
*/
|
|
90
|
-
private
|
|
103
|
+
private validateBinaryFilter;
|
|
91
104
|
/**
|
|
92
105
|
* Validates the given array filter.
|
|
93
106
|
*
|
|
@@ -32,7 +32,7 @@ export declare class CheckoutHelperService {
|
|
|
32
32
|
* Validates the recipient or customer information for a checkout.
|
|
33
33
|
*
|
|
34
34
|
* @param customer - The recipient or customer information to validate.
|
|
35
|
-
* Can be an object of type
|
|
35
|
+
* Can be an object of type ICheckoutCustomer,
|
|
36
36
|
* or a string (presumably a customer ID).
|
|
37
37
|
*
|
|
38
38
|
* @throws {Error} Throws an error if any of the customer's information (firstName, lastName, phone, email) is present but not a string.
|
|
@@ -49,6 +49,14 @@ export declare class CheckoutHelperService {
|
|
|
49
49
|
* @returns {void}
|
|
50
50
|
*/
|
|
51
51
|
private validateBillingAddress;
|
|
52
|
+
/**
|
|
53
|
+
* Validates and normalizes an array of gift cards. Ensures the provided input is an array of strings.
|
|
54
|
+
* Throws an error if the input is invalid.
|
|
55
|
+
*
|
|
56
|
+
* @param {string[]} [giftCards] - Optional array of gift card strings to validate.
|
|
57
|
+
* @return {string[]} A normalized array of gift card strings.
|
|
58
|
+
*/
|
|
59
|
+
private validateGiftCards;
|
|
52
60
|
/**
|
|
53
61
|
* Validates the giftOptions parameter.
|
|
54
62
|
*
|
|
@@ -3,5 +3,8 @@ export * from './cart-helper.service';
|
|
|
3
3
|
export * from './catalog-helper.service';
|
|
4
4
|
export * from './checkout-helper.service';
|
|
5
5
|
export * from './location-helper.service';
|
|
6
|
+
export * from './order-authenticated.service';
|
|
7
|
+
export * from './order-singleton.service';
|
|
6
8
|
export * from './payment-provider.service';
|
|
9
|
+
export * from './payment-session-helper.service';
|
|
7
10
|
export * from './singleton.service';
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
interface IOrderAuthConfig {
|
|
2
|
+
userID: string;
|
|
3
|
+
password: string;
|
|
4
|
+
baseURL: string;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Represents an order authenticated service for making HTTP requests.
|
|
8
|
+
*/
|
|
9
|
+
export declare class OrderAuthenticatedService {
|
|
10
|
+
private static instance;
|
|
11
|
+
private readonly userID;
|
|
12
|
+
private readonly password;
|
|
13
|
+
private readonly baseURL;
|
|
14
|
+
private accessToken;
|
|
15
|
+
private tokenExpiration;
|
|
16
|
+
private isAuthenticating;
|
|
17
|
+
private readonly httpClient;
|
|
18
|
+
private constructor();
|
|
19
|
+
/**
|
|
20
|
+
* Returns an instance of OrderAuthenticatedClient. This method follows the singleton pattern,
|
|
21
|
+
* meaning that it ensures only one instance of OrderAuthenticatedClient is created.
|
|
22
|
+
*
|
|
23
|
+
* @param {IOrderAuthConfig} config - The configuration object used to initialize the OrderAuthenticatedClient instance.
|
|
24
|
+
* @return {OrderAuthenticatedService} An instance of OrderAuthenticatedClient.
|
|
25
|
+
*/
|
|
26
|
+
static getInstance(config: IOrderAuthConfig): OrderAuthenticatedService;
|
|
27
|
+
/**
|
|
28
|
+
* Retrieves a unique key based on the userID, password, and baseURL.
|
|
29
|
+
*
|
|
30
|
+
* @return {string} The unique key generated by concatenating the userID, password, and baseURL.
|
|
31
|
+
*/
|
|
32
|
+
getUniqueKey(): string;
|
|
33
|
+
/**
|
|
34
|
+
* Authenticates the user with the LiquidCommerce Order API.
|
|
35
|
+
*
|
|
36
|
+
* This method sends a POST request to the /api/order-authentication endpoint,
|
|
37
|
+
* and stores the received access token and token expiration time.
|
|
38
|
+
*
|
|
39
|
+
* @returns A Promise that resolves to void.
|
|
40
|
+
* @throws An Error if the authentication fails.
|
|
41
|
+
* @async
|
|
42
|
+
*/
|
|
43
|
+
authenticate(): Promise<void>;
|
|
44
|
+
private requestWithoutAuth;
|
|
45
|
+
/**
|
|
46
|
+
* Checks if the token is expired.
|
|
47
|
+
*
|
|
48
|
+
* @returns {boolean} Returns true if the token is expired, otherwise returns false.
|
|
49
|
+
*/
|
|
50
|
+
isTokenExpired(): boolean;
|
|
51
|
+
/**
|
|
52
|
+
* Sends an HTTP request to the specified path with the provided options and returns a Promise that resolves to the response data.
|
|
53
|
+
*
|
|
54
|
+
* @param path - The path to send the request to.
|
|
55
|
+
* @param options - The options for the request, including method, headers, and body.
|
|
56
|
+
* @returns A Promise that resolves to the response data.
|
|
57
|
+
* @throws {Error} If the response is not successful (status is not ok).
|
|
58
|
+
*/
|
|
59
|
+
private request;
|
|
60
|
+
/**
|
|
61
|
+
* Sends a GET request to the specified path with optional headers.
|
|
62
|
+
*
|
|
63
|
+
* @param {string} path - The path to send the request to.
|
|
64
|
+
* @param {Record<string, string>} [headers] - Optional headers to include in the request.
|
|
65
|
+
* @return {Promise<T>} - A promise that resolves to the response data.
|
|
66
|
+
*/
|
|
67
|
+
get<T = any>(path: string, headers?: Record<string, string>): Promise<T>;
|
|
68
|
+
/**
|
|
69
|
+
* Sends a POST request to the specified path with optional body and headers.
|
|
70
|
+
*
|
|
71
|
+
* @param {string} path - The path to send the POST request to.
|
|
72
|
+
* @param {any} [body] - The optional body of the request.
|
|
73
|
+
* @param {Record<string, string>} [headers] - The optional headers of the request.
|
|
74
|
+
*
|
|
75
|
+
* @return {Promise<T>} - A Promise that resolves to the response of the request.
|
|
76
|
+
*
|
|
77
|
+
* @throws {Error} - If an error occurs while making the request.
|
|
78
|
+
*/
|
|
79
|
+
post<T = any>(path: string, body?: any, headers?: Record<string, string>): Promise<T>;
|
|
80
|
+
/**
|
|
81
|
+
* Sends a PUT request to the specified path with optional request body and headers.
|
|
82
|
+
*
|
|
83
|
+
* @param {string} path - The path where the PUT request will be sent.
|
|
84
|
+
* @param {any} [body] - The optional body of the request.
|
|
85
|
+
* @param {Record<string, string>} [headers] - The optional headers of the request.
|
|
86
|
+
* @return {Promise<T>} A Promise that resolves with the response data.
|
|
87
|
+
*/
|
|
88
|
+
put<T = any>(path: string, body?: any, headers?: Record<string, string>): Promise<T>;
|
|
89
|
+
/**
|
|
90
|
+
* Deletes a resource from the server using the HTTP DELETE method.
|
|
91
|
+
*
|
|
92
|
+
* @param path - The path of the resource to delete.
|
|
93
|
+
* @param headers - Optional headers to include in the request.
|
|
94
|
+
* @returns A promise that resolves to the deleted resource.
|
|
95
|
+
*/
|
|
96
|
+
delete<T = any>(path: string, headers?: Record<string, string>): Promise<T>;
|
|
97
|
+
}
|
|
98
|
+
export {};
|