@liquidcommerce/cloud-sdk 1.8.0 → 1.9.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.
@@ -1 +1 @@
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()}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})}}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
+ "use strict";var LIQUID_COMMERCE_ENV,t,e,r,i,s,o,n,a,E,I,l,d,h,u,c,R,N,T,p,O,A,S,v,y,m,W,D,w,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,(r=exports.STATES_CODE||(exports.STATES_CODE={})).AL="AL",r.AK="AK",r.AR="AR",r.AZ="AZ",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.ARIZONA="AZ",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_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.RETAILER_ONDEMAND_HOURS_NOT_AVAILABLE="RetailerOnDemandHoursNotAvailable",l.MAX_QUANTITY_PER_ORDER_EXCEEDED="MaxQuantityPerOrderExceeded",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",h[h.REQUEST_COMPLETE_CUSTOMER_MISSING_FIELDS=5504]="REQUEST_COMPLETE_CUSTOMER_MISSING_FIELDS",h[h.REQUEST_RETAILER_HOURS_ERROR=5505]="REQUEST_RETAILER_HOURS_ERROR",h[h.REQUEST_ITEM_QUANTITY_CHANGE_ERROR=5506]="REQUEST_ITEM_QUANTITY_CHANGE_ERROR",h[h.REQUEST_MAX_QUANTITY_PER_ORDER_ERROR=5507]="REQUEST_MAX_QUANTITY_PER_ORDER_ERROR",h[h.REQUEST_PRESALE_NOT_STARTED_ERROR=5508]="REQUEST_PRESALE_NOT_STARTED_ERROR",h[h.REQUEST_CART_MIN_RETAILER_NOT_MET_ERROR=5509]="REQUEST_CART_MIN_RETAILER_NOT_MET_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="Item(s) in your cart are no longer available",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.",u.REQUEST_COMPLETE_CUSTOMER_MISSING_FIELDS="Customer profile information is incomplete. Please provide all required details.",u.REQUEST_RETAILER_HOURS_ERROR="The retailer is currently closed or on-demand hours are not available.",u.REQUEST_ITEM_QUANTITY_CHANGE_ERROR="Some items in your cart exceed available stock quantities. Please adjust your cart and try again.",u.REQUEST_MAX_QUANTITY_PER_ORDER_ERROR="You have exceeded the maximum quantity allowed per order for one or more items in your cart.",u.REQUEST_PRESALE_NOT_STARTED_ERROR="The presale for this item has not started yet. Please check back later.",u.REQUEST_CART_MIN_RETAILER_NOT_MET_ERROR="Some items in your cart do not meet the minimum retailer requirements per order quantity. Please adjust your cart and try again.",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",c.RETAILER_ONDEMAND_HOURS_NOT_AVAILABLE="RetailerOnDemandHoursNotAvailable",c.ITEM_QTY_CHANGE="ItemQuantityChange",c.MAX_QUANTITY_PER_ORDER_EXCEEDED="MaxQuantityPerOrderExceeded",exports.ENUM_ORDER_STATUS=void 0,(R=exports.ENUM_ORDER_STATUS||(exports.ENUM_ORDER_STATUS={})).CREATED="created",R.PROCESSING="processing",R.CANCELED="canceled",R.DELIVERED="delivered",R.TEST="test",exports.ENUM_ORDER_SYSTEM=void 0,(N=exports.ENUM_ORDER_SYSTEM||(exports.ENUM_ORDER_SYSTEM={})).LIQUIDCOMMERCE="LiquidCommerce OMS",N.RESERVEBAR="ReserveBar OMS",exports.ENUM_ORDER_PACKAGE_STATUS=void 0,(T=exports.ENUM_ORDER_PACKAGE_STATUS||(exports.ENUM_ORDER_PACKAGE_STATUS={})).PENDING="pending",T.SHIPPED="shipped",T.DELIVERED="delivered",T.CANCELED="canceled",T.RETURNED="returned",exports.ENUM_ORDER_FULFILLMENT_TYPE=void 0,(p=exports.ENUM_ORDER_FULFILLMENT_TYPE||(exports.ENUM_ORDER_FULFILLMENT_TYPE={})).SHIPPING="shipping",p.ON_DEMAND="onDemand",p.DIGITAL="digital",p.BOPIS="bopis",exports.ENUM_CUSTOMER_PLACEMENT=void 0,(O=exports.ENUM_CUSTOMER_PLACEMENT||(exports.ENUM_CUSTOMER_PLACEMENT={})).STANDARD="standard",O.PRE_SALE="pre_sale",O.BACK_ORDER="back_order",exports.ENUM_BEER=void 0,(A=exports.ENUM_BEER||(exports.ENUM_BEER={})).ALE="BEER > ALE",A.LAGER="BEER > LAGER",A.BASE="BEER",A.NON_ALCOHOLIC="BEER > NON-ALCOHOLIC",A.OTHER_BEER="BEER > OTHER",A.OTHER_BEER_SOUR_BEER="BEER > SOUR BEER",A.OTHER_BEER_FLAVORED_BEER="BEER > FLAVORED BEER",A.OTHER_BEER_FRUIT_BEER="BEER > FRUIT BEER",exports.ENUM_FOOD=void 0,(S=exports.ENUM_FOOD||(exports.ENUM_FOOD={})).BASE="FOOD",S.PANTRY_OTHER="FOOD > PANTRY > OTHER",S.CANDY="FOOD > CANDY",S.CANDY_OTHER="FOOD > CANDY > OTHER",S.CBD="FOOD > CBD",S.CBD_OTHER="FOOD > CBD > OTHER",S.CHEESE="FOOD > CHEESE",S.CHEESE_OTHER="FOOD > CHEESE > OTHER",S.HOUSEHOLD="FOOD > HOUSEHOLD",S.HOUSEHOLD_SNACKS="FOOD > HOUSEHOLD > SNACKS",S.HOUSEHOLD_OTHER="FOOD > HOUSEHOLD > OTHER",S.PANTRY="FOOD > PANTRY",S.FRUIT="FOOD > FRUIT",S.OTHER="FOOD > OTHER",S.ICE="FOOD > ICE",S.ICE_CREAM="FOOD > ICE CREAM",S.PARTY_SUPPLIES="FOOD > PARTY SUPPLIES",S.PARTY_SUPPLIES_OTHER="FOOD > PARTY SUPPLIES > OTHER",S.SPIRITS_BASED="FOOD > SPIRITS BASED",S.GARNISHES="FOOD > GARNISHES",exports.ENUM_MERCHANDISE=void 0,(v=exports.ENUM_MERCHANDISE||(exports.ENUM_MERCHANDISE={})).BASE="MERCHANDISE",v.GLASSWARE="MERCHANDISE > GLASSWARE",v.GLASSWARE_OTHER="MERCHANDISE > GLASSWARE > OTHER",v.HUMIDOR="MERCHANDISE > HUMIDOR",v.ACCESSORY="MERCHANDISE > ACCESSORY",v.ACCESSORY_OTHER="MERCHANDISE > ACCESSORY > OTHER",v.GIFT_SET="MERCHANDISE > GIFT SET",v.GIFT_SET_GIFT_BAG="MERCHANDISE > GIFT SET > GIFT BAG",v.GIFT_SET_GIFT_CARD="MERCHANDISE > GIFT SET > GIFT CARD",v.BAR_TOOLS="MERCHANDISE > BAR TOOLS",v.BAR_TOOLS_ICE_BUCKET="MERCHANDISE > BAR TOOLS > ICE BUCKET",v.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,(D=exports.ENUM_SPIRITS||(exports.ENUM_SPIRITS={})).BASE="SPIRITS",D.AMARO_APERITIF_VERMOUTH="SPIRITS > AMARO APERITIF & VERMOUTH",D.AMARO_APERITIF_VERMOUTH_OTHER="SPIRITS > AMARO APERITIF & VERMOUTH > OTHER",D.BAIJIU="SPIRITS > BAIJIU",D.BITTERS="SPIRITS > BITTERS",D.BRANDY="SPIRITS > BRANDY",D.BRANDY_COGNAC="SPIRITS > BRANDY > COGNAC",D.CACHACA="SPIRITS > CACHACA",D.GIN="SPIRITS > GIN",D.GIN_DRY_GIN="SPIRITS > GIN > DRY GIN",D.GIN_FLAVORED_GIN="SPIRITS > GIN > FLAVORED GIN",D.GIN_OLD_TOM_GIN="SPIRITS > GIN > OLD TOM GIN",D.GIN_OTHER="SPIRITS > GIN > OTHER",D.GRAIN_ALCOHOL="SPIRITS > GRAIN ALCOHOL",D.LIQUEUR="SPIRITS > LIQUEUR",D.MEZCAL="SPIRITS > MEZCAL",D.OTHER_SPIRITS="SPIRITS > OTHER SPIRITS",D.RUM="SPIRITS > RUM",D.RUM_AGED_RUM="SPIRITS > RUM > AGED RUM",D.RUM_DARK_RUM="SPIRITS > RUM > DARK RUM",D.RUM_FLAVORED_RUM="SPIRITS > RUM > FLAVORED RUM",D.RUM_GOLD_RUM="SPIRITS > RUM > GOLD RUM",D.RUM_OTHER="SPIRITS > RUM > OTHER",D.RUM_SPICED="SPIRITS > RUM > SPICED",D.RUM_WHITE_RUM="SPIRITS > RUM > WHITE RUM",D.SHOCHU="SPIRITS > SHOCHU",D.SOJU="SPIRITS > SOJU",D.SOTOL="SPIRITS > SOTOL",D.TEQUILA="SPIRITS > TEQUILA",D.TEQUILA_ANEJO="SPIRITS > TEQUILA > AÑEJO",D.TEQUILA_BLANCO="SPIRITS > TEQUILA > BLANCO",D.TEQUILA_CRISTALINO="SPIRITS > TEQUILA > CRISTALINO",D.TEQUILA_EXTRA_ANEJO="SPIRITS > TEQUILA > EXTRA AÑEJO",D.TEQUILA_OTHER="SPIRITS > TEQUILA > OTHER",D.TEQUILA_REPOSADO="SPIRITS > TEQUILA > REPOSADO",D.VODKA="SPIRITS > VODKA",D.VODKA_FLAVORED_VODKA="SPIRITS > VODKA > FLAVORED VODKA",D.VODKA_OTHER="SPIRITS > VODKA > OTHER",D.VODKA_REGULAR_VODKA="SPIRITS > VODKA > REGULAR VODKA",D.WHISKEY="SPIRITS > WHISKEY",D.WHISKEY_AMERICAN_WHISKEY="SPIRITS > WHISKEY > AMERICAN WHISKEY",D.WHISKEY_BOURBON="SPIRITS > WHISKEY > BOURBON",D.WHISKEY_CANADIAN_WHISKEY="SPIRITS > WHISKEY > CANADIAN WHISKEY",D.WHISKEY_IRISH_WHISKEY="SPIRITS > WHISKEY > IRISH WHISKEY",D.WHISKEY_MOONSHINE="SPIRITS > WHISKEY > MOONSHINE",D.WHISKEY_FLAVORED="SPIRITS > WHISKEY > FLAVORED WHISKEY",D.WHISKEY_OTHER="SPIRITS > WHISKEY > OTHER",D.WHISKEY_SCOTCH="SPIRITS > WHISKEY > SCOTCH",exports.ENUM_WINE=void 0,(w=exports.ENUM_WINE||(exports.ENUM_WINE={})).BASE="WINE",w.CHAMPAGNE_SPARKLING="WINE > CHAMPAGNE & SPARKLING",w.CHAMPAGNE_SPARKLING_CAVA="WINE > CHAMPAGNE & SPARKLING > CAVA",w.CHAMPAGNE_SPARKLING_CHAMPAGNE="WINE > CHAMPAGNE & SPARKLING > CHAMPAGNE",w.CHAMPAGNE_SPARKLING_PROSECCO="WINE > CHAMPAGNE & SPARKLING > PROSECCO",w.CHAMPAGNE_SPARKLING_SPARKLING_WINE="WINE > CHAMPAGNE & SPARKLING > SPARKLING WINE",w.CHAMPAGNE_SPARKLING_OTHER="WINE > CHAMPAGNE & SPARKLING > OTHER",w.COOKING="WINE > COOKING",w.DESSERT_FORTIFIED_WINE="WINE > DESSERT & FORTIFIED WINE",w.DESSERT_FORTIFIED_WINE_MEAD="WINE > DESSERT & FORTIFIED WINE > MEAD",w.DESSERT_FORTIFIED_WINE_PORT="WINE > DESSERT & FORTIFIED WINE > PORT",w.DESSERT_FORTIFIED_WINE_SHERRY="WINE > DESSERT & FORTIFIED WINE > SHERRY",w.DESSERT_FORTIFIED_WINE_OTHER="WINE > DESSERT & FORTIFIED WINE > OTHER",w.RED_WINE="WINE > RED WINE",w.RED_WINE_AGIORGITIKO="WINE > RED WINE > AGIORGITIKO",w.RED_WINE_AGLIANICO="WINE > RED WINE > AGLIANICO",w.RED_WINE_ALICANTE_BOUSCHET="WINE > RED WINE > ALICANTE BOUSCHET",w.RED_WINE_BARBERA="WINE > RED WINE > BARBERA",w.RED_WINE_BARBARESCO="WINE > RED WINE > BARBARESCO",w.RED_WINE_BAROLO="WINE > RED WINE > BAROLO",w.RED_WINE_BEAUJOLAIS="WINE > RED WINE > BEAUJOLAIS",w.RED_WINE_BLAUER_ZWEIGELT="WINE > RED WINE > BLAUER ZWEIGELT",w.RED_WINE_BOBAL="WINE > RED WINE > BOBAL",w.RED_WINE_BONARDA="WINE > RED WINE > BONARDA",w.RED_WINE_BORDEAUX="WINE > RED WINE > BORDEAUX",w.RED_WINE_BORDEAUX_BLEND="WINE > RED WINE > BORDEAUX BLEND",w.RED_WINE_BURGUNDY="WINE > RED WINE > BURGUNDY",w.RED_WINE_CABERNET_FRANC="WINE > RED WINE > CABERNET FRANC",w.RED_WINE_CABERNET_SAUVIGNON="WINE > RED WINE > CABERNET SAUVIGNON",w.RED_WINE_CANNONAU="WINE > RED WINE > CANNONAU",w.RED_WINE_CARMENERE="WINE > RED WINE > CARMENERE",w.RED_WINE_CHAMBOURCIN="WINE > RED WINE > CHAMBOURCIN",w.RED_WINE_CHIANTI="WINE > RED WINE > CHIANTI",w.RED_WINE_CINSAULT="WINE > RED WINE > CINSAULT",w.RED_WINE_CORVINA="WINE > RED WINE > CORVINA",w.RED_WINE_DOLCETTO="WINE > RED WINE > DOLCETTO",w.RED_WINE_DORNFELDER="WINE > RED WINE > DORNFELDER",w.RED_WINE_FETEASCA_NEAGRA="WINE > RED WINE > FETEASCA NEAGRA",w.RED_WINE_GAMAY="WINE > RED WINE > GAMAY",w.RED_WINE_GRACIANO="WINE > RED WINE > GRACIANO",w.RED_WINE_GRENACHE="WINE > RED WINE > GRENACHE",w.RED_WINE_LIMNIO="WINE > RED WINE > LIMNIO",w.RED_WINE_MACABEO="WINE > RED WINE > MACABEO",w.RED_WINE_MALBEC="WINE > RED WINE > MALBEC",w.RED_WINE_MENCIA="WINE > RED WINE > MENCIA",w.RED_WINE_MERLOT="WINE > RED WINE > MERLOT",w.RED_WINE_MONICA="WINE > RED WINE > MONICA",w.RED_WINE_MONTEPULCIANO="WINE > RED WINE > MONTEPULCIANO",w.RED_WINE_MOURVEDRE_MONASTRELL="WINE > RED WINE > MOURVEDRE/MONASTRELL",w.RED_WINE_NEBBIOLO="WINE > RED WINE > NEBBIOLO",w.RED_WINE_NEGROAMARO="WINE > RED WINE > NEGROAMARO",w.RED_WINE_NERELLO_MASCALESE="WINE > RED WINE > NERELLO MASCALESE",w.RED_WINE_NERO_DAVOLA="WINE > RED WINE > NERO D'AVOLA",w.RED_WINE_PETIT_VERDOT="WINE > RED WINE > PETIT VERDOT",w.RED_WINE_PETITE_SIRAH="WINE > RED WINE > PETITE SIRAH",w.RED_WINE_PINOT_NOIR="WINE > RED WINE > PINOT NOIR",w.RED_WINE_PINOTAGE="WINE > RED WINE > PINOTAGE",w.RED_WINE_PRIMITIVO="WINE > RED WINE > PRIMITIVO",w.RED_WINE_RED_BLEND="WINE > RED WINE > RED BLEND",w.RED_WINE_RHONE_BLEND="WINE > RED WINE > RHONE BLEND",w.RED_WINE_RIOJA="WINE > RED WINE > RIOJA",w.RED_WINE_SAGRANTINO="WINE > RED WINE > SAGRANTINO",w.RED_WINE_SANGIOVESE="WINE > RED WINE > SANGIOVESE",w.RED_WINE_SAPERAVI="WINE > RED WINE > SAPERAVI",w.RED_WINE_SCHIAVA_TROLLINGER="WINE > RED WINE > SCHIAVA/TROLLINGER",w.RED_WINE_SYRAH_SHIRAZ="WINE > RED WINE > SYRAH/SHIRAZ",w.RED_WINE_TANNAT="WINE > RED WINE > TANNAT",w.RED_WINE_TEMPRANILLO="WINE > RED WINE > TEMPRANILLO",w.RED_WINE_TEROLDEGO="WINE > RED WINE > TEROLDEGO",w.RED_WINE_TINTA_DEL_TORO="WINE > RED WINE > TINTA DEL TORO",w.RED_WINE_TOURIGA_NACIONAL="WINE > RED WINE > TOURIGA NACIONAL",w.RED_WINE_VALPOLICELLA="WINE > RED WINE > VALPOLICELLA",w.RED_WINE_XINOMAVRO="WINE > RED WINE > XINOMAVRO",w.RED_WINE_ZINFANDEL="WINE > RED WINE > ZINFANDEL",w.RED_WINE_ZWEIGELT="WINE > RED WINE > ZWEIGELT",w.RED_WINE_OTHER="WINE > RED WINE > OTHER",w.ROSE_WINE="WINE > ROSE WINE",w.SAKE="WINE > SAKE",w.WHITE_WINE="WINE > WHITE WINE",w.WHITE_WINE_ALBARINO_ALVARINHO="WINE > WHITE WINE > ALBARINO/ALVARINHO",w.WHITE_WINE_ARNEIS="WINE > WHITE WINE > ARNEIS",w.WHITE_WINE_ASTI="WINE > WHITE WINE > ASTI",w.WHITE_WINE_ASSYRTIKO="WINE > WHITE WINE > ASSYRTIKO",w.WHITE_WINE_BURGUNDY="WINE > WHITE WINE > BURGUNDY",w.WHITE_WINE_CARRICANTE="WINE > WHITE WINE > CARRICANTE",w.WHITE_WINE_CATARRATTO="WINE > WHITE WINE > CATARRATTO",w.WHITE_WINE_CHABLIS="WINE > WHITE WINE > CHABLIS",w.WHITE_WINE_CHARDONNAY="WINE > WHITE WINE > CHARDONNAY",w.WHITE_WINE_CHENIN_BLANC="WINE > WHITE WINE > CHENIN BLANC",w.WHITE_WINE_CORTESE="WINE > WHITE WINE > CORTESE",w.WHITE_WINE_FALANGHINA="WINE > WHITE WINE > FALANGHINA",w.WHITE_WINE_FIANO="WINE > WHITE WINE > FIANO",w.WHITE_WINE_FRIULANO="WINE > WHITE WINE > FRIULANO",w.WHITE_WINE_FURMINT="WINE > WHITE WINE > FURMINT",w.WHITE_WINE_GARGANEGA="WINE > WHITE WINE > GARGANEGA",w.WHITE_WINE_GAVI="WINE > WHITE WINE > GAVI",w.WHITE_WINE_GEWURZTRAMINER="WINE > WHITE WINE > GEWURZTRAMINER",w.WHITE_WINE_GRECO_DI_TUFO="WINE > WHITE WINE > GRECO DI TUFO",w.WHITE_WINE_GRENACHE_BLANC="WINE > WHITE WINE > GRENACHE BLANC",w.WHITE_WINE_GRUNER_VELTLINER="WINE > WHITE WINE > GRUNER VELTLINER",w.WHITE_WINE_HUXELREBE="WINE > WHITE WINE > HUXELREBE",w.WHITE_WINE_INZOLIA="WINE > WHITE WINE > INZOLIA",w.WHITE_WINE_MALVASIA="WINE > WHITE WINE > MALVASIA",w.WHITE_WINE_MELON_DE_BOURGOGNE="WINE > WHITE WINE > MELON DE BOURGOGNE",w.WHITE_WINE_MOSCATO_BIANCO="WINE > WHITE WINE > MOSCATO BIANCO",w.WHITE_WINE_MOSCHOFILERO_FILERI="WINE > WHITE WINE > MOSCHOFILERO/FILERI",w.WHITE_WINE_MULLER_THURGAU_RIVANER="WINE > WHITE WINE > MULLER-THURGAU/RIVANER",w.WHITE_WINE_MUSCAT_MOSCATO="WINE > WHITE WINE > MUSCAT/MOSCATO",w.WHITE_WINE_PECORINO="WINE > WHITE WINE > PECORINO",w.WHITE_WINE_PICPOUL="WINE > WHITE WINE > PICPOUL",w.WHITE_WINE_PINOT_BLANC="WINE > WHITE WINE > PINOT BLANC",w.WHITE_WINE_PINOT_GRIGIO_PINOT_GRIS="WINE > WHITE WINE > PINOT GRIGIO/PINOT GRIS",w.WHITE_WINE_POUILLY_FUISSE="WINE > WHITE WINE > POUILLY-FUISSE",w.WHITE_WINE_POUILLY_FUME="WINE > WHITE WINE > POUILLY-FUME",w.WHITE_WINE_RIESLING="WINE > WHITE WINE > RIESLING",w.WHITE_WINE_RIOJA="WINE > WHITE WINE > RIOJA",w.WHITE_WINE_RODITIS="WINE > WHITE WINE > RODITIS",w.WHITE_WINE_SANCERRE="WINE > WHITE WINE > SANCERRE",w.WHITE_WINE_SAUVIGNON_BLANC="WINE > WHITE WINE > SAUVIGNON BLANC",w.WHITE_WINE_SEMILLON="WINE > WHITE WINE > SEMILLON",w.WHITE_WINE_SOAVE="WINE > WHITE WINE > SOAVE",w.WHITE_WINE_SYLVANER="WINE > WHITE WINE > SYLVANER",w.WHITE_WINE_TORRONTES="WINE > WHITE WINE > TORRONTES",w.WHITE_WINE_TREBBIANO_UGNI_BLANC="WINE > WHITE WINE > TREBBIANO/UGNI BLANC",w.WHITE_WINE_TURBIANA="WINE > WHITE WINE > TURBIANA",w.WHITE_WINE_TXAKOLINA="WINE > WHITE WINE > TXAKOLINA",w.WHITE_WINE_VERDEJO="WINE > WHITE WINE > VERDEJO",w.WHITE_WINE_VERDICCHIO="WINE > WHITE WINE > VERDICCHIO",w.WHITE_WINE_VERMENTINO="WINE > WHITE WINE > VERMENTINO",w.WHITE_WINE_VERNACCIA="WINE > WHITE WINE > VERNACCIA",w.WHITE_WINE_VIDIANO="WINE > WHITE WINE > VIDIANO",w.WHITE_WINE_VINHO_VERDE="WINE > WHITE WINE > VINHO VERDE",w.WHITE_WINE_VIOGNIER="WINE > WHITE WINE > VIOGNIER",w.WHITE_WINE_VIURA="WINE > WHITE WINE > VIURA",w.WHITE_WINE_OTHER="WINE > WHITE WINE > OTHER",w.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 g(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()}}}const L=(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)}));function P(){return"undefined"!=typeof fetch?g(fetch):"undefined"!=typeof global&&global.fetch?g(global.fetch):L}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 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=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 getAuth(){const t=await this.requestWithoutAuth("/authentication",{method:"GET"});return null==t?void 0:t.data}async requestWithoutAuth(t,e){const r=new URL(`api${t}`,this.baseURL),i={"Content-Type":"application/json","X-LIQUID-API-KEY":this.apiKey,"X-LIQUID-API-OBF":"true",...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){try{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,"X-LIQUID-API-OBF":"true","X-LIQUID-API-SDK":"true",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);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,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})}}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 U{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,n,a,E,I;const l={...t},d=null!==(e=null==l?void 0:l.upcs)&&void 0!==e?e:[],h=null!==(r=null==l?void 0:l.grouping)&&void 0!==r?r:[],u=null!==(i=null==l?void 0:l.ids)&&void 0!==i?i:[];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,r)=>{"string"!=typeof t?e.push(`Retailer at index ${r} must be a string`):this.isValidObjectId(t)||e.push(`Retailer ID at index ${r} must be a valid ObjectId string`)}))):e.push("Retailers must be an array"))}validateAndNormalizeSearchParams(t){const e=[],r={...t};return this.validateRetailers(r.retailers,e),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: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 r=Object.values(exports.ENUM_MODALITIES);t.forEach((t=>{r.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,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 x{constructor(t){this.locationHelperService=t}validateAndNormalizePrepareParams(t){var e,r,i,s,o,n,a,E,I,l,d,h,u,c,R,N,T,p,O,A;let S={...t};if(!(null==S?void 0:S.cartId)||"string"!=typeof(null==S?void 0:S.cartId))throw new Error("Invalid cartId");return this.validateCustomer(S.customer),(null==S?void 0:S.billingAddress)&&this.validateBillingAddress(S.billingAddress),S.hasAgeVerify=Boolean(null!==(i=null!==(e=null==S?void 0:S.hasAgeVerify)&&void 0!==e?e:null===(r=null==S?void 0:S.customer)||void 0===r?void 0:r.hasAgeVerify)&&void 0!==i&&i),S.hasSubstitutionPolicy=Boolean(null==S?void 0:S.hasSubstitutionPolicy),S.acceptedAccountCreation=Boolean(null==S?void 0:S.acceptedAccountCreation),S.isGift=Boolean(null==S?void 0:S.isGift),S.billingSameAsShipping=Boolean(null==S?void 0:S.billingSameAsShipping),S&&(null==S?void 0:S.billingAddress)&&""!==(null===(s=null==S?void 0:S.billingAddress)||void 0===s?void 0:s.phone)&&(S={...S,billingAddress:{...null!==(o=null==S?void 0:S.billingAddress)&&void 0!==o?o:{},phone:null!==(a=this.formatPhoneNumber(null===(n=S.billingAddress)||void 0===n?void 0:n.phone))&&void 0!==a?a:""}}),S&&(null==S?void 0:S.customer)&&""!==(null===(E=null==S?void 0:S.customer)||void 0===E?void 0:E.phone)&&(S={...S,customer:{...null!==(I=null==S?void 0:S.customer)&&void 0!==I?I:{},phone:null!==(d=this.formatPhoneNumber(null===(l=null==S?void 0:S.customer)||void 0===l?void 0:l.phone))&&void 0!==d?d:""}}),(null==S?void 0:S.isGift)&&(this.validateGiftOptions(S.giftOptions),S&&(null==S?void 0:S.giftOptions)&&""!==(null===(u=null===(h=null==S?void 0:S.giftOptions)||void 0===h?void 0:h.recipient)||void 0===u?void 0:u.phone)&&(S={...S,giftOptions:{...null!==(c=null==S?void 0:S.giftOptions)&&void 0!==c?c:{},recipient:{...null!==(N=null===(R=null==S?void 0:S.giftOptions)||void 0===R?void 0:R.recipient)&&void 0!==N?N:{},phone:null!==(O=this.formatPhoneNumber(null===(p=null===(T=S.giftOptions)||void 0===T?void 0:T.recipient)||void 0===p?void 0:p.phone))&&void 0!==O?O:""}}})),this.validateMarketingPreferences(null==S?void 0:S.marketingPreferences),(null==S?void 0:S.giftCards)&&(S.giftCards=this.validateGiftCards(null!==(A=null==S?void 0:S.giftCards)&&void 0!==A?A:[])),(null==S?void 0:S.deliveryTips)&&this.validateDeliveryTips(S.deliveryTips),(null==S?void 0:S.refresh)&&(S.refresh=Boolean(S.refresh)),S}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}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("message"in t&&"string"==typeof t.message&&t.message.length>500)throw new Error("Invalid gift message: Gift message cannot exceed 500 characters");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 _{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()}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 r=await this.requestWithoutAuth("/order-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 Order API")}finally{this.isAuthenticating=!1}}}async requestWithoutAuth(t,e){const r=new URL(`api${t}`,this.baseURL),i={"Content-Type":"application/json",Authorization:`Basic ${btoa(`${this.userID}:${this.password}`)}`,...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){try{this.accessToken&&!this.isTokenExpired()||await this.authenticate();const r=new URL(`api${t}`,this.baseURL),i={"Content-Type":"application/json",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);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,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})}}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 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 ${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),r=this.paymentSessionHelperService.rcd(null==e?void 0:e.data,this.env);return{...e,data:r}}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}`),r=this.paymentSessionHelperService.dd(null==e?void 0:e.data,t);return{...e,data:r}}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)throw new Error("Missing required parameters to add payment");const{customerId:e,paymentMethodId:r}=t;return await this.client.get(`${this.servicePath}/payments/updateDefault/${e}/${r}`)}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 r=new this.liquidCommerceOrderClientConstructor(t);await r.init(),this.services.set(e,r)}return this.services.get(e)}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(`OrderAuthenticatedClient_${JSON.stringify(t)}`,_,t)}getOrderService(t){return this.getOrCreateService(`OrderService_${t.getUniqueKey()}`,K,t)}}Q.instance=null;class q{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 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,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!==(i=null===(r=h.card)||void 0===r?void 0:r.brand)&&void 0!==i?i:"",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",...t.variables&&{variables:t.variables}}}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 j,z,J,X,Z;!function(t){t[t.X=0]="X",t[t.Y=1]="Y"}(j||(j={})),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 r=null==t?void 0:t[J.V];this.v(r,Array.isArray,Z.M,tt.F.G);const i=r[j.X];this.v(i,(t=>typeof t===Z.N),null,tt.F.H);const s=r[j.Y];return this.v(s,Array.isArray,Z.M,tt.F.I),{key:this.a(i,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,r,i){if(!e(t)||null!==r&&t.length<r)throw new Error(i)}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 r=this.gsi(e).replace(X.R,""),i=t.replace(X.T_C,""),s=JSON.stringify([i,r]);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"),[r,i]=JSON.parse(e);return`${X.T_C}${r}${X.R}${i}`}catch(t){throw new Error(`Failed to reconstruct the response data: ${t.message}`)}}dd(t,e){var r,i;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===(r=null==e?void 0:e.charCodeAt)||void 0===r?void 0:r.call(e,t))^(null===(i=null==s?void 0:s.charCodeAt)||void 0===i?void 0:i.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 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)}getPaymentElement(t){var e,r;const i=`PaymentElement_${null===(e=t.session)||void 0===e?void 0:e.key}_${null===(r=null==t?void 0:t.session)||void 0===r?void 0:r.secret}`;if(!this.services.has(i)){if(!this.paymentElementConstructor)throw new Error("PaymentElement constructor not set");const e=new this.paymentElementConstructor(t);this.services.set(i,e)}return this.services.get(i)}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)}`,H,t)}getLocationHelperService(){return this.getOrCreateService("LocationHelperService",M)}getAddressService(t){return this.getOrCreateService(`AddressService_${t.getUniqueKey()}`,B,t)}getCatalogHelperService(){return this.getOrCreateService("CatalogHelperService",U,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()}`,q,t)}getPaymentService(t){return this.getOrCreateService(`PaymentService_${t.getUniqueKey()}`,Y,this.getPaymentProviderService(t))}getCheckoutHelperService(){return this.getOrCreateService("CheckoutHelperService",x,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 rt{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 r=this.determineBaseURL(e);this.authenticatedClient=this.singletonManager.getAuthenticatedClient({apiKey:t,baseURL:r,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 it{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,r;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===(r=t.session)||void 0===r?void 0:r.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,r;if("undefined"==typeof document)throw new Error("Payment UI requires a browser environment.");const i=document.getElementById(t.elementId);if(!i)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===(r=t.elementOptions)||void 0===r?void 0:r.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(i)}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:r}=await this.componentSet.submit();if(r)return{type:"validation_error",message:r.message||"Form validation failed",code:r.code};const i={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(i);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 r=et.getInstance();return r.setLiquidCommerceClientConstructor(rt),await r.getClient(t,e)},exports.LiquidCommerceOrders=async function(t){const e=Q.getInstance();return e.setLiquidCommerceOrderClientConstructor(it),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))};
@@ -191,6 +191,8 @@ export declare enum CART_EVENT_ENUM {
191
191
  ITEM_ID_NOT_FOUND = "ItemIdNotFound",
192
192
  ITEMS_REMOVED = "ItemsRemoved",
193
193
  RETAILER_FULFILLMENT_INVALID = "RetailerFulfillmentInvalid",
194
+ RETAILER_ONDEMAND_HOURS_NOT_AVAILABLE = "RetailerOnDemandHoursNotAvailable",
195
+ MAX_QUANTITY_PER_ORDER_EXCEEDED = "MaxQuantityPerOrderExceeded",
194
196
  COUPON_PROCESSING_ERROR = "CouponProcessingError",
195
197
  COUPON_NOT_FOUND = "CouponNotFound",
196
198
  COUPON_EXPIRED = "CouponExpired",
@@ -242,7 +244,13 @@ export declare enum ENUM_CHECKOUT_STATUS_CODE_ERROR {
242
244
  REQUEST_PAYMENT_NOT_FOUND_ERROR = 5499,
243
245
  REQUEST_CART_UPDATED_ERROR = 5501,
244
246
  REQUEST_ADDRESS_DEFAULT_ERROR = 5502,
245
- REQUEST_TIPS_ERROR = 5503
247
+ REQUEST_TIPS_ERROR = 5503,
248
+ REQUEST_COMPLETE_CUSTOMER_MISSING_FIELDS = 5504,
249
+ REQUEST_RETAILER_HOURS_ERROR = 5505,
250
+ REQUEST_ITEM_QUANTITY_CHANGE_ERROR = 5506,
251
+ REQUEST_MAX_QUANTITY_PER_ORDER_ERROR = 5507,
252
+ REQUEST_PRESALE_NOT_STARTED_ERROR = 5508,
253
+ REQUEST_CART_MIN_RETAILER_NOT_MET_ERROR = 5509
246
254
  }
247
255
  export declare enum ENUM_CHECKOUT_STATUS_CODE_MESSAGE {
248
256
  REQUEST_DEFAULT_ERROR = "There's been an error with your checkout request.",
@@ -259,7 +267,7 @@ export declare enum ENUM_CHECKOUT_STATUS_CODE_MESSAGE {
259
267
  REQUEST_CHECKOUT_COMPLETE_UPDATE_ERROR = "Unable to update your checkout status.",
260
268
  REQUEST_CHECKOUT_COMPLETE_SAVE_ERROR = "Unable to save your completed checkout.",
261
269
  REQUEST_CHECKOUT_HAS_COMPLETE_ERROR = "This checkout has already been processed, create a new cart to process a new checkout.",
262
- REQUEST_NO_CART_ITEM_ERROR = "No items found in your cart.",
270
+ REQUEST_NO_CART_ITEM_ERROR = "Item(s) in your cart are no longer available",
263
271
  REQUEST_NO_CUSTOMER_FOUND_ERROR = "The customer account was not found.",
264
272
  REQUEST_PAYMENT_ATTACHED_ERROR = "The payment attached to the checkout is not a valid payment method for this customer.",
265
273
  REQUEST_SHIPPING_ADDRESS_ERROR = "The address in your cart has changed, check and try again.",
@@ -267,7 +275,13 @@ export declare enum ENUM_CHECKOUT_STATUS_CODE_MESSAGE {
267
275
  REQUEST_PAYMENT_NOT_FOUND_ERROR = "The payment method provided was not found.",
268
276
  REQUEST_CART_UPDATED_ERROR = "The cart requested was updated during your checkout.",
269
277
  REQUEST_ADDRESS_DEFAULT_ERROR = "There's been an error with your address configurations in cart and/or billing address, check and try again.",
270
- REQUEST_TIPS_ERROR = "There's been an error applying your tips to the checkout."
278
+ REQUEST_TIPS_ERROR = "There's been an error applying your tips to the checkout.",
279
+ REQUEST_COMPLETE_CUSTOMER_MISSING_FIELDS = "Customer profile information is incomplete. Please provide all required details.",
280
+ REQUEST_RETAILER_HOURS_ERROR = "The retailer is currently closed or on-demand hours are not available.",
281
+ REQUEST_ITEM_QUANTITY_CHANGE_ERROR = "Some items in your cart exceed available stock quantities. Please adjust your cart and try again.",
282
+ REQUEST_MAX_QUANTITY_PER_ORDER_ERROR = "You have exceeded the maximum quantity allowed per order for one or more items in your cart.",
283
+ REQUEST_PRESALE_NOT_STARTED_ERROR = "The presale for this item has not started yet. Please check back later.",
284
+ REQUEST_CART_MIN_RETAILER_NOT_MET_ERROR = "Some items in your cart do not meet the minimum retailer requirements per order quantity. Please adjust your cart and try again."
271
285
  }
272
286
  export declare enum CHECKOUT_EVENT_ENUM {
273
287
  ERROR_PROCESSING_GIFT_CARDS = "ErrorProcessingGiftCards",
@@ -276,7 +290,10 @@ export declare enum CHECKOUT_EVENT_ENUM {
276
290
  INACTIVE_GIFT_CARD = "InactiveGiftCard",
277
291
  GIFT_CARD_ALREADY_IN_USE = "GiftCardAlreadyInUse",
278
292
  GIFT_CARD_EXPIRED = "GiftCardExpired",
279
- GIFT_CARD_BALANCE_DEPLETED = "GiftCardBalanceDepleted"
293
+ GIFT_CARD_BALANCE_DEPLETED = "GiftCardBalanceDepleted",
294
+ RETAILER_ONDEMAND_HOURS_NOT_AVAILABLE = "RetailerOnDemandHoursNotAvailable",
295
+ ITEM_QTY_CHANGE = "ItemQuantityChange",
296
+ MAX_QUANTITY_PER_ORDER_EXCEEDED = "MaxQuantityPerOrderExceeded"
280
297
  }
281
298
  export declare enum ENUM_ORDER_STATUS {
282
299
  CREATED = "created",
@@ -90,6 +90,7 @@ export interface ICartItem extends Partial<Omit<IProduct, 'attributes'>> {
90
90
  */
91
91
  export interface ICartAttributesPromoCode {
92
92
  value: string;
93
+ discount: number;
93
94
  freeDelivery: boolean;
94
95
  freeServiceFee: boolean;
95
96
  freeShipping: boolean;
@@ -310,6 +310,7 @@ export interface IProductSizeAttributes {
310
310
  salsifyGrouping?: string;
311
311
  presale: IProductPresale;
312
312
  engraving: IProductSizeEngraving;
313
+ maxQuantityPerOrder?: number;
313
314
  }
314
315
  /**
315
316
  * Represents the size details of a product in an inventory system.
@@ -374,4 +375,5 @@ export interface IProduct {
374
375
  sizes: IProductSize[];
375
376
  attributes?: Partial<IAttributes>;
376
377
  priceInfo: IProductPriceInfo | null;
378
+ additionalInformation?: string;
377
379
  }
@@ -1,7 +1,7 @@
1
1
  import type { CHECKOUT_EVENT_ENUM } from '../enums';
2
2
  import type { ICoreParams } from '../types';
3
3
  import type { IAddress } from './address.interface';
4
- import type { ICartItemAttributes } from './cart.interface';
4
+ import type { ICartAttributesPromoCode, ICartItemAttributes } from './cart.interface';
5
5
  import type { IRetailerExpectation } from './retailer.interface';
6
6
  /**
7
7
  * Represents a customer in a checkout process.
@@ -267,10 +267,12 @@ export interface ICheckoutGiftCard {
267
267
  * @interface ICheckoutEvents
268
268
  * @property {CHECKOUT_EVENT_ENUM} type - The type of the checkout event.
269
269
  * @property {string} message - A message providing additional context or details about the event.
270
+ * @property {Array<Partial<ICheckoutItem>>} [items] - An optional array of items associated with the event, providing details about the products involved in the checkout process.
270
271
  */
271
272
  export interface ICheckoutEvents {
272
273
  type: CHECKOUT_EVENT_ENUM;
273
274
  message: string;
275
+ items?: Array<Partial<ICheckoutItem>>;
274
276
  }
275
277
  /**
276
278
  * Represents a response object for preparing a checkout process.
@@ -301,7 +303,7 @@ export interface ICheckoutPrepareResponse {
301
303
  payment?: string;
302
304
  giftCards: ICheckoutGiftCard[];
303
305
  events: ICheckoutEvents[];
304
- promoCode: string;
306
+ promoCode: ICartAttributesPromoCode;
305
307
  }
306
308
  /**
307
309
  * Represents the parameters required for completing a checkout process.
@@ -26,6 +26,17 @@ export interface ILiquidCommerceClient {
26
26
  *
27
27
  * @return {Promise<IAuth>} A promise that resolves to an authentication service
28
28
  * response containing details of the authentication process.
29
+ *
30
+ * @example
31
+ * const liquidCommerce = await LiquidCommerce(apiKey, config);
32
+ *
33
+ * try {
34
+ * const authResponse = await liquidCommerce.auth();
35
+ * console.log('Authentication details:', authResponse);
36
+ * // This will log an IAuth object e.g. { token: 'jwt-token', exp: 167... }
37
+ * } catch (error) {
38
+ * console.error('Authentication failed:', error);
39
+ * }
29
40
  */
30
41
  auth(): Promise<IAuth>;
31
42
  /**
@@ -27,6 +27,8 @@ export interface ILiquidPaymentElementOptions {
27
27
  *
28
28
  * @property {'default' | 'night' | 'flat'} [appearance.theme] - An optional theme for the payment form appearance.
29
29
  *
30
+ * @property {Object} [appearance.variables] - Optional style variables for customizing the payment element appearance.
31
+ *
30
32
  * @property {ILiquidPaymentElementOptions} [elementOptions] - Additional options for configuring the payment element.
31
33
  */
32
34
  export interface ILiquidPaymentConfig {
@@ -35,6 +37,7 @@ export interface ILiquidPaymentConfig {
35
37
  elementId: string;
36
38
  appearance?: {
37
39
  theme?: 'stripe' | 'night' | 'flat';
40
+ variables?: Record<string, string | number>;
38
41
  };
39
42
  elementOptions?: ILiquidPaymentElementOptions;
40
43
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@liquidcommerce/cloud-sdk",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "LiquidCommerce Cloud SDK",
5
5
  "main": "./dist/index.cjs",
6
6
  "module": "./dist/index.esm.js",