@liquidcommerce/cloud-sdk 1.3.0 → 1.4.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.
Files changed (36) hide show
  1. package/README.md +371 -119
  2. package/dist/index.cjs +1 -1
  3. package/dist/index.esm.js +1 -1
  4. package/dist/liquidcommerce-cloud-sdk.ssr.js +1 -1
  5. package/dist/types/constants/core.constant.d.ts +8 -0
  6. package/dist/types/core/cart-helper.service.d.ts +1 -1
  7. package/dist/types/core/catalog-helper.service.d.ts +24 -4
  8. package/dist/types/core/checkout-helper.service.d.ts +23 -8
  9. package/dist/types/core/location-helper.service.d.ts +4 -3
  10. package/dist/types/core/payment-provider.service.d.ts +16 -1
  11. package/dist/types/core/singleton.service.d.ts +9 -10
  12. package/dist/types/{enums.d.ts → enums/enums.d.ts} +62 -92
  13. package/dist/types/enums/index.d.ts +2 -0
  14. package/dist/types/enums/taxonomy.d.ts +285 -0
  15. package/dist/types/index.d.ts +2 -0
  16. package/dist/types/interfaces/address.interface.d.ts +86 -1
  17. package/dist/types/interfaces/cart.interface.d.ts +28 -10
  18. package/dist/types/interfaces/catalog.interface.d.ts +268 -8
  19. package/dist/types/interfaces/checkout.interface.d.ts +265 -50
  20. package/dist/types/interfaces/index.d.ts +8 -0
  21. package/dist/types/interfaces/liquid-commerce-client.interface.d.ts +34 -9
  22. package/dist/types/interfaces/payment.interface.d.ts +81 -2
  23. package/dist/types/interfaces/retailer.interface.d.ts +121 -0
  24. package/dist/types/interfaces/user.interface.d.ts +115 -8
  25. package/dist/types/liquid-commerce-client.d.ts +3 -192
  26. package/dist/types/services/address.service.d.ts +2 -18
  27. package/dist/types/services/cart.service.d.ts +1 -1
  28. package/dist/types/services/catalog.service.d.ts +1 -12
  29. package/dist/types/services/checkout.service.d.ts +1 -1
  30. package/dist/types/services/index.d.ts +5 -0
  31. package/dist/types/services/payment.service.d.ts +1 -1
  32. package/dist/types/services/user.service.d.ts +53 -1
  33. package/dist/types/types.d.ts +11 -5
  34. package/package.json +105 -105
  35. package/umd/liquidcommerce-cloud-sdk.min.js +1 -1
  36. package/dist/types/interfaces/catalog.service.interface.d.ts +0 -65
