@fayz-ai/sdk 0.8.3 → 0.8.5

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 (64) hide show
  1. package/dist/agent.d.ts +57 -0
  2. package/dist/agent.d.ts.map +1 -1
  3. package/dist/agent.js +1 -1
  4. package/dist/{chunk-SKARZBEH.js → chunk-F6PAMHPI.js} +59 -59
  5. package/dist/{chunk-SKARZBEH.js.map → chunk-F6PAMHPI.js.map} +1 -1
  6. package/dist/chunk-LSBVNW75.js +139 -0
  7. package/dist/chunk-LSBVNW75.js.map +1 -0
  8. package/dist/{chunk-7ZHG7XTA.js → chunk-V4GWI7WH.js} +12 -13
  9. package/dist/chunk-V4GWI7WH.js.map +1 -0
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js +3 -3
  13. package/dist/release-channels.js +1 -1
  14. package/dist/shop.d.ts.map +1 -1
  15. package/dist/shop.js +1 -1
  16. package/dist/vite.js +1 -1
  17. package/dist/vite.js.map +1 -1
  18. package/package.json +15 -24
  19. package/src/agent.ts +152 -5
  20. package/src/index.ts +3 -0
  21. package/src/release-channels.json +57 -57
  22. package/src/shop.ts +22 -20
  23. package/src/vite.ts +1 -1
  24. package/dist/agent.cjs +0 -16
  25. package/dist/agent.cjs.map +0 -1
  26. package/dist/ai-builder.cjs +0 -20
  27. package/dist/ai-builder.cjs.map +0 -1
  28. package/dist/app-params.cjs +0 -16
  29. package/dist/app-params.cjs.map +0 -1
  30. package/dist/chunk-746EA3BV.cjs +0 -774
  31. package/dist/chunk-746EA3BV.cjs.map +0 -1
  32. package/dist/chunk-7UZH4XEV.cjs +0 -66
  33. package/dist/chunk-7UZH4XEV.cjs.map +0 -1
  34. package/dist/chunk-7ZHG7XTA.js.map +0 -1
  35. package/dist/chunk-B6FHOO34.cjs +0 -63
  36. package/dist/chunk-B6FHOO34.cjs.map +0 -1
  37. package/dist/chunk-DAUDGR5N.cjs +0 -88
  38. package/dist/chunk-DAUDGR5N.cjs.map +0 -1
  39. package/dist/chunk-DK3ZA6NA.cjs +0 -139
  40. package/dist/chunk-DK3ZA6NA.cjs.map +0 -1
  41. package/dist/chunk-ENWSXKQE.cjs +0 -125
  42. package/dist/chunk-ENWSXKQE.cjs.map +0 -1
  43. package/dist/chunk-VPMRURSI.js +0 -63
  44. package/dist/chunk-VPMRURSI.js.map +0 -1
  45. package/dist/chunk-WMH7SIER.cjs +0 -140
  46. package/dist/chunk-WMH7SIER.cjs.map +0 -1
  47. package/dist/chunk-ZMHI2XGY.cjs +0 -68
  48. package/dist/chunk-ZMHI2XGY.cjs.map +0 -1
  49. package/dist/client.cjs +0 -22
  50. package/dist/client.cjs.map +0 -1
  51. package/dist/index.cjs +0 -103
  52. package/dist/index.cjs.map +0 -1
  53. package/dist/release-channels.cjs +0 -24
  54. package/dist/release-channels.cjs.map +0 -1
  55. package/dist/runtime.cjs +0 -16
  56. package/dist/runtime.cjs.map +0 -1
  57. package/dist/shop.cjs +0 -20
  58. package/dist/shop.cjs.map +0 -1
  59. package/dist/supported-surface.cjs +0 -24
  60. package/dist/supported-surface.cjs.map +0 -1
  61. package/dist/types.cjs +0 -4
  62. package/dist/types.cjs.map +0 -1
  63. package/dist/vite.cjs +0 -101
  64. package/dist/vite.cjs.map +0 -1
package/src/index.ts CHANGED
@@ -43,6 +43,9 @@ export {
43
43
  } from './runtime'
44
44
  export { createFayzAgentClient, FayzAgentError } from './agent'
