order3000 1.10.0 → 1.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.cjs +112 -4
- package/dist/client.d.cts +61 -3500
- package/dist/client.d.mts +61 -3500
- package/dist/client.mjs +112 -4
- package/dist/index-bbg7Ev_r.d.cts +3858 -0
- package/dist/index-bbg7Ev_r.d.mts +3858 -0
- package/dist/menu.cjs +35 -0
- package/dist/menu.d.cts +51 -0
- package/dist/menu.d.mts +51 -0
- package/dist/menu.mjs +30 -0
- package/dist/schemas.cjs +522 -1
- package/dist/schemas.d.cts +419 -1
- package/dist/schemas.d.mts +419 -1
- package/dist/schemas.mjs +522 -1
- package/package.json +13 -3
package/dist/client.cjs
CHANGED
|
@@ -627,6 +627,56 @@ class BasketsResource extends BaseResource {
|
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
629
|
|
|
630
|
+
class BeveragesResource extends BaseResource {
|
|
631
|
+
constructor(tokenManager, baseUrl) {
|
|
632
|
+
super(tokenManager, baseUrl, "/beverages");
|
|
633
|
+
}
|
|
634
|
+
/**
|
|
635
|
+
* Fetch a beverage by its `accessor` slug (localized name/description,
|
|
636
|
+
* price, assets with public URLs). Pair with `patch` for a safe
|
|
637
|
+
* read-modify-write rename that preserves untouched locales.
|
|
638
|
+
*/
|
|
639
|
+
async get(accessor) {
|
|
640
|
+
return this.request(
|
|
641
|
+
"GET",
|
|
642
|
+
`/${encodeURIComponent(accessor)}`
|
|
643
|
+
);
|
|
644
|
+
}
|
|
645
|
+
/**
|
|
646
|
+
* Edit a beverage by id. `editBeverage` replaces the fields it receives,
|
|
647
|
+
* so callers wanting a partial change should read the beverage with `get`
|
|
648
|
+
* first and merge. Returns the updated beverage row.
|
|
649
|
+
*/
|
|
650
|
+
async patch(beverageId, body) {
|
|
651
|
+
return this.request(
|
|
652
|
+
"PATCH",
|
|
653
|
+
`/${encodeURIComponent(beverageId)}`,
|
|
654
|
+
body
|
|
655
|
+
);
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Upload an asset image for a beverage. The SDK builds the multipart body
|
|
659
|
+
* internally — pass a Buffer/Uint8Array, the original filename, the MIME type,
|
|
660
|
+
* and optional discovery `tags` (e.g. `['lunch-menu']`). The asset is stored,
|
|
661
|
+
* tagged, and linked to the beverage via `beverage_assets`; returns the new
|
|
662
|
+
* asset and its public URL. The beverage is addressed by its accessor.
|
|
663
|
+
*/
|
|
664
|
+
async uploadAsset(idOrAccessor, file) {
|
|
665
|
+
const form = new FormData();
|
|
666
|
+
form.append(
|
|
667
|
+
"file",
|
|
668
|
+
new Blob([new Uint8Array(file.data)], { type: file.contentType }),
|
|
669
|
+
file.filename
|
|
670
|
+
);
|
|
671
|
+
if (file.tags?.length) form.append("tags", file.tags.join(","));
|
|
672
|
+
return this.requestMultipart(
|
|
673
|
+
"POST",
|
|
674
|
+
`/${encodeURIComponent(idOrAccessor)}/assets`,
|
|
675
|
+
form
|
|
676
|
+
);
|
|
677
|
+
}
|
|
678
|
+
}
|
|
679
|
+
|
|
630
680
|
class CalloutsResource extends BaseResource {
|
|
631
681
|
constructor(tokenManager, baseUrl) {
|
|
632
682
|
super(tokenManager, baseUrl, "/callouts");
|
|
@@ -668,6 +718,56 @@ class CalloutsResource extends BaseResource {
|
|
|
668
718
|
}
|
|
669
719
|
}
|
|
670
720
|
|
|
721
|
+
class DishesResource extends BaseResource {
|
|
722
|
+
constructor(tokenManager, baseUrl) {
|
|
723
|
+
super(tokenManager, baseUrl, "/dishes");
|
|
724
|
+
}
|
|
725
|
+
/**
|
|
726
|
+
* Fetch a dish by its `accessor` slug (localized name/description, dietary
|
|
727
|
+
* flags, price, assets with public URLs). Pair with `patch` for a safe
|
|
728
|
+
* read-modify-write rename that preserves untouched locales + flags.
|
|
729
|
+
*/
|
|
730
|
+
async get(accessor) {
|
|
731
|
+
return this.request(
|
|
732
|
+
"GET",
|
|
733
|
+
`/${encodeURIComponent(accessor)}`
|
|
734
|
+
);
|
|
735
|
+
}
|
|
736
|
+
/**
|
|
737
|
+
* Edit a dish by id. `editDish` replaces the fields it receives (localized
|
|
738
|
+
* `name` is required), so callers wanting a partial change should read the
|
|
739
|
+
* dish with `get` first and merge. Returns the updated dish row.
|
|
740
|
+
*/
|
|
741
|
+
async patch(dishId, body) {
|
|
742
|
+
return this.request(
|
|
743
|
+
"PATCH",
|
|
744
|
+
`/${encodeURIComponent(dishId)}`,
|
|
745
|
+
body
|
|
746
|
+
);
|
|
747
|
+
}
|
|
748
|
+
/**
|
|
749
|
+
* Upload an asset image for a dish. The SDK builds the multipart body
|
|
750
|
+
* internally — pass a Buffer/Uint8Array, the original filename, the MIME type,
|
|
751
|
+
* and optional discovery `tags` (e.g. `['lunch-menu']`). The asset is stored,
|
|
752
|
+
* tagged, and linked to the dish via `dish_assets`; returns the new asset and
|
|
753
|
+
* its public URL. The dish is addressed by its accessor.
|
|
754
|
+
*/
|
|
755
|
+
async uploadAsset(idOrAccessor, file) {
|
|
756
|
+
const form = new FormData();
|
|
757
|
+
form.append(
|
|
758
|
+
"file",
|
|
759
|
+
new Blob([new Uint8Array(file.data)], { type: file.contentType }),
|
|
760
|
+
file.filename
|
|
761
|
+
);
|
|
762
|
+
if (file.tags?.length) form.append("tags", file.tags.join(","));
|
|
763
|
+
return this.requestMultipart(
|
|
764
|
+
"POST",
|
|
765
|
+
`/${encodeURIComponent(idOrAccessor)}/assets`,
|
|
766
|
+
form
|
|
767
|
+
);
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
|
|
671
771
|
class EventsResource extends BaseResource {
|
|
672
772
|
constructor(tokenManager, baseUrl) {
|
|
673
773
|
super(tokenManager, baseUrl, "/events");
|
|
@@ -761,16 +861,20 @@ class EventsResource extends BaseResource {
|
|
|
761
861
|
return event.assets ?? [];
|
|
762
862
|
}
|
|
763
863
|
/**
|
|
764
|
-
* Per-start-slot
|
|
765
|
-
* `offered` honours the venue's
|
|
766
|
-
* `auto_steer`: only acceptable
|
|
767
|
-
* fully-booked start times.
|
|
864
|
+
* Per-start-slot availability for an event on a date, per booking channel.
|
|
865
|
+
* Reservation channel: each slot's `offered` honours the venue's
|
|
866
|
+
* reservation mode (`passive`: every slot; `auto_steer`: only acceptable
|
|
867
|
+
* slots), so a public widget can pre-exclude fully-booked start times.
|
|
868
|
+
* Order channel: the event's order-pickup grid gated by per-slot caps and
|
|
869
|
+
* the order booking window (no table occupancy); events without a
|
|
870
|
+
* dedicated order grid inherit the reservation grid.
|
|
768
871
|
*/
|
|
769
872
|
async getSlotAvailability(idOrAccessor, options) {
|
|
770
873
|
const params = new URLSearchParams();
|
|
771
874
|
params.set("reservationDate", options.reservationDate);
|
|
772
875
|
params.set("partySize", String(options.partySize));
|
|
773
876
|
if (options.areaId) params.set("areaId", options.areaId);
|
|
877
|
+
if (options.channel) params.set("channel", options.channel);
|
|
774
878
|
return this.request(
|
|
775
879
|
"GET",
|
|
776
880
|
`/${encodeURIComponent(idOrAccessor)}/slot-availability?${params.toString()}`
|
|
@@ -1624,7 +1728,9 @@ class O3KClient {
|
|
|
1624
1728
|
__publicField(this, "articles");
|
|
1625
1729
|
__publicField(this, "assets");
|
|
1626
1730
|
__publicField(this, "baskets");
|
|
1731
|
+
__publicField(this, "beverages");
|
|
1627
1732
|
__publicField(this, "callouts");
|
|
1733
|
+
__publicField(this, "dishes");
|
|
1628
1734
|
__publicField(this, "events");
|
|
1629
1735
|
__publicField(this, "menus");
|
|
1630
1736
|
__publicField(this, "orders");
|
|
@@ -1651,7 +1757,9 @@ class O3KClient {
|
|
|
1651
1757
|
this.articles = new ArticlesResource(this.tokenManager, this.baseUrl);
|
|
1652
1758
|
this.assets = new AssetsResource(this.tokenManager, this.baseUrl);
|
|
1653
1759
|
this.baskets = new BasketsResource(this.tokenManager, this.baseUrl);
|
|
1760
|
+
this.beverages = new BeveragesResource(this.tokenManager, this.baseUrl);
|
|
1654
1761
|
this.callouts = new CalloutsResource(this.tokenManager, this.baseUrl);
|
|
1762
|
+
this.dishes = new DishesResource(this.tokenManager, this.baseUrl);
|
|
1655
1763
|
this.events = new EventsResource(this.tokenManager, this.baseUrl);
|
|
1656
1764
|
this.menus = new MenusResource(this.tokenManager, this.baseUrl);
|
|
1657
1765
|
this.orders = new OrdersResource(this.tokenManager, this.baseUrl);
|