@wix/auto_sdk_apps-installer_apps-installer 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (39) hide show
  1. package/build/cjs/index.d.ts +110 -0
  2. package/build/cjs/index.js +589 -0
  3. package/build/cjs/index.js.map +1 -0
  4. package/build/cjs/index.typings.d.ts +837 -0
  5. package/build/cjs/index.typings.js +508 -0
  6. package/build/cjs/index.typings.js.map +1 -0
  7. package/build/cjs/meta.d.ts +226 -0
  8. package/build/cjs/meta.js +400 -0
  9. package/build/cjs/meta.js.map +1 -0
  10. package/build/es/index.d.mts +110 -0
  11. package/build/es/index.mjs +554 -0
  12. package/build/es/index.mjs.map +1 -0
  13. package/build/es/index.typings.d.mts +837 -0
  14. package/build/es/index.typings.mjs +474 -0
  15. package/build/es/index.typings.mjs.map +1 -0
  16. package/build/es/meta.d.mts +226 -0
  17. package/build/es/meta.mjs +368 -0
  18. package/build/es/meta.mjs.map +1 -0
  19. package/build/es/package.json +3 -0
  20. package/build/internal/cjs/index.d.ts +110 -0
  21. package/build/internal/cjs/index.js +589 -0
  22. package/build/internal/cjs/index.js.map +1 -0
  23. package/build/internal/cjs/index.typings.d.ts +837 -0
  24. package/build/internal/cjs/index.typings.js +508 -0
  25. package/build/internal/cjs/index.typings.js.map +1 -0
  26. package/build/internal/cjs/meta.d.ts +226 -0
  27. package/build/internal/cjs/meta.js +400 -0
  28. package/build/internal/cjs/meta.js.map +1 -0
  29. package/build/internal/es/index.d.mts +110 -0
  30. package/build/internal/es/index.mjs +554 -0
  31. package/build/internal/es/index.mjs.map +1 -0
  32. package/build/internal/es/index.typings.d.mts +837 -0
  33. package/build/internal/es/index.typings.mjs +474 -0
  34. package/build/internal/es/index.typings.mjs.map +1 -0
  35. package/build/internal/es/meta.d.mts +226 -0
  36. package/build/internal/es/meta.mjs +368 -0
  37. package/build/internal/es/meta.mjs.map +1 -0
  38. package/meta/package.json +3 -0
  39. package/package.json +53 -0
