wix-twix
Version:
A simple library for managing server and web Wix clients built on top of Wix SDK.
3 lines (2 loc) • 1.39 kB
JavaScript
;Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("@wix/business-tools"),l=require("../wixServerClient.js"),i=require("./wixBusinessLocation.js");class u extends l.WixServerClient{constructor(){super({locations:e.locations,siteProperties:e.siteProperties})}async getLocationById(o){const t=await this.client.locations.getLocation(o);return new i.WixBusinessLocation(this.client,t)}async getLocations(){const{locations:o}=await this.client.locations.listLocations();return o.map(t=>new i.WixBusinessLocation(this.client,t))}async getDefaultLocation(){const t=(await this.client.locations.queryLocations().eq("default",!0).find()).items[0];if(!t)throw new Error("No default location found");return new i.WixBusinessLocation(this.client,t)}get onLocationUpdate(){return this.client.locations.onLocationCreated}get onLocationCreate(){return this.client.locations.onLocationCreated}get onLocationArchive(){return this.client.locations.onLocationArchiveStatus}get onLocationSetDefault(){return this.client.locations.onLocationSetDefaultLocation}async createLocation({name:o,description:t,email:n,phone:s,fax:c,timeZone:a}){const r=await this.client.locations.createLocation({name:o,description:t,email:n,phone:s,fax:c,timeZone:a,address:{}});return new i.WixBusinessLocation(this.client,r)}}exports.WixBusiness=u;
//# sourceMappingURL=wixBusiness.js.map