@pluslabs/utils 0.1.2 → 0.2.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.
@@ -0,0 +1,18 @@
1
+ type ProactiveRequestData = {
2
+ request_id: string;
3
+ assistant_id: string;
4
+ client_id: string;
5
+ client_phone_number: string;
6
+ };
7
+ declare const gpt: {
8
+ extension: {
9
+ /**
10
+ * Send a proactive request to MagicGPT extension
11
+ * @param source String to identify the source of the request
12
+ * @param data ProactiveRequestData to send to the GPT
13
+ */
14
+ proactiveRequest: (source: string, data: ProactiveRequestData) => void;
15
+ };
16
+ };
17
+ export default gpt;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gpt/index.ts"],"names":[],"mappings":"AAAA,KAAK,oBAAoB,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,GAAG;;QAED;;;;WAIG;mCACwB,MAAM,QAAQ,oBAAoB;;CAmBpE,CAAC;AAEF,eAAe,GAAG,CAAC"}
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const gpt = {
4
+ extension: {
5
+ /**
6
+ * Send a proactive request to MagicGPT extension
7
+ * @param source String to identify the source of the request
8
+ * @param data ProactiveRequestData to send to the GPT
9
+ */
10
+ proactiveRequest: (source, data) => {
11
+ window.postMessage(JSON.stringify({
12
+ action: 'proactive.request',
13
+ data: btoa(JSON.stringify({
14
+ source,
15
+ data: {
16
+ request_id: data.request_id,
17
+ assistant_id: data.assistant_id,
18
+ client_id: data.client_id,
19
+ client_phone_number: data.client_phone_number
20
+ }
21
+ }))
22
+ }));
23
+ }
24
+ }
25
+ };
26
+ exports.default = gpt;
27
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/gpt/index.ts"],"names":[],"mappings":";;AAOA,MAAM,GAAG,GAAG;IACR,SAAS,EAAE;QACP;;;;WAIG;QACH,gBAAgB,EAAE,CAAC,MAAc,EAAE,IAA0B,EAAE,EAAE;YAC7D,MAAM,CAAC,WAAW,CACd,IAAI,CAAC,SAAS,CAAC;gBACX,MAAM,EAAE,mBAAmB;gBAC3B,IAAI,EAAE,IAAI,CACN,IAAI,CAAC,SAAS,CAAC;oBACX,MAAM;oBACN,IAAI,EAAE;wBACF,UAAU,EAAE,IAAI,CAAC,UAAU;wBAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;wBAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;wBACzB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;qBAChD;iBACJ,CAAC,CACL;aACJ,CAAC,CACL,CAAC;QACN,CAAC;KACJ;CACJ,CAAC;AAEF,kBAAe,GAAG,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from './stamp';
2
+ export * from './gpt';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./stamp"), exports);
18
+ __exportStar(require("./gpt"), exports);
18
19
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,wCAAsB"}
@@ -0,0 +1,18 @@
1
+ type ProactiveRequestData = {
2
+ request_id: string;
3
+ assistant_id: string;
4
+ client_id: string;
5
+ client_phone_number: string;
6
+ };
7
+ declare const gpt: {
8
+ extension: {
9
+ /**
10
+ * Send a proactive request to MagicGPT extension
11
+ * @param source String to identify the source of the request
12
+ * @param data ProactiveRequestData to send to the GPT
13
+ */
14
+ proactiveRequest: (source: string, data: ProactiveRequestData) => void;
15
+ };
16
+ };
17
+ export default gpt;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/gpt/index.ts"],"names":[],"mappings":"AAAA,KAAK,oBAAoB,GAAG;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,mBAAmB,EAAE,MAAM,CAAC;CAC/B,CAAC;AAEF,QAAA,MAAM,GAAG;;QAED;;;;WAIG;mCACwB,MAAM,QAAQ,oBAAoB;;CAmBpE,CAAC;AAEF,eAAe,GAAG,CAAC"}
@@ -0,0 +1,25 @@
1
+ const gpt = {
2
+ extension: {
3
+ /**
4
+ * Send a proactive request to MagicGPT extension
5
+ * @param source String to identify the source of the request
6
+ * @param data ProactiveRequestData to send to the GPT
7
+ */
8
+ proactiveRequest: (source, data) => {
9
+ window.postMessage(JSON.stringify({
10
+ action: 'proactive.request',
11
+ data: btoa(JSON.stringify({
12
+ source,
13
+ data: {
14
+ request_id: data.request_id,
15
+ assistant_id: data.assistant_id,
16
+ client_id: data.client_id,
17
+ client_phone_number: data.client_phone_number
18
+ }
19
+ }))
20
+ }));
21
+ }
22
+ }
23
+ };
24
+ export default gpt;
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/gpt/index.ts"],"names":[],"mappings":"AAOA,MAAM,GAAG,GAAG;IACR,SAAS,EAAE;QACP;;;;WAIG;QACH,gBAAgB,EAAE,CAAC,MAAc,EAAE,IAA0B,EAAE,EAAE;YAC7D,MAAM,CAAC,WAAW,CACd,IAAI,CAAC,SAAS,CAAC;gBACX,MAAM,EAAE,mBAAmB;gBAC3B,IAAI,EAAE,IAAI,CACN,IAAI,CAAC,SAAS,CAAC;oBACX,MAAM;oBACN,IAAI,EAAE;wBACF,UAAU,EAAE,IAAI,CAAC,UAAU;wBAC3B,YAAY,EAAE,IAAI,CAAC,YAAY;wBAC/B,SAAS,EAAE,IAAI,CAAC,SAAS;wBACzB,mBAAmB,EAAE,IAAI,CAAC,mBAAmB;qBAChD;iBACJ,CAAC,CACL;aACJ,CAAC,CACL,CAAC;QACN,CAAC;KACJ;CACJ,CAAC;AAEF,eAAe,GAAG,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from './stamp';
2
+ export * from './gpt';
2
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
@@ -1,2 +1,3 @@
1
1
  export * from './stamp';
2
+ export * from './gpt';
2
3
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,OAAO,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pluslabs/utils",
3
- "version": "0.1.2",
3
+ "version": "0.2.0",
4
4
  "description": "A set of utilities used across projects",
5
5
  "keywords": [
6
6
  "javascript",
@@ -0,0 +1,36 @@
1
+ type ProactiveRequestData = {
2
+ request_id: string;
3
+ assistant_id: string;
4
+ client_id: string;
5
+ client_phone_number: string;
6
+ };
7
+
8
+ const gpt = {
9
+ extension: {
10
+ /**
11
+ * Send a proactive request to MagicGPT extension
12
+ * @param source String to identify the source of the request
13
+ * @param data ProactiveRequestData to send to the GPT
14
+ */
15
+ proactiveRequest: (source: string, data: ProactiveRequestData) => {
16
+ window.postMessage(
17
+ JSON.stringify({
18
+ action: 'proactive.request',
19
+ data: btoa(
20
+ JSON.stringify({
21
+ source,
22
+ data: {
23
+ request_id: data.request_id,
24
+ assistant_id: data.assistant_id,
25
+ client_id: data.client_id,
26
+ client_phone_number: data.client_phone_number
27
+ }
28
+ })
29
+ )
30
+ })
31
+ );
32
+ }
33
+ }
34
+ };
35
+
36
+ export default gpt;
package/src/index.ts CHANGED
@@ -1 +1,2 @@
1
1
  export * from './stamp';
2
+ export * from './gpt';