@economist/web-apple-pay 0.1.3-beta.37 → 0.1.3-beta.38
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,49 +1123,29 @@ 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");
|
|
1127
1126
|
return true;
|
|
1128
1127
|
}
|
|
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");
|
|
1128
|
+
if (!isAppleDeviceOrSafari()) {
|
|
1139
1129
|
return false;
|
|
1140
1130
|
}
|
|
1131
|
+
const applePaySession = window.ApplePaySession;
|
|
1141
1132
|
if (!applePaySession) {
|
|
1142
|
-
console.log("[ApplePay] not available \u2014 Apple device but no ApplePaySession API");
|
|
1143
1133
|
return false;
|
|
1144
1134
|
}
|
|
1145
1135
|
try {
|
|
1146
1136
|
if (typeof applePaySession.canMakePayments !== "function") {
|
|
1147
|
-
console.log("[ApplePay] not available \u2014 canMakePayments is not a function");
|
|
1148
1137
|
return false;
|
|
1149
1138
|
}
|
|
1150
1139
|
if (!applePaySession.canMakePayments()) {
|
|
1151
|
-
console.log("[ApplePay] not available \u2014 canMakePayments returned false");
|
|
1152
1140
|
return false;
|
|
1153
1141
|
}
|
|
1154
1142
|
const merchantId = getApplePayConfig()?.merchantId;
|
|
1155
1143
|
if (!merchantId) {
|
|
1156
|
-
console.log("[ApplePay] not available \u2014 no merchantId configured");
|
|
1157
1144
|
return false;
|
|
1158
1145
|
}
|
|
1159
1146
|
const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
|
|
1160
|
-
|
|
1161
|
-
|
|
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));
|
|
1147
|
+
return hasActiveCard;
|
|
1148
|
+
} catch {
|
|
1169
1149
|
return false;
|
|
1170
1150
|
}
|
|
1171
1151
|
};
|
|
@@ -1118,49 +1118,29 @@ 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");
|
|
1122
1121
|
return true;
|
|
1123
1122
|
}
|
|
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");
|
|
1123
|
+
if (!isAppleDeviceOrSafari()) {
|
|
1134
1124
|
return false;
|
|
1135
1125
|
}
|
|
1126
|
+
const applePaySession = window.ApplePaySession;
|
|
1136
1127
|
if (!applePaySession) {
|
|
1137
|
-
console.log("[ApplePay] not available \u2014 Apple device but no ApplePaySession API");
|
|
1138
1128
|
return false;
|
|
1139
1129
|
}
|
|
1140
1130
|
try {
|
|
1141
1131
|
if (typeof applePaySession.canMakePayments !== "function") {
|
|
1142
|
-
console.log("[ApplePay] not available \u2014 canMakePayments is not a function");
|
|
1143
1132
|
return false;
|
|
1144
1133
|
}
|
|
1145
1134
|
if (!applePaySession.canMakePayments()) {
|
|
1146
|
-
console.log("[ApplePay] not available \u2014 canMakePayments returned false");
|
|
1147
1135
|
return false;
|
|
1148
1136
|
}
|
|
1149
1137
|
const merchantId = getApplePayConfig()?.merchantId;
|
|
1150
1138
|
if (!merchantId) {
|
|
1151
|
-
console.log("[ApplePay] not available \u2014 no merchantId configured");
|
|
1152
1139
|
return false;
|
|
1153
1140
|
}
|
|
1154
1141
|
const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
|
|
1155
|
-
|
|
1156
|
-
|
|
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));
|
|
1142
|
+
return hasActiveCard;
|
|
1143
|
+
} catch {
|
|
1164
1144
|
return false;
|
|
1165
1145
|
}
|
|
1166
1146
|
};
|
|
@@ -1126,49 +1126,29 @@ 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");
|
|
1130
1129
|
return true;
|
|
1131
1130
|
}
|
|
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");
|
|
1131
|
+
if (!isAppleDeviceOrSafari()) {
|
|
1142
1132
|
return false;
|
|
1143
1133
|
}
|
|
1134
|
+
const applePaySession = window.ApplePaySession;
|
|
1144
1135
|
if (!applePaySession) {
|
|
1145
|
-
console.log("[ApplePay] not available \u2014 Apple device but no ApplePaySession API");
|
|
1146
1136
|
return false;
|
|
1147
1137
|
}
|
|
1148
1138
|
try {
|
|
1149
1139
|
if (typeof applePaySession.canMakePayments !== "function") {
|
|
1150
|
-
console.log("[ApplePay] not available \u2014 canMakePayments is not a function");
|
|
1151
1140
|
return false;
|
|
1152
1141
|
}
|
|
1153
1142
|
if (!applePaySession.canMakePayments()) {
|
|
1154
|
-
console.log("[ApplePay] not available \u2014 canMakePayments returned false");
|
|
1155
1143
|
return false;
|
|
1156
1144
|
}
|
|
1157
1145
|
const merchantId = getApplePayConfig()?.merchantId;
|
|
1158
1146
|
if (!merchantId) {
|
|
1159
|
-
console.log("[ApplePay] not available \u2014 no merchantId configured");
|
|
1160
1147
|
return false;
|
|
1161
1148
|
}
|
|
1162
1149
|
const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
|
|
1163
|
-
|
|
1164
|
-
|
|
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));
|
|
1150
|
+
return hasActiveCard;
|
|
1151
|
+
} catch {
|
|
1172
1152
|
return false;
|
|
1173
1153
|
}
|
|
1174
1154
|
};
|
|
@@ -1118,49 +1118,29 @@ 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");
|
|
1122
1121
|
return true;
|
|
1123
1122
|
}
|
|
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");
|
|
1123
|
+
if (!isAppleDeviceOrSafari()) {
|
|
1134
1124
|
return false;
|
|
1135
1125
|
}
|
|
1126
|
+
const applePaySession = window.ApplePaySession;
|
|
1136
1127
|
if (!applePaySession) {
|
|
1137
|
-
console.log("[ApplePay] not available \u2014 Apple device but no ApplePaySession API");
|
|
1138
1128
|
return false;
|
|
1139
1129
|
}
|
|
1140
1130
|
try {
|
|
1141
1131
|
if (typeof applePaySession.canMakePayments !== "function") {
|
|
1142
|
-
console.log("[ApplePay] not available \u2014 canMakePayments is not a function");
|
|
1143
1132
|
return false;
|
|
1144
1133
|
}
|
|
1145
1134
|
if (!applePaySession.canMakePayments()) {
|
|
1146
|
-
console.log("[ApplePay] not available \u2014 canMakePayments returned false");
|
|
1147
1135
|
return false;
|
|
1148
1136
|
}
|
|
1149
1137
|
const merchantId = getApplePayConfig()?.merchantId;
|
|
1150
1138
|
if (!merchantId) {
|
|
1151
|
-
console.log("[ApplePay] not available \u2014 no merchantId configured");
|
|
1152
1139
|
return false;
|
|
1153
1140
|
}
|
|
1154
1141
|
const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
|
|
1155
|
-
|
|
1156
|
-
|
|
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));
|
|
1142
|
+
return hasActiveCard;
|
|
1143
|
+
} catch {
|
|
1164
1144
|
return false;
|
|
1165
1145
|
}
|
|
1166
1146
|
};
|
|
@@ -11,49 +11,29 @@ 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");
|
|
15
14
|
return true;
|
|
16
15
|
}
|
|
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");
|
|
16
|
+
if (!isAppleDeviceOrSafari()) {
|
|
27
17
|
return false;
|
|
28
18
|
}
|
|
19
|
+
const applePaySession = window.ApplePaySession;
|
|
29
20
|
if (!applePaySession) {
|
|
30
|
-
console.log("[ApplePay] not available \u2014 Apple device but no ApplePaySession API");
|
|
31
21
|
return false;
|
|
32
22
|
}
|
|
33
23
|
try {
|
|
34
24
|
if (typeof applePaySession.canMakePayments !== "function") {
|
|
35
|
-
console.log("[ApplePay] not available \u2014 canMakePayments is not a function");
|
|
36
25
|
return false;
|
|
37
26
|
}
|
|
38
27
|
if (!applePaySession.canMakePayments()) {
|
|
39
|
-
console.log("[ApplePay] not available \u2014 canMakePayments returned false");
|
|
40
28
|
return false;
|
|
41
29
|
}
|
|
42
30
|
const merchantId = getApplePayConfig()?.merchantId;
|
|
43
31
|
if (!merchantId) {
|
|
44
|
-
console.log("[ApplePay] not available \u2014 no merchantId configured");
|
|
45
32
|
return false;
|
|
46
33
|
}
|
|
47
34
|
const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
|
|
48
|
-
|
|
49
|
-
|
|
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));
|
|
35
|
+
return hasActiveCard;
|
|
36
|
+
} catch {
|
|
57
37
|
return false;
|
|
58
38
|
}
|
|
59
39
|
};
|
package/dist/src/index.js
CHANGED
|
@@ -1123,49 +1123,29 @@ 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");
|
|
1127
1126
|
return true;
|
|
1128
1127
|
}
|
|
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");
|
|
1128
|
+
if (!isAppleDeviceOrSafari()) {
|
|
1139
1129
|
return false;
|
|
1140
1130
|
}
|
|
1131
|
+
const applePaySession = window.ApplePaySession;
|
|
1141
1132
|
if (!applePaySession) {
|
|
1142
|
-
console.log("[ApplePay] not available \u2014 Apple device but no ApplePaySession API");
|
|
1143
1133
|
return false;
|
|
1144
1134
|
}
|
|
1145
1135
|
try {
|
|
1146
1136
|
if (typeof applePaySession.canMakePayments !== "function") {
|
|
1147
|
-
console.log("[ApplePay] not available \u2014 canMakePayments is not a function");
|
|
1148
1137
|
return false;
|
|
1149
1138
|
}
|
|
1150
1139
|
if (!applePaySession.canMakePayments()) {
|
|
1151
|
-
console.log("[ApplePay] not available \u2014 canMakePayments returned false");
|
|
1152
1140
|
return false;
|
|
1153
1141
|
}
|
|
1154
1142
|
const merchantId = getApplePayConfig()?.merchantId;
|
|
1155
1143
|
if (!merchantId) {
|
|
1156
|
-
console.log("[ApplePay] not available \u2014 no merchantId configured");
|
|
1157
1144
|
return false;
|
|
1158
1145
|
}
|
|
1159
1146
|
const hasActiveCard = await applePaySession.canMakePaymentsWithActiveCard(merchantId);
|
|
1160
|
-
|
|
1161
|
-
|
|
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));
|
|
1147
|
+
return hasActiveCard;
|
|
1148
|
+
} catch {
|
|
1169
1149
|
return false;
|
|
1170
1150
|
}
|
|
1171
1151
|
};
|
package/package.json
CHANGED