pika-shared 1.4.0 → 1.4.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.
Files changed (57) hide show
  1. package/dist/index.js.map +1 -1
  2. package/dist/index.mjs.map +1 -1
  3. package/dist/types/chatbot/bedrock-lambda-error.js.map +1 -1
  4. package/dist/types/chatbot/bedrock-lambda-error.mjs.map +1 -1
  5. package/dist/types/chatbot/chatbot-types.d.mts +421 -24
  6. package/dist/types/chatbot/chatbot-types.d.ts +421 -24
  7. package/dist/types/chatbot/chatbot-types.js +9 -1
  8. package/dist/types/chatbot/chatbot-types.js.map +1 -1
  9. package/dist/types/chatbot/chatbot-types.mjs +6 -2
  10. package/dist/types/chatbot/chatbot-types.mjs.map +1 -1
  11. package/dist/types/chatbot/webcomp-types.d.mts +326 -0
  12. package/dist/types/chatbot/webcomp-types.d.ts +326 -0
  13. package/dist/types/chatbot/webcomp-types.js +4 -0
  14. package/dist/types/chatbot/webcomp-types.js.map +1 -0
  15. package/dist/types/chatbot/webcomp-types.mjs +3 -0
  16. package/dist/types/chatbot/webcomp-types.mjs.map +1 -0
  17. package/dist/util/api-gateway-utils.js.map +1 -1
  18. package/dist/util/api-gateway-utils.mjs.map +1 -1
  19. package/dist/util/bad-request-error.js.map +1 -1
  20. package/dist/util/bad-request-error.mjs.map +1 -1
  21. package/dist/util/bedrock.js.map +1 -1
  22. package/dist/util/bedrock.mjs.map +1 -1
  23. package/dist/util/chatbot-shared-utils.js.map +1 -1
  24. package/dist/util/chatbot-shared-utils.mjs.map +1 -1
  25. package/dist/util/forbidden-error.js.map +1 -1
  26. package/dist/util/forbidden-error.mjs.map +1 -1
  27. package/dist/util/http-status-error.js.map +1 -1
  28. package/dist/util/http-status-error.mjs.map +1 -1
  29. package/dist/util/icon-utils.d.mts +12 -0
  30. package/dist/util/icon-utils.d.ts +12 -0
  31. package/dist/util/icon-utils.js +26 -0
  32. package/dist/util/icon-utils.js.map +1 -0
  33. package/dist/util/icon-utils.mjs +24 -0
  34. package/dist/util/icon-utils.mjs.map +1 -0
  35. package/dist/util/instruction-assistance-utils.d.mts +28 -1
  36. package/dist/util/instruction-assistance-utils.d.ts +28 -1
  37. package/dist/util/instruction-assistance-utils.js +56 -8
  38. package/dist/util/instruction-assistance-utils.js.map +1 -1
  39. package/dist/util/instruction-assistance-utils.mjs +55 -9
  40. package/dist/util/instruction-assistance-utils.mjs.map +1 -1
  41. package/dist/util/jwt.js.map +1 -1
  42. package/dist/util/jwt.mjs.map +1 -1
  43. package/dist/util/server-client-utils.js.map +1 -1
  44. package/dist/util/server-client-utils.mjs.map +1 -1
  45. package/dist/util/server-utils.js +6 -2
  46. package/dist/util/server-utils.js.map +1 -1
  47. package/dist/util/server-utils.mjs +6 -2
  48. package/dist/util/server-utils.mjs.map +1 -1
  49. package/dist/util/unauthorized-error.js.map +1 -1
  50. package/dist/util/unauthorized-error.mjs.map +1 -1
  51. package/dist/util/wc-utils.d.mts +22 -0
  52. package/dist/util/wc-utils.d.ts +22 -0
  53. package/dist/util/wc-utils.js +26 -0
  54. package/dist/util/wc-utils.js.map +1 -0
  55. package/dist/util/wc-utils.mjs +24 -0
  56. package/dist/util/wc-utils.mjs.map +1 -0
  57. package/package.json +1 -1
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/util/http-status-error.ts","../../src/util/unauthorized-error.ts"],"names":[],"mappings":";;;AAGO,IAAM,eAAA,GAAN,cAA8B,KAAM,CAAA;AAAA,EACvC,WAAA,CACI,SACgB,UAClB,EAAA;AACE,IAAA,KAAA,CAAM,OAAO,CAAA;AAFG,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAAA;AAIxB,CAAA;;;ACRa,IAAA,iBAAA,GAAN,cAAgC,eAAgB,CAAA;AAAA,EACnD,YAAY,OAAiB,EAAA;AACzB,IAAA,KAAA,CAAM,SAAS,GAAG,CAAA;AAAA;AAE1B","file":"unauthorized-error.js","sourcesContent":["/**\n * Throw this error to return a specific HTTP status code from an API Gateway Lambda function.\n */\nexport class HttpStatusError extends Error {\n constructor(\n message: string,\n public readonly statusCode: number\n ) {\n super(message);\n }\n}\n","import { HttpStatusError } from './http-status-error';\n\nexport class UnauthorizedError extends HttpStatusError {\n constructor(message: string) {\n super(message, 401);\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/util/http-status-error.ts","../../src/util/unauthorized-error.ts"],"names":[],"mappings":";;;AAGO,IAAM,eAAA,GAAN,cAA8B,KAAA,CAAM;AAAA,EACvC,WAAA,CACI,SACgB,UAAA,EAClB;AACE,IAAA,KAAA,CAAM,OAAO,CAAA;AAFG,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAAA,EAGpB;AACJ,CAAA;;;ACRO,IAAM,iBAAA,GAAN,cAAgC,eAAA,CAAgB;AAAA,EACnD,YAAY,OAAA,EAAiB;AACzB,IAAA,KAAA,CAAM,SAAS,GAAG,CAAA;AAAA,EACtB;AACJ","file":"unauthorized-error.js","sourcesContent":["/**\n * Throw this error to return a specific HTTP status code from an API Gateway Lambda function.\n */\nexport class HttpStatusError extends Error {\n constructor(\n message: string,\n public readonly statusCode: number\n ) {\n super(message);\n }\n}\n","import { HttpStatusError } from './http-status-error';\n\nexport class UnauthorizedError extends HttpStatusError {\n constructor(message: string) {\n super(message, 401);\n }\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/util/http-status-error.ts","../../src/util/unauthorized-error.ts"],"names":[],"mappings":";AAGO,IAAM,eAAA,GAAN,cAA8B,KAAM,CAAA;AAAA,EACvC,WAAA,CACI,SACgB,UAClB,EAAA;AACE,IAAA,KAAA,CAAM,OAAO,CAAA;AAFG,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAAA;AAIxB,CAAA;;;ACRa,IAAA,iBAAA,GAAN,cAAgC,eAAgB,CAAA;AAAA,EACnD,YAAY,OAAiB,EAAA;AACzB,IAAA,KAAA,CAAM,SAAS,GAAG,CAAA;AAAA;AAE1B","file":"unauthorized-error.mjs","sourcesContent":["/**\n * Throw this error to return a specific HTTP status code from an API Gateway Lambda function.\n */\nexport class HttpStatusError extends Error {\n constructor(\n message: string,\n public readonly statusCode: number\n ) {\n super(message);\n }\n}\n","import { HttpStatusError } from './http-status-error';\n\nexport class UnauthorizedError extends HttpStatusError {\n constructor(message: string) {\n super(message, 401);\n }\n}\n"]}
1
+ {"version":3,"sources":["../../src/util/http-status-error.ts","../../src/util/unauthorized-error.ts"],"names":[],"mappings":";AAGO,IAAM,eAAA,GAAN,cAA8B,KAAA,CAAM;AAAA,EACvC,WAAA,CACI,SACgB,UAAA,EAClB;AACE,IAAA,KAAA,CAAM,OAAO,CAAA;AAFG,IAAA,IAAA,CAAA,UAAA,GAAA,UAAA;AAAA,EAGpB;AACJ,CAAA;;;ACRO,IAAM,iBAAA,GAAN,cAAgC,eAAA,CAAgB;AAAA,EACnD,YAAY,OAAA,EAAiB;AACzB,IAAA,KAAA,CAAM,SAAS,GAAG,CAAA;AAAA,EACtB;AACJ","file":"unauthorized-error.mjs","sourcesContent":["/**\n * Throw this error to return a specific HTTP status code from an API Gateway Lambda function.\n */\nexport class HttpStatusError extends Error {\n constructor(\n message: string,\n public readonly statusCode: number\n ) {\n super(message);\n }\n}\n","import { HttpStatusError } from './http-status-error';\n\nexport class UnauthorizedError extends HttpStatusError {\n constructor(message: string) {\n super(message, 401);\n }\n}\n"]}
@@ -0,0 +1,22 @@
1
+ import { PikaWCContext } from '../types/chatbot/webcomp-types.mjs';
2
+ import '../types/upload-types.mjs';
3
+ import '../types/chatbot/chatbot-types.mjs';
4
+ import '@aws-sdk/client-bedrock-agent-runtime';
5
+ import '@aws-sdk/client-bedrock-agentcore';
6
+
7
+ /**
8
+ * Web component authors can use this function to get the Pika context when their web component is rendered.
9
+ *
10
+ * The type of the context object is defined in the PikaWCContext interface.
11
+ *
12
+ * @see PikaWCContext
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const ctx: PikaWCContext = await getPikaContext(el);
17
+ * console.log(ctx.appState.identity.user.fullName);
18
+ * ```
19
+ */
20
+ declare function getPikaContext(el: HTMLElement): Promise<PikaWCContext>;
21
+
22
+ export { getPikaContext };
@@ -0,0 +1,22 @@
1
+ import { PikaWCContext } from '../types/chatbot/webcomp-types.js';
2
+ import '../types/upload-types.js';
3
+ import '../types/chatbot/chatbot-types.js';
4
+ import '@aws-sdk/client-bedrock-agent-runtime';
5
+ import '@aws-sdk/client-bedrock-agentcore';
6
+
7
+ /**
8
+ * Web component authors can use this function to get the Pika context when their web component is rendered.
9
+ *
10
+ * The type of the context object is defined in the PikaWCContext interface.
11
+ *
12
+ * @see PikaWCContext
13
+ *
14
+ * @example
15
+ * ```ts
16
+ * const ctx: PikaWCContext = await getPikaContext(el);
17
+ * console.log(ctx.appState.identity.user.fullName);
18
+ * ```
19
+ */
20
+ declare function getPikaContext(el: HTMLElement): Promise<PikaWCContext>;
21
+
22
+ export { getPikaContext };
@@ -0,0 +1,26 @@
1
+ 'use strict';
2
+
3
+ // src/util/wc-utils.ts
4
+ function getPikaContext(el) {
5
+ return new Promise((resolve, reject) => {
6
+ const timeout = setTimeout(() => {
7
+ reject(new Error("Pika context not provided - component must be rendered within a Pika chat app"));
8
+ }, 1e3);
9
+ el.dispatchEvent(
10
+ new CustomEvent("pika-wc-context-request", {
11
+ bubbles: true,
12
+ composed: true,
13
+ detail: {
14
+ callback: (ctx) => {
15
+ clearTimeout(timeout);
16
+ resolve(ctx);
17
+ }
18
+ }
19
+ })
20
+ );
21
+ });
22
+ }
23
+
24
+ exports.getPikaContext = getPikaContext;
25
+ //# sourceMappingURL=wc-utils.js.map
26
+ //# sourceMappingURL=wc-utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/util/wc-utils.ts"],"names":[],"mappings":";;;AAeO,SAAS,eAAe,EAAA,EAAyC;AACpE,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,EAAS,MAAA,KAAW;AACpC,IAAA,MAAM,OAAA,GAAU,WAAW,MAAM;AAC7B,MAAA,MAAA,CAAO,IAAI,KAAA,CAAM,+EAA+E,CAAC,CAAA;AAAA,IACrG,GAAG,GAAI,CAAA;AAEP,IAAA,EAAA,CAAG,aAAA;AAAA,MACC,IAAI,YAAwC,yBAAA,EAA2B;AAAA,QACnE,OAAA,EAAS,IAAA;AAAA,QACT,QAAA,EAAU,IAAA;AAAA,QACV,MAAA,EAAQ;AAAA,UACJ,QAAA,EAAU,CAAC,GAAA,KAAuB;AAC9B,YAAA,YAAA,CAAa,OAAO,CAAA;AACpB,YAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,UACf;AAAA;AACJ,OACH;AAAA,KACL;AAAA,EACJ,CAAC,CAAA;AACL","file":"wc-utils.js","sourcesContent":["import { PikaWCContext, PikaWCContextRequestDetail } from '../types/chatbot/webcomp-types';\n\n/**\n * Web component authors can use this function to get the Pika context when their web component is rendered.\n *\n * The type of the context object is defined in the PikaWCContext interface.\n *\n * @see PikaWCContext\n *\n * @example\n * ```ts\n * const ctx: PikaWCContext = await getPikaContext(el);\n * console.log(ctx.appState.identity.user.fullName);\n * ```\n */\nexport function getPikaContext(el: HTMLElement): Promise<PikaWCContext> {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n reject(new Error('Pika context not provided - component must be rendered within a Pika chat app'));\n }, 1000);\n\n el.dispatchEvent(\n new CustomEvent<PikaWCContextRequestDetail>('pika-wc-context-request', {\n bubbles: true,\n composed: true,\n detail: {\n callback: (ctx: PikaWCContext) => {\n clearTimeout(timeout);\n resolve(ctx);\n }\n }\n })\n );\n });\n}\n"]}
@@ -0,0 +1,24 @@
1
+ // src/util/wc-utils.ts
2
+ function getPikaContext(el) {
3
+ return new Promise((resolve, reject) => {
4
+ const timeout = setTimeout(() => {
5
+ reject(new Error("Pika context not provided - component must be rendered within a Pika chat app"));
6
+ }, 1e3);
7
+ el.dispatchEvent(
8
+ new CustomEvent("pika-wc-context-request", {
9
+ bubbles: true,
10
+ composed: true,
11
+ detail: {
12
+ callback: (ctx) => {
13
+ clearTimeout(timeout);
14
+ resolve(ctx);
15
+ }
16
+ }
17
+ })
18
+ );
19
+ });
20
+ }
21
+
22
+ export { getPikaContext };
23
+ //# sourceMappingURL=wc-utils.mjs.map
24
+ //# sourceMappingURL=wc-utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/util/wc-utils.ts"],"names":[],"mappings":";AAeO,SAAS,eAAe,EAAA,EAAyC;AACpE,EAAA,OAAO,IAAI,OAAA,CAAQ,CAAC,OAAA,EAAS,MAAA,KAAW;AACpC,IAAA,MAAM,OAAA,GAAU,WAAW,MAAM;AAC7B,MAAA,MAAA,CAAO,IAAI,KAAA,CAAM,+EAA+E,CAAC,CAAA;AAAA,IACrG,GAAG,GAAI,CAAA;AAEP,IAAA,EAAA,CAAG,aAAA;AAAA,MACC,IAAI,YAAwC,yBAAA,EAA2B;AAAA,QACnE,OAAA,EAAS,IAAA;AAAA,QACT,QAAA,EAAU,IAAA;AAAA,QACV,MAAA,EAAQ;AAAA,UACJ,QAAA,EAAU,CAAC,GAAA,KAAuB;AAC9B,YAAA,YAAA,CAAa,OAAO,CAAA;AACpB,YAAA,OAAA,CAAQ,GAAG,CAAA;AAAA,UACf;AAAA;AACJ,OACH;AAAA,KACL;AAAA,EACJ,CAAC,CAAA;AACL","file":"wc-utils.mjs","sourcesContent":["import { PikaWCContext, PikaWCContextRequestDetail } from '../types/chatbot/webcomp-types';\n\n/**\n * Web component authors can use this function to get the Pika context when their web component is rendered.\n *\n * The type of the context object is defined in the PikaWCContext interface.\n *\n * @see PikaWCContext\n *\n * @example\n * ```ts\n * const ctx: PikaWCContext = await getPikaContext(el);\n * console.log(ctx.appState.identity.user.fullName);\n * ```\n */\nexport function getPikaContext(el: HTMLElement): Promise<PikaWCContext> {\n return new Promise((resolve, reject) => {\n const timeout = setTimeout(() => {\n reject(new Error('Pika context not provided - component must be rendered within a Pika chat app'));\n }, 1000);\n\n el.dispatchEvent(\n new CustomEvent<PikaWCContextRequestDetail>('pika-wc-context-request', {\n bubbles: true,\n composed: true,\n detail: {\n callback: (ctx: PikaWCContext) => {\n clearTimeout(timeout);\n resolve(ctx);\n }\n }\n })\n );\n });\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "pika-shared",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.mjs",
6
6
  "types": "./dist/index.d.ts",