@@ -1 +1 @@
1
- "use strict";var LIQUID_COMMERCE_ENV,t,e,r,i,s,a,o,n,h,d,c,l,u,p,I,E,w,y,m=require("@stripe/stripe-js");exports.LIQUID_COMMERCE_ENV=void 0,(LIQUID_COMMERCE_ENV=exports.LIQUID_COMMERCE_ENV||(exports.LIQUID_COMMERCE_ENV={})).LOC="loc",LIQUID_COMMERCE_ENV.STAGE="stage",LIQUID_COMMERCE_ENV.PROD="prod",LIQUID_COMMERCE_ENV.DEV="dev",exports.ENUM_MODALITIES=void 0,(t=exports.ENUM_MODALITIES||(exports.ENUM_MODALITIES={})).ON_DEMAND="onDemand",t.SHIPPING="shipping",exports.DAYS_OF_WEEK=void 0,(e=exports.DAYS_OF_WEEK||(exports.DAYS_OF_WEEK={})).MONDAY="monday",e.TUESDAY="tuesday",e.WEDNESDAY="wednesday",e.THURSDAY="thursday",e.FRIDAY="friday",e.SATURDAY="saturday",e.SUNDAY="sunday",exports.STATES_CODE=void 0,(r=exports.STATES_CODE||(exports.STATES_CODE={})).AL="AL",r.AK="AK",r.AR="AR",r.CA="CA",r.CO="CO",r.CT="CT",r.DE="DE",r.DC="DC",r.FL="FL",r.GA="GA",r.HI="HI",r.ID="ID",r.IL="IL",r.IN="IN",r.IA="IA",r.KS="KS",r.KY="KY",r.LA="LA",r.ME="ME",r.MD="MD",r.MA="MA",r.MI="MI",r.MN="MN",r.MS="MS",r.MO="MO",r.MT="MT",r.NE="NE",r.NV="NV",r.NH="NH",r.NJ="NJ",r.NM="NM",r.NY="NY",r.NC="NC",r.ND="ND",r.OH="OH",r.OK="OK",r.OR="OR",r.PA="PA",r.RI="RI",r.SC="SC",r.SD="SD",r.TN="TN",r.TX="TX",r.UT="UT",r.VT="VT",r.VA="VA",r.WA="WA",r.WV="WV",r.WI="WI",r.WY="WY",exports.STATES_NAME=void 0,(i=exports.STATES_NAME||(exports.STATES_NAME={})).ALABAMA="AL",i.ALASKA="AK",i.ARKANSAS="AR",i.CALIFORNIA="CA",i.COLORADO="CO",i.CONNECTICUT="CT",i.DELAWARE="DE",i.DISTRICT_OF_COLUMBIA="DC",i.FLORIDA="FL",i.GEORGIA="GA",i.HAWAII="HI",i.IDAHO="ID",i.ILLINOIS="IL",i.INDIANA="IN",i.IOWA="IA",i.KANSAS="KS",i.KENTUCKY="KY",i.LOUISIANA="LA",i.MAINE="ME",i.MARYLAND="MD",i.MASSACHUSETTS="MA",i.MICHIGAN="MI",i.MINNESOTA="MN",i.MISSISSIPPI="MS",i.MISSOURI="MO",i.MONTANA="MT",i.NEBRASKA="NE",i.NEVADA="NV",i.NEW_HAMPSHIRE="NH",i.NEW_JERSEY="NJ",i.NEW_MEXICO="NM",i.NEW_YORK="NY",i.NORTH_CAROLINA="NC",i.NORTH_DAKOTA="ND",i.OHIO="OH",i.OKLAHOMA="OK",i.OREGON="OR",i.PENNSYLVANIA="PA",i.RHODE_ISLAND="RI",i.SOUTH_CAROLINA="SC",i.SOUTH_DAKOTA="SD",i.TENNESSEE="TN",i.TEXAS="TX",i.UTAH="UT",i.VERMONT="VT",i.VIRGINIA="VA",i.WASHINGTON="WA",i.WEST_VIRGINIA="WV",i.WISCONSIN="WI",i.WYOMING="WY",exports.ENUM_BEER=void 0,(s=exports.ENUM_BEER||(exports.ENUM_BEER={})).ALE="BEER > ALE",s.LAGER="BEER > LAGER",s.MAIN="BEER",s.NON_ALCOHOLIC="BEER > NON-ALCOHOLIC",s.OTHER_BEER="BEER > OTHER BEER",exports.ENUM_FOOD=void 0,(a=exports.ENUM_FOOD||(exports.ENUM_FOOD={})).BASE="FOOD",a.PANTRY_OTHER="FOOD > PANTRY > OTHER",exports.ENUM_MERCHANDISE=void 0,(o=exports.ENUM_MERCHANDISE||(exports.ENUM_MERCHANDISE={})).BASE="MERCHANDISE",o.GLASSWARE="MERCHANDISE > GLASSWARE",o.HUMIDOR="MERCHANDISE > HUMIDOR",exports.ENUM_MISCELLANEOUS=void 0,(n=exports.ENUM_MISCELLANEOUS||(exports.ENUM_MISCELLANEOUS={})).BASE="MISCELLANEOUS",n.GIFT_CARD="MISCELLANEOUS > GIFT CARDS",n.PROMOTIONAL="MISCELLANEOUS > PROMOTIONAL",n.MEMBERSHIP="MISCELLANEOUS > MEMBERSHIP",exports.ENUM_NON_ALCOHOLIC=void 0,(h=exports.ENUM_NON_ALCOHOLIC||(exports.ENUM_NON_ALCOHOLIC={})).BASE="NON ALCOHOLIC",h.BITTERS="NON ALCOHOLIC > BITTERS",h.COCKTAIL_MIX="NON ALCOHOLIC > COCKTAIL MIX",h.COFFEE="NON ALCOHOLIC > COFFEE",h.ENERGY_DRINKS="NON ALCOHOLIC > ENERGY DRINKS",h.JUICE="NON ALCOHOLIC > JUICE",h.SODA="NON ALCOHOLIC > SODA",h.SPECIALTY_ITEM="NON ALCOHOLIC > SPECIALTY ITEM",h.SPIRITS="NON ALCOHOLIC > SPIRITS",h.TEA="NON ALCOHOLIC > TEA",h.WATER="NON ALCOHOLIC > WATER",h.WINE="NON ALCOHOLIC > WINE",exports.ENUM_READY_TO_DRINK=void 0,(d=exports.ENUM_READY_TO_DRINK||(exports.ENUM_READY_TO_DRINK={})).BASE="READY TO DRINK",d.HARD_CIDER="READY TO DRINK > HARD CIDER",d.HARD_CIDER_PERRY_PEAR_CIDER="READY TO DRINK > HARD CIDER > PERRY (PEAR CIDER)",d.HARD_TEA="READY TO DRINK > HARD TEA",d.MALT_BASED="READY TO DRINK > MALT BASED",d.SPIRITS_BASED_RTDS="READY TO DRINK > SPIRITS-BASED RTDS",d.SPIRITS_BASED_RTDS_RUM_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > RUM COCKTAILS",d.SPIRITS_BASED_RTDS_TEQUILA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEQUILA COCKTAILS",d.SPIRITS_BASED_RTDS_VODKA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > VODKA COCKTAILS",d.SPIRITS_BASED_RTDS_WHISKEY_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > WHISKEY COCKTAILS",d.WINE_COCKTAILS="READY TO DRINK > WINE COCKTAILS",exports.ENUM_SPIRITS=void 0,(c=exports.ENUM_SPIRITS||(exports.ENUM_SPIRITS={})).BASE="SPIRITS",c.BAIJIU="SPIRITS > BAIJIU",c.BITTERS="SPIRITS > BITTERS",c.BRANDY="SPIRITS > BRANDY",c.CACHACA="SPIRITS > CACHACA",c.GIN="SPIRITS > GIN",c.LAGER="SPIRITS > LAGER",c.LIQUEUR="SPIRITS > LIQUEUR",c.MEZCAL="SPIRITS > MEZCAL",c.OTHER_SPIRITS="SPIRITS > OTHER SPIRITS",c.RUM="SPIRITS > RUM",c.RUM_AGED_RUM="SPIRITS > RUM > AGED RUM",c.RUM_DARK_RUM="SPIRITS > RUM > DARK RUM",c.RUM_FLAVORED_RUM="SPIRITS > RUM > FLAVORED RUM",c.RUM_GOLD_RUM="SPIRITS > RUM > GOLD RUM",c.RUM_OTHER="SPIRITS > RUM > OTHER",c.RUM_SPICED="SPIRITS > RUM > SPICED",c.RUM_WHITE_RUM="SPIRITS > RUM > WHITE RUM",c.SOJU="SPIRITS > SOJU",c.TEQUILA="SPIRITS > TEQUILA",c.VODKA="SPIRITS > VODKA",c.VODKA_FLAVORED_VODKA="SPIRITS > VODKA > FLAVORED VODKA",c.WHISKEY="SPIRITS > WHISKEY",c.WHISKEY_AMERICAN_WHISKEY="SPIRITS > WHISKEY > AMERICAN WHISKEY",c.WHISKEY_BOURBON="SPIRITS > WHISKEY > BOURBON",c.WHISKEY_CANADIAN_WHISKEY="SPIRITS > WHISKEY > CANADIAN WHISKEY",c.WHISKEY_IRISH_WHISKEY="SPIRITS > WHISKEY > IRISH WHISKEY",c.WHISKEY_SCOTCH="SPIRITS > WHISKEY > SCOTCH",exports.ENUM_WINE=void 0,(l=exports.ENUM_WINE||(exports.ENUM_WINE={})).BASE="WINE",l.CHAMPAGNE_SPARKLING="WINE > CHAMPAGNE & SPARKLING",l.CHAMPAGNE_SPARKLING_SPARKLING_WINE="WINE > CHAMPAGNE & SPARKLING > SPARKLING WINE",l.COOKING="WINE > COOKING",l.DESSERT_FORTIFIED_WINE="WINE > DESSERT & FORTIFIED WINE",l.DESSERT_FORTIFIED_WINE_SHERRY="WINE > DESSERT & FORTIFIED WINE > SHERRY",l.RED_WINE="WINE > RED WINE",l.ROSE_WINE="WINE > ROSE WINE",l.SAKE="WINE > SAKE",l.WHITE_WINE="WINE > WHITE WINE",exports.ENUM_FILTER_KEYS=void 0,(u=exports.ENUM_FILTER_KEYS||(exports.ENUM_FILTER_KEYS={})).BRANDS="brands",u.FLAVOR="flavor",u.REGION="region",u.VARIETY="variety",u.PRICE="price",u.AVAILABILITY="availability",u.CATEGORIES="categories",u.SIZES="sizes",u.COLORS="colors",u.APPELLATION="appellation",u.COUNTRY="country",u.VINTAGE="vintage",u.MATERIALS="materials",exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE=void 0,(p=exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE||(exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE={})).ASC="asc",p.DESC="desc",exports.ENUM_ORDER_BY=void 0,(exports.ENUM_ORDER_BY||(exports.ENUM_ORDER_BY={})).PRICE="price",exports.ENUM_AVAILABILITY_VALUE=void 0,(I=exports.ENUM_AVAILABILITY_VALUE||(exports.ENUM_AVAILABILITY_VALUE={})).UNSPECIFIED="AVAILABILITY_UNSPECIFIED",I.IN_STOCK="IN_STOCK",I.OUT_OF_STOCK="OUT_OF_STOCK",I.PREORDER="PREORDER",I.BACKORDER="BACKORDER",exports.CART_PARAM_ERROR_ENUM=void 0,(E=exports.CART_PARAM_ERROR_ENUM||(exports.CART_PARAM_ERROR_ENUM={})).INVALID_ITEMS_TYPE="Items must be a non-empty array",E.INVALID_ITEMS_MAX="You can only send up to 25 items at a time!",E.INVALID_PART_NUMBER="The partnerNumber provided is invalid",E.INVALID_FULFILLMENT_ID="The fulfillmentId provided is invalid",exports.CART_EVENT_ENUM=void 0,(w=exports.CART_EVENT_ENUM||(exports.CART_EVENT_ENUM={})).OOS="OutOfStock",w.ITEMS_NOT_ADDED="ItemsNotAdded",w.ITEMS_REQUESTED_NOT_ADDED="ItemsRequestedNotAdded",w.ITEM_NOT_ENGRAVED="ItemEngravingError",w.ADDRESS_CHANGE="AddressChange",w.LOCATION_AVAILABILITY="LocationAvailability",w.REMOVED_EXISTING_ITEMS="RemovedExistingCartItems",w.RETAILER_MIN="RetailerMinNotMet",w.NO_ITEMS_IN_CART="NoItemsInCart",w.INVALID_ID="InvalidId",w.NO_ID="NoId",w.CART_CHECKOUT_PROCESSED="CartCheckoutProcessed",w.NEW_CART="NewCart",w.DEFAULT="CartError",w.ITEM_QTY_CHANGE="ItemQuantityChange",exports.ENUM_ADDRESS_TYPE=void 0,(y=exports.ENUM_ADDRESS_TYPE||(exports.ENUM_ADDRESS_TYPE={})).SHIPPING="shipping",y.BILLING="billing";const v={[exports.LIQUID_COMMERCE_ENV.LOC]:"https://staging.cloud.liquidcommerce.co/api",[exports.LIQUID_COMMERCE_ENV.DEV]:"https://staging.cloud.liquidcommerce.co/api",[exports.LIQUID_COMMERCE_ENV.STAGE]:"https://staging.cloud.liquidcommerce.co/api",[exports.LIQUID_COMMERCE_ENV.PROD]:"https://staging.cloud.liquidcommerce.co/api"};class S{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=!1,this.xhrFetch=(t,e)=>new Promise(((r,i)=>{const s=new XMLHttpRequest;s.open(e.method||"GET",t),Object.entries(e.headers).forEach((([t,e])=>{s.setRequestHeader(t,e)})),s.onload=()=>{r({ok:s.status>=200&&s.status<300,status:s.status,statusText:s.statusText,headers:s.getAllResponseHeaders().split("\r\n").reduce(((t,e)=>{const[r,i]=e.split(": ");return r&&(t[r]=i),t}),{}),json:()=>Promise.resolve(JSON.parse(s.responseText)),text:()=>Promise.resolve(s.responseText)})},s.onerror=()=>{i(new TypeError("Network request failed"))},s.send(e.body)})),this.apiKey=t.apiKey,this.baseURL=t.baseURL,this.httpClient=this.getFetchImplementation()}static getInstance(t){return S.instance||(S.instance=new S(t)),S.instance}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):this.xhrFetch}fetchAdapter(t){return async(e,r)=>{var i;const s=await t(e,r);let a;return"function"==typeof(null===(i=s.headers)||void 0===i?void 0:i.entries)?a=Object.fromEntries(s.headers.entries()):(a={},s.headers.forEach(((t,e)=>{a[e]=t}))),{ok:s.ok,status:s.status,statusText:s.statusText,headers:a,json:()=>s.json(),text:()=>s.text()}}}getUniqueKey(){return`${this.apiKey}_${this.baseURL}`}async authenticate(){var t,e;if(this.isAuthenticating)await new Promise((t=>{const e=()=>{this.isAuthenticating?setTimeout(e,100):t(void 0)};e()}));else{this.isAuthenticating=!0;try{const r=await this.requestWithoutAuth("/authentication",{method:"GET"});this.accessToken=null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.token,this.tokenExpiration=Date.now()+1e3*(null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.exp)}catch(t){throw new Error("Failed to authenticate with LiquidCommerce API")}finally{this.isAuthenticating=!1}}}async requestWithoutAuth(t,e){const r=new URL(`api${t}`,this.baseURL),i={"Content-Type":"application/json","X-LIQUID-API-KEY":this.apiKey,...e.headers},s={method:e.method,headers:i,body:e.body?JSON.stringify(e.body):void 0},a=await this.httpClient(r.toString(),s);if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a.json()}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}async request(t,e){this.accessToken&&!this.isTokenExpired()||await this.authenticate();const r=new URL(`api${t}`,this.baseURL),i={"Content-Type":"application/json","X-LIQUID-API-KEY":this.apiKey,Authorization:`Bearer ${this.accessToken}`,...e.headers},s={method:e.method,headers:i,body:e.body?JSON.stringify(e.body):void 0},a=await this.httpClient(r.toString(),s);if(!a.ok)throw new Error(`HTTP error! status: ${a.status}`);return a.json()}async get(t,e){return this.request(t,{method:"GET",headers:e})}async post(t,e,r){return this.request(t,{method:"POST",body:e,headers:r})}async put(t,e,r){return this.request(t,{method:"PUT",body:e,headers:r})}async delete(t,e){return this.request(t,{method:"DELETE",headers:e})}}S.instance=null;class A{constructor(t){this.locationHelperService=t}validateAndNormalizeParams(t){const e={...t};return e.id=this.validateId(e.id),e.items=this.validateAndNormalizeItems(e.items),this.locationHelperService.validateAndNormalizeLocation(e.loc),e.refresh=Boolean(e.refresh),e}validateId(t){return t&&"string"==typeof t&&0!==t.trim().length?t.trim():""}validateAndNormalizeItems(t){if(!Array.isArray(t)||0===t.length)throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_ITEMS_TYPE);if(t.length>25)throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_ITEMS_MAX);return t.map((t=>this.validateAndNormalizeItem(t)))}validateAndNormalizeItem(t){const e={...t};if(!this.validatePartNumber(e.partNumber))throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_PART_NUMBER);if(!e.fulfillmentId||"string"!=typeof e.fulfillmentId||0===e.fulfillmentId.trim().length)throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_FULFILLMENT_ID);return e.quantity=Math.max(0,Math.floor(e.quantity)),e.engravingLines&&(e.engravingLines=e.engravingLines.map((t=>t.trim())).filter((t=>t.length>0))),e}validatePartNumber(t){if(!t||"string"!=typeof t)return!1;const e=t.split("_");return 2===e.length&&14===e[0].length&&e[1].length>0}}class R{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)])}validateAndNormalizeParams(t){const e={...t};return this.validateUPCs(e.upcs),this.locationServiceHelper.validateAndNormalizeLocation(e.loc),e}validateAndNormalizeSearchParams(t){const e=[],r={...t};return this.validateOrderBy(r.orderBy,e),this.validateOrderDirection(r.orderDirection,e),this.validateFilters(r.filters,e),this.validatePagination(r.page,r.perPage,e),this.locationServiceHelper.validateAndNormalizeLocation(r.loc),e.length>0?{...r,error:e.join(". ")}:r}validateUPCs(t){if(!Array.isArray(t)||0===t.length)throw new Error("UPCs must be a non-empty array of strings");if(!t.every((t=>"string"==typeof t&&t.trim().length>0)))throw new Error("All UPCs must be non-empty strings")}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.BRANDS:this.validateArrayFilter(t.values,30,"brands",e);break;case exports.ENUM_FILTER_KEYS.CATEGORIES:this.validateCategoriesFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.COLORS:this.validateArrayFilter(t.values,75,"colors",e)}})))}validateAvailabilityFilter(t,e){Object.values(exports.ENUM_AVAILABILITY_VALUE).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 f{constructor(t){this.locationHelperService=t}validateAndNormalizePrepareParams(t){const e={...t};if(!e.cartId||"string"!=typeof e.cartId)throw new Error("Invalid cartId");return this.validateRecipient(e.recipient),e.billingAddress&&this.validateAddress(e.billingAddress),e.hasSubstitutionPolicy=Boolean(e.hasSubstitutionPolicy),e.isGift=Boolean(e.isGift),e.billingSameAsShipping=Boolean(e.billingSameAsShipping),e.isGift&&this.validateGiftOptions(e.giftOptions),this.validateMarketingPreferences(e.marketingPreferences),e.deliveryTips&&this.validateDeliveryTips(e.deliveryTips),e.refresh=Boolean(e.refresh),e}validateAndNormalizeCompleteParams(t){const e={...t};if(!e.token||"string"!=typeof e.token)throw new Error("Invalid token");if(!e.payment||"string"!=typeof e.payment)throw new Error("Invalid payment token");return void 0!==e.refresh&&(e.refresh=Boolean(e.refresh)),e}validateRecipient(t){if(!t||"object"!=typeof t)throw new Error("Invalid recipient");["firstName","lastName","email","phone","birthDate"].forEach((e=>{if(!t[e]||"string"!=typeof t[e])throw new Error(`Invalid recipient ${e}`)})),t.hasAgeVerify=Boolean(t.hasAgeVerify)}validateAddress(t){if(!t||"object"!=typeof t)throw new Error("Invalid address");["firstName","lastName","email","phone","one","city","state","zip"].forEach((e=>{if(!t[e]||"string"!=typeof t[e])throw new Error(`Invalid address ${e}`)})),this.locationHelperService.validateAndNormalizeLocation({address:t})}validateGiftOptions(t){if(!t||"object"!=typeof t)throw new Error("Invalid giftOptions");if(t.message&&"string"!=typeof t.message)throw new Error("Invalid gift message");if(t.recipient){const{name:e,phone:r,email:i}=t.recipient;if(e&&"string"!=typeof e)throw new Error("Invalid gift recipient name");if(r&&"string"!=typeof r)throw new Error("Invalid gift recipient phone");if(i&&"string"!=typeof i)throw new Error("Invalid gift recipient email")}}validateMarketingPreferences(t){if(!t||"object"!=typeof t)throw new Error("Invalid marketingPreferences");t.canEmail=Boolean(t.canEmail),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 O{validateAndNormalizeLocation(t){if(!t||"object"!=typeof t)throw new Error("Location must be a valid object");if(t.coords)this.validateCoordinates(t.coords);else{if(!t.address)throw new Error("Location must contain either coords or address");this.validateAndNormalizeAddress(t.address)}}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(!t.state||"string"!=typeof 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 N{constructor(){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 m.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,a,o,n,h,d,c,l;if(!this.stripe||!this.elements||!this.clientSecret)return{type:"client_error",message:"Payment form has not been initialized"};const{error:u}=await this.elements.submit();if(u)return{type:"validation_error",message:u.message,code:u.code};const{error:p,paymentMethod:I}=await this.stripe.createPaymentMethod({elements:this.elements}),E=await this.stripe.confirmSetup({elements:this.elements,redirect:"if_required"});return E.error?{type:"confirm_error",message:null!==(e=null===(t=null==E?void 0:E.error)||void 0===t?void 0:t.message)&&void 0!==e?e:"",code:null!==(i=null===(r=null==E?void 0:E.error)||void 0===r?void 0:r.code)&&void 0!==i?i:""}:p?{type:"validation_error"===p.type?"validation_error":"api_error",message:p.message,code:p.code,param:p.param}:I?{id:I.id,type:I.type,card:(null==I?void 0:I.card)?{brand:null!==(a=null===(s=I.card)||void 0===s?void 0:s.brand)&&void 0!==a?a:"",country:null!==(o=I.card.country)&&void 0!==o?o:"",expMonth:null!==(n=I.card.exp_month)&&void 0!==n?n:0,expYear:null!==(h=I.card.exp_year)&&void 0!==h?h:0,last4:null!==(d=I.card.last4)&&void 0!==d?d:"",funding:null!==(c=I.card.funding)&&void 0!==c?c:""}:void 0,created:null!==(l=null==I?void 0:I.created)&&void 0!==l?l:0}:{type:"client_error",message:"Failed to generate payment token"}}subscribe(t,e){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");if(!this.events.includes(t))throw new Error(this.eventsErrorMsg);this.paymentElement.on(t,e)}unsubscribe(t,e){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");if(!this.events.includes(t))throw new Error(this.eventsErrorMsg);this.paymentElement.off(t,e)}mapAppearance(t){if(t)return{theme:"night"===t.theme?"night":"stripe"}}mapElementOptions(t){return{layout:null==t?void 0:t.layout,wallets:{applePay:"auto",googlePay:"auto"}}}unmount(){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");this.paymentElement.unmount()}collapse(){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");this.paymentElement.collapse()}destroy(){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");this.paymentElement.destroy()}}class T{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 C{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 g{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 P{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 x{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 D{constructor(t){this.client=t,this.servicePath="/users"}async createOrUpdateSession(t){try{if(!(null==t?void 0:t.id)&&!(null==t?void 0:t.email))throw new Error("Either id or email must be provided");return await this.client.post(`${this.servicePath}/session`,t)}catch(t){throw t}}async 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{if(!(t.customerId&&t.one&&t.city&&t.state&&t.zip&&t.type))throw new Error("Missing required parameters to add address");return await this.client.post(`${this.servicePath}/addresses/add`,t)}catch(t){throw t}}async updateAddress(t){try{if(!(t.customerId&&t.one&&t.city&&t.state&&t.zip&&t.type))throw new Error("Missing required parameters for address update");return await this.client.post(`${this.servicePath}/addresses/update`,t)}catch(t){throw t}}async purgeAddress(t){try{if(!t)throw new Error("Address ID must be provided");return await this.client.delete(`${this.servicePath}/addresses/purge/${t}`)}catch(t){throw t}}async addPayment(t){try{if(!t.customerId||!t.paymentMethodId)throw new Error("Missing required parameters to add payment");return void 0===(null==t?void 0:t.isDefault)&&(null==t||delete t.isDefault),await this.client.post(`${this.servicePath}/payments/add`,t)}catch(t){throw t}}async updatePayment(t){try{if(!t.customerId||!t.paymentMethodId||void 0===(null==t?void 0:t.isDefault)||"boolean"!=typeof(null==t?void 0:t.isDefault))throw new Error("Missing required parameters to add payment");return await this.client.post(`${this.servicePath}/payments/update`,t)}catch(t){throw t}}async purgePayment(t,e){try{if(!t||!e)throw new Error("Missing required parameters for payment purge");return await this.client.delete(`${this.servicePath}/payments/purge/${t}/${e}`)}catch(t){throw t}}}class b{constructor(){this.services=new Map,this.liquidCommerceClientConstructor=null}static getInstance(){return b.instance||(b.instance=new b),b.instance}setLiquidCommerceClientConstructor(t){this.liquidCommerceClientConstructor=t}async getLiquidCommerceClient(t,e){const r=`LiquidCommerceClient_${t}_${JSON.stringify(e)}`;if(!this.services.has(r)){if(!this.liquidCommerceClientConstructor)throw new Error("LiquidCommerceClient constructor not set");const i=new this.liquidCommerceClientConstructor(t,e);await i.init(),this.services.set(r,i)}return this.services.get(r)}getOrCreateService(t,e,...r){if(!this.services.has(t)){const i="getInstance"in e?e.getInstance(...r):new e(...r);this.services.set(t,i)}return this.services.get(t)}getAuthenticatedClient(t){return this.getOrCreateService(`AuthenticatedClient_${JSON.stringify(t)}`,S,t)}getLocationHelperService(){return this.getOrCreateService("LocationHelperService",O)}getAddressService(t){return this.getOrCreateService(`AddressService_${t.getUniqueKey()}`,T,t)}getCatalogHelperService(){return this.getOrCreateService("CatalogHelperService",R,this.getLocationHelperService())}getCatalogService(t){return this.getOrCreateService(`CatalogService_${t.getUniqueKey()}`,g,t,this.getCatalogHelperService())}getCartHelperService(){return this.getOrCreateService("CartHelperService",A,this.getLocationHelperService())}getCartService(t){return this.getOrCreateService(`CartService_${t.getUniqueKey()}`,C,t,this.getCartHelperService())}getUserService(t){return this.getOrCreateService(`UserService_${t.getUniqueKey()}`,D,t)}getPaymentProviderService(){return this.getOrCreateService("PaymentProviderService",N)}getPaymentService(){return this.getOrCreateService("PaymentService",x,this.getPaymentProviderService())}getCheckoutHelperService(){return this.getOrCreateService("CheckoutHelperService",f,this.getLocationHelperService())}getCheckoutService(t){return this.getOrCreateService(`CheckoutService_${t.getUniqueKey()}`,P,t,this.getCheckoutHelperService())}}b.instance=null;class L{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)),purge:async t=>(await this.ensureAuthenticated(),this.userService.purge(t)),addAddress:async t=>(await this.ensureAuthenticated(),this.userService.addAddress(t)),updateAddress:async t=>(await this.ensureAuthenticated(),this.userService.updateAddress(t)),purgeAddress:async t=>(await this.ensureAuthenticated(),this.userService.purgeAddress(t)),addPayment:async t=>(await this.ensureAuthenticated(),this.userService.addPayment(t)),updatePayment:async t=>(await this.ensureAuthenticated(),this.userService.updatePayment(t)),purgePayment:async(t,e)=>(await this.ensureAuthenticated(),this.userService.purgePayment(t,e))},this.payment={mount:async t=>(await this.ensureAuthenticated(),this.paymentService.mount(t)),generateToken:async()=>(await this.ensureAuthenticated(),this.paymentService.generateToken()),subscribe:(t,e)=>{this.paymentService.subscribe(t,e)},unsubscribe:(t,e)=>{this.paymentService.unsubscribe(t,e)},collapse:()=>{this.paymentService.collapse()},unmount:()=>{this.paymentService.unmount()},destroy:()=>{this.paymentService.destroy()}},this.checkout={prepare:async t=>(await this.ensureAuthenticated(),this.checkoutService.prepare(t)),complete:async t=>(await this.ensureAuthenticated(),this.checkoutService.complete(t))},this.config=e,this.singletonManager=b.getInstance();const r=this.determineBaseURL(e);this.authenticatedClient=this.singletonManager.getAuthenticatedClient({apiKey:t,baseURL:r}),this.addressService=this.singletonManager.getAddressService(this.authenticatedClient),this.catalogService=this.singletonManager.getCatalogService(this.authenticatedClient),this.cartService=this.singletonManager.getCartService(this.authenticatedClient),this.userService=this.singletonManager.getUserService(this.authenticatedClient),this.paymentService=this.singletonManager.getPaymentService(),this.checkoutService=this.singletonManager.getCheckoutService(this.authenticatedClient)}determineBaseURL(t){const e=t.env||exports.LIQUID_COMMERCE_ENV.STAGE;return v[e]}async init(){try{await this.authenticatedClient.authenticate()}catch(t){throw new Error("Authentication failed during initialization")}}async ensureAuthenticated(){this.authenticatedClient.isTokenExpired()&&await this.authenticatedClient.authenticate()}}exports.LiquidCommerce=async function(t,e){const r=b.getInstance();return r.setLiquidCommerceClientConstructor(L),await r.getLiquidCommerceClient(t,e)};
1
+ "use strict";var LIQUID_COMMERCE_ENV,t,e,r,i,s,o,E,n,a,I,l,d,R,h,N,u,c,T,A,O,S,p=require("@stripe/stripe-js");exports.LIQUID_COMMERCE_ENV=void 0,(LIQUID_COMMERCE_ENV=exports.LIQUID_COMMERCE_ENV||(exports.LIQUID_COMMERCE_ENV={})).LOC="loc",LIQUID_COMMERCE_ENV.STAGE="stage",LIQUID_COMMERCE_ENV.PROD="prod",LIQUID_COMMERCE_ENV.DEV="dev",exports.ENUM_MODALITIES=void 0,(t=exports.ENUM_MODALITIES||(exports.ENUM_MODALITIES={})).ON_DEMAND="onDemand",t.SHIPPING="shipping",exports.DAYS_OF_WEEK=void 0,(e=exports.DAYS_OF_WEEK||(exports.DAYS_OF_WEEK={})).MONDAY="monday",e.TUESDAY="tuesday",e.WEDNESDAY="wednesday",e.THURSDAY="thursday",e.FRIDAY="friday",e.SATURDAY="saturday",e.SUNDAY="sunday",exports.STATES_CODE=void 0,(r=exports.STATES_CODE||(exports.STATES_CODE={})).AL="AL",r.AK="AK",r.AR="AR",r.CA="CA",r.CO="CO",r.CT="CT",r.DE="DE",r.DC="DC",r.FL="FL",r.GA="GA",r.HI="HI",r.ID="ID",r.IL="IL",r.IN="IN",r.IA="IA",r.KS="KS",r.KY="KY",r.LA="LA",r.ME="ME",r.MD="MD",r.MA="MA",r.MI="MI",r.MN="MN",r.MS="MS",r.MO="MO",r.MT="MT",r.NE="NE",r.NV="NV",r.NH="NH",r.NJ="NJ",r.NM="NM",r.NY="NY",r.NC="NC",r.ND="ND",r.OH="OH",r.OK="OK",r.OR="OR",r.PA="PA",r.RI="RI",r.SC="SC",r.SD="SD",r.TN="TN",r.TX="TX",r.UT="UT",r.VT="VT",r.VA="VA",r.WA="WA",r.WV="WV",r.WI="WI",r.WY="WY",exports.STATES_NAME=void 0,(i=exports.STATES_NAME||(exports.STATES_NAME={})).ALABAMA="AL",i.ALASKA="AK",i.ARKANSAS="AR",i.CALIFORNIA="CA",i.COLORADO="CO",i.CONNECTICUT="CT",i.DELAWARE="DE",i.DISTRICT_OF_COLUMBIA="DC",i.FLORIDA="FL",i.GEORGIA="GA",i.HAWAII="HI",i.IDAHO="ID",i.ILLINOIS="IL",i.INDIANA="IN",i.IOWA="IA",i.KANSAS="KS",i.KENTUCKY="KY",i.LOUISIANA="LA",i.MAINE="ME",i.MARYLAND="MD",i.MASSACHUSETTS="MA",i.MICHIGAN="MI",i.MINNESOTA="MN",i.MISSISSIPPI="MS",i.MISSOURI="MO",i.MONTANA="MT",i.NEBRASKA="NE",i.NEVADA="NV",i.NEW_HAMPSHIRE="NH",i.NEW_JERSEY="NJ",i.NEW_MEXICO="NM",i.NEW_YORK="NY",i.NORTH_CAROLINA="NC",i.NORTH_DAKOTA="ND",i.OHIO="OH",i.OKLAHOMA="OK",i.OREGON="OR",i.PENNSYLVANIA="PA",i.RHODE_ISLAND="RI",i.SOUTH_CAROLINA="SC",i.SOUTH_DAKOTA="SD",i.TENNESSEE="TN",i.TEXAS="TX",i.UTAH="UT",i.VERMONT="VT",i.VIRGINIA="VA",i.WASHINGTON="WA",i.WEST_VIRGINIA="WV",i.WISCONSIN="WI",i.WYOMING="WY",exports.ENUM_ENGRAVING=void 0,(s=exports.ENUM_ENGRAVING||(exports.ENUM_ENGRAVING={})).YES="YES",s.NO="NO",exports.ENUM_FILTER_KEYS=void 0,(o=exports.ENUM_FILTER_KEYS||(exports.ENUM_FILTER_KEYS={})).BRANDS="brands",o.FLAVOR="flavor",o.FULFILLMENT="fulfillment",o.TAGS="tags",o.REGION="region",o.VARIETY="variety",o.ENGRAVING="engraving",o.PRICE="price",o.AVAILABILITY="availability",o.CATEGORIES="categories",o.SIZES="sizes",o.COLORS="colors",o.APPELLATION="appellation",o.COUNTRY="country",o.VINTAGE="vintage",o.MATERIALS="materials",o.COLLECTION_TAGS="collectionTags",exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE=void 0,(E=exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE||(exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE={})).ASC="asc",E.DESC="desc",exports.ENUM_ORDER_BY=void 0,(exports.ENUM_ORDER_BY||(exports.ENUM_ORDER_BY={})).PRICE="price",exports.ENUM_AVAILABILITY_VALUE=void 0,(n=exports.ENUM_AVAILABILITY_VALUE||(exports.ENUM_AVAILABILITY_VALUE={})).UNSPECIFIED="AVAILABILITY_UNSPECIFIED",n.IN_STOCK="IN_STOCK",n.OUT_OF_STOCK="OUT_OF_STOCK",n.PREORDER="PREORDER",n.BACKORDER="BACKORDER",exports.CART_PARAM_ERROR_ENUM=void 0,(a=exports.CART_PARAM_ERROR_ENUM||(exports.CART_PARAM_ERROR_ENUM={})).INVALID_ITEMS_TYPE="Items must be a non-empty array",a.INVALID_ITEMS_MAX="You can only send up to 25 items at a time!",a.INVALID_PART_NUMBER="The partnerNumber provided is invalid",a.INVALID_FULFILLMENT_ID="The fulfillmentId provided is invalid",exports.CART_EVENT_ENUM=void 0,(I=exports.CART_EVENT_ENUM||(exports.CART_EVENT_ENUM={})).OOS="OutOfStock",I.ITEMS_NOT_ADDED="ItemsNotAdded",I.ITEMS_REQUESTED_NOT_ADDED="ItemsRequestedNotAdded",I.ITEM_NOT_ENGRAVED="ItemEngravingError",I.ADDRESS_CHANGE="AddressChange",I.LOCATION_AVAILABILITY="LocationAvailability",I.PARTNER_PRODUCT_CONFIGS="PartnerProductConfigs",I.REMOVED_EXISTING_ITEMS="RemovedExistingCartItems",I.RETAILER_MIN="RetailerMinNotMet",I.NO_ITEMS_IN_CART="NoItemsInCart",I.INVALID_ID="InvalidId",I.NO_ID="NoId",I.CART_CHECKOUT_PROCESSED="CartCheckoutProcessed",I.NEW_CART="NewCart",I.DEFAULT="CartError",I.ITEM_QTY_CHANGE="ItemQuantityChange",I.ITEM_ID_NOT_FOUND="ItemIdNotFound",I.ITEMS_REMOVED="ItemsRemoved",exports.ENUM_ADDRESS_TYPE=void 0,(l=exports.ENUM_ADDRESS_TYPE||(exports.ENUM_ADDRESS_TYPE={})).SHIPPING="shipping",l.BILLING="billing",exports.ENUM_CHECKOUT_STATUS_CODE_ERROR=void 0,(d=exports.ENUM_CHECKOUT_STATUS_CODE_ERROR||(exports.ENUM_CHECKOUT_STATUS_CODE_ERROR={}))[d.REQUEST_DEFAULT_ERROR=5480]="REQUEST_DEFAULT_ERROR",d[d.REQUEST_LOCATION_OOS_ERROR=5481]="REQUEST_LOCATION_OOS_ERROR",d[d.REQUEST_LOCATION_MISMATCH_ERROR=5482]="REQUEST_LOCATION_MISMATCH_ERROR",d[d.REQUEST_BIRTHDATE_ERROR=5483]="REQUEST_BIRTHDATE_ERROR",d[d.REQUEST_CART_NOT_AVAILABLE_ERROR=5484]="REQUEST_CART_NOT_AVAILABLE_ERROR",d[d.REQUEST_CART_ID_ERROR=5485]="REQUEST_CART_ID_ERROR",d[d.REQUEST_CART_ITEM_ERROR=5486]="REQUEST_CART_ITEM_ERROR",d[d.REQUEST_VALIDATION_ERROR=5487]="REQUEST_VALIDATION_ERROR",d[d.REQUEST_TAX_ERROR=5488]="REQUEST_TAX_ERROR",d[d.REQUEST_COMPLETE_TOKEN=5489]="REQUEST_COMPLETE_TOKEN",d[d.REQUEST_DEFAULT_COMPLETE_ERROR=5490]="REQUEST_DEFAULT_COMPLETE_ERROR",d[d.REQUEST_CHECKOUT_COMPLETE_UPDATE_ERROR=5491]="REQUEST_CHECKOUT_COMPLETE_UPDATE_ERROR",d[d.REQUEST_CHECKOUT_COMPLETE_SAVE_ERROR=5492]="REQUEST_CHECKOUT_COMPLETE_SAVE_ERROR",d[d.REQUEST_CHECKOUT_HAS_COMPLETE_ERROR=5493]="REQUEST_CHECKOUT_HAS_COMPLETE_ERROR",d[d.REQUEST_NO_CART_ITEM_ERROR=5494]="REQUEST_NO_CART_ITEM_ERROR",d[d.REQUEST_NO_CUSTOMER_FOUND_ERROR=5495]="REQUEST_NO_CUSTOMER_FOUND_ERROR",d[d.REQUEST_PAYMENT_ATTACHED_ERROR=5496]="REQUEST_PAYMENT_ATTACHED_ERROR",d[d.REQUEST_SHIPPING_ADDRESS_ERROR=5497]="REQUEST_SHIPPING_ADDRESS_ERROR",d[d.REQUEST_BILLING_ADDRESS_ERROR=5498]="REQUEST_BILLING_ADDRESS_ERROR",d[d.REQUEST_PAYMENT_NOT_FOUND_ERROR=5499]="REQUEST_PAYMENT_NOT_FOUND_ERROR",d[d.REQUEST_CART_UPDATED_ERROR=5501]="REQUEST_CART_UPDATED_ERROR",d[d.REQUEST_ADDRESS_DEFAULT_ERROR=5502]="REQUEST_ADDRESS_DEFAULT_ERROR",d[d.REQUEST_TIPS_ERROR=5503]="REQUEST_TIPS_ERROR",exports.ENUM_CHECKOUT_STATUS_CODE_MESSAGE=void 0,(R=exports.ENUM_CHECKOUT_STATUS_CODE_MESSAGE||(exports.ENUM_CHECKOUT_STATUS_CODE_MESSAGE={})).REQUEST_DEFAULT_ERROR="There's been an error with your checkout request.",R.REQUEST_LOCATION_OOS_ERROR="The requested items are out of stock at this location.",R.REQUEST_LOCATION_MISMATCH_ERROR="The selected location doesn't match your cart items.",R.REQUEST_BIRTHDATE_ERROR="Please verify your birthdate and try again.",R.REQUEST_CART_NOT_AVAILABLE_ERROR="This cart is no longer available.",R.REQUEST_CART_ID_ERROR="The cartId requested is invalid, check and try again.",R.REQUEST_CART_ITEM_ERROR="There's an issue with one or more items in your cart.",R.REQUEST_VALIDATION_ERROR="There's been an error with your request parameters, check and try again.",R.REQUEST_TAX_ERROR="There was an error calculating tax for your order.",R.REQUEST_COMPLETE_TOKEN="The checkout token provided is invalid, check and try again.",R.REQUEST_DEFAULT_COMPLETE_ERROR="There was an error completing your checkout, confirm through the (prepare) method and try again.",R.REQUEST_CHECKOUT_COMPLETE_UPDATE_ERROR="Unable to update your checkout status.",R.REQUEST_CHECKOUT_COMPLETE_SAVE_ERROR="Unable to save your completed checkout.",R.REQUEST_CHECKOUT_HAS_COMPLETE_ERROR="This checkout has already been processed, create a new cart to process a new checkout.",R.REQUEST_NO_CART_ITEM_ERROR="No items found in your cart.",R.REQUEST_NO_CUSTOMER_FOUND_ERROR="The customer account was not found.",R.REQUEST_PAYMENT_ATTACHED_ERROR="The payment attached to the checkout is not a valid payment method for this customer.",R.REQUEST_SHIPPING_ADDRESS_ERROR="The address in your cart has changed, check and try again.",R.REQUEST_BILLING_ADDRESS_ERROR="The billing address in your checkout is not valid, check and try again.",R.REQUEST_PAYMENT_NOT_FOUND_ERROR="The payment method provided was not found.",R.REQUEST_CART_UPDATED_ERROR="The cart requested was updated during your checkout.",R.REQUEST_ADDRESS_DEFAULT_ERROR="There's been an error with your address configurations in cart and/or billing address, check and try again.",R.REQUEST_TIPS_ERROR="There's been an error applying your tips to the checkout.",exports.ENUM_BEER=void 0,(h=exports.ENUM_BEER||(exports.ENUM_BEER={})).ALE="BEER > ALE",h.LAGER="BEER > LAGER",h.BASE="BEER",h.NON_ALCOHOLIC="BEER > NON-ALCOHOLIC",h.OTHER_BEER="BEER > OTHER",h.OTHER_BEER_SOUR_BEER="BEER > SOUR BEER",h.OTHER_BEER_FLAVORED_BEER="BEER > FLAVORED BEER",h.OTHER_BEER_FRUIT_BEER="BEER > FRUIT BEER",exports.ENUM_FOOD=void 0,(N=exports.ENUM_FOOD||(exports.ENUM_FOOD={})).BASE="FOOD",N.PANTRY_OTHER="FOOD > PANTRY > OTHER",N.CANDY="FOOD > CANDY",N.CANDY_OTHER="FOOD > CANDY > OTHER",N.CBD="FOOD > CBD",N.CBD_OTHER="FOOD > CBD > OTHER",N.CHEESE="FOOD > CHEESE",N.CHEESE_OTHER="FOOD > CHEESE > OTHER",N.HOUSEHOLD="FOOD > HOUSEHOLD",N.HOUSEHOLD_SNACKS="FOOD > HOUSEHOLD > SNACKS",N.HOUSEHOLD_OTHER="FOOD > HOUSEHOLD > OTHER",N.PANTRY="FOOD > PANTRY",N.FRUIT="FOOD > FRUIT",N.OTHER="FOOD > OTHER",N.ICE="FOOD > ICE",N.ICE_CREAM="FOOD > ICE CREAM",N.PARTY_SUPPLIES="FOOD > PARTY SUPPLIES",N.PARTY_SUPPLIES_OTHER="FOOD > PARTY SUPPLIES > OTHER",N.SPIRITS_BASED="FOOD > SPIRITS BASED",N.GARNISHES="FOOD > GARNISHES",exports.ENUM_MERCHANDISE=void 0,(u=exports.ENUM_MERCHANDISE||(exports.ENUM_MERCHANDISE={})).BASE="MERCHANDISE",u.GLASSWARE="MERCHANDISE > GLASSWARE",u.GLASSWARE_OTHER="MERCHANDISE > GLASSWARE > OTHER",u.HUMIDOR="MERCHANDISE > HUMIDOR",u.ACCESSORY="MERCHANDISE > ACCESSORY",u.ACCESSORY_OTHER="MERCHANDISE > ACCESSORY > OTHER",u.GIFT_SET="MERCHANDISE > GIFT SET",u.GIFT_SET_GIFT_BAG="MERCHANDISE > GIFT SET > GIFT BAG",u.GIFT_SET_GIFT_CARD="MERCHANDISE > GIFT SET > GIFT CARD",u.BAR_TOOLS="MERCHANDISE > BAR TOOLS",u.BAR_TOOLS_ICE_BUCKET="MERCHANDISE > BAR TOOLS > ICE BUCKET",u.BAR_TOOLS_OTHER="MERCHANDISE > BAR TOOLS > OTHER",exports.ENUM_MISCELLANEOUS=void 0,(c=exports.ENUM_MISCELLANEOUS||(exports.ENUM_MISCELLANEOUS={})).BASE="MISCELLANEOUS",c.GIFT_CARD="MISCELLANEOUS > GIFT CARDS",c.PROMOTIONAL="MISCELLANEOUS > PROMOTIONAL",c.MEMBERSHIP="MISCELLANEOUS > MEMBERSHIP",exports.ENUM_NON_ALCOHOLIC=void 0,(T=exports.ENUM_NON_ALCOHOLIC||(exports.ENUM_NON_ALCOHOLIC={})).BASE="NON ALCOHOLIC",T.BITTERS="NON ALCOHOLIC > BITTERS",T.COCKTAIL_MIX="NON ALCOHOLIC > COCKTAIL MIX",T.COFFEE="NON ALCOHOLIC > COFFEE",T.ENERGY_DRINKS="NON ALCOHOLIC > ENERGY DRINKS",T.JUICE="NON ALCOHOLIC > JUICE",T.SODA="NON ALCOHOLIC > SODA",T.SPECIALTY_ITEM="NON ALCOHOLIC > SPECIALTY ITEM",T.SPECIALTY_ITEM_OTHER="NON ALCOHOLIC > SPECIALTY ITEM > OTHER",T.SPIRITS="NON ALCOHOLIC > SPIRITS",T.TEA="NON ALCOHOLIC > TEA",T.WATER="NON ALCOHOLIC > WATER",T.WINE="NON ALCOHOLIC > WINE",T.SPORTS_DRINKS="NON ALCOHOLIC > SPORTS DRINKS",T.SLURPEES="NON ALCOHOLIC > SLURPEES",T.GINGER_BEER="NON ALCOHOLIC > GINGER BEER",T.DAIRY="NON ALCOHOLIC > DAIRY",T.DAIRY_OTHER="NON ALCOHOLIC > DAIRY > OTHER",T.OTHER="NON ALCOHOLIC > OTHER",exports.ENUM_READY_TO_DRINK=void 0,(A=exports.ENUM_READY_TO_DRINK||(exports.ENUM_READY_TO_DRINK={})).BASE="READY TO DRINK",A.HARD_CIDER="READY TO DRINK > HARD CIDER",A.HARD_CIDER_PERRY_PEAR_CIDER="READY TO DRINK > HARD CIDER > PERRY (PEAR CIDER)",A.HARD_CIDER_APPLE_CIDER="READY TO DRINK > HARD CIDER > APPLE CIDER",A.HARD_CIDER_OTHER_FRUIT_CIDER="READY TO DRINK > HARD CIDER > FRUIT CIDER",A.HARD_TEA="READY TO DRINK > HARD TEA",A.HARD_SELTZER="READY TO DRINK > HARD SELTZER",A.MALT_BASED="READY TO DRINK > MALT BASED",A.SPIRITS_BASED_RTDS="READY TO DRINK > SPIRITS-BASED RTDS",A.SPIRITS_BASED_RTDS_AGAVE_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > AGAVE COCKTAILS",A.SPIRITS_BASED_RTDS_GIN_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > GIN COCKTAILS",A.SPIRITS_BASED_RTDS_RUM_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > RUM COCKTAILS",A.SPIRITS_BASED_RTDS_TEQUILA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEQUILA COCKTAILS",A.SPIRITS_BASED_RTDS_VODKA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > VODKA COCKTAILS",A.SPIRITS_BASED_RTDS_WHISKEY_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > WHISKEY COCKTAILS",A.SPIRITS_BASED_RTDS_OTHER="READY TO DRINK > SPIRITS-BASED RTDS > OTHER",A.SPIRITS_BASED_RTDS_FROZEN_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > FROZEN COCKTAILS",A.SPIRITS_BASED_RTDS_APERITIF_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > APERITIF COCKTAILS",A.SPIRITS_BASED_RTDS_DESSERT_COFFEE_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > DESSERT & COFFEE COCKTAILS",A.SPIRITS_BASED_RTDS_TEA_COCKTAILS="READY TO DRINK > SPIRITS-BASED RTDS > TEA COCKTAILS",A.WINE_COCKTAILS="READY TO DRINK > WINE COCKTAILS",A.OTHER="READY TO DRINK > OTHER",exports.ENUM_SPIRITS=void 0,(O=exports.ENUM_SPIRITS||(exports.ENUM_SPIRITS={})).BASE="SPIRITS",O.AMARO_APERITIF_VERMOUTH="SPIRITS > AMARO APERITIF & VERMOUTH",O.AMARO_APERITIF_VERMOUTH_OTHER="SPIRITS > AMARO APERITIF & VERMOUTH > OTHER",O.BAIJIU="SPIRITS > BAIJIU",O.BITTERS="SPIRITS > BITTERS",O.BRANDY="SPIRITS > BRANDY",O.BRANDY_COGNAC="SPIRITS > BRANDY > COGNAC",O.CACHACA="SPIRITS > CACHACA",O.GIN="SPIRITS > GIN",O.GIN_DRY_GIN="SPIRITS > GIN > DRY GIN",O.GIN_FLAVORED_GIN="SPIRITS > GIN > FLAVORED GIN",O.GIN_OLD_TOM_GIN="SPIRITS > GIN > OLD TOM GIN",O.GIN_OTHER="SPIRITS > GIN > OTHER",O.GRAIN_ALCOHOL="SPIRITS > GRAIN ALCOHOL",O.LIQUEUR="SPIRITS > LIQUEUR",O.MEZCAL="SPIRITS > MEZCAL",O.OTHER_SPIRITS="SPIRITS > OTHER SPIRITS",O.RUM="SPIRITS > RUM",O.RUM_AGED_RUM="SPIRITS > RUM > AGED RUM",O.RUM_DARK_RUM="SPIRITS > RUM > DARK RUM",O.RUM_FLAVORED_RUM="SPIRITS > RUM > FLAVORED RUM",O.RUM_GOLD_RUM="SPIRITS > RUM > GOLD RUM",O.RUM_OTHER="SPIRITS > RUM > OTHER",O.RUM_SPICED="SPIRITS > RUM > SPICED",O.RUM_WHITE_RUM="SPIRITS > RUM > WHITE RUM",O.SHOCHU="SPIRITS > SHOCHU",O.SOJU="SPIRITS > SOJU",O.SOTOL="SPIRITS > SOTOL",O.TEQUILA="SPIRITS > TEQUILA",O.TEQUILA_ANEJO="SPIRITS > TEQUILA > AÑEJO",O.TEQUILA_BLANCO="SPIRITS > TEQUILA > BLANCO",O.TEQUILA_CRISTALINO="SPIRITS > TEQUILA > CRISTALINO",O.TEQUILA_EXTRA_ANEJO="SPIRITS > TEQUILA > EXTRA AÑEJO",O.TEQUILA_OTHER="SPIRITS > TEQUILA > OTHER",O.TEQUILA_REPOSADO="SPIRITS > TEQUILA > REPOSADO",O.VODKA="SPIRITS > VODKA",O.VODKA_FLAVORED_VODKA="SPIRITS > VODKA > FLAVORED VODKA",O.VODKA_OTHER="SPIRITS > VODKA > OTHER",O.VODKA_REGULAR_VODKA="SPIRITS > VODKA > REGULAR VODKA",O.WHISKEY="SPIRITS > WHISKEY",O.WHISKEY_AMERICAN_WHISKEY="SPIRITS > WHISKEY > AMERICAN WHISKEY",O.WHISKEY_BOURBON="SPIRITS > WHISKEY > BOURBON",O.WHISKEY_CANADIAN_WHISKEY="SPIRITS > WHISKEY > CANADIAN WHISKEY",O.WHISKEY_IRISH_WHISKEY="SPIRITS > WHISKEY > IRISH WHISKEY",O.WHISKEY_MOONSHINE="SPIRITS > WHISKEY > MOONSHINE",O.WHISKEY_FLAVORED="SPIRITS > WHISKEY > FLAVORED WHISKEY",O.WHISKEY_OTHER="SPIRITS > WHISKEY > OTHER",O.WHISKEY_SCOTCH="SPIRITS > WHISKEY > SCOTCH",exports.ENUM_WINE=void 0,(S=exports.ENUM_WINE||(exports.ENUM_WINE={})).BASE="WINE",S.CHAMPAGNE_SPARKLING="WINE > CHAMPAGNE & SPARKLING",S.CHAMPAGNE_SPARKLING_CAVA="WINE > CHAMPAGNE & SPARKLING > CAVA",S.CHAMPAGNE_SPARKLING_CHAMPAGNE="WINE > CHAMPAGNE & SPARKLING > CHAMPAGNE",S.CHAMPAGNE_SPARKLING_PROSECCO="WINE > CHAMPAGNE & SPARKLING > PROSECCO",S.CHAMPAGNE_SPARKLING_SPARKLING_WINE="WINE > CHAMPAGNE & SPARKLING > SPARKLING WINE",S.CHAMPAGNE_SPARKLING_OTHER="WINE > CHAMPAGNE & SPARKLING > OTHER",S.COOKING="WINE > COOKING",S.DESSERT_FORTIFIED_WINE="WINE > DESSERT & FORTIFIED WINE",S.DESSERT_FORTIFIED_WINE_MEAD="WINE > DESSERT & FORTIFIED WINE > MEAD",S.DESSERT_FORTIFIED_WINE_PORT="WINE > DESSERT & FORTIFIED WINE > PORT",S.DESSERT_FORTIFIED_WINE_SHERRY="WINE > DESSERT & FORTIFIED WINE > SHERRY",S.DESSERT_FORTIFIED_WINE_OTHER="WINE > DESSERT & FORTIFIED WINE > OTHER",S.RED_WINE="WINE > RED WINE",S.RED_WINE_AGIORGITIKO="WINE > RED WINE > AGIORGITIKO",S.RED_WINE_AGLIANICO="WINE > RED WINE > AGLIANICO",S.RED_WINE_ALICANTE_BOUSCHET="WINE > RED WINE > ALICANTE BOUSCHET",S.RED_WINE_BARBERA="WINE > RED WINE > BARBERA",S.RED_WINE_BARBARESCO="WINE > RED WINE > BARBARESCO",S.RED_WINE_BAROLO="WINE > RED WINE > BAROLO",S.RED_WINE_BEAUJOLAIS="WINE > RED WINE > BEAUJOLAIS",S.RED_WINE_BLAUER_ZWEIGELT="WINE > RED WINE > BLAUER ZWEIGELT",S.RED_WINE_BOBAL="WINE > RED WINE > BOBAL",S.RED_WINE_BONARDA="WINE > RED WINE > BONARDA",S.RED_WINE_BORDEAUX="WINE > RED WINE > BORDEAUX",S.RED_WINE_BORDEAUX_BLEND="WINE > RED WINE > BORDEAUX BLEND",S.RED_WINE_BURGUNDY="WINE > RED WINE > BURGUNDY",S.RED_WINE_CABERNET_FRANC="WINE > RED WINE > CABERNET FRANC",S.RED_WINE_CABERNET_SAUVIGNON="WINE > RED WINE > CABERNET SAUVIGNON",S.RED_WINE_CANNONAU="WINE > RED WINE > CANNONAU",S.RED_WINE_CARMENERE="WINE > RED WINE > CARMENERE",S.RED_WINE_CHAMBOURCIN="WINE > RED WINE > CHAMBOURCIN",S.RED_WINE_CHIANTI="WINE > RED WINE > CHIANTI",S.RED_WINE_CINSAULT="WINE > RED WINE > CINSAULT",S.RED_WINE_CORVINA="WINE > RED WINE > CORVINA",S.RED_WINE_DOLCETTO="WINE > RED WINE > DOLCETTO",S.RED_WINE_DORNFELDER="WINE > RED WINE > DORNFELDER",S.RED_WINE_FETEASCA_NEAGRA="WINE > RED WINE > FETEASCA NEAGRA",S.RED_WINE_GAMAY="WINE > RED WINE > GAMAY",S.RED_WINE_GRACIANO="WINE > RED WINE > GRACIANO",S.RED_WINE_GRENACHE="WINE > RED WINE > GRENACHE",S.RED_WINE_LIMNIO="WINE > RED WINE > LIMNIO",S.RED_WINE_MACABEO="WINE > RED WINE > MACABEO",S.RED_WINE_MALBEC="WINE > RED WINE > MALBEC",S.RED_WINE_MENCIA="WINE > RED WINE > MENCIA",S.RED_WINE_MERLOT="WINE > RED WINE > MERLOT",S.RED_WINE_MONICA="WINE > RED WINE > MONICA",S.RED_WINE_MONTEPULCIANO="WINE > RED WINE > MONTEPULCIANO",S.RED_WINE_MOURVEDRE_MONASTRELL="WINE > RED WINE > MOURVEDRE/MONASTRELL",S.RED_WINE_NEBBIOLO="WINE > RED WINE > NEBBIOLO",S.RED_WINE_NEGROAMARO="WINE > RED WINE > NEGROAMARO",S.RED_WINE_NERELLO_MASCALESE="WINE > RED WINE > NERELLO MASCALESE",S.RED_WINE_NERO_DAVOLA="WINE > RED WINE > NERO D'AVOLA",S.RED_WINE_PETIT_VERDOT="WINE > RED WINE > PETIT VERDOT",S.RED_WINE_PETITE_SIRAH="WINE > RED WINE > PETITE SIRAH",S.RED_WINE_PINOT_NOIR="WINE > RED WINE > PINOT NOIR",S.RED_WINE_PINOTAGE="WINE > RED WINE > PINOTAGE",S.RED_WINE_PRIMITIVO="WINE > RED WINE > PRIMITIVO",S.RED_WINE_RED_BLEND="WINE > RED WINE > RED BLEND",S.RED_WINE_RHONE_BLEND="WINE > RED WINE > RHONE BLEND",S.RED_WINE_RIOJA="WINE > RED WINE > RIOJA",S.RED_WINE_SAGRANTINO="WINE > RED WINE > SAGRANTINO",S.RED_WINE_SANGIOVESE="WINE > RED WINE > SANGIOVESE",S.RED_WINE_SAPERAVI="WINE > RED WINE > SAPERAVI",S.RED_WINE_SCHIAVA_TROLLINGER="WINE > RED WINE > SCHIAVA/TROLLINGER",S.RED_WINE_SYRAH_SHIRAZ="WINE > RED WINE > SYRAH/SHIRAZ",S.RED_WINE_TANNAT="WINE > RED WINE > TANNAT",S.RED_WINE_TEMPRANILLO="WINE > RED WINE > TEMPRANILLO",S.RED_WINE_TEROLDEGO="WINE > RED WINE > TEROLDEGO",S.RED_WINE_TINTA_DEL_TORO="WINE > RED WINE > TINTA DEL TORO",S.RED_WINE_TOURIGA_NACIONAL="WINE > RED WINE > TOURIGA NACIONAL",S.RED_WINE_VALPOLICELLA="WINE > RED WINE > VALPOLICELLA",S.RED_WINE_XINOMAVRO="WINE > RED WINE > XINOMAVRO",S.RED_WINE_ZINFANDEL="WINE > RED WINE > ZINFANDEL",S.RED_WINE_ZWEIGELT="WINE > RED WINE > ZWEIGELT",S.RED_WINE_OTHER="WINE > RED WINE > OTHER",S.ROSE_WINE="WINE > ROSE WINE",S.SAKE="WINE > SAKE",S.WHITE_WINE="WINE > WHITE WINE",S.WHITE_WINE_ALBARINO_ALVARINHO="WINE > WHITE WINE > ALBARINO/ALVARINHO",S.WHITE_WINE_ARNEIS="WINE > WHITE WINE > ARNEIS",S.WHITE_WINE_ASTI="WINE > WHITE WINE > ASTI",S.WHITE_WINE_ASSYRTIKO="WINE > WHITE WINE > ASSYRTIKO",S.WHITE_WINE_BURGUNDY="WINE > WHITE WINE > BURGUNDY",S.WHITE_WINE_CARRICANTE="WINE > WHITE WINE > CARRICANTE",S.WHITE_WINE_CATARRATTO="WINE > WHITE WINE > CATARRATTO",S.WHITE_WINE_CHABLIS="WINE > WHITE WINE > CHABLIS",S.WHITE_WINE_CHARDONNAY="WINE > WHITE WINE > CHARDONNAY",S.WHITE_WINE_CHENIN_BLANC="WINE > WHITE WINE > CHENIN BLANC",S.WHITE_WINE_CORTESE="WINE > WHITE WINE > CORTESE",S.WHITE_WINE_FALANGHINA="WINE > WHITE WINE > FALANGHINA",S.WHITE_WINE_FIANO="WINE > WHITE WINE > FIANO",S.WHITE_WINE_FRIULANO="WINE > WHITE WINE > FRIULANO",S.WHITE_WINE_FURMINT="WINE > WHITE WINE > FURMINT",S.WHITE_WINE_GARGANEGA="WINE > WHITE WINE > GARGANEGA",S.WHITE_WINE_GAVI="WINE > WHITE WINE > GAVI",S.WHITE_WINE_GEWURZTRAMINER="WINE > WHITE WINE > GEWURZTRAMINER",S.WHITE_WINE_GRECO_DI_TUFO="WINE > WHITE WINE > GRECO DI TUFO",S.WHITE_WINE_GRENACHE_BLANC="WINE > WHITE WINE > GRENACHE BLANC",S.WHITE_WINE_GRUNER_VELTLINER="WINE > WHITE WINE > GRUNER VELTLINER",S.WHITE_WINE_HUXELREBE="WINE > WHITE WINE > HUXELREBE",S.WHITE_WINE_INZOLIA="WINE > WHITE WINE > INZOLIA",S.WHITE_WINE_MALVASIA="WINE > WHITE WINE > MALVASIA",S.WHITE_WINE_MELON_DE_BOURGOGNE="WINE > WHITE WINE > MELON DE BOURGOGNE",S.WHITE_WINE_MOSCATO_BIANCO="WINE > WHITE WINE > MOSCATO BIANCO",S.WHITE_WINE_MOSCHOFILERO_FILERI="WINE > WHITE WINE > MOSCHOFILERO/FILERI",S.WHITE_WINE_MULLER_THURGAU_RIVANER="WINE > WHITE WINE > MULLER-THURGAU/RIVANER",S.WHITE_WINE_MUSCAT_MOSCATO="WINE > WHITE WINE > MUSCAT/MOSCATO",S.WHITE_WINE_PECORINO="WINE > WHITE WINE > PECORINO",S.WHITE_WINE_PICPOUL="WINE > WHITE WINE > PICPOUL",S.WHITE_WINE_PINOT_BLANC="WINE > WHITE WINE > PINOT BLANC",S.WHITE_WINE_PINOT_GRIGIO_PINOT_GRIS="WINE > WHITE WINE > PINOT GRIGIO/PINOT GRIS",S.WHITE_WINE_POUILLY_FUISSE="WINE > WHITE WINE > POUILLY-FUISSE",S.WHITE_WINE_POUILLY_FUME="WINE > WHITE WINE > POUILLY-FUME",S.WHITE_WINE_RIESLING="WINE > WHITE WINE > RIESLING",S.WHITE_WINE_RIOJA="WINE > WHITE WINE > RIOJA",S.WHITE_WINE_RODITIS="WINE > WHITE WINE > RODITIS",S.WHITE_WINE_SANCERRE="WINE > WHITE WINE > SANCERRE",S.WHITE_WINE_SAUVIGNON_BLANC="WINE > WHITE WINE > SAUVIGNON BLANC",S.WHITE_WINE_SEMILLON="WINE > WHITE WINE > SEMILLON",S.WHITE_WINE_SOAVE="WINE > WHITE WINE > SOAVE",S.WHITE_WINE_SYLVANER="WINE > WHITE WINE > SYLVANER",S.WHITE_WINE_TORRONTES="WINE > WHITE WINE > TORRONTES",S.WHITE_WINE_TREBBIANO_UGNI_BLANC="WINE > WHITE WINE > TREBBIANO/UGNI BLANC",S.WHITE_WINE_TURBIANA="WINE > WHITE WINE > TURBIANA",S.WHITE_WINE_TXAKOLINA="WINE > WHITE WINE > TXAKOLINA",S.WHITE_WINE_VERDEJO="WINE > WHITE WINE > VERDEJO",S.WHITE_WINE_VERDICCHIO="WINE > WHITE WINE > VERDICCHIO",S.WHITE_WINE_VERMENTINO="WINE > WHITE WINE > VERMENTINO",S.WHITE_WINE_VERNACCIA="WINE > WHITE WINE > VERNACCIA",S.WHITE_WINE_VIDIANO="WINE > WHITE WINE > VIDIANO",S.WHITE_WINE_VINHO_VERDE="WINE > WHITE WINE > VINHO VERDE",S.WHITE_WINE_VIOGNIER="WINE > WHITE WINE > VIOGNIER",S.WHITE_WINE_VIURA="WINE > WHITE WINE > VIURA",S.WHITE_WINE_OTHER="WINE > WHITE WINE > OTHER",S.WINE_OTHER="WINE > OTHER";const W={[exports.LIQUID_COMMERCE_ENV.LOC]:"https://dev.api.liquidcommerce.cloud",[exports.LIQUID_COMMERCE_ENV.DEV]:"https://dev.api.liquidcommerce.cloud",[exports.LIQUID_COMMERCE_ENV.STAGE]:"https://staging.api.liquidcommerce.cloud",[exports.LIQUID_COMMERCE_ENV.PROD]:"https://api.liquidcommerce.cloud"};class v{constructor(t){this.accessToken=null,this.tokenExpiration=null,this.isAuthenticating=!1,this.xhrFetch=(t,e)=>new Promise(((r,i)=>{const s=new XMLHttpRequest;s.open(e.method||"GET",t),Object.entries(e.headers).forEach((([t,e])=>{s.setRequestHeader(t,e)})),s.onload=()=>{r({ok:s.status>=200&&s.status<300,status:s.status,statusText:s.statusText,headers:s.getAllResponseHeaders().split("\r\n").reduce(((t,e)=>{const[r,i]=e.split(": ");return r&&(t[r]=i),t}),{}),json:()=>Promise.resolve(JSON.parse(s.responseText)),text:()=>Promise.resolve(s.responseText)})},s.onerror=()=>{i(new TypeError("Network request failed"))},s.send(e.body)})),this.apiKey=t.apiKey,this.baseURL=t.baseURL,this.httpClient=this.getFetchImplementation()}static getInstance(t){return v.instance||(v.instance=new v(t)),v.instance}getFetchImplementation(){return"undefined"!=typeof fetch?this.fetchAdapter(fetch):"undefined"!=typeof global&&global.fetch?this.fetchAdapter(global.fetch):this.xhrFetch}fetchAdapter(t){return async(e,r)=>{var i;const s=await t(e,r);let o;return"function"==typeof(null===(i=s.headers)||void 0===i?void 0:i.entries)?o=Object.fromEntries(s.headers.entries()):(o={},s.headers.forEach(((t,e)=>{o[e]=t}))),{ok:s.ok,status:s.status,statusText:s.statusText,headers:o,json:()=>s.json(),text:()=>s.text()}}}getUniqueKey(){return`${this.apiKey}_${this.baseURL}`}async authenticate(){var t,e;if(this.isAuthenticating)await new Promise((t=>{const e=()=>{this.isAuthenticating?setTimeout(e,100):t(void 0)};e()}));else{this.isAuthenticating=!0;try{const r=await this.requestWithoutAuth("/authentication",{method:"GET"});this.accessToken=null===(t=null==r?void 0:r.data)||void 0===t?void 0:t.token,this.tokenExpiration=Date.now()+1e3*(null===(e=null==r?void 0:r.data)||void 0===e?void 0:e.exp)}catch(t){throw new Error("Failed to authenticate with LiquidCommerce API")}finally{this.isAuthenticating=!1}}}async requestWithoutAuth(t,e){const r=new URL(`api${t}`,this.baseURL),i={"Content-Type":"application/json","X-LIQUID-API-KEY":this.apiKey,...e.headers},s={method:e.method,headers:i,body:e.body?JSON.stringify(e.body):void 0},o=await this.httpClient(r.toString(),s);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}isTokenExpired(){return!this.tokenExpiration||Date.now()>=this.tokenExpiration}async request(t,e){this.accessToken&&!this.isTokenExpired()||await this.authenticate();const r=new URL(`api${t}`,this.baseURL),i={"Content-Type":"application/json","X-LIQUID-API-KEY":this.apiKey,Authorization:`Bearer ${this.accessToken}`,...e.headers},s={method:e.method,headers:i,body:e.body?JSON.stringify(e.body):void 0},o=await this.httpClient(r.toString(),s);if(!o.ok)throw new Error(`HTTP error! status: ${o.status}`);return o.json()}async get(t,e){return this.request(t,{method:"GET",headers:e})}async post(t,e,r){return this.request(t,{method:"POST",body:e,headers:r})}async put(t,e,r){return this.request(t,{method:"PUT",body:e,headers:r})}async delete(t,e){return this.request(t,{method:"DELETE",headers:e})}}v.instance=null;class D{constructor(t){this.locationHelperService=t}validateAndNormalizeParams(t){const e={...t};return e.id=this.validateId(e.id),e.items=this.validateAndNormalizeItems(e.items),this.locationHelperService.validateAndNormalizeLocation(e.loc),e.refresh=Boolean(e.refresh),e}validateId(t){return t&&"string"==typeof t&&0!==t.trim().length?t.trim():""}validateAndNormalizeItems(t){if(!Array.isArray(t)||0===t.length)throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_ITEMS_TYPE);if(t.length>25)throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_ITEMS_MAX);return t.map((t=>this.validateAndNormalizeItem(t)))}validateAndNormalizeItem(t){const e={...t};if(!this.validatePartNumber(e.partNumber))throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_PART_NUMBER);if(!e.fulfillmentId||"string"!=typeof e.fulfillmentId||0===e.fulfillmentId.trim().length)throw new Error(exports.CART_PARAM_ERROR_ENUM.INVALID_FULFILLMENT_ID);return e.quantity=Math.max(0,Math.floor(e.quantity)),e.engravingLines&&(e.engravingLines=e.engravingLines.map((t=>t.trim())).filter((t=>t.length>0))),e}validatePartNumber(t){if(!t||"string"!=typeof t)return!1;const e=t.split("_");return 2===e.length&&14===e[0].length&&e[1].length>0}}class C{constructor(t){this.locationServiceHelper=t,this.taxonomyValues=new Set([...Object.values(exports.ENUM_BEER),...Object.values(exports.ENUM_FOOD),...Object.values(exports.ENUM_MERCHANDISE),...Object.values(exports.ENUM_NON_ALCOHOLIC),...Object.values(exports.ENUM_READY_TO_DRINK),...Object.values(exports.ENUM_SPIRITS),...Object.values(exports.ENUM_WINE),...Object.values(exports.ENUM_MISCELLANEOUS)])}validateAndNormalizeParams(t){var e,r,i,s,o,E,n,a,I;const l={...t},d=null!==(e=null==l?void 0:l.upcs)&&void 0!==e?e:[],R=null!==(r=null==l?void 0:l.grouping)&&void 0!==r?r:[],h=null!==(i=null==l?void 0:l.ids)&&void 0!==i?i:[];if([d,R,h].every((t=>this.validateIdsExist(t))))throw new Error("Product identifiers must be a non-empty array of strings");return d.length>0&&(this.validateIds(null!==(s=null==l?void 0:l.upcs)&&void 0!==s?s:[]),l.upcs=d),R.length>0&&(this.validateIds(null!==(o=null==l?void 0:l.grouping)&&void 0!==o?o:[]),l.grouping=R),h.length>0&&(this.validateIds(null!==(E=null==l?void 0:l.ids)&&void 0!==E?E:[]),l.ids=h),this.validateIds(null!==(I=null!==(a=null!==(n=null==l?void 0:l.upcs)&&void 0!==n?n:null==l?void 0:l.grouping)&&void 0!==a?a:null==l?void 0:l.ids)&&void 0!==I?I:[]),this.locationServiceHelper.validateAndNormalizeLocation(l.loc),l}validateAndNormalizeSearchParams(t){const e=[],r={...t};return this.validateOrderBy(r.orderBy,e),this.validateOrderDirection(r.orderDirection,e),this.validateFilters(r.filters,e),this.validatePagination(r.page,r.perPage,e),this.locationServiceHelper.validateAndNormalizeLocation(r.loc),e.length>0?{...r,error:e.join(". ")}:r}validateIds(t){if(!t.every((t=>"string"==typeof t&&t.trim().length>0)))throw new Error("All product identifiers must be non-empty strings")}validateIdsExist(t){return!Array.isArray(t)||0===t.length}validateOrderBy(t,e){t&&!Object.values(exports.ENUM_ORDER_BY).includes(t)&&e.push(`Invalid orderBy value: ${t}`)}validateOrderDirection(t,e){t&&!Object.values(exports.ENUM_NAVIGATION_ORDER_DIRECTION_TYPE).includes(t)&&e.push(`Invalid orderDirection value: ${t}`)}validateFilters(t,e){t&&(t.length>10&&e.push("Maximum of 10 filters allowed"),t.forEach((t=>{switch(Object.values(exports.ENUM_FILTER_KEYS).includes(t.key)||e.push(`Invalid filter key: ${t.key}`),t.key){case exports.ENUM_FILTER_KEYS.AVAILABILITY:this.validateAvailabilityFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.FULFILLMENT:this.validateFulfillmentFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.ENGRAVING:this.validateEngravingFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.CATEGORIES:this.validateCategoriesFilter(t.values,e);break;case exports.ENUM_FILTER_KEYS.BRANDS:this.validateArrayFilter(t.values,75,"brands",e);break;case exports.ENUM_FILTER_KEYS.FLAVOR:this.validateArrayFilter(t.values,25,"flavor",e);break;case exports.ENUM_FILTER_KEYS.REGION:this.validateArrayFilter(t.values,25,"region",e);break;case exports.ENUM_FILTER_KEYS.VARIETY:this.validateArrayFilter(t.values,25,"variety",e);break;case exports.ENUM_FILTER_KEYS.SIZES:this.validateArrayFilter(t.values,25,"sizes",e);break;case exports.ENUM_FILTER_KEYS.APPELLATION:this.validateArrayFilter(t.values,25,"appellation",e);break;case exports.ENUM_FILTER_KEYS.COUNTRY:this.validateArrayFilter(t.values,25,"country",e);break;case exports.ENUM_FILTER_KEYS.VINTAGE:this.validateArrayFilter(t.values,25,"vintage",e);break;case exports.ENUM_FILTER_KEYS.MATERIALS:this.validateArrayFilter(t.values,25,"materials",e);break;case exports.ENUM_FILTER_KEYS.COLORS:this.validateArrayFilter(t.values,25,"colors",e);break;case exports.ENUM_FILTER_KEYS.TAGS:this.validateArrayFilter(t.values,25,"tags",e)}})))}validateAvailabilityFilter(t,e){Object.values(exports.ENUM_AVAILABILITY_VALUE).includes(t)||e.push(`Invalid availability value: ${t}`)}validateFulfillmentFilter(t,e){if(!Array.isArray(t))return void e.push("Fulfillment filter must be an array");const r=Object.values(exports.ENUM_MODALITIES);t.forEach((t=>{r.includes(t)||e.push(`Invalid fulfillment value: ${t}`)}))}validateEngravingFilter(t,e){Object.values(exports.ENUM_ENGRAVING).includes(t)||e.push(`Invalid availability value: ${t}`)}validateArrayFilter(t,e,r,i){Array.isArray(t)?t.length>e&&i.push(`${r} filter can have a maximum of ${e} values`):i.push(`${r} filter must be an array`)}validateCategoriesFilter(t,e){Array.isArray(t)?t.every((t=>this.taxonomyValues.has(t)))||e.push("Invalid category value(s) in categories filter"):e.push("Categories filter must be an array")}validatePagination(t,e,r){void 0!==t&&("number"!=typeof t||t<0)&&r.push("Page must be a non-negative number"),void 0!==e&&("number"!=typeof e||e<=0)&&r.push("PerPage must be a positive number")}}class y{constructor(t){this.locationHelperService=t}validateAndNormalizePrepareParams(t){var e,r,i,s,o,E,n,a,I,l,d,R,h,N,u,c,T,A,O,S,p,W,v,D,C;let y={...t};if(!(null==y?void 0:y.cartId)||"string"!=typeof(null==y?void 0:y.cartId))throw new Error("Invalid cartId");return this.validateCustomer(y.customer),this.validateCustomer(y.recipient),(null==y?void 0:y.billingAddress)&&this.validateBillingAddress(y.billingAddress),y.hasAgeVerify=Boolean(null!==(o=null!==(i=null!==(e=null==y?void 0:y.hasAgeVerify)&&void 0!==e?e:null===(r=null==y?void 0:y.customer)||void 0===r?void 0:r.hasAgeVerify)&&void 0!==i?i:null===(s=null==y?void 0:y.recipient)||void 0===s?void 0:s.hasAgeVerify)&&void 0!==o&&o),y.hasSubstitutionPolicy=Boolean(null==y?void 0:y.hasSubstitutionPolicy),y.acceptedAccountCreation=Boolean(null==y?void 0:y.acceptedAccountCreation),y.isGift=Boolean(null==y?void 0:y.isGift),y.billingSameAsShipping=Boolean(null==y?void 0:y.billingSameAsShipping),y&&(null==y?void 0:y.billingAddress)&&""!==(null===(E=null==y?void 0:y.billingAddress)||void 0===E?void 0:E.phone)&&(y={...y,billingAddress:{...null!==(n=null==y?void 0:y.billingAddress)&&void 0!==n?n:{},phone:null!==(I=this.formatPhoneNumber(null===(a=y.billingAddress)||void 0===a?void 0:a.phone))&&void 0!==I?I:""}}),y&&(null==y?void 0:y.customer)&&""!==(null===(l=null==y?void 0:y.customer)||void 0===l?void 0:l.phone)&&(y={...y,customer:{...null!==(d=null==y?void 0:y.customer)&&void 0!==d?d:{},phone:null!==(h=this.formatPhoneNumber(null===(R=null==y?void 0:y.customer)||void 0===R?void 0:R.phone))&&void 0!==h?h:""}}),y&&(null==y?void 0:y.recipient)&&""!==(null===(N=null==y?void 0:y.recipient)||void 0===N?void 0:N.phone)&&(y={...y,customer:{...null!==(u=null==y?void 0:y.recipient)&&void 0!==u?u:{},phone:null!==(T=this.formatPhoneNumber(null===(c=null==y?void 0:y.recipient)||void 0===c?void 0:c.phone))&&void 0!==T?T:""}}),(null==y?void 0:y.isGift)&&(this.validateGiftOptions(y.giftOptions),y&&(null==y?void 0:y.giftOptions)&&""!==(null===(O=null===(A=null==y?void 0:y.giftOptions)||void 0===A?void 0:A.recipient)||void 0===O?void 0:O.phone)&&(y={...y,giftOptions:{...null!==(S=null==y?void 0:y.giftOptions)&&void 0!==S?S:{},recipient:{...null!==(W=null===(p=null==y?void 0:y.giftOptions)||void 0===p?void 0:p.recipient)&&void 0!==W?W:{},phone:null!==(C=this.formatPhoneNumber(null===(D=null===(v=y.giftOptions)||void 0===v?void 0:v.recipient)||void 0===D?void 0:D.phone))&&void 0!==C?C:""}}})),this.validateMarketingPreferences(y.marketingPreferences),(null==y?void 0:y.deliveryTips)&&this.validateDeliveryTips(y.deliveryTips),(null==y?void 0:y.refresh)&&(y.refresh=Boolean(y.refresh)),y}validateAndNormalizeCompleteParams(t){const e={...t};if(!e.token||"string"!=typeof(null==e?void 0:e.token))throw new Error("Invalid token");if(!(null==e?void 0:e.payment)||"string"!=typeof(null==e?void 0:e.payment))throw new Error("Invalid payment token");return void 0!==e.refresh&&(e.refresh=Boolean(e.refresh)),e}validateCustomer(t){if(t&&"object"==typeof t){const{firstName:e,lastName:r,phone:i,email:s}=t;if(e&&"string"!=typeof e)throw new Error("Invalid customer first name");if(r&&"string"!=typeof r)throw new Error("Invalid customer last name");if(i&&"string"!=typeof i)throw new Error("Invalid customer phone");if(s&&"string"!=typeof s)throw new Error("Invalid customer email");"hasAgeVerify"in t&&(t.hasAgeVerify=Boolean(t.hasAgeVerify))}}validateBillingAddress(t){if(!t)return{};if("object"!=typeof t||null===t)throw new Error("Invalid address: must be an object if provided");const e={...t};return["one","two","city","state","zip","country","firstName","lastName","email","phone","company"].forEach((t=>{if(t in e&&"string"!=typeof e[t])throw new Error(`Invalid billing address ${t}: must be a string if provided`)})),"state"in e&&e.state&&(e.state=this.locationHelperService.normalizeState(e.state)),e}validateGiftOptions(t){if(void 0!==t&&"object"!=typeof t)throw new Error("Invalid giftOptions: must be an object if provided");if(t){if("message"in t&&"string"!=typeof t.message)throw new Error("Invalid gift message: must be a string if provided");if("recipient"in t){if("object"!=typeof t.recipient)throw new Error("Invalid gift recipient: must be an object if provided");const{name:e,phone:r,email:i}=t.recipient;if("name"in t.recipient&&"string"!=typeof e)throw new Error("Invalid gift recipient name: must be a string if provided");if("phone"in t.recipient&&"string"!=typeof r)throw new Error("Invalid gift recipient phone: must be a string if provided");if("email"in t.recipient&&"string"!=typeof i)throw new Error("Invalid gift recipient email: must be a string if provided")}}}formatPhoneNumber(t){if(!t)return null;const e=t.replace(/[\s().\-_]/g,"").replace(/[^\d+]/g,"");if(e.startsWith("+1")){const t=e.substring(2);if(10===t.length)return`(${t.substring(0,3)}) ${t.substring(3,6)}-${t.substring(6)}`}if(11===e.length&&e.startsWith("1")){const t=e.substring(1);return`(${t.substring(0,3)}) ${t.substring(3,6)}-${t.substring(6)}`}return 10===e.length?`(${e.substring(0,3)}) ${e.substring(3,6)}-${e.substring(6)}`:e.startsWith("+")?e:t}validateMarketingPreferences(t){if(void 0!==t&&"object"!=typeof t)throw new Error("Invalid marketingPreferences: must be an object if provided");t&&("canEmail"in t&&(t.canEmail=Boolean(t.canEmail)),"canSms"in t&&(t.canSms=Boolean(t.canSms)))}validateDeliveryTips(t){if(!Array.isArray(t))throw new Error("Invalid deliveryTips");t.forEach((t=>{if(!t.fulfillmentId||"string"!=typeof t.fulfillmentId)throw new Error("Invalid fulfillmentId in deliveryTip");if("number"!=typeof t.tip||t.tip<0)throw new Error("Invalid tip amount in deliveryTip")}))}}class m{validateAndNormalizeLocation(t){if(!t)return;if("object"!=typeof t)throw new Error("Location must be a valid object");const{coords:e,address:r}=t;e?this.validateCoordinates(e):r&&this.validateAndNormalizeAddress(r)}validateCoordinates(t){if("number"!=typeof t.lat||"number"!=typeof t.long)throw new Error("Coordinates must be valid numbers");if(t.lat<-90||t.lat>90||t.long<-180||t.long>180)throw new Error("Coordinates are out of valid range")}validateAndNormalizeAddress(t){if(!(null==t?void 0:t.state)||"string"!=typeof(null==t?void 0:t.state))throw new Error("State is required and must be a string");if(t.state=this.normalizeState(t.state),!t.city||"string"!=typeof t.city)throw new Error("City is required and must be a string");if(!t.zip||"string"!=typeof t.zip)throw new Error("ZIP code is required and must be a string")}normalizeState(t){const e=t.toUpperCase();if(exports.STATES_CODE[e])return exports.STATES_CODE[e];const r=t.toUpperCase();if(exports.STATES_NAME[r])return exports.STATES_NAME[r];throw new Error(`Invalid state: ${t}`)}}class w{constructor(t){this.client=t,this.stripe=null,this.elements=null,this.paymentElement=null,this.events=["ready","change","loaderror","loaderstart"],this.eventsErrorMsg="The only Payment Element events allowed (change, ready, loaderstart, loadererror)",this.clientSecret=null}async mount(t){if(!document.getElementById(t.elementId))throw new Error(`Element with id "${t.elementId}" not found`);try{this.stripe=await p.loadStripe(t.key)}catch(t){throw new Error("Failed to initialize Stripe")}if(!this.stripe)throw new Error("Failed to initialize Stripe");this.clientSecret=t.clientSecret;try{const{setupIntent:t}=await this.stripe.retrieveSetupIntent(this.clientSecret);if("succeeded"===(null==t?void 0:t.status))throw new Error(`The client secret (${this.clientSecret}) has already been used previously. Generate a new one through a use session.`)}catch(t){throw t}const e={clientSecret:t.clientSecret,appearance:this.mapAppearance(t.appearance),paymentMethodCreation:"manual"};this.elements=this.stripe.elements(e);const r=this.mapElementOptions(t.elementOptions);this.paymentElement=this.elements.create("payment",r),this.paymentElement.mount(`#${t.elementId}`)}async generateToken(){var t,e,r,i,s,o,E,n,a,I;if(!this.stripe||!this.elements||!this.clientSecret)return{type:"client_error",message:"Payment form has not been initialized"};const{error:l}=await this.elements.submit();if(l)return{type:"validation_error",message:l.message,code:l.code};const{error:d,paymentMethod:R}=await this.stripe.createPaymentMethod({elements:this.elements});if(d)return{type:"validation_error"===d.type?"validation_error":"api_error",message:d.message,code:d.code,param:d.param};const{setupIntent:h}=await this.stripe.retrieveSetupIntent(this.clientSecret);if(!h)return{type:"confirm_error",message:"There's been an error during your session confirmation",code:"7190"};const{data:N}=await this.confirmSession({paymentMethodId:null!==(t=null==R?void 0:R.id)&&void 0!==t?t:"",sessionSecret:null!==(e=null==h?void 0:h.id)&&void 0!==e?e:""});return N?R?{id:R.id,type:R.type,card:(null==R?void 0:R.card)?{brand:null!==(i=null===(r=R.card)||void 0===r?void 0:r.brand)&&void 0!==i?i:"",country:null!==(s=R.card.country)&&void 0!==s?s:"",expMonth:null!==(o=R.card.exp_month)&&void 0!==o?o:0,expYear:null!==(E=R.card.exp_year)&&void 0!==E?E:0,last4:null!==(n=R.card.last4)&&void 0!==n?n:"",funding:null!==(a=R.card.funding)&&void 0!==a?a:""}:void 0,created:null!==(I=null==R?void 0:R.created)&&void 0!==I?I:0}:{type:"client_error",message:"Failed to generate payment token"}:{type:"confirm_error",message:"There's been an error during your session confirmation",code:"7191"}}async confirmSession({sessionSecret:t,paymentMethodId:e}){try{if(!t||!e)throw new Error("customerId, sessionSecret, paymentMethodId are required");return await this.client.post("/users/payments/confirm",{sessionSecret:t,paymentMethodId:e})}catch(t){throw t}}subscribe(t,e){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");if(!this.events.includes(t))throw new Error(this.eventsErrorMsg);this.paymentElement.on(t,e)}unsubscribe(t,e){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");if(!this.events.includes(t))throw new Error(this.eventsErrorMsg);this.paymentElement.off(t,e)}mapAppearance(t){if(t)return{theme:"night"===t.theme?"night":"stripe"}}mapElementOptions(t){return{layout:null==t?void 0:t.layout,wallets:{applePay:"auto",googlePay:"auto"}}}unmount(){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");this.paymentElement.unmount()}collapse(){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");this.paymentElement.collapse()}destroy(){if(!this.paymentElement)throw new Error("Payment Element has not been initialized");this.paymentElement.destroy()}}class L{constructor(t){this.client=t}async autocomplete(t,e){try{return await this.client.post("/address/autocomplete",{...t,key:e})}catch(t){throw t}}async details(t,e){try{return await this.client.post("/address/details",{...t,key:e})}catch(t){throw t}}}class H{constructor(t,e){this.client=t,this.catalogHelperService=e,this.servicePath="/catalog/"}async availability(t){try{const e=this.catalogHelperService.validateAndNormalizeParams(t);return await this.client.post(`${this.servicePath}availability`,e)}catch(t){throw t}}async search(t){try{const e=this.catalogHelperService.validateAndNormalizeSearchParams(t);if(null==e?void 0:e.error)throw new Error(null==e?void 0:e.error);return await this.client.post(`${this.servicePath}search`,e)}catch(t){throw t}}}class f{constructor(t,e){this.client=t,this.checkoutHelperService=e,this.servicePath="/checkout"}async prepare(t){try{const e=this.checkoutHelperService.validateAndNormalizePrepareParams(t);return await this.client.post(`${this.servicePath}/prepare`,e)}catch(t){throw t}}async complete(t){try{const e=this.checkoutHelperService.validateAndNormalizeCompleteParams(t);return await this.client.post(`${this.servicePath}/complete`,e)}catch(t){throw t}}}class P{constructor(t){this.paymentProvider=t,this.collapse=()=>this.paymentProvider.collapse(),this.unmount=()=>this.paymentProvider.unmount(),this.destroy=()=>this.paymentProvider.destroy()}async mount(t){try{await this.paymentProvider.mount(t)}catch(t){throw t}}async generateToken(){return this.paymentProvider.generateToken()}subscribe(t,e){this.paymentProvider.subscribe(t,e)}unsubscribe(t,e){this.paymentProvider.unsubscribe(t,e)}}class g{constructor(t){this.client=t,this.servicePath="/users"}async createOrUpdateSession(t){try{if(!(null==t?void 0:t.id)&&!(null==t?void 0:t.email))throw new Error("Either id or email must be provided");return await this.client.post(`${this.servicePath}/session`,t)}catch(t){throw t}}async fetchUser(t){try{if(!t)throw new Error("Id is required");return await this.client.get(`${this.servicePath}/fetch/${t}`)}catch(t){throw t}}async purge(t){try{if(!t)throw new Error("User identifier (ID or email) must be provided");return await this.client.delete(`${this.servicePath}/purge/${t}`)}catch(t){throw t}}async addAddress(t){try{return this.validateAddressParams(t),await this.client.post(`${this.servicePath}/addresses/add`,t)}catch(t){throw t}}async updateAddress(t){try{const e=this.validateAddressParams(t);return await this.client.post(`${this.servicePath}/addresses/update`,e)}catch(t){throw t}}validateAddressParams(t){const e=this.hasUser(t),r=this.hasUserAddressObj(t),i=this.hasUserAddressCoords(t),s=this.hasUserAddressPlacesId(t);if(e)throw new Error("Missing required parameter customerId for address update.");if(r&&i&&s)throw new Error("Missing required parameters for address update, you need at least, an address object or lat and long, or a google placesId");return i||(t.lat=Number(null==t?void 0:t.lat),t.long=Number(null==t?void 0:t.long)),t}hasUser(t){return!(null==t?void 0:t.customerId)||"string"!=typeof(null==t?void 0:t.customerId)}hasUserAddressObj(t){return!((null==t?void 0:t.one)&&"string"==typeof(null==t?void 0:t.one)&&(null==t?void 0:t.city)&&"string"==typeof(null==t?void 0:t.city)&&(null==t?void 0:t.state)&&"string"==typeof(null==t?void 0:t.state)&&(null==t?void 0:t.zip)&&"string"==typeof(null==t?void 0:t.zip)&&(null==t?void 0:t.type)&&"string"==typeof(null==t?void 0:t.type))}hasUserAddressCoords(t){return!(null==t?void 0:t.lat)&&!(null==t?void 0:t.long)||"number"!=typeof Number(null==t?void 0:t.lat)&&"number"!=typeof Number(null==t?void 0:t.long)}hasUserAddressPlacesId(t){return!(null==t?void 0:t.placesId)||"string"!=typeof(null==t?void 0:t.placesId)}async purgeAddress(t){try{if(!t)throw new Error("Address ID must be provided");return await this.client.delete(`${this.servicePath}/addresses/purge/${t}`)}catch(t){throw t}}async addPayment(t){try{if(!t.customerId||!t.paymentMethodId)throw new Error("Missing required parameters to add payment");return void 0===(null==t?void 0:t.isDefault)&&(null==t||delete t.isDefault),await this.client.post(`${this.servicePath}/payments/add`,t)}catch(t){throw t}}async updatePayment(t){try{if(!t.customerId||!t.paymentMethodId||void 0===(null==t?void 0:t.isDefault)||"boolean"!=typeof(null==t?void 0:t.isDefault))throw new Error("Missing required parameters to add payment");return await this.client.post(`${this.servicePath}/payments/update`,t)}catch(t){throw t}}async purgePayment(t,e){try{if(!t||!e)throw new Error("Missing required parameters for payment purge");return await this.client.delete(`${this.servicePath}/payments/purge/${t}/${e}`)}catch(t){throw t}}}class b{constructor(t,e){this.client=t,this.cartHelperService=e,this.servicePath="/cart/update"}async get(t,e){try{let r=this.cartHelperService.validateId(t);if(r=""!==r&&r,r){const t={id:r};return"boolean"==typeof e&&(t.refresh=e),await this.client.post(this.servicePath,t)}return await this.client.post(this.servicePath)}catch(t){throw t}}async update(t){try{const e=this.cartHelperService.validateAndNormalizeParams(t);return await this.client.post(this.servicePath,e)}catch(t){throw t}}}class U{constructor(){this.services=new Map,this.liquidCommerceClientConstructor=null}static getInstance(){return U.instance||(U.instance=new U),U.instance}setLiquidCommerceClientConstructor(t){this.liquidCommerceClientConstructor=t}async getClient(t,e){const r=`LiquidCommerceClient_${t}_${JSON.stringify(e)}`;if(!this.services.has(r)){if(!this.liquidCommerceClientConstructor)throw new Error("LiquidCommerceClient constructor not set");const i=new this.liquidCommerceClientConstructor(t,e);await i.init(),this.services.set(r,i)}return this.services.get(r)}getOrCreateService(t,e,...r){if(!this.services.has(t)){const i="getInstance"in e?e.getInstance(...r):new e(...r);this.services.set(t,i)}return this.services.get(t)}getAuthenticatedClient(t){return this.getOrCreateService(`AuthenticatedClient_${JSON.stringify(t)}`,v,t)}getLocationHelperService(){return this.getOrCreateService("LocationHelperService",m)}getAddressService(t){return this.getOrCreateService(`AddressService_${t.getUniqueKey()}`,L,t)}getCatalogHelperService(){return this.getOrCreateService("CatalogHelperService",C,this.getLocationHelperService())}getCatalogService(t){return this.getOrCreateService(`CatalogService_${t.getUniqueKey()}`,H,t,this.getCatalogHelperService())}getCartHelperService(){return this.getOrCreateService("CartHelperService",D,this.getLocationHelperService())}getCartService(t){return this.getOrCreateService(`CartService_${t.getUniqueKey()}`,b,t,this.getCartHelperService())}getUserService(t){return this.getOrCreateService(`UserService_${t.getUniqueKey()}`,g,t)}getPaymentProviderService(t){return this.getOrCreateService(`PaymentProviderService_${t.getUniqueKey()}`,w,t)}getPaymentService(t){return this.getOrCreateService(`PaymentService_${t.getUniqueKey()}`,P,this.getPaymentProviderService(t))}getCheckoutHelperService(){return this.getOrCreateService("CheckoutHelperService",y,this.getLocationHelperService())}getCheckoutService(t){return this.getOrCreateService(`CheckoutService_${t.getUniqueKey()}`,f,t,this.getCheckoutHelperService())}}U.instance=null;class M{constructor(t,e){this.address={autocomplete:async t=>(await this.ensureAuthenticated(),this.addressService.autocomplete(t,this.config.googlePlacesApiKey)),details:async t=>(await this.ensureAuthenticated(),this.addressService.details(t,this.config.googlePlacesApiKey))},this.catalog={availability:async t=>(await this.ensureAuthenticated(),this.catalogService.availability(t)),search:async t=>(await this.ensureAuthenticated(),this.catalogService.search(t))},this.cart={get:async(t,e)=>(await this.ensureAuthenticated(),this.cartService.get(t,e)),update:async t=>(await this.ensureAuthenticated(),this.cartService.update(t))},this.user={session:async t=>(await this.ensureAuthenticated(),this.userService.createOrUpdateSession(t)),fetch:async t=>(await this.ensureAuthenticated(),this.userService.fetchUser(t)),purge:async t=>(await this.ensureAuthenticated(),this.userService.purge(t)),addAddress:async t=>(await this.ensureAuthenticated(),this.userService.addAddress(t)),updateAddress:async t=>(await this.ensureAuthenticated(),this.userService.updateAddress(t)),purgeAddress:async t=>(await this.ensureAuthenticated(),this.userService.purgeAddress(t)),addPayment:async t=>(await this.ensureAuthenticated(),this.userService.addPayment(t)),updatePayment:async t=>(await this.ensureAuthenticated(),this.userService.updatePayment(t)),purgePayment:async(t,e)=>(await this.ensureAuthenticated(),this.userService.purgePayment(t,e))},this.payment={mount:async t=>(await this.ensureAuthenticated(),this.paymentService.mount(t)),generateToken:async()=>(await this.ensureAuthenticated(),this.paymentService.generateToken()),subscribe:(t,e)=>{this.paymentService.subscribe(t,e)},unsubscribe:(t,e)=>{this.paymentService.unsubscribe(t,e)},collapse:()=>{this.paymentService.collapse()},unmount:()=>{this.paymentService.unmount()},destroy:()=>{this.paymentService.destroy()}},this.checkout={prepare:async t=>(await this.ensureAuthenticated(),this.checkoutService.prepare(t)),complete:async t=>(await this.ensureAuthenticated(),this.checkoutService.complete(t))},this.config=e,this.singletonManager=U.getInstance();const r=this.determineBaseURL(e);this.authenticatedClient=this.singletonManager.getAuthenticatedClient({apiKey:t,baseURL:r}),this.addressService=this.singletonManager.getAddressService(this.authenticatedClient),this.catalogService=this.singletonManager.getCatalogService(this.authenticatedClient),this.cartService=this.singletonManager.getCartService(this.authenticatedClient),this.userService=this.singletonManager.getUserService(this.authenticatedClient),this.paymentService=this.singletonManager.getPaymentService(this.authenticatedClient),this.checkoutService=this.singletonManager.getCheckoutService(this.authenticatedClient)}determineBaseURL(t){const e=t.env||exports.LIQUID_COMMERCE_ENV.STAGE;return W[e]}async init(){try{await this.authenticatedClient.authenticate()}catch(t){throw new Error("Authentication failed during initialization")}}async ensureAuthenticated(){this.authenticatedClient.isTokenExpired()&&await this.authenticatedClient.authenticate()}}exports.LiquidCommerce=async function(t,e){const r=U.getInstance();return r.setLiquidCommerceClientConstructor(M),await r.getClient(t,e)};
@@ -1,3 +1,11 @@
1
+ /**
2
+ * A dictionary object containing the default base URLs for different Liquid Commerce environments.
3
+ *
4
+ * The keys are environment constants defined in the `LIQUID_COMMERCE_ENV` object,
5
+ * such as `LOC`, `DEV`, `STAGE`, and `PROD`.
6
+ * The values are URLs read from the respective environment variables: `ENV_LOC`, `ENV_DEV`, `ENV_STAGE`, and `ENV_PROD`.
7
+ * If the environment variables are not set, the values default to an empty string.
8
+ */
1
9
  export declare const DEFAULT_BASE_URLS: {
2
10
  loc: string;
3
11
  dev: string;
@@ -1,4 +1,4 @@
1
- import type { ICartUpdateParams } from '../interfaces/cart.interface';
1
+ import type { ICartUpdateParams } from '../interfaces';
2
2
  import type { LocationHelperService } from './location-helper.service';
3
3
  /**
4
4
  * CartHelperService is a class that provides methods
@@ -1,5 +1,4 @@
1
- import type { ICatalogParams } from '../interfaces/catalog.service.interface';
2
- import type { IAvailabilityParams } from '../services/catalog.service';
1
+ import type { IAvailabilityParams, ICatalogParams } from '../interfaces';
3
2
  import type { LocationHelperService } from './location-helper.service';
4
3
  /**
5
4
  * The `CatalogHelperService` class provides utility methods for validating and normalizing
@@ -28,11 +27,15 @@ export declare class CatalogHelperService {
28
27
  /**
29
28
  * Validates an array of UPCs.
30
29
  *
31
- * @param {string[]} upcs - The array of UPCs to validate.
30
+ * @param {string[]} ids - The array of ids to validate.
32
31
  * @throws {Error} If upcs is not an array or is an empty array.
33
32
  * @throws {Error} If any UPC in the array is not a non-empty string.
34
33
  */
35
- private validateUPCs;
34
+ private validateIds;
35
+ /**
36
+ *
37
+ */
38
+ private validateIdsExist;
36
39
  /**
37
40
  * Validates the orderBy parameter and adds any validation errors to the errors array.
38
41
  *
@@ -68,6 +71,23 @@ export declare class CatalogHelperService {
68
71
  * @return {void}
69
72
  */
70
73
  private validateAvailabilityFilter;
74
+ /**
75
+ * Validates the provided fulfillment filter against the ENUM_MODALITIES.
76
+ * If the value does not match any value in ENUM_MODALITIES, an error message is appended to the errors array.
77
+ *
78
+ * @param {ENUM_MODALITIES[]} values - The value to be validated against the ENUM_MODALITIES.
79
+ * @param {string[]} errors - The array where error messages will be stored if the validation fails.
80
+ * @return {void} This method does not return a value.
81
+ */
82
+ private validateFulfillmentFilter;
83
+ /**
84
+ * Validates if the provided engraving filter value is one of the allowed enums.
85
+ *
86
+ * @param value The engraving filter value to be validated.
87
+ * @param errors An array that collects error messages encountered during validation.
88
+ * @return void
89
+ */
90
+ private validateEngravingFilter;
71
91
  /**
72
92
  * Validates the given array filter.
73
93
  *
@@ -1,4 +1,4 @@
1
- import type { ICheckoutCompleteParams, ICheckoutPrepareParams } from '../interfaces/checkout.interface';
1
+ import type { ICheckoutCompleteParams, ICheckoutPrepareParams } from '../interfaces';
2
2
  import type { LocationHelperService } from './location-helper.service';
3
3
  /**
4
4
  * CheckoutHelperService is a helper class that provides methods
@@ -29,20 +29,26 @@ export declare class CheckoutHelperService {
29
29
  */
30
30
  validateAndNormalizeCompleteParams(params: ICheckoutCompleteParams): ICheckoutCompleteParams;
31
31
  /**
32
- * Validates the recipient object.
32
+ * Validates the recipient or customer information for a checkout.
33
33
  *
34
- * @param {ICheckoutPrepareParams['recipient']} recipient - The recipient object to be validated.
35
- * @throws {Error} If the recipient object is invalid.
36
- * @returns {void}
34
+ * @param customer - The recipient or customer information to validate.
35
+ * Can be an object of type ICheckoutRecipient or ICheckoutCustomer,
36
+ * or a string (presumably a customer ID).
37
+ *
38
+ * @throws {Error} Throws an error if any of the customer's information (firstName, lastName, phone, email) is present but not a string.
39
+ *
40
+ * @remarks
41
+ * If the customer is an object, it validates the firstName, lastName, phone, and email properties.
42
+ * If hasAgeVerify is present, it converts it to a boolean value.
37
43
  */
38
- private validateRecipient;
44
+ private validateCustomer;
39
45
  /**
40
46
  * Validates the given address object.
41
- * @param {IAddress} address - The address object to validate.
47
+ * @param {ICheckoutBillingAddress} address - The address object to validate.
42
48
  * @throws {Error} If the address is invalid or any required field is missing or not a string.
43
49
  * @returns {void}
44
50
  */
45
- private validateAddress;
51
+ private validateBillingAddress;
46
52
  /**
47
53
  * Validates the giftOptions parameter.
48
54
  *
@@ -55,6 +61,15 @@ export declare class CheckoutHelperService {
55
61
  * @returns {void}
56
62
  */
57
63
  private validateGiftOptions;
64
+ /**
65
+ * Formats a given phone number into a standard (XXX) XXX-XXXX format for US numbers.
66
+ * Keeps the original format for international numbers starting with a + sign.
67
+ *
68
+ * @param {string|null|undefined} value - The phone number to format. Can be a string, null, or undefined.
69
+ * @return {string|null} The formatted phone number in (XXX) XXX-XXXX format, the original international
70
+ * format, or null if input is null or undefined.
71
+ */
72
+ private formatPhoneNumber;
58
73
  /**
59
74
  * Validates the given marketing preferences.
60
75
  *
@@ -1,4 +1,5 @@
1
- import type { ILoc } from '../interfaces/address.interface';
1
+ import { STATES_CODE, STATES_NAME } from '../enums';
2
+ import type { ILoc } from '../interfaces';
2
3
  /**
3
4
  * The LocationHelperService class provides methods to validate and normalize location objects.
4
5
  */
@@ -9,7 +10,7 @@ export declare class LocationHelperService {
9
10
  * @throws {Error} - If the loc argument is not a valid object or if
10
11
  * it doesn't contain either coords or address.
11
12
  */
12
- validateAndNormalizeLocation(loc: ILoc): void;
13
+ validateAndNormalizeLocation(loc?: ILoc): void;
13
14
  /**
14
15
  * Validates coordinates to ensure they are within valid range.
15
16
  *
@@ -43,5 +44,5 @@ export declare class LocationHelperService {
43
44
  *
44
45
  * @throws {Error} - If the state value is invalid.
45
46
  */
46
- private normalizeState;
47
+ normalizeState(state: STATES_CODE | STATES_NAME): string;
47
48
  }
@@ -1,15 +1,19 @@
1
- import type { ILiquidPaymentConfig, ILiquidPaymentError, ILiquidPaymentToken, IPaymentElementEventMap, IPaymentProvider } from '../interfaces/payment.interface';
1
+ import type { IConfirmSessionParams, ILiquidPaymentConfig, ILiquidPaymentError, ILiquidPaymentToken, IPaymentElementEventMap, IPaymentProvider } from '../interfaces';
2
+ import type { IApiResponseWithData } from '../types';
3
+ import type { AuthenticatedService } from './authenticated.service';
2
4
  /**
3
5
  * Represents a service for handling payment processing using the Stripe API.
4
6
  * Implements the IPaymentProvider interface.
5
7
  */
6
8
  export declare class PaymentProviderService implements IPaymentProvider {
9
+ private client;
7
10
  private stripe;
8
11
  private elements;
9
12
  private paymentElement;
10
13
  private readonly events;
11
14
  private readonly eventsErrorMsg;
12
15
  private clientSecret;
16
+ constructor(client: AuthenticatedService);
13
17
  /**
14
18
  * Mounts the Stripe payment element to the specified container element on the page.
15
19
  *
@@ -67,6 +71,17 @@ export declare class PaymentProviderService implements IPaymentProvider {
67
71
  * - param (string): The error parameter (if applicable).
68
72
  */
69
73
  generateToken(): Promise<ILiquidPaymentToken | ILiquidPaymentError>;
74
+ /**
75
+ * Confirms the user session by providing session secret and payment method ID.
76
+ *
77
+ * @param {Object} params - The parameters required for confirming the session.
78
+ * @param {string} params.sessionSecret - The secret key associated with the session.
79
+ * @param {string} params.paymentMethodId - The ID of the payment method used in the session.
80
+ * @return {Promise<IApiResponseWithData<boolean>>} - Returns a promise that resolves to the API response with data indicating the confirmation status.
81
+ */
82
+ confirmSession({ sessionSecret, paymentMethodId, }: IConfirmSessionParams): Promise<IApiResponseWithData<{
83
+ data: boolean;
84
+ }>>;
70
85
  /**
71
86
  * Subscribes to a specific event on the payment element.
72
87
  *
@@ -1,10 +1,6 @@
1
- import type { ILiquidCommerceClient, ILiquidCommerceClientConstructor } from '../interfaces/liquid-commerce-client.interface';
2
- import { AddressService } from '../services/address.service';
1
+ import type { ILiquidCommerceClientConstructor } from '../interfaces';
2
+ import { AddressService, CatalogService, CheckoutService, PaymentService, UserService } from '../services';
3
3
  import { CartService } from '../services/cart.service';
4
- import { CatalogService } from '../services/catalog.service';
5
- import { CheckoutService } from '../services/checkout.service';
6
- import { PaymentService } from '../services/payment.service';
7
- import { UserService } from '../services/user.service';
8
4
  import type { ILiquidCommerceConfig } from '../types';
9
5
  import { AuthenticatedService } from './authenticated.service';
10
6
  import { CartHelperService } from './cart-helper.service';
@@ -37,7 +33,7 @@ export declare class SingletonManager {
37
33
  * @returns {Promise<ILiquidCommerceClient>} - A promise that resolves to an instance of ILiquidCommerceClient.
38
34
  * @throws {Error} - If the LiquidCommerceClient constructor is not set.
39
35
  */
40
- getLiquidCommerceClient(apiKey: string, config: ILiquidCommerceConfig): Promise<ILiquidCommerceClient>;
36
+ getClient<T>(apiKey: string, config: ILiquidCommerceConfig): Promise<T>;
41
37
  /**
42
38
  * Returns an instance of a service based on the given key and ServiceClass.
43
39
  * If the service does not exist, it creates a new instance using the ServiceClass and optional arguments.
@@ -111,17 +107,20 @@ export declare class SingletonManager {
111
107
  getUserService(authenticatedClient: AuthenticatedService): UserService;
112
108
  /**
113
109
  * Returns the instance of the `PaymentProviderService` class.
114
- * This method uses the `getOrCreateService` method internally to obtain the instance.
110
+ * Now accepts AuthenticatedService as a parameter to properly initialize the service.
115
111
  *
112
+ * @param {AuthenticatedService} authenticatedClient - The authenticated client instance
116
113
  * @return {PaymentProviderService} The instance of the `PaymentProviderService` class.
117
114
  */
118
- getPaymentProviderService(): PaymentProviderService;
115
+ getPaymentProviderService(authenticatedClient: AuthenticatedService): PaymentProviderService;
119
116
  /**
120
117
  * Retrieves the payment service by calling the getOrCreateService method.
118
+ * Modified to accept and pass through the AuthenticatedService.
121
119
  *
120
+ * @param {AuthenticatedService} authenticatedClient - The authenticated client instance
122
121
  * @return {PaymentService} The payment service object.
123
122
  */
124
- getPaymentService(): PaymentService;
123
+ getPaymentService(authenticatedClient: AuthenticatedService): PaymentService;
125
124
  /**
126
125
  * Retrieves the CheckoutHelperService instance.
127
126
  *