@wix/auto_sdk_ai-site-chat_widget-settings 1.0.2 → 1.0.3
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/build/cjs/index.d.ts +24 -1
- package/build/cjs/index.js +253 -15
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/index.typings.d.ts +205 -1
- package/build/cjs/index.typings.js +233 -15
- package/build/cjs/index.typings.js.map +1 -1
- package/build/cjs/meta.d.ts +196 -1
- package/build/cjs/meta.js +207 -15
- package/build/cjs/meta.js.map +1 -1
- package/build/es/index.d.mts +24 -0
- package/build/es/index.mjs +230 -0
- package/build/es/index.mjs.map +1 -0
- package/build/{internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.universal.d.ts → es/index.typings.d.mts} +55 -110
- package/build/es/index.typings.mjs +210 -0
- package/build/es/index.typings.mjs.map +1 -0
- package/build/es/{src/innovation-widget-v1-widget-settings-widget-settings.types.d.ts → meta.d.mts} +64 -91
- package/build/es/meta.mjs +182 -0
- package/build/es/meta.mjs.map +1 -0
- package/build/internal/cjs/index.d.ts +24 -1
- package/build/internal/cjs/index.js +253 -15
- package/build/internal/cjs/index.js.map +1 -1
- package/build/internal/cjs/index.typings.d.ts +205 -1
- package/build/internal/cjs/index.typings.js +233 -15
- package/build/internal/cjs/index.typings.js.map +1 -1
- package/build/internal/cjs/meta.d.ts +196 -1
- package/build/internal/cjs/meta.js +207 -15
- package/build/internal/cjs/meta.js.map +1 -1
- package/build/internal/es/index.d.mts +24 -0
- package/build/internal/es/index.mjs +230 -0
- package/build/internal/es/index.mjs.map +1 -0
- package/build/internal/es/{src/innovation-widget-v1-widget-settings-widget-settings.universal.d.ts → index.typings.d.mts} +55 -110
- package/build/internal/es/index.typings.mjs +210 -0
- package/build/internal/es/index.typings.mjs.map +1 -0
- package/build/{cjs/src/innovation-widget-v1-widget-settings-widget-settings.types.d.ts → internal/es/meta.d.mts} +64 -91
- package/build/internal/es/meta.mjs +182 -0
- package/build/internal/es/meta.mjs.map +1 -0
- package/package.json +12 -10
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.context.d.ts +0 -6
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.context.js +0 -10
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.context.js.map +0 -1
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.http.d.ts +0 -5
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.http.js +0 -136
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.http.js.map +0 -1
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.meta.d.ts +0 -14
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.meta.js +0 -66
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.meta.js.map +0 -1
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.public.d.ts +0 -21
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.public.js +0 -20
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.public.js.map +0 -1
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.types.js +0 -17
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.types.js.map +0 -1
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.universal.d.ts +0 -260
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.universal.js +0 -124
- package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.universal.js.map +0 -1
- package/build/es/index.d.ts +0 -1
- package/build/es/index.js +0 -2
- package/build/es/index.js.map +0 -1
- package/build/es/index.typings.d.ts +0 -1
- package/build/es/index.typings.js +0 -2
- package/build/es/index.typings.js.map +0 -1
- package/build/es/meta.d.ts +0 -1
- package/build/es/meta.js +0 -2
- package/build/es/meta.js.map +0 -1
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.context.d.ts +0 -6
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.context.js +0 -6
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.context.js.map +0 -1
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.http.d.ts +0 -5
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.http.js +0 -131
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.http.js.map +0 -1
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.meta.d.ts +0 -14
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.meta.js +0 -38
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.meta.js.map +0 -1
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.public.d.ts +0 -21
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.public.js +0 -14
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.public.js.map +0 -1
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.types.js +0 -14
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.types.js.map +0 -1
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.universal.d.ts +0 -260
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.universal.js +0 -96
- package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.universal.js.map +0 -1
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.context.d.ts +0 -6
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.context.js +0 -10
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.context.js.map +0 -1
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.http.d.ts +0 -5
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.http.js +0 -136
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.http.js.map +0 -1
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.meta.d.ts +0 -14
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.meta.js +0 -66
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.meta.js.map +0 -1
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.public.d.ts +0 -21
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.public.js +0 -20
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.public.js.map +0 -1
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.types.d.ts +0 -223
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.types.js +0 -17
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.types.js.map +0 -1
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.universal.js +0 -124
- package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.universal.js.map +0 -1
- package/build/internal/es/index.d.ts +0 -1
- package/build/internal/es/index.js +0 -2
- package/build/internal/es/index.js.map +0 -1
- package/build/internal/es/index.typings.d.ts +0 -1
- package/build/internal/es/index.typings.js +0 -2
- package/build/internal/es/index.typings.js.map +0 -1
- package/build/internal/es/meta.d.ts +0 -1
- package/build/internal/es/meta.js +0 -2
- package/build/internal/es/meta.js.map +0 -1
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.context.d.ts +0 -6
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.context.js +0 -6
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.context.js.map +0 -1
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.http.d.ts +0 -5
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.http.js +0 -131
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.http.js.map +0 -1
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.meta.d.ts +0 -14
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.meta.js +0 -38
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.meta.js.map +0 -1
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.public.d.ts +0 -21
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.public.js +0 -14
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.public.js.map +0 -1
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.types.d.ts +0 -223
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.types.js +0 -14
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.types.js.map +0 -1
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.universal.js +0 -96
- package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.universal.js.map +0 -1
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
1
|
+
import { NonNullablePaths } from '@wix/sdk-types';
|
|
2
|
+
|
|
3
|
+
interface WidgetSettings {
|
|
2
4
|
/**
|
|
3
5
|
* Widget settings ID.
|
|
4
6
|
* @format GUID
|
|
@@ -25,21 +27,32 @@ export interface WidgetSettings {
|
|
|
25
27
|
autoOpen?: boolean;
|
|
26
28
|
/** Times the AI assistant is available on the site. */
|
|
27
29
|
activeHours?: ActiveHours;
|
|
28
|
-
/** Defines
|
|
29
|
-
offlineBehavior?:
|
|
30
|
-
/**
|
|
31
|
-
|
|
30
|
+
/** Defines how the AI Site-Chat functions during the non-active hours. */
|
|
31
|
+
offlineBehavior?: OfflineBehaviorWithLiterals;
|
|
32
|
+
/** Whether the AI Site-Chat should send a summary of the site visitor's navigation on the site. */
|
|
33
|
+
navigationSummary?: boolean | null;
|
|
34
|
+
/**
|
|
35
|
+
* Wix Media image ID used for the AI assistant.
|
|
36
|
+
* @maxLength 500
|
|
37
|
+
*/
|
|
38
|
+
avatar?: string | null;
|
|
39
|
+
/** Whether to display example questions from the AI assistant. */
|
|
40
|
+
generatedQuestions?: boolean | null;
|
|
32
41
|
}
|
|
33
42
|
/** Intro message */
|
|
34
|
-
|
|
43
|
+
interface IntroMessage {
|
|
35
44
|
/** Main message settings. */
|
|
36
45
|
message?: SettingsMessage;
|
|
37
46
|
/** Legal disclaimer message settings. */
|
|
38
47
|
legalDisclaimer?: SettingsMessage;
|
|
39
48
|
/** Offline message settings. */
|
|
40
49
|
offlineDisclaimer?: SettingsMessage;
|
|
50
|
+
/** Message shown as popup to engage the site visitor with the AI assistant. */
|
|
51
|
+
engage?: SettingsMessage;
|
|
52
|
+
/** Suggested questions shown to the site visitor to help them get started. */
|
|
53
|
+
suggestions?: SuggestedQuestions;
|
|
41
54
|
}
|
|
42
|
-
|
|
55
|
+
interface SettingsMessage {
|
|
43
56
|
/** Whether the message is enabled. */
|
|
44
57
|
enabled?: boolean;
|
|
45
58
|
/**
|
|
@@ -48,21 +61,35 @@ export interface SettingsMessage {
|
|
|
48
61
|
*/
|
|
49
62
|
text?: string;
|
|
50
63
|
}
|
|
51
|
-
|
|
64
|
+
interface SuggestedQuestions {
|
|
65
|
+
/** Whether suggesting questions is enabled. */
|
|
66
|
+
enabled?: boolean;
|
|
67
|
+
/**
|
|
68
|
+
* Suggested questions shown to the site visitor to help them get started.
|
|
69
|
+
* @minSize 1
|
|
70
|
+
* @maxSize 5
|
|
71
|
+
*/
|
|
72
|
+
questions?: SettingsMessage[];
|
|
73
|
+
/** Introduction message for the suggested questions. */
|
|
74
|
+
introduction?: SettingsMessage;
|
|
75
|
+
}
|
|
76
|
+
interface ContactForm {
|
|
52
77
|
/** When the AI Site-Chat should send the contact form. */
|
|
53
78
|
conditions?: Conditions;
|
|
54
79
|
/** Contact form fields. */
|
|
55
80
|
fields?: Fields;
|
|
56
81
|
}
|
|
57
82
|
/** Contact form conditions */
|
|
58
|
-
|
|
83
|
+
interface Conditions {
|
|
59
84
|
/** Whether the AI Site-Chat should send the contact form if the AI is unable to answer the site visitor's question. */
|
|
60
85
|
cannotAnswer?: boolean;
|
|
61
86
|
/** Whether the AI Site-Chat should send the contact form if the site visitor requests to chat with a real person. */
|
|
62
87
|
requestForPerson?: boolean;
|
|
88
|
+
/** Require site visitor to fill contact form before starting a conversation. */
|
|
89
|
+
beforeChat?: boolean | null;
|
|
63
90
|
}
|
|
64
91
|
/** Contact form fields */
|
|
65
|
-
|
|
92
|
+
interface Fields {
|
|
66
93
|
/** Whether to include a name field in the form. */
|
|
67
94
|
name?: boolean;
|
|
68
95
|
/** Whether to include an email field in the form. */
|
|
@@ -73,7 +100,7 @@ export interface Fields {
|
|
|
73
100
|
message?: boolean;
|
|
74
101
|
}
|
|
75
102
|
/** Working hours settings */
|
|
76
|
-
|
|
103
|
+
interface ActiveHours {
|
|
77
104
|
/** Whether the AI Assistant is always online. If `true`, `schedule` and `timeZone` are ignored. */
|
|
78
105
|
always?: boolean;
|
|
79
106
|
/** Times at which the AI Assistant is online. */
|
|
@@ -85,7 +112,7 @@ export interface ActiveHours {
|
|
|
85
112
|
timeZone?: string;
|
|
86
113
|
}
|
|
87
114
|
/** Schedule */
|
|
88
|
-
|
|
115
|
+
interface Schedule {
|
|
89
116
|
/** Monday schedule. */
|
|
90
117
|
monday?: DaySchedule;
|
|
91
118
|
/** Tuesday schedule. */
|
|
@@ -102,7 +129,7 @@ export interface Schedule {
|
|
|
102
129
|
sunday?: DaySchedule;
|
|
103
130
|
}
|
|
104
131
|
/** Day schedule */
|
|
105
|
-
|
|
132
|
+
interface DaySchedule {
|
|
106
133
|
/** Whether the day is enabled. */
|
|
107
134
|
enabled?: boolean;
|
|
108
135
|
/**
|
|
@@ -112,13 +139,13 @@ export interface DaySchedule {
|
|
|
112
139
|
frames?: WorkingHoursFrame[];
|
|
113
140
|
}
|
|
114
141
|
/** Working hours frame */
|
|
115
|
-
|
|
142
|
+
interface WorkingHoursFrame {
|
|
116
143
|
/** Start time of the active hours. */
|
|
117
144
|
start?: number;
|
|
118
145
|
/** End time of the active hours. */
|
|
119
146
|
end?: number;
|
|
120
147
|
}
|
|
121
|
-
|
|
148
|
+
declare enum OfflineBehavior {
|
|
122
149
|
/** Unknown offline behavior. */
|
|
123
150
|
UNKNOWN_OFFLINE_BEHAVIOR = "UNKNOWN_OFFLINE_BEHAVIOR",
|
|
124
151
|
/** Allows the site visitor to write messages, but doesn't send a contact form. */
|
|
@@ -130,20 +157,11 @@ export declare enum OfflineBehavior {
|
|
|
130
157
|
/** Allows the site visitor to write messages and sends a contact form. */
|
|
131
158
|
CONTACT_FORM_WITH_CHAT = "CONTACT_FORM_WITH_CHAT"
|
|
132
159
|
}
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
* The value of each key is structured according to the schema defined when the extended fields were configured.
|
|
137
|
-
*
|
|
138
|
-
* You can only access fields for which you have the appropriate permissions.
|
|
139
|
-
*
|
|
140
|
-
* Learn more about [extended fields](https://dev.wix.com/docs/rest/articles/getting-started/extended-fields).
|
|
141
|
-
*/
|
|
142
|
-
namespaces?: Record<string, Record<string, any>>;
|
|
143
|
-
}
|
|
144
|
-
export interface GetWidgetSettingsRequest {
|
|
160
|
+
/** @enumType */
|
|
161
|
+
type OfflineBehaviorWithLiterals = OfflineBehavior | 'UNKNOWN_OFFLINE_BEHAVIOR' | 'CHAT_ONLY' | 'HIDE' | 'CONTACT_FORM_WITHOUT_CHAT' | 'CONTACT_FORM_WITH_CHAT';
|
|
162
|
+
interface GetWidgetSettingsRequest {
|
|
145
163
|
}
|
|
146
|
-
|
|
164
|
+
interface GetWidgetSettingsResponse {
|
|
147
165
|
/** Retrieved widget settings. */
|
|
148
166
|
widgetSettings?: WidgetSettings;
|
|
149
167
|
/**
|
|
@@ -152,109 +170,36 @@ export interface GetWidgetSettingsResponse {
|
|
|
152
170
|
*/
|
|
153
171
|
assistantOnline?: boolean;
|
|
154
172
|
}
|
|
155
|
-
|
|
173
|
+
interface SetWidgetSettingsRequest {
|
|
156
174
|
/** Widget settings to update. */
|
|
157
175
|
widgetSettings: WidgetSettings;
|
|
158
176
|
}
|
|
159
|
-
|
|
177
|
+
interface SetWidgetSettingsResponse {
|
|
160
178
|
/** Updated widget settings. */
|
|
161
179
|
widgetSettings?: WidgetSettings;
|
|
162
180
|
}
|
|
163
|
-
interface SettingsMessageNonNullableFields {
|
|
164
|
-
enabled: boolean;
|
|
165
|
-
text: string;
|
|
166
|
-
}
|
|
167
|
-
interface IntroMessageNonNullableFields {
|
|
168
|
-
message?: SettingsMessageNonNullableFields;
|
|
169
|
-
legalDisclaimer?: SettingsMessageNonNullableFields;
|
|
170
|
-
offlineDisclaimer?: SettingsMessageNonNullableFields;
|
|
171
|
-
}
|
|
172
|
-
interface ConditionsNonNullableFields {
|
|
173
|
-
cannotAnswer: boolean;
|
|
174
|
-
requestForPerson: boolean;
|
|
175
|
-
}
|
|
176
|
-
interface FieldsNonNullableFields {
|
|
177
|
-
name: boolean;
|
|
178
|
-
email: boolean;
|
|
179
|
-
phone: boolean;
|
|
180
|
-
message: boolean;
|
|
181
|
-
}
|
|
182
|
-
interface ContactFormNonNullableFields {
|
|
183
|
-
conditions?: ConditionsNonNullableFields;
|
|
184
|
-
fields?: FieldsNonNullableFields;
|
|
185
|
-
}
|
|
186
|
-
interface WorkingHoursFrameNonNullableFields {
|
|
187
|
-
start: number;
|
|
188
|
-
end: number;
|
|
189
|
-
}
|
|
190
|
-
interface DayScheduleNonNullableFields {
|
|
191
|
-
enabled: boolean;
|
|
192
|
-
frames: WorkingHoursFrameNonNullableFields[];
|
|
193
|
-
}
|
|
194
|
-
interface ScheduleNonNullableFields {
|
|
195
|
-
monday?: DayScheduleNonNullableFields;
|
|
196
|
-
tuesday?: DayScheduleNonNullableFields;
|
|
197
|
-
wednesday?: DayScheduleNonNullableFields;
|
|
198
|
-
thursday?: DayScheduleNonNullableFields;
|
|
199
|
-
friday?: DayScheduleNonNullableFields;
|
|
200
|
-
saturday?: DayScheduleNonNullableFields;
|
|
201
|
-
sunday?: DayScheduleNonNullableFields;
|
|
202
|
-
}
|
|
203
|
-
interface ActiveHoursNonNullableFields {
|
|
204
|
-
always: boolean;
|
|
205
|
-
schedule?: ScheduleNonNullableFields;
|
|
206
|
-
timeZone: string;
|
|
207
|
-
}
|
|
208
|
-
interface WidgetSettingsNonNullableFields {
|
|
209
|
-
enabled: boolean;
|
|
210
|
-
introMessage?: IntroMessageNonNullableFields;
|
|
211
|
-
contactForm?: ContactFormNonNullableFields;
|
|
212
|
-
autoOpen: boolean;
|
|
213
|
-
activeHours?: ActiveHoursNonNullableFields;
|
|
214
|
-
offlineBehavior: OfflineBehavior;
|
|
215
|
-
}
|
|
216
|
-
export interface GetWidgetSettingsResponseNonNullableFields {
|
|
217
|
-
widgetSettings?: WidgetSettingsNonNullableFields;
|
|
218
|
-
assistantOnline: boolean;
|
|
219
|
-
}
|
|
220
|
-
export interface SetWidgetSettingsResponseNonNullableFields {
|
|
221
|
-
widgetSettings?: WidgetSettingsNonNullableFields;
|
|
222
|
-
}
|
|
223
181
|
/**
|
|
224
182
|
* Retrieves the widget settings for the site.
|
|
225
183
|
* @public
|
|
226
|
-
* @
|
|
227
|
-
* @permissionId INNOVATION_LAB.CHAT_WIDGET
|
|
228
|
-
* @permissionScope Manage Bookings Services and Settings
|
|
229
|
-
* @permissionScopeId SCOPE.BOOKINGS.CONFIGURATION
|
|
230
|
-
* @permissionScope Manage Events
|
|
231
|
-
* @permissionScopeId SCOPE.EVENTS.MANAGE-EVENTS
|
|
232
|
-
* @permissionScope Manage Portfolio
|
|
233
|
-
* @permissionScopeId SCOPE.PORTFOLIO.MANAGE-PORTFOLIO
|
|
234
|
-
* @permissionScope Access Verticals by Automations
|
|
235
|
-
* @permissionScopeId SCOPE.CRM.ACCESS-VERTICALS-BY-AUTOMATIONS
|
|
236
|
-
* @permissionScope Manage Restaurants - all permissions
|
|
237
|
-
* @permissionScopeId SCOPE.RESTAURANTS.MEGA-SCOPES
|
|
238
|
-
* @permissionScope Set Up Automations
|
|
239
|
-
* @permissionScopeId SCOPE.CRM.SETUP-AUTOMATIONS
|
|
184
|
+
* @permissionId INNOVATION_LAB.CHAT_WIDGET_SETTINGS_READ
|
|
240
185
|
* @applicableIdentity APP
|
|
241
|
-
* @applicableIdentity VISITOR
|
|
242
186
|
* @fqn wix.innovation.assistant.widget.v1.Settings.GetWidgetSettings
|
|
243
187
|
*/
|
|
244
|
-
|
|
188
|
+
declare function getWidgetSettings(): Promise<NonNullablePaths<GetWidgetSettingsResponse, `widgetSettings.enabled` | `widgetSettings.introMessage.message.enabled` | `widgetSettings.introMessage.message.text` | `widgetSettings.introMessage.suggestions.enabled` | `widgetSettings.introMessage.suggestions.questions` | `widgetSettings.contactForm.conditions.cannotAnswer` | `widgetSettings.contactForm.conditions.requestForPerson` | `widgetSettings.contactForm.fields.name` | `widgetSettings.contactForm.fields.email` | `widgetSettings.contactForm.fields.phone` | `widgetSettings.contactForm.fields.message` | `widgetSettings.autoOpen` | `widgetSettings.activeHours.always` | `widgetSettings.activeHours.schedule.monday.enabled` | `widgetSettings.activeHours.schedule.monday.frames` | `widgetSettings.activeHours.schedule.monday.frames.${number}.start` | `widgetSettings.activeHours.schedule.monday.frames.${number}.end` | `widgetSettings.activeHours.timeZone` | `widgetSettings.offlineBehavior` | `assistantOnline`, 8>>;
|
|
245
189
|
/**
|
|
246
190
|
* Sets the widget settings for the site.
|
|
247
191
|
* @param widgetSettings - Widget settings to update.
|
|
248
192
|
* @public
|
|
249
|
-
* @documentationMaturity preview
|
|
250
193
|
* @requiredField widgetSettings
|
|
251
194
|
* @requiredField widgetSettings.activeHours
|
|
252
195
|
* @requiredField widgetSettings.contactForm
|
|
253
196
|
* @requiredField widgetSettings.contactForm.conditions
|
|
254
197
|
* @requiredField widgetSettings.contactForm.fields
|
|
255
198
|
* @requiredField widgetSettings.introMessage
|
|
256
|
-
* @permissionId INNOVATION_LAB.
|
|
199
|
+
* @permissionId INNOVATION_LAB.CHAT_WIDGET_SETTINGS_WRITE
|
|
200
|
+
* @applicableIdentity APP
|
|
257
201
|
* @fqn wix.innovation.assistant.widget.v1.Settings.SetWidgetSettings
|
|
258
202
|
*/
|
|
259
|
-
|
|
260
|
-
|
|
203
|
+
declare function setWidgetSettings(widgetSettings: NonNullablePaths<WidgetSettings, `activeHours` | `contactForm` | `contactForm.conditions` | `contactForm.fields` | `introMessage`, 3>): Promise<NonNullablePaths<SetWidgetSettingsResponse, `widgetSettings.enabled` | `widgetSettings.introMessage.message.enabled` | `widgetSettings.introMessage.message.text` | `widgetSettings.introMessage.suggestions.enabled` | `widgetSettings.introMessage.suggestions.questions` | `widgetSettings.contactForm.conditions.cannotAnswer` | `widgetSettings.contactForm.conditions.requestForPerson` | `widgetSettings.contactForm.fields.name` | `widgetSettings.contactForm.fields.email` | `widgetSettings.contactForm.fields.phone` | `widgetSettings.contactForm.fields.message` | `widgetSettings.autoOpen` | `widgetSettings.activeHours.always` | `widgetSettings.activeHours.schedule.monday.enabled` | `widgetSettings.activeHours.schedule.monday.frames` | `widgetSettings.activeHours.schedule.monday.frames.${number}.start` | `widgetSettings.activeHours.schedule.monday.frames.${number}.end` | `widgetSettings.activeHours.timeZone` | `widgetSettings.offlineBehavior`, 8>>;
|
|
204
|
+
|
|
205
|
+
export { type ActiveHours, type Conditions, type ContactForm, type DaySchedule, type Fields, type GetWidgetSettingsRequest, type GetWidgetSettingsResponse, type IntroMessage, OfflineBehavior, type OfflineBehaviorWithLiterals, type Schedule, type SetWidgetSettingsRequest, type SetWidgetSettingsResponse, type SettingsMessage, type SuggestedQuestions, type WidgetSettings, type WorkingHoursFrame, getWidgetSettings, setWidgetSettings };
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
// src/innovation-widget-v1-widget-settings-widget-settings.universal.ts
|
|
2
|
+
import { transformError as sdkTransformError } from "@wix/sdk-runtime/transform-error";
|
|
3
|
+
import {
|
|
4
|
+
renameKeysFromSDKRequestToRESTRequest,
|
|
5
|
+
renameKeysFromRESTResponseToSDKResponse
|
|
6
|
+
} from "@wix/sdk-runtime/rename-all-nested-keys";
|
|
7
|
+
|
|
8
|
+
// src/innovation-widget-v1-widget-settings-widget-settings.http.ts
|
|
9
|
+
import { toURLSearchParams } from "@wix/sdk-runtime/rest-modules";
|
|
10
|
+
import { transformSDKTimestampToRESTTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
|
|
11
|
+
import { transformRESTTimestampToSDKTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
|
|
12
|
+
import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
|
|
13
|
+
import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
|
|
14
|
+
function resolveWixInnovationAssistantWidgetV1SettingsUrl(opts) {
|
|
15
|
+
const domainToMappings = {
|
|
16
|
+
"manage._base_domain_": [
|
|
17
|
+
{
|
|
18
|
+
srcPath: "/wix-assistant-widget",
|
|
19
|
+
destPath: ""
|
|
20
|
+
}
|
|
21
|
+
],
|
|
22
|
+
_: [
|
|
23
|
+
{
|
|
24
|
+
srcPath: "/wix-assistant-widget",
|
|
25
|
+
destPath: ""
|
|
26
|
+
}
|
|
27
|
+
],
|
|
28
|
+
"editor._base_domain_": [
|
|
29
|
+
{
|
|
30
|
+
srcPath: "/wix-assistant-widget",
|
|
31
|
+
destPath: ""
|
|
32
|
+
}
|
|
33
|
+
],
|
|
34
|
+
"blocks._base_domain_": [
|
|
35
|
+
{
|
|
36
|
+
srcPath: "/wix-assistant-widget",
|
|
37
|
+
destPath: ""
|
|
38
|
+
}
|
|
39
|
+
],
|
|
40
|
+
"create.editorx": [
|
|
41
|
+
{
|
|
42
|
+
srcPath: "/wix-assistant-widget",
|
|
43
|
+
destPath: ""
|
|
44
|
+
}
|
|
45
|
+
],
|
|
46
|
+
"*.dev.wix-code.com": [
|
|
47
|
+
{
|
|
48
|
+
srcPath: "/wix-assistant-widget",
|
|
49
|
+
destPath: ""
|
|
50
|
+
}
|
|
51
|
+
],
|
|
52
|
+
"editor.wixapps.net": [
|
|
53
|
+
{
|
|
54
|
+
srcPath: "/wix-assistant-widget",
|
|
55
|
+
destPath: ""
|
|
56
|
+
}
|
|
57
|
+
],
|
|
58
|
+
"www.wixapis.com": [
|
|
59
|
+
{
|
|
60
|
+
srcPath: "/wix-assistant-widget",
|
|
61
|
+
destPath: ""
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
srcPath: "/innovation/widget",
|
|
65
|
+
destPath: ""
|
|
66
|
+
}
|
|
67
|
+
],
|
|
68
|
+
"www._base_domain_": [
|
|
69
|
+
{
|
|
70
|
+
srcPath: "/_api/wix-assistant-widget",
|
|
71
|
+
destPath: ""
|
|
72
|
+
}
|
|
73
|
+
]
|
|
74
|
+
};
|
|
75
|
+
return resolveUrl(Object.assign(opts, { domainToMappings }));
|
|
76
|
+
}
|
|
77
|
+
var PACKAGE_NAME = "@wix/auto_sdk_ai-site-chat_widget-settings";
|
|
78
|
+
function getWidgetSettings(payload) {
|
|
79
|
+
function __getWidgetSettings({ host }) {
|
|
80
|
+
const metadata = {
|
|
81
|
+
entityFqdn: "wix.innovation.widget.v1.widget_settings",
|
|
82
|
+
method: "GET",
|
|
83
|
+
methodFqn: "wix.innovation.assistant.widget.v1.Settings.GetWidgetSettings",
|
|
84
|
+
packageName: PACKAGE_NAME,
|
|
85
|
+
migrationOptions: {
|
|
86
|
+
optInTransformResponse: true
|
|
87
|
+
},
|
|
88
|
+
url: resolveWixInnovationAssistantWidgetV1SettingsUrl({
|
|
89
|
+
protoPath: "/v1/settings",
|
|
90
|
+
data: payload,
|
|
91
|
+
host
|
|
92
|
+
}),
|
|
93
|
+
params: toURLSearchParams(payload),
|
|
94
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
95
|
+
{
|
|
96
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
97
|
+
paths: [
|
|
98
|
+
{ path: "widgetSettings.createdDate" },
|
|
99
|
+
{ path: "widgetSettings.updatedDate" }
|
|
100
|
+
]
|
|
101
|
+
}
|
|
102
|
+
])
|
|
103
|
+
};
|
|
104
|
+
return metadata;
|
|
105
|
+
}
|
|
106
|
+
return __getWidgetSettings;
|
|
107
|
+
}
|
|
108
|
+
function setWidgetSettings(payload) {
|
|
109
|
+
function __setWidgetSettings({ host }) {
|
|
110
|
+
const serializedData = transformPaths(payload, [
|
|
111
|
+
{
|
|
112
|
+
transformFn: transformSDKTimestampToRESTTimestamp,
|
|
113
|
+
paths: [
|
|
114
|
+
{ path: "widgetSettings.createdDate" },
|
|
115
|
+
{ path: "widgetSettings.updatedDate" }
|
|
116
|
+
]
|
|
117
|
+
}
|
|
118
|
+
]);
|
|
119
|
+
const metadata = {
|
|
120
|
+
entityFqdn: "wix.innovation.widget.v1.widget_settings",
|
|
121
|
+
method: "POST",
|
|
122
|
+
methodFqn: "wix.innovation.assistant.widget.v1.Settings.SetWidgetSettings",
|
|
123
|
+
packageName: PACKAGE_NAME,
|
|
124
|
+
migrationOptions: {
|
|
125
|
+
optInTransformResponse: true
|
|
126
|
+
},
|
|
127
|
+
url: resolveWixInnovationAssistantWidgetV1SettingsUrl({
|
|
128
|
+
protoPath: "/v1/settings",
|
|
129
|
+
data: serializedData,
|
|
130
|
+
host
|
|
131
|
+
}),
|
|
132
|
+
data: serializedData,
|
|
133
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
134
|
+
{
|
|
135
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
136
|
+
paths: [
|
|
137
|
+
{ path: "widgetSettings.createdDate" },
|
|
138
|
+
{ path: "widgetSettings.updatedDate" }
|
|
139
|
+
]
|
|
140
|
+
}
|
|
141
|
+
])
|
|
142
|
+
};
|
|
143
|
+
return metadata;
|
|
144
|
+
}
|
|
145
|
+
return __setWidgetSettings;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
// src/innovation-widget-v1-widget-settings-widget-settings.universal.ts
|
|
149
|
+
var OfflineBehavior = /* @__PURE__ */ ((OfflineBehavior2) => {
|
|
150
|
+
OfflineBehavior2["UNKNOWN_OFFLINE_BEHAVIOR"] = "UNKNOWN_OFFLINE_BEHAVIOR";
|
|
151
|
+
OfflineBehavior2["CHAT_ONLY"] = "CHAT_ONLY";
|
|
152
|
+
OfflineBehavior2["HIDE"] = "HIDE";
|
|
153
|
+
OfflineBehavior2["CONTACT_FORM_WITHOUT_CHAT"] = "CONTACT_FORM_WITHOUT_CHAT";
|
|
154
|
+
OfflineBehavior2["CONTACT_FORM_WITH_CHAT"] = "CONTACT_FORM_WITH_CHAT";
|
|
155
|
+
return OfflineBehavior2;
|
|
156
|
+
})(OfflineBehavior || {});
|
|
157
|
+
async function getWidgetSettings2() {
|
|
158
|
+
const { httpClient, sideEffects } = arguments[0];
|
|
159
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({});
|
|
160
|
+
const reqOpts = getWidgetSettings(payload);
|
|
161
|
+
sideEffects?.onSiteCall?.();
|
|
162
|
+
try {
|
|
163
|
+
const result = await httpClient.request(reqOpts);
|
|
164
|
+
sideEffects?.onSuccess?.(result);
|
|
165
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
166
|
+
} catch (err) {
|
|
167
|
+
const transformedError = sdkTransformError(
|
|
168
|
+
err,
|
|
169
|
+
{
|
|
170
|
+
spreadPathsToArguments: {},
|
|
171
|
+
explicitPathsToArguments: {},
|
|
172
|
+
singleArgumentUnchanged: false
|
|
173
|
+
},
|
|
174
|
+
[]
|
|
175
|
+
);
|
|
176
|
+
sideEffects?.onError?.(err);
|
|
177
|
+
throw transformedError;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
async function setWidgetSettings2(widgetSettings) {
|
|
181
|
+
const { httpClient, sideEffects } = arguments[1];
|
|
182
|
+
const payload = renameKeysFromSDKRequestToRESTRequest({
|
|
183
|
+
widgetSettings
|
|
184
|
+
});
|
|
185
|
+
const reqOpts = setWidgetSettings(payload);
|
|
186
|
+
sideEffects?.onSiteCall?.();
|
|
187
|
+
try {
|
|
188
|
+
const result = await httpClient.request(reqOpts);
|
|
189
|
+
sideEffects?.onSuccess?.(result);
|
|
190
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data);
|
|
191
|
+
} catch (err) {
|
|
192
|
+
const transformedError = sdkTransformError(
|
|
193
|
+
err,
|
|
194
|
+
{
|
|
195
|
+
spreadPathsToArguments: {},
|
|
196
|
+
explicitPathsToArguments: { widgetSettings: "$[0]" },
|
|
197
|
+
singleArgumentUnchanged: false
|
|
198
|
+
},
|
|
199
|
+
["widgetSettings"]
|
|
200
|
+
);
|
|
201
|
+
sideEffects?.onError?.(err);
|
|
202
|
+
throw transformedError;
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
export {
|
|
206
|
+
OfflineBehavior,
|
|
207
|
+
getWidgetSettings2 as getWidgetSettings,
|
|
208
|
+
setWidgetSettings2 as setWidgetSettings
|
|
209
|
+
};
|
|
210
|
+
//# sourceMappingURL=index.typings.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/innovation-widget-v1-widget-settings-widget-settings.universal.ts","../../src/innovation-widget-v1-widget-settings-widget-settings.http.ts"],"sourcesContent":["import { transformError as sdkTransformError } from '@wix/sdk-runtime/transform-error';\nimport {\n renameKeysFromSDKRequestToRESTRequest,\n renameKeysFromRESTResponseToSDKResponse,\n} from '@wix/sdk-runtime/rename-all-nested-keys';\nimport { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport * as ambassadorWixInnovationWidgetV1WidgetSettings from './innovation-widget-v1-widget-settings-widget-settings.http.js';\n\nexport interface WidgetSettings {\n /**\n * Widget settings ID.\n * @format GUID\n * @readonly\n */\n _id?: string | null;\n /** Whether the AI Site-Chat is enabled on the site. */\n enabled?: boolean;\n /** AI Site-Chat introduction. This is shown in the chat when a site visitor starts a new conversation. */\n introMessage?: IntroMessage;\n /** Settings for the contact form. */\n contactForm?: ContactForm;\n /**\n * Date and time the widget settings were created.\n * @readonly\n */\n _createdDate?: Date | null;\n /**\n * Date and time the widget settings were updated.\n * @readonly\n */\n _updatedDate?: Date | null;\n /** Whether to open the AI Site-Chat automatically when the site loads. */\n autoOpen?: boolean;\n /** Times the AI assistant is available on the site. */\n activeHours?: ActiveHours;\n /** Defines how the AI Site-Chat functions during the non-active hours. */\n offlineBehavior?: OfflineBehaviorWithLiterals;\n /** Whether the AI Site-Chat should send a summary of the site visitor's navigation on the site. */\n navigationSummary?: boolean | null;\n /**\n * Wix Media image ID used for the AI assistant.\n * @maxLength 500\n */\n avatar?: string | null;\n /** Whether to display example questions from the AI assistant. */\n generatedQuestions?: boolean | null;\n}\n\n/** Intro message */\nexport interface IntroMessage {\n /** Main message settings. */\n message?: SettingsMessage;\n /** Legal disclaimer message settings. */\n legalDisclaimer?: SettingsMessage;\n /** Offline message settings. */\n offlineDisclaimer?: SettingsMessage;\n /** Message shown as popup to engage the site visitor with the AI assistant. */\n engage?: SettingsMessage;\n /** Suggested questions shown to the site visitor to help them get started. */\n suggestions?: SuggestedQuestions;\n}\n\nexport interface SettingsMessage {\n /** Whether the message is enabled. */\n enabled?: boolean;\n /**\n * Message content.\n * @maxLength 1000\n */\n text?: string;\n}\n\nexport interface SuggestedQuestions {\n /** Whether suggesting questions is enabled. */\n enabled?: boolean;\n /**\n * Suggested questions shown to the site visitor to help them get started.\n * @minSize 1\n * @maxSize 5\n */\n questions?: SettingsMessage[];\n /** Introduction message for the suggested questions. */\n introduction?: SettingsMessage;\n}\n\nexport interface ContactForm {\n /** When the AI Site-Chat should send the contact form. */\n conditions?: Conditions;\n /** Contact form fields. */\n fields?: Fields;\n}\n\n/** Contact form conditions */\nexport interface Conditions {\n /** Whether the AI Site-Chat should send the contact form if the AI is unable to answer the site visitor's question. */\n cannotAnswer?: boolean;\n /** Whether the AI Site-Chat should send the contact form if the site visitor requests to chat with a real person. */\n requestForPerson?: boolean;\n /** Require site visitor to fill contact form before starting a conversation. */\n beforeChat?: boolean | null;\n}\n\n/** Contact form fields */\nexport interface Fields {\n /** Whether to include a name field in the form. */\n name?: boolean;\n /** Whether to include an email field in the form. */\n email?: boolean;\n /** Whether to include a phone number field in the form. */\n phone?: boolean;\n /** Whether to include a message field in the form. */\n message?: boolean;\n}\n\n/** Working hours settings */\nexport interface ActiveHours {\n /** Whether the AI Assistant is always online. If `true`, `schedule` and `timeZone` are ignored. */\n always?: boolean;\n /** Times at which the AI Assistant is online. */\n schedule?: Schedule;\n /**\n * Timezone used for the schedule.\n * @maxLength 256\n */\n timeZone?: string;\n}\n\n/** Schedule */\nexport interface Schedule {\n /** Monday schedule. */\n monday?: DaySchedule;\n /** Tuesday schedule. */\n tuesday?: DaySchedule;\n /** Wednesday schedule. */\n wednesday?: DaySchedule;\n /** Thursday schedule. */\n thursday?: DaySchedule;\n /** Friday schedule. */\n friday?: DaySchedule;\n /** Saturday schedule. */\n saturday?: DaySchedule;\n /** Sunday schedule. */\n sunday?: DaySchedule;\n}\n\n/** Day schedule */\nexport interface DaySchedule {\n /** Whether the day is enabled. */\n enabled?: boolean;\n /**\n * Array of times during which the AI Assistant is active.\n * @maxSize 24\n */\n frames?: WorkingHoursFrame[];\n}\n\n/** Working hours frame */\nexport interface WorkingHoursFrame {\n /** Start time of the active hours. */\n start?: number;\n /** End time of the active hours. */\n end?: number;\n}\n\nexport enum OfflineBehavior {\n /** Unknown offline behavior. */\n UNKNOWN_OFFLINE_BEHAVIOR = 'UNKNOWN_OFFLINE_BEHAVIOR',\n /** Allows the site visitor to write messages, but doesn't send a contact form. */\n CHAT_ONLY = 'CHAT_ONLY',\n /** Hides the AI Site-Chat from the site. */\n HIDE = 'HIDE',\n /** Doesn't allow the site visitor to write messages, but does send a contact form. */\n CONTACT_FORM_WITHOUT_CHAT = 'CONTACT_FORM_WITHOUT_CHAT',\n /** Allows the site visitor to write messages and sends a contact form. */\n CONTACT_FORM_WITH_CHAT = 'CONTACT_FORM_WITH_CHAT',\n}\n\n/** @enumType */\nexport type OfflineBehaviorWithLiterals =\n | OfflineBehavior\n | 'UNKNOWN_OFFLINE_BEHAVIOR'\n | 'CHAT_ONLY'\n | 'HIDE'\n | 'CONTACT_FORM_WITHOUT_CHAT'\n | 'CONTACT_FORM_WITH_CHAT';\n\nexport interface GetWidgetSettingsRequest {}\n\nexport interface GetWidgetSettingsResponse {\n /** Retrieved widget settings. */\n widgetSettings?: WidgetSettings;\n /**\n * Whether the assistant is currently online.\n * @readonly\n */\n assistantOnline?: boolean;\n}\n\nexport interface SetWidgetSettingsRequest {\n /** Widget settings to update. */\n widgetSettings: WidgetSettings;\n}\n\nexport interface SetWidgetSettingsResponse {\n /** Updated widget settings. */\n widgetSettings?: WidgetSettings;\n}\n\n/**\n * Retrieves the widget settings for the site.\n * @public\n * @permissionId INNOVATION_LAB.CHAT_WIDGET_SETTINGS_READ\n * @applicableIdentity APP\n * @fqn wix.innovation.assistant.widget.v1.Settings.GetWidgetSettings\n */\nexport async function getWidgetSettings(): Promise<\n NonNullablePaths<\n GetWidgetSettingsResponse,\n | `widgetSettings.enabled`\n | `widgetSettings.introMessage.message.enabled`\n | `widgetSettings.introMessage.message.text`\n | `widgetSettings.introMessage.suggestions.enabled`\n | `widgetSettings.introMessage.suggestions.questions`\n | `widgetSettings.contactForm.conditions.cannotAnswer`\n | `widgetSettings.contactForm.conditions.requestForPerson`\n | `widgetSettings.contactForm.fields.name`\n | `widgetSettings.contactForm.fields.email`\n | `widgetSettings.contactForm.fields.phone`\n | `widgetSettings.contactForm.fields.message`\n | `widgetSettings.autoOpen`\n | `widgetSettings.activeHours.always`\n | `widgetSettings.activeHours.schedule.monday.enabled`\n | `widgetSettings.activeHours.schedule.monday.frames`\n | `widgetSettings.activeHours.schedule.monday.frames.${number}.start`\n | `widgetSettings.activeHours.schedule.monday.frames.${number}.end`\n | `widgetSettings.activeHours.timeZone`\n | `widgetSettings.offlineBehavior`\n | `assistantOnline`,\n 8\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[0] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({});\n\n const reqOpts =\n ambassadorWixInnovationWidgetV1WidgetSettings.getWidgetSettings(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: {},\n singleArgumentUnchanged: false,\n },\n []\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n\n/**\n * Sets the widget settings for the site.\n * @param widgetSettings - Widget settings to update.\n * @public\n * @requiredField widgetSettings\n * @requiredField widgetSettings.activeHours\n * @requiredField widgetSettings.contactForm\n * @requiredField widgetSettings.contactForm.conditions\n * @requiredField widgetSettings.contactForm.fields\n * @requiredField widgetSettings.introMessage\n * @permissionId INNOVATION_LAB.CHAT_WIDGET_SETTINGS_WRITE\n * @applicableIdentity APP\n * @fqn wix.innovation.assistant.widget.v1.Settings.SetWidgetSettings\n */\nexport async function setWidgetSettings(\n widgetSettings: NonNullablePaths<\n WidgetSettings,\n | `activeHours`\n | `contactForm`\n | `contactForm.conditions`\n | `contactForm.fields`\n | `introMessage`,\n 3\n >\n): Promise<\n NonNullablePaths<\n SetWidgetSettingsResponse,\n | `widgetSettings.enabled`\n | `widgetSettings.introMessage.message.enabled`\n | `widgetSettings.introMessage.message.text`\n | `widgetSettings.introMessage.suggestions.enabled`\n | `widgetSettings.introMessage.suggestions.questions`\n | `widgetSettings.contactForm.conditions.cannotAnswer`\n | `widgetSettings.contactForm.conditions.requestForPerson`\n | `widgetSettings.contactForm.fields.name`\n | `widgetSettings.contactForm.fields.email`\n | `widgetSettings.contactForm.fields.phone`\n | `widgetSettings.contactForm.fields.message`\n | `widgetSettings.autoOpen`\n | `widgetSettings.activeHours.always`\n | `widgetSettings.activeHours.schedule.monday.enabled`\n | `widgetSettings.activeHours.schedule.monday.frames`\n | `widgetSettings.activeHours.schedule.monday.frames.${number}.start`\n | `widgetSettings.activeHours.schedule.monday.frames.${number}.end`\n | `widgetSettings.activeHours.timeZone`\n | `widgetSettings.offlineBehavior`,\n 8\n >\n> {\n // @ts-ignore\n const { httpClient, sideEffects } = arguments[1] as {\n httpClient: HttpClient;\n sideEffects?: any;\n };\n\n const payload = renameKeysFromSDKRequestToRESTRequest({\n widgetSettings: widgetSettings,\n });\n\n const reqOpts =\n ambassadorWixInnovationWidgetV1WidgetSettings.setWidgetSettings(payload);\n\n sideEffects?.onSiteCall?.();\n try {\n const result = await httpClient.request(reqOpts);\n sideEffects?.onSuccess?.(result);\n\n return renameKeysFromRESTResponseToSDKResponse(result.data)!;\n } catch (err: any) {\n const transformedError = sdkTransformError(\n err,\n {\n spreadPathsToArguments: {},\n explicitPathsToArguments: { widgetSettings: '$[0]' },\n singleArgumentUnchanged: false,\n },\n ['widgetSettings']\n );\n sideEffects?.onError?.(err);\n\n throw transformedError;\n }\n}\n","import { toURLSearchParams } from '@wix/sdk-runtime/rest-modules';\nimport { transformSDKTimestampToRESTTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformRESTTimestampToSDKTimestamp } from '@wix/sdk-runtime/transformations/timestamp';\nimport { transformPaths } from '@wix/sdk-runtime/transformations/transform-paths';\nimport { resolveUrl } from '@wix/sdk-runtime/rest-modules';\nimport { ResolveUrlOpts } from '@wix/sdk-runtime/rest-modules';\nimport { RequestOptionsFactory } from '@wix/sdk-types';\n\nfunction resolveWixInnovationAssistantWidgetV1SettingsUrl(\n opts: Omit<ResolveUrlOpts, 'domainToMappings'>\n) {\n const domainToMappings = {\n 'manage._base_domain_': [\n {\n srcPath: '/wix-assistant-widget',\n destPath: '',\n },\n ],\n _: [\n {\n srcPath: '/wix-assistant-widget',\n destPath: '',\n },\n ],\n 'editor._base_domain_': [\n {\n srcPath: '/wix-assistant-widget',\n destPath: '',\n },\n ],\n 'blocks._base_domain_': [\n {\n srcPath: '/wix-assistant-widget',\n destPath: '',\n },\n ],\n 'create.editorx': [\n {\n srcPath: '/wix-assistant-widget',\n destPath: '',\n },\n ],\n '*.dev.wix-code.com': [\n {\n srcPath: '/wix-assistant-widget',\n destPath: '',\n },\n ],\n 'editor.wixapps.net': [\n {\n srcPath: '/wix-assistant-widget',\n destPath: '',\n },\n ],\n 'www.wixapis.com': [\n {\n srcPath: '/wix-assistant-widget',\n destPath: '',\n },\n {\n srcPath: '/innovation/widget',\n destPath: '',\n },\n ],\n 'www._base_domain_': [\n {\n srcPath: '/_api/wix-assistant-widget',\n destPath: '',\n },\n ],\n };\n\n return resolveUrl(Object.assign(opts, { domainToMappings }));\n}\n\nconst PACKAGE_NAME = '@wix/auto_sdk_ai-site-chat_widget-settings';\n\n/** Retrieves the widget settings for the site. */\nexport function getWidgetSettings(payload: object): RequestOptionsFactory<any> {\n function __getWidgetSettings({ host }: any) {\n const metadata = {\n entityFqdn: 'wix.innovation.widget.v1.widget_settings',\n method: 'GET' as any,\n methodFqn:\n 'wix.innovation.assistant.widget.v1.Settings.GetWidgetSettings',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixInnovationAssistantWidgetV1SettingsUrl({\n protoPath: '/v1/settings',\n data: payload,\n host,\n }),\n params: toURLSearchParams(payload),\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'widgetSettings.createdDate' },\n { path: 'widgetSettings.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __getWidgetSettings;\n}\n\n/** Sets the widget settings for the site. */\nexport function setWidgetSettings(payload: object): RequestOptionsFactory<any> {\n function __setWidgetSettings({ host }: any) {\n const serializedData = transformPaths(payload, [\n {\n transformFn: transformSDKTimestampToRESTTimestamp,\n paths: [\n { path: 'widgetSettings.createdDate' },\n { path: 'widgetSettings.updatedDate' },\n ],\n },\n ]);\n const metadata = {\n entityFqdn: 'wix.innovation.widget.v1.widget_settings',\n method: 'POST' as any,\n methodFqn:\n 'wix.innovation.assistant.widget.v1.Settings.SetWidgetSettings',\n packageName: PACKAGE_NAME,\n migrationOptions: {\n optInTransformResponse: true,\n },\n url: resolveWixInnovationAssistantWidgetV1SettingsUrl({\n protoPath: '/v1/settings',\n data: serializedData,\n host,\n }),\n data: serializedData,\n transformResponse: (payload: any) =>\n transformPaths(payload, [\n {\n transformFn: transformRESTTimestampToSDKTimestamp,\n paths: [\n { path: 'widgetSettings.createdDate' },\n { path: 'widgetSettings.updatedDate' },\n ],\n },\n ]),\n };\n\n return metadata;\n }\n\n return __setWidgetSettings;\n}\n"],"mappings":"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","names":["payload","OfflineBehavior","getWidgetSettings","setWidgetSettings"]}
|