45
45
  export type {
46
+ AgentAttachmentColumn,
47
+ AgentAttachmentDigest,
48
+ AgentAttachmentSheet,
46
49
  FayzAgentChatInput,
47
50
  FayzAgentChatResponse,
48
51
  FayzAgentClient,
@@ -1,103 +1,103 @@
1
1
  {
2
2
  "channels": {
3
3
  "stable": {
4
- "@fayz-ai/sdk": "^0.8.1",
5
- "@fayz-ai/core": "^0.8.1",
6
- "@fayz-ai/auth": "^0.8.1",
7
- "@fayz-ai/ui": "^0.8.1",
8
- "@fayz-ai/saas": "^0.8.1",
9
- "@fayz-ai/shop": "^0.8.0",
10
- "@fayz-ai/storefront": "^0.8.0",
4
+ "@fayz-ai/sdk": "^0.8.4",
5
+ "@fayz-ai/core": "^0.8.4",
6
+ "@fayz-ai/auth": "^0.8.4",
7
+ "@fayz-ai/ui": "^0.8.4",
8
+ "@fayz-ai/saas": "^0.8.4",
9
+ "@fayz-ai/shop": "^0.8.4",
10
+ "@fayz-ai/storefront": "^0.8.4",
11
11
  "@fayz-ai/portal": "^0.8.0",
12
- "@fayz-ai/courses": "^0.8.0",
13
- "@fayz-ai/db": "^0.8.0",
14
- "@fayz-ai/plugin-agenda": "^0.8.1",
12
+ "@fayz-ai/courses": "^0.8.1",
13
+ "@fayz-ai/db": "^0.8.4",
14
+ "@fayz-ai/plugin-agenda": "^0.8.4",
15
15
  "@fayz-ai/plugin-auth": "^0.8.0",
16
16
  "@fayz-ai/plugin-automations": "^0.8.0",
17
17
  "@fayz-ai/plugin-blog": "^0.8.1",
18
- "@fayz-ai/plugin-conversations": "^0.8.0",
19
- "@fayz-ai/plugin-courses": "^0.8.0",
20
- "@fayz-ai/plugin-crm": "^0.8.0",
18
+ "@fayz-ai/plugin-conversations": "^0.8.3",
19
+ "@fayz-ai/plugin-courses": "^0.8.4",
20
+ "@fayz-ai/plugin-crm": "^0.8.4",
21
21
  "@fayz-ai/plugin-dashboard": "^0.8.0",
22
- "@fayz-ai/plugin-financial": "^0.8.0",
23
- "@fayz-ai/plugin-forms": "^0.8.0",
24
- "@fayz-ai/plugin-inventory": "^0.8.0",
25
- "@fayz-ai/plugin-marketing": "^0.8.1",
22
+ "@fayz-ai/plugin-financial": "^0.8.4",
23
+ "@fayz-ai/plugin-forms": "^0.8.1",
24
+ "@fayz-ai/plugin-inventory": "^0.8.3",
25
+ "@fayz-ai/plugin-marketing": "^0.8.2",
26
26
  "@fayz-ai/plugin-menu": "^0.8.0",
27
27
  "@fayz-ai/plugin-orders": "^0.8.0",
28
28
  "@fayz-ai/plugin-payments": "^0.8.0",
29
29
  "@fayz-ai/plugin-reports": "^0.8.0",
30
30
  "@fayz-ai/plugin-reputation": "^0.8.0",
31
- "@fayz-ai/plugin-shop": "^0.8.0",
31
+ "@fayz-ai/plugin-shop": "^0.8.4",
32
32
  "@fayz-ai/plugin-sites": "^0.8.0",
33
33
  "@fayz-ai/plugin-tables": "^0.8.0",
34
- "@fayz-ai/plugin-tasks": "^0.8.0"
34
+ "@fayz-ai/plugin-tasks": "^0.8.3"
35
35
  },
36
36
  "latest": {
37
- "@fayz-ai/sdk": "^0.8.1",
38
- "@fayz-ai/core": "^0.8.1",
39
- "@fayz-ai/auth": "^0.8.1",
40
- "@fayz-ai/ui": "^0.8.1",
41
- "@fayz-ai/saas": "^0.8.1",
42
- "@fayz-ai/shop": "^0.8.0",
43
- "@fayz-ai/storefront": "^0.8.0",
37
+ "@fayz-ai/sdk": "^0.8.4",
38
+ "@fayz-ai/core": "^0.8.4",
39
+ "@fayz-ai/auth": "^0.8.4",
40
+ "@fayz-ai/ui": "^0.8.4",
41
+ "@fayz-ai/saas": "^0.8.4",
42
+ "@fayz-ai/shop": "^0.8.4",
43
+ "@fayz-ai/storefront": "^0.8.4",
44
44
  "@fayz-ai/portal": "^0.8.0",
45
- "@fayz-ai/courses": "^0.8.0",
46
- "@fayz-ai/db": "^0.8.0",
47
- "@fayz-ai/plugin-agenda": "^0.8.1",
45
+ "@fayz-ai/courses": "^0.8.1",
46
+ "@fayz-ai/db": "^0.8.4",
47
+ "@fayz-ai/plugin-agenda": "^0.8.4",
48
48
  "@fayz-ai/plugin-auth": "^0.8.0",
49
49
  "@fayz-ai/plugin-automations": "^0.8.0",
50
50
  "@fayz-ai/plugin-blog": "^0.8.1",
51
- "@fayz-ai/plugin-conversations": "^0.8.0",
52
- "@fayz-ai/plugin-courses": "^0.8.0",
53
- "@fayz-ai/plugin-crm": "^0.8.0",
51
+ "@fayz-ai/plugin-conversations": "^0.8.3",
52
+ "@fayz-ai/plugin-courses": "^0.8.4",
53
+ "@fayz-ai/plugin-crm": "^0.8.4",
54
54
  "@fayz-ai/plugin-dashboard": "^0.8.0",
55
- "@fayz-ai/plugin-financial": "^0.8.0",
56
- "@fayz-ai/plugin-forms": "^0.8.0",
57
- "@fayz-ai/plugin-inventory": "^0.8.0",
58
- "@fayz-ai/plugin-marketing": "^0.8.1",
55
+ "@fayz-ai/plugin-financial": "^0.8.4",
56
+ "@fayz-ai/plugin-forms": "^0.8.1",
57
+ "@fayz-ai/plugin-inventory": "^0.8.3",
58
+ "@fayz-ai/plugin-marketing": "^0.8.2",
59
59
  "@fayz-ai/plugin-menu": "^0.8.0",
60
60
  "@fayz-ai/plugin-orders": "^0.8.0",
61
61
  "@fayz-ai/plugin-payments": "^0.8.0",
62
62
  "@fayz-ai/plugin-reports": "^0.8.0",
63
63
  "@fayz-ai/plugin-reputation": "^0.8.0",
64
- "@fayz-ai/plugin-shop": "^0.8.0",
64
+ "@fayz-ai/plugin-shop": "^0.8.4",
65
65
  "@fayz-ai/plugin-sites": "^0.8.0",
66
66
  "@fayz-ai/plugin-tables": "^0.8.0",
67
- "@fayz-ai/plugin-tasks": "^0.8.0"
67
+ "@fayz-ai/plugin-tasks": "^0.8.3"
68
68
  },
69
69
  "preview": {
70
- "@fayz-ai/sdk": "^0.8.1",
71
- "@fayz-ai/core": "^0.8.1",
72
- "@fayz-ai/auth": "^0.8.1",
73
- "@fayz-ai/ui": "^0.8.1",
74
- "@fayz-ai/saas": "^0.8.1",
75
- "@fayz-ai/shop": "^0.8.0",
76
- "@fayz-ai/storefront": "^0.8.0",
70
+ "@fayz-ai/sdk": "^0.8.4",
71
+ "@fayz-ai/core": "^0.8.4",
72
+ "@fayz-ai/auth": "^0.8.4",
73
+ "@fayz-ai/ui": "^0.8.4",
74
+ "@fayz-ai/saas": "^0.8.4",
75
+ "@fayz-ai/shop": "^0.8.4",
76
+ "@fayz-ai/storefront": "^0.8.4",
77
77
  "@fayz-ai/portal": "^0.8.0",
78
- "@fayz-ai/courses": "^0.8.0",
79
- "@fayz-ai/db": "^0.8.0",
80
- "@fayz-ai/plugin-agenda": "^0.8.1",
78
+ "@fayz-ai/courses": "^0.8.1",
79
+ "@fayz-ai/db": "^0.8.4",
80
+ "@fayz-ai/plugin-agenda": "^0.8.4",
81
81
  "@fayz-ai/plugin-auth": "^0.8.0",
82
82
  "@fayz-ai/plugin-automations": "^0.8.0",
83
83
  "@fayz-ai/plugin-blog": "^0.8.1",
84
- "@fayz-ai/plugin-conversations": "^0.8.0",
85
- "@fayz-ai/plugin-courses": "^0.8.0",
86
- "@fayz-ai/plugin-crm": "^0.8.0",
84
+ "@fayz-ai/plugin-conversations": "^0.8.3",
85
+ "@fayz-ai/plugin-courses": "^0.8.4",
86
+ "@fayz-ai/plugin-crm": "^0.8.4",
87
87
  "@fayz-ai/plugin-dashboard": "^0.8.0",
88
- "@fayz-ai/plugin-financial": "^0.8.0",
89
- "@fayz-ai/plugin-forms": "^0.8.0",
90
- "@fayz-ai/plugin-inventory": "^0.8.0",
91
- "@fayz-ai/plugin-marketing": "^0.8.1",
88
+ "@fayz-ai/plugin-financial": "^0.8.4",
89
+ "@fayz-ai/plugin-forms": "^0.8.1",
90
+ "@fayz-ai/plugin-inventory": "^0.8.3",
91
+ "@fayz-ai/plugin-marketing": "^0.8.2",
92
92
  "@fayz-ai/plugin-menu": "^0.8.0",
93
93
  "@fayz-ai/plugin-orders": "^0.8.0",
94
94
  "@fayz-ai/plugin-payments": "^0.8.0",
95
95
  "@fayz-ai/plugin-reports": "^0.8.0",
96
96
  "@fayz-ai/plugin-reputation": "^0.8.0",
97
- "@fayz-ai/plugin-shop": "^0.8.0",
97
+ "@fayz-ai/plugin-shop": "^0.8.4",
98
98
  "@fayz-ai/plugin-sites": "^0.8.0",
99
99
  "@fayz-ai/plugin-tables": "^0.8.0",
100
- "@fayz-ai/plugin-tasks": "^0.8.0"
100
+ "@fayz-ai/plugin-tasks": "^0.8.3"
101
101
  }
102
102
  }
103
103
  }
package/src/shop.ts CHANGED
@@ -599,28 +599,30 @@ export function createFayzShopProvider(options: FayzShopProviderOptions) {
599
599
  query.set('order', 'created_at.desc')
600
600
  if (options?.limit) query.set('limit', String(options.limit))
601
601
  if (options?.offset) query.set('offset', String(options.offset))
602
-
603
- // Same shape as getOrder above: an anon storefront has no table grant, so
604
- // the direct read throws 401 and must fall through instead of surfacing as
605
- // "you have no orders". This is what made "Minhas compras" empty after a
606
- // guest checkout — the order was there, the read just wasn't allowed.
602
+ // Anon storefronts have no table grant (RLS restricts plg_shop_orders reads to
603
+ // `authenticated` users linked via auth.uid) — direct read 401s. RLS can also
604
+ // just filter every row out silently (200 OK + []) instead of 401ing, so an
605
+ // empty result here doesn't mean "no orders" either — both cases must fall
606
+ // back to the customer-uuid-capability RPC, same pattern as getOrder's
607
+ // shop_get_order. This is what made "Minhas compras" empty after a guest
608
+ // checkout — the order was there, the read just wasn't allowed (or silently
609
+ // filtered), and only the throw case used to be handled.
610
+ let rows: OrderRow[] = []
607
611
  try {
608
- return (await request<OrderRow[]>('plg_shop_orders', { query })).map(rowToOrder)
609
- } catch (err) {
610
- // Only the customer-scoped query has an RPC counterpart: shop_list_orders
611
- // treats the customer uuid as the read capability, exactly like
612
- // shop_get_order treats the order uuid. Any other filter combination has
613
- // no anon-safe equivalent, so the original error stands.
614
- if (!options?.customerId) throw err
615
- const rows = await request<OrderRow[]>('rpc/shop_list_orders', {
616
- method: 'POST',
617
- body: JSON.stringify({
618
- p_customer_id: options.customerId,
619
- p_limit: options.limit ?? 50,
620
- }),
621
- })
622
- return (rows ?? []).map(rowToOrder)
612
+ rows = await request<OrderRow[]>('plg_shop_orders', { query })
613
+ } catch (error) {
614
+ if (!options?.customerId) throw error
623
615
  }
616
+ if (rows.length || !options?.customerId) return rows.map(rowToOrder)
617
+ // Only the customer-scoped query has an RPC counterpart: shop_list_orders
618
+ // treats the customer uuid as the read capability, exactly like
619
+ // shop_get_order treats the order uuid. Any other filter combination has
620
+ // no anon-safe equivalent, so the original error (if any) stands.
621
+ const rpcRows = await request<OrderRow[]>('rpc/shop_list_orders', {
622
+ method: 'POST',
623
+ body: JSON.stringify({ p_customer_id: options.customerId, p_limit: options.limit ?? 50 }),
624
+ })
625
+ return (rpcRows ?? []).map(rowToOrder)
624
626
  },
625
627
  async getOrder(id: string) {
626
628
  const query = singleById(id)
package/src/vite.ts CHANGED
@@ -94,7 +94,7 @@ export function fayzVite(opts: FayzViteOptions = {}): UserConfig {
94
94
  // (so they're hoisted to its root node_modules) — deduping a transitive
95
95
  // like @tanstack/react-table makes Vite resolve it from the app root,
96
96
  // which fails in local-source mode and 500s the aliased UI source.
97
- dedupe: userDedupe ?? ['react', 'react-dom', 'zustand', 'lucide-react'],
97
+ dedupe: userDedupe ?? ['react', 'react-dom', 'zustand', 'lucide-react', '@supabase/supabase-js', 'sonner'],
98
98
  conditions: useLocal ? ['source', 'browser', 'module', 'jsnext:main', 'jsnext'] : undefined,
99
99
  },
100
100
  optimizeDeps: { exclude: useLocal ? Object.keys(localAliases) : [] },
package/dist/agent.cjs DELETED
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- var chunk7UZH4XEV_cjs = require('./chunk-7UZH4XEV.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "FayzAgentError", {
8
- enumerable: true,
9
- get: function () { return chunk7UZH4XEV_cjs.FayzAgentError; }
10
- });
11
- Object.defineProperty(exports, "createFayzAgentClient", {
12
- enumerable: true,
13
- get: function () { return chunk7UZH4XEV_cjs.createFayzAgentClient; }
14
- });
15
- //# sourceMappingURL=agent.cjs.map
16
- //# sourceMappingURL=agent.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"agent.cjs"}
@@ -1,20 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkDAUDGR5N_cjs = require('./chunk-DAUDGR5N.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "AI_BUILDER_REQUEST_CLASSES", {
8
- enumerable: true,
9
- get: function () { return chunkDAUDGR5N_cjs.AI_BUILDER_REQUEST_CLASSES; }
10
- });
11
- Object.defineProperty(exports, "AI_BUILDER_REQUEST_CLASS_IDS", {
12
- enumerable: true,
13
- get: function () { return chunkDAUDGR5N_cjs.AI_BUILDER_REQUEST_CLASS_IDS; }
14
- });
15
- Object.defineProperty(exports, "isAllowedRequestClass", {
16
- enumerable: true,
17
- get: function () { return chunkDAUDGR5N_cjs.isAllowedRequestClass; }
18
- });
19
- //# sourceMappingURL=ai-builder.cjs.map
20
- //# sourceMappingURL=ai-builder.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"ai-builder.cjs"}
@@ -1,16 +0,0 @@
1
- 'use strict';
2
-
3
- var chunkZMHI2XGY_cjs = require('./chunk-ZMHI2XGY.cjs');
4
-
5
-
6
-
7
- Object.defineProperty(exports, "appParams", {
8
- enumerable: true,
9
- get: function () { return chunkZMHI2XGY_cjs.appParams; }
10
- });
11
- Object.defineProperty(exports, "resolveAppParams", {
12
- enumerable: true,
13
- get: function () { return chunkZMHI2XGY_cjs.resolveAppParams; }
14
- });
15
- //# sourceMappingURL=app-params.cjs.map
16
- //# sourceMappingURL=app-params.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":[],"names":[],"mappings":"","file":"app-params.cjs"}