@wix/auto_sdk_ai-site-chat_widget-settings 1.0.2 → 1.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (123) hide show
  1. package/build/cjs/index.d.ts +24 -1
  2. package/build/cjs/index.js +253 -15
  3. package/build/cjs/index.js.map +1 -1
  4. package/build/cjs/index.typings.d.ts +206 -1
  5. package/build/cjs/index.typings.js +233 -15
  6. package/build/cjs/index.typings.js.map +1 -1
  7. package/build/cjs/meta.d.ts +196 -1
  8. package/build/cjs/meta.js +219 -15
  9. package/build/cjs/meta.js.map +1 -1
  10. package/build/es/index.d.mts +24 -0
  11. package/build/es/index.mjs +230 -0
  12. package/build/es/index.mjs.map +1 -0
  13. package/build/{internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.universal.d.ts → es/index.typings.d.mts} +56 -110
  14. package/build/es/index.typings.mjs +210 -0
  15. package/build/es/index.typings.mjs.map +1 -0
  16. package/build/es/{src/innovation-widget-v1-widget-settings-widget-settings.types.d.ts → meta.d.mts} +64 -91
  17. package/build/es/meta.mjs +193 -0
  18. package/build/es/meta.mjs.map +1 -0
  19. package/build/internal/cjs/index.d.ts +24 -1
  20. package/build/internal/cjs/index.js +253 -15
  21. package/build/internal/cjs/index.js.map +1 -1
  22. package/build/internal/cjs/index.typings.d.ts +206 -1
  23. package/build/internal/cjs/index.typings.js +233 -15
  24. package/build/internal/cjs/index.typings.js.map +1 -1
  25. package/build/internal/cjs/meta.d.ts +196 -1
  26. package/build/internal/cjs/meta.js +219 -15
  27. package/build/internal/cjs/meta.js.map +1 -1
  28. package/build/internal/es/index.d.mts +24 -0
  29. package/build/internal/es/index.mjs +230 -0
  30. package/build/internal/es/index.mjs.map +1 -0
  31. package/build/internal/es/{src/innovation-widget-v1-widget-settings-widget-settings.universal.d.ts → index.typings.d.mts} +56 -110
  32. package/build/internal/es/index.typings.mjs +210 -0
  33. package/build/internal/es/index.typings.mjs.map +1 -0
  34. package/build/{cjs/src/innovation-widget-v1-widget-settings-widget-settings.types.d.ts → internal/es/meta.d.mts} +64 -91
  35. package/build/internal/es/meta.mjs +193 -0
  36. package/build/internal/es/meta.mjs.map +1 -0
  37. package/package.json +12 -10
  38. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.context.d.ts +0 -6
  39. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.context.js +0 -10
  40. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.context.js.map +0 -1
  41. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.http.d.ts +0 -5
  42. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.http.js +0 -136
  43. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.http.js.map +0 -1
  44. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.meta.d.ts +0 -14
  45. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.meta.js +0 -66
  46. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.meta.js.map +0 -1
  47. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.public.d.ts +0 -21
  48. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.public.js +0 -20
  49. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.public.js.map +0 -1
  50. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.types.js +0 -17
  51. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.types.js.map +0 -1
  52. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.universal.d.ts +0 -260
  53. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.universal.js +0 -124
  54. package/build/cjs/src/innovation-widget-v1-widget-settings-widget-settings.universal.js.map +0 -1
  55. package/build/es/index.d.ts +0 -1
  56. package/build/es/index.js +0 -2
  57. package/build/es/index.js.map +0 -1
  58. package/build/es/index.typings.d.ts +0 -1
  59. package/build/es/index.typings.js +0 -2
  60. package/build/es/index.typings.js.map +0 -1
  61. package/build/es/meta.d.ts +0 -1
  62. package/build/es/meta.js +0 -2
  63. package/build/es/meta.js.map +0 -1
  64. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.context.d.ts +0 -6
  65. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.context.js +0 -6
  66. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.context.js.map +0 -1
  67. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.http.d.ts +0 -5
  68. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.http.js +0 -131
  69. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.http.js.map +0 -1
  70. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.meta.d.ts +0 -14
  71. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.meta.js +0 -38
  72. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.meta.js.map +0 -1
  73. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.public.d.ts +0 -21
  74. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.public.js +0 -14
  75. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.public.js.map +0 -1
  76. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.types.js +0 -14
  77. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.types.js.map +0 -1
  78. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.universal.d.ts +0 -260
  79. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.universal.js +0 -96
  80. package/build/es/src/innovation-widget-v1-widget-settings-widget-settings.universal.js.map +0 -1
  81. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.context.d.ts +0 -6
  82. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.context.js +0 -10
  83. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.context.js.map +0 -1
  84. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.http.d.ts +0 -5
  85. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.http.js +0 -136
  86. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.http.js.map +0 -1
  87. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.meta.d.ts +0 -14
  88. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.meta.js +0 -66
  89. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.meta.js.map +0 -1
  90. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.public.d.ts +0 -21
  91. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.public.js +0 -20
  92. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.public.js.map +0 -1
  93. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.types.d.ts +0 -223
  94. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.types.js +0 -17
  95. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.types.js.map +0 -1
  96. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.universal.js +0 -124
  97. package/build/internal/cjs/src/innovation-widget-v1-widget-settings-widget-settings.universal.js.map +0 -1
  98. package/build/internal/es/index.d.ts +0 -1
  99. package/build/internal/es/index.js +0 -2
  100. package/build/internal/es/index.js.map +0 -1
  101. package/build/internal/es/index.typings.d.ts +0 -1
  102. package/build/internal/es/index.typings.js +0 -2
  103. package/build/internal/es/index.typings.js.map +0 -1
  104. package/build/internal/es/meta.d.ts +0 -1
  105. package/build/internal/es/meta.js +0 -2
  106. package/build/internal/es/meta.js.map +0 -1
  107. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.context.d.ts +0 -6
  108. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.context.js +0 -6
  109. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.context.js.map +0 -1
  110. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.http.d.ts +0 -5
  111. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.http.js +0 -131
  112. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.http.js.map +0 -1
  113. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.meta.d.ts +0 -14
  114. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.meta.js +0 -38
  115. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.meta.js.map +0 -1
  116. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.public.d.ts +0 -21
  117. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.public.js +0 -14
  118. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.public.js.map +0 -1
  119. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.types.d.ts +0 -223
  120. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.types.js +0 -14
  121. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.types.js.map +0 -1
  122. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.universal.js +0 -96
  123. package/build/internal/es/src/innovation-widget-v1-widget-settings-widget-settings.universal.js.map +0 -1
