@feathery/react 2.11.2 → 2.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{fthry_FormControl.D6cl6D9S.js → fthry_FormControl.CD7ZX9HS.js} +1 -1
- package/dist/cjs/{fthry_InlineTooltip.BznYePC8.js → fthry_InlineTooltip.CoBn0AOC.js} +2 -2
- package/dist/cjs/{fthry_Overlay.Y_J8ccm6.js → fthry_Overlay.CshBlW3v.js} +1 -1
- package/dist/cjs/{fthry_PaymentMethodField.D0YALHBL.js → fthry_PaymentMethodField.ClmgrMDW.js} +4 -4
- package/dist/cjs/{fthry_Placeholder.DLJqaPGW.js → fthry_Placeholder.CL_PBAhS.js} +1 -1
- package/dist/cjs/{fthry_ShowEyeIcon.DzvNCry-.js → fthry_ShowEyeIcon.DQYOkuGq.js} +1 -1
- package/dist/cjs/{fthry_index.Biaf9DMR.js → fthry_index.B8m8NcYS.js} +1 -1
- package/dist/cjs/{fthry_index.EMYHk8IT.js → fthry_index.BMq3dBRB.js} +598 -457
- package/dist/cjs/{fthry_index.CVdIUnnS.js → fthry_index.BpPVWOqt.js} +4 -4
- package/dist/cjs/{fthry_index._0ok1zlZ.js → fthry_index.BrzbrcQa.js} +6 -6
- package/dist/cjs/{fthry_index.nvFgoNpW.js → fthry_index.C8jtezTq.js} +2 -2
- package/dist/cjs/{fthry_index.5Pl_oKxb.js → fthry_index.CRJbToBF.js} +3 -3
- package/dist/cjs/{fthry_index.lBGOIoJv.js → fthry_index.CVGTkuBu.js} +5 -5
- package/dist/cjs/{fthry_index.CaFboSVZ.js → fthry_index.CX0W0jE1.js} +2 -2
- package/dist/cjs/{fthry_index.uPlANshe.js → fthry_index.CcgrLEuS.js} +5 -5
- package/dist/cjs/{fthry_index.ObOAUNgg.js → fthry_index.CdGAa2gf.js} +4 -4
- package/dist/cjs/{fthry_index.hetQ4hFA.js → fthry_index.Ce9wiHSK.js} +5 -5
- package/dist/cjs/{fthry_index.DhP_ifSD.js → fthry_index.CmHODiIC.js} +3 -3
- package/dist/cjs/{fthry_index.BIDjlZK9.js → fthry_index.CpHzsH9n.js} +1 -1
- package/dist/cjs/{fthry_index.BVctbQwI.js → fthry_index.CpIBnF75.js} +1 -1
- package/dist/cjs/{fthry_index.DfjbwYs8.js → fthry_index.CuICsq3u.js} +5 -5
- package/dist/cjs/{fthry_index.C-CXGg0X.js → fthry_index.CxZygKnY.js} +6 -6
- package/dist/cjs/{fthry_index.6K3SolcM.js → fthry_index.D94gkYbC.js} +8 -8
- package/dist/cjs/{fthry_index.XwO_Rbt1.js → fthry_index.DBr9A2ZJ.js} +1 -1
- package/dist/cjs/{fthry_index.Dg3FFh_g.js → fthry_index.DM58Cupo.js} +1 -1
- package/dist/cjs/{fthry_index.DmHwjSeG.js → fthry_index.R9WKq_P8.js} +1 -1
- package/dist/cjs/{fthry_index.Cl0pC-iC.js → fthry_index.e1NDYANz.js} +6 -6
- package/dist/cjs/{fthry_index.DKwYIEay.js → fthry_index.iaUi_vwz.js} +4 -4
- package/dist/cjs/{fthry_index.DPJLojch.js → fthry_index.x3WPDwFM.js} +1 -1
- package/dist/cjs/{fthry_input.zxl6q_39.js → fthry_input.xxDrXTUh.js} +1 -1
- package/dist/cjs/{fthry_script.BR1PC2YO.js → fthry_script.rT4Hk6hO.js} +1 -1
- package/dist/cjs/{fthry_styles.8kKnpgke.js → fthry_styles.CBznbkq1.js} +1 -1
- package/dist/cjs/{fthry_useElementSize.d2r6U5ah.js → fthry_useElementSize.BtewtYuf.js} +1 -1
- package/dist/cjs/{fthry_useSalesforceSync.BhgCgOph.js → fthry_useSalesforceSync.CuD01OZB.js} +1 -1
- package/dist/cjs/{fthry_webfontloader.BxRwLQqw.js → fthry_webfontloader.BpYY6eaS.js} +1 -1
- package/dist/cjs/index.d.ts +2 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/utils/error.d.ts +0 -5
- package/dist/cjs/utils/error.d.ts.map +1 -1
- package/dist/cjs/utils/featheryClient/index.d.ts +12 -20
- package/dist/cjs/utils/featheryClient/index.d.ts.map +1 -1
- package/dist/cjs/utils/featheryClient/integrationClient.d.ts +2 -8
- package/dist/cjs/utils/featheryClient/integrationClient.d.ts.map +1 -1
- package/dist/cjs/utils/featheryClient/utils.d.ts.map +1 -1
- package/dist/cjs/utils/formContext.d.ts +2 -1
- package/dist/cjs/utils/formContext.d.ts.map +1 -1
- package/dist/cjs/utils/formHelperFunctions.d.ts.map +1 -1
- package/dist/cjs/utils/internalState.d.ts +1 -12
- package/dist/cjs/utils/internalState.d.ts.map +1 -1
- package/dist/esm/{fthry_FormControl.Dw6vin7t.js → fthry_FormControl.CJgP5gkl.js} +1 -1
- package/dist/esm/{fthry_InlineTooltip.BefepzqB.js → fthry_InlineTooltip.C6FcOG7t.js} +2 -2
- package/dist/esm/{fthry_Overlay.KSPvV_5I.js → fthry_Overlay.OaYtZbBy.js} +1 -1
- package/dist/esm/{fthry_PaymentMethodField.BUfFS7UV.js → fthry_PaymentMethodField.w3gN7Laz.js} +4 -4
- package/dist/esm/{fthry_Placeholder.BW8tIivs.js → fthry_Placeholder.B8o3b6LD.js} +1 -1
- package/dist/esm/{fthry_ShowEyeIcon.BKxMDQ6E.js → fthry_ShowEyeIcon.CTL96Xla.js} +1 -1
- package/dist/esm/{fthry_index.WbUsG08Q.js → fthry_index.B3p8f_0T.js} +3 -3
- package/dist/esm/{fthry_index.zq2HD0Fd.js → fthry_index.BG0CKa54.js} +1 -1
- package/dist/esm/{fthry_index.BnK1bTAO.js → fthry_index.BJfTO9uE.js} +5 -5
- package/dist/esm/{fthry_index.B792Q-9f.js → fthry_index.BmTsB6Yu.js} +4 -4
- package/dist/esm/{fthry_index.Cwlyf022.js → fthry_index.BrukVpyc.js} +1 -1
- package/dist/esm/{fthry_index.Dwn_Hlhv.js → fthry_index.Bwx-PVUc.js} +1 -1
- package/dist/esm/{fthry_index.ClAqMRNE.js → fthry_index.CX_yIpjx.js} +5 -5
- package/dist/esm/{fthry_index.CI9m6hZF.js → fthry_index.D2sLtI7z.js} +598 -457
- package/dist/esm/{fthry_index.C8W18PjB.js → fthry_index.D5EZxrPq.js} +6 -6
- package/dist/esm/{fthry_index.DySdw1qz.js → fthry_index.DVcP5-xw.js} +3 -3
- package/dist/esm/{fthry_index.B47QNn0m.js → fthry_index.DfQXHyGI.js} +5 -5
- package/dist/esm/{fthry_index.bwiHR1sL.js → fthry_index.Dh6l3Gzh.js} +1 -1
- package/dist/esm/{fthry_index.iCgN6lqQ.js → fthry_index.DhAebwSP.js} +1 -1
- package/dist/esm/{fthry_index.o9Sz1ZZ7.js → fthry_index.DjBNWso3.js} +4 -4
- package/dist/esm/{fthry_index.DrkBLnxc.js → fthry_index.W81Z3_36.js} +2 -2
- package/dist/esm/{fthry_index.DNGxrq0x.js → fthry_index._VpRor3C.js} +4 -4
- package/dist/esm/{fthry_index.BLXBhPia.js → fthry_index._Vy4-Wu1.js} +1 -1
- package/dist/esm/{fthry_index.B6wWZFeh.js → fthry_index.f0EL1oG0.js} +6 -6
- package/dist/esm/{fthry_index.BroPvTJq.js → fthry_index.q1Cc80ox.js} +2 -2
- package/dist/esm/{fthry_index.D9_3XAGw.js → fthry_index.rA0-tPwD.js} +8 -8
- package/dist/esm/{fthry_index.CJ32ytSR.js → fthry_index.xPB4gauQ.js} +1 -1
- package/dist/esm/{fthry_index.CquWPUWD.js → fthry_index.xmk6gHHa.js} +5 -5
- package/dist/esm/{fthry_index.56gEPYOD.js → fthry_index.yOjuSCdP.js} +6 -6
- package/dist/esm/{fthry_input.sAUJXmRh.js → fthry_input.IXRyP1Bj.js} +1 -1
- package/dist/esm/{fthry_script.Ddc0lRD_.js → fthry_script.BM2vGrj6.js} +1 -1
- package/dist/esm/{fthry_styles.3ifXNVk6.js → fthry_styles.DfbJMfa4.js} +1 -1
- package/dist/esm/{fthry_useElementSize.MYGhO3UW.js → fthry_useElementSize.9TQixaBM.js} +1 -1
- package/dist/esm/{fthry_useSalesforceSync.CLzWAPAF.js → fthry_useSalesforceSync.kfFiE0MN.js} +1 -1
- package/dist/esm/{fthry_webfontloader.DbHsRpPk.js → fthry_webfontloader.Bg-Ggiji.js} +1 -1
- package/dist/esm/index.d.ts +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/utils/error.d.ts +0 -5
- package/dist/esm/utils/error.d.ts.map +1 -1
- package/dist/esm/utils/featheryClient/index.d.ts +12 -20
- package/dist/esm/utils/featheryClient/index.d.ts.map +1 -1
- package/dist/esm/utils/featheryClient/integrationClient.d.ts +2 -8
- package/dist/esm/utils/featheryClient/integrationClient.d.ts.map +1 -1
- package/dist/esm/utils/featheryClient/utils.d.ts.map +1 -1
- package/dist/esm/utils/formContext.d.ts +2 -1
- package/dist/esm/utils/formContext.d.ts.map +1 -1
- package/dist/esm/utils/formHelperFunctions.d.ts.map +1 -1
- package/dist/esm/utils/internalState.d.ts +1 -12
- package/dist/esm/utils/internalState.d.ts.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/utils/error.d.ts +0 -5
- package/dist/utils/error.d.ts.map +1 -1
- package/dist/utils/featheryClient/index.d.ts +12 -20
- package/dist/utils/featheryClient/index.d.ts.map +1 -1
- package/dist/utils/featheryClient/integrationClient.d.ts +2 -8
- package/dist/utils/featheryClient/integrationClient.d.ts.map +1 -1
- package/dist/utils/featheryClient/utils.d.ts.map +1 -1
- package/dist/utils/formContext.d.ts +2 -1
- package/dist/utils/formContext.d.ts.map +1 -1
- package/dist/utils/formHelperFunctions.d.ts.map +1 -1
- package/dist/utils/internalState.d.ts +1 -12
- package/dist/utils/internalState.d.ts.map +1 -1
- package/package.json +2 -1
- package/umd/{509.4236d4d76d2fa2ccd971.js → 509.f9d0245d6c94d15722a0.js} +2 -2
- package/umd/index.js +1 -1
- /package/umd/{509.4236d4d76d2fa2ccd971.js.LICENSE.txt → 509.f9d0245d6c94d15722a0.js.LICENSE.txt} +0 -0
|
@@ -5759,66 +5759,6 @@ function v4$1(options, buf, offset) {
|
|
|
5759
5759
|
return stringify$1(rnds);
|
|
5760
5760
|
}
|
|
5761
5761
|
|
|
5762
|
-
var SDKKeyError = /** @class */ (function (_super) {
|
|
5763
|
-
__extends(SDKKeyError, _super);
|
|
5764
|
-
function SDKKeyError(message) {
|
|
5765
|
-
if (message === void 0) { message = 'Invalid SDK Key'; }
|
|
5766
|
-
var _this = _super.call(this, message) || this;
|
|
5767
|
-
_this.name = 'SDKKeyError';
|
|
5768
|
-
return _this;
|
|
5769
|
-
}
|
|
5770
|
-
return SDKKeyError;
|
|
5771
|
-
}(Error));
|
|
5772
|
-
var UserIdError = /** @class */ (function (_super) {
|
|
5773
|
-
__extends(UserIdError, _super);
|
|
5774
|
-
function UserIdError() {
|
|
5775
|
-
var _this = _super.call(this, 'Invalid User ID') || this;
|
|
5776
|
-
_this.name = 'UserIdError';
|
|
5777
|
-
return _this;
|
|
5778
|
-
}
|
|
5779
|
-
return UserIdError;
|
|
5780
|
-
}(Error));
|
|
5781
|
-
var FetchError = /** @class */ (function (_super) {
|
|
5782
|
-
__extends(FetchError, _super);
|
|
5783
|
-
function FetchError(message, payload) {
|
|
5784
|
-
if (payload === void 0) { payload = null; }
|
|
5785
|
-
var _this = _super.call(this, message) || this;
|
|
5786
|
-
_this.name = 'FetchError';
|
|
5787
|
-
_this.payload = payload;
|
|
5788
|
-
return _this;
|
|
5789
|
-
}
|
|
5790
|
-
return FetchError;
|
|
5791
|
-
}(Error));
|
|
5792
|
-
function parseError(err) {
|
|
5793
|
-
if (Array.isArray(err) && err.length) {
|
|
5794
|
-
var payloadError = err[0];
|
|
5795
|
-
if (typeof payloadError === 'object' && 'message' in payloadError) {
|
|
5796
|
-
return payloadError.message;
|
|
5797
|
-
}
|
|
5798
|
-
else
|
|
5799
|
-
return 'Invalid';
|
|
5800
|
-
}
|
|
5801
|
-
else if (err.message || err.error)
|
|
5802
|
-
return err.message || err.error;
|
|
5803
|
-
else
|
|
5804
|
-
return err.toString();
|
|
5805
|
-
}
|
|
5806
|
-
var handleCustomScriptError = function (e) {
|
|
5807
|
-
var _a, _b;
|
|
5808
|
-
var errorReason = (_a = e.reason) !== null && _a !== void 0 ? _a : e.error;
|
|
5809
|
-
// If stack is at 'eval', it is a logic rule error.
|
|
5810
|
-
// Note this only works for unhandledrejection events, not error events.
|
|
5811
|
-
console.warn('Error caught in custom HTML. Error Message: ', (_b = errorReason.message) !== null && _b !== void 0 ? _b : '');
|
|
5812
|
-
e.stopPropagation();
|
|
5813
|
-
e.preventDefault(); // Prevent the error in the log
|
|
5814
|
-
};
|
|
5815
|
-
var setCustomErrorHandler = function () {
|
|
5816
|
-
featheryWindow().addEventListener('error', handleCustomScriptError);
|
|
5817
|
-
};
|
|
5818
|
-
var removeCustomErrorHandler = function () {
|
|
5819
|
-
featheryWindow().removeEventListener('error', handleCustomScriptError);
|
|
5820
|
-
};
|
|
5821
|
-
|
|
5822
5762
|
function encodeGetParams(params) {
|
|
5823
5763
|
return (Object.entries(params)
|
|
5824
5764
|
// @ts-expect-error TS(2345): Argument of type '(uriComponent: string | number |... Remove this comment to see the full error message
|
|
@@ -5879,6 +5819,507 @@ function numMatchingItems(arr1, arr2) {
|
|
|
5879
5819
|
return i;
|
|
5880
5820
|
}
|
|
5881
5821
|
|
|
5822
|
+
var dist$2 = {};
|
|
5823
|
+
|
|
5824
|
+
var api$1 = {};
|
|
5825
|
+
|
|
5826
|
+
var utils = {};
|
|
5827
|
+
|
|
5828
|
+
var error = {};
|
|
5829
|
+
|
|
5830
|
+
var hasRequiredError;
|
|
5831
|
+
|
|
5832
|
+
function requireError () {
|
|
5833
|
+
if (hasRequiredError) return error;
|
|
5834
|
+
hasRequiredError = 1;
|
|
5835
|
+
Object.defineProperty(error, "__esModule", { value: true });
|
|
5836
|
+
error.ValidationError = error.FetchError = void 0;
|
|
5837
|
+
error.parseAPIError = parseAPIError;
|
|
5838
|
+
class FetchError extends Error {
|
|
5839
|
+
constructor(message, payload = null) {
|
|
5840
|
+
super(message);
|
|
5841
|
+
this.name = 'FetchError';
|
|
5842
|
+
this.payload = payload;
|
|
5843
|
+
}
|
|
5844
|
+
}
|
|
5845
|
+
error.FetchError = FetchError;
|
|
5846
|
+
class ValidationError extends Error {
|
|
5847
|
+
constructor(message) {
|
|
5848
|
+
super(message);
|
|
5849
|
+
this.name = 'ValidationError';
|
|
5850
|
+
}
|
|
5851
|
+
}
|
|
5852
|
+
error.ValidationError = ValidationError;
|
|
5853
|
+
function parseAPIError(err) {
|
|
5854
|
+
if (Array.isArray(err) && err.length) {
|
|
5855
|
+
const payloadError = err[0];
|
|
5856
|
+
if (typeof payloadError === 'object' && 'message' in payloadError) {
|
|
5857
|
+
return payloadError.message;
|
|
5858
|
+
}
|
|
5859
|
+
else
|
|
5860
|
+
return 'Invalid';
|
|
5861
|
+
}
|
|
5862
|
+
else if (err.message || err.error)
|
|
5863
|
+
return err.message || err.error;
|
|
5864
|
+
else
|
|
5865
|
+
return err.toString();
|
|
5866
|
+
}
|
|
5867
|
+
return error;
|
|
5868
|
+
}
|
|
5869
|
+
|
|
5870
|
+
var setup = {};
|
|
5871
|
+
|
|
5872
|
+
var hasRequiredSetup;
|
|
5873
|
+
|
|
5874
|
+
function requireSetup () {
|
|
5875
|
+
if (hasRequiredSetup) return setup;
|
|
5876
|
+
hasRequiredSetup = 1;
|
|
5877
|
+
Object.defineProperty(setup, "__esModule", { value: true });
|
|
5878
|
+
setup.S3_URL_OPTIONS = setup.CDN_URL_OPTIONS = setup.STATIC_URL_OPTIONS = setup.API_URL_OPTIONS = void 0;
|
|
5879
|
+
setup.getEnvironment = getEnvironment;
|
|
5880
|
+
setup.setEnvironment = setEnvironment;
|
|
5881
|
+
setup.API_URL_OPTIONS = {
|
|
5882
|
+
local: 'http://localhost:8006/api/',
|
|
5883
|
+
docker: 'http://host.docker.internal:8006/api/',
|
|
5884
|
+
staging: 'https://staging.feathery.io/api/',
|
|
5885
|
+
production: 'https://api.feathery.io/api/',
|
|
5886
|
+
productionAU: 'https://api-au.feathery.io/api/',
|
|
5887
|
+
productionEU: 'https://api-eu.feathery.io/api/',
|
|
5888
|
+
productionCA: 'https://api-ca.feathery.io/api/',
|
|
5889
|
+
};
|
|
5890
|
+
setup.STATIC_URL_OPTIONS = {
|
|
5891
|
+
local: 'http://localhost:8006/api/',
|
|
5892
|
+
docker: 'http://host.docker.internal:8006/api/',
|
|
5893
|
+
staging: 'https://staging.feathery.io/api/',
|
|
5894
|
+
production: 'https://api-static-2.feathery.io/api/',
|
|
5895
|
+
productionAU: 'https://api-au.feathery.io/api/',
|
|
5896
|
+
productionEU: 'https://api-eu.feathery.io/api/',
|
|
5897
|
+
productionCA: 'https://api-ca.feathery.io/api/',
|
|
5898
|
+
};
|
|
5899
|
+
setup.CDN_URL_OPTIONS = {
|
|
5900
|
+
local: 'http://localhost:8006/api/',
|
|
5901
|
+
docker: 'http://host.docker.internal:8006/api/',
|
|
5902
|
+
staging: 'https://staging.feathery.io/api/',
|
|
5903
|
+
production: 'https://cdn.feathery.io/api/',
|
|
5904
|
+
productionAU: 'https://cdn-au.feathery.io/api/',
|
|
5905
|
+
productionEU: 'https://cdn-eu.feathery.io/api/',
|
|
5906
|
+
productionCA: 'https://cdn-ca.feathery.io/api/',
|
|
5907
|
+
};
|
|
5908
|
+
setup.S3_URL_OPTIONS = {
|
|
5909
|
+
local: 'http://localhost:8006',
|
|
5910
|
+
docker: 'http://host.docker.internal:8006',
|
|
5911
|
+
staging: 's3.us-west-1.amazonaws.com',
|
|
5912
|
+
production: 's3.us-west-1.amazonaws.com',
|
|
5913
|
+
productionAU: 's3.ap-southeast-2.amazonaws.com',
|
|
5914
|
+
productionEU: 's3.eu-west-1.amazonaws.com',
|
|
5915
|
+
productionCA: 's3.ca-central-1.amazonaws.com',
|
|
5916
|
+
};
|
|
5917
|
+
let configuredEnvironment;
|
|
5918
|
+
let isClientSide = true;
|
|
5919
|
+
let internalSecretKey = null;
|
|
5920
|
+
function getEnvironment() {
|
|
5921
|
+
if (!configuredEnvironment)
|
|
5922
|
+
throw new Error('Environment not set');
|
|
5923
|
+
return { configuredEnvironment, isClientSide, internalSecretKey };
|
|
5924
|
+
}
|
|
5925
|
+
/**
|
|
5926
|
+
* Set the environment for the SDK.
|
|
5927
|
+
* @param environment - The environment to set (local, staging, production, etc.).
|
|
5928
|
+
* @param clientSide - Whether the SDK is running in the browser or server side.
|
|
5929
|
+
* @param secretKey - The secret key to use for the SDK.
|
|
5930
|
+
*/
|
|
5931
|
+
function setEnvironment(environment, clientSide = true, secretKey = null) {
|
|
5932
|
+
configuredEnvironment = environment;
|
|
5933
|
+
isClientSide = clientSide;
|
|
5934
|
+
internalSecretKey = secretKey;
|
|
5935
|
+
}
|
|
5936
|
+
return setup;
|
|
5937
|
+
}
|
|
5938
|
+
|
|
5939
|
+
var hasRequiredUtils;
|
|
5940
|
+
|
|
5941
|
+
function requireUtils () {
|
|
5942
|
+
if (hasRequiredUtils) return utils;
|
|
5943
|
+
hasRequiredUtils = 1;
|
|
5944
|
+
Object.defineProperty(utils, "__esModule", { value: true });
|
|
5945
|
+
utils.getApiUrl = getApiUrl;
|
|
5946
|
+
utils.getStaticUrl = getStaticUrl;
|
|
5947
|
+
utils.getCdnUrl = getCdnUrl;
|
|
5948
|
+
utils.getS3Url = getS3Url;
|
|
5949
|
+
utils.checkResponseSuccess = checkResponseSuccess;
|
|
5950
|
+
utils.apiFetch = apiFetch;
|
|
5951
|
+
utils.createHttpHelpers = createHttpHelpers;
|
|
5952
|
+
const api_1 = requireApi();
|
|
5953
|
+
const error_1 = requireError();
|
|
5954
|
+
const setup_1 = requireSetup();
|
|
5955
|
+
function getApiUrl() {
|
|
5956
|
+
const { configuredEnvironment, isClientSide } = (0, setup_1.getEnvironment)();
|
|
5957
|
+
if (configuredEnvironment === 'local' && !isClientSide)
|
|
5958
|
+
return setup_1.API_URL_OPTIONS.docker;
|
|
5959
|
+
return setup_1.API_URL_OPTIONS[configuredEnvironment];
|
|
5960
|
+
}
|
|
5961
|
+
function getStaticUrl() {
|
|
5962
|
+
const { configuredEnvironment, isClientSide } = (0, setup_1.getEnvironment)();
|
|
5963
|
+
if (configuredEnvironment === 'local' && !isClientSide)
|
|
5964
|
+
return setup_1.STATIC_URL_OPTIONS.docker;
|
|
5965
|
+
return setup_1.STATIC_URL_OPTIONS[configuredEnvironment];
|
|
5966
|
+
}
|
|
5967
|
+
function getCdnUrl() {
|
|
5968
|
+
const { configuredEnvironment, isClientSide } = (0, setup_1.getEnvironment)();
|
|
5969
|
+
if (configuredEnvironment === 'local' && !isClientSide)
|
|
5970
|
+
return setup_1.CDN_URL_OPTIONS.docker;
|
|
5971
|
+
return setup_1.CDN_URL_OPTIONS[configuredEnvironment];
|
|
5972
|
+
}
|
|
5973
|
+
function getS3Url() {
|
|
5974
|
+
const { configuredEnvironment, isClientSide } = (0, setup_1.getEnvironment)();
|
|
5975
|
+
if (configuredEnvironment === 'local' && !isClientSide)
|
|
5976
|
+
return setup_1.S3_URL_OPTIONS.docker;
|
|
5977
|
+
return setup_1.S3_URL_OPTIONS[configuredEnvironment];
|
|
5978
|
+
}
|
|
5979
|
+
async function checkResponseSuccess(response) {
|
|
5980
|
+
let payload;
|
|
5981
|
+
switch (response.status) {
|
|
5982
|
+
case 200:
|
|
5983
|
+
case 201:
|
|
5984
|
+
case 202:
|
|
5985
|
+
return;
|
|
5986
|
+
case 400:
|
|
5987
|
+
payload = JSON.stringify(await response.clone().text());
|
|
5988
|
+
throw new error_1.FetchError(payload.toString());
|
|
5989
|
+
case 404:
|
|
5990
|
+
throw new error_1.FetchError("Can't find object");
|
|
5991
|
+
case 500:
|
|
5992
|
+
throw new error_1.FetchError('Internal server error');
|
|
5993
|
+
default:
|
|
5994
|
+
throw new error_1.FetchError('Unknown error');
|
|
5995
|
+
}
|
|
5996
|
+
}
|
|
5997
|
+
async function apiFetch(sdkKey, url, options, parseResponse = true) {
|
|
5998
|
+
options = options ?? {};
|
|
5999
|
+
const { headers, ...otherOptions } = options;
|
|
6000
|
+
options = {
|
|
6001
|
+
cache: 'no-store',
|
|
6002
|
+
// write requests must succeed so data is tracked
|
|
6003
|
+
keepalive: ['POST', 'PATCH', 'PUT'].includes(options.method),
|
|
6004
|
+
headers: {
|
|
6005
|
+
Authorization: 'Token ' + sdkKey,
|
|
6006
|
+
...headers,
|
|
6007
|
+
},
|
|
6008
|
+
...otherOptions,
|
|
6009
|
+
};
|
|
6010
|
+
const { internalSecretKey } = (0, setup_1.getEnvironment)();
|
|
6011
|
+
if (internalSecretKey)
|
|
6012
|
+
options.headers['X-Lambda-Secret'] = internalSecretKey;
|
|
6013
|
+
return fetch(url, options).then(async (response) => {
|
|
6014
|
+
if (parseResponse)
|
|
6015
|
+
await checkResponseSuccess(response);
|
|
6016
|
+
return response;
|
|
6017
|
+
});
|
|
6018
|
+
}
|
|
6019
|
+
function createHttpHelpers(sdkKey, formId, userId, fieldValues, updateFieldData, offlineHandler) {
|
|
6020
|
+
const helpers = {};
|
|
6021
|
+
['get', 'patch', 'post', 'put', 'delete'].forEach((method) => (helpers[method] = async (url, data, headers) => {
|
|
6022
|
+
if (!url)
|
|
6023
|
+
return {};
|
|
6024
|
+
const response = await (0, api_1.runCustomRequest)(sdkKey, formId, { method: method.toUpperCase(), url, data, headers }, userId, fieldValues, offlineHandler);
|
|
6025
|
+
if (!response)
|
|
6026
|
+
return {};
|
|
6027
|
+
if (response.field_values && updateFieldData) {
|
|
6028
|
+
updateFieldData(response.field_values);
|
|
6029
|
+
}
|
|
6030
|
+
return {
|
|
6031
|
+
data: response.data,
|
|
6032
|
+
statusCode: response.status_code,
|
|
6033
|
+
// status_code for backwards compatibility
|
|
6034
|
+
status_code: response.statusCode,
|
|
6035
|
+
};
|
|
6036
|
+
}));
|
|
6037
|
+
helpers.connect = async (name, data, headers) => {
|
|
6038
|
+
if (!name)
|
|
6039
|
+
return {};
|
|
6040
|
+
const response = await (0, api_1.runCustomRequest)(sdkKey, formId, { name, data, headers }, userId, fieldValues, offlineHandler);
|
|
6041
|
+
if (!response)
|
|
6042
|
+
return {};
|
|
6043
|
+
if (response.field_values && updateFieldData) {
|
|
6044
|
+
updateFieldData(response.field_values);
|
|
6045
|
+
}
|
|
6046
|
+
return {
|
|
6047
|
+
data: response.data,
|
|
6048
|
+
statusCode: response.status_code,
|
|
6049
|
+
};
|
|
6050
|
+
};
|
|
6051
|
+
return helpers;
|
|
6052
|
+
}
|
|
6053
|
+
return utils;
|
|
6054
|
+
}
|
|
6055
|
+
|
|
6056
|
+
var hasRequiredApi;
|
|
6057
|
+
|
|
6058
|
+
function requireApi () {
|
|
6059
|
+
if (hasRequiredApi) return api$1;
|
|
6060
|
+
hasRequiredApi = 1;
|
|
6061
|
+
Object.defineProperty(api$1, "__esModule", { value: true });
|
|
6062
|
+
api$1.customRolloutAction = customRolloutAction;
|
|
6063
|
+
api$1.extractAIDocument = extractAIDocument;
|
|
6064
|
+
api$1.pollForCompletion = pollForCompletion;
|
|
6065
|
+
api$1.inviteFormCollaborator = inviteFormCollaborator;
|
|
6066
|
+
api$1.sendEmail = sendEmail;
|
|
6067
|
+
api$1.forwardInboxEmail = forwardInboxEmail;
|
|
6068
|
+
api$1.runCustomRequest = runCustomRequest;
|
|
6069
|
+
const utils_1 = requireUtils();
|
|
6070
|
+
const error_1 = requireError();
|
|
6071
|
+
async function customRolloutAction(sdkKey, automationIds, formId, fieldData, options, userId) {
|
|
6072
|
+
const url = `${(0, utils_1.getApiUrl)()}rollout/custom-trigger/`;
|
|
6073
|
+
if (typeof automationIds === 'string')
|
|
6074
|
+
automationIds = [automationIds];
|
|
6075
|
+
const reqOptions = {
|
|
6076
|
+
headers: { 'Content-Type': 'application/json' },
|
|
6077
|
+
method: 'POST',
|
|
6078
|
+
body: JSON.stringify({
|
|
6079
|
+
automation_ids: automationIds,
|
|
6080
|
+
sync: options.waitForCompletion ?? true,
|
|
6081
|
+
multiple: options.multiple ?? false,
|
|
6082
|
+
payload: fieldData,
|
|
6083
|
+
form_key: formId,
|
|
6084
|
+
fuser_key: userId,
|
|
6085
|
+
}),
|
|
6086
|
+
};
|
|
6087
|
+
const res = await (0, utils_1.apiFetch)(sdkKey, url, reqOptions, false);
|
|
6088
|
+
if (res && res.status === 200)
|
|
6089
|
+
return { ok: true, payload: await res.json() };
|
|
6090
|
+
else
|
|
6091
|
+
return { ok: false, error: (await res?.text()) ?? '' };
|
|
6092
|
+
}
|
|
6093
|
+
async function extractAIDocument(sdkKey, extractionId, options, userId, pages, triggerExtractionRunId, collaboratorId, onMeetingInfo, onStatusUpdate) {
|
|
6094
|
+
let runAsync;
|
|
6095
|
+
let variantId;
|
|
6096
|
+
let meetingUrl;
|
|
6097
|
+
if (typeof options === 'object') {
|
|
6098
|
+
runAsync = !options.waitForCompletion;
|
|
6099
|
+
pages = options.pages;
|
|
6100
|
+
variantId = options.variantId;
|
|
6101
|
+
meetingUrl = options.meetingUrl;
|
|
6102
|
+
}
|
|
6103
|
+
else {
|
|
6104
|
+
// deprecated usage, options is runAsync
|
|
6105
|
+
runAsync = options;
|
|
6106
|
+
}
|
|
6107
|
+
const data = {
|
|
6108
|
+
fuser_key: userId,
|
|
6109
|
+
extraction_id: extractionId,
|
|
6110
|
+
extraction_variant_id: variantId,
|
|
6111
|
+
trigger_extraction_run_id: triggerExtractionRunId,
|
|
6112
|
+
pages,
|
|
6113
|
+
meeting_url: meetingUrl,
|
|
6114
|
+
collaborator_user: collaboratorId,
|
|
6115
|
+
};
|
|
6116
|
+
const res = await (0, utils_1.apiFetch)(sdkKey, `${(0, utils_1.getStaticUrl)()}ai/vision/`, {
|
|
6117
|
+
headers: { 'Content-Type': 'application/json' },
|
|
6118
|
+
method: 'POST',
|
|
6119
|
+
body: JSON.stringify(data),
|
|
6120
|
+
});
|
|
6121
|
+
if (runAsync)
|
|
6122
|
+
return {};
|
|
6123
|
+
const response = await res?.json();
|
|
6124
|
+
if (response?.meeting_info) {
|
|
6125
|
+
onMeetingInfo?.();
|
|
6126
|
+
return {};
|
|
6127
|
+
}
|
|
6128
|
+
const pollUrl = `${(0, utils_1.getStaticUrl)()}ai/vision/completion/?fid=${userId}&eid=${extractionId}&evid=${variantId ?? ''}`;
|
|
6129
|
+
const CHECK_INTERVAL = 2000;
|
|
6130
|
+
const MAX_TIME = 3 * 60 * 1000;
|
|
6131
|
+
return await pollForCompletion(sdkKey, pollUrl, CHECK_INTERVAL, MAX_TIME, 'Extraction', onStatusUpdate);
|
|
6132
|
+
}
|
|
6133
|
+
async function pollForCompletion(sdkKey, pollUrl, checkInterval, maxTime, operationName = 'Operation', onStatusUpdate) {
|
|
6134
|
+
return new Promise((resolve) => {
|
|
6135
|
+
let attempts = 0;
|
|
6136
|
+
const maxAttempts = maxTime / checkInterval;
|
|
6137
|
+
const checkCompletion = async () => {
|
|
6138
|
+
const response = await (0, utils_1.apiFetch)(sdkKey, pollUrl, { method: 'GET' }, false);
|
|
6139
|
+
if (!response)
|
|
6140
|
+
return;
|
|
6141
|
+
const data = await response.json();
|
|
6142
|
+
if (onStatusUpdate) {
|
|
6143
|
+
onStatusUpdate(data);
|
|
6144
|
+
}
|
|
6145
|
+
if (response.ok) {
|
|
6146
|
+
if (data.status === 'complete') {
|
|
6147
|
+
return resolve(data);
|
|
6148
|
+
}
|
|
6149
|
+
else {
|
|
6150
|
+
attempts += 1;
|
|
6151
|
+
if (attempts < maxAttempts) {
|
|
6152
|
+
setTimeout(checkCompletion, checkInterval);
|
|
6153
|
+
}
|
|
6154
|
+
else {
|
|
6155
|
+
const message = `${operationName} took too long...`;
|
|
6156
|
+
console.error(message);
|
|
6157
|
+
return resolve({ status: 'error', message });
|
|
6158
|
+
}
|
|
6159
|
+
}
|
|
6160
|
+
}
|
|
6161
|
+
else {
|
|
6162
|
+
const message = (0, error_1.parseAPIError)(data);
|
|
6163
|
+
console.error(message);
|
|
6164
|
+
if (onStatusUpdate) {
|
|
6165
|
+
onStatusUpdate({ error: message });
|
|
6166
|
+
}
|
|
6167
|
+
return resolve({ status: 'error', message });
|
|
6168
|
+
}
|
|
6169
|
+
};
|
|
6170
|
+
// check every few seconds for a response
|
|
6171
|
+
setTimeout(checkCompletion, checkInterval);
|
|
6172
|
+
});
|
|
6173
|
+
}
|
|
6174
|
+
async function inviteFormCollaborator(sdkKey, formId, templateId, usersGroups, userId, collaboratorId) {
|
|
6175
|
+
const data = {
|
|
6176
|
+
form_key: formId,
|
|
6177
|
+
fuser_key: userId,
|
|
6178
|
+
users_groups: usersGroups,
|
|
6179
|
+
template_id: templateId,
|
|
6180
|
+
collaborator_user: collaboratorId,
|
|
6181
|
+
};
|
|
6182
|
+
return (0, utils_1.apiFetch)(sdkKey, `${(0, utils_1.getApiUrl)()}collaborator/invite/`, {
|
|
6183
|
+
headers: { 'Content-Type': 'application/json' },
|
|
6184
|
+
method: 'POST',
|
|
6185
|
+
body: JSON.stringify(data),
|
|
6186
|
+
}, false).then(async (response) => {
|
|
6187
|
+
if (response) {
|
|
6188
|
+
if (response && response.status === 201)
|
|
6189
|
+
return { ok: true, payload: await response.json() };
|
|
6190
|
+
else
|
|
6191
|
+
return { ok: false, error: (await response?.text()) ?? '' };
|
|
6192
|
+
}
|
|
6193
|
+
});
|
|
6194
|
+
}
|
|
6195
|
+
async function sendEmail(sdkKey, userId, formId, templateId, skipPfd = false) {
|
|
6196
|
+
const url = `${(0, utils_1.getApiUrl)()}email/logic-rule/`;
|
|
6197
|
+
const options = {
|
|
6198
|
+
headers: { 'Content-Type': 'application/json' },
|
|
6199
|
+
method: 'POST',
|
|
6200
|
+
body: JSON.stringify({
|
|
6201
|
+
template_id: templateId,
|
|
6202
|
+
form_key: formId,
|
|
6203
|
+
fuser_key: userId,
|
|
6204
|
+
skip_pfd: skipPfd,
|
|
6205
|
+
}),
|
|
6206
|
+
};
|
|
6207
|
+
return await (0, utils_1.apiFetch)(sdkKey, url, options, false);
|
|
6208
|
+
}
|
|
6209
|
+
async function forwardInboxEmail(sdkKey, userId, emailGroup, extractionRunId, emailMessageId, allGroups) {
|
|
6210
|
+
const recipients = allGroups?.find((group) => group.name === emailGroup)?.emails ?? [];
|
|
6211
|
+
const url = `${(0, utils_1.getApiUrl)()}email/forward/`;
|
|
6212
|
+
if (recipients.length === 0) {
|
|
6213
|
+
throw new error_1.ValidationError(`No recipients found for email group: ${emailGroup}`);
|
|
6214
|
+
}
|
|
6215
|
+
const options = {
|
|
6216
|
+
headers: { 'Content-Type': 'application/json' },
|
|
6217
|
+
method: 'POST',
|
|
6218
|
+
body: JSON.stringify({
|
|
6219
|
+
email_message_id: emailMessageId,
|
|
6220
|
+
recipients,
|
|
6221
|
+
extraction_run_id: extractionRunId,
|
|
6222
|
+
user_id: userId,
|
|
6223
|
+
email_group: emailGroup,
|
|
6224
|
+
}),
|
|
6225
|
+
};
|
|
6226
|
+
await (0, utils_1.apiFetch)(sdkKey, url, options);
|
|
6227
|
+
}
|
|
6228
|
+
function runCustomRequest(sdkKey, formId, payload, userId, fieldValues, offlineHandler) {
|
|
6229
|
+
const data = {
|
|
6230
|
+
fuser_key: userId,
|
|
6231
|
+
form_key: formId,
|
|
6232
|
+
name: payload.name,
|
|
6233
|
+
method: payload.method,
|
|
6234
|
+
url: payload.url,
|
|
6235
|
+
user_data: payload.data,
|
|
6236
|
+
headers: payload.headers,
|
|
6237
|
+
field_values: fieldValues,
|
|
6238
|
+
};
|
|
6239
|
+
const url = `${(0, utils_1.getStaticUrl)()}custom_request/`;
|
|
6240
|
+
const options = {
|
|
6241
|
+
headers: { 'Content-Type': 'application/json' },
|
|
6242
|
+
method: 'POST',
|
|
6243
|
+
body: JSON.stringify(data),
|
|
6244
|
+
keepalive: false,
|
|
6245
|
+
};
|
|
6246
|
+
const run = () => (0, utils_1.apiFetch)(sdkKey, url, options).then((response) => (response ? response.json() : Promise.resolve()));
|
|
6247
|
+
if (payload.method === 'GET' || !offlineHandler)
|
|
6248
|
+
return run();
|
|
6249
|
+
return offlineHandler(run, url, options, 'customRequest');
|
|
6250
|
+
}
|
|
6251
|
+
return api$1;
|
|
6252
|
+
}
|
|
6253
|
+
|
|
6254
|
+
var hasRequiredDist$2;
|
|
6255
|
+
|
|
6256
|
+
function requireDist$2 () {
|
|
6257
|
+
if (hasRequiredDist$2) return dist$2;
|
|
6258
|
+
hasRequiredDist$2 = 1;
|
|
6259
|
+
(function (exports$1) {
|
|
6260
|
+
Object.defineProperty(exports$1, "__esModule", { value: true });
|
|
6261
|
+
exports$1.setEnvironment = exports$1.parseAPIError = exports$1.FetchError = exports$1.getS3Url = exports$1.getCdnUrl = exports$1.getStaticUrl = exports$1.getApiUrl = exports$1.createHttpHelpers = exports$1.checkResponseSuccess = exports$1.apiFetch = exports$1.sendEmail = exports$1.pollForCompletion = exports$1.inviteFormCollaborator = exports$1.forwardInboxEmail = exports$1.extractAIDocument = exports$1.customRolloutAction = void 0;
|
|
6262
|
+
var api_1 = requireApi();
|
|
6263
|
+
Object.defineProperty(exports$1, "customRolloutAction", { enumerable: true, get: function () { return api_1.customRolloutAction; } });
|
|
6264
|
+
Object.defineProperty(exports$1, "extractAIDocument", { enumerable: true, get: function () { return api_1.extractAIDocument; } });
|
|
6265
|
+
Object.defineProperty(exports$1, "forwardInboxEmail", { enumerable: true, get: function () { return api_1.forwardInboxEmail; } });
|
|
6266
|
+
Object.defineProperty(exports$1, "inviteFormCollaborator", { enumerable: true, get: function () { return api_1.inviteFormCollaborator; } });
|
|
6267
|
+
Object.defineProperty(exports$1, "pollForCompletion", { enumerable: true, get: function () { return api_1.pollForCompletion; } });
|
|
6268
|
+
Object.defineProperty(exports$1, "sendEmail", { enumerable: true, get: function () { return api_1.sendEmail; } });
|
|
6269
|
+
var utils_1 = requireUtils();
|
|
6270
|
+
Object.defineProperty(exports$1, "apiFetch", { enumerable: true, get: function () { return utils_1.apiFetch; } });
|
|
6271
|
+
Object.defineProperty(exports$1, "checkResponseSuccess", { enumerable: true, get: function () { return utils_1.checkResponseSuccess; } });
|
|
6272
|
+
Object.defineProperty(exports$1, "createHttpHelpers", { enumerable: true, get: function () { return utils_1.createHttpHelpers; } });
|
|
6273
|
+
Object.defineProperty(exports$1, "getApiUrl", { enumerable: true, get: function () { return utils_1.getApiUrl; } });
|
|
6274
|
+
Object.defineProperty(exports$1, "getStaticUrl", { enumerable: true, get: function () { return utils_1.getStaticUrl; } });
|
|
6275
|
+
Object.defineProperty(exports$1, "getCdnUrl", { enumerable: true, get: function () { return utils_1.getCdnUrl; } });
|
|
6276
|
+
Object.defineProperty(exports$1, "getS3Url", { enumerable: true, get: function () { return utils_1.getS3Url; } });
|
|
6277
|
+
var error_1 = requireError();
|
|
6278
|
+
Object.defineProperty(exports$1, "FetchError", { enumerable: true, get: function () { return error_1.FetchError; } });
|
|
6279
|
+
Object.defineProperty(exports$1, "parseAPIError", { enumerable: true, get: function () { return error_1.parseAPIError; } });
|
|
6280
|
+
var setup_1 = requireSetup();
|
|
6281
|
+
Object.defineProperty(exports$1, "setEnvironment", { enumerable: true, get: function () { return setup_1.setEnvironment; } });
|
|
6282
|
+
} (dist$2));
|
|
6283
|
+
return dist$2;
|
|
6284
|
+
}
|
|
6285
|
+
|
|
6286
|
+
var distExports$2 = requireDist$2();
|
|
6287
|
+
|
|
6288
|
+
var SDKKeyError = /** @class */ (function (_super) {
|
|
6289
|
+
__extends(SDKKeyError, _super);
|
|
6290
|
+
function SDKKeyError(message) {
|
|
6291
|
+
if (message === void 0) { message = 'Invalid SDK Key'; }
|
|
6292
|
+
var _this = _super.call(this, message) || this;
|
|
6293
|
+
_this.name = 'SDKKeyError';
|
|
6294
|
+
return _this;
|
|
6295
|
+
}
|
|
6296
|
+
return SDKKeyError;
|
|
6297
|
+
}(Error));
|
|
6298
|
+
var UserIdError = /** @class */ (function (_super) {
|
|
6299
|
+
__extends(UserIdError, _super);
|
|
6300
|
+
function UserIdError() {
|
|
6301
|
+
var _this = _super.call(this, 'Invalid User ID') || this;
|
|
6302
|
+
_this.name = 'UserIdError';
|
|
6303
|
+
return _this;
|
|
6304
|
+
}
|
|
6305
|
+
return UserIdError;
|
|
6306
|
+
}(Error));
|
|
6307
|
+
var handleCustomScriptError = function (e) {
|
|
6308
|
+
var _a, _b;
|
|
6309
|
+
var errorReason = (_a = e.reason) !== null && _a !== void 0 ? _a : e.error;
|
|
6310
|
+
// If stack is at 'eval', it is a logic rule error.
|
|
6311
|
+
// Note this only works for unhandledrejection events, not error events.
|
|
6312
|
+
console.warn('Error caught in custom HTML. Error Message: ', (_b = errorReason.message) !== null && _b !== void 0 ? _b : '');
|
|
6313
|
+
e.stopPropagation();
|
|
6314
|
+
e.preventDefault(); // Prevent the error in the log
|
|
6315
|
+
};
|
|
6316
|
+
var setCustomErrorHandler = function () {
|
|
6317
|
+
featheryWindow().addEventListener('error', handleCustomScriptError);
|
|
6318
|
+
};
|
|
6319
|
+
var removeCustomErrorHandler = function () {
|
|
6320
|
+
featheryWindow().removeEventListener('error', handleCustomScriptError);
|
|
6321
|
+
};
|
|
6322
|
+
|
|
5882
6323
|
var conflictAlertShown = false;
|
|
5883
6324
|
function checkResponseSuccess(response) {
|
|
5884
6325
|
return __awaiter$2(this, void 0, void 0, function () {
|
|
@@ -5907,7 +6348,7 @@ function checkResponseSuccess(response) {
|
|
|
5907
6348
|
console.error(payload.toString());
|
|
5908
6349
|
return [2 /*return*/];
|
|
5909
6350
|
case 4: throw new SDKKeyError();
|
|
5910
|
-
case 5: throw new FetchError("Can't find object");
|
|
6351
|
+
case 5: throw new distExports$2.FetchError("Can't find object");
|
|
5911
6352
|
case 6:
|
|
5912
6353
|
// prevent multiple 409s from displaying multiple alerts
|
|
5913
6354
|
if (conflictAlertShown)
|
|
@@ -5918,8 +6359,8 @@ function checkResponseSuccess(response) {
|
|
|
5918
6359
|
featheryWindow().alert('This form has been updated. Please fill it out again.');
|
|
5919
6360
|
location.reload();
|
|
5920
6361
|
return [2 /*return*/];
|
|
5921
|
-
case 7: throw new FetchError('Internal server error');
|
|
5922
|
-
case 8: throw new FetchError('Unknown error');
|
|
6362
|
+
case 7: throw new distExports$2.FetchError('Internal server error');
|
|
6363
|
+
case 8: throw new distExports$2.FetchError('Unknown error');
|
|
5923
6364
|
}
|
|
5924
6365
|
});
|
|
5925
6366
|
});
|
|
@@ -6870,26 +7311,7 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
6870
7311
|
if (parseResponse === void 0) { parseResponse = true; }
|
|
6871
7312
|
if (propagateNetworkErrors === void 0) { propagateNetworkErrors = false; }
|
|
6872
7313
|
var sdkKey = initInfo().sdkKey;
|
|
6873
|
-
|
|
6874
|
-
var headers = options.headers, otherOptions = __rest$1(options, ["headers"]);
|
|
6875
|
-
options = __assign({ cache: 'no-store',
|
|
6876
|
-
// Write requests must succeed so data is tracked
|
|
6877
|
-
keepalive: ['POST', 'PATCH', 'PUT'].includes(options.method), headers: __assign({ Authorization: 'Token ' + sdkKey }, headers) }, otherOptions);
|
|
6878
|
-
return fetch(url, options)
|
|
6879
|
-
.then(function (response) { return __awaiter$2(_this, void 0, void 0, function () {
|
|
6880
|
-
return __generator(this, function (_a) {
|
|
6881
|
-
switch (_a.label) {
|
|
6882
|
-
case 0:
|
|
6883
|
-
if (!parseResponse) return [3 /*break*/, 2];
|
|
6884
|
-
return [4 /*yield*/, checkResponseSuccess(response)];
|
|
6885
|
-
case 1:
|
|
6886
|
-
_a.sent();
|
|
6887
|
-
_a.label = 2;
|
|
6888
|
-
case 2: return [2 /*return*/, response];
|
|
6889
|
-
}
|
|
6890
|
-
});
|
|
6891
|
-
}); })
|
|
6892
|
-
.catch(function (e) {
|
|
7314
|
+
return distExports$2.apiFetch(sdkKey, url, options, parseResponse).catch(function (e) {
|
|
6893
7315
|
var _a;
|
|
6894
7316
|
// Ignore TypeErrors if form has redirected because `fetch` in
|
|
6895
7317
|
// Safari will error after redirect
|
|
@@ -6920,7 +7342,7 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
6920
7342
|
payload = _a.sent();
|
|
6921
7343
|
if ((res === null || res === void 0 ? void 0 : res.status) === 200)
|
|
6922
7344
|
return [2 /*return*/, { token: payload.link_token }];
|
|
6923
|
-
return [2 /*return*/, { err:
|
|
7345
|
+
return [2 /*return*/, { err: distExports$2.parseAPIError(payload) || 'Ran into an error' }];
|
|
6924
7346
|
}
|
|
6925
7347
|
});
|
|
6926
7348
|
});
|
|
@@ -7194,7 +7616,7 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
7194
7616
|
case 1: return [2 /*return*/, _c.sent()];
|
|
7195
7617
|
case 2:
|
|
7196
7618
|
_a = Error;
|
|
7197
|
-
_b =
|
|
7619
|
+
_b = distExports$2.parseAPIError;
|
|
7198
7620
|
return [4 /*yield*/, response.json()];
|
|
7199
7621
|
case 3: throw _a.apply(void 0, [_b.apply(void 0, [_c.sent()])]);
|
|
7200
7622
|
case 4: return [2 /*return*/];
|
|
@@ -7233,7 +7655,7 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
7233
7655
|
case 1: return [2 /*return*/, _c.sent()];
|
|
7234
7656
|
case 2:
|
|
7235
7657
|
_a = Error;
|
|
7236
|
-
_b =
|
|
7658
|
+
_b = distExports$2.parseAPIError;
|
|
7237
7659
|
return [4 /*yield*/, response.json()];
|
|
7238
7660
|
case 3: throw _a.apply(void 0, [_b.apply(void 0, [_c.sent()])]);
|
|
7239
7661
|
case 4: return [2 /*return*/];
|
|
@@ -7271,7 +7693,7 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
7271
7693
|
case 1: return [2 /*return*/, _c.sent()];
|
|
7272
7694
|
case 2:
|
|
7273
7695
|
_a = Error;
|
|
7274
|
-
_b =
|
|
7696
|
+
_b = distExports$2.parseAPIError;
|
|
7275
7697
|
return [4 /*yield*/, response.json()];
|
|
7276
7698
|
case 3: throw _a.apply(void 0, [_b.apply(void 0, [_c.sent()])]);
|
|
7277
7699
|
case 4: return [2 /*return*/];
|
|
@@ -7281,66 +7703,10 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
7281
7703
|
});
|
|
7282
7704
|
});
|
|
7283
7705
|
};
|
|
7284
|
-
IntegrationClient.prototype.pollForCompletion = function (_a) {
|
|
7285
|
-
var pollUrl = _a.pollUrl, checkInterval = _a.checkInterval, maxTime = _a.maxTime, onStatusUpdate = _a.onStatusUpdate, _b = _a.operationName, operationName = _b === void 0 ? 'Operation' : _b;
|
|
7286
|
-
return __awaiter$2(this, void 0, void 0, function () {
|
|
7287
|
-
var _this = this;
|
|
7288
|
-
return __generator(this, function (_c) {
|
|
7289
|
-
return [2 /*return*/, new Promise(function (resolve) {
|
|
7290
|
-
var attempts = 0;
|
|
7291
|
-
var maxAttempts = maxTime / checkInterval;
|
|
7292
|
-
var checkCompletion = function () { return __awaiter$2(_this, void 0, void 0, function () {
|
|
7293
|
-
var response, data, message, message;
|
|
7294
|
-
return __generator(this, function (_a) {
|
|
7295
|
-
switch (_a.label) {
|
|
7296
|
-
case 0: return [4 /*yield*/, this._fetch(pollUrl, {}, false)];
|
|
7297
|
-
case 1:
|
|
7298
|
-
response = _a.sent();
|
|
7299
|
-
if (!response)
|
|
7300
|
-
return [2 /*return*/];
|
|
7301
|
-
return [4 /*yield*/, response.json()];
|
|
7302
|
-
case 2:
|
|
7303
|
-
data = _a.sent();
|
|
7304
|
-
if (onStatusUpdate) {
|
|
7305
|
-
onStatusUpdate(data);
|
|
7306
|
-
}
|
|
7307
|
-
if (response.ok) {
|
|
7308
|
-
if (data.status === 'complete') {
|
|
7309
|
-
return [2 /*return*/, resolve(data)];
|
|
7310
|
-
}
|
|
7311
|
-
else {
|
|
7312
|
-
attempts += 1;
|
|
7313
|
-
if (attempts < maxAttempts) {
|
|
7314
|
-
setTimeout(checkCompletion, checkInterval);
|
|
7315
|
-
}
|
|
7316
|
-
else {
|
|
7317
|
-
message = "".concat(operationName, " took too long...");
|
|
7318
|
-
console.error(message);
|
|
7319
|
-
return [2 /*return*/, resolve({ status: 'error', message: message })];
|
|
7320
|
-
}
|
|
7321
|
-
}
|
|
7322
|
-
}
|
|
7323
|
-
else {
|
|
7324
|
-
message = parseError(data);
|
|
7325
|
-
console.error(message);
|
|
7326
|
-
if (onStatusUpdate) {
|
|
7327
|
-
onStatusUpdate({ error: message });
|
|
7328
|
-
}
|
|
7329
|
-
return [2 /*return*/, resolve({ status: 'error', message: message })];
|
|
7330
|
-
}
|
|
7331
|
-
return [2 /*return*/];
|
|
7332
|
-
}
|
|
7333
|
-
});
|
|
7334
|
-
}); };
|
|
7335
|
-
setTimeout(checkCompletion, checkInterval);
|
|
7336
|
-
})];
|
|
7337
|
-
});
|
|
7338
|
-
});
|
|
7339
|
-
};
|
|
7340
7706
|
IntegrationClient.prototype.generateEnvelopes = function (action) {
|
|
7341
7707
|
var _this = this;
|
|
7342
7708
|
var _a, _b, _c;
|
|
7343
|
-
var
|
|
7709
|
+
var _d = initInfo(), userId = _d.userId, sdkKey = _d.sdkKey;
|
|
7344
7710
|
var signer = fieldValues[action.envelope_signer_field_key];
|
|
7345
7711
|
var runAsync = (_a = action.run_async) !== null && _a !== void 0 ? _a : true;
|
|
7346
7712
|
var documents = (_b = action.documents) !== null && _b !== void 0 ? _b : [];
|
|
@@ -7371,14 +7737,9 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
7371
7737
|
if (!runAsync || data.files)
|
|
7372
7738
|
return [2 /*return*/, data];
|
|
7373
7739
|
pollUrl = "".concat(API_URL, "document/form/generate/poll/?fid=").concat(userId, "&dids=").concat(documents);
|
|
7374
|
-
return [4 /*yield*/,
|
|
7375
|
-
pollUrl: pollUrl,
|
|
7376
|
-
checkInterval: this.ENVELOPE_CHECK_INTERVAL,
|
|
7377
|
-
maxTime: this.ENVELOPE_MAX_TIME,
|
|
7378
|
-
operationName: 'Envelope generation'
|
|
7379
|
-
})];
|
|
7740
|
+
return [4 /*yield*/, distExports$2.pollForCompletion(sdkKey, pollUrl, this.ENVELOPE_CHECK_INTERVAL, this.ENVELOPE_MAX_TIME, 'Envelope generation')];
|
|
7380
7741
|
case 2: return [2 /*return*/, _a.sent()];
|
|
7381
|
-
case 3: throw Error(
|
|
7742
|
+
case 3: throw Error(distExports$2.parseAPIError(data));
|
|
7382
7743
|
case 4: return [2 /*return*/];
|
|
7383
7744
|
}
|
|
7384
7745
|
});
|
|
@@ -7422,7 +7783,7 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
7422
7783
|
case 1: return [2 /*return*/, _c.sent()];
|
|
7423
7784
|
case 2:
|
|
7424
7785
|
_a = Error;
|
|
7425
|
-
_b =
|
|
7786
|
+
_b = distExports$2.parseAPIError;
|
|
7426
7787
|
return [4 /*yield*/, response.json()];
|
|
7427
7788
|
case 3: throw _a.apply(void 0, [_b.apply(void 0, [_c.sent()])]);
|
|
7428
7789
|
case 4: return [2 /*return*/];
|
|
@@ -7444,7 +7805,7 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
7444
7805
|
if (!((response === null || response === void 0 ? void 0 : response.status) === 400)) return [3 /*break*/, 3];
|
|
7445
7806
|
_a = resolve;
|
|
7446
7807
|
_c = {};
|
|
7447
|
-
_b =
|
|
7808
|
+
_b = distExports$2.parseAPIError;
|
|
7448
7809
|
return [4 /*yield*/, response.json()];
|
|
7449
7810
|
case 2: return [2 /*return*/, _a.apply(void 0, [(_c.error = _b.apply(void 0, [_d.sent()]), _c)])];
|
|
7450
7811
|
case 3:
|
|
@@ -7526,7 +7887,7 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
7526
7887
|
return [4 /*yield*/, response.json()];
|
|
7527
7888
|
case 2:
|
|
7528
7889
|
errorData = _a.sent();
|
|
7529
|
-
return [2 /*return*/, resolve({ error:
|
|
7890
|
+
return [2 /*return*/, resolve({ error: distExports$2.parseAPIError(errorData) })];
|
|
7530
7891
|
case 3:
|
|
7531
7892
|
if (!((response === null || response === void 0 ? void 0 : response.status) === 200)) return [3 /*break*/, 5];
|
|
7532
7893
|
return [4 /*yield*/, response.json()];
|
|
@@ -7621,7 +7982,7 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
7621
7982
|
return [2 /*return*/, finalStatus];
|
|
7622
7983
|
case 6:
|
|
7623
7984
|
_b = Error;
|
|
7624
|
-
_c =
|
|
7985
|
+
_c = distExports$2.parseAPIError;
|
|
7625
7986
|
return [4 /*yield*/, finalResponse.json()];
|
|
7626
7987
|
case 7: throw _b.apply(void 0, [_c.apply(void 0, [_d.sent()])]);
|
|
7627
7988
|
case 8: return [2 /*return*/, false];
|
|
@@ -7710,7 +8071,7 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
7710
8071
|
return [2 /*return*/, otpStatus];
|
|
7711
8072
|
case 3:
|
|
7712
8073
|
_a = Error;
|
|
7713
|
-
_b =
|
|
8074
|
+
_b = distExports$2.parseAPIError;
|
|
7714
8075
|
return [4 /*yield*/, response.json()];
|
|
7715
8076
|
case 4: throw _a.apply(void 0, [_b.apply(void 0, [_c.sent()])]);
|
|
7716
8077
|
case 5: return [2 /*return*/];
|
|
@@ -7720,24 +8081,14 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
7720
8081
|
};
|
|
7721
8082
|
IntegrationClient.prototype.sendEmail = function (templateId) {
|
|
7722
8083
|
return __awaiter$2(this, void 0, void 0, function () {
|
|
7723
|
-
var
|
|
7724
|
-
return __generator(this, function (
|
|
7725
|
-
switch (
|
|
8084
|
+
var _a, userId, sdkKey;
|
|
8085
|
+
return __generator(this, function (_b) {
|
|
8086
|
+
switch (_b.label) {
|
|
7726
8087
|
case 0:
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
options = {
|
|
7730
|
-
headers: { 'Content-Type': 'application/json' },
|
|
7731
|
-
method: 'POST',
|
|
7732
|
-
body: JSON.stringify({
|
|
7733
|
-
template_id: templateId,
|
|
7734
|
-
form_key: this.formKey,
|
|
7735
|
-
fuser_key: userId
|
|
7736
|
-
})
|
|
7737
|
-
};
|
|
7738
|
-
return [4 /*yield*/, this._fetch(url, options, false)];
|
|
8088
|
+
_a = initInfo(), userId = _a.userId, sdkKey = _a.sdkKey;
|
|
8089
|
+
return [4 /*yield*/, distExports$2.sendEmail(sdkKey, userId !== null && userId !== void 0 ? userId : '', this.formKey, templateId)];
|
|
7739
8090
|
case 1:
|
|
7740
|
-
|
|
8091
|
+
_b.sent();
|
|
7741
8092
|
return [2 /*return*/];
|
|
7742
8093
|
}
|
|
7743
8094
|
});
|
|
@@ -7879,43 +8230,16 @@ var IntegrationClient = /** @class */ (function () {
|
|
|
7879
8230
|
});
|
|
7880
8231
|
};
|
|
7881
8232
|
IntegrationClient.prototype.customRolloutAction = function (automationIds, options) {
|
|
7882
|
-
var _a, _b, _c;
|
|
7883
8233
|
return __awaiter$2(this, void 0, void 0, function () {
|
|
7884
|
-
var
|
|
7885
|
-
|
|
7886
|
-
|
|
7887
|
-
switch (_f.label) {
|
|
8234
|
+
var _a, userId, sdkKey;
|
|
8235
|
+
return __generator(this, function (_b) {
|
|
8236
|
+
switch (_b.label) {
|
|
7888
8237
|
case 0:
|
|
7889
|
-
|
|
7890
|
-
url = "".concat(API_URL, "rollout/custom-trigger/");
|
|
7891
|
-
if (typeof automationIds === 'string')
|
|
7892
|
-
automationIds = [automationIds];
|
|
7893
|
-
reqOptions = {
|
|
7894
|
-
headers: { 'Content-Type': 'application/json' },
|
|
7895
|
-
method: 'POST',
|
|
7896
|
-
body: JSON.stringify({
|
|
7897
|
-
automation_ids: automationIds,
|
|
7898
|
-
sync: (_a = options.waitForCompletion) !== null && _a !== void 0 ? _a : true,
|
|
7899
|
-
multiple: (_b = options.multiple) !== null && _b !== void 0 ? _b : false,
|
|
7900
|
-
payload: fieldValues,
|
|
7901
|
-
form_key: this.formKey,
|
|
7902
|
-
fuser_key: userId
|
|
7903
|
-
})
|
|
7904
|
-
};
|
|
8238
|
+
_a = initInfo(), userId = _a.userId, sdkKey = _a.sdkKey;
|
|
7905
8239
|
return [4 /*yield*/, this.submitQueue];
|
|
7906
8240
|
case 1:
|
|
7907
|
-
|
|
7908
|
-
return [
|
|
7909
|
-
case 2:
|
|
7910
|
-
res = _f.sent();
|
|
7911
|
-
if (!(res && res.status === 200)) return [3 /*break*/, 4];
|
|
7912
|
-
_d = { ok: true };
|
|
7913
|
-
return [4 /*yield*/, res.json()];
|
|
7914
|
-
case 3: return [2 /*return*/, (_d.payload = _f.sent(), _d)];
|
|
7915
|
-
case 4:
|
|
7916
|
-
_e = { ok: false };
|
|
7917
|
-
return [4 /*yield*/, (res === null || res === void 0 ? void 0 : res.text())];
|
|
7918
|
-
case 5: return [2 /*return*/, (_e.error = (_c = (_f.sent())) !== null && _c !== void 0 ? _c : '', _e)];
|
|
8241
|
+
_b.sent();
|
|
8242
|
+
return [2 /*return*/, distExports$2.customRolloutAction(sdkKey, automationIds, this.formKey, fieldValues, options, userId)];
|
|
7919
8243
|
}
|
|
7920
8244
|
});
|
|
7921
8245
|
});
|
|
@@ -42254,66 +42578,28 @@ function loadQRScanner() {
|
|
|
42254
42578
|
qrPromise = dynamicImport(QR_SCANNER_LIB_URL);
|
|
42255
42579
|
}
|
|
42256
42580
|
|
|
42257
|
-
|
|
42258
|
-
local: 'http://localhost:8006/api/',
|
|
42259
|
-
staging: 'https://staging.feathery.io/api/',
|
|
42260
|
-
production: 'https://api.feathery.io/api/',
|
|
42261
|
-
productionAU: 'https://api-au.feathery.io/api/',
|
|
42262
|
-
productionEU: 'https://api-eu.feathery.io/api/',
|
|
42263
|
-
productionCA: 'https://api-ca.feathery.io/api/'
|
|
42264
|
-
};
|
|
42265
|
-
var CDN_URL_OPTIONS = {
|
|
42266
|
-
local: 'http://localhost:8006/api/',
|
|
42267
|
-
staging: 'https://staging.feathery.io/api/',
|
|
42268
|
-
production: 'https://cdn.feathery.io/api/',
|
|
42269
|
-
productionAU: 'https://cdn-au.feathery.io/api/',
|
|
42270
|
-
productionEU: 'https://cdn-eu.feathery.io/api/',
|
|
42271
|
-
productionCA: 'https://cdn-ca.feathery.io/api/'
|
|
42272
|
-
};
|
|
42273
|
-
var STATIC_URL_OPTIONS = {
|
|
42274
|
-
local: 'http://localhost:8006/api/',
|
|
42275
|
-
staging: 'https://staging.feathery.io/api/',
|
|
42276
|
-
production: 'https://api-static-2.feathery.io/api/',
|
|
42277
|
-
productionAU: 'https://api-au.feathery.io/api/',
|
|
42278
|
-
productionEU: 'https://api-eu.feathery.io/api/',
|
|
42279
|
-
productionCA: 'https://api-ca.feathery.io/api/'
|
|
42280
|
-
};
|
|
42281
|
-
var S3_URL_OPTIONS = {
|
|
42282
|
-
local: 'http://localhost:8006',
|
|
42283
|
-
staging: 's3.us-west-1.amazonaws.com',
|
|
42284
|
-
production: 's3.us-west-1.amazonaws.com',
|
|
42285
|
-
productionAU: 's3.ap-southeast-2.amazonaws.com',
|
|
42286
|
-
productionEU: 's3.eu-west-1.amazonaws.com',
|
|
42287
|
-
productionCA: 's3.ca-central-1.amazonaws.com'
|
|
42288
|
-
};
|
|
42289
|
-
var environment = 'production';
|
|
42581
|
+
distExports$2.setEnvironment('production');
|
|
42290
42582
|
try {
|
|
42291
|
-
|
|
42583
|
+
distExports$2.setEnvironment((process.env.BACKEND_ENV || 'production'));
|
|
42292
42584
|
}
|
|
42293
42585
|
catch (e) { } // process.env won't exist in production build
|
|
42294
|
-
var API_URL =
|
|
42295
|
-
var CDN_URL =
|
|
42296
|
-
var STATIC_URL =
|
|
42297
|
-
var S3_URL =
|
|
42586
|
+
var API_URL = distExports$2.getApiUrl();
|
|
42587
|
+
var CDN_URL = distExports$2.getCdnUrl();
|
|
42588
|
+
var STATIC_URL = distExports$2.getStaticUrl();
|
|
42589
|
+
var S3_URL = distExports$2.getS3Url();
|
|
42298
42590
|
var updateRegionApiUrls = function (region) {
|
|
42299
|
-
|
|
42300
|
-
|
|
42301
|
-
|
|
42302
|
-
|
|
42303
|
-
|
|
42304
|
-
|
|
42305
|
-
|
|
42306
|
-
|
|
42307
|
-
|
|
42308
|
-
|
|
42309
|
-
|
|
42310
|
-
|
|
42311
|
-
else if (region === 'ca') {
|
|
42312
|
-
CDN_URL = CDN_URL_OPTIONS.productionCA;
|
|
42313
|
-
API_URL = API_URL_OPTIONS.productionCA;
|
|
42314
|
-
STATIC_URL = STATIC_URL_OPTIONS.productionCA;
|
|
42315
|
-
S3_URL = S3_URL_OPTIONS.productionCA;
|
|
42316
|
-
}
|
|
42591
|
+
var environmentMap = {
|
|
42592
|
+
au: 'productionAU',
|
|
42593
|
+
ca: 'productionCA',
|
|
42594
|
+
eu: 'productionEU'
|
|
42595
|
+
};
|
|
42596
|
+
if (!environmentMap[region])
|
|
42597
|
+
return;
|
|
42598
|
+
distExports$2.setEnvironment(environmentMap[region]);
|
|
42599
|
+
API_URL = distExports$2.getApiUrl();
|
|
42600
|
+
CDN_URL = distExports$2.getCdnUrl();
|
|
42601
|
+
STATIC_URL = distExports$2.getStaticUrl();
|
|
42602
|
+
S3_URL = distExports$2.getS3Url();
|
|
42317
42603
|
};
|
|
42318
42604
|
/**
|
|
42319
42605
|
* The number of milliseconds waited until another submitCustom call
|
|
@@ -43121,39 +43407,6 @@ var FeatheryClient = /** @class */ (function (_super) {
|
|
|
43121
43407
|
});
|
|
43122
43408
|
});
|
|
43123
43409
|
};
|
|
43124
|
-
// Logic custom APIs
|
|
43125
|
-
FeatheryClient.prototype.runCustomRequest = function (payload, fieldValues) {
|
|
43126
|
-
var _this = this;
|
|
43127
|
-
if (fieldValues === void 0) { fieldValues = null; }
|
|
43128
|
-
var userId = initInfo().userId;
|
|
43129
|
-
var data = {
|
|
43130
|
-
fuser_key: userId,
|
|
43131
|
-
form_key: this.formKey,
|
|
43132
|
-
name: payload.name,
|
|
43133
|
-
method: payload.method,
|
|
43134
|
-
url: payload.url,
|
|
43135
|
-
user_data: payload.data,
|
|
43136
|
-
headers: payload.headers
|
|
43137
|
-
};
|
|
43138
|
-
if (fieldValues) {
|
|
43139
|
-
data.field_values = fieldValues;
|
|
43140
|
-
}
|
|
43141
|
-
var url = "".concat(STATIC_URL, "custom_request/");
|
|
43142
|
-
var options = {
|
|
43143
|
-
headers: { 'Content-Type': 'application/json' },
|
|
43144
|
-
method: 'POST',
|
|
43145
|
-
body: JSON.stringify(data),
|
|
43146
|
-
keepalive: false
|
|
43147
|
-
};
|
|
43148
|
-
var run = function () {
|
|
43149
|
-
return _this._fetch(url, options).then(function (response) {
|
|
43150
|
-
return response ? response.json() : Promise.resolve();
|
|
43151
|
-
});
|
|
43152
|
-
};
|
|
43153
|
-
if (payload.method === 'GET')
|
|
43154
|
-
return run();
|
|
43155
|
-
return this.offlineRequestHandler.runOrSaveRequest(run, url, options, 'customRequest');
|
|
43156
|
-
};
|
|
43157
43410
|
FeatheryClient.prototype.runServerSideLogicRule = function (id) {
|
|
43158
43411
|
var userId = initInfo().userId;
|
|
43159
43412
|
var data = {
|
|
@@ -43176,54 +43429,13 @@ var FeatheryClient = /** @class */ (function (_super) {
|
|
|
43176
43429
|
FeatheryClient.prototype.runAIExtraction = function (_a) {
|
|
43177
43430
|
var extractionId = _a.extractionId, options = _a.options, pages = _a.pages, setPollFuserData = _a.setPollFuserData, onStatusUpdate = _a.onStatusUpdate;
|
|
43178
43431
|
return __awaiter$2(this, void 0, void 0, function () {
|
|
43179
|
-
var
|
|
43432
|
+
var _b, userId, sdkKey, collaboratorId;
|
|
43180
43433
|
return __generator(this, function (_c) {
|
|
43181
43434
|
switch (_c.label) {
|
|
43182
43435
|
case 0:
|
|
43183
|
-
|
|
43184
|
-
|
|
43185
|
-
|
|
43186
|
-
variantId = options.variantId;
|
|
43187
|
-
meetingUrl = options.meetingUrl || undefined;
|
|
43188
|
-
}
|
|
43189
|
-
else {
|
|
43190
|
-
// deprecated usage, options is waitForCompletion
|
|
43191
|
-
runAsync = !options;
|
|
43192
|
-
}
|
|
43193
|
-
_b = initInfo(), userId = _b.userId, collaboratorId = _b.collaboratorId;
|
|
43194
|
-
data = {
|
|
43195
|
-
fuser_key: userId,
|
|
43196
|
-
collaborator_user: collaboratorId,
|
|
43197
|
-
extraction_id: extractionId,
|
|
43198
|
-
extraction_variant_id: variantId,
|
|
43199
|
-
pages: pages,
|
|
43200
|
-
meeting_url: meetingUrl
|
|
43201
|
-
};
|
|
43202
|
-
return [4 /*yield*/, this._fetch("".concat(STATIC_URL, "ai/vision/"), {
|
|
43203
|
-
headers: { 'Content-Type': 'application/json' },
|
|
43204
|
-
method: 'POST',
|
|
43205
|
-
body: JSON.stringify(data)
|
|
43206
|
-
})];
|
|
43207
|
-
case 1:
|
|
43208
|
-
res = _c.sent();
|
|
43209
|
-
return [4 /*yield*/, (res === null || res === void 0 ? void 0 : res.json())];
|
|
43210
|
-
case 2:
|
|
43211
|
-
response = _c.sent();
|
|
43212
|
-
if (runAsync)
|
|
43213
|
-
return [2 /*return*/, {}];
|
|
43214
|
-
if (response.meeting_info) {
|
|
43215
|
-
setPollFuserData(true);
|
|
43216
|
-
return [2 /*return*/, {}];
|
|
43217
|
-
}
|
|
43218
|
-
pollUrl = "".concat(STATIC_URL, "ai/vision/completion/?fid=").concat(userId, "&eid=").concat(extractionId, "&evid=").concat(variantId !== null && variantId !== void 0 ? variantId : '');
|
|
43219
|
-
return [4 /*yield*/, this.pollForCompletion({
|
|
43220
|
-
pollUrl: pollUrl,
|
|
43221
|
-
checkInterval: this.AI_CHECK_INTERVAL,
|
|
43222
|
-
maxTime: this.AI_MAX_TIME,
|
|
43223
|
-
onStatusUpdate: onStatusUpdate,
|
|
43224
|
-
operationName: 'Extraction'
|
|
43225
|
-
})];
|
|
43226
|
-
case 3: return [2 /*return*/, _c.sent()];
|
|
43436
|
+
_b = initInfo(), userId = _b.userId, sdkKey = _b.sdkKey, collaboratorId = _b.collaboratorId;
|
|
43437
|
+
return [4 /*yield*/, distExports$2.extractAIDocument(sdkKey, extractionId, options, userId, pages, undefined, collaboratorId, function () { return setPollFuserData === null || setPollFuserData === void 0 ? void 0 : setPollFuserData(true); }, onStatusUpdate)];
|
|
43438
|
+
case 1: return [2 /*return*/, _c.sent()];
|
|
43227
43439
|
}
|
|
43228
43440
|
});
|
|
43229
43441
|
});
|
|
@@ -43273,41 +43485,20 @@ var FeatheryClient = /** @class */ (function (_super) {
|
|
|
43273
43485
|
};
|
|
43274
43486
|
FeatheryClient.prototype.inviteCollaborator = function (usersGroups, templateId) {
|
|
43275
43487
|
return __awaiter$2(this, void 0, void 0, function () {
|
|
43276
|
-
var _a, userId, collaboratorId,
|
|
43277
|
-
var _this = this;
|
|
43488
|
+
var _a, userId, collaboratorId, sdkKey, res;
|
|
43278
43489
|
return __generator(this, function (_b) {
|
|
43279
|
-
|
|
43280
|
-
|
|
43281
|
-
|
|
43282
|
-
|
|
43283
|
-
|
|
43284
|
-
|
|
43285
|
-
|
|
43286
|
-
|
|
43287
|
-
|
|
43288
|
-
|
|
43289
|
-
|
|
43290
|
-
|
|
43291
|
-
method: 'POST',
|
|
43292
|
-
body: JSON.stringify(data)
|
|
43293
|
-
}, false).then(function (response) { return __awaiter$2(_this, void 0, void 0, function () {
|
|
43294
|
-
var _a, _b;
|
|
43295
|
-
return __generator(this, function (_c) {
|
|
43296
|
-
switch (_c.label) {
|
|
43297
|
-
case 0:
|
|
43298
|
-
if (!response) return [3 /*break*/, 4];
|
|
43299
|
-
if (!response.ok) return [3 /*break*/, 2];
|
|
43300
|
-
return [4 /*yield*/, response.json()];
|
|
43301
|
-
case 1: return [2 /*return*/, _c.sent()];
|
|
43302
|
-
case 2:
|
|
43303
|
-
_a = Error;
|
|
43304
|
-
_b = parseError;
|
|
43305
|
-
return [4 /*yield*/, response.json()];
|
|
43306
|
-
case 3: throw _a.apply(void 0, [_b.apply(void 0, [_c.sent()])]);
|
|
43307
|
-
case 4: return [2 /*return*/];
|
|
43308
|
-
}
|
|
43309
|
-
});
|
|
43310
|
-
}); })];
|
|
43490
|
+
switch (_b.label) {
|
|
43491
|
+
case 0:
|
|
43492
|
+
_a = initInfo(), userId = _a.userId, collaboratorId = _a.collaboratorId, sdkKey = _a.sdkKey;
|
|
43493
|
+
return [4 /*yield*/, distExports$2.inviteFormCollaborator(sdkKey, this.formKey, templateId, usersGroups, userId, collaboratorId)];
|
|
43494
|
+
case 1:
|
|
43495
|
+
res = _b.sent();
|
|
43496
|
+
if (res && res.ok) {
|
|
43497
|
+
return [2 /*return*/, res];
|
|
43498
|
+
}
|
|
43499
|
+
else
|
|
43500
|
+
throw Error(distExports$2.parseAPIError(res));
|
|
43501
|
+
}
|
|
43311
43502
|
});
|
|
43312
43503
|
});
|
|
43313
43504
|
};
|
|
@@ -43341,7 +43532,7 @@ var FeatheryClient = /** @class */ (function (_super) {
|
|
|
43341
43532
|
case 1: return [2 /*return*/, _c.sent()];
|
|
43342
43533
|
case 2:
|
|
43343
43534
|
_a = Error;
|
|
43344
|
-
_b =
|
|
43535
|
+
_b = distExports$2.parseAPIError;
|
|
43345
43536
|
return [4 /*yield*/, response.json()];
|
|
43346
43537
|
case 3: throw _a.apply(void 0, [_b.apply(void 0, [_c.sent()])]);
|
|
43347
43538
|
case 4: return [2 /*return*/];
|
|
@@ -43378,7 +43569,7 @@ var FeatheryClient = /** @class */ (function (_super) {
|
|
|
43378
43569
|
case 1: return [2 /*return*/, _c.sent()];
|
|
43379
43570
|
case 2:
|
|
43380
43571
|
_a = Error;
|
|
43381
|
-
_b =
|
|
43572
|
+
_b = distExports$2.parseAPIError;
|
|
43382
43573
|
return [4 /*yield*/, response.json()];
|
|
43383
43574
|
case 3: throw _a.apply(void 0, [_b.apply(void 0, [_c.sent()])]);
|
|
43384
43575
|
case 4: return [2 /*return*/];
|
|
@@ -43424,7 +43615,7 @@ var FeatheryClient = /** @class */ (function (_super) {
|
|
|
43424
43615
|
case 3: return [2 /*return*/, { files: files }];
|
|
43425
43616
|
case 4:
|
|
43426
43617
|
_a = Error;
|
|
43427
|
-
_b =
|
|
43618
|
+
_b = distExports$2.parseAPIError;
|
|
43428
43619
|
return [4 /*yield*/, response.json()];
|
|
43429
43620
|
case 5: throw _a.apply(void 0, [_b.apply(void 0, [_c.sent()])]);
|
|
43430
43621
|
case 6: return [2 /*return*/];
|
|
@@ -43540,9 +43731,9 @@ function init(sdkKey, options) {
|
|
|
43540
43731
|
if (runningInClient()) {
|
|
43541
43732
|
// Dynamically load libraries that must be client side
|
|
43542
43733
|
global.scriptjsLoadPromise = import(
|
|
43543
|
-
/* webpackChunkName: "scriptjs" */ './fthry_script.
|
|
43734
|
+
/* webpackChunkName: "scriptjs" */ './fthry_script.BM2vGrj6.js').then(function (n) { return n.s; });
|
|
43544
43735
|
global.webfontloaderPromise = import(
|
|
43545
|
-
/* webpackChunkName: "webfontloader" */ './fthry_webfontloader.
|
|
43736
|
+
/* webpackChunkName: "webfontloader" */ './fthry_webfontloader.Bg-Ggiji.js').then(function (n) { return n.w; });
|
|
43546
43737
|
// Client-side tracking logic
|
|
43547
43738
|
if (initState.userTracking === 'cookie') {
|
|
43548
43739
|
var cookieKey = "feathery-user-id-".concat(sdkKey);
|
|
@@ -43688,7 +43879,7 @@ function getFieldValues() {
|
|
|
43688
43879
|
return __assign({}, fieldValues);
|
|
43689
43880
|
}
|
|
43690
43881
|
function logFeatheryBadge() {
|
|
43691
|
-
console.log('%c Feathery %c v' + "2.
|
|
43882
|
+
console.log('%c Feathery %c v' + "2.12.0" + ' ', // replaced with real version during build
|
|
43692
43883
|
'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;');
|
|
43693
43884
|
}
|
|
43694
43885
|
|
|
@@ -44035,63 +44226,13 @@ function isElementInViewport(el) {
|
|
|
44035
44226
|
rect.right <= width);
|
|
44036
44227
|
}
|
|
44037
44228
|
function httpHelpers(client, connectorFields) {
|
|
44038
|
-
var _this = this;
|
|
44039
44229
|
if (connectorFields === void 0) { connectorFields = []; }
|
|
44040
|
-
var
|
|
44041
|
-
|
|
44042
|
-
|
|
44043
|
-
|
|
44044
|
-
|
|
44045
|
-
|
|
44046
|
-
'POST',
|
|
44047
|
-
'post',
|
|
44048
|
-
'PUT',
|
|
44049
|
-
'put',
|
|
44050
|
-
'DELETE',
|
|
44051
|
-
'delete'
|
|
44052
|
-
].forEach(function (method) {
|
|
44053
|
-
return (helpers[method] = function (url, data, headers) { return __awaiter$2(_this, void 0, void 0, function () {
|
|
44054
|
-
var response;
|
|
44055
|
-
return __generator(this, function (_a) {
|
|
44056
|
-
switch (_a.label) {
|
|
44057
|
-
case 0:
|
|
44058
|
-
if (!url)
|
|
44059
|
-
return [2 /*return*/, {}];
|
|
44060
|
-
return [4 /*yield*/, client.runCustomRequest({ method: method.toUpperCase(), url: url, data: data, headers: headers }, getConnectorFieldValues(connectorFields))];
|
|
44061
|
-
case 1:
|
|
44062
|
-
response = _a.sent();
|
|
44063
|
-
return [2 /*return*/, {
|
|
44064
|
-
data: response.data,
|
|
44065
|
-
statusCode: response.status_code,
|
|
44066
|
-
// status_code for backwards compatibility
|
|
44067
|
-
status_code: response.statusCode
|
|
44068
|
-
}];
|
|
44069
|
-
}
|
|
44070
|
-
});
|
|
44071
|
-
}); });
|
|
44072
|
-
});
|
|
44073
|
-
helpers.connect = function (name, data, headers) { return __awaiter$2(_this, void 0, void 0, function () {
|
|
44074
|
-
var response;
|
|
44075
|
-
return __generator(this, function (_a) {
|
|
44076
|
-
switch (_a.label) {
|
|
44077
|
-
case 0:
|
|
44078
|
-
if (!name)
|
|
44079
|
-
return [2 /*return*/, {}];
|
|
44080
|
-
return [4 /*yield*/, client.runCustomRequest({ name: name, data: data, headers: headers }, getConnectorFieldValues(connectorFields))];
|
|
44081
|
-
case 1:
|
|
44082
|
-
response = _a.sent();
|
|
44083
|
-
if (response === null || response === void 0 ? void 0 : response.field_values)
|
|
44084
|
-
// skip server submit when setting field values here
|
|
44085
|
-
// because these values were just created on the server
|
|
44086
|
-
setFieldValues(response === null || response === void 0 ? void 0 : response.field_values, true, true);
|
|
44087
|
-
return [2 /*return*/, {
|
|
44088
|
-
data: response.data,
|
|
44089
|
-
statusCode: response.status_code
|
|
44090
|
-
}];
|
|
44091
|
-
}
|
|
44092
|
-
});
|
|
44093
|
-
}); };
|
|
44094
|
-
return helpers;
|
|
44230
|
+
var _a = initInfo(), sdkKey = _a.sdkKey, userId = _a.userId;
|
|
44231
|
+
return distExports$2.createHttpHelpers(sdkKey, client.formKey, userId, getConnectorFieldValues(connectorFields), function (fieldValues) {
|
|
44232
|
+
// skip server submit when setting field values here
|
|
44233
|
+
// because these values were just created on the server
|
|
44234
|
+
setFieldValues(fieldValues, true, true);
|
|
44235
|
+
}, client.offlineRequestHandler.runOrSaveRequest.bind(client.offlineRequestHandler));
|
|
44095
44236
|
}
|
|
44096
44237
|
|
|
44097
44238
|
function runningInClient() {
|
|
@@ -45160,39 +45301,39 @@ breakpoint) {
|
|
|
45160
45301
|
return styles.getTarget('inner-container', undefined, viewport === 'mobile');
|
|
45161
45302
|
};
|
|
45162
45303
|
|
|
45163
|
-
var AddressLine1 = lazy(function () { return import(/* webpackChunkName: "AddressField" */ './fthry_index.
|
|
45164
|
-
var ButtonGroupField = lazy(function () { return import(/* webpackChunkName: "ButtonGroupField" */ './fthry_index.
|
|
45165
|
-
var CheckboxField = lazy(function () { return import(/* webpackChunkName: "CheckboxField" */ './fthry_index.
|
|
45304
|
+
var AddressLine1 = lazy(function () { return import(/* webpackChunkName: "AddressField" */ './fthry_index.CX_yIpjx.js'); });
|
|
45305
|
+
var ButtonGroupField = lazy(function () { return import(/* webpackChunkName: "ButtonGroupField" */ './fthry_index.BmTsB6Yu.js'); });
|
|
45306
|
+
var CheckboxField = lazy(function () { return import(/* webpackChunkName: "CheckboxField" */ './fthry_index.Dh6l3Gzh.js'); });
|
|
45166
45307
|
var CheckboxGroupField = lazy(function () {
|
|
45167
|
-
return import(/* webpackChunkName: "CheckboxGroupField" */ './fthry_index.
|
|
45308
|
+
return import(/* webpackChunkName: "CheckboxGroupField" */ './fthry_index.yOjuSCdP.js');
|
|
45168
45309
|
});
|
|
45169
|
-
var ColorPickerField = lazy(function () { return import(/* webpackChunkName: "ColorPickerField" */ './fthry_index.
|
|
45170
|
-
var CustomField = lazy(function () { return import(/* webpackChunkName: "CustomField" */ './fthry_index.
|
|
45310
|
+
var ColorPickerField = lazy(function () { return import(/* webpackChunkName: "ColorPickerField" */ './fthry_index.Bwx-PVUc.js'); });
|
|
45311
|
+
var CustomField = lazy(function () { return import(/* webpackChunkName: "CustomField" */ './fthry_index._Vy4-Wu1.js'); });
|
|
45171
45312
|
var DateSelectorField = lazy(function () {
|
|
45172
|
-
return import(/* webpackChunkName: "DateSelectorField" */ './fthry_index.
|
|
45313
|
+
return import(/* webpackChunkName: "DateSelectorField" */ './fthry_index.D5EZxrPq.js');
|
|
45173
45314
|
});
|
|
45174
|
-
var DropdownField = lazy(function () { return import(/* webpackChunkName: "DropdownField" */ './fthry_index.
|
|
45315
|
+
var DropdownField = lazy(function () { return import(/* webpackChunkName: "DropdownField" */ './fthry_index.DjBNWso3.js'); });
|
|
45175
45316
|
var DropdownMultiField = lazy(function () {
|
|
45176
|
-
return import(/* webpackChunkName: "DropdownMultiField" */ './fthry_index.
|
|
45317
|
+
return import(/* webpackChunkName: "DropdownMultiField" */ './fthry_index.DfQXHyGI.js');
|
|
45177
45318
|
});
|
|
45178
|
-
var FileUploadField = lazy(function () { return import(/* webpackChunkName: "FileUploadField" */ './fthry_index.
|
|
45179
|
-
var MatrixField = lazy(function () { return import(/* webpackChunkName: "MatrixField" */ './fthry_index.
|
|
45180
|
-
var PasswordField = lazy(function () { return import(/* webpackChunkName: "PasswordField" */ './fthry_index.
|
|
45319
|
+
var FileUploadField = lazy(function () { return import(/* webpackChunkName: "FileUploadField" */ './fthry_index.BrukVpyc.js'); });
|
|
45320
|
+
var MatrixField = lazy(function () { return import(/* webpackChunkName: "MatrixField" */ './fthry_index.DVcP5-xw.js'); });
|
|
45321
|
+
var PasswordField = lazy(function () { return import(/* webpackChunkName: "PasswordField" */ './fthry_index.xmk6gHHa.js'); });
|
|
45181
45322
|
var PaymentMethodField = lazy(function () {
|
|
45182
|
-
return import(/* webpackChunkName: "PaymentMethodField" */ './fthry_PaymentMethodField.
|
|
45323
|
+
return import(/* webpackChunkName: "PaymentMethodField" */ './fthry_PaymentMethodField.w3gN7Laz.js');
|
|
45183
45324
|
});
|
|
45184
|
-
var PhoneField = lazy(function () { return import(/* webpackChunkName: "PhoneField" */ './fthry_index.
|
|
45185
|
-
var PinInputField = lazy(function () { return import(/* webpackChunkName: "PinInputField" */ './fthry_index.
|
|
45186
|
-
var QRScanner = lazy(function () { return import(/* webpackChunkName: "QRScanner" */ './fthry_index.
|
|
45325
|
+
var PhoneField = lazy(function () { return import(/* webpackChunkName: "PhoneField" */ './fthry_index.BJfTO9uE.js'); });
|
|
45326
|
+
var PinInputField = lazy(function () { return import(/* webpackChunkName: "PinInputField" */ './fthry_index.BG0CKa54.js'); });
|
|
45327
|
+
var QRScanner = lazy(function () { return import(/* webpackChunkName: "QRScanner" */ './fthry_index.W81Z3_36.js'); });
|
|
45187
45328
|
var RadioButtonGroupField = lazy(function () {
|
|
45188
45329
|
return import(
|
|
45189
|
-
/* webpackChunkName: "RadioButtonGroupField" */ './fthry_index.
|
|
45330
|
+
/* webpackChunkName: "RadioButtonGroupField" */ './fthry_index.f0EL1oG0.js');
|
|
45190
45331
|
});
|
|
45191
|
-
var RatingField = lazy(function () { return import(/* webpackChunkName: "RatingField" */ './fthry_index.
|
|
45192
|
-
var SignatureField = lazy(function () { return import(/* webpackChunkName: "SignatureField" */ './fthry_index.
|
|
45193
|
-
var SliderField = lazy(function () { return import(/* webpackChunkName: "SliderField" */ './fthry_index.
|
|
45194
|
-
var TextField = lazy(function () { return import(/* webpackChunkName: "TextField" */ './fthry_index.
|
|
45195
|
-
var TextArea = lazy(function () { return import(/* webpackChunkName: "TextArea" */ './fthry_index.
|
|
45332
|
+
var RatingField = lazy(function () { return import(/* webpackChunkName: "RatingField" */ './fthry_index.xPB4gauQ.js'); });
|
|
45333
|
+
var SignatureField = lazy(function () { return import(/* webpackChunkName: "SignatureField" */ './fthry_index.B3p8f_0T.js'); });
|
|
45334
|
+
var SliderField = lazy(function () { return import(/* webpackChunkName: "SliderField" */ './fthry_index.q1Cc80ox.js'); });
|
|
45335
|
+
var TextField = lazy(function () { return import(/* webpackChunkName: "TextField" */ './fthry_index.rA0-tPwD.js'); });
|
|
45336
|
+
var TextArea = lazy(function () { return import(/* webpackChunkName: "TextArea" */ './fthry_index._VpRor3C.js'); });
|
|
45196
45337
|
var Fields = {
|
|
45197
45338
|
AddressLine1: AddressLine1,
|
|
45198
45339
|
ButtonGroupField: ButtonGroupField,
|