paymob-pixel-alpha 1.1.58 → 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 -273
- 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,83 +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
|
-
document.getElementById(elementId).innerHTML = '';
|
|
82657
|
-
const container = document.getElementById(elementId).appendChild(document.createElement('div'));
|
|
82658
|
-
if (!('attachShadow' in Element.prototype)) {
|
|
82659
|
-
setError('Shadow DOM is not supported in this browser');
|
|
82660
|
-
return;
|
|
82661
|
-
}
|
|
82662
|
-
try {
|
|
82663
|
-
let shadow = container.shadowRoot;
|
|
82664
|
-
if (!shadow) {
|
|
82665
|
-
shadow = container.attachShadow({
|
|
82666
|
-
mode: 'open'
|
|
82667
|
-
});
|
|
82668
|
-
environment.PIXEL_CSS_LINKS.forEach(href => {
|
|
82669
|
-
if (href.match(/\.(woff2?|ttf|otf|eot)$/)) {
|
|
82670
|
-
const fontName = 'currencyFont';
|
|
82671
|
-
const font = new FontFace(fontName, `url(${href})`);
|
|
82672
|
-
font.load().then(loadedFace => {
|
|
82673
|
-
var _shadow;
|
|
82674
|
-
//@ts-ignore
|
|
82675
|
-
document.fonts.add(loadedFace);
|
|
82676
|
-
const style = document.createElement('style');
|
|
82677
|
-
style.textContent = `
|
|
82678
|
-
@font-face {
|
|
82679
|
-
font-family: '${fontName}';
|
|
82680
|
-
src: url('${href}');
|
|
82681
|
-
font-display: swap;
|
|
82682
|
-
}
|
|
82683
|
-
`;
|
|
82684
|
-
(_shadow = shadow) == null || _shadow.appendChild(style);
|
|
82685
|
-
}).catch(err => console.error(`Failed to load font: ${href}`, err));
|
|
82686
|
-
} else {
|
|
82687
|
-
var _shadow2;
|
|
82688
|
-
const link = document.createElement('link');
|
|
82689
|
-
link.rel = 'stylesheet';
|
|
82690
|
-
link.href = href;
|
|
82691
|
-
(_shadow2 = shadow) == null || _shadow2.appendChild(link);
|
|
82692
|
-
}
|
|
82693
|
-
});
|
|
82694
|
-
}
|
|
82695
|
-
setShadowRoot(shadow);
|
|
82696
|
-
} catch (error) {
|
|
82697
|
-
console.error('Failed to create Shadow DOM:', error);
|
|
82698
|
-
setError(`Failed to create Shadow DOM: ${error instanceof Error ? error.message : String(error)}`);
|
|
82699
|
-
}
|
|
82700
|
-
return () => {
|
|
82701
|
-
setShadowRoot(null);
|
|
82702
|
-
};
|
|
82703
|
-
}, [elementId]);
|
|
82704
|
-
if (error) {
|
|
82705
|
-
const container = document.getElementById(elementId);
|
|
82706
|
-
return /*#__PURE__*/(0,react_dom.createPortal)(/*#__PURE__*/(0,jsx_runtime.jsx)("div", {
|
|
82707
|
-
style: {
|
|
82708
|
-
color: 'red',
|
|
82709
|
-
padding: '10px'
|
|
82710
|
-
},
|
|
82711
|
-
children: error
|
|
82712
|
-
}), container);
|
|
82713
|
-
}
|
|
82714
|
-
if (shadowRoot) {
|
|
82715
|
-
return /*#__PURE__*/(0,react_dom.createPortal)(children, shadowRoot);
|
|
82716
|
-
}
|
|
82717
|
-
return null;
|
|
82718
|
-
};
|
|
82719
|
-
/* harmony default export */ const utils_ShadowWrapper = (ShadowWrapper);
|
|
82720
82644
|
;// ./src/components/Payments/List/index.tsx
|
|
82721
82645
|
|
|
82722
82646
|
|
|
@@ -82733,11 +82657,9 @@ const ShadowWrapper = ({
|
|
|
82733
82657
|
|
|
82734
82658
|
|
|
82735
82659
|
|
|
82736
|
-
|
|
82737
82660
|
const PaymentsList = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
82738
82661
|
var _customStyle$containe;
|
|
82739
82662
|
const {
|
|
82740
|
-
elementId,
|
|
82741
82663
|
payments,
|
|
82742
82664
|
customStyle,
|
|
82743
82665
|
baseUrl,
|
|
@@ -82899,13 +82821,50 @@ const PaymentsList = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
82899
82821
|
})
|
|
82900
82822
|
})
|
|
82901
82823
|
})]
|
|
82902
|
-
}), /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
82903
|
-
|
|
82904
|
-
children: paymentMethods.length
|
|
82905
|
-
|
|
82906
|
-
|
|
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,
|
|
82907
82867
|
customStyle,
|
|
82908
|
-
paymentMethodsCount: paymentMethods.length,
|
|
82909
82868
|
baseUrl,
|
|
82910
82869
|
disablePay,
|
|
82911
82870
|
savedCards: savedCardsList,
|
|
@@ -82922,46 +82881,6 @@ const PaymentsList = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
82922
82881
|
publicKey,
|
|
82923
82882
|
ref: cardRef,
|
|
82924
82883
|
discounts: discounts == null ? void 0 : discounts.cards
|
|
82925
|
-
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(jsx_runtime.Fragment, {
|
|
82926
|
-
children: viewMode === 'list' ? /*#__PURE__*/(0,jsx_runtime.jsx)(ListView, {
|
|
82927
|
-
paymentMethods: paymentMethods,
|
|
82928
|
-
customStyle,
|
|
82929
|
-
baseUrl,
|
|
82930
|
-
disablePay,
|
|
82931
|
-
savedCards: savedCardsList,
|
|
82932
|
-
forceSaveCard,
|
|
82933
|
-
showSaveCard,
|
|
82934
|
-
onBeforePaymentComplete: onBeforePaymentComplete && handleOnBeforePaymentComplete,
|
|
82935
|
-
onAfterPaymentComplete,
|
|
82936
|
-
onCardValidationChanged,
|
|
82937
|
-
showPaymobLogo,
|
|
82938
|
-
hideCardHolderName,
|
|
82939
|
-
isLoading,
|
|
82940
|
-
country,
|
|
82941
|
-
integrationType,
|
|
82942
|
-
publicKey,
|
|
82943
|
-
ref: cardRef,
|
|
82944
|
-
discounts: discounts == null ? void 0 : discounts.cards
|
|
82945
|
-
}) : /*#__PURE__*/(0,jsx_runtime.jsx)(List_TabView, {
|
|
82946
|
-
paymentMethods: paymentMethods,
|
|
82947
|
-
customStyle,
|
|
82948
|
-
baseUrl,
|
|
82949
|
-
disablePay,
|
|
82950
|
-
savedCards: savedCardsList,
|
|
82951
|
-
forceSaveCard,
|
|
82952
|
-
showSaveCard,
|
|
82953
|
-
onBeforePaymentComplete: onBeforePaymentComplete && handleOnBeforePaymentComplete,
|
|
82954
|
-
onAfterPaymentComplete,
|
|
82955
|
-
onCardValidationChanged,
|
|
82956
|
-
showPaymobLogo,
|
|
82957
|
-
hideCardHolderName,
|
|
82958
|
-
isLoading,
|
|
82959
|
-
country,
|
|
82960
|
-
integrationType,
|
|
82961
|
-
publicKey,
|
|
82962
|
-
ref: cardRef,
|
|
82963
|
-
discounts: discounts == null ? void 0 : discounts.cards
|
|
82964
|
-
})
|
|
82965
82884
|
})
|
|
82966
82885
|
})
|
|
82967
82886
|
})]
|
|
@@ -83161,12 +83080,10 @@ function getStyles_getStyles(customStyle) {
|
|
|
83161
83080
|
|
|
83162
83081
|
|
|
83163
83082
|
|
|
83164
|
-
|
|
83165
83083
|
|
|
83166
83084
|
|
|
83167
83085
|
const Payments_Payments = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
83168
83086
|
const {
|
|
83169
|
-
elementId,
|
|
83170
83087
|
payment,
|
|
83171
83088
|
customStyle,
|
|
83172
83089
|
paymentList,
|
|
@@ -83196,163 +83113,111 @@ const Payments_Payments = /*#__PURE__*/(0,react.forwardRef)((props, ref) => {
|
|
|
83196
83113
|
var _paymentMethod$name;
|
|
83197
83114
|
switch ((_paymentMethod$name = paymentMethod.name) == null ? void 0 : _paymentMethod$name.toUpperCase()) {
|
|
83198
83115
|
case 'CARD':
|
|
83199
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83200
|
-
|
|
83201
|
-
|
|
83202
|
-
|
|
83203
|
-
|
|
83204
|
-
|
|
83205
|
-
|
|
83206
|
-
|
|
83207
|
-
|
|
83208
|
-
|
|
83209
|
-
|
|
83210
|
-
|
|
83211
|
-
|
|
83212
|
-
|
|
83213
|
-
|
|
83214
|
-
integrationType,
|
|
83215
|
-
publicKey
|
|
83216
|
-
})
|
|
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
|
|
83217
83131
|
});
|
|
83218
83132
|
case 'CARD-INSTALLMENT':
|
|
83219
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83220
|
-
|
|
83221
|
-
|
|
83222
|
-
|
|
83223
|
-
customStyle: styles,
|
|
83224
|
-
baseUrl
|
|
83225
|
-
})
|
|
83133
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(BankInstalment, {
|
|
83134
|
+
payment: paymentMethod,
|
|
83135
|
+
customStyle: styles,
|
|
83136
|
+
baseUrl
|
|
83226
83137
|
});
|
|
83227
83138
|
case 'KNET':
|
|
83228
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83229
|
-
|
|
83230
|
-
|
|
83231
|
-
payment: paymentMethod,
|
|
83232
|
-
customStyle: styles
|
|
83233
|
-
})
|
|
83139
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(Payments_Knet, {
|
|
83140
|
+
payment: paymentMethod,
|
|
83141
|
+
customStyle: styles
|
|
83234
83142
|
});
|
|
83235
83143
|
case 'KNET-APPLE-PAY':
|
|
83236
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83237
|
-
|
|
83238
|
-
|
|
83239
|
-
payment: paymentMethod,
|
|
83240
|
-
customStyle: styles
|
|
83241
|
-
})
|
|
83144
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(Payments_KnetApplePay, {
|
|
83145
|
+
payment: paymentMethod,
|
|
83146
|
+
customStyle: styles
|
|
83242
83147
|
});
|
|
83243
83148
|
case 'NIFT':
|
|
83244
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83245
|
-
|
|
83246
|
-
|
|
83247
|
-
payment: paymentMethod,
|
|
83248
|
-
customStyle: styles
|
|
83249
|
-
})
|
|
83149
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(NiftElement, {
|
|
83150
|
+
payment: paymentMethod,
|
|
83151
|
+
customStyle: styles
|
|
83250
83152
|
});
|
|
83251
83153
|
case 'EASYPAISADIRECT':
|
|
83252
83154
|
case 'EASYPAISA':
|
|
83253
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83254
|
-
|
|
83255
|
-
|
|
83256
|
-
payment: paymentMethod,
|
|
83257
|
-
customStyle: styles
|
|
83258
|
-
})
|
|
83155
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(EasypaisaElement, {
|
|
83156
|
+
payment: paymentMethod,
|
|
83157
|
+
customStyle: styles
|
|
83259
83158
|
});
|
|
83260
83159
|
case 'JAZZCASH':
|
|
83261
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83262
|
-
|
|
83263
|
-
|
|
83264
|
-
payment: paymentMethod,
|
|
83265
|
-
customStyle: styles
|
|
83266
|
-
})
|
|
83160
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(JazzcashElement, {
|
|
83161
|
+
payment: paymentMethod,
|
|
83162
|
+
customStyle: styles
|
|
83267
83163
|
});
|
|
83268
83164
|
case 'POSTPAY':
|
|
83269
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83270
|
-
|
|
83271
|
-
|
|
83272
|
-
payment: paymentMethod,
|
|
83273
|
-
customStyle: styles
|
|
83274
|
-
})
|
|
83165
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(PostpayElement, {
|
|
83166
|
+
payment: paymentMethod,
|
|
83167
|
+
customStyle: styles
|
|
83275
83168
|
});
|
|
83276
83169
|
case 'TABBY':
|
|
83277
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83278
|
-
|
|
83279
|
-
|
|
83280
|
-
payment: paymentMethod,
|
|
83281
|
-
customStyle: styles
|
|
83282
|
-
})
|
|
83170
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(TabbyElement, {
|
|
83171
|
+
payment: paymentMethod,
|
|
83172
|
+
customStyle: styles
|
|
83283
83173
|
});
|
|
83284
83174
|
case 'WALLETS':
|
|
83285
83175
|
case 'WALLET':
|
|
83286
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83287
|
-
|
|
83288
|
-
|
|
83289
|
-
payment: paymentMethod,
|
|
83290
|
-
customStyle: styles
|
|
83291
|
-
})
|
|
83176
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(WalletElement, {
|
|
83177
|
+
payment: paymentMethod,
|
|
83178
|
+
customStyle: styles
|
|
83292
83179
|
});
|
|
83293
83180
|
case 'FORSA':
|
|
83294
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83295
|
-
|
|
83296
|
-
|
|
83297
|
-
payment: paymentMethod,
|
|
83298
|
-
customStyle: styles
|
|
83299
|
-
})
|
|
83181
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(ForsaElements, {
|
|
83182
|
+
payment: paymentMethod,
|
|
83183
|
+
customStyle: styles
|
|
83300
83184
|
});
|
|
83301
83185
|
case 'PREMIUM':
|
|
83302
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83303
|
-
|
|
83304
|
-
|
|
83305
|
-
|
|
83306
|
-
customStyle: styles,
|
|
83307
|
-
baseUrl
|
|
83308
|
-
})
|
|
83186
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(PremiumElement, {
|
|
83187
|
+
payment: paymentMethod,
|
|
83188
|
+
customStyle: styles,
|
|
83189
|
+
baseUrl
|
|
83309
83190
|
});
|
|
83310
83191
|
case 'KIOSK':
|
|
83311
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83312
|
-
|
|
83313
|
-
|
|
83314
|
-
payment: paymentMethod,
|
|
83315
|
-
customStyle: styles
|
|
83316
|
-
})
|
|
83192
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(Payments_Aman, {
|
|
83193
|
+
payment: paymentMethod,
|
|
83194
|
+
customStyle: styles
|
|
83317
83195
|
});
|
|
83318
83196
|
case 'VALU':
|
|
83319
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83320
|
-
|
|
83321
|
-
|
|
83322
|
-
payment: paymentMethod,
|
|
83323
|
-
customStyle: styles
|
|
83324
|
-
})
|
|
83197
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(Payments_ValU, {
|
|
83198
|
+
payment: paymentMethod,
|
|
83199
|
+
customStyle: styles
|
|
83325
83200
|
});
|
|
83326
83201
|
case 'SOUHOOLAV3':
|
|
83327
83202
|
case 'SOUHOOLA':
|
|
83328
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83329
|
-
|
|
83330
|
-
|
|
83331
|
-
payment: paymentMethod,
|
|
83332
|
-
customStyle: styles
|
|
83333
|
-
})
|
|
83203
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(SouhoolaElements, {
|
|
83204
|
+
payment: paymentMethod,
|
|
83205
|
+
customStyle: styles
|
|
83334
83206
|
});
|
|
83335
83207
|
case 'SYMPL':
|
|
83336
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83337
|
-
|
|
83338
|
-
|
|
83339
|
-
|
|
83340
|
-
customStyle: styles,
|
|
83341
|
-
baseUrl
|
|
83342
|
-
})
|
|
83208
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(SymplElement, {
|
|
83209
|
+
payment: paymentMethod,
|
|
83210
|
+
customStyle: styles,
|
|
83211
|
+
baseUrl
|
|
83343
83212
|
});
|
|
83344
83213
|
case 'STCPAY':
|
|
83345
|
-
return /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
83346
|
-
|
|
83347
|
-
|
|
83348
|
-
payment: paymentMethod,
|
|
83349
|
-
customStyle: styles
|
|
83350
|
-
})
|
|
83214
|
+
return /*#__PURE__*/(0,jsx_runtime.jsx)(StcPayElement, {
|
|
83215
|
+
payment: paymentMethod,
|
|
83216
|
+
customStyle: styles
|
|
83351
83217
|
});
|
|
83352
83218
|
}
|
|
83353
83219
|
}
|
|
83354
83220
|
return /*#__PURE__*/(0,jsx_runtime.jsx)(List, {
|
|
83355
|
-
elementId: elementId,
|
|
83356
83221
|
payments: paymentList,
|
|
83357
83222
|
setPaymentMethod: setPaymentMethod,
|
|
83358
83223
|
customStyle: styles,
|
|
@@ -87030,6 +86895,83 @@ i18next.use(initReactI18next).init({
|
|
|
87030
86895
|
}
|
|
87031
86896
|
});
|
|
87032
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);
|
|
87033
86975
|
;// ./src/lib/pixel.tsx
|
|
87034
86976
|
var _Pixel;
|
|
87035
86977
|
|
|
@@ -87042,6 +86984,7 @@ var _Pixel;
|
|
|
87042
86984
|
|
|
87043
86985
|
|
|
87044
86986
|
|
|
86987
|
+
|
|
87045
86988
|
class Pixel {
|
|
87046
86989
|
constructor(options) {
|
|
87047
86990
|
var _options$showPaymobLo;
|
|
@@ -87206,35 +87149,38 @@ class Pixel {
|
|
|
87206
87149
|
return;
|
|
87207
87150
|
}
|
|
87208
87151
|
this._root.render(/*#__PURE__*/(0,jsx_runtime.jsx)(react.StrictMode, {
|
|
87209
|
-
children: /*#__PURE__*/(0,jsx_runtime.jsx)(
|
|
87152
|
+
children: /*#__PURE__*/(0,jsx_runtime.jsx)(utils_ShadowWrapper, {
|
|
87210
87153
|
elementId: elementId,
|
|
87211
|
-
|
|
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
|
-
|
|
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
|
+
})
|
|
87238
87184
|
}));
|
|
87239
87185
|
}
|
|
87240
87186
|
}
|