@memori.ai/memori-api-client 6.19.0 → 6.20.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.
- package/CHANGELOG.md +7 -0
- package/dist/engine/dialog.d.ts +4 -2
- package/dist/engine/dialog.js +24 -4
- package/dist/engine/dialog.js.map +1 -1
- package/dist/engine.d.ts +6 -2
- package/dist/index.d.ts +6 -2
- package/dist/types.d.ts +6 -0
- package/esm/engine/dialog.d.ts +4 -2
- package/esm/engine/dialog.js +24 -4
- package/esm/engine/dialog.js.map +1 -1
- package/esm/engine.d.ts +6 -2
- package/esm/index.d.ts +6 -2
- package/esm/types.d.ts +6 -0
- package/package.json +1 -1
- package/src/engine/dialog.ts +35 -4
- package/src/types.ts +15 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
|
|
3
|
+
## [6.20.0](https://github.com/memori-ai/memori-api-client/compare/v6.19.0...v6.20.0) (2026-03-16)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Features
|
|
7
|
+
|
|
8
|
+
* add PlaceSpecs type and integrate into postTextEnteredEvent ([e860231](https://github.com/memori-ai/memori-api-client/commit/e860231f5ec6574b1a02d896b88feba2b96520f4))
|
|
9
|
+
|
|
3
10
|
## [6.19.0](https://github.com/memori-ai/memori-api-client/compare/v6.18.1...v6.19.0) (2026-02-09)
|
|
4
11
|
|
|
5
12
|
|
package/dist/engine/dialog.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { DialogState, Medium, ResponseSpec } from '../types';
|
|
1
|
+
import { DialogState, Medium, PlaceSpecs, ResponseSpec } from '../types';
|
|
2
2
|
declare const _default: (apiUrl: string) => {
|
|
3
|
-
postTextEnteredEvent: ({ sessionId, text, }: {
|
|
3
|
+
postTextEnteredEvent: ({ sessionId, text, dateUTC, place, }: {
|
|
4
4
|
sessionId: string;
|
|
5
5
|
text: string;
|
|
6
|
+
dateUTC?: string | null | undefined;
|
|
7
|
+
place?: PlaceSpecs | null | undefined;
|
|
6
8
|
}) => Promise<ResponseSpec & {
|
|
7
9
|
currentState: DialogState;
|
|
8
10
|
}>;
|
package/dist/engine/dialog.js
CHANGED
|
@@ -1,13 +1,33 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const apiFetcher_1 = require("../apiFetcher");
|
|
4
|
+
function buildTextEnteredBody(params) {
|
|
5
|
+
const { text, dateUTC, place } = params;
|
|
6
|
+
const body = { text };
|
|
7
|
+
if (dateUTC != null && dateUTC !== '') {
|
|
8
|
+
body.dateUTC = dateUTC;
|
|
9
|
+
}
|
|
10
|
+
if (place != null && typeof place === 'object') {
|
|
11
|
+
const placeBody = {};
|
|
12
|
+
if (place.placeName != null)
|
|
13
|
+
placeBody.placeName = place.placeName;
|
|
14
|
+
if (place.latitude != null)
|
|
15
|
+
placeBody.latitude = place.latitude;
|
|
16
|
+
if (place.longitude != null)
|
|
17
|
+
placeBody.longitude = place.longitude;
|
|
18
|
+
if (place.uncertaintyKm != null)
|
|
19
|
+
placeBody.uncertaintyKm = place.uncertaintyKm;
|
|
20
|
+
if (Object.keys(placeBody).length > 0) {
|
|
21
|
+
body.place = placeBody;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return body;
|
|
25
|
+
}
|
|
4
26
|
exports.default = (apiUrl) => ({
|
|
5
|
-
postTextEnteredEvent: async ({ sessionId, text, }) => (0, apiFetcher_1.apiFetcher)(`/TextEnteredEvent/${sessionId}`, {
|
|
27
|
+
postTextEnteredEvent: async ({ sessionId, text, dateUTC, place, }) => (0, apiFetcher_1.apiFetcher)(`/TextEnteredEvent/${sessionId}`, {
|
|
6
28
|
method: 'POST',
|
|
7
29
|
apiUrl,
|
|
8
|
-
body: {
|
|
9
|
-
text,
|
|
10
|
-
},
|
|
30
|
+
body: buildTextEnteredBody({ text, dateUTC, place }),
|
|
11
31
|
}),
|
|
12
32
|
postTextEnteredEventExtended: async ({ sessionId, text, questionsAndAnswersHistory, }) => (0, apiFetcher_1.apiFetcher)(`/ExtendedTextEnteredEvent/${sessionId}`, {
|
|
13
33
|
method: 'POST',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/engine/dialog.ts"],"names":[],"mappings":";;AACA,8CAA2C;AAQ3C,kBAAe,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/engine/dialog.ts"],"names":[],"mappings":";;AACA,8CAA2C;AAQ3C,SAAS,oBAAoB,CAAC,MAI7B;IACC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACxC,MAAM,IAAI,GAIN,EAAE,IAAI,EAAE,CAAC;IACb,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,KAAK,EAAE,EAAE;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;KACxB;IACD,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC9C,MAAM,SAAS,GAAuD,EAAE,CAAC;QACzE,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI;YAAE,SAAS,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACnE,IAAI,KAAK,CAAC,QAAQ,IAAI,IAAI;YAAE,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChE,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI;YAAE,SAAS,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACnE,IAAI,KAAK,CAAC,aAAa,IAAI,IAAI;YAAE,SAAS,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;QAC/E,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,E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
651
651
|
};
|
|
652
|
-
postTextEnteredEvent: ({ sessionId, text, }: {
|
|
652
|
+
postTextEnteredEvent: ({ sessionId, text, dateUTC, place, }: {
|
|
653
653
|
sessionId: string;
|
|
654
654
|
text: string;
|
|
655
|
+
dateUTC?: string | null | undefined;
|
|
656
|
+
place?: import("./types").PlaceSpecs | null | undefined;
|
|
655
657
|
}) => Promise<import("./types").ResponseSpec & {
|
|
656
658
|
currentState: import("./types").DialogState;
|
|
657
659
|
}>;
|
|
@@ -693,9 +695,11 @@ declare const _default: (apiUrl: string) => {
|
|
|
693
695
|
postPlaceSelectedEvent: (sessionId: string) => Promise<import("./types").ResponseSpec>;
|
|
694
696
|
postTagSelectedEvent: (sessionId: string) => Promise<import("./types").ResponseSpec>;
|
|
695
697
|
dialog: {
|
|
696
|
-
postTextEnteredEvent: ({ sessionId, text, }: {
|
|
698
|
+
postTextEnteredEvent: ({ sessionId, text, dateUTC, place, }: {
|
|
697
699
|
sessionId: string;
|
|
698
700
|
text: string;
|
|
701
|
+
dateUTC?: string | null | undefined;
|
|
702
|
+
place?: import("./types").PlaceSpecs | null | undefined;
|
|
699
703
|
}) => Promise<import("./types").ResponseSpec & {
|
|
700
704
|
currentState: import("./types").DialogState;
|
|
701
705
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -658,9 +658,11 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
658
658
|
intentSlotID: string;
|
|
659
659
|
}>;
|
|
660
660
|
};
|
|
661
|
-
postTextEnteredEvent: ({ sessionId, text, }: {
|
|
661
|
+
postTextEnteredEvent: ({ sessionId, text, dateUTC, place, }: {
|
|
662
662
|
sessionId: string;
|
|
663
663
|
text: string;
|
|
664
|
+
dateUTC?: string | null | undefined;
|
|
665
|
+
place?: import("./types").PlaceSpecs | null | undefined;
|
|
664
666
|
}) => Promise<import("./types").ResponseSpec & {
|
|
665
667
|
currentState: import("./types").DialogState;
|
|
666
668
|
}>;
|
|
@@ -702,9 +704,11 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
702
704
|
postPlaceSelectedEvent: (sessionId: string) => Promise<import("./types").ResponseSpec>;
|
|
703
705
|
postTagSelectedEvent: (sessionId: string) => Promise<import("./types").ResponseSpec>;
|
|
704
706
|
dialog: {
|
|
705
|
-
postTextEnteredEvent: ({ sessionId, text, }: {
|
|
707
|
+
postTextEnteredEvent: ({ sessionId, text, dateUTC, place, }: {
|
|
706
708
|
sessionId: string;
|
|
707
709
|
text: string;
|
|
710
|
+
dateUTC?: string | null | undefined;
|
|
711
|
+
place?: import("./types").PlaceSpecs | null | undefined;
|
|
708
712
|
}) => Promise<import("./types").ResponseSpec & {
|
|
709
713
|
currentState: import("./types").DialogState;
|
|
710
714
|
}>;
|
package/dist/types.d.ts
CHANGED
|
@@ -140,6 +140,12 @@ export declare type Venue = {
|
|
|
140
140
|
longitude: number;
|
|
141
141
|
uncertainty?: number;
|
|
142
142
|
};
|
|
143
|
+
export declare type PlaceSpecs = {
|
|
144
|
+
placeName?: string | null;
|
|
145
|
+
latitude?: number | null;
|
|
146
|
+
longitude?: number | null;
|
|
147
|
+
uncertaintyKm?: number | null;
|
|
148
|
+
};
|
|
143
149
|
export declare type NominatimItem = {
|
|
144
150
|
place_id: number;
|
|
145
151
|
lat: number;
|
package/esm/engine/dialog.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { DialogState, Medium, ResponseSpec } from '../types';
|
|
1
|
+
import { DialogState, Medium, PlaceSpecs, ResponseSpec } from '../types';
|
|
2
2
|
declare const _default: (apiUrl: string) => {
|
|
3
|
-
postTextEnteredEvent: ({ sessionId, text, }: {
|
|
3
|
+
postTextEnteredEvent: ({ sessionId, text, dateUTC, place, }: {
|
|
4
4
|
sessionId: string;
|
|
5
5
|
text: string;
|
|
6
|
+
dateUTC?: string | null | undefined;
|
|
7
|
+
place?: PlaceSpecs | null | undefined;
|
|
6
8
|
}) => Promise<ResponseSpec & {
|
|
7
9
|
currentState: DialogState;
|
|
8
10
|
}>;
|
package/esm/engine/dialog.js
CHANGED
|
@@ -1,11 +1,31 @@
|
|
|
1
1
|
import { apiFetcher } from '../apiFetcher';
|
|
2
|
+
function buildTextEnteredBody(params) {
|
|
3
|
+
const { text, dateUTC, place } = params;
|
|
4
|
+
const body = { text };
|
|
5
|
+
if (dateUTC != null && dateUTC !== '') {
|
|
6
|
+
body.dateUTC = dateUTC;
|
|
7
|
+
}
|
|
8
|
+
if (place != null && typeof place === 'object') {
|
|
9
|
+
const placeBody = {};
|
|
10
|
+
if (place.placeName != null)
|
|
11
|
+
placeBody.placeName = place.placeName;
|
|
12
|
+
if (place.latitude != null)
|
|
13
|
+
placeBody.latitude = place.latitude;
|
|
14
|
+
if (place.longitude != null)
|
|
15
|
+
placeBody.longitude = place.longitude;
|
|
16
|
+
if (place.uncertaintyKm != null)
|
|
17
|
+
placeBody.uncertaintyKm = place.uncertaintyKm;
|
|
18
|
+
if (Object.keys(placeBody).length > 0) {
|
|
19
|
+
body.place = placeBody;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return body;
|
|
23
|
+
}
|
|
2
24
|
export default (apiUrl) => ({
|
|
3
|
-
postTextEnteredEvent: async ({ sessionId, text, }) => apiFetcher(`/TextEnteredEvent/${sessionId}`, {
|
|
25
|
+
postTextEnteredEvent: async ({ sessionId, text, dateUTC, place, }) => apiFetcher(`/TextEnteredEvent/${sessionId}`, {
|
|
4
26
|
method: 'POST',
|
|
5
27
|
apiUrl,
|
|
6
|
-
body: {
|
|
7
|
-
text,
|
|
8
|
-
},
|
|
28
|
+
body: buildTextEnteredBody({ text, dateUTC, place }),
|
|
9
29
|
}),
|
|
10
30
|
postTextEnteredEventExtended: async ({ sessionId, text, questionsAndAnswersHistory, }) => apiFetcher(`/ExtendedTextEnteredEvent/${sessionId}`, {
|
|
11
31
|
method: 'POST',
|
package/esm/engine/dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/engine/dialog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ3C,eAAe,CAAC,MAAc,EAAE,EAAE,CAAC,CAAC;
|
|
1
|
+
{"version":3,"file":"dialog.js","sourceRoot":"","sources":["../../src/engine/dialog.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAQ3C,SAAS,oBAAoB,CAAC,MAI7B;IACC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;IACxC,MAAM,IAAI,GAIN,EAAE,IAAI,EAAE,CAAC;IACb,IAAI,OAAO,IAAI,IAAI,IAAI,OAAO,KAAK,EAAE,EAAE;QACrC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;KACxB;IACD,IAAI,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE;QAC9C,MAAM,SAAS,GAAuD,EAAE,CAAC;QACzE,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI;YAAE,SAAS,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACnE,IAAI,KAAK,CAAC,QAAQ,IAAI,IAAI;YAAE,SAAS,CAAC,QAAQ,GAAG,KAAK,CAAC,QAAQ,CAAC;QAChE,IAAI,KAAK,CAAC,SAAS,IAAI,IAAI;YAAE,SAAS,CAAC,SAAS,GAAG,KAAK,CAAC,SAAS,CAAC;QACnE,IAAI,KAAK,CAAC,aAAa,IAAI,IAAI;YAAE,SAAS,CAAC,aAAa,GAAG,KAAK,CAAC,aAAa,CAAC;QAC/E,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YACrC,IAAI,CAAC,KAAK,GAAG,SAAS,CAAC;SACxB;KACF;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,eAAe,CAAC,MAAc,EAA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AAC,iBAAiB,SAAS,EAAE,EAAE;QACvC,MAAM,EAAE,MAAM;QACd,MAAM;KACP,CAIA;IAQH,uBAAuB,EAAE,KAAK,EAAE,SAAiB,EAAE,MAAc,EAAE,EAAE,CACnE,UAAU,CAAC,wBAAwB,SAAS,EAAE,EAAE;QAC9C,MAAM,EAAE,MAAM;QACd,MAAM;QACN,IAAI,EAAE,EAAE,MAAM,EAAE;KACjB,CAIA;IAQH,yBAAyB,EAAE,KAAK,EAAE,SAAiB,EAAE,QAAgB,EAAE,EAAE,CACvE,UAAU,CAAC,0BAA0B,SAAS,EAAE,EAAE;QAChD,MAAM,EAAE,MAAM;QACd,MAAM;QACN,IAAI,EAAE,EAAE,QAAQ,EAAE;KACnB,CAIA;IAMH,qBAAqB,EAAE,KAAK,EAAE,SAAiB,EAAE,EAAE,CACjD,UAAU,CAAC,sBAAsB,SAAS,EAAE,EAAE;QAC5C,MAAM,EAAE,KAAK;QACb,MAAM;KACP,CAA0B;IAM7B,sBAAsB,EAAE,KAAK,EAAE,SAAiB,EAAE,EAAE,CAClD,UAAU,CAAC,uBAAuB,SAAS,EAAE,EAAE;QAC7C,MAAM,EAAE,KAAK;QACb,MAAM;KACP,CAA0B;IAM7B,oBAAoB,EAAE,KAAK,EAAE,SAAiB,EAAE,EAAE,CAChD,UAAU,CAAC,qBAAqB,SAAS,EAAE,EAAE;QAC3C,MAAM,EAAE,KAAK;QACb,MAAM;KACP,CAA0B;CAC9B,CAAC,CAAC"}
|
package/esm/engine.d.ts
CHANGED
|
@@ -649,9 +649,11 @@ declare const _default: (apiUrl: string) => {
|
|
|
649
649
|
intentSlotID: string;
|
|
650
650
|
}>;
|
|
651
651
|
};
|
|
652
|
-
postTextEnteredEvent: ({ sessionId, text, }: {
|
|
652
|
+
postTextEnteredEvent: ({ sessionId, text, dateUTC, place, }: {
|
|
653
653
|
sessionId: string;
|
|
654
654
|
text: string;
|
|
655
|
+
dateUTC?: string | null | undefined;
|
|
656
|
+
place?: import("./types").PlaceSpecs | null | undefined;
|
|
655
657
|
}) => Promise<import("./types").ResponseSpec & {
|
|
656
658
|
currentState: import("./types").DialogState;
|
|
657
659
|
}>;
|
|
@@ -693,9 +695,11 @@ declare const _default: (apiUrl: string) => {
|
|
|
693
695
|
postPlaceSelectedEvent: (sessionId: string) => Promise<import("./types").ResponseSpec>;
|
|
694
696
|
postTagSelectedEvent: (sessionId: string) => Promise<import("./types").ResponseSpec>;
|
|
695
697
|
dialog: {
|
|
696
|
-
postTextEnteredEvent: ({ sessionId, text, }: {
|
|
698
|
+
postTextEnteredEvent: ({ sessionId, text, dateUTC, place, }: {
|
|
697
699
|
sessionId: string;
|
|
698
700
|
text: string;
|
|
701
|
+
dateUTC?: string | null | undefined;
|
|
702
|
+
place?: import("./types").PlaceSpecs | null | undefined;
|
|
699
703
|
}) => Promise<import("./types").ResponseSpec & {
|
|
700
704
|
currentState: import("./types").DialogState;
|
|
701
705
|
}>;
|
package/esm/index.d.ts
CHANGED
|
@@ -658,9 +658,11 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
658
658
|
intentSlotID: string;
|
|
659
659
|
}>;
|
|
660
660
|
};
|
|
661
|
-
postTextEnteredEvent: ({ sessionId, text, }: {
|
|
661
|
+
postTextEnteredEvent: ({ sessionId, text, dateUTC, place, }: {
|
|
662
662
|
sessionId: string;
|
|
663
663
|
text: string;
|
|
664
|
+
dateUTC?: string | null | undefined;
|
|
665
|
+
place?: import("./types").PlaceSpecs | null | undefined;
|
|
664
666
|
}) => Promise<import("./types").ResponseSpec & {
|
|
665
667
|
currentState: import("./types").DialogState;
|
|
666
668
|
}>;
|
|
@@ -702,9 +704,11 @@ declare const api: (backendEndpoint?: string, engineEndpoint?: string) => {
|
|
|
702
704
|
postPlaceSelectedEvent: (sessionId: string) => Promise<import("./types").ResponseSpec>;
|
|
703
705
|
postTagSelectedEvent: (sessionId: string) => Promise<import("./types").ResponseSpec>;
|
|
704
706
|
dialog: {
|
|
705
|
-
postTextEnteredEvent: ({ sessionId, text, }: {
|
|
707
|
+
postTextEnteredEvent: ({ sessionId, text, dateUTC, place, }: {
|
|
706
708
|
sessionId: string;
|
|
707
709
|
text: string;
|
|
710
|
+
dateUTC?: string | null | undefined;
|
|
711
|
+
place?: import("./types").PlaceSpecs | null | undefined;
|
|
708
712
|
}) => Promise<import("./types").ResponseSpec & {
|
|
709
713
|
currentState: import("./types").DialogState;
|
|
710
714
|
}>;
|
package/esm/types.d.ts
CHANGED
|
@@ -140,6 +140,12 @@ export declare type Venue = {
|
|
|
140
140
|
longitude: number;
|
|
141
141
|
uncertainty?: number;
|
|
142
142
|
};
|
|
143
|
+
export declare type PlaceSpecs = {
|
|
144
|
+
placeName?: string | null;
|
|
145
|
+
latitude?: number | null;
|
|
146
|
+
longitude?: number | null;
|
|
147
|
+
uncertaintyKm?: number | null;
|
|
148
|
+
};
|
|
143
149
|
export declare type NominatimItem = {
|
|
144
150
|
place_id: number;
|
|
145
151
|
lat: number;
|
package/package.json
CHANGED
package/src/engine/dialog.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DialogState, Medium, ResponseSpec } from '../types';
|
|
1
|
+
import { DialogState, Medium, PlaceSpecs, ResponseSpec } from '../types';
|
|
2
2
|
import { apiFetcher } from '../apiFetcher';
|
|
3
3
|
|
|
4
4
|
/******************
|
|
@@ -7,26 +7,57 @@ import { apiFetcher } from '../apiFetcher';
|
|
|
7
7
|
* *
|
|
8
8
|
******************/
|
|
9
9
|
|
|
10
|
+
function buildTextEnteredBody(params: {
|
|
11
|
+
text: string;
|
|
12
|
+
dateUTC?: string | null;
|
|
13
|
+
place?: PlaceSpecs | null;
|
|
14
|
+
}) {
|
|
15
|
+
const { text, dateUTC, place } = params;
|
|
16
|
+
const body: {
|
|
17
|
+
text: string;
|
|
18
|
+
dateUTC?: string;
|
|
19
|
+
place?: Record<string, number | string | null | undefined>;
|
|
20
|
+
} = { text };
|
|
21
|
+
if (dateUTC != null && dateUTC !== '') {
|
|
22
|
+
body.dateUTC = dateUTC;
|
|
23
|
+
}
|
|
24
|
+
if (place != null && typeof place === 'object') {
|
|
25
|
+
const placeBody: Record<string, number | string | null | undefined> = {};
|
|
26
|
+
if (place.placeName != null) placeBody.placeName = place.placeName;
|
|
27
|
+
if (place.latitude != null) placeBody.latitude = place.latitude;
|
|
28
|
+
if (place.longitude != null) placeBody.longitude = place.longitude;
|
|
29
|
+
if (place.uncertaintyKm != null) placeBody.uncertaintyKm = place.uncertaintyKm;
|
|
30
|
+
if (Object.keys(placeBody).length > 0) {
|
|
31
|
+
body.place = placeBody;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return body;
|
|
35
|
+
}
|
|
36
|
+
|
|
10
37
|
export default (apiUrl: string) => ({
|
|
11
38
|
/**
|
|
12
39
|
* Submits a Text Entered event to the session's Dialog State Machine.
|
|
13
40
|
* @param {object} params
|
|
14
41
|
* @param {string} params.sessionId The session ID
|
|
15
42
|
* @param {string} params.text The text entered by the user
|
|
43
|
+
* @param {string} [params.dateUTC] Optional. Current date/time in UTC, ISO 8601 (e.g. 2026-03-16T12:00:00.000Z). If present, the backend updates the session's current date before processing.
|
|
44
|
+
* @param {PlaceSpecs} [params.place] Optional. Geographical context for the message (placeName, latitude, longitude, uncertaintyKm). latitude and longitude must be sent together if used.
|
|
16
45
|
*/
|
|
17
46
|
postTextEnteredEvent: async ({
|
|
18
47
|
sessionId,
|
|
19
48
|
text,
|
|
49
|
+
dateUTC,
|
|
50
|
+
place,
|
|
20
51
|
}: {
|
|
21
52
|
sessionId: string;
|
|
22
53
|
text: string;
|
|
54
|
+
dateUTC?: string | null;
|
|
55
|
+
place?: PlaceSpecs | null;
|
|
23
56
|
}) =>
|
|
24
57
|
apiFetcher(`/TextEnteredEvent/${sessionId}`, {
|
|
25
58
|
method: 'POST',
|
|
26
59
|
apiUrl,
|
|
27
|
-
body: {
|
|
28
|
-
text,
|
|
29
|
-
},
|
|
60
|
+
body: buildTextEnteredBody({ text, dateUTC, place }),
|
|
30
61
|
}) as Promise<
|
|
31
62
|
ResponseSpec & {
|
|
32
63
|
currentState: DialogState;
|
package/src/types.ts
CHANGED
|
@@ -315,6 +315,21 @@ export declare type Venue = {
|
|
|
315
315
|
uncertainty?: number;
|
|
316
316
|
};
|
|
317
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Geographical context for a message (e.g. Text Entered event).
|
|
320
|
+
* All fields are optional. When using coordinates, latitude and longitude must be provided together.
|
|
321
|
+
*/
|
|
322
|
+
export declare type PlaceSpecs = {
|
|
323
|
+
/** Place name (e.g. "London"); if lat/lon are omitted, the backend may geocode from this. */
|
|
324
|
+
placeName?: string | null;
|
|
325
|
+
/** Latitude; must be sent together with longitude when using coordinates. */
|
|
326
|
+
latitude?: number | null;
|
|
327
|
+
/** Longitude; must be sent together with latitude when using coordinates. */
|
|
328
|
+
longitude?: number | null;
|
|
329
|
+
/** Radius of uncertainty in km (e.g. 20.0). */
|
|
330
|
+
uncertaintyKm?: number | null;
|
|
331
|
+
};
|
|
332
|
+
|
|
318
333
|
export declare type NominatimItem = {
|
|
319
334
|
place_id: number;
|
|
320
335
|
lat: number;
|