@burdenoff/microfe-botmanor 2026.1201.3 → 2026.1202.1

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.
@@ -1,23 +1,29 @@
1
- import { useWorkspaceId as e, useWorkspaceMutation as t, useWorkspaceQuery as n } from "./internal/workspaceGateway.js";
1
+ import { useWorkspaceAllPagesQuery as e, useWorkspaceId as t, useWorkspaceMutation as n } from "./internal/workspaceGateway.js";
2
2
  import { useMemo as r } from "react";
3
3
  import { gql as i } from "@apollo/client";
4
4
  // src/botlit/hooks/useTemplates.ts
5
5
  var a = i`
6
- query ListBotTemplates($pagination: PaginationInput) {
7
- listAppTemplates(pagination: $pagination) {
8
- id
9
- name
10
- description
11
- category
6
+ query ListBotTemplates($pagination: BotmanorOffsetPaginationInput) {
7
+ listBotmanorAppTemplatesPage(pagination: $pagination) {
8
+ items {
9
+ id
10
+ name
11
+ description
12
+ category
13
+ }
14
+ nextOffset
12
15
  }
13
16
  }
14
17
  `, o = i`
15
- query ListAgentTemplatesForCreate($pagination: PaginationInput) {
16
- listAgentTemplates(pagination: $pagination) {
17
- id
18
- name
19
- description
20
- category
18
+ query ListAgentTemplatesForCreate($pagination: BotmanorOffsetPaginationInput) {
19
+ listBotmanorAgentTemplatesPage(pagination: $pagination) {
20
+ items {
21
+ id
22
+ name
23
+ description
24
+ category
25
+ }
26
+ nextOffset
21
27
  }
22
28
  }
23
29
  `, s = i`
@@ -38,34 +44,34 @@ var a = i`
38
44
  name
39
45
  }
40
46
  }
41
- `, l = [], u = { pagination: {
42
- limit: 100,
43
- offset: 0
44
- } };
45
- function d(t) {
46
- let i = e(), s = r(() => u, []);
47
- return n({
48
- document: t === "bot" ? a : o,
47
+ `, l = [], u = 100, d = {};
48
+ function f(n) {
49
+ let i = t(), s = r(() => d, []);
50
+ return e({
51
+ document: n === "bot" ? a : o,
49
52
  variables: s,
50
- select: (e) => (t === "bot" ? e?.listAppTemplates : e?.listAgentTemplates) ?? l,
53
+ pageSize: u,
54
+ extractRows: (e) => (n === "bot" ? e?.listBotmanorAppTemplatesPage?.items : e?.listBotmanorAgentTemplatesPage?.items) ?? l,
55
+ extractNextOffset: (e) => (n === "bot" ? e?.listBotmanorAppTemplatesPage?.nextOffset : e?.listBotmanorAgentTemplatesPage?.nextOffset) ?? null,
56
+ select: (e) => e,
51
57
  fallback: l,
52
58
  enabled: !!i,
53
59
  errorMessage: "Failed to load templates"
54
60
  });
55
61
  }
