order3000 1.8.0 → 1.10.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
@@ -435,9 +493,47 @@ class AssetsResource extends BaseResource {
435
493
  if (options.type) {
436
494
  queryParams.set("type", options.type);
437
495
  }
496
+ return this.request("GET", `?${queryParams.toString()}`);
497
+ }
498
+ /**
499
+ * Permanently remove a venue asset by id — the storage object, the `assets`
500
+ * row, and every junction link (an `everywhere` delete). The venue-wide
501
+ * counterpart to deleting an asset from a single entity.
502
+ *
503
+ * Proxies the dual-mode `deleteAsset` server action via
504
+ * `DELETE /venues/{venueId}/assets/{assetId}`. The action also publishes
505
+ * `order3000.assets.updated`, so every open asset library for the venue
506
+ * updates live.
507
+ *
508
+ * @param assetId - The globally-unique asset id
509
+ * @returns `{ success, deleted }`
510
+ */
511
+ async delete(assetId) {
438
512
  return this.request(
439
- "GET",
440
- `?${queryParams.toString()}`
513
+ "DELETE",
514
+ `/${encodeURIComponent(assetId)}`
515
+ );
516
+ }
517
+ /**
518
+ * Edit a venue asset's metadata (tags / caption / alt / active flag / crop)
519
+ * by id. Only the supplied fields are written; per-locale `caption` / `alt`
520
+ * merge into the existing record rather than overwriting it.
521
+ *
522
+ * Proxies the dual-mode `editAsset` server action via
523
+ * `PATCH /venues/{venueId}/assets/{assetId}`. The action also publishes
524
+ * `order3000.assets.updated`, so every open asset library for the venue
525
+ * updates live — the grid refetches and any open EditAssetModal showing this
526
+ * asset re-seeds to reflect the edit.
527
+ *
528
+ * @param assetId - The globally-unique asset id
529
+ * @param input - The fields to change
530
+ * @returns The updated asset row
531
+ */
532
+ async update(assetId, input) {
533
+ return this.request(
534
+ "PATCH",
535
+ `/${encodeURIComponent(assetId)}`,
536
+ input
441
537
  );
442
538
  }
443
539
  }
@@ -530,6 +626,47 @@ class BasketsResource extends BaseResource {
530
626
  }
531
627
  }
532
628
 
