@payment-kit-js/vanilla 0.5.8 → 0.5.9
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/dist/cdn/paymentkit.js +38 -13
- package/dist/cdn/paymentkit.js.map +3 -3
- package/dist/cdn/paymentkit.min.js +5 -5
- package/dist/cdn/paymentkit.min.js.map +3 -3
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/payment-methods/card.d.mts.map +1 -1
- package/dist/payment-methods/card.mjs +6 -2
- package/dist/payment-methods/card.mjs.map +1 -1
- package/dist/payment-methods/vgs-collect-loader.d.mts +1 -1
- package/dist/payment-methods/vgs-collect-loader.mjs +1 -1
- package/dist/{vgs-collect-loader-3Z4IWCA6.mjs → vgs-collect-loader-BZj36d8r.mjs} +28 -9
- package/dist/vgs-collect-loader-BZj36d8r.mjs.map +1 -0
- package/package.json +7 -4
- package/dist/vgs-collect-loader-3Z4IWCA6.mjs.map +0 -1
package/dist/cdn/paymentkit.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* PaymentKit.js v0.5.
|
|
2
|
+
* PaymentKit.js v0.5.9
|
|
3
3
|
* https://paymentkit.com
|
|
4
4
|
*
|
|
5
5
|
* @license MIT
|
|
@@ -42,7 +42,7 @@ var PaymentKit = (() => {
|
|
|
42
42
|
});
|
|
43
43
|
|
|
44
44
|
// package.json
|
|
45
|
-
var version = "0.5.
|
|
45
|
+
var version = "0.5.9";
|
|
46
46
|
|
|
47
47
|
// src/analytics/mock-adapter.ts
|
|
48
48
|
var MockAnalyticsAdapter = class {
|
|
@@ -6864,6 +6864,14 @@ var PaymentKit = (() => {
|
|
|
6864
6864
|
"box-sizing": "border-box",
|
|
6865
6865
|
...containerPadding && containerPadding !== "0px" ? { padding: containerPadding } : {}
|
|
6866
6866
|
};
|
|
6867
|
+
for (const selector of [mountPoints.pan, mountPoints.exp, mountPoints.cvc]) {
|
|
6868
|
+
const container = document.querySelector(selector);
|
|
6869
|
+
if (!container) continue;
|
|
6870
|
+
const staleIframes = container.querySelectorAll("iframe");
|
|
6871
|
+
for (const iframe of staleIframes) {
|
|
6872
|
+
iframe.remove();
|
|
6873
|
+
}
|
|
6874
|
+
}
|
|
6867
6875
|
const panField = form.cardNumberField(mountPoints.pan, {
|
|
6868
6876
|
placeholder: placeholders?.card_pan ?? "Card number",
|
|
6869
6877
|
validations: ["required", "validCardNumber"],
|
|
@@ -6883,9 +6891,12 @@ var PaymentKit = (() => {
|
|
|
6883
6891
|
validations: ["required", "validCardSecurityCode"],
|
|
6884
6892
|
css: fieldCss
|
|
6885
6893
|
});
|
|
6894
|
+
const observers = [];
|
|
6895
|
+
const containers = [];
|
|
6886
6896
|
for (const selector of [mountPoints.pan, mountPoints.exp, mountPoints.cvc]) {
|
|
6887
6897
|
const container = document.querySelector(selector);
|
|
6888
6898
|
if (!container) continue;
|
|
6899
|
+
containers.push(container);
|
|
6889
6900
|
const styleIframe = (iframe) => {
|
|
6890
6901
|
const containerEl = container;
|
|
6891
6902
|
if (getComputedStyle(containerEl).position === "static") {
|
|
@@ -6897,18 +6908,17 @@ var PaymentKit = (() => {
|
|
|
6897
6908
|
iframe.style.height = "100%";
|
|
6898
6909
|
iframe.style.border = "none";
|
|
6899
6910
|
};
|
|
6911
|
+
const observer = new MutationObserver(() => {
|
|
6912
|
+
const iframe = container.querySelector("iframe");
|
|
6913
|
+
if (iframe && iframe.style.position !== "absolute") {
|
|
6914
|
+
styleIframe(iframe);
|
|
6915
|
+
}
|
|
6916
|
+
});
|
|
6917
|
+
observer.observe(container, { childList: true, subtree: true });
|
|
6918
|
+
observers.push(observer);
|
|
6900
6919
|
const existing = container.querySelector("iframe");
|
|
6901
|
-
if (existing) {
|
|
6920
|
+
if (existing && existing.style.position !== "absolute") {
|
|
6902
6921
|
styleIframe(existing);
|
|
6903
|
-
} else {
|
|
6904
|
-
const observer = new MutationObserver((_2, obs) => {
|
|
6905
|
-
const iframe = container.querySelector("iframe");
|
|
6906
|
-
if (iframe) {
|
|
6907
|
-
styleIframe(iframe);
|
|
6908
|
-
obs.disconnect();
|
|
6909
|
-
}
|
|
6910
|
-
});
|
|
6911
|
-
observer.observe(container, { childList: true, subtree: true });
|
|
6912
6922
|
}
|
|
6913
6923
|
}
|
|
6914
6924
|
if (onFocusChangeCallbacks) {
|
|
@@ -6925,6 +6935,17 @@ var PaymentKit = (() => {
|
|
|
6925
6935
|
}
|
|
6926
6936
|
}
|
|
6927
6937
|
}
|
|
6938
|
+
return () => {
|
|
6939
|
+
for (const observer of observers) {
|
|
6940
|
+
observer.disconnect();
|
|
6941
|
+
}
|
|
6942
|
+
for (const container of containers) {
|
|
6943
|
+
const iframes = container.querySelectorAll("iframe");
|
|
6944
|
+
for (const iframe of iframes) {
|
|
6945
|
+
iframe.remove();
|
|
6946
|
+
}
|
|
6947
|
+
}
|
|
6948
|
+
};
|
|
6928
6949
|
}
|
|
6929
6950
|
|
|
6930
6951
|
// src/payment-methods/card.ts
|
|
@@ -7037,7 +7058,7 @@ var PaymentKit = (() => {
|
|
|
7037
7058
|
console.log(
|
|
7038
7059
|
`[PaymentKit] Creating VGS card fields \u2014 pan: ${parentSelector}, exp: ${expSelector}, cvc: ${cvcSelector}`
|
|
7039
7060
|
);
|
|
7040
|
-
createVgsCardFields(
|
|
7061
|
+
states.vgsFieldsCleanup = createVgsCardFields(
|
|
7041
7062
|
form,
|
|
7042
7063
|
{
|
|
7043
7064
|
pan: parentSelector,
|
|
@@ -7061,6 +7082,8 @@ var PaymentKit = (() => {
|
|
|
7061
7082
|
}
|
|
7062
7083
|
cleanupVgs = () => {
|
|
7063
7084
|
if (type === "card_pan" && states.vgsForm) {
|
|
7085
|
+
states.vgsFieldsCleanup?.();
|
|
7086
|
+
states.vgsFieldsCleanup = void 0;
|
|
7064
7087
|
states.vgsForm.unmount();
|
|
7065
7088
|
states.vgsForm = void 0;
|
|
7066
7089
|
}
|
|
@@ -7376,6 +7399,8 @@ var PaymentKit = (() => {
|
|
|
7376
7399
|
submitPayment: defSubmitPayment(localStates),
|
|
7377
7400
|
cleanup: () => {
|
|
7378
7401
|
if (localStates.vgsForm) {
|
|
7402
|
+
localStates.vgsFieldsCleanup?.();
|
|
7403
|
+
localStates.vgsFieldsCleanup = void 0;
|
|
7379
7404
|
localStates.vgsForm.unmount();
|
|
7380
7405
|
localStates.vgsForm = void 0;
|
|
7381
7406
|
}
|