@15gifts/sdk 0.3.1 → 0.4.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/dist/index.d.mts +284 -162
- package/dist/index.d.ts +284 -162
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/package.json +4 -4
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as openapi_fetch from 'openapi-fetch';
|
|
2
|
+
import { Client as Client$1, Middleware } from 'openapi-fetch';
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* This file was auto-generated by openapi-typescript.
|
|
@@ -553,7 +554,7 @@ interface operations {
|
|
|
553
554
|
* Do not make direct changes to the file.
|
|
554
555
|
*/
|
|
555
556
|
interface paths {
|
|
556
|
-
'/api/
|
|
557
|
+
'/api/tracking/identity/v1': {
|
|
557
558
|
parameters: {
|
|
558
559
|
query?: never;
|
|
559
560
|
header?: never;
|
|
@@ -563,33 +564,27 @@ interface paths {
|
|
|
563
564
|
get?: never;
|
|
564
565
|
put?: never;
|
|
565
566
|
/**
|
|
566
|
-
*
|
|
567
|
-
* @
|
|
567
|
+
* Generate tracking identifiers
|
|
568
|
+
* @deprecated
|
|
569
|
+
* @description Generate tracking identifiers for a user
|
|
568
570
|
*/
|
|
569
571
|
post: {
|
|
570
572
|
parameters: {
|
|
571
573
|
query?: never;
|
|
572
574
|
header?: never;
|
|
573
|
-
path
|
|
574
|
-
/** @description Customer ID */
|
|
575
|
-
customerId: string;
|
|
576
|
-
};
|
|
575
|
+
path?: never;
|
|
577
576
|
cookie?: never;
|
|
578
577
|
};
|
|
579
|
-
/** @description
|
|
578
|
+
/** @description Generate tracking identifiers for a user */
|
|
580
579
|
requestBody: {
|
|
581
580
|
content: {
|
|
582
581
|
'application/json': {
|
|
583
|
-
/**
|
|
584
|
-
|
|
585
|
-
* @description URL of the page where the product-expert will be shown
|
|
586
|
-
* @example https://www.example.com/telco/
|
|
587
|
-
*/
|
|
588
|
-
url: string;
|
|
582
|
+
/** @description Customer ID */
|
|
583
|
+
customerId: string;
|
|
589
584
|
/** @description User ID */
|
|
590
|
-
|
|
585
|
+
createUserId?: boolean;
|
|
591
586
|
/** @description Session ID */
|
|
592
|
-
|
|
587
|
+
createSessionId?: boolean;
|
|
593
588
|
};
|
|
594
589
|
};
|
|
595
590
|
};
|
|
@@ -601,126 +596,13 @@ interface paths {
|
|
|
601
596
|
};
|
|
602
597
|
content: {
|
|
603
598
|
'application/json': {
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
domain?: string;
|
|
609
|
-
};
|
|
610
|
-
engage: {
|
|
611
|
-
text: string;
|
|
612
|
-
/** @enum {string} */
|
|
613
|
-
type: 'floating' | 'embedded' | 'embedded-fullwidth';
|
|
614
|
-
};
|
|
615
|
-
styles: {
|
|
616
|
-
primaryColor: string;
|
|
617
|
-
hoverColor: string;
|
|
618
|
-
textColor: string;
|
|
619
|
-
};
|
|
620
|
-
};
|
|
621
|
-
show: boolean;
|
|
622
|
-
features?: string[];
|
|
623
|
-
metadata: {
|
|
624
|
-
customerVersion: string;
|
|
625
|
-
customerRevision: string;
|
|
626
|
-
productVersion: string;
|
|
627
|
-
productRevision: string;
|
|
628
|
-
};
|
|
599
|
+
/** @description User ID */
|
|
600
|
+
userId?: string;
|
|
601
|
+
/** @description Session ID */
|
|
602
|
+
sessionId?: string;
|
|
629
603
|
};
|
|
630
604
|
};
|
|
631
605
|
};
|
|
632
|
-
/** @description Default Response */
|
|
633
|
-
404: {
|
|
634
|
-
headers: {
|
|
635
|
-
[name: string]: unknown;
|
|
636
|
-
};
|
|
637
|
-
content?: never;
|
|
638
|
-
};
|
|
639
|
-
};
|
|
640
|
-
};
|
|
641
|
-
delete?: never;
|
|
642
|
-
options?: never;
|
|
643
|
-
head?: never;
|
|
644
|
-
patch?: never;
|
|
645
|
-
trace?: never;
|
|
646
|
-
};
|
|
647
|
-
'/api/feedback/v1': {
|
|
648
|
-
parameters: {
|
|
649
|
-
query?: never;
|
|
650
|
-
header?: never;
|
|
651
|
-
path?: never;
|
|
652
|
-
cookie?: never;
|
|
653
|
-
};
|
|
654
|
-
get?: never;
|
|
655
|
-
put?: never;
|
|
656
|
-
/**
|
|
657
|
-
* Submit user feedback
|
|
658
|
-
* @description Submit user feedback
|
|
659
|
-
*/
|
|
660
|
-
post: {
|
|
661
|
-
parameters: {
|
|
662
|
-
query?: never;
|
|
663
|
-
header?: never;
|
|
664
|
-
path?: never;
|
|
665
|
-
cookie?: never;
|
|
666
|
-
};
|
|
667
|
-
/** @description Product Expert user feedback */
|
|
668
|
-
requestBody: {
|
|
669
|
-
content: {
|
|
670
|
-
/** @example {
|
|
671
|
-
* "customerId": "oclet",
|
|
672
|
-
* "userId": "163a692e-8ee2-623f-9927-0bb563b19853",
|
|
673
|
-
* "sessionId": "2f6863a9-2833-5521-a45d-359dcdfd154a",
|
|
674
|
-
* "conversationId": "386d85d7-9daa-8a87-85d4-3f93c990b292",
|
|
675
|
-
* "url": "https://www.example.com/telco/",
|
|
676
|
-
* "deviceType": "desktop",
|
|
677
|
-
* "userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3",
|
|
678
|
-
* "rating": 4,
|
|
679
|
-
* "ratingText": "excellent"
|
|
680
|
-
* } */
|
|
681
|
-
'application/json': {
|
|
682
|
-
/** @description Customer ID */
|
|
683
|
-
customerId: string;
|
|
684
|
-
/** @description User ID */
|
|
685
|
-
userId?: string;
|
|
686
|
-
/** @description Session ID */
|
|
687
|
-
sessionId: string;
|
|
688
|
-
/** @description Conversation ID */
|
|
689
|
-
conversationId?: string;
|
|
690
|
-
/** @description URL */
|
|
691
|
-
url?: string;
|
|
692
|
-
/**
|
|
693
|
-
* @description Device Type
|
|
694
|
-
* @enum {string}
|
|
695
|
-
*/
|
|
696
|
-
deviceType?: 'desktop' | 'mobile' | 'tablet';
|
|
697
|
-
/** @description User Agent */
|
|
698
|
-
userAgent?: string;
|
|
699
|
-
/** @description Conversation Rating */
|
|
700
|
-
rating: number;
|
|
701
|
-
/**
|
|
702
|
-
* @description Conversation Rating
|
|
703
|
-
* @enum {string}
|
|
704
|
-
*/
|
|
705
|
-
ratingText: 'poor' | 'fair' | 'good' | 'excellent';
|
|
706
|
-
};
|
|
707
|
-
};
|
|
708
|
-
};
|
|
709
|
-
responses: {
|
|
710
|
-
/** @description Successful response */
|
|
711
|
-
204: {
|
|
712
|
-
headers: {
|
|
713
|
-
[name: string]: unknown;
|
|
714
|
-
};
|
|
715
|
-
content?: never;
|
|
716
|
-
};
|
|
717
|
-
/** @description Default Response */
|
|
718
|
-
404: {
|
|
719
|
-
headers: {
|
|
720
|
-
[name: string]: unknown;
|
|
721
|
-
};
|
|
722
|
-
content?: never;
|
|
723
|
-
};
|
|
724
606
|
};
|
|
725
607
|
};
|
|
726
608
|
delete?: never;
|
|
@@ -729,7 +611,7 @@ interface paths {
|
|
|
729
611
|
patch?: never;
|
|
730
612
|
trace?: never;
|
|
731
613
|
};
|
|
732
|
-
'/api/tracking/identity/
|
|
614
|
+
'/api/tracking/identity/v2': {
|
|
733
615
|
parameters: {
|
|
734
616
|
query?: never;
|
|
735
617
|
header?: never;
|
|
@@ -755,10 +637,10 @@ interface paths {
|
|
|
755
637
|
'application/json': {
|
|
756
638
|
/** @description Customer ID */
|
|
757
639
|
customerId: string;
|
|
758
|
-
/** @description User ID */
|
|
759
|
-
createUserId?: boolean;
|
|
760
640
|
/** @description Session ID */
|
|
761
|
-
|
|
641
|
+
sessionId?: string;
|
|
642
|
+
/** @description User ID */
|
|
643
|
+
userId?: string;
|
|
762
644
|
};
|
|
763
645
|
};
|
|
764
646
|
};
|
|
@@ -770,10 +652,12 @@ interface paths {
|
|
|
770
652
|
};
|
|
771
653
|
content: {
|
|
772
654
|
'application/json': {
|
|
773
|
-
/** @description User ID */
|
|
774
|
-
userId?: string;
|
|
775
655
|
/** @description Session ID */
|
|
776
|
-
sessionId
|
|
656
|
+
sessionId: string;
|
|
657
|
+
/** @description User ID */
|
|
658
|
+
userId: string;
|
|
659
|
+
/** @description JSON Web Token (JWT) */
|
|
660
|
+
token: string;
|
|
777
661
|
};
|
|
778
662
|
};
|
|
779
663
|
};
|
|
@@ -796,6 +680,7 @@ interface paths {
|
|
|
796
680
|
put?: never;
|
|
797
681
|
/**
|
|
798
682
|
* Submit sales tracking data
|
|
683
|
+
* @deprecated
|
|
799
684
|
* @description Submit sales tracking data
|
|
800
685
|
*/
|
|
801
686
|
post: {
|
|
@@ -898,6 +783,111 @@ interface paths {
|
|
|
898
783
|
patch?: never;
|
|
899
784
|
trace?: never;
|
|
900
785
|
};
|
|
786
|
+
'/api/tracking/sales/v2': {
|
|
787
|
+
parameters: {
|
|
788
|
+
query?: never;
|
|
789
|
+
header?: never;
|
|
790
|
+
path?: never;
|
|
791
|
+
cookie?: never;
|
|
792
|
+
};
|
|
793
|
+
get?: never;
|
|
794
|
+
put?: never;
|
|
795
|
+
/**
|
|
796
|
+
* Submit sales tracking data
|
|
797
|
+
* @description Submit sales tracking data
|
|
798
|
+
*/
|
|
799
|
+
post: {
|
|
800
|
+
parameters: {
|
|
801
|
+
query?: never;
|
|
802
|
+
header?: never;
|
|
803
|
+
path?: never;
|
|
804
|
+
cookie?: never;
|
|
805
|
+
};
|
|
806
|
+
/** @description Sales tracking event data */
|
|
807
|
+
requestBody: {
|
|
808
|
+
content: {
|
|
809
|
+
/** @example {
|
|
810
|
+
* "conversationId": "386d85d7-9daa-8a87-85d4-3f93c990b292",
|
|
811
|
+
* "currency": "GBP",
|
|
812
|
+
* "items": [
|
|
813
|
+
* {
|
|
814
|
+
* "name": "Product 1",
|
|
815
|
+
* "productRef": "1260449",
|
|
816
|
+
* "quantity": 1,
|
|
817
|
+
* "recurring": 10
|
|
818
|
+
* },
|
|
819
|
+
* {
|
|
820
|
+
* "name": "Product 2",
|
|
821
|
+
* "price": 50,
|
|
822
|
+
* "productRef": "fe-56-sd2458",
|
|
823
|
+
* "quantity": 2
|
|
824
|
+
* }
|
|
825
|
+
* ],
|
|
826
|
+
* "saleRef": "34596872",
|
|
827
|
+
* "totalPrice": 100,
|
|
828
|
+
* "totalRecurring": 10
|
|
829
|
+
* } */
|
|
830
|
+
'application/json': {
|
|
831
|
+
/** @description Conversation ID */
|
|
832
|
+
conversationId?: string;
|
|
833
|
+
/** @description Contract Length */
|
|
834
|
+
contractLength?: number;
|
|
835
|
+
/** @description Currency Code */
|
|
836
|
+
currency: string;
|
|
837
|
+
/**
|
|
838
|
+
* @description Device Type
|
|
839
|
+
* @enum {string}
|
|
840
|
+
*/
|
|
841
|
+
deviceType?: 'desktop' | 'mobile' | 'tablet';
|
|
842
|
+
/** @description Event data */
|
|
843
|
+
items?: {
|
|
844
|
+
/** @description Product Name */
|
|
845
|
+
name?: string;
|
|
846
|
+
/** @description Price */
|
|
847
|
+
price?: number;
|
|
848
|
+
/** @description Product Reference */
|
|
849
|
+
productRef?: string;
|
|
850
|
+
/** @description Quantity */
|
|
851
|
+
quantity?: number;
|
|
852
|
+
/** @description Recurring Price */
|
|
853
|
+
recurring?: number;
|
|
854
|
+
}[];
|
|
855
|
+
/** @description Sale Reference */
|
|
856
|
+
saleRef: string;
|
|
857
|
+
/** @description Total Price */
|
|
858
|
+
totalPrice: number;
|
|
859
|
+
/** @description Total Recurring Price */
|
|
860
|
+
totalRecurring?: number;
|
|
861
|
+
/** @description URL */
|
|
862
|
+
url?: string;
|
|
863
|
+
/** @description User Agent */
|
|
864
|
+
userAgent?: string;
|
|
865
|
+
};
|
|
866
|
+
};
|
|
867
|
+
};
|
|
868
|
+
responses: {
|
|
869
|
+
/** @description Successful response */
|
|
870
|
+
204: {
|
|
871
|
+
headers: {
|
|
872
|
+
[name: string]: unknown;
|
|
873
|
+
};
|
|
874
|
+
content?: never;
|
|
875
|
+
};
|
|
876
|
+
/** @description Default Response */
|
|
877
|
+
404: {
|
|
878
|
+
headers: {
|
|
879
|
+
[name: string]: unknown;
|
|
880
|
+
};
|
|
881
|
+
content?: never;
|
|
882
|
+
};
|
|
883
|
+
};
|
|
884
|
+
};
|
|
885
|
+
delete?: never;
|
|
886
|
+
options?: never;
|
|
887
|
+
head?: never;
|
|
888
|
+
patch?: never;
|
|
889
|
+
trace?: never;
|
|
890
|
+
};
|
|
901
891
|
'/api/tracking/user/v1': {
|
|
902
892
|
parameters: {
|
|
903
893
|
query?: never;
|
|
@@ -909,6 +899,7 @@ interface paths {
|
|
|
909
899
|
put?: never;
|
|
910
900
|
/**
|
|
911
901
|
* Submit user tracking data
|
|
902
|
+
* @deprecated
|
|
912
903
|
* @description Submit user tracking data
|
|
913
904
|
*/
|
|
914
905
|
post: {
|
|
@@ -981,6 +972,80 @@ interface paths {
|
|
|
981
972
|
patch?: never;
|
|
982
973
|
trace?: never;
|
|
983
974
|
};
|
|
975
|
+
'/api/tracking/user/v2': {
|
|
976
|
+
parameters: {
|
|
977
|
+
query?: never;
|
|
978
|
+
header?: never;
|
|
979
|
+
path?: never;
|
|
980
|
+
cookie?: never;
|
|
981
|
+
};
|
|
982
|
+
get?: never;
|
|
983
|
+
put?: never;
|
|
984
|
+
/**
|
|
985
|
+
* Submit user tracking data
|
|
986
|
+
* @description Submit user tracking data
|
|
987
|
+
*/
|
|
988
|
+
post: {
|
|
989
|
+
parameters: {
|
|
990
|
+
query?: never;
|
|
991
|
+
header?: never;
|
|
992
|
+
path?: never;
|
|
993
|
+
cookie?: never;
|
|
994
|
+
};
|
|
995
|
+
/** @description User tracking event data */
|
|
996
|
+
requestBody: {
|
|
997
|
+
content: {
|
|
998
|
+
/** @example {
|
|
999
|
+
* "conversationId": "386d85d7-9daa-8a87-85d4-3f93c990b292",
|
|
1000
|
+
* "eventName": "tab-shown",
|
|
1001
|
+
* "url": "https://www.example.com/telco/"
|
|
1002
|
+
* } */
|
|
1003
|
+
'application/json': {
|
|
1004
|
+
additionalProperties?: {
|
|
1005
|
+
[key: string]: boolean | number | string;
|
|
1006
|
+
};
|
|
1007
|
+
/** @description Conversation ID */
|
|
1008
|
+
conversationId?: string;
|
|
1009
|
+
/**
|
|
1010
|
+
* @description Device Type
|
|
1011
|
+
* @enum {string}
|
|
1012
|
+
*/
|
|
1013
|
+
deviceType?: 'desktop' | 'mobile' | 'tablet';
|
|
1014
|
+
/**
|
|
1015
|
+
* @description Event Name
|
|
1016
|
+
* @enum {string}
|
|
1017
|
+
*/
|
|
1018
|
+
eventName: 'welcome_screen-shown' | 'tab-shown' | 'feedback_submit-clicked' | 'page-shown' | 'tool-closed' | 'user_message-submitted' | 'assistant_message-submitted' | 'feedback-shown' | 'feedback_skip-clicked' | 'sale-completed' | 'tab-clicked' | 'tool_close-clicked' | 'woo_assistant_message-submitted' | 'woo_user_message-submitted' | 'woo_reaction-submitted';
|
|
1019
|
+
/** @description URL */
|
|
1020
|
+
url?: string;
|
|
1021
|
+
/** @description User Agent */
|
|
1022
|
+
userAgent?: string;
|
|
1023
|
+
};
|
|
1024
|
+
};
|
|
1025
|
+
};
|
|
1026
|
+
responses: {
|
|
1027
|
+
/** @description Successful response */
|
|
1028
|
+
204: {
|
|
1029
|
+
headers: {
|
|
1030
|
+
[name: string]: unknown;
|
|
1031
|
+
};
|
|
1032
|
+
content?: never;
|
|
1033
|
+
};
|
|
1034
|
+
/** @description Default Response */
|
|
1035
|
+
404: {
|
|
1036
|
+
headers: {
|
|
1037
|
+
[name: string]: unknown;
|
|
1038
|
+
};
|
|
1039
|
+
content?: never;
|
|
1040
|
+
};
|
|
1041
|
+
};
|
|
1042
|
+
};
|
|
1043
|
+
delete?: never;
|
|
1044
|
+
options?: never;
|
|
1045
|
+
head?: never;
|
|
1046
|
+
patch?: never;
|
|
1047
|
+
trace?: never;
|
|
1048
|
+
};
|
|
984
1049
|
}
|
|
985
1050
|
|
|
986
1051
|
/**
|
|
@@ -988,14 +1053,9 @@ interface paths {
|
|
|
988
1053
|
* We don't use them directly, or export them here because of how they appear in the documentation site.
|
|
989
1054
|
*/
|
|
990
1055
|
type ApiConversationRequest = components['schemas']['ConversationRequest'];
|
|
991
|
-
type ApiMessage = components['schemas']['ConversationResponseMessageChunk'];
|
|
992
1056
|
type ApiDebug = components['schemas']['ConversationResponseDebugChunk'];
|
|
993
|
-
type
|
|
994
|
-
|
|
995
|
-
* The request to the conversation API.
|
|
996
|
-
*/
|
|
997
|
-
interface ConversationApiRequest extends ApiConversationRequest {
|
|
998
|
-
}
|
|
1057
|
+
type ApiMessage = components['schemas']['ConversationResponseMessageChunk'];
|
|
1058
|
+
type ApiTrackingUserRequest = paths['/api/tracking/user/v2']['post']['requestBody']['content']['application/json'];
|
|
999
1059
|
/**
|
|
1000
1060
|
* Configuration options for initializing the client.
|
|
1001
1061
|
*/
|
|
@@ -1008,7 +1068,7 @@ interface Config {
|
|
|
1008
1068
|
* Optional fetch function to use for making HTTP requests.
|
|
1009
1069
|
* If not provided, the default `fetch` implementation will be used.
|
|
1010
1070
|
*/
|
|
1011
|
-
fetch?: (
|
|
1071
|
+
fetch?: (input: Request) => Promise<Response>;
|
|
1012
1072
|
/**
|
|
1013
1073
|
* The base URL for the conversation API.
|
|
1014
1074
|
*/
|
|
@@ -1038,19 +1098,19 @@ interface Identity {
|
|
|
1038
1098
|
/**
|
|
1039
1099
|
* The customer ID.
|
|
1040
1100
|
*/
|
|
1041
|
-
customerId:
|
|
1101
|
+
customerId: Config['customerId'];
|
|
1042
1102
|
/**
|
|
1043
1103
|
* The conversation ID.
|
|
1044
1104
|
*/
|
|
1045
|
-
conversationId
|
|
1105
|
+
conversationId?: string;
|
|
1046
1106
|
/**
|
|
1047
1107
|
* The session ID associated with the user.
|
|
1048
1108
|
*/
|
|
1049
|
-
sessionId
|
|
1109
|
+
sessionId?: string;
|
|
1050
1110
|
/**
|
|
1051
1111
|
* The user ID.
|
|
1052
1112
|
*/
|
|
1053
|
-
userId
|
|
1113
|
+
userId?: string;
|
|
1054
1114
|
}
|
|
1055
1115
|
/**
|
|
1056
1116
|
* Message within a conversation.
|
|
@@ -1083,7 +1143,12 @@ interface DebugResponse {
|
|
|
1083
1143
|
*/
|
|
1084
1144
|
type: ApiDebug['type'];
|
|
1085
1145
|
}
|
|
1086
|
-
|
|
1146
|
+
/**
|
|
1147
|
+
* The request to the conversation API.
|
|
1148
|
+
*/
|
|
1149
|
+
interface ConversationApiRequest extends ApiConversationRequest {
|
|
1150
|
+
}
|
|
1151
|
+
interface TrackingEvent extends ApiTrackingUserRequest {
|
|
1087
1152
|
}
|
|
1088
1153
|
|
|
1089
1154
|
/**
|
|
@@ -1116,9 +1181,10 @@ declare class Client {
|
|
|
1116
1181
|
*/
|
|
1117
1182
|
constructor({ customerId, fetch, conversationUrl, frontendUrl }: Config);
|
|
1118
1183
|
/**
|
|
1119
|
-
* Creates a new identity for the user by generating a session ID and user ID if they don't exist.
|
|
1184
|
+
* Creates a new identity for the user by generating a session ID and user ID if they don't exist, and sets the access token for future API calls.
|
|
1185
|
+
* Ends the current conversation if a conversation ID is present before sending a request to update identity.
|
|
1120
1186
|
*
|
|
1121
|
-
* @returns A promise that resolves once the identity is created.
|
|
1187
|
+
* @returns A promise that resolves once the identity is created and the access token is set.
|
|
1122
1188
|
*
|
|
1123
1189
|
* @example
|
|
1124
1190
|
* ```ts
|
|
@@ -1174,15 +1240,50 @@ declare class Client {
|
|
|
1174
1240
|
* await client.trackEvent('tab-shown')
|
|
1175
1241
|
* ```
|
|
1176
1242
|
*/
|
|
1177
|
-
trackEvent(eventName: TrackingEvent['eventName'], properties?: TrackingEvent['additionalProperties']): Promise<{
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1243
|
+
trackEvent(eventName: TrackingEvent['eventName'], properties?: TrackingEvent['additionalProperties']): Promise<openapi_fetch.FetchResponse<{
|
|
1244
|
+
parameters: {
|
|
1245
|
+
query?: never;
|
|
1246
|
+
header?: never;
|
|
1247
|
+
path?: never;
|
|
1248
|
+
cookie?: never;
|
|
1249
|
+
};
|
|
1250
|
+
requestBody: {
|
|
1251
|
+
content: {
|
|
1252
|
+
"application/json": {
|
|
1253
|
+
additionalProperties?: {
|
|
1254
|
+
[key: string]: boolean | number | string;
|
|
1255
|
+
};
|
|
1256
|
+
conversationId?: string;
|
|
1257
|
+
deviceType?: "desktop" | "mobile" | "tablet";
|
|
1258
|
+
eventName: "welcome_screen-shown" | "tab-shown" | "feedback_submit-clicked" | "page-shown" | "tool-closed" | "user_message-submitted" | "assistant_message-submitted" | "feedback-shown" | "feedback_skip-clicked" | "sale-completed" | "tab-clicked" | "tool_close-clicked" | "woo_assistant_message-submitted" | "woo_user_message-submitted" | "woo_reaction-submitted";
|
|
1259
|
+
url?: string;
|
|
1260
|
+
userAgent?: string;
|
|
1261
|
+
};
|
|
1262
|
+
};
|
|
1263
|
+
};
|
|
1264
|
+
responses: {
|
|
1265
|
+
204: {
|
|
1266
|
+
headers: {
|
|
1267
|
+
[name: string]: unknown;
|
|
1268
|
+
};
|
|
1269
|
+
content?: never;
|
|
1270
|
+
};
|
|
1271
|
+
404: {
|
|
1272
|
+
headers: {
|
|
1273
|
+
[name: string]: unknown;
|
|
1274
|
+
};
|
|
1275
|
+
content?: never;
|
|
1276
|
+
};
|
|
1277
|
+
};
|
|
1278
|
+
}, {
|
|
1279
|
+
body: TrackingEvent;
|
|
1280
|
+
}, `${string}/${string}`>>;
|
|
1182
1281
|
}
|
|
1183
1282
|
|
|
1184
1283
|
/**
|
|
1185
1284
|
* The key used to store the conversation ID in `sessionStorage`.
|
|
1285
|
+
*
|
|
1286
|
+
* @ignore
|
|
1186
1287
|
*/
|
|
1187
1288
|
declare const CONVERSATION_ID = "__15gifts_conversation_id";
|
|
1188
1289
|
/**
|
|
@@ -1229,6 +1330,8 @@ declare const setConversationId: (conversationId: string) => void;
|
|
|
1229
1330
|
|
|
1230
1331
|
/**
|
|
1231
1332
|
* The key used to store the session ID in `sessionStorage`.
|
|
1333
|
+
*
|
|
1334
|
+
* @ignore
|
|
1232
1335
|
*/
|
|
1233
1336
|
declare const SESSION_ID = "__15gifts_session_id";
|
|
1234
1337
|
/**
|
|
@@ -1263,11 +1366,15 @@ declare const setSessionId: (sessionId: string) => void;
|
|
|
1263
1366
|
|
|
1264
1367
|
/**
|
|
1265
1368
|
* The key used to store the user ID in `localStorage`.
|
|
1369
|
+
*
|
|
1370
|
+
* @ignore
|
|
1266
1371
|
*/
|
|
1267
1372
|
declare const USER_ID = "__15gifts_user_id";
|
|
1268
1373
|
/**
|
|
1269
1374
|
* Time-to-live (TTL) for the user ID in milliseconds.
|
|
1270
1375
|
* Set to 30 days.
|
|
1376
|
+
*
|
|
1377
|
+
* @ignore
|
|
1271
1378
|
*/
|
|
1272
1379
|
declare const TTL: number;
|
|
1273
1380
|
/**
|
|
@@ -1300,4 +1407,19 @@ declare const getUserId: () => string | null;
|
|
|
1300
1407
|
*/
|
|
1301
1408
|
declare const setUserId: (userId: string) => void;
|
|
1302
1409
|
|
|
1303
|
-
|
|
1410
|
+
/**
|
|
1411
|
+
* Middleware for adding an `Authorization` header to requests.
|
|
1412
|
+
*
|
|
1413
|
+
* @param accessToken - The token to be included in the `Authorization` header.
|
|
1414
|
+
* @returns A middleware object that attaches the access token to the request headers.
|
|
1415
|
+
*
|
|
1416
|
+
* @example
|
|
1417
|
+
* ```ts
|
|
1418
|
+
* import { authMiddleware } from '@15gifts/sdk';
|
|
1419
|
+
*
|
|
1420
|
+
* this.endpoint.conversation.use(authMiddleware(accessToken))
|
|
1421
|
+
* ```
|
|
1422
|
+
*/
|
|
1423
|
+
declare const authMiddleware: (accessToken: string) => Middleware;
|
|
1424
|
+
|
|
1425
|
+
export { CONVERSATION_ID, Client, type Config, type ConversationApiRequest, type DebugResponse, type Endpoint, type Identity, type Message, SESSION_ID, TTL, type TrackingEvent, USER_ID, authMiddleware, deleteConversationId, getConversationId, getSessionId, getUserId, setConversationId, setSessionId, setUserId };
|