@feathery/react 2.23.4 → 2.23.5

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 (94) hide show
  1. package/cjs/auth/internal/utils.d.ts.map +1 -1
  2. package/cjs/elements/fields/PhoneField/CountryDropdown.d.ts.map +1 -1
  3. package/cjs/elements/fields/PhoneField/index.d.ts.map +1 -1
  4. package/cjs/elements/fields/PhoneField/tests/test-utils.d.ts.map +1 -1
  5. package/cjs/{fthry_FormControl.CP_mLa1m.js → fthry_FormControl.CscXHID3.js} +1 -1
  6. package/cjs/{fthry_InlineTooltip.B8DmZAm_.js → fthry_InlineTooltip.ZpgEmPO3.js} +2 -2
  7. package/cjs/{fthry_Overlay.NbtN0szY.js → fthry_Overlay.BTS_EcV3.js} +1 -1
  8. package/cjs/{fthry_PaymentMethodField.Chdv_-BE.js → fthry_PaymentMethodField.D902pJlo.js} +4 -4
  9. package/cjs/{fthry_Placeholder.DqfWdyxL.js → fthry_Placeholder.Ctq06SYu.js} +1 -1
  10. package/cjs/{fthry_ShowEyeIcon.D0r8cp_B.js → fthry_ShowEyeIcon.q9BhUK2g.js} +1 -1
  11. package/cjs/{fthry_index.C5j86Jvn.js → fthry_index.-Y9ZJS34.js} +6 -6
  12. package/cjs/{fthry_index.xSHVUU1i.js → fthry_index.9PFsbc4I.js} +1 -1
  13. package/cjs/{fthry_index.jPrS6PXj.js → fthry_index.B4YVBeqY.js} +3 -3
  14. package/cjs/{fthry_index.DYCqVDAy.js → fthry_index.BS6b2BTF.js} +6 -6
  15. package/cjs/{fthry_index.BYHR4MSY.js → fthry_index.BYTU7WTg.js} +4 -4
  16. package/cjs/{fthry_index.D12V6N10.js → fthry_index.B_UehadW.js} +1 -1
  17. package/cjs/{fthry_index.BEVeNRzV.js → fthry_index.Bh5jAAhx.js} +6 -6
  18. package/cjs/{fthry_index.DMpC4pzK.js → fthry_index.Bl2kuNOo.js} +14 -16
  19. package/cjs/{fthry_index.D4Wh5Gae.js → fthry_index.BmT77CVY.js} +2 -2
  20. package/cjs/{fthry_index.DHiNhZNV.js → fthry_index.Bsklltx4.js} +1 -1
  21. package/cjs/{fthry_index.CwZQzFeM.js → fthry_index.BuQ1HIIN.js} +8 -8
  22. package/cjs/{fthry_index.Cmq71Bt9.js → fthry_index.C6-dnyHD.js} +1 -1
  23. package/cjs/{fthry_index.B2zNdCo9.js → fthry_index.CSwhuTPY.js} +1 -1
  24. package/cjs/{fthry_index.nk3LibkG.js → fthry_index.CTqVrxjv.js} +1 -1
  25. package/cjs/{fthry_index.DxlmMil4.js → fthry_index.CWofoHQs.js} +4 -4
  26. package/cjs/{fthry_index.CJcXFlqa.js → fthry_index.CbASwLjr.js} +1 -1
  27. package/cjs/{fthry_index.NQG80c7p.js → fthry_index.D36o5hns.js} +5 -5
  28. package/cjs/{fthry_index.DnxpWsMc.js → fthry_index.DGctX9WE.js} +5 -5
  29. package/cjs/fthry_index.DKgFa6Cd.js +7245 -0
  30. package/cjs/{fthry_index.CxSsfqmh.js → fthry_index.Jp2CJ4is.js} +2 -2
  31. package/cjs/{fthry_index.Bsfl9n6o.js → fthry_index.Nrwqiq0j.js} +5 -5
  32. package/cjs/{fthry_index.BwJ8UbV0.js → fthry_index._iQAHcD9.js} +1285 -1272
  33. package/cjs/{fthry_index.MhBBvjf4.js → fthry_index.dGUMsRB1.js} +4 -4
  34. package/cjs/{fthry_index.D48NiLIf.js → fthry_index.jot4NArP.js} +3 -3
  35. package/cjs/{fthry_index.qt3C-Qt1.js → fthry_index.lGGMSnRj.js} +1 -1
  36. package/cjs/{fthry_index.BUWCPnkW.js → fthry_index.mEUshDAA.js} +1 -1
  37. package/cjs/{fthry_input.BtD9rhOL.js → fthry_input.3JtjJgPY.js} +1 -1
  38. package/cjs/{fthry_script.Bse2qene.js → fthry_script.DOCG8gyM.js} +1 -1
  39. package/cjs/{fthry_styles.CBS4ziaS.js → fthry_styles.CVqE6wer.js} +1 -1
  40. package/cjs/{fthry_useElementSize.1JZE9_XK.js → fthry_useElementSize.B5-XFuix.js} +1 -1
  41. package/cjs/{fthry_useSalesforceSync.BDWg3Re_.js → fthry_useSalesforceSync.D9f_IkFv.js} +1 -1
  42. package/cjs/{fthry_webfontloader.C5EOl2GC.js → fthry_webfontloader.5X-HEWHN.js} +1 -1
  43. package/cjs/index.js +1 -1
  44. package/cjs/utils/validation.d.ts +4 -3
  45. package/cjs/utils/validation.d.ts.map +1 -1
  46. package/dist/auth/internal/utils.d.ts.map +1 -1
  47. package/dist/elements/fields/PhoneField/CountryDropdown.d.ts.map +1 -1
  48. package/dist/elements/fields/PhoneField/index.d.ts.map +1 -1
  49. package/dist/elements/fields/PhoneField/tests/test-utils.d.ts.map +1 -1
  50. package/dist/{fthry_FormControl.pCOAO7LM.js → fthry_FormControl.Bt83gTi3.js} +1 -1
  51. package/dist/{fthry_InlineTooltip.C_1nocB9.js → fthry_InlineTooltip.BADFGh_F.js} +2 -2
  52. package/dist/{fthry_Overlay.B71_lHCP.js → fthry_Overlay.CsBPXuR_.js} +1 -1
  53. package/dist/{fthry_PaymentMethodField.DWQiQajb.js → fthry_PaymentMethodField.CVKE3t_i.js} +4 -4
  54. package/dist/{fthry_Placeholder.CmfLMsuU.js → fthry_Placeholder.9MqCxqHS.js} +1 -1
  55. package/dist/{fthry_ShowEyeIcon.CwsDOp-1.js → fthry_ShowEyeIcon.CxXoA4_B.js} +1 -1
  56. package/dist/{fthry_index.qSUOQAau.js → fthry_index.5oEnjTzQ.js} +3 -3
  57. package/dist/{fthry_index.DrbC7Yvj.js → fthry_index.7TulZeVg.js} +6 -6
  58. package/dist/{fthry_index.B6e40TNH.js → fthry_index.AdQD-dII.js} +1 -1
  59. package/dist/{fthry_index.3I3TFRij.js → fthry_index.B0_n9jqc.js} +4 -4
  60. package/dist/{fthry_index.CTNmp4Uu.js → fthry_index.BIkyi9OD.js} +4 -4
  61. package/dist/{fthry_index.lUtvQLwf.js → fthry_index.BPmvHG0R.js} +1 -1
  62. package/dist/{fthry_index.Boum24kr.js → fthry_index.BQTGcd6O.js} +8 -8
  63. package/dist/{fthry_index.CRHUBRQI.js → fthry_index.BbSZxIR5.js} +2 -2
  64. package/dist/{fthry_index.fgPxSncQ.js → fthry_index.Beh4LhUb.js} +4 -4
  65. package/dist/{fthry_index.xiCtRiXP.js → fthry_index.C0FNSGu0.js} +5 -5
  66. package/dist/{fthry_index.DNkI9rK_.js → fthry_index.C4cVkdmR.js} +5 -5
  67. package/dist/{fthry_index.B662KpzL.js → fthry_index.CefyT_Xy.js} +3 -3
  68. package/dist/{fthry_index.B-1AsITd.js → fthry_index.CnNPiyfF.js} +6 -6
  69. package/dist/{fthry_index.Du7-Siwz.js → fthry_index.CsQzji9M.js} +1 -1
  70. package/dist/{fthry_index.DZzcdxua.js → fthry_index.Cy8OGyJ9.js} +14 -16
  71. package/dist/{fthry_index.DkOfnwMo.js → fthry_index.CyjNCuWE.js} +1 -1
  72. package/dist/{fthry_index.BdiPlpSw.js → fthry_index.D4ENNIPP.js} +1 -1
  73. package/dist/{fthry_index.B_MGu0vq.js → fthry_index.D86GTeP3.js} +6 -6
  74. package/dist/{fthry_index.Zw_6EeQW.js → fthry_index.Degy27gw.js} +1 -1
  75. package/dist/{fthry_index.CDEcS8bU.js → fthry_index.DoxZOyru.js} +2 -2
  76. package/dist/{fthry_index.BM9D8gpq.js → fthry_index.DpU0lL2P.js} +1 -1
  77. package/dist/{fthry_index.DpJv-8TU.js → fthry_index.Dte366nP.js} +1 -1
  78. package/dist/{fthry_index.EsYuFuWJ.js → fthry_index.EFk2iysz.js} +1286 -1273
  79. package/dist/{fthry_index.BFjEVX8Q.js → fthry_index.FjbxGNs2.js} +5 -5
  80. package/dist/fthry_index.FxHyaooV.js +7193 -0
  81. package/dist/{fthry_index.UgzTpusQ.js → fthry_index.qQius3J9.js} +1 -1
  82. package/dist/{fthry_input.DDJESt6C.js → fthry_input.BMNwRyD_.js} +1 -1
  83. package/dist/{fthry_script.BZXm6Hk6.js → fthry_script.0KhNn8f9.js} +1 -1
  84. package/dist/{fthry_styles.LF8XhlRV.js → fthry_styles.DtCYeZPi.js} +1 -1
  85. package/dist/{fthry_useElementSize.Bs-CqmP2.js → fthry_useElementSize.fW6iiT11.js} +1 -1
  86. package/dist/{fthry_useSalesforceSync.DWx9gd0A.js → fthry_useSalesforceSync.BIkirclp.js} +1 -1
  87. package/dist/{fthry_webfontloader.Fmt0quEr.js → fthry_webfontloader.Dyilj6id.js} +1 -1
  88. package/dist/index.js +1 -1
  89. package/dist/utils/validation.d.ts +4 -3
  90. package/dist/utils/validation.d.ts.map +1 -1
  91. package/package.json +2 -1
  92. package/umd/{PhoneField.f52b5de44614b445feeb.js → PhoneField.42eae8ec161c28522777.js} +1 -1
  93. package/umd/index.js +1 -1
  94. package/umd/libphonenumber.d53d0d1347fa5545ff45.js +1 -0
@@ -17591,373 +17591,726 @@ var isBase64Image = function (string) {
17591
17591
  return BASE64_REGEX.test(string);
17592
17592
  };
17593
17593
 
17594
- var plaidPromise = null;
17595
- function installPlaid(isPlaidActive) {
17596
- if (plaidPromise)
17597
- return plaidPromise;
17598
- else if (!isPlaidActive)
17599
- return Promise.resolve();
17600
- else {
17601
- plaidPromise = dynamicImport('https://cdn.plaid.com/link/v2/stable/link-initialize.js');
17602
- return plaidPromise;
17603
- }
17604
- }
17605
- function openPlaidLink(client, onSuccess, onExit, updateFieldValues, action, handleError) {
17606
- return __awaiter$2(this, void 0, void 0, function () {
17607
- var kwargs, res, handler;
17608
- var _this = this;
17609
- return __generator(this, function (_a) {
17610
- switch (_a.label) {
17611
- case 0: return [4 /*yield*/, plaidPromise];
17612
- case 1:
17613
- _a.sent();
17614
- if (action.plaid_action === 'identity') {
17615
- kwargs = {
17616
- identity_template_id: action.template_id,
17617
- email_field: action.email_field
17618
- };
17619
- }
17620
- else {
17621
- kwargs = { liabilities: action.include_liabilities ? 'true' : 'false' };
17622
- }
17623
- return [4 /*yield*/, client.fetchPlaidLinkToken(kwargs)];
17624
- case 2:
17625
- res = _a.sent();
17626
- if (res.err) {
17627
- handleError(res.err);
17628
- return [2 /*return*/];
17629
- }
17630
- handler = global.Plaid.create({
17631
- token: res.token,
17632
- onExit: onExit,
17633
- onSuccess: function (publicToken, metadata) { return __awaiter$2(_this, void 0, void 0, function () {
17634
- var res_1, statusKey, newValues, res_2, fieldVals;
17635
- var _a;
17636
- var _b;
17637
- return __generator(this, function (_c) {
17638
- switch (_c.label) {
17639
- case 0:
17640
- _c.trys.push([0, 8, 9, 10]);
17641
- if (!(action.plaid_action === 'identity')) return [3 /*break*/, 4];
17642
- return [4 /*yield*/, client.fetchPlaidVerificationStatus(metadata.link_session_id)];
17643
- case 1:
17644
- res_1 = _c.sent();
17645
- statusKey = action.plaid_identity_field_key;
17646
- if (statusKey) {
17647
- newValues = (_a = {}, _a[statusKey] = res_1.status, _a);
17648
- updateFieldValues(newValues);
17649
- client.submitCustom(newValues, { shouldFlush: true });
17650
- }
17651
- if (!(res_1.status !== 'success')) return [3 /*break*/, 3];
17652
- handleError('Identity verification was not successful');
17653
- return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 2000); })];
17654
- case 2:
17655
- _c.sent();
17656
- return [2 /*return*/];
17657
- case 3: return [3 /*break*/, 6];
17658
- case 4:
17659
- if (!publicToken) return [3 /*break*/, 6];
17660
- res_2 = client.submitPlaidUserData(publicToken);
17661
- if (!((_b = action.wait_for_completion) !== null && _b !== void 0 ? _b : true)) return [3 /*break*/, 6];
17662
- return [4 /*yield*/, res_2];
17663
- case 5:
17664
- fieldVals = _c.sent();
17665
- updateFieldValues(fieldVals);
17666
- _c.label = 6;
17667
- case 6: return [4 /*yield*/, onSuccess()];
17668
- case 7:
17669
- _c.sent();
17670
- return [3 /*break*/, 10];
17671
- case 8:
17672
- _c.sent();
17673
- handleError();
17674
- return [3 /*break*/, 10];
17675
- case 9:
17676
- handler.exit();
17677
- handler.destroy();
17678
- return [7 /*endfinally*/];
17679
- case 10: return [2 /*return*/];
17680
- }
17681
- });
17682
- }); }
17683
- });
17684
- handler.open();
17685
- return [2 /*return*/];
17686
- }
17687
- });
17688
- });
17689
- }
17594
+ var isUrl_1;
17595
+ var hasRequiredIsUrl;
17690
17596
 
