@wix/vibe-forms-plugin 0.32.0 → 0.32.2
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/README.md +27 -1
- package/dist/index.cjs +1 -79
- package/dist/index.cjs.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
1
|
# Wix Vibe Forms Plugin
|
|
2
2
|
|
|
3
|
-
A Wix Vibe plugin that enables using form headless components for Forms consumers.
|
|
3
|
+
A Wix Vibe plugin that enables using form headless components for Forms consumers.
|
|
4
|
+
|
|
5
|
+
## Development
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Install dependencies
|
|
9
|
+
yarn install
|
|
10
|
+
|
|
11
|
+
# Build the plugin
|
|
12
|
+
yarn build
|
|
13
|
+
|
|
14
|
+
# Build the plugin in watch mode
|
|
15
|
+
yarn build --watch
|
|
16
|
+
|
|
17
|
+
# Fix linting issues
|
|
18
|
+
yarn lint:fix
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
To use local build of `vibe-forms-plugin-files`, set `useLocal` param to true on `install` function.
|
|
22
|
+
```
|
|
23
|
+
await unzipAndMergePluginFiles(env, true);
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Publishing new version
|
|
27
|
+
|
|
28
|
+
Publish new version by bumping the package version in `package.json` manually. The version should be bumped for *all* forms plugins.
|
|
29
|
+
You also have to update the Old Wix Forms and Payments SDK extension on dev center to use the new version.
|
package/dist/index.cjs
CHANGED
|
@@ -5520,85 +5520,8 @@ var PLUGIN_FILES_VERSION = (0, import_vibe_plugin_utils.getPluginFilesVersion)(
|
|
|
5520
5520
|
);
|
|
5521
5521
|
var PLUGIN_FILES_ZIP_URL = `https://static.parastorage.com/services/vibe-forms-plugin-files/${PLUGIN_FILES_VERSION}/forms-plugin-files-files.zip`;
|
|
5522
5522
|
var VERTICAL_NAME = "forms";
|
|
5523
|
-
var FORMS_PLATFORM_APP_DEF_ID = "14ce1214-b278-a7e4-1373-00cebd1bef7c";
|
|
5524
|
-
|
|
5525
|
-
// src/wix-apis.ts
|
|
5526
|
-
var callWixAPI = async ({
|
|
5527
|
-
url,
|
|
5528
|
-
method,
|
|
5529
|
-
body,
|
|
5530
|
-
additionalHeaders,
|
|
5531
|
-
logger
|
|
5532
|
-
}) => {
|
|
5533
|
-
if (!process.env.WIX_TOKEN) {
|
|
5534
|
-
logger.warn("[wix-apis] WIX_TOKEN is not set");
|
|
5535
|
-
}
|
|
5536
|
-
try {
|
|
5537
|
-
logger.debug("[wix-apis] Calling Wix API...", {
|
|
5538
|
-
url,
|
|
5539
|
-
method,
|
|
5540
|
-
additionalHeaders
|
|
5541
|
-
});
|
|
5542
|
-
const response = await fetch(url, {
|
|
5543
|
-
method,
|
|
5544
|
-
headers: {
|
|
5545
|
-
"Content-Type": "application/json",
|
|
5546
|
-
Authorization: process.env.WIX_TOKEN,
|
|
5547
|
-
...additionalHeaders
|
|
5548
|
-
},
|
|
5549
|
-
...method === "GET" ? {} : { body: JSON.stringify(body) }
|
|
5550
|
-
});
|
|
5551
|
-
if (!response.ok) {
|
|
5552
|
-
const responseText = await response.text();
|
|
5553
|
-
logger.error(new Error("[wix-apis] Error calling Wix API"), {
|
|
5554
|
-
responseText,
|
|
5555
|
-
url,
|
|
5556
|
-
method,
|
|
5557
|
-
body,
|
|
5558
|
-
requestId: response.headers.get("x-wix-request-id")
|
|
5559
|
-
});
|
|
5560
|
-
return null;
|
|
5561
|
-
}
|
|
5562
|
-
return await response.json();
|
|
5563
|
-
} catch (error) {
|
|
5564
|
-
logger.error(new Error("[wix-apis] Error calling Wix API"), {
|
|
5565
|
-
error,
|
|
5566
|
-
url,
|
|
5567
|
-
method,
|
|
5568
|
-
body,
|
|
5569
|
-
requestId: error instanceof Error && "requestId" in error ? error.requestId : void 0
|
|
5570
|
-
});
|
|
5571
|
-
return null;
|
|
5572
|
-
}
|
|
5573
|
-
};
|
|
5574
|
-
var installWixApp = async (appDefId, siteId, logger) => {
|
|
5575
|
-
logger.debug("Installing Wix app...", { appDefId, siteId });
|
|
5576
|
-
const response = await callWixAPI({
|
|
5577
|
-
url: "https://www.wixapis.com/apps-installer-service/v1/app-instance/install",
|
|
5578
|
-
method: "POST",
|
|
5579
|
-
body: {
|
|
5580
|
-
tenant: {
|
|
5581
|
-
tenantType: "SITE",
|
|
5582
|
-
id: siteId
|
|
5583
|
-
},
|
|
5584
|
-
appInstance: {
|
|
5585
|
-
appDefId
|
|
5586
|
-
}
|
|
5587
|
-
},
|
|
5588
|
-
logger
|
|
5589
|
-
});
|
|
5590
|
-
return response;
|
|
5591
|
-
};
|
|
5592
5523
|
|
|
5593
5524
|
// src/utils.ts
|
|
5594
|
-
var installFormsPlatform = async (env) => {
|
|
5595
|
-
env.logger.debug(
|
|
5596
|
-
`[${VERTICAL_NAME}-plugin-install] Installing vertical functionality...`,
|
|
5597
|
-
env
|
|
5598
|
-
);
|
|
5599
|
-
await installWixApp(FORMS_PLATFORM_APP_DEF_ID, env.WIX_SITE_ID, env.logger);
|
|
5600
|
-
env.logger.debug(`[${VERTICAL_NAME}-plugin-install] Installation completed`);
|
|
5601
|
-
};
|
|
5602
5525
|
async function downloadZipFile(url, filePath, logger) {
|
|
5603
5526
|
return new Promise((resolve, reject) => {
|
|
5604
5527
|
const file = fs__namespace.createWriteStream(filePath);
|
|
@@ -5735,12 +5658,11 @@ var unzipAndMergeLocalPluginFiles = async (env, zipPath) => {
|
|
|
5735
5658
|
|
|
5736
5659
|
// src/index.ts
|
|
5737
5660
|
var install = async (env) => {
|
|
5738
|
-
await installFormsPlatform(env);
|
|
5739
5661
|
console.log(
|
|
5740
5662
|
`[${VERTICAL_NAME}-plugin-install] Unzipping and merging plugin files...`
|
|
5741
5663
|
);
|
|
5742
5664
|
await unzipAndMergePluginFiles(env, false);
|
|
5743
|
-
console.log(`[${VERTICAL_NAME}-plugin-install]
|
|
5665
|
+
console.log(`[${VERTICAL_NAME}-plugin-install] Files merged successfully`);
|
|
5744
5666
|
};
|
|
5745
5667
|
var formsPlugin = {
|
|
5746
5668
|
install
|