@bigbinary/neeto-payments-frontend 1.3.6 → 1.3.8
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/app/javascript/src/translations/en.json +31 -1
- package/dist/index.cjs.js +2188 -64
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +2359 -255
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/types.d.ts +5 -0
package/dist/index.cjs.js
CHANGED
|
@@ -18,20 +18,42 @@ var axios = require('axios');
|
|
|
18
18
|
var neetocist = require('neetocist');
|
|
19
19
|
var utils$3 = require('@bigbinary/neeto-commons-frontend/utils');
|
|
20
20
|
var reactRouterDom = require('react-router-dom');
|
|
21
|
+
var neetoCist = require('@bigbinary/neeto-cist');
|
|
21
22
|
var ramda = require('ramda');
|
|
22
23
|
var DateFormat = require('@bigbinary/neeto-molecules/DateFormat');
|
|
23
24
|
var CopyToClipboardButton = require('@bigbinary/neeto-molecules/CopyToClipboardButton');
|
|
24
25
|
var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
|
|
25
26
|
var TableWrapper = require('@bigbinary/neeto-molecules/TableWrapper');
|
|
26
27
|
var require$$0 = require('util');
|
|
27
|
-
var neetoCist = require('@bigbinary/neeto-cist');
|
|
28
28
|
var reactRouterDom$1 = require('react-router-dom/cjs/react-router-dom');
|
|
29
29
|
var classNames = require('classnames');
|
|
30
30
|
var initializers = require('@bigbinary/neeto-commons-frontend/initializers');
|
|
31
|
+
var neetointegrations = require('neetointegrations');
|
|
32
|
+
var formik = require('@bigbinary/neetoui/formik');
|
|
33
|
+
var yup = require('yup');
|
|
31
34
|
|
|
32
35
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
33
36
|
|
|
37
|
+
function _interopNamespace(e) {
|
|
38
|
+
if (e && e.__esModule) return e;
|
|
39
|
+
var n = Object.create(null);
|
|
40
|
+
if (e) {
|
|
41
|
+
Object.keys(e).forEach(function (k) {
|
|
42
|
+
if (k !== 'default') {
|
|
43
|
+
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
44
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
45
|
+
enumerable: true,
|
|
46
|
+
get: function () { return e[k]; }
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
n["default"] = e;
|
|
52
|
+
return Object.freeze(n);
|
|
53
|
+
}
|
|
54
|
+
|
|
34
55
|
var React__default = /*#__PURE__*/_interopDefaultLegacy(React);
|
|
56
|
+
var React__namespace = /*#__PURE__*/_interopNamespace(React);
|
|
35
57
|
var Header__default = /*#__PURE__*/_interopDefaultLegacy(Header);
|
|
36
58
|
var SubHeader__default = /*#__PURE__*/_interopDefaultLegacy(SubHeader);
|
|
37
59
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
@@ -41,6 +63,7 @@ var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
|
|
|
41
63
|
var TableWrapper__default = /*#__PURE__*/_interopDefaultLegacy(TableWrapper);
|
|
42
64
|
var require$$0__default = /*#__PURE__*/_interopDefaultLegacy(require$$0);
|
|
43
65
|
var classNames__default = /*#__PURE__*/_interopDefaultLegacy(classNames);
|
|
66
|
+
var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
|
|
44
67
|
|
|
45
68
|
function _arrayWithHoles(arr) {
|
|
46
69
|
if (Array.isArray(arr)) return arr;
|
|
@@ -618,7 +641,7 @@ var TAG_STYLE = {
|
|
|
618
641
|
completed: "success",
|
|
619
642
|
rejected: "danger"
|
|
620
643
|
};
|
|
621
|
-
var DEFAULT_SORT_PROPERTIES = {
|
|
644
|
+
var DEFAULT_SORT_PROPERTIES$1 = {
|
|
622
645
|
sortBy: "updated_at",
|
|
623
646
|
orderBy: "DESC"
|
|
624
647
|
};
|
|
@@ -688,8 +711,8 @@ var buildStripePayoutLink = function buildStripePayoutLink(identifier) {
|
|
|
688
711
|
return "".concat(STRIPE_DASHBOARD_LINK).concat(isLive ? "" : "test/", "payouts/").concat(identifier);
|
|
689
712
|
};
|
|
690
713
|
|
|
691
|
-
function ownKeys$
|
|
692
|
-
function _objectSpread$
|
|
714
|
+
function ownKeys$b(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
715
|
+
function _objectSpread$b(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$b(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$b(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
693
716
|
var ExportModal$2 = function ExportModal(_ref) {
|
|
694
717
|
var showExportModal = _ref.showExportModal,
|
|
695
718
|
setShowExportModal = _ref.setShowExportModal,
|
|
@@ -721,7 +744,7 @@ var ExportModal$2 = function ExportModal(_ref) {
|
|
|
721
744
|
}
|
|
722
745
|
};
|
|
723
746
|
var handleGenerateClick = function handleGenerateClick() {
|
|
724
|
-
var payload = _objectSpread$
|
|
747
|
+
var payload = _objectSpread$b({
|
|
725
748
|
kind: "account",
|
|
726
749
|
token: token,
|
|
727
750
|
filters: JSON.stringify(filters),
|
|
@@ -801,8 +824,8 @@ var useURLSearchParams = function useURLSearchParams() {
|
|
|
801
824
|
}, [search]);
|
|
802
825
|
};
|
|
803
826
|
|
|
804
|
-
function ownKeys$
|
|
805
|
-
function _objectSpread$
|
|
827
|
+
function ownKeys$a(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
828
|
+
function _objectSpread$a(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$a(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$a(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
806
829
|
var processSortProperties = function processSortProperties(sortProperties) {
|
|
807
830
|
if (sortProperties.sortBy === "payment_amount") {
|
|
808
831
|
return ramda.assoc("sortBy", "neeto_payments_engine_stripe_transactions.amount", sortProperties);
|
|
@@ -810,11 +833,14 @@ var processSortProperties = function processSortProperties(sortProperties) {
|
|
|
810
833
|
if (sortProperties.sortBy === "email" || sortProperties.sortBy === "first_name") {
|
|
811
834
|
return ramda.modify("sortBy", ramda.concat("users."), sortProperties);
|
|
812
835
|
}
|
|
836
|
+
if (sortProperties.sortBy === "payable,ends_at") {
|
|
837
|
+
return ramda.assoc("sortBy", "bookings.ends_at", sortProperties);
|
|
838
|
+
}
|
|
813
839
|
return sortProperties;
|
|
814
840
|
};
|
|
815
841
|
var buildDefaultPageProperties = function buildDefaultPageProperties(tabs) {
|
|
816
842
|
return tabs.reduce(function (pageProperties, tab) {
|
|
817
|
-
return _objectSpread$
|
|
843
|
+
return _objectSpread$a(_objectSpread$a({}, pageProperties), {}, _defineProperty({}, tab, DEFAULT_PAGE_VALUES));
|
|
818
844
|
}, {});
|
|
819
845
|
};
|
|
820
846
|
var buildPayload = function buildPayload(_ref) {
|
|
@@ -826,8 +852,8 @@ var buildPayload = function buildPayload(_ref) {
|
|
|
826
852
|
sortProperties = _ref$sortProperties === void 0 ? {} : _ref$sortProperties,
|
|
827
853
|
_ref$payoutId = _ref.payoutId,
|
|
828
854
|
payoutId = _ref$payoutId === void 0 ? null : _ref$payoutId;
|
|
829
|
-
return _objectSpread$
|
|
830
|
-
tab: tab,
|
|
855
|
+
return _objectSpread$a({
|
|
856
|
+
tab: neetoCist.camelToSnakeCase(tab),
|
|
831
857
|
payoutId: payoutId,
|
|
832
858
|
page: (_pageProperties$tab = pageProperties[tab]) === null || _pageProperties$tab === void 0 ? void 0 : _pageProperties$tab.page,
|
|
833
859
|
pageSize: (_pageProperties$tab2 = pageProperties[tab]) === null || _pageProperties$tab2 === void 0 ? void 0 : _pageProperties$tab2.pageSize,
|
|
@@ -842,7 +868,7 @@ var buildRowData = function buildRowData(_ref2) {
|
|
|
842
868
|
tab = _ref2$tab === void 0 ? "all" : _ref2$tab;
|
|
843
869
|
return data.map(function (element, index) {
|
|
844
870
|
var _pageProperties$tab3, _pageProperties$tab4;
|
|
845
|
-
return _objectSpread$
|
|
871
|
+
return _objectSpread$a(_objectSpread$a({}, element), {}, {
|
|
846
872
|
payable: element.payable,
|
|
847
873
|
identifier: element,
|
|
848
874
|
id: ramda.isEmpty(pageProperties) ? index + 1 : ((_pageProperties$tab3 = pageProperties[tab]) === null || _pageProperties$tab3 === void 0 ? void 0 : _pageProperties$tab3.pageSize) * (((_pageProperties$tab4 = pageProperties[tab]) === null || _pageProperties$tab4 === void 0 ? void 0 : _pageProperties$tab4.page) - 1) + index + 1
|
|
@@ -875,7 +901,7 @@ var preProcessStatus = function preProcessStatus(type, status) {
|
|
|
875
901
|
if (status === "voided") {
|
|
876
902
|
return "incomplete";
|
|
877
903
|
}
|
|
878
|
-
return status;
|
|
904
|
+
return neetoCist.snakeToCamelCase(status);
|
|
879
905
|
};
|
|
880
906
|
var renderStatus = ramda.curry(function (type, status, record) {
|
|
881
907
|
var processedStatus = preProcessStatus(type, status, record);
|
|
@@ -984,8 +1010,8 @@ var COLUMNS$3 = [{
|
|
|
984
1010
|
sorter: true
|
|
985
1011
|
}];
|
|
986
1012
|
|
|
987
|
-
function ownKeys$
|
|
988
|
-
function _objectSpread$
|
|
1013
|
+
function ownKeys$9(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1014
|
+
function _objectSpread$9(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$9(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$9(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
989
1015
|
var useFiltersAndPagination$3 = function useFiltersAndPagination() {
|
|
990
1016
|
var urlSearchParams = useURLSearchParams();
|
|
991
1017
|
var _useState = React.useState(false),
|
|
@@ -1000,7 +1026,7 @@ var useFiltersAndPagination$3 = function useFiltersAndPagination() {
|
|
|
1000
1026
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
1001
1027
|
pageProperties = _useState6[0],
|
|
1002
1028
|
setPageProperties = _useState6[1];
|
|
1003
|
-
var _useState7 = React.useState(DEFAULT_SORT_PROPERTIES),
|
|
1029
|
+
var _useState7 = React.useState(DEFAULT_SORT_PROPERTIES$1),
|
|
1004
1030
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
1005
1031
|
sortProperties = _useState8[0],
|
|
1006
1032
|
setSortProperties = _useState8[1];
|
|
@@ -1015,7 +1041,7 @@ var useFiltersAndPagination$3 = function useFiltersAndPagination() {
|
|
|
1015
1041
|
var _getQueryParams = utils$3.getQueryParams(),
|
|
1016
1042
|
_getQueryParams$searc = _getQueryParams.searchTerm,
|
|
1017
1043
|
searchTerm = _getQueryParams$searc === void 0 ? "" : _getQueryParams$searc;
|
|
1018
|
-
var searchKeywordProps = _objectSpread$
|
|
1044
|
+
var searchKeywordProps = _objectSpread$9(_objectSpread$9({}, SEARCH_PROPS$1), {}, {
|
|
1019
1045
|
key: "search_term",
|
|
1020
1046
|
value: searchTerm.trim()
|
|
1021
1047
|
});
|
|
@@ -1136,6 +1162,7 @@ var List$3 = function List(_ref) {
|
|
|
1136
1162
|
setDataSize(dataSize);
|
|
1137
1163
|
}, [accounts]);
|
|
1138
1164
|
var handleTablePagination = function handleTablePagination(page, pageSize) {
|
|
1165
|
+
urlSearchParams.set("tab", tab);
|
|
1139
1166
|
urlSearchParams.set("page", page);
|
|
1140
1167
|
urlSearchParams.set("page_size", pageSize);
|
|
1141
1168
|
history.push({
|
|
@@ -1148,7 +1175,7 @@ var List$3 = function List(_ref) {
|
|
|
1148
1175
|
};
|
|
1149
1176
|
React.useEffect(function () {
|
|
1150
1177
|
handleTablePagination(constants.DEFAULT_PAGE_INDEX, constants.DEFAULT_PAGE_SIZE);
|
|
1151
|
-
setSortProperties(DEFAULT_SORT_PROPERTIES);
|
|
1178
|
+
setSortProperties(DEFAULT_SORT_PROPERTIES$1);
|
|
1152
1179
|
}, [filters, tab]);
|
|
1153
1180
|
React.useEffect(function () {
|
|
1154
1181
|
var _pageProperties$tab, _pageProperties$tab2;
|
|
@@ -1164,7 +1191,7 @@ var List$3 = function List(_ref) {
|
|
|
1164
1191
|
setSortProperties(neetocist.isPresent(sorter === null || sorter === void 0 ? void 0 : sorter.column) ? {
|
|
1165
1192
|
sortBy: neetocist.camelToSnakeCase(sorter.field),
|
|
1166
1193
|
orderBy: sorter.order === "ascend" ? "ASC" : "DESC"
|
|
1167
|
-
} : DEFAULT_SORT_PROPERTIES);
|
|
1194
|
+
} : DEFAULT_SORT_PROPERTIES$1);
|
|
1168
1195
|
};
|
|
1169
1196
|
if (isLoading) {
|
|
1170
1197
|
return /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null);
|
|
@@ -1314,8 +1341,8 @@ var AccountsDashboard = function AccountsDashboard() {
|
|
|
1314
1341
|
};
|
|
1315
1342
|
var index$3 = reactUtils.withTitle(withReactQuery(AccountsDashboard), i18next.t("neetoPayments.title.account"));
|
|
1316
1343
|
|
|
1317
|
-
function _extends() {
|
|
1318
|
-
_extends = Object.assign ? Object.assign.bind() : function (target) {
|
|
1344
|
+
function _extends$1() {
|
|
1345
|
+
_extends$1 = Object.assign ? Object.assign.bind() : function (target) {
|
|
1319
1346
|
for (var i = 1; i < arguments.length; i++) {
|
|
1320
1347
|
var source = arguments[i];
|
|
1321
1348
|
for (var key in source) {
|
|
@@ -1326,7 +1353,7 @@ function _extends() {
|
|
|
1326
1353
|
}
|
|
1327
1354
|
return target;
|
|
1328
1355
|
};
|
|
1329
|
-
return _extends.apply(this, arguments);
|
|
1356
|
+
return _extends$1.apply(this, arguments);
|
|
1330
1357
|
}
|
|
1331
1358
|
|
|
1332
1359
|
var TAB$2 = {
|
|
@@ -1594,8 +1621,9 @@ var COLUMNS$2 = [{
|
|
|
1594
1621
|
dataIndex: "refunds",
|
|
1595
1622
|
key: "refundsTime",
|
|
1596
1623
|
width: "220px",
|
|
1597
|
-
render: function render(
|
|
1624
|
+
render: function render() {
|
|
1598
1625
|
var _refunds$;
|
|
1626
|
+
var refunds = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
1599
1627
|
return renderDate((_refunds$ = refunds[0]) === null || _refunds$ === void 0 ? void 0 : _refunds$.updatedAt);
|
|
1600
1628
|
},
|
|
1601
1629
|
position: 6
|
|
@@ -1906,8 +1934,8 @@ var modifySearchProps = function modifySearchProps(_ref5) {
|
|
|
1906
1934
|
}, searchProps);
|
|
1907
1935
|
};
|
|
1908
1936
|
|
|
1909
|
-
function ownKeys$
|
|
1910
|
-
function _objectSpread$
|
|
1937
|
+
function ownKeys$8(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
1938
|
+
function _objectSpread$8(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$8(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$8(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
1911
1939
|
var ExportModal$1 = function ExportModal(_ref) {
|
|
1912
1940
|
var showExportModal = _ref.showExportModal,
|
|
1913
1941
|
setShowExportModal = _ref.setShowExportModal,
|
|
@@ -1941,7 +1969,7 @@ var ExportModal$1 = function ExportModal(_ref) {
|
|
|
1941
1969
|
}
|
|
1942
1970
|
};
|
|
1943
1971
|
var handleGenerateClick = function handleGenerateClick() {
|
|
1944
|
-
var payload = _objectSpread$
|
|
1972
|
+
var payload = _objectSpread$8({
|
|
1945
1973
|
kind: isTransferKind(kind) ? "connected" : kind,
|
|
1946
1974
|
token: token,
|
|
1947
1975
|
filters: JSON.stringify(filters),
|
|
@@ -1998,8 +2026,8 @@ var ExportModal$1 = function ExportModal(_ref) {
|
|
|
1998
2026
|
}))));
|
|
1999
2027
|
};
|
|
2000
2028
|
|
|
2001
|
-
function ownKeys$
|
|
2002
|
-
function _objectSpread$
|
|
2029
|
+
function ownKeys$7(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
2030
|
+
function _objectSpread$7(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$7(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$7(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
2003
2031
|
var useFiltersAndPagination$2 = function useFiltersAndPagination(_ref) {
|
|
2004
2032
|
var payableEntityColumns = _ref.payableEntityColumns,
|
|
2005
2033
|
kind = _ref.kind,
|
|
@@ -2022,7 +2050,7 @@ var useFiltersAndPagination$2 = function useFiltersAndPagination(_ref) {
|
|
|
2022
2050
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
2023
2051
|
pageProperties = _useState6[0],
|
|
2024
2052
|
setPageProperties = _useState6[1];
|
|
2025
|
-
var _useState7 = React.useState(DEFAULT_SORT_PROPERTIES),
|
|
2053
|
+
var _useState7 = React.useState(DEFAULT_SORT_PROPERTIES$1),
|
|
2026
2054
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
2027
2055
|
sortProperties = _useState8[0],
|
|
2028
2056
|
setSortProperties = _useState8[1];
|
|
@@ -2038,7 +2066,7 @@ var useFiltersAndPagination$2 = function useFiltersAndPagination(_ref) {
|
|
|
2038
2066
|
var _getQueryParams = utils$3.getQueryParams(),
|
|
2039
2067
|
_getQueryParams$searc = _getQueryParams.searchTerm,
|
|
2040
2068
|
searchTerm = _getQueryParams$searc === void 0 ? "" : _getQueryParams$searc;
|
|
2041
|
-
var searchKeywordProps = _objectSpread$
|
|
2069
|
+
var searchKeywordProps = _objectSpread$7(_objectSpread$7({}, modifySearchProps({
|
|
2042
2070
|
searchProps: searchProps,
|
|
2043
2071
|
kind: kind
|
|
2044
2072
|
})), {}, {
|
|
@@ -2110,8 +2138,20 @@ var useFiltersAndPagination$2 = function useFiltersAndPagination(_ref) {
|
|
|
2110
2138
|
var show$5 = function show(holdableId) {
|
|
2111
2139
|
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/stripe/holdable/").concat(holdableId, "/account"));
|
|
2112
2140
|
};
|
|
2141
|
+
var create$1 = function create(payload) {
|
|
2142
|
+
return axios__default["default"].post("".concat(BASE_URL, "/api/v1/stripe/accounts"), payload);
|
|
2143
|
+
};
|
|
2144
|
+
var creationStatus = function creationStatus(jobId) {
|
|
2145
|
+
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/stripe/accounts/").concat(jobId, "/creation_status"));
|
|
2146
|
+
};
|
|
2147
|
+
var destroy = function destroy(accountId) {
|
|
2148
|
+
return axios__default["default"]["delete"]("".concat(BASE_URL, "/api/v1/stripe/accounts/").concat(accountId));
|
|
2149
|
+
};
|
|
2113
2150
|
var accountsApi$2 = {
|
|
2114
|
-
show: show$5
|
|
2151
|
+
show: show$5,
|
|
2152
|
+
create: create$1,
|
|
2153
|
+
creationStatus: creationStatus,
|
|
2154
|
+
destroy: destroy
|
|
2115
2155
|
};
|
|
2116
2156
|
|
|
2117
2157
|
var list$7 = function list(payload) {
|
|
@@ -4206,6 +4246,8 @@ var transactionsApi$1 = {
|
|
|
4206
4246
|
list: list$6
|
|
4207
4247
|
};
|
|
4208
4248
|
|
|
4249
|
+
function ownKeys$6(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4250
|
+
function _objectSpread$6(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$6(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$6(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4209
4251
|
var useFetchConnectedStripeAccount = function useFetchConnectedStripeAccount(holdableId) {
|
|
4210
4252
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4211
4253
|
return reactQuery.useQuery([QUERY_KEYS.CONNECTED_ACCOUNT, holdableId], function () {
|
|
@@ -4231,10 +4273,38 @@ var useFetchStripePayouts = function useFetchStripePayouts(payload) {
|
|
|
4231
4273
|
};
|
|
4232
4274
|
var useShowStripePayout = function useShowStripePayout(id) {
|
|
4233
4275
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4234
|
-
return reactQuery.useQuery(QUERY_KEYS.STRIPE_PAYOUT, function () {
|
|
4276
|
+
return reactQuery.useQuery([QUERY_KEYS.STRIPE_PAYOUT, id], function () {
|
|
4235
4277
|
return payoutsApi$1.show(id);
|
|
4236
4278
|
}, options);
|
|
4237
4279
|
};
|
|
4280
|
+
var usePollingStripeAccount = function usePollingStripeAccount(holdableId, _ref) {
|
|
4281
|
+
var refetchInterval = _ref.refetchInterval;
|
|
4282
|
+
return reactQuery.useQuery(QUERY_KEYS.STRIPE_ACCOUNT_DETAILS, function () {
|
|
4283
|
+
return accountsApi$2.show(holdableId);
|
|
4284
|
+
}, {
|
|
4285
|
+
refetchInterval: refetchInterval
|
|
4286
|
+
});
|
|
4287
|
+
};
|
|
4288
|
+
var usePollingStripeAccountCreationStatus = function usePollingStripeAccountCreationStatus(jobId, options) {
|
|
4289
|
+
return reactQuery.useQuery([QUERY_KEYS.STRIPE_ACCOUNT_DETAILS, jobId], function () {
|
|
4290
|
+
return accountsApi$2.creationStatus(jobId);
|
|
4291
|
+
}, _objectSpread$6({}, options));
|
|
4292
|
+
};
|
|
4293
|
+
var useDestroyStripeAccount = function useDestroyStripeAccount(_ref2) {
|
|
4294
|
+
var onSuccess = _ref2.onSuccess,
|
|
4295
|
+
holdableId = _ref2.holdableId;
|
|
4296
|
+
return reactUtils.useMutationWithInvalidation(accountsApi$2.destroy, {
|
|
4297
|
+
keysToInvalidate: [QUERY_KEYS.STRIPE_ACCOUNT_DETAILS, [QUERY_KEYS.CONNECTED_ACCOUNT, holdableId]],
|
|
4298
|
+
onSuccess: onSuccess
|
|
4299
|
+
});
|
|
4300
|
+
};
|
|
4301
|
+
var useCreateStripeAccount = function useCreateStripeAccount(_ref3) {
|
|
4302
|
+
var onSuccess = _ref3.onSuccess;
|
|
4303
|
+
return reactUtils.useMutationWithInvalidation(accountsApi$2.create, {
|
|
4304
|
+
keysToInvalidate: [QUERY_KEYS.STRIPE_ACCOUNT_DETAILS],
|
|
4305
|
+
onSuccess: onSuccess
|
|
4306
|
+
});
|
|
4307
|
+
};
|
|
4238
4308
|
|
|
4239
4309
|
var list$5 = function list(payload) {
|
|
4240
4310
|
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/stripe/holdable/refunds"), {
|
|
@@ -4338,7 +4408,7 @@ var useFetchStripePlatformPayouts = function useFetchStripePlatformPayouts(paylo
|
|
|
4338
4408
|
};
|
|
4339
4409
|
var useShowStripePlatformPayout = function useShowStripePlatformPayout(id) {
|
|
4340
4410
|
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
4341
|
-
return reactQuery.useQuery(QUERY_KEYS.STRIPE_PAYOUT, function () {
|
|
4411
|
+
return reactQuery.useQuery([QUERY_KEYS.STRIPE_PAYOUT, id], function () {
|
|
4342
4412
|
return payoutsApi.show(id);
|
|
4343
4413
|
}, options);
|
|
4344
4414
|
};
|
|
@@ -4440,8 +4510,8 @@ var ExpandedRow = function ExpandedRow() {
|
|
|
4440
4510
|
})));
|
|
4441
4511
|
};
|
|
4442
4512
|
|
|
4443
|
-
function ownKeys$
|
|
4444
|
-
function _objectSpread$
|
|
4513
|
+
function ownKeys$5(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4514
|
+
function _objectSpread$5(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$5(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$5(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4445
4515
|
var useFetchData$2 = function useFetchData(_ref) {
|
|
4446
4516
|
var _data$kind, _data$kind2, _data$kind3, _data$kind4;
|
|
4447
4517
|
var kind = _ref.kind,
|
|
@@ -4449,7 +4519,7 @@ var useFetchData$2 = function useFetchData(_ref) {
|
|
|
4449
4519
|
payload = _ref.payload,
|
|
4450
4520
|
isPlatformEnabled = _ref.isPlatformEnabled;
|
|
4451
4521
|
var data = {};
|
|
4452
|
-
data.transfer = data.connected = useFetchStripeTransactions(holdableId, _objectSpread$
|
|
4522
|
+
data.transfer = data.connected = useFetchStripeTransactions(holdableId, _objectSpread$5(_objectSpread$5({}, payload), {}, {
|
|
4453
4523
|
kind: kind
|
|
4454
4524
|
}), {
|
|
4455
4525
|
enabled: isTransferKind(kind) || isConnectedKind(kind)
|
|
@@ -4536,7 +4606,7 @@ var Details = function Details(_ref) {
|
|
|
4536
4606
|
live = _useFetchStripePlatfo3.live,
|
|
4537
4607
|
_useFetchStripePlatfo4 = _useFetchStripePlatfo3.splits,
|
|
4538
4608
|
splits = _useFetchStripePlatfo4 === void 0 ? [] : _useFetchStripePlatfo4;
|
|
4539
|
-
return /*#__PURE__*/React__default["default"].createElement(neetoui.Pane, _extends({}, paneProps, {
|
|
4609
|
+
return /*#__PURE__*/React__default["default"].createElement(neetoui.Pane, _extends$1({}, paneProps, {
|
|
4540
4610
|
size: "large"
|
|
4541
4611
|
}), /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Header, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
4542
4612
|
style: "h2"
|
|
@@ -4661,7 +4731,7 @@ var List$2 = function List(_ref) {
|
|
|
4661
4731
|
};
|
|
4662
4732
|
React.useEffect(function () {
|
|
4663
4733
|
handleTablePaginaton(constants.DEFAULT_PAGE_INDEX, constants.DEFAULT_PAGE_SIZE);
|
|
4664
|
-
setSortProperties(DEFAULT_SORT_PROPERTIES);
|
|
4734
|
+
setSortProperties(DEFAULT_SORT_PROPERTIES$1);
|
|
4665
4735
|
}, [filters, tab]);
|
|
4666
4736
|
React.useEffect(function () {
|
|
4667
4737
|
var _pageProperties$tab, _pageProperties$tab2;
|
|
@@ -4675,9 +4745,9 @@ var List$2 = function List(_ref) {
|
|
|
4675
4745
|
}, [urlSearchParams]);
|
|
4676
4746
|
var handleTableChange = function handleTableChange(_, __, sorter) {
|
|
4677
4747
|
setSortProperties(neetocist.isPresent(sorter === null || sorter === void 0 ? void 0 : sorter.column) ? {
|
|
4678
|
-
sortBy: neetocist.camelToSnakeCase(sorter.field),
|
|
4748
|
+
sortBy: neetocist.camelToSnakeCase(processDataIndex(sorter.field)),
|
|
4679
4749
|
orderBy: sorter.order === "ascend" ? "ASC" : "DESC"
|
|
4680
|
-
} : DEFAULT_SORT_PROPERTIES);
|
|
4750
|
+
} : DEFAULT_SORT_PROPERTIES$1);
|
|
4681
4751
|
};
|
|
4682
4752
|
if (isStripeAccountLoading || isStripePlatformAccountLoading || isDataLoading) {
|
|
4683
4753
|
return /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null);
|
|
@@ -4724,7 +4794,7 @@ var List$2 = function List(_ref) {
|
|
|
4724
4794
|
total: dataSize
|
|
4725
4795
|
},
|
|
4726
4796
|
onChange: handleTableChange
|
|
4727
|
-
})), /*#__PURE__*/React__default["default"].createElement(Details, _extends({}, paneStatus, {
|
|
4797
|
+
})), /*#__PURE__*/React__default["default"].createElement(Details, _extends$1({}, paneStatus, {
|
|
4728
4798
|
onClose: function onClose() {
|
|
4729
4799
|
return setPaneStatus(INITIAL_PANE_STATUS);
|
|
4730
4800
|
}
|
|
@@ -4789,7 +4859,7 @@ var Dashboard = function Dashboard(_ref) {
|
|
|
4789
4859
|
setFilters(filters);
|
|
4790
4860
|
});
|
|
4791
4861
|
};
|
|
4792
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Header__default["default"], _extends({}, headerProps, {
|
|
4862
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Header__default["default"], _extends$1({}, headerProps, {
|
|
4793
4863
|
title: t("neetoPayments.title.".concat(titleKind)),
|
|
4794
4864
|
searchProps: {
|
|
4795
4865
|
placeholder: searchKeywordProps.placeholder,
|
|
@@ -4873,10 +4943,10 @@ var Dashboard$1 = reactUtils.withTitle(withReactQuery(Dashboard), i18next.t("nee
|
|
|
4873
4943
|
var TAB$1 = {
|
|
4874
4944
|
all: "all",
|
|
4875
4945
|
paid: "paid",
|
|
4876
|
-
pending: "pending",
|
|
4877
4946
|
inTransit: "inTransit",
|
|
4878
4947
|
failed: "failed",
|
|
4879
|
-
canceled: "canceled"
|
|
4948
|
+
canceled: "canceled",
|
|
4949
|
+
pending: "pending"
|
|
4880
4950
|
};
|
|
4881
4951
|
var TABS$1 = Object.values(TAB$1);
|
|
4882
4952
|
var SEARCH_PROPS = {
|
|
@@ -4898,9 +4968,13 @@ var FILTER_COLUMNS = [{
|
|
|
4898
4968
|
type: "date",
|
|
4899
4969
|
showRuleSelector: true
|
|
4900
4970
|
}];
|
|
4971
|
+
var DEFAULT_SORT_PROPERTIES = {
|
|
4972
|
+
sortBy: "created_at",
|
|
4973
|
+
orderBy: "DESC"
|
|
4974
|
+
};
|
|
4901
4975
|
|
|
4902
|
-
function ownKeys$
|
|
4903
|
-
function _objectSpread$
|
|
4976
|
+
function ownKeys$4(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
4977
|
+
function _objectSpread$4(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$4(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$4(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
4904
4978
|
var ExportModal = function ExportModal(_ref) {
|
|
4905
4979
|
var showExportModal = _ref.showExportModal,
|
|
4906
4980
|
setShowExportModal = _ref.setShowExportModal,
|
|
@@ -4932,7 +5006,7 @@ var ExportModal = function ExportModal(_ref) {
|
|
|
4932
5006
|
}
|
|
4933
5007
|
};
|
|
4934
5008
|
var handleGenerateClick = function handleGenerateClick() {
|
|
4935
|
-
var payload = _objectSpread$
|
|
5009
|
+
var payload = _objectSpread$4({
|
|
4936
5010
|
kind: "payout",
|
|
4937
5011
|
token: token,
|
|
4938
5012
|
filters: JSON.stringify(filters),
|
|
@@ -5033,6 +5107,9 @@ var IDENTIFIER_COLUMN = {
|
|
|
5033
5107
|
width: "300px"
|
|
5034
5108
|
};
|
|
5035
5109
|
|
|
5110
|
+
var processTab = function processTab(status) {
|
|
5111
|
+
return neetoCist.camelToSnakeCase(status).split("_").join(" ");
|
|
5112
|
+
};
|
|
5036
5113
|
var renderPayoutIdentifier$1 = ramda.curry(function (route, _ref) {
|
|
5037
5114
|
var _ref$identifier = _ref.identifier,
|
|
5038
5115
|
identifier = _ref$identifier === void 0 ? "" : _ref$identifier,
|
|
@@ -5050,8 +5127,8 @@ var renderPayoutIdentifier$1 = ramda.curry(function (route, _ref) {
|
|
|
5050
5127
|
}));
|
|
5051
5128
|
});
|
|
5052
5129
|
|
|
5053
|
-
function ownKeys$
|
|
5054
|
-
function _objectSpread$
|
|
5130
|
+
function ownKeys$3(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
5131
|
+
function _objectSpread$3(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$3(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$3(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5055
5132
|
var useFiltersAndPagination$1 = function useFiltersAndPagination(payoutsPageRoute) {
|
|
5056
5133
|
var urlSearchParams = useURLSearchParams();
|
|
5057
5134
|
var _useState = React.useState(false),
|
|
@@ -5066,7 +5143,7 @@ var useFiltersAndPagination$1 = function useFiltersAndPagination(payoutsPageRout
|
|
|
5066
5143
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
5067
5144
|
pageProperties = _useState6[0],
|
|
5068
5145
|
setPageProperties = _useState6[1];
|
|
5069
|
-
var _useState7 = React.useState(DEFAULT_SORT_PROPERTIES),
|
|
5146
|
+
var _useState7 = React.useState(DEFAULT_SORT_PROPERTIES$1),
|
|
5070
5147
|
_useState8 = _slicedToArray(_useState7, 2),
|
|
5071
5148
|
sortProperties = _useState8[0],
|
|
5072
5149
|
setSortProperties = _useState8[1];
|
|
@@ -5081,7 +5158,7 @@ var useFiltersAndPagination$1 = function useFiltersAndPagination(payoutsPageRout
|
|
|
5081
5158
|
var _getQueryParams = utils$3.getQueryParams(),
|
|
5082
5159
|
_getQueryParams$searc = _getQueryParams.searchTerm,
|
|
5083
5160
|
searchTerm = _getQueryParams$searc === void 0 ? "" : _getQueryParams$searc;
|
|
5084
|
-
var searchKeywordProps = _objectSpread$
|
|
5161
|
+
var searchKeywordProps = _objectSpread$3(_objectSpread$3({}, SEARCH_PROPS), {}, {
|
|
5085
5162
|
key: "search_term",
|
|
5086
5163
|
value: searchTerm.trim()
|
|
5087
5164
|
});
|
|
@@ -5138,6 +5215,7 @@ var useFetchData$1 = function useFetchData(_ref) {
|
|
|
5138
5215
|
payload = _ref.payload;
|
|
5139
5216
|
var data = {};
|
|
5140
5217
|
var kind = isPlatformEnabled ? "platform" : "connected";
|
|
5218
|
+
var tab = neetoCist.snakeToCamelCase((payload === null || payload === void 0 ? void 0 : payload.tab) || "");
|
|
5141
5219
|
data.connected = useFetchStripePayouts(payload, {
|
|
5142
5220
|
enabled: !isPlatformEnabled
|
|
5143
5221
|
});
|
|
@@ -5146,7 +5224,7 @@ var useFetchData$1 = function useFetchData(_ref) {
|
|
|
5146
5224
|
});
|
|
5147
5225
|
return {
|
|
5148
5226
|
data: (_data$kind = data[kind]) === null || _data$kind === void 0 || (_data$kind = _data$kind.data) === null || _data$kind === void 0 ? void 0 : _data$kind.payouts,
|
|
5149
|
-
dataSize: (_data$kind2 = data[kind]) === null || _data$kind2 === void 0 || (_data$kind2 = _data$kind2.data) === null || _data$kind2 === void 0 || (_data$kind2 = _data$kind2.views) === null || _data$kind2 === void 0 ? void 0 : _data$kind2[
|
|
5227
|
+
dataSize: (_data$kind2 = data[kind]) === null || _data$kind2 === void 0 || (_data$kind2 = _data$kind2.data) === null || _data$kind2 === void 0 || (_data$kind2 = _data$kind2.views) === null || _data$kind2 === void 0 ? void 0 : _data$kind2[tab],
|
|
5150
5228
|
isDataLoading: (_data$kind3 = data[kind]) === null || _data$kind3 === void 0 ? void 0 : _data$kind3.isLoading,
|
|
5151
5229
|
isDataFetching: (_data$kind4 = data[kind]) === null || _data$kind4 === void 0 ? void 0 : _data$kind4.isFetching
|
|
5152
5230
|
};
|
|
@@ -5187,6 +5265,7 @@ var List$1 = function List(_ref) {
|
|
|
5187
5265
|
setDataSize(dataSize);
|
|
5188
5266
|
}, [payouts]);
|
|
5189
5267
|
var handleTablePagination = function handleTablePagination(page, pageSize) {
|
|
5268
|
+
urlSearchParams.set("tab", tab);
|
|
5190
5269
|
urlSearchParams.set("page", page);
|
|
5191
5270
|
urlSearchParams.set("page_size", pageSize);
|
|
5192
5271
|
history.push({
|
|
@@ -5315,7 +5394,7 @@ var PayoutsDashboard = function PayoutsDashboard(_ref) {
|
|
|
5315
5394
|
count: dataSize
|
|
5316
5395
|
}) : t("neetoPayments.countOf.payoutWithStatus", {
|
|
5317
5396
|
count: dataSize,
|
|
5318
|
-
status: tab
|
|
5397
|
+
status: processTab(tab)
|
|
5319
5398
|
})),
|
|
5320
5399
|
rightActionBlock: /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoFiltersFrontend.Bar, {
|
|
5321
5400
|
columns: FILTER_COLUMNS,
|
|
@@ -5408,7 +5487,7 @@ var PayoutsPage = function PayoutsPage(_ref) {
|
|
|
5408
5487
|
id: id,
|
|
5409
5488
|
isPlatformEnabled: isPlatformEnabled
|
|
5410
5489
|
}),
|
|
5411
|
-
|
|
5490
|
+
isDataLoading = _useFetchData.isDataLoading,
|
|
5412
5491
|
_useFetchData$data = _useFetchData.data,
|
|
5413
5492
|
_useFetchData$data2 = _useFetchData$data === void 0 ? {} : _useFetchData$data,
|
|
5414
5493
|
amount = _useFetchData$data2.amount,
|
|
@@ -5426,7 +5505,7 @@ var PayoutsPage = function PayoutsPage(_ref) {
|
|
|
5426
5505
|
}, {
|
|
5427
5506
|
text: identifier
|
|
5428
5507
|
}];
|
|
5429
|
-
if (
|
|
5508
|
+
if (isDataLoading) return /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null);
|
|
5430
5509
|
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Header__default["default"], {
|
|
5431
5510
|
breadcrumbs: headerBreadCrumbs,
|
|
5432
5511
|
title: t("neetoPayments.payoutsPage.title")
|
|
@@ -5487,7 +5566,7 @@ var PayoutsPage = function PayoutsPage(_ref) {
|
|
|
5487
5566
|
}, t("neetoPayments.payoutsPage.failureMessage")), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
5488
5567
|
className: "neeto-ui-text-black font-medium",
|
|
5489
5568
|
style: "body2"
|
|
5490
|
-
}, failureMessage)))), isAutomatic && /*#__PURE__*/React__default["default"].createElement(Dashboard$1, _extends({}, isPlatformEnabled, {
|
|
5569
|
+
}, failureMessage)))), isAutomatic && /*#__PURE__*/React__default["default"].createElement(Dashboard$1, _extends$1({}, isPlatformEnabled, {
|
|
5491
5570
|
kind: "connected"
|
|
5492
5571
|
}, otherProps, {
|
|
5493
5572
|
headerProps: {
|
|
@@ -5985,8 +6064,8 @@ var SquareCard = function SquareCard(_ref) {
|
|
|
5985
6064
|
}, !card && /*#__PURE__*/React__default["default"].createElement(neetoui.Spinner, null));
|
|
5986
6065
|
};
|
|
5987
6066
|
|
|
5988
|
-
function ownKeys$
|
|
5989
|
-
function _objectSpread$
|
|
6067
|
+
function ownKeys$2(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6068
|
+
function _objectSpread$2(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$2(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$2(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
5990
6069
|
var FilterWrapper = function FilterWrapper(_ref) {
|
|
5991
6070
|
var searchProps = _ref.searchProps,
|
|
5992
6071
|
_ref$headerProps = _ref.headerProps,
|
|
@@ -6011,7 +6090,7 @@ var FilterWrapper = function FilterWrapper(_ref) {
|
|
|
6011
6090
|
var _useTranslation = reactI18next.useTranslation(),
|
|
6012
6091
|
t = _useTranslation.t;
|
|
6013
6092
|
var isTabsVisible = isFilterButtonVisible || tab !== "all";
|
|
6014
|
-
var searchKeywordProps = _objectSpread$
|
|
6093
|
+
var searchKeywordProps = _objectSpread$2(_objectSpread$2({}, searchProps), {}, {
|
|
6015
6094
|
value: searchTerm.trim(),
|
|
6016
6095
|
setValue: neetocist.noop
|
|
6017
6096
|
});
|
|
@@ -6020,7 +6099,7 @@ var FilterWrapper = function FilterWrapper(_ref) {
|
|
|
6020
6099
|
setFilters(filters);
|
|
6021
6100
|
});
|
|
6022
6101
|
};
|
|
6023
|
-
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Header__default["default"], _extends({}, _objectSpread$
|
|
6102
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(Header__default["default"], _extends$1({}, _objectSpread$2(_objectSpread$2({}, headerProps), {}, {
|
|
6024
6103
|
title: title
|
|
6025
6104
|
}), {
|
|
6026
6105
|
searchProps: {
|
|
@@ -6469,8 +6548,8 @@ var List = function List(_ref) {
|
|
|
6469
6548
|
}));
|
|
6470
6549
|
};
|
|
6471
6550
|
|
|
6472
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6473
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6551
|
+
function ownKeys$1(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
6552
|
+
function _objectSpread$1(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys$1(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys$1(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
6474
6553
|
var SquareDashboard = function SquareDashboard(_ref) {
|
|
6475
6554
|
var searchProps = _ref.searchProps,
|
|
6476
6555
|
_ref$headerProps = _ref.headerProps,
|
|
@@ -6495,9 +6574,9 @@ var SquareDashboard = function SquareDashboard(_ref) {
|
|
|
6495
6574
|
tabs = filterPaginationState.tabs,
|
|
6496
6575
|
handleTabChange = filterPaginationState.handleTabChange,
|
|
6497
6576
|
setDataSize = filterPaginationState.setDataSize;
|
|
6498
|
-
return /*#__PURE__*/React__default["default"].createElement(FilterWrapper, _extends({
|
|
6577
|
+
return /*#__PURE__*/React__default["default"].createElement(FilterWrapper, _extends$1({
|
|
6499
6578
|
title: isPaymentKind(kind) ? i18next.t("neetoPayments.title.squarePayment") : i18next.t("neetoPayments.title.squareRefund")
|
|
6500
|
-
}, _objectSpread({
|
|
6579
|
+
}, _objectSpread$1({
|
|
6501
6580
|
headerProps: headerProps,
|
|
6502
6581
|
kind: kind,
|
|
6503
6582
|
searchProps: searchProps
|
|
@@ -6537,7 +6616,7 @@ var PaymentKindRestrictionAlert = function PaymentKindRestrictionAlert(_ref) {
|
|
|
6537
6616
|
_ref$onClose = _ref.onClose,
|
|
6538
6617
|
onClose = _ref$onClose === void 0 ? neetocist.noop : _ref$onClose,
|
|
6539
6618
|
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
6540
|
-
return /*#__PURE__*/React__default["default"].createElement(neetoui.Alert, _extends({
|
|
6619
|
+
return /*#__PURE__*/React__default["default"].createElement(neetoui.Alert, _extends$1({
|
|
6541
6620
|
isOpen: isOpen,
|
|
6542
6621
|
onClose: onClose,
|
|
6543
6622
|
message: STRIPE_ALERT_PAYMENT_KIND_CONTENT[paymentKind].message,
|
|
@@ -6642,6 +6721,2050 @@ var useStripePromise = function useStripePromise(stripeAccountIdentifier) {
|
|
|
6642
6721
|
return stripePromise;
|
|
6643
6722
|
};
|
|
6644
6723
|
|
|
6724
|
+
var _path, _path2, _path3;
|
|
6725
|
+
function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
|
|
6726
|
+
const SvgStripe = props => /*#__PURE__*/React__namespace.createElement("svg", _extends({
|
|
6727
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
6728
|
+
width: 54,
|
|
6729
|
+
height: 54,
|
|
6730
|
+
fill: "#6772e5",
|
|
6731
|
+
viewBox: "0 0 32 32"
|
|
6732
|
+
}, props), _path || (_path = /*#__PURE__*/React__namespace.createElement("path", {
|
|
6733
|
+
fillRule: "evenodd",
|
|
6734
|
+
d: "M111.328 15.602c0-4.97-2.415-8.9-7.013-8.9s-7.423 3.924-7.423 8.863c0 5.85 3.32 8.8 8.036 8.8 2.318 0 4.06-.528 5.377-1.26V19.22a10.246 10.246 0 0 1-4.764 1.075c-1.9 0-3.556-.67-3.774-2.943h9.497a39.64 39.64 0 0 0 .063-1.748zm-9.606-1.835c0-2.186 1.35-3.1 2.56-3.1s2.454.906 2.454 3.1zM89.4 6.712a5.434 5.434 0 0 0-3.801 1.509l-.254-1.208h-4.27v22.64l4.85-1.032v-5.488a5.434 5.434 0 0 0 3.444 1.265c3.472 0 6.64-2.792 6.64-8.957.003-5.66-3.206-8.73-6.614-8.73zM88.23 20.1a2.898 2.898 0 0 1-2.288-.906l-.03-7.2a2.928 2.928 0 0 1 2.315-.96c1.775 0 2.998 2 2.998 4.528.003 2.593-1.198 4.546-2.995 4.546zM79.25.57l-4.87 1.035v3.95l4.87-1.032z"
|
|
6735
|
+
})), _path2 || (_path2 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
6736
|
+
d: "M74.38 7.035h4.87V24.04h-4.87z"
|
|
6737
|
+
})), _path3 || (_path3 = /*#__PURE__*/React__namespace.createElement("path", {
|
|
6738
|
+
fillRule: "evenodd",
|
|
6739
|
+
d: "m69.164 8.47-.302-1.434h-4.196V24.04h4.848V12.5c1.147-1.5 3.082-1.208 3.698-1.017V7.038c-.646-.232-2.913-.658-4.048 1.43zm-9.73-5.646L54.698 3.83l-.02 15.562c0 2.87 2.158 4.993 5.038 4.993 1.585 0 2.756-.302 3.405-.643v-3.95c-.622.248-3.683 1.138-3.683-1.72v-6.9h3.683V7.035h-3.683zM46.3 11.97c0-.758.63-1.05 1.648-1.05a10.868 10.868 0 0 1 4.83 1.25V7.6a12.815 12.815 0 0 0-4.83-.888c-3.924 0-6.557 2.056-6.557 5.488 0 5.37 7.375 4.498 7.375 6.813 0 .906-.78 1.186-1.863 1.186-1.606 0-3.68-.664-5.307-1.55v4.63a13.461 13.461 0 0 0 5.307 1.117c4.033 0 6.813-1.992 6.813-5.485 0-5.796-7.417-4.76-7.417-6.943zM13.88 9.515c0-1.37 1.14-1.9 2.982-1.9A19.661 19.661 0 0 1 25.6 9.876v-8.27A23.184 23.184 0 0 0 16.862.001C9.762.001 5 3.72 5 9.93c0 9.716 13.342 8.138 13.342 12.326 0 1.638-1.4 2.146-3.37 2.146-2.905 0-6.657-1.202-9.6-2.802v8.378A24.353 24.353 0 0 0 14.973 32C22.27 32 27.3 28.395 27.3 22.077c0-10.486-13.42-8.613-13.42-12.56z"
|
|
6740
|
+
})));
|
|
6741
|
+
|
|
6742
|
+
var fetchCountries = function fetchCountries() {
|
|
6743
|
+
return axios__default["default"].get("".concat(BASE_URL, "/api/v1/stripe/countries"));
|
|
6744
|
+
};
|
|
6745
|
+
var countriesApi = {
|
|
6746
|
+
fetchCountries: fetchCountries
|
|
6747
|
+
};
|
|
6748
|
+
|
|
6749
|
+
var useFetchStripeCountries = function useFetchStripeCountries() {
|
|
6750
|
+
return reactQuery.useQuery(QUERY_KEYS.STRIPE_COUNTRIES, function () {
|
|
6751
|
+
return countriesApi.fetchCountries();
|
|
6752
|
+
});
|
|
6753
|
+
};
|
|
6754
|
+
|
|
6755
|
+
var POLLING_INTERVAL = 5000;
|
|
6756
|
+
var MAX_POLLING_TIME = 30000;
|
|
6757
|
+
var INITIAL_VALUES = {
|
|
6758
|
+
country: "",
|
|
6759
|
+
return_url: ""
|
|
6760
|
+
};
|
|
6761
|
+
var VALIDATION_SCHEMA = yup__namespace.object().shape({
|
|
6762
|
+
country: yup__namespace.object().required(i18next.t("neetoPayments.validations.countryRequired")),
|
|
6763
|
+
returnUrl: yup__namespace.string().url(i18next.t("neetoPayments.validations.invalidUrl"))
|
|
6764
|
+
});
|
|
6765
|
+
|
|
6766
|
+
var STEPS = {
|
|
6767
|
+
connect: "connect",
|
|
6768
|
+
configure: "configure",
|
|
6769
|
+
finish: "finish",
|
|
6770
|
+
demo: "demo"
|
|
6771
|
+
};
|
|
6772
|
+
var INTEGRATION_STEPS = [{
|
|
6773
|
+
step: "1",
|
|
6774
|
+
label: i18next.t("neetoPayments.common.connect"),
|
|
6775
|
+
isActive: false,
|
|
6776
|
+
isCompleted: false
|
|
6777
|
+
}, {
|
|
6778
|
+
step: "2",
|
|
6779
|
+
label: i18next.t("neetoPayments.common.configure"),
|
|
6780
|
+
isActive: false,
|
|
6781
|
+
isCompleted: false
|
|
6782
|
+
}, {
|
|
6783
|
+
step: "3",
|
|
6784
|
+
label: i18next.t("neetoPayments.common.finish"),
|
|
6785
|
+
isActive: false,
|
|
6786
|
+
isCompleted: true
|
|
6787
|
+
}
|
|
6788
|
+
// { step: "4", label: "demo", isActive: false, isCompleted: false },
|
|
6789
|
+
];
|
|
6790
|
+
|
|
6791
|
+
var INTEGRATION_METHOD = {
|
|
6792
|
+
useExistingAccount: "use_existing_account",
|
|
6793
|
+
createNewAccount: "create_new_account"
|
|
6794
|
+
};
|
|
6795
|
+
var STRIPE_CONNECT_URL = "/".concat(BASE_URL, "/api/v1/integrations/connect/stripe");
|
|
6796
|
+
|
|
6797
|
+
var buildRefreshUrl = function buildRefreshUrl(accountId, returnUrl) {
|
|
6798
|
+
return "/payments/api/v1/stripe/callbacks/".concat(accountId, "/refresh?return_url=").concat(returnUrl);
|
|
6799
|
+
};
|
|
6800
|
+
var buildCountryOptions = function buildCountryOptions(countries) {
|
|
6801
|
+
var _Object$entries;
|
|
6802
|
+
return (_Object$entries = Object.entries(countries)) === null || _Object$entries === void 0 ? void 0 : _Object$entries.map(function (country) {
|
|
6803
|
+
return {
|
|
6804
|
+
label: neetocist.humanize(country[0]),
|
|
6805
|
+
value: country[1]
|
|
6806
|
+
};
|
|
6807
|
+
});
|
|
6808
|
+
};
|
|
6809
|
+
|
|
6810
|
+
var AccountForm = function AccountForm(_ref) {
|
|
6811
|
+
var holdableId = _ref.holdableId,
|
|
6812
|
+
returnUrl = _ref.returnUrl;
|
|
6813
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
6814
|
+
t = _useTranslation.t;
|
|
6815
|
+
var _useState = React.useState(false),
|
|
6816
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
6817
|
+
isPolling = _useState2[0],
|
|
6818
|
+
setIsPolling = _useState2[1];
|
|
6819
|
+
var submitButtonLabel = isPolling ? t("neetoPayments.integrationModal.creating") : t("neetoPayments.common.connect");
|
|
6820
|
+
var refetchInterval = function refetchInterval() {
|
|
6821
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
6822
|
+
jobStatus = _ref2.jobStatus,
|
|
6823
|
+
onboarding = _ref2.onboarding;
|
|
6824
|
+
if (jobStatus === "complete") {
|
|
6825
|
+
window.open(onboarding === null || onboarding === void 0 ? void 0 : onboarding.url, "_self");
|
|
6826
|
+
return false;
|
|
6827
|
+
}
|
|
6828
|
+
return POLLING_INTERVAL;
|
|
6829
|
+
};
|
|
6830
|
+
var _useCreateStripeAccou = useCreateStripeAccount({
|
|
6831
|
+
onSuccess: function onSuccess() {
|
|
6832
|
+
return setIsPolling(true);
|
|
6833
|
+
}
|
|
6834
|
+
}),
|
|
6835
|
+
isCreating = _useCreateStripeAccou.isLoading,
|
|
6836
|
+
_useCreateStripeAccou2 = _useCreateStripeAccou.data,
|
|
6837
|
+
_useCreateStripeAccou3 = _useCreateStripeAccou2 === void 0 ? {} : _useCreateStripeAccou2,
|
|
6838
|
+
jobId = _useCreateStripeAccou3.jobId,
|
|
6839
|
+
createStripeAccount = _useCreateStripeAccou.mutate;
|
|
6840
|
+
usePollingStripeAccountCreationStatus(jobId, {
|
|
6841
|
+
refetchInterval: refetchInterval,
|
|
6842
|
+
enabled: neetocist.isPresent(jobId)
|
|
6843
|
+
});
|
|
6844
|
+
var _useFetchStripeCountr = useFetchStripeCountries(),
|
|
6845
|
+
isLoading = _useFetchStripeCountr.isLoading,
|
|
6846
|
+
_useFetchStripeCountr2 = _useFetchStripeCountr.data,
|
|
6847
|
+
_useFetchStripeCountr3 = _useFetchStripeCountr2 === void 0 ? {} : _useFetchStripeCountr2,
|
|
6848
|
+
_useFetchStripeCountr4 = _useFetchStripeCountr3.countries,
|
|
6849
|
+
countries = _useFetchStripeCountr4 === void 0 ? {} : _useFetchStripeCountr4;
|
|
6850
|
+
var handleSubmit = function handleSubmit(_ref3) {
|
|
6851
|
+
var country = _ref3.country;
|
|
6852
|
+
var payload = {
|
|
6853
|
+
returnUrl: returnUrl,
|
|
6854
|
+
country: country.value,
|
|
6855
|
+
holdableId: holdableId
|
|
6856
|
+
};
|
|
6857
|
+
createStripeAccount(payload);
|
|
6858
|
+
};
|
|
6859
|
+
if (isLoading) {
|
|
6860
|
+
return /*#__PURE__*/React__default["default"].createElement(PageLoader__default["default"], null);
|
|
6861
|
+
}
|
|
6862
|
+
return /*#__PURE__*/React__default["default"].createElement(formik.Form, {
|
|
6863
|
+
formikProps: {
|
|
6864
|
+
enableReinitialize: true,
|
|
6865
|
+
initialValues: INITIAL_VALUES,
|
|
6866
|
+
validationSchema: VALIDATION_SCHEMA,
|
|
6867
|
+
onSubmit: handleSubmit
|
|
6868
|
+
}
|
|
6869
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6870
|
+
className: "space-y-3"
|
|
6871
|
+
}, /*#__PURE__*/React__default["default"].createElement(formik.Select, {
|
|
6872
|
+
required: true,
|
|
6873
|
+
helpText: t("neetoPayments.integrationModal.form.helpText"),
|
|
6874
|
+
label: t("neetoPayments.integrationModal.form.label"),
|
|
6875
|
+
name: "country",
|
|
6876
|
+
options: buildCountryOptions(countries),
|
|
6877
|
+
placeholder: t("neetoPayments.integrationModal.form.placeholder")
|
|
6878
|
+
}), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
6879
|
+
disabled: isCreating || isPolling,
|
|
6880
|
+
label: submitButtonLabel,
|
|
6881
|
+
loading: isCreating || isPolling,
|
|
6882
|
+
type: "submit"
|
|
6883
|
+
})));
|
|
6884
|
+
};
|
|
6885
|
+
|
|
6886
|
+
var AccountDetails = function AccountDetails(_ref) {
|
|
6887
|
+
var holdableId = _ref.holdableId;
|
|
6888
|
+
var _useFetchConnectedStr = useFetchConnectedStripeAccount(holdableId),
|
|
6889
|
+
_useFetchConnectedStr2 = _useFetchConnectedStr.data,
|
|
6890
|
+
_useFetchConnectedStr3 = _useFetchConnectedStr2 === void 0 ? {} : _useFetchConnectedStr2,
|
|
6891
|
+
stripeAccount = _useFetchConnectedStr3.account;
|
|
6892
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
6893
|
+
t = _useTranslation.t;
|
|
6894
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6895
|
+
className: "mb-6 space-y-3"
|
|
6896
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
6897
|
+
style: "h5",
|
|
6898
|
+
weight: "medium"
|
|
6899
|
+
}, t("neetoPayments.integrationModal.account.title")), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6900
|
+
className: "grid grid-cols-4 gap-y-3"
|
|
6901
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Label, {
|
|
6902
|
+
className: "neeto-ui-text-gray-800"
|
|
6903
|
+
}, t("neetoPayments.common.id")), /*#__PURE__*/React__default["default"].createElement(neetoui.Label, {
|
|
6904
|
+
className: "neeto-ui-text-gray-800 col-span-3"
|
|
6905
|
+
}, stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.identifier), /*#__PURE__*/React__default["default"].createElement(neetoui.Label, {
|
|
6906
|
+
className: "neeto-ui-text-gray-800"
|
|
6907
|
+
}, t("neetoPayments.common.email")), /*#__PURE__*/React__default["default"].createElement(neetoui.Label, {
|
|
6908
|
+
className: "neeto-ui-text-gray-800 col-span-3"
|
|
6909
|
+
}, stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.email), /*#__PURE__*/React__default["default"].createElement(neetoui.Label, {
|
|
6910
|
+
className: "neeto-ui-text-gray-800"
|
|
6911
|
+
}, t("neetoPayments.common.country")), /*#__PURE__*/React__default["default"].createElement(neetoui.Label, {
|
|
6912
|
+
className: "neeto-ui-text-gray-800 col-span-3"
|
|
6913
|
+
}, stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.country)));
|
|
6914
|
+
};
|
|
6915
|
+
|
|
6916
|
+
var AccountProcessing = function AccountProcessing(_ref) {
|
|
6917
|
+
var holdableId = _ref.holdableId,
|
|
6918
|
+
returnUrl = _ref.returnUrl;
|
|
6919
|
+
var _useState = React.useState(false),
|
|
6920
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
6921
|
+
isAlertOpen = _useState2[0],
|
|
6922
|
+
setIsAlertOpen = _useState2[1];
|
|
6923
|
+
var _useState3 = React.useState(false),
|
|
6924
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
6925
|
+
isPolling = _useState4[0],
|
|
6926
|
+
setIsPolling = _useState4[1];
|
|
6927
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
6928
|
+
t = _useTranslation.t;
|
|
6929
|
+
var urlSearchParams = useURLSearchParams();
|
|
6930
|
+
var isStripeCallback = urlSearchParams.get("app") === "stripe";
|
|
6931
|
+
React.useEffect(function () {
|
|
6932
|
+
if (!isStripeCallback) return;
|
|
6933
|
+
setIsPolling(true);
|
|
6934
|
+
setInterval(function () {
|
|
6935
|
+
setIsPolling(false);
|
|
6936
|
+
}, MAX_POLLING_TIME);
|
|
6937
|
+
}, [isStripeCallback]);
|
|
6938
|
+
var _useFetchConnectedStr = useFetchConnectedStripeAccount(holdableId),
|
|
6939
|
+
_useFetchConnectedStr2 = _useFetchConnectedStr.data,
|
|
6940
|
+
_useFetchConnectedStr3 = _useFetchConnectedStr2 === void 0 ? {} : _useFetchConnectedStr2,
|
|
6941
|
+
stripeAccount = _useFetchConnectedStr3.account;
|
|
6942
|
+
var _useDestroyStripeAcco = useDestroyStripeAccount({
|
|
6943
|
+
onSuccess: function onSuccess() {
|
|
6944
|
+
return setIsAlertOpen(false);
|
|
6945
|
+
},
|
|
6946
|
+
holdableId: holdableId
|
|
6947
|
+
}),
|
|
6948
|
+
isStripeAccountDestroying = _useDestroyStripeAcco.isLoading,
|
|
6949
|
+
destroyStripeAccount = _useDestroyStripeAcco.mutate;
|
|
6950
|
+
var refetchInterval = function refetchInterval() {
|
|
6951
|
+
var _ref2 = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
6952
|
+
account = _ref2.account;
|
|
6953
|
+
if (isStripeCallback && !(account !== null && account !== void 0 && account.isConnected) && isPolling) {
|
|
6954
|
+
return POLLING_INTERVAL;
|
|
6955
|
+
}
|
|
6956
|
+
if (account !== null && account !== void 0 && account.isConnected) {
|
|
6957
|
+
setIsPolling(false);
|
|
6958
|
+
}
|
|
6959
|
+
return false;
|
|
6960
|
+
};
|
|
6961
|
+
usePollingStripeAccount(holdableId, {
|
|
6962
|
+
refetchInterval: refetchInterval
|
|
6963
|
+
});
|
|
6964
|
+
var isAccountProcessingFailed = isStripeCallback && !isPolling && !(stripeAccount !== null && stripeAccount !== void 0 && stripeAccount.isConnected);
|
|
6965
|
+
var buttonLabel = function buttonLabel() {
|
|
6966
|
+
if (isPolling) {
|
|
6967
|
+
return t("neetoPayments.integrationModal.creating");
|
|
6968
|
+
}
|
|
6969
|
+
if (isAccountProcessingFailed) {
|
|
6970
|
+
return t("neetoPayments.integrationModal.failedButton");
|
|
6971
|
+
}
|
|
6972
|
+
return t("neetoPayments.common.continue");
|
|
6973
|
+
};
|
|
6974
|
+
var handleUseAnotherStripeAccount = function handleUseAnotherStripeAccount() {
|
|
6975
|
+
destroyStripeAccount(stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.id);
|
|
6976
|
+
};
|
|
6977
|
+
return /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(AccountDetails, null), /*#__PURE__*/React__default["default"].createElement("div", {
|
|
6978
|
+
className: "flex flex-col items-start space-y-2"
|
|
6979
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
6980
|
+
disabled: isPolling,
|
|
6981
|
+
href: buildRefreshUrl(stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.id, returnUrl),
|
|
6982
|
+
label: buttonLabel(),
|
|
6983
|
+
loading: isPolling,
|
|
6984
|
+
size: "small"
|
|
6985
|
+
}), !isPolling && !isAccountProcessingFailed && /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
6986
|
+
disabled: isStripeAccountDestroying || isPolling,
|
|
6987
|
+
label: t("neetoPayments.integrationModal.anotherAccount"),
|
|
6988
|
+
size: "small",
|
|
6989
|
+
style: "link",
|
|
6990
|
+
onClick: function onClick() {
|
|
6991
|
+
return setIsAlertOpen(true);
|
|
6992
|
+
}
|
|
6993
|
+
})), /*#__PURE__*/React__default["default"].createElement(neetoui.Alert, {
|
|
6994
|
+
isOpen: isAlertOpen,
|
|
6995
|
+
title: t("neetoPayments.integrationModal.alert.changeTitle"),
|
|
6996
|
+
message: /*#__PURE__*/React__default["default"].createElement(reactI18next.Trans, {
|
|
6997
|
+
i18nKey: "neetoPayments.integrationModal.alert.changeMessage",
|
|
6998
|
+
values: {
|
|
6999
|
+
account: stripeAccount === null || stripeAccount === void 0 ? void 0 : stripeAccount.email
|
|
7000
|
+
}
|
|
7001
|
+
}),
|
|
7002
|
+
onClose: function onClose() {
|
|
7003
|
+
return setIsAlertOpen(false);
|
|
7004
|
+
},
|
|
7005
|
+
onSubmit: handleUseAnotherStripeAccount
|
|
7006
|
+
}));
|
|
7007
|
+
};
|
|
7008
|
+
|
|
7009
|
+
var Configure = function Configure(_ref) {
|
|
7010
|
+
var holdableId = _ref.holdableId,
|
|
7011
|
+
returnUrl = _ref.returnUrl;
|
|
7012
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
7013
|
+
t = _useTranslation.t;
|
|
7014
|
+
var _useFetchConnectedStr = useFetchConnectedStripeAccount(holdableId),
|
|
7015
|
+
_useFetchConnectedStr2 = _useFetchConnectedStr.data,
|
|
7016
|
+
_useFetchConnectedStr3 = _useFetchConnectedStr2 === void 0 ? {} : _useFetchConnectedStr2,
|
|
7017
|
+
stripeAccount = _useFetchConnectedStr3.account;
|
|
7018
|
+
var handleStripeAccountCreated = function handleStripeAccountCreated(_ref2) {
|
|
7019
|
+
var onboarding = _ref2.onboarding;
|
|
7020
|
+
window.open(onboarding === null || onboarding === void 0 ? void 0 : onboarding.url, "_self");
|
|
7021
|
+
};
|
|
7022
|
+
var connectDescription = neetocist.isPresent(stripeAccount) ? t("neetoPayments.integrationModal.linkedDescription") : t("neetoPayments.integrationModal.subtitle");
|
|
7023
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
7024
|
+
className: "mx-auto w-full max-w-lg space-y-8"
|
|
7025
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
7026
|
+
className: "space-y-2"
|
|
7027
|
+
}, /*#__PURE__*/React__default["default"].createElement(SvgStripe, null), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
7028
|
+
"data-cy": "configure-payment-title",
|
|
7029
|
+
style: "h2",
|
|
7030
|
+
weight: "semibold"
|
|
7031
|
+
}, t("neetoPayments.integrationModal.title")), /*#__PURE__*/React__default["default"].createElement(neetoui.Label, {
|
|
7032
|
+
className: "leading-snug"
|
|
7033
|
+
}, connectDescription)), neetocist.isPresent(stripeAccount) ? /*#__PURE__*/React__default["default"].createElement(AccountProcessing, {
|
|
7034
|
+
onAccountCreated: handleStripeAccountCreated,
|
|
7035
|
+
holdableId: holdableId,
|
|
7036
|
+
returnUrl: returnUrl
|
|
7037
|
+
}) : /*#__PURE__*/React__default["default"].createElement(AccountForm, {
|
|
7038
|
+
holdableId: holdableId,
|
|
7039
|
+
returnUrl: returnUrl,
|
|
7040
|
+
onAccountCreated: handleStripeAccountCreated
|
|
7041
|
+
}));
|
|
7042
|
+
};
|
|
7043
|
+
|
|
7044
|
+
/*! @license DOMPurify 3.0.2 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.0.2/LICENSE */
|
|
7045
|
+
|
|
7046
|
+
const {
|
|
7047
|
+
entries,
|
|
7048
|
+
setPrototypeOf,
|
|
7049
|
+
isFrozen,
|
|
7050
|
+
getPrototypeOf,
|
|
7051
|
+
getOwnPropertyDescriptor
|
|
7052
|
+
} = Object;
|
|
7053
|
+
let {
|
|
7054
|
+
freeze,
|
|
7055
|
+
seal,
|
|
7056
|
+
create
|
|
7057
|
+
} = Object; // eslint-disable-line import/no-mutable-exports
|
|
7058
|
+
|
|
7059
|
+
let {
|
|
7060
|
+
apply,
|
|
7061
|
+
construct
|
|
7062
|
+
} = typeof Reflect !== 'undefined' && Reflect;
|
|
7063
|
+
|
|
7064
|
+
if (!apply) {
|
|
7065
|
+
apply = function apply(fun, thisValue, args) {
|
|
7066
|
+
return fun.apply(thisValue, args);
|
|
7067
|
+
};
|
|
7068
|
+
}
|
|
7069
|
+
|
|
7070
|
+
if (!freeze) {
|
|
7071
|
+
freeze = function freeze(x) {
|
|
7072
|
+
return x;
|
|
7073
|
+
};
|
|
7074
|
+
}
|
|
7075
|
+
|
|
7076
|
+
if (!seal) {
|
|
7077
|
+
seal = function seal(x) {
|
|
7078
|
+
return x;
|
|
7079
|
+
};
|
|
7080
|
+
}
|
|
7081
|
+
|
|
7082
|
+
if (!construct) {
|
|
7083
|
+
construct = function construct(Func, args) {
|
|
7084
|
+
return new Func(...args);
|
|
7085
|
+
};
|
|
7086
|
+
}
|
|
7087
|
+
|
|
7088
|
+
const arrayForEach = unapply(Array.prototype.forEach);
|
|
7089
|
+
const arrayPop = unapply(Array.prototype.pop);
|
|
7090
|
+
const arrayPush = unapply(Array.prototype.push);
|
|
7091
|
+
const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
7092
|
+
const stringToString = unapply(String.prototype.toString);
|
|
7093
|
+
const stringMatch = unapply(String.prototype.match);
|
|
7094
|
+
const stringReplace = unapply(String.prototype.replace);
|
|
7095
|
+
const stringIndexOf = unapply(String.prototype.indexOf);
|
|
7096
|
+
const stringTrim = unapply(String.prototype.trim);
|
|
7097
|
+
const regExpTest = unapply(RegExp.prototype.test);
|
|
7098
|
+
const typeErrorCreate = unconstruct(TypeError);
|
|
7099
|
+
function unapply(func) {
|
|
7100
|
+
return function (thisArg) {
|
|
7101
|
+
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
7102
|
+
args[_key - 1] = arguments[_key];
|
|
7103
|
+
}
|
|
7104
|
+
|
|
7105
|
+
return apply(func, thisArg, args);
|
|
7106
|
+
};
|
|
7107
|
+
}
|
|
7108
|
+
function unconstruct(func) {
|
|
7109
|
+
return function () {
|
|
7110
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
|
7111
|
+
args[_key2] = arguments[_key2];
|
|
7112
|
+
}
|
|
7113
|
+
|
|
7114
|
+
return construct(func, args);
|
|
7115
|
+
};
|
|
7116
|
+
}
|
|
7117
|
+
/* Add properties to a lookup table */
|
|
7118
|
+
|
|
7119
|
+
function addToSet(set, array, transformCaseFunc) {
|
|
7120
|
+
transformCaseFunc = transformCaseFunc ? transformCaseFunc : stringToLowerCase;
|
|
7121
|
+
|
|
7122
|
+
if (setPrototypeOf) {
|
|
7123
|
+
// Make 'in' and truthy checks like Boolean(set.constructor)
|
|
7124
|
+
// independent of any properties defined on Object.prototype.
|
|
7125
|
+
// Prevent prototype setters from intercepting set as a this value.
|
|
7126
|
+
setPrototypeOf(set, null);
|
|
7127
|
+
}
|
|
7128
|
+
|
|
7129
|
+
let l = array.length;
|
|
7130
|
+
|
|
7131
|
+
while (l--) {
|
|
7132
|
+
let element = array[l];
|
|
7133
|
+
|
|
7134
|
+
if (typeof element === 'string') {
|
|
7135
|
+
const lcElement = transformCaseFunc(element);
|
|
7136
|
+
|
|
7137
|
+
if (lcElement !== element) {
|
|
7138
|
+
// Config presets (e.g. tags.js, attrs.js) are immutable.
|
|
7139
|
+
if (!isFrozen(array)) {
|
|
7140
|
+
array[l] = lcElement;
|
|
7141
|
+
}
|
|
7142
|
+
|
|
7143
|
+
element = lcElement;
|
|
7144
|
+
}
|
|
7145
|
+
}
|
|
7146
|
+
|
|
7147
|
+
set[element] = true;
|
|
7148
|
+
}
|
|
7149
|
+
|
|
7150
|
+
return set;
|
|
7151
|
+
}
|
|
7152
|
+
/* Shallow clone an object */
|
|
7153
|
+
|
|
7154
|
+
function clone(object) {
|
|
7155
|
+
const newObject = create(null);
|
|
7156
|
+
|
|
7157
|
+
for (const [property, value] of entries(object)) {
|
|
7158
|
+
newObject[property] = value;
|
|
7159
|
+
}
|
|
7160
|
+
|
|
7161
|
+
return newObject;
|
|
7162
|
+
}
|
|
7163
|
+
/* This method automatically checks if the prop is function
|
|
7164
|
+
* or getter and behaves accordingly. */
|
|
7165
|
+
|
|
7166
|
+
function lookupGetter(object, prop) {
|
|
7167
|
+
while (object !== null) {
|
|
7168
|
+
const desc = getOwnPropertyDescriptor(object, prop);
|
|
7169
|
+
|
|
7170
|
+
if (desc) {
|
|
7171
|
+
if (desc.get) {
|
|
7172
|
+
return unapply(desc.get);
|
|
7173
|
+
}
|
|
7174
|
+
|
|
7175
|
+
if (typeof desc.value === 'function') {
|
|
7176
|
+
return unapply(desc.value);
|
|
7177
|
+
}
|
|
7178
|
+
}
|
|
7179
|
+
|
|
7180
|
+
object = getPrototypeOf(object);
|
|
7181
|
+
}
|
|
7182
|
+
|
|
7183
|
+
function fallbackValue(element) {
|
|
7184
|
+
console.warn('fallback value for', element);
|
|
7185
|
+
return null;
|
|
7186
|
+
}
|
|
7187
|
+
|
|
7188
|
+
return fallbackValue;
|
|
7189
|
+
}
|
|
7190
|
+
|
|
7191
|
+
const html$1 = freeze(['a', 'abbr', 'acronym', 'address', 'area', 'article', 'aside', 'audio', 'b', 'bdi', 'bdo', 'big', 'blink', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'center', 'cite', 'code', 'col', 'colgroup', 'content', 'data', 'datalist', 'dd', 'decorator', 'del', 'details', 'dfn', 'dialog', 'dir', 'div', 'dl', 'dt', 'element', 'em', 'fieldset', 'figcaption', 'figure', 'font', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'img', 'input', 'ins', 'kbd', 'label', 'legend', 'li', 'main', 'map', 'mark', 'marquee', 'menu', 'menuitem', 'meter', 'nav', 'nobr', 'ol', 'optgroup', 'option', 'output', 'p', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'section', 'select', 'shadow', 'small', 'source', 'spacer', 'span', 'strike', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'template', 'textarea', 'tfoot', 'th', 'thead', 'time', 'tr', 'track', 'tt', 'u', 'ul', 'var', 'video', 'wbr']); // SVG
|
|
7192
|
+
|
|
7193
|
+
const svg$1 = freeze(['svg', 'a', 'altglyph', 'altglyphdef', 'altglyphitem', 'animatecolor', 'animatemotion', 'animatetransform', 'circle', 'clippath', 'defs', 'desc', 'ellipse', 'filter', 'font', 'g', 'glyph', 'glyphref', 'hkern', 'image', 'line', 'lineargradient', 'marker', 'mask', 'metadata', 'mpath', 'path', 'pattern', 'polygon', 'polyline', 'radialgradient', 'rect', 'stop', 'style', 'switch', 'symbol', 'text', 'textpath', 'title', 'tref', 'tspan', 'view', 'vkern']);
|
|
7194
|
+
const svgFilters = freeze(['feBlend', 'feColorMatrix', 'feComponentTransfer', 'feComposite', 'feConvolveMatrix', 'feDiffuseLighting', 'feDisplacementMap', 'feDistantLight', 'feFlood', 'feFuncA', 'feFuncB', 'feFuncG', 'feFuncR', 'feGaussianBlur', 'feImage', 'feMerge', 'feMergeNode', 'feMorphology', 'feOffset', 'fePointLight', 'feSpecularLighting', 'feSpotLight', 'feTile', 'feTurbulence']); // List of SVG elements that are disallowed by default.
|
|
7195
|
+
// We still need to know them so that we can do namespace
|
|
7196
|
+
// checks properly in case one wants to add them to
|
|
7197
|
+
// allow-list.
|
|
7198
|
+
|
|
7199
|
+
const svgDisallowed = freeze(['animate', 'color-profile', 'cursor', 'discard', 'fedropshadow', 'font-face', 'font-face-format', 'font-face-name', 'font-face-src', 'font-face-uri', 'foreignobject', 'hatch', 'hatchpath', 'mesh', 'meshgradient', 'meshpatch', 'meshrow', 'missing-glyph', 'script', 'set', 'solidcolor', 'unknown', 'use']);
|
|
7200
|
+
const mathMl$1 = freeze(['math', 'menclose', 'merror', 'mfenced', 'mfrac', 'mglyph', 'mi', 'mlabeledtr', 'mmultiscripts', 'mn', 'mo', 'mover', 'mpadded', 'mphantom', 'mroot', 'mrow', 'ms', 'mspace', 'msqrt', 'mstyle', 'msub', 'msup', 'msubsup', 'mtable', 'mtd', 'mtext', 'mtr', 'munder', 'munderover', 'mprescripts']); // Similarly to SVG, we want to know all MathML elements,
|
|
7201
|
+
// even those that we disallow by default.
|
|
7202
|
+
|
|
7203
|
+
const mathMlDisallowed = freeze(['maction', 'maligngroup', 'malignmark', 'mlongdiv', 'mscarries', 'mscarry', 'msgroup', 'mstack', 'msline', 'msrow', 'semantics', 'annotation', 'annotation-xml', 'mprescripts', 'none']);
|
|
7204
|
+
const text = freeze(['#text']);
|
|
7205
|
+
|
|
7206
|
+
const html = freeze(['accept', 'action', 'align', 'alt', 'autocapitalize', 'autocomplete', 'autopictureinpicture', 'autoplay', 'background', 'bgcolor', 'border', 'capture', 'cellpadding', 'cellspacing', 'checked', 'cite', 'class', 'clear', 'color', 'cols', 'colspan', 'controls', 'controlslist', 'coords', 'crossorigin', 'datetime', 'decoding', 'default', 'dir', 'disabled', 'disablepictureinpicture', 'disableremoteplayback', 'download', 'draggable', 'enctype', 'enterkeyhint', 'face', 'for', 'headers', 'height', 'hidden', 'high', 'href', 'hreflang', 'id', 'inputmode', 'integrity', 'ismap', 'kind', 'label', 'lang', 'list', 'loading', 'loop', 'low', 'max', 'maxlength', 'media', 'method', 'min', 'minlength', 'multiple', 'muted', 'name', 'nonce', 'noshade', 'novalidate', 'nowrap', 'open', 'optimum', 'pattern', 'placeholder', 'playsinline', 'poster', 'preload', 'pubdate', 'radiogroup', 'readonly', 'rel', 'required', 'rev', 'reversed', 'role', 'rows', 'rowspan', 'spellcheck', 'scope', 'selected', 'shape', 'size', 'sizes', 'span', 'srclang', 'start', 'src', 'srcset', 'step', 'style', 'summary', 'tabindex', 'title', 'translate', 'type', 'usemap', 'valign', 'value', 'width', 'xmlns', 'slot']);
|
|
7207
|
+
const svg = freeze(['accent-height', 'accumulate', 'additive', 'alignment-baseline', 'ascent', 'attributename', 'attributetype', 'azimuth', 'basefrequency', 'baseline-shift', 'begin', 'bias', 'by', 'class', 'clip', 'clippathunits', 'clip-path', 'clip-rule', 'color', 'color-interpolation', 'color-interpolation-filters', 'color-profile', 'color-rendering', 'cx', 'cy', 'd', 'dx', 'dy', 'diffuseconstant', 'direction', 'display', 'divisor', 'dur', 'edgemode', 'elevation', 'end', 'fill', 'fill-opacity', 'fill-rule', 'filter', 'filterunits', 'flood-color', 'flood-opacity', 'font-family', 'font-size', 'font-size-adjust', 'font-stretch', 'font-style', 'font-variant', 'font-weight', 'fx', 'fy', 'g1', 'g2', 'glyph-name', 'glyphref', 'gradientunits', 'gradienttransform', 'height', 'href', 'id', 'image-rendering', 'in', 'in2', 'k', 'k1', 'k2', 'k3', 'k4', 'kerning', 'keypoints', 'keysplines', 'keytimes', 'lang', 'lengthadjust', 'letter-spacing', 'kernelmatrix', 'kernelunitlength', 'lighting-color', 'local', 'marker-end', 'marker-mid', 'marker-start', 'markerheight', 'markerunits', 'markerwidth', 'maskcontentunits', 'maskunits', 'max', 'mask', 'media', 'method', 'mode', 'min', 'name', 'numoctaves', 'offset', 'operator', 'opacity', 'order', 'orient', 'orientation', 'origin', 'overflow', 'paint-order', 'path', 'pathlength', 'patterncontentunits', 'patterntransform', 'patternunits', 'points', 'preservealpha', 'preserveaspectratio', 'primitiveunits', 'r', 'rx', 'ry', 'radius', 'refx', 'refy', 'repeatcount', 'repeatdur', 'restart', 'result', 'rotate', 'scale', 'seed', 'shape-rendering', 'specularconstant', 'specularexponent', 'spreadmethod', 'startoffset', 'stddeviation', 'stitchtiles', 'stop-color', 'stop-opacity', 'stroke-dasharray', 'stroke-dashoffset', 'stroke-linecap', 'stroke-linejoin', 'stroke-miterlimit', 'stroke-opacity', 'stroke', 'stroke-width', 'style', 'surfacescale', 'systemlanguage', 'tabindex', 'targetx', 'targety', 'transform', 'transform-origin', 'text-anchor', 'text-decoration', 'text-rendering', 'textlength', 'type', 'u1', 'u2', 'unicode', 'values', 'viewbox', 'visibility', 'version', 'vert-adv-y', 'vert-origin-x', 'vert-origin-y', 'width', 'word-spacing', 'wrap', 'writing-mode', 'xchannelselector', 'ychannelselector', 'x', 'x1', 'x2', 'xmlns', 'y', 'y1', 'y2', 'z', 'zoomandpan']);
|
|
7208
|
+
const mathMl = freeze(['accent', 'accentunder', 'align', 'bevelled', 'close', 'columnsalign', 'columnlines', 'columnspan', 'denomalign', 'depth', 'dir', 'display', 'displaystyle', 'encoding', 'fence', 'frame', 'height', 'href', 'id', 'largeop', 'length', 'linethickness', 'lspace', 'lquote', 'mathbackground', 'mathcolor', 'mathsize', 'mathvariant', 'maxsize', 'minsize', 'movablelimits', 'notation', 'numalign', 'open', 'rowalign', 'rowlines', 'rowspacing', 'rowspan', 'rspace', 'rquote', 'scriptlevel', 'scriptminsize', 'scriptsizemultiplier', 'selection', 'separator', 'separators', 'stretchy', 'subscriptshift', 'supscriptshift', 'symmetric', 'voffset', 'width', 'xmlns']);
|
|
7209
|
+
const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:xlink']);
|
|
7210
|
+
|
|
7211
|
+
const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
|
|
7212
|
+
|
|
7213
|
+
const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
|
7214
|
+
const TMPLIT_EXPR = seal(/\${[\w\W]*}/gm);
|
|
7215
|
+
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]/); // eslint-disable-line no-useless-escape
|
|
7216
|
+
|
|
7217
|
+
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
|
7218
|
+
|
|
7219
|
+
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
7220
|
+
);
|
|
7221
|
+
const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
7222
|
+
const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
|
|
7223
|
+
);
|
|
7224
|
+
const DOCTYPE_NAME = seal(/^html$/i);
|
|
7225
|
+
|
|
7226
|
+
var EXPRESSIONS = /*#__PURE__*/Object.freeze({
|
|
7227
|
+
__proto__: null,
|
|
7228
|
+
MUSTACHE_EXPR: MUSTACHE_EXPR,
|
|
7229
|
+
ERB_EXPR: ERB_EXPR,
|
|
7230
|
+
TMPLIT_EXPR: TMPLIT_EXPR,
|
|
7231
|
+
DATA_ATTR: DATA_ATTR,
|
|
7232
|
+
ARIA_ATTR: ARIA_ATTR,
|
|
7233
|
+
IS_ALLOWED_URI: IS_ALLOWED_URI,
|
|
7234
|
+
IS_SCRIPT_OR_DATA: IS_SCRIPT_OR_DATA,
|
|
7235
|
+
ATTR_WHITESPACE: ATTR_WHITESPACE,
|
|
7236
|
+
DOCTYPE_NAME: DOCTYPE_NAME
|
|
7237
|
+
});
|
|
7238
|
+
|
|
7239
|
+
const getGlobal = () => typeof window === 'undefined' ? null : window;
|
|
7240
|
+
/**
|
|
7241
|
+
* Creates a no-op policy for internal use only.
|
|
7242
|
+
* Don't export this function outside this module!
|
|
7243
|
+
* @param {?TrustedTypePolicyFactory} trustedTypes The policy factory.
|
|
7244
|
+
* @param {Document} document The document object (to determine policy name suffix)
|
|
7245
|
+
* @return {?TrustedTypePolicy} The policy created (or null, if Trusted Types
|
|
7246
|
+
* are not supported).
|
|
7247
|
+
*/
|
|
7248
|
+
|
|
7249
|
+
|
|
7250
|
+
const _createTrustedTypesPolicy = function _createTrustedTypesPolicy(trustedTypes, document) {
|
|
7251
|
+
if (typeof trustedTypes !== 'object' || typeof trustedTypes.createPolicy !== 'function') {
|
|
7252
|
+
return null;
|
|
7253
|
+
} // Allow the callers to control the unique policy name
|
|
7254
|
+
// by adding a data-tt-policy-suffix to the script element with the DOMPurify.
|
|
7255
|
+
// Policy creation with duplicate names throws in Trusted Types.
|
|
7256
|
+
|
|
7257
|
+
|
|
7258
|
+
let suffix = null;
|
|
7259
|
+
const ATTR_NAME = 'data-tt-policy-suffix';
|
|
7260
|
+
|
|
7261
|
+
if (document.currentScript && document.currentScript.hasAttribute(ATTR_NAME)) {
|
|
7262
|
+
suffix = document.currentScript.getAttribute(ATTR_NAME);
|
|
7263
|
+
}
|
|
7264
|
+
|
|
7265
|
+
const policyName = 'dompurify' + (suffix ? '#' + suffix : '');
|
|
7266
|
+
|
|
7267
|
+
try {
|
|
7268
|
+
return trustedTypes.createPolicy(policyName, {
|
|
7269
|
+
createHTML(html) {
|
|
7270
|
+
return html;
|
|
7271
|
+
},
|
|
7272
|
+
|
|
7273
|
+
createScriptURL(scriptUrl) {
|
|
7274
|
+
return scriptUrl;
|
|
7275
|
+
}
|
|
7276
|
+
|
|
7277
|
+
});
|
|
7278
|
+
} catch (_) {
|
|
7279
|
+
// Policy creation failed (most likely another DOMPurify script has
|
|
7280
|
+
// already run). Skip creating the policy, as this will only cause errors
|
|
7281
|
+
// if TT are enforced.
|
|
7282
|
+
console.warn('TrustedTypes policy ' + policyName + ' could not be created.');
|
|
7283
|
+
return null;
|
|
7284
|
+
}
|
|
7285
|
+
};
|
|
7286
|
+
|
|
7287
|
+
function createDOMPurify() {
|
|
7288
|
+
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
7289
|
+
|
|
7290
|
+
const DOMPurify = root => createDOMPurify(root);
|
|
7291
|
+
/**
|
|
7292
|
+
* Version label, exposed for easier checks
|
|
7293
|
+
* if DOMPurify is up to date or not
|
|
7294
|
+
*/
|
|
7295
|
+
|
|
7296
|
+
|
|
7297
|
+
DOMPurify.version = '3.0.2';
|
|
7298
|
+
/**
|
|
7299
|
+
* Array of elements that DOMPurify removed during sanitation.
|
|
7300
|
+
* Empty if nothing was removed.
|
|
7301
|
+
*/
|
|
7302
|
+
|
|
7303
|
+
DOMPurify.removed = [];
|
|
7304
|
+
|
|
7305
|
+
if (!window || !window.document || window.document.nodeType !== 9) {
|
|
7306
|
+
// Not running in a browser, provide a factory function
|
|
7307
|
+
// so that you can pass your own Window
|
|
7308
|
+
DOMPurify.isSupported = false;
|
|
7309
|
+
return DOMPurify;
|
|
7310
|
+
}
|
|
7311
|
+
|
|
7312
|
+
const originalDocument = window.document;
|
|
7313
|
+
let {
|
|
7314
|
+
document
|
|
7315
|
+
} = window;
|
|
7316
|
+
const {
|
|
7317
|
+
DocumentFragment,
|
|
7318
|
+
HTMLTemplateElement,
|
|
7319
|
+
Node,
|
|
7320
|
+
Element,
|
|
7321
|
+
NodeFilter,
|
|
7322
|
+
NamedNodeMap = window.NamedNodeMap || window.MozNamedAttrMap,
|
|
7323
|
+
HTMLFormElement,
|
|
7324
|
+
DOMParser,
|
|
7325
|
+
trustedTypes
|
|
7326
|
+
} = window;
|
|
7327
|
+
const ElementPrototype = Element.prototype;
|
|
7328
|
+
const cloneNode = lookupGetter(ElementPrototype, 'cloneNode');
|
|
7329
|
+
const getNextSibling = lookupGetter(ElementPrototype, 'nextSibling');
|
|
7330
|
+
const getChildNodes = lookupGetter(ElementPrototype, 'childNodes');
|
|
7331
|
+
const getParentNode = lookupGetter(ElementPrototype, 'parentNode'); // As per issue #47, the web-components registry is inherited by a
|
|
7332
|
+
// new document created via createHTMLDocument. As per the spec
|
|
7333
|
+
// (http://w3c.github.io/webcomponents/spec/custom/#creating-and-passing-registries)
|
|
7334
|
+
// a new empty registry is used when creating a template contents owner
|
|
7335
|
+
// document, so we use that as our parent document to ensure nothing
|
|
7336
|
+
// is inherited.
|
|
7337
|
+
|
|
7338
|
+
if (typeof HTMLTemplateElement === 'function') {
|
|
7339
|
+
const template = document.createElement('template');
|
|
7340
|
+
|
|
7341
|
+
if (template.content && template.content.ownerDocument) {
|
|
7342
|
+
document = template.content.ownerDocument;
|
|
7343
|
+
}
|
|
7344
|
+
}
|
|
7345
|
+
|
|
7346
|
+
const trustedTypesPolicy = _createTrustedTypesPolicy(trustedTypes, originalDocument);
|
|
7347
|
+
|
|
7348
|
+
const emptyHTML = trustedTypesPolicy ? trustedTypesPolicy.createHTML('') : '';
|
|
7349
|
+
const {
|
|
7350
|
+
implementation,
|
|
7351
|
+
createNodeIterator,
|
|
7352
|
+
createDocumentFragment,
|
|
7353
|
+
getElementsByTagName
|
|
7354
|
+
} = document;
|
|
7355
|
+
const {
|
|
7356
|
+
importNode
|
|
7357
|
+
} = originalDocument;
|
|
7358
|
+
let hooks = {};
|
|
7359
|
+
/**
|
|
7360
|
+
* Expose whether this browser supports running the full DOMPurify.
|
|
7361
|
+
*/
|
|
7362
|
+
|
|
7363
|
+
DOMPurify.isSupported = typeof entries === 'function' && typeof getParentNode === 'function' && implementation && typeof implementation.createHTMLDocument !== 'undefined';
|
|
7364
|
+
const {
|
|
7365
|
+
MUSTACHE_EXPR,
|
|
7366
|
+
ERB_EXPR,
|
|
7367
|
+
TMPLIT_EXPR,
|
|
7368
|
+
DATA_ATTR,
|
|
7369
|
+
ARIA_ATTR,
|
|
7370
|
+
IS_SCRIPT_OR_DATA,
|
|
7371
|
+
ATTR_WHITESPACE
|
|
7372
|
+
} = EXPRESSIONS;
|
|
7373
|
+
let {
|
|
7374
|
+
IS_ALLOWED_URI: IS_ALLOWED_URI$1
|
|
7375
|
+
} = EXPRESSIONS;
|
|
7376
|
+
/**
|
|
7377
|
+
* We consider the elements and attributes below to be safe. Ideally
|
|
7378
|
+
* don't add any new ones but feel free to remove unwanted ones.
|
|
7379
|
+
*/
|
|
7380
|
+
|
|
7381
|
+
/* allowed element names */
|
|
7382
|
+
|
|
7383
|
+
let ALLOWED_TAGS = null;
|
|
7384
|
+
const DEFAULT_ALLOWED_TAGS = addToSet({}, [...html$1, ...svg$1, ...svgFilters, ...mathMl$1, ...text]);
|
|
7385
|
+
/* Allowed attribute names */
|
|
7386
|
+
|
|
7387
|
+
let ALLOWED_ATTR = null;
|
|
7388
|
+
const DEFAULT_ALLOWED_ATTR = addToSet({}, [...html, ...svg, ...mathMl, ...xml]);
|
|
7389
|
+
/*
|
|
7390
|
+
* Configure how DOMPUrify should handle custom elements and their attributes as well as customized built-in elements.
|
|
7391
|
+
* @property {RegExp|Function|null} tagNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any custom elements)
|
|
7392
|
+
* @property {RegExp|Function|null} attributeNameCheck one of [null, regexPattern, predicate]. Default: `null` (disallow any attributes not on the allow list)
|
|
7393
|
+
* @property {boolean} allowCustomizedBuiltInElements allow custom elements derived from built-ins if they pass CUSTOM_ELEMENT_HANDLING.tagNameCheck. Default: `false`.
|
|
7394
|
+
*/
|
|
7395
|
+
|
|
7396
|
+
let CUSTOM_ELEMENT_HANDLING = Object.seal(Object.create(null, {
|
|
7397
|
+
tagNameCheck: {
|
|
7398
|
+
writable: true,
|
|
7399
|
+
configurable: false,
|
|
7400
|
+
enumerable: true,
|
|
7401
|
+
value: null
|
|
7402
|
+
},
|
|
7403
|
+
attributeNameCheck: {
|
|
7404
|
+
writable: true,
|
|
7405
|
+
configurable: false,
|
|
7406
|
+
enumerable: true,
|
|
7407
|
+
value: null
|
|
7408
|
+
},
|
|
7409
|
+
allowCustomizedBuiltInElements: {
|
|
7410
|
+
writable: true,
|
|
7411
|
+
configurable: false,
|
|
7412
|
+
enumerable: true,
|
|
7413
|
+
value: false
|
|
7414
|
+
}
|
|
7415
|
+
}));
|
|
7416
|
+
/* Explicitly forbidden tags (overrides ALLOWED_TAGS/ADD_TAGS) */
|
|
7417
|
+
|
|
7418
|
+
let FORBID_TAGS = null;
|
|
7419
|
+
/* Explicitly forbidden attributes (overrides ALLOWED_ATTR/ADD_ATTR) */
|
|
7420
|
+
|
|
7421
|
+
let FORBID_ATTR = null;
|
|
7422
|
+
/* Decide if ARIA attributes are okay */
|
|
7423
|
+
|
|
7424
|
+
let ALLOW_ARIA_ATTR = true;
|
|
7425
|
+
/* Decide if custom data attributes are okay */
|
|
7426
|
+
|
|
7427
|
+
let ALLOW_DATA_ATTR = true;
|
|
7428
|
+
/* Decide if unknown protocols are okay */
|
|
7429
|
+
|
|
7430
|
+
let ALLOW_UNKNOWN_PROTOCOLS = false;
|
|
7431
|
+
/* Decide if self-closing tags in attributes are allowed.
|
|
7432
|
+
* Usually removed due to a mXSS issue in jQuery 3.0 */
|
|
7433
|
+
|
|
7434
|
+
let ALLOW_SELF_CLOSE_IN_ATTR = true;
|
|
7435
|
+
/* Output should be safe for common template engines.
|
|
7436
|
+
* This means, DOMPurify removes data attributes, mustaches and ERB
|
|
7437
|
+
*/
|
|
7438
|
+
|
|
7439
|
+
let SAFE_FOR_TEMPLATES = false;
|
|
7440
|
+
/* Decide if document with <html>... should be returned */
|
|
7441
|
+
|
|
7442
|
+
let WHOLE_DOCUMENT = false;
|
|
7443
|
+
/* Track whether config is already set on this instance of DOMPurify. */
|
|
7444
|
+
|
|
7445
|
+
let SET_CONFIG = false;
|
|
7446
|
+
/* Decide if all elements (e.g. style, script) must be children of
|
|
7447
|
+
* document.body. By default, browsers might move them to document.head */
|
|
7448
|
+
|
|
7449
|
+
let FORCE_BODY = false;
|
|
7450
|
+
/* Decide if a DOM `HTMLBodyElement` should be returned, instead of a html
|
|
7451
|
+
* string (or a TrustedHTML object if Trusted Types are supported).
|
|
7452
|
+
* If `WHOLE_DOCUMENT` is enabled a `HTMLHtmlElement` will be returned instead
|
|
7453
|
+
*/
|
|
7454
|
+
|
|
7455
|
+
let RETURN_DOM = false;
|
|
7456
|
+
/* Decide if a DOM `DocumentFragment` should be returned, instead of a html
|
|
7457
|
+
* string (or a TrustedHTML object if Trusted Types are supported) */
|
|
7458
|
+
|
|
7459
|
+
let RETURN_DOM_FRAGMENT = false;
|
|
7460
|
+
/* Try to return a Trusted Type object instead of a string, return a string in
|
|
7461
|
+
* case Trusted Types are not supported */
|
|
7462
|
+
|
|
7463
|
+
let RETURN_TRUSTED_TYPE = false;
|
|
7464
|
+
/* Output should be free from DOM clobbering attacks?
|
|
7465
|
+
* This sanitizes markups named with colliding, clobberable built-in DOM APIs.
|
|
7466
|
+
*/
|
|
7467
|
+
|
|
7468
|
+
let SANITIZE_DOM = true;
|
|
7469
|
+
/* Achieve full DOM Clobbering protection by isolating the namespace of named
|
|
7470
|
+
* properties and JS variables, mitigating attacks that abuse the HTML/DOM spec rules.
|
|
7471
|
+
*
|
|
7472
|
+
* HTML/DOM spec rules that enable DOM Clobbering:
|
|
7473
|
+
* - Named Access on Window (§7.3.3)
|
|
7474
|
+
* - DOM Tree Accessors (§3.1.5)
|
|
7475
|
+
* - Form Element Parent-Child Relations (§4.10.3)
|
|
7476
|
+
* - Iframe srcdoc / Nested WindowProxies (§4.8.5)
|
|
7477
|
+
* - HTMLCollection (§4.2.10.2)
|
|
7478
|
+
*
|
|
7479
|
+
* Namespace isolation is implemented by prefixing `id` and `name` attributes
|
|
7480
|
+
* with a constant string, i.e., `user-content-`
|
|
7481
|
+
*/
|
|
7482
|
+
|
|
7483
|
+
let SANITIZE_NAMED_PROPS = false;
|
|
7484
|
+
const SANITIZE_NAMED_PROPS_PREFIX = 'user-content-';
|
|
7485
|
+
/* Keep element content when removing element? */
|
|
7486
|
+
|
|
7487
|
+
let KEEP_CONTENT = true;
|
|
7488
|
+
/* If a `Node` is passed to sanitize(), then performs sanitization in-place instead
|
|
7489
|
+
* of importing it into a new Document and returning a sanitized copy */
|
|
7490
|
+
|
|
7491
|
+
let IN_PLACE = false;
|
|
7492
|
+
/* Allow usage of profiles like html, svg and mathMl */
|
|
7493
|
+
|
|
7494
|
+
let USE_PROFILES = {};
|
|
7495
|
+
/* Tags to ignore content of when KEEP_CONTENT is true */
|
|
7496
|
+
|
|
7497
|
+
let FORBID_CONTENTS = null;
|
|
7498
|
+
const DEFAULT_FORBID_CONTENTS = addToSet({}, ['annotation-xml', 'audio', 'colgroup', 'desc', 'foreignobject', 'head', 'iframe', 'math', 'mi', 'mn', 'mo', 'ms', 'mtext', 'noembed', 'noframes', 'noscript', 'plaintext', 'script', 'style', 'svg', 'template', 'thead', 'title', 'video', 'xmp']);
|
|
7499
|
+
/* Tags that are safe for data: URIs */
|
|
7500
|
+
|
|
7501
|
+
let DATA_URI_TAGS = null;
|
|
7502
|
+
const DEFAULT_DATA_URI_TAGS = addToSet({}, ['audio', 'video', 'img', 'source', 'image', 'track']);
|
|
7503
|
+
/* Attributes safe for values like "javascript:" */
|
|
7504
|
+
|
|
7505
|
+
let URI_SAFE_ATTRIBUTES = null;
|
|
7506
|
+
const DEFAULT_URI_SAFE_ATTRIBUTES = addToSet({}, ['alt', 'class', 'for', 'id', 'label', 'name', 'pattern', 'placeholder', 'role', 'summary', 'title', 'value', 'style', 'xmlns']);
|
|
7507
|
+
const MATHML_NAMESPACE = 'http://www.w3.org/1998/Math/MathML';
|
|
7508
|
+
const SVG_NAMESPACE = 'http://www.w3.org/2000/svg';
|
|
7509
|
+
const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
7510
|
+
/* Document namespace */
|
|
7511
|
+
|
|
7512
|
+
let NAMESPACE = HTML_NAMESPACE;
|
|
7513
|
+
let IS_EMPTY_INPUT = false;
|
|
7514
|
+
/* Allowed XHTML+XML namespaces */
|
|
7515
|
+
|
|
7516
|
+
let ALLOWED_NAMESPACES = null;
|
|
7517
|
+
const DEFAULT_ALLOWED_NAMESPACES = addToSet({}, [MATHML_NAMESPACE, SVG_NAMESPACE, HTML_NAMESPACE], stringToString);
|
|
7518
|
+
/* Parsing of strict XHTML documents */
|
|
7519
|
+
|
|
7520
|
+
let PARSER_MEDIA_TYPE;
|
|
7521
|
+
const SUPPORTED_PARSER_MEDIA_TYPES = ['application/xhtml+xml', 'text/html'];
|
|
7522
|
+
const DEFAULT_PARSER_MEDIA_TYPE = 'text/html';
|
|
7523
|
+
let transformCaseFunc;
|
|
7524
|
+
/* Keep a reference to config to pass to hooks */
|
|
7525
|
+
|
|
7526
|
+
let CONFIG = null;
|
|
7527
|
+
/* Ideally, do not touch anything below this line */
|
|
7528
|
+
|
|
7529
|
+
/* ______________________________________________ */
|
|
7530
|
+
|
|
7531
|
+
const formElement = document.createElement('form');
|
|
7532
|
+
|
|
7533
|
+
const isRegexOrFunction = function isRegexOrFunction(testValue) {
|
|
7534
|
+
return testValue instanceof RegExp || testValue instanceof Function;
|
|
7535
|
+
};
|
|
7536
|
+
/**
|
|
7537
|
+
* _parseConfig
|
|
7538
|
+
*
|
|
7539
|
+
* @param {Object} cfg optional config literal
|
|
7540
|
+
*/
|
|
7541
|
+
// eslint-disable-next-line complexity
|
|
7542
|
+
|
|
7543
|
+
|
|
7544
|
+
const _parseConfig = function _parseConfig(cfg) {
|
|
7545
|
+
if (CONFIG && CONFIG === cfg) {
|
|
7546
|
+
return;
|
|
7547
|
+
}
|
|
7548
|
+
/* Shield configuration object from tampering */
|
|
7549
|
+
|
|
7550
|
+
|
|
7551
|
+
if (!cfg || typeof cfg !== 'object') {
|
|
7552
|
+
cfg = {};
|
|
7553
|
+
}
|
|
7554
|
+
/* Shield configuration object from prototype pollution */
|
|
7555
|
+
|
|
7556
|
+
|
|
7557
|
+
cfg = clone(cfg);
|
|
7558
|
+
PARSER_MEDIA_TYPE = // eslint-disable-next-line unicorn/prefer-includes
|
|
7559
|
+
SUPPORTED_PARSER_MEDIA_TYPES.indexOf(cfg.PARSER_MEDIA_TYPE) === -1 ? PARSER_MEDIA_TYPE = DEFAULT_PARSER_MEDIA_TYPE : PARSER_MEDIA_TYPE = cfg.PARSER_MEDIA_TYPE; // HTML tags and attributes are not case-sensitive, converting to lowercase. Keeping XHTML as is.
|
|
7560
|
+
|
|
7561
|
+
transformCaseFunc = PARSER_MEDIA_TYPE === 'application/xhtml+xml' ? stringToString : stringToLowerCase;
|
|
7562
|
+
/* Set configuration parameters */
|
|
7563
|
+
|
|
7564
|
+
ALLOWED_TAGS = 'ALLOWED_TAGS' in cfg ? addToSet({}, cfg.ALLOWED_TAGS, transformCaseFunc) : DEFAULT_ALLOWED_TAGS;
|
|
7565
|
+
ALLOWED_ATTR = 'ALLOWED_ATTR' in cfg ? addToSet({}, cfg.ALLOWED_ATTR, transformCaseFunc) : DEFAULT_ALLOWED_ATTR;
|
|
7566
|
+
ALLOWED_NAMESPACES = 'ALLOWED_NAMESPACES' in cfg ? addToSet({}, cfg.ALLOWED_NAMESPACES, stringToString) : DEFAULT_ALLOWED_NAMESPACES;
|
|
7567
|
+
URI_SAFE_ATTRIBUTES = 'ADD_URI_SAFE_ATTR' in cfg ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), // eslint-disable-line indent
|
|
7568
|
+
cfg.ADD_URI_SAFE_ATTR, // eslint-disable-line indent
|
|
7569
|
+
transformCaseFunc // eslint-disable-line indent
|
|
7570
|
+
) // eslint-disable-line indent
|
|
7571
|
+
: DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
7572
|
+
DATA_URI_TAGS = 'ADD_DATA_URI_TAGS' in cfg ? addToSet(clone(DEFAULT_DATA_URI_TAGS), // eslint-disable-line indent
|
|
7573
|
+
cfg.ADD_DATA_URI_TAGS, // eslint-disable-line indent
|
|
7574
|
+
transformCaseFunc // eslint-disable-line indent
|
|
7575
|
+
) // eslint-disable-line indent
|
|
7576
|
+
: DEFAULT_DATA_URI_TAGS;
|
|
7577
|
+
FORBID_CONTENTS = 'FORBID_CONTENTS' in cfg ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
7578
|
+
FORBID_TAGS = 'FORBID_TAGS' in cfg ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
|
7579
|
+
FORBID_ATTR = 'FORBID_ATTR' in cfg ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
|
7580
|
+
USE_PROFILES = 'USE_PROFILES' in cfg ? cfg.USE_PROFILES : false;
|
|
7581
|
+
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
7582
|
+
|
|
7583
|
+
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
|
7584
|
+
|
|
7585
|
+
ALLOW_UNKNOWN_PROTOCOLS = cfg.ALLOW_UNKNOWN_PROTOCOLS || false; // Default false
|
|
7586
|
+
|
|
7587
|
+
ALLOW_SELF_CLOSE_IN_ATTR = cfg.ALLOW_SELF_CLOSE_IN_ATTR !== false; // Default true
|
|
7588
|
+
|
|
7589
|
+
SAFE_FOR_TEMPLATES = cfg.SAFE_FOR_TEMPLATES || false; // Default false
|
|
7590
|
+
|
|
7591
|
+
WHOLE_DOCUMENT = cfg.WHOLE_DOCUMENT || false; // Default false
|
|
7592
|
+
|
|
7593
|
+
RETURN_DOM = cfg.RETURN_DOM || false; // Default false
|
|
7594
|
+
|
|
7595
|
+
RETURN_DOM_FRAGMENT = cfg.RETURN_DOM_FRAGMENT || false; // Default false
|
|
7596
|
+
|
|
7597
|
+
RETURN_TRUSTED_TYPE = cfg.RETURN_TRUSTED_TYPE || false; // Default false
|
|
7598
|
+
|
|
7599
|
+
FORCE_BODY = cfg.FORCE_BODY || false; // Default false
|
|
7600
|
+
|
|
7601
|
+
SANITIZE_DOM = cfg.SANITIZE_DOM !== false; // Default true
|
|
7602
|
+
|
|
7603
|
+
SANITIZE_NAMED_PROPS = cfg.SANITIZE_NAMED_PROPS || false; // Default false
|
|
7604
|
+
|
|
7605
|
+
KEEP_CONTENT = cfg.KEEP_CONTENT !== false; // Default true
|
|
7606
|
+
|
|
7607
|
+
IN_PLACE = cfg.IN_PLACE || false; // Default false
|
|
7608
|
+
|
|
7609
|
+
IS_ALLOWED_URI$1 = cfg.ALLOWED_URI_REGEXP || IS_ALLOWED_URI;
|
|
7610
|
+
NAMESPACE = cfg.NAMESPACE || HTML_NAMESPACE;
|
|
7611
|
+
CUSTOM_ELEMENT_HANDLING = cfg.CUSTOM_ELEMENT_HANDLING || {};
|
|
7612
|
+
|
|
7613
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck)) {
|
|
7614
|
+
CUSTOM_ELEMENT_HANDLING.tagNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.tagNameCheck;
|
|
7615
|
+
}
|
|
7616
|
+
|
|
7617
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && isRegexOrFunction(cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck)) {
|
|
7618
|
+
CUSTOM_ELEMENT_HANDLING.attributeNameCheck = cfg.CUSTOM_ELEMENT_HANDLING.attributeNameCheck;
|
|
7619
|
+
}
|
|
7620
|
+
|
|
7621
|
+
if (cfg.CUSTOM_ELEMENT_HANDLING && typeof cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements === 'boolean') {
|
|
7622
|
+
CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements = cfg.CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements;
|
|
7623
|
+
}
|
|
7624
|
+
|
|
7625
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
7626
|
+
ALLOW_DATA_ATTR = false;
|
|
7627
|
+
}
|
|
7628
|
+
|
|
7629
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
7630
|
+
RETURN_DOM = true;
|
|
7631
|
+
}
|
|
7632
|
+
/* Parse profile info */
|
|
7633
|
+
|
|
7634
|
+
|
|
7635
|
+
if (USE_PROFILES) {
|
|
7636
|
+
ALLOWED_TAGS = addToSet({}, [...text]);
|
|
7637
|
+
ALLOWED_ATTR = [];
|
|
7638
|
+
|
|
7639
|
+
if (USE_PROFILES.html === true) {
|
|
7640
|
+
addToSet(ALLOWED_TAGS, html$1);
|
|
7641
|
+
addToSet(ALLOWED_ATTR, html);
|
|
7642
|
+
}
|
|
7643
|
+
|
|
7644
|
+
if (USE_PROFILES.svg === true) {
|
|
7645
|
+
addToSet(ALLOWED_TAGS, svg$1);
|
|
7646
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
7647
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
7648
|
+
}
|
|
7649
|
+
|
|
7650
|
+
if (USE_PROFILES.svgFilters === true) {
|
|
7651
|
+
addToSet(ALLOWED_TAGS, svgFilters);
|
|
7652
|
+
addToSet(ALLOWED_ATTR, svg);
|
|
7653
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
7654
|
+
}
|
|
7655
|
+
|
|
7656
|
+
if (USE_PROFILES.mathMl === true) {
|
|
7657
|
+
addToSet(ALLOWED_TAGS, mathMl$1);
|
|
7658
|
+
addToSet(ALLOWED_ATTR, mathMl);
|
|
7659
|
+
addToSet(ALLOWED_ATTR, xml);
|
|
7660
|
+
}
|
|
7661
|
+
}
|
|
7662
|
+
/* Merge configuration parameters */
|
|
7663
|
+
|
|
7664
|
+
|
|
7665
|
+
if (cfg.ADD_TAGS) {
|
|
7666
|
+
if (ALLOWED_TAGS === DEFAULT_ALLOWED_TAGS) {
|
|
7667
|
+
ALLOWED_TAGS = clone(ALLOWED_TAGS);
|
|
7668
|
+
}
|
|
7669
|
+
|
|
7670
|
+
addToSet(ALLOWED_TAGS, cfg.ADD_TAGS, transformCaseFunc);
|
|
7671
|
+
}
|
|
7672
|
+
|
|
7673
|
+
if (cfg.ADD_ATTR) {
|
|
7674
|
+
if (ALLOWED_ATTR === DEFAULT_ALLOWED_ATTR) {
|
|
7675
|
+
ALLOWED_ATTR = clone(ALLOWED_ATTR);
|
|
7676
|
+
}
|
|
7677
|
+
|
|
7678
|
+
addToSet(ALLOWED_ATTR, cfg.ADD_ATTR, transformCaseFunc);
|
|
7679
|
+
}
|
|
7680
|
+
|
|
7681
|
+
if (cfg.ADD_URI_SAFE_ATTR) {
|
|
7682
|
+
addToSet(URI_SAFE_ATTRIBUTES, cfg.ADD_URI_SAFE_ATTR, transformCaseFunc);
|
|
7683
|
+
}
|
|
7684
|
+
|
|
7685
|
+
if (cfg.FORBID_CONTENTS) {
|
|
7686
|
+
if (FORBID_CONTENTS === DEFAULT_FORBID_CONTENTS) {
|
|
7687
|
+
FORBID_CONTENTS = clone(FORBID_CONTENTS);
|
|
7688
|
+
}
|
|
7689
|
+
|
|
7690
|
+
addToSet(FORBID_CONTENTS, cfg.FORBID_CONTENTS, transformCaseFunc);
|
|
7691
|
+
}
|
|
7692
|
+
/* Add #text in case KEEP_CONTENT is set to true */
|
|
7693
|
+
|
|
7694
|
+
|
|
7695
|
+
if (KEEP_CONTENT) {
|
|
7696
|
+
ALLOWED_TAGS['#text'] = true;
|
|
7697
|
+
}
|
|
7698
|
+
/* Add html, head and body to ALLOWED_TAGS in case WHOLE_DOCUMENT is true */
|
|
7699
|
+
|
|
7700
|
+
|
|
7701
|
+
if (WHOLE_DOCUMENT) {
|
|
7702
|
+
addToSet(ALLOWED_TAGS, ['html', 'head', 'body']);
|
|
7703
|
+
}
|
|
7704
|
+
/* Add tbody to ALLOWED_TAGS in case tables are permitted, see #286, #365 */
|
|
7705
|
+
|
|
7706
|
+
|
|
7707
|
+
if (ALLOWED_TAGS.table) {
|
|
7708
|
+
addToSet(ALLOWED_TAGS, ['tbody']);
|
|
7709
|
+
delete FORBID_TAGS.tbody;
|
|
7710
|
+
} // Prevent further manipulation of configuration.
|
|
7711
|
+
// Not available in IE8, Safari 5, etc.
|
|
7712
|
+
|
|
7713
|
+
|
|
7714
|
+
if (freeze) {
|
|
7715
|
+
freeze(cfg);
|
|
7716
|
+
}
|
|
7717
|
+
|
|
7718
|
+
CONFIG = cfg;
|
|
7719
|
+
};
|
|
7720
|
+
|
|
7721
|
+
const MATHML_TEXT_INTEGRATION_POINTS = addToSet({}, ['mi', 'mo', 'mn', 'ms', 'mtext']);
|
|
7722
|
+
const HTML_INTEGRATION_POINTS = addToSet({}, ['foreignobject', 'desc', 'title', 'annotation-xml']); // Certain elements are allowed in both SVG and HTML
|
|
7723
|
+
// namespace. We need to specify them explicitly
|
|
7724
|
+
// so that they don't get erroneously deleted from
|
|
7725
|
+
// HTML namespace.
|
|
7726
|
+
|
|
7727
|
+
const COMMON_SVG_AND_HTML_ELEMENTS = addToSet({}, ['title', 'style', 'font', 'a', 'script']);
|
|
7728
|
+
/* Keep track of all possible SVG and MathML tags
|
|
7729
|
+
* so that we can perform the namespace checks
|
|
7730
|
+
* correctly. */
|
|
7731
|
+
|
|
7732
|
+
const ALL_SVG_TAGS = addToSet({}, svg$1);
|
|
7733
|
+
addToSet(ALL_SVG_TAGS, svgFilters);
|
|
7734
|
+
addToSet(ALL_SVG_TAGS, svgDisallowed);
|
|
7735
|
+
const ALL_MATHML_TAGS = addToSet({}, mathMl$1);
|
|
7736
|
+
addToSet(ALL_MATHML_TAGS, mathMlDisallowed);
|
|
7737
|
+
/**
|
|
7738
|
+
*
|
|
7739
|
+
*
|
|
7740
|
+
* @param {Element} element a DOM element whose namespace is being checked
|
|
7741
|
+
* @returns {boolean} Return false if the element has a
|
|
7742
|
+
* namespace that a spec-compliant parser would never
|
|
7743
|
+
* return. Return true otherwise.
|
|
7744
|
+
*/
|
|
7745
|
+
|
|
7746
|
+
const _checkValidNamespace = function _checkValidNamespace(element) {
|
|
7747
|
+
let parent = getParentNode(element); // In JSDOM, if we're inside shadow DOM, then parentNode
|
|
7748
|
+
// can be null. We just simulate parent in this case.
|
|
7749
|
+
|
|
7750
|
+
if (!parent || !parent.tagName) {
|
|
7751
|
+
parent = {
|
|
7752
|
+
namespaceURI: NAMESPACE,
|
|
7753
|
+
tagName: 'template'
|
|
7754
|
+
};
|
|
7755
|
+
}
|
|
7756
|
+
|
|
7757
|
+
const tagName = stringToLowerCase(element.tagName);
|
|
7758
|
+
const parentTagName = stringToLowerCase(parent.tagName);
|
|
7759
|
+
|
|
7760
|
+
if (!ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
7761
|
+
return false;
|
|
7762
|
+
}
|
|
7763
|
+
|
|
7764
|
+
if (element.namespaceURI === SVG_NAMESPACE) {
|
|
7765
|
+
// The only way to switch from HTML namespace to SVG
|
|
7766
|
+
// is via <svg>. If it happens via any other tag, then
|
|
7767
|
+
// it should be killed.
|
|
7768
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
7769
|
+
return tagName === 'svg';
|
|
7770
|
+
} // The only way to switch from MathML to SVG is via`
|
|
7771
|
+
// svg if parent is either <annotation-xml> or MathML
|
|
7772
|
+
// text integration points.
|
|
7773
|
+
|
|
7774
|
+
|
|
7775
|
+
if (parent.namespaceURI === MATHML_NAMESPACE) {
|
|
7776
|
+
return tagName === 'svg' && (parentTagName === 'annotation-xml' || MATHML_TEXT_INTEGRATION_POINTS[parentTagName]);
|
|
7777
|
+
} // We only allow elements that are defined in SVG
|
|
7778
|
+
// spec. All others are disallowed in SVG namespace.
|
|
7779
|
+
|
|
7780
|
+
|
|
7781
|
+
return Boolean(ALL_SVG_TAGS[tagName]);
|
|
7782
|
+
}
|
|
7783
|
+
|
|
7784
|
+
if (element.namespaceURI === MATHML_NAMESPACE) {
|
|
7785
|
+
// The only way to switch from HTML namespace to MathML
|
|
7786
|
+
// is via <math>. If it happens via any other tag, then
|
|
7787
|
+
// it should be killed.
|
|
7788
|
+
if (parent.namespaceURI === HTML_NAMESPACE) {
|
|
7789
|
+
return tagName === 'math';
|
|
7790
|
+
} // The only way to switch from SVG to MathML is via
|
|
7791
|
+
// <math> and HTML integration points
|
|
7792
|
+
|
|
7793
|
+
|
|
7794
|
+
if (parent.namespaceURI === SVG_NAMESPACE) {
|
|
7795
|
+
return tagName === 'math' && HTML_INTEGRATION_POINTS[parentTagName];
|
|
7796
|
+
} // We only allow elements that are defined in MathML
|
|
7797
|
+
// spec. All others are disallowed in MathML namespace.
|
|
7798
|
+
|
|
7799
|
+
|
|
7800
|
+
return Boolean(ALL_MATHML_TAGS[tagName]);
|
|
7801
|
+
}
|
|
7802
|
+
|
|
7803
|
+
if (element.namespaceURI === HTML_NAMESPACE) {
|
|
7804
|
+
// The only way to switch from SVG to HTML is via
|
|
7805
|
+
// HTML integration points, and from MathML to HTML
|
|
7806
|
+
// is via MathML text integration points
|
|
7807
|
+
if (parent.namespaceURI === SVG_NAMESPACE && !HTML_INTEGRATION_POINTS[parentTagName]) {
|
|
7808
|
+
return false;
|
|
7809
|
+
}
|
|
7810
|
+
|
|
7811
|
+
if (parent.namespaceURI === MATHML_NAMESPACE && !MATHML_TEXT_INTEGRATION_POINTS[parentTagName]) {
|
|
7812
|
+
return false;
|
|
7813
|
+
} // We disallow tags that are specific for MathML
|
|
7814
|
+
// or SVG and should never appear in HTML namespace
|
|
7815
|
+
|
|
7816
|
+
|
|
7817
|
+
return !ALL_MATHML_TAGS[tagName] && (COMMON_SVG_AND_HTML_ELEMENTS[tagName] || !ALL_SVG_TAGS[tagName]);
|
|
7818
|
+
} // For XHTML and XML documents that support custom namespaces
|
|
7819
|
+
|
|
7820
|
+
|
|
7821
|
+
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && ALLOWED_NAMESPACES[element.namespaceURI]) {
|
|
7822
|
+
return true;
|
|
7823
|
+
} // The code should never reach this place (this means
|
|
7824
|
+
// that the element somehow got namespace that is not
|
|
7825
|
+
// HTML, SVG, MathML or allowed via ALLOWED_NAMESPACES).
|
|
7826
|
+
// Return false just in case.
|
|
7827
|
+
|
|
7828
|
+
|
|
7829
|
+
return false;
|
|
7830
|
+
};
|
|
7831
|
+
/**
|
|
7832
|
+
* _forceRemove
|
|
7833
|
+
*
|
|
7834
|
+
* @param {Node} node a DOM node
|
|
7835
|
+
*/
|
|
7836
|
+
|
|
7837
|
+
|
|
7838
|
+
const _forceRemove = function _forceRemove(node) {
|
|
7839
|
+
arrayPush(DOMPurify.removed, {
|
|
7840
|
+
element: node
|
|
7841
|
+
});
|
|
7842
|
+
|
|
7843
|
+
try {
|
|
7844
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-remove
|
|
7845
|
+
node.parentNode.removeChild(node);
|
|
7846
|
+
} catch (_) {
|
|
7847
|
+
node.remove();
|
|
7848
|
+
}
|
|
7849
|
+
};
|
|
7850
|
+
/**
|
|
7851
|
+
* _removeAttribute
|
|
7852
|
+
*
|
|
7853
|
+
* @param {String} name an Attribute name
|
|
7854
|
+
* @param {Node} node a DOM node
|
|
7855
|
+
*/
|
|
7856
|
+
|
|
7857
|
+
|
|
7858
|
+
const _removeAttribute = function _removeAttribute(name, node) {
|
|
7859
|
+
try {
|
|
7860
|
+
arrayPush(DOMPurify.removed, {
|
|
7861
|
+
attribute: node.getAttributeNode(name),
|
|
7862
|
+
from: node
|
|
7863
|
+
});
|
|
7864
|
+
} catch (_) {
|
|
7865
|
+
arrayPush(DOMPurify.removed, {
|
|
7866
|
+
attribute: null,
|
|
7867
|
+
from: node
|
|
7868
|
+
});
|
|
7869
|
+
}
|
|
7870
|
+
|
|
7871
|
+
node.removeAttribute(name); // We void attribute values for unremovable "is"" attributes
|
|
7872
|
+
|
|
7873
|
+
if (name === 'is' && !ALLOWED_ATTR[name]) {
|
|
7874
|
+
if (RETURN_DOM || RETURN_DOM_FRAGMENT) {
|
|
7875
|
+
try {
|
|
7876
|
+
_forceRemove(node);
|
|
7877
|
+
} catch (_) {}
|
|
7878
|
+
} else {
|
|
7879
|
+
try {
|
|
7880
|
+
node.setAttribute(name, '');
|
|
7881
|
+
} catch (_) {}
|
|
7882
|
+
}
|
|
7883
|
+
}
|
|
7884
|
+
};
|
|
7885
|
+
/**
|
|
7886
|
+
* _initDocument
|
|
7887
|
+
*
|
|
7888
|
+
* @param {String} dirty a string of dirty markup
|
|
7889
|
+
* @return {Document} a DOM, filled with the dirty markup
|
|
7890
|
+
*/
|
|
7891
|
+
|
|
7892
|
+
|
|
7893
|
+
const _initDocument = function _initDocument(dirty) {
|
|
7894
|
+
/* Create a HTML document */
|
|
7895
|
+
let doc;
|
|
7896
|
+
let leadingWhitespace;
|
|
7897
|
+
|
|
7898
|
+
if (FORCE_BODY) {
|
|
7899
|
+
dirty = '<remove></remove>' + dirty;
|
|
7900
|
+
} else {
|
|
7901
|
+
/* If FORCE_BODY isn't used, leading whitespace needs to be preserved manually */
|
|
7902
|
+
const matches = stringMatch(dirty, /^[\r\n\t ]+/);
|
|
7903
|
+
leadingWhitespace = matches && matches[0];
|
|
7904
|
+
}
|
|
7905
|
+
|
|
7906
|
+
if (PARSER_MEDIA_TYPE === 'application/xhtml+xml' && NAMESPACE === HTML_NAMESPACE) {
|
|
7907
|
+
// Root of XHTML doc must contain xmlns declaration (see https://www.w3.org/TR/xhtml1/normative.html#strict)
|
|
7908
|
+
dirty = '<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>' + dirty + '</body></html>';
|
|
7909
|
+
}
|
|
7910
|
+
|
|
7911
|
+
const dirtyPayload = trustedTypesPolicy ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
7912
|
+
/*
|
|
7913
|
+
* Use the DOMParser API by default, fallback later if needs be
|
|
7914
|
+
* DOMParser not work for svg when has multiple root element.
|
|
7915
|
+
*/
|
|
7916
|
+
|
|
7917
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
|
7918
|
+
try {
|
|
7919
|
+
doc = new DOMParser().parseFromString(dirtyPayload, PARSER_MEDIA_TYPE);
|
|
7920
|
+
} catch (_) {}
|
|
7921
|
+
}
|
|
7922
|
+
/* Use createHTMLDocument in case DOMParser is not available */
|
|
7923
|
+
|
|
7924
|
+
|
|
7925
|
+
if (!doc || !doc.documentElement) {
|
|
7926
|
+
doc = implementation.createDocument(NAMESPACE, 'template', null);
|
|
7927
|
+
|
|
7928
|
+
try {
|
|
7929
|
+
doc.documentElement.innerHTML = IS_EMPTY_INPUT ? emptyHTML : dirtyPayload;
|
|
7930
|
+
} catch (_) {// Syntax error if dirtyPayload is invalid xml
|
|
7931
|
+
}
|
|
7932
|
+
}
|
|
7933
|
+
|
|
7934
|
+
const body = doc.body || doc.documentElement;
|
|
7935
|
+
|
|
7936
|
+
if (dirty && leadingWhitespace) {
|
|
7937
|
+
body.insertBefore(document.createTextNode(leadingWhitespace), body.childNodes[0] || null);
|
|
7938
|
+
}
|
|
7939
|
+
/* Work on whole document or just its body */
|
|
7940
|
+
|
|
7941
|
+
|
|
7942
|
+
if (NAMESPACE === HTML_NAMESPACE) {
|
|
7943
|
+
return getElementsByTagName.call(doc, WHOLE_DOCUMENT ? 'html' : 'body')[0];
|
|
7944
|
+
}
|
|
7945
|
+
|
|
7946
|
+
return WHOLE_DOCUMENT ? doc.documentElement : body;
|
|
7947
|
+
};
|
|
7948
|
+
/**
|
|
7949
|
+
* _createIterator
|
|
7950
|
+
*
|
|
7951
|
+
* @param {Document} root document/fragment to create iterator for
|
|
7952
|
+
* @return {Iterator} iterator instance
|
|
7953
|
+
*/
|
|
7954
|
+
|
|
7955
|
+
|
|
7956
|
+
const _createIterator = function _createIterator(root) {
|
|
7957
|
+
return createNodeIterator.call(root.ownerDocument || root, root, // eslint-disable-next-line no-bitwise
|
|
7958
|
+
NodeFilter.SHOW_ELEMENT | NodeFilter.SHOW_COMMENT | NodeFilter.SHOW_TEXT, null, false);
|
|
7959
|
+
};
|
|
7960
|
+
/**
|
|
7961
|
+
* _isClobbered
|
|
7962
|
+
*
|
|
7963
|
+
* @param {Node} elm element to check for clobbering attacks
|
|
7964
|
+
* @return {Boolean} true if clobbered, false if safe
|
|
7965
|
+
*/
|
|
7966
|
+
|
|
7967
|
+
|
|
7968
|
+
const _isClobbered = function _isClobbered(elm) {
|
|
7969
|
+
return elm instanceof HTMLFormElement && (typeof elm.nodeName !== 'string' || typeof elm.textContent !== 'string' || typeof elm.removeChild !== 'function' || !(elm.attributes instanceof NamedNodeMap) || typeof elm.removeAttribute !== 'function' || typeof elm.setAttribute !== 'function' || typeof elm.namespaceURI !== 'string' || typeof elm.insertBefore !== 'function' || typeof elm.hasChildNodes !== 'function');
|
|
7970
|
+
};
|
|
7971
|
+
/**
|
|
7972
|
+
* _isNode
|
|
7973
|
+
*
|
|
7974
|
+
* @param {Node} obj object to check whether it's a DOM node
|
|
7975
|
+
* @return {Boolean} true is object is a DOM node
|
|
7976
|
+
*/
|
|
7977
|
+
|
|
7978
|
+
|
|
7979
|
+
const _isNode = function _isNode(object) {
|
|
7980
|
+
return typeof Node === 'object' ? object instanceof Node : object && typeof object === 'object' && typeof object.nodeType === 'number' && typeof object.nodeName === 'string';
|
|
7981
|
+
};
|
|
7982
|
+
/**
|
|
7983
|
+
* _executeHook
|
|
7984
|
+
* Execute user configurable hooks
|
|
7985
|
+
*
|
|
7986
|
+
* @param {String} entryPoint Name of the hook's entry point
|
|
7987
|
+
* @param {Node} currentNode node to work on with the hook
|
|
7988
|
+
* @param {Object} data additional hook parameters
|
|
7989
|
+
*/
|
|
7990
|
+
|
|
7991
|
+
|
|
7992
|
+
const _executeHook = function _executeHook(entryPoint, currentNode, data) {
|
|
7993
|
+
if (!hooks[entryPoint]) {
|
|
7994
|
+
return;
|
|
7995
|
+
}
|
|
7996
|
+
|
|
7997
|
+
arrayForEach(hooks[entryPoint], hook => {
|
|
7998
|
+
hook.call(DOMPurify, currentNode, data, CONFIG);
|
|
7999
|
+
});
|
|
8000
|
+
};
|
|
8001
|
+
/**
|
|
8002
|
+
* _sanitizeElements
|
|
8003
|
+
*
|
|
8004
|
+
* @protect nodeName
|
|
8005
|
+
* @protect textContent
|
|
8006
|
+
* @protect removeChild
|
|
8007
|
+
*
|
|
8008
|
+
* @param {Node} currentNode to check for permission to exist
|
|
8009
|
+
* @return {Boolean} true if node was killed, false if left alive
|
|
8010
|
+
*/
|
|
8011
|
+
|
|
8012
|
+
|
|
8013
|
+
const _sanitizeElements = function _sanitizeElements(currentNode) {
|
|
8014
|
+
let content;
|
|
8015
|
+
/* Execute a hook if present */
|
|
8016
|
+
|
|
8017
|
+
_executeHook('beforeSanitizeElements', currentNode, null);
|
|
8018
|
+
/* Check if element is clobbered or can clobber */
|
|
8019
|
+
|
|
8020
|
+
|
|
8021
|
+
if (_isClobbered(currentNode)) {
|
|
8022
|
+
_forceRemove(currentNode);
|
|
8023
|
+
|
|
8024
|
+
return true;
|
|
8025
|
+
}
|
|
8026
|
+
/* Now let's check the element's type and name */
|
|
8027
|
+
|
|
8028
|
+
|
|
8029
|
+
const tagName = transformCaseFunc(currentNode.nodeName);
|
|
8030
|
+
/* Execute a hook if present */
|
|
8031
|
+
|
|
8032
|
+
_executeHook('uponSanitizeElement', currentNode, {
|
|
8033
|
+
tagName,
|
|
8034
|
+
allowedTags: ALLOWED_TAGS
|
|
8035
|
+
});
|
|
8036
|
+
/* Detect mXSS attempts abusing namespace confusion */
|
|
8037
|
+
|
|
8038
|
+
|
|
8039
|
+
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && (!_isNode(currentNode.content) || !_isNode(currentNode.content.firstElementChild)) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
|
|
8040
|
+
_forceRemove(currentNode);
|
|
8041
|
+
|
|
8042
|
+
return true;
|
|
8043
|
+
}
|
|
8044
|
+
/* Remove element if anything forbids its presence */
|
|
8045
|
+
|
|
8046
|
+
|
|
8047
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
8048
|
+
/* Check if we have a custom element to handle */
|
|
8049
|
+
if (!FORBID_TAGS[tagName] && _basicCustomElementTest(tagName)) {
|
|
8050
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, tagName)) return false;
|
|
8051
|
+
if (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(tagName)) return false;
|
|
8052
|
+
}
|
|
8053
|
+
/* Keep content except for bad-listed elements */
|
|
8054
|
+
|
|
8055
|
+
|
|
8056
|
+
if (KEEP_CONTENT && !FORBID_CONTENTS[tagName]) {
|
|
8057
|
+
const parentNode = getParentNode(currentNode) || currentNode.parentNode;
|
|
8058
|
+
const childNodes = getChildNodes(currentNode) || currentNode.childNodes;
|
|
8059
|
+
|
|
8060
|
+
if (childNodes && parentNode) {
|
|
8061
|
+
const childCount = childNodes.length;
|
|
8062
|
+
|
|
8063
|
+
for (let i = childCount - 1; i >= 0; --i) {
|
|
8064
|
+
parentNode.insertBefore(cloneNode(childNodes[i], true), getNextSibling(currentNode));
|
|
8065
|
+
}
|
|
8066
|
+
}
|
|
8067
|
+
}
|
|
8068
|
+
|
|
8069
|
+
_forceRemove(currentNode);
|
|
8070
|
+
|
|
8071
|
+
return true;
|
|
8072
|
+
}
|
|
8073
|
+
/* Check whether element has a valid namespace */
|
|
8074
|
+
|
|
8075
|
+
|
|
8076
|
+
if (currentNode instanceof Element && !_checkValidNamespace(currentNode)) {
|
|
8077
|
+
_forceRemove(currentNode);
|
|
8078
|
+
|
|
8079
|
+
return true;
|
|
8080
|
+
}
|
|
8081
|
+
/* Make sure that older browsers don't get noscript mXSS */
|
|
8082
|
+
|
|
8083
|
+
|
|
8084
|
+
if ((tagName === 'noscript' || tagName === 'noembed') && regExpTest(/<\/no(script|embed)/i, currentNode.innerHTML)) {
|
|
8085
|
+
_forceRemove(currentNode);
|
|
8086
|
+
|
|
8087
|
+
return true;
|
|
8088
|
+
}
|
|
8089
|
+
/* Sanitize element content to be template-safe */
|
|
8090
|
+
|
|
8091
|
+
|
|
8092
|
+
if (SAFE_FOR_TEMPLATES && currentNode.nodeType === 3) {
|
|
8093
|
+
/* Get the element's text content */
|
|
8094
|
+
content = currentNode.textContent;
|
|
8095
|
+
content = stringReplace(content, MUSTACHE_EXPR, ' ');
|
|
8096
|
+
content = stringReplace(content, ERB_EXPR, ' ');
|
|
8097
|
+
content = stringReplace(content, TMPLIT_EXPR, ' ');
|
|
8098
|
+
|
|
8099
|
+
if (currentNode.textContent !== content) {
|
|
8100
|
+
arrayPush(DOMPurify.removed, {
|
|
8101
|
+
element: currentNode.cloneNode()
|
|
8102
|
+
});
|
|
8103
|
+
currentNode.textContent = content;
|
|
8104
|
+
}
|
|
8105
|
+
}
|
|
8106
|
+
/* Execute a hook if present */
|
|
8107
|
+
|
|
8108
|
+
|
|
8109
|
+
_executeHook('afterSanitizeElements', currentNode, null);
|
|
8110
|
+
|
|
8111
|
+
return false;
|
|
8112
|
+
};
|
|
8113
|
+
/**
|
|
8114
|
+
* _isValidAttribute
|
|
8115
|
+
*
|
|
8116
|
+
* @param {string} lcTag Lowercase tag name of containing element.
|
|
8117
|
+
* @param {string} lcName Lowercase attribute name.
|
|
8118
|
+
* @param {string} value Attribute value.
|
|
8119
|
+
* @return {Boolean} Returns true if `value` is valid, otherwise false.
|
|
8120
|
+
*/
|
|
8121
|
+
// eslint-disable-next-line complexity
|
|
8122
|
+
|
|
8123
|
+
|
|
8124
|
+
const _isValidAttribute = function _isValidAttribute(lcTag, lcName, value) {
|
|
8125
|
+
/* Make sure attribute cannot clobber */
|
|
8126
|
+
if (SANITIZE_DOM && (lcName === 'id' || lcName === 'name') && (value in document || value in formElement)) {
|
|
8127
|
+
return false;
|
|
8128
|
+
}
|
|
8129
|
+
/* Allow valid data-* attributes: At least one character after "-"
|
|
8130
|
+
(https://html.spec.whatwg.org/multipage/dom.html#embedding-custom-non-visible-data-with-the-data-*-attributes)
|
|
8131
|
+
XML-compatible (https://html.spec.whatwg.org/multipage/infrastructure.html#xml-compatible and http://www.w3.org/TR/xml/#d0e804)
|
|
8132
|
+
We don't need to check the value; it's always URI safe. */
|
|
8133
|
+
|
|
8134
|
+
|
|
8135
|
+
if (ALLOW_DATA_ATTR && !FORBID_ATTR[lcName] && regExpTest(DATA_ATTR, lcName)) ; else if (ALLOW_ARIA_ATTR && regExpTest(ARIA_ATTR, lcName)) ; else if (!ALLOWED_ATTR[lcName] || FORBID_ATTR[lcName]) {
|
|
8136
|
+
if ( // First condition does a very basic check if a) it's basically a valid custom element tagname AND
|
|
8137
|
+
// b) if the tagName passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
8138
|
+
// and c) if the attribute name passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.attributeNameCheck
|
|
8139
|
+
_basicCustomElementTest(lcTag) && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, lcTag) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(lcTag)) && (CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.attributeNameCheck, lcName) || CUSTOM_ELEMENT_HANDLING.attributeNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.attributeNameCheck(lcName)) || // Alternative, second condition checks if it's an `is`-attribute, AND
|
|
8140
|
+
// the value passes whatever the user has configured for CUSTOM_ELEMENT_HANDLING.tagNameCheck
|
|
8141
|
+
lcName === 'is' && CUSTOM_ELEMENT_HANDLING.allowCustomizedBuiltInElements && (CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof RegExp && regExpTest(CUSTOM_ELEMENT_HANDLING.tagNameCheck, value) || CUSTOM_ELEMENT_HANDLING.tagNameCheck instanceof Function && CUSTOM_ELEMENT_HANDLING.tagNameCheck(value))) ; else {
|
|
8142
|
+
return false;
|
|
8143
|
+
}
|
|
8144
|
+
/* Check value is safe. First, is attr inert? If so, is safe */
|
|
8145
|
+
|
|
8146
|
+
} else if (URI_SAFE_ATTRIBUTES[lcName]) ; else if (regExpTest(IS_ALLOWED_URI$1, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if ((lcName === 'src' || lcName === 'xlink:href' || lcName === 'href') && lcTag !== 'script' && stringIndexOf(value, 'data:') === 0 && DATA_URI_TAGS[lcTag]) ; else if (ALLOW_UNKNOWN_PROTOCOLS && !regExpTest(IS_SCRIPT_OR_DATA, stringReplace(value, ATTR_WHITESPACE, ''))) ; else if (!value) ; else {
|
|
8147
|
+
return false;
|
|
8148
|
+
}
|
|
8149
|
+
|
|
8150
|
+
return true;
|
|
8151
|
+
};
|
|
8152
|
+
/**
|
|
8153
|
+
* _basicCustomElementCheck
|
|
8154
|
+
* checks if at least one dash is included in tagName, and it's not the first char
|
|
8155
|
+
* for more sophisticated checking see https://github.com/sindresorhus/validate-element-name
|
|
8156
|
+
* @param {string} tagName name of the tag of the node to sanitize
|
|
8157
|
+
*/
|
|
8158
|
+
|
|
8159
|
+
|
|
8160
|
+
const _basicCustomElementTest = function _basicCustomElementTest(tagName) {
|
|
8161
|
+
return tagName.indexOf('-') > 0;
|
|
8162
|
+
};
|
|
8163
|
+
/**
|
|
8164
|
+
* _sanitizeAttributes
|
|
8165
|
+
*
|
|
8166
|
+
* @protect attributes
|
|
8167
|
+
* @protect nodeName
|
|
8168
|
+
* @protect removeAttribute
|
|
8169
|
+
* @protect setAttribute
|
|
8170
|
+
*
|
|
8171
|
+
* @param {Node} currentNode to sanitize
|
|
8172
|
+
*/
|
|
8173
|
+
|
|
8174
|
+
|
|
8175
|
+
const _sanitizeAttributes = function _sanitizeAttributes(currentNode) {
|
|
8176
|
+
let attr;
|
|
8177
|
+
let value;
|
|
8178
|
+
let lcName;
|
|
8179
|
+
let l;
|
|
8180
|
+
/* Execute a hook if present */
|
|
8181
|
+
|
|
8182
|
+
_executeHook('beforeSanitizeAttributes', currentNode, null);
|
|
8183
|
+
|
|
8184
|
+
const {
|
|
8185
|
+
attributes
|
|
8186
|
+
} = currentNode;
|
|
8187
|
+
/* Check if we have attributes; if not we might have a text node */
|
|
8188
|
+
|
|
8189
|
+
if (!attributes) {
|
|
8190
|
+
return;
|
|
8191
|
+
}
|
|
8192
|
+
|
|
8193
|
+
const hookEvent = {
|
|
8194
|
+
attrName: '',
|
|
8195
|
+
attrValue: '',
|
|
8196
|
+
keepAttr: true,
|
|
8197
|
+
allowedAttributes: ALLOWED_ATTR
|
|
8198
|
+
};
|
|
8199
|
+
l = attributes.length;
|
|
8200
|
+
/* Go backwards over all attributes; safely remove bad ones */
|
|
8201
|
+
|
|
8202
|
+
while (l--) {
|
|
8203
|
+
attr = attributes[l];
|
|
8204
|
+
const {
|
|
8205
|
+
name,
|
|
8206
|
+
namespaceURI
|
|
8207
|
+
} = attr;
|
|
8208
|
+
value = name === 'value' ? attr.value : stringTrim(attr.value);
|
|
8209
|
+
lcName = transformCaseFunc(name);
|
|
8210
|
+
/* Execute a hook if present */
|
|
8211
|
+
|
|
8212
|
+
hookEvent.attrName = lcName;
|
|
8213
|
+
hookEvent.attrValue = value;
|
|
8214
|
+
hookEvent.keepAttr = true;
|
|
8215
|
+
hookEvent.forceKeepAttr = undefined; // Allows developers to see this is a property they can set
|
|
8216
|
+
|
|
8217
|
+
_executeHook('uponSanitizeAttribute', currentNode, hookEvent);
|
|
8218
|
+
|
|
8219
|
+
value = hookEvent.attrValue;
|
|
8220
|
+
/* Did the hooks approve of the attribute? */
|
|
8221
|
+
|
|
8222
|
+
if (hookEvent.forceKeepAttr) {
|
|
8223
|
+
continue;
|
|
8224
|
+
}
|
|
8225
|
+
/* Remove attribute */
|
|
8226
|
+
|
|
8227
|
+
|
|
8228
|
+
_removeAttribute(name, currentNode);
|
|
8229
|
+
/* Did the hooks approve of the attribute? */
|
|
8230
|
+
|
|
8231
|
+
|
|
8232
|
+
if (!hookEvent.keepAttr) {
|
|
8233
|
+
continue;
|
|
8234
|
+
}
|
|
8235
|
+
/* Work around a security issue in jQuery 3.0 */
|
|
8236
|
+
|
|
8237
|
+
|
|
8238
|
+
if (!ALLOW_SELF_CLOSE_IN_ATTR && regExpTest(/\/>/i, value)) {
|
|
8239
|
+
_removeAttribute(name, currentNode);
|
|
8240
|
+
|
|
8241
|
+
continue;
|
|
8242
|
+
}
|
|
8243
|
+
/* Sanitize attribute content to be template-safe */
|
|
8244
|
+
|
|
8245
|
+
|
|
8246
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
8247
|
+
value = stringReplace(value, MUSTACHE_EXPR, ' ');
|
|
8248
|
+
value = stringReplace(value, ERB_EXPR, ' ');
|
|
8249
|
+
value = stringReplace(value, TMPLIT_EXPR, ' ');
|
|
8250
|
+
}
|
|
8251
|
+
/* Is `value` valid for this attribute? */
|
|
8252
|
+
|
|
8253
|
+
|
|
8254
|
+
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
8255
|
+
|
|
8256
|
+
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
8257
|
+
continue;
|
|
8258
|
+
}
|
|
8259
|
+
/* Full DOM Clobbering protection via namespace isolation,
|
|
8260
|
+
* Prefix id and name attributes with `user-content-`
|
|
8261
|
+
*/
|
|
8262
|
+
|
|
8263
|
+
|
|
8264
|
+
if (SANITIZE_NAMED_PROPS && (lcName === 'id' || lcName === 'name')) {
|
|
8265
|
+
// Remove the attribute with this value
|
|
8266
|
+
_removeAttribute(name, currentNode); // Prefix the value and later re-create the attribute with the sanitized value
|
|
8267
|
+
|
|
8268
|
+
|
|
8269
|
+
value = SANITIZE_NAMED_PROPS_PREFIX + value;
|
|
8270
|
+
}
|
|
8271
|
+
/* Handle attributes that require Trusted Types */
|
|
8272
|
+
|
|
8273
|
+
|
|
8274
|
+
if (trustedTypesPolicy && typeof trustedTypes === 'object' && typeof trustedTypes.getAttributeType === 'function') {
|
|
8275
|
+
if (namespaceURI) ; else {
|
|
8276
|
+
switch (trustedTypes.getAttributeType(lcTag, lcName)) {
|
|
8277
|
+
case 'TrustedHTML':
|
|
8278
|
+
value = trustedTypesPolicy.createHTML(value);
|
|
8279
|
+
break;
|
|
8280
|
+
|
|
8281
|
+
case 'TrustedScriptURL':
|
|
8282
|
+
value = trustedTypesPolicy.createScriptURL(value);
|
|
8283
|
+
break;
|
|
8284
|
+
}
|
|
8285
|
+
}
|
|
8286
|
+
}
|
|
8287
|
+
/* Handle invalid data-* attribute set by try-catching it */
|
|
8288
|
+
|
|
8289
|
+
|
|
8290
|
+
try {
|
|
8291
|
+
if (namespaceURI) {
|
|
8292
|
+
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
8293
|
+
} else {
|
|
8294
|
+
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
8295
|
+
currentNode.setAttribute(name, value);
|
|
8296
|
+
}
|
|
8297
|
+
|
|
8298
|
+
arrayPop(DOMPurify.removed);
|
|
8299
|
+
} catch (_) {}
|
|
8300
|
+
}
|
|
8301
|
+
/* Execute a hook if present */
|
|
8302
|
+
|
|
8303
|
+
|
|
8304
|
+
_executeHook('afterSanitizeAttributes', currentNode, null);
|
|
8305
|
+
};
|
|
8306
|
+
/**
|
|
8307
|
+
* _sanitizeShadowDOM
|
|
8308
|
+
*
|
|
8309
|
+
* @param {DocumentFragment} fragment to iterate over recursively
|
|
8310
|
+
*/
|
|
8311
|
+
|
|
8312
|
+
|
|
8313
|
+
const _sanitizeShadowDOM = function _sanitizeShadowDOM(fragment) {
|
|
8314
|
+
let shadowNode;
|
|
8315
|
+
|
|
8316
|
+
const shadowIterator = _createIterator(fragment);
|
|
8317
|
+
/* Execute a hook if present */
|
|
8318
|
+
|
|
8319
|
+
|
|
8320
|
+
_executeHook('beforeSanitizeShadowDOM', fragment, null);
|
|
8321
|
+
|
|
8322
|
+
while (shadowNode = shadowIterator.nextNode()) {
|
|
8323
|
+
/* Execute a hook if present */
|
|
8324
|
+
_executeHook('uponSanitizeShadowNode', shadowNode, null);
|
|
8325
|
+
/* Sanitize tags and elements */
|
|
8326
|
+
|
|
8327
|
+
|
|
8328
|
+
if (_sanitizeElements(shadowNode)) {
|
|
8329
|
+
continue;
|
|
8330
|
+
}
|
|
8331
|
+
/* Deep shadow DOM detected */
|
|
8332
|
+
|
|
8333
|
+
|
|
8334
|
+
if (shadowNode.content instanceof DocumentFragment) {
|
|
8335
|
+
_sanitizeShadowDOM(shadowNode.content);
|
|
8336
|
+
}
|
|
8337
|
+
/* Check attributes, sanitize if necessary */
|
|
8338
|
+
|
|
8339
|
+
|
|
8340
|
+
_sanitizeAttributes(shadowNode);
|
|
8341
|
+
}
|
|
8342
|
+
/* Execute a hook if present */
|
|
8343
|
+
|
|
8344
|
+
|
|
8345
|
+
_executeHook('afterSanitizeShadowDOM', fragment, null);
|
|
8346
|
+
};
|
|
8347
|
+
/**
|
|
8348
|
+
* Sanitize
|
|
8349
|
+
* Public method providing core sanitation functionality
|
|
8350
|
+
*
|
|
8351
|
+
* @param {String|Node} dirty string or DOM node
|
|
8352
|
+
* @param {Object} configuration object
|
|
8353
|
+
*/
|
|
8354
|
+
// eslint-disable-next-line complexity
|
|
8355
|
+
|
|
8356
|
+
|
|
8357
|
+
DOMPurify.sanitize = function (dirty) {
|
|
8358
|
+
let cfg = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
|
8359
|
+
let body;
|
|
8360
|
+
let importedNode;
|
|
8361
|
+
let currentNode;
|
|
8362
|
+
let returnNode;
|
|
8363
|
+
/* Make sure we have a string to sanitize.
|
|
8364
|
+
DO NOT return early, as this will return the wrong type if
|
|
8365
|
+
the user has requested a DOM object rather than a string */
|
|
8366
|
+
|
|
8367
|
+
IS_EMPTY_INPUT = !dirty;
|
|
8368
|
+
|
|
8369
|
+
if (IS_EMPTY_INPUT) {
|
|
8370
|
+
dirty = '<!-->';
|
|
8371
|
+
}
|
|
8372
|
+
/* Stringify, in case dirty is an object */
|
|
8373
|
+
|
|
8374
|
+
|
|
8375
|
+
if (typeof dirty !== 'string' && !_isNode(dirty)) {
|
|
8376
|
+
// eslint-disable-next-line no-negated-condition
|
|
8377
|
+
if (typeof dirty.toString !== 'function') {
|
|
8378
|
+
throw typeErrorCreate('toString is not a function');
|
|
8379
|
+
} else {
|
|
8380
|
+
dirty = dirty.toString();
|
|
8381
|
+
|
|
8382
|
+
if (typeof dirty !== 'string') {
|
|
8383
|
+
throw typeErrorCreate('dirty is not a string, aborting');
|
|
8384
|
+
}
|
|
8385
|
+
}
|
|
8386
|
+
}
|
|
8387
|
+
/* Return dirty HTML if DOMPurify cannot run */
|
|
8388
|
+
|
|
8389
|
+
|
|
8390
|
+
if (!DOMPurify.isSupported) {
|
|
8391
|
+
return dirty;
|
|
8392
|
+
}
|
|
8393
|
+
/* Assign config vars */
|
|
8394
|
+
|
|
8395
|
+
|
|
8396
|
+
if (!SET_CONFIG) {
|
|
8397
|
+
_parseConfig(cfg);
|
|
8398
|
+
}
|
|
8399
|
+
/* Clean up removed elements */
|
|
8400
|
+
|
|
8401
|
+
|
|
8402
|
+
DOMPurify.removed = [];
|
|
8403
|
+
/* Check if dirty is correctly typed for IN_PLACE */
|
|
8404
|
+
|
|
8405
|
+
if (typeof dirty === 'string') {
|
|
8406
|
+
IN_PLACE = false;
|
|
8407
|
+
}
|
|
8408
|
+
|
|
8409
|
+
if (IN_PLACE) {
|
|
8410
|
+
/* Do some early pre-sanitization to avoid unsafe root nodes */
|
|
8411
|
+
if (dirty.nodeName) {
|
|
8412
|
+
const tagName = transformCaseFunc(dirty.nodeName);
|
|
8413
|
+
|
|
8414
|
+
if (!ALLOWED_TAGS[tagName] || FORBID_TAGS[tagName]) {
|
|
8415
|
+
throw typeErrorCreate('root node is forbidden and cannot be sanitized in-place');
|
|
8416
|
+
}
|
|
8417
|
+
}
|
|
8418
|
+
} else if (dirty instanceof Node) {
|
|
8419
|
+
/* If dirty is a DOM element, append to an empty document to avoid
|
|
8420
|
+
elements being stripped by the parser */
|
|
8421
|
+
body = _initDocument('<!---->');
|
|
8422
|
+
importedNode = body.ownerDocument.importNode(dirty, true);
|
|
8423
|
+
|
|
8424
|
+
if (importedNode.nodeType === 1 && importedNode.nodeName === 'BODY') {
|
|
8425
|
+
/* Node is already a body, use as is */
|
|
8426
|
+
body = importedNode;
|
|
8427
|
+
} else if (importedNode.nodeName === 'HTML') {
|
|
8428
|
+
body = importedNode;
|
|
8429
|
+
} else {
|
|
8430
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
8431
|
+
body.appendChild(importedNode);
|
|
8432
|
+
}
|
|
8433
|
+
} else {
|
|
8434
|
+
/* Exit directly if we have nothing to do */
|
|
8435
|
+
if (!RETURN_DOM && !SAFE_FOR_TEMPLATES && !WHOLE_DOCUMENT && // eslint-disable-next-line unicorn/prefer-includes
|
|
8436
|
+
dirty.indexOf('<') === -1) {
|
|
8437
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(dirty) : dirty;
|
|
8438
|
+
}
|
|
8439
|
+
/* Initialize the document to work on */
|
|
8440
|
+
|
|
8441
|
+
|
|
8442
|
+
body = _initDocument(dirty);
|
|
8443
|
+
/* Check we have a DOM node from the data */
|
|
8444
|
+
|
|
8445
|
+
if (!body) {
|
|
8446
|
+
return RETURN_DOM ? null : RETURN_TRUSTED_TYPE ? emptyHTML : '';
|
|
8447
|
+
}
|
|
8448
|
+
}
|
|
8449
|
+
/* Remove first element node (ours) if FORCE_BODY is set */
|
|
8450
|
+
|
|
8451
|
+
|
|
8452
|
+
if (body && FORCE_BODY) {
|
|
8453
|
+
_forceRemove(body.firstChild);
|
|
8454
|
+
}
|
|
8455
|
+
/* Get node iterator */
|
|
8456
|
+
|
|
8457
|
+
|
|
8458
|
+
const nodeIterator = _createIterator(IN_PLACE ? dirty : body);
|
|
8459
|
+
/* Now start iterating over the created document */
|
|
8460
|
+
|
|
8461
|
+
|
|
8462
|
+
while (currentNode = nodeIterator.nextNode()) {
|
|
8463
|
+
/* Sanitize tags and elements */
|
|
8464
|
+
if (_sanitizeElements(currentNode)) {
|
|
8465
|
+
continue;
|
|
8466
|
+
}
|
|
8467
|
+
/* Shadow DOM detected, sanitize it */
|
|
8468
|
+
|
|
8469
|
+
|
|
8470
|
+
if (currentNode.content instanceof DocumentFragment) {
|
|
8471
|
+
_sanitizeShadowDOM(currentNode.content);
|
|
8472
|
+
}
|
|
8473
|
+
/* Check attributes, sanitize if necessary */
|
|
8474
|
+
|
|
8475
|
+
|
|
8476
|
+
_sanitizeAttributes(currentNode);
|
|
8477
|
+
}
|
|
8478
|
+
/* If we sanitized `dirty` in-place, return it. */
|
|
8479
|
+
|
|
8480
|
+
|
|
8481
|
+
if (IN_PLACE) {
|
|
8482
|
+
return dirty;
|
|
8483
|
+
}
|
|
8484
|
+
/* Return sanitized string or DOM */
|
|
8485
|
+
|
|
8486
|
+
|
|
8487
|
+
if (RETURN_DOM) {
|
|
8488
|
+
if (RETURN_DOM_FRAGMENT) {
|
|
8489
|
+
returnNode = createDocumentFragment.call(body.ownerDocument);
|
|
8490
|
+
|
|
8491
|
+
while (body.firstChild) {
|
|
8492
|
+
// eslint-disable-next-line unicorn/prefer-dom-node-append
|
|
8493
|
+
returnNode.appendChild(body.firstChild);
|
|
8494
|
+
}
|
|
8495
|
+
} else {
|
|
8496
|
+
returnNode = body;
|
|
8497
|
+
}
|
|
8498
|
+
|
|
8499
|
+
if (ALLOWED_ATTR.shadowroot || ALLOWED_ATTR.shadowrootmod) {
|
|
8500
|
+
/*
|
|
8501
|
+
AdoptNode() is not used because internal state is not reset
|
|
8502
|
+
(e.g. the past names map of a HTMLFormElement), this is safe
|
|
8503
|
+
in theory but we would rather not risk another attack vector.
|
|
8504
|
+
The state that is cloned by importNode() is explicitly defined
|
|
8505
|
+
by the specs.
|
|
8506
|
+
*/
|
|
8507
|
+
returnNode = importNode.call(originalDocument, returnNode, true);
|
|
8508
|
+
}
|
|
8509
|
+
|
|
8510
|
+
return returnNode;
|
|
8511
|
+
}
|
|
8512
|
+
|
|
8513
|
+
let serializedHTML = WHOLE_DOCUMENT ? body.outerHTML : body.innerHTML;
|
|
8514
|
+
/* Serialize doctype if allowed */
|
|
8515
|
+
|
|
8516
|
+
if (WHOLE_DOCUMENT && ALLOWED_TAGS['!doctype'] && body.ownerDocument && body.ownerDocument.doctype && body.ownerDocument.doctype.name && regExpTest(DOCTYPE_NAME, body.ownerDocument.doctype.name)) {
|
|
8517
|
+
serializedHTML = '<!DOCTYPE ' + body.ownerDocument.doctype.name + '>\n' + serializedHTML;
|
|
8518
|
+
}
|
|
8519
|
+
/* Sanitize final string template-safe */
|
|
8520
|
+
|
|
8521
|
+
|
|
8522
|
+
if (SAFE_FOR_TEMPLATES) {
|
|
8523
|
+
serializedHTML = stringReplace(serializedHTML, MUSTACHE_EXPR, ' ');
|
|
8524
|
+
serializedHTML = stringReplace(serializedHTML, ERB_EXPR, ' ');
|
|
8525
|
+
serializedHTML = stringReplace(serializedHTML, TMPLIT_EXPR, ' ');
|
|
8526
|
+
}
|
|
8527
|
+
|
|
8528
|
+
return trustedTypesPolicy && RETURN_TRUSTED_TYPE ? trustedTypesPolicy.createHTML(serializedHTML) : serializedHTML;
|
|
8529
|
+
};
|
|
8530
|
+
/**
|
|
8531
|
+
* Public method to set the configuration once
|
|
8532
|
+
* setConfig
|
|
8533
|
+
*
|
|
8534
|
+
* @param {Object} cfg configuration object
|
|
8535
|
+
*/
|
|
8536
|
+
|
|
8537
|
+
|
|
8538
|
+
DOMPurify.setConfig = function (cfg) {
|
|
8539
|
+
_parseConfig(cfg);
|
|
8540
|
+
|
|
8541
|
+
SET_CONFIG = true;
|
|
8542
|
+
};
|
|
8543
|
+
/**
|
|
8544
|
+
* Public method to remove the configuration
|
|
8545
|
+
* clearConfig
|
|
8546
|
+
*
|
|
8547
|
+
*/
|
|
8548
|
+
|
|
8549
|
+
|
|
8550
|
+
DOMPurify.clearConfig = function () {
|
|
8551
|
+
CONFIG = null;
|
|
8552
|
+
SET_CONFIG = false;
|
|
8553
|
+
};
|
|
8554
|
+
/**
|
|
8555
|
+
* Public method to check if an attribute value is valid.
|
|
8556
|
+
* Uses last set config, if any. Otherwise, uses config defaults.
|
|
8557
|
+
* isValidAttribute
|
|
8558
|
+
*
|
|
8559
|
+
* @param {string} tag Tag name of containing element.
|
|
8560
|
+
* @param {string} attr Attribute name.
|
|
8561
|
+
* @param {string} value Attribute value.
|
|
8562
|
+
* @return {Boolean} Returns true if `value` is valid. Otherwise, returns false.
|
|
8563
|
+
*/
|
|
8564
|
+
|
|
8565
|
+
|
|
8566
|
+
DOMPurify.isValidAttribute = function (tag, attr, value) {
|
|
8567
|
+
/* Initialize shared config vars if necessary. */
|
|
8568
|
+
if (!CONFIG) {
|
|
8569
|
+
_parseConfig({});
|
|
8570
|
+
}
|
|
8571
|
+
|
|
8572
|
+
const lcTag = transformCaseFunc(tag);
|
|
8573
|
+
const lcName = transformCaseFunc(attr);
|
|
8574
|
+
return _isValidAttribute(lcTag, lcName, value);
|
|
8575
|
+
};
|
|
8576
|
+
/**
|
|
8577
|
+
* AddHook
|
|
8578
|
+
* Public method to add DOMPurify hooks
|
|
8579
|
+
*
|
|
8580
|
+
* @param {String} entryPoint entry point for the hook to add
|
|
8581
|
+
* @param {Function} hookFunction function to execute
|
|
8582
|
+
*/
|
|
8583
|
+
|
|
8584
|
+
|
|
8585
|
+
DOMPurify.addHook = function (entryPoint, hookFunction) {
|
|
8586
|
+
if (typeof hookFunction !== 'function') {
|
|
8587
|
+
return;
|
|
8588
|
+
}
|
|
8589
|
+
|
|
8590
|
+
hooks[entryPoint] = hooks[entryPoint] || [];
|
|
8591
|
+
arrayPush(hooks[entryPoint], hookFunction);
|
|
8592
|
+
};
|
|
8593
|
+
/**
|
|
8594
|
+
* RemoveHook
|
|
8595
|
+
* Public method to remove a DOMPurify hook at a given entryPoint
|
|
8596
|
+
* (pops it from the stack of hooks if more are present)
|
|
8597
|
+
*
|
|
8598
|
+
* @param {String} entryPoint entry point for the hook to remove
|
|
8599
|
+
* @return {Function} removed(popped) hook
|
|
8600
|
+
*/
|
|
8601
|
+
|
|
8602
|
+
|
|
8603
|
+
DOMPurify.removeHook = function (entryPoint) {
|
|
8604
|
+
if (hooks[entryPoint]) {
|
|
8605
|
+
return arrayPop(hooks[entryPoint]);
|
|
8606
|
+
}
|
|
8607
|
+
};
|
|
8608
|
+
/**
|
|
8609
|
+
* RemoveHooks
|
|
8610
|
+
* Public method to remove all DOMPurify hooks at a given entryPoint
|
|
8611
|
+
*
|
|
8612
|
+
* @param {String} entryPoint entry point for the hooks to remove
|
|
8613
|
+
*/
|
|
8614
|
+
|
|
8615
|
+
|
|
8616
|
+
DOMPurify.removeHooks = function (entryPoint) {
|
|
8617
|
+
if (hooks[entryPoint]) {
|
|
8618
|
+
hooks[entryPoint] = [];
|
|
8619
|
+
}
|
|
8620
|
+
};
|
|
8621
|
+
/**
|
|
8622
|
+
* RemoveAllHooks
|
|
8623
|
+
* Public method to remove all DOMPurify hooks
|
|
8624
|
+
*
|
|
8625
|
+
*/
|
|
8626
|
+
|
|
8627
|
+
|
|
8628
|
+
DOMPurify.removeAllHooks = function () {
|
|
8629
|
+
hooks = {};
|
|
8630
|
+
};
|
|
8631
|
+
|
|
8632
|
+
return DOMPurify;
|
|
8633
|
+
}
|
|
8634
|
+
|
|
8635
|
+
var purify = createDOMPurify();
|
|
8636
|
+
|
|
8637
|
+
var getInitialTab = function getInitialTab(stripeAccount) {
|
|
8638
|
+
if (stripeAccount !== null && stripeAccount !== void 0 && stripeAccount.isConnected) {
|
|
8639
|
+
return STEPS.finish;
|
|
8640
|
+
}
|
|
8641
|
+
if (neetocist.isPresent(stripeAccount)) {
|
|
8642
|
+
return STEPS.configure;
|
|
8643
|
+
}
|
|
8644
|
+
return STEPS.connect;
|
|
8645
|
+
};
|
|
8646
|
+
var buildStripeConnectUrl = function buildStripeConnectUrl(holdableId, returnUrl) {
|
|
8647
|
+
return utils$3.buildUrl(STRIPE_CONNECT_URL, {
|
|
8648
|
+
holdable_id: holdableId,
|
|
8649
|
+
return_url: returnUrl
|
|
8650
|
+
});
|
|
8651
|
+
};
|
|
8652
|
+
|
|
8653
|
+
var Connect = function Connect(_ref) {
|
|
8654
|
+
var setActiveTab = _ref.setActiveTab,
|
|
8655
|
+
holdableId = _ref.holdableId,
|
|
8656
|
+
returnUrl = _ref.returnUrl;
|
|
8657
|
+
var _useTranslation = reactI18next.useTranslation(),
|
|
8658
|
+
t = _useTranslation.t;
|
|
8659
|
+
var _useState = React.useState(INTEGRATION_METHOD.createNewAccount),
|
|
8660
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
8661
|
+
selectedOption = _useState2[0],
|
|
8662
|
+
setSelectedOption = _useState2[1];
|
|
8663
|
+
var stripeConnectUrl = buildStripeConnectUrl(holdableId, returnUrl);
|
|
8664
|
+
var handleSubmit = function handleSubmit() {
|
|
8665
|
+
if (selectedOption !== INTEGRATION_METHOD.useExistingAccount) {
|
|
8666
|
+
setActiveTab(STEPS.configure);
|
|
8667
|
+
return;
|
|
8668
|
+
}
|
|
8669
|
+
window.location.href = purify.sanitize(stripeConnectUrl);
|
|
8670
|
+
};
|
|
8671
|
+
return /*#__PURE__*/React__default["default"].createElement("div", {
|
|
8672
|
+
className: "mx-auto w-full max-w-lg space-y-8"
|
|
8673
|
+
}, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
8674
|
+
className: "space-y-2"
|
|
8675
|
+
}, /*#__PURE__*/React__default["default"].createElement(SvgStripe, null), /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
8676
|
+
"data-cy": "configure-payment-title",
|
|
8677
|
+
style: "h2",
|
|
8678
|
+
weight: "semibold"
|
|
8679
|
+
}, t("neetoPayments.integrationModal.title")), /*#__PURE__*/React__default["default"].createElement(neetoui.Label, {
|
|
8680
|
+
className: "leading-snug"
|
|
8681
|
+
}, t("neetoPayments.integrationModal.subtitle"))), /*#__PURE__*/React__default["default"].createElement(neetoui.Radio, {
|
|
8682
|
+
stacked: true,
|
|
8683
|
+
value: selectedOption,
|
|
8684
|
+
onChange: function onChange(event) {
|
|
8685
|
+
return setSelectedOption(event.target.value);
|
|
8686
|
+
}
|
|
8687
|
+
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Radio.Item, {
|
|
8688
|
+
className: "neeto-ui-border-black w-96 py-2",
|
|
8689
|
+
label: t("neetoPayments.integrationModal.createAccount"),
|
|
8690
|
+
name: "accountMethod",
|
|
8691
|
+
value: INTEGRATION_METHOD.createNewAccount
|
|
8692
|
+
}), /*#__PURE__*/React__default["default"].createElement(neetoui.Radio.Item, {
|
|
8693
|
+
className: "neeto-ui-border-black w-96 py-2",
|
|
8694
|
+
label: t("neetoPayments.integrationModal.connectAccount"),
|
|
8695
|
+
name: "accountMethod",
|
|
8696
|
+
value: INTEGRATION_METHOD.useExistingAccount
|
|
8697
|
+
})), /*#__PURE__*/React__default["default"].createElement(neetoui.Button, {
|
|
8698
|
+
label: t("neetoPayments.common.continue"),
|
|
8699
|
+
onClick: handleSubmit
|
|
8700
|
+
}));
|
|
8701
|
+
};
|
|
8702
|
+
|
|
8703
|
+
var Finish = reactUtils.withT(function (_ref) {
|
|
8704
|
+
var t = _ref.t,
|
|
8705
|
+
onSuccess = _ref.onSuccess;
|
|
8706
|
+
return /*#__PURE__*/React__default["default"].createElement(neetointegrations.Finish, {
|
|
8707
|
+
title: t("v2.payment.finishTitle"),
|
|
8708
|
+
onClick: onSuccess
|
|
8709
|
+
}, /*#__PURE__*/React__default["default"].createElement(AccountDetails, null));
|
|
8710
|
+
});
|
|
8711
|
+
|
|
8712
|
+
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
8713
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
8714
|
+
var StripeConnect = function StripeConnect(_ref) {
|
|
8715
|
+
var _ref$holdableId = _ref.holdableId,
|
|
8716
|
+
holdableId = _ref$holdableId === void 0 ? null : _ref$holdableId,
|
|
8717
|
+
isOpen = _ref.isOpen,
|
|
8718
|
+
onClose = _ref.onClose,
|
|
8719
|
+
_ref$isPlatform = _ref.isPlatform,
|
|
8720
|
+
isPlatform = _ref$isPlatform === void 0 ? false : _ref$isPlatform,
|
|
8721
|
+
returnUrl = _ref.returnUrl;
|
|
8722
|
+
var _useFetchConnectedStr = useFetchConnectedStripeAccount(holdableId),
|
|
8723
|
+
_useFetchConnectedStr2 = _useFetchConnectedStr.data,
|
|
8724
|
+
_useFetchConnectedStr3 = _useFetchConnectedStr2 === void 0 ? {} : _useFetchConnectedStr2,
|
|
8725
|
+
stripeAccount = _useFetchConnectedStr3.account;
|
|
8726
|
+
var _useStateWithDependen = reactUtils.useStateWithDependency(getInitialTab(stripeAccount), [stripeAccount]),
|
|
8727
|
+
_useStateWithDependen2 = _slicedToArray(_useStateWithDependen, 2),
|
|
8728
|
+
activeTab = _useStateWithDependen2[0],
|
|
8729
|
+
setActiveTab = _useStateWithDependen2[1];
|
|
8730
|
+
var steps = React.useMemo(function () {
|
|
8731
|
+
var _INTEGRATION_STEPS = _slicedToArray(INTEGRATION_STEPS, 4),
|
|
8732
|
+
connect = _INTEGRATION_STEPS[0],
|
|
8733
|
+
configure = _INTEGRATION_STEPS[1],
|
|
8734
|
+
finish = _INTEGRATION_STEPS[2],
|
|
8735
|
+
demo = _INTEGRATION_STEPS[3];
|
|
8736
|
+
return [_objectSpread(_objectSpread({}, connect), {}, {
|
|
8737
|
+
isActive: activeTab === STEPS.connect,
|
|
8738
|
+
isCompleted: neetocist.isPresent(stripeAccount) || activeTab === STEPS.configure || isPlatform
|
|
8739
|
+
}), _objectSpread(_objectSpread({}, configure), {}, {
|
|
8740
|
+
isActive: activeTab === STEPS.configure,
|
|
8741
|
+
isCompleted: !!(stripeAccount !== null && stripeAccount !== void 0 && stripeAccount.isConnected)
|
|
8742
|
+
}), _objectSpread(_objectSpread({}, finish), {}, {
|
|
8743
|
+
isActive: activeTab === STEPS.finish,
|
|
8744
|
+
isCompleted: activeTab === STEPS.finish || activeTab === STEPS.demo
|
|
8745
|
+
}), _objectSpread(_objectSpread({}, demo), {}, {
|
|
8746
|
+
isActive: activeTab === STEPS.demo,
|
|
8747
|
+
isCompleted: activeTab === STEPS.demo
|
|
8748
|
+
})];
|
|
8749
|
+
}, [activeTab, stripeAccount]);
|
|
8750
|
+
return /*#__PURE__*/React__default["default"].createElement(neetointegrations.Modal, {
|
|
8751
|
+
isOpen: isOpen,
|
|
8752
|
+
onClose: onClose,
|
|
8753
|
+
steps: steps
|
|
8754
|
+
}, activeTab === STEPS.connect && /*#__PURE__*/React__default["default"].createElement(Connect, {
|
|
8755
|
+
holdableId: holdableId,
|
|
8756
|
+
returnUrl: returnUrl,
|
|
8757
|
+
setActiveTab: setActiveTab
|
|
8758
|
+
}), activeTab === STEPS.configure && /*#__PURE__*/React__default["default"].createElement(Configure, {
|
|
8759
|
+
holdableId: holdableId,
|
|
8760
|
+
returnUrl: returnUrl
|
|
8761
|
+
}), activeTab === STEPS.finish && /*#__PURE__*/React__default["default"].createElement(Finish, {
|
|
8762
|
+
onSuccess: onClose
|
|
8763
|
+
}), activeTab === STEPS.demo && /*#__PURE__*/React__default["default"].createElement(neetointegrations.Demo, {
|
|
8764
|
+
onClose: onClose
|
|
8765
|
+
}));
|
|
8766
|
+
};
|
|
8767
|
+
|
|
6645
8768
|
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|
|
6646
8769
|
|
|
6647
8770
|
var css = ".ant-table-cell-row-hover .identifier-copy-button{visibility:visible!important}\n/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbImFwcC9qYXZhc2NyaXB0L3NyYy9zdHlsZXNoZWV0cy9jb21wb25lbnRzL19jb3B5LWJ1dHRvbi5zY3NzIiwiYXBwL2phdmFzY3JpcHQvc3JjL3N0eWxlc2hlZXRzL21haW4uc2NzcyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiQUFDRSxrREFDRSw0QkNBSiIsInNvdXJjZXNDb250ZW50IjpbIi5hbnQtdGFibGUtY2VsbC1yb3ctaG92ZXIge1xuICAuaWRlbnRpZmllci1jb3B5LWJ1dHRvbiB7XG4gICAgdmlzaWJpbGl0eTogdmlzaWJsZSAhaW1wb3J0YW50O1xuICB9XG59XG4iLCIuYW50LXRhYmxlLWNlbGwtcm93LWhvdmVyIC5pZGVudGlmaWVyLWNvcHktYnV0dG9uIHtcbiAgdmlzaWJpbGl0eTogdmlzaWJsZSAhaW1wb3J0YW50O1xufSJdfQ== */";
|
|
@@ -6795,6 +8918,7 @@ exports.PayoutsDashboard = index$2;
|
|
|
6795
8918
|
exports.PayoutsPage = PayoutsPage;
|
|
6796
8919
|
exports.SquareCard = SquareCard;
|
|
6797
8920
|
exports.SquareDashboard = index$1;
|
|
8921
|
+
exports.StripeConnect = StripeConnect;
|
|
6798
8922
|
exports.buildStripeTransactionLink = buildStripeTransactionLink;
|
|
6799
8923
|
exports.useSquareCard = useSquareCard;
|
|
6800
8924
|
exports.useStripePromise = useStripePromise;
|