order3000 0.13.2 → 0.13.4

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
@@ -26,26 +26,16 @@ class TokenManager {
26
26
  return this.refreshToken();
27
27
  }
28
28
  getVenueId() {
29
- console.log("[SDK VENUE] Getting venue ID...");
30
- console.log("[SDK VENUE] User venue ID:", this.userVenueId);
31
- console.log("[SDK VENUE] Default venue ID:", this.defaultVenueId);
32
29
  if (this.userVenueId) {
33
- console.log("[SDK VENUE] Using user venue ID:", this.userVenueId);
34
30
  return this.userVenueId;
35
31
  }
36
32
  if (!this.defaultVenueId) {
37
- console.error("[SDK VENUE] No venue ID available!");
38
- console.error("[SDK VENUE] Token exists:", !!this.accessToken);
39
33
  throw new Error("No venue ID available. The robot account may not be associated with any venues.");
40
34
  }
41
- console.log("[SDK VENUE] Using default venue ID:", this.defaultVenueId);
42
35
  return this.defaultVenueId;
43
36
  }
44
37
  async refreshToken() {
45
38
  if (this.refreshPromise) return this.refreshPromise;
46
- console.log("[SDK TOKEN] Requesting token from:", this.tokenEndpoint);
47
- console.log("[SDK TOKEN] Using clientId:", this.clientId);
48
- console.log("[SDK TOKEN] Secret length:", this.clientSecret?.length);
49
39
  this.refreshPromise = fetch(this.tokenEndpoint, {
50
40
  method: "POST",
51
41
  headers: { "Content-Type": "application/json" },
@@ -56,20 +46,15 @@ class TokenManager {
56
46
  signal: AbortSignal.timeout(36e4)
57
47
  }).then(async (response) => {
58
48
  if (!response.ok) {
59
- const body = await response.text();
60
- console.log("[SDK TOKEN] Response status:", response.status);
61
- console.log("[SDK TOKEN] Response body:", body);
62
49
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
63
50
  }
64
51
  return response.json();
65
52
  }).then((data) => {
66
- console.log("[SDK TOKEN] Token received successfully");
67
53
  this.accessToken = data.accessToken;
68
54
  this.tokenExpiresAt = Date.now() + data.expiresIn * 1e3;
69
55
  this.setDefaultVenueId();
70
56
  return this.accessToken;
71
57
  }).catch((error) => {
72
- console.log("[SDK TOKEN] Token request failed:", error.message);
73
58
  throw error;
74
59
  }).finally(() => {
75
60
  this.refreshPromise = null;
@@ -79,21 +64,16 @@ class TokenManager {
79
64
  setDefaultVenueId() {
80
65
  if (this.userVenueId || !this.accessToken) return;
81
66
  try {
82
- console.log("[SDK VENUE] Parsing token to extract default venue ID...");
83
67
  const [, payload] = this.accessToken.split(".");
84
68
  const decoded = JSON.parse(
85
69
  Buffer.from(payload, "base64").toString()
86
70
  );
87
- console.log("[SDK VENUE] Token payload venues:", decoded.venues);
88
71
  if (!decoded.venues || decoded.venues.length === 0) {
89
- console.warn("[SDK VENUE] No venues found in token. Robot account may not be associated with any venues.");
90
72
  this.defaultVenueId = void 0;
91
73
  return;
92
74
  }
93
75
  this.defaultVenueId = decoded.venues[0];
94
- console.log("[SDK VENUE] Set default venue ID to:", this.defaultVenueId);
95
- } catch (error) {
96
- console.error("[SDK VENUE] Failed to parse venue ID from token:", error);
76
+ } catch {
97
77
  throw new Error("Failed to parse venue ID from token");
98
78
  }
99
79
  }
@@ -109,7 +89,6 @@ class BaseResource {
109
89
  const token = await this.tokenManager.getToken();
110
90
  const venueId = this.tokenManager.getVenueId();
111
91
  const url = `${this.baseUrl}/venues/${venueId}${this.resourcePath}${path}`;
112
- console.log(`[SDK] Making ${method} request to: ${url}`);
113
92
  const response = await fetch(url, {
114
93
  method,
115
94
  headers: {
package/dist/client.d.cts CHANGED
@@ -113,21 +113,19 @@ interface components {
113
113
  publicId?: string | null;
114
114
  quickReferenceNumber?: number | null;
115
115
  /** @enum {string} */
116
- status?: "draft" | "pending" | "paid" | "fulfilled" | "cancelled" | "refunded";
116
+ status?: "pending" | "in_progress" | "ready" | "completed" | "cancelled";
117
117
  paymentIntentId?: string | null;
118
118
  /** @enum {string|null} */
119
119
  paymentMethod?: "card" | "cash" | "voucher" | null;
120
+ /** @enum {string} */
121
+ paymentStatus?: "unpaid" | "paid" | "refunded";
120
122
  taxAmount: number;
121
123
  totalAmount: number;
122
124
  /** @enum {string} */
123
125
  currency?: "EUR" | "CHF";
124
126
  /** @enum {string|null} */
125
127
  fulfillmentType?: "pickup" | "delivery" | null;
126
- /**
127
- * Format: date-time
128
- * @description When the order should be fulfilled (ISO 8601 datetime string)
129
- */
130
- fulfillmentAt?: string | null;
128
+ fulfillmentAt: unknown;
131
129
  orderedAt?: unknown;
132
130
  orderedBy: string;
133
131
  updatedAt?: unknown;
@@ -141,21 +139,19 @@ interface components {
141
139
  publicId: string | null;
142
140
  quickReferenceNumber: number | null;
143
141
  /** @enum {string} */
144
- status: "draft" | "pending" | "paid" | "fulfilled" | "cancelled" | "refunded";
142
+ status: "pending" | "in_progress" | "ready" | "completed" | "cancelled";
145
143
  paymentIntentId: string | null;
146
144
  /** @enum {string|null} */
147
145
  paymentMethod: "card" | "cash" | "voucher" | null;
146
+ /** @enum {string} */
147
+ paymentStatus: "unpaid" | "paid" | "refunded";
148
148
  taxAmount: number;
149
149
  totalAmount: number;
150
150
  /** @enum {string} */
151
151
  currency: "EUR" | "CHF";
152
152
  /** @enum {string|null} */
153
153
  fulfillmentType: "pickup" | "delivery" | null;
154
- /**
155
- * Format: date-time
156
- * @description When the order should be fulfilled (ISO 8601 datetime string)
157
- */
158
- fulfillmentAt: string | null;
154
+ fulfillmentAt: unknown;
159
155
  orderedAt: unknown;
160
156
  orderedBy: string;
161
157
  updatedAt: unknown;
@@ -479,10 +475,12 @@ interface MenuDish {
479
475
  name: Record<string, string>;
480
476
  shortName?: Record<string, string>;
481
477
  description: Record<string, string> | null;
478
+ longDescription?: Record<string, string> | null;
482
479
  isVegetarian: boolean | null;
483
480
  isVegan: boolean | null;
484
481
  isGlutenFree: boolean | null;
485
482
  isDairyFree: boolean | null;
483
+ spiciness: number | null;
486
484
  assets?: MenuAsset[];
487
485
  }
488
486
  interface MenuBeverage {
@@ -491,6 +489,7 @@ interface MenuBeverage {
491
489
  name: Record<string, string>;
492
490
  shortName?: Record<string, string>;
493
491
  description: Record<string, string> | null;
492
+ longDescription?: Record<string, string> | null;
494
493
  assets?: MenuAsset[];
495
494
  }
496
495
  interface MenuItem {
@@ -499,7 +498,7 @@ interface MenuItem {
499
498
  tags: string[] | null;
500
499
  /** Price adjustment in cents (adds to bundle base price) */
501
500
  priceAdjustment: number;
502
- currency: string;
501
+ currency: CurrencyCode;
503
502
  isActive: boolean;
504
503
  sortIndex: string | null;
505
504
  dish: MenuDish | null;
@@ -939,7 +938,7 @@ interface MenuItemRow {
939
938
  dish_id: string | null;
940
939
  beverage_id: string | null;
941
940
  price_adjustment: number;
942
- currency: string;
941
+ currency: CurrencyCode;
943
942
  is_active: boolean;
944
943
  tags: string[] | null;
945
944
  sort_index: string | null;
@@ -1084,4 +1083,5 @@ declare class Order3000Client {
1084
1083
  constructor(config: Order3000ClientConfig);
1085
1084
  }
1086
1085
 
1087
- export { type AddToBasketRequest, type AddToBasketResponse, type Basket, type BasketItem, type BasketItemMenuItemRef, type BasketItemMetadata, type BasketStatus, type ConfirmOrderRequest, type ConfirmOrderResponse, type CreatePaymentIntentRequest, type CreatePaymentIntentResponse, type CropArea, type Currency, type DayOfWeek, type Event, type EventByAccessor, type EventMenu, type EventPoster, type EventRow, type GetEventOptions, type GetMenuOptions, type ListEventsOptions, type ListEventsResponse, type Menu, type MenuAsset, type MenuBeverage, type MenuBundle, type MenuBundleDeposit, type MenuDish, type MenuItem, type MenuItemRow, type MenuItemType, type MenuSubscription, type MenuSubscriptionPoster, Order3000Client, type Order3000ClientConfig, type OrderFulfillmentType, type PlaceOrderRequest, type Promotion, type RealtimeConfig, type RealtimeEvent, type RealtimeSubscription, type RemoveFromBasketResponse, type Schedule, type ScheduleInfo, type ScheduleOverride, type ScheduleOverrideRow, type ScheduleRow, type ScheduleTimeSlot, type ScheduleWithTimeSlots, type SubscribeRequest, type SubscribeResponse, type SubscriberStatus, type SubscriptionCredit, type SubscriptionCreditStatus, type SubscriptionOptions, type SubscriptionPeriod, type TimeSlot, type Unit, getScheduleInfo };
1086
+ export { Order3000Client, getScheduleInfo };
1087
+ export type { AddToBasketRequest, AddToBasketResponse, Basket, BasketItem, BasketItemMenuItemRef, BasketItemMetadata, BasketStatus, ConfirmOrderRequest, ConfirmOrderResponse, CreatePaymentIntentRequest, CreatePaymentIntentResponse, CropArea, Currency, DayOfWeek, Event, EventByAccessor, EventMenu, EventPoster, EventRow, GetEventOptions, GetMenuOptions, ListEventsOptions, ListEventsResponse, Menu, MenuAsset, MenuBeverage, MenuBundle, MenuBundleDeposit, MenuDish, MenuItem, MenuItemRow, MenuItemType, MenuSubscription, MenuSubscriptionPoster, Order3000ClientConfig, OrderFulfillmentType, PlaceOrderRequest, Promotion, RealtimeConfig, RealtimeEvent, RealtimeSubscription, RemoveFromBasketResponse, Schedule, ScheduleInfo, ScheduleOverride, ScheduleOverrideRow, ScheduleRow, ScheduleTimeSlot, ScheduleWithTimeSlots, SubscribeRequest, SubscribeResponse, SubscriberStatus, SubscriptionCredit, SubscriptionCreditStatus, SubscriptionOptions, SubscriptionPeriod, TimeSlot, Unit };
package/dist/client.d.mts CHANGED
@@ -113,21 +113,19 @@ interface components {
113
113
  publicId?: string | null;
114
114
  quickReferenceNumber?: number | null;
115
115
  /** @enum {string} */
116
- status?: "draft" | "pending" | "paid" | "fulfilled" | "cancelled" | "refunded";
116
+ status?: "pending" | "in_progress" | "ready" | "completed" | "cancelled";
117
117
  paymentIntentId?: string | null;
118
118
  /** @enum {string|null} */
119
119
  paymentMethod?: "card" | "cash" | "voucher" | null;
120
+ /** @enum {string} */
121
+ paymentStatus?: "unpaid" | "paid" | "refunded";
120
122
  taxAmount: number;
121
123
  totalAmount: number;
122
124
  /** @enum {string} */
123
125
  currency?: "EUR" | "CHF";
124
126
  /** @enum {string|null} */
125
127
  fulfillmentType?: "pickup" | "delivery" | null;
126
- /**
127
- * Format: date-time
128
- * @description When the order should be fulfilled (ISO 8601 datetime string)
129
- */
130
- fulfillmentAt?: string | null;
128
+ fulfillmentAt: unknown;
131
129
  orderedAt?: unknown;
132
130
  orderedBy: string;
133
131
  updatedAt?: unknown;
@@ -141,21 +139,19 @@ interface components {
141
139
  publicId: string | null;
142
140
  quickReferenceNumber: number | null;
143
141
  /** @enum {string} */
144
- status: "draft" | "pending" | "paid" | "fulfilled" | "cancelled" | "refunded";
142
+ status: "pending" | "in_progress" | "ready" | "completed" | "cancelled";
145
143
  paymentIntentId: string | null;
146
144
  /** @enum {string|null} */
147
145
  paymentMethod: "card" | "cash" | "voucher" | null;
146
+ /** @enum {string} */
147
+ paymentStatus: "unpaid" | "paid" | "refunded";
148
148
  taxAmount: number;
149
149
  totalAmount: number;
150
150
  /** @enum {string} */
151
151
  currency: "EUR" | "CHF";
152
152
  /** @enum {string|null} */
153
153
  fulfillmentType: "pickup" | "delivery" | null;
154
- /**
155
- * Format: date-time
156
- * @description When the order should be fulfilled (ISO 8601 datetime string)
157
- */
158
- fulfillmentAt: string | null;
154
+ fulfillmentAt: unknown;
159
155
  orderedAt: unknown;
160
156
  orderedBy: string;
161
157
  updatedAt: unknown;
@@ -479,10 +475,12 @@ interface MenuDish {
479
475
  name: Record<string, string>;
480
476
  shortName?: Record<string, string>;
481
477
  description: Record<string, string> | null;
478
+ longDescription?: Record<string, string> | null;
482
479
  isVegetarian: boolean | null;
483
480
  isVegan: boolean | null;
484
481
  isGlutenFree: boolean | null;
485
482
  isDairyFree: boolean | null;
483
+ spiciness: number | null;
486
484
  assets?: MenuAsset[];
487
485
  }
488
486
  interface MenuBeverage {
@@ -491,6 +489,7 @@ interface MenuBeverage {
491
489
  name: Record<string, string>;
492
490
  shortName?: Record<string, string>;
493
491
  description: Record<string, string> | null;
492
+ longDescription?: Record<string, string> | null;
494
493
  assets?: MenuAsset[];
495
494
  }
496
495
  interface MenuItem {
@@ -499,7 +498,7 @@ interface MenuItem {
499
498
  tags: string[] | null;
500
499
  /** Price adjustment in cents (adds to bundle base price) */
501
500
  priceAdjustment: number;
502
- currency: string;
501
+ currency: CurrencyCode;
503
502
  isActive: boolean;
504
503
  sortIndex: string | null;
505
504
  dish: MenuDish | null;
@@ -939,7 +938,7 @@ interface MenuItemRow {
939
938
  dish_id: string | null;
940
939
  beverage_id: string | null;
941
940
  price_adjustment: number;
942
- currency: string;
941
+ currency: CurrencyCode;
943
942
  is_active: boolean;
944
943
  tags: string[] | null;
945
944
  sort_index: string | null;
@@ -1084,4 +1083,5 @@ declare class Order3000Client {
1084
1083
  constructor(config: Order3000ClientConfig);
1085
1084
  }
1086
1085
 
1087
- export { type AddToBasketRequest, type AddToBasketResponse, type Basket, type BasketItem, type BasketItemMenuItemRef, type BasketItemMetadata, type BasketStatus, type ConfirmOrderRequest, type ConfirmOrderResponse, type CreatePaymentIntentRequest, type CreatePaymentIntentResponse, type CropArea, type Currency, type DayOfWeek, type Event, type EventByAccessor, type EventMenu, type EventPoster, type EventRow, type GetEventOptions, type GetMenuOptions, type ListEventsOptions, type ListEventsResponse, type Menu, type MenuAsset, type MenuBeverage, type MenuBundle, type MenuBundleDeposit, type MenuDish, type MenuItem, type MenuItemRow, type MenuItemType, type MenuSubscription, type MenuSubscriptionPoster, Order3000Client, type Order3000ClientConfig, type OrderFulfillmentType, type PlaceOrderRequest, type Promotion, type RealtimeConfig, type RealtimeEvent, type RealtimeSubscription, type RemoveFromBasketResponse, type Schedule, type ScheduleInfo, type ScheduleOverride, type ScheduleOverrideRow, type ScheduleRow, type ScheduleTimeSlot, type ScheduleWithTimeSlots, type SubscribeRequest, type SubscribeResponse, type SubscriberStatus, type SubscriptionCredit, type SubscriptionCreditStatus, type SubscriptionOptions, type SubscriptionPeriod, type TimeSlot, type Unit, getScheduleInfo };
1086
+ export { Order3000Client, getScheduleInfo };
1087
+ export type { AddToBasketRequest, AddToBasketResponse, Basket, BasketItem, BasketItemMenuItemRef, BasketItemMetadata, BasketStatus, ConfirmOrderRequest, ConfirmOrderResponse, CreatePaymentIntentRequest, CreatePaymentIntentResponse, CropArea, Currency, DayOfWeek, Event, EventByAccessor, EventMenu, EventPoster, EventRow, GetEventOptions, GetMenuOptions, ListEventsOptions, ListEventsResponse, Menu, MenuAsset, MenuBeverage, MenuBundle, MenuBundleDeposit, MenuDish, MenuItem, MenuItemRow, MenuItemType, MenuSubscription, MenuSubscriptionPoster, Order3000ClientConfig, OrderFulfillmentType, PlaceOrderRequest, Promotion, RealtimeConfig, RealtimeEvent, RealtimeSubscription, RemoveFromBasketResponse, Schedule, ScheduleInfo, ScheduleOverride, ScheduleOverrideRow, ScheduleRow, ScheduleTimeSlot, ScheduleWithTimeSlots, SubscribeRequest, SubscribeResponse, SubscriberStatus, SubscriptionCredit, SubscriptionCreditStatus, SubscriptionOptions, SubscriptionPeriod, TimeSlot, Unit };
package/dist/client.mjs CHANGED
@@ -24,26 +24,16 @@ class TokenManager {
24
24
  return this.refreshToken();
25
25
  }
26
26
  getVenueId() {
27
- console.log("[SDK VENUE] Getting venue ID...");
28
- console.log("[SDK VENUE] User venue ID:", this.userVenueId);
29
- console.log("[SDK VENUE] Default venue ID:", this.defaultVenueId);
30
27
  if (this.userVenueId) {
31
- console.log("[SDK VENUE] Using user venue ID:", this.userVenueId);
32
28
  return this.userVenueId;
33
29
  }
34
30
  if (!this.defaultVenueId) {
35
- console.error("[SDK VENUE] No venue ID available!");
36
- console.error("[SDK VENUE] Token exists:", !!this.accessToken);
37
31
  throw new Error("No venue ID available. The robot account may not be associated with any venues.");
38
32
  }
39
- console.log("[SDK VENUE] Using default venue ID:", this.defaultVenueId);
40
33
  return this.defaultVenueId;
41
34
  }
42
35
  async refreshToken() {
43
36
  if (this.refreshPromise) return this.refreshPromise;
44
- console.log("[SDK TOKEN] Requesting token from:", this.tokenEndpoint);
45
- console.log("[SDK TOKEN] Using clientId:", this.clientId);
46
- console.log("[SDK TOKEN] Secret length:", this.clientSecret?.length);
47
37
  this.refreshPromise = fetch(this.tokenEndpoint, {
48
38
  method: "POST",
49
39
  headers: { "Content-Type": "application/json" },
@@ -54,20 +44,15 @@ class TokenManager {
54
44
  signal: AbortSignal.timeout(36e4)
55
45
  }).then(async (response) => {
56
46
  if (!response.ok) {
57
- const body = await response.text();
58
- console.log("[SDK TOKEN] Response status:", response.status);
59
- console.log("[SDK TOKEN] Response body:", body);
60
47
  throw new Error(`HTTP ${response.status}: ${response.statusText}`);
61
48
  }
62
49
  return response.json();
63
50
  }).then((data) => {
64
- console.log("[SDK TOKEN] Token received successfully");
65
51
  this.accessToken = data.accessToken;
66
52
  this.tokenExpiresAt = Date.now() + data.expiresIn * 1e3;
67
53
  this.setDefaultVenueId();
68
54
  return this.accessToken;
69
55
  }).catch((error) => {
70
- console.log("[SDK TOKEN] Token request failed:", error.message);
71
56
  throw error;
72
57
  }).finally(() => {
73
58
  this.refreshPromise = null;
@@ -77,21 +62,16 @@ class TokenManager {
77
62
  setDefaultVenueId() {
78
63
  if (this.userVenueId || !this.accessToken) return;
79
64
  try {
80
- console.log("[SDK VENUE] Parsing token to extract default venue ID...");
81
65
  const [, payload] = this.accessToken.split(".");
82
66
  const decoded = JSON.parse(
83
67
  Buffer.from(payload, "base64").toString()
84
68
  );
85
- console.log("[SDK VENUE] Token payload venues:", decoded.venues);
86
69
  if (!decoded.venues || decoded.venues.length === 0) {
87
- console.warn("[SDK VENUE] No venues found in token. Robot account may not be associated with any venues.");
88
70
  this.defaultVenueId = void 0;
89
71
  return;
90
72
  }
91
73
  this.defaultVenueId = decoded.venues[0];
92
- console.log("[SDK VENUE] Set default venue ID to:", this.defaultVenueId);
93
- } catch (error) {
94
- console.error("[SDK VENUE] Failed to parse venue ID from token:", error);
74
+ } catch {
95
75
  throw new Error("Failed to parse venue ID from token");
96
76
  }
97
77
  }
@@ -107,7 +87,6 @@ class BaseResource {
107
87
  const token = await this.tokenManager.getToken();
108
88
  const venueId = this.tokenManager.getVenueId();
109
89
  const url = `${this.baseUrl}/venues/${venueId}${this.resourcePath}${path}`;
110
- console.log(`[SDK] Making ${method} request to: ${url}`);
111
90
  const response = await fetch(url, {
112
91
  method,
113
92
  headers: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "order3000",
3
- "version": "0.13.2",
3
+ "version": "0.13.4",
4
4
  "description": "order3000 node.js sdk",
5
5
  "main": "./dist/client.cjs",
6
6
  "module": "./dist/client.mjs",
@@ -16,6 +16,7 @@
16
16
  }
17
17
  },
18
18
  "dependencies": {
19
+ "@date-fns/tz": "^1.4.1",
19
20
  "@supabase/supabase-js": "^2.49.8",
20
21
  "@types/react-type-animation": "^2.0.0",
21
22
  "i18next": "^25.6.0",
@@ -25,12 +26,13 @@
25
26
  },
26
27
  "devDependencies": {
27
28
  "@types/node": "^24.10.0",
29
+ "esbuild": "^0.26.0",
28
30
  "openapi-typescript": "^7.6.1",
29
- "pkgroll": "^2.11.2",
31
+ "pkgroll": "^2.26.3",
30
32
  "prettier": "^3.7.4",
31
33
  "tsx": "^4.19.2",
32
34
  "typescript": "^5.9.3",
33
- "@kolaveri/eslint-config": "1.4.1",
35
+ "@kolaveri/eslint-config": "1.4.2",
34
36
  "@kolaveri/prettier-config": "1.0.6",
35
37
  "@kolaveri/tsconfig": "1.0.1"
36
38
  },