@fayz-ai/plugin-shop 0.11.2 → 0.13.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.
Files changed (66) hide show
  1. package/dist/{ShopPage-YB5ZWECJ.js → ShopPage-QFIM2HDU.js} +1516 -406
  2. package/dist/ShopPage-QFIM2HDU.js.map +1 -0
  3. package/dist/{chunk-HAKXHHAG.js → chunk-2VMTPRGC.js} +202 -11
  4. package/dist/chunk-2VMTPRGC.js.map +1 -0
  5. package/dist/index.d.ts +2 -0
  6. package/dist/index.d.ts.map +1 -1
  7. package/dist/index.js +1814 -442
  8. package/dist/index.js.map +1 -1
  9. package/dist/integrations/abacatepay/connectorDef.d.ts.map +1 -1
  10. package/dist/integrations/abacatepay/data.d.ts +40 -0
  11. package/dist/integrations/abacatepay/data.d.ts.map +1 -0
  12. package/dist/integrations/abacatepay/limits.d.ts +26 -0
  13. package/dist/integrations/abacatepay/limits.d.ts.map +1 -0
  14. package/dist/integrations/abacatepay/sync.d.ts +88 -0
  15. package/dist/integrations/abacatepay/sync.d.ts.map +1 -0
  16. package/dist/integrations/bling/data.d.ts.map +1 -1
  17. package/dist/integrations/mercadopago/connectorDef.d.ts +41 -0
  18. package/dist/integrations/mercadopago/connectorDef.d.ts.map +1 -0
  19. package/dist/integrations/neochef/connectorDef.d.ts +12 -0
  20. package/dist/integrations/neochef/connectorDef.d.ts.map +1 -0
  21. package/dist/integrations/neochef/data.d.ts +54 -0
  22. package/dist/integrations/neochef/data.d.ts.map +1 -0
  23. package/dist/integrations/neochef/index.d.ts +8 -0
  24. package/dist/integrations/neochef/index.d.ts.map +1 -0
  25. package/dist/integrations/neochef/limits.d.ts +26 -0
  26. package/dist/integrations/neochef/limits.d.ts.map +1 -0
  27. package/dist/integrations/neochef/mapping.d.ts +31 -0
  28. package/dist/integrations/neochef/mapping.d.ts.map +1 -0
  29. package/dist/integrations/neochef/mark.d.ts +21 -0
  30. package/dist/integrations/neochef/mark.d.ts.map +1 -0
  31. package/dist/integrations/neochef/types.d.ts +71 -0
  32. package/dist/integrations/neochef/types.d.ts.map +1 -0
  33. package/dist/integrations/vindi/connectorDef.d.ts +67 -35
  34. package/dist/integrations/vindi/connectorDef.d.ts.map +1 -1
  35. package/dist/views/ContentPage.d.ts.map +1 -1
  36. package/dist/views/CustomerModal.d.ts +33 -0
  37. package/dist/views/CustomerModal.d.ts.map +1 -0
  38. package/dist/views/NewOrderCharge.d.ts +39 -3
  39. package/dist/views/NewOrderCharge.d.ts.map +1 -1
  40. package/dist/views/NewOrderPage.d.ts +10 -1
  41. package/dist/views/NewOrderPage.d.ts.map +1 -1
  42. package/dist/views/OrderDetailView.d.ts.map +1 -1
  43. package/dist/views/OrdersAgentSurface.d.ts +10 -0
  44. package/dist/views/OrdersAgentSurface.d.ts.map +1 -0
  45. package/dist/views/ProductPositionsTab.d.ts +7 -0
  46. package/dist/views/ProductPositionsTab.d.ts.map +1 -0
  47. package/dist/views/ProductStockTab.d.ts +84 -0
  48. package/dist/views/ProductStockTab.d.ts.map +1 -0
  49. package/dist/views/ShopPage.d.ts.map +1 -1
  50. package/dist/views/StockEntryModal.d.ts +32 -0
  51. package/dist/views/StockEntryModal.d.ts.map +1 -0
  52. package/dist/views/customerEntity.d.ts.map +1 -1
  53. package/dist/views/discount-agent.d.ts +2 -0
  54. package/dist/views/discount-agent.d.ts.map +1 -0
  55. package/dist/views/new-order-rules.d.ts +23 -1
  56. package/dist/views/new-order-rules.d.ts.map +1 -1
  57. package/dist/views/orders-agent.d.ts +11 -0
  58. package/dist/views/orders-agent.d.ts.map +1 -0
  59. package/dist/views/product-matching.d.ts +38 -0
  60. package/dist/views/product-matching.d.ts.map +1 -0
  61. package/dist/views/productEntity.d.ts.map +1 -1
  62. package/dist/views/stock-agent.d.ts +82 -0
  63. package/dist/views/stock-agent.d.ts.map +1 -0
  64. package/package.json +8 -6
  65. package/dist/ShopPage-YB5ZWECJ.js.map +0 -1
  66. package/dist/chunk-HAKXHHAG.js.map +0 -1
@@ -13,35 +13,48 @@ export declare const VINDI_CONNECTOR_ID = "vindi";
13
13
  */
14
14
  export declare const VINDI_LATENCY_BUDGET_MS = 6000;
