@fayz-ai/core 0.17.0 → 0.19.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/access/engine.d.ts +15 -1
- package/dist/access/engine.d.ts.map +1 -1
- package/dist/access/index.js +2 -2
- package/dist/access/index.js.map +1 -1
- package/dist/app/app-config.d.ts +25 -0
- package/dist/app/app-config.d.ts.map +1 -1
- package/dist/{chunk-ED6NBH6U.js → chunk-3TRR2YLM.js} +2 -2
- package/dist/{chunk-ED6NBH6U.js.map → chunk-3TRR2YLM.js.map} +1 -1
- package/dist/{chunk-AOIYRUTF.js → chunk-4SPEISNL.js} +19 -5
- package/dist/chunk-4SPEISNL.js.map +1 -0
- package/dist/chunk-6TVRNKWW.js +17 -0
- package/dist/chunk-6TVRNKWW.js.map +1 -0
- package/dist/{chunk-OHH26S4N.js → chunk-7M4NWLIT.js} +9 -8
- package/dist/chunk-7M4NWLIT.js.map +1 -0
- package/dist/{chunk-2VY5IJW7.js → chunk-H6XDQXN5.js} +42 -14
- package/dist/chunk-H6XDQXN5.js.map +1 -0
- package/dist/{chunk-BCI743RH.js → chunk-HVWFFFKN.js} +4 -3
- package/dist/chunk-HVWFFFKN.js.map +1 -0
- package/dist/chunk-RBPDK2WB.js +104 -0
- package/dist/chunk-RBPDK2WB.js.map +1 -0
- package/dist/{chunk-2ZAUJVYP.js → chunk-S3EEGDEK.js} +122 -48
- package/dist/chunk-S3EEGDEK.js.map +1 -0
- package/dist/{chunk-KJUD6JA5.js → chunk-ZGAGCTQM.js} +6 -5
- package/dist/chunk-ZGAGCTQM.js.map +1 -0
- package/dist/connector-runtime/index.js +1 -1
- package/dist/data/archetype.d.ts +16 -0
- package/dist/data/archetype.d.ts.map +1 -1
- package/dist/data/bulk.d.ts.map +1 -1
- package/dist/data/index.js +3 -2
- package/dist/data/resolve.d.ts.map +1 -1
- package/dist/data/supabase.d.ts.map +1 -1
- package/dist/data/types.d.ts +13 -0
- package/dist/data/types.d.ts.map +1 -1
- package/dist/events/log.d.ts +1 -1
- package/dist/events/log.d.ts.map +1 -1
- package/dist/fields/store.d.ts +1 -1
- package/dist/fields/store.d.ts.map +1 -1
- package/dist/i18n/index.d.ts +11 -0
- package/dist/i18n/index.d.ts.map +1 -1
- package/dist/i18n/index.js +1 -1
- package/dist/i18n/shell-translations.en.d.ts.map +1 -1
- package/dist/i18n/shell-translations.pt-br.d.ts.map +1 -1
- package/dist/index.d.ts +11 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +58 -13
- package/dist/index.js.map +1 -1
- package/dist/integrations/index.d.ts +8 -8
- package/dist/integrations/index.d.ts.map +1 -1
- package/dist/integrations/index.js +4 -3
- package/dist/integrations/request.d.ts +2 -2
- package/dist/integrations/request.d.ts.map +1 -1
- package/dist/integrations/runtime.d.ts +1 -1
- package/dist/integrations/runtime.d.ts.map +1 -1
- package/dist/integrations/settings.d.ts +1 -1
- package/dist/integrations/settings.d.ts.map +1 -1
- package/dist/integrations/store.d.ts +7 -7
- package/dist/integrations/store.d.ts.map +1 -1
- package/dist/interaction/haptics.d.ts +5 -0
- package/dist/interaction/haptics.d.ts.map +1 -0
- package/dist/interaction/index.d.ts +7 -0
- package/dist/interaction/index.d.ts.map +1 -0
- package/dist/interaction/index.js +3 -0
- package/dist/interaction/index.js.map +1 -0
- package/dist/interaction/keymap.d.ts +17 -0
- package/dist/interaction/keymap.d.ts.map +1 -0
- package/dist/interaction/roving.d.ts +9 -0
- package/dist/interaction/roving.d.ts.map +1 -0
- package/dist/lib/address.d.ts +10 -0
- package/dist/lib/address.d.ts.map +1 -1
- package/dist/lib/error-message.d.ts +21 -0
- package/dist/lib/error-message.d.ts.map +1 -0
- package/dist/orders/index.d.ts +114 -0
- package/dist/orders/index.d.ts.map +1 -0
- package/dist/orders/index.js +168 -0
- package/dist/orders/index.js.map +1 -0
- package/dist/plugin/index.js +2 -1
- package/dist/plugin/runtime.d.ts.map +1 -1
- package/dist/registry/extension-points.d.ts.map +1 -1
- package/dist/{shell-translations.pt-br-ZSSVWG6H.js → shell-translations.pt-br-GFBWBZZJ.js} +28 -12
- package/dist/shell-translations.pt-br-GFBWBZZJ.js.map +1 -0
- package/dist/testing/index.js +5 -4
- package/dist/testing.d.ts.map +1 -1
- package/dist/types/auth.d.ts +12 -0
- package/dist/types/auth.d.ts.map +1 -1
- package/dist/types/crud.d.ts +42 -0
- package/dist/types/crud.d.ts.map +1 -1
- package/dist/types/onboarding.d.ts +25 -0
- package/dist/types/onboarding.d.ts.map +1 -1
- package/dist/types/plugins.d.ts +43 -0
- package/dist/types/plugins.d.ts.map +1 -1
- package/dist/types/setup-guide.d.ts +120 -0
- package/dist/types/setup-guide.d.ts.map +1 -0
- package/package.json +12 -3
- package/dist/chunk-2VY5IJW7.js.map +0 -1
- package/dist/chunk-2ZAUJVYP.js.map +0 -1
- package/dist/chunk-AOIYRUTF.js.map +0 -1
- package/dist/chunk-BCI743RH.js.map +0 -1
- package/dist/chunk-KJUD6JA5.js.map +0 -1
- package/dist/chunk-OHH26S4N.js.map +0 -1
- package/dist/shell-translations.pt-br-ZSSVWG6H.js.map +0 -1
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
// src/orders/index.ts
|
|
2
|
+
var OrderError = class extends Error {
|
|
3
|
+
constructor(message, cause) {
|
|
4
|
+
super(message);
|
|
5
|
+
this.cause = cause;
|
|
6
|
+
this.name = "OrderError";
|
|
7
|
+
}
|
|
8
|
+
};
|
|
9
|
+
function refuse(error, what) {
|
|
10
|
+
if (error?.code === "42501") throw new OrderError(`${what}: sem permiss\xE3o para isto.`);
|
|
11
|
+
throw new OrderError(`${what}: ${error?.message ?? "motivo desconhecido"}`, error);
|
|
12
|
+
}
|
|
13
|
+
var money = (cents) => Math.round(cents) / 100;
|
|
14
|
+
async function openOrder(ctx, input) {
|
|
15
|
+
const { data, error } = await ctx.db.rpc("order_create", {
|
|
16
|
+
p_kind: input.kind,
|
|
17
|
+
p_lines: (input.lines ?? []).map(toRpcLine),
|
|
18
|
+
p_party_id: input.partyId ?? null,
|
|
19
|
+
p_unit_id: ctx.unitId ?? null,
|
|
20
|
+
p_status: input.status ?? null,
|
|
21
|
+
p_channel: input.channel ?? null,
|
|
22
|
+
p_notes: input.notes ?? null,
|
|
23
|
+
p_metadata: { ...input.metadata ?? {}, source: ctx.source },
|
|
24
|
+
p_idempotency_key: input.idempotencyKey ?? null
|
|
25
|
+
});
|
|
26
|
+
if (error || !data) refuse(error, "O pedido n\xE3o foi aberto");
|
|
27
|
+
return data;
|
|
28
|
+
}
|
|
29
|
+
var toRpcLine = (l, index) => ({
|
|
30
|
+
product_id: l.productId ?? null,
|
|
31
|
+
name: l.name,
|
|
32
|
+
description: l.description ?? null,
|
|
33
|
+
quantity: l.quantity,
|
|
34
|
+
unit_price: money(l.unitPriceCents),
|
|
35
|
+
sort_order: index,
|
|
36
|
+
metadata: { ...l.metadata ?? {}, lineId: l.id, ...l.note ? { note: l.note } : {} }
|
|
37
|
+
});
|
|
38
|
+
async function addLines(ctx, orderId, lines) {
|
|
39
|
+
if (lines.length > 0) {
|
|
40
|
+
const { error } = await ctx.db.from("items").insert(lines.map((l, index) => ({
|
|
41
|
+
tenant_id: ctx.tenantId,
|
|
42
|
+
unit_id: ctx.unitId ?? null,
|
|
43
|
+
order_id: orderId,
|
|
44
|
+
product_id: l.productId ?? null,
|
|
45
|
+
name: l.name,
|
|
46
|
+
description: l.description ?? null,
|
|
47
|
+
quantity: l.quantity,
|
|
48
|
+
unit_price: money(l.unitPriceCents),
|
|
49
|
+
total: money(l.unitPriceCents * l.quantity),
|
|
50
|
+
sort_order: index,
|
|
51
|
+
metadata: { ...l.metadata ?? {}, lineId: l.id, source: ctx.source, ...l.note ? { note: l.note } : {} }
|
|
52
|
+
})));
|
|
53
|
+
if (error) refuse(error, "Os itens n\xE3o foram gravados");
|
|
54
|
+
}
|
|
55
|
+
return syncTotal(ctx, orderId);
|
|
56
|
+
}
|
|
57
|
+
async function syncTotal(ctx, orderId) {
|
|
58
|
+
const read = await ctx.db.from("items").select("total").eq("order_id", orderId).is("cancelled_at", null);
|
|
59
|
+
if (read.error) refuse(read.error, "O total do pedido n\xE3o foi apurado");
|
|
60
|
+
const total = Math.round((read.data ?? []).reduce((sum, r) => sum + Number(r.total ?? 0), 0) * 100) / 100;
|
|
61
|
+
const write = await ctx.db.from("orders").update({ subtotal: total, total }).eq("id", orderId);
|
|
62
|
+
if (write.error) refuse(write.error, "O total do pedido n\xE3o foi gravado");
|
|
63
|
+
return Math.round(total * 100);
|
|
64
|
+
}
|
|
65
|
+
async function setStatus(ctx, orderId, status) {
|
|
66
|
+
const { error } = await ctx.db.from("orders").update({ status }).eq("id", orderId);
|
|
67
|
+
if (error) refuse(error, `O pedido n\xE3o passou para "${status}"`);
|
|
68
|
+
}
|
|
69
|
+
async function invoiceOf(ctx, orderId) {
|
|
70
|
+
const { data, error } = await ctx.db.from("plg_financial_invoices").select("id, number, total, plg_financial_invoice_installments(id, amount)").eq("order_id", orderId).is("cancelled_at", null).limit(1).maybeSingle();
|
|
71
|
+
if (error) refuse(error, "A fatura n\xE3o foi encontrada");
|
|
72
|
+
if (!data) return null;
|
|
73
|
+
return {
|
|
74
|
+
id: data.id,
|
|
75
|
+
number: data.number,
|
|
76
|
+
totalCents: Math.round(Number(data.total ?? 0) * 100),
|
|
77
|
+
instalments: (data.plg_financial_invoice_installments ?? []).map(
|
|
78
|
+
(i) => ({ id: i.id, amountCents: Math.round(Number(i.amount) * 100) })
|
|
79
|
+
)
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
async function completeOrder(ctx, orderId) {
|
|
83
|
+
await syncTotal(ctx, orderId);
|
|
84
|
+
await setStatus(ctx, orderId, "completed");
|
|
85
|
+
const invoice = await invoiceOf(ctx, orderId);
|
|
86
|
+
if (!invoice) {
|
|
87
|
+
throw new OrderError("O pedido fechou sem gerar fatura \u2014 n\xE3o libere antes de conferir.");
|
|
88
|
+
}
|
|
89
|
+
return invoice;
|
|
90
|
+
}
|
|
91
|
+
var ACCOUNT_CODE = {
|
|
92
|
+
pix: "pix",
|
|
93
|
+
credit_card: "credito",
|
|
94
|
+
debit_card: "debito",
|
|
95
|
+
transfer: "pix"
|
|
96
|
+
};
|
|
97
|
+
var PAYMENT_METHODS = {
|
|
98
|
+
cash: "cash",
|
|
99
|
+
dinheiro: "cash",
|
|
100
|
+
pix: "pix",
|
|
101
|
+
card: "credit_card",
|
|
102
|
+
cartao: "credit_card",
|
|
103
|
+
"cart\xE3o": "credit_card",
|
|
104
|
+
credit: "credit_card",
|
|
105
|
+
debit: "debit_card",
|
|
106
|
+
debito: "debit_card",
|
|
107
|
+
"d\xE9bito": "debit_card"
|
|
108
|
+
};
|
|
109
|
+
async function receivePayment(ctx, input) {
|
|
110
|
+
const instalment = input.invoice.instalments[0];
|
|
111
|
+
if (!instalment) {
|
|
112
|
+
return { paid: false, warning: `Fatura ${input.invoice.number} sem parcela para baixar.` };
|
|
113
|
+
}
|
|
114
|
+
let accountId = null;
|
|
115
|
+
let cashSessionId = null;
|
|
116
|
+
const code = ACCOUNT_CODE[input.method];
|
|
117
|
+
if (code) {
|
|
118
|
+
const account = await ctx.db.from("plg_financial_accounts").select("id").eq("code", code).eq("is_active", true).limit(1).maybeSingle();
|
|
119
|
+
if (!account.data) {
|
|
120
|
+
return { paid: false, warning: `Fatura ${input.invoice.number} emitida; falta a conta "${code}" no Financeiro.` };
|
|
121
|
+
}
|
|
122
|
+
accountId = account.data.id;
|
|
123
|
+
} else {
|
|
124
|
+
const open = await ctx.db.from("plg_financial_cash_register_sessions").select("id").eq("status", "open").limit(1).maybeSingle();
|
|
125
|
+
cashSessionId = open.data?.id ?? null;
|
|
126
|
+
if (!cashSessionId) {
|
|
127
|
+
if (!input.openCashSession) {
|
|
128
|
+
return { paid: false, warning: `Fatura ${input.invoice.number} emitida; abra o caixa para receber em dinheiro.` };
|
|
129
|
+
}
|
|
130
|
+
const cofre = await ctx.db.from("plg_financial_accounts").select("id").eq("kind", "cash_physical").eq("is_active", true).limit(1).maybeSingle();
|
|
131
|
+
if (!cofre.data) {
|
|
132
|
+
return { paid: false, warning: `Fatura ${input.invoice.number} emitida; sem cofre para abrir o caixa.` };
|
|
133
|
+
}
|
|
134
|
+
const opened = await ctx.db.rpc("financial_cash_session_open", {
|
|
135
|
+
p_cofre_account_id: cofre.data.id,
|
|
136
|
+
p_opening_amount: 0
|
|
137
|
+
});
|
|
138
|
+
if (opened.error) {
|
|
139
|
+
return { paid: false, warning: `Fatura ${input.invoice.number} emitida; o caixa n\xE3o abriu (${opened.error.message}).` };
|
|
140
|
+
}
|
|
141
|
+
cashSessionId = opened.data.session_id;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
const amount = money(input.amountCents ?? instalment.amountCents);
|
|
145
|
+
const { error } = await ctx.db.rpc("financial_receive_payment", {
|
|
146
|
+
p_installment_id: instalment.id,
|
|
147
|
+
p_amount: amount,
|
|
148
|
+
p_account_id: accountId,
|
|
149
|
+
p_method: input.method,
|
|
150
|
+
p_cash_session_id: cashSessionId,
|
|
151
|
+
// The same bill confirmed twice must not take the money twice.
|
|
152
|
+
p_idempotency_key: `pay:${instalment.id}`,
|
|
153
|
+
p_metadata: { source: ctx.source }
|
|
154
|
+
});
|
|
155
|
+
if (error) {
|
|
156
|
+
return { paid: false, warning: `Fatura ${input.invoice.number} emitida; o pagamento n\xE3o foi baixado (${error.message}).` };
|
|
157
|
+
}
|
|
158
|
+
return { paid: true };
|
|
159
|
+
}
|
|
160
|
+
async function settle(ctx, orderId, payment) {
|
|
161
|
+
const invoice = await completeOrder(ctx, orderId);
|
|
162
|
+
const result = await receivePayment(ctx, { ...payment, invoice });
|
|
163
|
+
return { invoice, ...result };
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
export { OrderError, PAYMENT_METHODS, addLines, completeOrder, invoiceOf, openOrder, receivePayment, setStatus, settle, syncTotal };
|
|
167
|
+
//# sourceMappingURL=index.js.map
|
|
168
|
+
//# sour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A;AAAA;AAAA,IAEnB,iBAAA,EAAmB,CAAA,IAAA,EAAO,UAAA,CAAW,EAAE,CAAA,CAAA;AAAA,IACvC,UAAA,EAAY,EAAE,MAAA,EAAQ,GAAA,CAAI,MAAA;AAAO,GAClC,CAAA;AACD,EAAA,IAAI,KAAA,EAAO;AACT,IAAA,OAAO,EAAE,IAAA,EAAM,KAAA,EAAO,OAAA,EAAS,CAAA,OAAA,EAAU,KAAA,CAAM,OAAA,CAAQ,MAAM,CAAA,0CAAA,EAA0C,KAAA,CAAM,OAAO,CAAA,EAAA,CAAA,EAAK;AAAA,EAC3H;AACA,EAAA,OAAO,EAAE,MAAM,IAAA,EAAK;AACtB;AAQA,eAAsB,MAAA,CACpB,GAAA,EACA,OAAA,EACA,OAAA,EAC+C;AAC/C,EAAA,MAAM,OAAA,GAAU,MAAM,aAAA,CAAc,GAAA,EAAK,OAAO,CAAA;AAChD,EAAA,MAAM,MAAA,GAAS,MAAM,cAAA,CAAe,GAAA,EAAK,EAAE,GAAG,OAAA,EAAS,SAAS,CAAA;AAChE,EAAA,OAAO,EAAE,OAAA,EAAS,GAAG,MAAA,EAAO;AAC9B","file":"index.js","sourcesContent":["// ---------------------------------------------------------------------------\n// Order to cash, once.\n//\n// The PDV, the totem and anything else that sells write the SAME order: open\n// it, add lines, complete it, take the money. Three surfaces with three copies\n// of that sequence is three subtly different orders in one restaurant's books\n// — a totem sale that never raises a receivable, a till that writes its own\n// invoice rows beside the ones the cluster already numbers.\n//\n// So this module is a thin, shared vocabulary over what the cluster ALREADY\n// defines, and deliberately invents nothing:\n//\n// order_create(kind, …) opens the document\n// public.items the lines\n// orders.status = 'completed' raises the receivable, by trigger\n// financial_receive_payment(instalment, …) books the money\n//\n// It does not own the session: the caller passes a signed-in client, because\n// who a surface authenticates as (device user, kiosk user, real person) is a\n// decision each surface has to make for itself.\n// ---------------------------------------------------------------------------\n\nimport type { SupabaseClient } from '@supabase/supabase-js'\n\n/** Who is writing, and on whose behalf. */\nexport interface OrderContext {\n db: SupabaseClient\n tenantId: string\n unitId?: string\n /**\n * The writing surface, e.g. `chef-pos:caixa-01`. Stamped into metadata on\n * everything this module writes, because \"which machine did this\" is the\n * first question support asks and the last thing anyone can reconstruct.\n */\n source: string\n}\n\n/** A line as a selling surface holds it: cents, never a float. */\nexport interface OrderLine {\n /** The surface's own id for the line, kept so a reload returns the same line. */\n id: string\n /** public.products.id when the line is a catalogue item. */\n productId?: string\n name: string\n quantity: number\n unitPriceCents: number\n note?: string\n /**\n * What was done to the dish, in one line. Modifiers also ride in `metadata`,\n * but a printed kitchen ticket reads columns, not JSON — so the thing the\n * cook has to do differently belongs in one the ticket already shows.\n */\n description?: string\n /** Anything the surface needs back on reload: modifiers, state, timestamps. */\n metadata?: Record<string, unknown>\n}\n\nexport class OrderError extends Error {\n constructor(message: string, readonly cause?: unknown) {\n super(message)\n this.name = 'OrderError'\n }\n}\n\nfunction refuse(error: { message: string; code?: string } | null, what: string): never {\n if (error?.code === '42501') throw new OrderError(`${what}: sem permissão para isto.`)\n throw new OrderError(`${what}: ${error?.message ?? 'motivo desconhecido'}`, error)\n}\n\nconst money = (cents: number) => Math.round(cents) / 100\n\n// --- opening ----------------------------------------------------------------\n\nexport interface OpenOrderInput {\n /** A species registered in public.order_kinds: dine_in, takeout, delivery, sale. */\n kind: string\n /** Must be in that kind's status list. Defaults to the registry's own default. */\n status?: string\n /** Where the sale came from: 'pos', 'totem', 'whatsapp'. */\n channel?: string\n lines?: OrderLine[]\n partyId?: string\n notes?: string\n metadata?: Record<string, unknown>\n /** Replaying the same tap returns the same order instead of a second one. */\n idempotencyKey?: string\n}\n\n/** Opens the document. Returns the order id — from here on that IS the sale. */\nexport async function openOrder(ctx: OrderContext, input: OpenOrderInput): Promise<string> {\n const { data, error } = await ctx.db.rpc('order_create', {\n p_kind: input.kind,\n p_lines: (input.lines ?? []).map(toRpcLine),\n p_party_id: input.partyId ?? null,\n p_unit_id: ctx.unitId ?? null,\n p_status: input.status ?? null,\n p_channel: input.channel ?? null,\n p_notes: input.notes ?? null,\n p_metadata: { ...(input.metadata ?? {}), source: ctx.source },\n p_idempotency_key: input.idempotencyKey ?? null,\n })\n if (error || !data) refuse(error, 'O pedido não foi aberto')\n return data as string\n}\n\nconst toRpcLine = (l: OrderLine, index: number) => ({\n product_id: l.productId ?? null,\n name: l.name,\n description: l.description ?? null,\n quantity: l.quantity,\n unit_price: money(l.unitPriceCents),\n sort_order: index,\n metadata: { ...(l.metadata ?? {}), lineId: l.id, ...(l.note ? { note: l.note } : {}) },\n})\n\n// --- lines ------------------------------------------------------------------\n\n/**\n * Appends lines and leaves the header agreeing with them.\n *\n * The total is read back from the order rather than added up on the client:\n * another terminal may have written to the same comanda a second ago, and a\n * header computed from one screen's idea of the ticket is how a bill starts\n * disagreeing with its own lines.\n */\nexport async function addLines(\n ctx: OrderContext, orderId: string, lines: OrderLine[],\n): Promise<number> {\n if (lines.length > 0) {\n const { error } = await ctx.db.from('items').insert(lines.map((l, index) => ({\n tenant_id: ctx.tenantId,\n unit_id: ctx.unitId ?? null,\n order_id: orderId,\n product_id: l.productId ?? null,\n name: l.name,\n description: l.description ?? null,\n quantity: l.quantity,\n unit_price: money(l.unitPriceCents),\n total: money(l.unitPriceCents * l.quantity),\n sort_order: index,\n metadata: { ...(l.metadata ?? {}), lineId: l.id, source: ctx.source, ...(l.note ? { note: l.note } : {}) },\n })))\n if (error) refuse(error, 'Os itens não foram gravados')\n }\n return syncTotal(ctx, orderId)\n}\n\n/** Recomputes subtotal/total from the lines the order actually holds. */\nexport async function syncTotal(ctx: OrderContext, orderId: string): Promise<number> {\n const read = await ctx.db.from('items').select('total')\n .eq('order_id', orderId).is('cancelled_at', null)\n if (read.error) refuse(read.error, 'O total do pedido não foi apurado')\n const total = Math.round((read.data ?? []).reduce((sum, r) => sum + Number(r.total ?? 0), 0) * 100) / 100\n const write = await ctx.db.from('orders').update({ subtotal: total, total }).eq('id', orderId)\n if (write.error) refuse(write.error, 'O total do pedido não foi gravado')\n return Math.round(total * 100)\n}\n\n/** Moves the order along its own machine. The cluster refuses an illegal hop. */\nexport async function setStatus(ctx: OrderContext, orderId: string, status: string): Promise<void> {\n const { error } = await ctx.db.from('orders').update({ status }).eq('id', orderId)\n if (error) refuse(error, `O pedido não passou para \"${status}\"`)\n}\n\n// --- money ------------------------------------------------------------------\n\nexport interface Invoice {\n id: string\n number: string\n totalCents: number\n instalments: { id: string; amountCents: number }[]\n}\n\n/** The receivable behind an order, once there is one. */\nexport async function invoiceOf(ctx: OrderContext, orderId: string): Promise<Invoice | null> {\n const { data, error } = await ctx.db.from('plg_financial_invoices')\n .select('id, number, total, plg_financial_invoice_installments(id, amount)')\n .eq('order_id', orderId).is('cancelled_at', null).limit(1).maybeSingle()\n if (error) refuse(error, 'A fatura não foi encontrada')\n if (!data) return null\n return {\n id: data.id,\n number: data.number,\n totalCents: Math.round(Number(data.total ?? 0) * 100),\n instalments: (data.plg_financial_invoice_installments ?? []).map(\n (i: { id: string; amount: number | string }) => ({ id: i.id, amountCents: Math.round(Number(i.amount) * 100) }),\n ),\n }\n}\n\n/**\n * Completes the order, which is what RAISES the receivable — the cluster's\n * trigger does it in the same transaction, so a closed sale can never be\n * missing its invoice. No surface writes an invoice row of its own.\n */\nexport async function completeOrder(ctx: OrderContext, orderId: string): Promise<Invoice> {\n await syncTotal(ctx, orderId)\n await setStatus(ctx, orderId, 'completed')\n const invoice = await invoiceOf(ctx, orderId)\n if (!invoice) {\n throw new OrderError('O pedido fechou sem gerar fatura — não libere antes de conferir.')\n }\n return invoice\n}\n\n/** What a surface's payment button means to the ledger. */\nexport type PaymentMethod = 'cash' | 'pix' | 'credit_card' | 'debit_card' | 'transfer' | 'other'\n\n/** Which `plg_financial_accounts.code` settles each method. Cash has none: it\n * settles into the operator's open caixinha, which is a session, not a code. */\nconst ACCOUNT_CODE: Partial<Record<PaymentMethod, string>> = {\n pix: 'pix', credit_card: 'credito', debit_card: 'debito', transfer: 'pix',\n}\n\n/** The buttons a surface shows, in the words the ledger uses. */\nexport const PAYMENT_METHODS: Record<string, PaymentMethod> = {\n cash: 'cash', dinheiro: 'cash',\n pix: 'pix',\n card: 'credit_card', cartao: 'credit_card', 'cartão': 'credit_card', credit: 'credit_card',\n debit: 'debit_card', debito: 'debit_card', 'débito': 'debit_card',\n}\n\nexport interface PaymentResult {\n paid: boolean\n /** Set when the invoice stands but the money could not be booked. */\n warning?: string\n}\n\nexport interface ReceivePaymentInput {\n invoice: Invoice\n method: PaymentMethod\n /** Defaults to the instalment's full amount. */\n amountCents?: number\n /**\n * Cash needs an open caixinha. `true` lets this open one with a counted\n * opening of zero rather than refuse the banknote — a stand-in until the\n * surface has a real shift-opening screen, and it is visible in the ledger.\n */\n openCashSession?: boolean\n}\n\nexport async function receivePayment(\n ctx: OrderContext, input: ReceivePaymentInput,\n): Promise<PaymentResult> {\n const instalment = input.invoice.instalments[0]\n if (!instalment) {\n return { paid: false, warning: `Fatura ${input.invoice.number} sem parcela para baixar.` }\n }\n\n let accountId: string | null = null\n let cashSessionId: string | null = null\n const code = ACCOUNT_CODE[input.method]\n\n if (code) {\n const account = await ctx.db.from('plg_financial_accounts').select('id')\n .eq('code', code).eq('is_active', true).limit(1).maybeSingle()\n if (!account.data) {\n return { paid: false, warning: `Fatura ${input.invoice.number} emitida; falta a conta \"${code}\" no Financeiro.` }\n }\n accountId = account.data.id\n } else {\n const open = await ctx.db.from('plg_financial_cash_register_sessions')\n .select('id').eq('status', 'open').limit(1).maybeSingle()\n cashSessionId = open.data?.id ?? null\n if (!cashSessionId) {\n if (!input.openCashSession) {\n return { paid: false, warning: `Fatura ${input.invoice.number} emitida; abra o caixa para receber em dinheiro.` }\n }\n const cofre = await ctx.db.from('plg_financial_accounts').select('id')\n .eq('kind', 'cash_physical').eq('is_active', true).limit(1).maybeSingle()\n if (!cofre.data) {\n return { paid: false, warning: `Fatura ${input.invoice.number} emitida; sem cofre para abrir o caixa.` }\n }\n const opened = await ctx.db.rpc('financial_cash_session_open', {\n p_cofre_account_id: cofre.data.id, p_opening_amount: 0,\n })\n if (opened.error) {\n return { paid: false, warning: `Fatura ${input.invoice.number} emitida; o caixa não abriu (${opened.error.message}).` }\n }\n cashSessionId = (opened.data as { session_id: string }).session_id\n }\n }\n\n const amount = money(input.amountCents ?? instalment.amountCents)\n const { error } = await ctx.db.rpc('financial_receive_payment', {\n p_installment_id: instalment.id,\n p_amount: amount,\n p_account_id: accountId,\n p_method: input.method,\n p_cash_session_id: cashSessionId,\n // The same bill confirmed twice must not take the money twice.\n p_idempotency_key: `pay:${instalment.id}`,\n p_metadata: { source: ctx.source },\n })\n if (error) {\n return { paid: false, warning: `Fatura ${input.invoice.number} emitida; o pagamento não foi baixado (${error.message}).` }\n }\n return { paid: true }\n}\n\n/**\n * The whole tail of a sale: complete, get the invoice, book the money. The\n * invoice is returned even when the payment leg fails, because the receivable\n * is real either way and the surface has to say so rather than pretend the\n * close did not happen.\n */\nexport async function settle(\n ctx: OrderContext,\n orderId: string,\n payment: Omit<ReceivePaymentInput, 'invoice'>,\n): Promise<{ invoice: Invoice } & PaymentResult> {\n const invoice = await completeOrder(ctx, orderId)\n const result = await receivePayment(ctx, { ...payment, invoice })\n return { invoice, ...result }\n}\n"]}
|
package/dist/plugin/index.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
export { PluginRuntimeProvider, definePlugin, getWidgetsForZone, resolvePluginRuntime, usePluginRuntime, usePluginRuntimeOptional } from '../chunk-
|
|
1
|
+
export { PluginRuntimeProvider, definePlugin, getWidgetsForZone, resolvePluginRuntime, usePluginRuntime, usePluginRuntimeOptional } from '../chunk-4SPEISNL.js';
|
|
2
2
|
import '../chunk-EWKX4VUM.js';
|
|
3
|
+
import '../chunk-6TVRNKWW.js';
|
|
3
4
|
import '../chunk-CU64QI4A.js';
|
|
4
5
|
//# sourceMappingURL=index.js.map
|
|
5
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/plugin/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,oBAAoB,EAKpB,gBAAgB,EAEhB,oBAAoB,EACpB,mBAAmB,EAMnB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"runtime.d.ts","sourceRoot":"","sources":["../../src/plugin/runtime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,EACV,cAAc,EACd,aAAa,EACb,oBAAoB,EAKpB,gBAAgB,EAEhB,oBAAoB,EACpB,mBAAmB,EAMnB,uBAAuB,EAEvB,gBAAgB,EAEjB,MAAM,kBAAkB,CAAA;AACzB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,oBAAoB,CAAA;AAM/D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAA;AAI1D;8DAC8D;AAC9D,eAAO,MAAM,kBAAkB,IAAI,CAAA;AAEnC;+EAC+E;AAC/E,wBAAgB,sBAAsB,CACpC,GAAG,EAAE;IAAE,SAAS,CAAC,EAAE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACtE,KAAK,CAAC,aAAa,CAAC,OAAO,CAAC,GAAG,SAAS,CAI1C;AAED,UAAU,2BAA2B;IACnC,OAAO,CAAC,EAAE,cAAc,EAAE,CAAA;IAC1B,aAAa,CAAC,EAAE,mBAAmB,EAAE,CAAA;IACrC,iBAAiB,CAAC,EAAE,OAAO,CAAA;IAC3B,OAAO,EAAE,oBAAoB,CAAA;CAC9B;AA8ED,wBAAgB,YAAY,CAAC,CAAC,SAAS,cAAc,EAAE,MAAM,EAAE,CAAC,GAAG,CAAC,CAEnE;AAED,wBAAgB,oBAAoB,CAAC,EACnC,OAAY,EACZ,aAAkB,EAClB,iBAAiB,EACjB,OAAO,GACR,EAAE,2BAA2B,GAAG,aAAa,CA+O7C;AAED,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,aAAa,EACtB,IAAI,EAAE,gBAAgB,EACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,GAC/C,oBAAoB,EAAE,CAGxB;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,aAAa,EACtB,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,mEAAmE;IACnE,UAAU,CAAC,EAAE,OAAO,CAAA;IACpB,+DAA+D;IAC/D,OAAO,CAAC,EAAE,gBAAgB,CAAA;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAA;CAC5C,GACL,qBAAqB,EAAE,CAezB;AAED,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,aAAa,EACtB,OAAO,EAAE;IAAE,OAAO,EAAE,gBAAgB,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC,oBAAoB,CAAC,CAAA;CAAE,GACxG,uBAAuB,EAAE,CAU3B;AAED,QAAA,MAAM,oBAAoB,qCAAkD,CAAA;AAC5E,eAAO,MAAM,qBAAqB,sCAAgC,CAAA;AAElE,wBAAgB,gBAAgB,IAAI,aAAa,CAEhD;AAED,wBAAgB,wBAAwB,IAAI,aAAa,GAAG,IAAI,CAE/D;AAED,iFAAiF;AACjF,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,mBAAmB,EAAE,CAElF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extension-points.d.ts","sourceRoot":"","sources":["../../src/registry/extension-points.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"extension-points.d.ts","sourceRoot":"","sources":["../../src/registry/extension-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AmB,IAAI,MAAM,EAAE,CAE9C;AAED;oDACoD;AACpD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAG/D;AAED,oDAAoD;AACpD,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C;AAID;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,EAClD,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,SAAS,CAAC,MAAM,CAAC,GAAG,MAAM,CAAC,EAAE,GACrC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,EAAE,EAAE,MAAM,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAY/E"}
|
|
@@ -95,6 +95,7 @@ var shellTranslationsPtBr = {
|
|
|
95
95
|
"crud.list.searchPlaceholder": "Buscar {{entities}}...",
|
|
96
96
|
"crud.list.allFacet": "Todos",
|
|
97
97
|
"crud.list.addButton": "+ Adicionar {{entity}}",
|
|
98
|
+
"crud.list.pageN": "P\xE1gina {{page}}",
|
|
98
99
|
"crud.list.rangeCount": "{{from}}\u2013{{to}} de {{total}} {{entities}}",
|
|
99
100
|
"crud.list.pageOf": "{{page}} / {{pages}}",
|
|
100
101
|
"crud.list.prevPage": "P\xE1gina anterior",
|
|
@@ -315,6 +316,8 @@ var shellTranslationsPtBr = {
|
|
|
315
316
|
"banner.overLimit.unlock": "Nada foi bloqueado. O {plan} tira esse teto do seu caminho.",
|
|
316
317
|
"banner.overLimit.body": "Nada foi bloqueado \u2014 mas esse \xE9 o teto do seu plano.",
|
|
317
318
|
"banner.overLimit.ctaPriced": "Assinar {plan} \u2014 {price}/m\xEAs",
|
|
319
|
+
"banner.overLimit.ctaPlan": "Assinar {plan}",
|
|
320
|
+
"banner.overLimit.perMonth": "{price}/m\xEAs",
|
|
318
321
|
"banner.overLimit.compare": "Comparar planos",
|
|
319
322
|
"banner.overLimit.more": "+{count} outro(s) limite(s) no teto.",
|
|
320
323
|
"limit.label.clients": "clientes",
|
|
@@ -380,6 +383,19 @@ var shellTranslationsPtBr = {
|
|
|
380
383
|
"shell.error.copied": "Copiado",
|
|
381
384
|
"shell.error.reference": "Informe este c\xF3digo ao falar com o suporte",
|
|
382
385
|
"organization.workspaces": "\xC1reas de trabalho",
|
|
386
|
+
"organization.chooseWorkspace": "Escolha uma \xE1rea de trabalho",
|
|
387
|
+
"organization.chooseWorkspaceDescription": "Voc\xEA tem acesso a mais de uma. Selecione em qual deseja entrar.",
|
|
388
|
+
"organization.lastUsed": "\xFAltimo acesso",
|
|
389
|
+
"organization.rememberChoice": "N\xE3o perguntar novamente neste dispositivo",
|
|
390
|
+
"organization.enter": "Entrar",
|
|
391
|
+
"organization.entryPreference": "Ao entrar",
|
|
392
|
+
"organization.entryAsk": "Perguntar sempre",
|
|
393
|
+
"organization.entryLast": "Abrir a \xFAltima usada",
|
|
394
|
+
"organization.switching.eyebrow": "Entrando em",
|
|
395
|
+
"organization.switching.step1": "Alterando organiza\xE7\xE3o",
|
|
396
|
+
"organization.switching.step2": "Garantindo seguran\xE7a dos dados",
|
|
397
|
+
"organization.switching.step3": "Carregando suas informa\xE7\xF5es",
|
|
398
|
+
"organization.switchLaterHint": "Voc\xEA pode trocar a qualquer momento pelo seletor no topo da tela.",
|
|
383
399
|
"organization.onlyWorkspace": "Esta \xE9 a sua \xFAnica \xE1rea de trabalho.",
|
|
384
400
|
"crud.form.requiredIndicator": "*",
|
|
385
401
|
"crud.form.createDescription": "Criar um(a) novo(a) {{entity}}.",
|
|
@@ -564,16 +580,7 @@ var shellTranslationsPtBr = {
|
|
|
564
580
|
"chat.greetingNamed": "Oi {{name}}, como posso ajudar?",
|
|
565
581
|
"chat.greetingHint": "Pe\xE7a com suas palavras \u2014 ou toque no microfone e fale. Eu consulto seus dados, crio e atualizo cadastros, e explico o que est\xE1 acontecendo no seu neg\xF3cio.",
|
|
566
582
|
"chat.disclaimer": "A IA pode errar. Confira o que for importante.",
|
|
567
|
-
"chat.
|
|
568
|
-
"chat.staff.switch": "Falar com outra pessoa da equipe",
|
|
569
|
-
"chat.staff.hire": "Conhecer {{name}}",
|
|
570
|
-
"chat.staff.hireNote": "{{name}} entra na sua equipe assim que o plano for ativado. Voc\xEA pode cancelar quando quiser.",
|
|
571
|
-
"chat.staff.priceFrom": "A partir de",
|
|
572
|
-
"chat.staff.perMonth": "/m\xEAs",
|
|
573
|
-
"chat.staff.onPlan": "no plano {{plan}}",
|
|
574
|
-
"chat.staff.priceOnPlans": "Veja nos planos o que inclui cada agente.",
|
|
575
|
-
"chat.staff.seePlans": "Ver planos",
|
|
576
|
-
"chat.staff.notHired": "N\xE3o contratado",
|
|
583
|
+
"chat.agent.talkTo": "Falar com",
|
|
577
584
|
"chat.staff.handoffFrom": "{{from}} passou para {{to}}",
|
|
578
585
|
"chat.staff.handoffTo": "{{to}} assumiu",
|
|
579
586
|
"chat.opener.capabilities": "O que voc\xEA consegue fazer aqui?",
|
|
@@ -600,6 +607,9 @@ var shellTranslationsPtBr = {
|
|
|
600
607
|
"chat.confirmAction.fillRequired": "Preencha para continuar: {{fields}}",
|
|
601
608
|
"chat.confirmAction.showAll": "Preencher mais campos ({{count}})",
|
|
602
609
|
"chat.confirmAction.showLess": "Mostrar menos campos",
|
|
610
|
+
"chat.confirmAction.queued": "Mais {{count}} igual a esta na fila",
|
|
611
|
+
"chat.confirmAction.confirmAll": "Confirmar todas ({{count}})",
|
|
612
|
+
"chat.confirmAction.cancelAll": "Recusar todas",
|
|
603
613
|
"chat.tool.createAppointment": "Marcar hor\xE1rio",
|
|
604
614
|
"chat.tool.createRecord": "Criar registro",
|
|
605
615
|
"chat.tool.updateRecord": "Atualizar registro",
|
|
@@ -878,6 +888,12 @@ var shellTranslationsPtBr = {
|
|
|
878
888
|
"crud.archetype.addresses.noTenant": "Nenhuma organiza\xE7\xE3o ativa \u2014 recarregue a p\xE1gina e tente de novo.",
|
|
879
889
|
"crud.archetype.schedule.title": "Agenda",
|
|
880
890
|
"crud.archetype.schedule.description": "Visualize e gerencie compromissos, turnos e disponibilidade desta pessoa.",
|
|
891
|
+
"crud.archetype.bookable.title": "Aparece na agenda",
|
|
892
|
+
"crud.archetype.bookable.descriptionOn": "Clientes podem ser marcados com esta pessoa, e ela ganha coluna pr\xF3pria na agenda.",
|
|
893
|
+
"crud.archetype.bookable.descriptionOff": "Esta pessoa n\xE3o atende clientes. Os hor\xE1rios abaixo continuam guardados, mas ningu\xE9m \xE9 marcado com ela.",
|
|
894
|
+
"crud.archetype.bookable.on": "Agora aparece na agenda",
|
|
895
|
+
"crud.archetype.bookable.off": "Saiu da agenda",
|
|
896
|
+
"crud.archetype.bookable.saveFailed": "N\xE3o foi poss\xEDvel mudar a presen\xE7a na agenda.",
|
|
881
897
|
"crud.archetype.inventory.title": "Estoque",
|
|
882
898
|
"crud.archetype.inventory.description": "Acompanhe n\xEDveis de estoque, hist\xF3rico de movimenta\xE7\xE3o, alertas de reposi\xE7\xE3o e gerencie o invent\xE1rio entre locais.",
|
|
883
899
|
"crud.archetype.suppliers.title": "Fornecedores",
|
|
@@ -1064,5 +1080,5 @@ var shellTranslationsPtBr = {
|
|
|
1064
1080
|
};
|
|
1065
1081
|
|
|
1066
1082
|
export { shellTranslationsPtBr };
|
|
1067
|
-
//# sourceMappingURL=shell-translations.pt-br-
|
|
1068
|
-
//# sourceMappingURL=shell-translations.pt-br-
|
|
1083
|
+
//# sourceMappingURL=shell-translations.pt-br-GFBWBZZJ.js.map
|
|
1084
|
+
//# sourceMappingURL=shell-translations.pt-br-GFBWBZZJ.js.map
|