@wix/vibe-bookings-plugin 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +23 -80
- package/dist/index.cjs.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -3053,17 +3053,6 @@ function renameKeysFromRESTResponseToSDKResponse(payload, ignorePaths = []) {
|
|
|
3053
3053
|
return renameAllNestedKeys(payload, RESTResponseToSDKResponseRenameMap, ignorePaths);
|
|
3054
3054
|
}
|
|
3055
3055
|
|
|
3056
|
-
// ../../../node_modules/@wix/sdk-types/build/index.mjs
|
|
3057
|
-
function EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {
|
|
3058
|
-
return () => ({
|
|
3059
|
-
__type: "event-definition",
|
|
3060
|
-
type,
|
|
3061
|
-
isDomainEvent,
|
|
3062
|
-
transformations
|
|
3063
|
-
});
|
|
3064
|
-
}
|
|
3065
|
-
var SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
3066
|
-
|
|
3067
3056
|
// ../../../node_modules/@wix/sdk-context/build/index.mjs
|
|
3068
3057
|
var wixContext = {};
|
|
3069
3058
|
|
|
@@ -3326,6 +3315,16 @@ function transformSDKFieldMaskToRESTFieldMask(val) {
|
|
|
3326
3315
|
return val.join(",");
|
|
3327
3316
|
}
|
|
3328
3317
|
|
|
3318
|
+
// ../../../node_modules/@wix/sdk-types/build/index.mjs
|
|
3319
|
+
function EventDefinition(type, isDomainEvent = false, transformations = (x) => x) {
|
|
3320
|
+
return () => ({
|
|
3321
|
+
__type: "event-definition",
|
|
3322
|
+
type,
|
|
3323
|
+
isDomainEvent,
|
|
3324
|
+
transformations
|
|
3325
|
+
});
|
|
3326
|
+
}
|
|
3327
|
+
|
|
3329
3328
|
// ../../../node_modules/@wix/sdk-runtime/build/query-filter.js
|
|
3330
3329
|
function isAndOperator(filter) {
|
|
3331
3330
|
return Object.keys(filter).length === 1 && "$and" in filter && Array.isArray(filter.$and);
|
|
@@ -8268,6 +8267,17 @@ createEventModule(
|
|
|
8268
8267
|
);
|
|
8269
8268
|
createEventModule(onBookingUpdated);
|
|
8270
8269
|
|
|
8270
|
+
// ../../../node_modules/@wix/sdk/node_modules/@wix/sdk-types/build/index.mjs
|
|
8271
|
+
function EventDefinition2(type, isDomainEvent = false, transformations = (x) => x) {
|
|
8272
|
+
return () => ({
|
|
8273
|
+
__type: "event-definition",
|
|
8274
|
+
type,
|
|
8275
|
+
isDomainEvent,
|
|
8276
|
+
transformations
|
|
8277
|
+
});
|
|
8278
|
+
}
|
|
8279
|
+
var SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
8280
|
+
|
|
8271
8281
|
// ../../../node_modules/@wix/sdk/build/ambassador-modules.js
|
|
8272
8282
|
var parseMethod = (method) => {
|
|
8273
8283
|
switch (method) {
|
|
@@ -8858,8 +8868,8 @@ function eventHandlersModules(authStrategy) {
|
|
|
8858
8868
|
})));
|
|
8859
8869
|
},
|
|
8860
8870
|
apps: {
|
|
8861
|
-
AppInstalled:
|
|
8862
|
-
AppRemoved:
|
|
8871
|
+
AppInstalled: EventDefinition2("AppInstalled")(),
|
|
8872
|
+
AppRemoved: EventDefinition2("AppRemoved")()
|
|
8863
8873
|
}
|
|
8864
8874
|
};
|
|
8865
8875
|
return {
|
|
@@ -9496,76 +9506,9 @@ IF THE SITE IS IN ENGLISH OR THE LANGUAGE IS NOT SPECIFIED, YOU MUST NOT READ OR
|
|
|
9496
9506
|
`;
|
|
9497
9507
|
};
|
|
9498
9508
|
|
|
9499
|
-
// src/wix-apis.ts
|
|
9500
|
-
var callWixAPI = async (url, method, _siteId, body, headers) => {
|
|
9501
|
-
if (!process.env.WIX_TOKEN) {
|
|
9502
|
-
console.error("[wix-apis] WIX_TOKEN is not set");
|
|
9503
|
-
}
|
|
9504
|
-
try {
|
|
9505
|
-
console.log("[wix-apis] Calling Wix API...", {
|
|
9506
|
-
url,
|
|
9507
|
-
method,
|
|
9508
|
-
_siteId,
|
|
9509
|
-
headers
|
|
9510
|
-
});
|
|
9511
|
-
const response = await fetch(url, {
|
|
9512
|
-
method,
|
|
9513
|
-
headers: {
|
|
9514
|
-
"Content-Type": "application/json",
|
|
9515
|
-
Authorization: process.env.WIX_TOKEN,
|
|
9516
|
-
...headers
|
|
9517
|
-
},
|
|
9518
|
-
...method === "GET" ? {} : { body: JSON.stringify(body) }
|
|
9519
|
-
});
|
|
9520
|
-
if (!response.ok) {
|
|
9521
|
-
const text = await response.text();
|
|
9522
|
-
console.error("[wix-apis] Error calling Wix API", {
|
|
9523
|
-
repsponseText: text,
|
|
9524
|
-
url,
|
|
9525
|
-
method,
|
|
9526
|
-
body,
|
|
9527
|
-
requestId: response.headers.get("x-wix-request-id")
|
|
9528
|
-
});
|
|
9529
|
-
return null;
|
|
9530
|
-
}
|
|
9531
|
-
const data = await response.json();
|
|
9532
|
-
return data;
|
|
9533
|
-
} catch (error) {
|
|
9534
|
-
console.error("[wix-apis] Error calling Wix API", {
|
|
9535
|
-
error,
|
|
9536
|
-
url,
|
|
9537
|
-
method,
|
|
9538
|
-
body,
|
|
9539
|
-
requestId: isErrorWithRequestId(error) ? error.requestId : void 0
|
|
9540
|
-
});
|
|
9541
|
-
return null;
|
|
9542
|
-
}
|
|
9543
|
-
};
|
|
9544
|
-
var isErrorWithRequestId = (error) => {
|
|
9545
|
-
return error instanceof Error && "requestId" in error;
|
|
9546
|
-
};
|
|
9547
|
-
var installApp = async (appDefId, siteId) => {
|
|
9548
|
-
console.log("Installing Wix app...", { appDefId, siteId });
|
|
9549
|
-
const response = await callWixAPI(
|
|
9550
|
-
"https://www.wixapis.com/apps-installer-service/v1/app-instance/install",
|
|
9551
|
-
"POST",
|
|
9552
|
-
siteId,
|
|
9553
|
-
{
|
|
9554
|
-
tenant: {
|
|
9555
|
-
tenantType: "SITE",
|
|
9556
|
-
id: siteId
|
|
9557
|
-
},
|
|
9558
|
-
appInstance: { appDefId }
|
|
9559
|
-
}
|
|
9560
|
-
);
|
|
9561
|
-
return response;
|
|
9562
|
-
};
|
|
9563
|
-
|
|
9564
9509
|
// src/index.ts
|
|
9565
9510
|
var install = async (env) => {
|
|
9566
9511
|
console.log(`[${VERTICAL_NAME}-plugin-install] Starting installation`, env);
|
|
9567
|
-
console.log(`[${VERTICAL_NAME}-plugin-install] Installing vertical functionality...`);
|
|
9568
|
-
await installApp("cc552162-24a4-45e0-9695-230c4931ef40", env.WIX_SITE_ID);
|
|
9569
9512
|
console.log(`[${VERTICAL_NAME}-plugin-install] Unzipping and merging plugin files...`);
|
|
9570
9513
|
await unzipAndMergePluginFiles(env, PLUGIN_FILES_ZIP_URL);
|
|
9571
9514
|
console.log(`
|