@verbb/formie-browser 1.0.11 → 1.0.13

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.
Files changed (43) hide show
  1. package/CHANGELOG.md +15 -0
  2. package/dist/chunks/{api-BYe9YPko.js → api-DqpfkZWL.js} +15 -2
  3. package/dist/chunks/{bpoint-C0VOftX9.js → bpoint-Dlq34XH1.js} +1 -1
  4. package/dist/chunks/{calculations-DERi2xaC.js → calculations-Dv3hYb8_.js} +1 -1
  5. package/dist/chunks/{conditions-65kBcFWW.js → conditions-CPH1snCx.js} +1 -1
  6. package/dist/chunks/{date-picker-5CA_-zGb.js → date-picker-F9BUBDSW.js} +3 -0
  7. package/dist/chunks/{dist-BdUy8m_p.js → dist-D6i-VNgM.js} +1 -1
  8. package/dist/chunks/{eway-CS6Y1Yvo.js → eway-D9_m8ooj.js} +1 -1
  9. package/dist/chunks/{go-cardless-BTPD668l.js → go-cardless-DAT3ZaQf.js} +1 -1
  10. package/dist/chunks/{mollie-CXgBwvo6.js → mollie-Bibhl67p.js} +1 -1
  11. package/dist/chunks/{moneris-B6oLu7nj.js → moneris-H2wSqk9h.js} +1 -1
  12. package/dist/chunks/opayo-CR0DtsLa.js +179 -0
  13. package/dist/chunks/{paddle-GRlsm5mm.js → paddle-DkvIxQdG.js} +1 -1
  14. package/dist/chunks/{password-validation-T0vDQPCr.js → password-validation-D06uH9va.js} +1 -1
  15. package/dist/chunks/{paypal-CdcZnf6r.js → paypal-CQpAF7Ua.js} +32 -31
  16. package/dist/chunks/{payway-CfmYOS__.js → payway-CwDkC7YZ.js} +1 -1
  17. package/dist/chunks/{signature-xz4QO7CR.js → signature-IOhuicje.js} +69 -47
  18. package/dist/chunks/{square-BY--5M-X.js → square-DwdcOI1G.js} +1 -1
  19. package/dist/chunks/{stripe-uusYjWty.js → stripe-DaoG2FT1.js} +1 -1
  20. package/dist/chunks/{text-limit-Bn18WrPU.js → text-limit-BGaY0jhI.js} +1 -1
  21. package/dist/css/theme/fields/_check-radio.css +3 -1
  22. package/dist/css/theme/fields/_signature.css +2 -1
  23. package/dist/css/theme/integrations/_opayo.css +9 -0
  24. package/dist/index.js +21 -19
  25. package/dist/js/core/create-formie-client.d.ts.map +1 -1
  26. package/dist/js/modules/fields/date-picker.d.ts.map +1 -1
  27. package/dist/js/modules/fields/signature.d.ts.map +1 -1
  28. package/dist/js/modules/payments/factories.d.ts +5 -1
  29. package/dist/js/modules/payments/factories.d.ts.map +1 -1
  30. package/dist/js/modules/payments/opayo.d.ts +17 -2
  31. package/dist/js/modules/payments/opayo.d.ts.map +1 -1
  32. package/dist/js/modules/payments/paypal.d.ts.map +1 -1
  33. package/package.json +2 -2
  34. package/src/css/theme/fields/_check-radio.css +3 -1
  35. package/src/css/theme/fields/_signature.css +2 -1
  36. package/src/css/theme/integrations/_opayo.css +9 -0
  37. package/src/js/core/create-formie-client.ts +7 -0
  38. package/src/js/modules/fields/date-picker.ts +6 -0
  39. package/src/js/modules/fields/signature.ts +40 -2
  40. package/src/js/modules/payments/factories.ts +27 -2
  41. package/src/js/modules/payments/opayo.ts +256 -69
  42. package/src/js/modules/payments/paypal.ts +23 -3
  43. package/dist/chunks/opayo-DPUA5CKr.js +0 -113