17691
- var RouterContext = React.createContext({
17692
- location: {
17693
- pathname: ''
17694
- },
17695
- navigate: function () { }
17696
- });
17697
- function RouterProvider(_a) {
17698
- var children = _a.children, _b = _a.initialPath, initialPath = _b === void 0 ? featheryWindow().location.pathname : _b;
17699
- var _c = __read(React.useState({ pathname: initialPath }), 2), location = _c[0], setLocation = _c[1];
17700
- var navigate = React.useCallback(function (to, options) {
17701
- if (options === void 0) { options = {}; }
17702
- var historyMethod = options.replace ? 'replaceState' : 'pushState';
17703
- featheryWindow().history[historyMethod](null, '', to);
17704
- setLocation({ pathname: to });
17705
- }, []);
17706
- // listen to browser back/forward navigation
17707
- React.useEffect(function () {
17708
- var window = featheryWindow();
17709
- var handlePopState = function () {
17710
- setLocation({ pathname: window.location.pathname });
17711
- };
17712
- window.addEventListener('popstate', handlePopState);
17713
- return function () { return window.removeEventListener('popstate', handlePopState); };
17714
- }, []);
17715
- var routerData = React.useMemo(function () { return ({
17716
- location: location,
17717
- navigate: navigate
17718
- }); }, [location, navigate]);
17719
- return (jsx$1(RouterContext.Provider, exports.__assign({ value: routerData }, { children: children })));
17720
- }
17721
- function useLocation() {
17722
- var context = React.useContext(RouterContext);
17723
- if (!context)
17724
- throw new Error('useLocation must be used within RouterProvider');
17725
- return context.location;
17726
- }
17727
- function useNavigate() {
17728
- var context = React.useContext(RouterContext);
17729
- if (!context)
17730
- throw new Error('useNavigate must be used within RouterProvider');
17731
- return context.navigate;
17597
+ function requireIsUrl () {
17598
+ if (hasRequiredIsUrl) return isUrl_1;
17599
+ hasRequiredIsUrl = 1;
17600
+ /**
17601
+ * Expose `isUrl`.
17602
+ */
17603
+
17604
+ isUrl_1 = isUrl;
17605
+
17606
+ /**
17607
+ * RegExps.
17608
+ * A URL must match #1 and then at least one of #2/#3.
17609
+ * Use two levels of REs to avoid REDOS.
17610
+ */
17611
+
17612
+ var protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/;
17613
+
17614
+ var localhostDomainRE = /^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/;
17615
+ var nonLocalhostDomainRE = /^[^\s\.]+\.\S{2,}$/;
17616
+
17617
+ /**
17618
+ * Loosely validate a URL `string`.
17619
+ *
17620
+ * @param {String} string
17621
+ * @return {Boolean}
17622
+ */
17623
+
17624
+ function isUrl(string){
17625
+ if (typeof string !== 'string') {
17626
+ return false;
17627
+ }
17628
+
17629
+ var match = string.match(protocolAndDomainRE);
17630
+ if (!match) {
17631
+ return false;
17632
+ }
17633
+
17634
+ var everythingAfterProtocol = match[1];
17635
+ if (!everythingAfterProtocol) {
17636
+ return false;
17637
+ }
17638
+
17639
+ if (localhostDomainRE.test(everythingAfterProtocol) ||
17640
+ nonLocalhostDomainRE.test(everythingAfterProtocol)) {
17641
+ return true;
17642
+ }
17643
+
17644
+ return false;
17645
+ }
17646
+ return isUrl_1;
17732
17647
  }
17733
17648
 
17734
- var MIN_AXIS_SIZE = 15;
17735
- var FIT = 'fit';
17736
- var FILL = 'fill';
17737
- var isFill = function (v) { return v === FILL; };
17738
- var isFit = function (v) { return v === FIT; };
17739
- var isPx = function (v) {
17740
- return typeof v === 'string' && v.indexOf('px') >= 0 && v.indexOf('calc') < 0;
17741
- };
17742
- var getPxValue = function (size) {
17743
- return isPx(size) ? Number.parseFloat(size) : MIN_AXIS_SIZE;
17744
- };
17745
- var formatDimensionValue = function (value, type) {
17746
- // fit-content is needed to allow elements to push beyond the parent container's explicit height.
17747
- switch (value) {
17748
- case FILL:
17749
- return type === 'width' ? '100%' : 'auto';
17750
- case FIT:
17751
- return 'fit-content';
17752
- default:
17753
- return parseInt(value);
17754
- }
17755
- };
17756
- var calculateDimensionsHelper = function (root, p) {
17757
- if (p === void 0) { p = ''; }
17758
- var width = root["".concat(p, "width")] || root.width;
17759
- var height = root["".concat(p, "height")] || root.height;
17760
- var dimensions = {
17761
- maxWidth: formatDimensionValue(width, 'width'),
17762
- height: formatDimensionValue(height, 'height')
17763
- };
17764
- // to allow responsiveness, min width shouldn't be set for fixed widths
17765
- dimensions.minWidth = isNum(width) ? undefined : dimensions.maxWidth;
17766
- // min and max height must be 100% to prevent fit-content from collapsing, which would break fill's non-collapsing intent
17767
- dimensions.minHeight = isFill(height) ? '100%' : dimensions.height;
17768
- return dimensions;
17769
- };
17649
+ var isUrlExports = requireIsUrl();
17650
+ var isUrl = /*@__PURE__*/getDefaultExportFromCjs(isUrlExports);
17651
+
17652
+ var LETTER_MATCH = /[a-zA-Z]/;
17653
+ var UPPERCASE_LETTER_MATCH = /[A-Z]/;
17654
+ var LOWERCASE_LETTER_MATCH = /[a-z]/;
17655
+ var NUMBER_MATCH = /\d/;
17656
+ // eslint-disable-next-line no-useless-escape
17657
+ var SYMBOL_MATCH = /[#$\.%&'()\+,-/:;<=>!?@\\\[\]\^_`{|}~\*]/;
17658
+ var DOMAIN_ALLOWED_CHARACTERS = /^[a-zA-Z0-9.\\-]+$/;
17770
17659
  /**
17771
- * Calculates the dimensions of the provided step.
17772
- * Note: The provided step should be fully-hydrated (i.e. rows injected, etc.) to calculate dimensions accurately.
17660
+ * Validate elements on a form
17773
17661
  */
17774
- function calculateStepCSS(step) {
17775
- if (!step)
17776
- return {};
17777
- var root = step.subgrids.find(function (grid) { return grid.position.length === 0; });
17778
- var desktop = calculateDimensionsHelper(root);
17779
- var mobile = calculateDimensionsHelper(root, 'mobile_');
17780
- var stepCSS = exports.__assign({ backgroundSize: 'cover', width: '100%' }, desktop);
17781
- // width will be controlled by maxWidth in the case it is fixed below 478px
17782
- stepCSS["@media (max-width: 478px)"] = exports.__assign({ width: '100%' }, mobile);
17783
- return stepCSS;
17784
- }
17785
- function calculateGlobalCSS(globalStyles) {
17786
- var styles = new ResponsiveStyles({ styles: globalStyles }, ['form'], false, DEFAULT_MOBILE_BREAKPOINT);
17787
- if (globalStyles) {
17788
- styles.applyFontStyles('form');
17789
- }
17790
- return styles;
17791
- }
17792
-
17793
- function changeStep(newKey, oldKey, steps, setStepKey, navigate, client, trackHashes) {
17794
- var sameKey = oldKey === newKey;
17795
- if (!sameKey && newKey) {
17796
- if (newKey in steps) {
17797
- client.registerEvent({
17798
- step_key: oldKey,
17799
- next_step_key: newKey,
17800
- event: 'complete'
17801
- });
17802
- if (trackHashes)
17803
- navigate(location.pathname + location.search + "#".concat(newKey), {
17804
- replace: true
17805
- });
17806
- setStepKey(newKey);
17807
- return true;
17662
+ function validateElements(_a) {
17663
+ var step = _a.step, visiblePositions = _a.visiblePositions, triggerErrors = _a.triggerErrors, errorType = _a.errorType, formRef = _a.formRef, _b = _a.errorCallback, errorCallback = _b === void 0 ? function () { } : _b, setInlineErrors = _a.setInlineErrors, trigger = _a.trigger;
17664
+ var invalid = false;
17665
+ var inlineErrors = {};
17666
+ var errors = getVisibleElements(step, visiblePositions, ['servar_fields', 'buttons'], true).reduce(function (errors, _a) {
17667
+ var _b;
17668
+ var element = _a.element, repeat = _a.repeat, last = _a.last, elementType = _a.type;
17669
+ var key, type;
17670
+ if (elementType === 'servar_fields') {
17671
+ if (element.servar.repeat_trigger === 'set_value' && last && repeat) {
17672
+ // Skip validation on last repeat since it might be default value
17673
+ return errors;
17674
+ }
17675
+ type = element.servar.type;
17676
+ key = element.servar.key;
17677
+ }
17678
+ else {
17679
+ // if not a servar, then a button
17680
+ type = 'button';
17681
+ key = element.id;
17808
17682
  }
17683
+ var message = validateElement(element, repeat);
17684
+ // We want to clear button errors when the button is not "relevant" to what the user is doing.
17685
+ // If the element is a button and was NOT the trigger or no trigger,
17686
+ // then we don't show the error.
17687
+ if (type === 'button' && ((trigger && key !== trigger.id) || !trigger))
17688
+ message = '';
17689
+ if (!(key in errors))
17690
+ errors[key] = message;
17691
+ else if (Array.isArray(errors[key]))
17692
+ errors[key].push(message);
17809
17693
  else
17810
- console.warn("".concat(newKey, " is not a valid step to navigate to"));
17811
- }
17812
- return false;
17813
- }
17814
- function getNewStepUrl(stepKey) {
17815
- return location.pathname + location.search + "#".concat(stepKey);
17816
- }
17817
- function getPrevStepKey(curStep, stepMap) {
17818
- var newStepKey = stepMap[curStep.key];
17819
- if (!newStepKey) {
17820
- var prevCondition = curStep.previous_conditions[0];
17821
- if (prevCondition)
17822
- newStepKey = prevCondition.previous_step_key;
17694
+ errors[key] = [errors[key], message];
17695
+ if (message && !invalid)
17696
+ invalid = true;
17697
+ if (type === 'matrix' && message) {
17698
+ // Get question index where error is
17699
+ var fieldValue = exports.fieldValues[key];
17700
+ // handle repeated matrix fields
17701
+ if (repeat != null && Array.isArray(fieldValue))
17702
+ fieldValue = (_b = fieldValue[repeat]) !== null && _b !== void 0 ? _b : {};
17703
+ var questions = element.servar.metadata.questions;
17704
+ var questionIds = questions.map(function (q) { return q.id; });
17705
+ for (var i = 0; i < questionIds.length; i++) {
17706
+ var value = fieldValue[questionIds[i]];
17707
+ if (value === undefined ||
17708
+ (Array.isArray(value) && value.length === 0)) {
17709
+ key = "".concat(key, "-").concat(i);
17710
+ break;
17711
+ }
17712
+ }
17713
+ }
17714
+ if (triggerErrors) {
17715
+ setFormElementError({
17716
+ formRef: formRef,
17717
+ errorCallback: errorCallback,
17718
+ fieldKey: key,
17719
+ message: message,
17720
+ errorType: errorType,
17721
+ servarType: type,
17722
+ inlineErrors: inlineErrors,
17723
+ index: repeat
17724
+ });
17725
+ }
17726
+ return errors;
17727
+ }, {});
17728
+ if (triggerErrors) {
17729
+ setFormElementError({
17730
+ formRef: formRef,
17731
+ errorType: errorType,
17732
+ inlineErrors: inlineErrors,
17733
+ setInlineErrors: setInlineErrors,
17734
+ triggerErrors: true
17735
+ });
17823
17736
  }
17824
- return newStepKey;
17737
+ return { errors: errors, inlineErrors: inlineErrors, invalid: invalid };
17825
17738
  }
17826
- var nextStepKey = function (nextConditions, metadata) {
17827
- var newKey = null;
17828
- nextConditions
17829
- .filter(function (cond) {
17830
- return cond.element_type === metadata.elementType &&
17831
- metadata.elementIDs.includes(cond.element_id) &&
17832
- cond.metadata.start === metadata.start &&
17833
- cond.metadata.end === metadata.end;
17834
- })
17835
- .sort(function (cond1, cond2) {
17836
- return cond1.rules.length < cond2.rules.length ? 1 : -1;
17837
- })
17838
- .forEach(function (cond) {
17839
- if (newKey)
17840
- return;
17841
- var rulesMet = true;
17842
- cond.rules.forEach(function (rule) {
17843
- rulesMet && (rulesMet = evalComparisonRule(rule));
17844
- });
17845
- if (rulesMet)
17846
- newKey = cond.next_step_key;
17847
- });
17848
- return newKey;
17849
- };
17850
- // No origin is possible if there are no steps, e.g. form is disabled
17851
- var NO_ORIGIN_DEFAULT = { key: '' };
17852
- var getOrigin = function (steps) {
17853
- var _a;
17854
- return (_a = Object.values(steps).find(function (step) { return step.origin; })) !== null && _a !== void 0 ? _a : NO_ORIGIN_DEFAULT;
17855
- };
17856
17739
  /**
17857
- *
17858
- * @returns Url hash without the #, or '' if decodeURI fails
17740
+ * Performs all default/standard and custom validations on a field/element
17741
+ * and returns any validation message.
17859
17742
  */
17860
- function getUrlHash() {
17861
- try {
17862
- return decodeURI(location.hash.substr(1));
17863
- }
17864
- catch (e) {
17865
- console.warn(e);
17866
- return '';
17867
- }
17868
- }
17869
- function setUrlStepHash(navigate, steps, stepName) {
17870
- // No hash necessary if form only has one step
17871
- if (Object.keys(steps).length > 1) {
17872
- navigate(location.pathname + location.search + "#".concat(stepName), {
17873
- replace: true
17743
+ function validateElement(element, repeat) {
17744
+ var servar = element.servar, validations = element.validations;
17745
+ // First priority is custom validations for servar fields
17746
+ if (validations) {
17747
+ var firstMatchingValidation = validations.find(function (validation) {
17748
+ return validation.rules.every(function (rule) { return evalComparisonRule(rule, repeat); });
17874
17749
  });
17750
+ if (firstMatchingValidation)
17751
+ return firstMatchingValidation.message;
17875
17752
  }
17876
- }
17877
- function getInitialStep(_a) {
17878
- var initialStepId = _a.initialStepId, steps = _a.steps, sessionCurrentStep = _a.sessionCurrentStep, formId = _a.formId;
17879
- return ((formId && getSavedStepKey(formId)) || // saved step from remounting
17880
- initialStepId ||
17881
- sessionCurrentStep ||
17882
- getOrigin(steps).key);
17883
- }
17884
- // Store current step keys for each form during remount
17885
- var savedStepKeys = {};
17886
- function getSavedStepKey(formId) {
17887
- var savedKey = savedStepKeys[formId];
17888
- if (savedKey) {
17889
- delete savedStepKeys[formId];
17890
- return savedKey;
17753
+ // Now apply any standard validations
17754
+ if (servar) {
17755
+ var fieldVal = exports.fieldValues[servar.key];
17756
+ if (servar.repeated)
17757
+ fieldVal = fieldVal[repeat];
17758
+ var errorMsg = getStandardFieldError(fieldVal, servar, repeat);
17759
+ if (errorMsg)
17760
+ return errorMsg;
17891
17761
  }
17892
- return undefined;
17893
- }
17894
- function setSavedStepKey(formId, stepKey) {
17895
- savedStepKeys[formId] = stepKey;
17762
+ return '';
17896
17763
  }
17897
- function isStepTerminal(step) {
17898
- // If step is navigable to another step, it's not terminal
17899
- if (step.next_conditions.length > 0)
17900
- return false;
17901
- if (step.servar_fields.some(function (field) { return field.servar.required; }) &&
17902
- step.buttons.some(function (b) { return b.properties.submit; })) {
17903
- // Not terminal if there is a required field on the step that can be saved
17904
- return false;
17905
- }
17906
- var onlyExits = ['buttons', 'texts', 'subgrids'].every(function (key) {
17907
- return step[key].every(function (b) {
17908
- var _a;
17909
- return ((_a = b.properties.actions) !== null && _a !== void 0 ? _a : []).every(function (action) { return action.type === ACTION_URL; });
17910
- });
17911
- });
17912
- if (onlyExits && step.servar_fields.length === 0)
17913
- return true;
17914
- var hasNext = step.buttons.some(function (b) {
17915
- var _a;
17916
- return ((_a = b.properties.actions) !== null && _a !== void 0 ? _a : []).some(function (action) {
17917
- return action.type === ACTION_NEXT ||
17918
- (action.type === ACTION_URL && !action.open_tab);
17919
- });
17764
+ //
17765
+ // Standard Validations
17766
+ //
17767
+ var emailPatternStr = "^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]{2,63})+$";
17768
+ var emailPattern = new RegExp(emailPatternStr);
17769
+ exports.phoneLib = null;
17770
+ exports.phoneLibPromise = Promise.resolve();
17771
+ var loadPhoneValidator = function () {
17772
+ exports.phoneLibPromise = Promise.resolve().then(function () { return require(
17773
+ /* webpackChunkName: "libphonenumber" */ './fthry_index.DKgFa6Cd.js'); }).then(function (mod) {
17774
+ exports.phoneLib = mod;
17775
+ return mod;
17920
17776
  });
17921
- return !hasNext;
17922
- }
17923
- function _recurseQueue(depthMap, steps, hasProgressBar, queue, altQueue) {
17924
- var _loop_1 = function () {
17925
- var _a = __read(queue.shift(), 2), step = _a[0], depth = _a[1];
17926
- if (step.key in depthMap)
17927
- return "continue";
17928
- // Optionally filter only for steps with progress bar
17929
- var missingBar = hasProgressBar && step.progress_bars.length === 0;
17930
- depthMap[step.key] = missingBar ? 0 : depth;
17931
- var incr = missingBar ? 0 : 1;
17932
- step.next_conditions.forEach(function (condition) {
17933
- queue.push([steps[condition.next_step_key], depth + incr]);
17934
- });
17935
- // For calculating progress bar depth, deprioritize previous condition
17936
- // depths relative to next conditions
17937
- var previousQueue = hasProgressBar && altQueue ? altQueue : queue;
17938
- step.previous_conditions.forEach(function (condition) {
17939
- previousQueue.push([steps[condition.previous_step_key], depth + incr]);
17940
- });
17941
- };
17942
- while (queue.length > 0) {
17943
- _loop_1();
17944
- }
17945
- }
17946
- var getStepDepthMap = function (steps, hasProgressBar) {
17947
- if (hasProgressBar === void 0) { hasProgressBar = false; }
17948
- var depthMap = {};
17949
- var stepQueue = [[getOrigin(steps), 0]];
17950
- var reverseQueue = [];
17951
- _recurseQueue(depthMap, steps, hasProgressBar, stepQueue, reverseQueue);
17952
- if (hasProgressBar)
17953
- _recurseQueue(depthMap, steps, hasProgressBar, reverseQueue);
17954
- return depthMap;
17955
17777
  };
17956
- var recurseProgressDepth = function (steps, curKey) {
17957
- var depthMap = getStepDepthMap(steps, true);
17958
- return [depthMap[curKey], Math.max.apply(Math, __spreadArray([], __read(Object.values(depthMap)), false))];
17959
- };
17960
-
17778
+ var validators = {
17779
+ email: function (a) {
17780
+ if (!a)
17781
+ return false;
17782
+ var parts = a.split('@');
17783
+ if (parts.length !== 2)
17784
+ return false;
17785
+ // Email handle cannot end with '.'
17786
+ var part = parts[0];
17787
+ if (part.endsWith('.') || part.startsWith('.'))
17788
+ return false;
17789
+ if (part.includes('..'))
17790
+ return false;
17791
+ return emailPattern.test(a);
17792
+ },
17793
+ phone: function (a) {
17794
+ try {
17795
+ return exports.phoneLib.isValidPhoneNumber("+".concat(a));
17796
+ }
17797
+ catch (e) {
17798
+ // Invalid phone number
17799
+ return false;
17800
+ }
17801
+ },
17802
+ url: function (a) {
17803
+ if (!isUrl(a))
17804
+ return false;
17805
+ try {
17806
+ var urlObj = new URL(a);
17807
+ if (!urlObj)
17808
+ return false;
17809
+ var hostname = urlObj.hostname;
17810
+ if (hostname.length >= 64)
17811
+ return false;
17812
+ if (!DOMAIN_ALLOWED_CHARACTERS.test(hostname))
17813
+ return false;
17814
+ var parts = hostname.split('.');
17815
+ if (parts.some(function (part) { return !part; }))
17816
+ return false;
17817
+ // Last part of domain cannot contain digit
17818
+ if (NUMBER_MATCH.test(parts[parts.length - 1]))
17819
+ return false;
17820
+ // Colon at end of hostname gets filtered out by URL object but
17821
+ // should be invalid
17822
+ if (a[urlObj.origin.length] === ':')
17823
+ return false;
17824
+ // Check for filtered out special characters, e.g.
17825
+ // https://@google.com -> https://google.com
17826
+ if (!a.toLowerCase().includes("/".concat(hostname.toLowerCase())))
17827
+ return false;
17828
+ return parts.length > 1;
17829
+ }
17830
+ catch (e) {
17831
+ return false;
17832
+ }
17833
+ }
17834
+ };
17835
+ function isFieldValueEmpty(value, servar) {
17836
+ var _a;
17837
+ if (ARRAY_FIELD_TYPES.includes(servar.type)) {
17838
+ if (!value || value.length === 0)
17839
+ return true;
17840
+ // For file uploads and button groups, check if array contains only null/falsy values
17841
+ if (['file_upload', 'button_group'].includes(servar.type)) {
17842
+ // In repeatable containers, file upload values are stored as individual Files (not arrays)
17843
+ // because changeValue extracts value[0] for each row. Handle both cases:
17844
+ if (!Array.isArray(value)) {
17845
+ return !value; // Single file or null (from repeatable container)
17846
+ }
17847
+ if (value.every(function (val) { return !val; })) {
17848
+ return true;
17849
+ }
17850
+ }
17851
+ // If 'other' is selected for checkbox group, make sure it has a value
17852
+ return servar.type === 'multiselect' && value.some(function (val) { return !val; });
17853
+ }
17854
+ var noVal;
17855
+ switch (servar.type) {
17856
+ case 'matrix':
17857
+ // Each key in value needs to have an array with at least one value
17858
+ noVal = servar.metadata.questions.some(function (_a) {
17859
+ var id = _a.id;
17860
+ return !value[id] || value[id].length === 0;
17861
+ });
17862
+ break;
17863
+ case 'select':
17864
+ case 'signature':
17865
+ noVal = !value;
17866
+ break;
17867
+ case 'checkbox':
17868
+ // eslint-disable-next-line camelcase
17869
+ noVal = !value && ((_a = servar.metadata) === null || _a === void 0 ? void 0 : _a.must_check);
17870
+ break;
17871
+ case 'payment_method':
17872
+ noVal = !(value === null || value === void 0 ? void 0 : value.complete);
17873
+ break;
17874
+ case 'rating':
17875
+ noVal = !value;
17876
+ break;
17877
+ default:
17878
+ if (typeof value === 'string')
17879
+ value = value.trim();
17880
+ noVal = ['', null, undefined].includes(value);
17881
+ break;
17882
+ }
17883
+ return noVal;
17884
+ }
17885
+ /**
17886
+ * Default validations.
17887
+ * Returns the error message for a field value if it's invalid.
17888
+ * Returns an empty string if it's valid.
17889
+ */
17890
+ function getStandardFieldError(value, servar, repeat) {
17891
+ var defaultErrors = initInfo().defaultErrors;
17892
+ if (isFieldValueEmpty(value, servar)) {
17893
+ // If no value, error if field is required
17894
+ return servar.required ? defaultErrors.required : '';
17895
+ }
17896
+ if (servar.min_length && value.length < servar.min_length) {
17897
+ return defaultErrors.minimum.replace('{length}', servar.min_length);
17898
+ }
17899
+ var defaultErr = defaultErrors[servar.type];
17900
+ // Check if value is badly formatted
17901
+ if (servar.type === 'phone_number' && !validators.phone(value)) {
17902
+ return defaultErr;
17903
+ }
17904
+ else if (servar.type === 'email' && !validators.email(value)) {
17905
+ return defaultErr;
17906
+ }
17907
+ else if (servar.type === 'url' && !validators.url(value)) {
17908
+ // Try appending https since user may have just omitted the protocol
17909
+ var newVal = 'https://' + value;
17910
+ if (validators.url(newVal)) {
17911
+ if (servar.repeated) {
17912
+ // @ts-ignore
17913
+ exports.fieldValues[servar === null || servar === void 0 ? void 0 : servar.key][repeat] = newVal;
17914
+ }
17915
+ else
17916
+ exports.fieldValues[servar.key] = newVal;
17917
+ return '';
17918
+ }
17919
+ return defaultErr;
17920
+ }
17921
+ else if (servar.type === 'ssn' &&
17922
+ value.length !== (servar.metadata.last_four_digits ? 4 : 9)) {
17923
+ return defaultErr;
17924
+ }
17925
+ else if (servar.type === 'pin_input' &&
17926
+ value.length !== servar.max_length) {
17927
+ return defaultErr;
17928
+ }
17929
+ else if (servar.type === 'password') {
17930
+ var meta = servar.metadata;
17931
+ var msg = function (key) { return "Your password must have at least 1 ".concat(key); };
17932
+ if (meta.letter_required && !LETTER_MATCH.test(value))
17933
+ return msg('letter');
17934
+ if (meta.uppercase_letter_required && !UPPERCASE_LETTER_MATCH.test(value))
17935
+ return msg('uppercase letter');
17936
+ if (meta.lowercase_letter_required && !LOWERCASE_LETTER_MATCH.test(value))
17937
+ return msg('lowercase letter');
17938
+ if (meta.number_required && !NUMBER_MATCH.test(value))
17939
+ return msg('number');
17940
+ if (meta.symbol_required && !SYMBOL_MATCH.test(value))
17941
+ return msg('symbol');
17942
+ }
17943
+ // No error
17944
+ return '';
17945
+ }
17946
+
17947
+ var plaidPromise = null;
17948
+ function installPlaid(isPlaidActive) {
17949
+ if (plaidPromise)
17950
+ return plaidPromise;
17951
+ else if (!isPlaidActive)
17952
+ return Promise.resolve();
17953
+ else {
17954
+ plaidPromise = dynamicImport('https://cdn.plaid.com/link/v2/stable/link-initialize.js');
17955
+ return plaidPromise;
17956
+ }
17957
+ }
17958
+ function openPlaidLink(client, onSuccess, onExit, updateFieldValues, action, handleError) {
17959
+ return __awaiter$2(this, void 0, void 0, function () {
17960
+ var kwargs, res, handler;
17961
+ var _this = this;
17962
+ return __generator(this, function (_a) {
17963
+ switch (_a.label) {
17964
+ case 0: return [4 /*yield*/, plaidPromise];
17965
+ case 1:
17966
+ _a.sent();
17967
+ if (action.plaid_action === 'identity') {
17968
+ kwargs = {
17969
+ identity_template_id: action.template_id,
17970
+ email_field: action.email_field
17971
+ };
17972
+ }
17973
+ else {
17974
+ kwargs = { liabilities: action.include_liabilities ? 'true' : 'false' };
17975
+ }
17976
+ return [4 /*yield*/, client.fetchPlaidLinkToken(kwargs)];
17977
+ case 2:
17978
+ res = _a.sent();
17979
+ if (res.err) {
17980
+ handleError(res.err);
17981
+ return [2 /*return*/];
17982
+ }
17983
+ handler = global.Plaid.create({
17984
+ token: res.token,
17985
+ onExit: onExit,
17986
+ onSuccess: function (publicToken, metadata) { return __awaiter$2(_this, void 0, void 0, function () {
17987
+ var res_1, statusKey, newValues, res_2, fieldVals;
17988
+ var _a;
17989
+ var _b;
17990
+ return __generator(this, function (_c) {
17991
+ switch (_c.label) {
17992
+ case 0:
17993
+ _c.trys.push([0, 8, 9, 10]);
17994
+ if (!(action.plaid_action === 'identity')) return [3 /*break*/, 4];
17995
+ return [4 /*yield*/, client.fetchPlaidVerificationStatus(metadata.link_session_id)];
17996
+ case 1:
17997
+ res_1 = _c.sent();
17998
+ statusKey = action.plaid_identity_field_key;
17999
+ if (statusKey) {
18000
+ newValues = (_a = {}, _a[statusKey] = res_1.status, _a);
18001
+ updateFieldValues(newValues);
18002
+ client.submitCustom(newValues, { shouldFlush: true });
18003
+ }
18004
+ if (!(res_1.status !== 'success')) return [3 /*break*/, 3];
18005
+ handleError('Identity verification was not successful');
18006
+ return [4 /*yield*/, new Promise(function (resolve) { return setTimeout(resolve, 2000); })];
18007
+ case 2:
18008
+ _c.sent();
18009
+ return [2 /*return*/];
18010
+ case 3: return [3 /*break*/, 6];
18011
+ case 4:
18012
+ if (!publicToken) return [3 /*break*/, 6];
18013
+ res_2 = client.submitPlaidUserData(publicToken);
18014
+ if (!((_b = action.wait_for_completion) !== null && _b !== void 0 ? _b : true)) return [3 /*break*/, 6];
18015
+ return [4 /*yield*/, res_2];
18016
+ case 5:
18017
+ fieldVals = _c.sent();
18018
+ updateFieldValues(fieldVals);
18019
+ _c.label = 6;
18020
+ case 6: return [4 /*yield*/, onSuccess()];
18021
+ case 7:
18022
+ _c.sent();
18023
+ return [3 /*break*/, 10];
18024
+ case 8:
18025
+ _c.sent();
18026
+ handleError();
18027
+ return [3 /*break*/, 10];
18028
+ case 9:
18029
+ handler.exit();
18030
+ handler.destroy();
18031
+ return [7 /*endfinally*/];
18032
+ case 10: return [2 /*return*/];
18033
+ }
18034
+ });
18035
+ }); }
18036
+ });
18037
+ handler.open();
18038
+ return [2 /*return*/];
18039
+ }
18040
+ });
18041
+ });
18042
+ }
18043
+
18044
+ var RouterContext = React.createContext({
18045
+ location: {
18046
+ pathname: ''
18047
+ },
18048
+ navigate: function () { }
18049
+ });
18050
+ function RouterProvider(_a) {
18051
+ var children = _a.children, _b = _a.initialPath, initialPath = _b === void 0 ? featheryWindow().location.pathname : _b;
18052
+ var _c = __read(React.useState({ pathname: initialPath }), 2), location = _c[0], setLocation = _c[1];
18053
+ var navigate = React.useCallback(function (to, options) {
18054
+ if (options === void 0) { options = {}; }
18055
+ var historyMethod = options.replace ? 'replaceState' : 'pushState';
18056
+ featheryWindow().history[historyMethod](null, '', to);
18057
+ setLocation({ pathname: to });
18058
+ }, []);
18059
+ // listen to browser back/forward navigation
18060
+ React.useEffect(function () {
18061
+ var window = featheryWindow();
18062
+ var handlePopState = function () {
18063
+ setLocation({ pathname: window.location.pathname });
18064
+ };
18065
+ window.addEventListener('popstate', handlePopState);
18066
+ return function () { return window.removeEventListener('popstate', handlePopState); };
18067
+ }, []);
18068
+ var routerData = React.useMemo(function () { return ({
18069
+ location: location,
18070
+ navigate: navigate
18071
+ }); }, [location, navigate]);
18072
+ return (jsx$1(RouterContext.Provider, exports.__assign({ value: routerData }, { children: children })));
18073
+ }
18074
+ function useLocation() {
18075
+ var context = React.useContext(RouterContext);
18076
+ if (!context)
18077
+ throw new Error('useLocation must be used within RouterProvider');
18078
+ return context.location;
18079
+ }
18080
+ function useNavigate() {
18081
+ var context = React.useContext(RouterContext);
18082
+ if (!context)
18083
+ throw new Error('useNavigate must be used within RouterProvider');
18084
+ return context.navigate;
18085
+ }
18086
+
18087
+ var MIN_AXIS_SIZE = 15;
18088
+ var FIT = 'fit';
18089
+ var FILL = 'fill';
18090
+ var isFill = function (v) { return v === FILL; };
18091
+ var isFit = function (v) { return v === FIT; };
18092
+ var isPx = function (v) {
18093
+ return typeof v === 'string' && v.indexOf('px') >= 0 && v.indexOf('calc') < 0;
18094
+ };
18095
+ var getPxValue = function (size) {
18096
+ return isPx(size) ? Number.parseFloat(size) : MIN_AXIS_SIZE;
18097
+ };
18098
+ var formatDimensionValue = function (value, type) {
18099
+ // fit-content is needed to allow elements to push beyond the parent container's explicit height.
18100
+ switch (value) {
18101
+ case FILL:
18102
+ return type === 'width' ? '100%' : 'auto';
18103
+ case FIT:
18104
+ return 'fit-content';
18105
+ default:
18106
+ return parseInt(value);
18107
+ }
18108
+ };
18109
+ var calculateDimensionsHelper = function (root, p) {
18110
+ if (p === void 0) { p = ''; }
18111
+ var width = root["".concat(p, "width")] || root.width;
18112
+ var height = root["".concat(p, "height")] || root.height;
18113
+ var dimensions = {
18114
+ maxWidth: formatDimensionValue(width, 'width'),
18115
+ height: formatDimensionValue(height, 'height')
18116
+ };
18117
+ // to allow responsiveness, min width shouldn't be set for fixed widths
18118
+ dimensions.minWidth = isNum(width) ? undefined : dimensions.maxWidth;
18119
+ // min and max height must be 100% to prevent fit-content from collapsing, which would break fill's non-collapsing intent
18120
+ dimensions.minHeight = isFill(height) ? '100%' : dimensions.height;
18121
+ return dimensions;
18122
+ };
18123
+ /**
18124
+ * Calculates the dimensions of the provided step.
18125
+ * Note: The provided step should be fully-hydrated (i.e. rows injected, etc.) to calculate dimensions accurately.
18126
+ */
18127
+ function calculateStepCSS(step) {
18128
+ if (!step)
18129
+ return {};
18130
+ var root = step.subgrids.find(function (grid) { return grid.position.length === 0; });
18131
+ var desktop = calculateDimensionsHelper(root);
18132
+ var mobile = calculateDimensionsHelper(root, 'mobile_');
18133
+ var stepCSS = exports.__assign({ backgroundSize: 'cover', width: '100%' }, desktop);
18134
+ // width will be controlled by maxWidth in the case it is fixed below 478px
18135
+ stepCSS["@media (max-width: 478px)"] = exports.__assign({ width: '100%' }, mobile);
18136
+ return stepCSS;
18137
+ }
18138
+ function calculateGlobalCSS(globalStyles) {
18139
+ var styles = new ResponsiveStyles({ styles: globalStyles }, ['form'], false, DEFAULT_MOBILE_BREAKPOINT);
18140
+ if (globalStyles) {
18141
+ styles.applyFontStyles('form');
18142
+ }
18143
+ return styles;
18144
+ }
18145
+
18146
+ function changeStep(newKey, oldKey, steps, setStepKey, navigate, client, trackHashes) {
18147
+ var sameKey = oldKey === newKey;
18148
+ if (!sameKey && newKey) {
18149
+ if (newKey in steps) {
18150
+ client.registerEvent({
18151
+ step_key: oldKey,
18152
+ next_step_key: newKey,
18153
+ event: 'complete'
18154
+ });
18155
+ if (trackHashes)
18156
+ navigate(location.pathname + location.search + "#".concat(newKey), {
18157
+ replace: true
18158
+ });
18159
+ setStepKey(newKey);
18160
+ return true;
18161
+ }
18162
+ else
18163
+ console.warn("".concat(newKey, " is not a valid step to navigate to"));
18164
+ }
18165
+ return false;
18166
+ }
18167
+ function getNewStepUrl(stepKey) {
18168
+ return location.pathname + location.search + "#".concat(stepKey);
18169
+ }
18170
+ function getPrevStepKey(curStep, stepMap) {
18171
+ var newStepKey = stepMap[curStep.key];
18172
+ if (!newStepKey) {
18173
+ var prevCondition = curStep.previous_conditions[0];
18174
+ if (prevCondition)
18175
+ newStepKey = prevCondition.previous_step_key;
18176
+ }
18177
+ return newStepKey;
18178
+ }
18179
+ var nextStepKey = function (nextConditions, metadata) {
18180
+ var newKey = null;
18181
+ nextConditions
18182
+ .filter(function (cond) {
18183
+ return cond.element_type === metadata.elementType &&
18184
+ metadata.elementIDs.includes(cond.element_id) &&
18185
+ cond.metadata.start === metadata.start &&
18186
+ cond.metadata.end === metadata.end;
18187
+ })
18188
+ .sort(function (cond1, cond2) {
18189
+ return cond1.rules.length < cond2.rules.length ? 1 : -1;
18190
+ })
18191
+ .forEach(function (cond) {
18192
+ if (newKey)
18193
+ return;
18194
+ var rulesMet = true;
18195
+ cond.rules.forEach(function (rule) {
18196
+ rulesMet && (rulesMet = evalComparisonRule(rule));
18197
+ });
18198
+ if (rulesMet)
18199
+ newKey = cond.next_step_key;
18200
+ });
18201
+ return newKey;
18202
+ };
18203
+ // No origin is possible if there are no steps, e.g. form is disabled
18204
+ var NO_ORIGIN_DEFAULT = { key: '' };
18205
+ var getOrigin = function (steps) {
18206
+ var _a;
18207
+ return (_a = Object.values(steps).find(function (step) { return step.origin; })) !== null && _a !== void 0 ? _a : NO_ORIGIN_DEFAULT;
18208
+ };
18209
+ /**
18210
+ *
18211
+ * @returns Url hash without the #, or '' if decodeURI fails
18212
+ */
18213
+ function getUrlHash() {
18214
+ try {
18215
+ return decodeURI(location.hash.substr(1));
18216
+ }
18217
+ catch (e) {
18218
+ console.warn(e);
18219
+ return '';
18220
+ }
18221
+ }
18222
+ function setUrlStepHash(navigate, steps, stepName) {
18223
+ // No hash necessary if form only has one step
18224
+ if (Object.keys(steps).length > 1) {
18225
+ navigate(location.pathname + location.search + "#".concat(stepName), {
18226
+ replace: true
18227
+ });
18228
+ }
18229
+ }
18230
+ function getInitialStep(_a) {
18231
+ var initialStepId = _a.initialStepId, steps = _a.steps, sessionCurrentStep = _a.sessionCurrentStep, formId = _a.formId;
18232
+ return ((formId && getSavedStepKey(formId)) || // saved step from remounting
18233
+ initialStepId ||
18234
+ sessionCurrentStep ||
18235
+ getOrigin(steps).key);
18236
+ }
18237
+ // Store current step keys for each form during remount
18238
+ var savedStepKeys = {};
18239
+ function getSavedStepKey(formId) {
18240
+ var savedKey = savedStepKeys[formId];
18241
+ if (savedKey) {
18242
+ delete savedStepKeys[formId];
18243
+ return savedKey;
18244
+ }
18245
+ return undefined;
18246
+ }
18247
+ function setSavedStepKey(formId, stepKey) {
18248
+ savedStepKeys[formId] = stepKey;
18249
+ }
18250
+ function isStepTerminal(step) {
18251
+ // If step is navigable to another step, it's not terminal
18252
+ if (step.next_conditions.length > 0)
18253
+ return false;
18254
+ if (step.servar_fields.some(function (field) { return field.servar.required; }) &&
18255
+ step.buttons.some(function (b) { return b.properties.submit; })) {
18256
+ // Not terminal if there is a required field on the step that can be saved
18257
+ return false;
18258
+ }
18259
+ var onlyExits = ['buttons', 'texts', 'subgrids'].every(function (key) {
18260
+ return step[key].every(function (b) {
18261
+ var _a;
18262
+ return ((_a = b.properties.actions) !== null && _a !== void 0 ? _a : []).every(function (action) { return action.type === ACTION_URL; });
18263
+ });
18264
+ });
18265
+ if (onlyExits && step.servar_fields.length === 0)
18266
+ return true;
18267
+ var hasNext = step.buttons.some(function (b) {
18268
+ var _a;
18269
+ return ((_a = b.properties.actions) !== null && _a !== void 0 ? _a : []).some(function (action) {
18270
+ return action.type === ACTION_NEXT ||
18271
+ (action.type === ACTION_URL && !action.open_tab);
18272
+ });
18273
+ });
18274
+ return !hasNext;
18275
+ }
18276
+ function _recurseQueue(depthMap, steps, hasProgressBar, queue, altQueue) {
18277
+ var _loop_1 = function () {
18278
+ var _a = __read(queue.shift(), 2), step = _a[0], depth = _a[1];
18279
+ if (step.key in depthMap)
18280
+ return "continue";
18281
+ // Optionally filter only for steps with progress bar
18282
+ var missingBar = hasProgressBar && step.progress_bars.length === 0;
18283
+ depthMap[step.key] = missingBar ? 0 : depth;
18284
+ var incr = missingBar ? 0 : 1;
18285
+ step.next_conditions.forEach(function (condition) {
18286
+ queue.push([steps[condition.next_step_key], depth + incr]);
18287
+ });
18288
+ // For calculating progress bar depth, deprioritize previous condition
18289
+ // depths relative to next conditions
18290
+ var previousQueue = hasProgressBar && altQueue ? altQueue : queue;
18291
+ step.previous_conditions.forEach(function (condition) {
18292
+ previousQueue.push([steps[condition.previous_step_key], depth + incr]);
18293
+ });
18294
+ };
18295
+ while (queue.length > 0) {
18296
+ _loop_1();
18297
+ }
18298
+ }
18299
+ var getStepDepthMap = function (steps, hasProgressBar) {
18300
+ if (hasProgressBar === void 0) { hasProgressBar = false; }
18301
+ var depthMap = {};
18302
+ var stepQueue = [[getOrigin(steps), 0]];
18303
+ var reverseQueue = [];
18304
+ _recurseQueue(depthMap, steps, hasProgressBar, stepQueue, reverseQueue);
18305
+ if (hasProgressBar)
18306
+ _recurseQueue(depthMap, steps, hasProgressBar, reverseQueue);
18307
+ return depthMap;
18308
+ };
18309
+ var recurseProgressDepth = function (steps, curKey) {
18310
+ var depthMap = getStepDepthMap(steps, true);
18311
+ return [depthMap[curKey], Math.max.apply(Math, __spreadArray([], __read(Object.values(depthMap)), false))];
18312
+ };
18313
+
17961
18314
  var pure$1 = {};
17962
18315
 
17963
18316
  var hasRequiredPure$1;
@@ -28625,12 +28978,21 @@ function hasAuthGatedSteps(integrations) {
28625
28978
  function getRedirectUrl() {
28626
28979
  var _a = featheryWindow().location, origin = _a.origin, pathname = _a.pathname, hash = _a.hash, search = _a.search;
28627
28980
  var queryParams = new URLSearchParams(search);
28981
+ // If no _slug param, extract slug from /to/<slug> path
28982
+ if (!queryParams.has('_slug')) {
28983
+ var toMatch = pathname.match(/\/to\/([^/]+)/);
28984
+ if (toMatch) {
28985
+ queryParams.set('_slug', toMatch[1]);
28986
+ }
28987
+ }
28628
28988
  queryParams.forEach(function (value, key) {
28629
28989
  if (!['_slug'].includes(key))
28630
28990
  queryParams.delete(key);
28631
28991
  });
28992
+ // Strip the /to/<slug> segment
28993
+ var cleanPathname = pathname.replace(/\/to\/[^/]+/, '');
28632
28994
  var queryString = queryParams.has('_slug') ? "?".concat(queryParams) : '';
28633
- return "".concat(origin).concat(pathname).concat(queryString).concat(hash);
28995
+ return "".concat(origin).concat(cleanPathname).concat(queryString).concat(hash);
28634
28996
  }
28635
28997
 
28636
28998
  var stytchPromise = null;
@@ -39096,7 +39458,7 @@ function useTrackUserInteraction(formRef, activeStep, stepKey, formName) {
39096
39458
  }, [activeStep, stepKey, formName]);
39097
39459
  }
39098
39460
 
39099
- var AssistantChat = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "AssistantChat" */ './fthry_index.qt3C-Qt1.js'); }); });
39461
+ var AssistantChat = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "AssistantChat" */ './fthry_index.lGGMSnRj.js'); }); });
39100
39462
  var getSubmissionErrorMessage = function (error) {
39101
39463
  if (error instanceof TypeError && error.message === 'Failed to fetch') {
39102
39464
  return 'Unable to upload files. Please check your connection and try again.';
@@ -43694,944 +44056,595 @@ function requireGa4 () {
43694
44056
  Object.keys(rest).filter(function (key) {
43695
44057
  return key.substr(0, "dimension".length) === "dimension";
43696
44058
  }).forEach(function (key) {
43697
- fieldObject[key] = rest[key];
43698
- });
43699
- Object.keys(rest).filter(function (key) {
43700
- return key.substr(0, "metric".length) === "metric";
43701
- }).forEach(function (key) {
43702
- fieldObject[key] = rest[key];
43703
- });
43704
-
43705
- _this._gaCommand("send", fieldObject);
43706
- }
43707
- });
43708
-
43709
- _defineProperty(this, "send", function (fieldObject) {
43710
- _this._gaCommand("send", fieldObject);
43711
- });
43712
-
43713
- _defineProperty(this, "pageview", function (path, _, title) {
43714
- var pathTrim = path === null || path === void 0 ? void 0 : path.trim();
43715
-
43716
- if (pathTrim === "") {
43717
- console.warn("path cannot be an empty string in .pageview()");
43718
- return;
43719
- }
43720
-
43721
- _this._gaCommand("send", "pageview", pathTrim, {
43722
- title: title
43723
- });
43724
- });
43725
-
43726
- this.reset();
43727
- }
43728
-
43729
- _createClass(GA4, [{
43730
- key: "gtag",
43731
- value: function gtag() {
43732
- this._gtag.apply(this, arguments);
43733
- }
43734
- }, {
43735
- key: "_appendCustomMap",
43736
- value: function _appendCustomMap(options) {
43737
- var legacyDimensionMetric = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
43738
-
43739
- if (!legacyDimensionMetric) {
43740
- return options;
43741
- }
43742
-
43743
- if (!options.custom_map) {
43744
- options.custom_map = {};
43745
- }
43746
-
43747
- for (var i = 1; i <= 200; i++) {
43748
- if (!options.custom_map["dimension".concat(i)]) {
43749
- options.custom_map["dimension".concat(i)] = "dimension".concat(i);
43750
- }
43751
-
43752
- if (!options.custom_map["metric".concat(i)]) {
43753
- options.custom_map["metric".concat(i)] = "metric".concat(i);
43754
- }
43755
- }
43756
-
43757
- return options;
43758
- }
43759
- /**
43760
- * @since v1.0.2
43761
- * @param {string} [path="location.href"]
43762
- * @param {string[]} [_] unsupported
43763
- * @param {string} [title="location.pathname"]
43764
- * @deprecated Use `.send("pageview")` instead
43765
- */
43766
-
43767
- }, {
43768
- key: "outboundLink",
43769
- value:
43770
- /**
43771
- * @since v1.0.6
43772
- * @param {Object} options
43773
- * @param {string} options.label
43774
- * @param {function} hitCallback
43775
- * @deprecated Use `enhanced measurement` feature in Google Analytics.
43776
- */
43777
- function outboundLink(_ref3, hitCallback) {
43778
- var label = _ref3.label;
43779
-
43780
- if (typeof hitCallback !== "function") {
43781
- console.warn("hitCallback function is required");
43782
- return;
43783
- }
43784
-
43785
- if (!label) {
43786
- console.warn("args.label is required in outboundLink()");
43787
- return;
43788
- } // Required Fields
43789
-
43790
-
43791
- var fieldObject = {
43792
- hitType: "event",
43793
- eventCategory: "Outbound",
43794
- eventAction: "Click",
43795
- eventLabel: (0, _format["default"])(label)
43796
- };
43797
- var safetyCallbackCalled = false;
43798
-
43799
- var safetyCallback = function safetyCallback() {
43800
- // This prevents a delayed response from GA
43801
- // causing hitCallback from being fired twice
43802
- safetyCallbackCalled = true;
43803
- hitCallback();
43804
- }; // Using a timeout to ensure the execution of critical application code
43805
- // in the case when the GA server might be down
43806
- // or an ad blocker prevents sending the data
43807
- // register safety net timeout:
43808
-
43809
-
43810
- var t = setTimeout(safetyCallback, 250);
43811
-
43812
- var clearableCallbackForGA = function clearableCallbackForGA() {
43813
- clearTimeout(t);
43814
-
43815
- if (!safetyCallbackCalled) {
43816
- hitCallback();
43817
- }
43818
- };
43819
-
43820
- fieldObject.hitCallback = clearableCallbackForGA;
43821
-
43822
- this._gaCommand("send", fieldObject);
43823
- }
43824
- }]);
43825
-
43826
- return GA4;
43827
- }();
43828
-
43829
- exports$1.GA4 = GA4;
43830
-
43831
- var _default = new GA4();
43832
-
43833
- exports$1["default"] = _default;
43834
- } (ga4));
43835
- return ga4;
43836
- }
43837
-
43838
- var hasRequiredDist;
43839
-
43840
- function requireDist () {
43841
- if (hasRequiredDist) return dist;
43842
- hasRequiredDist = 1;
43843
- (function (exports$1) {
43844
-
43845
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
43846
-
43847
- Object.defineProperty(exports$1, "__esModule", {
43848
- value: true
43849
- });
43850
- exports$1["default"] = exports$1.ReactGAImplementation = void 0;
43851
-
43852
- var _ga = _interopRequireWildcard(requireGa4());
44059
+ fieldObject[key] = rest[key];
44060
+ });
44061
+ Object.keys(rest).filter(function (key) {
44062
+ return key.substr(0, "metric".length) === "metric";
44063
+ }).forEach(function (key) {
44064
+ fieldObject[key] = rest[key];
44065
+ });
43853
44066
 
43854
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
44067
+ _this._gaCommand("send", fieldObject);
44068
+ }
44069
+ });
43855
44070
 
