@theelena/sdk 0.1.2 → 0.1.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/agent.d.ts +165 -3
- package/dist/agent.js +60 -6
- package/dist/agent.js.map +1 -1
- package/dist/index.d.ts +43 -3
- package/dist/index.js +10 -6
- package/dist/index.js.map +1 -1
- package/dist/{key-transport.d-Bopgxw9r.d.ts → key-transport.d-DlF2RqPm.d.ts} +13 -0
- package/package.json +2 -6
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { bo as ElenaHttpClient, bp as ElenaFetch, bq as ElenaClientOptions, E as ElenaKeyRequestOptions, W as ElenaClientContextV1, b as ElenaKeyPageQuery, V as ElenaClientCatalogV1, X as ElenaClientProductResponseV1, T as ElenaClientAssetResponseV1, j as ElenaKeyTransportOptions } from './key-transport.d-
|
|
2
|
-
export { S as ElenaAgentTransportError, U as ElenaClientAssetV1, Y as ElenaClientProductV1, br as ElenaHttpMethod, Z as ElenaKeyTransportErrorCode, a0 as ElenaPublicConnectionV1, bs as ElenaRequestOptions } from './key-transport.d-
|
|
1
|
+
import { bo as ElenaHttpClient, bp as ElenaFetch, bq as ElenaClientOptions, E as ElenaKeyRequestOptions, W as ElenaClientContextV1, b as ElenaKeyPageQuery, V as ElenaClientCatalogV1, X as ElenaClientProductResponseV1, T as ElenaClientAssetResponseV1, j as ElenaKeyTransportOptions } from './key-transport.d-DlF2RqPm.js';
|
|
2
|
+
export { S as ElenaAgentTransportError, U as ElenaClientAssetV1, Y as ElenaClientProductV1, br as ElenaHttpMethod, Z as ElenaKeyTransportErrorCode, a0 as ElenaPublicConnectionV1, bs as ElenaRequestOptions } from './key-transport.d-DlF2RqPm.js';
|
|
3
3
|
import { z } from 'zod';
|
|
4
4
|
|
|
5
5
|
type TicketEstado = 'emitido' | 'usado' | 'anulado';
|
|
@@ -209,6 +209,9 @@ interface BusinessSocial {
|
|
|
209
209
|
facebook: string | null;
|
|
210
210
|
instagram: string | null;
|
|
211
211
|
twitter: string | null;
|
|
212
|
+
tiktok?: string | null;
|
|
213
|
+
website?: string | null;
|
|
214
|
+
whatsapp?: string | null;
|
|
212
215
|
}
|
|
213
216
|
type BusinessSchedule = Record<string, {
|
|
214
217
|
abierto: boolean;
|
|
@@ -264,6 +267,9 @@ interface BusinessInfo {
|
|
|
264
267
|
preferences: {
|
|
265
268
|
heroCarouselEnabled?: boolean;
|
|
266
269
|
catalogChatEnabled?: boolean;
|
|
270
|
+
catalogPaletteId?: string;
|
|
271
|
+
catalogFontId?: string;
|
|
272
|
+
catalogRadiusId?: string;
|
|
267
273
|
};
|
|
268
274
|
orderCharges: OrderChargeDefinition[];
|
|
269
275
|
businessType: 'restaurante' | 'discoteca' | null;
|
|
@@ -332,6 +338,36 @@ interface BusinessTable {
|
|
|
332
338
|
status: string;
|
|
333
339
|
}
|
|
334
340
|
|
|
341
|
+
/**
|
|
342
|
+
* Catalog appearance system.
|
|
343
|
+
*
|
|
344
|
+
* Single source of truth for the visual identity a restaurant can apply to its
|
|
345
|
+
* public catalog: curated palettes (light + dark tokens), display fonts and
|
|
346
|
+
* corner radii. The backend persists only ids in `restaurants.preferences`; the
|
|
347
|
+
* public catalog resolves them to CSS custom properties and the admin preview
|
|
348
|
+
* consumes the exact same data.
|
|
349
|
+
*
|
|
350
|
+
* Rules:
|
|
351
|
+
* - Ids are an allowlist. Unknown values always fall back to Elena defaults, so
|
|
352
|
+
* a legacy or corrupted preference can never inject arbitrary CSS.
|
|
353
|
+
* - `accentInk` exists because the accent that fills a button is not always
|
|
354
|
+
* legible as text on the page background (see the amber palette).
|
|
355
|
+
* - The default appearance reproduces the current catalog look; adding this
|
|
356
|
+
* module must not change any existing restaurant's catalog.
|
|
357
|
+
*/
|
|
358
|
+
declare const CATALOG_PALETTE_IDS: readonly ["clasico", "terracotta", "forest", "graphite", "rose", "ocean", "violet", "brasa", "aji", "mercado"];
|
|
359
|
+
type CatalogPaletteId = (typeof CATALOG_PALETTE_IDS)[number];
|
|
360
|
+
declare const CATALOG_FONT_IDS: readonly ["inter", "fraunces", "manrope", "archivo", "bricolage"];
|
|
361
|
+
type CatalogFontId = (typeof CATALOG_FONT_IDS)[number];
|
|
362
|
+
declare const CATALOG_RADIUS_IDS: readonly ["compacto", "suave", "redondeado"];
|
|
363
|
+
type CatalogRadiusId = (typeof CATALOG_RADIUS_IDS)[number];
|
|
364
|
+
/** Validated appearance applied by the public catalog. */
|
|
365
|
+
interface CatalogAppearance {
|
|
366
|
+
paletteId: CatalogPaletteId;
|
|
367
|
+
fontId: CatalogFontId;
|
|
368
|
+
radiusId: CatalogRadiusId;
|
|
369
|
+
}
|
|
370
|
+
|
|
335
371
|
declare const CustomerOrderStatusSchema: z.ZodEnum<{
|
|
336
372
|
recibido: "recibido";
|
|
337
373
|
aprobado: "aprobado";
|
|
@@ -445,6 +481,8 @@ interface OrderCreationResult {
|
|
|
445
481
|
interface PublicOrderDetail {
|
|
446
482
|
orderId: string;
|
|
447
483
|
restaurantName: string;
|
|
484
|
+
/** Palette/font/radius the public catalog used; tracking follows the theme. */
|
|
485
|
+
appearance?: CatalogAppearance;
|
|
448
486
|
orderNumber: string;
|
|
449
487
|
orderName?: string | null;
|
|
450
488
|
status: CustomerOrderStatus;
|
|
@@ -726,6 +764,8 @@ interface LiveSessionBeacon {
|
|
|
726
764
|
/** Wire shape of GET /api/v1/public/catalog/:slug/sales/:receiptToken. */
|
|
727
765
|
interface SaleReceipt {
|
|
728
766
|
restaurantName: string;
|
|
767
|
+
/** Palette/font/radius the public catalog used; the receipt follows the theme. */
|
|
768
|
+
appearance?: CatalogAppearance;
|
|
729
769
|
receiptNumber: string;
|
|
730
770
|
orderName?: string | null;
|
|
731
771
|
status: 'completado';
|
|
@@ -898,4 +938,4 @@ declare function discoverElenaPublicConnection(options: ElenaKeyTransportOptions
|
|
|
898
938
|
};
|
|
899
939
|
}>;
|
|
900
940
|
|
|
901
|
-
export { AccessResource, type AppliedOrderCharge, AssetsResource, type BusinessCategory, type BusinessEventSummary, type BusinessInfo, type BusinessPaymentMethodDetail, type BusinessProduct, type BusinessSchedule, BusinessScope, type BusinessSocial, type BusinessStatus, type BusinessTable, type BusinessTicketTypeSummary, type CatalogMenu, CatalogResource, type ChatConnection, ChatResource, type ContinuationExchangeResult, ContinuationsResource, type CreateOrderInput, type CreateOrderOptions, type CustomerOrderStatus, type CustomizationGroup, type CustomizationOption, ElenaApiError, type ElenaApiErrorDetails, type ElenaCheckoutValidationCode, ElenaCheckoutValidationError, ElenaClientAssetResponseV1, ElenaClientCatalogV1, ElenaClientContextV1, type ElenaClientKeyClient, type ElenaClientKeyClientOptions, ElenaClientOptions, ElenaClientProductResponseV1, ElenaFetch, ElenaHttpClient, type ElenaJourneyClient, type ElenaJourneyClientOptions, ElenaKeyPageQuery, ElenaKeyRequestOptions, ElenaKeyTransportOptions, ElenaNetworkError, type ElenaPublicClient, ElenaRequestAbortedError, ElenaResponseError, ElenaTimeoutError, type EmittedTicket, type EventDetail, type EventTicketType, EventsResource, type HeroSlide, type JourneyActionRequired, type JourneyConfirmInput, type JourneyConfirmationResult, type JourneyConflictDetails, JourneyConflictError, type JourneyEventInput, type JourneyOrderResult, type JourneyParticipant, JourneyResource, type JourneySnapshot, type JourneyStateResult, type LiveSessionBeacon, type LiveSessionInput, type LiveSessionOrderType, type LiveSessionResult, type LiveSessionStatus, type MenuQuery, type OrderChargeDefinition, type OrderCreationResult, type OrderItemSelection, OrdersResource, type PaymentClaimInput, type PaymentClaimResult, PresenceResource, type PublicCatalogOrderItem, type PublicCatalogOrderPayload, type PublicOrderDetail, type RealtimeConnection, RealtimeResource, ReceiptsResource, type SaleReceipt, TablesResource, type TicketEmissionInput, type TicketEmissionResult, type TicketEstado, type TicketStatus, TicketsResource, buildOrderItems, createElenaClientKeyClient, createElenaJourneyClient, createElenaPublicClient, discoverElenaPublicConnection };
|
|
941
|
+
export { AccessResource, type AppliedOrderCharge, AssetsResource, type BusinessCategory, type BusinessEventSummary, type BusinessInfo, type BusinessPaymentMethodDetail, type BusinessProduct, type BusinessSchedule, BusinessScope, type BusinessSocial, type BusinessStatus, type BusinessTable, type BusinessTicketTypeSummary, type CatalogMenu, CatalogResource, type ChatConnection, ChatResource, type ContinuationExchangeResult, ContinuationsResource, type CreateOrderInput, type CreateOrderOptions, type CustomerOrderStatus, type CustomizationGroup, type CustomizationOption, ElenaApiError, type ElenaApiErrorDetails, type ElenaCheckoutValidationCode, ElenaCheckoutValidationError, ElenaClientAssetResponseV1, ElenaClientCatalogV1, ElenaClientContextV1, type ElenaClientKeyClient, type ElenaClientKeyClientOptions, ElenaClientOptions, ElenaClientProductResponseV1, ElenaFetch, ElenaHttpClient, type ElenaJourneyClient, type ElenaJourneyClientOptions, ElenaKeyPageQuery, ElenaKeyRequestOptions, ElenaKeyTransportOptions, ElenaNetworkError, type ElenaPublicClient, ElenaRequestAbortedError, ElenaResponseError, ElenaTimeoutError, type EmittedTicket, type EventDetail, type EventTicketType, EventsResource, type HeroSlide, type JourneyActionRequired, type JourneyConfirmInput, type JourneyConfirmationResult, type JourneyConflictDetails, JourneyConflictError, type JourneyEventInput, type JourneyOrderResult, type JourneyParticipant, JourneyResource, type JourneySnapshot, type JourneyStateResult, type LiveSessionBeacon, type LiveSessionInput, type LiveSessionOrderType, type LiveSessionResult, type LiveSessionStatus, type MenuQuery, type OrderChargeDefinition, type OrderCreationResult, type OrderItemSelection, OrdersResource, type PaymentClaimInput, type PaymentClaimResult, PresenceResource, type PublicCatalogOrderItem, type PublicCatalogOrderPayload, type PublicCatalogOrderReceipt, type PublicOrderDetail, type RealtimeConnection, RealtimeResource, ReceiptsResource, type SaleReceipt, TablesResource, type TicketEmissionInput, type TicketEmissionResult, type TicketEstado, type TicketStatus, TicketsResource, buildOrderItems, createElenaClientKeyClient, createElenaJourneyClient, createElenaPublicClient, discoverElenaPublicConnection };
|
package/dist/index.js
CHANGED
|
@@ -905,9 +905,10 @@ var elenaAgentScopeSchema = z2.enum([
|
|
|
905
905
|
"catalog:write",
|
|
906
906
|
"catalog:publish",
|
|
907
907
|
"assets:read",
|
|
908
|
-
"assets:write"
|
|
908
|
+
"assets:write",
|
|
909
|
+
"appearance:write"
|
|
909
910
|
]);
|
|
910
|
-
var elenaAgentScopesSchema = z2.array(elenaAgentScopeSchema).min(1).max(
|
|
911
|
+
var elenaAgentScopesSchema = z2.array(elenaAgentScopeSchema).min(1).max(6).refine((scopes) => new Set(scopes).size === scopes.length, "Duplicate scope").refine((scopes) => scopes.includes("catalog:read"), "catalog:read is mandatory");
|
|
911
912
|
var elenaAgentActionSchema = z2.enum([
|
|
912
913
|
"context.read",
|
|
913
914
|
"catalog.read",
|
|
@@ -916,7 +917,8 @@ var elenaAgentActionSchema = z2.enum([
|
|
|
916
917
|
"operations.read",
|
|
917
918
|
"operations.propose",
|
|
918
919
|
"operations.apply",
|
|
919
|
-
"catalog.publish"
|
|
920
|
+
"catalog.publish",
|
|
921
|
+
"appearance.write"
|
|
920
922
|
]);
|
|
921
923
|
var elenaAgentRestaurantSchema = z2.strictObject({
|
|
922
924
|
id: elenaAgentIdSchema,
|
|
@@ -1085,7 +1087,7 @@ var elenaAgentContextSchema = z2.strictObject({
|
|
|
1085
1087
|
media: z2.boolean(),
|
|
1086
1088
|
publication: z2.boolean()
|
|
1087
1089
|
}),
|
|
1088
|
-
actions: z2.array(elenaAgentActionSchema).min(1).max(
|
|
1090
|
+
actions: z2.array(elenaAgentActionSchema).min(1).max(9).refine((actions) => new Set(actions).size === actions.length, "Duplicate action")
|
|
1089
1091
|
}).superRefine((value, ctx) => {
|
|
1090
1092
|
const requiredScopes = {
|
|
1091
1093
|
"catalog.read": "catalog:read",
|
|
@@ -1093,13 +1095,15 @@ var elenaAgentContextSchema = z2.strictObject({
|
|
|
1093
1095
|
"assets.stage": "assets:write",
|
|
1094
1096
|
"operations.propose": "catalog:write",
|
|
1095
1097
|
"operations.apply": "catalog:write",
|
|
1096
|
-
"catalog.publish": "catalog:publish"
|
|
1098
|
+
"catalog.publish": "catalog:publish",
|
|
1099
|
+
"appearance.write": "appearance:write"
|
|
1097
1100
|
};
|
|
1098
1101
|
const writes = {
|
|
1099
1102
|
"assets.stage": true,
|
|
1100
1103
|
"operations.propose": true,
|
|
1101
1104
|
"operations.apply": true,
|
|
1102
|
-
"catalog.publish": true
|
|
1105
|
+
"catalog.publish": true,
|
|
1106
|
+
"appearance.write": true
|
|
1103
1107
|
};
|
|
1104
1108
|
for (const action of value.actions) {
|
|
1105
1109
|
if (value.principal.mode === "read" && writes[action]) {
|