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