@wix/vibe-forms-app-plugin 0.7.0 → 0.9.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.7.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
  {
@@ -147320,56 +147364,51 @@ Your tasks for implementing and integrating the Forms features of the site are:
147320
147364
 
147321
147365
  Add the form component on a site page.
147322
147366
 
147367
+ **🚨 CRITICAL: FormComponent is ALREADY IMPLEMENTED! DO NOT create/implement it - just import and use it!**
147368
+
147323
147369
  ## Usage Examples
147324
147370
 
147325
147371
  ### Form component
147326
147372
  \`\`\`tsx
147373
+ // Import the existing FormComponent (DO NOT implement it!)
147327
147374
  import { FormComponent } from '@/components/forms/Form';
147328
147375
 
147329
147376
  <div>
147330
147377
  <h1>${purpose}</h1>
147331
- <FormComponent formServiceConfig={{ form: "${formSchema}" }} />
147378
+ <FormComponent formServiceConfig={{ formId: "${formId}" }} />
147332
147379
  </div>
147333
147380
  \`\`\`
147334
147381
 
147335
147382
  ## Form Service Configuration
147336
147383
 
147337
- Forms are configured using a \`formServiceConfig\` object:
147338
-
147339
- \`\`\`tsx
147340
- interface FormProps {
147341
- formServiceConfig: {
147342
- form?: forms.Form; // Pre-loaded form data (SSR/SSG)
147343
- formId?: string; // Form ID for lazy loading (client-side)
147344
- };
147345
- }
147384
+ Forms are configured using a \`formServiceConfig\` object. The FormComponent is ALREADY IMPLEMENTED - just import and use it!
147346
147385
 
147347
- // Example usage
147386
+ **Import Path:** Always use \`@/components/forms/Form\` - this is the correct path to the existing FormComponent.
147348
147387
 
147349
- const formServiceConfig = {formId: "${formId}"};
147388
+ \`\`\`tsx
147389
+ // Example usage with formId
147390
+ <FormComponent formServiceConfig={{ formId: "${formId}" }} />
147350
147391
 
147351
- // Or with pre-loaded data
147352
- const formServiceConfig = {
147353
- form: formData, // Use pre-loaded form data
147354
- };
147392
+ // Or with pre-loaded form data
147393
+ <FormComponent formServiceConfig={{ form: formData }} />
147355
147394
  \`\`\`
147356
147395
 
147396
+ **DO NOT IMPLEMENT FormComponent - IT ALREADY EXISTS!**
147397
+
147357
147398
 
147358
147399
 
147359
147400
  # SECOND TASK: FORMS CODE CHANGES:
147401
+ - **NEVER implement FormComponent - it already exists!** Just import it from '@/components/forms/Form'
147360
147402
  - The general instruction is to NOT CHANGE THE FORMS COMPONENTS CODE and only integrate the forms components into a site page.
147361
147403
  - The FormComponent handles the onChange, onBlur, onFocus, onSubmit, etc. events and updates the form data. It also handles validation & showing errors.
147362
- - i.e DO NOT EDIT or READ ANY FILE in <code>./src/wix-verticals/</code> USE EVERYTHING AS IS!!
147404
+ - i.e DO NOT EDIT or READ ANY FILE in <code>src/components/forms/</code> USE EVERYTHING AS IS!!
147363
147405
  <code-changes-exceptions>
147364
- - Exceptions are when the user explicitly asks for changes to the forms components code
147365
- - For example, if the user asks a site in non english language, you REQUIRED to go make changes to forms composite components in: \`src/components/forms/...\`:
147366
-
147367
- \`\`\`bash
147368
- src/components/forms/Form.tsx
147369
- src/components/forms/fields.tsx
147370
- \`\`\`
147371
-
147372
- and change the static text the translate it to the new language.
147406
+ - **ONLY** make changes to forms components when the user explicitly requests language translation
147407
+ - **ONLY** edit these specific files for language changes:
147408
+ - \`src/components/forms/Form.tsx\` - for form-level text
147409
+ - \`src/components/forms/fields.tsx\` - for field-level text
147410
+ - **DO NOT** edit any other forms component files
147411
+ - **DO NOT** change functionality, only translate static text strings
147373
147412
  </code-changes-exceptions>
147374
147413
 
147375
147414
  # THIRD TASK: CODE THE REST OF THE SITE PAGES