43856
- function _interopRequireWildcard(obj, nodeInterop) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
44071
+ _defineProperty(this, "send", function (fieldObject) {
44072
+ _this._gaCommand("send", fieldObject);
44073
+ });
43857
44074
 
43858
- var ReactGAImplementation = _ga.GA4;
43859
- exports$1.ReactGAImplementation = ReactGAImplementation;
43860
- var _default = _ga["default"];
43861
- exports$1["default"] = _default;
43862
- } (dist));
43863
- return dist;
43864
- }
44075
+ _defineProperty(this, "pageview", function (path, _, title) {
44076
+ var pathTrim = path === null || path === void 0 ? void 0 : path.trim();
43865
44077
 
43866
- var distExports = requireDist();
43867
- var ReactGA = /*@__PURE__*/getDefaultExportFromCjs(distExports);
44078
+ if (pathTrim === "") {
44079
+ console.warn("path cannot be an empty string in .pageview()");
44080
+ return;
44081
+ }
43868
44082
 
43869
- var gaInstalled = false;
43870
- function installGoogleAnalytics(gaConfig) {
43871
- if (gaConfig && !gaInstalled) {
43872
- gaInstalled = true;
43873
- ReactGA.initialize(gaConfig.metadata.api_key);
43874
- }
43875
- return Promise.resolve();
43876
- }
43877
- function trackGAEvent(category, action, label) {
43878
- ReactGA.event({ category: category, action: action, label: label });
43879
- }
44083
+ _this._gaCommand("send", "pageview", pathTrim, {
44084
+ title: title
44085
+ });
44086
+ });
43880
44087
 