@@ -0,0 +1,110 @@
1
+ import { HttpClient, NonNullablePaths, EventDefinition, MaybeContext, BuildRESTFunction, BuildEventDefinition } from '@wix/sdk-types';
2
+ import { Tenant, InstallAppOptions, InstallAppResponse, InstallAppApplicationErrors, UninstallAppOptions, BulkUninstallAppOptions, BulkUninstallAppResponse, InstallAppFromShareUrlOptions, InstallAppFromShareUrlResponse, InstallAppFromShareUrlApplicationErrors, InstallTypeWithLiterals, IsPermittedToInstallAppsOptions, IsPermittedToInstallAppsResponse, IsPermittedToInstallAppsApplicationErrors, GetInstalledAppsResponse, AppInstanceAppInstalledOnTenantEnvelope } from './index.typings.mjs';
3
+ export { ActionEvent, AppInstalledOnTenant, AppInstance, ApplicationError, AppsInstallOptions, BaseEventMetadata, BulkActionMetadata, BulkInstallAppRequest, BulkInstallAppResponse, BulkInstallAppResult, BulkUninstallAppRequest, BulkUninstallAppResult, ClientSpec, ClientSpecMap, DevVersionInstallation, DomainEvent, DomainEventBodyOneOf, Empty, EntityCreatedEvent, EntityDeletedEvent, EntityUpdatedEvent, EventMetadata, GetInstalledAppsRequest, GluedOptions, GluedWidget, IdentificationData, IdentificationDataIdOneOf, InstallAppFromShareUrlRequest, InstallAppRequest, InstallDefaultAppsEvent, InstallType, IsPermittedToInstallAppsOptionsOptionsOneOf, IsPermittedToInstallAppsRequest, IsPermittedToInstallAppsRequestOptionsOneOf, ItemMetadata, LegacyParams, ListAppInstancesRequest, ListAppInstancesResponse, MessageEnvelope, RequestedFields, RestoreInfo, ShareUrlInstallOptions, Status, TPAAppPage, TPAAppRequirements, TPAPermissions, TPASettingsClientSpec, TPAWidgetPosition, TenantType, UninstallAppRequest, UninstallAppResponse, WebhookIdentityType, Widget } from './index.typings.mjs';
4
+
5
+ type AppInstanceNonNullablePaths = `_id` | `appDefId` | `enabled`;
6
+ declare function installApp$1(httpClient: HttpClient): InstallAppSignature;
7
+ interface InstallAppSignature {
8
+ /**
9
+ * <blockquote class="warning">
10
+ *
11
+ * __Warning:__
12
+ * By using this API to install 3rd-party apps, you acknowledge and agree that:
13
+ *
14
+ * - Some 3rd-party apps installed with this API may access, use, copy, change, or delete all your website's data, including your and your website visitors' and members' financial and personal information.
15
+ * - Wix may not have reviewed the app, and can't guarantee their operation or that it will continue to function as described by the app developers.
16
+ * - You may be sharing sensitive information with the app. Review the terms of use and privacy policies of any app you choose to install to understand how your data will be handled.
17
+ * - You agree to the Wix App Market [terms of use](https://www.wix.com/about/app-market-terms).
18
+ *
19
+ * By installing any 3rd-party app through this API, you confirm your acceptance of all the above conditions.
20
+ *
21
+ * </blockquote>
22
+ *
23
+ * Installs an app on a tenant, specifying the details of the app instance to create.
24
+ *
25
+ * The ID of this app instance is automatically generated and included in the `appInstance` object in the response.
26
+ * @param - Tenant details.
27
+ */
28
+ (tenant: NonNullablePaths<Tenant, `_id`>, options: NonNullablePaths<InstallAppOptions, `appInstance` | `appInstance.appDefId`>): Promise<NonNullablePaths<InstallAppResponse, {
29
+ [P in AppInstanceNonNullablePaths]: `appInstance.${P}`;
30
+ }[AppInstanceNonNullablePaths]> & {
31
+ __applicationErrorsType?: InstallAppApplicationErrors;
32
+ }>;
33
+ }
34
+ declare function uninstallApp$1(httpClient: HttpClient): UninstallAppSignature;
35
+ interface UninstallAppSignature {
36
+ /**
37
+ * Uninstalls an app from a tenant.
38
+ *
39
+ * This removes the instance of a specified app from the tenant.
40
+ */
41
+ (options?: NonNullablePaths<UninstallAppOptions, `appDefId`>): Promise<void>;
42
+ }
43
+ declare function bulkUninstallApp$1(httpClient: HttpClient): BulkUninstallAppSignature;
44
+ interface BulkUninstallAppSignature {
45
+ /**
46
+ * Uninstalls apps from a tenant.
47
+ *
48
+ * This removes the instances of the specified apps from the tenant.
49
+ */
50
+ (options?: NonNullablePaths<BulkUninstallAppOptions, `appDefIds`>): Promise<NonNullablePaths<BulkUninstallAppResponse, `results` | `results.${number}.itemMetadata.originalIndex` | `results.${number}.itemMetadata.success` | `results.${number}.itemMetadata.error.code` | `results.${number}.itemMetadata.error.description` | `results.${number}.appDefId` | {
51
+ [P in AppInstanceNonNullablePaths]: `results.${number}.appInstance.${P}`;
52
+ }[AppInstanceNonNullablePaths] | `bulkActionMetadata.totalSuccesses` | `bulkActionMetadata.totalFailures` | `bulkActionMetadata.undetailedFailures`>>;
53
+ }
54
+ declare function installAppFromShareUrl$1(httpClient: HttpClient): InstallAppFromShareUrlSignature;
55
+ interface InstallAppFromShareUrlSignature {
56
+ /**
57
+ * <blockquote class="warning">
58
+ *
59
+ * __Warning:__
60
+ * By using this API to install 3rd-party apps, you acknowledge and agree that:
61
+ *
62
+ * - Some 3rd-party apps installed with this API may access, use, copy, change, or delete all your website's data, including your and your website visitors' and members' financial and personal information.
63
+ * - Wix may not have reviewed the app, and cannot guarantee their operation or that it will continue to function as described by the app developers.
64
+ * - You may be sharing sensitive information with the app. Please review the terms of use and privacy policies of any app you choose to install to understand how your data will be handled.
65
+ * - By utilizing this API, you agree to the Wix App Market [terms of use](https://www.wix.com/about/app-market-terms).
66
+ *
67
+ * By installing any 3rd-party app through this API, I confirm my acceptance of all the above conditions.
68
+ *
69
+ * </blockquote>
70
+ *
71
+ * Installs an app on a site using a share URL.
72
+ * @param - Tenant details.
73
+ */
74
+ (tenant: NonNullablePaths<Tenant, `_id`>, options?: NonNullablePaths<InstallAppFromShareUrlOptions, `shareUrlId`>): Promise<NonNullablePaths<InstallAppFromShareUrlResponse, {
75
+ [P in AppInstanceNonNullablePaths]: `appInstance.${P}`;
76
+ }[AppInstanceNonNullablePaths]> & {
77
+ __applicationErrorsType?: InstallAppFromShareUrlApplicationErrors;
78
+ }>;
79
+ }
80
+ declare function isPermittedToInstallApps$1(httpClient: HttpClient): IsPermittedToInstallAppsSignature;
81
+ interface IsPermittedToInstallAppsSignature {
82
+ /**
83
+ * Returns whether it's possible to install an app on a tenant, either by providing app instance details or using a share URL.
84
+ * @param - Installation type.
85
+ */
86
+ (installType: InstallTypeWithLiterals, options: IsPermittedToInstallAppsOptions): Promise<NonNullablePaths<IsPermittedToInstallAppsResponse, `permitted`> & {
87
+ __applicationErrorsType?: IsPermittedToInstallAppsApplicationErrors;
88
+ }>;
89
+ }
90
+ declare function getInstalledApps$1(httpClient: HttpClient): GetInstalledAppsSignature;
91
+ interface GetInstalledAppsSignature {
92
+ /**
93
+ * Returns the apps that are installed on the site in context
94
+ */
95
+ (): Promise<NonNullablePaths<GetInstalledAppsResponse, {
96
+ [P in AppInstanceNonNullablePaths]: `appInstances.${number}.${P}`;
97
+ }[AppInstanceNonNullablePaths]>>;
98
+ }
99
+ declare const onAppInstanceAppInstalledOnTenant$1: EventDefinition<AppInstanceAppInstalledOnTenantEnvelope, "wix.apps.v1.app_instance_app_installed_on_tenant">;
100
+
101
+ declare const installApp: MaybeContext<BuildRESTFunction<typeof installApp$1> & typeof installApp$1>;
102
+ declare const uninstallApp: MaybeContext<BuildRESTFunction<typeof uninstallApp$1> & typeof uninstallApp$1>;
103
+ declare const bulkUninstallApp: MaybeContext<BuildRESTFunction<typeof bulkUninstallApp$1> & typeof bulkUninstallApp$1>;
104
+ declare const installAppFromShareUrl: MaybeContext<BuildRESTFunction<typeof installAppFromShareUrl$1> & typeof installAppFromShareUrl$1>;
105
+ declare const isPermittedToInstallApps: MaybeContext<BuildRESTFunction<typeof isPermittedToInstallApps$1> & typeof isPermittedToInstallApps$1>;
106
+ declare const getInstalledApps: MaybeContext<BuildRESTFunction<typeof getInstalledApps$1> & typeof getInstalledApps$1>;
107
+ /** */
108
+ declare const onAppInstanceAppInstalledOnTenant: BuildEventDefinition<typeof onAppInstanceAppInstalledOnTenant$1>;
109
+
110
+ export { AppInstanceAppInstalledOnTenantEnvelope, BulkUninstallAppOptions, BulkUninstallAppResponse, GetInstalledAppsResponse, InstallAppFromShareUrlOptions, InstallAppFromShareUrlResponse, InstallAppOptions, InstallAppResponse, IsPermittedToInstallAppsOptions, IsPermittedToInstallAppsResponse, Tenant, UninstallAppOptions, bulkUninstallApp, getInstalledApps, installApp, installAppFromShareUrl, isPermittedToInstallApps, onAppInstanceAppInstalledOnTenant, uninstallApp };
@@ -0,0 +1,554 @@
1
+ // src/apps-v1-app-instance-apps-installer.public.ts
2
+ import { renameKeysFromRESTResponseToSDKResponse as renameKeysFromRESTResponseToSDKResponse2 } from "@wix/sdk-runtime/rename-all-nested-keys";
3
+ import { transformRESTTimestampToSDKTimestamp as transformRESTTimestampToSDKTimestamp2 } from "@wix/sdk-runtime/transformations/timestamp";
4
+ import { transformPaths as transformPaths2 } from "@wix/sdk-runtime/transformations/transform-paths";
5
+ import { EventDefinition } from "@wix/sdk-types";
6
+
7
+ // src/apps-v1-app-instance-apps-installer.universal.ts
8
+ import { transformError as sdkTransformError } from "@wix/sdk-runtime/transform-error";
9
+ import {
10
+ renameKeysFromSDKRequestToRESTRequest,
11
+ renameKeysFromRESTResponseToSDKResponse
12
+ } from "@wix/sdk-runtime/rename-all-nested-keys";
13
+
14
+ // src/apps-v1-app-instance-apps-installer.http.ts
15
+ import { toURLSearchParams } from "@wix/sdk-runtime/rest-modules";
16
+ import { transformRESTFloatToSDKFloat } from "@wix/sdk-runtime/transformations/float";
17
+ import { transformSDKTimestampToRESTTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
18
+ import { transformRESTTimestampToSDKTimestamp } from "@wix/sdk-runtime/transformations/timestamp";
19
+ import { transformPaths } from "@wix/sdk-runtime/transformations/transform-paths";
20
+ import { resolveUrl } from "@wix/sdk-runtime/rest-modules";
21
+ function resolveWixDevcenterAppsInstallerV1AppsInstallerServiceUrl(opts) {
22
+ const domainToMappings = {
23
+ "manage._base_domain_": [
24
+ {
25
+ srcPath: "/apps-installer-service",
26
+ destPath: ""
27
+ }
28
+ ],
29
+ "editor._base_domain_": [
30
+ {
31
+ srcPath: "/apps-installer-service",
32
+ destPath: ""
33
+ }
34
+ ],
35
+ "blocks._base_domain_": [
36
+ {
37
+ srcPath: "/apps-installer-service",
38
+ destPath: ""
39
+ }
40
+ ],
41
+ "create.editorx": [
42
+ {
43
+ srcPath: "/apps-installer-service",
44
+ destPath: ""
45
+ }
46
+ ],
47
+ "dev._base_domain_": [
48
+ {
49
+ srcPath: "/apps-installer-service",
50
+ destPath: ""
51
+ }
52
+ ],
53
+ "www.wixapis.com": [
54
+ {
55
+ srcPath: "/apps-installer-service",
56
+ destPath: ""
57
+ }
58
+ ],
59
+ "*.dev.wix-code.com": [
60
+ {
61
+ srcPath: "/apps/v1/app-instances",
62
+ destPath: ""
63
+ }
64
+ ],
65
+ _: [
66
+ {
67
+ srcPath: "/apps/v1/app-instances",
68
+ destPath: ""
69
+ }
70
+ ]
71
+ };
72
+ return resolveUrl(Object.assign(opts, { domainToMappings }));
73
+ }
74
+ var PACKAGE_NAME = "@wix/auto_sdk_apps-installer_apps-installer";
75
+ function installApp(payload) {
76
+ function __installApp({ host }) {
77
+ const serializedData = transformPaths(payload, [
78
+ {
79
+ transformFn: transformSDKTimestampToRESTTimestamp,
80
+ paths: [
81
+ { path: "appInstance.installedDate" },
82
+ { path: "appInstance.updatedDate" }
83
+ ]
84
+ }
85
+ ]);
86
+ const metadata = {
87
+ entityFqdn: "wix.apps.v1.app_instance",
88
+ method: "POST",
89
+ methodFqn: "wix.devcenter.apps.installer.v1.AppsInstallerService.InstallApp",
90
+ packageName: PACKAGE_NAME,
91
+ url: resolveWixDevcenterAppsInstallerV1AppsInstallerServiceUrl({
92
+ protoPath: "/v1/app-instance/install",
93
+ data: serializedData,
94
+ host
95
+ }),
96
+ data: serializedData,
97
+ transformResponse: (payload2) => transformPaths(payload2, [
98
+ {
99
+ transformFn: transformRESTTimestampToSDKTimestamp,
100
+ paths: [
101
+ { path: "appInstance.installedDate" },
102
+ { path: "appInstance.updatedDate" },
103
+ { path: "dependenciesInstallation.installedDate" },
104
+ { path: "dependenciesInstallation.updatedDate" }
105
+ ]
106
+ }
107
+ ])
108
+ };
109
+ return metadata;
110
+ }
111
+ return __installApp;
112
+ }
113
+ function uninstallApp(payload) {
114
+ function __uninstallApp({ host }) {
115
+ const metadata = {
116
+ entityFqdn: "wix.apps.v1.app_instance",
117
+ method: "POST",
118
+ methodFqn: "wix.devcenter.apps.installer.v1.AppsInstallerService.UninstallApp",
119
+ packageName: PACKAGE_NAME,
120
+ url: resolveWixDevcenterAppsInstallerV1AppsInstallerServiceUrl({
121
+ protoPath: "/v1/app-instance/uninstall",
122
+ data: payload,
123
+ host
124
+ }),
125
+ data: payload
126
+ };
127
+ return metadata;
128
+ }
129
+ return __uninstallApp;
130
+ }
131
+ function bulkUninstallApp(payload) {
132
+ function __bulkUninstallApp({ host }) {
133
+ const metadata = {
134
+ entityFqdn: "wix.apps.v1.app_instance",
135
+ method: "POST",
136
+ methodFqn: "wix.devcenter.apps.installer.v1.AppsInstallerService.BulkUninstallApp",
137
+ packageName: PACKAGE_NAME,
138
+ url: resolveWixDevcenterAppsInstallerV1AppsInstallerServiceUrl({
139
+ protoPath: "/v1/bulk/app-instance/uninstall",
140
+ data: payload,
141
+ host
142
+ }),
143
+ data: payload,
144
+ transformResponse: (payload2) => transformPaths(payload2, [
145
+ {
146
+ transformFn: transformRESTTimestampToSDKTimestamp,
147
+ paths: [
148
+ { path: "results.appInstance.installedDate" },
149
+ { path: "results.appInstance.updatedDate" }
150
+ ]
151
+ },
152
+ {
153
+ transformFn: transformRESTFloatToSDKFloat,
154
+ paths: [
155
+ {
156
+ path: "clientSpecMap.data.widgets.*.gluedOptions.verticalMargin"
157
+ },
158
+ {
159
+ path: "clientSpecMap.data.widgets.*.gluedOptions.horizontalMargin"
160
+ }
161
+ ]
162
+ }
163
+ ])
164
+ };
165
+ return metadata;
166
+ }
167
+ return __bulkUninstallApp;
168
+ }
169
+ function installAppFromShareUrl(payload) {
170
+ function __installAppFromShareUrl({ host }) {
171
+ const metadata = {
172
+ entityFqdn: "wix.apps.v1.app_instance",
173
+ method: "POST",
174
+ methodFqn: "wix.devcenter.apps.installer.v1.AppsInstallerService.InstallAppFromShareUrl",
175
+ packageName: PACKAGE_NAME,
176
+ url: resolveWixDevcenterAppsInstallerV1AppsInstallerServiceUrl({
177
+ protoPath: "/v1/app-share-url/install",
178
+ data: payload,
179
+ host
180
+ }),
181
+ data: payload,
182
+ transformResponse: (payload2) => transformPaths(payload2, [
183
+ {
184
+ transformFn: transformRESTTimestampToSDKTimestamp,
185
+ paths: [
186
+ { path: "appInstance.installedDate" },
187
+ { path: "appInstance.updatedDate" },
188
+ { path: "dependenciesInstallation.installedDate" },
189
+ { path: "dependenciesInstallation.updatedDate" }
190
+ ]
191
+ }
192
+ ])
193
+ };
194
+ return metadata;
195
+ }
196
+ return __installAppFromShareUrl;
197
+ }
198
+ function isPermittedToInstallApps(payload) {
199
+ function __isPermittedToInstallApps({ host }) {
200
+ const serializedData = transformPaths(payload, [
201
+ {
202
+ transformFn: transformSDKTimestampToRESTTimestamp,
203
+ paths: [
204
+ { path: "appsInstallOptions.appInstances.installedDate" },
205
+ { path: "appsInstallOptions.appInstances.updatedDate" }
206
+ ]
207
+ }
208
+ ]);
209
+ const metadata = {
210
+ entityFqdn: "wix.apps.v1.app_instance",
211
+ method: "POST",
212
+ methodFqn: "wix.devcenter.apps.installer.v1.AppsInstallerService.IsPermittedToInstallApps",
213
+ packageName: PACKAGE_NAME,
214
+ url: resolveWixDevcenterAppsInstallerV1AppsInstallerServiceUrl({
215
+ protoPath: "/v1/app-instance/is-permitted-to-install",
216
+ data: serializedData,
217
+ host
218
+ }),
219
+ data: serializedData
220
+ };
221
+ return metadata;
222
+ }
223
+ return __isPermittedToInstallApps;
224
+ }
225
+ function getInstalledApps(payload) {
226
+ function __getInstalledApps({ host }) {
227
+ const metadata = {
228
+ entityFqdn: "wix.apps.v1.app_instance",
229
+ method: "GET",
230
+ methodFqn: "wix.devcenter.apps.installer.v1.AppsInstallerService.GetInstalledApps",
231
+ packageName: PACKAGE_NAME,
232
+ url: resolveWixDevcenterAppsInstallerV1AppsInstallerServiceUrl({
233
+ protoPath: "/v1/app-instances",
234
+ data: payload,
235
+ host
236
+ }),
237
+ params: toURLSearchParams(payload),
238
+ transformResponse: (payload2) => transformPaths(payload2, [
239
+ {
240
+ transformFn: transformRESTTimestampToSDKTimestamp,
241
+ paths: [
242
+ { path: "appInstances.installedDate" },
243
+ { path: "appInstances.updatedDate" }
244
+ ]
245
+ }
246
+ ]),
247
+ fallback: [
248
+ {
249
+ method: "GET",
250
+ url: resolveWixDevcenterAppsInstallerV1AppsInstallerServiceUrl({
251
+ protoPath: "/v1/app-instances",
252
+ data: payload,
253
+ host
254
+ }),
255
+ params: toURLSearchParams(payload)
256
+ }
257
+ ]
258
+ };
259
+ return metadata;
260
+ }
261
+ return __getInstalledApps;
262
+ }
263
+
264
+ // src/apps-v1-app-instance-apps-installer.universal.ts
265
+ var Status = /* @__PURE__ */ ((Status2) => {
266
+ Status2["UNKNOWN"] = "UNKNOWN";
267
+ Status2["WAITING_FOR_OAUTH"] = "WAITING_FOR_OAUTH";
268
+ Status2["AUTHENTICATED"] = "AUTHENTICATED";
269
+ Status2["DIDNT_COMPLETE_PAYMENT"] = "DIDNT_COMPLETE_PAYMENT";
270
+ return Status2;
271
+ })(Status || {});
272
+ var TenantType = /* @__PURE__ */ ((TenantType2) => {
273
+ TenantType2["SITE"] = "SITE";
274
+ TenantType2["ACCOUNT"] = "ACCOUNT";
275
+ return TenantType2;
276
+ })(TenantType || {});
277
+ var WebhookIdentityType = /* @__PURE__ */ ((WebhookIdentityType2) => {
278
+ WebhookIdentityType2["UNKNOWN"] = "UNKNOWN";
279
+ WebhookIdentityType2["ANONYMOUS_VISITOR"] = "ANONYMOUS_VISITOR";
280
+ WebhookIdentityType2["MEMBER"] = "MEMBER";
281
+ WebhookIdentityType2["WIX_USER"] = "WIX_USER";
282
+ WebhookIdentityType2["APP"] = "APP";
283
+ return WebhookIdentityType2;
284
+ })(WebhookIdentityType || {});
285
+ var RequestedFields = /* @__PURE__ */ ((RequestedFields2) => {
286
+ RequestedFields2["UNKNOWN_REQUESTED_FIELD"] = "UNKNOWN_REQUESTED_FIELD";
287
+ RequestedFields2["CLIENT_SPEC_MAP"] = "CLIENT_SPEC_MAP";
288
+ return RequestedFields2;
289
+ })(RequestedFields || {});
290
+ var InstallType = /* @__PURE__ */ ((InstallType2) => {
291
+ InstallType2["UNKNOWN_INSTALL_TYPE"] = "UNKNOWN_INSTALL_TYPE";
292
+ InstallType2["APPS_INSTALL"] = "APPS_INSTALL";
293
+ InstallType2["SHARE_URL_INSTALL"] = "SHARE_URL_INSTALL";
294
+ return InstallType2;
295
+ })(InstallType || {});
296
+ async function installApp2(tenant, options) {
297
+ const { httpClient, sideEffects } = arguments[2];
298
+ const payload = renameKeysFromSDKRequestToRESTRequest({
299
+ tenant,
300
+ appInstance: options?.appInstance
301
+ });
302
+ const reqOpts = installApp(payload);
303
+ sideEffects?.onSiteCall?.();
304
+ try {
305
+ const result = await httpClient.request(reqOpts);
306
+ sideEffects?.onSuccess?.(result);
307
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
308
+ } catch (err) {
309
+ const transformedError = sdkTransformError(
310
+ err,
311
+ {
312
+ spreadPathsToArguments: {},
313
+ explicitPathsToArguments: {
314
+ tenant: "$[0]",
315
+ appInstance: "$[1].appInstance"
316
+ },
317
+ singleArgumentUnchanged: false
318
+ },
319
+ ["tenant", "options"]
320
+ );
321
+ sideEffects?.onError?.(err);
322
+ throw transformedError;
323
+ }
324
+ }
325
+ async function uninstallApp2(options) {
326
+ const { httpClient, sideEffects } = arguments[1];
327
+ const payload = renameKeysFromSDKRequestToRESTRequest({
328
+ tenant: options?.tenant,
329
+ appDefId: options?.appDefId
330
+ });
331
+ const reqOpts = uninstallApp(payload);
332
+ sideEffects?.onSiteCall?.();
333
+ try {
334
+ const result = await httpClient.request(reqOpts);
335
+ sideEffects?.onSuccess?.(result);
336
+ } catch (err) {
337
+ const transformedError = sdkTransformError(
338
+ err,
339
+ {
340
+ spreadPathsToArguments: {},
341
+ explicitPathsToArguments: {
342
+ tenant: "$[0].tenant",
343
+ appDefId: "$[0].appDefId"
344
+ },
345
+ singleArgumentUnchanged: false
346
+ },
347
+ ["options"]
348
+ );
349
+ sideEffects?.onError?.(err);
350
+ throw transformedError;
351
+ }
352
+ }
353
+ async function bulkUninstallApp2(options) {
354
+ const { httpClient, sideEffects } = arguments[1];
355
+ const payload = renameKeysFromSDKRequestToRESTRequest({
356
+ tenant: options?.tenant,
357
+ appDefIds: options?.appDefIds
358
+ });
359
+ const reqOpts = bulkUninstallApp(payload);
360
+ sideEffects?.onSiteCall?.();
361
+ try {
362
+ const result = await httpClient.request(reqOpts);
363
+ sideEffects?.onSuccess?.(result);
364
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
365
+ } catch (err) {
366
+ const transformedError = sdkTransformError(
367
+ err,
368
+ {
369
+ spreadPathsToArguments: {},
370
+ explicitPathsToArguments: {
371
+ tenant: "$[0].tenant",
372
+ appDefIds: "$[0].appDefIds"
373
+ },
374
+ singleArgumentUnchanged: false
375
+ },
376
+ ["options"]
377
+ );
378
+ sideEffects?.onError?.(err);
379
+ throw transformedError;
380
+ }
381
+ }
382
+ async function installAppFromShareUrl2(tenant, options) {
383
+ const { httpClient, sideEffects } = arguments[2];
384
+ const payload = renameKeysFromSDKRequestToRESTRequest({
385
+ tenant,
386
+ shareUrlId: options?.shareUrlId,
387
+ devVersion: options?.devVersion
388
+ });
389
+ const reqOpts = installAppFromShareUrl(payload);
390
+ sideEffects?.onSiteCall?.();
391
+ try {
392
+ const result = await httpClient.request(reqOpts);
393
+ sideEffects?.onSuccess?.(result);
394
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
395
+ } catch (err) {
396
+ const transformedError = sdkTransformError(
397
+ err,
398
+ {
399
+ spreadPathsToArguments: {},
400
+ explicitPathsToArguments: {
401
+ tenant: "$[0]",
402
+ shareUrlId: "$[1].shareUrlId",
403
+ devVersion: "$[1].devVersion"
404
+ },
405
+ singleArgumentUnchanged: false
406
+ },
407
+ ["tenant", "options"]
408
+ );
409
+ sideEffects?.onError?.(err);
410
+ throw transformedError;
411
+ }
412
+ }
413
+ async function isPermittedToInstallApps2(installType, options) {
414
+ const { httpClient, sideEffects } = arguments[2];
415
+ const payload = renameKeysFromSDKRequestToRESTRequest({
416
+ installType,
417
+ appsInstallOptions: options?.appsInstallOptions,
418
+ shareUrlInstallOptions: options?.shareUrlInstallOptions
419
+ });
420
+ const reqOpts = isPermittedToInstallApps(payload);
421
+ sideEffects?.onSiteCall?.();
422
+ try {
423
+ const result = await httpClient.request(reqOpts);
424
+ sideEffects?.onSuccess?.(result);
425
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
426
+ } catch (err) {
427
+ const transformedError = sdkTransformError(
428
+ err,
429
+ {
430
+ spreadPathsToArguments: {},
431
+ explicitPathsToArguments: {
432
+ installType: "$[0]",
433
+ appsInstallOptions: "$[1].appsInstallOptions",
434
+ shareUrlInstallOptions: "$[1].shareUrlInstallOptions"
435
+ },
436
+ singleArgumentUnchanged: false
437
+ },
438
+ ["installType", "options"]
439
+ );
440
+ sideEffects?.onError?.(err);
441
+ throw transformedError;
442
+ }
443
+ }
444
+ async function getInstalledApps2() {
445
+ const { httpClient, sideEffects } = arguments[0];
446
+ const payload = renameKeysFromSDKRequestToRESTRequest({});
447
+ const reqOpts = getInstalledApps(payload);
448
+ sideEffects?.onSiteCall?.();
449
+ try {
450
+ const result = await httpClient.request(reqOpts);
451
+ sideEffects?.onSuccess?.(result);
452
+ return renameKeysFromRESTResponseToSDKResponse(result.data);
453
+ } catch (err) {
454
+ const transformedError = sdkTransformError(
455
+ err,
456
+ {
457
+ spreadPathsToArguments: {},
458
+ explicitPathsToArguments: {},
459
+ singleArgumentUnchanged: false
460
+ },
461
+ []
462
+ );
463
+ sideEffects?.onError?.(err);
464
+ throw transformedError;
465
+ }
466
+ }
467
+
468
+ // src/apps-v1-app-instance-apps-installer.public.ts
469
+ function installApp3(httpClient) {
470
+ return (tenant, options) => installApp2(
471
+ tenant,
472
+ options,
473
+ // @ts-ignore
474
+ { httpClient }
475
+ );
476
+ }
477
+ function uninstallApp3(httpClient) {
478
+ return (options) => uninstallApp2(
479
+ options,
480
+ // @ts-ignore
481
+ { httpClient }
482
+ );
483
+ }
484
+ function bulkUninstallApp3(httpClient) {
485
+ return (options) => bulkUninstallApp2(
486
+ options,
487
+ // @ts-ignore
488
+ { httpClient }
489
+ );
490
+ }
491
+ function installAppFromShareUrl3(httpClient) {
492
+ return (tenant, options) => installAppFromShareUrl2(
493
+ tenant,
494
+ options,
495
+ // @ts-ignore
496
+ { httpClient }
497
+ );
498
+ }
499
+ function isPermittedToInstallApps3(httpClient) {
500
+ return (installType, options) => isPermittedToInstallApps2(
501
+ installType,
502
+ options,
503
+ // @ts-ignore
504
+ { httpClient }
505
+ );
506
+ }
507
+ function getInstalledApps3(httpClient) {
508
+ return () => getInstalledApps2(
509
+ // @ts-ignore
510
+ { httpClient }
511
+ );
512
+ }
513
+ var onAppInstanceAppInstalledOnTenant = EventDefinition(
514
+ "wix.apps.v1.app_instance_app_installed_on_tenant",
515
+ true,
516
+ (event) => renameKeysFromRESTResponseToSDKResponse2(
517
+ transformPaths2(event, [
518
+ {
519
+ transformFn: transformRESTTimestampToSDKTimestamp2,
520
+ paths: [
521
+ { path: "data.appInstance.installedDate" },
522
+ { path: "data.appInstance.updatedDate" },
523
+ { path: "metadata.eventTime" }
524
+ ]
525
+ }
526
+ ])
527
+ )
528
+ )();
529
+
530
+ // src/apps-v1-app-instance-apps-installer.context.ts
531
+ import { createRESTModule } from "@wix/sdk-runtime/rest-modules";
532
+ import { createEventModule } from "@wix/sdk-runtime/event-definition-modules";
533
+ var installApp4 = /* @__PURE__ */ createRESTModule(installApp3);
534
+ var uninstallApp4 = /* @__PURE__ */ createRESTModule(uninstallApp3);
535
+ var bulkUninstallApp4 = /* @__PURE__ */ createRESTModule(bulkUninstallApp3);
536
+ var installAppFromShareUrl4 = /* @__PURE__ */ createRESTModule(installAppFromShareUrl3);
537
+ var isPermittedToInstallApps4 = /* @__PURE__ */ createRESTModule(isPermittedToInstallApps3);
538
+ var getInstalledApps4 = /* @__PURE__ */ createRESTModule(getInstalledApps3);
539
+ var onAppInstanceAppInstalledOnTenant2 = createEventModule(onAppInstanceAppInstalledOnTenant);
540
+ export {
541
+ InstallType,
542
+ RequestedFields,
543
+ Status,
544
+ TenantType,
545
+ WebhookIdentityType,
546
+ bulkUninstallApp4 as bulkUninstallApp,
547
+ getInstalledApps4 as getInstalledApps,
548
+ installApp4 as installApp,
549
+ installAppFromShareUrl4 as installAppFromShareUrl,
550
+ isPermittedToInstallApps4 as isPermittedToInstallApps,
551
+ onAppInstanceAppInstalledOnTenant2 as onAppInstanceAppInstalledOnTenant,
552
+ uninstallApp4 as uninstallApp
553
+ };
554
+ //# sourceMappingURL=index.mjs.map