@economist/web-apple-pay 0.1.3-beta.36 → 0.1.3-beta.37
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/index.js
CHANGED
|
@@ -1123,29 +1123,49 @@ var isAppleDeviceOrSafari = () => {
|
|
|
1123
1123
|
var bypassApplePayChecks = () => new URLSearchParams(window.location.search).get("BYPASS_APPLE_PAY_CHECKS") !== null;
|
|
1124
1124
|
var isApplePayAvailable = async () => {
|
|
1125
1125
|
if (bypassApplePayChecks()) {
|
|
1126
|
+
console.log("[ApplePay] bypass active \u2014 displaying button");
|
|
1126
1127
|
return true;
|
|
1127
1128
|
}
|
|
1128
1129
|
const applePaySession = window.ApplePaySession;
|
|
1129
|
-
|
|
1130
|
+
const isAppleDevice = isAppleDeviceOrSafari();
|
|
1131
|
+
console.log("[ApplePay] detection:", JSON.stringify({
|
|
1132
|
+
applePaySessionExists: !!applePaySession,
|
|
1133
|
+
isAppleDevice,
|
|
1134
|
+
userAgent: navigator.userAgent,
|
|
1135
|
+
maxTouchPoints: navigator.maxTouchPoints
|
|
1136
|
+
}, null, 2));
|
|
1137
|
+
if (!applePaySession && !isAppleDevice) {
|
|
1138
|
+
console.log("[ApplePay] not available \u2014 no ApplePaySession and not Apple device");
|
|
1130
1139
|
return false;
|
|
1131
1140
|
}
|
|
1132
1141
|
if (!applePaySession) {
|
|
1142
|
+
console.log("[ApplePay] not available \u2014 Apple device but no ApplePaySession API");
|
|
1133
1143
|
return false;
|
|
1134
1144
|
}
|
|
1135
1145
|
try {
|
|
1136
1146
|
if (typeof applePaySession.canMakePayments !== "function") {
|
|
1147
|
+
console.log("[ApplePay] not available \u2014 canMakePayments is not a function");
|
|
1137
1148
|
return false;
|
|
1138
1149
|
}
|
|
1139
1150
|
if (!applePaySession.canMakePayments()) {
|
|
1151
|
+
console.log("[ApplePay] not available \u2014 canMakePayments returned false");
|
|
1140
1152
|
return false;
|
|
1141
1153
|
}
|
|
1142
1154
|
const merchantId = getApplePayConfig()?.merchantId;
|
|
1143
1155
|
if (!merchantId) {
|
|
1156
|
+
console.log("[ApplePay] not available \u2014 no merchantId configured");
|
|
1144
1157
|
return false;
|
|
1145
1158
|
}
|
|
1146
1159
|
const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
|
|
1147
|
-
|
|
1148
|
-
|
|
1160
|
+
console.log("[ApplePay] canMakePaymentsWithActiveCard:", JSON.stringify({ merchantId, hasActiveCard }, null, 2));
|
|
1161
|
+
if (!hasActiveCard) {
|
|
1162
|
+
console.log("[ApplePay] not available \u2014 no active card for merchant");
|
|
1163
|
+
return false;
|
|
1164
|
+
}
|
|
1165
|
+
console.log("[ApplePay] available \u2014 displaying button");
|
|
1166
|
+
return true;
|
|
1167
|
+
} catch (error) {
|
|
1168
|
+
console.log("[ApplePay] not available \u2014 error:", JSON.stringify({ error: String(error) }, null, 2));
|
|
1149
1169
|
return false;
|
|
1150
1170
|
}
|
|
1151
1171
|
};
|
|
@@ -1118,29 +1118,49 @@ var isAppleDeviceOrSafari = () => {
|
|
|
1118
1118
|
var bypassApplePayChecks = () => new URLSearchParams(window.location.search).get("BYPASS_APPLE_PAY_CHECKS") !== null;
|
|
1119
1119
|
var isApplePayAvailable = async () => {
|
|
1120
1120
|
if (bypassApplePayChecks()) {
|
|
1121
|
+
console.log("[ApplePay] bypass active \u2014 displaying button");
|
|
1121
1122
|
return true;
|
|
1122
1123
|
}
|
|
1123
1124
|
const applePaySession = window.ApplePaySession;
|
|
1124
|
-
|
|
1125
|
+
const isAppleDevice = isAppleDeviceOrSafari();
|
|
1126
|
+
console.log("[ApplePay] detection:", JSON.stringify({
|
|
1127
|
+
applePaySessionExists: !!applePaySession,
|
|
1128
|
+
isAppleDevice,
|
|
1129
|
+
userAgent: navigator.userAgent,
|
|
1130
|
+
maxTouchPoints: navigator.maxTouchPoints
|
|
1131
|
+
}, null, 2));
|
|
1132
|
+
if (!applePaySession && !isAppleDevice) {
|
|
1133
|
+
console.log("[ApplePay] not available \u2014 no ApplePaySession and not Apple device");
|
|
1125
1134
|
return false;
|
|
1126
1135
|
}
|
|
1127
1136
|
if (!applePaySession) {
|
|
1137
|
+
console.log("[ApplePay] not available \u2014 Apple device but no ApplePaySession API");
|
|
1128
1138
|
return false;
|
|
1129
1139
|
}
|
|
1130
1140
|
try {
|
|
1131
1141
|
if (typeof applePaySession.canMakePayments !== "function") {
|
|
1142
|
+
console.log("[ApplePay] not available \u2014 canMakePayments is not a function");
|
|
1132
1143
|
return false;
|
|
1133
1144
|
}
|
|
1134
1145
|
if (!applePaySession.canMakePayments()) {
|
|
1146
|
+
console.log("[ApplePay] not available \u2014 canMakePayments returned false");
|
|
1135
1147
|
return false;
|
|
1136
1148
|
}
|
|
1137
1149
|
const merchantId = getApplePayConfig()?.merchantId;
|
|
1138
1150
|
if (!merchantId) {
|
|
1151
|
+
console.log("[ApplePay] not available \u2014 no merchantId configured");
|
|
1139
1152
|
return false;
|
|
1140
1153
|
}
|
|
1141
1154
|
const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
|
|
1142
|
-
|
|
1143
|
-
|
|
1155
|
+
console.log("[ApplePay] canMakePaymentsWithActiveCard:", JSON.stringify({ merchantId, hasActiveCard }, null, 2));
|
|
1156
|
+
if (!hasActiveCard) {
|
|
1157
|
+
console.log("[ApplePay] not available \u2014 no active card for merchant");
|
|
1158
|
+
return false;
|
|
1159
|
+
}
|
|
1160
|
+
console.log("[ApplePay] available \u2014 displaying button");
|
|
1161
|
+
return true;
|
|
1162
|
+
} catch (error) {
|
|
1163
|
+
console.log("[ApplePay] not available \u2014 error:", JSON.stringify({ error: String(error) }, null, 2));
|
|
1144
1164
|
return false;
|
|
1145
1165
|
}
|
|
1146
1166
|
};
|
|
@@ -1126,29 +1126,49 @@ var isAppleDeviceOrSafari = () => {
|
|
|
1126
1126
|
var bypassApplePayChecks = () => new URLSearchParams(window.location.search).get("BYPASS_APPLE_PAY_CHECKS") !== null;
|
|
1127
1127
|
var isApplePayAvailable = async () => {
|
|
1128
1128
|
if (bypassApplePayChecks()) {
|
|
1129
|
+
console.log("[ApplePay] bypass active \u2014 displaying button");
|
|
1129
1130
|
return true;
|
|
1130
1131
|
}
|
|
1131
1132
|
const applePaySession = window.ApplePaySession;
|
|
1132
|
-
|
|
1133
|
+
const isAppleDevice = isAppleDeviceOrSafari();
|
|
1134
|
+
console.log("[ApplePay] detection:", JSON.stringify({
|
|
1135
|
+
applePaySessionExists: !!applePaySession,
|
|
1136
|
+
isAppleDevice,
|
|
1137
|
+
userAgent: navigator.userAgent,
|
|
1138
|
+
maxTouchPoints: navigator.maxTouchPoints
|
|
1139
|
+
}, null, 2));
|
|
1140
|
+
if (!applePaySession && !isAppleDevice) {
|
|
1141
|
+
console.log("[ApplePay] not available \u2014 no ApplePaySession and not Apple device");
|
|
1133
1142
|
return false;
|
|
1134
1143
|
}
|
|
1135
1144
|
if (!applePaySession) {
|
|
1145
|
+
console.log("[ApplePay] not available \u2014 Apple device but no ApplePaySession API");
|
|
1136
1146
|
return false;
|
|
1137
1147
|
}
|
|
1138
1148
|
try {
|
|
1139
1149
|
if (typeof applePaySession.canMakePayments !== "function") {
|
|
1150
|
+
console.log("[ApplePay] not available \u2014 canMakePayments is not a function");
|
|
1140
1151
|
return false;
|
|
1141
1152
|
}
|
|
1142
1153
|
if (!applePaySession.canMakePayments()) {
|
|
1154
|
+
console.log("[ApplePay] not available \u2014 canMakePayments returned false");
|
|
1143
1155
|
return false;
|
|
1144
1156
|
}
|
|
1145
1157
|
const merchantId = getApplePayConfig()?.merchantId;
|
|
1146
1158
|
if (!merchantId) {
|
|
1159
|
+
console.log("[ApplePay] not available \u2014 no merchantId configured");
|
|
1147
1160
|
return false;
|
|
1148
1161
|
}
|
|
1149
1162
|
const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
|
|
1150
|
-
|
|
1151
|
-
|
|
1163
|
+
console.log("[ApplePay] canMakePaymentsWithActiveCard:", JSON.stringify({ merchantId, hasActiveCard }, null, 2));
|
|
1164
|
+
if (!hasActiveCard) {
|
|
1165
|
+
console.log("[ApplePay] not available \u2014 no active card for merchant");
|
|
1166
|
+
return false;
|
|
1167
|
+
}
|
|
1168
|
+
console.log("[ApplePay] available \u2014 displaying button");
|
|
1169
|
+
return true;
|
|
1170
|
+
} catch (error) {
|
|
1171
|
+
console.log("[ApplePay] not available \u2014 error:", JSON.stringify({ error: String(error) }, null, 2));
|
|
1152
1172
|
return false;
|
|
1153
1173
|
}
|
|
1154
1174
|
};
|
|
@@ -1118,29 +1118,49 @@ var isAppleDeviceOrSafari = () => {
|
|
|
1118
1118
|
var bypassApplePayChecks = () => new URLSearchParams(window.location.search).get("BYPASS_APPLE_PAY_CHECKS") !== null;
|
|
1119
1119
|
var isApplePayAvailable = async () => {
|
|
1120
1120
|
if (bypassApplePayChecks()) {
|
|
1121
|
+
console.log("[ApplePay] bypass active \u2014 displaying button");
|
|
1121
1122
|
return true;
|
|
1122
1123
|
}
|
|
1123
1124
|
const applePaySession = window.ApplePaySession;
|
|
1124
|
-
|
|
1125
|
+
const isAppleDevice = isAppleDeviceOrSafari();
|
|
1126
|
+
console.log("[ApplePay] detection:", JSON.stringify({
|
|
1127
|
+
applePaySessionExists: !!applePaySession,
|
|
1128
|
+
isAppleDevice,
|
|
1129
|
+
userAgent: navigator.userAgent,
|
|
1130
|
+
maxTouchPoints: navigator.maxTouchPoints
|
|
1131
|
+
}, null, 2));
|
|
1132
|
+
if (!applePaySession && !isAppleDevice) {
|
|
1133
|
+
console.log("[ApplePay] not available \u2014 no ApplePaySession and not Apple device");
|
|
1125
1134
|
return false;
|
|
1126
1135
|
}
|
|
1127
1136
|
if (!applePaySession) {
|
|
1137
|
+
console.log("[ApplePay] not available \u2014 Apple device but no ApplePaySession API");
|
|
1128
1138
|
return false;
|
|
1129
1139
|
}
|
|
1130
1140
|
try {
|
|
1131
1141
|
if (typeof applePaySession.canMakePayments !== "function") {
|
|
1142
|
+
console.log("[ApplePay] not available \u2014 canMakePayments is not a function");
|
|
1132
1143
|
return false;
|
|
1133
1144
|
}
|
|
1134
1145
|
if (!applePaySession.canMakePayments()) {
|
|
1146
|
+
console.log("[ApplePay] not available \u2014 canMakePayments returned false");
|
|
1135
1147
|
return false;
|
|
1136
1148
|
}
|
|
1137
1149
|
const merchantId = getApplePayConfig()?.merchantId;
|
|
1138
1150
|
if (!merchantId) {
|
|
1151
|
+
console.log("[ApplePay] not available \u2014 no merchantId configured");
|
|
1139
1152
|
return false;
|
|
1140
1153
|
}
|
|
1141
1154
|
const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
|
|
1142
|
-
|
|
1143
|
-
|
|
1155
|
+
console.log("[ApplePay] canMakePaymentsWithActiveCard:", JSON.stringify({ merchantId, hasActiveCard }, null, 2));
|
|
1156
|
+
if (!hasActiveCard) {
|
|
1157
|
+
console.log("[ApplePay] not available \u2014 no active card for merchant");
|
|
1158
|
+
return false;
|
|
1159
|
+
}
|
|
1160
|
+
console.log("[ApplePay] available \u2014 displaying button");
|
|
1161
|
+
return true;
|
|
1162
|
+
} catch (error) {
|
|
1163
|
+
console.log("[ApplePay] not available \u2014 error:", JSON.stringify({ error: String(error) }, null, 2));
|
|
1144
1164
|
return false;
|
|
1145
1165
|
}
|
|
1146
1166
|
};
|
|
@@ -11,29 +11,49 @@ var isAppleDeviceOrSafari = () => {
|
|
|
11
11
|
var bypassApplePayChecks = () => new URLSearchParams(window.location.search).get("BYPASS_APPLE_PAY_CHECKS") !== null;
|
|
12
12
|
var isApplePayAvailable = async () => {
|
|
13
13
|
if (bypassApplePayChecks()) {
|
|
14
|
+
console.log("[ApplePay] bypass active \u2014 displaying button");
|
|
14
15
|
return true;
|
|
15
16
|
}
|
|
16
17
|
const applePaySession = window.ApplePaySession;
|
|
17
|
-
|
|
18
|
+
const isAppleDevice = isAppleDeviceOrSafari();
|
|
19
|
+
console.log("[ApplePay] detection:", JSON.stringify({
|
|
20
|
+
applePaySessionExists: !!applePaySession,
|
|
21
|
+
isAppleDevice,
|
|
22
|
+
userAgent: navigator.userAgent,
|
|
23
|
+
maxTouchPoints: navigator.maxTouchPoints
|
|
24
|
+
}, null, 2));
|
|
25
|
+
if (!applePaySession && !isAppleDevice) {
|
|
26
|
+
console.log("[ApplePay] not available \u2014 no ApplePaySession and not Apple device");
|
|
18
27
|
return false;
|
|
19
28
|
}
|
|
20
29
|
if (!applePaySession) {
|
|
30
|
+
console.log("[ApplePay] not available \u2014 Apple device but no ApplePaySession API");
|
|
21
31
|
return false;
|
|
22
32
|
}
|
|
23
33
|
try {
|
|
24
34
|
if (typeof applePaySession.canMakePayments !== "function") {
|
|
35
|
+
console.log("[ApplePay] not available \u2014 canMakePayments is not a function");
|
|
25
36
|
return false;
|
|
26
37
|
}
|
|
27
38
|
if (!applePaySession.canMakePayments()) {
|
|
39
|
+
console.log("[ApplePay] not available \u2014 canMakePayments returned false");
|
|
28
40
|
return false;
|
|
29
41
|
}
|
|
30
42
|
const merchantId = getApplePayConfig()?.merchantId;
|
|
31
43
|
if (!merchantId) {
|
|
44
|
+
console.log("[ApplePay] not available \u2014 no merchantId configured");
|
|
32
45
|
return false;
|
|
33
46
|
}
|
|
34
47
|
const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
|
|
35
|
-
|
|
36
|
-
|
|
48
|
+
console.log("[ApplePay] canMakePaymentsWithActiveCard:", JSON.stringify({ merchantId, hasActiveCard }, null, 2));
|
|
49
|
+
if (!hasActiveCard) {
|
|
50
|
+
console.log("[ApplePay] not available \u2014 no active card for merchant");
|
|
51
|
+
return false;
|
|
52
|
+
}
|
|
53
|
+
console.log("[ApplePay] available \u2014 displaying button");
|
|
54
|
+
return true;
|
|
55
|
+
} catch (error) {
|
|
56
|
+
console.log("[ApplePay] not available \u2014 error:", JSON.stringify({ error: String(error) }, null, 2));
|
|
37
57
|
return false;
|
|
38
58
|
}
|
|
39
59
|
};
|
package/dist/src/index.js
CHANGED
|
@@ -1123,29 +1123,49 @@ var isAppleDeviceOrSafari = () => {
|
|
|
1123
1123
|
var bypassApplePayChecks = () => new URLSearchParams(window.location.search).get("BYPASS_APPLE_PAY_CHECKS") !== null;
|
|
1124
1124
|
var isApplePayAvailable = async () => {
|
|
1125
1125
|
if (bypassApplePayChecks()) {
|
|
1126
|
+
console.log("[ApplePay] bypass active \u2014 displaying button");
|
|
1126
1127
|
return true;
|
|
1127
1128
|
}
|
|
1128
1129
|
const applePaySession = window.ApplePaySession;
|
|
1129
|
-
|
|
1130
|
+
const isAppleDevice = isAppleDeviceOrSafari();
|
|
1131
|
+
console.log("[ApplePay] detection:", JSON.stringify({
|
|
1132
|
+
applePaySessionExists: !!applePaySession,
|
|
1133
|
+
isAppleDevice,
|
|
1134
|
+
userAgent: navigator.userAgent,
|
|
1135
|
+
maxTouchPoints: navigator.maxTouchPoints
|
|
1136
|
+
}, null, 2));
|
|
1137
|
+
if (!applePaySession && !isAppleDevice) {
|
|
1138
|
+
console.log("[ApplePay] not available \u2014 no ApplePaySession and not Apple device");
|
|
1130
1139
|
return false;
|
|
1131
1140
|
}
|
|
1132
1141
|
if (!applePaySession) {
|
|
1142
|
+
console.log("[ApplePay] not available \u2014 Apple device but no ApplePaySession API");
|
|
1133
1143
|
return false;
|
|
1134
1144
|
}
|
|
1135
1145
|
try {
|
|
1136
1146
|
if (typeof applePaySession.canMakePayments !== "function") {
|
|
1147
|
+
console.log("[ApplePay] not available \u2014 canMakePayments is not a function");
|
|
1137
1148
|
return false;
|
|
1138
1149
|
}
|
|
1139
1150
|
if (!applePaySession.canMakePayments()) {
|
|
1151
|
+
console.log("[ApplePay] not available \u2014 canMakePayments returned false");
|
|
1140
1152
|
return false;
|
|
1141
1153
|
}
|
|
1142
1154
|
const merchantId = getApplePayConfig()?.merchantId;
|
|
1143
1155
|
if (!merchantId) {
|
|
1156
|
+
console.log("[ApplePay] not available \u2014 no merchantId configured");
|
|
1144
1157
|
return false;
|
|
1145
1158
|
}
|
|
1146
1159
|
const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
|
|
1147
|
-
|
|
1148
|
-
|
|
1160
|
+
console.log("[ApplePay] canMakePaymentsWithActiveCard:", JSON.stringify({ merchantId, hasActiveCard }, null, 2));
|
|
1161
|
+
if (!hasActiveCard) {
|
|
1162
|
+
console.log("[ApplePay] not available \u2014 no active card for merchant");
|
|
1163
|
+
return false;
|
|
1164
|
+
}
|
|
1165
|
+
console.log("[ApplePay] available \u2014 displaying button");
|
|
1166
|
+
return true;
|
|
1167
|
+
} catch (error) {
|
|
1168
|
+
console.log("[ApplePay] not available \u2014 error:", JSON.stringify({ error: String(error) }, null, 2));
|
|
1149
1169
|
return false;
|
|
1150
1170
|
}
|
|
1151
1171
|
};
|
package/package.json
CHANGED