43881
- var heapInstalled = false;
43882
- function installHeap(heapConfig) {
43883
- if (heapConfig && !heapInstalled) {
43884
- heapInstalled = true;
43885
- featheryWindow().heap = featheryWindow().heap || [];
43886
- featheryWindow().heap.load = function (e) {
43887
- featheryWindow().heap.appid = e;
43888
- featheryWindow().heap.config = {};
43889
- var r = featheryDoc().createElement('script');
43890
- r.type = 'text/javascript';
43891
- r.async = true;
43892
- r.src = 'https://cdn.heapanalytics.com/js/heap-' + e + '.js';
43893
- var a = featheryDoc().getElementsByTagName('script')[0];
43894
- a.parentNode.insertBefore(r, a);
43895
- for (var n = function (e) {
43896
- return function () {
43897
- featheryWindow().heap.push(
43898
- // eslint-disable-next-line prefer-rest-params
43899
- [e].concat(Array.prototype.slice.call(arguments, 0)));
43900
- };
43901
- }, p = [
43902
- 'addEventProperties',
43903
- 'addUserProperties',
43904
- 'clearEventProperties',
43905
- 'identify',
43906
- 'resetIdentity',
43907
- 'removeEventProperty',
43908
- 'setEventProperties',
43909
- 'track',
43910
- 'unsetEventProperty'
43911
- ], o = 0; o < p.length; o++)
43912
- featheryWindow().heap[p[o]] = n(p[o]);
43913
- };
43914
- featheryWindow().heap.load(heapConfig.metadata.api_key);
43915
- }
43916
- return Promise.resolve();
43917
- }
44088
+ this.reset();
44089
+ }
43918
44090
 
