@wix/vibe-forms-app-plugin 0.18.0 → 0.20.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/README.md +27 -1
- package/dist/index.cjs +1043 -1459
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -8
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -2715,14 +2715,568 @@ var require_adm_zip = __commonJS({
|
|
|
2715
2715
|
}
|
|
2716
2716
|
});
|
|
2717
2717
|
|
|
2718
|
-
// ../../../node_modules
|
|
2718
|
+
// ../../../node_modules/dedent/dist/dedent.mjs
|
|
2719
|
+
function ownKeys(object, enumerableOnly) {
|
|
2720
|
+
var keys = Object.keys(object);
|
|
2721
|
+
if (Object.getOwnPropertySymbols) {
|
|
2722
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
2723
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
2724
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
2725
|
+
})), keys.push.apply(keys, symbols);
|
|
2726
|
+
}
|
|
2727
|
+
return keys;
|
|
2728
|
+
}
|
|
2729
|
+
function _objectSpread(target) {
|
|
2730
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
2731
|
+
var source = null != arguments[i] ? arguments[i] : {};
|
|
2732
|
+
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
2733
|
+
_defineProperty(target, key, source[key]);
|
|
2734
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
2735
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
2736
|
+
});
|
|
2737
|
+
}
|
|
2738
|
+
return target;
|
|
2739
|
+
}
|
|
2740
|
+
function _defineProperty(obj, key, value) {
|
|
2741
|
+
key = _toPropertyKey(key);
|
|
2742
|
+
if (key in obj) {
|
|
2743
|
+
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
2744
|
+
} else {
|
|
2745
|
+
obj[key] = value;
|
|
2746
|
+
}
|
|
2747
|
+
return obj;
|
|
2748
|
+
}
|
|
2749
|
+
function _toPropertyKey(arg) {
|
|
2750
|
+
var key = _toPrimitive(arg, "string");
|
|
2751
|
+
return typeof key === "symbol" ? key : String(key);
|
|
2752
|
+
}
|
|
2753
|
+
function _toPrimitive(input, hint) {
|
|
2754
|
+
if (typeof input !== "object" || input === null) return input;
|
|
2755
|
+
var prim = input[Symbol.toPrimitive];
|
|
2756
|
+
if (prim !== void 0) {
|
|
2757
|
+
var res = prim.call(input, hint);
|
|
2758
|
+
if (typeof res !== "object") return res;
|
|
2759
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
2760
|
+
}
|
|
2761
|
+
return (hint === "string" ? String : Number)(input);
|
|
2762
|
+
}
|
|
2763
|
+
var dedent = createDedent({});
|
|
2764
|
+
var dedent_default = dedent;
|
|
2765
|
+
function createDedent(options) {
|
|
2766
|
+
dedent2.withOptions = (newOptions) => createDedent(_objectSpread(_objectSpread({}, options), newOptions));
|
|
2767
|
+
return dedent2;
|
|
2768
|
+
function dedent2(strings, ...values) {
|
|
2769
|
+
const raw = typeof strings === "string" ? [strings] : strings.raw;
|
|
2770
|
+
const {
|
|
2771
|
+
escapeSpecialCharacters = Array.isArray(strings),
|
|
2772
|
+
trimWhitespace = true
|
|
2773
|
+
} = options;
|
|
2774
|
+
let result = "";
|
|
2775
|
+
for (let i = 0; i < raw.length; i++) {
|
|
2776
|
+
let next = raw[i];
|
|
2777
|
+
if (escapeSpecialCharacters) {
|
|
2778
|
+
next = next.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{");
|
|
2779
|
+
}
|
|
2780
|
+
result += next;
|
|
2781
|
+
if (i < values.length) {
|
|
2782
|
+
result += values[i];
|
|
2783
|
+
}
|
|
2784
|
+
}
|
|
2785
|
+
const lines = result.split("\n");
|
|
2786
|
+
let mindent = null;
|
|
2787
|
+
for (const l of lines) {
|
|
2788
|
+
const m = l.match(/^(\s+)\S+/);
|
|
2789
|
+
if (m) {
|
|
2790
|
+
const indent = m[1].length;
|
|
2791
|
+
if (!mindent) {
|
|
2792
|
+
mindent = indent;
|
|
2793
|
+
} else {
|
|
2794
|
+
mindent = Math.min(mindent, indent);
|
|
2795
|
+
}
|
|
2796
|
+
}
|
|
2797
|
+
}
|
|
2798
|
+
if (mindent !== null) {
|
|
2799
|
+
const m = mindent;
|
|
2800
|
+
result = lines.map((l) => l[0] === " " || l[0] === " " ? l.slice(m) : l).join("\n");
|
|
2801
|
+
}
|
|
2802
|
+
if (trimWhitespace) {
|
|
2803
|
+
result = result.trim();
|
|
2804
|
+
}
|
|
2805
|
+
if (escapeSpecialCharacters) {
|
|
2806
|
+
result = result.replace(/\\n/g, "\n");
|
|
2807
|
+
}
|
|
2808
|
+
return result;
|
|
2809
|
+
}
|
|
2810
|
+
}
|
|
2811
|
+
|
|
2812
|
+
// src/utils.ts
|
|
2813
|
+
var import_adm_zip = __toESM(require_adm_zip());
|
|
2814
|
+
|
|
2815
|
+
// src/constants.ts
|
|
2816
|
+
var VERTICAL_NAME = "forms-app";
|
|
2817
|
+
var FORMS_APP_DEF_ID = "225dd912-7dea-4738-8688-4b8c6955ffc2";
|
|
2818
|
+
var PLUGIN_FILES_ZIP_URL = "https://static.parastorage.com/services/vibe-forms-plugin-files/0.18.0/forms-plugin-files-files.zip";
|
|
2819
|
+
|
|
2820
|
+
// src/wix-apis.ts
|
|
2821
|
+
var callWixAPI = async (url, method, body) => {
|
|
2822
|
+
if (!process.env.WIX_TOKEN) {
|
|
2823
|
+
console.log("[wix-apis] WIX_TOKEN is not set");
|
|
2824
|
+
}
|
|
2825
|
+
try {
|
|
2826
|
+
console.log("[wix-apis] Calling Wix API...", { url, method });
|
|
2827
|
+
const response = await fetch(url, {
|
|
2828
|
+
method,
|
|
2829
|
+
headers: {
|
|
2830
|
+
"Content-Type": "application/json",
|
|
2831
|
+
Authorization: process.env.WIX_TOKEN
|
|
2832
|
+
},
|
|
2833
|
+
...method === "GET" ? {} : { body: JSON.stringify(body) }
|
|
2834
|
+
});
|
|
2835
|
+
if (!response.ok) {
|
|
2836
|
+
const responseText = await response.text();
|
|
2837
|
+
console.log("[wix-apis] Error calling Wix API", {
|
|
2838
|
+
responseText,
|
|
2839
|
+
url,
|
|
2840
|
+
method,
|
|
2841
|
+
body,
|
|
2842
|
+
requestId: response.headers.get("x-wix-request-id")
|
|
2843
|
+
});
|
|
2844
|
+
return null;
|
|
2845
|
+
}
|
|
2846
|
+
return await response.json();
|
|
2847
|
+
} catch (error) {
|
|
2848
|
+
console.log("[wix-apis] Error calling Wix API", {
|
|
2849
|
+
error,
|
|
2850
|
+
url,
|
|
2851
|
+
method,
|
|
2852
|
+
body,
|
|
2853
|
+
requestId: error instanceof Error && "requestId" in error ? error.requestId : void 0
|
|
2854
|
+
});
|
|
2855
|
+
return null;
|
|
2856
|
+
}
|
|
2857
|
+
};
|
|
2858
|
+
var installWixApp = async (appDefId, siteId) => {
|
|
2859
|
+
console.log("Installing Wix app...", { appDefId, siteId });
|
|
2860
|
+
const response = await callWixAPI(
|
|
2861
|
+
"https://www.wixapis.com/apps-installer-service/v1/app-instance/install",
|
|
2862
|
+
"POST",
|
|
2863
|
+
{
|
|
2864
|
+
tenant: {
|
|
2865
|
+
tenantType: "SITE",
|
|
2866
|
+
id: siteId
|
|
2867
|
+
},
|
|
2868
|
+
appInstance: {
|
|
2869
|
+
appDefId
|
|
2870
|
+
}
|
|
2871
|
+
}
|
|
2872
|
+
);
|
|
2873
|
+
return response;
|
|
2874
|
+
};
|
|
2875
|
+
|
|
2876
|
+
// src/utils.ts
|
|
2877
|
+
async function downloadZipFile(url, filePath) {
|
|
2878
|
+
return new Promise((resolve, reject) => {
|
|
2879
|
+
const file = fs__namespace.createWriteStream(filePath);
|
|
2880
|
+
const makeRequest = (requestUrl) => {
|
|
2881
|
+
https__default.default.get(requestUrl, (response) => {
|
|
2882
|
+
if (response.statusCode === 301 || response.statusCode === 302) {
|
|
2883
|
+
const location = response.headers.location;
|
|
2884
|
+
if (location) {
|
|
2885
|
+
console.log(
|
|
2886
|
+
`[${VERTICAL_NAME}-plugin-setup] following redirect to: ${location}`
|
|
2887
|
+
);
|
|
2888
|
+
makeRequest(location);
|
|
2889
|
+
return;
|
|
2890
|
+
}
|
|
2891
|
+
}
|
|
2892
|
+
if (response.statusCode !== 200) {
|
|
2893
|
+
reject(
|
|
2894
|
+
new Error(
|
|
2895
|
+
`Failed to download: ${response.statusCode} ${response.statusMessage}`
|
|
2896
|
+
)
|
|
2897
|
+
);
|
|
2898
|
+
return;
|
|
2899
|
+
}
|
|
2900
|
+
response.pipe(file);
|
|
2901
|
+
file.on("finish", () => {
|
|
2902
|
+
file.close();
|
|
2903
|
+
resolve();
|
|
2904
|
+
});
|
|
2905
|
+
file.on("error", (err) => {
|
|
2906
|
+
fs__namespace.unlink(filePath, () => {
|
|
2907
|
+
});
|
|
2908
|
+
reject(err);
|
|
2909
|
+
});
|
|
2910
|
+
}).on("error", (err) => {
|
|
2911
|
+
reject(err);
|
|
2912
|
+
});
|
|
2913
|
+
};
|
|
2914
|
+
makeRequest(url);
|
|
2915
|
+
});
|
|
2916
|
+
}
|
|
2917
|
+
var MOCK_SCHEMA = {
|
|
2918
|
+
namespace: "wix.form_app.form",
|
|
2919
|
+
fields: [
|
|
2920
|
+
{
|
|
2921
|
+
id: "30afbc7f-6266-4a3d-7f48-3de4a7c7d165",
|
|
2922
|
+
view: {
|
|
2923
|
+
submitText: "Submit",
|
|
2924
|
+
nextText: "Next",
|
|
2925
|
+
previousText: "Back",
|
|
2926
|
+
thankYouMessageText: {
|
|
2927
|
+
nodes: [
|
|
2928
|
+
{
|
|
2929
|
+
type: "PARAGRAPH",
|
|
2930
|
+
id: "py3dq1",
|
|
2931
|
+
nodes: [
|
|
2932
|
+
{
|
|
2933
|
+
type: "TEXT",
|
|
2934
|
+
id: "",
|
|
2935
|
+
nodes: [],
|
|
2936
|
+
textData: {
|
|
2937
|
+
text: "Thanks, we received your submission.",
|
|
2938
|
+
decorations: []
|
|
2939
|
+
}
|
|
2940
|
+
}
|
|
2941
|
+
],
|
|
2942
|
+
paragraphData: {
|
|
2943
|
+
textStyle: {
|
|
2944
|
+
textAlignment: "CENTER"
|
|
2945
|
+
}
|
|
2946
|
+
}
|
|
2947
|
+
}
|
|
2948
|
+
]
|
|
2949
|
+
},
|
|
2950
|
+
thankYouMessageDuration: 8,
|
|
2951
|
+
submitAction: "THANK_YOU_MESSAGE",
|
|
2952
|
+
fieldType: "SUBMIT_BUTTON"
|
|
2953
|
+
}
|
|
2954
|
+
},
|
|
2955
|
+
{
|
|
2956
|
+
id: "b27f777f-f3d6-42b0-0034-acf363d16aa5",
|
|
2957
|
+
target: "first_name_620e",
|
|
2958
|
+
view: {
|
|
2959
|
+
fieldType: "CONTACTS_FIRST_NAME",
|
|
2960
|
+
label: "First name"
|
|
2961
|
+
},
|
|
2962
|
+
validation: {
|
|
2963
|
+
string: {}
|
|
2964
|
+
},
|
|
2965
|
+
pii: true
|
|
2966
|
+
},
|
|
2967
|
+
{
|
|
2968
|
+
id: "ceae0b6e-1ee9-4f7c-ea64-2ff0966bf60d",
|
|
2969
|
+
target: "last_name_68b3",
|
|
2970
|
+
view: {
|
|
2971
|
+
fieldType: "CONTACTS_LAST_NAME",
|
|
2972
|
+
label: "Last name"
|
|
2973
|
+
},
|
|
2974
|
+
validation: {
|
|
2975
|
+
string: {}
|
|
2976
|
+
},
|
|
2977
|
+
pii: true
|
|
2978
|
+
},
|
|
2979
|
+
{
|
|
2980
|
+
id: "2e1e030b-ca2a-44dd-4116-16a4a53db1a8",
|
|
2981
|
+
target: "email_4419",
|
|
2982
|
+
view: {
|
|
2983
|
+
fieldType: "CONTACTS_EMAIL",
|
|
2984
|
+
label: "Email"
|
|
2985
|
+
},
|
|
2986
|
+
validation: {
|
|
2987
|
+
string: {
|
|
2988
|
+
format: "EMAIL"
|
|
2989
|
+
}
|
|
2990
|
+
},
|
|
2991
|
+
pii: true
|
|
2992
|
+
}
|
|
2993
|
+
],
|
|
2994
|
+
steps: [
|
|
2995
|
+
{
|
|
2996
|
+
id: "a2d7f252-701b-442f-ff04-4cc14aacd2be",
|
|
2997
|
+
name: "Page 1",
|
|
2998
|
+
layout: {
|
|
2999
|
+
large: {
|
|
3000
|
+
items: [
|
|
3001
|
+
{
|
|
3002
|
+
fieldId: "30afbc7f-6266-4a3d-7f48-3de4a7c7d165",
|
|
3003
|
+
column: 0,
|
|
3004
|
+
row: 3,
|
|
3005
|
+
width: 12,
|
|
3006
|
+
height: 1
|
|
3007
|
+
},
|
|
3008
|
+
{
|
|
3009
|
+
fieldId: "b27f777f-f3d6-42b0-0034-acf363d16aa5",
|
|
3010
|
+
column: 0,
|
|
3011
|
+
row: 0,
|
|
3012
|
+
width: 12,
|
|
3013
|
+
height: 1
|
|
3014
|
+
},
|
|
3015
|
+
{
|
|
3016
|
+
fieldId: "ceae0b6e-1ee9-4f7c-ea64-2ff0966bf60d",
|
|
3017
|
+
column: 0,
|
|
3018
|
+
row: 1,
|
|
3019
|
+
width: 12,
|
|
3020
|
+
height: 1
|
|
3021
|
+
},
|
|
3022
|
+
{
|
|
3023
|
+
fieldId: "2e1e030b-ca2a-44dd-4116-16a4a53db1a8",
|
|
3024
|
+
column: 0,
|
|
3025
|
+
row: 2,
|
|
3026
|
+
width: 12,
|
|
3027
|
+
height: 1
|
|
3028
|
+
}
|
|
3029
|
+
]
|
|
3030
|
+
}
|
|
3031
|
+
}
|
|
3032
|
+
}
|
|
3033
|
+
],
|
|
3034
|
+
properties: {
|
|
3035
|
+
name: "My Form"
|
|
3036
|
+
},
|
|
3037
|
+
submitSettings: {
|
|
3038
|
+
submitSuccessAction: "THANK_YOU_MESSAGE",
|
|
3039
|
+
thankYouMessageOptions: {
|
|
3040
|
+
richContent: {
|
|
3041
|
+
nodes: [
|
|
3042
|
+
{
|
|
3043
|
+
type: "PARAGRAPH",
|
|
3044
|
+
id: "1dbu62",
|
|
3045
|
+
nodes: [
|
|
3046
|
+
{
|
|
3047
|
+
type: "TEXT",
|
|
3048
|
+
id: "",
|
|
3049
|
+
nodes: [],
|
|
3050
|
+
textData: {
|
|
3051
|
+
text: "Thanks, we received your submission.",
|
|
3052
|
+
decorations: []
|
|
3053
|
+
}
|
|
3054
|
+
}
|
|
3055
|
+
],
|
|
3056
|
+
paragraphData: {
|
|
3057
|
+
textStyle: {
|
|
3058
|
+
textAlignment: "CENTER"
|
|
3059
|
+
}
|
|
3060
|
+
}
|
|
3061
|
+
}
|
|
3062
|
+
],
|
|
3063
|
+
metadata: {
|
|
3064
|
+
version: 1,
|
|
3065
|
+
id: "7dc8e190-8f88-4977-af26-c0d9397ccdbc"
|
|
3066
|
+
}
|
|
3067
|
+
},
|
|
3068
|
+
durationInSeconds: 8
|
|
3069
|
+
}
|
|
3070
|
+
},
|
|
3071
|
+
nestedForms: [],
|
|
3072
|
+
deletedFields: [],
|
|
3073
|
+
postSubmissionTriggers: {
|
|
3074
|
+
upsertContact: {
|
|
3075
|
+
fieldsMapping: {
|
|
3076
|
+
first_name_620e: {
|
|
3077
|
+
contactField: "FIRST_NAME"
|
|
3078
|
+
},
|
|
3079
|
+
last_name_68b3: {
|
|
3080
|
+
contactField: "LAST_NAME"
|
|
3081
|
+
},
|
|
3082
|
+
email_4419: {
|
|
3083
|
+
contactField: "EMAIL",
|
|
3084
|
+
emailInfo: {
|
|
3085
|
+
tag: "UNTAGGED"
|
|
3086
|
+
}
|
|
3087
|
+
}
|
|
3088
|
+
},
|
|
3089
|
+
labels: []
|
|
3090
|
+
}
|
|
3091
|
+
}
|
|
3092
|
+
};
|
|
3093
|
+
var installFormsApp = async (env) => {
|
|
3094
|
+
console.log(
|
|
3095
|
+
`[${VERTICAL_NAME}-plugin-install] Installing vertical functionality...`,
|
|
3096
|
+
env
|
|
3097
|
+
);
|
|
3098
|
+
await installWixApp(FORMS_APP_DEF_ID, env.WIX_SITE_ID);
|
|
3099
|
+
console.log(
|
|
3100
|
+
`[${VERTICAL_NAME}-plugin-install] Forms app installation completed`
|
|
3101
|
+
);
|
|
3102
|
+
};
|
|
3103
|
+
var unzipAndMergeParastoragePluginFiles = async (env, zipUrl) => {
|
|
3104
|
+
console.log(
|
|
3105
|
+
`[${VERTICAL_NAME}-plugin-install] Unzipping plugin files from dependency...`
|
|
3106
|
+
);
|
|
3107
|
+
const zipPath = path__namespace.join(process.cwd(), "picasso-forms-plugin-files.zip");
|
|
3108
|
+
const targetDir = path__namespace.join(env.CODEGEN_APP_ROOT, "src");
|
|
3109
|
+
try {
|
|
3110
|
+
console.log(
|
|
3111
|
+
`[${VERTICAL_NAME}-plugin-install] downloading zip file to:`,
|
|
3112
|
+
zipPath
|
|
3113
|
+
);
|
|
3114
|
+
await downloadZipFile(zipUrl, zipPath);
|
|
3115
|
+
const zip = new import_adm_zip.default(zipPath);
|
|
3116
|
+
console.log(`[${VERTICAL_NAME}-plugin-install] Unzipping files...`);
|
|
3117
|
+
zip.getEntries().forEach((entry) => {
|
|
3118
|
+
if (!entry.isDirectory) {
|
|
3119
|
+
const entryPath = entry.entryName;
|
|
3120
|
+
const targetPath = path__namespace.join(targetDir, entryPath);
|
|
3121
|
+
const targetDirPath = path__namespace.dirname(targetPath);
|
|
3122
|
+
if (!fs__namespace.existsSync(targetDirPath)) {
|
|
3123
|
+
fs__namespace.mkdirSync(targetDirPath, { recursive: true });
|
|
3124
|
+
}
|
|
3125
|
+
fs__namespace.writeFileSync(targetPath, entry.getData());
|
|
3126
|
+
console.log(
|
|
3127
|
+
`[${VERTICAL_NAME}-plugin-install] Extracted: ${targetPath}`
|
|
3128
|
+
);
|
|
3129
|
+
}
|
|
3130
|
+
});
|
|
3131
|
+
console.log(
|
|
3132
|
+
`[${VERTICAL_NAME}-plugin-install] Plugin files unzipped and merged successfully`
|
|
3133
|
+
);
|
|
3134
|
+
} catch (error) {
|
|
3135
|
+
console.log(
|
|
3136
|
+
`[${VERTICAL_NAME}-plugin-install] Error downloading or unzipping plugin files:`,
|
|
3137
|
+
error
|
|
3138
|
+
);
|
|
3139
|
+
throw error;
|
|
3140
|
+
}
|
|
3141
|
+
};
|
|
3142
|
+
var unzipAndMergePluginFiles = async (env, useLocal = false) => {
|
|
3143
|
+
if (useLocal) {
|
|
3144
|
+
return unzipAndMergeLocalPluginFiles(
|
|
3145
|
+
env,
|
|
3146
|
+
"/Users/laurale/vibe-plugins/plugins/forms/vibe-forms-plugin-files/dist/statics/forms-plugin-files-files.zip"
|
|
3147
|
+
);
|
|
3148
|
+
} else {
|
|
3149
|
+
return unzipAndMergeParastoragePluginFiles(env, PLUGIN_FILES_ZIP_URL);
|
|
3150
|
+
}
|
|
3151
|
+
};
|
|
3152
|
+
var unzipAndMergeLocalPluginFiles = async (env, zipPath) => {
|
|
3153
|
+
console.log(
|
|
3154
|
+
`[${VERTICAL_NAME}-plugin-install] Unzipping plugin files from local file...`
|
|
3155
|
+
);
|
|
3156
|
+
const targetDir = path__namespace.join(env.CODEGEN_APP_ROOT, "src");
|
|
3157
|
+
try {
|
|
3158
|
+
console.log(
|
|
3159
|
+
`[${VERTICAL_NAME}-plugin-install] Using local zip file:`,
|
|
3160
|
+
zipPath
|
|
3161
|
+
);
|
|
3162
|
+
if (!fs__namespace.existsSync(zipPath)) {
|
|
3163
|
+
throw new Error(`Local zip file not found at: ${zipPath}`);
|
|
3164
|
+
}
|
|
3165
|
+
const zip = new import_adm_zip.default(zipPath);
|
|
3166
|
+
console.log(`[${VERTICAL_NAME}-plugin-install] Unzipping files...`);
|
|
3167
|
+
zip.getEntries().forEach((entry) => {
|
|
3168
|
+
if (!entry.isDirectory) {
|
|
3169
|
+
const entryPath = entry.entryName;
|
|
3170
|
+
const targetPath = path__namespace.join(targetDir, entryPath);
|
|
3171
|
+
const targetDirPath = path__namespace.dirname(targetPath);
|
|
3172
|
+
if (!fs__namespace.existsSync(targetDirPath)) {
|
|
3173
|
+
fs__namespace.mkdirSync(targetDirPath, { recursive: true });
|
|
3174
|
+
}
|
|
3175
|
+
fs__namespace.writeFileSync(targetPath, entry.getData());
|
|
3176
|
+
console.log(
|
|
3177
|
+
`[${VERTICAL_NAME}-plugin-install] Extracted: ${targetPath}`
|
|
3178
|
+
);
|
|
3179
|
+
}
|
|
3180
|
+
});
|
|
3181
|
+
console.log(
|
|
3182
|
+
`[${VERTICAL_NAME}-plugin-install] Plugin files unzipped and merged successfully`
|
|
3183
|
+
);
|
|
3184
|
+
} catch (error) {
|
|
3185
|
+
console.log(
|
|
3186
|
+
`[${VERTICAL_NAME}-plugin-install] Error unzipping plugin files:`,
|
|
3187
|
+
error
|
|
3188
|
+
);
|
|
3189
|
+
throw error;
|
|
3190
|
+
}
|
|
3191
|
+
};
|
|
3192
|
+
|
|
3193
|
+
// src/forms-app-instructions.ts
|
|
3194
|
+
var getContactPageExample = (formId) => {
|
|
3195
|
+
return dedent_default`
|
|
3196
|
+
// src/pages/ContactPage.tsx
|
|
3197
|
+
import { Form } from '@/components/forms/Form';
|
|
3198
|
+
|
|
3199
|
+
export function ContactPage() {
|
|
3200
|
+
return (
|
|
3201
|
+
<div className="max-w-4xl mx-auto px-4 py-8">
|
|
3202
|
+
<div className="text-center mb-12">
|
|
3203
|
+
<h1 className="font-heading text-4xl font-bold text-foreground mb-4">
|
|
3204
|
+
Contact Us
|
|
3205
|
+
</h1>
|
|
3206
|
+
<p className="text-lg text-secondary-foreground">
|
|
3207
|
+
We'd love to hear from you. Send us a message and we'll respond as soon as possible.
|
|
3208
|
+
</p>
|
|
3209
|
+
</div>
|
|
3210
|
+
|
|
3211
|
+
<div className="max-w-2xl mx-auto">
|
|
3212
|
+
{/* Contact Form */}
|
|
3213
|
+
<div className="bg-background border border-foreground rounded-lg p-8">
|
|
3214
|
+
<h2 className="font-heading text-2xl font-semibold text-foreground mb-6">
|
|
3215
|
+
Send us a Message
|
|
3216
|
+
</h2>
|
|
3217
|
+
{/* Use the formId from generated data */}
|
|
3218
|
+
<Form formServiceConfig={{ formId: "${formId}" }} />
|
|
3219
|
+
</div>
|
|
3220
|
+
</div>
|
|
3221
|
+
</div>
|
|
3222
|
+
);
|
|
3223
|
+
}
|
|
3224
|
+
`;
|
|
3225
|
+
};
|
|
3226
|
+
var getFormsCodingInstructions = (generatedData) => {
|
|
3227
|
+
const { formId, purpose } = generatedData;
|
|
3228
|
+
return dedent_default`
|
|
3229
|
+
<forms_instructions>
|
|
3230
|
+
|
|
3231
|
+
Your tasks for implementing and integrating the Forms features of the site are:
|
|
3232
|
+
|
|
3233
|
+
# FIRST TASK: Analyze pages and determine form placement
|
|
3234
|
+
|
|
3235
|
+
Analyze site pages and determine the best location for the form based on the purpose of the form: ${purpose}.
|
|
3236
|
+
|
|
3237
|
+
**Common page types for forms:**
|
|
3238
|
+
- **Contact page** - Perfect for contact forms, inquiry forms
|
|
3239
|
+
- **About page** - Good for contact or feedback forms
|
|
3240
|
+
- **Homepage** - Suitable for lead generation or newsletter signup
|
|
3241
|
+
|
|
3242
|
+
# SECOND TASK: Integrate Form component into the page
|
|
3243
|
+
|
|
3244
|
+
Import Form component:
|
|
3245
|
+
\`\`\`tsx
|
|
3246
|
+
import { Form } from "@wix/forms/components";
|
|
3247
|
+
\`\`\`
|
|
3248
|
+
|
|
3249
|
+
Place Form component in appropriate place in the page. Ensure that the formId ${formId} is passed to the Form component:
|
|
3250
|
+
\`\`\`tsx
|
|
3251
|
+
<Form formServiceConfig={{ formId: "${formId}" }} />
|
|
3252
|
+
\`\`\`
|
|
3253
|
+
|
|
3254
|
+
**Example for integrating a contact form into a contact page:**
|
|
3255
|
+
|
|
3256
|
+
\`\`\`tsx
|
|
3257
|
+
${getContactPageExample(formId)}
|
|
3258
|
+
\`\`\`
|
|
3259
|
+
</forms_instructions>
|
|
3260
|
+
`;
|
|
3261
|
+
};
|
|
3262
|
+
|
|
3263
|
+
// ../../../node_modules/@wix/sdk-runtime/build/constants.js
|
|
3264
|
+
var WIX_PROTOCOL = "wix:";
|
|
3265
|
+
var SDKRequestToRESTRequestRenameMap = {
|
|
3266
|
+
_id: "id",
|
|
3267
|
+
_createdDate: "createdDate",
|
|
3268
|
+
_updatedDate: "updatedDate"
|
|
3269
|
+
};
|
|
2719
3270
|
var RESTResponseToSDKResponseRenameMap = {
|
|
2720
3271
|
id: "_id",
|
|
2721
3272
|
createdDate: "_createdDate",
|
|
2722
3273
|
updatedDate: "_updatedDate"
|
|
2723
3274
|
};
|
|
3275
|
+
var ITEMS_RESULT_PROPERTY_NAME = "items";
|
|
3276
|
+
var PAGING_METADATA_RESULT_PROPERTY_NAME = "pagingMetadata";
|
|
3277
|
+
var DEFAULT_LIMIT = 50;
|
|
2724
3278
|
|
|
2725
|
-
// ../../../node_modules/@wix/
|
|
3279
|
+
// ../../../node_modules/@wix/sdk-runtime/build/rename-all-nested-keys.js
|
|
2726
3280
|
function renameAllNestedKeys(payload, renameMap, ignorePaths) {
|
|
2727
3281
|
const isIgnored = (path2) => ignorePaths.includes(path2);
|
|
2728
3282
|
const traverse = (obj, path2) => {
|
|
@@ -2748,16 +3302,22 @@ function renameAllNestedKeys(payload, renameMap, ignorePaths) {
|
|
|
2748
3302
|
traverse(payload, "");
|
|
2749
3303
|
return payload;
|
|
2750
3304
|
}
|
|
3305
|
+
function renameKeysFromSDKRequestToRESTRequest(payload, ignorePaths = []) {
|
|
3306
|
+
return renameAllNestedKeys(payload, SDKRequestToRESTRequestRenameMap, ignorePaths);
|
|
3307
|
+
}
|
|
2751
3308
|
function renameKeysFromRESTResponseToSDKResponse(payload, ignorePaths = []) {
|
|
2752
3309
|
return renameAllNestedKeys(payload, RESTResponseToSDKResponseRenameMap, ignorePaths);
|
|
2753
3310
|
}
|
|
2754
3311
|
|
|
2755
|
-
// ../../../node_modules/@wix/
|
|
3312
|
+
// ../../../node_modules/@wix/sdk-runtime/build/transformations/timestamp.js
|
|
3313
|
+
function transformSDKTimestampToRESTTimestamp(val) {
|
|
3314
|
+
return val?.toISOString();
|
|
3315
|
+
}
|
|
2756
3316
|
function transformRESTTimestampToSDKTimestamp(val) {
|
|
2757
3317
|
return val ? new Date(val) : void 0;
|
|
2758
3318
|
}
|
|
2759
3319
|
|
|
2760
|
-
// ../../../node_modules/@wix/
|
|
3320
|
+
// ../../../node_modules/@wix/sdk-runtime/build/transformations/transform-paths.js
|
|
2761
3321
|
function transformPath(obj, { path: path2, isRepeated, isMap }, transformFn) {
|
|
2762
3322
|
const pathParts = path2.split(".");
|
|
2763
3323
|
if (pathParts.length === 1 && path2 in obj) {
|
|
@@ -2798,340 +3358,7 @@ function EventDefinition(type, isDomainEvent = false, transformations = (x) => x
|
|
|
2798
3358
|
}
|
|
2799
3359
|
var SERVICE_PLUGIN_ERROR_TYPE = "wix_spi_error";
|
|
2800
3360
|
|
|
2801
|
-
// ../../../node_modules/@wix/sdk-
|
|
2802
|
-
var wixContext = {};
|
|
2803
|
-
|
|
2804
|
-
// ../../../node_modules/@wix/auto_sdk_forms_interactive-form-sessions/node_modules/@wix/sdk-runtime/build/context.js
|
|
2805
|
-
function resolveContext() {
|
|
2806
|
-
const oldContext = typeof $wixContext !== "undefined" && $wixContext.initWixModules ? $wixContext.initWixModules : typeof globalThis.__wix_context__ !== "undefined" && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
2807
|
-
if (oldContext) {
|
|
2808
|
-
return {
|
|
2809
|
-
// @ts-expect-error
|
|
2810
|
-
initWixModules(modules, elevated) {
|
|
2811
|
-
return runWithoutContext(() => oldContext(modules, elevated));
|
|
2812
|
-
},
|
|
2813
|
-
fetchWithAuth() {
|
|
2814
|
-
throw new Error("fetchWithAuth is not available in this context");
|
|
2815
|
-
},
|
|
2816
|
-
graphql() {
|
|
2817
|
-
throw new Error("graphql is not available in this context");
|
|
2818
|
-
}
|
|
2819
|
-
};
|
|
2820
|
-
}
|
|
2821
|
-
const contextualClient = typeof $wixContext !== "undefined" ? $wixContext.client : typeof wixContext.client !== "undefined" ? wixContext.client : typeof globalThis.__wix_context__ !== "undefined" ? globalThis.__wix_context__.client : void 0;
|
|
2822
|
-
const elevatedClient = typeof $wixContext !== "undefined" ? $wixContext.elevatedClient : typeof wixContext.elevatedClient !== "undefined" ? wixContext.elevatedClient : typeof globalThis.__wix_context__ !== "undefined" ? globalThis.__wix_context__.elevatedClient : void 0;
|
|
2823
|
-
if (!contextualClient && !elevatedClient) {
|
|
2824
|
-
return;
|
|
2825
|
-
}
|
|
2826
|
-
return {
|
|
2827
|
-
initWixModules(wixModules, elevated) {
|
|
2828
|
-
if (elevated) {
|
|
2829
|
-
if (!elevatedClient) {
|
|
2830
|
-
throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");
|
|
2831
|
-
}
|
|
2832
|
-
return runWithoutContext(() => elevatedClient.use(wixModules));
|
|
2833
|
-
}
|
|
2834
|
-
if (!contextualClient) {
|
|
2835
|
-
throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
|
|
2836
|
-
}
|
|
2837
|
-
return runWithoutContext(() => contextualClient.use(wixModules));
|
|
2838
|
-
},
|
|
2839
|
-
fetchWithAuth: (urlOrRequest, requestInit) => {
|
|
2840
|
-
if (!contextualClient) {
|
|
2841
|
-
throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
|
|
2842
|
-
}
|
|
2843
|
-
return contextualClient.fetchWithAuth(urlOrRequest, requestInit);
|
|
2844
|
-
},
|
|
2845
|
-
getAuth() {
|
|
2846
|
-
if (!contextualClient) {
|
|
2847
|
-
throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
|
|
2848
|
-
}
|
|
2849
|
-
return contextualClient.auth;
|
|
2850
|
-
},
|
|
2851
|
-
async graphql(query, variables, opts) {
|
|
2852
|
-
if (!contextualClient) {
|
|
2853
|
-
throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
|
|
2854
|
-
}
|
|
2855
|
-
return contextualClient.graphql(query, variables, opts);
|
|
2856
|
-
}
|
|
2857
|
-
};
|
|
2858
|
-
}
|
|
2859
|
-
function runWithoutContext(fn) {
|
|
2860
|
-
const globalContext = globalThis.__wix_context__;
|
|
2861
|
-
const moduleContext = {
|
|
2862
|
-
client: wixContext.client,
|
|
2863
|
-
elevatedClient: wixContext.elevatedClient
|
|
2864
|
-
};
|
|
2865
|
-
let closureContext;
|
|
2866
|
-
globalThis.__wix_context__ = void 0;
|
|
2867
|
-
wixContext.client = void 0;
|
|
2868
|
-
wixContext.elevatedClient = void 0;
|
|
2869
|
-
if (typeof $wixContext !== "undefined") {
|
|
2870
|
-
closureContext = {
|
|
2871
|
-
client: $wixContext?.client,
|
|
2872
|
-
elevatedClient: $wixContext?.elevatedClient
|
|
2873
|
-
};
|
|
2874
|
-
delete $wixContext.client;
|
|
2875
|
-
delete $wixContext.elevatedClient;
|
|
2876
|
-
}
|
|
2877
|
-
try {
|
|
2878
|
-
return fn();
|
|
2879
|
-
} finally {
|
|
2880
|
-
globalThis.__wix_context__ = globalContext;
|
|
2881
|
-
wixContext.client = moduleContext.client;
|
|
2882
|
-
wixContext.elevatedClient = moduleContext.elevatedClient;
|
|
2883
|
-
if (typeof $wixContext !== "undefined") {
|
|
2884
|
-
$wixContext.client = closureContext.client;
|
|
2885
|
-
$wixContext.elevatedClient = closureContext.elevatedClient;
|
|
2886
|
-
}
|
|
2887
|
-
}
|
|
2888
|
-
}
|
|
2889
|
-
|
|
2890
|
-
// ../../../node_modules/@wix/auto_sdk_forms_interactive-form-sessions/node_modules/@wix/sdk-runtime/build/context-v2.js
|
|
2891
|
-
function contextualizeEventDefinitionModuleV2(eventDefinition) {
|
|
2892
|
-
const contextualMethod = ((...args) => {
|
|
2893
|
-
const context = resolveContext();
|
|
2894
|
-
if (!context) {
|
|
2895
|
-
return () => {
|
|
2896
|
-
};
|
|
2897
|
-
}
|
|
2898
|
-
return context.initWixModules(eventDefinition).apply(void 0, args);
|
|
2899
|
-
});
|
|
2900
|
-
contextualMethod.__type = eventDefinition.__type;
|
|
2901
|
-
contextualMethod.type = eventDefinition.type;
|
|
2902
|
-
contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;
|
|
2903
|
-
contextualMethod.transformations = eventDefinition.transformations;
|
|
2904
|
-
return contextualMethod;
|
|
2905
|
-
}
|
|
2906
|
-
|
|
2907
|
-
// ../../../node_modules/@wix/auto_sdk_forms_interactive-form-sessions/node_modules/@wix/sdk-runtime/build/event-definition-modules.js
|
|
2908
|
-
function createEventModule(eventDefinition) {
|
|
2909
|
-
return contextualizeEventDefinitionModuleV2(eventDefinition);
|
|
2910
|
-
}
|
|
2911
|
-
|
|
2912
|
-
// ../../../node_modules/@wix/auto_sdk_forms_interactive-form-sessions/build/es/index.mjs
|
|
2913
|
-
var onInteractiveFormSessionCreated = EventDefinition(
|
|
2914
|
-
"wix.forms.ai.v1.interactive_form_session_created",
|
|
2915
|
-
true,
|
|
2916
|
-
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
2917
|
-
transformPaths(event, [
|
|
2918
|
-
{
|
|
2919
|
-
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
2920
|
-
paths: [{ path: "metadata.eventTime" }]
|
|
2921
|
-
}
|
|
2922
|
-
])
|
|
2923
|
-
)
|
|
2924
|
-
)();
|
|
2925
|
-
createEventModule(
|
|
2926
|
-
onInteractiveFormSessionCreated
|
|
2927
|
-
);
|
|
2928
|
-
|
|
2929
|
-
// ../../../node_modules/@wix/auto_sdk_forms_forms/build/es/index.mjs
|
|
2930
|
-
var es_exports = {};
|
|
2931
|
-
__export(es_exports, {
|
|
2932
|
-
AddressInfoTag: () => AddressInfoTag,
|
|
2933
|
-
Alignment: () => Alignment,
|
|
2934
|
-
AppType: () => AppType,
|
|
2935
|
-
ArrayComponentType: () => ArrayComponentType,
|
|
2936
|
-
ArrayItemsItemType: () => ArrayItemsItemType,
|
|
2937
|
-
AspectRatio: () => AspectRatio,
|
|
2938
|
-
BackgroundType: () => BackgroundType,
|
|
2939
|
-
BooleanComponentType: () => BooleanComponentType,
|
|
2940
|
-
ButtonDataType: () => ButtonDataType,
|
|
2941
|
-
CardStylesAlignment: () => CardStylesAlignment,
|
|
2942
|
-
CardStylesType: () => CardStylesType,
|
|
2943
|
-
ChangeableProperty: () => ChangeableProperty,
|
|
2944
|
-
ComponentType: () => ComponentType,
|
|
2945
|
-
ConfirmationLevel: () => ConfirmationLevel,
|
|
2946
|
-
ContactField: () => ContactField,
|
|
2947
|
-
CountFormsFieldset: () => CountFormsFieldset,
|
|
2948
|
-
Crop: () => Crop,
|
|
2949
|
-
DecorationType: () => DecorationType,
|
|
2950
|
-
Direction: () => Direction,
|
|
2951
|
-
DisplayFieldDisplayFieldType: () => DisplayFieldDisplayFieldType,
|
|
2952
|
-
DisplayFieldType: () => DisplayFieldType,
|
|
2953
|
-
DividerDataAlignment: () => DividerDataAlignment,
|
|
2954
|
-
EmailInfoTag: () => EmailInfoTag,
|
|
2955
|
-
FieldInputType: () => FieldInputType,
|
|
2956
|
-
FieldType: () => FieldType,
|
|
2957
|
-
Fieldset: () => Fieldset,
|
|
2958
|
-
FilterType: () => FilterType,
|
|
2959
|
-
FirstDayOfWeek: () => FirstDayOfWeek,
|
|
2960
|
-
FontType: () => FontType,
|
|
2961
|
-
FormFieldContactInfoContactField: () => FormFieldContactInfoContactField,
|
|
2962
|
-
FormFieldContactInfoEmailInfoTag: () => FormFieldContactInfoEmailInfoTag,
|
|
2963
|
-
FormFieldContactInfoPhoneInfoTag: () => FormFieldContactInfoPhoneInfoTag,
|
|
2964
|
-
FormFieldV2FieldType: () => FormFieldV2FieldType,
|
|
2965
|
-
Format: () => Format,
|
|
2966
|
-
FormatEnumFormat: () => FormatEnumFormat,
|
|
2967
|
-
GIFType: () => GIFType,
|
|
2968
|
-
ImageFit: () => ImageFit,
|
|
2969
|
-
ImagePosition: () => ImagePosition,
|
|
2970
|
-
InitialExpandedItems: () => InitialExpandedItems,
|
|
2971
|
-
InputFieldArrayComponentType: () => InputFieldArrayComponentType,
|
|
2972
|
-
InputFieldBooleanComponentType: () => InputFieldBooleanComponentType,
|
|
2973
|
-
InputFieldInputType: () => InputFieldInputType,
|
|
2974
|
-
InputFieldNumberComponentType: () => InputFieldNumberComponentType,
|
|
2975
|
-
InputFieldPaymentComponentType: () => InputFieldPaymentComponentType,
|
|
2976
|
-
InputFieldSchedulingComponentType: () => InputFieldSchedulingComponentType,
|
|
2977
|
-
InputFieldStringComponentType: () => InputFieldStringComponentType,
|
|
2978
|
-
InputFieldStringTypeFormatEnumFormat: () => InputFieldStringTypeFormatEnumFormat,
|
|
2979
|
-
InputFieldWixFileComponentType: () => InputFieldWixFileComponentType,
|
|
2980
|
-
InputType: () => InputType,
|
|
2981
|
-
ItemType: () => ItemType,
|
|
2982
|
-
Kind: () => Kind,
|
|
2983
|
-
Layout: () => Layout,
|
|
2984
|
-
LayoutType: () => LayoutType,
|
|
2985
|
-
LineStyle: () => LineStyle,
|
|
2986
|
-
LinkTarget: () => LinkTarget,
|
|
2987
|
-
ListDeletedFormsOrder: () => ListDeletedFormsOrder,
|
|
2988
|
-
ListFormsOrder: () => ListFormsOrder,
|
|
2989
|
-
ListFormsRequestListFormsOrder: () => ListFormsRequestListFormsOrder,
|
|
2990
|
-
MapType: () => MapType,
|
|
2991
|
-
MultilineAddressComponentType: () => MultilineAddressComponentType,
|
|
2992
|
-
NodeType: () => NodeType,
|
|
2993
|
-
NullValue: () => NullValue,
|
|
2994
|
-
NumberComponentType: () => NumberComponentType,
|
|
2995
|
-
NumberOfColumns: () => NumberOfColumns,
|
|
2996
|
-
ObjectArrayComponentType: () => ObjectArrayComponentType,
|
|
2997
|
-
Operator: () => Operator,
|
|
2998
|
-
OptInLevel: () => OptInLevel,
|
|
2999
|
-
Orientation: () => Orientation,
|
|
3000
|
-
OverrideEntityType: () => OverrideEntityType,
|
|
3001
|
-
OverrideEntityTypeEnumOverrideEntityType: () => OverrideEntityTypeEnumOverrideEntityType,
|
|
3002
|
-
PaymentComponentType: () => PaymentComponentType,
|
|
3003
|
-
PhoneInfoTag: () => PhoneInfoTag,
|
|
3004
|
-
Placement: () => Placement,
|
|
3005
|
-
PluginContainerDataAlignment: () => PluginContainerDataAlignment,
|
|
3006
|
-
PollLayoutDirection: () => PollLayoutDirection,
|
|
3007
|
-
PollLayoutType: () => PollLayoutType,
|
|
3008
|
-
Position: () => Position,
|
|
3009
|
-
PriceType: () => PriceType,
|
|
3010
|
-
ProductType: () => ProductType,
|
|
3011
|
-
PropertiesTypeEnum: () => PropertiesTypeEnum,
|
|
3012
|
-
PropertiesTypePropertiesTypeEnum: () => PropertiesTypePropertiesTypeEnum,
|
|
3013
|
-
RequiredIndicator: () => RequiredIndicator,
|
|
3014
|
-
RequiredIndicatorPlacement: () => RequiredIndicatorPlacement,
|
|
3015
|
-
Resizing: () => Resizing,
|
|
3016
|
-
SchedulingComponentType: () => SchedulingComponentType,
|
|
3017
|
-
SortOrder: () => SortOrder,
|
|
3018
|
-
Source: () => Source,
|
|
3019
|
-
SpamFilterProtectionLevel: () => SpamFilterProtectionLevel,
|
|
3020
|
-
StringComponentType: () => StringComponentType,
|
|
3021
|
-
StringTypeFormatEnumFormat: () => StringTypeFormatEnumFormat,
|
|
3022
|
-
StylesPosition: () => StylesPosition,
|
|
3023
|
-
SubmitSuccessAction: () => SubmitSuccessAction,
|
|
3024
|
-
Tag: () => Tag,
|
|
3025
|
-
Target: () => Target,
|
|
3026
|
-
TextAlignment: () => TextAlignment,
|
|
3027
|
-
ThumbnailsAlignment: () => ThumbnailsAlignment,
|
|
3028
|
-
Type: () => Type,
|
|
3029
|
-
UploadFileFormat: () => UploadFileFormat,
|
|
3030
|
-
ValidationFormat: () => ValidationFormat,
|
|
3031
|
-
VerticalAlignment: () => VerticalAlignment,
|
|
3032
|
-
ViewMode: () => ViewMode,
|
|
3033
|
-
ViewRole: () => ViewRole,
|
|
3034
|
-
VoteRole: () => VoteRole,
|
|
3035
|
-
WebhookIdentityType: () => WebhookIdentityType,
|
|
3036
|
-
Width: () => Width,
|
|
3037
|
-
WidthType: () => WidthType,
|
|
3038
|
-
WixFileComponentType: () => WixFileComponentType,
|
|
3039
|
-
bulkCloneForm: () => bulkCloneForm4,
|
|
3040
|
-
bulkCreateForm: () => bulkCreateForm4,
|
|
3041
|
-
bulkDeleteForm: () => bulkDeleteForm4,
|
|
3042
|
-
bulkRemoveDeletedField: () => bulkRemoveDeletedField4,
|
|
3043
|
-
cloneForm: () => cloneForm4,
|
|
3044
|
-
countDeletedForms: () => countDeletedForms4,
|
|
3045
|
-
countFormsByFilter: () => countFormsByFilter4,
|
|
3046
|
-
createForm: () => createForm4,
|
|
3047
|
-
deleteForm: () => deleteForm4,
|
|
3048
|
-
getDeletedForm: () => getDeletedForm4,
|
|
3049
|
-
getForm: () => getForm4,
|
|
3050
|
-
getFormSummary: () => getFormSummary4,
|
|
3051
|
-
listDeletedForms: () => listDeletedForms4,
|
|
3052
|
-
listForms: () => listForms4,
|
|
3053
|
-
listFormsProvidersConfigs: () => listFormsProvidersConfigs4,
|
|
3054
|
-
onFormCreated: () => onFormCreated2,
|
|
3055
|
-
onFormDeleted: () => onFormDeleted2,
|
|
3056
|
-
onFormDisabledForm: () => onFormDisabledForm2,
|
|
3057
|
-
onFormEnabledForm: () => onFormEnabledForm2,
|
|
3058
|
-
onFormTranslationChanged: () => onFormTranslationChanged2,
|
|
3059
|
-
onFormTranslationDeleted: () => onFormTranslationDeleted2,
|
|
3060
|
-
onFormUpdated: () => onFormUpdated2,
|
|
3061
|
-
queryDeletedForms: () => queryDeletedForms4,
|
|
3062
|
-
queryForms: () => queryForms4,
|
|
3063
|
-
removeFormFromTrashBin: () => removeFormFromTrashBin4,
|
|
3064
|
-
restoreFromTrashBin: () => restoreFromTrashBin4,
|
|
3065
|
-
updateForm: () => updateForm4
|
|
3066
|
-
});
|
|
3067
|
-
|
|
3068
|
-
// ../../../node_modules/@wix/auto_sdk_forms_forms/node_modules/@wix/sdk-runtime/build/constants.js
|
|
3069
|
-
var WIX_PROTOCOL = "wix:";
|
|
3070
|
-
var SDKRequestToRESTRequestRenameMap2 = {
|
|
3071
|
-
_id: "id",
|
|
3072
|
-
_createdDate: "createdDate",
|
|
3073
|
-
_updatedDate: "updatedDate"
|
|
3074
|
-
};
|
|
3075
|
-
var RESTResponseToSDKResponseRenameMap2 = {
|
|
3076
|
-
id: "_id",
|
|
3077
|
-
createdDate: "_createdDate",
|
|
3078
|
-
updatedDate: "_updatedDate"
|
|
3079
|
-
};
|
|
3080
|
-
var ITEMS_RESULT_PROPERTY_NAME = "items";
|
|
3081
|
-
var PAGING_METADATA_RESULT_PROPERTY_NAME = "pagingMetadata";
|
|
3082
|
-
var DEFAULT_LIMIT = 50;
|
|
3083
|
-
|
|
3084
|
-
// ../../../node_modules/@wix/auto_sdk_forms_forms/node_modules/@wix/sdk-runtime/build/rename-all-nested-keys.js
|
|
3085
|
-
function renameAllNestedKeys2(payload, renameMap, ignorePaths) {
|
|
3086
|
-
const isIgnored = (path2) => ignorePaths.includes(path2);
|
|
3087
|
-
const traverse = (obj, path2) => {
|
|
3088
|
-
if (Array.isArray(obj)) {
|
|
3089
|
-
obj.forEach((item) => {
|
|
3090
|
-
traverse(item, path2);
|
|
3091
|
-
});
|
|
3092
|
-
} else if (typeof obj === "object" && obj !== null) {
|
|
3093
|
-
const objAsRecord = obj;
|
|
3094
|
-
Object.keys(objAsRecord).forEach((key) => {
|
|
3095
|
-
const newPath = path2 === "" ? key : `${path2}.${key}`;
|
|
3096
|
-
if (isIgnored(newPath)) {
|
|
3097
|
-
return;
|
|
3098
|
-
}
|
|
3099
|
-
if (key in renameMap && !(renameMap[key] in objAsRecord)) {
|
|
3100
|
-
objAsRecord[renameMap[key]] = objAsRecord[key];
|
|
3101
|
-
delete objAsRecord[key];
|
|
3102
|
-
}
|
|
3103
|
-
traverse(objAsRecord[key], newPath);
|
|
3104
|
-
});
|
|
3105
|
-
}
|
|
3106
|
-
};
|
|
3107
|
-
traverse(payload, "");
|
|
3108
|
-
return payload;
|
|
3109
|
-
}
|
|
3110
|
-
function renameKeysFromSDKRequestToRESTRequest(payload, ignorePaths = []) {
|
|
3111
|
-
return renameAllNestedKeys2(payload, SDKRequestToRESTRequestRenameMap2, ignorePaths);
|
|
3112
|
-
}
|
|
3113
|
-
function renameKeysFromRESTResponseToSDKResponse2(payload, ignorePaths = []) {
|
|
3114
|
-
return renameAllNestedKeys2(payload, RESTResponseToSDKResponseRenameMap2, ignorePaths);
|
|
3115
|
-
}
|
|
3116
|
-
|
|
3117
|
-
// ../../../node_modules/@wix/auto_sdk_forms_forms/node_modules/@wix/sdk-runtime/build/transformations/float.js
|
|
3118
|
-
function transformSDKFloatToRESTFloat(val) {
|
|
3119
|
-
return isFinite(val) ? val : val.toString();
|
|
3120
|
-
}
|
|
3121
|
-
function transformRESTFloatToSDKFloat(val) {
|
|
3122
|
-
if (val === "NaN") {
|
|
3123
|
-
return NaN;
|
|
3124
|
-
}
|
|
3125
|
-
if (val === "Infinity") {
|
|
3126
|
-
return Infinity;
|
|
3127
|
-
}
|
|
3128
|
-
if (val === "-Infinity") {
|
|
3129
|
-
return -Infinity;
|
|
3130
|
-
}
|
|
3131
|
-
return val;
|
|
3132
|
-
}
|
|
3133
|
-
|
|
3134
|
-
// ../../../node_modules/@wix/auto_sdk_forms_forms/node_modules/@wix/sdk-runtime/build/utils.js
|
|
3361
|
+
// ../../../node_modules/@wix/sdk-runtime/build/utils.js
|
|
3135
3362
|
function alignIfLegacy(url, type) {
|
|
3136
3363
|
const { protocol } = new URL(url);
|
|
3137
3364
|
return protocol === `${type}:` ? `${WIX_PROTOCOL}${url}` : url;
|
|
@@ -3161,82 +3388,7 @@ function split(value) {
|
|
|
3161
3388
|
return result.slice(start, end).split(/\0/g);
|
|
3162
3389
|
}
|
|
3163
3390
|
|
|
3164
|
-
// ../../../node_modules/@wix/
|
|
3165
|
-
function transformSDKImageToRESTImage(val) {
|
|
3166
|
-
if (!val) {
|
|
3167
|
-
return;
|
|
3168
|
-
}
|
|
3169
|
-
const alignedImage = alignIfLegacy(val, "image");
|
|
3170
|
-
const { protocol, hash, pathname } = new URL(alignedImage);
|
|
3171
|
-
const params = new URLSearchParams(hash.replace("#", ""));
|
|
3172
|
-
const height = params.get("originHeight");
|
|
3173
|
-
const width = params.get("originWidth");
|
|
3174
|
-
const [id, filenameOrAltText] = pathname.replace(`image://v1/`, "").split("/");
|
|
3175
|
-
const decodedFilenameOrAltText = decodeURIComponent(filenameOrAltText);
|
|
3176
|
-
if (protocol === WIX_PROTOCOL) {
|
|
3177
|
-
const res = { id, height: Number(height), width: Number(width) };
|
|
3178
|
-
if (!decodedFilenameOrAltText) {
|
|
3179
|
-
return res;
|
|
3180
|
-
}
|
|
3181
|
-
return {
|
|
3182
|
-
...res,
|
|
3183
|
-
altText: decodedFilenameOrAltText,
|
|
3184
|
-
filename: decodedFilenameOrAltText,
|
|
3185
|
-
url: val
|
|
3186
|
-
};
|
|
3187
|
-
}
|
|
3188
|
-
return { url: val };
|
|
3189
|
-
}
|
|
3190
|
-
function transformRESTImageToSDKImage(payload) {
|
|
3191
|
-
if (!payload) {
|
|
3192
|
-
return;
|
|
3193
|
-
}
|
|
3194
|
-
let fileNameOrAltText = "";
|
|
3195
|
-
if (payload.filename || payload.altText) {
|
|
3196
|
-
fileNameOrAltText = `/${encodeURIComponent(payload.filename || payload.altText)}`;
|
|
3197
|
-
}
|
|
3198
|
-
return payload.id ? `wix:image://v1/${payload.id}${fileNameOrAltText}#originWidth=${payload.width}&originHeight=${payload.height}` : payload.url;
|
|
3199
|
-
}
|
|
3200
|
-
|
|
3201
|
-
// ../../../node_modules/@wix/auto_sdk_forms_forms/node_modules/@wix/sdk-runtime/build/transformations/timestamp.js
|
|
3202
|
-
function transformSDKTimestampToRESTTimestamp(val) {
|
|
3203
|
-
return val?.toISOString();
|
|
3204
|
-
}
|
|
3205
|
-
function transformRESTTimestampToSDKTimestamp2(val) {
|
|
3206
|
-
return val ? new Date(val) : void 0;
|
|
3207
|
-
}
|
|
3208
|
-
|
|
3209
|
-
// ../../../node_modules/@wix/auto_sdk_forms_forms/node_modules/@wix/sdk-runtime/build/transformations/transform-paths.js
|
|
3210
|
-
function transformPath2(obj, { path: path2, isRepeated, isMap }, transformFn) {
|
|
3211
|
-
const pathParts = path2.split(".");
|
|
3212
|
-
if (pathParts.length === 1 && path2 in obj) {
|
|
3213
|
-
obj[path2] = isRepeated ? obj[path2].map(transformFn) : isMap ? Object.fromEntries(Object.entries(obj[path2]).map(([key, value]) => [key, transformFn(value)])) : transformFn(obj[path2]);
|
|
3214
|
-
return obj;
|
|
3215
|
-
}
|
|
3216
|
-
const [first, ...rest] = pathParts;
|
|
3217
|
-
if (first.endsWith("{}")) {
|
|
3218
|
-
const cleanPath = first.slice(0, -2);
|
|
3219
|
-
obj[cleanPath] = Object.fromEntries(Object.entries(obj[cleanPath]).map(([key, value]) => [
|
|
3220
|
-
key,
|
|
3221
|
-
transformPath2(value, { path: rest.join("."), isRepeated, isMap }, transformFn)
|
|
3222
|
-
]));
|
|
3223
|
-
} else if (Array.isArray(obj[first])) {
|
|
3224
|
-
obj[first] = obj[first].map((item) => transformPath2(item, { path: rest.join("."), isRepeated, isMap }, transformFn));
|
|
3225
|
-
} else if (first in obj && typeof obj[first] === "object" && obj[first] !== null) {
|
|
3226
|
-
obj[first] = transformPath2(obj[first], { path: rest.join("."), isRepeated, isMap }, transformFn);
|
|
3227
|
-
} else if (first === "*") {
|
|
3228
|
-
Object.keys(obj).reduce((acc, curr) => {
|
|
3229
|
-
acc[curr] = transformPath2(obj[curr], { path: rest.join("."), isRepeated, isMap }, transformFn);
|
|
3230
|
-
return acc;
|
|
3231
|
-
}, obj);
|
|
3232
|
-
}
|
|
3233
|
-
return obj;
|
|
3234
|
-
}
|
|
3235
|
-
function transformPaths2(obj, transformations) {
|
|
3236
|
-
return transformations.reduce((acc, { paths, transformFn }) => paths.reduce((transformerAcc, path2) => transformPath2(transformerAcc, path2, transformFn), acc), obj);
|
|
3237
|
-
}
|
|
3238
|
-
|
|
3239
|
-
// ../../../node_modules/@wix/auto_sdk_forms_forms/node_modules/@wix/sdk-runtime/build/transform-error.js
|
|
3391
|
+
// ../../../node_modules/@wix/sdk-runtime/build/transform-error.js
|
|
3240
3392
|
var isValidationError = (httpClientError) => "validationError" in (httpClientError.response?.data?.details ?? {});
|
|
3241
3393
|
var isApplicationError = (httpClientError) => "applicationError" in (httpClientError.response?.data?.details ?? {});
|
|
3242
3394
|
var isClientError = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 && (httpClientError.response?.status ?? -1) < 500;
|
|
@@ -3391,7 +3543,7 @@ var getArgumentIndex = (s) => {
|
|
|
3391
3543
|
return match && match.groups && Number(match.groups.argIndex);
|
|
3392
3544
|
};
|
|
3393
3545
|
|
|
3394
|
-
// ../../../node_modules/@wix/
|
|
3546
|
+
// ../../../node_modules/@wix/sdk-runtime/build/query-filter.js
|
|
3395
3547
|
function isAndOperator(filter) {
|
|
3396
3548
|
return Object.keys(filter).length === 1 && "$and" in filter && Array.isArray(filter.$and);
|
|
3397
3549
|
}
|
|
@@ -3439,7 +3591,7 @@ function not(a) {
|
|
|
3439
3591
|
}
|
|
3440
3592
|
}
|
|
3441
3593
|
|
|
3442
|
-
// ../../../node_modules/@wix/
|
|
3594
|
+
// ../../../node_modules/@wix/sdk-runtime/build/query-iterators.js
|
|
3443
3595
|
var Iterator = class {
|
|
3444
3596
|
_items;
|
|
3445
3597
|
_fetchNextPage;
|
|
@@ -3528,7 +3680,7 @@ var OffsetBasedIterator = class extends Iterator {
|
|
|
3528
3680
|
}
|
|
3529
3681
|
};
|
|
3530
3682
|
|
|
3531
|
-
// ../../../node_modules/@wix/
|
|
3683
|
+
// ../../../node_modules/@wix/sdk-runtime/build/query-builder.js
|
|
3532
3684
|
function queryBuilder(opts) {
|
|
3533
3685
|
const createQueryBuilder = (query) => {
|
|
3534
3686
|
return {
|
|
@@ -3839,17 +3991,20 @@ function renameFieldByPaths(transformationPaths, fieldPath) {
|
|
|
3839
3991
|
if (transformationPath) {
|
|
3840
3992
|
return fieldPath.replace(transformationPath, transformationPaths[transformationPath]);
|
|
3841
3993
|
}
|
|
3842
|
-
return fieldPath.split(".").map((segment) => transformationPaths[segment] ??
|
|
3994
|
+
return fieldPath.split(".").map((segment) => transformationPaths[segment] ?? SDKRequestToRESTRequestRenameMap[segment] ?? segment).join(".");
|
|
3843
3995
|
}
|
|
3844
3996
|
|
|
3845
|
-
// ../../../node_modules/@wix/
|
|
3846
|
-
|
|
3997
|
+
// ../../../node_modules/@wix/sdk-context/build/index.mjs
|
|
3998
|
+
var wixContext = {};
|
|
3999
|
+
|
|
4000
|
+
// ../../../node_modules/@wix/sdk-runtime/build/context.js
|
|
4001
|
+
function resolveContext() {
|
|
3847
4002
|
const oldContext = typeof $wixContext !== "undefined" && $wixContext.initWixModules ? $wixContext.initWixModules : typeof globalThis.__wix_context__ !== "undefined" && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
3848
4003
|
if (oldContext) {
|
|
3849
4004
|
return {
|
|
3850
4005
|
// @ts-expect-error
|
|
3851
4006
|
initWixModules(modules, elevated) {
|
|
3852
|
-
return
|
|
4007
|
+
return runWithoutContext(() => oldContext(modules, elevated));
|
|
3853
4008
|
},
|
|
3854
4009
|
fetchWithAuth() {
|
|
3855
4010
|
throw new Error("fetchWithAuth is not available in this context");
|
|
@@ -3870,12 +4025,12 @@ function resolveContext2() {
|
|
|
3870
4025
|
if (!elevatedClient) {
|
|
3871
4026
|
throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");
|
|
3872
4027
|
}
|
|
3873
|
-
return
|
|
4028
|
+
return runWithoutContext(() => elevatedClient.use(wixModules));
|
|
3874
4029
|
}
|
|
3875
4030
|
if (!contextualClient) {
|
|
3876
4031
|
throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
|
|
3877
4032
|
}
|
|
3878
|
-
return
|
|
4033
|
+
return runWithoutContext(() => contextualClient.use(wixModules));
|
|
3879
4034
|
},
|
|
3880
4035
|
fetchWithAuth: (urlOrRequest, requestInit) => {
|
|
3881
4036
|
if (!contextualClient) {
|
|
@@ -3897,7 +4052,7 @@ function resolveContext2() {
|
|
|
3897
4052
|
}
|
|
3898
4053
|
};
|
|
3899
4054
|
}
|
|
3900
|
-
function
|
|
4055
|
+
function runWithoutContext(fn) {
|
|
3901
4056
|
const globalContext = globalThis.__wix_context__;
|
|
3902
4057
|
const moduleContext = {
|
|
3903
4058
|
client: wixContext.client,
|
|
@@ -3928,19 +4083,19 @@ function runWithoutContext2(fn) {
|
|
|
3928
4083
|
}
|
|
3929
4084
|
}
|
|
3930
4085
|
|
|
3931
|
-
// ../../../node_modules/@wix/
|
|
4086
|
+
// ../../../node_modules/@wix/sdk-runtime/build/context-v2.js
|
|
3932
4087
|
function contextualizeRESTModuleV2(restModule, elevated) {
|
|
3933
4088
|
return ((...args) => {
|
|
3934
|
-
const context =
|
|
4089
|
+
const context = resolveContext();
|
|
3935
4090
|
if (!context) {
|
|
3936
4091
|
return restModule.apply(void 0, args);
|
|
3937
4092
|
}
|
|
3938
4093
|
return context.initWixModules(restModule, elevated).apply(void 0, args);
|
|
3939
4094
|
});
|
|
3940
4095
|
}
|
|
3941
|
-
function
|
|
4096
|
+
function contextualizeEventDefinitionModuleV2(eventDefinition) {
|
|
3942
4097
|
const contextualMethod = ((...args) => {
|
|
3943
|
-
const context =
|
|
4098
|
+
const context = resolveContext();
|
|
3944
4099
|
if (!context) {
|
|
3945
4100
|
return () => {
|
|
3946
4101
|
};
|
|
@@ -3954,7 +4109,7 @@ function contextualizeEventDefinitionModuleV22(eventDefinition) {
|
|
|
3954
4109
|
return contextualMethod;
|
|
3955
4110
|
}
|
|
3956
4111
|
|
|
3957
|
-
// ../../../node_modules/@wix/
|
|
4112
|
+
// ../../../node_modules/@wix/sdk-runtime/build/rest-modules.js
|
|
3958
4113
|
function createRESTModule(descriptor, elevated = false) {
|
|
3959
4114
|
return contextualizeRESTModuleV2(descriptor, elevated);
|
|
3960
4115
|
}
|
|
@@ -4062,7 +4217,7 @@ function resolvePathFromMappings(protoPath, mappings) {
|
|
|
4062
4217
|
return mapping.srcPath + protoPath.slice(mapping.destPath.length);
|
|
4063
4218
|
}
|
|
4064
4219
|
|
|
4065
|
-
// ../../../node_modules/@wix/
|
|
4220
|
+
// ../../../node_modules/@wix/sdk-runtime/build/transformations/field-mask.js
|
|
4066
4221
|
function transformSDKFieldMaskToRESTFieldMask(val) {
|
|
4067
4222
|
if (!val) {
|
|
4068
4223
|
return val;
|
|
@@ -4070,9 +4225,278 @@ function transformSDKFieldMaskToRESTFieldMask(val) {
|
|
|
4070
4225
|
return val.join(",");
|
|
4071
4226
|
}
|
|
4072
4227
|
|
|
4073
|
-
// ../../../node_modules/@wix/
|
|
4074
|
-
function
|
|
4075
|
-
return
|
|
4228
|
+
// ../../../node_modules/@wix/sdk-runtime/build/event-definition-modules.js
|
|
4229
|
+
function createEventModule(eventDefinition) {
|
|
4230
|
+
return contextualizeEventDefinitionModuleV2(eventDefinition);
|
|
4231
|
+
}
|
|
4232
|
+
|
|
4233
|
+
// ../../../node_modules/@wix/auto_sdk_forms_chat-settings/build/es/index.mjs
|
|
4234
|
+
var onChatSettingsCreated = EventDefinition(
|
|
4235
|
+
"wix.forms.ai.v1.chat_settings_created",
|
|
4236
|
+
true,
|
|
4237
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
4238
|
+
transformPaths(event, [
|
|
4239
|
+
{
|
|
4240
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
4241
|
+
paths: [
|
|
4242
|
+
{ path: "entity.createdDate" },
|
|
4243
|
+
{ path: "entity.updatedDate" },
|
|
4244
|
+
{ path: "metadata.eventTime" }
|
|
4245
|
+
]
|
|
4246
|
+
}
|
|
4247
|
+
])
|
|
4248
|
+
)
|
|
4249
|
+
)();
|
|
4250
|
+
var onChatSettingsDeleted = EventDefinition(
|
|
4251
|
+
"wix.forms.ai.v1.chat_settings_deleted",
|
|
4252
|
+
true,
|
|
4253
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
4254
|
+
transformPaths(event, [
|
|
4255
|
+
{
|
|
4256
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
4257
|
+
paths: [
|
|
4258
|
+
{ path: "undefined.createdDate" },
|
|
4259
|
+
{ path: "undefined.updatedDate" },
|
|
4260
|
+
{ path: "metadata.eventTime" }
|
|
4261
|
+
]
|
|
4262
|
+
}
|
|
4263
|
+
])
|
|
4264
|
+
)
|
|
4265
|
+
)();
|
|
4266
|
+
var onChatSettingsUpdated = EventDefinition(
|
|
4267
|
+
"wix.forms.ai.v1.chat_settings_updated",
|
|
4268
|
+
true,
|
|
4269
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
4270
|
+
transformPaths(event, [
|
|
4271
|
+
{
|
|
4272
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
4273
|
+
paths: [
|
|
4274
|
+
{ path: "entity.createdDate" },
|
|
4275
|
+
{ path: "entity.updatedDate" },
|
|
4276
|
+
{ path: "metadata.eventTime" }
|
|
4277
|
+
]
|
|
4278
|
+
}
|
|
4279
|
+
])
|
|
4280
|
+
)
|
|
4281
|
+
)();
|
|
4282
|
+
createEventModule(
|
|
4283
|
+
onChatSettingsCreated
|
|
4284
|
+
);
|
|
4285
|
+
createEventModule(
|
|
4286
|
+
onChatSettingsDeleted
|
|
4287
|
+
);
|
|
4288
|
+
createEventModule(
|
|
4289
|
+
onChatSettingsUpdated
|
|
4290
|
+
);
|
|
4291
|
+
|
|
4292
|
+
// ../../../node_modules/@wix/sdk-runtime/build/transformations/float.js
|
|
4293
|
+
function transformSDKFloatToRESTFloat(val) {
|
|
4294
|
+
return isFinite(val) ? val : val.toString();
|
|
4295
|
+
}
|
|
4296
|
+
function transformRESTFloatToSDKFloat(val) {
|
|
4297
|
+
if (val === "NaN") {
|
|
4298
|
+
return NaN;
|
|
4299
|
+
}
|
|
4300
|
+
if (val === "Infinity") {
|
|
4301
|
+
return Infinity;
|
|
4302
|
+
}
|
|
4303
|
+
if (val === "-Infinity") {
|
|
4304
|
+
return -Infinity;
|
|
4305
|
+
}
|
|
4306
|
+
return val;
|
|
4307
|
+
}
|
|
4308
|
+
|
|
4309
|
+
// ../../../node_modules/@wix/auto_sdk_forms_interactive-form-sessions/build/es/index.mjs
|
|
4310
|
+
var onInteractiveFormSessionCreated = EventDefinition(
|
|
4311
|
+
"wix.forms.ai.v1.interactive_form_session_created",
|
|
4312
|
+
true,
|
|
4313
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
4314
|
+
transformPaths(event, [
|
|
4315
|
+
{
|
|
4316
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
4317
|
+
paths: [{ path: "metadata.eventTime" }]
|
|
4318
|
+
}
|
|
4319
|
+
])
|
|
4320
|
+
)
|
|
4321
|
+
)();
|
|
4322
|
+
createEventModule(
|
|
4323
|
+
onInteractiveFormSessionCreated
|
|
4324
|
+
);
|
|
4325
|
+
|
|
4326
|
+
// ../../../node_modules/@wix/auto_sdk_forms_forms/build/es/index.mjs
|
|
4327
|
+
var es_exports = {};
|
|
4328
|
+
__export(es_exports, {
|
|
4329
|
+
AddressInfoTag: () => AddressInfoTag,
|
|
4330
|
+
Alignment: () => Alignment,
|
|
4331
|
+
AppType: () => AppType,
|
|
4332
|
+
ArrayComponentType: () => ArrayComponentType,
|
|
4333
|
+
ArrayItemsItemType: () => ArrayItemsItemType,
|
|
4334
|
+
AspectRatio: () => AspectRatio,
|
|
4335
|
+
BackgroundType: () => BackgroundType,
|
|
4336
|
+
BooleanComponentType: () => BooleanComponentType,
|
|
4337
|
+
ButtonDataType: () => ButtonDataType,
|
|
4338
|
+
CardStylesAlignment: () => CardStylesAlignment,
|
|
4339
|
+
CardStylesType: () => CardStylesType,
|
|
4340
|
+
ChangeableProperty: () => ChangeableProperty,
|
|
4341
|
+
ComponentType: () => ComponentType,
|
|
4342
|
+
ConfirmationLevel: () => ConfirmationLevel,
|
|
4343
|
+
ContactField: () => ContactField,
|
|
4344
|
+
CountFormsFieldset: () => CountFormsFieldset,
|
|
4345
|
+
Crop: () => Crop,
|
|
4346
|
+
DecorationType: () => DecorationType,
|
|
4347
|
+
Direction: () => Direction,
|
|
4348
|
+
DisplayFieldDisplayFieldType: () => DisplayFieldDisplayFieldType,
|
|
4349
|
+
DisplayFieldType: () => DisplayFieldType,
|
|
4350
|
+
DividerDataAlignment: () => DividerDataAlignment,
|
|
4351
|
+
EmailInfoTag: () => EmailInfoTag,
|
|
4352
|
+
FieldInputType: () => FieldInputType,
|
|
4353
|
+
FieldType: () => FieldType,
|
|
4354
|
+
Fieldset: () => Fieldset,
|
|
4355
|
+
FilterType: () => FilterType,
|
|
4356
|
+
FirstDayOfWeek: () => FirstDayOfWeek,
|
|
4357
|
+
FontType: () => FontType,
|
|
4358
|
+
FormFieldContactInfoContactField: () => FormFieldContactInfoContactField,
|
|
4359
|
+
FormFieldContactInfoEmailInfoTag: () => FormFieldContactInfoEmailInfoTag,
|
|
4360
|
+
FormFieldContactInfoPhoneInfoTag: () => FormFieldContactInfoPhoneInfoTag,
|
|
4361
|
+
FormFieldV2FieldType: () => FormFieldV2FieldType,
|
|
4362
|
+
Format: () => Format,
|
|
4363
|
+
FormatEnumFormat: () => FormatEnumFormat,
|
|
4364
|
+
GIFType: () => GIFType,
|
|
4365
|
+
ImageFit: () => ImageFit,
|
|
4366
|
+
ImagePosition: () => ImagePosition,
|
|
4367
|
+
InitialExpandedItems: () => InitialExpandedItems,
|
|
4368
|
+
InputFieldArrayComponentType: () => InputFieldArrayComponentType,
|
|
4369
|
+
InputFieldBooleanComponentType: () => InputFieldBooleanComponentType,
|
|
4370
|
+
InputFieldInputType: () => InputFieldInputType,
|
|
4371
|
+
InputFieldNumberComponentType: () => InputFieldNumberComponentType,
|
|
4372
|
+
InputFieldPaymentComponentType: () => InputFieldPaymentComponentType,
|
|
4373
|
+
InputFieldSchedulingComponentType: () => InputFieldSchedulingComponentType,
|
|
4374
|
+
InputFieldStringComponentType: () => InputFieldStringComponentType,
|
|
4375
|
+
InputFieldStringTypeFormatEnumFormat: () => InputFieldStringTypeFormatEnumFormat,
|
|
4376
|
+
InputFieldWixFileComponentType: () => InputFieldWixFileComponentType,
|
|
4377
|
+
InputType: () => InputType,
|
|
4378
|
+
ItemType: () => ItemType,
|
|
4379
|
+
Kind: () => Kind,
|
|
4380
|
+
Layout: () => Layout,
|
|
4381
|
+
LayoutType: () => LayoutType,
|
|
4382
|
+
LineStyle: () => LineStyle,
|
|
4383
|
+
LinkTarget: () => LinkTarget,
|
|
4384
|
+
ListDeletedFormsOrder: () => ListDeletedFormsOrder,
|
|
4385
|
+
ListFormsOrder: () => ListFormsOrder,
|
|
4386
|
+
ListFormsRequestListFormsOrder: () => ListFormsRequestListFormsOrder,
|
|
4387
|
+
MapType: () => MapType,
|
|
4388
|
+
MultilineAddressComponentType: () => MultilineAddressComponentType,
|
|
4389
|
+
NodeType: () => NodeType,
|
|
4390
|
+
NullValue: () => NullValue,
|
|
4391
|
+
NumberComponentType: () => NumberComponentType,
|
|
4392
|
+
NumberOfColumns: () => NumberOfColumns,
|
|
4393
|
+
ObjectArrayComponentType: () => ObjectArrayComponentType,
|
|
4394
|
+
Operator: () => Operator,
|
|
4395
|
+
OptInLevel: () => OptInLevel,
|
|
4396
|
+
Orientation: () => Orientation,
|
|
4397
|
+
OverrideEntityType: () => OverrideEntityType,
|
|
4398
|
+
OverrideEntityTypeEnumOverrideEntityType: () => OverrideEntityTypeEnumOverrideEntityType,
|
|
4399
|
+
PaymentComponentType: () => PaymentComponentType,
|
|
4400
|
+
PhoneInfoTag: () => PhoneInfoTag,
|
|
4401
|
+
Placement: () => Placement,
|
|
4402
|
+
PluginContainerDataAlignment: () => PluginContainerDataAlignment,
|
|
4403
|
+
PollLayoutDirection: () => PollLayoutDirection,
|
|
4404
|
+
PollLayoutType: () => PollLayoutType,
|
|
4405
|
+
Position: () => Position,
|
|
4406
|
+
PriceType: () => PriceType,
|
|
4407
|
+
ProductType: () => ProductType,
|
|
4408
|
+
PropertiesTypeEnum: () => PropertiesTypeEnum,
|
|
4409
|
+
PropertiesTypePropertiesTypeEnum: () => PropertiesTypePropertiesTypeEnum,
|
|
4410
|
+
RequiredIndicator: () => RequiredIndicator,
|
|
4411
|
+
RequiredIndicatorPlacement: () => RequiredIndicatorPlacement,
|
|
4412
|
+
Resizing: () => Resizing,
|
|
4413
|
+
SchedulingComponentType: () => SchedulingComponentType,
|
|
4414
|
+
SortOrder: () => SortOrder,
|
|
4415
|
+
Source: () => Source,
|
|
4416
|
+
SpamFilterProtectionLevel: () => SpamFilterProtectionLevel,
|
|
4417
|
+
StringComponentType: () => StringComponentType,
|
|
4418
|
+
StringTypeFormatEnumFormat: () => StringTypeFormatEnumFormat,
|
|
4419
|
+
StylesPosition: () => StylesPosition,
|
|
4420
|
+
SubmitSuccessAction: () => SubmitSuccessAction,
|
|
4421
|
+
Tag: () => Tag,
|
|
4422
|
+
Target: () => Target,
|
|
4423
|
+
TextAlignment: () => TextAlignment,
|
|
4424
|
+
ThumbnailsAlignment: () => ThumbnailsAlignment,
|
|
4425
|
+
Type: () => Type,
|
|
4426
|
+
UploadFileFormat: () => UploadFileFormat,
|
|
4427
|
+
ValidationFormat: () => ValidationFormat,
|
|
4428
|
+
VerticalAlignment: () => VerticalAlignment,
|
|
4429
|
+
ViewMode: () => ViewMode,
|
|
4430
|
+
ViewRole: () => ViewRole,
|
|
4431
|
+
VoteRole: () => VoteRole,
|
|
4432
|
+
WebhookIdentityType: () => WebhookIdentityType,
|
|
4433
|
+
Width: () => Width,
|
|
4434
|
+
WidthType: () => WidthType,
|
|
4435
|
+
WixFileComponentType: () => WixFileComponentType,
|
|
4436
|
+
bulkCloneForm: () => bulkCloneForm4,
|
|
4437
|
+
bulkCreateForm: () => bulkCreateForm4,
|
|
4438
|
+
bulkDeleteForm: () => bulkDeleteForm4,
|
|
4439
|
+
bulkRemoveDeletedField: () => bulkRemoveDeletedField4,
|
|
4440
|
+
cloneForm: () => cloneForm4,
|
|
4441
|
+
countDeletedForms: () => countDeletedForms4,
|
|
4442
|
+
countFormsByFilter: () => countFormsByFilter4,
|
|
4443
|
+
createForm: () => createForm4,
|
|
4444
|
+
deleteForm: () => deleteForm4,
|
|
4445
|
+
getDeletedForm: () => getDeletedForm4,
|
|
4446
|
+
getForm: () => getForm4,
|
|
4447
|
+
getFormSummary: () => getFormSummary4,
|
|
4448
|
+
listDeletedForms: () => listDeletedForms4,
|
|
4449
|
+
listForms: () => listForms4,
|
|
4450
|
+
listFormsProvidersConfigs: () => listFormsProvidersConfigs4,
|
|
4451
|
+
onFormCreated: () => onFormCreated2,
|
|
4452
|
+
onFormDeleted: () => onFormDeleted2,
|
|
4453
|
+
onFormDisabledForm: () => onFormDisabledForm2,
|
|
4454
|
+
onFormEnabledForm: () => onFormEnabledForm2,
|
|
4455
|
+
onFormTranslationChanged: () => onFormTranslationChanged2,
|
|
4456
|
+
onFormTranslationDeleted: () => onFormTranslationDeleted2,
|
|
4457
|
+
onFormUpdated: () => onFormUpdated2,
|
|
4458
|
+
queryDeletedForms: () => queryDeletedForms4,
|
|
4459
|
+
queryForms: () => queryForms4,
|
|
4460
|
+
removeFormFromTrashBin: () => removeFormFromTrashBin4,
|
|
4461
|
+
restoreFromTrashBin: () => restoreFromTrashBin4,
|
|
4462
|
+
updateForm: () => updateForm4
|
|
4463
|
+
});
|
|
4464
|
+
|
|
4465
|
+
// ../../../node_modules/@wix/sdk-runtime/build/transformations/image.js
|
|
4466
|
+
function transformSDKImageToRESTImage(val) {
|
|
4467
|
+
if (!val) {
|
|
4468
|
+
return;
|
|
4469
|
+
}
|
|
4470
|
+
const alignedImage = alignIfLegacy(val, "image");
|
|
4471
|
+
const { protocol, hash, pathname } = new URL(alignedImage);
|
|
4472
|
+
const params = new URLSearchParams(hash.replace("#", ""));
|
|
4473
|
+
const height = params.get("originHeight");
|
|
4474
|
+
const width = params.get("originWidth");
|
|
4475
|
+
const [id, filenameOrAltText] = pathname.replace(`image://v1/`, "").split("/");
|
|
4476
|
+
const decodedFilenameOrAltText = decodeURIComponent(filenameOrAltText);
|
|
4477
|
+
if (protocol === WIX_PROTOCOL) {
|
|
4478
|
+
const res = { id, height: Number(height), width: Number(width) };
|
|
4479
|
+
if (!decodedFilenameOrAltText) {
|
|
4480
|
+
return res;
|
|
4481
|
+
}
|
|
4482
|
+
return {
|
|
4483
|
+
...res,
|
|
4484
|
+
altText: decodedFilenameOrAltText,
|
|
4485
|
+
filename: decodedFilenameOrAltText,
|
|
4486
|
+
url: val
|
|
4487
|
+
};
|
|
4488
|
+
}
|
|
4489
|
+
return { url: val };
|
|
4490
|
+
}
|
|
4491
|
+
function transformRESTImageToSDKImage(payload) {
|
|
4492
|
+
if (!payload) {
|
|
4493
|
+
return;
|
|
4494
|
+
}
|
|
4495
|
+
let fileNameOrAltText = "";
|
|
4496
|
+
if (payload.filename || payload.altText) {
|
|
4497
|
+
fileNameOrAltText = `/${encodeURIComponent(payload.filename || payload.altText)}`;
|
|
4498
|
+
}
|
|
4499
|
+
return payload.id ? `wix:image://v1/${payload.id}${fileNameOrAltText}#originWidth=${payload.width}&originHeight=${payload.height}` : payload.url;
|
|
4076
4500
|
}
|
|
4077
4501
|
|
|
4078
4502
|
// ../../../node_modules/@wix/auto_sdk_forms_forms/build/es/index.mjs
|
|
@@ -4176,7 +4600,7 @@ function resolveWixFormsV4FormSchemaServiceUrl(opts) {
|
|
|
4176
4600
|
var PACKAGE_NAME = "@wix/auto_sdk_forms_forms";
|
|
4177
4601
|
function createForm(payload) {
|
|
4178
4602
|
function __createForm({ host }) {
|
|
4179
|
-
const serializedData =
|
|
4603
|
+
const serializedData = transformPaths(payload, [
|
|
4180
4604
|
{
|
|
4181
4605
|
transformFn: transformSDKTimestampToRESTTimestamp,
|
|
4182
4606
|
paths: [
|
|
@@ -9826,9 +10250,9 @@ function createForm(payload) {
|
|
|
9826
10250
|
host
|
|
9827
10251
|
}),
|
|
9828
10252
|
data: serializedData,
|
|
9829
|
-
transformResponse: (payload2) =>
|
|
10253
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
9830
10254
|
{
|
|
9831
|
-
transformFn:
|
|
10255
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
9832
10256
|
paths: [
|
|
9833
10257
|
{ path: "form.createdDate" },
|
|
9834
10258
|
{ path: "form.updatedDate" },
|
|
@@ -15487,7 +15911,7 @@ function createForm(payload) {
|
|
|
15487
15911
|
}
|
|
15488
15912
|
function bulkCreateForm(payload) {
|
|
15489
15913
|
function __bulkCreateForm({ host }) {
|
|
15490
|
-
const serializedData =
|
|
15914
|
+
const serializedData = transformPaths(payload, [
|
|
15491
15915
|
{
|
|
15492
15916
|
transformFn: transformSDKTimestampToRESTTimestamp,
|
|
15493
15917
|
paths: [
|
|
@@ -21141,9 +21565,9 @@ function bulkCreateForm(payload) {
|
|
|
21141
21565
|
host
|
|
21142
21566
|
}),
|
|
21143
21567
|
data: serializedData,
|
|
21144
|
-
transformResponse: (payload2) =>
|
|
21568
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
21145
21569
|
{
|
|
21146
|
-
transformFn:
|
|
21570
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
21147
21571
|
paths: [
|
|
21148
21572
|
{ path: "results.item.createdDate" },
|
|
21149
21573
|
{ path: "results.item.updatedDate" },
|
|
@@ -26831,9 +27255,9 @@ function cloneForm(payload) {
|
|
|
26831
27255
|
host
|
|
26832
27256
|
}),
|
|
26833
27257
|
data: payload,
|
|
26834
|
-
transformResponse: (payload2) =>
|
|
27258
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
26835
27259
|
{
|
|
26836
|
-
transformFn:
|
|
27260
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
26837
27261
|
paths: [
|
|
26838
27262
|
{ path: "form.createdDate" },
|
|
26839
27263
|
{ path: "form.updatedDate" },
|
|
@@ -32506,9 +32930,9 @@ function bulkCloneForm(payload) {
|
|
|
32506
32930
|
host
|
|
32507
32931
|
}),
|
|
32508
32932
|
data: payload,
|
|
32509
|
-
transformResponse: (payload2) =>
|
|
32933
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
32510
32934
|
{
|
|
32511
|
-
transformFn:
|
|
32935
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
32512
32936
|
paths: [
|
|
32513
32937
|
{ path: "results.item.createdDate" },
|
|
32514
32938
|
{ path: "results.item.updatedDate" },
|
|
@@ -38196,9 +38620,9 @@ function getForm(payload) {
|
|
|
38196
38620
|
host
|
|
38197
38621
|
}),
|
|
38198
38622
|
params: toURLSearchParams(payload, true),
|
|
38199
|
-
transformResponse: (payload2) =>
|
|
38623
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
38200
38624
|
{
|
|
38201
|
-
transformFn:
|
|
38625
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
38202
38626
|
paths: [
|
|
38203
38627
|
{ path: "form.createdDate" },
|
|
38204
38628
|
{ path: "form.updatedDate" },
|
|
@@ -43857,7 +44281,7 @@ function getForm(payload) {
|
|
|
43857
44281
|
}
|
|
43858
44282
|
function updateForm(payload) {
|
|
43859
44283
|
function __updateForm({ host }) {
|
|
43860
|
-
const serializedData =
|
|
44284
|
+
const serializedData = transformPaths(payload, [
|
|
43861
44285
|
{
|
|
43862
44286
|
transformFn: transformSDKFieldMaskToRESTFieldMask,
|
|
43863
44287
|
paths: [{ path: "mask" }]
|
|
@@ -49511,9 +49935,9 @@ function updateForm(payload) {
|
|
|
49511
49935
|
host
|
|
49512
49936
|
}),
|
|
49513
49937
|
data: serializedData,
|
|
49514
|
-
transformResponse: (payload2) =>
|
|
49938
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
49515
49939
|
{
|
|
49516
|
-
transformFn:
|
|
49940
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
49517
49941
|
paths: [
|
|
49518
49942
|
{ path: "form.createdDate" },
|
|
49519
49943
|
{ path: "form.updatedDate" },
|
|
@@ -55223,14 +55647,14 @@ function bulkDeleteForm(payload) {
|
|
|
55223
55647
|
optInTransformResponse: true
|
|
55224
55648
|
},
|
|
55225
55649
|
url: resolveWixFormsV4FormSchemaServiceUrl({
|
|
55226
|
-
protoPath: "/
|
|
55650
|
+
protoPath: "/v4/bulk/forms/delete",
|
|
55227
55651
|
data: payload,
|
|
55228
55652
|
host
|
|
55229
55653
|
}),
|
|
55230
55654
|
data: payload,
|
|
55231
|
-
transformResponse: (payload2) =>
|
|
55655
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
55232
55656
|
{
|
|
55233
|
-
transformFn:
|
|
55657
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
55234
55658
|
paths: [
|
|
55235
55659
|
{ path: "results.item.createdDate" },
|
|
55236
55660
|
{ path: "results.item.updatedDate" },
|
|
@@ -60918,9 +61342,9 @@ function restoreFromTrashBin(payload) {
|
|
|
60918
61342
|
host
|
|
60919
61343
|
}),
|
|
60920
61344
|
data: payload,
|
|
60921
|
-
transformResponse: (payload2) =>
|
|
61345
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
60922
61346
|
{
|
|
60923
|
-
transformFn:
|
|
61347
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
60924
61348
|
paths: [
|
|
60925
61349
|
{ path: "form.createdDate" },
|
|
60926
61350
|
{ path: "form.updatedDate" },
|
|
@@ -66593,9 +67017,9 @@ function queryForms(payload) {
|
|
|
66593
67017
|
host
|
|
66594
67018
|
}),
|
|
66595
67019
|
data: payload,
|
|
66596
|
-
transformResponse: (payload2) =>
|
|
67020
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
66597
67021
|
{
|
|
66598
|
-
transformFn:
|
|
67022
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
66599
67023
|
paths: [
|
|
66600
67024
|
{ path: "forms.createdDate" },
|
|
66601
67025
|
{ path: "forms.updatedDate" },
|
|
@@ -72310,9 +72734,9 @@ function listForms(payload) {
|
|
|
72310
72734
|
host
|
|
72311
72735
|
}),
|
|
72312
72736
|
params: toURLSearchParams(payload, true),
|
|
72313
|
-
transformResponse: (payload2) =>
|
|
72737
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
72314
72738
|
{
|
|
72315
|
-
transformFn:
|
|
72739
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
72316
72740
|
paths: [
|
|
72317
72741
|
{ path: "forms.createdDate" },
|
|
72318
72742
|
{ path: "forms.updatedDate" },
|
|
@@ -77985,9 +78409,9 @@ function getDeletedForm(payload) {
|
|
|
77985
78409
|
host
|
|
77986
78410
|
}),
|
|
77987
78411
|
params: toURLSearchParams(payload),
|
|
77988
|
-
transformResponse: (payload2) =>
|
|
78412
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
77989
78413
|
{
|
|
77990
|
-
transformFn:
|
|
78414
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
77991
78415
|
paths: [
|
|
77992
78416
|
{ path: "form.createdDate" },
|
|
77993
78417
|
{ path: "form.updatedDate" },
|
|
@@ -83660,9 +84084,9 @@ function queryDeletedForms(payload) {
|
|
|
83660
84084
|
host
|
|
83661
84085
|
}),
|
|
83662
84086
|
data: payload,
|
|
83663
|
-
transformResponse: (payload2) =>
|
|
84087
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
83664
84088
|
{
|
|
83665
|
-
transformFn:
|
|
84089
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
83666
84090
|
paths: [
|
|
83667
84091
|
{ path: "forms.createdDate" },
|
|
83668
84092
|
{ path: "forms.updatedDate" },
|
|
@@ -89335,9 +89759,9 @@ function listDeletedForms(payload) {
|
|
|
89335
89759
|
host
|
|
89336
89760
|
}),
|
|
89337
89761
|
params: toURLSearchParams(payload),
|
|
89338
|
-
transformResponse: (payload2) =>
|
|
89762
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
89339
89763
|
{
|
|
89340
|
-
transformFn:
|
|
89764
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
89341
89765
|
paths: [
|
|
89342
89766
|
{ path: "forms.createdDate" },
|
|
89343
89767
|
{ path: "forms.updatedDate" },
|
|
@@ -95010,9 +95434,9 @@ function bulkRemoveDeletedField(payload) {
|
|
|
95010
95434
|
host
|
|
95011
95435
|
}),
|
|
95012
95436
|
data: payload,
|
|
95013
|
-
transformResponse: (payload2) =>
|
|
95437
|
+
transformResponse: (payload2) => transformPaths(payload2, [
|
|
95014
95438
|
{
|
|
95015
|
-
transformFn:
|
|
95439
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
95016
95440
|
paths: [
|
|
95017
95441
|
{ path: "form.createdDate" },
|
|
95018
95442
|
{ path: "form.updatedDate" },
|
|
@@ -101536,7 +101960,7 @@ var FieldInputType = /* @__PURE__ */ ((FieldInputType2) => {
|
|
|
101536
101960
|
})(FieldInputType || {});
|
|
101537
101961
|
async function createForm2(form) {
|
|
101538
101962
|
const { httpClient, sideEffects } = arguments[1];
|
|
101539
|
-
const payload =
|
|
101963
|
+
const payload = transformPaths(
|
|
101540
101964
|
renameKeysFromSDKRequestToRESTRequest({ form }, [
|
|
101541
101965
|
"form.fieldsV2.inputOptions.stringOptions.textInputOptions.description",
|
|
101542
101966
|
"form.formFields.inputOptions.stringOptions.textInputOptions.description",
|
|
@@ -101811,8 +102235,8 @@ async function createForm2(form) {
|
|
|
101811
102235
|
try {
|
|
101812
102236
|
const result = await httpClient.request(reqOpts);
|
|
101813
102237
|
sideEffects?.onSuccess?.(result);
|
|
101814
|
-
return
|
|
101815
|
-
|
|
102238
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
102239
|
+
transformPaths(result.data, [
|
|
101816
102240
|
{
|
|
101817
102241
|
transformFn: transformRESTImageToSDKImage,
|
|
101818
102242
|
paths: [
|
|
@@ -102097,7 +102521,7 @@ async function createForm2(form) {
|
|
|
102097
102521
|
}
|
|
102098
102522
|
async function bulkCreateForm2(options) {
|
|
102099
102523
|
const { httpClient, sideEffects } = arguments[1];
|
|
102100
|
-
const payload =
|
|
102524
|
+
const payload = transformPaths(
|
|
102101
102525
|
renameKeysFromSDKRequestToRESTRequest(
|
|
102102
102526
|
{ forms: options?.forms, returnEntity: options?.returnEntity },
|
|
102103
102527
|
[
|
|
@@ -102375,8 +102799,8 @@ async function bulkCreateForm2(options) {
|
|
|
102375
102799
|
try {
|
|
102376
102800
|
const result = await httpClient.request(reqOpts);
|
|
102377
102801
|
sideEffects?.onSuccess?.(result);
|
|
102378
|
-
return
|
|
102379
|
-
|
|
102802
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
102803
|
+
transformPaths(result.data, [
|
|
102380
102804
|
{
|
|
102381
102805
|
transformFn: transformRESTImageToSDKImage,
|
|
102382
102806
|
paths: [
|
|
@@ -102670,8 +103094,8 @@ async function cloneForm2(formId) {
|
|
|
102670
103094
|
try {
|
|
102671
103095
|
const result = await httpClient.request(reqOpts);
|
|
102672
103096
|
sideEffects?.onSuccess?.(result);
|
|
102673
|
-
return
|
|
102674
|
-
|
|
103097
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
103098
|
+
transformPaths(result.data, [
|
|
102675
103099
|
{
|
|
102676
103100
|
transformFn: transformRESTImageToSDKImage,
|
|
102677
103101
|
paths: [
|
|
@@ -102969,8 +103393,8 @@ async function bulkCloneForm2(formIds, options) {
|
|
|
102969
103393
|
try {
|
|
102970
103394
|
const result = await httpClient.request(reqOpts);
|
|
102971
103395
|
sideEffects?.onSuccess?.(result);
|
|
102972
|
-
return
|
|
102973
|
-
|
|
103396
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
103397
|
+
transformPaths(result.data, [
|
|
102974
103398
|
{
|
|
102975
103399
|
transformFn: transformRESTImageToSDKImage,
|
|
102976
103400
|
paths: [
|
|
@@ -103265,8 +103689,8 @@ async function getForm2(formId) {
|
|
|
103265
103689
|
try {
|
|
103266
103690
|
const result = await httpClient.request(reqOpts);
|
|
103267
103691
|
sideEffects?.onSuccess?.(result);
|
|
103268
|
-
return
|
|
103269
|
-
|
|
103692
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
103693
|
+
transformPaths(result.data, [
|
|
103270
103694
|
{
|
|
103271
103695
|
transformFn: transformRESTImageToSDKImage,
|
|
103272
103696
|
paths: [
|
|
@@ -103551,7 +103975,7 @@ async function getForm2(formId) {
|
|
|
103551
103975
|
}
|
|
103552
103976
|
async function updateForm2(_id, form) {
|
|
103553
103977
|
const { httpClient, sideEffects } = arguments[2];
|
|
103554
|
-
const payload =
|
|
103978
|
+
const payload = transformPaths(
|
|
103555
103979
|
renameKeysFromSDKRequestToRESTRequest({ form: { ...form, id: _id } }, [
|
|
103556
103980
|
"form.fieldsV2.inputOptions.stringOptions.textInputOptions.description",
|
|
103557
103981
|
"form.formFields.inputOptions.stringOptions.textInputOptions.description",
|
|
@@ -103826,8 +104250,8 @@ async function updateForm2(_id, form) {
|
|
|
103826
104250
|
try {
|
|
103827
104251
|
const result = await httpClient.request(reqOpts);
|
|
103828
104252
|
sideEffects?.onSuccess?.(result);
|
|
103829
|
-
return
|
|
103830
|
-
|
|
104253
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
104254
|
+
transformPaths(result.data, [
|
|
103831
104255
|
{
|
|
103832
104256
|
transformFn: transformRESTImageToSDKImage,
|
|
103833
104257
|
paths: [
|
|
@@ -104171,8 +104595,8 @@ async function bulkDeleteForm2(formIds, options) {
|
|
|
104171
104595
|
try {
|
|
104172
104596
|
const result = await httpClient.request(reqOpts);
|
|
104173
104597
|
sideEffects?.onSuccess?.(result);
|
|
104174
|
-
return
|
|
104175
|
-
|
|
104598
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
104599
|
+
transformPaths(result.data, [
|
|
104176
104600
|
{
|
|
104177
104601
|
transformFn: transformRESTImageToSDKImage,
|
|
104178
104602
|
paths: [
|
|
@@ -104466,8 +104890,8 @@ async function restoreFromTrashBin2(formId) {
|
|
|
104466
104890
|
try {
|
|
104467
104891
|
const result = await httpClient.request(reqOpts);
|
|
104468
104892
|
sideEffects?.onSuccess?.(result);
|
|
104469
|
-
return
|
|
104470
|
-
|
|
104893
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
104894
|
+
transformPaths(result.data, [
|
|
104471
104895
|
{
|
|
104472
104896
|
transformFn: transformRESTImageToSDKImage,
|
|
104473
104897
|
paths: [
|
|
@@ -104776,8 +105200,8 @@ function queryForms2(options) {
|
|
|
104776
105200
|
);
|
|
104777
105201
|
},
|
|
104778
105202
|
responseTransformer: ({ data }) => {
|
|
104779
|
-
const transformedData =
|
|
104780
|
-
|
|
105203
|
+
const transformedData = renameKeysFromRESTResponseToSDKResponse(
|
|
105204
|
+
transformPaths(data, [
|
|
104781
105205
|
{
|
|
104782
105206
|
transformFn: transformRESTImageToSDKImage,
|
|
104783
105207
|
paths: [
|
|
@@ -105074,7 +105498,7 @@ async function countFormsByFilter2(options) {
|
|
|
105074
105498
|
try {
|
|
105075
105499
|
const result = await httpClient.request(reqOpts);
|
|
105076
105500
|
sideEffects?.onSuccess?.(result);
|
|
105077
|
-
return
|
|
105501
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data, []);
|
|
105078
105502
|
} catch (err) {
|
|
105079
105503
|
const transformedError = transformError(
|
|
105080
105504
|
err,
|
|
@@ -105103,7 +105527,7 @@ async function countDeletedForms2(options) {
|
|
|
105103
105527
|
try {
|
|
105104
105528
|
const result = await httpClient.request(reqOpts);
|
|
105105
105529
|
sideEffects?.onSuccess?.(result);
|
|
105106
|
-
return
|
|
105530
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data, []);
|
|
105107
105531
|
} catch (err) {
|
|
105108
105532
|
const transformedError = transformError(
|
|
105109
105533
|
err,
|
|
@@ -105142,8 +105566,8 @@ async function listForms2(namespace, options) {
|
|
|
105142
105566
|
try {
|
|
105143
105567
|
const result = await httpClient.request(reqOpts);
|
|
105144
105568
|
sideEffects?.onSuccess?.(result);
|
|
105145
|
-
return
|
|
105146
|
-
|
|
105569
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
105570
|
+
transformPaths(result.data, [
|
|
105147
105571
|
{
|
|
105148
105572
|
transformFn: transformRESTImageToSDKImage,
|
|
105149
105573
|
paths: [
|
|
@@ -105444,8 +105868,8 @@ async function getDeletedForm2(formId) {
|
|
|
105444
105868
|
try {
|
|
105445
105869
|
const result = await httpClient.request(reqOpts);
|
|
105446
105870
|
sideEffects?.onSuccess?.(result);
|
|
105447
|
-
return
|
|
105448
|
-
|
|
105871
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
105872
|
+
transformPaths(result.data, [
|
|
105449
105873
|
{
|
|
105450
105874
|
transformFn: transformRESTImageToSDKImage,
|
|
105451
105875
|
paths: [
|
|
@@ -105739,8 +106163,8 @@ async function queryDeletedForms2(options) {
|
|
|
105739
106163
|
try {
|
|
105740
106164
|
const result = await httpClient.request(reqOpts);
|
|
105741
106165
|
sideEffects?.onSuccess?.(result);
|
|
105742
|
-
return
|
|
105743
|
-
|
|
106166
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
106167
|
+
transformPaths(result.data, [
|
|
105744
106168
|
{
|
|
105745
106169
|
transformFn: transformRESTImageToSDKImage,
|
|
105746
106170
|
paths: [
|
|
@@ -106045,8 +106469,8 @@ async function listDeletedForms2(namespace, options) {
|
|
|
106045
106469
|
try {
|
|
106046
106470
|
const result = await httpClient.request(reqOpts);
|
|
106047
106471
|
sideEffects?.onSuccess?.(result);
|
|
106048
|
-
return
|
|
106049
|
-
|
|
106472
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
106473
|
+
transformPaths(result.data, [
|
|
106050
106474
|
{
|
|
106051
106475
|
transformFn: transformRESTImageToSDKImage,
|
|
106052
106476
|
paths: [
|
|
@@ -106348,8 +106772,8 @@ async function bulkRemoveDeletedField2(formId, options) {
|
|
|
106348
106772
|
try {
|
|
106349
106773
|
const result = await httpClient.request(reqOpts);
|
|
106350
106774
|
sideEffects?.onSuccess?.(result);
|
|
106351
|
-
return
|
|
106352
|
-
|
|
106775
|
+
return renameKeysFromRESTResponseToSDKResponse(
|
|
106776
|
+
transformPaths(result.data, [
|
|
106353
106777
|
{
|
|
106354
106778
|
transformFn: transformRESTImageToSDKImage,
|
|
106355
106779
|
paths: [
|
|
@@ -106643,7 +107067,7 @@ async function listFormsProvidersConfigs2() {
|
|
|
106643
107067
|
try {
|
|
106644
107068
|
const result = await httpClient.request(reqOpts);
|
|
106645
107069
|
sideEffects?.onSuccess?.(result);
|
|
106646
|
-
return
|
|
107070
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data, []);
|
|
106647
107071
|
} catch (err) {
|
|
106648
107072
|
const transformedError = transformError(
|
|
106649
107073
|
err,
|
|
@@ -106666,7 +107090,7 @@ async function getFormSummary2(formId) {
|
|
|
106666
107090
|
try {
|
|
106667
107091
|
const result = await httpClient.request(reqOpts);
|
|
106668
107092
|
sideEffects?.onSuccess?.(result);
|
|
106669
|
-
return
|
|
107093
|
+
return renameKeysFromRESTResponseToSDKResponse(result.data, []);
|
|
106670
107094
|
} catch (err) {
|
|
106671
107095
|
const transformedError = transformError(
|
|
106672
107096
|
err,
|
|
@@ -106830,10 +107254,10 @@ function getFormSummary3(httpClient) {
|
|
|
106830
107254
|
var onFormCreated = EventDefinition(
|
|
106831
107255
|
"wix.forms.v4.form_created",
|
|
106832
107256
|
true,
|
|
106833
|
-
(event) =>
|
|
106834
|
-
|
|
107257
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
107258
|
+
transformPaths(event, [
|
|
106835
107259
|
{
|
|
106836
|
-
transformFn:
|
|
107260
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
106837
107261
|
paths: [
|
|
106838
107262
|
{ path: "entity.createdDate" },
|
|
106839
107263
|
{ path: "entity.updatedDate" },
|
|
@@ -118163,10 +118587,10 @@ var onFormCreated = EventDefinition(
|
|
|
118163
118587
|
var onFormDeleted = EventDefinition(
|
|
118164
118588
|
"wix.forms.v4.form_deleted",
|
|
118165
118589
|
true,
|
|
118166
|
-
(event) =>
|
|
118167
|
-
|
|
118590
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
118591
|
+
transformPaths(event, [
|
|
118168
118592
|
{
|
|
118169
|
-
transformFn:
|
|
118593
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
118170
118594
|
paths: [
|
|
118171
118595
|
{ path: "entity.createdDate" },
|
|
118172
118596
|
{ path: "entity.updatedDate" },
|
|
@@ -129496,10 +129920,10 @@ var onFormDeleted = EventDefinition(
|
|
|
129496
129920
|
var onFormDisabledForm = EventDefinition(
|
|
129497
129921
|
"wix.forms.v4.form_disabled_form",
|
|
129498
129922
|
true,
|
|
129499
|
-
(event) =>
|
|
129500
|
-
|
|
129923
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
129924
|
+
transformPaths(event, [
|
|
129501
129925
|
{
|
|
129502
|
-
transformFn:
|
|
129926
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
129503
129927
|
paths: [{ path: "metadata.eventTime" }]
|
|
129504
129928
|
}
|
|
129505
129929
|
])
|
|
@@ -129508,10 +129932,10 @@ var onFormDisabledForm = EventDefinition(
|
|
|
129508
129932
|
var onFormEnabledForm = EventDefinition(
|
|
129509
129933
|
"wix.forms.v4.form_enabled_form",
|
|
129510
129934
|
true,
|
|
129511
|
-
(event) =>
|
|
129512
|
-
|
|
129935
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
129936
|
+
transformPaths(event, [
|
|
129513
129937
|
{
|
|
129514
|
-
transformFn:
|
|
129938
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
129515
129939
|
paths: [{ path: "metadata.eventTime" }]
|
|
129516
129940
|
}
|
|
129517
129941
|
])
|
|
@@ -129520,10 +129944,10 @@ var onFormEnabledForm = EventDefinition(
|
|
|
129520
129944
|
var onFormTranslationChanged = EventDefinition(
|
|
129521
129945
|
"wix.forms.v4.form_form_translation_changed",
|
|
129522
129946
|
true,
|
|
129523
|
-
(event) =>
|
|
129524
|
-
|
|
129947
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
129948
|
+
transformPaths(event, [
|
|
129525
129949
|
{
|
|
129526
|
-
transformFn:
|
|
129950
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
129527
129951
|
paths: [
|
|
129528
129952
|
{ path: "data.form.createdDate" },
|
|
129529
129953
|
{ path: "data.form.updatedDate" },
|
|
@@ -135191,10 +135615,10 @@ var onFormTranslationChanged = EventDefinition(
|
|
|
135191
135615
|
var onFormTranslationDeleted = EventDefinition(
|
|
135192
135616
|
"wix.forms.v4.form_form_translation_deleted",
|
|
135193
135617
|
true,
|
|
135194
|
-
(event) =>
|
|
135195
|
-
|
|
135618
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
135619
|
+
transformPaths(event, [
|
|
135196
135620
|
{
|
|
135197
|
-
transformFn:
|
|
135621
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
135198
135622
|
paths: [{ path: "metadata.eventTime" }]
|
|
135199
135623
|
}
|
|
135200
135624
|
])
|
|
@@ -135203,10 +135627,10 @@ var onFormTranslationDeleted = EventDefinition(
|
|
|
135203
135627
|
var onFormUpdated = EventDefinition(
|
|
135204
135628
|
"wix.forms.v4.form_updated",
|
|
135205
135629
|
true,
|
|
135206
|
-
(event) =>
|
|
135207
|
-
|
|
135630
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
135631
|
+
transformPaths(event, [
|
|
135208
135632
|
{
|
|
135209
|
-
transformFn:
|
|
135633
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
135210
135634
|
paths: [
|
|
135211
135635
|
{ path: "entity.createdDate" },
|
|
135212
135636
|
{ path: "entity.updatedDate" },
|
|
@@ -146553,206 +146977,26 @@ var listDeletedForms4 = /* @__PURE__ */ createRESTModule(listDeletedForms3);
|
|
|
146553
146977
|
var bulkRemoveDeletedField4 = /* @__PURE__ */ createRESTModule(bulkRemoveDeletedField3);
|
|
146554
146978
|
var listFormsProvidersConfigs4 = /* @__PURE__ */ createRESTModule(listFormsProvidersConfigs3);
|
|
146555
146979
|
var getFormSummary4 = /* @__PURE__ */ createRESTModule(getFormSummary3);
|
|
146556
|
-
var onFormCreated2 =
|
|
146557
|
-
var onFormDeleted2 =
|
|
146558
|
-
var onFormDisabledForm2 =
|
|
146559
|
-
var onFormEnabledForm2 =
|
|
146560
|
-
var onFormTranslationChanged2 =
|
|
146980
|
+
var onFormCreated2 = createEventModule(onFormCreated);
|
|
146981
|
+
var onFormDeleted2 = createEventModule(onFormDeleted);
|
|
146982
|
+
var onFormDisabledForm2 = createEventModule(onFormDisabledForm);
|
|
146983
|
+
var onFormEnabledForm2 = createEventModule(onFormEnabledForm);
|
|
146984
|
+
var onFormTranslationChanged2 = createEventModule(
|
|
146561
146985
|
onFormTranslationChanged
|
|
146562
146986
|
);
|
|
146563
|
-
var onFormTranslationDeleted2 =
|
|
146987
|
+
var onFormTranslationDeleted2 = createEventModule(
|
|
146564
146988
|
onFormTranslationDeleted
|
|
146565
146989
|
);
|
|
146566
|
-
var onFormUpdated2 =
|
|
146567
|
-
|
|
146568
|
-
// ../../../node_modules/@wix/auto_sdk_forms_submissions/node_modules/@wix/sdk-runtime/build/constants.js
|
|
146569
|
-
var RESTResponseToSDKResponseRenameMap3 = {
|
|
146570
|
-
id: "_id",
|
|
146571
|
-
createdDate: "_createdDate",
|
|
146572
|
-
updatedDate: "_updatedDate"
|
|
146573
|
-
};
|
|
146574
|
-
|
|
146575
|
-
// ../../../node_modules/@wix/auto_sdk_forms_submissions/node_modules/@wix/sdk-runtime/build/rename-all-nested-keys.js
|
|
146576
|
-
function renameAllNestedKeys3(payload, renameMap, ignorePaths) {
|
|
146577
|
-
const isIgnored = (path2) => ignorePaths.includes(path2);
|
|
146578
|
-
const traverse = (obj, path2) => {
|
|
146579
|
-
if (Array.isArray(obj)) {
|
|
146580
|
-
obj.forEach((item) => {
|
|
146581
|
-
traverse(item, path2);
|
|
146582
|
-
});
|
|
146583
|
-
} else if (typeof obj === "object" && obj !== null) {
|
|
146584
|
-
const objAsRecord = obj;
|
|
146585
|
-
Object.keys(objAsRecord).forEach((key) => {
|
|
146586
|
-
const newPath = path2 === "" ? key : `${path2}.${key}`;
|
|
146587
|
-
if (isIgnored(newPath)) {
|
|
146588
|
-
return;
|
|
146589
|
-
}
|
|
146590
|
-
if (key in renameMap && !(renameMap[key] in objAsRecord)) {
|
|
146591
|
-
objAsRecord[renameMap[key]] = objAsRecord[key];
|
|
146592
|
-
delete objAsRecord[key];
|
|
146593
|
-
}
|
|
146594
|
-
traverse(objAsRecord[key], newPath);
|
|
146595
|
-
});
|
|
146596
|
-
}
|
|
146597
|
-
};
|
|
146598
|
-
traverse(payload, "");
|
|
146599
|
-
return payload;
|
|
146600
|
-
}
|
|
146601
|
-
function renameKeysFromRESTResponseToSDKResponse3(payload, ignorePaths = []) {
|
|
146602
|
-
return renameAllNestedKeys3(payload, RESTResponseToSDKResponseRenameMap3, ignorePaths);
|
|
146603
|
-
}
|
|
146604
|
-
|
|
146605
|
-
// ../../../node_modules/@wix/auto_sdk_forms_submissions/node_modules/@wix/sdk-runtime/build/transformations/timestamp.js
|
|
146606
|
-
function transformRESTTimestampToSDKTimestamp3(val) {
|
|
146607
|
-
return val ? new Date(val) : void 0;
|
|
146608
|
-
}
|
|
146609
|
-
|
|
146610
|
-
// ../../../node_modules/@wix/auto_sdk_forms_submissions/node_modules/@wix/sdk-runtime/build/transformations/transform-paths.js
|
|
146611
|
-
function transformPath3(obj, { path: path2, isRepeated, isMap }, transformFn) {
|
|
146612
|
-
const pathParts = path2.split(".");
|
|
146613
|
-
if (pathParts.length === 1 && path2 in obj) {
|
|
146614
|
-
obj[path2] = isRepeated ? obj[path2].map(transformFn) : isMap ? Object.fromEntries(Object.entries(obj[path2]).map(([key, value]) => [key, transformFn(value)])) : transformFn(obj[path2]);
|
|
146615
|
-
return obj;
|
|
146616
|
-
}
|
|
146617
|
-
const [first, ...rest] = pathParts;
|
|
146618
|
-
if (first.endsWith("{}")) {
|
|
146619
|
-
const cleanPath = first.slice(0, -2);
|
|
146620
|
-
obj[cleanPath] = Object.fromEntries(Object.entries(obj[cleanPath]).map(([key, value]) => [
|
|
146621
|
-
key,
|
|
146622
|
-
transformPath3(value, { path: rest.join("."), isRepeated, isMap }, transformFn)
|
|
146623
|
-
]));
|
|
146624
|
-
} else if (Array.isArray(obj[first])) {
|
|
146625
|
-
obj[first] = obj[first].map((item) => transformPath3(item, { path: rest.join("."), isRepeated, isMap }, transformFn));
|
|
146626
|
-
} else if (first in obj && typeof obj[first] === "object" && obj[first] !== null) {
|
|
146627
|
-
obj[first] = transformPath3(obj[first], { path: rest.join("."), isRepeated, isMap }, transformFn);
|
|
146628
|
-
} else if (first === "*") {
|
|
146629
|
-
Object.keys(obj).reduce((acc, curr) => {
|
|
146630
|
-
acc[curr] = transformPath3(obj[curr], { path: rest.join("."), isRepeated, isMap }, transformFn);
|
|
146631
|
-
return acc;
|
|
146632
|
-
}, obj);
|
|
146633
|
-
}
|
|
146634
|
-
return obj;
|
|
146635
|
-
}
|
|
146636
|
-
function transformPaths3(obj, transformations) {
|
|
146637
|
-
return transformations.reduce((acc, { paths, transformFn }) => paths.reduce((transformerAcc, path2) => transformPath3(transformerAcc, path2, transformFn), acc), obj);
|
|
146638
|
-
}
|
|
146639
|
-
|
|
146640
|
-
// ../../../node_modules/@wix/auto_sdk_forms_submissions/node_modules/@wix/sdk-runtime/build/context.js
|
|
146641
|
-
function resolveContext3() {
|
|
146642
|
-
const oldContext = typeof $wixContext !== "undefined" && $wixContext.initWixModules ? $wixContext.initWixModules : typeof globalThis.__wix_context__ !== "undefined" && globalThis.__wix_context__.initWixModules ? globalThis.__wix_context__.initWixModules : void 0;
|
|
146643
|
-
if (oldContext) {
|
|
146644
|
-
return {
|
|
146645
|
-
// @ts-expect-error
|
|
146646
|
-
initWixModules(modules, elevated) {
|
|
146647
|
-
return runWithoutContext3(() => oldContext(modules, elevated));
|
|
146648
|
-
},
|
|
146649
|
-
fetchWithAuth() {
|
|
146650
|
-
throw new Error("fetchWithAuth is not available in this context");
|
|
146651
|
-
},
|
|
146652
|
-
graphql() {
|
|
146653
|
-
throw new Error("graphql is not available in this context");
|
|
146654
|
-
}
|
|
146655
|
-
};
|
|
146656
|
-
}
|
|
146657
|
-
const contextualClient = typeof $wixContext !== "undefined" ? $wixContext.client : typeof wixContext.client !== "undefined" ? wixContext.client : typeof globalThis.__wix_context__ !== "undefined" ? globalThis.__wix_context__.client : void 0;
|
|
146658
|
-
const elevatedClient = typeof $wixContext !== "undefined" ? $wixContext.elevatedClient : typeof wixContext.elevatedClient !== "undefined" ? wixContext.elevatedClient : typeof globalThis.__wix_context__ !== "undefined" ? globalThis.__wix_context__.elevatedClient : void 0;
|
|
146659
|
-
if (!contextualClient && !elevatedClient) {
|
|
146660
|
-
return;
|
|
146661
|
-
}
|
|
146662
|
-
return {
|
|
146663
|
-
initWixModules(wixModules, elevated) {
|
|
146664
|
-
if (elevated) {
|
|
146665
|
-
if (!elevatedClient) {
|
|
146666
|
-
throw new Error("An elevated client is required to use elevated modules. Make sure to initialize the Wix context with an elevated client before using elevated SDK modules");
|
|
146667
|
-
}
|
|
146668
|
-
return runWithoutContext3(() => elevatedClient.use(wixModules));
|
|
146669
|
-
}
|
|
146670
|
-
if (!contextualClient) {
|
|
146671
|
-
throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
|
|
146672
|
-
}
|
|
146673
|
-
return runWithoutContext3(() => contextualClient.use(wixModules));
|
|
146674
|
-
},
|
|
146675
|
-
fetchWithAuth: (urlOrRequest, requestInit) => {
|
|
146676
|
-
if (!contextualClient) {
|
|
146677
|
-
throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
|
|
146678
|
-
}
|
|
146679
|
-
return contextualClient.fetchWithAuth(urlOrRequest, requestInit);
|
|
146680
|
-
},
|
|
146681
|
-
getAuth() {
|
|
146682
|
-
if (!contextualClient) {
|
|
146683
|
-
throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
|
|
146684
|
-
}
|
|
146685
|
-
return contextualClient.auth;
|
|
146686
|
-
},
|
|
146687
|
-
async graphql(query, variables, opts) {
|
|
146688
|
-
if (!contextualClient) {
|
|
146689
|
-
throw new Error("Wix context is not available. Make sure to initialize the Wix context before using SDK modules");
|
|
146690
|
-
}
|
|
146691
|
-
return contextualClient.graphql(query, variables, opts);
|
|
146692
|
-
}
|
|
146693
|
-
};
|
|
146694
|
-
}
|
|
146695
|
-
function runWithoutContext3(fn) {
|
|
146696
|
-
const globalContext = globalThis.__wix_context__;
|
|
146697
|
-
const moduleContext = {
|
|
146698
|
-
client: wixContext.client,
|
|
146699
|
-
elevatedClient: wixContext.elevatedClient
|
|
146700
|
-
};
|
|
146701
|
-
let closureContext;
|
|
146702
|
-
globalThis.__wix_context__ = void 0;
|
|
146703
|
-
wixContext.client = void 0;
|
|
146704
|
-
wixContext.elevatedClient = void 0;
|
|
146705
|
-
if (typeof $wixContext !== "undefined") {
|
|
146706
|
-
closureContext = {
|
|
146707
|
-
client: $wixContext?.client,
|
|
146708
|
-
elevatedClient: $wixContext?.elevatedClient
|
|
146709
|
-
};
|
|
146710
|
-
delete $wixContext.client;
|
|
146711
|
-
delete $wixContext.elevatedClient;
|
|
146712
|
-
}
|
|
146713
|
-
try {
|
|
146714
|
-
return fn();
|
|
146715
|
-
} finally {
|
|
146716
|
-
globalThis.__wix_context__ = globalContext;
|
|
146717
|
-
wixContext.client = moduleContext.client;
|
|
146718
|
-
wixContext.elevatedClient = moduleContext.elevatedClient;
|
|
146719
|
-
if (typeof $wixContext !== "undefined") {
|
|
146720
|
-
$wixContext.client = closureContext.client;
|
|
146721
|
-
$wixContext.elevatedClient = closureContext.elevatedClient;
|
|
146722
|
-
}
|
|
146723
|
-
}
|
|
146724
|
-
}
|
|
146725
|
-
|
|
146726
|
-
// ../../../node_modules/@wix/auto_sdk_forms_submissions/node_modules/@wix/sdk-runtime/build/context-v2.js
|
|
146727
|
-
function contextualizeEventDefinitionModuleV23(eventDefinition) {
|
|
146728
|
-
const contextualMethod = ((...args) => {
|
|
146729
|
-
const context = resolveContext3();
|
|
146730
|
-
if (!context) {
|
|
146731
|
-
return () => {
|
|
146732
|
-
};
|
|
146733
|
-
}
|
|
146734
|
-
return context.initWixModules(eventDefinition).apply(void 0, args);
|
|
146735
|
-
});
|
|
146736
|
-
contextualMethod.__type = eventDefinition.__type;
|
|
146737
|
-
contextualMethod.type = eventDefinition.type;
|
|
146738
|
-
contextualMethod.isDomainEvent = eventDefinition.isDomainEvent;
|
|
146739
|
-
contextualMethod.transformations = eventDefinition.transformations;
|
|
146740
|
-
return contextualMethod;
|
|
146741
|
-
}
|
|
146742
|
-
|
|
146743
|
-
// ../../../node_modules/@wix/auto_sdk_forms_submissions/node_modules/@wix/sdk-runtime/build/event-definition-modules.js
|
|
146744
|
-
function createEventModule3(eventDefinition) {
|
|
146745
|
-
return contextualizeEventDefinitionModuleV23(eventDefinition);
|
|
146746
|
-
}
|
|
146990
|
+
var onFormUpdated2 = createEventModule(onFormUpdated);
|
|
146747
146991
|
|
|
146748
146992
|
// ../../../node_modules/@wix/auto_sdk_forms_submissions/build/es/index.mjs
|
|
146749
146993
|
var onSubmissionCreated = EventDefinition(
|
|
146750
146994
|
"wix.forms.v4.submission_created",
|
|
146751
146995
|
true,
|
|
146752
|
-
(event) =>
|
|
146753
|
-
|
|
146996
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
146997
|
+
transformPaths(event, [
|
|
146754
146998
|
{
|
|
146755
|
-
transformFn:
|
|
146999
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
146756
147000
|
paths: [
|
|
146757
147001
|
{ path: "entity.createdDate" },
|
|
146758
147002
|
{ path: "entity.updatedDate" },
|
|
@@ -146765,10 +147009,10 @@ var onSubmissionCreated = EventDefinition(
|
|
|
146765
147009
|
var onSubmissionDeleted = EventDefinition(
|
|
146766
147010
|
"wix.forms.v4.submission_deleted",
|
|
146767
147011
|
true,
|
|
146768
|
-
(event) =>
|
|
146769
|
-
|
|
147012
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
147013
|
+
transformPaths(event, [
|
|
146770
147014
|
{
|
|
146771
|
-
transformFn:
|
|
147015
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
146772
147016
|
paths: [
|
|
146773
147017
|
{ path: "entity.createdDate" },
|
|
146774
147018
|
{ path: "entity.updatedDate" },
|
|
@@ -146781,10 +147025,10 @@ var onSubmissionDeleted = EventDefinition(
|
|
|
146781
147025
|
var onSubmissionRemovedSubmissionFromTrash = EventDefinition(
|
|
146782
147026
|
"wix.forms.v4.submission_removed_submission_from_trash",
|
|
146783
147027
|
true,
|
|
146784
|
-
(event) =>
|
|
146785
|
-
|
|
147028
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
147029
|
+
transformPaths(event, [
|
|
146786
147030
|
{
|
|
146787
|
-
transformFn:
|
|
147031
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
146788
147032
|
paths: [
|
|
146789
147033
|
{ path: "data.submission.createdDate" },
|
|
146790
147034
|
{ path: "data.submission.updatedDate" },
|
|
@@ -146797,10 +147041,10 @@ var onSubmissionRemovedSubmissionFromTrash = EventDefinition(
|
|
|
146797
147041
|
var onSubmissionStatusUpdated = EventDefinition(
|
|
146798
147042
|
"wix.forms.v4.submission_status_updated",
|
|
146799
147043
|
true,
|
|
146800
|
-
(event) =>
|
|
146801
|
-
|
|
147044
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
147045
|
+
transformPaths(event, [
|
|
146802
147046
|
{
|
|
146803
|
-
transformFn:
|
|
147047
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
146804
147048
|
paths: [
|
|
146805
147049
|
{ path: "data.submission.createdDate" },
|
|
146806
147050
|
{ path: "data.submission.updatedDate" },
|
|
@@ -146813,10 +147057,10 @@ var onSubmissionStatusUpdated = EventDefinition(
|
|
|
146813
147057
|
var onSubmissionContactMapped = EventDefinition(
|
|
146814
147058
|
"wix.forms.v4.submission_submission_contact_mapped",
|
|
146815
147059
|
true,
|
|
146816
|
-
(event) =>
|
|
146817
|
-
|
|
147060
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
147061
|
+
transformPaths(event, [
|
|
146818
147062
|
{
|
|
146819
|
-
transformFn:
|
|
147063
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
146820
147064
|
paths: [
|
|
146821
147065
|
{ path: "data.marketingSubscriptionDetails.submittedDate" },
|
|
146822
147066
|
{ path: "metadata.eventTime" }
|
|
@@ -146828,10 +147072,10 @@ var onSubmissionContactMapped = EventDefinition(
|
|
|
146828
147072
|
var onSubmissionContactMappingSkipped = EventDefinition(
|
|
146829
147073
|
"wix.forms.v4.submission_submission_contact_mapping_skipped",
|
|
146830
147074
|
true,
|
|
146831
|
-
(event) =>
|
|
146832
|
-
|
|
147075
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
147076
|
+
transformPaths(event, [
|
|
146833
147077
|
{
|
|
146834
|
-
transformFn:
|
|
147078
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
146835
147079
|
paths: [{ path: "metadata.eventTime" }]
|
|
146836
147080
|
}
|
|
146837
147081
|
])
|
|
@@ -146840,10 +147084,10 @@ var onSubmissionContactMappingSkipped = EventDefinition(
|
|
|
146840
147084
|
var onSubmissionUpdated = EventDefinition(
|
|
146841
147085
|
"wix.forms.v4.submission_updated",
|
|
146842
147086
|
true,
|
|
146843
|
-
(event) =>
|
|
146844
|
-
|
|
147087
|
+
(event) => renameKeysFromRESTResponseToSDKResponse(
|
|
147088
|
+
transformPaths(event, [
|
|
146845
147089
|
{
|
|
146846
|
-
transformFn:
|
|
147090
|
+
transformFn: transformRESTTimestampToSDKTimestamp,
|
|
146847
147091
|
paths: [
|
|
146848
147092
|
{ path: "entity.createdDate" },
|
|
146849
147093
|
{ path: "entity.updatedDate" },
|
|
@@ -146853,686 +147097,28 @@ var onSubmissionUpdated = EventDefinition(
|
|
|
146853
147097
|
])
|
|
146854
147098
|
)
|
|
146855
147099
|
)();
|
|
146856
|
-
|
|
147100
|
+
createEventModule(
|
|
146857
147101
|
onSubmissionCreated
|
|
146858
147102
|
);
|
|
146859
|
-
|
|
147103
|
+
createEventModule(
|
|
146860
147104
|
onSubmissionDeleted
|
|
146861
147105
|
);
|
|
146862
|
-
|
|
147106
|
+
createEventModule(
|
|
146863
147107
|
onSubmissionRemovedSubmissionFromTrash
|
|
146864
147108
|
);
|
|
146865
|
-
|
|
147109
|
+
createEventModule(
|
|
146866
147110
|
onSubmissionStatusUpdated
|
|
146867
147111
|
);
|
|
146868
|
-
|
|
147112
|
+
createEventModule(
|
|
146869
147113
|
onSubmissionContactMapped
|
|
146870
147114
|
);
|
|
146871
|
-
|
|
147115
|
+
createEventModule(
|
|
146872
147116
|
onSubmissionContactMappingSkipped
|
|
146873
147117
|
);
|
|
146874
|
-
|
|
147118
|
+
createEventModule(
|
|
146875
147119
|
onSubmissionUpdated
|
|
146876
147120
|
);
|
|
146877
147121
|
|
|
146878
|
-
// ../../../node_modules/dedent/dist/dedent.mjs
|
|
146879
|
-
function ownKeys(object, enumerableOnly) {
|
|
146880
|
-
var keys = Object.keys(object);
|
|
146881
|
-
if (Object.getOwnPropertySymbols) {
|
|
146882
|
-
var symbols = Object.getOwnPropertySymbols(object);
|
|
146883
|
-
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
146884
|
-
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
146885
|
-
})), keys.push.apply(keys, symbols);
|
|
146886
|
-
}
|
|
146887
|
-
return keys;
|
|
146888
|
-
}
|
|
146889
|
-
function _objectSpread(target) {
|
|
146890
|
-
for (var i = 1; i < arguments.length; i++) {
|
|
146891
|
-
var source = null != arguments[i] ? arguments[i] : {};
|
|
146892
|
-
i % 2 ? ownKeys(Object(source), true).forEach(function(key) {
|
|
146893
|
-
_defineProperty(target, key, source[key]);
|
|
146894
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
146895
|
-
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
146896
|
-
});
|
|
146897
|
-
}
|
|
146898
|
-
return target;
|
|
146899
|
-
}
|
|
146900
|
-
function _defineProperty(obj, key, value) {
|
|
146901
|
-
key = _toPropertyKey(key);
|
|
146902
|
-
if (key in obj) {
|
|
146903
|
-
Object.defineProperty(obj, key, { value, enumerable: true, configurable: true, writable: true });
|
|
146904
|
-
} else {
|
|
146905
|
-
obj[key] = value;
|
|
146906
|
-
}
|
|
146907
|
-
return obj;
|
|
146908
|
-
}
|
|
146909
|
-
function _toPropertyKey(arg) {
|
|
146910
|
-
var key = _toPrimitive(arg, "string");
|
|
146911
|
-
return typeof key === "symbol" ? key : String(key);
|
|
146912
|
-
}
|
|
146913
|
-
function _toPrimitive(input, hint) {
|
|
146914
|
-
if (typeof input !== "object" || input === null) return input;
|
|
146915
|
-
var prim = input[Symbol.toPrimitive];
|
|
146916
|
-
if (prim !== void 0) {
|
|
146917
|
-
var res = prim.call(input, hint);
|
|
146918
|
-
if (typeof res !== "object") return res;
|
|
146919
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
146920
|
-
}
|
|
146921
|
-
return (hint === "string" ? String : Number)(input);
|
|
146922
|
-
}
|
|
146923
|
-
var dedent = createDedent({});
|
|
146924
|
-
var dedent_default = dedent;
|
|
146925
|
-
function createDedent(options) {
|
|
146926
|
-
dedent2.withOptions = (newOptions) => createDedent(_objectSpread(_objectSpread({}, options), newOptions));
|
|
146927
|
-
return dedent2;
|
|
146928
|
-
function dedent2(strings, ...values) {
|
|
146929
|
-
const raw = typeof strings === "string" ? [strings] : strings.raw;
|
|
146930
|
-
const {
|
|
146931
|
-
escapeSpecialCharacters = Array.isArray(strings),
|
|
146932
|
-
trimWhitespace = true
|
|
146933
|
-
} = options;
|
|
146934
|
-
let result = "";
|
|
146935
|
-
for (let i = 0; i < raw.length; i++) {
|
|
146936
|
-
let next = raw[i];
|
|
146937
|
-
if (escapeSpecialCharacters) {
|
|
146938
|
-
next = next.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{");
|
|
146939
|
-
}
|
|
146940
|
-
result += next;
|
|
146941
|
-
if (i < values.length) {
|
|
146942
|
-
result += values[i];
|
|
146943
|
-
}
|
|
146944
|
-
}
|
|
146945
|
-
const lines = result.split("\n");
|
|
146946
|
-
let mindent = null;
|
|
146947
|
-
for (const l of lines) {
|
|
146948
|
-
const m = l.match(/^(\s+)\S+/);
|
|
146949
|
-
if (m) {
|
|
146950
|
-
const indent = m[1].length;
|
|
146951
|
-
if (!mindent) {
|
|
146952
|
-
mindent = indent;
|
|
146953
|
-
} else {
|
|
146954
|
-
mindent = Math.min(mindent, indent);
|
|
146955
|
-
}
|
|
146956
|
-
}
|
|
146957
|
-
}
|
|
146958
|
-
if (mindent !== null) {
|
|
146959
|
-
const m = mindent;
|
|
146960
|
-
result = lines.map((l) => l[0] === " " || l[0] === " " ? l.slice(m) : l).join("\n");
|
|
146961
|
-
}
|
|
146962
|
-
if (trimWhitespace) {
|
|
146963
|
-
result = result.trim();
|
|
146964
|
-
}
|
|
146965
|
-
if (escapeSpecialCharacters) {
|
|
146966
|
-
result = result.replace(/\\n/g, "\n");
|
|
146967
|
-
}
|
|
146968
|
-
return result;
|
|
146969
|
-
}
|
|
146970
|
-
}
|
|
146971
|
-
|
|
146972
|
-
// src/utils.ts
|
|
146973
|
-
var import_adm_zip = __toESM(require_adm_zip());
|
|
146974
|
-
|
|
146975
|
-
// src/constants.ts
|
|
146976
|
-
var VERTICAL_NAME = "forms-app";
|
|
146977
|
-
var FORMS_APP_DEF_ID = "225dd912-7dea-4738-8688-4b8c6955ffc2";
|
|
146978
|
-
var PLUGIN_FILES_ZIP_URL = "https://static.parastorage.com/services/vibe-forms-plugin-files/0.18.0/forms-plugin-files-files.zip";
|
|
146979
|
-
|
|
146980
|
-
// src/wix-apis.ts
|
|
146981
|
-
var callWixAPI = async (url, method, body) => {
|
|
146982
|
-
if (!process.env.WIX_TOKEN) {
|
|
146983
|
-
console.log("[wix-apis] WIX_TOKEN is not set");
|
|
146984
|
-
}
|
|
146985
|
-
try {
|
|
146986
|
-
console.log("[wix-apis] Calling Wix API...", { url, method });
|
|
146987
|
-
const response = await fetch(url, {
|
|
146988
|
-
method,
|
|
146989
|
-
headers: {
|
|
146990
|
-
"Content-Type": "application/json",
|
|
146991
|
-
Authorization: process.env.WIX_TOKEN
|
|
146992
|
-
},
|
|
146993
|
-
...method === "GET" ? {} : { body: JSON.stringify(body) }
|
|
146994
|
-
});
|
|
146995
|
-
if (!response.ok) {
|
|
146996
|
-
const responseText = await response.text();
|
|
146997
|
-
console.log("[wix-apis] Error calling Wix API", {
|
|
146998
|
-
responseText,
|
|
146999
|
-
url,
|
|
147000
|
-
method,
|
|
147001
|
-
body,
|
|
147002
|
-
requestId: response.headers.get("x-wix-request-id")
|
|
147003
|
-
});
|
|
147004
|
-
return null;
|
|
147005
|
-
}
|
|
147006
|
-
return await response.json();
|
|
147007
|
-
} catch (error) {
|
|
147008
|
-
console.log("[wix-apis] Error calling Wix API", {
|
|
147009
|
-
error,
|
|
147010
|
-
url,
|
|
147011
|
-
method,
|
|
147012
|
-
body,
|
|
147013
|
-
requestId: error instanceof Error && "requestId" in error ? error.requestId : void 0
|
|
147014
|
-
});
|
|
147015
|
-
return null;
|
|
147016
|
-
}
|
|
147017
|
-
};
|
|
147018
|
-
var installWixApp = async (appDefId, siteId) => {
|
|
147019
|
-
console.log("Installing Wix app...", { appDefId, siteId });
|
|
147020
|
-
const response = await callWixAPI(
|
|
147021
|
-
"https://www.wixapis.com/apps-installer-service/v1/app-instance/install",
|
|
147022
|
-
"POST",
|
|
147023
|
-
{
|
|
147024
|
-
tenant: {
|
|
147025
|
-
tenantType: "SITE",
|
|
147026
|
-
id: siteId
|
|
147027
|
-
},
|
|
147028
|
-
appInstance: {
|
|
147029
|
-
appDefId
|
|
147030
|
-
}
|
|
147031
|
-
}
|
|
147032
|
-
);
|
|
147033
|
-
return response;
|
|
147034
|
-
};
|
|
147035
|
-
|
|
147036
|
-
// src/utils.ts
|
|
147037
|
-
async function downloadZipFile(url, filePath) {
|
|
147038
|
-
return new Promise((resolve, reject) => {
|
|
147039
|
-
const file = fs__namespace.createWriteStream(filePath);
|
|
147040
|
-
const makeRequest = (requestUrl) => {
|
|
147041
|
-
https__default.default.get(requestUrl, (response) => {
|
|
147042
|
-
if (response.statusCode === 301 || response.statusCode === 302) {
|
|
147043
|
-
const location = response.headers.location;
|
|
147044
|
-
if (location) {
|
|
147045
|
-
console.log(
|
|
147046
|
-
`[${VERTICAL_NAME}-plugin-setup] following redirect to: ${location}`
|
|
147047
|
-
);
|
|
147048
|
-
makeRequest(location);
|
|
147049
|
-
return;
|
|
147050
|
-
}
|
|
147051
|
-
}
|
|
147052
|
-
if (response.statusCode !== 200) {
|
|
147053
|
-
reject(
|
|
147054
|
-
new Error(
|
|
147055
|
-
`Failed to download: ${response.statusCode} ${response.statusMessage}`
|
|
147056
|
-
)
|
|
147057
|
-
);
|
|
147058
|
-
return;
|
|
147059
|
-
}
|
|
147060
|
-
response.pipe(file);
|
|
147061
|
-
file.on("finish", () => {
|
|
147062
|
-
file.close();
|
|
147063
|
-
resolve();
|
|
147064
|
-
});
|
|
147065
|
-
file.on("error", (err) => {
|
|
147066
|
-
fs__namespace.unlink(filePath, () => {
|
|
147067
|
-
});
|
|
147068
|
-
reject(err);
|
|
147069
|
-
});
|
|
147070
|
-
}).on("error", (err) => {
|
|
147071
|
-
reject(err);
|
|
147072
|
-
});
|
|
147073
|
-
};
|
|
147074
|
-
makeRequest(url);
|
|
147075
|
-
});
|
|
147076
|
-
}
|
|
147077
|
-
var MOCK_SCHEMA = {
|
|
147078
|
-
namespace: "wix.form_app.form",
|
|
147079
|
-
fields: [
|
|
147080
|
-
{
|
|
147081
|
-
id: "30afbc7f-6266-4a3d-7f48-3de4a7c7d165",
|
|
147082
|
-
view: {
|
|
147083
|
-
submitText: "Submit",
|
|
147084
|
-
nextText: "Next",
|
|
147085
|
-
previousText: "Back",
|
|
147086
|
-
thankYouMessageText: {
|
|
147087
|
-
nodes: [
|
|
147088
|
-
{
|
|
147089
|
-
type: "PARAGRAPH",
|
|
147090
|
-
id: "py3dq1",
|
|
147091
|
-
nodes: [
|
|
147092
|
-
{
|
|
147093
|
-
type: "TEXT",
|
|
147094
|
-
id: "",
|
|
147095
|
-
nodes: [],
|
|
147096
|
-
textData: {
|
|
147097
|
-
text: "Thanks, we received your submission.",
|
|
147098
|
-
decorations: []
|
|
147099
|
-
}
|
|
147100
|
-
}
|
|
147101
|
-
],
|
|
147102
|
-
paragraphData: {
|
|
147103
|
-
textStyle: {
|
|
147104
|
-
textAlignment: "CENTER"
|
|
147105
|
-
}
|
|
147106
|
-
}
|
|
147107
|
-
}
|
|
147108
|
-
]
|
|
147109
|
-
},
|
|
147110
|
-
thankYouMessageDuration: 8,
|
|
147111
|
-
submitAction: "THANK_YOU_MESSAGE",
|
|
147112
|
-
fieldType: "SUBMIT_BUTTON"
|
|
147113
|
-
}
|
|
147114
|
-
},
|
|
147115
|
-
{
|
|
147116
|
-
id: "b27f777f-f3d6-42b0-0034-acf363d16aa5",
|
|
147117
|
-
target: "first_name_620e",
|
|
147118
|
-
view: {
|
|
147119
|
-
fieldType: "CONTACTS_FIRST_NAME",
|
|
147120
|
-
label: "First name"
|
|
147121
|
-
},
|
|
147122
|
-
validation: {
|
|
147123
|
-
string: {}
|
|
147124
|
-
},
|
|
147125
|
-
pii: true
|
|
147126
|
-
},
|
|
147127
|
-
{
|
|
147128
|
-
id: "ceae0b6e-1ee9-4f7c-ea64-2ff0966bf60d",
|
|
147129
|
-
target: "last_name_68b3",
|
|
147130
|
-
view: {
|
|
147131
|
-
fieldType: "CONTACTS_LAST_NAME",
|
|
147132
|
-
label: "Last name"
|
|
147133
|
-
},
|
|
147134
|
-
validation: {
|
|
147135
|
-
string: {}
|
|
147136
|
-
},
|
|
147137
|
-
pii: true
|
|
147138
|
-
},
|
|
147139
|
-
{
|
|
147140
|
-
id: "2e1e030b-ca2a-44dd-4116-16a4a53db1a8",
|
|
147141
|
-
target: "email_4419",
|
|
147142
|
-
view: {
|
|
147143
|
-
fieldType: "CONTACTS_EMAIL",
|
|
147144
|
-
label: "Email"
|
|
147145
|
-
},
|
|
147146
|
-
validation: {
|
|
147147
|
-
string: {
|
|
147148
|
-
format: "EMAIL"
|
|
147149
|
-
}
|
|
147150
|
-
},
|
|
147151
|
-
pii: true
|
|
147152
|
-
}
|
|
147153
|
-
],
|
|
147154
|
-
steps: [
|
|
147155
|
-
{
|
|
147156
|
-
id: "a2d7f252-701b-442f-ff04-4cc14aacd2be",
|
|
147157
|
-
name: "Page 1",
|
|
147158
|
-
layout: {
|
|
147159
|
-
large: {
|
|
147160
|
-
items: [
|
|
147161
|
-
{
|
|
147162
|
-
fieldId: "30afbc7f-6266-4a3d-7f48-3de4a7c7d165",
|
|
147163
|
-
column: 0,
|
|
147164
|
-
row: 3,
|
|
147165
|
-
width: 12,
|
|
147166
|
-
height: 1
|
|
147167
|
-
},
|
|
147168
|
-
{
|
|
147169
|
-
fieldId: "b27f777f-f3d6-42b0-0034-acf363d16aa5",
|
|
147170
|
-
column: 0,
|
|
147171
|
-
row: 0,
|
|
147172
|
-
width: 12,
|
|
147173
|
-
height: 1
|
|
147174
|
-
},
|
|
147175
|
-
{
|
|
147176
|
-
fieldId: "ceae0b6e-1ee9-4f7c-ea64-2ff0966bf60d",
|
|
147177
|
-
column: 0,
|
|
147178
|
-
row: 1,
|
|
147179
|
-
width: 12,
|
|
147180
|
-
height: 1
|
|
147181
|
-
},
|
|
147182
|
-
{
|
|
147183
|
-
fieldId: "2e1e030b-ca2a-44dd-4116-16a4a53db1a8",
|
|
147184
|
-
column: 0,
|
|
147185
|
-
row: 2,
|
|
147186
|
-
width: 12,
|
|
147187
|
-
height: 1
|
|
147188
|
-
}
|
|
147189
|
-
]
|
|
147190
|
-
}
|
|
147191
|
-
}
|
|
147192
|
-
}
|
|
147193
|
-
],
|
|
147194
|
-
properties: {
|
|
147195
|
-
name: "My Form"
|
|
147196
|
-
},
|
|
147197
|
-
submitSettings: {
|
|
147198
|
-
submitSuccessAction: "THANK_YOU_MESSAGE",
|
|
147199
|
-
thankYouMessageOptions: {
|
|
147200
|
-
richContent: {
|
|
147201
|
-
nodes: [
|
|
147202
|
-
{
|
|
147203
|
-
type: "PARAGRAPH",
|
|
147204
|
-
id: "1dbu62",
|
|
147205
|
-
nodes: [
|
|
147206
|
-
{
|
|
147207
|
-
type: "TEXT",
|
|
147208
|
-
id: "",
|
|
147209
|
-
nodes: [],
|
|
147210
|
-
textData: {
|
|
147211
|
-
text: "Thanks, we received your submission.",
|
|
147212
|
-
decorations: []
|
|
147213
|
-
}
|
|
147214
|
-
}
|
|
147215
|
-
],
|
|
147216
|
-
paragraphData: {
|
|
147217
|
-
textStyle: {
|
|
147218
|
-
textAlignment: "CENTER"
|
|
147219
|
-
}
|
|
147220
|
-
}
|
|
147221
|
-
}
|
|
147222
|
-
],
|
|
147223
|
-
metadata: {
|
|
147224
|
-
version: 1,
|
|
147225
|
-
id: "7dc8e190-8f88-4977-af26-c0d9397ccdbc"
|
|
147226
|
-
}
|
|
147227
|
-
},
|
|
147228
|
-
durationInSeconds: 8
|
|
147229
|
-
}
|
|
147230
|
-
},
|
|
147231
|
-
nestedForms: [],
|
|
147232
|
-
deletedFields: [],
|
|
147233
|
-
postSubmissionTriggers: {
|
|
147234
|
-
upsertContact: {
|
|
147235
|
-
fieldsMapping: {
|
|
147236
|
-
first_name_620e: {
|
|
147237
|
-
contactField: "FIRST_NAME"
|
|
147238
|
-
},
|
|
147239
|
-
last_name_68b3: {
|
|
147240
|
-
contactField: "LAST_NAME"
|
|
147241
|
-
},
|
|
147242
|
-
email_4419: {
|
|
147243
|
-
contactField: "EMAIL",
|
|
147244
|
-
emailInfo: {
|
|
147245
|
-
tag: "UNTAGGED"
|
|
147246
|
-
}
|
|
147247
|
-
}
|
|
147248
|
-
},
|
|
147249
|
-
labels: []
|
|
147250
|
-
}
|
|
147251
|
-
}
|
|
147252
|
-
};
|
|
147253
|
-
var installFormsApp = async (env) => {
|
|
147254
|
-
console.log(
|
|
147255
|
-
"[forms-app-plugin-install] Installing vertical functionality...",
|
|
147256
|
-
env
|
|
147257
|
-
);
|
|
147258
|
-
await installWixApp(FORMS_APP_DEF_ID, env.WIX_SITE_ID);
|
|
147259
|
-
console.log("[forms-app-plugin-install] Forms App installation completed");
|
|
147260
|
-
};
|
|
147261
|
-
var unzipAndMergePluginFiles = async (env, zipUrl) => {
|
|
147262
|
-
console.log(
|
|
147263
|
-
`[${VERTICAL_NAME}-plugin-install] Unzipping plugin files from dependency...`
|
|
147264
|
-
);
|
|
147265
|
-
const zipPath = path__namespace.join(process.cwd(), "picasso-forms-plugin-files.zip");
|
|
147266
|
-
const targetDir = path__namespace.join(env.CODEGEN_APP_ROOT, "src");
|
|
147267
|
-
try {
|
|
147268
|
-
console.log(
|
|
147269
|
-
`[${VERTICAL_NAME}-plugin-install] downloading zip file to:`,
|
|
147270
|
-
zipPath
|
|
147271
|
-
);
|
|
147272
|
-
await downloadZipFile(zipUrl, zipPath);
|
|
147273
|
-
const zip = new import_adm_zip.default(zipPath);
|
|
147274
|
-
console.log(`[${VERTICAL_NAME}-plugin-install] Unzipping files...`);
|
|
147275
|
-
zip.getEntries().forEach((entry) => {
|
|
147276
|
-
if (!entry.isDirectory) {
|
|
147277
|
-
const entryPath = entry.entryName;
|
|
147278
|
-
const targetPath = path__namespace.join(targetDir, entryPath);
|
|
147279
|
-
const targetDirPath = path__namespace.dirname(targetPath);
|
|
147280
|
-
if (!fs__namespace.existsSync(targetDirPath)) {
|
|
147281
|
-
fs__namespace.mkdirSync(targetDirPath, { recursive: true });
|
|
147282
|
-
}
|
|
147283
|
-
fs__namespace.writeFileSync(targetPath, entry.getData());
|
|
147284
|
-
console.log(
|
|
147285
|
-
`[${VERTICAL_NAME}-plugin-install] Extracted: ${targetPath}`
|
|
147286
|
-
);
|
|
147287
|
-
}
|
|
147288
|
-
});
|
|
147289
|
-
console.log(
|
|
147290
|
-
`[${VERTICAL_NAME}-plugin-install] Plugin files unzipped and merged successfully`
|
|
147291
|
-
);
|
|
147292
|
-
} catch (error) {
|
|
147293
|
-
console.log(
|
|
147294
|
-
`[${VERTICAL_NAME}-plugin-install] Error downloading or unzipping plugin files:`,
|
|
147295
|
-
error
|
|
147296
|
-
);
|
|
147297
|
-
throw error;
|
|
147298
|
-
}
|
|
147299
|
-
};
|
|
147300
|
-
|
|
147301
|
-
// src/forms-app-instructions.ts
|
|
147302
|
-
var getRouterFileContent = () => {
|
|
147303
|
-
return dedent_default`
|
|
147304
|
-
import {
|
|
147305
|
-
createBrowserRouter,
|
|
147306
|
-
RouterProvider,
|
|
147307
|
-
Navigate,
|
|
147308
|
-
Outlet,
|
|
147309
|
-
} from 'react-router-dom';
|
|
147310
|
-
import { FormAppPage, formAppPageLoader } from './forms/FormAppPage';
|
|
147311
|
-
|
|
147312
|
-
// Layout component (optional)
|
|
147313
|
-
function Layout() {
|
|
147314
|
-
return (
|
|
147315
|
-
<>
|
|
147316
|
-
<Outlet />
|
|
147317
|
-
</>
|
|
147318
|
-
);
|
|
147319
|
-
}
|
|
147320
|
-
|
|
147321
|
-
const router = createBrowserRouter([
|
|
147322
|
-
{
|
|
147323
|
-
path: "/",
|
|
147324
|
-
element: <Layout />,
|
|
147325
|
-
children: [
|
|
147326
|
-
{
|
|
147327
|
-
path: "forms/:formId",
|
|
147328
|
-
element: <FormAppPage />,
|
|
147329
|
-
loader: formAppPageLoader,
|
|
147330
|
-
},
|
|
147331
|
-
{
|
|
147332
|
-
index: true,
|
|
147333
|
-
element: <Navigate to="/forms/your-default-form-id" replace />,
|
|
147334
|
-
},
|
|
147335
|
-
{
|
|
147336
|
-
path: "*",
|
|
147337
|
-
element: <Navigate to="/" replace />,
|
|
147338
|
-
},
|
|
147339
|
-
],
|
|
147340
|
-
},
|
|
147341
|
-
], {
|
|
147342
|
-
basename: import.meta.env.BASE_NAME,
|
|
147343
|
-
});
|
|
147344
|
-
|
|
147345
|
-
export default function AppRouter() {
|
|
147346
|
-
return <RouterProvider router={router} />;
|
|
147347
|
-
}
|
|
147348
|
-
`;
|
|
147349
|
-
};
|
|
147350
|
-
var getFormsCodingInstructions = () => dedent_default`
|
|
147351
|
-
<forms_instructions>
|
|
147352
|
-
|
|
147353
|
-
Your tasks for implementing and integrating the Forms features of the site are:
|
|
147354
|
-
|
|
147355
|
-
# FIRST TASK: INTEGRATE THE FORMS ROUTES INTO THE SITE ROUTER
|
|
147356
|
-
|
|
147357
|
-
Integrate the forms routes into the existing router of the app.
|
|
147358
|
-
|
|
147359
|
-
**⚠️ IMPORTANT: The forms app is a complete, self-contained solution that ONLY works with the FormAppPage component. You cannot use individual form components separately or create custom form implementations.**
|
|
147360
|
-
|
|
147361
|
-
## Example Forms Router File
|
|
147362
|
-
You should not use it as is, but rather use the content of the file as reference for how to implement the router in the app.
|
|
147363
|
-
\`\`\`tsx
|
|
147364
|
-
${getRouterFileContent()}
|
|
147365
|
-
\`\`\`
|
|
147366
|
-
|
|
147367
|
-
## FormAppPage Usage
|
|
147368
|
-
|
|
147369
|
-
The FormAppPage is ALREADY IMPLEMENTED and uses React Router's loader pattern for data fetching with slug-based routing.
|
|
147370
|
-
|
|
147371
|
-
**Required Imports:**
|
|
147372
|
-
\`\`\`tsx
|
|
147373
|
-
import { FormAppPage, formAppPageLoader } from '@/components/forms/FormAppPage';
|
|
147374
|
-
\`\`\`
|
|
147375
|
-
|
|
147376
|
-
**Router Configuration:**
|
|
147377
|
-
\`\`\tsx
|
|
147378
|
-
{
|
|
147379
|
-
path: "forms/:formId",
|
|
147380
|
-
element: <FormAppPage />,
|
|
147381
|
-
loader: formAppPageLoader,
|
|
147382
|
-
}
|
|
147383
|
-
\`\`\`
|
|
147384
|
-
|
|
147385
|
-
**⚠️ CRITICAL: Router Setup Requirements**
|
|
147386
|
-
- The FormAppPage component MUST be used within a React Router context
|
|
147387
|
-
- The loader (formAppPageLoader) MUST be configured in the router
|
|
147388
|
-
- The formId parameter comes from the URL path (e.g., /forms/abc123 → formId = "abc123")
|
|
147389
|
-
- FormAppPage will show an error message if used outside of router context
|
|
147390
|
-
- **NEVER use FormAppPage as an index route** - it requires a formId parameter
|
|
147391
|
-
- **ALWAYS use the path "forms/:formId"** - not as a root route
|
|
147392
|
-
|
|
147393
|
-
**Complete Router Example:**
|
|
147394
|
-
\`\`\`tsx
|
|
147395
|
-
import { createBrowserRouter, RouterProvider, Navigate, Outlet } from 'react-router-dom';
|
|
147396
|
-
import { FormAppPage, formAppPageLoader } from '@/components/forms/FormAppPage';
|
|
147397
|
-
|
|
147398
|
-
// Layout component (optional)
|
|
147399
|
-
function Layout() {
|
|
147400
|
-
return <Outlet />;
|
|
147401
|
-
}
|
|
147402
|
-
|
|
147403
|
-
const router = createBrowserRouter([
|
|
147404
|
-
{
|
|
147405
|
-
path: "/",
|
|
147406
|
-
element: <Layout />,
|
|
147407
|
-
children: [
|
|
147408
|
-
{
|
|
147409
|
-
path: "forms/:formId",
|
|
147410
|
-
element: <FormAppPage />,
|
|
147411
|
-
loader: formAppPageLoader,
|
|
147412
|
-
},
|
|
147413
|
-
{
|
|
147414
|
-
index: true,
|
|
147415
|
-
element: <Navigate to="/forms/your-default-form-id" replace />,
|
|
147416
|
-
},
|
|
147417
|
-
{
|
|
147418
|
-
path: "*",
|
|
147419
|
-
element: <Navigate to="/" replace />,
|
|
147420
|
-
},
|
|
147421
|
-
],
|
|
147422
|
-
},
|
|
147423
|
-
], {
|
|
147424
|
-
basename: import.meta.env.BASE_NAME,
|
|
147425
|
-
});
|
|
147426
|
-
|
|
147427
|
-
function App() {
|
|
147428
|
-
return <RouterProvider router={router} />;
|
|
147429
|
-
}
|
|
147430
|
-
\`\`\`
|
|
147431
|
-
|
|
147432
|
-
**Note:** Forms don't require MemberProvider - they work independently of user authentication.
|
|
147433
|
-
|
|
147434
|
-
|
|
147435
|
-
# SECOND TASK: FORMS CODE CHANGES:
|
|
147436
|
-
**ABSOLUTE PROHIBITION: DO NOT EDIT, MODIFY, OR IMPLEMENT ANY FORM COMPONENTS OR FORM FIELDS CODE!**
|
|
147437
|
-
|
|
147438
|
-
**🎯 KEY POINT: The forms app is designed to work ONLY as a complete page solution using FormAppPage. Individual form components cannot be used separately.**
|
|
147439
|
-
|
|
147440
|
-
### 🚫 FORBIDDEN: Custom Form Components
|
|
147441
|
-
**DO NOT implement custom form components or use generic form UI components!**
|
|
147442
|
-
|
|
147443
|
-
**NEVER use these imports:**
|
|
147444
|
-
\`\`\`tsx
|
|
147445
|
-
// ❌ FORBIDDEN - Do not use these generic form components
|
|
147446
|
-
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from '@/components/ui/form';
|
|
147447
|
-
\`\`\`
|
|
147448
|
-
|
|
147449
|
-
**NEVER implement custom form components like:**
|
|
147450
|
-
- Custom form wrappers
|
|
147451
|
-
- Custom form fields
|
|
147452
|
-
- Custom form validation components
|
|
147453
|
-
- Custom form submission handlers
|
|
147454
|
-
|
|
147455
|
-
### What is FORBIDDEN:
|
|
147456
|
-
- **NEVER edit any files** in <code>src/components/forms/</code> directory
|
|
147457
|
-
- **NEVER modify form fields code** - use all form components exactly as they are
|
|
147458
|
-
- **NEVER change form functionality** - all form logic is already implemented
|
|
147459
|
-
- **NEVER read form component files** for implementation purposes
|
|
147460
|
-
|
|
147461
|
-
### ✅ ALLOWED: Only Use These Specific Components
|
|
147462
|
-
**ONLY use these pre-built form components:**
|
|
147463
|
-
- \`FormAppPage\` - Main form page component with loader (requires React Router)
|
|
147464
|
-
- \`formAppPageLoader\` - Data loader for form configuration
|
|
147465
|
-
- \`FormAppFields\` - Form fields component with FIELD_MAP
|
|
147466
|
-
- \`FormAppForm\` - Form wrapper component with Wix headless forms
|
|
147467
|
-
- Individual field components: \`TextInput\`, \`TextArea\`, \`NumberInput\`, \`PhoneInput\`, \`Checkbox\`, \`RadioGroup\`, \`CheckboxGroup\`, \`Dropdown\`, \`FileUpload\`, \`SubmitButton\`, \`RichText\`
|
|
147468
|
-
|
|
147469
|
-
**Required Usage:**
|
|
147470
|
-
\`\`\`tsx
|
|
147471
|
-
// MUST be used in router configuration
|
|
147472
|
-
{ path: "forms/:formId", element: <FormAppPage />, loader: formAppPageLoader }
|
|
147473
|
-
\`\`\`
|
|
147474
|
-
|
|
147475
|
-
**⚠️ IMPORTANT:** FormAppPage MUST be used within a React Router context. If used outside of router context, it will display a helpful error message with instructions.
|
|
147476
|
-
|
|
147477
|
-
**🚫 COMMON ROUTER MISTAKES TO AVOID:**
|
|
147478
|
-
|
|
147479
|
-
1. **❌ WRONG - Using FormAppPage as index route:**
|
|
147480
|
-
\`\`\`tsx
|
|
147481
|
-
// DON'T DO THIS - FormAppPage needs formId parameter
|
|
147482
|
-
{
|
|
147483
|
-
index: true,
|
|
147484
|
-
element: <FormAppPage />,
|
|
147485
|
-
loader: formAppPageLoader,
|
|
147486
|
-
}
|
|
147487
|
-
\`\`\`
|
|
147488
|
-
|
|
147489
|
-
2. **❌ WRONG - Using root path without formId:**
|
|
147490
|
-
\`\`\`tsx
|
|
147491
|
-
// DON'T DO THIS - Missing formId parameter
|
|
147492
|
-
{
|
|
147493
|
-
path: "/",
|
|
147494
|
-
element: <FormAppPage />,
|
|
147495
|
-
loader: formAppPageLoader,
|
|
147496
|
-
}
|
|
147497
|
-
\`\`\`
|
|
147498
|
-
|
|
147499
|
-
3. **✅ CORRECT - Using proper nested route:**
|
|
147500
|
-
\`\`\`tsx
|
|
147501
|
-
// DO THIS - Proper nested route with formId
|
|
147502
|
-
{
|
|
147503
|
-
path: "forms/:formId",
|
|
147504
|
-
element: <FormAppPage />,
|
|
147505
|
-
loader: formAppPageLoader,
|
|
147506
|
-
}
|
|
147507
|
-
\`\`\`
|
|
147508
|
-
|
|
147509
|
-
### What you MUST do:
|
|
147510
|
-
- **ONLY use FormAppPage** - This is the ONLY way to implement forms in your app
|
|
147511
|
-
- **ONLY integrate** form page into site routes with proper loader configuration
|
|
147512
|
-
- **USE EVERYTHING AS IS** from the forms components directory
|
|
147513
|
-
- **ALWAYS include the loader** when using FormAppPage in router configuration
|
|
147514
|
-
- **ALWAYS use within React Router context** - FormAppPage requires router setup
|
|
147515
|
-
|
|
147516
|
-
### Form Components Handle Everything:
|
|
147517
|
-
- The FormAppPage uses Wix headless forms service for data loading with the formId from the URL slug
|
|
147518
|
-
- The loader receives the formId parameter from the route (e.g., \`/forms/3d2d2976-742e-447e-bbb9-9a92ac6a5376\` → formId = "3d2d2976-742e-447e-bbb9-9a92ac6a5376")
|
|
147519
|
-
- Form components use semantic color/font system classes (text-foreground, bg-background, etc.)
|
|
147520
|
-
- Form components handle onChange, onBlur, onFocus, onSubmit events automatically
|
|
147521
|
-
- Form components update form data automatically with proper validation
|
|
147522
|
-
- Form components handle validation and error display with consistent styling
|
|
147523
|
-
- Form components manage all form state and behavior using Wix forms SDK
|
|
147524
|
-
|
|
147525
|
-
# THIRD TASK: CODE THE REST OF THE SITE PAGES
|
|
147526
|
-
|
|
147527
|
-
<important_notes>
|
|
147528
|
-
<strong>ALL FORMS FEATURES (submit button, validation, etc.) ARE ALREADY IMPLEMENTED BY THE FORMS COMPONENTS.</strong>
|
|
147529
|
-
<strong>THE REST OF THE SITE PAGES SHOULD BE IMPLEMENTED AS USUAL ACCORDING TO THE PLAN AND USER REQUESTS, FOLLOWING THE OTHER INSTRUCTIONS IN THE CONTEXT.</strong>
|
|
147530
|
-
|
|
147531
|
-
</important_notes>
|
|
147532
|
-
|
|
147533
|
-
</forms_instructions>
|
|
147534
|
-
`;
|
|
147535
|
-
|
|
147536
147122
|
// ../../../node_modules/@wix/sdk/build/ambassador-modules.js
|
|
147537
147123
|
var parseMethod = (method) => {
|
|
147538
147124
|
switch (method) {
|
|
@@ -147675,8 +147261,8 @@ function objectToKeyValue(input) {
|
|
|
147675
147261
|
return Object.entries(input).filter(([_, value]) => Boolean(value)).map(([key, value]) => `${key}=${value}`).join(",");
|
|
147676
147262
|
}
|
|
147677
147263
|
|
|
147678
|
-
// ../../../node_modules/@wix/sdk-runtime/build/context.js
|
|
147679
|
-
function
|
|
147264
|
+
// ../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/context.js
|
|
147265
|
+
function runWithoutContext2(fn) {
|
|
147680
147266
|
const globalContext = globalThis.__wix_context__;
|
|
147681
147267
|
const moduleContext = {
|
|
147682
147268
|
client: wixContext.client,
|
|
@@ -147707,7 +147293,7 @@ function runWithoutContext4(fn) {
|
|
|
147707
147293
|
}
|
|
147708
147294
|
}
|
|
147709
147295
|
|
|
147710
|
-
// ../../../node_modules/@wix/sdk-runtime/build/utils.js
|
|
147296
|
+
// ../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/utils.js
|
|
147711
147297
|
function constantCase2(input) {
|
|
147712
147298
|
return split2(input).map((part) => part.toLocaleUpperCase()).join("_");
|
|
147713
147299
|
}
|
|
@@ -147733,7 +147319,7 @@ function split2(value) {
|
|
|
147733
147319
|
return result.slice(start, end).split(/\0/g);
|
|
147734
147320
|
}
|
|
147735
147321
|
|
|
147736
|
-
// ../../../node_modules/@wix/sdk-runtime/build/transform-error.js
|
|
147322
|
+
// ../../../node_modules/@wix/sdk/node_modules/@wix/sdk-runtime/build/transform-error.js
|
|
147737
147323
|
var isValidationError2 = (httpClientError) => "validationError" in (httpClientError.response?.data?.details ?? {});
|
|
147738
147324
|
var isApplicationError2 = (httpClientError) => "applicationError" in (httpClientError.response?.data?.details ?? {});
|
|
147739
147325
|
var isClientError2 = (httpClientError) => (httpClientError.response?.status ?? -1) >= 400 && (httpClientError.response?.status ?? -1) < 500;
|
|
@@ -147890,13 +147476,13 @@ var getArgumentIndex2 = (s) => {
|
|
|
147890
147476
|
|
|
147891
147477
|
// ../../../node_modules/@wix/sdk/build/rest-modules.js
|
|
147892
147478
|
function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, errorHandler, wixAPIFetch, getActiveToken, options, hostName, useCDN) {
|
|
147893
|
-
return
|
|
147479
|
+
return runWithoutContext2(() => origFunc({
|
|
147894
147480
|
request: async (factory) => {
|
|
147895
147481
|
const requestOptions = factory({
|
|
147896
147482
|
host: options?.HTTPHost || DEFAULT_API_URL
|
|
147897
147483
|
});
|
|
147898
147484
|
let request = requestOptions;
|
|
147899
|
-
if (request.method === "GET" && request.fallback?.length && request.params
|
|
147485
|
+
if (request.method === "GET" && request.fallback?.length && (request.params?.toString().length ?? 0) > 4e3) {
|
|
147900
147486
|
request = requestOptions.fallback[0];
|
|
147901
147487
|
}
|
|
147902
147488
|
const domain = options?.HTTPHost ?? DEFAULT_API_URL;
|
|
@@ -147937,7 +147523,13 @@ function buildRESTDescriptor(origFunc, publicMetadata, boundFetch, errorHandler,
|
|
|
147937
147523
|
});
|
|
147938
147524
|
throw error;
|
|
147939
147525
|
}
|
|
147940
|
-
const
|
|
147526
|
+
const rawData = await res.json();
|
|
147527
|
+
const data = (
|
|
147528
|
+
// we only transform the response if the optInTransformResponse flag is set
|
|
147529
|
+
// this is for backwards compatibility as some users might rely on not transforming the response
|
|
147530
|
+
// in older modules. In that case the modules would not have the optInTransformResponse flag set
|
|
147531
|
+
request.migrationOptions?.optInTransformResponse && request.transformResponse ? Array.isArray(request.transformResponse) ? request.transformResponse[0](rawData) : request.transformResponse(rawData) : rawData
|
|
147532
|
+
);
|
|
147941
147533
|
return {
|
|
147942
147534
|
data,
|
|
147943
147535
|
headers: res.headers,
|
|
@@ -148309,7 +147901,7 @@ function createClient(config) {
|
|
|
148309
147901
|
}
|
|
148310
147902
|
const apiBaseUrl = config.host?.apiBaseUrl ?? DEFAULT_API_URL;
|
|
148311
147903
|
const shouldUseCDN = config.useCDN === void 0 ? config.auth?.shouldUseCDN : config.useCDN;
|
|
148312
|
-
return buildRESTDescriptor(
|
|
147904
|
+
return buildRESTDescriptor(runWithoutContext2(() => isAmbassadorModule(modules)) ? toHTTPModule(modules) : modules, metadata ?? {}, boundFetch, config.host?.getErrorHandler?.(), (relativeUrl, fetchOptions) => {
|
|
148313
147905
|
const finalUrl = new URL(relativeUrl, `https://${apiBaseUrl}`);
|
|
148314
147906
|
finalUrl.host = apiBaseUrl;
|
|
148315
147907
|
finalUrl.protocol = "https";
|
|
@@ -148396,111 +147988,103 @@ function findConsistentHeader(response) {
|
|
|
148396
147988
|
return response.headers?.get(X_WIX_CONSISTENT_HEADER) ?? response.headers?.get(X_WIX_CONSISTENT_HEADER.toLowerCase());
|
|
148397
147989
|
}
|
|
148398
147990
|
|
|
148399
|
-
// src/
|
|
147991
|
+
// src/wix-forms-apis.ts
|
|
147992
|
+
var getWixClient = async (siteId) => {
|
|
147993
|
+
const authHeaders = {
|
|
147994
|
+
Authorization: process.env.WIX_TOKEN,
|
|
147995
|
+
"wix-site-id": siteId
|
|
147996
|
+
};
|
|
147997
|
+
const wixClient = createClient({
|
|
147998
|
+
auth: {
|
|
147999
|
+
getAuthHeaders: async () => {
|
|
148000
|
+
return {
|
|
148001
|
+
headers: authHeaders
|
|
148002
|
+
};
|
|
148003
|
+
}
|
|
148004
|
+
},
|
|
148005
|
+
modules: {
|
|
148006
|
+
forms: es_exports
|
|
148007
|
+
}
|
|
148008
|
+
});
|
|
148009
|
+
return wixClient;
|
|
148010
|
+
};
|
|
148400
148011
|
async function createForm5(schema, siteId) {
|
|
148012
|
+
console.log(
|
|
148013
|
+
`[${VERTICAL_NAME}-plugin-generateData] Calling createForm...`,
|
|
148014
|
+
schema
|
|
148015
|
+
);
|
|
148401
148016
|
try {
|
|
148402
148017
|
const wixClient = await getWixClient(siteId);
|
|
148403
|
-
console.log(
|
|
148404
|
-
`[${VERTICAL_NAME}-plugin-generateData] !!!!! Calling createForm...`,
|
|
148405
|
-
schema
|
|
148406
|
-
);
|
|
148407
148018
|
const result = await wixClient.forms.createForm(schema);
|
|
148408
148019
|
console.log(
|
|
148409
|
-
`[${VERTICAL_NAME}-plugin-generateData]
|
|
148020
|
+
`[${VERTICAL_NAME}-plugin-generateData] Form created...`,
|
|
148410
148021
|
result
|
|
148411
148022
|
);
|
|
148412
148023
|
return result;
|
|
148413
148024
|
} catch (error) {
|
|
148414
148025
|
console.log(
|
|
148415
|
-
|
|
148026
|
+
`[${VERTICAL_NAME}-plugin-generateData] Error creating form:`,
|
|
148416
148027
|
error
|
|
148417
148028
|
);
|
|
148418
148029
|
return null;
|
|
148419
148030
|
}
|
|
148420
148031
|
}
|
|
148032
|
+
|
|
148033
|
+
// src/index.ts
|
|
148421
148034
|
var install = async (env) => {
|
|
148422
|
-
console.log(
|
|
148035
|
+
console.log(`[${VERTICAL_NAME}-plugin-install] Starting installation`, env);
|
|
148423
148036
|
console.log(
|
|
148424
|
-
|
|
148037
|
+
`[${VERTICAL_NAME}-plugin-install] Installing forms app functionality...`
|
|
148425
148038
|
);
|
|
148426
148039
|
await installFormsApp(env);
|
|
148427
148040
|
console.log(
|
|
148428
148041
|
`[${VERTICAL_NAME}-plugin-install] Unzipping and merging plugin files...`
|
|
148429
148042
|
);
|
|
148430
|
-
await unzipAndMergePluginFiles(env,
|
|
148043
|
+
await unzipAndMergePluginFiles(env, false);
|
|
148431
148044
|
console.log(
|
|
148432
|
-
|
|
148045
|
+
`
|
|
148046
|
+
\x1B[34m ==== ${VERTICAL_NAME} installation completed ==== \x1B[0m
|
|
148047
|
+
`
|
|
148433
148048
|
);
|
|
148434
|
-
|
|
148435
|
-
|
|
148436
|
-
|
|
148437
|
-
Authorization: process.env.WIX_TOKEN,
|
|
148438
|
-
"wix-site-id": siteId
|
|
148439
|
-
};
|
|
148440
|
-
const wixClient = createClient({
|
|
148441
|
-
auth: {
|
|
148442
|
-
getAuthHeaders: async () => {
|
|
148443
|
-
return {
|
|
148444
|
-
headers: authHeaders
|
|
148445
|
-
};
|
|
148446
|
-
}
|
|
148447
|
-
},
|
|
148448
|
-
modules: {
|
|
148449
|
-
forms: es_exports
|
|
148450
|
-
}
|
|
148451
|
-
});
|
|
148452
|
-
return wixClient;
|
|
148049
|
+
const data = await generateData(env);
|
|
148050
|
+
console.log(`[${VERTICAL_NAME}-plugin-install] Generated data`, data);
|
|
148051
|
+
return data;
|
|
148453
148052
|
};
|
|
148454
148053
|
var generateData = async (env) => {
|
|
148455
148054
|
console.log(
|
|
148456
148055
|
`[${VERTICAL_NAME}-plugin-generateData] Starting data generation`,
|
|
148457
148056
|
env
|
|
148458
148057
|
);
|
|
148459
|
-
console.log(
|
|
148460
|
-
`[${VERTICAL_NAME}-plugin-generateData] Generating mock data... !!!!!`
|
|
148461
|
-
);
|
|
148058
|
+
console.log(`[${VERTICAL_NAME}-plugin-generateData] Generating mock data...`);
|
|
148462
148059
|
try {
|
|
148463
|
-
console.log(
|
|
148464
|
-
`[${VERTICAL_NAME}-plugin-generateData] !!!!! Getting wix client on site...`,
|
|
148465
|
-
env.WIX_SITE_ID
|
|
148466
|
-
);
|
|
148467
148060
|
const form = await createForm5(MOCK_SCHEMA, env.WIX_SITE_ID);
|
|
148468
|
-
console.log(
|
|
148469
|
-
`[${VERTICAL_NAME}-plugin-generateData] !!!!! Form created...`,
|
|
148470
|
-
form
|
|
148471
|
-
);
|
|
148472
|
-
console.log(
|
|
148473
|
-
`[${VERTICAL_NAME}-plugin-generateData] !!!!! Form id...`,
|
|
148474
|
-
form?._id
|
|
148475
|
-
);
|
|
148476
|
-
console.log(
|
|
148477
|
-
`[${VERTICAL_NAME}-plugin-generateData] !!!!! Form name...`,
|
|
148478
|
-
form.name
|
|
148479
|
-
);
|
|
148480
148061
|
const generatedData = {
|
|
148481
148062
|
formId: form?._id,
|
|
148482
|
-
purpose: form.name,
|
|
148483
|
-
|
|
148484
|
-
formId: form?._id
|
|
148485
|
-
}
|
|
148063
|
+
// purpose: form.name,
|
|
148064
|
+
purpose: "Allow users to contact us"
|
|
148486
148065
|
};
|
|
148487
148066
|
console.log(
|
|
148488
148067
|
`
|
|
148489
|
-
\x1B[34m ====
|
|
148068
|
+
\x1B[34m ==== Form app data generation completed ==== \x1B[0m
|
|
148490
148069
|
`,
|
|
148491
148070
|
generatedData
|
|
148492
148071
|
);
|
|
148493
148072
|
return generatedData;
|
|
148494
148073
|
} catch (error) {
|
|
148495
148074
|
console.log(
|
|
148496
|
-
|
|
148075
|
+
`[${VERTICAL_NAME}-plugin-generateData] Error generating form data:`,
|
|
148497
148076
|
error
|
|
148498
148077
|
);
|
|
148499
148078
|
return null;
|
|
148500
148079
|
}
|
|
148501
148080
|
};
|
|
148502
148081
|
var getInstructions = async (params) => {
|
|
148503
|
-
const
|
|
148082
|
+
const generatedData = params.result;
|
|
148083
|
+
console.log(
|
|
148084
|
+
`[${VERTICAL_NAME}-plugin-getInstructions] Calling instructions`,
|
|
148085
|
+
params
|
|
148086
|
+
);
|
|
148087
|
+
const actualInstructions = getFormsCodingInstructions(generatedData);
|
|
148504
148088
|
console.log(
|
|
148505
148089
|
`[${VERTICAL_NAME}-plugin-getInstructions] Getting instructions`,
|
|
148506
148090
|
{
|
|
@@ -148513,7 +148097,7 @@ var getInstructions = async (params) => {
|
|
|
148513
148097
|
};
|
|
148514
148098
|
var formsPlugin = {
|
|
148515
148099
|
install,
|
|
148516
|
-
generateData,
|
|
148100
|
+
generateData: () => new Promise((resolve) => resolve(null)),
|
|
148517
148101
|
getInstructions
|
|
148518
148102
|
};
|
|
148519
148103
|
var index_default = formsPlugin;
|