@verbb/formie-browser 1.0.16 → 1.0.17-next.7.gf88643cc06da
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/CHANGELOG.md +15 -0
- package/dist/chunks/{address-state-CHKit8AW.js → address-state-D9KfV-qB.js} +1 -1
- package/dist/chunks/{combobox-CJh2DoSO.js → combobox-B6ROYFW7.js} +1 -1
- package/dist/chunks/date-picker-dp41TnRq.js +5351 -0
- package/dist/chunks/{hcaptcha-COilLmRT.js → hcaptcha-lseqzFTP.js} +14 -14
- package/dist/chunks/phone-country-BMyw-Qcz.js +2647 -0
- package/dist/chunks/{upload-manager-Ccg3d_4I.js → upload-manager-CkmsPJRl.js} +1 -1
- package/dist/index.js +407 -386
- package/dist/js/core/create-formie-client.d.ts.map +1 -1
- package/dist/js/core/submit-result-ui.d.ts.map +1 -1
- package/dist/js/modules/captchas/hcaptcha.d.ts.map +1 -1
- package/dist/js/modules/fields/combobox.d.ts.map +1 -1
- package/dist/js/modules/fields/phone-country.d.ts.map +1 -1
- package/dist/js/modules/fields/upload-manager.d.ts.map +1 -1
- package/dist/js/modules/loader.d.ts.map +1 -1
- package/dist/js/theme/message-attributes.d.ts +4 -0
- package/dist/js/theme/message-attributes.d.ts.map +1 -0
- package/dist/js/transport/forms-api.d.ts +1 -1
- package/dist/js/transport/forms-api.d.ts.map +1 -1
- package/dist/js/validation/validator.d.ts.map +1 -1
- package/package.json +6 -4
- package/src/js/core/create-formie-client.ts +49 -33
- package/src/js/core/submit-result-ui.ts +10 -2
- package/src/js/modules/captchas/hcaptcha.ts +3 -2
- package/src/js/modules/fields/combobox.ts +4 -0
- package/src/js/modules/fields/date-picker.ts +3 -3
- package/src/js/modules/fields/phone-country.ts +25 -17
- package/src/js/modules/fields/upload-manager.ts +3 -2
- package/src/js/modules/loader.ts +7 -0
- package/src/js/theme/message-attributes.ts +54 -0
- package/src/js/transport/forms-api.ts +6 -1
- package/src/js/validation/validator.ts +3 -2
- package/src/vendor.d.ts +2 -3
- package/dist/chunks/date-picker-BVJxJVYT.js +0 -5321
- package/dist/chunks/phone-country-Bx9EG50h.js +0 -2645
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-formie-client.d.ts","sourceRoot":"","sources":["../../../src/js/core/create-formie-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,YAAY,EAGf,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"create-formie-client.d.ts","sourceRoot":"","sources":["../../../src/js/core/create-formie-client.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACR,YAAY,EAGf,MAAM,mBAAmB,CAAC;AAi4B3B,wBAAgB,kBAAkB,IAAI,YAAY,CA2uBjD"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"submit-result-ui.d.ts","sourceRoot":"","sources":["../../../src/js/core/submit-result-ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"submit-result-ui.d.ts","sourceRoot":"","sources":["../../../src/js/core/submit-result-ui.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AA0K1D,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CA6B5D;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAmB3D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CA8B5D;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,CAI5D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,GAAG,IAAI,CAqDpG;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,EAAE,GAAG,IAAI,CAiBlF;AAYD,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAY7E;AAgBD,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GAAG,IAAI,CA2CpH;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,eAAe,EAAE,MAAM,EAAE,gBAAgB,GAAG,IAAI,CAoDzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hcaptcha.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/captchas/hcaptcha.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"hcaptcha.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/captchas/hcaptcha.ts"],"names":[],"mappings":"AAoEA,eAAO,MAAM,cAAc,4CAqFzB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/fields/combobox.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,4CAA4C,CAAC;AAEnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAoBlE,MAAM,MAAM,qBAAqB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF,KAAK,iBAAiB,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG;IACtD,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,KAAK,aAAa,GAAG,iBAAiB,GAAG;IACrC,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;CACxC,CAAC;
|
|
1
|
+
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/fields/combobox.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,4CAA4C,CAAC;AAEnE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAoBlE,MAAM,MAAM,qBAAqB,GAAG;IAChC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC/B,CAAC;AAEF,KAAK,iBAAiB,GAAG,YAAY,CAAC,OAAO,SAAS,CAAC,GAAG;IACtD,OAAO,EAAE,WAAW,CAAC;IACrB,QAAQ,CAAC,EAAE,WAAW,CAAC;CAC1B,CAAC;AAEF,KAAK,aAAa,GAAG,iBAAiB,GAAG;IACrC,gBAAgB,CAAC,EAAE,iBAAiB,CAAC;CACxC,CAAC;AAiDF,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,aAAa,EAAE,OAAO,GAAE,qBAA0B,GAAG,MAAM,IAAI,CAsGzG;AAED,eAAO,MAAM,cAAc,EAAE,uBAuC5B,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"phone-country.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/fields/phone-country.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"phone-country.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/fields/phone-country.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAmPlE,eAAO,MAAM,kBAAkB,EAAE,uBA2ChC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"upload-manager.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/fields/upload-manager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"upload-manager.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/fields/upload-manager.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAo1ClE,eAAO,MAAM,mBAAmB,EAAE,uBAqFjC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/js/modules/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,qBAAqB,EAA2B,MAAM,oBAAoB,CAAC;AACtH,OAAO,KAAK,EAAwE,4BAA4B,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAKrL,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,MAAM,oBAAoB,GAAG,4BAA4B,GAAG;IAC9D,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,cAAc,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACtE,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,YAAY,EAAE,kBAAkB,CAAC;IACjC,YAAY,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;CACvE,CAAC;AAwHF,wFAAwF;AACxF,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC,
|
|
1
|
+
{"version":3,"file":"loader.d.ts","sourceRoot":"","sources":["../../../src/js/modules/loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+B,KAAK,qBAAqB,EAA2B,MAAM,oBAAoB,CAAC;AACtH,OAAO,KAAK,EAAwE,4BAA4B,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAKrL,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAEnD,MAAM,MAAM,oBAAoB,GAAG,4BAA4B,GAAG;IAC9D,WAAW,EAAE,MAAM,IAAI,CAAC;IACxB,OAAO,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7B,cAAc,EAAE,CAAC,QAAQ,EAAE,qBAAqB,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACtE,CAAC;AAEF,KAAK,iBAAiB,GAAG;IACrB,QAAQ,EAAE,cAAc,CAAC;IACzB,YAAY,EAAE,kBAAkB,CAAC;IACjC,YAAY,EAAE,IAAI,CAAC,kBAAkB,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAAC,CAAC;CACvE,CAAC;AAwHF,wFAAwF;AACxF,wBAAsB,uBAAuB,CAAC,QAAQ,EAAE,qBAAqB,EAAE,GAAG,EAAE,iBAAiB,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAsQpI"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-attributes.d.ts","sourceRoot":"","sources":["../../../src/js/theme/message-attributes.ts"],"names":[],"mappings":"AAAA,KAAK,UAAU,GAAG,cAAc,GAAG,gBAAgB,CAAC;AAEpD,wBAAgB,sBAAsB,CAClC,MAAM,EAAE,OAAO,EACf,IAAI,EAAE,eAAe,EACrB,GAAG,EAAE,UAAU,EACf,MAAM,UAAQ,GACf,IAAI,CA8CN"}
|
|
@@ -2,7 +2,7 @@ import { type BrowserRequestOptions } from '@verbb/formie-core';
|
|
|
2
2
|
import type { FormEndpointPayload, FormSubmitResult } from '#contracts/schema';
|
|
3
3
|
export declare function requestRender(endpoint: string, handle: string, renderOptions?: Record<string, unknown>, requestOptions?: BrowserRequestOptions): Promise<FormEndpointPayload>;
|
|
4
4
|
export declare function requestGraphqlRender(endpoint: string, handle: string, renderOptions?: Record<string, unknown>, requestOptions?: BrowserRequestOptions): Promise<FormEndpointPayload>;
|
|
5
|
-
export declare function requestRefreshTokens(endpoint: string, handle: string, renderId?: string, requestOptions?: BrowserRequestOptions, requestToken?: string): Promise<FormEndpointPayload['refreshTokens']>;
|
|
5
|
+
export declare function requestRefreshTokens(endpoint: string, handle: string, renderId?: string, requestOptions?: BrowserRequestOptions, requestToken?: string, siteId?: string | number): Promise<FormEndpointPayload['refreshTokens']>;
|
|
6
6
|
export declare function requestSetPage(url: string, form?: HTMLFormElement, pageId?: string): Promise<{
|
|
7
7
|
success?: boolean;
|
|
8
8
|
pageId?: string | number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forms-api.d.ts","sourceRoot":"","sources":["../../../src/js/transport/forms-api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,qBAAqB,EAAE,MAAM,oBAAoB,CAAC;AAChF,OAAO,KAAK,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AA6G/E,wBAAsB,aAAa,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EAAE,cAAc,GAAE,qBAA0B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAmB3L;AAED,wBAAsB,oBAAoB,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,aAAa,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,EAAE,cAAc,GAAE,qBAA0B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAuClM;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C;IAClB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;CACrC,CAAC,CAkDD;AAED,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,eAAe,GAAG,IAAI,CAoCrF;AAED,wBAAsB,UAAU,CAAC,IAAI,EAAE,eAAe,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAuDrG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/js/validation/validator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACR,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,eAAe,EAClB,MAAM,mBAAmB,CAAC;AAM3B,KAAK,mBAAmB,GAAG;IACvB,QAAQ,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,OAAO,CAAC;IAC9C,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,MAAM,CAAC;CACrD,CAAC;AAEF,KAAK,eAAe,GAAG;IACnB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;
|
|
1
|
+
{"version":3,"file":"validator.d.ts","sourceRoot":"","sources":["../../../src/js/validation/validator.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EACR,gBAAgB,EAChB,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,eAAe,EAClB,MAAM,mBAAmB,CAAC;AAM3B,KAAK,mBAAmB,GAAG;IACvB,QAAQ,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,OAAO,CAAC;IAC9C,YAAY,CAAC,EAAE,CAAC,GAAG,EAAE,iBAAiB,KAAK,MAAM,CAAC;CACrD,CAAC;AAEF,KAAK,eAAe,GAAG;I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package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@verbb/formie-browser",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.17-next.7.gf88643cc06da",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -84,7 +84,8 @@
|
|
|
84
84
|
"./vite-dev": "./vite-dev.mjs"
|
|
85
85
|
},
|
|
86
86
|
"publishConfig": {
|
|
87
|
-
"access": "public"
|
|
87
|
+
"access": "public",
|
|
88
|
+
"tag": "next"
|
|
88
89
|
},
|
|
89
90
|
"scripts": {
|
|
90
91
|
"prebuild": "node ../../scripts/generate-browser-theme-state.mjs",
|
|
@@ -101,7 +102,7 @@
|
|
|
101
102
|
"@placekit/autocomplete-js": "^2.2.1",
|
|
102
103
|
"@uppy/core": "^5.2.0",
|
|
103
104
|
"@uppy/xhr-upload": "^5.2.0",
|
|
104
|
-
"@verbb/formie-core": "1.0.
|
|
105
|
+
"@verbb/formie-core": "1.0.17-next.7.gf88643cc06da",
|
|
105
106
|
"expression-language": "^2.5.4",
|
|
106
107
|
"flatpickr": "^4.6.13",
|
|
107
108
|
"friendly-challenge": "^0.9.19",
|
|
@@ -110,5 +111,6 @@
|
|
|
110
111
|
"pell": "^1.0.6",
|
|
111
112
|
"signature_pad": "^5.1.3",
|
|
112
113
|
"tom-select": "^2.6.1"
|
|
113
|
-
}
|
|
114
|
+
},
|
|
115
|
+
"gitHead": "f88643cc06da3664b0ebdec08ed649f7932917e6"
|
|
114
116
|
}
|
|
@@ -165,6 +165,17 @@ function resolveHeadlessEndpoint(baseOrEndpoint: string | undefined, actionPath:
|
|
|
165
165
|
return candidate;
|
|
166
166
|
}
|
|
167
167
|
|
|
168
|
+
// Explicit action URLs may use a custom trigger, subdirectory or Craft path parameter.
|
|
169
|
+
const actionSuffix = actionPath.replace(/^\/actions/, '');
|
|
170
|
+
try {
|
|
171
|
+
const url = new URL(candidate, window.location.origin);
|
|
172
|
+
if (url.pathname.endsWith(actionSuffix) || Array.from(url.searchParams.values()).some((value) => value.endsWith(actionSuffix))) {
|
|
173
|
+
return candidate;
|
|
174
|
+
}
|
|
175
|
+
} catch (_error) {
|
|
176
|
+
// Keep the existing fallback for bases that cannot be resolved as URLs.
|
|
177
|
+
}
|
|
178
|
+
|
|
168
179
|
return resolveEndpointAgainstBase(actionPath, candidate);
|
|
169
180
|
}
|
|
170
181
|
|
|
@@ -187,51 +198,40 @@ function resolveGraphqlEndpoint(options: FormMountOptions, target: Element): str
|
|
|
187
198
|
}
|
|
188
199
|
|
|
189
200
|
function resolveRefreshTokensEndpoint(options: FormMountOptions, target: Element): string {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
DEFAULT_HEADLESS_REFRESH_TOKENS_ACTION,
|
|
193
|
-
);
|
|
194
|
-
}
|
|
201
|
+
const endpoint = (target as HTMLElement).dataset.formieRefreshTokensEndpoint
|
|
202
|
+
|| getFormFromTarget(target)?.dataset.formieRefreshTokensEndpoint;
|
|
195
203
|
|
|
196
|
-
|
|
197
|
-
if (
|
|
198
|
-
return
|
|
204
|
+
// Server-provided endpoints are complete URLs, not bases for the default action path.
|
|
205
|
+
if (endpoint) {
|
|
206
|
+
return resolveEndpointAgainstBase(endpoint, options.endpoint || (target as HTMLElement).dataset.formieEndpoint);
|
|
199
207
|
}
|
|
200
208
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
source.searchParams.forEach((value, key) => {
|
|
206
|
-
if (!destination.searchParams.has(key)) {
|
|
207
|
-
destination.searchParams.set(key, value);
|
|
208
|
-
}
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
return destination.toString();
|
|
212
|
-
} catch (_error) {
|
|
213
|
-
return destinationUrl;
|
|
214
|
-
}
|
|
209
|
+
return resolveHeadlessEndpoint(
|
|
210
|
+
options.endpoint || (target as HTMLElement).dataset.formieEndpoint,
|
|
211
|
+
DEFAULT_HEADLESS_REFRESH_TOKENS_ACTION,
|
|
212
|
+
);
|
|
215
213
|
}
|
|
216
214
|
|
|
217
215
|
function normalizeServerRenderedUrls(target: Element, form: HTMLFormElement, options: FormMountOptions): void {
|
|
218
216
|
const baseEndpoint = options.endpoint || (target as HTMLElement).dataset.formieEndpoint;
|
|
219
|
-
const
|
|
220
|
-
const existingAction = form.getAttribute('action');
|
|
217
|
+
const existingAction = form.getAttribute('action') || form.dataset.formieSubmitEndpoint;
|
|
221
218
|
|
|
222
|
-
|
|
219
|
+
// Keep Craft's routing and query parameters; only resolve relative URLs for remote HTML.
|
|
220
|
+
form.setAttribute('action', existingAction
|
|
221
|
+
? resolveEndpointAgainstBase(existingAction, baseEndpoint)
|
|
222
|
+
: resolveHeadlessEndpoint(baseEndpoint, DEFAULT_HEADLESS_SUBMIT_ACTION));
|
|
223
223
|
|
|
224
224
|
form.querySelectorAll<HTMLAnchorElement>('[data-formie-tab-link]').forEach((link) => {
|
|
225
225
|
const existingHref = link.getAttribute('href');
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
226
|
+
link.setAttribute('href', existingHref
|
|
227
|
+
? resolveEndpointAgainstBase(existingHref, baseEndpoint)
|
|
228
|
+
: resolveHeadlessEndpoint(baseEndpoint, DEFAULT_HEADLESS_SET_PAGE_ACTION));
|
|
229
229
|
});
|
|
230
230
|
|
|
231
231
|
form.querySelectorAll<HTMLElement>('[data-formie-file-upload-hydrate-endpoint]').forEach((input) => {
|
|
232
232
|
input.setAttribute(
|
|
233
233
|
'data-formie-file-upload-hydrate-endpoint',
|
|
234
|
-
|
|
234
|
+
resolveEndpointAgainstBase(input.getAttribute('data-formie-file-upload-hydrate-endpoint') || DEFAULT_FILE_UPLOAD_HYDRATE_ACTION, baseEndpoint),
|
|
235
235
|
);
|
|
236
236
|
});
|
|
237
237
|
}
|
|
@@ -252,8 +252,12 @@ function hasAutomaticSubmissionState(form: HTMLFormElement): boolean {
|
|
|
252
252
|
}
|
|
253
253
|
|
|
254
254
|
function resolveClearSubmissionEndpoint(options: FormMountOptions, target: Element, form: HTMLFormElement): string {
|
|
255
|
+
if (form.dataset.formieClearSubmissionEndpoint) {
|
|
256
|
+
return resolveEndpointAgainstBase(form.dataset.formieClearSubmissionEndpoint, options.endpoint || (target as HTMLElement).dataset.formieEndpoint);
|
|
257
|
+
}
|
|
258
|
+
|
|
255
259
|
return resolveHeadlessEndpoint(
|
|
256
|
-
|
|
260
|
+
options.endpoint || (target as HTMLElement).dataset.formieEndpoint,
|
|
257
261
|
DEFAULT_HEADLESS_CLEAR_SUBMISSION_ACTION,
|
|
258
262
|
);
|
|
259
263
|
}
|
|
@@ -548,7 +552,11 @@ async function refreshTokensAfterSubmitIfNeeded(target: Element, options: FormMo
|
|
|
548
552
|
const endpoint = resolveRefreshTokensEndpoint(options, target);
|
|
549
553
|
const renderIdInput = form.querySelector('input[name="renderId"]') as HTMLInputElement | null;
|
|
550
554
|
const renderId = renderIdInput?.value || undefined;
|
|
551
|
-
const refreshTokens = await requestRefreshTokens(
|
|
555
|
+
const refreshTokens = await requestRefreshTokens(
|
|
556
|
+
endpoint, formHandle, renderId, options,
|
|
557
|
+
form.querySelector<HTMLInputElement>('input[name="requestToken"]')?.value,
|
|
558
|
+
form.querySelector<HTMLInputElement>('input[name="siteId"]')?.value || options.siteId,
|
|
559
|
+
);
|
|
552
560
|
applyRefreshTokensToForm(form, refreshTokens);
|
|
553
561
|
dispatchFormieDomEvent(target, 'formie:refresh-tokens:refreshed', refreshTokens);
|
|
554
562
|
}
|
|
@@ -878,7 +886,11 @@ async function refreshTokensIfNeeded(target: Element, options: FormMountOptions,
|
|
|
878
886
|
|
|
879
887
|
// Refresh-tokens-before-ready is the cache-safe path: forms can render from SSR/cache
|
|
880
888
|
// and still receive fresh transport tokens before the user submits anything.
|
|
881
|
-
const refreshTokens = await requestRefreshTokens(
|
|
889
|
+
const refreshTokens = await requestRefreshTokens(
|
|
890
|
+
endpoint, formHandle, renderId, options,
|
|
891
|
+
form?.querySelector<HTMLInputElement>('input[name="requestToken"]')?.value,
|
|
892
|
+
form?.querySelector<HTMLInputElement>('input[name="siteId"]')?.value || options.siteId,
|
|
893
|
+
);
|
|
882
894
|
|
|
883
895
|
if (!refreshTokens || !form) {
|
|
884
896
|
return;
|
|
@@ -1483,7 +1495,11 @@ export function createFormieClient(): FormieClient {
|
|
|
1483
1495
|
return;
|
|
1484
1496
|
}
|
|
1485
1497
|
|
|
1486
|
-
const refreshTokens = await requestRefreshTokens(
|
|
1498
|
+
const refreshTokens = await requestRefreshTokens(
|
|
1499
|
+
endpoint, formHandle, renderId, options,
|
|
1500
|
+
form.querySelector<HTMLInputElement>('input[name="requestToken"]')?.value,
|
|
1501
|
+
form.querySelector<HTMLInputElement>('input[name="siteId"]')?.value || options.siteId,
|
|
1502
|
+
);
|
|
1487
1503
|
|
|
1488
1504
|
if (!refreshTokens) {
|
|
1489
1505
|
return;
|
|
@@ -10,6 +10,7 @@ import { syncPageTabErrors } from '#core/page-tab-errors';
|
|
|
10
10
|
import { focusFirstValidationError } from '#core/validation-focus';
|
|
11
11
|
import { setFormHiddenState } from '#core/submit-result-state';
|
|
12
12
|
import { addThemeClasses, removeThemeClasses } from '#theme/theme-classes';
|
|
13
|
+
import { applyMessageAttributes } from '#theme/message-attributes';
|
|
13
14
|
|
|
14
15
|
const successHideTimers = new WeakMap<HTMLFormElement, number>();
|
|
15
16
|
|
|
@@ -18,7 +19,8 @@ function getConfiguredCompletionBehavior(form: HTMLFormElement): string {
|
|
|
18
19
|
}
|
|
19
20
|
|
|
20
21
|
function getErrorMessagePosition(form: HTMLFormElement): string {
|
|
21
|
-
|
|
22
|
+
// An explicit empty position is the form's "None" setting; only omitted attributes use the default.
|
|
23
|
+
return (form.dataset.formieErrorMessagePosition ?? 'top-form').trim();
|
|
22
24
|
}
|
|
23
25
|
|
|
24
26
|
function getSuccessMessagePosition(form: HTMLFormElement): string {
|
|
@@ -124,6 +126,7 @@ function ensureFormErrorMessageContainer(form: HTMLFormElement, container: HTMLE
|
|
|
124
126
|
container.appendChild(messageContainer);
|
|
125
127
|
}
|
|
126
128
|
|
|
129
|
+
applyMessageAttributes(messageContainer, form, 'messageError');
|
|
127
130
|
messageContainer.setAttribute('data-formie-message', 'true');
|
|
128
131
|
messageContainer.setAttribute('data-formie-message-error', 'true');
|
|
129
132
|
addThemeClasses(messageContainer, form, 'message', 'messageError');
|
|
@@ -231,6 +234,7 @@ export function clearFormSuccess(form: HTMLFormElement): void {
|
|
|
231
234
|
successNode.remove();
|
|
232
235
|
});
|
|
233
236
|
|
|
237
|
+
applyMessageAttributes(container, form, 'messageSuccess', true);
|
|
234
238
|
removeThemeClasses(container, form, 'message', 'messageSuccess');
|
|
235
239
|
container.removeAttribute('data-formie-message');
|
|
236
240
|
container.removeAttribute('data-formie-message-success');
|
|
@@ -310,6 +314,10 @@ export function renderFieldErrors(form: HTMLFormElement, fieldErrors: Record<str
|
|
|
310
314
|
}
|
|
311
315
|
|
|
312
316
|
export function renderFormErrors(form: HTMLFormElement, formErrors: string[]): void {
|
|
317
|
+
if (!getErrorMessagePosition(form)) {
|
|
318
|
+
return;
|
|
319
|
+
}
|
|
320
|
+
|
|
313
321
|
const container = ensureFormErrorContainer(form);
|
|
314
322
|
const messageContainer = ensureFormErrorMessageContainer(form, container);
|
|
315
323
|
|
|
@@ -318,7 +326,6 @@ export function renderFormErrors(form: HTMLFormElement, formErrors: string[]): v
|
|
|
318
326
|
formErrors.forEach((error) => {
|
|
319
327
|
const errorNode = document.createElement('div');
|
|
320
328
|
errorNode.setAttribute('data-formie-error', 'true');
|
|
321
|
-
errorNode.setAttribute('role', 'alert');
|
|
322
329
|
addThemeClasses(errorNode, form, 'error');
|
|
323
330
|
errorNode.innerHTML = error;
|
|
324
331
|
messageContainer.appendChild(errorNode);
|
|
@@ -372,6 +379,7 @@ export function renderFormSuccess(form: HTMLFormElement, message: string, option
|
|
|
372
379
|
|
|
373
380
|
const container = ensureFormSuccessContainer(form, position);
|
|
374
381
|
|
|
382
|
+
applyMessageAttributes(container, form, 'messageSuccess');
|
|
375
383
|
addThemeClasses(container, form, 'message', 'messageSuccess');
|
|
376
384
|
container.setAttribute('data-formie-message', 'true');
|
|
377
385
|
container.setAttribute('data-formie-message-success', 'true');
|
|
@@ -2,6 +2,7 @@ import {
|
|
|
2
2
|
defineCaptchaModule,
|
|
3
3
|
} from '#modules/captchas/api';
|
|
4
4
|
import {
|
|
5
|
+
CAPTCHA_EXECUTE_WAIT_FOR_VALUE_MS,
|
|
5
6
|
CAPTCHA_PROVIDER_LOAD_TIMEOUT_MS,
|
|
6
7
|
} from '#modules/captchas/constants';
|
|
7
8
|
import { ensureGlobal, loadExternalScript } from '#utils/scripts';
|
|
@@ -131,8 +132,8 @@ export const hcaptchaModule = defineCaptchaModule<HcaptchaProviderOptions, Hcapt
|
|
|
131
132
|
|
|
132
133
|
// After execute(), the token will arrive asynchronously via the widget
|
|
133
134
|
// callback configured in `mount()`. We therefore wait on the shared
|
|
134
|
-
// token transport layer,
|
|
135
|
-
return services.tokens.wait().then((hasToken) => {
|
|
135
|
+
// token transport layer, allowing time for an interactive challenge.
|
|
136
|
+
return services.tokens.wait(CAPTCHA_EXECUTE_WAIT_FOR_VALUE_MS).then((hasToken) => {
|
|
136
137
|
if (!hasToken) {
|
|
137
138
|
// If the callback never produced a token in time, surface a
|
|
138
139
|
// normal themed error and abort the submit pipeline's `screen`
|
|
@@ -76,6 +76,10 @@ function resolvePlaceholder(select: HTMLSelectElement, configuredPlaceholder?: s
|
|
|
76
76
|
function removeEmptyOptionFromCombobox(instance: TomSelectInstance): void {
|
|
77
77
|
if (instance.options['']) {
|
|
78
78
|
instance.removeOption('', true);
|
|
79
|
+
|
|
80
|
+
// Removing the selected empty option leaves Tom Select's input hidden
|
|
81
|
+
// until the next interaction unless its placeholder state is refreshed.
|
|
82
|
+
instance.inputState();
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
85
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import flatpickr from 'flatpickr';
|
|
2
|
-
import
|
|
2
|
+
import flatpickrLocales from 'flatpickr/dist/esm/l10n/index.js';
|
|
3
3
|
import flatpickrCss from 'flatpickr/dist/flatpickr.css?inline';
|
|
4
4
|
|
|
5
5
|
import type { BrowserModuleDefinition } from '#contracts/modules';
|
|
@@ -157,8 +157,8 @@ function getLocale(locale: string | undefined): unknown {
|
|
|
157
157
|
return 'en';
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
-
const localeMap
|
|
161
|
-
return localeMap[locale] ??
|
|
160
|
+
const localeMap: Record<string, unknown> = flatpickrLocales;
|
|
161
|
+
return localeMap[locale] ?? 'en';
|
|
162
162
|
}
|
|
163
163
|
|
|
164
164
|
function getDisabledWeekdayHandler(availableDaysOfWeek: DatePickerOptions['availableDaysOfWeek']) {
|
|
@@ -17,7 +17,7 @@ const debug = createDebug('fields', 'phone');
|
|
|
17
17
|
ensureModuleStyles(MODULE_ID, [intlTelInputCss]);
|
|
18
18
|
|
|
19
19
|
type PhoneCountryOptions = {
|
|
20
|
-
countryDefaultValue?: string;
|
|
20
|
+
countryDefaultValue?: string | null;
|
|
21
21
|
allowedCountryCodes?: string[];
|
|
22
22
|
countryPreselectFromIp?: boolean;
|
|
23
23
|
countryFromIpAction?: string;
|
|
@@ -86,7 +86,7 @@ function buildOptions(options: PhoneCountryOptions, form: HTMLFormElement | null
|
|
|
86
86
|
allowDropdown: true,
|
|
87
87
|
nationalMode: false,
|
|
88
88
|
separateDialCode: true,
|
|
89
|
-
initialCountry: '
|
|
89
|
+
initialCountry: '',
|
|
90
90
|
autoPlaceholder: 'off',
|
|
91
91
|
formatOnDisplay: false,
|
|
92
92
|
formatAsYouType: false,
|
|
@@ -101,11 +101,11 @@ function buildOptions(options: PhoneCountryOptions, form: HTMLFormElement | null
|
|
|
101
101
|
|
|
102
102
|
if (allowedCountries.length) {
|
|
103
103
|
intlOptions.onlyCountries = allowedCountries;
|
|
104
|
-
intlOptions.initialCountry = allowedCountries[0];
|
|
105
104
|
|
|
106
105
|
// One allowed country behaves more like a formatting helper than a full
|
|
107
106
|
// country-picker UI, so tighten the plugin options accordingly.
|
|
108
107
|
if (allowedCountries.length === 1) {
|
|
108
|
+
intlOptions.initialCountry = allowedCountries[0];
|
|
109
109
|
intlOptions.allowDropdown = false;
|
|
110
110
|
intlOptions.separateDialCode = false;
|
|
111
111
|
intlOptions.nationalMode = true;
|
|
@@ -119,8 +119,8 @@ function buildOptions(options: PhoneCountryOptions, form: HTMLFormElement | null
|
|
|
119
119
|
intlOptions.geoIpLookup = createGeoIpLookup(options.countryFromIpAction, form);
|
|
120
120
|
}
|
|
121
121
|
|
|
122
|
-
if (Array.isArray(intlOptions.onlyCountries) &&
|
|
123
|
-
const initialCountry =
|
|
122
|
+
if (Array.isArray(intlOptions.onlyCountries) && options.countryDefaultValue) {
|
|
123
|
+
const initialCountry = options.countryDefaultValue.toLowerCase();
|
|
124
124
|
if (!intlOptions.onlyCountries.includes(initialCountry)) {
|
|
125
125
|
intlOptions.onlyCountries.push(initialCountry);
|
|
126
126
|
}
|
|
@@ -137,7 +137,7 @@ function initPhoneField(phoneInput: PhoneInput, countryInput: HTMLInputElement,
|
|
|
137
137
|
options: intlOptions,
|
|
138
138
|
});
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
let validator = intlTelInput(phoneInput, intlOptions);
|
|
141
141
|
const allowedCountries = Array.isArray((intlOptions as { onlyCountries?: unknown[] }).onlyCountries)
|
|
142
142
|
? (intlOptions as { onlyCountries?: unknown[] }).onlyCountries!.map(String)
|
|
143
143
|
: [];
|
|
@@ -153,11 +153,8 @@ function initPhoneField(phoneInput: PhoneInput, countryInput: HTMLInputElement,
|
|
|
153
153
|
const syncCountry = () => {
|
|
154
154
|
const countryData = validator.getSelectedCountryData();
|
|
155
155
|
const isoCode = countryData?.iso2 || '';
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
// the tel input focuses on the visible formatted number experience.
|
|
159
|
-
countryInput.value = isoCode.toUpperCase();
|
|
160
|
-
}
|
|
156
|
+
// Clearing the selection must also clear the submitted country.
|
|
157
|
+
countryInput.value = isoCode.toUpperCase();
|
|
161
158
|
};
|
|
162
159
|
|
|
163
160
|
phoneInput.addEventListener('countrychange', syncCountry);
|
|
@@ -168,20 +165,31 @@ function initPhoneField(phoneInput: PhoneInput, countryInput: HTMLInputElement,
|
|
|
168
165
|
let defaultCountry = countryInput.value;
|
|
169
166
|
let destroyed = false;
|
|
170
167
|
void validator.promise.then(() => {
|
|
171
|
-
if (!destroyed) {
|
|
168
|
+
if (!destroyed && intlOptions.initialCountry === 'auto') {
|
|
172
169
|
defaultCountry ||= validator.getSelectedCountryData()?.iso2?.toUpperCase() || '';
|
|
173
170
|
}
|
|
174
171
|
}, () => {});
|
|
175
172
|
|
|
176
173
|
const form = phoneInput.form;
|
|
177
174
|
const onReset = (event: Event) => {
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
175
|
+
// Wait for all reset listeners and the browser's native value restoration.
|
|
176
|
+
window.setTimeout(() => {
|
|
177
|
+
if (!destroyed && !event.defaultPrevented) {
|
|
178
|
+
if (defaultCountry) {
|
|
179
|
+
validator.setCountry(defaultCountry.toLowerCase() as IntlCountryCode);
|
|
180
|
+
validator.setNumber(phoneInput.defaultValue);
|
|
181
|
+
} else {
|
|
182
|
+
// intl-tel-input rejects setCountry('') and retains the last country
|
|
183
|
+
// in setNumber(''), so recreate it to restore an unset default.
|
|
184
|
+
validator.destroy();
|
|
185
|
+
validator = intlTelInput(phoneInput, { ...intlOptions, initialCountry: '' });
|
|
186
|
+
phoneInput.validator = validator;
|
|
187
|
+
syncCountryButton();
|
|
188
|
+
}
|
|
189
|
+
|
|
182
190
|
syncCountry();
|
|
183
191
|
}
|
|
184
|
-
});
|
|
192
|
+
}, 0);
|
|
185
193
|
};
|
|
186
194
|
form?.addEventListener('reset', onReset);
|
|
187
195
|
|
|
@@ -973,10 +973,11 @@ function bindUploadManagerField(field: HTMLElement, form: HTMLFormElement | null
|
|
|
973
973
|
state.files[index] = targetFile;
|
|
974
974
|
state.files[targetIndex] = managedFile;
|
|
975
975
|
|
|
976
|
+
// Keep the visible rows in the same order as the controls and submitted assets.
|
|
976
977
|
if (direction === -1) {
|
|
977
|
-
|
|
978
|
+
targetFile.listItem.before(managedFile.listItem);
|
|
978
979
|
} else {
|
|
979
|
-
|
|
980
|
+
targetFile.listItem.after(managedFile.listItem);
|
|
980
981
|
}
|
|
981
982
|
|
|
982
983
|
syncUploadedAssetsEvent(state);
|
package/src/js/modules/loader.ts
CHANGED
|
@@ -328,6 +328,13 @@ export async function loadModulesFromManifest(manifest: BrowserModuleManifest, c
|
|
|
328
328
|
if (definition.surfaces && !definition.surfaces.includes(surface)) throw new Error(`Module ${entry.moduleId} does not support ${surface}.`);
|
|
329
329
|
if (definition.kind !== entry.kind) throw new Error(`Module ${entry.moduleId} is registered as ${definition.kind}, not ${entry.kind}.`);
|
|
330
330
|
if (!definition.match({ ...ctx.matchContext, target, scope: setup.scope, manifestItem: entry })) {
|
|
331
|
+
// Field and core modules only enhance what's rendered, and a Repeater can render its fields later, so
|
|
332
|
+
// nothing to enhance isn't a failure. Reconciling mounts them once it appears.
|
|
333
|
+
if (definition.kind === 'field' || definition.kind === 'core') {
|
|
334
|
+
recovered = true;
|
|
335
|
+
continue;
|
|
336
|
+
}
|
|
337
|
+
|
|
331
338
|
throw new Error(`Module ${entry.moduleId} does not support the rendered target.`);
|
|
332
339
|
}
|
|
333
340
|
const instance = await definition.setup(setup);
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
type MessageKey = 'messageError' | 'messageSuccess';
|
|
2
|
+
|
|
3
|
+
export function applyMessageAttributes(
|
|
4
|
+
target: Element,
|
|
5
|
+
form: HTMLFormElement,
|
|
6
|
+
key: MessageKey,
|
|
7
|
+
remove = false,
|
|
8
|
+
): void {
|
|
9
|
+
const raw = form.getAttribute('data-formie-message-attributes');
|
|
10
|
+
|
|
11
|
+
if (!raw) {
|
|
12
|
+
return;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
let messages: unknown;
|
|
16
|
+
|
|
17
|
+
try {
|
|
18
|
+
messages = JSON.parse(raw);
|
|
19
|
+
} catch {
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (!messages || typeof messages !== 'object' || Array.isArray(messages)) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const attributes: unknown = (messages as Record<string, unknown>)[key];
|
|
28
|
+
|
|
29
|
+
if (
|
|
30
|
+
!attributes ||
|
|
31
|
+
typeof attributes !== 'object' ||
|
|
32
|
+
Array.isArray(attributes)
|
|
33
|
+
) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// These values are resolved by PHP using the same theme rules as server output.
|
|
38
|
+
// Classes and structural/live-region attributes remain owned by the caller.
|
|
39
|
+
Object.entries(attributes).forEach(([name, value]) => {
|
|
40
|
+
if (
|
|
41
|
+
name === 'class' ||
|
|
42
|
+
!/^[^\s"'<>/=]+$/.test(name) ||
|
|
43
|
+
(typeof value !== 'string' && value !== true)
|
|
44
|
+
) {
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
if (remove) {
|
|
49
|
+
target.removeAttribute(name);
|
|
50
|
+
} else {
|
|
51
|
+
target.setAttribute(name, value === true ? '' : value);
|
|
52
|
+
}
|
|
53
|
+
});
|
|
54
|
+
}
|
|
@@ -170,10 +170,15 @@ query FormieHtmlForm($handle: String!, $input: ServerRenderPayloadInput) {
|
|
|
170
170
|
return payload;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
export async function requestRefreshTokens(endpoint: string, handle: string, renderId?: string, requestOptions: BrowserRequestOptions = {}, requestToken?: string): Promise<FormEndpointPayload['refreshTokens']> {
|
|
173
|
+
export async function requestRefreshTokens(endpoint: string, handle: string, renderId?: string, requestOptions: BrowserRequestOptions = {}, requestToken?: string, siteId?: string | number): Promise<FormEndpointPayload['refreshTokens']> {
|
|
174
174
|
const url = new URL(endpoint, window.location.origin);
|
|
175
175
|
url.searchParams.set('handle', handle);
|
|
176
176
|
|
|
177
|
+
// Root-level action URLs cannot identify sites that share a domain and use path prefixes.
|
|
178
|
+
if (siteId !== undefined && siteId !== '') {
|
|
179
|
+
url.searchParams.set('siteId', String(siteId));
|
|
180
|
+
}
|
|
181
|
+
|
|
177
182
|
if (renderId) {
|
|
178
183
|
url.searchParams.set('renderId', renderId);
|
|
179
184
|
}
|
|
@@ -42,12 +42,13 @@ const debug = createDebug('general', 'validator');
|
|
|
42
42
|
|
|
43
43
|
function isValidationInput(node: Element | null): node is ValidationInput {
|
|
44
44
|
// Enhancement libraries inject unnamed search controls that do not submit
|
|
45
|
-
// field values and must not inherit the field's validation rules.
|
|
45
|
+
// field values and must not inherit the field's validation rules. Date pickers
|
|
46
|
+
// move their marker and rules to an unnamed visible input, which must validate.
|
|
46
47
|
return !!node && (
|
|
47
48
|
node instanceof HTMLInputElement ||
|
|
48
49
|
node instanceof HTMLSelectElement ||
|
|
49
50
|
node instanceof HTMLTextAreaElement
|
|
50
|
-
) && !!node.name;
|
|
51
|
+
) && (!!node.name || node.hasAttribute('data-formie-date-datepicker-input'));
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
function isPainted(element: HTMLElement): boolean {
|
package/src/vendor.d.ts
CHANGED
|
@@ -51,9 +51,8 @@ declare module 'flatpickr' {
|
|
|
51
51
|
export default flatpickr;
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
-
declare module 'flatpickr/dist/l10n/index.js' {
|
|
55
|
-
|
|
56
|
-
export = locales;
|
|
54
|
+
declare module 'flatpickr/dist/esm/l10n/index.js' {
|
|
55
|
+
export { default } from 'flatpickr/dist/l10n/index.js';
|
|
57
56
|
}
|
|
58
57
|
|
|
59
58
|
declare module 'intl-tel-input' {
|