43919
- var intercomInstalled = false;
43920
- function installIntercom(intercomConfig) {
43921
- if (intercomConfig && !intercomInstalled) {
43922
- intercomInstalled = true;
43923
- var workspaceId_1 = intercomConfig.api_key;
43924
- featheryWindow().intercomSettings = {
43925
- api_base: 'https://api-iam.intercom.io',
43926
- app_id: workspaceId_1
43927
- };
43928
- var w = featheryWindow();
43929
- var ic = w.Intercom;
43930
- if (typeof ic === 'function') {
43931
- ic('reattach_activator');
43932
- ic('update', w.intercomSettings);
43933
- }
43934
- else {
43935
- var d_1 = featheryDoc();
43936
- var i_1 = function () {
43937
- // eslint-disable-next-line prefer-rest-params
43938
- i_1.c(arguments);
43939
- };
43940
- i_1.q = [];
43941
- i_1.c = function (args) {
43942
- i_1.q.push(args);
43943
- };
43944
- w.Intercom = i_1;
43945
- var l = function () {
43946
- var s = d_1.createElement('script');
43947
- s.type = 'text/javascript';
43948
- s.async = true;
43949
- s.src = "https://widget.intercom.io/widget/".concat(workspaceId_1);
43950
- var x = d_1.getElementsByTagName('script')[0];
43951
- x.parentNode.insertBefore(s, x);
43952
- };
43953
- if (featheryDoc().readyState === 'complete') {
43954
- l();
43955
- }
43956
- else if (w.attachEvent) {
43957
- w.attachEvent('onload', l);
43958
- }
43959
- else {
43960
- w.addEventListener('load', l, false);
43961
- }
43962
- }
43963
- }
43964
- return Promise.resolve();
43965
- }
44091
+ _createClass(GA4, [{
44092
+ key: "gtag",
44093
+ value: function gtag() {
44094
+ this._gtag.apply(this, arguments);
44095
+ }
44096
+ }, {
44097
+ key: "_appendCustomMap",
44098
+ value: function _appendCustomMap(options) {
44099
+ var legacyDimensionMetric = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;
43966
44100
 
43967
- var amplitudeInstalled = false;
43968
- function installAmplitude(amplitudeConfig) {
43969
- return __awaiter$2(this, void 0, void 0, function () {
43970
- var meta, apiKey, cdn, sessionReplayTracking, options;
43971
- return __generator(this, function (_a) {
43972
- switch (_a.label) {
43973
- case 0:
43974
- if (!amplitudeConfig || amplitudeInstalled)
43975
- return [2 /*return*/];
43976
- amplitudeInstalled = true;
43977
- meta = amplitudeConfig.metadata;
43978
- apiKey = meta.api_key;
43979
- cdn = 'cdn';
43980
- if (meta.eu_server)
43981
- cdn = 'cdn.eu';
43982
- return [4 /*yield*/, dynamicImport("https://".concat(cdn, ".amplitude.com/script/").concat(apiKey, ".js"))];
43983
- case 1:
43984
- _a.sent();
43985
- if (!featheryWindow().amplitude) {
43986
- console.warn('Failed to load Amplitude.');
43987
- return [2 /*return*/];
43988
- }
43989
- if (meta.session_replay && featheryWindow().sessionReplay) {
43990
- sessionReplayTracking = featheryWindow().sessionReplay.plugin();
43991
- featheryWindow().amplitude.add(sessionReplayTracking);
43992
- }
43993
- options = {
43994
- fetchRemoteConfig: true,
43995
- autocapture: true
43996
- };
43997
- if (meta.eu_server)
43998
- options.serverZone = 'EU';
43999
- featheryWindow().amplitude.init(apiKey, options);
44000
- if (meta.identify_user)
44001
- featheryWindow().amplitude.setUserId(initInfo().userId);
44002
- return [2 /*return*/];
44003
- }
44004
- });
44005
- });
44006
- }
44101
+ if (!legacyDimensionMetric) {
44102
+ return options;
44103
+ }
44007
44104
 
44008
- var mixpanelInstalled = false;
44009
- function installMixpanel(mixpanelConfig) {
44010
- if (mixpanelConfig && !mixpanelInstalled && !featheryWindow().mixpanel) {
44011
- mixpanelInstalled = true;
44012
- (function (f, b) {
44013
- if (!b.__SV) {
44014
- var i_1, h_1;
44015
- featheryWindow().mixpanel = b;
44016
- b._i = [];
44017
- b.init = function (e, f, c) {
44018
- function g(a, d) {
44019
- var b = d.split('.');
44020
- // eslint-disable-next-line eqeqeq,no-unused-expressions
44021
- b.length == 2 && ((a = a[b[0]]), (d = b[1]));
44022
- a[d] = function () {
44023
- // eslint-disable-next-line prefer-rest-params
44024
- a.push([d].concat(Array.prototype.slice.call(arguments, 0)));
44025
- };
44026
- }
44027
- var a = b;
44028
- typeof c !== 'undefined' ? (a = b[c] = []) : (c = 'mixpanel');
44029
- a.people = a.people || [];
44030
- a.toString = function (a) {
44031
- var d = 'mixpanel';
44032
- c !== 'mixpanel' && (d += '.' + c);
44033
- a || (d += ' (stub)');
44034
- return d;
44035
- };
44036
- a.people.toString = function () {
44037
- return a.toString(1) + '.people (stub)';
44038
- };
44039
- i_1 =
44040
- 'disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove'.split(' ');
44041
- for (h_1 = 0; h_1 < i_1.length; h_1++)
44042
- g(a, i_1[h_1]);
44043
- var j = 'set set_once union unset remove delete'.split(' ');
44044
- a.get_group = function () {
44045
- function b(c) {
44046
- d[c] = function () {
44047
- var call2 = [c].concat(
44048
- // eslint-disable-next-line prefer-rest-params
44049
- Array.prototype.slice.call(arguments, 0));
44050
- a.push([e, call2]);
44051
- };
44052
- }
44053
- var d;
44054
- for (d = {},
44055
- e = ['get_group'].concat(
44056
- // eslint-disable-next-line prefer-rest-params
44057
- Array.prototype.slice.call(arguments, 0)),
44058
- c = 0; c < j.length; c++)
44059
- b(j[c]);
44060
- return d;
44061
- };
44062
- b._i.push([e, f, c]);
44063
- };
44064
- b.__SV = 1.2;
44065
- var e = f.createElement('script');
44066
- e.type = 'text/javascript';
44067
- e.async = true;
44068
- e.src =
44069
- f.location.protocol === 'file:' &&
44070
- '//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'.match(/^\/\//)
44071
- ? 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'
44072
- : '//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js';
44073
- var g = f.getElementsByTagName('script')[0];
44074
- g.parentNode.insertBefore(e, g);
44075
- }
44076
- })(featheryDoc(), featheryWindow().mixpanel || []);
44077
- featheryWindow().mixpanel.init(mixpanelConfig.metadata.api_key);
44078
- }
44079
- return Promise.resolve();
44080
- }
44105
+ if (!options.custom_map) {
44106
+ options.custom_map = {};
44107
+ }
44081
44108
 
44082
- var rudderStackInstalled = false;
44083
- function installRudderStack(rudderStackConfig) {
44084
- return __awaiter$2(this, void 0, void 0, function () {
44085
- var rudderanalytics_1, methods, i, method;
44086
- return __generator(this, function (_a) {
44087
- if (rudderStackConfig && !rudderStackInstalled) {
44088
- rudderStackInstalled = true;
44089
- dynamicImport('https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js');
44090
- rudderanalytics_1 = (featheryWindow().rudderanalytics = []);
44091
- methods = [
44092
- 'load',
44093
- 'page',
44094
- 'track',
44095
- 'identify',
44096
- 'alias',
44097
- 'group',
44098
- 'ready',
44099
- 'reset',
44100
- 'getAnonymousId',
44101
- 'setAnonymousId',
44102
- 'getUserId',
44103
- 'getUserTraits',
44104
- 'getGroupId',
44105
- 'getGroupTraits',
44106
- 'startSession',
44107
- 'endSession',
44108
- 'getSessionId'
44109
- ];
44110
- for (i = 0; i < methods.length; i++) {
44111
- method = methods[i];
44112
- rudderanalytics_1[method] = (function (methodName) {
44113
- return function () {
44114
- rudderanalytics_1.push(
44115
- // eslint-disable-next-line prefer-rest-params
44116
- [methodName].concat(Array.prototype.slice.call(arguments)));
44117
- };
44118
- })(method);
44119
- }
44120
- rudderanalytics_1.load(rudderStackConfig.metadata.write_key, rudderStackConfig.metadata.data_plane_url);
44121
- rudderanalytics_1.identify(initInfo().userId);
44122
- }
44123
- return [2 /*return*/, Promise.resolve()];
44124
- });
44125
- });
44126
- }
44127
- function trackRudderEvent(title, properties, integ) {
44128
- var trackEvents = integ === null || integ === void 0 ? void 0 : integ.metadata.track_events;
44129
- if (!trackEvents || trackEvents.includes(title))
44130
- featheryWindow().rudderanalytics.track(title, properties);
44131
- }
44109
+ for (var i = 1; i <= 200; i++) {
44110
+ if (!options.custom_map["dimension".concat(i)]) {
44111
+ options.custom_map["dimension".concat(i)] = "dimension".concat(i);
44112
+ }
44132
44113
 
44133
- var configMap = {};
44134
- function installTrustedForm(trustedformConfig, formKey) {
44135
- return __awaiter$2(this, void 0, void 0, function () {
44136
- var tf, protocol, certField, pingField, rand, s;
44137
- return __generator(this, function (_a) {
44138
- if (!trustedformConfig)
44139
- return [2 /*return*/];
44140
- configMap[formKey] = trustedformConfig;
44141
- tf = featheryDoc().createElement('script');
44142
- tf.type = 'text/javascript';
44143
- tf.async = true;
44144
- protocol = featheryDoc().location.protocol === 'https:' ? 'https' : 'http';
44145
- certField = trustedformConfig.metadata.certificate_field_key;
44146
- pingField = trustedformConfig.metadata.ping_field_key;
44147
- rand = new Date().getTime() + Math.random();
44148
- tf.src = "".concat(protocol, "://api.trustedform.com/trustedform.js?field=").concat(certField, "&ping_field=").concat(pingField, "&l=").concat(rand);
44149
- s = featheryDoc().getElementsByTagName('script')[0];
44150
- s.parentNode.insertBefore(tf, s);
44151
- return [2 /*return*/];
44152
- });
44153
- });
44154
- }
44155
- function gatherTrustedFormFields(existingFields, formKey) {
44156
- var config = configMap[formKey];
44157
- if (!config)
44158
- return;
44159
- ['certificate_field_key', 'ping_field_key'].forEach(function (attr) {
44160
- var fieldKey = config.metadata[attr];
44161
- if (!(fieldKey in exports.fieldValues)) {
44162
- // Not stored yet
44163
- var el = featheryDoc().getElementsByName(fieldKey)[0];
44164
- if (el) {
44165
- var fieldVal = el.value;
44166
- exports.fieldValues[fieldKey] = fieldVal;
44167
- existingFields[fieldKey] = fieldVal;
44168
- }
44169
- }
44170
- });
44171
- }
44114
+ if (!options.custom_map["metric".concat(i)]) {
44115
+ options.custom_map["metric".concat(i)] = "metric".concat(i);
44116
+ }
44117
+ }
44172
44118
 
44173
- var IMPORTED_URLS = new Set();
44174
- function dynamicImport(dependencies, parallel, force) {
44175
- if (parallel === void 0) { parallel = true; }
44176
- if (force === void 0) { force = false; }
44177
- if (typeof dependencies === 'string')
44178
- dependencies = [dependencies];
44179
- var newDependencies = [];
44180
- dependencies.forEach(function (d) {
44181
- var dup = IMPORTED_URLS.has(d);
44182
- if (dup && force) {
44183
- var base = d;
44184
- var counter = 1;
44185
- while (dup) {
44186
- d = "".concat(base, "?version=").concat(counter);
44187
- dup = IMPORTED_URLS.has(d);
44188
- counter++;
44189
- }
44190
- }
44191
- if (!dup) {
44192
- IMPORTED_URLS.add(d);
44193
- newDependencies.push(d);
44194
- }
44195
- });
44196
- if (newDependencies.length === 0)
44197
- return Promise.resolve();
44198
- if (parallel) {
44199
- return new Promise(function (resolve) {
44200
- global.scriptjsLoadPromise.then(function ($script) {
44201
- $script.default(newDependencies, function (lib) {
44202
- resolve(lib);
44203
- });
44204
- });
44205
- });
44206
- }
44207
- else {
44208
- return new Promise(function (resolve) {
44209
- global.scriptjsLoadPromise.then(function ($script) {
44210
- $script.default.order(newDependencies, resolve);
44211
- });
44212
- });
44213
- }
44214
- }
44215
- function initializeIntegrations(integs, featheryClient) {
44216
- return __awaiter$2(this, void 0, void 0, function () {
44217
- var gtm;
44218
- return __generator(this, function (_a) {
44219
- switch (_a.label) {
44220
- case 0: return [4 /*yield*/, Promise.all([
44221
- installArgyle(!!integs.argyle),
44222
- installPlaid(!!integs.plaid),
44223
- installFirebase(integs.firebase),
44224
- installStytch(integs.stytch),
44225
- installStripe(integs.stripe),
44226
- installSegment(integs.segment),
44227
- installGoogleAnalytics(integs['google-analytics']),
44228
- installHeap(integs.heap),
44229
- installAmplitude(integs.amplitude),
44230
- installMixpanel(integs.mixpanel),
44231
- installIntercom(integs['intercom-embedded']),
44232
- installRudderStack(integs.rudderstack),
44233
- installPersona(integs.persona),
44234
- installAlloy(integs.alloy),
44235
- installTrustedForm(integs.trustedform, featheryClient.formKey)
44236
- ])];
44237
- case 1:
44238
- _a.sent();
44239
- gtm = integs['google-tag-manager'];
44240
- if (gtm)
44241
- initializeTagManager(gtm);
44242
- if (integs.firebase || integs.stytch) {
44243
- authState.authFormKey = featheryClient.formKey;
44244
- return [2 /*return*/, Auth.inferLoginOnLoad(featheryClient)];
44245
- }
44246
- return [2 /*return*/];
44247
- }
44248
- });
44249
- });
44250
- }
44251
- function trackEvent(integrations, title, stepId, formName, fieldData) {
44252
- var metadata = { formName: formName };
44253
- if (stepId)
44254
- metadata.stepId = stepId;
44255
- // Google Tag Manager
44256
- // @ts-expect-error TS(2551): Property 'initialized' does not exist on type '{ d... Remove this comment to see the full error message
44257
- if (TagManager.initialized) {
44258
- var gtmData = exports.__assign({}, metadata);
44259
- if (fieldData === null || fieldData === void 0 ? void 0 : fieldData['google-tag-manager'])
44260
- gtmData = exports.__assign(exports.__assign({}, gtmData), fieldData['google-tag-manager']);
44261
- TagManager.dataLayer({ dataLayer: exports.__assign(exports.__assign({}, gtmData), { event: title }) });
44262
- }
44263
- // RudderStack
44264
- if (rudderStackInstalled) {
44265
- var rudderData = exports.__assign({}, metadata);
44266
- if (title === 'FeatheryFormComplete')
44267
- rudderData.fieldData = exports.fieldValues;
44268
- trackRudderEvent(title, rudderData, integrations === null || integrations === void 0 ? void 0 : integrations.rudderstack);
44269
- }
44270
- // Google Analytics
44271
- if (gaInstalled)
44272
- trackGAEvent(formName, title, stepId);
44273
- // Segment
44274
- var segmentData = exports.__assign({}, metadata);
44275
- if (fieldData === null || fieldData === void 0 ? void 0 : fieldData.segment)
44276
- segmentData.submittedData = fieldData.segment;
44277
- if (featheryWindow().analytics)
44278
- featheryWindow().analytics.track(title, segmentData);
44279
- var amplitudeData = exports.__assign({}, metadata);
44280
- if (fieldData === null || fieldData === void 0 ? void 0 : fieldData.amplitude)
44281
- amplitudeData.submittedData = fieldData.amplitude;
44282
- if (featheryWindow().amplitude)
44283
- featheryWindow().amplitude.track(title, amplitudeData);
44284
- if (featheryWindow().mixpanel)
44285
- featheryWindow().mixpanel.track(title, metadata);
44286
- }
44119
+ return options;
44120
+ }
44121
+ /**
44122
+ * @since v1.0.2
44123
+ * @param {string} [path="location.href"]
44124
+ * @param {string[]} [_] unsupported
44125
+ * @param {string} [title="location.pathname"]
44126
+ * @deprecated Use `.send("pageview")` instead
44127
+ */
44128
+
44129
+ }, {
44130
+ key: "outboundLink",
44131
+ value:
44132
+ /**
44133
+ * @since v1.0.6
44134
+ * @param {Object} options
44135
+ * @param {string} options.label
44136
+ * @param {function} hitCallback
44137
+ * @deprecated Use `enhanced measurement` feature in Google Analytics.
44138
+ */
44139
+ function outboundLink(_ref3, hitCallback) {
44140
+ var label = _ref3.label;
44141
+
44142
+ if (typeof hitCallback !== "function") {
44143
+ console.warn("hitCallback function is required");
44144
+ return;
44145
+ }
44146
+
44147
+ if (!label) {
44148
+ console.warn("args.label is required in outboundLink()");
44149
+ return;
44150
+ } // Required Fields
44151
+
44152
+
44153
+ var fieldObject = {
44154
+ hitType: "event",
44155
+ eventCategory: "Outbound",
44156
+ eventAction: "Click",
44157
+ eventLabel: (0, _format["default"])(label)
44158
+ };
44159
+ var safetyCallbackCalled = false;
44160
+
44161
+ var safetyCallback = function safetyCallback() {
44162
+ // This prevents a delayed response from GA
44163
+ // causing hitCallback from being fired twice
44164
+ safetyCallbackCalled = true;
44165
+ hitCallback();
44166
+ }; // Using a timeout to ensure the execution of critical application code
44167
+ // in the case when the GA server might be down
44168
+ // or an ad blocker prevents sending the data
44169
+ // register safety net timeout:
44287
44170
 
44288
- var isUrl_1;
44289
- var hasRequiredIsUrl;
44290
44171
 
44291
- function requireIsUrl () {
44292
- if (hasRequiredIsUrl) return isUrl_1;
44293
- hasRequiredIsUrl = 1;
44294
- /**
44295
- * Expose `isUrl`.
44296
- */
44172
+ var t = setTimeout(safetyCallback, 250);
44297
44173
 
44298
- isUrl_1 = isUrl;
44174
+ var clearableCallbackForGA = function clearableCallbackForGA() {
44175
+ clearTimeout(t);
44299
44176
 
44300
- /**
44301
- * RegExps.
44302
- * A URL must match #1 and then at least one of #2/#3.
44303
- * Use two levels of REs to avoid REDOS.
44304
- */
44177
+ if (!safetyCallbackCalled) {
44178
+ hitCallback();
44179
+ }
44180
+ };
44305
44181
 
44306
- var protocolAndDomainRE = /^(?:\w+:)?\/\/(\S+)$/;
44182
+ fieldObject.hitCallback = clearableCallbackForGA;
44307
44183
 
44308
- var localhostDomainRE = /^localhost[\:?\d]*(?:[^\:?\d]\S*)?$/;
44309
- var nonLocalhostDomainRE = /^[^\s\.]+\.\S{2,}$/;
44184
+ this._gaCommand("send", fieldObject);
44185
+ }
44186
+ }]);
44310
44187
 
44311
- /**
44312
- * Loosely validate a URL `string`.
44313
- *
44314
- * @param {String} string
44315
- * @return {Boolean}
44316
- */
44188
+ return GA4;
44189
+ }();
44317
44190
 
44318
- function isUrl(string){
44319
- if (typeof string !== 'string') {
44320
- return false;
44321
- }
44191
+ exports$1.GA4 = GA4;
44322
44192
 
44323
- var match = string.match(protocolAndDomainRE);
44324
- if (!match) {
44325
- return false;
44326
- }
44193
+ var _default = new GA4();
44327
44194
 
44328
- var everythingAfterProtocol = match[1];
44329
- if (!everythingAfterProtocol) {
44330
- return false;
44331
- }
44195
+ exports$1["default"] = _default;
44196
+ } (ga4));
44197
+ return ga4;
44198
+ }
44332
44199
 