15
15
  /**
16
- * The one thing that authorizes the connection.
17
- *
18
- * `type: 'password'` is what routes it to the platform's credential sink
19
- * (packages/admin/.../connect/credentials.ts) instead of to `saveConnection`;
20
- * `secret: true` states the same thing on the field itself, so the intent
21
- * survives a future change of input type.
22
- *
23
- * ── why there is no second field, and what it costs ─────────────────────────
24
- *
25
- * `token_account` opens a transaction and reads it back, which is the buyer's
26
- * whole path. It cannot CANCEL one: `PATCH /transactions/cancel` takes an
27
- * `access_token` and nothing else.
28
- *
29
- * Getting an access_token is not a matter of asking for one more secret. Vindi's
30
- * chain is consumer_key → **CODE** → access_token, the CODE is copied out of a
31
- * browser's address bar by the account owner "uma vez por ambiente", and the
32
- * resulting token lives 24 hours and has to be renewed daily against a refresh
33
- * token that would have to be written back somewhere. The platform refreshes
34
- * credentials for `oauth` connectors registered in its broker, and Vindi cannot
35
- * be one (see the file header). So the machinery does not exist, and asking a
36
- * merchant for a consumer pair we cannot turn into a token would be asking for a
37
- * secret in exchange for nothing.
38
- *
39
- * **The consequence, stated rather than hidden:** when a payment lands and the
40
- * order cannot be written, this connector does NOT give the money back by itself
41
- * — unlike the AbacatePay path, where *dinheiro recebido sem pedido tem um final
42
- * correto só*. `vindi-checkout-settle` marks the session failed and reports the
43
- * transaction id loudly; the merchant refunds in Vindi's own panel. Automatic
44
- * reversal is phase 2, and it arrives with the token lifecycle or not at all.
16
+ * As URLs onde o dono da conta busca o CODE, uma por ambiente.
17
+ *
18
+ * Não é uma tela de consentimento: a Vindi aceita `consumer_key` e mais nada —
19
+ * sem `redirect_uri`, sem `state`, sem escopos — e devolve o CODE na barra de
20
+ * endereço para ser copiado à mão. É por isso que o conector segue `api-key` e
21
+ * não `oauth`: não há nada que o broker da plataforma possa assinar aqui.
22
+ */
23
+ export declare const VINDI_AUTHENTICATION_URLS: Record<string, string>;
24
+ /**
25
+ * O que autoriza a conexão — e são QUATRO coisas, não uma, porque a Vindi tem
26
+ * duas credenciais que abrem portas diferentes.
27
+ *
28
+ * `type: 'password'` é o que roteia cada uma para o cofre da plataforma
29
+ * (packages/admin/.../connect/credentials.ts) em vez do `saveConnection`;
30
+ * `secret: true` diz a mesma coisa no próprio campo, para a intenção sobreviver
31
+ * a uma troca futura do tipo de input.
32
+ *
33
+ * ── o token da conta, e onde ele PARA ───────────────────────────────────────
34
+ *
35
+ * `tokenAccount` abre uma transação e a relê: Pix, boleto e o carrinho de
36
+ * cartão vivem inteiramente dele. O que ele não faz é falar com a v3 — medido,
37
+ * não suposto: `POST /api/v3/charges` respondeu **401** às três formas de
38
+ * mandá-lo (corpo, Bearer, cabeçalho) no pool de produção em 25/08.
39
+ *
40
+ * ── a chave de consumidor, e o que ela compra ──────────────────────────────
41
+ *
42
+ * A v3 é o que emite um LINK DE PAGAMENTO de verdade — `pagar.vindi.com.br/…`,
43
+ * com um `id` que a loja pode consultar depois. O carrinho da v1 devolve um
44
+ * endereço parecido e sem id: ninguém pode perguntar por ele, e a venda só se
45
+ * liquida se um webhook chegar. Era o que a loja tinha antes disto.
46
+ *
47
+ * O preço é uma corrente de três passos, e o do meio é manual:
48
+ * `consumer_key` + `consumer_secret` (painel da Vindi) → abrir
49
+ * {@link VINDI_AUTHENTICATION_URLS} no navegador e copiar o CODE da barra de
50
+ * endereço → `access_token` (24 h) + `refresh_token` (1 ano). A renovação
51
+ * diária é automática e acontece na função de borda; o CODE se digita uma vez
52
+ * por ambiente.
53
+ *
54
+ * Os três são OPCIONAIS de propósito. Uma loja que só vende Pix na própria
55
+ * página nunca precisou deles, e torná-los obrigatórios jogaria toda conexão que
56
+ * funciona hoje para "falta configurar". O que falta sem eles é o link — e quem
57
+ * pedir um recebe a frase que diz exatamente isto, em vez de um endereço mudo.
45
58
  */
46
59
  export declare const VINDI_FIELDS: ConnectorField[];
47
60
  /**
@@ -57,20 +70,39 @@ export declare const VINDI_FIELDS: ConnectorField[];
57
70
  * sentence to read at speed.
58
71
  */
59
72
  export declare const VINDI_ENVIRONMENT_SETTING: ConnectorSetting;
73
+ /** Vindi's credit card id — the one method that is not paid on our page. */
74
+ export declare const VINDI_CARD_METHOD = "3";
60
75
  /**
61
- * Which methods the storefront may offer — commercial policy, not a credential.
76
+ * Which methods the merchant offers — commercial policy, not a credential.
62
77
  *
63
78
  * The values are Vindi's own `payment_method_id`, as numbers-in-strings, because
64
79
  * that is what travels to it on the wire. A translation table between what the
65
80
  * merchant picked and what the API accepts is one more place for a method to
66
81
  * silently stop being offered.
67
82
  *
68
- * Credit card (`3`) is absent on purpose. Vindi's transparent card flow takes
69
- * `card_number` in the request body, which would put a PAN inside our edge
70
- * function — the same rule that already kept card off the AbacatePay path. Card
71
- * arrives through Vindi's hosted `url_payment` page, in phase 2, and offering it
72
- * here today would promise a checkout option nothing can open.
83
+ * ── card is here, and it is NOT the same kind of thing as the others ────────
84
+ *
85
+ * Pix, Bolepix and boleto are opened by our own edge function and paid inside
86
+ * the store: a QR code and a barcode are public strings, so nothing sensitive
87
+ * is ever ours to hold.
88
+ *
89
+ * Card cannot work that way. Vindi's transparent card call takes `card_number`,
90
+ * `card_cvv` and the expiry in the request body, and a PAN crossing our edge
91
+ * function drags the whole pool into PCI scope — an audit and an architecture,
92
+ * not a feature. So card is opened as a CART and paid on Vindi's own page: the
93
+ * buyer is redirected, types the number under Vindi's certificate, and comes
94
+ * back. That is the cost, and it is stated to the merchant in the panel below
95
+ * rather than discovered by a buyer.
73
96
  */