@@ -1 +1,24 @@
1
- export * from './src/innovation-widget-v1-widget-settings-widget-settings.context.js';
1
+ import { HttpClient, NonNullablePaths, MaybeContext, BuildRESTFunction } from '@wix/sdk-types';
2
+ import { GetWidgetSettingsResponse, WidgetSettings, SetWidgetSettingsResponse } from './index.typings.js';
3
+ export { ActiveHours, Conditions, ContactForm, DaySchedule, Fields, GetWidgetSettingsRequest, IntroMessage, OfflineBehavior, OfflineBehaviorWithLiterals, Schedule, SetWidgetSettingsRequest, SettingsMessage, SuggestedQuestions, WorkingHoursFrame } from './index.typings.js';
4
+
5
+ declare function getWidgetSettings$1(httpClient: HttpClient): GetWidgetSettingsSignature;
6
+ interface GetWidgetSettingsSignature {
7
+ /**
8
+ * Retrieves the widget settings for the site.
9
+ */
10
+ (): 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>>;
11
+ }
12
+ declare function setWidgetSettings$1(httpClient: HttpClient): SetWidgetSettingsSignature;
13
+ interface SetWidgetSettingsSignature {
14
+ /**
15
+ * Sets the widget settings for the site.
16
+ * @param - Widget settings to update.
17
+ */
18
+ (widgetSettings: NonNullablePaths<WidgetSettings, `activeHours` | `contactForm` | `contactForm.conditions` | `contactForm.fields` | `introMessage` | `offlineBehavior`, 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>>;
19
+ }
20
+
21
+ declare const getWidgetSettings: MaybeContext<BuildRESTFunction<typeof getWidgetSettings$1> & typeof getWidgetSettings$1>;
22
+ declare const setWidgetSettings: MaybeContext<BuildRESTFunction<typeof setWidgetSettings$1> & typeof setWidgetSettings$1>;
23
+
24
+ export { GetWidgetSettingsResponse, SetWidgetSettingsResponse, WidgetSettings, getWidgetSettings, setWidgetSettings };
@@ -1,18 +1,256 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
15
9
  };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./src/innovation-widget-v1-widget-settings-widget-settings.context.js"), exports);
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ OfflineBehavior: () => OfflineBehavior,
24
+ getWidgetSettings: () => getWidgetSettings4,
25
+ setWidgetSettings: () => setWidgetSettings4
26
+ });
27
+ module.exports = __toCommonJS(index_exports);
28
+
29
+ // src/innovation-widget-v1-widget-settings-widget-settings.universal.ts
30
+ var import_transform_error = require("@wix/sdk-runtime/transform-error");
31
+ var import_rename_all_nested_keys = require("@wix/sdk-runtime/rename-all-nested-keys");
32
+
33
+ // src/innovation-widget-v1-widget-settings-widget-settings.http.ts
34
+ var import_rest_modules = require("@wix/sdk-runtime/rest-modules");
35
+ var import_timestamp = require("@wix/sdk-runtime/transformations/timestamp");
36
+ var import_timestamp2 = require("@wix/sdk-runtime/transformations/timestamp");
37
+ var import_transform_paths = require("@wix/sdk-runtime/transformations/transform-paths");
38
+ var import_rest_modules2 = require("@wix/sdk-runtime/rest-modules");
39
+ function resolveWixInnovationAssistantWidgetV1SettingsUrl(opts) {
40
+ const domainToMappings = {
41
+ "manage._base_domain_": [
42
+ {
43
+ srcPath: "/wix-assistant-widget",
44
+ destPath: ""
45
+ }
46
+ ],
47
+ _: [
48
+ {
49
+ srcPath: "/wix-assistant-widget",
50
+ destPath: ""
51
+ }
52
+ ],
53
+ "editor._base_domain_": [
54
+ {
55
+ srcPath: "/wix-assistant-widget",
56
+ destPath: ""
57
+ }
58
+ ],
59
+ "blocks._base_domain_": [
60
+ {
61
+ srcPath: "/wix-assistant-widget",
62
+ destPath: ""
63
+ }
64
+ ],
65
+ "create.editorx": [
66
+ {
67
+ srcPath: "/wix-assistant-widget",
68
+ destPath: ""
69
+ }
70
+ ],
71
+ "*.dev.wix-code.com": [
72
+ {
73
+ srcPath: "/wix-assistant-widget",
74
+ destPath: ""
75
+ }
76
+ ],
77
+ "editor.wixapps.net": [
78
+ {
79
+ srcPath: "/wix-assistant-widget",
80
+ destPath: ""
81
+ }
82
+ ],
83
+ "www.wixapis.com": [
84
+ {
85
+ srcPath: "/wix-assistant-widget",
86
+ destPath: ""
87
+ },
88
+ {
89
+ srcPath: "/innovation/widget",
90
+ destPath: ""
91
+ }
92
+ ],
93
+ "www._base_domain_": [
94
+ {
95
+ srcPath: "/_api/wix-assistant-widget",
96
+ destPath: ""
97
+ }
98
+ ]
99
+ };
100
+ return (0, import_rest_modules2.resolveUrl)(Object.assign(opts, { domainToMappings }));
101
+ }
102
+ var PACKAGE_NAME = "@wix/auto_sdk_ai-site-chat_widget-settings";
103
+ function getWidgetSettings(payload) {
104
+ function __getWidgetSettings({ host }) {
105
+ const metadata = {
106
+ entityFqdn: "wix.innovation.widget.v1.widget_settings",
107
+ method: "GET",
108
+ methodFqn: "wix.innovation.assistant.widget.v1.Settings.GetWidgetSettings",
109
+ packageName: PACKAGE_NAME,
110
+ migrationOptions: {
111
+ optInTransformResponse: true
112
+ },
113
+ url: resolveWixInnovationAssistantWidgetV1SettingsUrl({
114
+ protoPath: "/v1/settings",
115
+ data: payload,
116
+ host
117
+ }),
118
+ params: (0, import_rest_modules.toURLSearchParams)(payload),
119
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
120
+ {
121
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
122
+ paths: [
123
+ { path: "widgetSettings.createdDate" },
124
+ { path: "widgetSettings.updatedDate" }
125
+ ]
126
+ }
127
+ ])
128
+ };
129
+ return metadata;
130
+ }
131
+ return __getWidgetSettings;
132
+ }
133
+ function setWidgetSettings(payload) {
134
+ function __setWidgetSettings({ host }) {
135
+ const serializedData = (0, import_transform_paths.transformPaths)(payload, [
136
+ {
137
+ transformFn: import_timestamp.transformSDKTimestampToRESTTimestamp,
138
+ paths: [
139
+ { path: "widgetSettings.createdDate" },
140
+ { path: "widgetSettings.updatedDate" }
141
+ ]
142
+ }
143
+ ]);
144
+ const metadata = {
145
+ entityFqdn: "wix.innovation.widget.v1.widget_settings",
146
+ method: "POST",
147
+ methodFqn: "wix.innovation.assistant.widget.v1.Settings.SetWidgetSettings",
148
+ packageName: PACKAGE_NAME,
149
+ migrationOptions: {
150
+ optInTransformResponse: true
151
+ },
152
+ url: resolveWixInnovationAssistantWidgetV1SettingsUrl({
153
+ protoPath: "/v1/settings",
154
+ data: serializedData,
155
+ host
156
+ }),
157
+ data: serializedData,
158
+ transformResponse: (payload2) => (0, import_transform_paths.transformPaths)(payload2, [
159
+ {
160
+ transformFn: import_timestamp2.transformRESTTimestampToSDKTimestamp,
161
+ paths: [
162
+ { path: "widgetSettings.createdDate" },
163
+ { path: "widgetSettings.updatedDate" }
164
+ ]
165
+ }
166
+ ])
167
+ };
168
+ return metadata;
169
+ }
170
+ return __setWidgetSettings;
171
+ }
172
+
173
+ // src/innovation-widget-v1-widget-settings-widget-settings.universal.ts
174
+ var OfflineBehavior = /* @__PURE__ */ ((OfflineBehavior2) => {
175
+ OfflineBehavior2["UNKNOWN_OFFLINE_BEHAVIOR"] = "UNKNOWN_OFFLINE_BEHAVIOR";
176
+ OfflineBehavior2["CHAT_ONLY"] = "CHAT_ONLY";
177
+ OfflineBehavior2["HIDE"] = "HIDE";
178
+ OfflineBehavior2["CONTACT_FORM_WITHOUT_CHAT"] = "CONTACT_FORM_WITHOUT_CHAT";
179
+ OfflineBehavior2["CONTACT_FORM_WITH_CHAT"] = "CONTACT_FORM_WITH_CHAT";
180
+ return OfflineBehavior2;
181
+ })(OfflineBehavior || {});
182
+ async function getWidgetSettings2() {
183
+ const { httpClient, sideEffects } = arguments[0];
184
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({});
185
+ const reqOpts = getWidgetSettings(payload);
186
+ sideEffects?.onSiteCall?.();
187
+ try {
188
+ const result = await httpClient.request(reqOpts);
189
+ sideEffects?.onSuccess?.(result);
190
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
191
+ } catch (err) {
192
+ const transformedError = (0, import_transform_error.transformError)(
193
+ err,
194
+ {
195
+ spreadPathsToArguments: {},
196
+ explicitPathsToArguments: {},
197
+ singleArgumentUnchanged: false
198
+ },
199
+ []
200
+ );
201
+ sideEffects?.onError?.(err);
202
+ throw transformedError;
203
+ }
204
+ }
205
+ async function setWidgetSettings2(widgetSettings) {
206
+ const { httpClient, sideEffects } = arguments[1];
207
+ const payload = (0, import_rename_all_nested_keys.renameKeysFromSDKRequestToRESTRequest)({
208
+ widgetSettings
209
+ });
210
+ const reqOpts = setWidgetSettings(payload);
211
+ sideEffects?.onSiteCall?.();
212
+ try {
213
+ const result = await httpClient.request(reqOpts);
214
+ sideEffects?.onSuccess?.(result);
215
+ return (0, import_rename_all_nested_keys.renameKeysFromRESTResponseToSDKResponse)(result.data);
216
+ } catch (err) {
217
+ const transformedError = (0, import_transform_error.transformError)(
218
+ err,
219
+ {
220
+ spreadPathsToArguments: {},
221
+ explicitPathsToArguments: { widgetSettings: "$[0]" },
222
+ singleArgumentUnchanged: false
223
+ },
224
+ ["widgetSettings"]
225
+ );
226
+ sideEffects?.onError?.(err);
227
+ throw transformedError;
228
+ }
229
+ }
230
+
231
+ // src/innovation-widget-v1-widget-settings-widget-settings.public.ts
232
+ function getWidgetSettings3(httpClient) {
233
+ return () => getWidgetSettings2(
234
+ // @ts-ignore
235
+ { httpClient }
236
+ );
237
+ }
238
+ function setWidgetSettings3(httpClient) {
239
+ return (widgetSettings) => setWidgetSettings2(
240
+ widgetSettings,
241
+ // @ts-ignore
242
+ { httpClient }
243
+ );
244
+ }
245
+
246
+ // src/innovation-widget-v1-widget-settings-widget-settings.context.ts
247
+ var import_rest_modules3 = require("@wix/sdk-runtime/rest-modules");
248
+ var getWidgetSettings4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(getWidgetSettings3);
249
+ var setWidgetSettings4 = /* @__PURE__ */ (0, import_rest_modules3.createRESTModule)(setWidgetSettings3);
250
+ // Annotate the CommonJS export names for ESM import in node:
251
+ 0 && (module.exports = {
252
+ OfflineBehavior,
253
+ getWidgetSettings,
254
+ setWidgetSettings
255
+ });
18
256
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,wGAAsF"}
1
+ {"version":3,"sources":["../../index.ts","../../src/innovation-widget-v1-widget-settings-widget-settings.universal.ts","../../src/innovation-widget-v1-widget-settings-widget-settings.http.ts","../../src/innovation-widget-v1-widget-settings-widget-settings.public.ts","../../src/innovation-widget-v1-widget-settings-widget-settings.context.ts"],"sourcesContent":["export * from './src/innovation-widget-v1-widget-settings-widget-settings.context.js';\n","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 * @requiredField widgetSettings.offlineBehavior\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 | `offlineBehavior`,\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","import { HttpClient, NonNullablePaths } from '@wix/sdk-types';\nimport {\n GetWidgetSettingsResponse,\n SetWidgetSettingsResponse,\n WidgetSettings,\n getWidgetSettings as universalGetWidgetSettings,\n setWidgetSettings as universalSetWidgetSettings,\n} from './innovation-widget-v1-widget-settings-widget-settings.universal.js';\n\nexport const __metadata = { PACKAGE_NAME: '@wix/ai-site-chat' };\n\nexport function getWidgetSettings(\n httpClient: HttpClient\n): GetWidgetSettingsSignature {\n return () =>\n universalGetWidgetSettings(\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface GetWidgetSettingsSignature {\n /**\n * Retrieves the widget settings for the site.\n */\n (): 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}\n\nexport function setWidgetSettings(\n httpClient: HttpClient\n): SetWidgetSettingsSignature {\n return (\n widgetSettings: NonNullablePaths<\n WidgetSettings,\n | `activeHours`\n | `contactForm`\n | `contactForm.conditions`\n | `contactForm.fields`\n | `introMessage`\n | `offlineBehavior`,\n 3\n >\n ) =>\n universalSetWidgetSettings(\n widgetSettings,\n // @ts-ignore\n { httpClient }\n );\n}\n\ninterface SetWidgetSettingsSignature {\n /**\n * Sets the widget settings for the site.\n * @param - Widget settings to update.\n */\n (\n widgetSettings: NonNullablePaths<\n WidgetSettings,\n | `activeHours`\n | `contactForm`\n | `contactForm.conditions`\n | `contactForm.fields`\n | `introMessage`\n | `offlineBehavior`,\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}\n\nexport {\n ActiveHours,\n Conditions,\n ContactForm,\n DaySchedule,\n Fields,\n GetWidgetSettingsRequest,\n GetWidgetSettingsResponse,\n IntroMessage,\n OfflineBehavior,\n Schedule,\n SetWidgetSettingsRequest,\n SetWidgetSettingsResponse,\n SettingsMessage,\n SuggestedQuestions,\n WidgetSettings,\n WorkingHoursFrame,\n} from './innovation-widget-v1-widget-settings-widget-settings.universal.js';\n","import {\n getWidgetSettings as publicGetWidgetSettings,\n setWidgetSettings as publicSetWidgetSettings,\n} from './innovation-widget-v1-widget-settings-widget-settings.public.js';\nimport { createRESTModule } from '@wix/sdk-runtime/rest-modules';\nimport { BuildRESTFunction, MaybeContext } from '@wix/sdk-types';\n\nexport const getWidgetSettings: MaybeContext<\n BuildRESTFunction<typeof publicGetWidgetSettings> &\n typeof publicGetWidgetSettings\n> = /*#__PURE__*/ createRESTModule(publicGetWidgetSettings);\nexport const setWidgetSettings: MaybeContext<\n BuildRESTFunction<typeof publicSetWidgetSettings> &\n typeof publicSetWidgetSettings\n> = /*#__PURE__*/ createRESTModule(publicSetWidgetSettings);\n\nexport { OfflineBehavior } from './innovation-widget-v1-widget-settings-widget-settings.universal.js';\nexport {\n WidgetSettings,\n IntroMessage,\n SettingsMessage,\n SuggestedQuestions,\n ContactForm,\n Conditions,\n Fields,\n ActiveHours,\n Schedule,\n DaySchedule,\n WorkingHoursFrame,\n GetWidgetSettingsRequest,\n GetWidgetSettingsResponse,\n SetWidgetSettingsRequest,\n SetWidgetSettingsResponse,\n} from './innovation-widget-v1-widget-settings-widget-settings.universal.js';\nexport { OfflineBehaviorWithLiterals } from './innovation-widget-v1-widget-settings-widget-settings.universal.js';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA,2BAAAA;AAAA,EAAA,yBAAAC;AAAA;AAAA;;;ACAA,6BAAoD;AACpD,oCAGO;;;ACJP,0BAAkC;AAClC,uBAAqD;AACrD,IAAAC,oBAAqD;AACrD,6BAA+B;AAC/B,IAAAC,uBAA2B;AAI3B,SAAS,iDACP,MACA;AACA,QAAM,mBAAmB;AAAA,IACvB,wBAAwB;AAAA,MACtB;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,GAAG;AAAA,MACD;AAAA,QACE,SAAS;AAAA,QACT,UAAU;AAAA,MACZ;AAAA,IACF;AAAA,IACA,wBAAwB;AAAA,MACtB;AAAA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_timestamp","import_rest_modules","payload","OfflineBehavior","getWidgetSettings","sdkTransformError","setWidgetSettings","getWidgetSettings","setWidgetSettings","import_rest_modules","getWidgetSettings","setWidgetSettings"]}
@@ -1 +1,206 @@
1
- export * from './src/innovation-widget-v1-widget-settings-widget-settings.universal.js';
1
+ import { NonNullablePaths } from '@wix/sdk-types';
2
+
3
+ interface WidgetSettings {
4
+ /**
5
+ * Widget settings ID.
6
+ * @format GUID
7
+ * @readonly
8
+ */
9
+ _id?: string | null;
10
+ /** Whether the AI Site-Chat is enabled on the site. */
11
+ enabled?: boolean;
12
+ /** AI Site-Chat introduction. This is shown in the chat when a site visitor starts a new conversation. */
13
+ introMessage?: IntroMessage;
14
+ /** Settings for the contact form. */
15
+ contactForm?: ContactForm;
16
+ /**
17
+ * Date and time the widget settings were created.
18
+ * @readonly
19
+ */
20
+ _createdDate?: Date | null;
21
+ /**
22
+ * Date and time the widget settings were updated.
23
+ * @readonly
24
+ */
25
+ _updatedDate?: Date | null;
26
+ /** Whether to open the AI Site-Chat automatically when the site loads. */
27
+ autoOpen?: boolean;
28
+ /** Times the AI assistant is available on the site. */
29
+ activeHours?: ActiveHours;
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;
41
+ }
42
+ /** Intro message */
43
+ interface IntroMessage {
44
+ /** Main message settings. */
45
+ message?: SettingsMessage;
46
+ /** Legal disclaimer message settings. */
47
+ legalDisclaimer?: SettingsMessage;
48
+ /** Offline message settings. */
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;
54
+ }
55
+ interface SettingsMessage {
56
+ /** Whether the message is enabled. */
57
+ enabled?: boolean;
58
+ /**
59
+ * Message content.
60
+ * @maxLength 1000
61
+ */
62
+ text?: string;
63
+ }
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 {
77
+ /** When the AI Site-Chat should send the contact form. */
78
+ conditions?: Conditions;
79
+ /** Contact form fields. */
80
+ fields?: Fields;
81
+ }
82
+ /** Contact form conditions */
83
+ interface Conditions {
84
+ /** Whether the AI Site-Chat should send the contact form if the AI is unable to answer the site visitor's question. */
85
+ cannotAnswer?: boolean;
86
+ /** Whether the AI Site-Chat should send the contact form if the site visitor requests to chat with a real person. */
87
+ requestForPerson?: boolean;
88
+ /** Require site visitor to fill contact form before starting a conversation. */
89
+ beforeChat?: boolean | null;
90
+ }
91
+ /** Contact form fields */
92
+ interface Fields {
93
+ /** Whether to include a name field in the form. */
94
+ name?: boolean;
95
+ /** Whether to include an email field in the form. */
96
+ email?: boolean;
97
+ /** Whether to include a phone number field in the form. */
98
+ phone?: boolean;
99
+ /** Whether to include a message field in the form. */
100
+ message?: boolean;
101
+ }
102
+ /** Working hours settings */
103
+ interface ActiveHours {
104
+ /** Whether the AI Assistant is always online. If `true`, `schedule` and `timeZone` are ignored. */
105
+ always?: boolean;
106
+ /** Times at which the AI Assistant is online. */
107
+ schedule?: Schedule;
108
+ /**
109
+ * Timezone used for the schedule.
110
+ * @maxLength 256
111
+ */
112
+ timeZone?: string;
113
+ }
114
+ /** Schedule */
115
+ interface Schedule {
116
+ /** Monday schedule. */
117
+ monday?: DaySchedule;
118
+ /** Tuesday schedule. */
119
+ tuesday?: DaySchedule;
120
+ /** Wednesday schedule. */
121
+ wednesday?: DaySchedule;
122
+ /** Thursday schedule. */
123
+ thursday?: DaySchedule;
124
+ /** Friday schedule. */
125
+ friday?: DaySchedule;
126
+ /** Saturday schedule. */
127
+ saturday?: DaySchedule;
128
+ /** Sunday schedule. */
129
+ sunday?: DaySchedule;
130
+ }
131
+ /** Day schedule */
132
+ interface DaySchedule {
133
+ /** Whether the day is enabled. */
134
+ enabled?: boolean;
135
+ /**
136
+ * Array of times during which the AI Assistant is active.
137
+ * @maxSize 24
138
+ */
139
+ frames?: WorkingHoursFrame[];
140
+ }
141
+ /** Working hours frame */
142
+ interface WorkingHoursFrame {
143
+ /** Start time of the active hours. */
144
+ start?: number;
145
+ /** End time of the active hours. */
146
+ end?: number;
147
+ }
148
+ declare enum OfflineBehavior {
149
+ /** Unknown offline behavior. */
150
+ UNKNOWN_OFFLINE_BEHAVIOR = "UNKNOWN_OFFLINE_BEHAVIOR",
151
+ /** Allows the site visitor to write messages, but doesn't send a contact form. */
152
+ CHAT_ONLY = "CHAT_ONLY",
153
+ /** Hides the AI Site-Chat from the site. */
154
+ HIDE = "HIDE",
155
+ /** Doesn't allow the site visitor to write messages, but does send a contact form. */
156
+ CONTACT_FORM_WITHOUT_CHAT = "CONTACT_FORM_WITHOUT_CHAT",
157
+ /** Allows the site visitor to write messages and sends a contact form. */
158
+ CONTACT_FORM_WITH_CHAT = "CONTACT_FORM_WITH_CHAT"
159
+ }
160
+ /** @enumType */
161
+ type OfflineBehaviorWithLiterals = OfflineBehavior | 'UNKNOWN_OFFLINE_BEHAVIOR' | 'CHAT_ONLY' | 'HIDE' | 'CONTACT_FORM_WITHOUT_CHAT' | 'CONTACT_FORM_WITH_CHAT';
162
+ interface GetWidgetSettingsRequest {
163
+ }
164
+ interface GetWidgetSettingsResponse {
165
+ /** Retrieved widget settings. */
166
+ widgetSettings?: WidgetSettings;
167
+ /**
168
+ * Whether the assistant is currently online.
169
+ * @readonly
170
+ */
171
+ assistantOnline?: boolean;
172
+ }
173
+ interface SetWidgetSettingsRequest {
174
+ /** Widget settings to update. */
175
+ widgetSettings: WidgetSettings;
176
+ }
177
+ interface SetWidgetSettingsResponse {
178
+ /** Updated widget settings. */
179
+ widgetSettings?: WidgetSettings;
180
+ }
181
+ /**
182
+ * Retrieves the widget settings for the site.
183
+ * @public
184
+ * @permissionId INNOVATION_LAB.CHAT_WIDGET_SETTINGS_READ
185
+ * @applicableIdentity APP
186
+ * @fqn wix.innovation.assistant.widget.v1.Settings.GetWidgetSettings
187
+ */
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>>;
189
+ /**
190
+ * Sets the widget settings for the site.
191
+ * @param widgetSettings - Widget settings to update.
192
+ * @public
193
+ * @requiredField widgetSettings
194
+ * @requiredField widgetSettings.activeHours
195
+ * @requiredField widgetSettings.contactForm
196
+ * @requiredField widgetSettings.contactForm.conditions
197
+ * @requiredField widgetSettings.contactForm.fields
198
+ * @requiredField widgetSettings.introMessage
199
+ * @requiredField widgetSettings.offlineBehavior
200
+ * @permissionId INNOVATION_LAB.CHAT_WIDGET_SETTINGS_WRITE
201
+ * @applicableIdentity APP
202
+ * @fqn wix.innovation.assistant.widget.v1.Settings.SetWidgetSettings
203
+ */
204
+ declare function setWidgetSettings(widgetSettings: NonNullablePaths<WidgetSettings, `activeHours` | `contactForm` | `contactForm.conditions` | `contactForm.fields` | `introMessage` | `offlineBehavior`, 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>>;
205
+
206
+ 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 };