44333
- if (localhostDomainRE.test(everythingAfterProtocol) ||
44334
- nonLocalhostDomainRE.test(everythingAfterProtocol)) {
44335
- return true;
44336
- }
44200
+ var hasRequiredDist;
44337
44201
 
44338
- return false;
44339
- }
44340
- return isUrl_1;
44202
+ function requireDist () {
44203
+ if (hasRequiredDist) return dist;
44204
+ hasRequiredDist = 1;
44205
+ (function (exports$1) {
44206
+
44207
+ function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
44208
+
44209
+ Object.defineProperty(exports$1, "__esModule", {
44210
+ value: true
44211
+ });
44212
+ exports$1["default"] = exports$1.ReactGAImplementation = void 0;
44213
+
44214
+ var _ga = _interopRequireWildcard(requireGa4());
44215
+
44216
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
44217
+
44218
+ function _interopRequireWildcard(obj, nodeInterop) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
44219
+
44220
+ var ReactGAImplementation = _ga.GA4;
44221
+ exports$1.ReactGAImplementation = ReactGAImplementation;
44222
+ var _default = _ga["default"];
44223
+ exports$1["default"] = _default;
44224
+ } (dist));
44225
+ return dist;
44341
44226
  }
44342
44227
 
44343
- var isUrlExports = requireIsUrl();
44344
- var isUrl = /*@__PURE__*/getDefaultExportFromCjs(isUrlExports);
44228
+ var distExports = requireDist();
44229
+ var ReactGA = /*@__PURE__*/getDefaultExportFromCjs(distExports);
44345
44230
 