629
+ class CalloutsResource extends BaseResource {
630
+ constructor(tokenManager, baseUrl) {
631
+ super(tokenManager, baseUrl, "/callouts");
632
+ }
633
+ /**
634
+ * List the venue's whole callout pool, ordered by `createdAt`.
635
+ */
636
+ async list() {
637
+ return this.request("GET", "");
638
+ }
639
+ /**
640
+ * Add a callout to the venue pool. `label` is the localized text (`{ de,
641
+ * en }`); each locale value ≤25 chars and at least one must be non-empty.
642
+ * Returns the created callout row.
643
+ */
644
+ async create(body) {
645
+ return this.request("POST", "", body);
646
+ }
647
+ /**
648
+ * Replace a pool callout's localized `label` (each locale value ≤25 chars;
649
+ * at least one non-empty). Returns the updated callout row.
650
+ */
651
+ async update(calloutId, body) {
652
+ return this.request(
653
+ "PATCH",
654
+ `/${encodeURIComponent(calloutId)}`,
655
+ body
656
+ );
657
+ }
658
+ /**
659
+ * Permanently remove a callout from the venue pool. Returns the deleted row.
660
+ * (Ads still referencing the id simply drop it on their next save.)
661
+ */
662
+ async delete(calloutId) {
663
+ return this.request(
664
+ "DELETE",
665
+ `/${encodeURIComponent(calloutId)}`
666
+ );
667
+ }
668
+ }
669
+
533
670
  class EventsResource extends BaseResource {
534
671
  constructor(tokenManager, baseUrl) {
535
672
  super(tokenManager, baseUrl, "/events");
@@ -1114,6 +1251,48 @@ class VenuesResource {
1114
1251
  }
1115
1252
  }
1116
1253
 
1254
+ class WebsitePagesResource extends BaseResource {
1255
+ constructor(tokenManager, baseUrl) {
1256
+ super(tokenManager, baseUrl, "/website-pages");
1257
+ }
1258
+ /**
1259
+ * List the venue's whole website-page pool, ordered by `createdAt`.
1260
+ */
1261
+ async list() {
1262
+ return this.request("GET", "");
1263
+ }
1264
+ /**
1265
+ * Add a website page to the venue pool. `target` is the raw reference the
1266
+ * owner typed — an internal path (`/speisekarte`) or a full URL — classified
1267
+ * server-side against the venue website. `label` is the localized link text.
1268
+ * Returns the created page row.
1269
+ */
1270
+ async create(body) {
1271
+ return this.request("POST", "", body);
1272
+ }
1273
+ /**
1274
+ * Replace a pool page's `target` (re-classified into a path or external URL)
1275
+ * and/or localized `label`. Returns the updated page row.
1276
+ */
1277
+ async update(pageId, body) {
1278
+ return this.request(
1279
+ "PATCH",
1280
+ `/${encodeURIComponent(pageId)}`,
1281
+ body
1282
+ );
1283
+ }
1284
+ /**
1285
+ * Permanently remove a website page from the venue pool. Returns the deleted
1286
+ * row. (Ads still referencing the id simply drop it on their next save.)
1287
+ */
1288
+ async delete(pageId) {
1289
+ return this.request(
1290
+ "DELETE",
1291
+ `/${encodeURIComponent(pageId)}`
1292
+ );
1293
+ }
1294
+ }
1295
+
1117
1296
  var __defProp$2 = Object.defineProperty;
1118
1297
  var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
1119
1298
  var __publicField$2 = (obj, key, value) => __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
@@ -1444,6 +1623,7 @@ class O3KClient {
1444
1623
  __publicField(this, "articles");
1445
1624
  __publicField(this, "assets");
1446
1625
  __publicField(this, "baskets");
1626
+ __publicField(this, "callouts");
1447
1627
  __publicField(this, "events");
1448
1628
  __publicField(this, "menus");
1449
1629
  __publicField(this, "orders");
@@ -1453,6 +1633,7 @@ class O3KClient {
1453
1633
  __publicField(this, "subscriptions");
1454
1634
  __publicField(this, "teamOrders");
1455
1635
  __publicField(this, "venues");
1636
+ __publicField(this, "websitePages");
1456
1637
  __publicField(this, "realtime");
1457
1638
  __publicField(this, "baseUrl");
1458
1639
  __publicField(this, "tokenManager");
@@ -1469,6 +1650,7 @@ class O3KClient {
1469
1650
  this.articles = new ArticlesResource(this.tokenManager, this.baseUrl);
1470
1651
  this.assets = new AssetsResource(this.tokenManager, this.baseUrl);
1471
1652
  this.baskets = new BasketsResource(this.tokenManager, this.baseUrl);
1653
+ this.callouts = new CalloutsResource(this.tokenManager, this.baseUrl);
1472
1654
  this.events = new EventsResource(this.tokenManager, this.baseUrl);
1473
1655
  this.menus = new MenusResource(this.tokenManager, this.baseUrl);
1474
1656
  this.orders = new OrdersResource(this.tokenManager, this.baseUrl);
@@ -1487,6 +1669,10 @@ class O3KClient {
1487
1669
  );
1488
1670
  this.teamOrders = new TeamOrdersResource(this.tokenManager, this.baseUrl);
1489
1671
  this.venues = new VenuesResource(this.tokenManager, this.baseUrl);
1672
+ this.websitePages = new WebsitePagesResource(
1673
+ this.tokenManager,
1674
+ this.baseUrl
1675
+ );
1490
1676
  this.realtime = new RealtimeManager(this.tokenManager, this.baseUrl);
1491
1677
  }
1492
1678
  }