order3000 1.7.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.cjs CHANGED
@@ -237,6 +237,64 @@ class AdsResource extends BaseResource {
237
237
  body
238
238
  );
239
239
  }
240
+ /**
241
+ * Replace the ad's owner-chosen callout set in one shot — the highlights
242
+ * pushed to Google as CALLOUT assets. The set references the venue's callout
243
+ * pool by id; it is de-duplicated while preserving order, and an empty array
244
+ * clears callouts. Only ids belonging to the venue's pool survive. Call
245
+ * {@link get} first and resend the full set to preserve existing entries.
246
+ * Returns the cleaned, persisted ids.
247
+ */
248
+ async saveCallouts(adId, body) {
249
+ return this.request(
250
+ "PATCH",
251
+ `/${encodeURIComponent(adId)}/callouts`,
252
+ body
253
+ );
254
+ }
255
+ /**
256
+ * Replace the ad's owner-curated NEGATIVE keyword set (and the venue
257
+ * negatives toggled off for this ad) in one shot. An empty `negativeKeywords`
258
+ * array clears the set. Texts are trimmed + de-duplicated server-side; the
259
+ * set is pushed to a linked live campaign immediately. Call {@link get} first
260
+ * and resend the full set to preserve existing entries.
261
+ */
262
+ async saveNegativeKeywords(adId, body) {
263
+ return this.request(
264
+ "PATCH",
265
+ `/${encodeURIComponent(adId)}/negative-keywords`,
266
+ body
267
+ );
268
+ }
269
+ /**
270
+ * Replace the ad's owner-chosen website-page set in one shot — the pages
271
+ * pushed to Google as SITELINK assets. The set references the venue's
272
+ * website-page pool by id; it is de-duplicated while preserving order, and
273
+ * an empty array clears sitelinks. Only ids belonging to the venue's pool
274
+ * survive. Call {@link get} first and resend the full set to preserve
275
+ * existing entries. Returns the cleaned, persisted ids.
276
+ */
277
+ async saveWebsitePages(adId, body) {
278
+ return this.request(
279
+ "PATCH",
280
+ `/${encodeURIComponent(adId)}/website-pages`,
281
+ body
282
+ );
283
+ }
284
+ /**
285
+ * Persist the ad's order3000-side daily budget, in CENTS (the app-wide money
286
+ * unit). This writes `ads.dailyBudget` and pushes NOTHING to Google — it lets
287
+ * the owner set + refine a budget on a DRAFT ad before any campaign exists;
288
+ * `createCampaign` reads it as the default at launch (converting cents→micros
289
+ * at the Google boundary). Returns the updated ad row.
290
+ */
291
+ async setBudget(adId, body) {
292
+ return this.request(
293
+ "PATCH",
294
+ `/${encodeURIComponent(adId)}/budget`,
295
+ body
296
+ );
297
+ }
240
298
  /**
241
299
  * Write paste-ready Meta (Facebook/Instagram) ad copy + creative onto the
242
300
  * ad's `metaContent` document — the Meta analog of {@link patch} (which writes
@@ -531,6 +589,47 @@ class BasketsResource extends BaseResource {
531
589
  }
532
590
  }
533
591
 
592
+ class CalloutsResource extends BaseResource {
593
+ constructor(tokenManager, baseUrl) {
594
+ super(tokenManager, baseUrl, "/callouts");
595
+ }
596
+ /**
597
+ * List the venue's whole callout pool, ordered by `createdAt`.
598
+ */
599
+ async list() {
600
+ return this.request("GET", "");
601
+ }
602
+ /**
603
+ * Add a callout to the venue pool. `label` is the localized text (`{ de,
604
+ * en }`); each locale value ≤25 chars and at least one must be non-empty.
605
+ * Returns the created callout row.
606
+ */
607
+ async create(body) {
608
+ return this.request("POST", "", body);
609
+ }
610
+ /**
611
+ * Replace a pool callout's localized `label` (each locale value ≤25 chars;
612
+ * at least one non-empty). Returns the updated callout row.
613
+ */
614
+ async update(calloutId, body) {
615
+ return this.request(
616
+ "PATCH",
617
+ `/${encodeURIComponent(calloutId)}`,
618
+ body
619
+ );
620
+ }
621
+ /**
622
+ * Permanently remove a callout from the venue pool. Returns the deleted row.
623
+ * (Ads still referencing the id simply drop it on their next save.)
624
+ */
625
+ async delete(calloutId) {
626
+ return this.request(
627
+ "DELETE",
628
+ `/${encodeURIComponent(calloutId)}`
629
+ );
630
+ }
631
+ }
632
+
534
633
  class EventsResource extends BaseResource {
535
634
  constructor(tokenManager, baseUrl) {
536
635
  super(tokenManager, baseUrl, "/events");
@@ -623,6 +722,22 @@ class EventsResource extends BaseResource {
623
722
  });
624
723
  return event.assets ?? [];
625
724
  }