74
97
  export declare const VINDI_SETTINGS: ConnectorSetting[];
98
+ /**
99
+ * The required-to-operate list for THIS connection, which is not a constant.
100
+ *
101
+ * A merchant who enabled card owes us a postcode; one who did not, does not. A
102
+ * static declaration could only choose between nagging every Pix-only store
103
+ * forever and letting a card checkout fail at the moment of paying — and the
104
+ * second is a buyer's problem, which is the one kind we do not get to ship.
105
+ */
106
+ export declare function requiredSettingsFor(settings: Record<string, unknown> | undefined): ConnectorSetting[];
75
107
  export declare const vindiConnectorDef: ConnectorDefinition;
76
108
  //# sourceMappingURL=connectorDef.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"connectorDef.d.ts","sourceRoot":"","sources":["../../../src/integrations/vindi/connectorDef.tsx"],"names":[],"mappings":"AA2BA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAA;AAEtB,eAAO,MAAM,kBAAkB,UAAU,CAAA;AAEzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAA;AAE3C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,EAQxC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yBAAyB,EAAE,gBAUvC,CAAA;AAED;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,cAAc,EAAE,gBAAgB,EAc5C,CAAA;AAqED,eAAO,MAAM,iBAAiB,EAAE,mBA8F/B,CAAA"}
