paymob-pixel-alpha 1.1.3 → 1.1.4
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/main.css +1 -1
- package/main.js +213 -50
- package/package.json +1 -1
- package/styles.css +38 -0
package/main.css
CHANGED
|
@@ -76,7 +76,7 @@
|
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
.card_action-btn__9Y5Ha{display:flex;justify-content:center;gap:1rem}.card_gotham__a35IS{font-family:"Gotham"}.card_gotham__a35IS *{font-family:"Gotham"}
|
|
79
|
+
.card_action-btn__9Y5Ha{display:flex;justify-content:center;gap:1rem}.card_gotham__a35IS{font-family:"Gotham"}.card_gotham__a35IS *{font-family:"Gotham"}.card_iframe__cRxaZ{border:0;overflow:hidden;z-index:5;position:relative}
|
|
80
80
|
.bank-details_actions__LE0s9{display:flex;justify-content:center;margin-top:.75rem}.bank-details_row__X6sSZ{display:flex;margin-bottom:.75rem;column-gap:.75rem}.bank-details_accountNoLogo__KOR5M{position:relative;left:-10px}
|
|
81
81
|
.bank-selection_actions__fy7Ox{display:flex;justify-content:center;margin-top:1.5rem}
|
|
82
82
|
.otp_error-message__Jl9Pb{color:red;font-size:13px;margin-bottom:20px}.otp_hint__FF51s{font-size:11px;color:#b7b7b7;font-weight:bold;text-align:center;display:block;margin-bottom:20px}.otp_hint__FF51s p{margin:0 5px}.otp_otp-container__qxM9e{margin-bottom:1.25rem}.otp_resend-otp-container__RTV7D{margin-bottom:1.25rem}.otp_actions__8W-lZ{display:flex;justify-content:center}
|
package/main.js
CHANGED
|
@@ -7440,7 +7440,7 @@ function InputViewTwo_InputViewTwo(props) {
|
|
|
7440
7440
|
return /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
7441
7441
|
className: "flex flex-col w-full [&_*]:border-box relative",
|
|
7442
7442
|
children: /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
7443
|
-
className: [`flex justify-between items-center gap-2 py-2.5 px-3 w-full h-10 relative overflow-hidden border border-gray-300 ${borderStyleState === borderStyle_borderStyleConstants.RECTANGULAR ? 'rounded-none' : 'rounded-lg'} bg-white`, className].join(' '),
|
|
7443
|
+
className: [`flex justify-between items-center gap-2 py-2.5 px-3 w-full h-10 relative overflow-hidden border border-solid border-gray-300 ${borderStyleState === borderStyle_borderStyleConstants.RECTANGULAR ? 'rounded-none' : 'rounded-lg'} bg-white`, className].join(' '),
|
|
7444
7444
|
style: customStyle != null && customStyle.input ? customStyle == null ? void 0 : customStyle.input : customStyle,
|
|
7445
7445
|
children: [label && /*#__PURE__*/(0,jsx_runtime.jsx)("label", {
|
|
7446
7446
|
className: "w-5 h-5 text-sm flex justify-start items-center whitespace-nowrap text-end",
|
|
@@ -9990,10 +9990,21 @@ function Accordion(props) {
|
|
|
9990
9990
|
const {
|
|
9991
9991
|
borderStyle
|
|
9992
9992
|
} = useSelector(state => state.customization);
|
|
9993
|
+
const isSympl = type === 'sympl' || type === 'symplv2';
|
|
9993
9994
|
const sortedPaymentNames = ['card', 'e-wallet', 'installments', 'pay later', 'kiosk'];
|
|
9995
|
+
let badge = null;
|
|
9996
|
+
if (isSympl) {
|
|
9997
|
+
badge = /*#__PURE__*/_jsx("div", {
|
|
9998
|
+
className: "absolute -top-3 left-1/2 -translate-x-1/2 w-auto min-w-[8rem] h-4 flex px-2 py-[0.6rem] justify-center items-center rounded-2xl bg-gray-100 overflow-visible",
|
|
9999
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
10000
|
+
className: "text-gray-700 text-[0.65rem] font-medium leading-6 tracking-[0.01rem] whitespace-nowrap",
|
|
10001
|
+
children: "0% interest on any card"
|
|
10002
|
+
})
|
|
10003
|
+
});
|
|
10004
|
+
}
|
|
9994
10005
|
return /*#__PURE__*/_jsxs("div", {
|
|
9995
|
-
className: `border border-gray-200 ${borderStyle === borderStyleConstants.RECTANGULAR ? 'rounded-none' : 'rounded-lg'} w-full px-4`,
|
|
9996
|
-
children: [/*#__PURE__*/_jsxs("div", {
|
|
10006
|
+
className: `border border-gray-200 ${borderStyle === borderStyleConstants.RECTANGULAR ? 'rounded-none' : 'rounded-lg'} w-full px-4 relative`,
|
|
10007
|
+
children: [badge, /*#__PURE__*/_jsxs("div", {
|
|
9997
10008
|
className: "flex gap-3 items-center cursor-pointer py-4",
|
|
9998
10009
|
onClick: toggleAccordion,
|
|
9999
10010
|
children: [/*#__PURE__*/_jsx("img", {
|
|
@@ -17078,7 +17089,7 @@ function SecureCheckout(props) {
|
|
|
17078
17089
|
} = useTranslation('kitComponents');
|
|
17079
17090
|
return /*#__PURE__*/_jsxs("div", {
|
|
17080
17091
|
ref: scrollRef,
|
|
17081
|
-
className: `flex ${!isMobile ? 'border-b justify-between border-gray-200 mx-20 py-11' : 'justify-center'} ${isMobile && isDark(colors == null ? void 0 : colors.accent) ? '[&_*]:text-white' : ''}`,
|
|
17092
|
+
className: `flex ${!isMobile ? 'border-b justify-between border-gray-200 mx-20 [@media(max-height:880px)]:py-4 py-11' : 'justify-center'} ${isMobile && isDark(colors == null ? void 0 : colors.accent) ? '[&_*]:text-white' : ''}`,
|
|
17082
17093
|
style: {
|
|
17083
17094
|
background: isMobile ? colors == null ? void 0 : colors.accent : ''
|
|
17084
17095
|
},
|
|
@@ -18274,7 +18285,7 @@ function cardFormViewTwo_Card(props) {
|
|
|
18274
18285
|
id: "pay-button",
|
|
18275
18286
|
loading: loading,
|
|
18276
18287
|
fullWidth: true,
|
|
18277
|
-
disabled: !isDirty || !isValid,
|
|
18288
|
+
disabled: !isDirty || !isValid || loading,
|
|
18278
18289
|
customStyle: styling.button
|
|
18279
18290
|
})]
|
|
18280
18291
|
})]
|
|
@@ -18757,7 +18768,8 @@ function IframeCard(props) {
|
|
|
18757
18768
|
isOmanNetCard,
|
|
18758
18769
|
setIsOmanNetCard,
|
|
18759
18770
|
hasOmanNetIntegration,
|
|
18760
|
-
setHasOmanNetIntegration
|
|
18771
|
+
setHasOmanNetIntegration,
|
|
18772
|
+
handleGenerateToken
|
|
18761
18773
|
} = props;
|
|
18762
18774
|
const [iframeCardHight, setIframeCardHight] = useState();
|
|
18763
18775
|
const [iframeCustomStyles, setIframeCustomStyles] = useState({});
|
|
@@ -18770,6 +18782,9 @@ function IframeCard(props) {
|
|
|
18770
18782
|
const [cardHolderError, setCardHolderError] = useState();
|
|
18771
18783
|
const [cardHolderNameHidden, setCardHolderNameHidden] = useState(false);
|
|
18772
18784
|
const [currency, setCurrency] = useState('');
|
|
18785
|
+
const [country, setCountry] = useState('');
|
|
18786
|
+
const [publicKey, setPublicKey] = useState('');
|
|
18787
|
+
const [integrationType, setIntegrationType] = useState('directPayment');
|
|
18773
18788
|
const {
|
|
18774
18789
|
handleSubmit,
|
|
18775
18790
|
errors,
|
|
@@ -18782,7 +18797,8 @@ function IframeCard(props) {
|
|
|
18782
18797
|
cardType
|
|
18783
18798
|
} = useHookForm({
|
|
18784
18799
|
isIframe: true,
|
|
18785
|
-
hasOmanNetIntegration
|
|
18800
|
+
hasOmanNetIntegration,
|
|
18801
|
+
countryName: country
|
|
18786
18802
|
});
|
|
18787
18803
|
const timeoutIdRef = useRef();
|
|
18788
18804
|
useEffect(() => {
|
|
@@ -18803,6 +18819,8 @@ function IframeCard(props) {
|
|
|
18803
18819
|
handleCardStylesFromSDK(event.data.payload);
|
|
18804
18820
|
} else if (event.data.type === 'cardHolderError') {
|
|
18805
18821
|
handleCardHolderErrorFromSDK(event.data.payload);
|
|
18822
|
+
} else if (event.data.type === 'tokenizeCard') {
|
|
18823
|
+
handleTokenizeCardDataFromSDK(event.data.payload);
|
|
18806
18824
|
}
|
|
18807
18825
|
};
|
|
18808
18826
|
const handleCardHolderErrorFromSDK = payload => {
|
|
@@ -18838,6 +18856,21 @@ function IframeCard(props) {
|
|
|
18838
18856
|
if (payload.currency) {
|
|
18839
18857
|
setCurrency(payload.currency);
|
|
18840
18858
|
}
|
|
18859
|
+
if (payload.country) {
|
|
18860
|
+
setCountry(payload.country);
|
|
18861
|
+
}
|
|
18862
|
+
};
|
|
18863
|
+
const handleTokenizeCardDataFromSDK = payload => {
|
|
18864
|
+
setIntegrationType('tokenization');
|
|
18865
|
+
if (payload.publicKey) {
|
|
18866
|
+
setPublicKey(payload.publicKey);
|
|
18867
|
+
}
|
|
18868
|
+
if (payload.cardHolderName) {
|
|
18869
|
+
setCardHolderName(payload.cardHolderName);
|
|
18870
|
+
}
|
|
18871
|
+
if (payload.shouldSubmitData) {
|
|
18872
|
+
setShouldSubmitData(payload.shouldSubmitData);
|
|
18873
|
+
}
|
|
18841
18874
|
};
|
|
18842
18875
|
const handleCardStylesFromSDK = payload => {
|
|
18843
18876
|
var _payload$options;
|
|
@@ -18872,14 +18905,22 @@ function IframeCard(props) {
|
|
|
18872
18905
|
if (shouldSubmitData) {
|
|
18873
18906
|
if (isValid && isDirty) {
|
|
18874
18907
|
const data = getValues();
|
|
18875
|
-
|
|
18876
|
-
|
|
18877
|
-
|
|
18878
|
-
|
|
18879
|
-
|
|
18880
|
-
|
|
18881
|
-
|
|
18882
|
-
|
|
18908
|
+
if (integrationType === 'tokenization') {
|
|
18909
|
+
handleGenerateToken({
|
|
18910
|
+
data,
|
|
18911
|
+
cardHolderName,
|
|
18912
|
+
publicKey
|
|
18913
|
+
});
|
|
18914
|
+
} else {
|
|
18915
|
+
handleCardSubmit({
|
|
18916
|
+
data,
|
|
18917
|
+
cardHolderName,
|
|
18918
|
+
paymentToken: hasOmanNetIntegration && isOmanNetCard ? subType.paymentToken : paymentToken,
|
|
18919
|
+
subType: hasOmanNetIntegration && isOmanNetCard ? subType.type : 'CARD',
|
|
18920
|
+
saveCard,
|
|
18921
|
+
tenure
|
|
18922
|
+
});
|
|
18923
|
+
}
|
|
18883
18924
|
setShouldSubmitData(false);
|
|
18884
18925
|
}
|
|
18885
18926
|
}
|
|
@@ -19832,7 +19873,7 @@ const environment = {
|
|
|
19832
19873
|
};
|
|
19833
19874
|
;// CONCATENATED MODULE: ./src/components/Payments/Card/card.module.scss
|
|
19834
19875
|
// extracted by mini-css-extract-plugin
|
|
19835
|
-
/* harmony default export */ const card_module = ({"action-btn":"card_action-btn__9Y5Ha","gotham":"card_gotham__a35IS"});
|
|
19876
|
+
/* harmony default export */ const card_module = ({"action-btn":"card_action-btn__9Y5Ha","gotham":"card_gotham__a35IS","iframe":"card_iframe__cRxaZ"});
|
|
19836
19877
|
;// CONCATENATED MODULE: ./src/services/cardService.ts
|
|
19837
19878
|
|
|
19838
19879
|
const payWithSavedCard = payload => {
|
|
@@ -19887,6 +19928,11 @@ const getErrorMsg = err => {
|
|
|
19887
19928
|
}
|
|
19888
19929
|
return DECLINED_MESSAGE;
|
|
19889
19930
|
};
|
|
19931
|
+
;// CONCATENATED MODULE: ./src/constants/index.ts
|
|
19932
|
+
const INTEGRATION_TYPE = {
|
|
19933
|
+
DIRECT_PAYMENT: 'directPayment',
|
|
19934
|
+
TOKENIZATION: 'tokenization'
|
|
19935
|
+
};
|
|
19890
19936
|
;// CONCATENATED MODULE: ./src/components/Payments/Card/index.tsx
|
|
19891
19937
|
|
|
19892
19938
|
|
|
@@ -19899,7 +19945,8 @@ const getErrorMsg = err => {
|
|
|
19899
19945
|
|
|
19900
19946
|
|
|
19901
19947
|
|
|
19902
|
-
|
|
19948
|
+
|
|
19949
|
+
const CardElement = /*#__PURE__*/(0,react.forwardRef)(({
|
|
19903
19950
|
payment,
|
|
19904
19951
|
customStyle,
|
|
19905
19952
|
tenure,
|
|
@@ -19914,8 +19961,11 @@ function CardElement({
|
|
|
19914
19961
|
onCardValidationChanged,
|
|
19915
19962
|
showPaymobLogo,
|
|
19916
19963
|
hideCardHolderName,
|
|
19917
|
-
isLoading
|
|
19918
|
-
|
|
19964
|
+
isLoading,
|
|
19965
|
+
country,
|
|
19966
|
+
integrationType,
|
|
19967
|
+
publicKey
|
|
19968
|
+
}, ref) => {
|
|
19919
19969
|
var _customStyle$containe, _customStyle$containe2, _customStyle$button, _customStyle$containe3;
|
|
19920
19970
|
const {
|
|
19921
19971
|
token,
|
|
@@ -19933,7 +19983,7 @@ function CardElement({
|
|
|
19933
19983
|
const [isActionBtnDisabled, setIsActionBtnDisabled] = (0,react.useState)(false);
|
|
19934
19984
|
const [shouldSubmitData, setShouldSubmitData] = (0,react.useState)(false);
|
|
19935
19985
|
const [saveCard, setSaveCard] = (0,react.useState)(false);
|
|
19936
|
-
const [height, setHeight] = (0,react.useState)(80
|
|
19986
|
+
const [height, setHeight] = (0,react.useState)(80);
|
|
19937
19987
|
const [errorMessage, setErrorMessage] = (0,react.useState)('');
|
|
19938
19988
|
const iframeRef = (0,react.useRef)(null);
|
|
19939
19989
|
const [errors, setErrors] = (0,react.useState)({});
|
|
@@ -19950,6 +20000,7 @@ function CardElement({
|
|
|
19950
20000
|
const [sendOTPLoading, setSendOTPLoading] = (0,react.useState)(false);
|
|
19951
20001
|
const [paymentId, setPaymentId] = (0,react.useState)('');
|
|
19952
20002
|
const [otpErrorMessage, setOTPErrorMessage] = (0,react.useState)('');
|
|
20003
|
+
const tokenizationResolve = (0,react.useRef)(null);
|
|
19953
20004
|
const isCardValid = hideCardHolderName ? !isActionBtnDisabled : !(isActionBtnDisabled || !cardHolderName);
|
|
19954
20005
|
const isAmexCardSelected = (selectedCard == null ? void 0 : selectedCard.type) === constants_CARD_TYPES.AMEX;
|
|
19955
20006
|
const selectedCardCvvLength = selectedCardCVV.length;
|
|
@@ -19958,7 +20009,7 @@ function CardElement({
|
|
|
19958
20009
|
const shouldDisablePayBtn = showCvvInput ? loading || (isAmexCardSelected ? selectedCardCvvLength !== constants_AMEX_CVV_LENGTH : selectedCardCvvLength !== constants_CVV_LENGTH) : !selectedCardId;
|
|
19959
20010
|
(0,react.useEffect)(() => {
|
|
19960
20011
|
const handleDataFromIframe = event => {
|
|
19961
|
-
var _event$data, _event$data2;
|
|
20012
|
+
var _event$data, _event$data2, _event$data3;
|
|
19962
20013
|
if (!event.data) return;
|
|
19963
20014
|
if (!event.data.type) return;
|
|
19964
20015
|
if (event.data.shouldFocusOnCardName) {
|
|
@@ -19968,7 +20019,7 @@ function CardElement({
|
|
|
19968
20019
|
}
|
|
19969
20020
|
}
|
|
19970
20021
|
if (event.data.iframeCardHight) {
|
|
19971
|
-
setHeight(event.data.iframeCardHight
|
|
20022
|
+
setHeight(event.data.iframeCardHight);
|
|
19972
20023
|
}
|
|
19973
20024
|
if (event.data.selectedCardCVV) {
|
|
19974
20025
|
setSelectedCardCVV(event.data.selectedCardCVV);
|
|
@@ -19991,6 +20042,10 @@ function CardElement({
|
|
|
19991
20042
|
if ((event == null || (_event$data2 = event.data) == null ? void 0 : _event$data2.type) === 'openCVVToolTipModal') {
|
|
19992
20043
|
setShowCVVTooltipModal(true);
|
|
19993
20044
|
}
|
|
20045
|
+
if ((event == null || (_event$data3 = event.data) == null ? void 0 : _event$data3.type) === 'tokenizationResponse' && tokenizationResolve.current) {
|
|
20046
|
+
tokenizationResolve.current(event.data.response.res);
|
|
20047
|
+
tokenizationResolve.current = null;
|
|
20048
|
+
}
|
|
19994
20049
|
};
|
|
19995
20050
|
const handlePaymentResponse = ({
|
|
19996
20051
|
res,
|
|
@@ -20100,6 +20155,7 @@ function CardElement({
|
|
|
20100
20155
|
}
|
|
20101
20156
|
}, [isIframeLoaded, payment]);
|
|
20102
20157
|
(0,react.useEffect)(() => {
|
|
20158
|
+
let resizeObserver = null;
|
|
20103
20159
|
if (isIframeLoaded) {
|
|
20104
20160
|
var _iframe$contentWindow;
|
|
20105
20161
|
(_iframe$contentWindow = iframe.contentWindow) == null || _iframe$contentWindow.postMessage({
|
|
@@ -20111,7 +20167,21 @@ function CardElement({
|
|
|
20111
20167
|
}
|
|
20112
20168
|
}
|
|
20113
20169
|
}, '*');
|
|
20170
|
+
const nextElement = iframe.nextElementSibling;
|
|
20171
|
+
resizeObserver = new ResizeObserver(entries => {
|
|
20172
|
+
for (let entry of entries) {
|
|
20173
|
+
const width = Math.floor(entry.contentRect.width - 0.5);
|
|
20174
|
+
if (nextElement) {
|
|
20175
|
+
nextElement.style.width = `${width}px`;
|
|
20176
|
+
}
|
|
20177
|
+
}
|
|
20178
|
+
});
|
|
20179
|
+
resizeObserver.observe(iframe);
|
|
20114
20180
|
}
|
|
20181
|
+
return () => {
|
|
20182
|
+
var _resizeObserver;
|
|
20183
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.disconnect();
|
|
20184
|
+
};
|
|
20115
20185
|
}, [isIframeLoaded, iframeRef.current]);
|
|
20116
20186
|
(0,react.useEffect)(() => {
|
|
20117
20187
|
var _iframe$contentWindow2;
|
|
@@ -20133,21 +20203,43 @@ function CardElement({
|
|
|
20133
20203
|
previousValidationRef.current = isCardValid;
|
|
20134
20204
|
}
|
|
20135
20205
|
}, [isCardValid, shouldDisablePayBtn]);
|
|
20206
|
+
(0,react.useImperativeHandle)(ref, () => ({
|
|
20207
|
+
handleGenerateToken
|
|
20208
|
+
}));
|
|
20209
|
+
async function handleGenerateToken() {
|
|
20210
|
+
return new Promise((resolve, reject) => {
|
|
20211
|
+
var _iframe$contentWindow3;
|
|
20212
|
+
if (loading || !isCardValid || isLoading) {
|
|
20213
|
+
return reject();
|
|
20214
|
+
}
|
|
20215
|
+
tokenizationResolve.current = resolve;
|
|
20216
|
+
(_iframe$contentWindow3 = iframe.contentWindow) == null || _iframe$contentWindow3.postMessage({
|
|
20217
|
+
type: 'tokenizeCard',
|
|
20218
|
+
payload: {
|
|
20219
|
+
publicKey,
|
|
20220
|
+
cardHolderName,
|
|
20221
|
+
shouldSubmitData: true
|
|
20222
|
+
}
|
|
20223
|
+
}, '*');
|
|
20224
|
+
});
|
|
20225
|
+
}
|
|
20226
|
+
;
|
|
20136
20227
|
const sendCardData = shouldSubmitData => {
|
|
20137
|
-
var _iframe$
|
|
20138
|
-
(_iframe$
|
|
20228
|
+
var _iframe$contentWindow4, _payment$subType, _payment$subType2;
|
|
20229
|
+
(_iframe$contentWindow4 = iframe.contentWindow) == null || _iframe$contentWindow4.postMessage({
|
|
20139
20230
|
type: 'cardData',
|
|
20140
20231
|
payload: {
|
|
20141
|
-
paymentToken: payment.token,
|
|
20232
|
+
paymentToken: payment == null ? void 0 : payment.token,
|
|
20142
20233
|
subType: {
|
|
20143
|
-
paymentToken: (_payment$subType = payment.subType) == null ? void 0 : _payment$subType.token,
|
|
20144
|
-
type: (_payment$subType2 = payment.subType) == null ? void 0 : _payment$subType2.type
|
|
20234
|
+
paymentToken: payment == null || (_payment$subType = payment.subType) == null ? void 0 : _payment$subType.token,
|
|
20235
|
+
type: payment == null || (_payment$subType2 = payment.subType) == null ? void 0 : _payment$subType2.type
|
|
20145
20236
|
},
|
|
20146
20237
|
currency,
|
|
20147
20238
|
cardHolderName,
|
|
20148
20239
|
saveCard: forceSaveCard || saveCard,
|
|
20149
20240
|
tenure,
|
|
20150
|
-
shouldSubmitData: shouldSubmitData
|
|
20241
|
+
shouldSubmitData: shouldSubmitData,
|
|
20242
|
+
country
|
|
20151
20243
|
}
|
|
20152
20244
|
}, '*');
|
|
20153
20245
|
};
|
|
@@ -20155,8 +20247,8 @@ function CardElement({
|
|
|
20155
20247
|
setShouldSubmitData(true);
|
|
20156
20248
|
};
|
|
20157
20249
|
const handleFocusToPrevInput = () => {
|
|
20158
|
-
var _iframe$
|
|
20159
|
-
(_iframe$
|
|
20250
|
+
var _iframe$contentWindow5;
|
|
20251
|
+
(_iframe$contentWindow5 = iframe.contentWindow) == null || _iframe$contentWindow5.postMessage({
|
|
20160
20252
|
type: 'setPrevFocus',
|
|
20161
20253
|
payload: {
|
|
20162
20254
|
shouldFocusOnCVV: true
|
|
@@ -20241,9 +20333,9 @@ function CardElement({
|
|
|
20241
20333
|
}
|
|
20242
20334
|
};
|
|
20243
20335
|
const handleOTPSubmit = async otp => {
|
|
20244
|
-
var _iframe$
|
|
20336
|
+
var _iframe$contentWindow6, _payment$subType3;
|
|
20245
20337
|
setSendOTPLoading(true);
|
|
20246
|
-
(_iframe$
|
|
20338
|
+
(_iframe$contentWindow6 = iframe.contentWindow) == null || _iframe$contentWindow6.postMessage({
|
|
20247
20339
|
type: 'otpData',
|
|
20248
20340
|
payload: {
|
|
20249
20341
|
paymentToken: payment.token,
|
|
@@ -20350,7 +20442,7 @@ function CardElement({
|
|
|
20350
20442
|
})]
|
|
20351
20443
|
}), /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
20352
20444
|
className: "[&>div:nth-child(even)]:w-[calc(100%-1px)]",
|
|
20353
|
-
children: [(!isIframeLoaded || !payment.token) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
20445
|
+
children: [(!isIframeLoaded || !(payment.token || integrationType === INTEGRATION_TYPE.TOKENIZATION)) && /*#__PURE__*/(0,jsx_runtime.jsxs)("div", {
|
|
20354
20446
|
className: "-mt-1",
|
|
20355
20447
|
children: [/*#__PURE__*/(0,jsx_runtime.jsx)(dist_Skeleton, {
|
|
20356
20448
|
height: 37
|
|
@@ -20371,10 +20463,9 @@ function CardElement({
|
|
|
20371
20463
|
src: `${baseUrl}/${environment['IFRAME_PATH']}/?type=card&v=2`
|
|
20372
20464
|
// src={`http://localhost:9001/${environment['IFRAME_PATH']}/?type=card&v=2`}
|
|
20373
20465
|
,
|
|
20466
|
+
className: card_module['iframe'],
|
|
20374
20467
|
style: {
|
|
20375
|
-
|
|
20376
|
-
overflow: 'hidden',
|
|
20377
|
-
display: isIframeLoaded && payment.token ? 'block' : 'none'
|
|
20468
|
+
display: isIframeLoaded && (payment.token || integrationType === INTEGRATION_TYPE.TOKENIZATION) ? 'block' : 'none'
|
|
20378
20469
|
},
|
|
20379
20470
|
frameBorder: "0",
|
|
20380
20471
|
scrolling: "no",
|
|
@@ -20385,7 +20476,7 @@ function CardElement({
|
|
|
20385
20476
|
setIsIframeLoaded(true);
|
|
20386
20477
|
}, 200);
|
|
20387
20478
|
}
|
|
20388
|
-
}), isIframeLoaded && payment.token && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
20479
|
+
}), isIframeLoaded && (payment.token || integrationType === INTEGRATION_TYPE.TOKENIZATION) && /*#__PURE__*/(0,jsx_runtime.jsxs)(jsx_runtime.Fragment, {
|
|
20389
20480
|
children: [!hideCardHolderName && /*#__PURE__*/(0,jsx_runtime.jsx)(components_CardHolder_CardHolder, {
|
|
20390
20481
|
onChange: handleCardHolderChange,
|
|
20391
20482
|
focusToPrevInput: handleFocusToPrevInput,
|
|
@@ -20419,7 +20510,7 @@ function CardElement({
|
|
|
20419
20510
|
onChange: e => setSaveCard(e.target.checked),
|
|
20420
20511
|
customStyle: customStyle == null ? void 0 : customStyle.label
|
|
20421
20512
|
})
|
|
20422
|
-
}), !disablePay && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
20513
|
+
}), !disablePay && integrationType === INTEGRATION_TYPE.DIRECT_PAYMENT && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
20423
20514
|
className: card_module['action-btn'],
|
|
20424
20515
|
children: /*#__PURE__*/(0,jsx_runtime.jsx)(Button_Button, {
|
|
20425
20516
|
id: 'pay-button',
|
|
@@ -20429,7 +20520,7 @@ function CardElement({
|
|
|
20429
20520
|
onClick: () => setShouldSubmitData(true),
|
|
20430
20521
|
customStyle: customStyle == null ? void 0 : customStyle.button
|
|
20431
20522
|
})
|
|
20432
|
-
}), showPaymobLogo && /*#__PURE__*/(0,jsx_runtime.jsx)(CopyrightsViewTwo_Copyrights, {
|
|
20523
|
+
}), showPaymobLogo && integrationType === INTEGRATION_TYPE.DIRECT_PAYMENT && /*#__PURE__*/(0,jsx_runtime.jsx)(CopyrightsViewTwo_Copyrights, {
|
|
20433
20524
|
isElements: true
|
|
20434
20525
|
})]
|
|
20435
20526
|
})]
|
|
@@ -20478,7 +20569,7 @@ function CardElement({
|
|
|
20478
20569
|
})]
|
|
20479
20570
|
})]
|
|
20480
20571
|
});
|
|
20481
|
-
}
|
|
20572
|
+
});
|
|
20482
20573
|
/* harmony default export */ const Payments_Card = (CardElement);
|
|
20483
20574
|
;// CONCATENATED MODULE: ../../libs/form-validation/src/lib/form-validation.ts
|
|
20484
20575
|
|
|
@@ -26957,7 +27048,8 @@ function ApplePay(props) {
|
|
|
26957
27048
|
checkDiscount,
|
|
26958
27049
|
isPixel,
|
|
26959
27050
|
isLoading,
|
|
26960
|
-
paymentName
|
|
27051
|
+
paymentName,
|
|
27052
|
+
country
|
|
26961
27053
|
} = props;
|
|
26962
27054
|
const [loading, setLoading] = (0,react.useState)(false);
|
|
26963
27055
|
const [discount, setDiscount] = (0,react.useState)({
|
|
@@ -26997,7 +27089,7 @@ function ApplePay(props) {
|
|
|
26997
27089
|
amount: discount.hasDiscount ? discount.discountAmount : amount
|
|
26998
27090
|
}
|
|
26999
27091
|
};
|
|
27000
|
-
if (
|
|
27092
|
+
if (country === 'EGYPT') {
|
|
27001
27093
|
payload.supportedNetworks.push('meeza');
|
|
27002
27094
|
}
|
|
27003
27095
|
if (clientInfo === null) {
|
|
@@ -27431,7 +27523,8 @@ function ApplePayElements({
|
|
|
27431
27523
|
onBeforePaymentComplete,
|
|
27432
27524
|
onAfterPaymentComplete,
|
|
27433
27525
|
onPaymentCancel,
|
|
27434
|
-
isLoading
|
|
27526
|
+
isLoading,
|
|
27527
|
+
country
|
|
27435
27528
|
}) {
|
|
27436
27529
|
var _amount$toString;
|
|
27437
27530
|
const {
|
|
@@ -27444,6 +27537,7 @@ function ApplePayElements({
|
|
|
27444
27537
|
window.location.href = resData.redirection_url;
|
|
27445
27538
|
};
|
|
27446
27539
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(ApplePay, {
|
|
27540
|
+
country: country,
|
|
27447
27541
|
countryCode: currency == null ? void 0 : currency.slice(0, 2),
|
|
27448
27542
|
currency: currency,
|
|
27449
27543
|
amount: (_amount$toString = amount.toString()) == null ? void 0 : _amount$toString.replace(/,/g, ''),
|
|
@@ -27530,6 +27624,35 @@ async function fetchPayments(publicKey, clientSecret, paymentMethods) {
|
|
|
27530
27624
|
savedCards: formattedSavedCards
|
|
27531
27625
|
};
|
|
27532
27626
|
}
|
|
27627
|
+
;// CONCATENATED MODULE: ./src/constants/countries.ts
|
|
27628
|
+
const COUNTRIES = {
|
|
27629
|
+
EGYPT: 'EGYPT',
|
|
27630
|
+
UAE: 'UAE',
|
|
27631
|
+
PAKISTAN: 'PAKISTAN',
|
|
27632
|
+
OMAN: 'OMAN',
|
|
27633
|
+
SAUDI_ARABIA: 'SAUDI_ARABIA'
|
|
27634
|
+
};
|
|
27635
|
+
const COUNTRY_TO_CODE = {
|
|
27636
|
+
[COUNTRIES.EGYPT]: 'egy',
|
|
27637
|
+
[COUNTRIES.UAE]: 'are',
|
|
27638
|
+
[COUNTRIES.PAKISTAN]: 'pak',
|
|
27639
|
+
[COUNTRIES.OMAN]: 'omn',
|
|
27640
|
+
[COUNTRIES.SAUDI_ARABIA]: 'sau'
|
|
27641
|
+
};
|
|
27642
|
+
const CODE_TO_COUNTRY = Object.fromEntries(Object.entries(COUNTRY_TO_CODE).map(([country, code]) => [code, country]));
|
|
27643
|
+
;// CONCATENATED MODULE: ./src/utils/getCountry.ts
|
|
27644
|
+
|
|
27645
|
+
function getCountryCodeByKeys(publicKey, clientSecret) {
|
|
27646
|
+
let countryCode = publicKey.split('_')[0] || '';
|
|
27647
|
+
if (!['egy', 'are', 'pak', 'omn', 'sau'].includes(countryCode)) {
|
|
27648
|
+
countryCode = clientSecret.split('_')[0] || '';
|
|
27649
|
+
}
|
|
27650
|
+
return countryCode;
|
|
27651
|
+
}
|
|
27652
|
+
function getCountryByKeys(publicKey, clientSecret) {
|
|
27653
|
+
const countryCode = getCountryCodeByKeys(publicKey, clientSecret);
|
|
27654
|
+
return CODE_TO_COUNTRY[countryCode];
|
|
27655
|
+
}
|
|
27533
27656
|
;// CONCATENATED MODULE: ./src/components/Payments/List/index.tsx
|
|
27534
27657
|
|
|
27535
27658
|
|
|
@@ -27542,6 +27665,7 @@ async function fetchPayments(publicKey, clientSecret, paymentMethods) {
|
|
|
27542
27665
|
|
|
27543
27666
|
|
|
27544
27667
|
|
|
27668
|
+
|
|
27545
27669
|
const PaymentsList = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
27546
27670
|
var _customStyle$containe;
|
|
27547
27671
|
const {
|
|
@@ -27560,7 +27684,8 @@ const PaymentsList = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
27560
27684
|
hideCardHolderName,
|
|
27561
27685
|
publicKey,
|
|
27562
27686
|
clientSecret,
|
|
27563
|
-
selectedPaymentMethods
|
|
27687
|
+
selectedPaymentMethods,
|
|
27688
|
+
integrationType
|
|
27564
27689
|
} = props;
|
|
27565
27690
|
const {
|
|
27566
27691
|
t
|
|
@@ -27571,6 +27696,7 @@ const PaymentsList = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
27571
27696
|
const [savedCardsList, setSavedCardsList] = (0,react.useState)(savedCards);
|
|
27572
27697
|
const [errorMessage, setErrorMessage] = (0,react.useState)('');
|
|
27573
27698
|
const [isLoading, setIsLoading] = (0,react.useState)(false);
|
|
27699
|
+
const country = getCountryByKeys(publicKey, clientSecret);
|
|
27574
27700
|
(0,react.useImperativeHandle)(ref, () => ({
|
|
27575
27701
|
getData: async () => {
|
|
27576
27702
|
setIsLoading(true);
|
|
@@ -27638,7 +27764,8 @@ const PaymentsList = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
27638
27764
|
onAfterPaymentComplete: onAfterPaymentComplete,
|
|
27639
27765
|
onPaymentCancel: onPaymentCancel,
|
|
27640
27766
|
customStyle: customStyle == null ? void 0 : customStyle.button,
|
|
27641
|
-
isLoading: isLoading
|
|
27767
|
+
isLoading: isLoading,
|
|
27768
|
+
country: country
|
|
27642
27769
|
}), isGooglePay() && /*#__PURE__*/(0,jsx_runtime.jsx)(GooglePayElement, {
|
|
27643
27770
|
payment: googlePaymentMethod,
|
|
27644
27771
|
customStyle: customStyle == null ? void 0 : customStyle.button,
|
|
@@ -27684,6 +27811,10 @@ const PaymentsList = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
27684
27811
|
showPaymobLogo,
|
|
27685
27812
|
hideCardHolderName,
|
|
27686
27813
|
isLoading,
|
|
27814
|
+
country,
|
|
27815
|
+
integrationType,
|
|
27816
|
+
publicKey,
|
|
27817
|
+
ref,
|
|
27687
27818
|
isList: true
|
|
27688
27819
|
})
|
|
27689
27820
|
})]
|
|
@@ -27795,7 +27926,9 @@ function getStyles(customStyle) {
|
|
|
27795
27926
|
container: Object.assign({}, colorContainer, fontFamily, verticalSpacingBetweenComponents, containerPadding, widthOfContainer),
|
|
27796
27927
|
tabs: Object.assign({}, fontFamily, radiusBorder),
|
|
27797
27928
|
label: Object.assign({}, fontFamily, fontWeightLabel, fontSizeLabel, textColorForLabel),
|
|
27798
|
-
input: Object.assign({}, fontFamily, fontWeightInputFields, fontSizeInputFields, colorBorderInputFields, radiusBorder, colorInputFields, textColorForInput, verticalPadding
|
|
27929
|
+
input: Object.assign({}, fontFamily, fontWeightInputFields, fontSizeInputFields, colorBorderInputFields, radiusBorder, colorInputFields, textColorForInput, verticalPadding, {
|
|
27930
|
+
borderStyle: 'solid'
|
|
27931
|
+
}),
|
|
27799
27932
|
button: Object.assign({}, fontFamily, fontWeightPaymentButton, fontSizePaymentButton, colorBorderPaymentButton, radiusBorder, colorPrimaryPaymentButton, textColorForPaymentButton, verticalPaddingButton, {
|
|
27800
27933
|
disabled: Object.assign({}, colorDisabled)
|
|
27801
27934
|
}),
|
|
@@ -27841,7 +27974,8 @@ const Payments_Payments = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
27841
27974
|
hideCardHolderName,
|
|
27842
27975
|
publicKey,
|
|
27843
27976
|
clientSecret,
|
|
27844
|
-
selectedPaymentMethods
|
|
27977
|
+
selectedPaymentMethods,
|
|
27978
|
+
integrationType
|
|
27845
27979
|
} = props;
|
|
27846
27980
|
const [paymentMethod, setPaymentMethod] = (0,react.useState)(payment);
|
|
27847
27981
|
const styles = getStyles(customStyle);
|
|
@@ -27862,7 +27996,10 @@ const Payments_Payments = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
27862
27996
|
onAfterPaymentComplete,
|
|
27863
27997
|
onCardValidationChanged,
|
|
27864
27998
|
showPaymobLogo,
|
|
27865
|
-
hideCardHolderName
|
|
27999
|
+
hideCardHolderName,
|
|
28000
|
+
integrationType,
|
|
28001
|
+
publicKey,
|
|
28002
|
+
ref
|
|
27866
28003
|
});
|
|
27867
28004
|
case 'CARD-INSTALLMENT':
|
|
27868
28005
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(BankInstalment, {
|
|
@@ -27960,7 +28097,8 @@ const Payments_Payments = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
27960
28097
|
publicKey: publicKey,
|
|
27961
28098
|
clientSecret: clientSecret,
|
|
27962
28099
|
selectedPaymentMethods: selectedPaymentMethods,
|
|
27963
|
-
ref: ref
|
|
28100
|
+
ref: ref,
|
|
28101
|
+
integrationType: integrationType
|
|
27964
28102
|
});
|
|
27965
28103
|
};
|
|
27966
28104
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
@@ -31535,19 +31673,35 @@ class Pixel {
|
|
|
31535
31673
|
this._root = null;
|
|
31536
31674
|
this._error = null;
|
|
31537
31675
|
this._paymentsRef = null;
|
|
31676
|
+
this._integrationType = void 0;
|
|
31538
31677
|
this._options = Object.assign({}, options, {
|
|
31539
31678
|
showPaymobLogo: (_options$showPaymobLo = options.showPaymobLogo) != null ? _options$showPaymobLo : true
|
|
31540
31679
|
});
|
|
31541
31680
|
this._baseURL = this.updateAPIBaseURL();
|
|
31542
31681
|
this._paymentsRef = /*#__PURE__*/react.createRef();
|
|
31543
31682
|
Pixel._instance = this;
|
|
31544
|
-
this.
|
|
31683
|
+
if (this._options['clientSecret'] && this._options['paymentMethods']) {
|
|
31684
|
+
this._integrationType = 'directPayment';
|
|
31685
|
+
this.getData();
|
|
31686
|
+
} else {
|
|
31687
|
+
this._integrationType = 'tokenization';
|
|
31688
|
+
this.renderCard();
|
|
31689
|
+
}
|
|
31545
31690
|
}
|
|
31546
31691
|
updateAPIBaseURL() {
|
|
31547
31692
|
const baseURL = getAPIURLByKeys(this._options['publicKey'], this._options['clientSecret']);
|
|
31548
31693
|
lib_axios.defaults.baseURL = baseURL;
|
|
31549
31694
|
return baseURL;
|
|
31550
31695
|
}
|
|
31696
|
+
renderCard() {
|
|
31697
|
+
this._paymentList = [{
|
|
31698
|
+
name: 'card',
|
|
31699
|
+
type: 'card',
|
|
31700
|
+
amount: '',
|
|
31701
|
+
currency: ''
|
|
31702
|
+
}];
|
|
31703
|
+
this.render();
|
|
31704
|
+
}
|
|
31551
31705
|
async getData() {
|
|
31552
31706
|
const publicKey = this._options['publicKey'];
|
|
31553
31707
|
const clientSecret = this._options['clientSecret'];
|
|
@@ -31611,6 +31765,13 @@ class Pixel {
|
|
|
31611
31765
|
}
|
|
31612
31766
|
return await Pixel._instance._paymentsRef.current.getData();
|
|
31613
31767
|
}
|
|
31768
|
+
static async submit() {
|
|
31769
|
+
var _Pixel$_instance2;
|
|
31770
|
+
if (!((_Pixel$_instance2 = Pixel._instance) != null && (_Pixel$_instance2 = _Pixel$_instance2._paymentsRef) != null && (_Pixel$_instance2 = _Pixel$_instance2.current) != null && _Pixel$_instance2.handleGenerateToken)) {
|
|
31771
|
+
throw new Error('Pixel not initialized');
|
|
31772
|
+
}
|
|
31773
|
+
return await Pixel._instance._paymentsRef.current.handleGenerateToken();
|
|
31774
|
+
}
|
|
31614
31775
|
render() {
|
|
31615
31776
|
const container = document.getElementById(this._options['elementId']);
|
|
31616
31777
|
if (!container) {
|
|
@@ -31650,6 +31811,8 @@ class Pixel {
|
|
|
31650
31811
|
onPaymentCancel: this.handleOnPaymentCancel.bind(this)
|
|
31651
31812
|
}, this._options.cardValidationChanged && {
|
|
31652
31813
|
onCardValidationChanged: this.handleCardValidationChanged.bind(this)
|
|
31814
|
+
}, {
|
|
31815
|
+
integrationType: this._integrationType
|
|
31653
31816
|
}), Date.now())
|
|
31654
31817
|
}));
|
|
31655
31818
|
}
|
package/package.json
CHANGED
package/styles.css
CHANGED
|
@@ -636,6 +636,14 @@ video {
|
|
|
636
636
|
bottom: -1rem;
|
|
637
637
|
}
|
|
638
638
|
|
|
639
|
+
.-top-3 {
|
|
640
|
+
top: -0.75rem;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
.left-1\/2 {
|
|
644
|
+
left: 50%;
|
|
645
|
+
}
|
|
646
|
+
|
|
639
647
|
.left-\[-16px\] {
|
|
640
648
|
left: -16px;
|
|
641
649
|
}
|
|
@@ -1176,6 +1184,10 @@ video {
|
|
|
1176
1184
|
width: 100%;
|
|
1177
1185
|
}
|
|
1178
1186
|
|
|
1187
|
+
.min-w-\[8rem\] {
|
|
1188
|
+
min-width: 8rem;
|
|
1189
|
+
}
|
|
1190
|
+
|
|
1179
1191
|
.max-w-\[400px\] {
|
|
1180
1192
|
max-width: 400px;
|
|
1181
1193
|
}
|
|
@@ -1208,6 +1220,11 @@ video {
|
|
|
1208
1220
|
flex-grow: 1;
|
|
1209
1221
|
}
|
|
1210
1222
|
|
|
1223
|
+
.-translate-x-1\/2 {
|
|
1224
|
+
--tw-translate-x: -50%;
|
|
1225
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1226
|
+
}
|
|
1227
|
+
|
|
1211
1228
|
.-translate-y-1\/2 {
|
|
1212
1229
|
--tw-translate-y: -50%;
|
|
1213
1230
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -1410,6 +1427,10 @@ video {
|
|
|
1410
1427
|
overflow: hidden;
|
|
1411
1428
|
}
|
|
1412
1429
|
|
|
1430
|
+
.overflow-visible {
|
|
1431
|
+
overflow: visible;
|
|
1432
|
+
}
|
|
1433
|
+
|
|
1413
1434
|
.overflow-scroll {
|
|
1414
1435
|
overflow: scroll;
|
|
1415
1436
|
}
|
|
@@ -2002,6 +2023,11 @@ video {
|
|
|
2002
2023
|
padding-bottom: 0.625rem;
|
|
2003
2024
|
}
|
|
2004
2025
|
|
|
2026
|
+
.py-\[0\.6rem\] {
|
|
2027
|
+
padding-top: 0.6rem;
|
|
2028
|
+
padding-bottom: 0.6rem;
|
|
2029
|
+
}
|
|
2030
|
+
|
|
2005
2031
|
.py-\[10px\] {
|
|
2006
2032
|
padding-top: 10px;
|
|
2007
2033
|
padding-bottom: 10px;
|
|
@@ -2089,6 +2115,10 @@ video {
|
|
|
2089
2115
|
line-height: 2.25rem;
|
|
2090
2116
|
}
|
|
2091
2117
|
|
|
2118
|
+
.text-\[0\.65rem\] {
|
|
2119
|
+
font-size: 0.65rem;
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2092
2122
|
.text-\[2rem\] {
|
|
2093
2123
|
font-size: 2rem;
|
|
2094
2124
|
}
|
|
@@ -2982,3 +3012,11 @@ video {
|
|
|
2982
3012
|
.\[\&_input\]\:pl-6 input {
|
|
2983
3013
|
padding-left: 1.5rem;
|
|
2984
3014
|
}
|
|
3015
|
+
|
|
3016
|
+
@media(max-height:880px) {
|
|
3017
|
+
|
|
3018
|
+
.\[\@media\(max-height\:880px\)\]\:py-4 {
|
|
3019
|
+
padding-top: 1rem;
|
|
3020
|
+
padding-bottom: 1rem;
|
|
3021
|
+
}
|
|
3022
|
+
}
|