paymob-widget-alpha 1.0.0 → 1.0.2
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/README.md +48 -32
- package/main.css +1 -0
- package/main.js +527 -434
- package/package.json +1 -1
- package/styles.css +2 -2
- package/Gotham-Bold.otf +0 -0
- package/Gotham-Light.otf +0 -0
- package/Gotham-Medium.otf +0 -0
- package/assets/fonts/Gotham/Gotham-Bold.otf +0 -0
- package/assets/fonts/Gotham/Gotham-BoldItalic.otf +0 -0
- package/assets/fonts/Gotham/Gotham-Book.otf +0 -0
- package/assets/fonts/Gotham/Gotham-BookItalic.otf +0 -0
- package/assets/fonts/Gotham/Gotham-Light.otf +0 -0
- package/assets/fonts/Gotham/Gotham-LightItalic.otf +0 -0
- package/assets/fonts/Gotham/Gotham-Medium.otf +0 -0
- package/assets/fonts/Gotham/Gotham-MediumItalic.otf +0 -0
package/main.js
CHANGED
|
@@ -600,21 +600,38 @@ var react_dom = __webpack_require__(144);
|
|
|
600
600
|
const environment = {
|
|
601
601
|
production: false,
|
|
602
602
|
API_URL_EG: 'https://accept-alpha.paymob.com',
|
|
603
|
-
API_URL_AE: 'https://
|
|
604
|
-
API_URL_SA: 'https://
|
|
605
|
-
API_URL_PK: 'https://
|
|
606
|
-
API_URL_OM: 'https://
|
|
603
|
+
API_URL_AE: 'https://paymob-widget-alpha',
|
|
604
|
+
API_URL_SA: 'https://paymob-widget-alpha',
|
|
605
|
+
API_URL_PK: 'https://paymob-widget-alpha',
|
|
606
|
+
API_URL_OM: 'https://paymob-widget-alpha',
|
|
607
607
|
API_URL_DEFAULT: 'https://accept-alpha.paymob.com',
|
|
608
608
|
IFRAME_PATH: 'unifiedcheckout/iframe-card',
|
|
609
|
-
PIXEL_CSS_LINKS: ['https://cdn.jsdelivr.net/npm/paymob-
|
|
609
|
+
PIXEL_CSS_LINKS: ['https://cdn.jsdelivr.net/npm/paymob-widget-alpha@latest/styles.css', 'https://cdn.jsdelivr.net/npm/paymob-widget-alpha@latest/main.css', 'https://cdn.jsdelivr.net/npm/paymob-widget-alpha@latest/Inter.woff2', 'https://cdn.jsdelivr.net/npm/paymob-widget-alpha@latest/Inter.woff', 'https://cdn.jsdelivr.net/npm/paymob-widget-alpha@latest/Inter.ttf', 'https://cdn.jsdelivr.net/npm/paymob-widget-alpha@latest/Inter.otf']
|
|
610
610
|
};
|
|
611
611
|
// EXTERNAL MODULE: ../../node_modules/react/jsx-runtime.js
|
|
612
612
|
var jsx_runtime = __webpack_require__(85);
|
|
613
|
+
;// ./src/utils/PortalRootContext.tsx
|
|
614
|
+
|
|
615
|
+
|
|
616
|
+
const PortalRootContext = /*#__PURE__*/(0,react.createContext)(null);
|
|
617
|
+
function PortalRootProvider({
|
|
618
|
+
value,
|
|
619
|
+
children
|
|
620
|
+
}) {
|
|
621
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(PortalRootContext.Provider, {
|
|
622
|
+
value: value,
|
|
623
|
+
children: children
|
|
624
|
+
});
|
|
625
|
+
}
|
|
626
|
+
function usePortalRoot() {
|
|
627
|
+
return (0,react.useContext)(PortalRootContext);
|
|
628
|
+
}
|
|
613
629
|
;// ./src/utils/ShadowWrapper.tsx
|
|
614
630
|
|
|
615
631
|
|
|
616
632
|
|
|
617
633
|
|
|
634
|
+
|
|
618
635
|
const ShadowWrapper = ({
|
|
619
636
|
elementId,
|
|
620
637
|
children
|
|
@@ -624,17 +641,47 @@ const ShadowWrapper = ({
|
|
|
624
641
|
(0,react.useEffect)(() => {
|
|
625
642
|
if (!document.getElementById(elementId)) return;
|
|
626
643
|
document.getElementById(elementId).innerHTML = '';
|
|
627
|
-
const
|
|
644
|
+
const mountRoot = document.getElementById(elementId);
|
|
645
|
+
|
|
646
|
+
// Create a dedicated Shadow DOM host for the main app.
|
|
647
|
+
const shadowHost = mountRoot.appendChild(document.createElement('div'));
|
|
628
648
|
if (!('attachShadow' in Element.prototype)) {
|
|
629
649
|
setError('Shadow DOM is not supported in this browser');
|
|
630
650
|
return;
|
|
631
651
|
}
|
|
632
652
|
try {
|
|
633
|
-
let shadow =
|
|
653
|
+
let shadow = shadowHost.shadowRoot;
|
|
634
654
|
if (!shadow) {
|
|
635
|
-
shadow =
|
|
655
|
+
shadow = shadowHost.attachShadow({
|
|
636
656
|
mode: 'open'
|
|
637
657
|
});
|
|
658
|
+
const appendedHrefs = new Set();
|
|
659
|
+
const appendStylesheetLink = href => {
|
|
660
|
+
if (!href) return;
|
|
661
|
+
if (appendedHrefs.has(href)) return;
|
|
662
|
+
if (shadow.querySelector(`link[rel="stylesheet"][href="${href}"]`)) return;
|
|
663
|
+
const link = document.createElement('link');
|
|
664
|
+
link.rel = 'stylesheet';
|
|
665
|
+
link.href = href;
|
|
666
|
+
shadow.appendChild(link);
|
|
667
|
+
appendedHrefs.add(href);
|
|
668
|
+
};
|
|
669
|
+
|
|
670
|
+
// If the widget script is loaded from a URL (CDN/dev server),
|
|
671
|
+
// also load sibling CSS assets from the same base so Shadow DOM always
|
|
672
|
+
// receives the correct CSS bundle (including CSS Modules).
|
|
673
|
+
const resolveBaseFromScript = () => {
|
|
674
|
+
// Best-effort script tag detection (covers CDN embeds + local dev).
|
|
675
|
+
const scripts = Array.from(document.querySelectorAll('script[src]'));
|
|
676
|
+
const candidates = scripts.map(s => String(s.src || '')).filter(Boolean).filter(src => /\/main\.js(\?.*)?$/.test(src));
|
|
677
|
+
const best = candidates.find(src => src.includes('paymob-widget')) || candidates.find(src => src.includes('paymob_widget')) || candidates[candidates.length - 1];
|
|
678
|
+
return best ? best.replace(/\/[^/]*$/, '') : null;
|
|
679
|
+
};
|
|
680
|
+
const base = resolveBaseFromScript();
|
|
681
|
+
if (base) {
|
|
682
|
+
appendStylesheetLink(`${base}/styles.css`);
|
|
683
|
+
appendStylesheetLink(`${base}/main.css`);
|
|
684
|
+
}
|
|
638
685
|
environment.PIXEL_CSS_LINKS.forEach(href => {
|
|
639
686
|
if (href.match(/\.(woff2?|ttf|otf|eot)$/)) {
|
|
640
687
|
const fontName = 'currencyFont';
|
|
@@ -654,11 +701,7 @@ const ShadowWrapper = ({
|
|
|
654
701
|
(_shadow = shadow) == null || _shadow.appendChild(style);
|
|
655
702
|
}).catch(err => console.error(`Failed to load font: ${href}`, err));
|
|
656
703
|
} else {
|
|
657
|
-
|
|
658
|
-
const link = document.createElement('link');
|
|
659
|
-
link.rel = 'stylesheet';
|
|
660
|
-
link.href = href;
|
|
661
|
-
(_shadow2 = shadow) == null || _shadow2.appendChild(link);
|
|
704
|
+
appendStylesheetLink(href);
|
|
662
705
|
}
|
|
663
706
|
});
|
|
664
707
|
}
|
|
@@ -682,7 +725,10 @@ const ShadowWrapper = ({
|
|
|
682
725
|
}), container);
|
|
683
726
|
}
|
|
684
727
|
if (shadowRoot) {
|
|
685
|
-
return /*#__PURE__*/(0,react_dom.createPortal)(
|
|
728
|
+
return /*#__PURE__*/(0,react_dom.createPortal)(/*#__PURE__*/(0,jsx_runtime.jsx)(PortalRootProvider, {
|
|
729
|
+
value: shadowRoot,
|
|
730
|
+
children: children
|
|
731
|
+
}), shadowRoot);
|
|
686
732
|
}
|
|
687
733
|
return null;
|
|
688
734
|
};
|
|
@@ -710,30 +756,30 @@ function bind(fn, thisArg) {
|
|
|
710
756
|
|
|
711
757
|
// utils is a library of generic helper functions non-specific to axios
|
|
712
758
|
|
|
713
|
-
const {toString: utils_toString} = Object.prototype;
|
|
714
|
-
const {getPrototypeOf} = Object;
|
|
715
|
-
const {iterator, toStringTag} = Symbol;
|
|
759
|
+
const { toString: utils_toString } = Object.prototype;
|
|
760
|
+
const { getPrototypeOf } = Object;
|
|
761
|
+
const { iterator, toStringTag } = Symbol;
|
|
716
762
|
|
|
717
|
-
const kindOf = (cache => thing => {
|
|
718
|
-
|
|
719
|
-
|
|
763
|
+
const kindOf = ((cache) => (thing) => {
|
|
764
|
+
const str = utils_toString.call(thing);
|
|
765
|
+
return cache[str] || (cache[str] = str.slice(8, -1).toLowerCase());
|
|
720
766
|
})(Object.create(null));
|
|
721
767
|
|
|
722
768
|
const kindOfTest = (type) => {
|
|
723
769
|
type = type.toLowerCase();
|
|
724
|
-
return (thing) => kindOf(thing) === type
|
|
725
|
-
}
|
|
770
|
+
return (thing) => kindOf(thing) === type;
|
|
771
|
+
};
|
|
726
772
|
|
|
727
|
-
const typeOfTest = type => thing => typeof thing === type;
|
|
773
|
+
const typeOfTest = (type) => (thing) => typeof thing === type;
|
|
728
774
|
|
|
729
775
|
/**
|
|
730
|
-
* Determine if a value is
|
|
776
|
+
* Determine if a value is a non-null object
|
|
731
777
|
*
|
|
732
778
|
* @param {Object} val The value to test
|
|
733
779
|
*
|
|
734
780
|
* @returns {boolean} True if value is an Array, otherwise false
|
|
735
781
|
*/
|
|
736
|
-
const {isArray} = Array;
|
|
782
|
+
const { isArray } = Array;
|
|
737
783
|
|
|
738
784
|
/**
|
|
739
785
|
* Determine if a value is undefined
|
|
@@ -742,7 +788,7 @@ const {isArray} = Array;
|
|
|
742
788
|
*
|
|
743
789
|
* @returns {boolean} True if the value is undefined, otherwise false
|
|
744
790
|
*/
|
|
745
|
-
const isUndefined = typeOfTest(
|
|
791
|
+
const isUndefined = typeOfTest("undefined");
|
|
746
792
|
|
|
747
793
|
/**
|
|
748
794
|
* Determine if a value is a Buffer
|
|
@@ -752,8 +798,14 @@ const isUndefined = typeOfTest('undefined');
|
|
|
752
798
|
* @returns {boolean} True if value is a Buffer, otherwise false
|
|
753
799
|
*/
|
|
754
800
|
function isBuffer(val) {
|
|
755
|
-
return
|
|
756
|
-
|
|
801
|
+
return (
|
|
802
|
+
val !== null &&
|
|
803
|
+
!isUndefined(val) &&
|
|
804
|
+
val.constructor !== null &&
|
|
805
|
+
!isUndefined(val.constructor) &&
|
|
806
|
+
isFunction(val.constructor.isBuffer) &&
|
|
807
|
+
val.constructor.isBuffer(val)
|
|
808
|
+
);
|
|
757
809
|
}
|
|
758
810
|
|
|
759
811
|
/**
|
|
@@ -763,8 +815,7 @@ function isBuffer(val) {
|
|
|
763
815
|
*
|
|
764
816
|
* @returns {boolean} True if value is an ArrayBuffer, otherwise false
|
|
765
817
|
*/
|
|
766
|
-
const isArrayBuffer = kindOfTest(
|
|
767
|
-
|
|
818
|
+
const isArrayBuffer = kindOfTest("ArrayBuffer");
|
|
768
819
|
|
|
769
820
|
/**
|
|
770
821
|
* Determine if a value is a view on an ArrayBuffer
|
|
@@ -775,10 +826,10 @@ const isArrayBuffer = kindOfTest('ArrayBuffer');
|
|
|
775
826
|
*/
|
|
776
827
|
function isArrayBufferView(val) {
|
|
777
828
|
let result;
|
|
778
|
-
if (
|
|
829
|
+
if (typeof ArrayBuffer !== "undefined" && ArrayBuffer.isView) {
|
|
779
830
|
result = ArrayBuffer.isView(val);
|
|
780
831
|
} else {
|
|
781
|
-
result =
|
|
832
|
+
result = val && val.buffer && isArrayBuffer(val.buffer);
|
|
782
833
|
}
|
|
783
834
|
return result;
|
|
784
835
|
}
|
|
@@ -790,7 +841,7 @@ function isArrayBufferView(val) {
|
|
|
790
841
|
*
|
|
791
842
|
* @returns {boolean} True if value is a String, otherwise false
|
|
792
843
|
*/
|
|
793
|
-
const isString = typeOfTest(
|
|
844
|
+
const isString = typeOfTest("string");
|
|
794
845
|
|
|
795
846
|
/**
|
|
796
847
|
* Determine if a value is a Function
|
|
@@ -798,7 +849,7 @@ const isString = typeOfTest('string');
|
|
|
798
849
|
* @param {*} val The value to test
|
|
799
850
|
* @returns {boolean} True if value is a Function, otherwise false
|
|
800
851
|
*/
|
|
801
|
-
const isFunction = typeOfTest(
|
|
852
|
+
const isFunction = typeOfTest("function");
|
|
802
853
|
|
|
803
854
|
/**
|
|
804
855
|
* Determine if a value is a Number
|
|
@@ -807,7 +858,7 @@ const isFunction = typeOfTest('function');
|
|
|
807
858
|
*
|
|
808
859
|
* @returns {boolean} True if value is a Number, otherwise false
|
|
809
860
|
*/
|
|
810
|
-
const isNumber = typeOfTest(
|
|
861
|
+
const isNumber = typeOfTest("number");
|
|
811
862
|
|
|
812
863
|
/**
|
|
813
864
|
* Determine if a value is an Object
|
|
@@ -816,7 +867,7 @@ const isNumber = typeOfTest('number');
|
|
|
816
867
|
*
|
|
817
868
|
* @returns {boolean} True if value is an Object, otherwise false
|
|
818
869
|
*/
|
|
819
|
-
const isObject = (thing) => thing !== null && typeof thing ===
|
|
870
|
+
const isObject = (thing) => thing !== null && typeof thing === "object";
|
|
820
871
|
|
|
821
872
|
/**
|
|
822
873
|
* Determine if a value is a Boolean
|
|
@@ -824,7 +875,7 @@ const isObject = (thing) => thing !== null && typeof thing === 'object';
|
|
|
824
875
|
* @param {*} thing The value to test
|
|
825
876
|
* @returns {boolean} True if value is a Boolean, otherwise false
|
|
826
877
|
*/
|
|
827
|
-
const isBoolean = thing => thing === true || thing === false;
|
|
878
|
+
const isBoolean = (thing) => thing === true || thing === false;
|
|
828
879
|
|
|
829
880
|
/**
|
|
830
881
|
* Determine if a value is a plain Object
|
|
@@ -834,13 +885,19 @@ const isBoolean = thing => thing === true || thing === false;
|
|
|
834
885
|
* @returns {boolean} True if value is a plain Object, otherwise false
|
|
835
886
|
*/
|
|
836
887
|
const isPlainObject = (val) => {
|
|
837
|
-
if (kindOf(val) !==
|
|
888
|
+
if (kindOf(val) !== "object") {
|
|
838
889
|
return false;
|
|
839
890
|
}
|
|
840
891
|
|
|
841
892
|
const prototype = getPrototypeOf(val);
|
|
842
|
-
return (
|
|
843
|
-
|
|
893
|
+
return (
|
|
894
|
+
(prototype === null ||
|
|
895
|
+
prototype === Object.prototype ||
|
|
896
|
+
Object.getPrototypeOf(prototype) === null) &&
|
|
897
|
+
!(toStringTag in val) &&
|
|
898
|
+
!(iterator in val)
|
|
899
|
+
);
|
|
900
|
+
};
|
|
844
901
|
|
|
845
902
|
/**
|
|
846
903
|
* Determine if a value is an empty object (safely handles Buffers)
|
|
@@ -856,12 +913,15 @@ const isEmptyObject = (val) => {
|
|
|
856
913
|
}
|
|
857
914
|
|
|
858
915
|
try {
|
|
859
|
-
return
|
|
916
|
+
return (
|
|
917
|
+
Object.keys(val).length === 0 &&
|
|
918
|
+
Object.getPrototypeOf(val) === Object.prototype
|
|
919
|
+
);
|
|
860
920
|
} catch (e) {
|
|
861
921
|
// Fallback for any other objects that might cause RangeError with Object.keys()
|
|
862
922
|
return false;
|
|
863
923
|
}
|
|
864
|
-
}
|
|
924
|
+
};
|
|
865
925
|
|
|
866
926
|
/**
|
|
867
927
|
* Determine if a value is a Date
|
|
@@ -870,7 +930,7 @@ const isEmptyObject = (val) => {
|
|
|
870
930
|
*
|
|
871
931
|
* @returns {boolean} True if value is a Date, otherwise false
|
|
872
932
|
*/
|
|
873
|
-
const isDate = kindOfTest(
|
|
933
|
+
const isDate = kindOfTest("Date");
|
|
874
934
|
|
|
875
935
|
/**
|
|
876
936
|
* Determine if a value is a File
|
|
@@ -879,7 +939,7 @@ const isDate = kindOfTest('Date');
|
|
|
879
939
|
*
|
|
880
940
|
* @returns {boolean} True if value is a File, otherwise false
|
|
881
941
|
*/
|
|
882
|
-
const isFile = kindOfTest(
|
|
942
|
+
const isFile = kindOfTest("File");
|
|
883
943
|
|
|
884
944
|
/**
|
|
885
945
|
* Determine if a value is a Blob
|
|
@@ -888,7 +948,7 @@ const isFile = kindOfTest('File');
|
|
|
888
948
|
*
|
|
889
949
|
* @returns {boolean} True if value is a Blob, otherwise false
|
|
890
950
|
*/
|
|
891
|
-
const isBlob = kindOfTest(
|
|
951
|
+
const isBlob = kindOfTest("Blob");
|
|
892
952
|
|
|
893
953
|
/**
|
|
894
954
|
* Determine if a value is a FileList
|
|
@@ -897,7 +957,7 @@ const isBlob = kindOfTest('Blob');
|
|
|
897
957
|
*
|
|
898
958
|
* @returns {boolean} True if value is a File, otherwise false
|
|
899
959
|
*/
|
|
900
|
-
const isFileList = kindOfTest(
|
|
960
|
+
const isFileList = kindOfTest("FileList");
|
|
901
961
|
|
|
902
962
|
/**
|
|
903
963
|
* Determine if a value is a Stream
|
|
@@ -917,16 +977,17 @@ const isStream = (val) => isObject(val) && isFunction(val.pipe);
|
|
|
917
977
|
*/
|
|
918
978
|
const isFormData = (thing) => {
|
|
919
979
|
let kind;
|
|
920
|
-
return
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
980
|
+
return (
|
|
981
|
+
thing &&
|
|
982
|
+
((typeof FormData === "function" && thing instanceof FormData) ||
|
|
983
|
+
(isFunction(thing.append) &&
|
|
984
|
+
((kind = kindOf(thing)) === "formdata" ||
|
|
985
|
+
// detect form-data instance
|
|
986
|
+
(kind === "object" &&
|
|
987
|
+
isFunction(thing.toString) &&
|
|
988
|
+
thing.toString() === "[object FormData]"))))
|
|
989
|
+
);
|
|
990
|
+
};
|
|
930
991
|
|
|
931
992
|
/**
|
|
932
993
|
* Determine if a value is a URLSearchParams object
|
|
@@ -935,9 +996,14 @@ const isFormData = (thing) => {
|
|
|
935
996
|
*
|
|
936
997
|
* @returns {boolean} True if value is a URLSearchParams object, otherwise false
|
|
937
998
|
*/
|
|
938
|
-
const isURLSearchParams = kindOfTest(
|
|
999
|
+
const isURLSearchParams = kindOfTest("URLSearchParams");
|
|
939
1000
|
|
|
940
|
-
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
1001
|
+
const [isReadableStream, isRequest, isResponse, isHeaders] = [
|
|
1002
|
+
"ReadableStream",
|
|
1003
|
+
"Request",
|
|
1004
|
+
"Response",
|
|
1005
|
+
"Headers",
|
|
1006
|
+
].map(kindOfTest);
|
|
941
1007
|
|
|
942
1008
|
/**
|
|
943
1009
|
* Trim excess whitespace off the beginning and end of a string
|
|
@@ -946,8 +1012,8 @@ const [isReadableStream, isRequest, isResponse, isHeaders] = ['ReadableStream',
|
|
|
946
1012
|
*
|
|
947
1013
|
* @returns {String} The String freed of excess whitespace
|
|
948
1014
|
*/
|
|
949
|
-
const trim = (str) =>
|
|
950
|
-
str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,
|
|
1015
|
+
const trim = (str) =>
|
|
1016
|
+
str.trim ? str.trim() : str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, "");
|
|
951
1017
|
|
|
952
1018
|
/**
|
|
953
1019
|
* Iterate over an Array or an Object invoking a function for each item.
|
|
@@ -965,9 +1031,9 @@ const trim = (str) => str.trim ?
|
|
|
965
1031
|
* @param {Boolean} [options.allOwnKeys = false]
|
|
966
1032
|
* @returns {any}
|
|
967
1033
|
*/
|
|
968
|
-
function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
1034
|
+
function forEach(obj, fn, { allOwnKeys = false } = {}) {
|
|
969
1035
|
// Don't bother if no value provided
|
|
970
|
-
if (obj === null || typeof obj ===
|
|
1036
|
+
if (obj === null || typeof obj === "undefined") {
|
|
971
1037
|
return;
|
|
972
1038
|
}
|
|
973
1039
|
|
|
@@ -975,7 +1041,7 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
975
1041
|
let l;
|
|
976
1042
|
|
|
977
1043
|
// Force an array if not already something iterable
|
|
978
|
-
if (typeof obj !==
|
|
1044
|
+
if (typeof obj !== "object") {
|
|
979
1045
|
/*eslint no-param-reassign:0*/
|
|
980
1046
|
obj = [obj];
|
|
981
1047
|
}
|
|
@@ -992,7 +1058,9 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
992
1058
|
}
|
|
993
1059
|
|
|
994
1060
|
// Iterate over object keys
|
|
995
|
-
const keys = allOwnKeys
|
|
1061
|
+
const keys = allOwnKeys
|
|
1062
|
+
? Object.getOwnPropertyNames(obj)
|
|
1063
|
+
: Object.keys(obj);
|
|
996
1064
|
const len = keys.length;
|
|
997
1065
|
let key;
|
|
998
1066
|
|
|
@@ -1004,7 +1072,7 @@ function forEach(obj, fn, {allOwnKeys = false} = {}) {
|
|
|
1004
1072
|
}
|
|
1005
1073
|
|
|
1006
1074
|
function findKey(obj, key) {
|
|
1007
|
-
if (isBuffer(obj)){
|
|
1075
|
+
if (isBuffer(obj)) {
|
|
1008
1076
|
return null;
|
|
1009
1077
|
}
|
|
1010
1078
|
|
|
@@ -1024,10 +1092,15 @@ function findKey(obj, key) {
|
|
|
1024
1092
|
const _global = (() => {
|
|
1025
1093
|
/*eslint no-undef:0*/
|
|
1026
1094
|
if (typeof globalThis !== "undefined") return globalThis;
|
|
1027
|
-
return typeof self !== "undefined"
|
|
1095
|
+
return typeof self !== "undefined"
|
|
1096
|
+
? self
|
|
1097
|
+
: typeof window !== "undefined"
|
|
1098
|
+
? window
|
|
1099
|
+
: __webpack_require__.g;
|
|
1028
1100
|
})();
|
|
1029
1101
|
|
|
1030
|
-
const isContextDefined = (context) =>
|
|
1102
|
+
const isContextDefined = (context) =>
|
|
1103
|
+
!isUndefined(context) && context !== _global;
|
|
1031
1104
|
|
|
1032
1105
|
/**
|
|
1033
1106
|
* Accepts varargs expecting each argument to be an object, then
|
|
@@ -1048,10 +1121,15 @@ const isContextDefined = (context) => !isUndefined(context) && context !== _glob
|
|
|
1048
1121
|
* @returns {Object} Result of all merge properties
|
|
1049
1122
|
*/
|
|
1050
1123
|
function merge(/* obj1, obj2, obj3, ... */) {
|
|
1051
|
-
const {caseless, skipUndefined} = isContextDefined(this) && this || {};
|
|
1124
|
+
const { caseless, skipUndefined } = (isContextDefined(this) && this) || {};
|
|
1052
1125
|
const result = {};
|
|
1053
1126
|
const assignValue = (val, key) => {
|
|
1054
|
-
|
|
1127
|
+
// Skip dangerous property names to prevent prototype pollution
|
|
1128
|
+
if (key === "__proto__" || key === "constructor" || key === "prototype") {
|
|
1129
|
+
return;
|
|
1130
|
+
}
|
|
1131
|
+
|
|
1132
|
+
const targetKey = (caseless && findKey(result, key)) || key;
|
|
1055
1133
|
if (isPlainObject(result[targetKey]) && isPlainObject(val)) {
|
|
1056
1134
|
result[targetKey] = merge(result[targetKey], val);
|
|
1057
1135
|
} else if (isPlainObject(val)) {
|
|
@@ -1061,7 +1139,7 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
1061
1139
|
} else if (!skipUndefined || !isUndefined(val)) {
|
|
1062
1140
|
result[targetKey] = val;
|
|
1063
1141
|
}
|
|
1064
|
-
}
|
|
1142
|
+
};
|
|
1065
1143
|
|
|
1066
1144
|
for (let i = 0, l = arguments.length; i < l; i++) {
|
|
1067
1145
|
arguments[i] && forEach(arguments[i], assignValue);
|
|
@@ -1080,26 +1158,30 @@ function merge(/* obj1, obj2, obj3, ... */) {
|
|
|
1080
1158
|
* @param {Boolean} [options.allOwnKeys]
|
|
1081
1159
|
* @returns {Object} The resulting value of object a
|
|
1082
1160
|
*/
|
|
1083
|
-
const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
1084
|
-
forEach(
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1161
|
+
const extend = (a, b, thisArg, { allOwnKeys } = {}) => {
|
|
1162
|
+
forEach(
|
|
1163
|
+
b,
|
|
1164
|
+
(val, key) => {
|
|
1165
|
+
if (thisArg && isFunction(val)) {
|
|
1166
|
+
Object.defineProperty(a, key, {
|
|
1167
|
+
value: bind(val, thisArg),
|
|
1168
|
+
writable: true,
|
|
1169
|
+
enumerable: true,
|
|
1170
|
+
configurable: true,
|
|
1171
|
+
});
|
|
1172
|
+
} else {
|
|
1173
|
+
Object.defineProperty(a, key, {
|
|
1174
|
+
value: val,
|
|
1175
|
+
writable: true,
|
|
1176
|
+
enumerable: true,
|
|
1177
|
+
configurable: true,
|
|
1178
|
+
});
|
|
1179
|
+
}
|
|
1180
|
+
},
|
|
1181
|
+
{ allOwnKeys },
|
|
1182
|
+
);
|
|
1101
1183
|
return a;
|
|
1102
|
-
}
|
|
1184
|
+
};
|
|
1103
1185
|
|
|
1104
1186
|
/**
|
|
1105
1187
|
* Remove byte order marker. This catches EF BB BF (the UTF-8 BOM)
|
|
@@ -1109,11 +1191,11 @@ const extend = (a, b, thisArg, {allOwnKeys}= {}) => {
|
|
|
1109
1191
|
* @returns {string} content value without BOM
|
|
1110
1192
|
*/
|
|
1111
1193
|
const stripBOM = (content) => {
|
|
1112
|
-
if (content.charCodeAt(0) ===
|
|
1194
|
+
if (content.charCodeAt(0) === 0xfeff) {
|
|
1113
1195
|
content = content.slice(1);
|
|
1114
1196
|
}
|
|
1115
1197
|
return content;
|
|
1116
|
-
}
|
|
1198
|
+
};
|
|
1117
1199
|
|
|
1118
1200
|
/**
|
|
1119
1201
|
* Inherit the prototype methods from one constructor into another
|
|
@@ -1125,18 +1207,21 @@ const stripBOM = (content) => {
|
|
|
1125
1207
|
* @returns {void}
|
|
1126
1208
|
*/
|
|
1127
1209
|
const inherits = (constructor, superConstructor, props, descriptors) => {
|
|
1128
|
-
constructor.prototype = Object.create(
|
|
1129
|
-
|
|
1210
|
+
constructor.prototype = Object.create(
|
|
1211
|
+
superConstructor.prototype,
|
|
1212
|
+
descriptors,
|
|
1213
|
+
);
|
|
1214
|
+
Object.defineProperty(constructor.prototype, "constructor", {
|
|
1130
1215
|
value: constructor,
|
|
1131
1216
|
writable: true,
|
|
1132
1217
|
enumerable: false,
|
|
1133
|
-
configurable: true
|
|
1218
|
+
configurable: true,
|
|
1134
1219
|
});
|
|
1135
|
-
Object.defineProperty(constructor,
|
|
1136
|
-
value: superConstructor.prototype
|
|
1220
|
+
Object.defineProperty(constructor, "super", {
|
|
1221
|
+
value: superConstructor.prototype,
|
|
1137
1222
|
});
|
|
1138
1223
|
props && Object.assign(constructor.prototype, props);
|
|
1139
|
-
}
|
|
1224
|
+
};
|
|
1140
1225
|
|
|
1141
1226
|
/**
|
|
1142
1227
|
* Resolve object with deep prototype chain to a flat object
|
|
@@ -1162,16 +1247,23 @@ const toFlatObject = (sourceObj, destObj, filter, propFilter) => {
|
|
|
1162
1247
|
i = props.length;
|
|
1163
1248
|
while (i-- > 0) {
|
|
1164
1249
|
prop = props[i];
|
|
1165
|
-
if (
|
|
1250
|
+
if (
|
|
1251
|
+
(!propFilter || propFilter(prop, sourceObj, destObj)) &&
|
|
1252
|
+
!merged[prop]
|
|
1253
|
+
) {
|
|
1166
1254
|
destObj[prop] = sourceObj[prop];
|
|
1167
1255
|
merged[prop] = true;
|
|
1168
1256
|
}
|
|
1169
1257
|
}
|
|
1170
1258
|
sourceObj = filter !== false && getPrototypeOf(sourceObj);
|
|
1171
|
-
} while (
|
|
1259
|
+
} while (
|
|
1260
|
+
sourceObj &&
|
|
1261
|
+
(!filter || filter(sourceObj, destObj)) &&
|
|
1262
|
+
sourceObj !== Object.prototype
|
|
1263
|
+
);
|
|
1172
1264
|
|
|
1173
1265
|
return destObj;
|
|
1174
|
-
}
|
|
1266
|
+
};
|
|
1175
1267
|
|
|
1176
1268
|
/**
|
|
1177
1269
|
* Determines whether a string ends with the characters of a specified string
|
|
@@ -1190,8 +1282,7 @@ const endsWith = (str, searchString, position) => {
|
|
|
1190
1282
|
position -= searchString.length;
|
|
1191
1283
|
const lastIndex = str.indexOf(searchString, position);
|
|
1192
1284
|
return lastIndex !== -1 && lastIndex === position;
|
|
1193
|
-
}
|
|
1194
|
-
|
|
1285
|
+
};
|
|
1195
1286
|
|
|
1196
1287
|
/**
|
|
1197
1288
|
* Returns new array from array like object or null if failed
|
|
@@ -1210,7 +1301,7 @@ const toArray = (thing) => {
|
|
|
1210
1301
|
arr[i] = thing[i];
|
|
1211
1302
|
}
|
|
1212
1303
|
return arr;
|
|
1213
|
-
}
|
|
1304
|
+
};
|
|
1214
1305
|
|
|
1215
1306
|
/**
|
|
1216
1307
|
* Checking if the Uint8Array exists and if it does, it returns a function that checks if the
|
|
@@ -1221,12 +1312,12 @@ const toArray = (thing) => {
|
|
|
1221
1312
|
* @returns {Array}
|
|
1222
1313
|
*/
|
|
1223
1314
|
// eslint-disable-next-line func-names
|
|
1224
|
-
const isTypedArray = (TypedArray => {
|
|
1315
|
+
const isTypedArray = ((TypedArray) => {
|
|
1225
1316
|
// eslint-disable-next-line func-names
|
|
1226
|
-
return thing => {
|
|
1317
|
+
return (thing) => {
|
|
1227
1318
|
return TypedArray && thing instanceof TypedArray;
|
|
1228
1319
|
};
|
|
1229
|
-
})(typeof Uint8Array !==
|
|
1320
|
+
})(typeof Uint8Array !== "undefined" && getPrototypeOf(Uint8Array));
|
|
1230
1321
|
|
|
1231
1322
|
/**
|
|
1232
1323
|
* For each entry in the object, call the function with the key and value.
|
|
@@ -1247,7 +1338,7 @@ const forEachEntry = (obj, fn) => {
|
|
|
1247
1338
|
const pair = result.value;
|
|
1248
1339
|
fn.call(obj, pair[0], pair[1]);
|
|
1249
1340
|
}
|
|
1250
|
-
}
|
|
1341
|
+
};
|
|
1251
1342
|
|
|
1252
1343
|
/**
|
|
1253
1344
|
* It takes a regular expression and a string, and returns an array of all the matches
|
|
@@ -1266,21 +1357,25 @@ const matchAll = (regExp, str) => {
|
|
|
1266
1357
|
}
|
|
1267
1358
|
|
|
1268
1359
|
return arr;
|
|
1269
|
-
}
|
|
1360
|
+
};
|
|
1270
1361
|
|
|
1271
1362
|
/* Checking if the kindOfTest function returns true when passed an HTMLFormElement. */
|
|
1272
|
-
const isHTMLForm = kindOfTest(
|
|
1363
|
+
const isHTMLForm = kindOfTest("HTMLFormElement");
|
|
1273
1364
|
|
|
1274
|
-
const toCamelCase = str => {
|
|
1275
|
-
return str
|
|
1276
|
-
|
|
1365
|
+
const toCamelCase = (str) => {
|
|
1366
|
+
return str
|
|
1367
|
+
.toLowerCase()
|
|
1368
|
+
.replace(/[-_\s]([a-z\d])(\w*)/g, function replacer(m, p1, p2) {
|
|
1277
1369
|
return p1.toUpperCase() + p2;
|
|
1278
|
-
}
|
|
1279
|
-
);
|
|
1370
|
+
});
|
|
1280
1371
|
};
|
|
1281
1372
|
|
|
1282
1373
|
/* Creating a function that will check if an object has a property. */
|
|
1283
|
-
const utils_hasOwnProperty = (
|
|
1374
|
+
const utils_hasOwnProperty = (
|
|
1375
|
+
({ hasOwnProperty }) =>
|
|
1376
|
+
(obj, prop) =>
|
|
1377
|
+
hasOwnProperty.call(obj, prop)
|
|
1378
|
+
)(Object.prototype);
|
|
1284
1379
|
|
|
1285
1380
|
/**
|
|
1286
1381
|
* Determine if a value is a RegExp object
|
|
@@ -1289,7 +1384,7 @@ const utils_hasOwnProperty = (({hasOwnProperty}) => (obj, prop) => hasOwnPropert
|
|
|
1289
1384
|
*
|
|
1290
1385
|
* @returns {boolean} True if value is a RegExp object, otherwise false
|
|
1291
1386
|
*/
|
|
1292
|
-
const isRegExp = kindOfTest(
|
|
1387
|
+
const isRegExp = kindOfTest("RegExp");
|
|
1293
1388
|
|
|
1294
1389
|
const reduceDescriptors = (obj, reducer) => {
|
|
1295
1390
|
const descriptors = Object.getOwnPropertyDescriptors(obj);
|
|
@@ -1303,7 +1398,7 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
1303
1398
|
});
|
|
1304
1399
|
|
|
1305
1400
|
Object.defineProperties(obj, reducedDescriptors);
|
|
1306
|
-
}
|
|
1401
|
+
};
|
|
1307
1402
|
|
|
1308
1403
|
/**
|
|
1309
1404
|
* Makes all methods read-only
|
|
@@ -1313,7 +1408,10 @@ const reduceDescriptors = (obj, reducer) => {
|
|
|
1313
1408
|
const freezeMethods = (obj) => {
|
|
1314
1409
|
reduceDescriptors(obj, (descriptor, name) => {
|
|
1315
1410
|
// skip restricted props in strict mode
|
|
1316
|
-
if (
|
|
1411
|
+
if (
|
|
1412
|
+
isFunction(obj) &&
|
|
1413
|
+
["arguments", "caller", "callee"].indexOf(name) !== -1
|
|
1414
|
+
) {
|
|
1317
1415
|
return false;
|
|
1318
1416
|
}
|
|
1319
1417
|
|
|
@@ -1323,40 +1421,42 @@ const freezeMethods = (obj) => {
|
|
|
1323
1421
|
|
|
1324
1422
|
descriptor.enumerable = false;
|
|
1325
1423
|
|
|
1326
|
-
if (
|
|
1424
|
+
if ("writable" in descriptor) {
|
|
1327
1425
|
descriptor.writable = false;
|
|
1328
1426
|
return;
|
|
1329
1427
|
}
|
|
1330
1428
|
|
|
1331
1429
|
if (!descriptor.set) {
|
|
1332
1430
|
descriptor.set = () => {
|
|
1333
|
-
throw Error(
|
|
1431
|
+
throw Error("Can not rewrite read-only method '" + name + "'");
|
|
1334
1432
|
};
|
|
1335
1433
|
}
|
|
1336
1434
|
});
|
|
1337
|
-
}
|
|
1435
|
+
};
|
|
1338
1436
|
|
|
1339
1437
|
const toObjectSet = (arrayOrString, delimiter) => {
|
|
1340
1438
|
const obj = {};
|
|
1341
1439
|
|
|
1342
1440
|
const define = (arr) => {
|
|
1343
|
-
arr.forEach(value => {
|
|
1441
|
+
arr.forEach((value) => {
|
|
1344
1442
|
obj[value] = true;
|
|
1345
1443
|
});
|
|
1346
|
-
}
|
|
1444
|
+
};
|
|
1347
1445
|
|
|
1348
|
-
isArray(arrayOrString)
|
|
1446
|
+
isArray(arrayOrString)
|
|
1447
|
+
? define(arrayOrString)
|
|
1448
|
+
: define(String(arrayOrString).split(delimiter));
|
|
1349
1449
|
|
|
1350
1450
|
return obj;
|
|
1351
|
-
}
|
|
1451
|
+
};
|
|
1352
1452
|
|
|
1353
|
-
const noop = () => {}
|
|
1453
|
+
const noop = () => {};
|
|
1354
1454
|
|
|
1355
1455
|
const toFiniteNumber = (value, defaultValue) => {
|
|
1356
|
-
return value != null && Number.isFinite(value = +value)
|
|
1357
|
-
|
|
1358
|
-
|
|
1359
|
-
|
|
1456
|
+
return value != null && Number.isFinite((value = +value))
|
|
1457
|
+
? value
|
|
1458
|
+
: defaultValue;
|
|
1459
|
+
};
|
|
1360
1460
|
|
|
1361
1461
|
/**
|
|
1362
1462
|
* If the thing is a FormData object, return true, otherwise return false.
|
|
@@ -1366,14 +1466,18 @@ const toFiniteNumber = (value, defaultValue) => {
|
|
|
1366
1466
|
* @returns {boolean}
|
|
1367
1467
|
*/
|
|
1368
1468
|
function isSpecCompliantForm(thing) {
|
|
1369
|
-
return !!(
|
|
1469
|
+
return !!(
|
|
1470
|
+
thing &&
|
|
1471
|
+
isFunction(thing.append) &&
|
|
1472
|
+
thing[toStringTag] === "FormData" &&
|
|
1473
|
+
thing[iterator]
|
|
1474
|
+
);
|
|
1370
1475
|
}
|
|
1371
1476
|
|
|
1372
1477
|
const toJSONObject = (obj) => {
|
|
1373
1478
|
const stack = new Array(10);
|
|
1374
1479
|
|
|
1375
1480
|
const visit = (source, i) => {
|
|
1376
|
-
|
|
1377
1481
|
if (isObject(source)) {
|
|
1378
1482
|
if (stack.indexOf(source) >= 0) {
|
|
1379
1483
|
return;
|
|
@@ -1384,7 +1488,7 @@ const toJSONObject = (obj) => {
|
|
|
1384
1488
|
return source;
|
|
1385
1489
|
}
|
|
1386
1490
|
|
|
1387
|
-
if(!(
|
|
1491
|
+
if (!("toJSON" in source)) {
|
|
1388
1492
|
stack[i] = source;
|
|
1389
1493
|
const target = isArray(source) ? [] : {};
|
|
1390
1494
|
|
|
@@ -1400,15 +1504,18 @@ const toJSONObject = (obj) => {
|
|
|
1400
1504
|
}
|
|
1401
1505
|
|
|
1402
1506
|
return source;
|
|
1403
|
-
}
|
|
1507
|
+
};
|
|
1404
1508
|
|
|
1405
1509
|
return visit(obj, 0);
|
|
1406
|
-
}
|
|
1510
|
+
};
|
|
1407
1511
|
|
|
1408
|
-
const isAsyncFn = kindOfTest(
|
|
1512
|
+
const isAsyncFn = kindOfTest("AsyncFunction");
|
|
1409
1513
|
|
|
1410
1514
|
const isThenable = (thing) =>
|
|
1411
|
-
thing &&
|
|
1515
|
+
thing &&
|
|
1516
|
+
(isObject(thing) || isFunction(thing)) &&
|
|
1517
|
+
isFunction(thing.then) &&
|
|
1518
|
+
isFunction(thing.catch);
|
|
1412
1519
|
|
|
1413
1520
|
// original code
|
|
1414
1521
|
// https://github.com/DigitalBrainJS/AxiosPromise/blob/16deab13710ec09779922131f3fa5954320f83ab/lib/utils.js#L11-L34
|
|
@@ -1418,32 +1525,35 @@ const _setImmediate = ((setImmediateSupported, postMessageSupported) => {
|
|
|
1418
1525
|
return setImmediate;
|
|
1419
1526
|
}
|
|
1420
1527
|
|
|
1421
|
-
return postMessageSupported
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1528
|
+
return postMessageSupported
|
|
1529
|
+
? ((token, callbacks) => {
|
|
1530
|
+
_global.addEventListener(
|
|
1531
|
+
"message",
|
|
1532
|
+
({ source, data }) => {
|
|
1533
|
+
if (source === _global && data === token) {
|
|
1534
|
+
callbacks.length && callbacks.shift()();
|
|
1535
|
+
}
|
|
1536
|
+
},
|
|
1537
|
+
false,
|
|
1538
|
+
);
|
|
1427
1539
|
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
isFunction(_global.postMessage)
|
|
1436
|
-
);
|
|
1540
|
+
return (cb) => {
|
|
1541
|
+
callbacks.push(cb);
|
|
1542
|
+
_global.postMessage(token, "*");
|
|
1543
|
+
};
|
|
1544
|
+
})(`axios@${Math.random()}`, [])
|
|
1545
|
+
: (cb) => setTimeout(cb);
|
|
1546
|
+
})(typeof setImmediate === "function", isFunction(_global.postMessage));
|
|
1437
1547
|
|
|
1438
|
-
const asap =
|
|
1439
|
-
|
|
1548
|
+
const asap =
|
|
1549
|
+
typeof queueMicrotask !== "undefined"
|
|
1550
|
+
? queueMicrotask.bind(_global)
|
|
1551
|
+
: (typeof process !== "undefined" && process.nextTick) || _setImmediate;
|
|
1440
1552
|
|
|
1441
1553
|
// *********************
|
|
1442
1554
|
|
|
1443
|
-
|
|
1444
1555
|
const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
1445
1556
|
|
|
1446
|
-
|
|
1447
1557
|
/* harmony default export */ const utils = ({
|
|
1448
1558
|
isArray,
|
|
1449
1559
|
isArrayBuffer,
|
|
@@ -1501,7 +1611,7 @@ const isIterable = (thing) => thing != null && isFunction(thing[iterator]);
|
|
|
1501
1611
|
isThenable,
|
|
1502
1612
|
setImmediate: _setImmediate,
|
|
1503
1613
|
asap,
|
|
1504
|
-
isIterable
|
|
1614
|
+
isIterable,
|
|
1505
1615
|
});
|
|
1506
1616
|
|
|
1507
1617
|
;// ../../node_modules/axios/lib/core/AxiosError.js
|
|
@@ -2014,7 +2124,8 @@ class InterceptorManager {
|
|
|
2014
2124
|
/* harmony default export */ const defaults_transitional = ({
|
|
2015
2125
|
silentJSONParsing: true,
|
|
2016
2126
|
forcedJSONParsing: true,
|
|
2017
|
-
clarifyTimeoutError: false
|
|
2127
|
+
clarifyTimeoutError: false,
|
|
2128
|
+
legacyInterceptorReqResOrdering: true
|
|
2018
2129
|
});
|
|
2019
2130
|
|
|
2020
2131
|
;// ../../node_modules/axios/lib/platform/browser/classes/URLSearchParams.js
|
|
@@ -3090,9 +3201,14 @@ function isAbsoluteURL(url) {
|
|
|
3090
3201
|
// A URL is considered absolute if it begins with "<scheme>://" or "//" (protocol-relative URL).
|
|
3091
3202
|
// RFC 3986 defines scheme name as a sequence of characters beginning with a letter and followed
|
|
3092
3203
|
// by any combination of letters, digits, plus, period, or hyphen.
|
|
3204
|
+
if (typeof url !== 'string') {
|
|
3205
|
+
return false;
|
|
3206
|
+
}
|
|
3207
|
+
|
|
3093
3208
|
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(url);
|
|
3094
3209
|
}
|
|
3095
3210
|
|
|
3211
|
+
|
|
3096
3212
|
;// ../../node_modules/axios/lib/helpers/combineURLs.js
|
|
3097
3213
|
|
|
3098
3214
|
|
|
@@ -3140,7 +3256,8 @@ function buildFullPath(baseURL, requestedURL, allowAbsoluteUrls) {
|
|
|
3140
3256
|
|
|
3141
3257
|
|
|
3142
3258
|
|
|
3143
|
-
const headersToObject = (thing) =>
|
|
3259
|
+
const headersToObject = (thing) =>
|
|
3260
|
+
thing instanceof core_AxiosHeaders ? { ...thing } : thing;
|
|
3144
3261
|
|
|
3145
3262
|
/**
|
|
3146
3263
|
* Config-specific merge-function which creates a new config-object
|
|
@@ -3229,14 +3346,27 @@ function mergeConfig(config1, config2) {
|
|
|
3229
3346
|
socketPath: defaultToConfig2,
|
|
3230
3347
|
responseEncoding: defaultToConfig2,
|
|
3231
3348
|
validateStatus: mergeDirectKeys,
|
|
3232
|
-
headers: (a, b, prop) =>
|
|
3349
|
+
headers: (a, b, prop) =>
|
|
3350
|
+
mergeDeepProperties(headersToObject(a), headersToObject(b), prop, true),
|
|
3233
3351
|
};
|
|
3234
3352
|
|
|
3235
|
-
utils.forEach(
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3353
|
+
utils.forEach(
|
|
3354
|
+
Object.keys({ ...config1, ...config2 }),
|
|
3355
|
+
function computeConfigValue(prop) {
|
|
3356
|
+
if (
|
|
3357
|
+
prop === "__proto__" ||
|
|
3358
|
+
prop === "constructor" ||
|
|
3359
|
+
prop === "prototype"
|
|
3360
|
+
)
|
|
3361
|
+
return;
|
|
3362
|
+
const merge = utils.hasOwnProp(mergeMap, prop)
|
|
3363
|
+
? mergeMap[prop]
|
|
3364
|
+
: mergeDeepProperties;
|
|
3365
|
+
const configValue = merge(config1[prop], config2[prop], prop);
|
|
3366
|
+
(utils.isUndefined(configValue) && merge !== mergeDirectKeys) ||
|
|
3367
|
+
(config[prop] = configValue);
|
|
3368
|
+
},
|
|
3369
|
+
);
|
|
3240
3370
|
|
|
3241
3371
|
return config;
|
|
3242
3372
|
}
|
|
@@ -3895,14 +4025,14 @@ const factory = (env) => {
|
|
|
3895
4025
|
|
|
3896
4026
|
if (err && err.name === 'TypeError' && /Load failed|fetch/i.test(err.message)) {
|
|
3897
4027
|
throw Object.assign(
|
|
3898
|
-
new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, config, request),
|
|
4028
|
+
new core_AxiosError('Network Error', core_AxiosError.ERR_NETWORK, config, request, err && err.response),
|
|
3899
4029
|
{
|
|
3900
4030
|
cause: err.cause || err
|
|
3901
4031
|
}
|
|
3902
4032
|
)
|
|
3903
4033
|
}
|
|
3904
4034
|
|
|
3905
|
-
throw core_AxiosError.from(err, err && err.code, config, request);
|
|
4035
|
+
throw core_AxiosError.from(err, err && err.code, config, request, err && err.response);
|
|
3906
4036
|
}
|
|
3907
4037
|
}
|
|
3908
4038
|
}
|
|
@@ -4147,7 +4277,7 @@ function dispatchRequest(config) {
|
|
|
4147
4277
|
}
|
|
4148
4278
|
|
|
4149
4279
|
;// ../../node_modules/axios/lib/env/data.js
|
|
4150
|
-
const VERSION = "1.13.
|
|
4280
|
+
const VERSION = "1.13.5";
|
|
4151
4281
|
;// ../../node_modules/axios/lib/helpers/validator.js
|
|
4152
4282
|
|
|
4153
4283
|
|
|
@@ -4261,6 +4391,7 @@ function assertOptions(options, schema, allowUnknown) {
|
|
|
4261
4391
|
|
|
4262
4392
|
|
|
4263
4393
|
|
|
4394
|
+
|
|
4264
4395
|
const Axios_validators = validator.validators;
|
|
4265
4396
|
|
|
4266
4397
|
/**
|
|
@@ -4332,7 +4463,8 @@ class Axios {
|
|
|
4332
4463
|
validator.assertOptions(transitional, {
|
|
4333
4464
|
silentJSONParsing: Axios_validators.transitional(Axios_validators.boolean),
|
|
4334
4465
|
forcedJSONParsing: Axios_validators.transitional(Axios_validators.boolean),
|
|
4335
|
-
clarifyTimeoutError: Axios_validators.transitional(Axios_validators.boolean)
|
|
4466
|
+
clarifyTimeoutError: Axios_validators.transitional(Axios_validators.boolean),
|
|
4467
|
+
legacyInterceptorReqResOrdering: Axios_validators.transitional(Axios_validators.boolean)
|
|
4336
4468
|
}, false);
|
|
4337
4469
|
}
|
|
4338
4470
|
|
|
@@ -4391,7 +4523,14 @@ class Axios {
|
|
|
4391
4523
|
|
|
4392
4524
|
synchronousRequestInterceptors = synchronousRequestInterceptors && interceptor.synchronous;
|
|
4393
4525
|
|
|
4394
|
-
|
|
4526
|
+
const transitional = config.transitional || defaults_transitional;
|
|
4527
|
+
const legacyInterceptorReqResOrdering = transitional && transitional.legacyInterceptorReqResOrdering;
|
|
4528
|
+
|
|
4529
|
+
if (legacyInterceptorReqResOrdering) {
|
|
4530
|
+
requestInterceptorChain.unshift(interceptor.fulfilled, interceptor.rejected);
|
|
4531
|
+
} else {
|
|
4532
|
+
requestInterceptorChain.push(interceptor.fulfilled, interceptor.rejected);
|
|
4533
|
+
}
|
|
4395
4534
|
});
|
|
4396
4535
|
|
|
4397
4536
|
const responseInterceptorChain = [];
|
|
@@ -4868,6 +5007,9 @@ const card_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEQA
|
|
|
4868
5007
|
const bag_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEAAAABACAYAAACqaXHeAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAASnSURBVHgB7ZvPTxtHFMffGy9NoRfyHxipObSHJkiN1BtGaoLbS9zKSO0pQUoa91Rya0+Yv6BwaYl7wNwqBRLnUtnkgLkHyb3QS1Ccv6BcEkTwzst7i0gIM/6R7CzB3v1cEma9szvfefPmzewbhFMik5sdHRp6nlNaTRDCJQRKA+Do4VXaJcAmEjQ06c0D/UmlXlnYhVMAIWKyPxTS/gHNKqTrbxrcAwRl9HG+WllqQoREJoD0+Dlvb47/OwshIKDi+mppHiIiEgGk18mnDX77NLiAoMnWMBmFNShwzLfTty45bbyAkKYUbVzhusExTi2gt55nh0fwEBEaiBQ4OiIcJWDHiDjR8d4ILMGpAFPTt5+2bYC8POJMdXWp3qmO7HThBo/7uU717PvD465miRQ44mq+MMdq5qwXCRZra3e/ebL9uNmlGuDfNHa2txYvfH5ZOidj/ABh1FMHH/NvauAAJxYQmH6LntofQPPV1VIR3oNsvlAMrMFWbwvHXAwFJ05Qt3TRVh6m8QIPl6JYj+2an6JQ0+sRoS0gx/P9nrf3v3GBxyqb/Rg4wOZb2DJ2X7ZGxsL6gtAW8JzDW1s5EjoLXriuGaOMo8ohZX/2uxBaAH65jFHIvV+9v1QGRxzOHGT0tEI1ASEJLwDgRUtxHRzDccJDowwpdGDkwAnKqu4ESP+CY9hZNSzFaQiJAwHMFZ7W5Hwpq9GsE99lddkGYxb4On8zg5TKKQXXnMbzHxAePg3Za7Atr18L4Gr5evahhf3WyPzR9BkIII3/yNvb4D+cr7bOImIRL1vDkyJC4AOk5+PSeEHaes57EYTY2CmOH3QQ/ElP4ni0RMQcam7yPl65WyVEatlycxmV3gSHaA64+D2vnyxH1DPQ8f14pkD8xebQfXb2njWQ4Uhufa2UgR6Yyt9eNl9Wbz6691cZHMK7QRJ1GgJUe3vOAr/nBpxYXvP4vyY+wBz7SIswYGjUK0Yhb7VZA6EoApmzivNN0X4jEQDCYy5SUtaFS0iGzDrZWUNIXCyH7xxfq8s2GM8AzgV4dO+PBj/r2CaLfE9UdyAkoQWQzQr01DgRfZdCPR5mD7CHZxXlGTL3czw/tr72ZwVC4oEDqn8HK6wmnAL/HFqXMwtLnCDEnEQAiDmJABBzEgEg5iQCQMxJBICYkwgAMScRAGJOIgDEnEQAiDmJALy//swoRTVwyRJKm20ioAYLgMYWs3w2hkFD2dpEz8QC6kY5fzbO5m9mYEC4Mn3rhi1BQulURQ23Rsq2m4hSy9lcIQ19jqQAKVDWlHvQUFeVygJ/YyNr8oD26EE/iyCN1y16YM13JChLzmAwCyhPFW3JyJJNFRxW+p5NqM+QhE85v9Qu+02SJoN/jwqm8j/Psk383rZG/hStJWFZ6Qg+fTuEvX23LNfjBzneSg+7mv+pbMvEGigOzy+9zoZ969DUzvZW5dPPvjzPsnwFAwj3/EptrVQ4XmacGtv5b6va9sRW3xL4t99qq6VfT16xHpt7sv24fuGLyyuk6TwPif6OCoND2OrH2v27VdvlroemZCoBHzJEfg5IpfmOi3CmkdCe2FFjfZ9jnG6Hql4BrhLc6NP7m20AAAAASUVORK5CYII=";
|
|
4869
5008
|
;// ./src/assets/icons/close.png
|
|
4870
5009
|
const close_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACYAAAAmCAYAAACoPemuAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAInSURBVHgBvdg9T9wwGAfw/2OjinYqW8e2ggFYOkBfprZLeyNSbz+68DJBPgHwCRhBTLCDgO1ggZHhBlh4kUA6Rraw8HqcsQ8FHSIXx8nj/LckdvyT7cSWCTp/y+PzgBqFolBBBdtrSxsoKL9Gpt+/6bqaIiLdPurUoP/VjcU6PaEw3V6YlBitri2swHOeUNc7BHyJ7umOCe8a7z7J3oGh6qsapEb6+r/WT49qB/CUOFSraVB3l7i/ENoYxlVU1Fwu/ZusoEDUM64pQg2Tc51e4ANnQ5l5hiZ25dlhba9vYJhMndiCjMOaBkUP9NtMfmmuTw9ru75xLihzKaP7PnGuqBcwX7gsqFcwblxWVCyMC5cH1RGWF5cXlQjLiuNAWWGuOC5U67VImVJ5YlYvsDOdS6hAgSocKBNrj0Wx9hyopB9+AAPKCZYOx4Nyhpk44TKiMsFMDK63f6hHz9Dv8IAyEcgQ8/Upws/EQoSPkJRcJiHOPWb9JbQnx8LvBHNC5cSlhtlRZotO3WDCpYKl+6OLHyToEkxbJivMZZnh3DJJLlR0iwsnOVGcOMmN4sJJHygOnPSFyouTPlF5cNI3KitOFoHKgqM/5bFlffRT8Y1qj22bftt422POx9ZRIMrE1nMCdyfx52MeUVGqq4uzeqTm4p7pY89QEIkABaOScArYN2fAUnfr/ufBb5tKqVut3NKooAhUlNawDg6f6/YvibCiz1+D+vHezSMpY05esgXS3QAAAABJRU5ErkJggg==";
|
|
5010
|
+
;// ./src/components/modal/modal.module.scss
|
|
5011
|
+
// extracted by mini-css-extract-plugin
|
|
5012
|
+
/* harmony default export */ const modal_module = ({"root":"modal_root__sfoqg","rootMobile":"modal_rootMobile__wzN8Q","rootDesktop":"modal_rootDesktop__CiQty","overlay":"modal_overlay__D1Rh8","panel":"modal_panel__odrOu","panelMobile":"modal_panelMobile__Pyh+r","slideUp":"modal_slideUp__2GwQS","panelDesktop":"modal_panelDesktop__YwVRJ","slideIn":"modal_slideIn__uUuXp","closeFloatingMobile":"modal_closeFloatingMobile__Z3pkR","closeFloatingDesktop":"modal_closeFloatingDesktop__3W3cX","dialog":"modal_dialog__fapVk","dialogMobile":"modal_dialogMobile__awaMW","dialogDesktop":"modal_dialogDesktop__z8dIY","header":"modal_header__oe722","title":"modal_title__0XpA9","poweredRow":"modal_poweredRow__VXaw8","poweredLabel":"modal_poweredLabel__a3hHx","logo":"modal_logo__jcucM","body":"modal_body__SQUnU","footer":"modal_footer__GKw2U","closeIcon":"modal_closeIcon__RJJ9p"});
|
|
4871
5013
|
;// ./src/components/modal/index.tsx
|
|
4872
5014
|
|
|
4873
5015
|
|
|
@@ -4875,6 +5017,25 @@ const close_namespaceObject = "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACY
|
|
|
4875
5017
|
|
|
4876
5018
|
|
|
4877
5019
|
|
|
5020
|
+
|
|
5021
|
+
|
|
5022
|
+
const MOBILE_BREAKPOINT_PX = 664;
|
|
5023
|
+
const FOCUSABLE_SELECTOR = 'a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';
|
|
5024
|
+
function getFocusableElements(root) {
|
|
5025
|
+
return Array.from(root.querySelectorAll(FOCUSABLE_SELECTOR)).filter(el => el.offsetParent !== null || el.getClientRects().length > 0);
|
|
5026
|
+
}
|
|
5027
|
+
function useIsMobileLayout() {
|
|
5028
|
+
const [isMobile, setIsMobile] = (0,react.useState)(() => typeof window !== 'undefined' && window.innerWidth <= MOBILE_BREAKPOINT_PX);
|
|
5029
|
+
(0,react.useEffect)(() => {
|
|
5030
|
+
const handleResize = () => {
|
|
5031
|
+
setIsMobile(window.innerWidth <= MOBILE_BREAKPOINT_PX);
|
|
5032
|
+
};
|
|
5033
|
+
handleResize();
|
|
5034
|
+
window.addEventListener('resize', handleResize);
|
|
5035
|
+
return () => window.removeEventListener('resize', handleResize);
|
|
5036
|
+
}, []);
|
|
5037
|
+
return isMobile;
|
|
5038
|
+
}
|
|
4878
5039
|
function Modal({
|
|
4879
5040
|
isOpen,
|
|
4880
5041
|
onClose,
|
|
@@ -4883,217 +5044,135 @@ function Modal({
|
|
|
4883
5044
|
title = 'Choose your plan to proceed',
|
|
4884
5045
|
theme = 'primary'
|
|
4885
5046
|
}) {
|
|
4886
|
-
const isMobile =
|
|
4887
|
-
(0,react.
|
|
4888
|
-
|
|
4889
|
-
|
|
5047
|
+
const isMobile = useIsMobileLayout();
|
|
5048
|
+
const titleId = (0,react.useId)();
|
|
5049
|
+
const trapContainerRef = (0,react.useRef)(null);
|
|
5050
|
+
const dialogRef = (0,react.useRef)(null);
|
|
5051
|
+
const portalRoot = usePortalRoot();
|
|
5052
|
+
(0,react.useLayoutEffect)(() => {
|
|
5053
|
+
if (!isOpen) return;
|
|
5054
|
+
const previousActiveElement = document.activeElement;
|
|
5055
|
+
document.body.style.overflow = 'hidden';
|
|
5056
|
+
const container = trapContainerRef.current;
|
|
5057
|
+
const focusInitial = () => {
|
|
5058
|
+
if (!container) return;
|
|
5059
|
+
const focusables = getFocusableElements(container);
|
|
5060
|
+
if (focusables.length > 0) {
|
|
5061
|
+
focusables[0].focus();
|
|
5062
|
+
} else {
|
|
5063
|
+
var _dialogRef$current;
|
|
5064
|
+
(_dialogRef$current = dialogRef.current) == null || _dialogRef$current.focus();
|
|
5065
|
+
}
|
|
4890
5066
|
};
|
|
4891
|
-
|
|
4892
|
-
|
|
4893
|
-
|
|
4894
|
-
|
|
5067
|
+
focusInitial();
|
|
5068
|
+
const onDocKeyDown = e => {
|
|
5069
|
+
if (e.key === 'Escape') {
|
|
5070
|
+
onClose();
|
|
5071
|
+
return;
|
|
5072
|
+
}
|
|
5073
|
+
if (e.key !== 'Tab' || !container) return;
|
|
5074
|
+
if (!container.contains(document.activeElement)) return;
|
|
5075
|
+
const focusables = getFocusableElements(container);
|
|
5076
|
+
if (focusables.length === 0) return;
|
|
5077
|
+
if (focusables.length === 1) {
|
|
5078
|
+
e.preventDefault();
|
|
5079
|
+
focusables[0].focus();
|
|
5080
|
+
return;
|
|
5081
|
+
}
|
|
5082
|
+
const first = focusables[0];
|
|
5083
|
+
const last = focusables[focusables.length - 1];
|
|
5084
|
+
if (e.shiftKey) {
|
|
5085
|
+
if (document.activeElement === first) {
|
|
5086
|
+
e.preventDefault();
|
|
5087
|
+
last.focus();
|
|
5088
|
+
}
|
|
5089
|
+
} else if (document.activeElement === last) {
|
|
5090
|
+
e.preventDefault();
|
|
5091
|
+
first.focus();
|
|
5092
|
+
}
|
|
5093
|
+
};
|
|
5094
|
+
document.addEventListener('keydown', onDocKeyDown);
|
|
4895
5095
|
return () => {
|
|
4896
|
-
document.removeEventListener('keydown',
|
|
4897
|
-
document.body.style.overflow = '
|
|
5096
|
+
document.removeEventListener('keydown', onDocKeyDown);
|
|
5097
|
+
document.body.style.overflow = '';
|
|
5098
|
+
if (previousActiveElement instanceof HTMLElement && document.contains(previousActiveElement)) {
|
|
5099
|
+
previousActiveElement.focus({
|
|
5100
|
+
preventScroll: true
|
|
5101
|
+
});
|
|
5102
|
+
}
|
|
4898
5103
|
};
|
|
4899
5104
|
}, [isOpen, onClose]);
|
|
4900
|
-
|
|
4901
|
-
|
|
4902
|
-
|
|
4903
|
-
background: '#144DFF'
|
|
4904
|
-
},
|
|
4905
|
-
dark: {
|
|
4906
|
-
background: '#081F66'
|
|
4907
|
-
},
|
|
4908
|
-
light: {
|
|
4909
|
-
background: '#E8EDFF'
|
|
4910
|
-
}
|
|
4911
|
-
};
|
|
4912
|
-
const titleColorByTheme = {
|
|
4913
|
-
primary: '#FFFFFF',
|
|
4914
|
-
dark: '#FFFFFF',
|
|
4915
|
-
light: '#101828'
|
|
4916
|
-
};
|
|
4917
|
-
const poweredByColorByTheme = {
|
|
4918
|
-
primary: '#D0D5DD',
|
|
4919
|
-
dark: '#D0D5DD',
|
|
4920
|
-
light: '#667085'
|
|
5105
|
+
const handleOverlayClick = event => {
|
|
5106
|
+
if (event.target !== event.currentTarget) return;
|
|
5107
|
+
onClose();
|
|
4921
5108
|
};
|
|
5109
|
+
if (!isOpen) return null;
|
|
4922
5110
|
const modalContent = /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
4923
|
-
|
|
4924
|
-
position: 'fixed',
|
|
4925
|
-
inset: 0,
|
|
4926
|
-
display: isMobile ? 'flex' : 'block',
|
|
4927
|
-
justifyContent: isMobile ? 'flex-end' : undefined,
|
|
4928
|
-
alignItems: isMobile ? 'stretch' : undefined,
|
|
4929
|
-
zIndex: 2147483647
|
|
4930
|
-
},
|
|
5111
|
+
className: `${modal_module.root} ${isMobile ? modal_module.rootMobile : modal_module.rootDesktop}`,
|
|
4931
5112
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
4932
|
-
|
|
4933
|
-
|
|
4934
|
-
|
|
4935
|
-
|
|
4936
|
-
background: 'rgba(0,0,0,0.35)',
|
|
4937
|
-
backdropFilter: 'blur(6px)',
|
|
4938
|
-
WebkitBackdropFilter: 'blur(6px)',
|
|
4939
|
-
zIndex: 0,
|
|
4940
|
-
cursor: 'pointer'
|
|
4941
|
-
}
|
|
5113
|
+
className: modal_module.overlay,
|
|
5114
|
+
onClick: handleOverlayClick,
|
|
5115
|
+
role: "presentation",
|
|
5116
|
+
"aria-hidden": "true"
|
|
4942
5117
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
zIndex: 1,
|
|
4946
|
-
marginLeft: isMobile ? 0 : 'auto',
|
|
4947
|
-
marginRight: isMobile ? 0 : '0',
|
|
4948
|
-
marginTop: isMobile ? 'auto' : '0',
|
|
4949
|
-
marginBottom: 0,
|
|
4950
|
-
height: isMobile ? '80vh' : '100%',
|
|
4951
|
-
maxHeight: isMobile ? '80vh' : '100%',
|
|
4952
|
-
width: '100%',
|
|
4953
|
-
maxWidth: isMobile ? '100%' : '550px',
|
|
4954
|
-
animation: isMobile ? 'slideUp 0.3s ease-out' : 'slideIn 0.3s ease-out'
|
|
4955
|
-
},
|
|
5118
|
+
ref: trapContainerRef,
|
|
5119
|
+
className: `${modal_module.panel} ${isMobile ? modal_module.panelMobile : modal_module.panelDesktop}`,
|
|
4956
5120
|
children: [isMobile && /*#__PURE__*/(0,jsx_runtime.jsx)("button", {
|
|
4957
5121
|
type: "button",
|
|
4958
5122
|
onClick: onClose,
|
|
4959
|
-
|
|
4960
|
-
position: 'absolute',
|
|
4961
|
-
left: '50%',
|
|
4962
|
-
top: -50,
|
|
4963
|
-
transform: 'translateX(-50%)',
|
|
4964
|
-
width: 40,
|
|
4965
|
-
height: 40,
|
|
4966
|
-
borderRadius: '50%',
|
|
4967
|
-
backgroundColor: 'white',
|
|
4968
|
-
border: 'none',
|
|
4969
|
-
cursor: 'pointer',
|
|
4970
|
-
display: 'flex',
|
|
4971
|
-
alignItems: 'center',
|
|
4972
|
-
justifyContent: 'center',
|
|
4973
|
-
boxShadow: '0 6px 16px rgba(0,0,0,0.18)',
|
|
4974
|
-
zIndex: 2
|
|
4975
|
-
},
|
|
5123
|
+
className: modal_module.closeFloatingMobile,
|
|
4976
5124
|
"aria-label": "Close modal",
|
|
4977
5125
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
4978
5126
|
src: close_namespaceObject,
|
|
4979
5127
|
alt: "close",
|
|
4980
|
-
|
|
4981
|
-
width: 10,
|
|
4982
|
-
height: 10
|
|
4983
|
-
}
|
|
5128
|
+
className: modal_module.closeIcon
|
|
4984
5129
|
})
|
|
4985
5130
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
5131
|
+
ref: dialogRef,
|
|
4986
5132
|
role: "dialog",
|
|
4987
5133
|
"aria-modal": "true",
|
|
4988
|
-
|
|
4989
|
-
|
|
4990
|
-
|
|
4991
|
-
|
|
4992
|
-
display: 'flex',
|
|
4993
|
-
flexDirection: 'column',
|
|
4994
|
-
backgroundColor: 'white',
|
|
4995
|
-
overflow: isMobile ? 'hidden' : 'visible',
|
|
4996
|
-
boxShadow: isMobile ? '0 -4px 24px rgba(0,0,0,0.15)' : '-4px 0 24px rgba(0,0,0,0.15)',
|
|
4997
|
-
borderRadius: isMobile ? '24px 24px 0 0' : '0px'
|
|
4998
|
-
},
|
|
5134
|
+
"aria-labelledby": titleId,
|
|
5135
|
+
"data-theme": theme,
|
|
5136
|
+
tabIndex: -1,
|
|
5137
|
+
className: `${modal_module.dialog} ${isMobile ? modal_module.dialogMobile : modal_module.dialogDesktop}`,
|
|
4999
5138
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
5000
|
-
|
|
5001
|
-
position: 'relative',
|
|
5002
|
-
display: 'flex',
|
|
5003
|
-
alignItems: 'flex-end',
|
|
5004
|
-
justifyContent: 'space-between',
|
|
5005
|
-
backgroundColor: headerStylesByTheme[theme].background,
|
|
5006
|
-
padding: '12px 16px',
|
|
5007
|
-
color: titleColorByTheme[theme]
|
|
5008
|
-
},
|
|
5139
|
+
className: modal_module.header,
|
|
5009
5140
|
children: [!isMobile && /*#__PURE__*/(0,jsx_runtime.jsx)("button", {
|
|
5010
5141
|
type: "button",
|
|
5011
5142
|
onClick: onClose,
|
|
5012
|
-
|
|
5013
|
-
position: 'absolute',
|
|
5014
|
-
left: '-45px',
|
|
5015
|
-
top: '50%',
|
|
5016
|
-
transform: 'translateY(-50%)',
|
|
5017
|
-
width: 40,
|
|
5018
|
-
height: 40,
|
|
5019
|
-
borderRadius: '50%',
|
|
5020
|
-
backgroundColor: 'white',
|
|
5021
|
-
border: 'none',
|
|
5022
|
-
cursor: 'pointer',
|
|
5023
|
-
display: 'flex',
|
|
5024
|
-
alignItems: 'center',
|
|
5025
|
-
justifyContent: 'center',
|
|
5026
|
-
boxShadow: '0 6px 16px rgba(0,0,0,0.18)'
|
|
5027
|
-
},
|
|
5143
|
+
className: modal_module.closeFloatingDesktop,
|
|
5028
5144
|
"aria-label": "Close modal",
|
|
5029
5145
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
5030
5146
|
src: close_namespaceObject,
|
|
5031
5147
|
alt: "close",
|
|
5032
|
-
|
|
5033
|
-
width: 10,
|
|
5034
|
-
height: 10
|
|
5035
|
-
}
|
|
5148
|
+
className: modal_module.closeIcon
|
|
5036
5149
|
})
|
|
5037
5150
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
5038
|
-
|
|
5039
|
-
|
|
5040
|
-
fontWeight: 600
|
|
5041
|
-
},
|
|
5151
|
+
id: titleId,
|
|
5152
|
+
className: modal_module.title,
|
|
5042
5153
|
children: title
|
|
5043
5154
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
5044
|
-
|
|
5045
|
-
display: 'flex',
|
|
5046
|
-
alignItems: 'flex-end',
|
|
5047
|
-
gap: 4
|
|
5048
|
-
},
|
|
5155
|
+
className: modal_module.poweredRow,
|
|
5049
5156
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("span", {
|
|
5050
|
-
|
|
5051
|
-
fontSize: 12,
|
|
5052
|
-
lineHeight: 1,
|
|
5053
|
-
display: 'flex',
|
|
5054
|
-
alignItems: 'flex-end',
|
|
5055
|
-
color: poweredByColorByTheme[theme]
|
|
5056
|
-
},
|
|
5157
|
+
className: modal_module.poweredLabel,
|
|
5057
5158
|
children: "Powered by"
|
|
5058
5159
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
5059
5160
|
src: theme === 'light' ? blue_logo_namespaceObject : paymob_logo_namespaceObject,
|
|
5060
5161
|
alt: "paymob",
|
|
5061
|
-
|
|
5062
|
-
height: 17,
|
|
5063
|
-
objectFit: 'contain'
|
|
5064
|
-
}
|
|
5162
|
+
className: modal_module.logo
|
|
5065
5163
|
})]
|
|
5066
5164
|
})]
|
|
5067
5165
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
5068
|
-
|
|
5069
|
-
flex: 1,
|
|
5070
|
-
overflowY: 'auto',
|
|
5071
|
-
padding: 16,
|
|
5072
|
-
WebkitOverflowScrolling: 'touch'
|
|
5073
|
-
},
|
|
5166
|
+
className: modal_module.body,
|
|
5074
5167
|
children: children
|
|
5075
5168
|
}), footer && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
5076
|
-
|
|
5077
|
-
borderTop: '1px solid #f3f4f6',
|
|
5078
|
-
padding: 16
|
|
5079
|
-
},
|
|
5169
|
+
className: modal_module.footer,
|
|
5080
5170
|
children: footer
|
|
5081
5171
|
})]
|
|
5082
5172
|
})]
|
|
5083
|
-
}), /*#__PURE__*/(0,jsx_runtime.jsx)("style", {
|
|
5084
|
-
children: `
|
|
5085
|
-
@keyframes slideIn {
|
|
5086
|
-
from { transform: translateX(100%); opacity: 0; }
|
|
5087
|
-
to { transform: translateX(0); opacity: 1; }
|
|
5088
|
-
}
|
|
5089
|
-
@keyframes slideUp {
|
|
5090
|
-
from { transform: translateY(100%); opacity: 0; }
|
|
5091
|
-
to { transform: translateY(0); opacity: 1; }
|
|
5092
|
-
}
|
|
5093
|
-
`
|
|
5094
5173
|
})]
|
|
5095
5174
|
});
|
|
5096
|
-
return /*#__PURE__*/(0,react_dom.createPortal)(modalContent, document.body);
|
|
5175
|
+
return /*#__PURE__*/(0,react_dom.createPortal)(modalContent, portalRoot != null ? portalRoot : document.body);
|
|
5097
5176
|
}
|
|
5098
5177
|
/* harmony default export */ const modal = (Modal);
|
|
5099
5178
|
;// ../../node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
|
|
@@ -7723,6 +7802,26 @@ async function fetchInstallmentPlansProduct(payload) {
|
|
|
7723
7802
|
|
|
7724
7803
|
|
|
7725
7804
|
|
|
7805
|
+
/** One installment row as returned by the installment-plans product endpoint (snake_case). */
|
|
7806
|
+
|
|
7807
|
+
/** One bank row as returned by the same endpoint (snake_case). */
|
|
7808
|
+
|
|
7809
|
+
function isInstallmentPlansProductWrappedPayload(value) {
|
|
7810
|
+
return typeof value === 'object' && value !== null && 'data' in value && Array.isArray(value.data);
|
|
7811
|
+
}
|
|
7812
|
+
|
|
7813
|
+
/**
|
|
7814
|
+
* Accepts either a bare list of banks or `{ data: banks[] }` (common axios / gateway shape).
|
|
7815
|
+
*/
|
|
7816
|
+
function readBanksListFromInstallmentPlansProductPayload(payload) {
|
|
7817
|
+
if (Array.isArray(payload)) {
|
|
7818
|
+
return payload;
|
|
7819
|
+
}
|
|
7820
|
+
if (isInstallmentPlansProductWrappedPayload(payload)) {
|
|
7821
|
+
return payload.data;
|
|
7822
|
+
}
|
|
7823
|
+
return null;
|
|
7824
|
+
}
|
|
7726
7825
|
const learnMoreSteps = [{
|
|
7727
7826
|
icon: calender_namespaceObject,
|
|
7728
7827
|
title: 'Select Installment Plan',
|
|
@@ -7740,6 +7839,37 @@ const learnMoreSteps = [{
|
|
|
7740
7839
|
title: 'Complete Payment on Paymob',
|
|
7741
7840
|
description: 'Enter the card details of the selected bank to finalize the payment.'
|
|
7742
7841
|
}];
|
|
7842
|
+
function normalizeBanksWithPlans(installmentPlansProductPayload) {
|
|
7843
|
+
const banksList = readBanksListFromInstallmentPlansProductPayload(installmentPlansProductPayload);
|
|
7844
|
+
if (!(banksList != null && banksList.length)) return null;
|
|
7845
|
+
return banksList.map((bankItem, bankIndex) => {
|
|
7846
|
+
var _bankItem$installment, _axios$defaults$baseU, _bankItem$bank_logo;
|
|
7847
|
+
const bankInstallmentPlans = (_bankItem$installment = bankItem.installment_plans) != null ? _bankItem$installment : [];
|
|
7848
|
+
const installmentOptions = bankInstallmentPlans.map(planFromProduct => {
|
|
7849
|
+
const interestRate = Number(planFromProduct.interest_rate);
|
|
7850
|
+
const badge = interestRate === 0 ? '0% Interest' : `${interestRate}% Interest`;
|
|
7851
|
+
return {
|
|
7852
|
+
id: planFromProduct.id,
|
|
7853
|
+
months: Number(planFromProduct.tenure),
|
|
7854
|
+
monthlyAmount: Number(planFromProduct.installment_amount),
|
|
7855
|
+
badge
|
|
7856
|
+
};
|
|
7857
|
+
});
|
|
7858
|
+
const minimumMonthlyFromProduct = Number(bankItem.minimum_plan_amount);
|
|
7859
|
+
const startsFromAmount = minimumMonthlyFromProduct || (installmentOptions.length ? Math.min(...installmentOptions.map(option => option.monthlyAmount)) : 0);
|
|
7860
|
+
const baseURL = String((_axios$defaults$baseU = lib_axios.defaults.baseURL) != null ? _axios$defaults$baseU : '');
|
|
7861
|
+
const logoPath = String((_bankItem$bank_logo = bankItem.bank_logo) != null ? _bankItem$bank_logo : '');
|
|
7862
|
+
const resolvedLogo = logoPath && logoPath.startsWith('/') && baseURL ? `${baseURL}${logoPath}` : logoPath || Partner_logo_namespaceObject;
|
|
7863
|
+
return {
|
|
7864
|
+
id: String(bankItem.bank_name || `bank-${bankIndex}`),
|
|
7865
|
+
name: String(bankItem.bank_name || 'Bank'),
|
|
7866
|
+
logo: resolvedLogo,
|
|
7867
|
+
badgeText: '0% Interest',
|
|
7868
|
+
startsFromAmount,
|
|
7869
|
+
installmentOptions
|
|
7870
|
+
};
|
|
7871
|
+
});
|
|
7872
|
+
}
|
|
7743
7873
|
function Widget({
|
|
7744
7874
|
publicKey,
|
|
7745
7875
|
amount = 300,
|
|
@@ -7750,87 +7880,50 @@ function Widget({
|
|
|
7750
7880
|
}) {
|
|
7751
7881
|
const [isModalOpen, setIsModalOpen] = (0,react.useState)(false);
|
|
7752
7882
|
const [isLearnMoreOpen, setIsLearnMoreOpen] = (0,react.useState)(false);
|
|
7753
|
-
const [
|
|
7754
|
-
const [
|
|
7755
|
-
const [
|
|
7756
|
-
const [
|
|
7757
|
-
const [
|
|
7758
|
-
const [
|
|
7759
|
-
const [
|
|
7883
|
+
const [isPlansLoading, setIsPlansLoading] = (0,react.useState)(false);
|
|
7884
|
+
const [plansErrorMessage, setPlansErrorMessage] = (0,react.useState)(null);
|
|
7885
|
+
const [banksWithPlans, setBanksWithPlans] = (0,react.useState)([]);
|
|
7886
|
+
const [selectedInstallmentId, setSelectedInstallmentId] = (0,react.useState)(null);
|
|
7887
|
+
const [selectedInstallment, setSelectedInstallment] = (0,react.useState)(null);
|
|
7888
|
+
const [isSubmitting, setIsSubmitting] = (0,react.useState)(false);
|
|
7889
|
+
const [submitError, setSubmitError] = (0,react.useState)(null);
|
|
7760
7890
|
const canSelect = typeof onSubmit === 'function';
|
|
7761
|
-
const
|
|
7891
|
+
const amountInCents = (0,react.useMemo)(() => {
|
|
7762
7892
|
if (typeof amount === 'number') return Math.round(amount * 100);
|
|
7763
7893
|
return 0;
|
|
7764
7894
|
}, [amount]);
|
|
7765
|
-
const normalizedPlans = data => {
|
|
7766
|
-
var _ref, _ref2, _ref3, _ref4, _data$banks;
|
|
7767
|
-
const raw = (_ref = (_ref2 = (_ref3 = (_ref4 = (_data$banks = data == null ? void 0 : data.banks) != null ? _data$banks : data == null ? void 0 : data.bank_plans) != null ? _ref4 : data == null ? void 0 : data.bankPlans) != null ? _ref3 : data == null ? void 0 : data.data) != null ? _ref2 : data == null ? void 0 : data.results) != null ? _ref : data;
|
|
7768
|
-
if (!Array.isArray(raw)) return null;
|
|
7769
|
-
return raw.map(bank => {
|
|
7770
|
-
var _ref5, _ref6, _ref7, _bank$installment_pla, _ref19, _ref20, _bank$startsFrom, _axios$defaults$baseU, _ref21, _bank$logo, _ref22, _ref23, _bank$id, _ref24, _bank$name, _ref25, _bank$badgeText;
|
|
7771
|
-
const plansRaw = (_ref5 = (_ref6 = (_ref7 = (_bank$installment_pla = bank == null ? void 0 : bank.installment_plans) != null ? _bank$installment_pla : bank == null ? void 0 : bank.plans) != null ? _ref7 : bank == null ? void 0 : bank.tenures) != null ? _ref6 : bank == null ? void 0 : bank.installments) != null ? _ref5 : [];
|
|
7772
|
-
const plans = Array.isArray(plansRaw) ? plansRaw.map(p => {
|
|
7773
|
-
var _ref8, _ref9, _ref0, _p$id, _ref1, _ref10, _p$months, _ref11, _ref12, _ref13, _ref14, _p$monthly_amount;
|
|
7774
|
-
return {
|
|
7775
|
-
id: (_ref8 = (_ref9 = (_ref0 = (_p$id = p == null ? void 0 : p.id) != null ? _p$id : p == null ? void 0 : p.plan_id) != null ? _ref0 : p == null ? void 0 : p.tenure_id) != null ? _ref9 : p == null ? void 0 : p.tenure) != null ? _ref8 : p == null ? void 0 : p.months,
|
|
7776
|
-
months: Number((_ref1 = (_ref10 = (_p$months = p == null ? void 0 : p.months) != null ? _p$months : p == null ? void 0 : p.tenure) != null ? _ref10 : p == null ? void 0 : p.duration) != null ? _ref1 : 0),
|
|
7777
|
-
monthlyAmount: Number((_ref11 = (_ref12 = (_ref13 = (_ref14 = (_p$monthly_amount = p == null ? void 0 : p.monthly_amount) != null ? _p$monthly_amount : p == null ? void 0 : p.monthlyAmount) != null ? _ref14 : p == null ? void 0 : p.amount_per_month) != null ? _ref13 : p == null ? void 0 : p.installment_amount) != null ? _ref12 : p == null ? void 0 : p.amount) != null ? _ref11 : 0),
|
|
7778
|
-
badge: ((_ref15, _p$interest_rate, _ref16, _ref17, _ref18, _p$badge) => {
|
|
7779
|
-
const interestRate = (_ref15 = (_p$interest_rate = p == null ? void 0 : p.interest_rate) != null ? _p$interest_rate : p == null ? void 0 : p.interestRate) != null ? _ref15 : typeof (p == null ? void 0 : p.interest) === 'number' ? p.interest : undefined;
|
|
7780
|
-
if (typeof interestRate === 'number') {
|
|
7781
|
-
if (interestRate === 0) return '0% Interest';
|
|
7782
|
-
return `${interestRate}% Interest`;
|
|
7783
|
-
}
|
|
7784
|
-
return String((_ref16 = (_ref17 = (_ref18 = (_p$badge = p == null ? void 0 : p.badge) != null ? _p$badge : p == null ? void 0 : p.interest_text) != null ? _ref18 : p == null ? void 0 : p.interest) != null ? _ref17 : bank == null ? void 0 : bank.badgeText) != null ? _ref16 : '0% Interest');
|
|
7785
|
-
})()
|
|
7786
|
-
};
|
|
7787
|
-
}) : [];
|
|
7788
|
-
const startsFrom = Number((_ref19 = (_ref20 = (_bank$startsFrom = bank == null ? void 0 : bank.startsFrom) != null ? _bank$startsFrom : bank == null ? void 0 : bank.minimum_plan_amount) != null ? _ref20 : bank == null ? void 0 : bank.minimum_installment_amount) != null ? _ref19 : 0) || (plans.length ? Math.min(...plans.map(p => p.monthlyAmount)) : 0);
|
|
7789
|
-
const baseURL = String((_axios$defaults$baseU = lib_axios.defaults.baseURL) != null ? _axios$defaults$baseU : '');
|
|
7790
|
-
const logoPath = String((_ref21 = (_bank$logo = bank == null ? void 0 : bank.logo) != null ? _bank$logo : bank == null ? void 0 : bank.bank_logo) != null ? _ref21 : '');
|
|
7791
|
-
const resolvedLogo = logoPath && logoPath.startsWith('/') && baseURL ? `${baseURL}${logoPath}` : logoPath || Partner_logo_namespaceObject;
|
|
7792
|
-
return {
|
|
7793
|
-
id: String((_ref22 = (_ref23 = (_bank$id = bank == null ? void 0 : bank.id) != null ? _bank$id : bank == null ? void 0 : bank.code) != null ? _ref23 : bank == null ? void 0 : bank.name) != null ? _ref22 : Math.random()),
|
|
7794
|
-
name: String((_ref24 = (_bank$name = bank == null ? void 0 : bank.name) != null ? _bank$name : bank == null ? void 0 : bank.bank_name) != null ? _ref24 : 'Bank'),
|
|
7795
|
-
logo: resolvedLogo,
|
|
7796
|
-
badgeText: String((_ref25 = (_bank$badgeText = bank == null ? void 0 : bank.badgeText) != null ? _bank$badgeText : bank == null ? void 0 : bank.badge_text) != null ? _ref25 : '0% Interest'),
|
|
7797
|
-
startsFrom,
|
|
7798
|
-
plans
|
|
7799
|
-
};
|
|
7800
|
-
});
|
|
7801
|
-
};
|
|
7802
7895
|
(0,react.useEffect)(() => {
|
|
7803
|
-
const
|
|
7896
|
+
const loadInstallmentPlans = async () => {
|
|
7804
7897
|
if (!isModalOpen) return;
|
|
7805
7898
|
if (!publicKey) return;
|
|
7806
|
-
|
|
7807
|
-
|
|
7808
|
-
|
|
7809
|
-
|
|
7810
|
-
|
|
7811
|
-
|
|
7812
|
-
const
|
|
7899
|
+
setIsPlansLoading(true);
|
|
7900
|
+
setPlansErrorMessage(null);
|
|
7901
|
+
setSubmitError(null);
|
|
7902
|
+
setBanksWithPlans([]);
|
|
7903
|
+
setSelectedInstallmentId(null);
|
|
7904
|
+
setSelectedInstallment(null);
|
|
7905
|
+
const installmentPlansResponse = await fetchInstallmentPlansProduct(Object.assign({
|
|
7813
7906
|
public_key: publicKey,
|
|
7814
|
-
amount_cents:
|
|
7907
|
+
amount_cents: amountInCents,
|
|
7815
7908
|
currency
|
|
7816
7909
|
}, typeof integrationId === 'number' ? {
|
|
7817
7910
|
integration_id: integrationId
|
|
7818
7911
|
} : {}));
|
|
7819
|
-
if ((
|
|
7820
|
-
const
|
|
7821
|
-
if (
|
|
7822
|
-
|
|
7912
|
+
if ((installmentPlansResponse == null ? void 0 : installmentPlansResponse.status) >= 200 && (installmentPlansResponse == null ? void 0 : installmentPlansResponse.status) < 300) {
|
|
7913
|
+
const normalizedBanks = normalizeBanksWithPlans(installmentPlansResponse == null ? void 0 : installmentPlansResponse.data);
|
|
7914
|
+
if (normalizedBanks != null && normalizedBanks.length) {
|
|
7915
|
+
setBanksWithPlans(normalizedBanks);
|
|
7823
7916
|
} else {
|
|
7824
|
-
|
|
7917
|
+
setPlansErrorMessage('No installment plans available.');
|
|
7825
7918
|
}
|
|
7826
7919
|
} else {
|
|
7827
|
-
var
|
|
7828
|
-
|
|
7920
|
+
var _installmentPlansResp, _installmentPlansResp2;
|
|
7921
|
+
setPlansErrorMessage((installmentPlansResponse == null || (_installmentPlansResp = installmentPlansResponse.data) == null ? void 0 : _installmentPlansResp.message) || (installmentPlansResponse == null || (_installmentPlansResp2 = installmentPlansResponse.data) == null ? void 0 : _installmentPlansResp2.msg) || 'Failed to load installment plans.');
|
|
7829
7922
|
}
|
|
7830
|
-
|
|
7923
|
+
setIsPlansLoading(false);
|
|
7831
7924
|
};
|
|
7832
|
-
void
|
|
7833
|
-
}, [isModalOpen, publicKey,
|
|
7925
|
+
void loadInstallmentPlans();
|
|
7926
|
+
}, [isModalOpen, publicKey, amountInCents, currency, integrationId]);
|
|
7834
7927
|
const headerThemeStyles = {
|
|
7835
7928
|
primary: {
|
|
7836
7929
|
background: '#144DFF'
|
|
@@ -7903,7 +7996,7 @@ function Widget({
|
|
|
7903
7996
|
text: "View all plans",
|
|
7904
7997
|
onClickHandler: () => {
|
|
7905
7998
|
setIsModalOpen(true);
|
|
7906
|
-
|
|
7999
|
+
setSubmitError(null);
|
|
7907
8000
|
},
|
|
7908
8001
|
trailingIcon: /*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
7909
8002
|
src: arrow_namespaceObject,
|
|
@@ -7934,51 +8027,51 @@ function Widget({
|
|
|
7934
8027
|
theme: theme,
|
|
7935
8028
|
footer: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
7936
8029
|
className: moda_module['button'],
|
|
7937
|
-
children: [
|
|
8030
|
+
children: [submitError && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
7938
8031
|
style: {
|
|
7939
8032
|
paddingBottom: 8,
|
|
7940
8033
|
color: '#B42318',
|
|
7941
8034
|
fontSize: 14
|
|
7942
8035
|
},
|
|
7943
|
-
children:
|
|
8036
|
+
children: submitError
|
|
7944
8037
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Button, {
|
|
7945
8038
|
type: "button",
|
|
7946
8039
|
text: "Buy now",
|
|
7947
8040
|
color: "primary",
|
|
7948
|
-
loading:
|
|
7949
|
-
disabled: !canSelect || !
|
|
8041
|
+
loading: isSubmitting,
|
|
8042
|
+
disabled: !canSelect || !selectedInstallment || isSubmitting || isPlansLoading,
|
|
7950
8043
|
onClickHandler: async () => {
|
|
7951
8044
|
if (!canSelect) return;
|
|
7952
|
-
if (!
|
|
7953
|
-
|
|
8045
|
+
if (!selectedInstallment) {
|
|
8046
|
+
setSubmitError('Please select an installment plan.');
|
|
7954
8047
|
return;
|
|
7955
8048
|
}
|
|
7956
|
-
|
|
7957
|
-
|
|
8049
|
+
setIsSubmitting(true);
|
|
8050
|
+
setSubmitError(null);
|
|
7958
8051
|
try {
|
|
7959
|
-
onSubmit == null || onSubmit(
|
|
8052
|
+
onSubmit == null || onSubmit(selectedInstallment);
|
|
7960
8053
|
setIsModalOpen(false);
|
|
7961
8054
|
} finally {
|
|
7962
|
-
|
|
8055
|
+
setIsSubmitting(false);
|
|
7963
8056
|
}
|
|
7964
8057
|
}
|
|
7965
8058
|
})]
|
|
7966
8059
|
}),
|
|
7967
|
-
children: [
|
|
8060
|
+
children: [isPlansLoading && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
7968
8061
|
style: {
|
|
7969
8062
|
padding: 8,
|
|
7970
8063
|
color: '#475467',
|
|
7971
8064
|
fontSize: 14
|
|
7972
8065
|
},
|
|
7973
8066
|
children: "Loading plans..."
|
|
7974
|
-
}),
|
|
8067
|
+
}), plansErrorMessage && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
7975
8068
|
style: {
|
|
7976
8069
|
padding: 8,
|
|
7977
8070
|
color: '#B42318',
|
|
7978
8071
|
fontSize: 14
|
|
7979
8072
|
},
|
|
7980
|
-
children:
|
|
7981
|
-
}), !
|
|
8073
|
+
children: plansErrorMessage
|
|
8074
|
+
}), !isPlansLoading && !plansErrorMessage && banksWithPlans.length === 0 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
7982
8075
|
style: {
|
|
7983
8076
|
padding: 8,
|
|
7984
8077
|
color: '#475467',
|
|
@@ -7991,7 +8084,7 @@ function Widget({
|
|
|
7991
8084
|
flexDirection: 'column',
|
|
7992
8085
|
gap: '12px'
|
|
7993
8086
|
},
|
|
7994
|
-
children:
|
|
8087
|
+
children: banksWithPlans.map(bankItem => /*#__PURE__*/(0,jsx_runtime.jsx)(Accordion, {
|
|
7995
8088
|
header: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
7996
8089
|
style: {
|
|
7997
8090
|
display: 'flex',
|
|
@@ -7999,8 +8092,8 @@ function Widget({
|
|
|
7999
8092
|
gap: '10px'
|
|
8000
8093
|
},
|
|
8001
8094
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)("img", {
|
|
8002
|
-
src:
|
|
8003
|
-
alt:
|
|
8095
|
+
src: bankItem.logo,
|
|
8096
|
+
alt: bankItem.name,
|
|
8004
8097
|
style: {
|
|
8005
8098
|
width: '50px',
|
|
8006
8099
|
height: '50px',
|
|
@@ -8024,9 +8117,9 @@ function Widget({
|
|
|
8024
8117
|
fontWeight: '600',
|
|
8025
8118
|
color: '#101828'
|
|
8026
8119
|
},
|
|
8027
|
-
children:
|
|
8120
|
+
children: bankItem.name
|
|
8028
8121
|
}), /*#__PURE__*/(0,jsx_runtime.jsx)(Badge, {
|
|
8029
|
-
text:
|
|
8122
|
+
text: bankItem.badgeText,
|
|
8030
8123
|
color: "green",
|
|
8031
8124
|
size: "sm"
|
|
8032
8125
|
})]
|
|
@@ -8035,7 +8128,7 @@ function Widget({
|
|
|
8035
8128
|
fontSize: '14px',
|
|
8036
8129
|
color: '#667085'
|
|
8037
8130
|
},
|
|
8038
|
-
children: ["Starts from EGP ",
|
|
8131
|
+
children: ["Starts from EGP ", bankItem.startsFromAmount, " / month"]
|
|
8039
8132
|
})]
|
|
8040
8133
|
})]
|
|
8041
8134
|
}),
|
|
@@ -8049,21 +8142,21 @@ function Widget({
|
|
|
8049
8142
|
flexDirection: 'column',
|
|
8050
8143
|
gap: '12px'
|
|
8051
8144
|
},
|
|
8052
|
-
children:
|
|
8053
|
-
id: String(
|
|
8145
|
+
children: bankItem.installmentOptions.map(installmentOption => /*#__PURE__*/(0,jsx_runtime.jsx)(ItemSelector, {
|
|
8146
|
+
id: String(installmentOption.id),
|
|
8054
8147
|
type: "radio",
|
|
8055
8148
|
size: "sm",
|
|
8056
8149
|
disabled: !canSelect,
|
|
8057
|
-
selected:
|
|
8150
|
+
selected: selectedInstallmentId === installmentOption.id,
|
|
8058
8151
|
onClickHandler: () => {
|
|
8059
8152
|
if (!canSelect) return;
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
id:
|
|
8063
|
-
tenure:
|
|
8064
|
-
amount:
|
|
8153
|
+
setSelectedInstallmentId(installmentOption.id);
|
|
8154
|
+
setSelectedInstallment({
|
|
8155
|
+
id: installmentOption.id,
|
|
8156
|
+
tenure: installmentOption.months,
|
|
8157
|
+
amount: installmentOption.monthlyAmount
|
|
8065
8158
|
});
|
|
8066
|
-
|
|
8159
|
+
setSubmitError(null);
|
|
8067
8160
|
},
|
|
8068
8161
|
text: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
8069
8162
|
style: {
|
|
@@ -8072,9 +8165,9 @@ function Widget({
|
|
|
8072
8165
|
width: '100%'
|
|
8073
8166
|
},
|
|
8074
8167
|
children: [/*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
8075
|
-
children: ["EGP ",
|
|
8168
|
+
children: ["EGP ", installmentOption.monthlyAmount, " / month"]
|
|
8076
8169
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("span", {
|
|
8077
|
-
children: [
|
|
8170
|
+
children: [installmentOption.months, " Months"]
|
|
8078
8171
|
})]
|
|
8079
8172
|
}),
|
|
8080
8173
|
hintText: /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
@@ -8084,14 +8177,14 @@ function Widget({
|
|
|
8084
8177
|
gap: '10px'
|
|
8085
8178
|
},
|
|
8086
8179
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Badge, {
|
|
8087
|
-
text:
|
|
8180
|
+
text: installmentOption.badge,
|
|
8088
8181
|
color: "green",
|
|
8089
8182
|
size: "sm"
|
|
8090
8183
|
})
|
|
8091
8184
|
})
|
|
8092
|
-
},
|
|
8185
|
+
}, installmentOption.id))
|
|
8093
8186
|
})
|
|
8094
|
-
},
|
|
8187
|
+
}, bankItem.id))
|
|
8095
8188
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
8096
8189
|
style: {
|
|
8097
8190
|
display: 'flex',
|