paymob-pixel-alpha 1.1.59 → 1.1.60
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.js +219 -274
- package/package.json +1 -1
package/main.js
CHANGED
|
@@ -82367,6 +82367,7 @@ async function fetchPayments(publicKey, clientSecret, paymentMethods, baseUrl) {
|
|
|
82367
82367
|
KnetCurrency: item.target_currency,
|
|
82368
82368
|
KnetEquivalentAmountCents: item.converted_amount_cents,
|
|
82369
82369
|
KnetMinTransactionAmount: item.minimum_transaction_amount,
|
|
82370
|
+
merchantIdentifier: item.merchant_identifier,
|
|
82370
82371
|
paymentMethodType,
|
|
82371
82372
|
useCvv,
|
|
82372
82373
|
subType
|
|
@@ -82640,84 +82641,6 @@ const ListView = _ref => {
|
|
|
82640
82641
|
});
|
|
82641
82642
|
};
|
|
82642
82643
|
/* harmony default export */ const List_ListView = ((/* unused pure expression or super */ null && (ListView)));
|
|
82643
|
-
;// ./src/utils/ShadowWrapper.tsx
|
|
82644
|
-
|
|
82645
|
-
|
|
82646
|
-
|
|
82647
|
-
|
|
82648
|
-
const ShadowWrapper = ({
|
|
82649
|
-
elementId,
|
|
82650
|
-
children
|
|
82651
|
-
}) => {
|
|
82652
|
-
const [shadowRoot, setShadowRoot] = (0,react.useState)(null);
|
|
82653
|
-
const [error, setError] = (0,react.useState)(null);
|
|
82654
|
-
(0,react.useEffect)(() => {
|
|
82655
|
-
if (!document.getElementById(elementId)) return;
|
|
82656
|
-
|
|
82657
|
-
//document.getElementById(elementId)!.innerHTML = '';
|
|
82658
|
-
const container = document.getElementById(elementId).appendChild(document.createElement('div'));
|
|
82659
|
-
if (!('attachShadow' in Element.prototype)) {
|
|
82660
|
-
setError('Shadow DOM is not supported in this browser');
|
|
82661
|
-
return;
|
|
82662
|
-
}
|
|
82663
|
-
try {
|
|
82664
|
-
let shadow = container.shadowRoot;
|
|
82665
|
-
if (!shadow) {
|
|
82666
|
-
shadow = container.attachShadow({
|
|
82667
|
-
mode: 'open'
|
|
82668
|
-
});
|
|
82669
|
-
environment.PIXEL_CSS_LINKS.forEach(href => {
|
|
82670
|
-
if (href.match(/\.(woff2?|ttf|otf|eot)$/)) {
|
|
82671
|
-
const fontName = 'currencyFont';
|
|
82672
|
-
const font = new FontFace(fontName, `url(${href})`);
|
|
82673
|
-
font.load().then(loadedFace => {
|
|
82674
|
-
var _shadow;
|
|
82675
|
-
//@ts-ignore
|
|
82676
|
-
document.fonts.add(loadedFace);
|
|
82677
|
-
const style = document.createElement('style');
|
|
82678
|
-
style.textContent = `
|
|
82679
|
-
@font-face {
|
|
82680
|
-
font-family: '${fontName}';
|
|
82681
|
-
src: url('${href}');
|
|
82682
|
-
font-display: swap;
|
|
82683
|
-
}
|
|
82684
|
-
`;
|
|
82685
|
-
(_shadow = shadow) == null || _shadow.appendChild(style);
|
|
82686
|
-
}).catch(err => console.error(`Failed to load font: ${href}`, err));
|
|
82687
|
-
} else {
|
|
82688
|
-
var _shadow2;
|
|
82689
|
-
const link = document.createElement('link');
|
|
82690
|
-
link.rel = 'stylesheet';
|
|
82691
|
-
link.href = href;
|
|
82692
|
-
(_shadow2 = shadow) == null || _shadow2.appendChild(link);
|
|
82693
|
-
}
|
|
82694
|
-
});
|
|
82695
|
-
}
|
|
82696
|
-
setShadowRoot(shadow);
|
|
82697
|
-
} catch (error) {
|
|
82698
|
-
console.error('Failed to create Shadow DOM:', error);
|
|
82699
|
-
setError(`Failed to create Shadow DOM: ${error instanceof Error ? error.message : String(error)}`);
|
|
82700
|
-
}
|
|
82701
|
-
return () => {
|
|
82702
|
-
setShadowRoot(null);
|
|
82703
|
-
};
|
|
82704
|
-
}, [elementId]);
|
|
82705
|
-
if (error) {
|
|
82706
|
-
const container = document.getElementById(elementId);
|
|
82707
|
-
return /*#__PURE__*/(0,react_dom.createPortal)(/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
82708
|
-
style: {
|
|
82709
|
-
color: 'red',
|
|
82710
|
-
padding: '10px'
|
|
82711
|
-
},
|
|
82712
|
-
children: error
|
|
82713
|
-
}), container);
|
|
82714
|
-
}
|
|
82715
|
-
if (shadowRoot) {
|
|
82716
|
-
return /*#__PURE__*/(0,react_dom.createPortal)(children, shadowRoot);
|
|
82717
|
-
}
|
|
82718
|
-
return null;
|
|
82719
|
-
};
|
|
82720
|
-
/* harmony default export */ const utils_ShadowWrapper = (ShadowWrapper);
|
|
82721
82644
|
;// ./src/components/Payments/List/index.tsx
|
|
82722
82645
|
|
|
82723
82646
|
|
|
@@ -82734,11 +82657,9 @@ const ShadowWrapper = ({
|
|
|
82734
82657
|
|
|
82735
82658
|
|
|
82736
82659
|
|
|
82737
|
-
|
|
82738
82660
|
const PaymentsList = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
82739
82661
|
var _customStyle$containe;
|
|
82740
82662
|
const {
|
|
82741
|
-
elementId,
|
|
82742
82663
|
payments,
|
|
82743
82664
|
customStyle,
|
|
82744
82665
|
baseUrl,
|
|
@@ -82900,13 +82821,50 @@ const PaymentsList = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
82900
82821
|
})
|
|
82901
82822
|
})
|
|
82902
82823
|
})]
|
|
82903
|
-
}), /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
82904
|
-
|
|
82905
|
-
children: paymentMethods.length
|
|
82906
|
-
|
|
82907
|
-
|
|
82824
|
+
}), paymentMethods.length >= 1 && /*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
82825
|
+
className: list_module['payments-list'],
|
|
82826
|
+
children: paymentMethods.length === 1 ? renderSelectedPaymentMethod(paymentMethods[0], {
|
|
82827
|
+
customStyle,
|
|
82828
|
+
paymentMethodsCount: paymentMethods.length,
|
|
82829
|
+
baseUrl,
|
|
82830
|
+
disablePay,
|
|
82831
|
+
savedCards: savedCardsList,
|
|
82832
|
+
forceSaveCard,
|
|
82833
|
+
showSaveCard,
|
|
82834
|
+
onBeforePaymentComplete: onBeforePaymentComplete && handleOnBeforePaymentComplete,
|
|
82835
|
+
onAfterPaymentComplete,
|
|
82836
|
+
onCardValidationChanged,
|
|
82837
|
+
showPaymobLogo,
|
|
82838
|
+
hideCardHolderName,
|
|
82839
|
+
isLoading,
|
|
82840
|
+
country,
|
|
82841
|
+
integrationType,
|
|
82842
|
+
publicKey,
|
|
82843
|
+
ref: cardRef,
|
|
82844
|
+
discounts: discounts == null ? void 0 : discounts.cards
|
|
82845
|
+
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
82846
|
+
children: viewMode === 'list' ? /*#__PURE__*/(0,jsx_runtime.jsx)(ListView, {
|
|
82847
|
+
paymentMethods: paymentMethods,
|
|
82848
|
+
customStyle,
|
|
82849
|
+
baseUrl,
|
|
82850
|
+
disablePay,
|
|
82851
|
+
savedCards: savedCardsList,
|
|
82852
|
+
forceSaveCard,
|
|
82853
|
+
showSaveCard,
|
|
82854
|
+
onBeforePaymentComplete: onBeforePaymentComplete && handleOnBeforePaymentComplete,
|
|
82855
|
+
onAfterPaymentComplete,
|
|
82856
|
+
onCardValidationChanged,
|
|
82857
|
+
showPaymobLogo,
|
|
82858
|
+
hideCardHolderName,
|
|
82859
|
+
isLoading,
|
|
82860
|
+
country,
|
|
82861
|
+
integrationType,
|
|
82862
|
+
publicKey,
|
|
82863
|
+
ref: cardRef,
|
|
82864
|
+
discounts: discounts == null ? void 0 : discounts.cards
|
|
82865
|
+
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(List_TabView, {
|
|
82866
|
+
paymentMethods: paymentMethods,
|
|
82908
82867
|
customStyle,
|
|
82909
|
-
paymentMethodsCount: paymentMethods.length,
|
|
82910
82868
|
baseUrl,
|
|
82911
82869
|
disablePay,
|
|
82912
82870
|
savedCards: savedCardsList,
|
|
@@ -82923,46 +82881,6 @@ const PaymentsList = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
82923
82881
|
publicKey,
|
|
82924
82882
|
ref: cardRef,
|
|
82925
82883
|
discounts: discounts == null ? void 0 : discounts.cards
|
|
82926
|
-
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
82927
|
-
children: viewMode === 'list' ? /*#__PURE__*/(0,jsx_runtime.jsx)(ListView, {
|
|
82928
|
-
paymentMethods: paymentMethods,
|
|
82929
|
-
customStyle,
|
|
82930
|
-
baseUrl,
|
|
82931
|
-
disablePay,
|
|
82932
|
-
savedCards: savedCardsList,
|
|
82933
|
-
forceSaveCard,
|
|
82934
|
-
showSaveCard,
|
|
82935
|
-
onBeforePaymentComplete: onBeforePaymentComplete && handleOnBeforePaymentComplete,
|
|
82936
|
-
onAfterPaymentComplete,
|
|
82937
|
-
onCardValidationChanged,
|
|
82938
|
-
showPaymobLogo,
|
|
82939
|
-
hideCardHolderName,
|
|
82940
|
-
isLoading,
|
|
82941
|
-
country,
|
|
82942
|
-
integrationType,
|
|
82943
|
-
publicKey,
|
|
82944
|
-
ref: cardRef,
|
|
82945
|
-
discounts: discounts == null ? void 0 : discounts.cards
|
|
82946
|
-
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(List_TabView, {
|
|
82947
|
-
paymentMethods: paymentMethods,
|
|
82948
|
-
customStyle,
|
|
82949
|
-
baseUrl,
|
|
82950
|
-
disablePay,
|
|
82951
|
-
savedCards: savedCardsList,
|
|
82952
|
-
forceSaveCard,
|
|
82953
|
-
showSaveCard,
|
|
82954
|
-
onBeforePaymentComplete: onBeforePaymentComplete && handleOnBeforePaymentComplete,
|
|
82955
|
-
onAfterPaymentComplete,
|
|
82956
|
-
onCardValidationChanged,
|
|
82957
|
-
showPaymobLogo,
|
|
82958
|
-
hideCardHolderName,
|
|
82959
|
-
isLoading,
|
|
82960
|
-
country,
|
|
82961
|
-
integrationType,
|
|
82962
|
-
publicKey,
|
|
82963
|
-
ref: cardRef,
|
|
82964
|
-
discounts: discounts == null ? void 0 : discounts.cards
|
|
82965
|
-
})
|
|
82966
82884
|
})
|
|
82967
82885
|
})
|
|
82968
82886
|
})]
|
|
@@ -83162,12 +83080,10 @@ function getStyles_getStyles(customStyle) {
|
|
|
83162
83080
|
|
|
83163
83081
|
|
|
83164
83082
|
|
|
83165
|
-
|
|
83166
83083
|
|
|
83167
83084
|
|
|
83168
83085
|
const Payments_Payments = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
83169
83086
|
const {
|
|
83170
|
-
elementId,
|
|
83171
83087
|
payment,
|
|
83172
83088
|
customStyle,
|
|
83173
83089
|
paymentList,
|
|
@@ -83197,163 +83113,111 @@ const Payments_Payments = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
83197
83113
|
var _paymentMethod$name;
|
|
83198
83114
|
switch ((_paymentMethod$name = paymentMethod.name) == null ? void 0 : _paymentMethod$name.toUpperCase()) {
|
|
83199
83115
|
case 'CARD':
|
|
83200
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83201
|
-
|
|
83202
|
-
|
|
83203
|
-
|
|
83204
|
-
|
|
83205
|
-
|
|
83206
|
-
|
|
83207
|
-
|
|
83208
|
-
|
|
83209
|
-
|
|
83210
|
-
|
|
83211
|
-
|
|
83212
|
-
|
|
83213
|
-
|
|
83214
|
-
|
|
83215
|
-
integrationType,
|
|
83216
|
-
publicKey
|
|
83217
|
-
})
|
|
83116
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(Payments_Card, {
|
|
83117
|
+
payment: paymentMethod,
|
|
83118
|
+
customStyle: styles,
|
|
83119
|
+
baseUrl,
|
|
83120
|
+
savedCards,
|
|
83121
|
+
disablePay,
|
|
83122
|
+
forceSaveCard,
|
|
83123
|
+
showSaveCard,
|
|
83124
|
+
onBeforePaymentComplete,
|
|
83125
|
+
onAfterPaymentComplete,
|
|
83126
|
+
onCardValidationChanged,
|
|
83127
|
+
showPaymobLogo,
|
|
83128
|
+
hideCardHolderName,
|
|
83129
|
+
integrationType,
|
|
83130
|
+
publicKey
|
|
83218
83131
|
});
|
|
83219
83132
|
case 'CARD-INSTALLMENT':
|
|
83220
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83221
|
-
|
|
83222
|
-
|
|
83223
|
-
|
|
83224
|
-
customStyle: styles,
|
|
83225
|
-
baseUrl
|
|
83226
|
-
})
|
|
83133
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(BankInstalment, {
|
|
83134
|
+
payment: paymentMethod,
|
|
83135
|
+
customStyle: styles,
|
|
83136
|
+
baseUrl
|
|
83227
83137
|
});
|
|
83228
83138
|
case 'KNET':
|
|
83229
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83230
|
-
|
|
83231
|
-
|
|
83232
|
-
payment: paymentMethod,
|
|
83233
|
-
customStyle: styles
|
|
83234
|
-
})
|
|
83139
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(Payments_Knet, {
|
|
83140
|
+
payment: paymentMethod,
|
|
83141
|
+
customStyle: styles
|
|
83235
83142
|
});
|
|
83236
83143
|
case 'KNET-APPLE-PAY':
|
|
83237
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83238
|
-
|
|
83239
|
-
|
|
83240
|
-
payment: paymentMethod,
|
|
83241
|
-
customStyle: styles
|
|
83242
|
-
})
|
|
83144
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(Payments_KnetApplePay, {
|
|
83145
|
+
payment: paymentMethod,
|
|
83146
|
+
customStyle: styles
|
|
83243
83147
|
});
|
|
83244
83148
|
case 'NIFT':
|
|
83245
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83246
|
-
|
|
83247
|
-
|
|
83248
|
-
payment: paymentMethod,
|
|
83249
|
-
customStyle: styles
|
|
83250
|
-
})
|
|
83149
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(NiftElement, {
|
|
83150
|
+
payment: paymentMethod,
|
|
83151
|
+
customStyle: styles
|
|
83251
83152
|
});
|
|
83252
83153
|
case 'EASYPAISADIRECT':
|
|
83253
83154
|
case 'EASYPAISA':
|
|
83254
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83255
|
-
|
|
83256
|
-
|
|
83257
|
-
payment: paymentMethod,
|
|
83258
|
-
customStyle: styles
|
|
83259
|
-
})
|
|
83155
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(EasypaisaElement, {
|
|
83156
|
+
payment: paymentMethod,
|
|
83157
|
+
customStyle: styles
|
|
83260
83158
|
});
|
|
83261
83159
|
case 'JAZZCASH':
|
|
83262
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83263
|
-
|
|
83264
|
-
|
|
83265
|
-
payment: paymentMethod,
|
|
83266
|
-
customStyle: styles
|
|
83267
|
-
})
|
|
83160
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(JazzcashElement, {
|
|
83161
|
+
payment: paymentMethod,
|
|
83162
|
+
customStyle: styles
|
|
83268
83163
|
});
|
|
83269
83164
|
case 'POSTPAY':
|
|
83270
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83271
|
-
|
|
83272
|
-
|
|
83273
|
-
payment: paymentMethod,
|
|
83274
|
-
customStyle: styles
|
|
83275
|
-
})
|
|
83165
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(PostpayElement, {
|
|
83166
|
+
payment: paymentMethod,
|
|
83167
|
+
customStyle: styles
|
|
83276
83168
|
});
|
|
83277
83169
|
case 'TABBY':
|
|
83278
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83279
|
-
|
|
83280
|
-
|
|
83281
|
-
payment: paymentMethod,
|
|
83282
|
-
customStyle: styles
|
|
83283
|
-
})
|
|
83170
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(TabbyElement, {
|
|
83171
|
+
payment: paymentMethod,
|
|
83172
|
+
customStyle: styles
|
|
83284
83173
|
});
|
|
83285
83174
|
case 'WALLETS':
|
|
83286
83175
|
case 'WALLET':
|
|
83287
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83288
|
-
|
|
83289
|
-
|
|
83290
|
-
payment: paymentMethod,
|
|
83291
|
-
customStyle: styles
|
|
83292
|
-
})
|
|
83176
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(WalletElement, {
|
|
83177
|
+
payment: paymentMethod,
|
|
83178
|
+
customStyle: styles
|
|
83293
83179
|
});
|
|
83294
83180
|
case 'FORSA':
|
|
83295
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83296
|
-
|
|
83297
|
-
|
|
83298
|
-
payment: paymentMethod,
|
|
83299
|
-
customStyle: styles
|
|
83300
|
-
})
|
|
83181
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(ForsaElements, {
|
|
83182
|
+
payment: paymentMethod,
|
|
83183
|
+
customStyle: styles
|
|
83301
83184
|
});
|
|
83302
83185
|
case 'PREMIUM':
|
|
83303
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83304
|
-
|
|
83305
|
-
|
|
83306
|
-
|
|
83307
|
-
customStyle: styles,
|
|
83308
|
-
baseUrl
|
|
83309
|
-
})
|
|
83186
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(PremiumElement, {
|
|
83187
|
+
payment: paymentMethod,
|
|
83188
|
+
customStyle: styles,
|
|
83189
|
+
baseUrl
|
|
83310
83190
|
});
|
|
83311
83191
|
case 'KIOSK':
|
|
83312
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83313
|
-
|
|
83314
|
-
|
|
83315
|
-
payment: paymentMethod,
|
|
83316
|
-
customStyle: styles
|
|
83317
|
-
})
|
|
83192
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(Payments_Aman, {
|
|
83193
|
+
payment: paymentMethod,
|
|
83194
|
+
customStyle: styles
|
|
83318
83195
|
});
|
|
83319
83196
|
case 'VALU':
|
|
83320
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83321
|
-
|
|
83322
|
-
|
|
83323
|
-
payment: paymentMethod,
|
|
83324
|
-
customStyle: styles
|
|
83325
|
-
})
|
|
83197
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(Payments_ValU, {
|
|
83198
|
+
payment: paymentMethod,
|
|
83199
|
+
customStyle: styles
|
|
83326
83200
|
});
|
|
83327
83201
|
case 'SOUHOOLAV3':
|
|
83328
83202
|
case 'SOUHOOLA':
|
|
83329
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83330
|
-
|
|
83331
|
-
|
|
83332
|
-
payment: paymentMethod,
|
|
83333
|
-
customStyle: styles
|
|
83334
|
-
})
|
|
83203
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(SouhoolaElements, {
|
|
83204
|
+
payment: paymentMethod,
|
|
83205
|
+
customStyle: styles
|
|
83335
83206
|
});
|
|
83336
83207
|
case 'SYMPL':
|
|
83337
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83338
|
-
|
|
83339
|
-
|
|
83340
|
-
|
|
83341
|
-
customStyle: styles,
|
|
83342
|
-
baseUrl
|
|
83343
|
-
})
|
|
83208
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(SymplElement, {
|
|
83209
|
+
payment: paymentMethod,
|
|
83210
|
+
customStyle: styles,
|
|
83211
|
+
baseUrl
|
|
83344
83212
|
});
|
|
83345
83213
|
case 'STCPAY':
|
|
83346
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83347
|
-
|
|
83348
|
-
|
|
83349
|
-
payment: paymentMethod,
|
|
83350
|
-
customStyle: styles
|
|
83351
|
-
})
|
|
83214
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(StcPayElement, {
|
|
83215
|
+
payment: paymentMethod,
|
|
83216
|
+
customStyle: styles
|
|
83352
83217
|
});
|
|
83353
83218
|
}
|
|
83354
83219
|
}
|
|
83355
83220
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(List, {
|
|
83356
|
-
elementId: elementId,
|
|
83357
83221
|
payments: paymentList,
|
|
83358
83222
|
setPaymentMethod: setPaymentMethod,
|
|
83359
83223
|
customStyle: styles,
|
|
@@ -87031,6 +86895,83 @@ i18next.use(initReactI18next).init({
|
|
|
87031
86895
|
}
|
|
87032
86896
|
});
|
|
87033
86897
|
/* harmony default export */ const localization_i18n = ((/* unused pure expression or super */ null && (i18n)));
|
|
86898
|
+
;// ./src/utils/ShadowWrapper.tsx
|
|
86899
|
+
|
|
86900
|
+
|
|
86901
|
+
|
|
86902
|
+
|
|
86903
|
+
const ShadowWrapper = ({
|
|
86904
|
+
elementId,
|
|
86905
|
+
children
|
|
86906
|
+
}) => {
|
|
86907
|
+
const [shadowRoot, setShadowRoot] = (0,react.useState)(null);
|
|
86908
|
+
const [error, setError] = (0,react.useState)(null);
|
|
86909
|
+
(0,react.useEffect)(() => {
|
|
86910
|
+
if (!document.getElementById(elementId)) return;
|
|
86911
|
+
document.getElementById(elementId).innerHTML = '';
|
|
86912
|
+
const container = document.getElementById(elementId).appendChild(document.createElement('div'));
|
|
86913
|
+
if (!('attachShadow' in Element.prototype)) {
|
|
86914
|
+
setError('Shadow DOM is not supported in this browser');
|
|
86915
|
+
return;
|
|
86916
|
+
}
|
|
86917
|
+
try {
|
|
86918
|
+
let shadow = container.shadowRoot;
|
|
86919
|
+
if (!shadow) {
|
|
86920
|
+
shadow = container.attachShadow({
|
|
86921
|
+
mode: 'open'
|
|
86922
|
+
});
|
|
86923
|
+
environment.PIXEL_CSS_LINKS.forEach(href => {
|
|
86924
|
+
if (href.match(/\.(woff2?|ttf|otf|eot)$/)) {
|
|
86925
|
+
const fontName = 'currencyFont';
|
|
86926
|
+
const font = new FontFace(fontName, `url(${href})`);
|
|
86927
|
+
font.load().then(loadedFace => {
|
|
86928
|
+
var _shadow;
|
|
86929
|
+
//@ts-ignore
|
|
86930
|
+
document.fonts.add(loadedFace);
|
|
86931
|
+
const style = document.createElement('style');
|
|
86932
|
+
style.textContent = `
|
|
86933
|
+
@font-face {
|
|
86934
|
+
font-family: '${fontName}';
|
|
86935
|
+
src: url('${href}');
|
|
86936
|
+
font-display: swap;
|
|
86937
|
+
}
|
|
86938
|
+
`;
|
|
86939
|
+
(_shadow = shadow) == null || _shadow.appendChild(style);
|
|
86940
|
+
}).catch(err => console.error(`Failed to load font: ${href}`, err));
|
|
86941
|
+
} else {
|
|
86942
|
+
var _shadow2;
|
|
86943
|
+
const link = document.createElement('link');
|
|
86944
|
+
link.rel = 'stylesheet';
|
|
86945
|
+
link.href = href;
|
|
86946
|
+
(_shadow2 = shadow) == null || _shadow2.appendChild(link);
|
|
86947
|
+
}
|
|
86948
|
+
});
|
|
86949
|
+
}
|
|
86950
|
+
setShadowRoot(shadow);
|
|
86951
|
+
} catch (error) {
|
|
86952
|
+
console.error('Failed to create Shadow DOM:', error);
|
|
86953
|
+
setError(`Failed to create Shadow DOM: ${error instanceof Error ? error.message : String(error)}`);
|
|
86954
|
+
}
|
|
86955
|
+
return () => {
|
|
86956
|
+
setShadowRoot(null);
|
|
86957
|
+
};
|
|
86958
|
+
}, [elementId]);
|
|
86959
|
+
if (error) {
|
|
86960
|
+
const container = document.getElementById(elementId);
|
|
86961
|
+
return /*#__PURE__*/(0,react_dom.createPortal)(/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
86962
|
+
style: {
|
|
86963
|
+
color: 'red',
|
|
86964
|
+
padding: '10px'
|
|
86965
|
+
},
|
|
86966
|
+
children: error
|
|
86967
|
+
}), container);
|
|
86968
|
+
}
|
|
86969
|
+
if (shadowRoot) {
|
|
86970
|
+
return /*#__PURE__*/(0,react_dom.createPortal)(children, shadowRoot);
|
|
86971
|
+
}
|
|
86972
|
+
return null;
|
|
86973
|
+
};
|
|
86974
|
+
/* harmony default export */ const utils_ShadowWrapper = (ShadowWrapper);
|
|
87034
86975
|
;// ./src/lib/pixel.tsx
|
|
87035
86976
|
var _Pixel;
|
|
87036
86977
|
|
|
@@ -87043,6 +86984,7 @@ var _Pixel;
|
|
|
87043
86984
|
|
|
87044
86985
|
|
|
87045
86986
|
|
|
86987
|
+
|
|
87046
86988
|
class Pixel {
|
|
87047
86989
|
constructor(options) {
|
|
87048
86990
|
var _options$showPaymobLo;
|
|
@@ -87207,35 +87149,38 @@ class Pixel {
|
|
|
87207
87149
|
return;
|
|
87208
87150
|
}
|
|
87209
87151
|
this._root.render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode, {
|
|
87210
|
-
children: /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
87152
|
+
children: /*#__PURE__*/(0,jsx_runtime.jsx)(utils_ShadowWrapper, {
|
|
87211
87153
|
elementId: elementId,
|
|
87212
|
-
|
|
87213
|
-
|
|
87214
|
-
|
|
87215
|
-
|
|
87216
|
-
|
|
87217
|
-
|
|
87218
|
-
|
|
87219
|
-
|
|
87220
|
-
|
|
87221
|
-
|
|
87222
|
-
|
|
87223
|
-
|
|
87224
|
-
|
|
87225
|
-
|
|
87226
|
-
|
|
87227
|
-
|
|
87228
|
-
|
|
87229
|
-
|
|
87230
|
-
|
|
87231
|
-
|
|
87232
|
-
|
|
87233
|
-
|
|
87234
|
-
|
|
87235
|
-
|
|
87236
|
-
|
|
87237
|
-
|
|
87238
|
-
|
|
87154
|
+
children: /*#__PURE__*/(0,jsx_runtime.jsx)(components_Payments, Object.assign({
|
|
87155
|
+
baseUrl: this._baseURL,
|
|
87156
|
+
paymentList: this._paymentList,
|
|
87157
|
+
payment: this._paymentMethod,
|
|
87158
|
+
disablePay: this._options['disablePay'],
|
|
87159
|
+
showPaymobLogo: this._options['showPaymobLogo'],
|
|
87160
|
+
customStyle: this._options['customStyle'],
|
|
87161
|
+
savedCards: this._savedCards,
|
|
87162
|
+
forceSaveCard: this._options['forceSaveCard'],
|
|
87163
|
+
showSaveCard: this._options['showSaveCard'],
|
|
87164
|
+
hideCardHolderName: this._options['hideCardHolderName'],
|
|
87165
|
+
publicKey: this._options['publicKey'],
|
|
87166
|
+
clientSecret: this._options['clientSecret'],
|
|
87167
|
+
selectedPaymentMethods: this._options['paymentMethods'],
|
|
87168
|
+
ref: this._paymentsRef
|
|
87169
|
+
}, this._options.beforePaymentComplete && {
|
|
87170
|
+
onBeforePaymentComplete: this.handleBeforePaymentComplete.bind(this)
|
|
87171
|
+
}, this._options.afterPaymentComplete && {
|
|
87172
|
+
onAfterPaymentComplete: this.handleAfterPaymentComplete.bind(this)
|
|
87173
|
+
}, this._options.onPaymentCancel && {
|
|
87174
|
+
onPaymentCancel: this.handleOnPaymentCancel.bind(this)
|
|
87175
|
+
}, this._options.cardValidationChanged && {
|
|
87176
|
+
onCardValidationChanged: this.handleCardValidationChanged.bind(this)
|
|
87177
|
+
}, {
|
|
87178
|
+
integrationType: this._integrationType,
|
|
87179
|
+
discounts: this._discounts,
|
|
87180
|
+
viewMode: this._options.viewMode,
|
|
87181
|
+
displayName: this._options.displayName
|
|
87182
|
+
}), Date.now())
|
|
87183
|
+
})
|
|
87239
87184
|
}));
|
|
87240
87185
|
}
|
|
87241
87186
|
}
|