1
+ {"version":3,"file":"connectorDef.d.ts","sourceRoot":"","sources":["../../../src/integrations/vindi/connectorDef.tsx"],"names":[],"mappings":"AAmCA,OAAO,EAKL,KAAK,mBAAmB,EACxB,KAAK,cAAc,EACnB,KAAK,gBAAgB,EACtB,MAAM,eAAe,CAAA;AAEtB,eAAO,MAAM,kBAAkB,UAAU,CAAA;AAEzC;;;;;;;;;;GAUG;AACH,eAAO,MAAM,uBAAuB,OAAO,CAAA;AAE3C;;;;;;;GAOG;AACH,eAAO,MAAM,yBAAyB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAG5D,CAAA;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkCG;AACH,eAAO,MAAM,YAAY,EAAE,cAAc,EA6BxC,CAAA;AAED;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,yBAAyB,EAAE,gBAUvC,CAAA;AAED,4EAA4E;AAC5E,eAAO,MAAM,iBAAiB,MAAM,CAAA;AAEpC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,cAAc,EAAE,gBAAgB,EAwD5C,CAAA;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,gBAAgB,EAAE,CASrG;AAwHD,eAAO,MAAM,iBAAiB,EAAE,mBAiG/B,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"ContentPage.d.ts","sourceRoot":"","sources":["../../src/views/ContentPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AASzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAyCtD,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,EAAE,oBAAoB,CAAA;CACvC;AAED,wBAAgB,WAAW,CAAC,EAAE,eAAe,EAAE,EAAE,gBAAgB,qBA+OhE"}
1
+ {"version":3,"file":"ContentPage.d.ts","sourceRoot":"","sources":["../../src/views/ContentPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AAUzB,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAA;AAyCtD,MAAM,WAAW,gBAAgB;IAC/B,eAAe,CAAC,EAAE,oBAAoB,CAAA;CACvC;AAED,wBAAgB,WAAW,CAAC,EAAE,eAAe,EAAE,EAAE,gBAAgB,qBA+OhE"}
@@ -0,0 +1,33 @@
1
+ import React from 'react';
2
+ import type { ShopCustomer, ShopProvider } from '@fayz-ai/shop';
3
+ /**
4
+ * The customer's record, created or edited — the one form for both.
5
+ *
6
+ * The form itself is the ENTITY's, rendered by the same CrudRecordModal every
7
+ * other "register this mid-task" dialog uses: the fields, labels, groups and
8
+ * masks come from buildShopCustomerEntity, so a column added to the registry
9
+ * shows up here without anyone remembering this file exists. What stays local
10
+ * is what only a sale knows — the name typed into the search box, and what to
11
+ * do when the e-mail is already someone's.
12
+ *
13
+ * Both ends of it write to `plg_shop_customers`: a CPF typed here is the
14
+ * person's, not this order's, so the next sale to them already has it. The
15
+ * order still freezes its own copy, which is what an invoice issued months
16
+ * later has to quote.
17
+ */
18
+ export declare function CustomerModal({ open, initialName, customerId, initial, provider, onClose, onSaved }: {
19
+ open: boolean;
20
+ initialName?: string;
21
+ /** Set when editing an existing record. */
22
+ customerId?: string;
23
+ initial?: {
24
+ name: string;
25
+ email: string;
26
+ phone: string;
27
+ document: string;
28
+ };
29
+ provider: () => ShopProvider;
30
+ onClose: () => void;
31
+ onSaved: (customer: ShopCustomer) => void;
32
+ }): React.JSX.Element;
33
+ //# sourceMappingURL=CustomerModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomerModal.d.ts","sourceRoot":"","sources":["../../src/views/CustomerModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAA;AAK3D,OAAO,KAAK,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAgB/D;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,aAAa,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE;IACpG,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,2CAA2C;IAC3C,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,OAAO,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAA;IAC1E,QAAQ,EAAE,MAAM,YAAY,CAAA;IAC5B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,OAAO,EAAE,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAA;CAC1C,qBAqIA"}
@@ -3,9 +3,45 @@ import type { ShopProvider } from '@fayz-ai/shop';
3
3
  export interface NewOrderChargeProps {
4
4
  open: boolean;
5
5
  provider: () => ShopProvider;
6
- sessionId: string;
7
- emv: string;
6
+ /** Null enquanto a cobrança está sendo aberta — o modal já está na tela. */
7
+ sessionId: string | null;
8
+ /** Pix copy-and-paste. Null when the sale was closed with a link instead. */
9
+ emv: string | null;
8
10
  qrcodeBase64: string | null;
11
+ /**
12
+ * O QR hospedado pelo adquirente, quando ele não devolve os bytes.
13
+ *
14
+ * A AbacatePay manda base64 e a Vindi manda a URL de um SVG. Desenhar um como
15
+ * o outro é um <img> quebrado no instante exato em que alguém ia pagar, então
16
+ * a tela desenha o que veio, e não o que ela esperava.
17
+ */
18
+ qrcodeUrl?: string | null;
19
+ /**
20
+ * A escolha, quando ela ainda não foi feita.
21
+ *
22
+ * Sem isto o modal é o que sempre foi: uma cobrança pronta. Com isto ele abre
23
+ * ANTES — mostrando as formas de cobrar e, depois do clique, o esqueleto do
24
+ * que está vindo. É o padrão de qualquer coisa que demora: a janela aparece
25
+ * na hora do clique, não quando o servidor termina.
26
+ */
27
+ onChoose?: (asLink: boolean) => void;
28
+ /** True entre a escolha e a resposta do adquirente. */
29
+ opening?: boolean;
30
+ /** A recusa da ABERTURA, dentro da janela onde ela aconteceu. */
31
+ error?: string | null;
32
+ /** "Já recebi" — a terceira forma de um pedido ficar pago, na mesma porta. */
33
+ onRegisterReceipt?: () => void;
34
+ /** The acquirer's own page — one address, sent to whoever is buying. */
35
+ paymentUrl?: string | null;
36
+ /**
37
+ * WHICH acquirer opened this session.
38
+ *
39
+ * Not cosmetic: without it the settle call defaults to AbacatePay, and a store
40
+ * on any other gateway had its charge polled against a provider that has never
41
+ * heard of the transaction — a Pix that stayed "aguardando" forever while the
42
+ * money was already in.
43
+ */
44
+ acquirer?: string | null;
9
45
  total: number;
10
46
  currency: string;
11
47
  customerName: string;
@@ -13,5 +49,5 @@ export interface NewOrderChargeProps {
13
49
  onPaid: (orderId?: string) => void;
14
50
  onClose: () => void;
15
51
  }
16
- export declare function NewOrderCharge({ open, provider, sessionId, emv, qrcodeBase64, total, currency, customerName, customerPhone, onPaid, onClose, }: NewOrderChargeProps): React.JSX.Element;
52
+ export declare function NewOrderCharge({ open, provider, sessionId, emv, qrcodeBase64, qrcodeUrl, paymentUrl, acquirer, total, currency, customerName, customerPhone, onPaid, onClose, onChoose, opening, onRegisterReceipt, error, }: NewOrderChargeProps): React.JSX.Element;
17
53
  //# sourceMappingURL=NewOrderCharge.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NewOrderCharge.d.ts","sourceRoot":"","sources":["../../src/views/NewOrderCharge.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAOvE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAmBjD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,OAAO,CAAA;IACb,QAAQ,EAAE,MAAM,YAAY,CAAA;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,YAAY,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,EAAE,MAAM,CAAA;IAChB,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAED,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EAAE,QAAQ,EAAE,SAAS,EAAE,GAAG,EAAE,YAAY,EAAE,KAAK,EAAE,QAAQ,EAC7D,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,GAC7C,EAAE,mBAAmB,qBA2IrB"}
1
+ {"version":3,"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,EAAE,KAAK,EAAE,QAAQ,EAC9F,YAAY,EAAE,aAAa,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,iBAAiB,EAAE,KAAK,GAC1F,EAAE,mBAAmB,qBA8SrB"}
@@ -4,6 +4,15 @@ export interface NewOrderPageProps {
4
4
  provider: () => ShopProvider;
5
5
  onDone: (orderId?: string) => void;
6
6
  onCancel: () => void;
7
+ /**
8
+ * Corrigir um pedido que já existe, em vez de abrir um novo.
9
+ *
10
+ * É a MESMA tela porque é o mesmo ato: escolher cliente, itens e entrega. O
11
+ * que muda é para onde a gravação vai — `reviseOrder`, que reescreve aquele
12
+ * pedido pelo mesmo caminho de confiança que o criou (0072) — e que as formas
13
+ * de cobrar somem: um pedido que já existe se cobra pela tela dele.
14
+ */
15
+ orderId?: string;
7
16
  }
8
- export declare function NewOrderPage({ provider, onDone, onCancel }: NewOrderPageProps): React.JSX.Element;
17
+ export declare function NewOrderPage({ provider, onDone, onCancel, orderId }: NewOrderPageProps): React.JSX.Element;
9
18
  //# sourceMappingURL=NewOrderPage.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"NewOrderPage.d.ts","sourceRoot":"","sources":["../../src/views/NewOrderPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAYxE,OAAO,KAAK,EAC8C,YAAY,EACrE,MAAM,eAAe,CAAA;AAkGtB,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,YAAY,CAAA;IAC5B,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAA;CACrB;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,EAAE,iBAAiB,qBAkc7E"}
1
+ {"version":3,"file":"NewOrderPage.d.ts","sourceRoot":"","sources":["../../src/views/NewOrderPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAkBxE,OAAO,KAAK,EAC8C,YAAY,EACrE,MAAM,eAAe,CAAA;AAuGtB,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,MAAM,YAAY,CAAA;IAC5B,MAAM,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,KAAK,IAAI,CAAA;IAClC,QAAQ,EAAE,MAAM,IAAI,CAAA;IACpB;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAED,wBAAgB,YAAY,CAAC,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,EAAE,iBAAiB,qBA0pBtF"}
@@ -1 +1 @@
1
- {"version":3,"file":"OrderDetailView.d.ts","sourceRoot":"","sources":["../../src/views/OrderDetailView.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA2C,MAAM,OAAO,CAAA;AAc/D,OAAO,KAAK,EAAS,YAAY,EAAE,MAAM,eAAe,CAAA;AA0DxD,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKrD,CAAA;AAoED,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;IAC7D,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,YAAY,CAAA;IAC5B,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB,qBA8WA;AAED,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,WAAyB,CAAA;AACnE,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,SAAyC,CAAA"}
1
+ {"version":3,"file":"OrderDetailView.d.ts","sourceRoot":"","sources":["../../src/views/OrderDetailView.tsx"],"names":[],"mappings":"AACA,OAAO,KAAmD,MAAM,OAAO,CAAA;AAiBvE,OAAO,KAAK,EAAwC,YAAY,EAAE,MAAM,eAAe,CAAA;AA0DvF,mEAAmE;AACnE,eAAO,MAAM,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAKrD,CAAA;AAiFD,wBAAgB,eAAe,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE;IAC7D,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,YAAY,CAAA;IAC5B,MAAM,EAAE,MAAM,IAAI,CAAA;CACnB,qBAomBA;AAED,eAAO,MAAM,eAAe,GAAI,IAAI,MAAM,WAAyB,CAAA;AACnE,eAAO,MAAM,SAAS,GAAI,IAAI,MAAM,SAAyC,CAAA"}
@@ -0,0 +1,10 @@
1
+ import { type AskAIIntro } from '@fayz-ai/admin';
2
+ import type { Order, ShopProvider } from '@fayz-ai/shop';
3
+ /** O convite da porta "Criar com IA" — mesma tela, dito para o lojista. */
4
+ export declare const ORDER_TAKING_INTRO: AskAIIntro;
5
+ export declare function OrdersAgentSurface({ provider, orders, onChanged, }: {
6
+ provider: () => ShopProvider;
7
+ orders: Order[];
8
+ onChanged: () => void;
9
+ }): null;
10
+ //# sourceMappingURL=OrdersAgentSurface.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"OrdersAgentSurface.d.ts","sourceRoot":"","sources":["../../src/views/OrdersAgentSurface.tsx"],"names":[],"mappings":"AACA,OAAO,EAAkD,KAAK,UAAU,EAAE,MAAM,gBAAgB,CAAA;AAChG,OAAO,KAAK,EAAE,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAWxD,2EAA2E;AAC3E,eAAO,MAAM,kBAAkB,EAAE,UAWhC,CAAA;AAED,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EAAE,MAAM,EAAE,SAAS,GAC5B,EAAE;IACD,QAAQ,EAAE,MAAM,YAAY,CAAA;IAC5B,MAAM,EAAE,KAAK,EAAE,CAAA;IACf,SAAS,EAAE,MAAM,IAAI,CAAA;CACtB,QAqDA"}
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ import type { ShopProvider } from '@fayz-ai/shop';
3
+ export declare function ProductPositionsTab({ item, getProvider }: {
4
+ item: unknown;
5
+ getProvider: () => ShopProvider;
6
+ }): React.JSX.Element;
7
+ //# sourceMappingURL=ProductPositionsTab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductPositionsTab.d.ts","sourceRoot":"","sources":["../../src/views/ProductPositionsTab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAWxE,OAAO,KAAK,EAA2B,YAAY,EAAE,MAAM,eAAe,CAAA;AAsD1E,wBAAgB,mBAAmB,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE;IACzD,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,MAAM,YAAY,CAAA;CAChC,qBAoaA"}
@@ -0,0 +1,84 @@
1
+ import React from 'react';
2
+ import type { Product, ProductVariant, ShopProvider } from '@fayz-ai/shop';
3
+ import type { StockBalance, StockLocation, StockLot } from '@fayz-ai/shop/inventory';
4
+ /**
5
+ * Estoque — onde as unidades deste produto realmente estão, e como corrigi-las.
6
+ *
7
+ * A aba de Variantes mostra UM número por variante: o espelho que a 0036
8
+ * publica em `inventory_count`. Ele é a soma de posições que o lojista não
9
+ * enxerga em lugar nenhum — duas lojas, um depósito, lotes com validade
10
+ * diferente — e é por isso que "tenho 12" nunca respondia "12 onde?".
11
+ *
12
+ * DUAS COISAS AQUI NÃO SÃO ESCOLHA DE TELA:
13
+ *
14
+ * • ENTRADA E CONTAGEM SÃO ATOS DIFERENTES, porque o razão os grava
15
+ * diferente. Quem recebe digita o que CHEGOU (`receipt`, a quantidade é o
16
+ * movimento); quem confere a prateleira digita o que ESTÁ LÁ (`count`, o
17
+ * movimento é a diferença). Misturar os dois num campo só é como um saldo
18
+ * dobra sem ninguém errar a conta.
19
+ * • O POOL PODE ESTAR ATRÁS DAS MIGRATIONS. `plg_shop_stock_lots` não existe
20
+ * em toda loja, e há produto sem nenhuma linha de variante. Nenhuma leitura
21
+ * aqui pode assumir que deu certo: o que falta vira estado vazio legível e
22
+ * um aviso, nunca uma aba que gira para sempre.
23
+ */
24
+ export declare function ProductStockTab({ item, getProvider }: {
25
+ item: unknown;
26
+ getProvider: () => ShopProvider;
27
+ }): React.JSX.Element;
28
+ export interface AdjustForm {
29
+ kind: string;
30
+ quantity: number;
31
+ reasonCode: string;
32
+ note: string;
33
+ date: string;
34
+ }
35
+ /** Motivo inicial do ato, lido do vocabulário: o específico do kind vem antes
36
+ * dos coringas, e o saldo inicial só é oferecido a quem nunca teve saldo. */
37
+ export declare function defaultReasonFor(kind: string, opening: boolean): string;
38
+ export interface StockPosition {
39
+ key: string;
40
+ /** null quando a loja não tem linha de variante — o contador é do produto. */
41
+ variantId: string | null;
42
+ variantLabel: string;
43
+ locationId: string | null;
44
+ locationLabel: string;
45
+ lotId: string | null;
46
+ lotLabel: string | null;
47
+ onHand: number;
48
+ reserved: number;
49
+ available: number;
50
+ /** O número veio do contador espelhado, e não de uma linha do razão. */
51
+ mirrored: boolean;
52
+ }
53
+ export interface StockSnapshot {
54
+ positions: StockPosition[];
55
+ /** A loja guarda estoque no produto: nenhuma variante existe. */
56
+ perProduct: boolean;
57
+ /** A primeira leitura que falhou, para o aviso. null quando tudo respondeu. */
58
+ degraded: string | null;
59
+ }
60
+ /** Posição que ninguém tocou: contador espelhado em zero, sem razão por trás. */
61
+ export declare function isUntouched(position: StockPosition): boolean;
62
+ /**
63
+ * As posições que a tabela desenha.
64
+ *
65
+ * Uma variante sem nenhuma linha de saldo não some: ela ganha uma posição
66
+ * sintética a partir do espelho da 0036, senão não haveria onde clicar para dar
67
+ * a primeira entrada. `mirrored` marca essas, que é o que separa "zero de
68
+ * verdade" de "nunca teve razão".
69
+ */
70
+ export declare function buildStockPositions({ product, variants, balances, locations, lots }: {
71
+ product: Pick<Product, 'id' | 'name' | 'inventoryCount'>;
72
+ variants: readonly ProductVariant[];
73
+ balances: readonly StockBalance[];
74
+ locations: readonly StockLocation[];
75
+ lots: readonly StockLot[];
76
+ }): StockPosition[];
77
+ /**
78
+ * Grava o ajuste e devolve o movimento (assinado) que ele gerou.
79
+ *
80
+ * A conta que separa os dois atos mora aqui: `receipt` lança o que foi digitado,
81
+ * `count` lança a DIFERENÇA entre o que foi contado e o que o saldo dizia.
82
+ */
83
+ export declare function recordAdjustment(shop: ShopProvider, product: Product, position: StockPosition, form: AdjustForm): Promise<number>;
84
+ //# sourceMappingURL=ProductStockTab.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ProductStockTab.d.ts","sourceRoot":"","sources":["../../src/views/ProductStockTab.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAQ1E,OAAO,KAAK,EACV,YAAY,EAAE,aAAa,EAAE,QAAQ,EACtC,MAAM,yBAAyB,CAAA;AAMhC;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE;IACrD,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,EAAE,MAAM,YAAY,CAAA;CAChC,qBAgKA;AAUD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE,MAAM,CAAA;IAChB,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;CACb;AAkJD;8EAC8E;AAC9E,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAOvE;AAMD,MAAM,WAAW,aAAa;IAC5B,GAAG,EAAE,MAAM,CAAA;IACX,8EAA8E;IAC9E,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;IACxB,YAAY,EAAE,MAAM,CAAA;IACpB,UAAU,EAAE,MAAM,GAAG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,CAAA;AAYxE,OAAO,KAAK,EAA+D,YAAY,EAAE,MAAM,eAAe,CAAA;AAE9G,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,CAAC,MAAM,YAAY,CAAC,CAAA;AAEtE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,oBAAoB,CAAA;CAChC;AAmcD,QAAA,MAAM,IAAI;;;;;;;;;;;;EAKA,CAAA;AAEV,KAAK,KAAK,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;AAStC;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,GAAG;IAAE,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CA+ElE,CAAA"}
1
+ {"version":3,"file":"ShopPage.d.ts","sourceRoot":"","sources":["../../src/views/ShopPage.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoD,MAAM,OAAO,CAAA;AAaxE,OAAO,KAAK,EAA+D,YAAY,EAAE,MAAM,eAAe,CAAA;AAE9G,MAAM,MAAM,oBAAoB,GAAG,YAAY,GAAG,CAAC,MAAM,YAAY,CAAC,CAAA;AAEtE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,EAAE,oBAAoB,CAAA;CAChC;AAqeD,QAAA,MAAM,IAAI;;;;;;;;;;;;EAKA,CAAA;AAEV,KAAK,KAAK,GAAG,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,CAAA;AAStC;;;;GAIG;AACH,eAAO,MAAM,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,aAAa,GAAG;IAAE,OAAO,CAAC,EAAE,KAAK,CAAA;CAAE,CAmFlE,CAAA"}
@@ -0,0 +1,32 @@
1
+ import React from 'react';
2
+ import type { ShopProvider } from '@fayz-ai/shop';
3
+ /** Hoje, no fuso de quem digita — que é o que um <input type="date"> mostra. */
4
+ export declare function today(): string;
5
+ /**
6
+ * A data escolhida, virando instante.
7
+ *
8
+ * Hoje devolve `undefined` — o banco carimba `now()` e a hora real do
9
+ * lançamento é preservada, em vez de virar meia-noite. Outro dia vira MEIO-DIA
10
+ * local: montado da meia-noite, um fuso a oeste lê o dia anterior, e há zonas
11
+ * onde 00:00 não existe (horário de verão).
12
+ */
13
+ export declare function occurredAtFor(date: string): string | undefined;
14
+ export interface StockEntryModalProps {
15
+ open: boolean;
16
+ onClose: () => void;
17
+ provider: () => ShopProvider;
18
+ /** The variant the ledger tracks. When the line does not know it — a product
19
+ * whose variants were never loaded — the modal looks it up on open. */
20
+ variantId?: string | null;
21
+ productId: string;
22
+ productName: string;
23
+ sku?: string | null;
24
+ /** What the picker last saw on the shelf. Null when unknown. */
25
+ available?: number | null;
26
+ /** How many this order needs — what makes the default quantity a real one. */
27
+ needed?: number;
28
+ /** The new available count, for the caller to retry what the refusal stopped. */
29
+ onReceived: (available: number) => void;
30
+ }
31
+ export declare function StockEntryModal({ open, onClose, provider, variantId, productId, productName, sku, available, needed, onReceived, }: StockEntryModalProps): React.JSX.Element;
32
+ //# sourceMappingURL=StockEntryModal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"StockEntryModal.d.ts","sourceRoot":"","sources":["../../src/views/StockEntryModal.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAuC,MAAM,OAAO,CAAA;AAQ3D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAqBjD,gFAAgF;AAChF,wBAAgB,KAAK,IAAI,MAAM,CAG9B;AAED;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAK9D;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,OAAO,CAAA;IACb,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,QAAQ,EAAE,MAAM,YAAY,CAAA;IAC5B;4EACwE;IACxE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,SAAS,EAAE,MAAM,CAAA;IACjB,WAAW,EAAE,MAAM,CAAA;IACnB,GAAG,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACnB,gEAAgE;IAChE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACzB,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,iFAAiF;IACjF,UAAU,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,IAAI,CAAA;CACxC;AAED,wBAAgB,eAAe,CAAC,EAC9B,IAAI,EAAE,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,WAAW,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,GAC/F,EAAE,oBAAoB,qBA8JtB"}
@@ -1 +1 @@
1
- {"version":3,"file":"customerEntity.d.ts","sourceRoot":"","sources":["../../src/views/customerEntity.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,eAAe,CAAA;AACxD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAmBjD,wBAAgB,uBAAuB,IAAI,SAAS,CAAC,YAAY,CAAC,CAiGjE"}
1
+ {"version":3,"file":"customerEntity.d.ts","sourceRoot":"","sources":["../../src/views/customerEntity.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAY,MAAM,eAAe,CAAA;AAExD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAmBjD,wBAAgB,uBAAuB,IAAI,SAAS,CAAC,YAAY,CAAC,CA6GjE"}
@@ -0,0 +1,2 @@
1
+ export declare const DISCOUNT_CREATE_INSTRUCTIONS: string;
2
+ //# sourceMappingURL=discount-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discount-agent.d.ts","sourceRoot":"","sources":["../../src/views/discount-agent.ts"],"names":[],"mappings":"AAcA,eAAO,MAAM,4BAA4B,QAyBjC,CAAA"}
@@ -10,7 +10,16 @@ export type ChargeOutcome = 'waiting' | 'paid' | 'expired' | 'failed';
10
10
  * never heard of — keeps waiting.
11
11
  */
12
12
  export declare function chargeOutcome(state: CheckoutSettlement['state'] | undefined): ChargeOutcome;
13
- export type NewOrderEnding = 'charge' | 'received' | 'later';
13
+ /**
14
+ * How the merchant ends the sale they just typed.
15
+ *
16
+ * `link` is the one where nobody is present: the cart is frozen and the
17
+ * acquirer hands back an address to send. It is a separate ending rather than a
18
+ * flavour of `charge` because it asks for different things — a phone to send it
19
+ * to, and no document, since the customer fills that in on the acquirer's own
20
+ * page.
21
+ */
22
+ export type NewOrderEnding = 'charge' | 'link' | 'received' | 'later';
14
23
  export interface NewOrderDraft {
15
24
  lineCount: number;
16
25
  /** Lines whose product has options but no variant chosen yet. */
@@ -43,6 +52,19 @@ export declare function validateNewOrder(draft: NewOrderDraft, ending: NewOrderE
43
52
  * transports that drop the code.
44
53
  */
45
54
  export declare function isDuplicateEmail(error: unknown): boolean;
55
+ /**
56
+ * The product `shop_place_order` refused to sell — or null when the refusal was
57
+ * about something else.
58
+ *
59
+ * The RPC raises `shop_place_order: insufficient stock for <nome>` (23514) and
60
+ * that sentence, on its own, ends the sale: the merchant has the customer on
61
+ * the phone, the stock is on the shelf, and the only path forward is another
62
+ * screen. Naming the product is what lets this one offer the entry instead.
63
+ *
64
+ * The name is whatever `products.name` holds, spaces and all, so it runs to the
65
+ * end of the message rather than to the first separator.
66
+ */
67
+ export declare function insufficientStockProduct(message: string | null | undefined): string | null;
46
68
  /**
47
69
  * Is the carrier complaining about the SENDER rather than this order?
48
70
  *
@@ -1 +1 @@
1
- {"version":3,"file":"new-order-rules.d.ts","sourceRoot":"","sources":["../../src/views/new-order-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,eAAe,CAAA;AAOvD,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,QAAQ,CAAA;AAErE;;;;;;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AM,GAAG,UAAU,GAAG,OAAO,CAAA;AAMrE,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,MAAM,CAAA;IACjB,iEAAiE;IACjE,kBAAkB,EAAE,MAAM,CAAA;IAC1B,YAAY,EAAE,MAAM,CAAA;IACpB,aAAa,EAAE,MAAM,CAAA;IACrB,aAAa,EAAE,MAAM,CAAA;IACrB,+DAA+D;IAC/D,gBAAgB,EAAE,MAAM,CAAA;IACxB,aAAa,EAAE,OAAO,CAAA;IACtB,oEAAoE;IACpE,QAAQ,EAAE,OAAO,CAAA;IACjB,eAAe,EAAE,OAAO,CAAA;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,aAAa,EAAE,MAAM,EAAE,cAAc,GAAG,MAAM,GAAG,IAAI,CAqC5F;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAKxD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,MAAM,GAAG,IAAI,CAG1F;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAG3E"}
@@ -0,0 +1,11 @@
1
+ import type { AgentSurfaceTool } from '@fayz-ai/admin';
2
+ import type { ShopProvider } from '@fayz-ai/shop';
3
+ export declare const ORDER_TAKING_INSTRUCTIONS: string;
4
+ export interface OrderTakingDeps {
5
+ getProvider: () => ShopProvider;
6
+ /** Refresh the list behind the conversation — a pedido created by chat has to
7
+ * show up on the screen the merchant is looking at. */
8
+ onChanged?: () => void;
9
+ }
10
+ export declare function createOrderTakingTools({ getProvider, onChanged }: OrderTakingDeps): AgentSurfaceTool[];
11
+ //# sourceMappingURL=orders-agent.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"orders-agent.d.ts","sourceRoot":"","sources":["../../src/views/orders-agent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AACtD,OAAO,KAAK,EAC6D,YAAY,EACpF,MAAM,eAAe,CAAA;AA6BtB,eAAO,MAAM,yBAAyB,QAqB9B,CAAA;AAmLR,MAAM,WAAW,eAAe;IAC9B,WAAW,EAAE,MAAM,YAAY,CAAA;IAC/B;4DACwD;IACxD,SAAS,CAAC,EAAE,MAAM,IAAI,CAAA;CACvB;AAoED,wBAAgB,sBAAsB,CAAC,EAAE,WAAW,EAAE,SAAS,EAAE,EAAE,eAAe,GAAG,gBAAgB,EAAE,CA8OtG"}
@@ -0,0 +1,38 @@
1
+ import type { Product } from '@fayz-ai/shop';
2
+ /**
3
+ * Quão bem este produto responde a este termo, de 0 (não responde) a 100.
4
+ *
5
+ * Ordem de confiança: o SKU escrito por extenso, o nome exato, o nome que
6
+ * contém o termo inteiro, e por último a fração de palavras em comum — que é o
7
+ * que salva "costela com queijo" quando o catálogo diz "Costela Suína com
8
+ * Queijo". Abaixo de metade das palavras não é candidato, é ruído.
9
+ */
10
+ export declare function scoreProduct(term: string, product: Product): number;
11
+ export interface ProductCandidate {
12
+ productId: string;
13
+ name: string;
14
+ sku: string | null;
15
+ price: number;
16
+ stock: number;
17
+ score: number;
18
+ variants?: Array<{
19
+ variantId: string;
20
+ options: Record<string, string>;
21
+ price: number;
22
+ stock: number;
23
+ }>;
24
+ }
25
+ /** Os candidatos de um termo, do melhor para o pior. */
26
+ export declare function rankProducts(term: string, catalog: Product[], limit?: number): ProductCandidate[];
27
+ export interface TermResolution {
28
+ term: string;
29
+ /** O produto, quando não há dúvida honesta. */
30
+ resolved?: ProductCandidate;
31
+ /** Os candidatos, quando há. Vira a pergunta na tela. */
32
+ options?: ProductCandidate[];
33
+ }
34
+ export declare function resolveTerm(term: string, catalog: Product[]): TermResolution;
35
+ export declare const money: (value: number) => string;
36
+ /** A linha sob o nome: o que distingue uma costela da outra na hora de escolher. */
37
+ export declare const candidateMeta: (candidate: ProductCandidate) => string;
38
+ //# sourceMappingURL=product-matching.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"product-matching.d.ts","sourceRoot":"","sources":["../../src/views/product-matching.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAyB5C;;;;;;;GAOG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,MAAM,CAiBnE;AAED,MAAM,WAAW,gBAAgB;IAC/B,SAAS,EAAE,MAAM,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,EAAE,MAAM,GAAG,IAAI,CAAA;IAClB,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,KAAK,CAAC;QAAE,SAAS,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CACvG;AAED,wDAAwD;AACxD,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,KAAK,SAAI,GAAG,gBAAgB,EAAE,CAoB5F;AAkBD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAA;IACZ,+CAA+C;IAC/C,QAAQ,CAAC,EAAE,gBAAgB,CAAA;IAC3B,yDAAyD;IACzD,OAAO,CAAC,EAAE,gBAAgB,EAAE,CAAA;CAC7B;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,GAAG,cAAc,CAW5E;AAED,eAAO,MAAM,KAAK,GAAI,OAAO,MAAM,WACgE,CAAA;AAEnG,oFAAoF;AACpF,eAAO,MAAM,aAAa,GAAI,WAAW,gBAAgB,KAAG,MAE5C,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"productEntity.d.ts","sourceRoot":"","sources":["../../src/views/productEntity.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAA+B,MAAM,eAAe,CAAA;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAgD1D,8EAA8E;AAC9E,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ7C;AAsBD,wBAAgB,sBAAsB,CACpC,YAAY,SAAQ,EACpB,WAAW,CAAC,EAAE,MAAM,YAAY,GAC/B,SAAS,CAAC,OAAO,CAAC,CAqOpB"}
1
+ {"version":3,"file":"productEntity.d.ts","sourceRoot":"","sources":["../../src/views/productEntity.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAA+B,MAAM,eAAe,CAAA;AAC3E,OAAO,KAAK,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,eAAe,CAAA;AAiD1D,8EAA8E;AAC9E,wBAAgB,OAAO,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAQ7C;AAsBD,wBAAgB,sBAAsB,CACpC,YAAY,SAAQ,EACpB,WAAW,CAAC,EAAE,MAAM,YAAY,GAC/B,SAAS,CAAC,OAAO,CAAC,CAmRpB"}