44346
- var LETTER_MATCH = /[a-zA-Z]/;
44347
- var UPPERCASE_LETTER_MATCH = /[A-Z]/;
44348
- var LOWERCASE_LETTER_MATCH = /[a-z]/;
44349
- var NUMBER_MATCH = /\d/;
44350
- // eslint-disable-next-line no-useless-escape
44351
- var SYMBOL_MATCH = /[#$\.%&'()\+,-/:;<=>!?@\\\[\]\^_`{|}~\*]/;
44352
- var DOMAIN_ALLOWED_CHARACTERS = /^[a-zA-Z0-9.\\-]+$/;
44353
- /**
44354
- * Validate elements on a form
44355
- */
44356
- function validateElements(_a) {
44357
- var step = _a.step, visiblePositions = _a.visiblePositions, triggerErrors = _a.triggerErrors, errorType = _a.errorType, formRef = _a.formRef, _b = _a.errorCallback, errorCallback = _b === void 0 ? function () { } : _b, setInlineErrors = _a.setInlineErrors, trigger = _a.trigger;
44358
- var invalid = false;
44359
- var inlineErrors = {};
44360
- var errors = getVisibleElements(step, visiblePositions, ['servar_fields', 'buttons'], true).reduce(function (errors, _a) {
44361
- var _b;
44362
- var element = _a.element, repeat = _a.repeat, last = _a.last, elementType = _a.type;
44363
- var key, type;
44364
- if (elementType === 'servar_fields') {
44365
- if (element.servar.repeat_trigger === 'set_value' && last && repeat) {
44366
- // Skip validation on last repeat since it might be default value
44367
- return errors;
44368
- }
44369
- type = element.servar.type;
44370
- key = element.servar.key;
44231
+ var gaInstalled = false;
44232
+ function installGoogleAnalytics(gaConfig) {
44233
+ if (gaConfig && !gaInstalled) {
44234
+ gaInstalled = true;
44235
+ ReactGA.initialize(gaConfig.metadata.api_key);
44236
+ }
44237
+ return Promise.resolve();
44238
+ }
44239
+ function trackGAEvent(category, action, label) {
44240
+ ReactGA.event({ category: category, action: action, label: label });
44241
+ }
44242
+
44243
+ var heapInstalled = false;
44244
+ function installHeap(heapConfig) {
44245
+ if (heapConfig && !heapInstalled) {
44246
+ heapInstalled = true;
44247
+ featheryWindow().heap = featheryWindow().heap || [];
44248
+ featheryWindow().heap.load = function (e) {
44249
+ featheryWindow().heap.appid = e;
44250
+ featheryWindow().heap.config = {};
44251
+ var r = featheryDoc().createElement('script');
44252
+ r.type = 'text/javascript';
44253
+ r.async = true;
44254
+ r.src = 'https://cdn.heapanalytics.com/js/heap-' + e + '.js';
44255
+ var a = featheryDoc().getElementsByTagName('script')[0];
44256
+ a.parentNode.insertBefore(r, a);
44257
+ for (var n = function (e) {
44258
+ return function () {
44259
+ featheryWindow().heap.push(
44260
+ // eslint-disable-next-line prefer-rest-params
44261
+ [e].concat(Array.prototype.slice.call(arguments, 0)));
44262
+ };
44263
+ }, p = [
44264
+ 'addEventProperties',
44265
+ 'addUserProperties',
44266
+ 'clearEventProperties',
44267
+ 'identify',
44268
+ 'resetIdentity',
44269
+ 'removeEventProperty',
44270
+ 'setEventProperties',
44271
+ 'track',
44272
+ 'unsetEventProperty'
44273
+ ], o = 0; o < p.length; o++)
44274
+ featheryWindow().heap[p[o]] = n(p[o]);
44275
+ };
44276
+ featheryWindow().heap.load(heapConfig.metadata.api_key);
44277
+ }
44278
+ return Promise.resolve();
44279
+ }
44280
+
44281
+ var intercomInstalled = false;
44282
+ function installIntercom(intercomConfig) {
44283
+ if (intercomConfig && !intercomInstalled) {
44284
+ intercomInstalled = true;
44285
+ var workspaceId_1 = intercomConfig.api_key;
44286
+ featheryWindow().intercomSettings = {
44287
+ api_base: 'https://api-iam.intercom.io',
44288
+ app_id: workspaceId_1
44289
+ };
44290
+ var w = featheryWindow();
44291
+ var ic = w.Intercom;
44292
+ if (typeof ic === 'function') {
44293
+ ic('reattach_activator');
44294
+ ic('update', w.intercomSettings);
44371
44295
  }
44372
44296
  else {
44373
- // if not a servar, then a button
44374
- type = 'button';
44375
- key = element.id;
44376
- }
44377
- var message = validateElement(element, repeat);
44378
- // We want to clear button errors when the button is not "relevant" to what the user is doing.
44379
- // If the element is a button and was NOT the trigger or no trigger,
44380
- // then we don't show the error.
44381
- if (type === 'button' && ((trigger && key !== trigger.id) || !trigger))
44382
- message = '';
44383
- if (!(key in errors))
44384
- errors[key] = message;
44385
- else if (Array.isArray(errors[key]))
44386
- errors[key].push(message);
44387
- else
44388
- errors[key] = [errors[key], message];
44389
- if (message && !invalid)
44390
- invalid = true;
44391
- if (type === 'matrix' && message) {
44392
- // Get question index where error is
44393
- var fieldValue = exports.fieldValues[key];
44394
- // handle repeated matrix fields
44395
- if (repeat != null && Array.isArray(fieldValue))
44396
- fieldValue = (_b = fieldValue[repeat]) !== null && _b !== void 0 ? _b : {};
44397
- var questions = element.servar.metadata.questions;
44398
- var questionIds = questions.map(function (q) { return q.id; });
44399
- for (var i = 0; i < questionIds.length; i++) {
44400
- var value = fieldValue[questionIds[i]];
44401
- if (value === undefined ||
44402
- (Array.isArray(value) && value.length === 0)) {
44403
- key = "".concat(key, "-").concat(i);
44404
- break;
44405
- }
44297
+ var d_1 = featheryDoc();
44298
+ var i_1 = function () {
44299
+ // eslint-disable-next-line prefer-rest-params
44300
+ i_1.c(arguments);
44301
+ };
44302
+ i_1.q = [];
44303
+ i_1.c = function (args) {
44304
+ i_1.q.push(args);
44305
+ };
44306
+ w.Intercom = i_1;
44307
+ var l = function () {
44308
+ var s = d_1.createElement('script');
44309
+ s.type = 'text/javascript';
44310
+ s.async = true;
44311
+ s.src = "https://widget.intercom.io/widget/".concat(workspaceId_1);
44312
+ var x = d_1.getElementsByTagName('script')[0];
44313
+ x.parentNode.insertBefore(s, x);
44314
+ };
44315
+ if (featheryDoc().readyState === 'complete') {
44316
+ l();
44317
+ }
44318
+ else if (w.attachEvent) {
44319
+ w.attachEvent('onload', l);
44320
+ }
44321
+ else {
44322
+ w.addEventListener('load', l, false);
44406
44323
  }
44407
44324
  }
44408
- if (triggerErrors) {
44409
- setFormElementError({
44410
- formRef: formRef,
44411
- errorCallback: errorCallback,
44412
- fieldKey: key,
44413
- message: message,
44414
- errorType: errorType,
44415
- servarType: type,
44416
- inlineErrors: inlineErrors,
44417
- index: repeat
44418
- });
44419
- }
44420
- return errors;
44421
- }, {});
44422
- if (triggerErrors) {
44423
- setFormElementError({
44424
- formRef: formRef,
44425
- errorType: errorType,
44426
- inlineErrors: inlineErrors,
44427
- setInlineErrors: setInlineErrors,
44428
- triggerErrors: true
44429
- });
44430
44325
  }
44431
- return { errors: errors, inlineErrors: inlineErrors, invalid: invalid };
44432
- }
44433
- /**
44434
- * Performs all default/standard and custom validations on a field/element
44435
- * and returns any validation message.
44436
- */
44437
- function validateElement(element, repeat) {
44438
- var servar = element.servar, validations = element.validations;
44439
- // First priority is custom validations for servar fields
44440
- if (validations) {
44441
- var firstMatchingValidation = validations.find(function (validation) {
44442
- return validation.rules.every(function (rule) { return evalComparisonRule(rule, repeat); });
44326
+ return Promise.resolve();
44327
+ }
44328
+
44329
+ var amplitudeInstalled = false;
44330
+ function installAmplitude(amplitudeConfig) {
44331
+ return __awaiter$2(this, void 0, void 0, function () {
44332
+ var meta, apiKey, cdn, sessionReplayTracking, options;
44333
+ return __generator(this, function (_a) {
44334
+ switch (_a.label) {
44335
+ case 0:
44336
+ if (!amplitudeConfig || amplitudeInstalled)
44337
+ return [2 /*return*/];
44338
+ amplitudeInstalled = true;
44339
+ meta = amplitudeConfig.metadata;
44340
+ apiKey = meta.api_key;
44341
+ cdn = 'cdn';
44342
+ if (meta.eu_server)
44343
+ cdn = 'cdn.eu';
44344
+ return [4 /*yield*/, dynamicImport("https://".concat(cdn, ".amplitude.com/script/").concat(apiKey, ".js"))];
44345
+ case 1:
44346
+ _a.sent();
44347
+ if (!featheryWindow().amplitude) {
44348
+ console.warn('Failed to load Amplitude.');
44349
+ return [2 /*return*/];
44350
+ }
44351
+ if (meta.session_replay && featheryWindow().sessionReplay) {
44352
+ sessionReplayTracking = featheryWindow().sessionReplay.plugin();
44353
+ featheryWindow().amplitude.add(sessionReplayTracking);
44354
+ }
44355
+ options = {
44356
+ fetchRemoteConfig: true,
44357
+ autocapture: true
44358
+ };
44359
+ if (meta.eu_server)
44360
+ options.serverZone = 'EU';
44361
+ featheryWindow().amplitude.init(apiKey, options);
44362
+ if (meta.identify_user)
44363
+ featheryWindow().amplitude.setUserId(initInfo().userId);
44364
+ return [2 /*return*/];
44365
+ }
44443
44366
  });
44444
- if (firstMatchingValidation)
44445
- return firstMatchingValidation.message;
44446
- }
44447
- // Now apply any standard validations
44448
- if (servar) {
44449
- var fieldVal = exports.fieldValues[servar.key];
44450
- if (servar.repeated)
44451
- fieldVal = fieldVal[repeat];
44452
- var errorMsg = getStandardFieldError(fieldVal, servar, repeat);
44453
- if (errorMsg)
44454
- return errorMsg;
44455
- }
44456
- return '';
44457
- }
44458
- //
44459
- // Standard Validations
44460
- //
44461
- var emailPatternStr = "^[a-zA-Z0-9.!#$%&'*+\\/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:\\.[a-zA-Z0-9-]{2,63})+$";
44462
- var emailPattern = new RegExp(emailPatternStr);
44463
- var LIB_PHONE_NUMBER_URL = 'https://cdn.jsdelivr.net/npm/libphonenumber-js@1.11.16/bundle/libphonenumber-js.min.js';
44464
- exports.phoneLibPromise = Promise.resolve();
44465
- var loadPhoneValidator = function () {
44466
- return (exports.phoneLibPromise = dynamicImport(LIB_PHONE_NUMBER_URL));
44467
- };
44468
- var validators = {
44469
- email: function (a) {
44470
- if (!a)
44471
- return false;
44472
- var parts = a.split('@');
44473
- if (parts.length !== 2)
44474
- return false;
44475
- // Email handle cannot end with '.'
44476
- var part = parts[0];
44477
- if (part.endsWith('.') || part.startsWith('.'))
44478
- return false;
44479
- if (part.includes('..'))
44480
- return false;
44481
- return emailPattern.test(a);
44482
- },
44483
- phone: function (a) {
44484
- try {
44485
- return global.libphonenumber.isValidPhoneNumber("+".concat(a));
44486
- }
44487
- catch (e) {
44488
- // Invalid phone number
44489
- return false;
44490
- }
44491
- },
44492
- url: function (a) {
44493
- if (!isUrl(a))
44494
- return false;
44495
- try {
44496
- var urlObj = new URL(a);
44497
- if (!urlObj)
44498
- return false;
44499
- var hostname = urlObj.hostname;
44500
- if (hostname.length >= 64)
44501
- return false;
44502
- if (!DOMAIN_ALLOWED_CHARACTERS.test(hostname))
44503
- return false;
44504
- var parts = hostname.split('.');
44505
- if (parts.some(function (part) { return !part; }))
44506
- return false;
44507
- // Last part of domain cannot contain digit
44508
- if (NUMBER_MATCH.test(parts[parts.length - 1]))
44509
- return false;
44510
- // Colon at end of hostname gets filtered out by URL object but
44511
- // should be invalid
44512
- if (a[urlObj.origin.length] === ':')
44513
- return false;
44514
- // Check for filtered out special characters, e.g.
44515
- // https://@google.com -> https://google.com
44516
- if (!a.toLowerCase().includes("/".concat(hostname.toLowerCase())))
44517
- return false;
44518
- return parts.length > 1;
44519
- }
44520
- catch (e) {
44521
- return false;
44522
- }
44367
+ });
44368
+ }
44369
+
44370
+ var mixpanelInstalled = false;
44371
+ function installMixpanel(mixpanelConfig) {
44372
+ if (mixpanelConfig && !mixpanelInstalled && !featheryWindow().mixpanel) {
44373
+ mixpanelInstalled = true;
44374
+ (function (f, b) {
44375
+ if (!b.__SV) {
44376
+ var i_1, h_1;
44377
+ featheryWindow().mixpanel = b;
44378
+ b._i = [];
44379
+ b.init = function (e, f, c) {
44380
+ function g(a, d) {
44381
+ var b = d.split('.');
44382
+ // eslint-disable-next-line eqeqeq,no-unused-expressions
44383
+ b.length == 2 && ((a = a[b[0]]), (d = b[1]));
44384
+ a[d] = function () {
44385
+ // eslint-disable-next-line prefer-rest-params
44386
+ a.push([d].concat(Array.prototype.slice.call(arguments, 0)));
44387
+ };
44388
+ }
44389
+ var a = b;
44390
+ typeof c !== 'undefined' ? (a = b[c] = []) : (c = 'mixpanel');
44391
+ a.people = a.people || [];
44392
+ a.toString = function (a) {
44393
+ var d = 'mixpanel';
44394
+ c !== 'mixpanel' && (d += '.' + c);
44395
+ a || (d += ' (stub)');
44396
+ return d;
44397
+ };
44398
+ a.people.toString = function () {
44399
+ return a.toString(1) + '.people (stub)';
44400
+ };
44401
+ i_1 =
44402
+ 'disable time_event track track_pageview track_links track_forms track_with_groups add_group set_group remove_group register register_once alias unregister identify name_tag set_config reset opt_in_tracking opt_out_tracking has_opted_in_tracking has_opted_out_tracking clear_opt_in_out_tracking start_batch_senders people.set people.set_once people.unset people.increment people.append people.union people.track_charge people.clear_charges people.delete_user people.remove'.split(' ');
44403
+ for (h_1 = 0; h_1 < i_1.length; h_1++)
44404
+ g(a, i_1[h_1]);
44405
+ var j = 'set set_once union unset remove delete'.split(' ');
44406
+ a.get_group = function () {
44407
+ function b(c) {
44408
+ d[c] = function () {
44409
+ var call2 = [c].concat(
44410
+ // eslint-disable-next-line prefer-rest-params
44411
+ Array.prototype.slice.call(arguments, 0));
44412
+ a.push([e, call2]);
44413
+ };
44414
+ }
44415
+ var d;
44416
+ for (d = {},
44417
+ e = ['get_group'].concat(
44418
+ // eslint-disable-next-line prefer-rest-params
44419
+ Array.prototype.slice.call(arguments, 0)),
44420
+ c = 0; c < j.length; c++)
44421
+ b(j[c]);
44422
+ return d;
44423
+ };
44424
+ b._i.push([e, f, c]);
44425
+ };
44426
+ b.__SV = 1.2;
44427
+ var e = f.createElement('script');
44428
+ e.type = 'text/javascript';
44429
+ e.async = true;
44430
+ e.src =
44431
+ f.location.protocol === 'file:' &&
44432
+ '//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'.match(/^\/\//)
44433
+ ? 'https://cdn.mxpnl.com/libs/mixpanel-2-latest.min.js'
44434
+ : '//cdn.mxpnl.com/libs/mixpanel-2-latest.min.js';
44435
+ var g = f.getElementsByTagName('script')[0];
44436
+ g.parentNode.insertBefore(e, g);
44437
+ }
44438
+ })(featheryDoc(), featheryWindow().mixpanel || []);
44439
+ featheryWindow().mixpanel.init(mixpanelConfig.metadata.api_key);
44523
44440
  }
44524
- };
44525
- function isFieldValueEmpty(value, servar) {
44526
- var _a;
44527
- if (ARRAY_FIELD_TYPES.includes(servar.type)) {
44528
- if (!value || value.length === 0)
44529
- return true;
44530
- // For file uploads and button groups, check if array contains only null/falsy values
44531
- if (['file_upload', 'button_group'].includes(servar.type)) {
44532
- // In repeatable containers, file upload values are stored as individual Files (not arrays)
44533
- // because changeValue extracts value[0] for each row. Handle both cases:
44534
- if (!Array.isArray(value)) {
44535
- return !value; // Single file or null (from repeatable container)
44441
+ return Promise.resolve();
44442
+ }
44443
+
44444
+ var rudderStackInstalled = false;
44445
+ function installRudderStack(rudderStackConfig) {
44446
+ return __awaiter$2(this, void 0, void 0, function () {
44447
+ var rudderanalytics_1, methods, i, method;
44448
+ return __generator(this, function (_a) {
44449
+ if (rudderStackConfig && !rudderStackInstalled) {
44450
+ rudderStackInstalled = true;
44451
+ dynamicImport('https://cdn.rudderlabs.com/v1.1/rudder-analytics.min.js');
44452
+ rudderanalytics_1 = (featheryWindow().rudderanalytics = []);
44453
+ methods = [
44454
+ 'load',
44455
+ 'page',
44456
+ 'track',
44457
+ 'identify',
44458
+ 'alias',
44459
+ 'group',
44460
+ 'ready',
44461
+ 'reset',
44462
+ 'getAnonymousId',
44463
+ 'setAnonymousId',
44464
+ 'getUserId',
44465
+ 'getUserTraits',
44466
+ 'getGroupId',
44467
+ 'getGroupTraits',
44468
+ 'startSession',
44469
+ 'endSession',
44470
+ 'getSessionId'
44471
+ ];
44472
+ for (i = 0; i < methods.length; i++) {
44473
+ method = methods[i];
44474
+ rudderanalytics_1[method] = (function (methodName) {
44475
+ return function () {
44476
+ rudderanalytics_1.push(
44477
+ // eslint-disable-next-line prefer-rest-params
44478
+ [methodName].concat(Array.prototype.slice.call(arguments)));
44479
+ };
44480
+ })(method);
44481
+ }
44482
+ rudderanalytics_1.load(rudderStackConfig.metadata.write_key, rudderStackConfig.metadata.data_plane_url);
44483
+ rudderanalytics_1.identify(initInfo().userId);
44536
44484
  }
44537
- if (value.every(function (val) { return !val; })) {
44538
- return true;
44485
+ return [2 /*return*/, Promise.resolve()];
44486
+ });
44487
+ });
44488
+ }
44489
+ function trackRudderEvent(title, properties, integ) {
44490
+ var trackEvents = integ === null || integ === void 0 ? void 0 : integ.metadata.track_events;
44491
+ if (!trackEvents || trackEvents.includes(title))
44492
+ featheryWindow().rudderanalytics.track(title, properties);
44493
+ }
44494
+
44495
+ var configMap = {};
44496
+ function installTrustedForm(trustedformConfig, formKey) {
44497
+ return __awaiter$2(this, void 0, void 0, function () {
44498
+ var tf, protocol, certField, pingField, rand, s;
44499
+ return __generator(this, function (_a) {
44500
+ if (!trustedformConfig)
44501
+ return [2 /*return*/];
44502
+ configMap[formKey] = trustedformConfig;
44503
+ tf = featheryDoc().createElement('script');
44504
+ tf.type = 'text/javascript';
44505
+ tf.async = true;
44506
+ protocol = featheryDoc().location.protocol === 'https:' ? 'https' : 'http';
44507
+ certField = trustedformConfig.metadata.certificate_field_key;
44508
+ pingField = trustedformConfig.metadata.ping_field_key;
44509
+ rand = new Date().getTime() + Math.random();
44510
+ tf.src = "".concat(protocol, "://api.trustedform.com/trustedform.js?field=").concat(certField, "&ping_field=").concat(pingField, "&l=").concat(rand);
44511
+ s = featheryDoc().getElementsByTagName('script')[0];
44512
+ s.parentNode.insertBefore(tf, s);
44513
+ return [2 /*return*/];
44514
+ });
44515
+ });
44516
+ }
44517
+ function gatherTrustedFormFields(existingFields, formKey) {
44518
+ var config = configMap[formKey];
44519
+ if (!config)
44520
+ return;
44521
+ ['certificate_field_key', 'ping_field_key'].forEach(function (attr) {
44522
+ var fieldKey = config.metadata[attr];
44523
+ if (!(fieldKey in exports.fieldValues)) {
44524
+ // Not stored yet
44525
+ var el = featheryDoc().getElementsByName(fieldKey)[0];
44526
+ if (el) {
44527
+ var fieldVal = el.value;
44528
+ exports.fieldValues[fieldKey] = fieldVal;
44529
+ existingFields[fieldKey] = fieldVal;
44539
44530
  }
44540
44531
  }
44541
- // If 'other' is selected for checkbox group, make sure it has a value
44542
- return servar.type === 'multiselect' && value.some(function (val) { return !val; });
44532
+ });
44533
+ }
44534
+
44535
+ var IMPORTED_URLS = new Set();
44536
+ function dynamicImport(dependencies, parallel, force) {
44537
+ if (parallel === void 0) { parallel = true; }
44538
+ if (force === void 0) { force = false; }
44539
+ if (typeof dependencies === 'string')
44540
+ dependencies = [dependencies];
44541
+ var newDependencies = [];
44542
+ dependencies.forEach(function (d) {
44543
+ var dup = IMPORTED_URLS.has(d);
44544
+ if (dup && force) {
44545
+ var base = d;
44546
+ var counter = 1;
44547
+ while (dup) {
44548
+ d = "".concat(base, "?version=").concat(counter);
44549
+ dup = IMPORTED_URLS.has(d);
44550
+ counter++;
44551
+ }
44552
+ }
44553
+ if (!dup) {
44554
+ IMPORTED_URLS.add(d);
44555
+ newDependencies.push(d);
44556
+ }
44557
+ });
44558
+ if (newDependencies.length === 0)
44559
+ return Promise.resolve();
44560
+ if (parallel) {
44561
+ return new Promise(function (resolve) {
44562
+ global.scriptjsLoadPromise.then(function ($script) {
44563
+ $script.default(newDependencies, function (lib) {
44564
+ resolve(lib);
44565
+ });
44566
+ });
44567
+ });
44543
44568
  }
44544
- var noVal;
44545
- switch (servar.type) {
44546
- case 'matrix':
44547
- // Each key in value needs to have an array with at least one value
44548
- noVal = servar.metadata.questions.some(function (_a) {
44549
- var id = _a.id;
44550
- return !value[id] || value[id].length === 0;
44569
+ else {
44570
+ return new Promise(function (resolve) {
44571
+ global.scriptjsLoadPromise.then(function ($script) {
44572
+ $script.default.order(newDependencies, resolve);
44551
44573
  });
44552
- break;
44553
- case 'select':
44554
- case 'signature':
44555
- noVal = !value;
44556
- break;
44557
- case 'checkbox':
44558
- // eslint-disable-next-line camelcase
44559
- noVal = !value && ((_a = servar.metadata) === null || _a === void 0 ? void 0 : _a.must_check);
44560
- break;
44561
- case 'payment_method':
44562
- noVal = !(value === null || value === void 0 ? void 0 : value.complete);
44563
- break;
44564
- case 'rating':
44565
- noVal = !value;
44566
- break;
44567
- default:
44568
- if (typeof value === 'string')
44569
- value = value.trim();
44570
- noVal = ['', null, undefined].includes(value);
44571
- break;
44574
+ });
44572
44575
  }
44573
- return noVal;
44574
44576
  }
44575
- /**
44576
- * Default validations.
44577
- * Returns the error message for a field value if it's invalid.
44578
- * Returns an empty string if it's valid.
44579
- */
44580
- function getStandardFieldError(value, servar, repeat) {
44581
- var defaultErrors = initInfo().defaultErrors;
44582
- if (isFieldValueEmpty(value, servar)) {
44583
- // If no value, error if field is required
44584
- return servar.required ? defaultErrors.required : '';
44585
- }
44586
- if (servar.min_length && value.length < servar.min_length) {
44587
- return defaultErrors.minimum.replace('{length}', servar.min_length);
44588
- }
44589
- var defaultErr = defaultErrors[servar.type];
44590
- // Check if value is badly formatted
44591
- if (servar.type === 'phone_number' && !validators.phone(value)) {
44592
- return defaultErr;
44593
- }
44594
- else if (servar.type === 'email' && !validators.email(value)) {
44595
- return defaultErr;
44596
- }
44597
- else if (servar.type === 'url' && !validators.url(value)) {
44598
- // Try appending https since user may have just omitted the protocol
44599
- var newVal = 'https://' + value;
44600
- if (validators.url(newVal)) {
44601
- if (servar.repeated) {
44602
- // @ts-ignore
44603
- exports.fieldValues[servar === null || servar === void 0 ? void 0 : servar.key][repeat] = newVal;
44577
+ function initializeIntegrations(integs, featheryClient) {
44578
+ return __awaiter$2(this, void 0, void 0, function () {
44579
+ var gtm;
44580
+ return __generator(this, function (_a) {
44581
+ switch (_a.label) {
44582
+ case 0: return [4 /*yield*/, Promise.all([
44583
+ installArgyle(!!integs.argyle),
44584
+ installPlaid(!!integs.plaid),
44585
+ installFirebase(integs.firebase),
44586
+ installStytch(integs.stytch),
44587
+ installStripe(integs.stripe),
44588
+ installSegment(integs.segment),
44589
+ installGoogleAnalytics(integs['google-analytics']),
44590
+ installHeap(integs.heap),
44591
+ installAmplitude(integs.amplitude),
44592
+ installMixpanel(integs.mixpanel),
44593
+ installIntercom(integs['intercom-embedded']),
44594
+ installRudderStack(integs.rudderstack),
44595
+ installPersona(integs.persona),
44596
+ installAlloy(integs.alloy),
44597
+ installTrustedForm(integs.trustedform, featheryClient.formKey)
44598
+ ])];
44599
+ case 1:
44600
+ _a.sent();
44601
+ gtm = integs['google-tag-manager'];
44602
+ if (gtm)
44603
+ initializeTagManager(gtm);
44604
+ if (integs.firebase || integs.stytch) {
44605
+ authState.authFormKey = featheryClient.formKey;
44606
+ return [2 /*return*/, Auth.inferLoginOnLoad(featheryClient)];
44607
+ }
44608
+ return [2 /*return*/];
44604
44609
  }
44605
- else
44606
- exports.fieldValues[servar.key] = newVal;
44607
- return '';
44608
- }
44609
- return defaultErr;
44610
- }
44611
- else if (servar.type === 'ssn' &&
44612
- value.length !== (servar.metadata.last_four_digits ? 4 : 9)) {
44613
- return defaultErr;
44614
- }
44615
- else if (servar.type === 'pin_input' &&
44616
- value.length !== servar.max_length) {
44617
- return defaultErr;
44610
+ });
44611
+ });
44612
+ }
44613
+ function trackEvent(integrations, title, stepId, formName, fieldData) {
44614
+ var metadata = { formName: formName };
44615
+ if (stepId)
44616
+ metadata.stepId = stepId;
44617
+ // Google Tag Manager
44618
+ // @ts-expect-error TS(2551): Property 'initialized' does not exist on type '{ d... Remove this comment to see the full error message
44619
+ if (TagManager.initialized) {
44620
+ var gtmData = exports.__assign({}, metadata);
44621
+ if (fieldData === null || fieldData === void 0 ? void 0 : fieldData['google-tag-manager'])
44622
+ gtmData = exports.__assign(exports.__assign({}, gtmData), fieldData['google-tag-manager']);
44623
+ TagManager.dataLayer({ dataLayer: exports.__assign(exports.__assign({}, gtmData), { event: title }) });
44618
44624
  }
44619
- else if (servar.type === 'password') {
44620
- var meta = servar.metadata;
44621
- var msg = function (key) { return "Your password must have at least 1 ".concat(key); };
44622
- if (meta.letter_required && !LETTER_MATCH.test(value))
44623
- return msg('letter');
44624
- if (meta.uppercase_letter_required && !UPPERCASE_LETTER_MATCH.test(value))
44625
- return msg('uppercase letter');
44626
- if (meta.lowercase_letter_required && !LOWERCASE_LETTER_MATCH.test(value))
44627
- return msg('lowercase letter');
44628
- if (meta.number_required && !NUMBER_MATCH.test(value))
44629
- return msg('number');
44630
- if (meta.symbol_required && !SYMBOL_MATCH.test(value))
44631
- return msg('symbol');
44625
+ // RudderStack
44626
+ if (rudderStackInstalled) {
44627
+ var rudderData = exports.__assign({}, metadata);
44628
+ if (title === 'FeatheryFormComplete')
44629
+ rudderData.fieldData = exports.fieldValues;
44630
+ trackRudderEvent(title, rudderData, integrations === null || integrations === void 0 ? void 0 : integrations.rudderstack);
44632
44631
  }
44633
- // No error
44634
- return '';
44632
+ // Google Analytics
44633
+ if (gaInstalled)
44634
+ trackGAEvent(formName, title, stepId);
44635
+ // Segment
44636
+ var segmentData = exports.__assign({}, metadata);
44637
+ if (fieldData === null || fieldData === void 0 ? void 0 : fieldData.segment)
44638
+ segmentData.submittedData = fieldData.segment;
44639
+ if (featheryWindow().analytics)
44640
+ featheryWindow().analytics.track(title, segmentData);
44641
+ var amplitudeData = exports.__assign({}, metadata);
44642
+ if (fieldData === null || fieldData === void 0 ? void 0 : fieldData.amplitude)
44643
+ amplitudeData.submittedData = fieldData.amplitude;
44644
+ if (featheryWindow().amplitude)
44645
+ featheryWindow().amplitude.track(title, amplitudeData);
44646
+ if (featheryWindow().mixpanel)
44647
+ featheryWindow().mixpanel.track(title, metadata);
44635
44648
  }
44636
44649
 
44637
44650
  var QR_SCANNER_LIB_URL = 'https://unpkg.com/html5-qrcode';
@@ -45989,9 +46002,9 @@ function init(sdkKey, options) {
45989
46002
  if (runningInClient()) {
45990
46003
  // Dynamically load libraries that must be client side
45991
46004
  global.scriptjsLoadPromise = Promise.resolve().then(function () { return require(
45992
- /* webpackChunkName: "scriptjs" */ './fthry_script.Bse2qene.js'); }).then(function (n) { return n.script; });
46005
+ /* webpackChunkName: "scriptjs" */ './fthry_script.DOCG8gyM.js'); }).then(function (n) { return n.script; });
45993
46006
  global.webfontloaderPromise = Promise.resolve().then(function () { return require(
45994
- /* webpackChunkName: "webfontloader" */ './fthry_webfontloader.C5EOl2GC.js'); }).then(function (n) { return n.webfontloader; });
46007
+ /* webpackChunkName: "webfontloader" */ './fthry_webfontloader.5X-HEWHN.js'); }).then(function (n) { return n.webfontloader; });
45995
46008
  // Client-side tracking logic
45996
46009
  if (initState.userTracking === 'cookie') {
45997
46010
  var cookieKey = "feathery-user-id-".concat(sdkKey);
@@ -46137,7 +46150,7 @@ function getFieldValues() {
46137
46150
  return exports.__assign({}, exports.fieldValues);
46138
46151
  }
46139
46152
  function logFeatheryBadge() {
46140
- console.log('%c Feathery %c v' + "2.23.4" + ' ', // replaced with real version during build
46153
+ console.log('%c Feathery %c v' + "2.23.5" + ' ', // replaced with real version during build
46141
46154
  'background: #e2626e; color: white; padding: 2px 6px; border-radius: 3px 0 0 3px; font-weight: bold;', 'background: #fce7e9; color: #c5495a; padding: 2px 6px; border-radius: 0 3px 3px 0;');
46142
46155
  }
46143
46156
 
@@ -47570,39 +47583,39 @@ breakpoint) {
47570
47583
  return styles.getTarget('inner-container', undefined, viewport === 'mobile');
47571
47584
  };
47572
47585
 
47573
- var AddressLine1 = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "AddressField" */ './fthry_index.DnxpWsMc.js'); }); });
47574
- var ButtonGroupField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "ButtonGroupField" */ './fthry_index.BYHR4MSY.js'); }); });
47575
- var CheckboxField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "CheckboxField" */ './fthry_index.BUWCPnkW.js'); }); });
47586
+ var AddressLine1 = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "AddressField" */ './fthry_index.DGctX9WE.js'); }); });
47587
+ var ButtonGroupField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "ButtonGroupField" */ './fthry_index.BYTU7WTg.js'); }); });
47588
+ var CheckboxField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "CheckboxField" */ './fthry_index.mEUshDAA.js'); }); });
47576
47589
  var CheckboxGroupField = React.lazy(function () {
47577
- return Promise.resolve().then(function () { return require(/* webpackChunkName: "CheckboxGroupField" */ './fthry_index.BEVeNRzV.js'); });
47590
+ return Promise.resolve().then(function () { return require(/* webpackChunkName: "CheckboxGroupField" */ './fthry_index.Bh5jAAhx.js'); });
47578
47591
  });