56
- function f(n) {
57
- let r = e();
58
- return t({
59
- document: n === "bot" ? s : c,
62
+ function p(e) {
63
+ let r = t();
64
+ return n({
65
+ document: e === "bot" ? s : c,
60
66
  variables: ({ name: e, templateId: t }) => ({
61
67
  name: e.trim(),
62
68
  templateId: t,
63
69
  workspaceId: r
64
70
  }),
65
- select: (e) => (n === "bot" ? e?.createAppFromTemplate : e?.createBotmanorAgentFromTemplate) ?? void 0,
66
- errorMessage: n === "bot" ? "Failed to create the bot from the template" : "Failed to create the agent from the template"
71
+ select: (t) => (e === "bot" ? t?.createAppFromTemplate : t?.createBotmanorAgentFromTemplate) ?? void 0,
72
+ errorMessage: e === "bot" ? "Failed to create the bot from the template" : "Failed to create the agent from the template"
67
73
  });
68
74
  }
69
- export { f as useCreateFromTemplate, d as useTemplates };
75
+ export { p as useCreateFromTemplate, f as useTemplates };
70
76
 
71
77
  //# sourceMappingURL=useTemplates.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useTemplates.js","names":["LIST_APP_TEMPLATES_DOCUMENT","LIST_AGENT_TEMPLATES_DOCUMENT","CREATE_APP_FROM_TEMPLATE_DOCUMENT","CREATE_AGENT_FROM_TEMPLATE_DOCUMENT","NO_TEMPLATES","PAGE","useTemplates","workspaceId","useWorkspaceId","variables","useMemo","useWorkspaceQuery","kind","data","useCreateFromTemplate","useWorkspaceMutation","name"],"sources":["../../../src/botlit/hooks/useTemplates.ts"],"sourcesContent":["/**\n * App and agent templates (BOFF-15360)\n * @module botlit/hooks\n *\n * Every workspace is provisioned with a starter catalogue of bot (app) and\n * agent templates. These hooks list them and create a bot or an agent from one\n * in a single step, the \"Create from template\" flow on the create pages.\n */\n\nimport { gql } from '@apollo/client';\nimport { useMemo } from 'react';\n\nimport {\n useWorkspaceId,\n useWorkspaceMutation,\n useWorkspaceQuery,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nexport interface TemplateRecord {\n id: string;\n name: string;\n description?: string | null;\n category?: string | null;\n}\n\ninterface ListAppTemplatesData {\n listAppTemplates?: TemplateRecord[] | null;\n}\n\ninterface ListAgentTemplatesData {\n listAgentTemplates?: TemplateRecord[] | null;\n}\n\ninterface CreatedRecord {\n id: string;\n name: string;\n}\n\ninterface CreateAppFromTemplateData {\n createAppFromTemplate?: CreatedRecord | null;\n}\n\ninterface CreateAgentFromTemplateData {\n createBotmanorAgentFromTemplate?: CreatedRecord | null;\n}\n\nconst LIST_APP_TEMPLATES_DOCUMENT = gql`\n query ListBotTemplates($pagination: PaginationInput) {\n listAppTemplates(pagination: $pagination) {\n id\n name\n description\n category\n }\n }\n`;\n\nconst LIST_AGENT_TEMPLATES_DOCUMENT = gql`\n query ListAgentTemplatesForCreate($pagination: PaginationInput) {\n listAgentTemplates(pagination: $pagination) {\n id\n name\n description\n category\n }\n }\n`;\n\nconst CREATE_APP_FROM_TEMPLATE_DOCUMENT = gql`\n mutation CreateBotFromTemplate($name: String!, $templateId: ID!, $workspaceId: ID!) {\n createAppFromTemplate(name: $name, templateId: $templateId, workspaceId: $workspaceId) {\n id\n name\n }\n }\n`;\n\nconst CREATE_AGENT_FROM_TEMPLATE_DOCUMENT = gql`\n mutation CreateAgentFromTemplate($name: String!, $templateId: ID!, $workspaceId: ID!) {\n createBotmanorAgentFromTemplate(\n name: $name\n templateId: $templateId\n workspaceId: $workspaceId\n ) {\n id\n name\n }\n }\n`;\n\nconst NO_TEMPLATES: TemplateRecord[] = [];\nconst PAGE = { pagination: { limit: 100, offset: 0 } };\n\nexport type TemplateKind = 'bot' | 'agent';\n\nexport function useTemplates(kind: TemplateKind): QueryResult<TemplateRecord[]> {\n const workspaceId = useWorkspaceId();\n const variables = useMemo(() => PAGE, []);\n return useWorkspaceQuery<ListAppTemplatesData & ListAgentTemplatesData, TemplateRecord[]>({\n document: kind === 'bot' ? LIST_APP_TEMPLATES_DOCUMENT : LIST_AGENT_TEMPLATES_DOCUMENT,\n variables,\n select: (data) =>\n (kind === 'bot' ? data?.listAppTemplates : data?.listAgentTemplates) ?? NO_TEMPLATES,\n fallback: NO_TEMPLATES,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load templates',\n });\n}\n\nexport interface CreateFromTemplateInput {\n name: string;\n templateId: string;\n}\n\nexport function useCreateFromTemplate(kind: TemplateKind) {\n const workspaceId = useWorkspaceId();\n return useWorkspaceMutation<\n CreateAppFromTemplateData & CreateAgentFromTemplateData,\n CreateFromTemplateInput,\n CreatedRecord\n >({\n document:\n kind === 'bot' ? CREATE_APP_FROM_TEMPLATE_DOCUMENT : CREATE_AGENT_FROM_TEMPLATE_DOCUMENT,\n variables: ({ name, templateId }) => ({ name: name.trim(), templateId, workspaceId }),\n select: (data) =>\n (kind === 'bot' ? data?.createAppFromTemplate : data?.createBotmanorAgentFromTemplate) ??\n undefined,\n errorMessage:\n kind === 'bot'\n ? 'Failed to create the bot from the template'\n : 'Failed to create the agent from the template',\n });\n}\n"],"mappings":";;;;AA+CA,IAAMA,IAA8B,CAAG;;;;;;;;;GAWjCC,IAAgC,CAAG;;;;;;;;;GAWnCC,IAAoC,CAAG;;;;;;;GASvCC,IAAsC,CAAG;;;;;;;;;;;GAazCC,IAAiC,CAAC,GAClCC,IAAO,EAAE,YAAY;CAAE,OAAO;CAAK,QAAQ;AAAE,EAAE;AAIrD,SAAgBC,EAAa,GAAmD;CAC9E,IAAMC,IAAcC,EAAe,GAC7BC,IAAYC,QAAcL,GAAM,CAAC,CAAC;CACxC,OAAOM,EAAmF;EACxF,UAAUC,MAAS,QAAQZ,IAA8BC;EACzD;EACA,SAAS,OACNW,MAAS,QAAQC,GAAM,mBAAmBA,GAAM,uBAAuBT;EAC1E,UAAUA;EACV,SAAS,EAAQG;EACjB,cAAc;CAChB,CAAC;AACH;AAOA,SAAgBO,EAAsB,GAAoB;CACxD,IAAMP,IAAcC,EAAe;CACnC,OAAOO,EAIL;EACA,UACEH,MAAS,QAAQV,IAAoCC;EACvD,YAAY,EAAE,SAAM,qBAAkB;GAAE,MAAMa,EAAK,KAAK;GAAG;GAAY;EAAY;EACnF,SAAS,OACNJ,MAAS,QAAQC,GAAM,wBAAwBA,GAAM,oCACtD,KAAA;EACF,cACED,MAAS,QACL,+CACA;CACR,CAAC;AACH"}
1
+ {"version":3,"file":"useTemplates.js","names":["LIST_APP_TEMPLATES_DOCUMENT","LIST_AGENT_TEMPLATES_DOCUMENT","CREATE_APP_FROM_TEMPLATE_DOCUMENT","CREATE_AGENT_FROM_TEMPLATE_DOCUMENT","NO_TEMPLATES","TEMPLATE_PAGE_SIZE","EMPTY_VARIABLES","useTemplates","workspaceId","useWorkspaceId","variables","useMemo","useWorkspaceAllPagesQuery","kind","data","rows","useCreateFromTemplate","useWorkspaceMutation","name"],"sources":["../../../src/botlit/hooks/useTemplates.ts"],"sourcesContent":["/**\n * App and agent templates (BOFF-15360)\n * @module botlit/hooks\n *\n * Every workspace is provisioned with a starter catalogue of bot (app) and\n * agent templates. These hooks list them and create a bot or an agent from one\n * in a single step, the \"Create from template\" flow on the create pages.\n */\n\nimport { gql } from '@apollo/client';\nimport { useMemo } from 'react';\n\nimport {\n useWorkspaceAllPagesQuery,\n useWorkspaceId,\n useWorkspaceMutation,\n type QueryResult,\n} from './internal/workspaceGateway';\n\nexport interface TemplateRecord {\n id: string;\n name: string;\n description?: string | null;\n category?: string | null;\n}\n\ninterface ListAppTemplatesData {\n listBotmanorAppTemplatesPage?: {\n items: TemplateRecord[];\n nextOffset: number | null;\n } | null;\n}\n\ninterface ListAgentTemplatesData {\n listBotmanorAgentTemplatesPage?: {\n items: TemplateRecord[];\n nextOffset: number | null;\n } | null;\n}\n\ninterface CreatedRecord {\n id: string;\n name: string;\n}\n\ninterface CreateAppFromTemplateData {\n createAppFromTemplate?: CreatedRecord | null;\n}\n\ninterface CreateAgentFromTemplateData {\n createBotmanorAgentFromTemplate?: CreatedRecord | null;\n}\n\nconst LIST_APP_TEMPLATES_DOCUMENT = gql`\n query ListBotTemplates($pagination: BotmanorOffsetPaginationInput) {\n listBotmanorAppTemplatesPage(pagination: $pagination) {\n items {\n id\n name\n description\n category\n }\n nextOffset\n }\n }\n`;\n\nconst LIST_AGENT_TEMPLATES_DOCUMENT = gql`\n query ListAgentTemplatesForCreate($pagination: BotmanorOffsetPaginationInput) {\n listBotmanorAgentTemplatesPage(pagination: $pagination) {\n items {\n id\n name\n description\n category\n }\n nextOffset\n }\n }\n`;\n\nconst CREATE_APP_FROM_TEMPLATE_DOCUMENT = gql`\n mutation CreateBotFromTemplate($name: String!, $templateId: ID!, $workspaceId: ID!) {\n createAppFromTemplate(name: $name, templateId: $templateId, workspaceId: $workspaceId) {\n id\n name\n }\n }\n`;\n\nconst CREATE_AGENT_FROM_TEMPLATE_DOCUMENT = gql`\n mutation CreateAgentFromTemplate($name: String!, $templateId: ID!, $workspaceId: ID!) {\n createBotmanorAgentFromTemplate(\n name: $name\n templateId: $templateId\n workspaceId: $workspaceId\n ) {\n id\n name\n }\n }\n`;\n\nconst NO_TEMPLATES: TemplateRecord[] = [];\nconst TEMPLATE_PAGE_SIZE = 100;\nconst EMPTY_VARIABLES = {};\n\nexport type TemplateKind = 'bot' | 'agent';\n\nexport function useTemplates(kind: TemplateKind): QueryResult<TemplateRecord[]> {\n const workspaceId = useWorkspaceId();\n const variables = useMemo(() => EMPTY_VARIABLES, []);\n return useWorkspaceAllPagesQuery<\n ListAppTemplatesData & ListAgentTemplatesData,\n TemplateRecord,\n TemplateRecord[]\n >({\n document: kind === 'bot' ? LIST_APP_TEMPLATES_DOCUMENT : LIST_AGENT_TEMPLATES_DOCUMENT,\n variables,\n pageSize: TEMPLATE_PAGE_SIZE,\n extractRows: (data) =>\n (kind === 'bot'\n ? data?.listBotmanorAppTemplatesPage?.items\n : data?.listBotmanorAgentTemplatesPage?.items) ?? NO_TEMPLATES,\n extractNextOffset: (data) =>\n (kind === 'bot'\n ? data?.listBotmanorAppTemplatesPage?.nextOffset\n : data?.listBotmanorAgentTemplatesPage?.nextOffset) ?? null,\n select: (rows) => rows,\n fallback: NO_TEMPLATES,\n enabled: Boolean(workspaceId),\n errorMessage: 'Failed to load templates',\n });\n}\n\nexport interface CreateFromTemplateInput {\n name: string;\n templateId: string;\n}\n\nexport function useCreateFromTemplate(kind: TemplateKind) {\n const workspaceId = useWorkspaceId();\n return useWorkspaceMutation<\n CreateAppFromTemplateData & CreateAgentFromTemplateData,\n CreateFromTemplateInput,\n CreatedRecord\n >({\n document:\n kind === 'bot' ? CREATE_APP_FROM_TEMPLATE_DOCUMENT : CREATE_AGENT_FROM_TEMPLATE_DOCUMENT,\n variables: ({ name, templateId }) => ({ name: name.trim(), templateId, workspaceId }),\n select: (data) =>\n (kind === 'bot' ? data?.createAppFromTemplate : data?.createBotmanorAgentFromTemplate) ??\n undefined,\n errorMessage:\n kind === 'bot'\n ? 'Failed to create the bot from the template'\n : 'Failed to create the agent from the template',\n });\n}\n"],"mappings":";;;;AAqDA,IAAMA,IAA8B,CAAG;;;;;;;;;;;;GAcjCC,IAAgC,CAAG;;;;;;;;;;;;GAcnCC,IAAoC,CAAG;;;;;;;GASvCC,IAAsC,CAAG;;;;;;;;;;;GAazCC,IAAiC,CAAC,GAClCC,IAAqB,KACrBC,IAAkB,CAAC;AAIzB,SAAgBC,EAAa,GAAmD;CAC9E,IAAMC,IAAcC,EAAe,GAC7BC,IAAYC,QAAcL,GAAiB,CAAC,CAAC;CACnD,OAAOM,EAIL;EACA,UAAUC,MAAS,QAAQb,IAA8BC;EACzD;EACA,UAAUI;EACV,cAAc,OACXQ,MAAS,QACNC,GAAM,8BAA8B,QACpCA,GAAM,gCAAgC,UAAUV;EACtD,oBAAoB,OACjBS,MAAS,QACNC,GAAM,8BAA8B,aACpCA,GAAM,gCAAgC,eAAe;EAC3D,SAAS,MAASC;EAClB,UAAUX;EACV,SAAS,EAAQI;EACjB,cAAc;CAChB,CAAC;AACH;AAOA,SAAgBQ,EAAsB,GAAoB;CACxD,IAAMR,IAAcC,EAAe;CACnC,OAAOQ,EAIL;EACA,UACEJ,MAAS,QAAQX,IAAoCC;EACvD,YAAY,EAAE,SAAM,qBAAkB;GAAE,MAAMe,EAAK,KAAK;GAAG;GAAY;EAAY;EACnF,SAAS,OACNL,MAAS,QAAQC,GAAM,wBAAwBA,GAAM,oCACtD,KAAA;EACF,cACED,MAAS,QACL,+CACA;CACR,CAAC;AACH"}