@fayz-ai/plugin-conversations 0.23.0 → 0.23.2
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/index.d.ts.map +1 -1
- package/dist/index.js +62 -4
- package/dist/index.js.map +1 -1
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAA;AAEvF,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAA;AAIlD,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,cAAc,CAAA;AAuBzD,MAAM,WAAW,0BAA0B;IACzC,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,UAAU,CAAC,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,CAAA;IAC9C,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,WAAW,CAAA;IACnB,UAAU,CAAC,EAAE,UAAU,CAAA;IACvB,YAAY,CAAC,EAAE,qBAAqB,CAAA;IAEpC;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,oFAAoF;IACpF,aAAa,CAAC,EAAE,YAAY,CAAA;IAC5B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,SAAS,CAAA;CAC7B;AA2BD,wBAAgB,yBAAyB,CAAC,OAAO,CAAC,EAAE,0BAA0B,GAAG,cAAc,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eA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KAAK,4BAA4B,GAClC,MAAM,iBAAiB,CAAA;AAGxB,OAAO,EACL,kBAAkB,EAClB,mBAAmB,EACnB,wBAAwB,GACzB,MAAM,oCAAoC,CAAA;AAO3C,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAA;AAC1F,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAC/C,YAAY,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -5594,6 +5594,61 @@ var MIGRATION_014_CLAIMING_TARGETS_IS_SERVER_ONLY = `-- 014_claiming_targets_is_
|
|
|
5594
5594
|
REVOKE ALL ON FUNCTION public.conversations_claim_targets(uuid, integer) FROM PUBLIC, anon, authenticated;
|
|
5595
5595
|
GRANT EXECUTE ON FUNCTION public.conversations_claim_targets(uuid, integer) TO service_role;
|
|
5596
5596
|
`;
|
|
5597
|
+
var MIGRATION_015_THE_SERVICE_DOOR_FOR_MESSAGING = `-- ============================================================================
|
|
5598
|
+
-- 015_the_service_door_for_messaging \u2014 the WhatsApp edge functions move to the
|
|
5599
|
+
-- integration service (ADR 0003 phase 2, wave 2).
|
|
5600
|
+
--
|
|
5601
|
+
-- Two kinds of table, two kinds of access:
|
|
5602
|
+
--
|
|
5603
|
+
-- * tenant tables a member already writes (conversations, messages,
|
|
5604
|
+
-- campaigns, templates): the service writes them AS the store's owner or
|
|
5605
|
+
-- as the verified caller (core migrations 210/212), under RLS. Nothing
|
|
5606
|
+
-- here.
|
|
5607
|
+
-- * service tables only a machine writes, which service_role wrote until
|
|
5608
|
+
-- now: provider credentials, channels, opt-outs, webhook events, provider
|
|
5609
|
+
-- templates, payment requests. fayz_integration gets exactly that, table
|
|
5610
|
+
-- by table, with an explicit policy. Panels keep their SELECT policies.
|
|
5611
|
+
--
|
|
5612
|
+
-- And the three server-only functions the webhooks call get EXECUTE for the
|
|
5613
|
+
-- service role (they were service_role only, 014).
|
|
5614
|
+
--
|
|
5615
|
+
-- Guarded: the role is an operator step. Replay-safe.
|
|
5616
|
+
-- ============================================================================
|
|
5617
|
+
|
|
5618
|
+
DO $$
|
|
5619
|
+
DECLARE
|
|
5620
|
+
t text;
|
|
5621
|
+
f text;
|
|
5622
|
+
BEGIN
|
|
5623
|
+
IF NOT EXISTS (SELECT 1 FROM pg_roles WHERE rolname = 'fayz_integration') THEN
|
|
5624
|
+
RETURN;
|
|
5625
|
+
END IF;
|
|
5626
|
+
|
|
5627
|
+
FOREACH t IN ARRAY ARRAY[
|
|
5628
|
+
'plg_conversations_providers',
|
|
5629
|
+
'plg_conversations_channels',
|
|
5630
|
+
'plg_conversations_optouts',
|
|
5631
|
+
'plg_conversations_webhook_events',
|
|
5632
|
+
'plg_automations_provider_templates',
|
|
5633
|
+
'plg_conversations_payment_requests'
|
|
5634
|
+
] LOOP
|
|
5635
|
+
IF to_regclass('public.' || t) IS NULL THEN CONTINUE; END IF;
|
|
5636
|
+
EXECUTE format('GRANT SELECT, INSERT, UPDATE, DELETE ON public.%I TO fayz_integration', t);
|
|
5637
|
+
EXECUTE format('DROP POLICY IF EXISTS %I ON public.%I', t || '_service', t);
|
|
5638
|
+
EXECUTE format('CREATE POLICY %I ON public.%I FOR ALL TO fayz_integration USING (true) WITH CHECK (true)', t || '_service', t);
|
|
5639
|
+
END LOOP;
|
|
5640
|
+
|
|
5641
|
+
FOREACH f IN ARRAY ARRAY[
|
|
5642
|
+
'public.conversations_claim_targets(uuid, integer)',
|
|
5643
|
+
'public.plg_booking_apply_channel_reply(uuid, text, uuid)',
|
|
5644
|
+
'public.plg_conversations_match_by_phone(text, text, text, uuid)'
|
|
5645
|
+
] LOOP
|
|
5646
|
+
IF to_regprocedure(f) IS NOT NULL THEN
|
|
5647
|
+
EXECUTE format('GRANT EXECUTE ON FUNCTION %s TO fayz_integration', f);
|
|
5648
|
+
END IF;
|
|
5649
|
+
END LOOP;
|
|
5650
|
+
END $$;
|
|
5651
|
+
`;
|
|
5597
5652
|
var MIGRATIONS = [
|
|
5598
5653
|
{ id: "000_baseline", sql: MIGRATION_000_BASELINE },
|
|
5599
5654
|
{ id: "001_a_caixa_sabe_quem_falou_por_ultimo", sql: MIGRATION_001_A_CAIXA_SABE_QUEM_FALOU_POR_ULTIMO },
|
|
@@ -5609,7 +5664,8 @@ var MIGRATIONS = [
|
|
|
5609
5664
|
{ id: "011_o_anuncio_e_uma_campainha_nao_um_recado", sql: MIGRATION_011_O_ANUNCIO_E_UMA_CAMPAINHA_NAO_UM_RECADO },
|
|
5610
5665
|
{ id: "012_a_rich_message_keeps_its_shape", sql: MIGRATION_012_A_RICH_MESSAGE_KEEPS_ITS_SHAPE },
|
|
5611
5666
|
{ id: "013_a_midia_fica_conosco", sql: MIGRATION_013_A_MIDIA_FICA_CONOSCO },
|
|
5612
|
-
{ id: "014_claiming_targets_is_server_only", sql: MIGRATION_014_CLAIMING_TARGETS_IS_SERVER_ONLY }
|
|
5667
|
+
{ id: "014_claiming_targets_is_server_only", sql: MIGRATION_014_CLAIMING_TARGETS_IS_SERVER_ONLY },
|
|
5668
|
+
{ id: "015_the_service_door_for_messaging", sql: MIGRATION_015_THE_SERVICE_DOOR_FOR_MESSAGING }
|
|
5613
5669
|
];
|
|
5614
5670
|
var conversationsV1SettingsTabs = [
|
|
5615
5671
|
defineSettingsTab({
|
|
@@ -5832,7 +5888,9 @@ function createConversationsPlugin(options) {
|
|
|
5832
5888
|
// AtendeAI does get a rail line, as in V1: whoever runs the AI follows it
|
|
5833
5889
|
// all day. Offered to every account — off, the page is the upsell.
|
|
5834
5890
|
navigation: [
|
|
5835
|
-
|
|
5891
|
+
// AtendeAI é recurso de restaurante (ChefControl): só aparece no vertical
|
|
5892
|
+
// 'food'. Uma loja de outro ramo não vê a linha.
|
|
5893
|
+
{ section: "main", position: 45, label: "AtendeAI", route: "/atendeai", icon: "Bot", before: ["/analytics", "/reports"], verticalId: "food", permission: { feature: "conversations", action: "read" } }
|
|
5836
5894
|
],
|
|
5837
5895
|
routes: [
|
|
5838
5896
|
{
|
|
@@ -5913,8 +5971,8 @@ function createConversationsPlugin(options) {
|
|
|
5913
5971
|
}
|
|
5914
5972
|
},
|
|
5915
5973
|
suggestions: [
|
|
5916
|
-
{ label: "
|
|
5917
|
-
{ label: "
|
|
5974
|
+
{ label: "Mostre as conversas n\xE3o lidas" },
|
|
5975
|
+
{ label: "Chegou mensagem nova no WhatsApp?" }
|
|
5918
5976
|
],
|
|
5919
5977
|
permission: { feature: "conversations", action: "read" }
|
|
5920
5978
|
},
|