@wix/vibe-forms-app-plugin 0.6.0 → 0.8.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 CHANGED
@@ -4,6 +4,9 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var fs = require('fs');
6
6
  var path = require('path');
7
+ var https = require('https');
8
+
9
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
7
10
 
8
11
  function _interopNamespace(e) {
9
12
  if (e && e.__esModule) return e;
@@ -25,6 +28,7 @@ function _interopNamespace(e) {
25
28
 
26
29
  var fs__namespace = /*#__PURE__*/_interopNamespace(fs);
27
30
  var path__namespace = /*#__PURE__*/_interopNamespace(path);
31
+ var https__default = /*#__PURE__*/_interopDefault(https);
28
32
 
29
33
  var __create = Object.create;
30
34
  var __defProp = Object.defineProperty;
@@ -146970,7 +146974,7 @@ var import_adm_zip = __toESM(require_adm_zip());
146970
146974
  // src/constants.ts
146971
146975
  var VERTICAL_NAME = "forms-app";
146972
146976
  var FORMS_APP_DEF_ID = "225dd912-7dea-4738-8688-4b8c6955ffc2";
146973
- var PLUGIN_FILES_ZIP_URL = "https://static.parastorage.com/services/forms-plugin-files/0.2.0/forms-plugin-files-files.zip";
146977
+ var PLUGIN_FILES_ZIP_URL = "https://static.parastorage.com/services/forms-plugin-files/0.7.0/forms-plugin-files.zip";
146974
146978
 
146975
146979
  // src/wix-apis.ts
146976
146980
  var isErrorWithRequestId = (error) => {
@@ -147039,6 +147043,46 @@ var installWixApp = async (env, appDefId) => {
147039
147043
  };
147040
147044
 
147041
147045
  // src/utils.ts
147046
+ async function downloadZipFile(url, filePath) {
147047
+ return new Promise((resolve, reject) => {
147048
+ const file = fs__namespace.createWriteStream(filePath);
147049
+ const makeRequest = (requestUrl) => {
147050
+ https__default.default.get(requestUrl, (response) => {
147051
+ if (response.statusCode === 301 || response.statusCode === 302) {
147052
+ const location = response.headers.location;
147053
+ if (location) {
147054
+ console.log(
147055
+ `[${VERTICAL_NAME}-plugin-setup] following redirect to: ${location}`
147056
+ );
147057
+ makeRequest(location);
147058
+ return;
147059
+ }
147060
+ }
147061
+ if (response.statusCode !== 200) {
147062
+ reject(
147063
+ new Error(
147064
+ `Failed to download: ${response.statusCode} ${response.statusMessage}`
147065
+ )
147066
+ );
147067
+ return;
147068
+ }
147069
+ response.pipe(file);
147070
+ file.on("finish", () => {
147071
+ file.close();
147072
+ resolve();
147073
+ });
147074
+ file.on("error", (err) => {
147075
+ fs__namespace.unlink(filePath, () => {
147076
+ });
147077
+ reject(err);
147078
+ });
147079
+ }).on("error", (err) => {
147080
+ reject(err);
147081
+ });
147082
+ };
147083
+ makeRequest(url);
147084
+ });
147085
+ }
147042
147086
  var MOCK_SCHEMA = {
147043
147087
  formFields: [
147044
147088
  {