47579
- var ColorPickerField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "ColorPickerField" */ './fthry_index.B2zNdCo9.js'); }); });
47580
- var CustomField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "CustomField" */ './fthry_index.DHiNhZNV.js'); }); });
47592
+ var ColorPickerField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "ColorPickerField" */ './fthry_index.CSwhuTPY.js'); }); });
47593
+ var CustomField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "CustomField" */ './fthry_index.Bsklltx4.js'); }); });
47581
47594
  var DateSelectorField = React.lazy(function () {
47582
- return Promise.resolve().then(function () { return require(/* webpackChunkName: "DateSelectorField" */ './fthry_index.DYCqVDAy.js'); });
47595
+ return Promise.resolve().then(function () { return require(/* webpackChunkName: "DateSelectorField" */ './fthry_index.BS6b2BTF.js'); });
47583
47596
  });
47584
- var DropdownField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "DropdownField" */ './fthry_index.DxlmMil4.js'); }); });
47597
+ var DropdownField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "DropdownField" */ './fthry_index.CWofoHQs.js'); }); });
47585
47598
  var DropdownMultiField = React.lazy(function () {
47586
- return Promise.resolve().then(function () { return require(/* webpackChunkName: "DropdownMultiField" */ './fthry_index.Bsfl9n6o.js'); });
47599
+ return Promise.resolve().then(function () { return require(/* webpackChunkName: "DropdownMultiField" */ './fthry_index.Nrwqiq0j.js'); });
47587
47600
  });
47588
- var FileUploadField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "FileUploadField" */ './fthry_index.D12V6N10.js'); }); });
47589
- var MatrixField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "MatrixField" */ './fthry_index.D48NiLIf.js'); }); });
47590
- var PasswordField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "PasswordField" */ './fthry_index.NQG80c7p.js'); }); });
47601
+ var FileUploadField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "FileUploadField" */ './fthry_index.B_UehadW.js'); }); });
47602
+ var MatrixField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "MatrixField" */ './fthry_index.jot4NArP.js'); }); });
47603
+ var PasswordField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "PasswordField" */ './fthry_index.D36o5hns.js'); }); });
47591
47604
  var PaymentMethodField = React.lazy(function () {
47592
- return Promise.resolve().then(function () { return require(/* webpackChunkName: "PaymentMethodField" */ './fthry_PaymentMethodField.Chdv_-BE.js'); });
47605
+ return Promise.resolve().then(function () { return require(/* webpackChunkName: "PaymentMethodField" */ './fthry_PaymentMethodField.D902pJlo.js'); });
47593
47606
  });
47594
- var PhoneField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "PhoneField" */ './fthry_index.DMpC4pzK.js'); }); });
47595
- var PinInputField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "PinInputField" */ './fthry_index.xSHVUU1i.js'); }); });
47596
- var QRScanner = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "QRScanner" */ './fthry_index.CxSsfqmh.js'); }); });
47607
+ var PhoneField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "PhoneField" */ './fthry_index.Bl2kuNOo.js'); }); });
47608
+ var PinInputField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "PinInputField" */ './fthry_index.9PFsbc4I.js'); }); });
47609
+ var QRScanner = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "QRScanner" */ './fthry_index.Jp2CJ4is.js'); }); });
47597
47610
  var RadioButtonGroupField = React.lazy(function () {
47598
47611
  return Promise.resolve().then(function () { return require(
47599
- /* webpackChunkName: "RadioButtonGroupField" */ './fthry_index.C5j86Jvn.js'); });
47612
+ /* webpackChunkName: "RadioButtonGroupField" */ './fthry_index.-Y9ZJS34.js'); });
47600
47613
  });
47601
- var RatingField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "RatingField" */ './fthry_index.Cmq71Bt9.js'); }); });
47602
- var SignatureField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "SignatureField" */ './fthry_index.jPrS6PXj.js'); }); });
47603
- var SliderField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "SliderField" */ './fthry_index.D4Wh5Gae.js'); }); });
47604
- var TextField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "TextField" */ './fthry_index.CwZQzFeM.js'); }); });
47605
- var TextArea = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "TextArea" */ './fthry_index.MhBBvjf4.js'); }); });
47614
+ var RatingField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "RatingField" */ './fthry_index.C6-dnyHD.js'); }); });
47615
+ var SignatureField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "SignatureField" */ './fthry_index.B4YVBeqY.js'); }); });
47616
+ var SliderField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "SliderField" */ './fthry_index.BmT77CVY.js'); }); });
47617
+ var TextField = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "TextField" */ './fthry_index.BuQ1HIIN.js'); }); });
47618
+ var TextArea = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "TextArea" */ './fthry_index.dGUMsRB1.js'); }); });
47606
47619
  var Fields = {
47607
47620
  AddressLine1: AddressLine1,
47608
47621
  ButtonGroupField: ButtonGroupField,
@@ -48542,7 +48555,7 @@ function ElementSkeleton(_a) {
48542
48555
  }
48543
48556
  var templateObject_1;
48544
48557
 
48545
- var TableElement = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "TableElement" */ './fthry_index.CJcXFlqa.js'); }); });
48558
+ var TableElement = React.lazy(function () { return Promise.resolve().then(function () { return require(/* webpackChunkName: "TableElement" */ './fthry_index.CbASwLjr.js'); }); });
48546
48559
  var Basic = {
48547
48560
  ImageElement: ImageElement,
48548
48561
  VideoElement: VideoElement,