725
+ /**
726
+ * Per-start-slot occupancy availability for an event on a date. Each slot's
727
+ * `offered` honours the venue's reservation mode (`passive`: every slot;
728
+ * `auto_steer`: only acceptable slots), so a public widget can pre-exclude
729
+ * fully-booked start times.
730
+ */
731
+ async getSlotAvailability(idOrAccessor, options) {
732
+ const params = new URLSearchParams();
733
+ params.set("reservationDate", options.reservationDate);
734
+ params.set("partySize", String(options.partySize));
735
+ if (options.areaId) params.set("areaId", options.areaId);
736
+ return this.request(
737
+ "GET",
738
+ `/${encodeURIComponent(idOrAccessor)}/slot-availability?${params.toString()}`
739
+ );
740
+ }
626
741
  /**
627
742
  * Upload a asset image for an event. The SDK builds the multipart
628
743
  * body internally — pass a Buffer/Uint8Array, the original filename,
@@ -1099,6 +1214,48 @@ class VenuesResource {
1099
1214
  }
1100
1215
  }
1101
1216
 
1217
+ class WebsitePagesResource extends BaseResource {
1218
+ constructor(tokenManager, baseUrl) {
1219
+ super(tokenManager, baseUrl, "/website-pages");
1220
+ }
1221
+ /**
1222
+ * List the venue's whole website-page pool, ordered by `createdAt`.
1223
+ */
1224
+ async list() {
1225
+ return this.request("GET", "");
1226
+ }
1227
+ /**
1228
+ * Add a website page to the venue pool. `target` is the raw reference the
1229
+ * owner typed — an internal path (`/speisekarte`) or a full URL — classified
1230
+ * server-side against the venue website. `label` is the localized link text.
1231
+ * Returns the created page row.
1232
+ */
1233
+ async create(body) {
1234
+ return this.request("POST", "", body);
1235
+ }
1236
+ /**
1237
+ * Replace a pool page's `target` (re-classified into a path or external URL)
1238
+ * and/or localized `label`. Returns the updated page row.
1239
+ */
1240
+ async update(pageId, body) {
1241
+ return this.request(
1242
+ "PATCH",
1243
+ `/${encodeURIComponent(pageId)}`,
1244
+ body
1245
+ );
1246
+ }
1247
+ /**
1248
+ * Permanently remove a website page from the venue pool. Returns the deleted
1249
+ * row. (Ads still referencing the id simply drop it on their next save.)
1250
+ */
1251
+ async delete(pageId) {
1252
+ return this.request(
1253
+ "DELETE",
1254
+ `/${encodeURIComponent(pageId)}`
1255
+ );
1256
+ }
1257
+ }
1258
+
1102
1259
  var __defProp$2 = Object.defineProperty;
1103
1260
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1104
1261
  var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1429,6 +1586,7 @@ class O3KClient {
1429
1586
  __publicField(this, "articles");
1430
1587
  __publicField(this, "assets");
1431
1588
  __publicField(this, "baskets");
1589
+ __publicField(this, "callouts");
1432
1590
  __publicField(this, "events");
1433
1591
  __publicField(this, "menus");
1434
1592
  __publicField(this, "orders");
@@ -1438,6 +1596,7 @@ class O3KClient {
1438
1596
  __publicField(this, "subscriptions");
1439
1597
  __publicField(this, "teamOrders");
1440
1598
  __publicField(this, "venues");
1599
+ __publicField(this, "websitePages");
1441
1600
  __publicField(this, "realtime");
1442
1601
  __publicField(this, "baseUrl");
1443
1602
  __publicField(this, "tokenManager");
@@ -1454,6 +1613,7 @@ class O3KClient {
1454
1613
  this.articles = new ArticlesResource(this.tokenManager, this.baseUrl);
1455
1614
  this.assets = new AssetsResource(this.tokenManager, this.baseUrl);
1456
1615
  this.baskets = new BasketsResource(this.tokenManager, this.baseUrl);
1616
+ this.callouts = new CalloutsResource(this.tokenManager, this.baseUrl);
1457
1617
  this.events = new EventsResource(this.tokenManager, this.baseUrl);
1458
1618
  this.menus = new MenusResource(this.tokenManager, this.baseUrl);
1459
1619
  this.orders = new OrdersResource(this.tokenManager, this.baseUrl);
@@ -1472,6 +1632,10 @@ class O3KClient {
1472
1632
  );
1473
1633
  this.teamOrders = new TeamOrdersResource(this.tokenManager, this.baseUrl);
1474
1634
  this.venues = new VenuesResource(this.tokenManager, this.baseUrl);
1635
+ this.websitePages = new WebsitePagesResource(
1636
+ this.tokenManager,
1637
+ this.baseUrl
1638
+ );
1475
1639
  this.realtime = new RealtimeManager(this.tokenManager, this.baseUrl);
1476
1640
  }
1477
1641
  }