@@ -1,7 +1,7 @@
1
1
  import { i as e } from "./i18n-BY1ds1BL.js";
2
2
  import { t } from "./styles-BfoIZwJp.js";
3
3
  import { c as n, i as r, l as i } from "./shared-Bx9s0i0P.js";
4
- import { n as a } from "./dist-BdUy8m_p.js";
4
+ import { n as a } from "./dist-D6i-VNgM.js";
5
5
  //#region src/css/theme/fields/_text-limit.css?inline
6
6
  var o = "@layer formie-theme{.formie-limit-number{font-weight:var(--formie-font-weight-semibold);color:var(--formie-color-text)}.formie-limit-number-error{color:var(--formie-color-danger)}}", s = "input[data-formie-single-line-text-input], textarea[data-formie-multi-line-text-input]", c = [
7
7
  "textMinCharacterLimit",
@@ -116,8 +116,10 @@
116
116
 
117
117
  .formie-field-option:has(> input[data-formie-other-option]),
118
118
  .formie-other-option {
119
+ display: flex;
119
120
  flex-wrap: wrap;
120
- align-items: flex-start;
121
+ align-items: center;
122
+ width: 100%;
121
123
  }
122
124
 
123
125
  .formie-field-option:has(> input[data-formie-other-option]:checked) > .formie-other-option-text,
@@ -20,7 +20,8 @@
20
20
  [data-formie-field-type="signature"] .formie-signature-canvas {
21
21
  display: block;
22
22
  width: var(--formie-signature-width);
23
- height: var(--formie-signature-height);
23
+ min-height: var(--formie-signature-height);
24
+ height: auto;
24
25
  border: var(--formie-signature-border);
25
26
  background: var(--formie-signature-background);
26
27
  border-radius: var(--formie-signature-border-radius);
@@ -0,0 +1,9 @@
1
+ @layer formie-theme {
2
+
3
+ /* Opayo drop-in checkout iframe mount point. */
4
+ .formie-opayo-drop-in {
5
+ width: 100%;
6
+ min-height: 10rem;
7
+ box-sizing: border-box;
8
+ }
9
+ }
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { c as e, d as t, l as n, o as r, r as i, t as a, u as o } from "./chunks/event-names-BCI2FLD8.js";
2
- import { a as s, c, d as l, f as u, i as d, l as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y } from "./chunks/api-BYe9YPko.js";
2
+ import { a as s, c, d as l, f as u, i as d, l as f, n as p, o as m, p as h, r as g, s as _, t as v, u as y } from "./chunks/api-DqpfkZWL.js";
3
3
  import { a as b, i as x, n as ee, r as te, t as S } from "./chunks/debug-BV0DvdHx.js";
4
4
  import { n as ne, r as C, t as w } from "./chunks/theme-classes-Tv7q7ToE.js";
5
5
  import { t as T } from "./chunks/http-D-JExro7.js";
@@ -1382,42 +1382,42 @@ var L = class {
1382
1382
  snaptcha: () => import("./chunks/snaptcha-DKx98oon.js").then((e) => e.snaptchaModule),
1383
1383
  turnstile: () => import("./chunks/turnstile-DJakPzQD.js").then((e) => e.turnstileModule)
1384
1384
  }, Xt = {
1385
- calculations: () => import("./chunks/calculations-DERi2xaC.js").then((e) => e.calculationsModule),
1385
+ calculations: () => import("./chunks/calculations-Dv3hYb8_.js").then((e) => e.calculationsModule),
1386
1386
  "checkbox-radio": () => import("./chunks/checkbox-radio-BY2aTCOG.js").then((e) => e.checkboxRadioModule),
1387
1387
  combobox: () => import("./chunks/combobox-C0EuExSI.js").then((e) => e.comboboxModule),
1388
- conditions: () => import("./chunks/conditions-65kBcFWW.js").then((e) => e.conditionsModule),
1388
+ conditions: () => import("./chunks/conditions-CPH1snCx.js").then((e) => e.conditionsModule),
1389
1389
  "custom-google-maps": () => import("./chunks/custom-google-maps-BsaSirEZ.js").then((e) => e.customGoogleMapsModule),
1390
1390
  "custom-link": () => import("./chunks/custom-link-CJ1-FjEM.js").then((e) => e.customLinkModule),
1391
1391
  "custom-maps": () => import("./chunks/custom-maps-DYW_pBid.js").then((e) => e.customMapsModule),
1392
- "date-picker": () => import("./chunks/date-picker-5CA_-zGb.js").then((e) => e.datePickerModule),
1392
+ "date-picker": () => import("./chunks/date-picker-F9BUBDSW.js").then((e) => e.datePickerModule),
1393
1393
  "file-upload": () => import("./chunks/file-upload-rqfZNqlH.js").then((e) => e.fileUploadModule),
1394
1394
  "upload-manager": () => import("./chunks/upload-manager-W-QDgxKD.js").then((e) => e.uploadManagerModule),
1395
1395
  hidden: () => import("./chunks/hidden-D7_Ch-QN.js").then((e) => e.hiddenModule),
1396
1396
  "phone-country": () => import("./chunks/phone-country-D3ayr60L.js").then((e) => e.phoneCountryModule),
1397
- "password-validation": () => import("./chunks/password-validation-T0vDQPCr.js").then((e) => e.passwordValidationModule),
1397
+ "password-validation": () => import("./chunks/password-validation-D06uH9va.js").then((e) => e.passwordValidationModule),
1398
1398
  "address-country": () => import("./chunks/address-country-Rx6GQTND.js").then((e) => e.addressCountryModule),
1399
1399
  "address-state": () => import("./chunks/address-state-BwE01m2_.js").then((e) => e.addressStateModule),
1400
1400
  repeater: () => import("./chunks/repeater-BVnPUqTj.js").then((e) => e.repeaterModule),
1401
1401
  "rich-text": () => import("./chunks/rich-text-Bg_--4TG.js").then((e) => e.richTextModule),
1402
- signature: () => import("./chunks/signature-xz4QO7CR.js").then((e) => e.signatureModule),
1402
+ signature: () => import("./chunks/signature-IOhuicje.js").then((e) => e.signatureModule),
1403
1403
  summary: () => import("./chunks/summary-Dks0gXS3.js").then((e) => e.summaryModule),
1404
1404
  "survey-likert": () => import("./chunks/survey-likert-DkE6bR7B.js").then((e) => e.surveyLikertModule),
1405
1405
  "survey-rank": () => import("./chunks/survey-rank-DN6x4IZM.js").then((e) => e.surveyRankModule),
1406
1406
  "survey-rating": () => import("./chunks/survey-rating-BnsNL9U5.js").then((e) => e.surveyRatingModule),
1407
1407
  table: () => import("./chunks/table-CAjCJHrL.js").then((e) => e.tableModule),
1408
- "text-limit": () => import("./chunks/text-limit-Bn18WrPU.js").then((e) => e.textLimitModule)
1408
+ "text-limit": () => import("./chunks/text-limit-BGaY0jhI.js").then((e) => e.textLimitModule)
1409
1409
  }, Zt = {
1410
- bpoint: () => import("./chunks/bpoint-C0VOftX9.js").then((e) => e.bpointModule),
1411
- eway: () => import("./chunks/eway-CS6Y1Yvo.js").then((e) => e.ewayModule),
1412
- "go-cardless": () => import("./chunks/go-cardless-BTPD668l.js").then((e) => e.goCardlessModule),
1413
- mollie: () => import("./chunks/mollie-CXgBwvo6.js").then((e) => e.mollieModule),
1414
- moneris: () => import("./chunks/moneris-B6oLu7nj.js").then((e) => e.monerisModule),
1415
- opayo: () => import("./chunks/opayo-DPUA5CKr.js").then((e) => e.opayoModule),
1416
- paddle: () => import("./chunks/paddle-GRlsm5mm.js").then((e) => e.paddleModule),
1417
- paypal: () => import("./chunks/paypal-CdcZnf6r.js").then((e) => e.paypalModule),
1418
- payway: () => import("./chunks/payway-CfmYOS__.js").then((e) => e.paywayModule),
1419
- square: () => import("./chunks/square-BY--5M-X.js").then((e) => e.squareModule),
1420
- stripe: () => import("./chunks/stripe-uusYjWty.js").then((e) => e.stripeModule)
1410
+ bpoint: () => import("./chunks/bpoint-Dlq34XH1.js").then((e) => e.bpointModule),
1411
+ eway: () => import("./chunks/eway-D9_m8ooj.js").then((e) => e.ewayModule),
1412
+ "go-cardless": () => import("./chunks/go-cardless-DAT3ZaQf.js").then((e) => e.goCardlessModule),
1413
+ mollie: () => import("./chunks/mollie-Bibhl67p.js").then((e) => e.mollieModule),
1414
+ moneris: () => import("./chunks/moneris-H2wSqk9h.js").then((e) => e.monerisModule),
1415
+ opayo: () => import("./chunks/opayo-CR0DtsLa.js").then((e) => e.opayoModule),
1416
+ paddle: () => import("./chunks/paddle-DkvIxQdG.js").then((e) => e.paddleModule),
1417
+ paypal: () => import("./chunks/paypal-CQpAF7Ua.js").then((e) => e.paypalModule),
1418
+ payway: () => import("./chunks/payway-CwDkC7YZ.js").then((e) => e.paywayModule),
1419
+ square: () => import("./chunks/square-DwdcOI1G.js").then((e) => e.squareModule),
1420
+ stripe: () => import("./chunks/stripe-DaoG2FT1.js").then((e) => e.stripeModule)
1421
1421
  }, Qt = {
1422
1422
  ...Xt,
1423
1423
  ...Jt,
@@ -2231,7 +2231,9 @@ function sr() {
2231
2231
  instance: D,
2232
2232
  options: g,
2233
2233
  unbinds: d
2234
- })), b && (ar(r, b, m, l, T, d), T && (d.push(_(b, T, r)), d.push(bn(b))), await or(r, m, b)), i.forEach((e) => {
2234
+ })), b && (ar(r, b, m, l, T, d), T && (d.push(_(b, T, r)), d.push(bn(b))), await or(r, m, b), b.dispatchEvent(new CustomEvent("formie:state:reset")), window.setTimeout(() => {
2235
+ b.dispatchEvent(new CustomEvent("formie:state:reset"));
2236
+ }, 350)), i.forEach((e) => {
2235
2237
  let t = l.on(`formie:stage:${e}:before`, async (t) => {
2236
2238
  h(r, `formie:stage:${e}:before`, t);
2237
2239
  }), n = l.on(`formie:stage:${e}:before`, async (e) => {
@@ -1 +1 @@
1
- {"version":3,"file":"create-formie-client.d.ts","sourceRoot":"","sources":["../../../src/js/core/create-formie-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,YAAY,EAGf,MAAM,mBAAmB,CAAC;AA81B3B,wBAAgB,kBAAkB,IAAI,YAAY,CAysBjD"}
1
+ {"version":3,"file":"create-formie-client.d.ts","sourceRoot":"","sources":["../../../src/js/core/create-formie-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,YAAY,EAGf,MAAM,mBAAmB,CAAC;AA81B3B,wBAAgB,kBAAkB,IAAI,YAAY,CAgtBjD"}
@@ -1 +1 @@
1
- {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/fields/date-picker.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAgUjE,eAAO,MAAM,gBAAgB,EAAE,sBAwC9B,CAAC"}
1
+ {"version":3,"file":"date-picker.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/fields/date-picker.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAsUjE,eAAO,MAAM,gBAAgB,EAAE,sBAwC9B,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/fields/signature.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAmVjE,eAAO,MAAM,eAAe,EAAE,sBA2C7B,CAAC"}
1
+ {"version":3,"file":"signature.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/fields/signature.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAyXjE,eAAO,MAAM,eAAe,EAAE,sBA2C7B,CAAC"}
@@ -8,6 +8,10 @@ type PaymentSetupResult = {
8
8
  destroy?: () => void | Promise<void>;
9
9
  onBeforeStage?: (stageCtx: import('#contracts/modules').SubmitHookContext) => void | Promise<void>;
10
10
  };
11
+ export type PaymentAfterSubmitResult = {
12
+ /** Tear down the current widget and mount again (for example after a failed payment). */
13
+ remount?: boolean;
14
+ };
11
15
  export type ManagedPaymentModuleAdapter<TProvider extends Record<string, unknown>, TApi, TWidget> = {
12
16
  id: string;
13
17
  defaultRequiredInputSuffixes?: string[];
@@ -47,7 +51,7 @@ export type ManagedPaymentModuleAdapter<TProvider extends Record<string, unknown
47
51
  options: NormalizedPaymentModuleOptions<TProvider>;
48
52
  provider: TProvider;
49
53
  result?: import('#contracts/schema').FormSubmitResult;
50
- }) => void | Promise<void>;
54
+ }) => void | Promise<void> | PaymentAfterSubmitResult | Promise<PaymentAfterSubmitResult>;
51
55
  };
52
56
  export declare function createManagedPaymentModule<TProvider extends Record<string, unknown>, TApi, TWidget>(adapter: ManagedPaymentModuleAdapter<TProvider, TApi, TWidget>): FormieModuleDefinition;
53
57
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"factories.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/payments/factories.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACR,sBAAsB,EAEtB,kBAAkB,EACrB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAEH,KAAK,8BAA8B,EACnC,KAAK,mBAAmB,EAE3B,MAAM,wBAAwB,CAAC;AAchC,MAAM,MAAM,yBAAyB,CAAC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC,GAAG;IACrH,OAAO,EAAE,8BAA8B,CAAC,SAAS,CAAC,CAAC;IACnD,QAAQ,EAAE,mBAAmB,CAAC;CACjC,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACtB,OAAO,CAAC,EAAE,MAAM,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,aAAa,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,oBAAoB,EAAE,iBAAiB,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtG,CAAC;AAEF,MAAM,MAAM,2BAA2B,CACnC,SAAS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EAAE,CAAC,IAAI,EAAE;QACvB,GAAG,EAAE,IAAI,CAAC;QACV,MAAM,EAAE,OAAO,GAAG,IAAI,CAAC;QACvB,KAAK,EAAE,OAAO,CAAC;QACf,QAAQ,EAAE,mBAAmB,CAAC;QAC9B,OAAO,EAAE,8BAA8B,CAAC,SAAS,CAAC,CAAC;QACnD,QAAQ,EAAE,SAAS,CAAC;QACpB,QAAQ,EAAE,OAAO,oBAAoB,EAAE,iBAAiB,CAAC;KAC5D,KAAK,OAAO,CAAC,OAAO,CAAC,GAAG,OAAO,CAAC;IACjC,mFAAmF;IACnF,aAAa,CAAC,EAAE,CAAC,IAAI,EAAE;QACnB,KAAK,EAAE,OAAO,CAAC;QACf,QAAQ,EAAE,mBAAmB,CAAC;QAC9B,OAAO,EAAE,8BAA8B,CAAC,SAAS,CAAC,CAAC;QACnD,QAAQ,EAAE,SAAS,CAAC;QACpB,MAAM,CAAC,EAAE,OAAO,mBAAmB,EAAE,gBAAgB,CAAC;KACzD,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,wBAAwB,GAAG,OAAO,CAAC,wBAAwB,CAAC,CAAC;CAC7F,CAAC;AAEF,wBAAgB,0BAA0B,CACtC,SAAS,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACzC,IAAI,EACJ,OAAO,EACT,OAAO,EAAE,2BAA2B,CAAC,SAAS,EAAE,IAAI,EAAE,OAAO,CAAC,GAAG,sBAAsB,CA4QxF"}
@@ -5,7 +5,7 @@ type SagePayTokeniseResult = {
5
5
  message: string;
6
6
  }>;
7
7
  };
8
- type SagePayGlobal = {
8
+ type SagePayOwnFormGlobal = {
9
9
  (opts: {
10
10
  merchantSessionKey: string;
11
11
  }): {
@@ -15,9 +15,24 @@ type SagePayGlobal = {
15
15
  }) => void;
16
16
  };
17
17
  };
18
+ type SagePayCheckoutInstance = {
19
+ tokenise: (opts?: {
20
+ newMerchantSessionKey?: string;
21
+ }) => void;
22
+ destroy: () => void;
23
+ };
24
+ type SagePayCheckoutGlobal = {
25
+ (opts: {
26
+ merchantSessionKey: string;
27
+ containerSelector: string;
28
+ onTokenise?: (result: SagePayTokeniseResult) => void;
29
+ reusableCardIdentifier?: string;
30
+ }): SagePayCheckoutInstance;
31
+ };
18
32
  declare global {
19
33
  interface Window {
20
- sagepayOwnForm?: SagePayGlobal;
34
+ sagepayOwnForm?: SagePayOwnFormGlobal;
35
+ sagepayCheckout?: SagePayCheckoutGlobal;
21
36
  }
22
37
  }
23
38
  export declare const opayoModule: import("../../..").FormieModuleDefinition;
@@ -1 +1 @@
1
- {"version":3,"file":"opayo.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/payments/opayo.ts"],"names":[],"mappings":"AAKA,KAAK,qBAAqB,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvC,CAAC;AAEF,KAAK,aAAa,GAAG;IACjB,CAAC,IAAI,EAAE;QAAE,kBAAkB,EAAE,MAAM,CAAA;KAAE,GAAG;QACpC,mBAAmB,EAAE,CAAC,IAAI,EAAE;YACxB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACpC,WAAW,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;SACxD,KAAK,IAAI,CAAC;KACd,CAAC;CACL,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,cAAc,CAAC,EAAE,aAAa,CAAC;KAClC;CACJ;AAeD,eAAO,MAAM,WAAW,2CAwOtB,CAAC"}
1
+ {"version":3,"file":"opayo.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/payments/opayo.ts"],"names":[],"mappings":"AAUA,KAAK,qBAAqB,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,MAAM,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CACvC,CAAC;AAEF,KAAK,oBAAoB,GAAG;IACxB,CAAC,IAAI,EAAE;QAAE,kBAAkB,EAAE,MAAM,CAAA;KAAE,GAAG;QACpC,mBAAmB,EAAE,CAAC,IAAI,EAAE;YACxB,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACpC,WAAW,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;SACxD,KAAK,IAAI,CAAC;KACd,CAAC;CACL,CAAC;AAEF,KAAK,uBAAuB,GAAG;IAC3B,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE;QAAE,qBAAqB,CAAC,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;IAC9D,OAAO,EAAE,MAAM,IAAI,CAAC;CACvB,CAAC;AAEF,KAAK,qBAAqB,GAAG;IACzB,CAAC,IAAI,EAAE;QACH,kBAAkB,EAAE,MAAM,CAAC;QAC3B,iBAAiB,EAAE,MAAM,CAAC;QAC1B,UAAU,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;QACrD,sBAAsB,CAAC,EAAE,MAAM,CAAC;KACnC,GAAG,uBAAuB,CAAC;CAC/B,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACX,UAAU,MAAM;QACZ,cAAc,CAAC,EAAE,oBAAoB,CAAC;QACtC,eAAe,CAAC,EAAE,qBAAqB,CAAC;KAC3C;CACJ;AAwFD,eAAO,MAAM,WAAW,2CAsUtB,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"paypal.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/payments/paypal.ts"],"names":[],"mappings":"AA4EA,eAAO,MAAM,YAAY,2CAyIvB,CAAC"}
1
+ {"version":3,"file":"paypal.d.ts","sourceRoot":"","sources":["../../../../src/js/modules/payments/paypal.ts"],"names":[],"mappings":"AAqFA,eAAO,MAAM,YAAY,2CAoJvB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@verbb/formie-browser",
3
- "version": "1.0.11",
3
+ "version": "1.0.13",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",
@@ -70,7 +70,7 @@
70
70
  "@placekit/autocomplete-js": "^2.2.1",
71
71
  "@uppy/core": "^5.2.0",
72
72
  "@uppy/xhr-upload": "^5.2.0",
73
- "@verbb/formie-core": "1.0.11",
73
+ "@verbb/formie-core": "1.0.13",
74
74
  "expression-language": "^2.5.4",
75
75
  "flatpickr": "^4.6.13",
76
76
  "friendly-challenge": "^0.9.19",
@@ -116,8 +116,10 @@
116
116
 
117
117
  .formie-field-option:has(> input[data-formie-other-option]),
118
118
  .formie-other-option {
119
+ display: flex;
119
120
  flex-wrap: wrap;
120
- align-items: flex-start;
121
+ align-items: center;
122
+ width: 100%;
121
123
  }
122
124
 
123
125
  .formie-field-option:has(> input[data-formie-other-option]:checked) > .formie-other-option-text,
@@ -20,7 +20,8 @@
20
20
  [data-formie-field-type="signature"] .formie-signature-canvas {
21
21
  display: block;
22
22
  width: var(--formie-signature-width);
23
- height: var(--formie-signature-height);
23
+ min-height: var(--formie-signature-height);
24
+ height: auto;
24
25
  border: var(--formie-signature-border);
25
26
  background: var(--formie-signature-background);
26
27
  border-radius: var(--formie-signature-border-radius);
@@ -0,0 +1,9 @@
1
+ @layer formie-theme {
2
+
3
+ /* Opayo drop-in checkout iframe mount point. */
4
+ .formie-opayo-drop-in {
5
+ width: 100%;
6
+ min-height: 10rem;
7
+ box-sizing: border-box;
8
+ }
9
+ }
@@ -1192,6 +1192,13 @@ export function createFormieClient(): FormieClient {
1192
1192
  }
1193
1193
 
1194
1194
  await refreshTokensIfNeeded(target, normalizedOptions, form);
1195
+
1196
+ // Recapture after captcha/token hydration and field-module init settle so
1197
+ // programmatic post-mount value changes do not leave a false dirty state.
1198
+ form.dispatchEvent(new CustomEvent('formie:state:reset'));
1199
+ window.setTimeout(() => {
1200
+ form.dispatchEvent(new CustomEvent('formie:state:reset'));
1201
+ }, 350);
1195
1202
  }
1196
1203
 
1197
1204
  stageNames.forEach((stageName) => {
@@ -285,6 +285,12 @@ function initDatePicker(input: FlatpickrInput, options: DatePickerOptions): () =
285
285
  if (startDate) {
286
286
  defaultOptions.defaultDate = endDate ? [startDate, endDate] : [startDate];
287
287
  }
288
+ } else if (input.value) {
289
+ const defaultDate = parseSubmissionDate(input.value);
290
+
291
+ if (defaultDate) {
292
+ defaultOptions.defaultDate = defaultDate;
293
+ }
288
294
  }
289
295
 
290
296
  const mergedOptions = {
@@ -111,11 +111,45 @@ function drawValueOnCanvas(canvas: HTMLCanvasElement, value: string): void {
111
111
  };
112
112
  }
113
113
 
114
+ function getImageDimensions(dataUrl: string): Promise<{ width: number; height: number } | null> {
115
+ return new Promise((resolve) => {
116
+ const image = new Image();
117
+ image.onload = () => {
118
+ resolve({
119
+ width: image.naturalWidth,
120
+ height: image.naturalHeight,
121
+ });
122
+ };
123
+ image.onerror = () => resolve(null);
124
+ image.src = dataUrl;
125
+ });
126
+ }
127
+
128
+ async function syncCanvasHeightToSignatureValue(canvas: HTMLCanvasElement, value: string): Promise<void> {
129
+ const dimensions = await getImageDimensions(value);
130
+
131
+ if (!dimensions?.width || !dimensions?.height) {
132
+ return;
133
+ }
134
+
135
+ const { width: containerWidth } = getCanvasSize(canvas);
136
+
137
+ if (!(containerWidth > 0)) {
138
+ return;
139
+ }
140
+
141
+ // Match the stored PNG aspect ratio so restored signatures are not vertically stretched.
142
+ const aspectHeight = Math.max(1, Math.round(containerWidth * (dimensions.height / dimensions.width)));
143
+ canvas.style.height = `${aspectHeight}px`;
144
+ }
145
+
114
146
  async function restoreSignatureValue(signaturePad: SignaturePad, canvas: HTMLCanvasElement, value: string): Promise<void> {
115
147
  if (!value) {
116
148
  return;
117
149
  }
118
150
 
151
+ await syncCanvasHeightToSignatureValue(canvas, value);
152
+
119
153
  try {
120
154
  await signaturePad.fromDataURL(value);
121
155
  } catch {
@@ -184,6 +218,12 @@ function initSignatureField(
184
218
  };
185
219
 
186
220
  const resizeCanvas = async(): Promise<boolean> => {
221
+ const existingValue = input.value || (signaturePad.isEmpty() ? '' : signaturePad.toDataURL());
222
+
223
+ if (existingValue) {
224
+ await syncCanvasHeightToSignatureValue(canvas, existingValue);
225
+ }
226
+
187
227
  const { width, height } = getCanvasSize(canvas);
188
228
 
189
229
  if (!(width > 0) || !(height > 0)) {
@@ -196,8 +236,6 @@ function initSignatureField(
196
236
  return false;
197
237
  }
198
238
 
199
- const existingValue = input.value || (signaturePad.isEmpty() ? '' : signaturePad.toDataURL());
200
-
201
239
  canvas.width = width * ratio;
202
240
  canvas.height = height * ratio;
203
241
  context.setTransform(1, 0, 0, 1, 0, 0);
@@ -33,6 +33,11 @@ type PaymentSetupResult = {
33
33
  onBeforeStage?: (stageCtx: import('#contracts/modules').SubmitHookContext) => void | Promise<void>;
34
34
  };
35
35
 
36
+ export type PaymentAfterSubmitResult = {
37
+ /** Tear down the current widget and mount again (for example after a failed payment). */
38
+ remount?: boolean;
39
+ };
40
+
36
41
  export type ManagedPaymentModuleAdapter<
37
42
  TProvider extends Record<string, unknown>,
38
43
  TApi,
@@ -74,7 +79,7 @@ export type ManagedPaymentModuleAdapter<
74
79
  options: NormalizedPaymentModuleOptions<TProvider>;
75
80
  provider: TProvider;
76
81
  result?: import('#contracts/schema').FormSubmitResult;
77
- }) => void | Promise<void>;
82
+ }) => void | Promise<void> | PaymentAfterSubmitResult | Promise<PaymentAfterSubmitResult>;
78
83
  };
79
84
 
80
85
  export function createManagedPaymentModule<
@@ -318,13 +323,33 @@ export function createManagedPaymentModule<
318
323
  return;
319
324
  }
320
325
 
321
- await adapter.onAfterSubmit({
326
+ const afterSubmitResult = await adapter.onAfterSubmit({
322
327
  field: ctx.target,
323
328
  services,
324
329
  options,
325
330
  provider: options.provider,
326
331
  result,
327
332
  });
333
+
334
+ if (!afterSubmitResult?.remount || !adapter.mount) {
335
+ return;
336
+ }
337
+
338
+ if (widget && adapter.unmount) {
339
+ const api = await getApi();
340
+
341
+ await adapter.unmount({
342
+ api,
343
+ widget,
344
+ field: ctx.target,
345
+ services,
346
+ options,
347
+ provider: options.provider,
348
+ });
349
+ }
350
+
351
+ widget = null;
352
+ await ensureMounted();
328
353
  },
329
354
  };
330
355
  },