order3000 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/client.mjs CHANGED
@@ -236,6 +236,64 @@ class AdsResource extends BaseResource {
236
236
  body
237
237
  );
238
238
  }
239
+ /**
240
+ * Replace the ad's owner-chosen callout set in one shot — the highlights
241
+ * pushed to Google as CALLOUT assets. The set references the venue's callout
242
+ * pool by id; it is de-duplicated while preserving order, and an empty array
243
+ * clears callouts. Only ids belonging to the venue's pool survive. Call
244
+ * {@link get} first and resend the full set to preserve existing entries.
245
+ * Returns the cleaned, persisted ids.
246
+ */
247
+ async saveCallouts(adId, body) {
248
+ return this.request(
249
+ "PATCH",
250
+ `/${encodeURIComponent(adId)}/callouts`,
251
+ body
252
+ );
253
+ }
254
+ /**
255
+ * Replace the ad's owner-curated NEGATIVE keyword set (and the venue
256
+ * negatives toggled off for this ad) in one shot. An empty `negativeKeywords`
257
+ * array clears the set. Texts are trimmed + de-duplicated server-side; the
258
+ * set is pushed to a linked live campaign immediately. Call {@link get} first
259
+ * and resend the full set to preserve existing entries.
260
+ */
261
+ async saveNegativeKeywords(adId, body) {
262
+ return this.request(
263
+ "PATCH",
264
+ `/${encodeURIComponent(adId)}/negative-keywords`,
265
+ body
266
+ );
267
+ }
268
+ /**
269
+ * Replace the ad's owner-chosen website-page set in one shot — the pages
270
+ * pushed to Google as SITELINK assets. The set references the venue's
271
+ * website-page pool by id; it is de-duplicated while preserving order, and
272
+ * an empty array clears sitelinks. Only ids belonging to the venue's pool
273
+ * survive. Call {@link get} first and resend the full set to preserve
274
+ * existing entries. Returns the cleaned, persisted ids.
275
+ */
276
+ async saveWebsitePages(adId, body) {
277
+ return this.request(
278
+ "PATCH",
279
+ `/${encodeURIComponent(adId)}/website-pages`,
280
+ body
281
+ );
282
+ }
283
+ /**
284
+ * Persist the ad's order3000-side daily budget, in CENTS (the app-wide money
285
+ * unit). This writes `ads.dailyBudget` and pushes NOTHING to Google — it lets
286
+ * the owner set + refine a budget on a DRAFT ad before any campaign exists;
287
+ * `createCampaign` reads it as the default at launch (converting cents→micros
288
+ * at the Google boundary). Returns the updated ad row.
289
+ */
290
+ async setBudget(adId, body) {
291
+ return this.request(
292
+ "PATCH",
293
+ `/${encodeURIComponent(adId)}/budget`,
294
+ body
295
+ );
296
+ }
239
297
  /**
240
298
  * Write paste-ready Meta (Facebook/Instagram) ad copy + creative onto the
241
299
  * ad's `metaContent` document — the Meta analog of {@link patch} (which writes
@@ -530,6 +588,47 @@ class BasketsResource extends BaseResource {
530
588
  }
531
589
  }
532
590
 
591
+ class CalloutsResource extends BaseResource {
592
+ constructor(tokenManager, baseUrl) {
593
+ super(tokenManager, baseUrl, "/callouts");
594
+ }
595
+ /**
596
+ * List the venue's whole callout pool, ordered by `createdAt`.
597
+ */
598
+ async list() {
599
+ return this.request("GET", "");
600
+ }
601
+ /**
602
+ * Add a callout to the venue pool. `label` is the localized text (`{ de,
603
+ * en }`); each locale value ≤25 chars and at least one must be non-empty.
604
+ * Returns the created callout row.
605
+ */
606
+ async create(body) {
607
+ return this.request("POST", "", body);
608
+ }
609
+ /**
610
+ * Replace a pool callout's localized `label` (each locale value ≤25 chars;
611
+ * at least one non-empty). Returns the updated callout row.
612
+ */
613
+ async update(calloutId, body) {
614
+ return this.request(
615
+ "PATCH",
616
+ `/${encodeURIComponent(calloutId)}`,
617
+ body
618
+ );
619
+ }
620
+ /**
621
+ * Permanently remove a callout from the venue pool. Returns the deleted row.
622
+ * (Ads still referencing the id simply drop it on their next save.)
623
+ */
624
+ async delete(calloutId) {
625
+ return this.request(
626
+ "DELETE",
627
+ `/${encodeURIComponent(calloutId)}`
628
+ );
629
+ }
630
+ }
631
+
533
632
  class EventsResource extends BaseResource {
534
633
  constructor(tokenManager, baseUrl) {
535
634
  super(tokenManager, baseUrl, "/events");
@@ -1114,6 +1213,48 @@ class VenuesResource {
1114
1213
  }
1115
1214
  }
1116
1215
 
1216
+ class WebsitePagesResource extends BaseResource {
1217
+ constructor(tokenManager, baseUrl) {
1218
+ super(tokenManager, baseUrl, "/website-pages");
1219
+ }
1220
+ /**
1221
+ * List the venue's whole website-page pool, ordered by `createdAt`.
1222
+ */
1223
+ async list() {
1224
+ return this.request("GET", "");
1225
+ }
1226
+ /**
1227
+ * Add a website page to the venue pool. `target` is the raw reference the
1228
+ * owner typed — an internal path (`/speisekarte`) or a full URL — classified
1229
+ * server-side against the venue website. `label` is the localized link text.
1230
+ * Returns the created page row.
1231
+ */
1232
+ async create(body) {
1233
+ return this.request("POST", "", body);
1234
+ }
1235
+ /**
1236
+ * Replace a pool page's `target` (re-classified into a path or external URL)
1237
+ * and/or localized `label`. Returns the updated page row.
1238
+ */
1239
+ async update(pageId, body) {
1240
+ return this.request(
1241
+ "PATCH",
1242
+ `/${encodeURIComponent(pageId)}`,
1243
+ body
1244
+ );
1245
+ }
1246
+ /**
1247
+ * Permanently remove a website page from the venue pool. Returns the deleted
1248
+ * row. (Ads still referencing the id simply drop it on their next save.)
1249
+ */
1250
+ async delete(pageId) {
1251
+ return this.request(
1252
+ "DELETE",
1253
+ `/${encodeURIComponent(pageId)}`
1254
+ );
1255
+ }
1256
+ }
1257
+
1117
1258
  var __defProp$2 = Object.defineProperty;
1118
1259
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1119
1260
  var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1444,6 +1585,7 @@ class O3KClient {
1444
1585
  __publicField(this, "articles");
1445
1586
  __publicField(this, "assets");
1446
1587
  __publicField(this, "baskets");
1588
+ __publicField(this, "callouts");
1447
1589
  __publicField(this, "events");
1448
1590
  __publicField(this, "menus");
1449
1591
  __publicField(this, "orders");
@@ -1453,6 +1595,7 @@ class O3KClient {
1453
1595
  __publicField(this, "subscriptions");
1454
1596
  __publicField(this, "teamOrders");
1455
1597
  __publicField(this, "venues");
1598
+ __publicField(this, "websitePages");
1456
1599
  __publicField(this, "realtime");
1457
1600
  __publicField(this, "baseUrl");
1458
1601
  __publicField(this, "tokenManager");
@@ -1469,6 +1612,7 @@ class O3KClient {
1469
1612
  this.articles = new ArticlesResource(this.tokenManager, this.baseUrl);
1470
1613
  this.assets = new AssetsResource(this.tokenManager, this.baseUrl);
1471
1614
  this.baskets = new BasketsResource(this.tokenManager, this.baseUrl);
1615
+ this.callouts = new CalloutsResource(this.tokenManager, this.baseUrl);
1472
1616
  this.events = new EventsResource(this.tokenManager, this.baseUrl);
1473
1617
  this.menus = new MenusResource(this.tokenManager, this.baseUrl);
1474
1618
  this.orders = new OrdersResource(this.tokenManager, this.baseUrl);
@@ -1487,6 +1631,10 @@ class O3KClient {
1487
1631
  );
1488
1632
  this.teamOrders = new TeamOrdersResource(this.tokenManager, this.baseUrl);
1489
1633
  this.venues = new VenuesResource(this.tokenManager, this.baseUrl);
1634
+ this.websitePages = new WebsitePagesResource(
1635
+ this.tokenManager,
1636
+ this.baseUrl
1637
+ );
1490
1638
  this.realtime = new RealtimeManager(this.tokenManager, this.baseUrl);
1491
1639
  }
1492
1640
  }