@economist/web-apple-pay 0.1.3-beta.34 → 0.1.3-beta.36
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
|
@@ -1125,10 +1125,10 @@ var isApplePayAvailable = async () => {
|
|
|
1125
1125
|
if (bypassApplePayChecks()) {
|
|
1126
1126
|
return true;
|
|
1127
1127
|
}
|
|
1128
|
-
|
|
1128
|
+
const applePaySession = window.ApplePaySession;
|
|
1129
|
+
if (!applePaySession && !isAppleDeviceOrSafari()) {
|
|
1129
1130
|
return false;
|
|
1130
1131
|
}
|
|
1131
|
-
const applePaySession = window.ApplePaySession;
|
|
1132
1132
|
if (!applePaySession) {
|
|
1133
1133
|
return false;
|
|
1134
1134
|
}
|
|
@@ -2040,203 +2040,18 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2040
2040
|
// ─── Render pipeline ────────────────────────────────────────────────────────
|
|
2041
2041
|
async #run() {
|
|
2042
2042
|
try {
|
|
2043
|
-
console.log(
|
|
2044
|
-
"[ApplePayButton] #run start",
|
|
2045
|
-
JSON.stringify(
|
|
2046
|
-
{
|
|
2047
|
-
country: this.#country,
|
|
2048
|
-
offer_sku: this.#offer?.sku_id,
|
|
2049
|
-
entry_point: this.#entryPoint
|
|
2050
|
-
},
|
|
2051
|
-
null,
|
|
2052
|
-
2
|
|
2053
|
-
)
|
|
2054
|
-
);
|
|
2055
2043
|
this.#renderTemplate();
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
{
|
|
2060
|
-
country: this.#country,
|
|
2061
|
-
offer_sku: this.#offer?.sku_id
|
|
2062
|
-
},
|
|
2063
|
-
null,
|
|
2064
|
-
2
|
|
2065
|
-
)
|
|
2066
|
-
);
|
|
2067
|
-
const availabilityBlocked = await this.#checkAvailability();
|
|
2068
|
-
console.log(
|
|
2069
|
-
"[ApplePayButton] #checkAvailability result",
|
|
2070
|
-
JSON.stringify(
|
|
2071
|
-
{
|
|
2072
|
-
blocked: availabilityBlocked,
|
|
2073
|
-
country: this.#country,
|
|
2074
|
-
offer_sku: this.#offer?.sku_id
|
|
2075
|
-
},
|
|
2076
|
-
null,
|
|
2077
|
-
2
|
|
2078
|
-
)
|
|
2079
|
-
);
|
|
2080
|
-
if (availabilityBlocked) {
|
|
2081
|
-
console.log(
|
|
2082
|
-
"[ApplePayButton] #run early return after #checkAvailability",
|
|
2083
|
-
JSON.stringify(
|
|
2084
|
-
{
|
|
2085
|
-
country: this.#country,
|
|
2086
|
-
offer_sku: this.#offer?.sku_id
|
|
2087
|
-
},
|
|
2088
|
-
null,
|
|
2089
|
-
2
|
|
2090
|
-
)
|
|
2091
|
-
);
|
|
2092
|
-
return;
|
|
2093
|
-
}
|
|
2094
|
-
const offerMissing = this.#checkOffer();
|
|
2095
|
-
console.log(
|
|
2096
|
-
"[ApplePayButton] #checkOffer result",
|
|
2097
|
-
JSON.stringify(
|
|
2098
|
-
{
|
|
2099
|
-
blocked: offerMissing,
|
|
2100
|
-
country: this.#country,
|
|
2101
|
-
offer_sku: this.#offer?.sku_id
|
|
2102
|
-
},
|
|
2103
|
-
null,
|
|
2104
|
-
2
|
|
2105
|
-
)
|
|
2106
|
-
);
|
|
2107
|
-
if (offerMissing) {
|
|
2108
|
-
console.log(
|
|
2109
|
-
"[ApplePayButton] #run early return after #checkOffer",
|
|
2110
|
-
JSON.stringify(
|
|
2111
|
-
{
|
|
2112
|
-
country: this.#country,
|
|
2113
|
-
offer_sku: this.#offer?.sku_id
|
|
2114
|
-
},
|
|
2115
|
-
null,
|
|
2116
|
-
2
|
|
2117
|
-
)
|
|
2118
|
-
);
|
|
2119
|
-
return;
|
|
2120
|
-
}
|
|
2121
|
-
const sessionBlocked = await this.#checkSession();
|
|
2122
|
-
console.log(
|
|
2123
|
-
"[ApplePayButton] #checkSession result",
|
|
2124
|
-
JSON.stringify(
|
|
2125
|
-
{
|
|
2126
|
-
blocked: sessionBlocked,
|
|
2127
|
-
country: this.#country,
|
|
2128
|
-
offer_sku: this.#offer?.sku_id,
|
|
2129
|
-
session_user_type: this.#sessionData?.userType,
|
|
2130
|
-
session_logged_in: this.#sessionData?.loggedIn
|
|
2131
|
-
},
|
|
2132
|
-
null,
|
|
2133
|
-
2
|
|
2134
|
-
)
|
|
2135
|
-
);
|
|
2136
|
-
if (sessionBlocked) {
|
|
2137
|
-
console.log(
|
|
2138
|
-
"[ApplePayButton] #run early return after #checkSession",
|
|
2139
|
-
JSON.stringify(
|
|
2140
|
-
{
|
|
2141
|
-
country: this.#country,
|
|
2142
|
-
offer_sku: this.#offer?.sku_id
|
|
2143
|
-
},
|
|
2144
|
-
null,
|
|
2145
|
-
2
|
|
2146
|
-
)
|
|
2147
|
-
);
|
|
2148
|
-
return;
|
|
2149
|
-
}
|
|
2044
|
+
if (await this.#checkAvailability()) return;
|
|
2045
|
+
if (this.#checkOffer()) return;
|
|
2046
|
+
if (await this.#checkSession()) return;
|
|
2150
2047
|
this.#captureReturnUrl();
|
|
2151
|
-
console.log(
|
|
2152
|
-
"[ApplePayButton] #captureReturnUrl done",
|
|
2153
|
-
JSON.stringify(
|
|
2154
|
-
{
|
|
2155
|
-
return_url: this.#returnUrl
|
|
2156
|
-
},
|
|
2157
|
-
null,
|
|
2158
|
-
2
|
|
2159
|
-
)
|
|
2160
|
-
);
|
|
2161
2048
|
this.#computeBillingCountries();
|
|
2162
|
-
|
|
2163
|
-
"[ApplePayButton] #computeBillingCountries done",
|
|
2164
|
-
JSON.stringify(
|
|
2165
|
-
{
|
|
2166
|
-
supported_billing_countries: this.#supportedBillingCountries
|
|
2167
|
-
},
|
|
2168
|
-
null,
|
|
2169
|
-
2
|
|
2170
|
-
)
|
|
2171
|
-
);
|
|
2172
|
-
const optionsBlocked = await this.#fetchAndCacheOptions();
|
|
2173
|
-
console.log(
|
|
2174
|
-
"[ApplePayButton] #fetchAndCacheOptions result",
|
|
2175
|
-
JSON.stringify(
|
|
2176
|
-
{
|
|
2177
|
-
blocked: optionsBlocked,
|
|
2178
|
-
has_apple_pay_option: Boolean(this.#paymentOptions?.options?.apple_pay)
|
|
2179
|
-
},
|
|
2180
|
-
null,
|
|
2181
|
-
2
|
|
2182
|
-
)
|
|
2183
|
-
);
|
|
2184
|
-
if (optionsBlocked) {
|
|
2185
|
-
console.log(
|
|
2186
|
-
"[ApplePayButton] #run early return after #fetchAndCacheOptions",
|
|
2187
|
-
JSON.stringify(
|
|
2188
|
-
{
|
|
2189
|
-
country: this.#country,
|
|
2190
|
-
offer_sku: this.#offer?.sku_id
|
|
2191
|
-
},
|
|
2192
|
-
null,
|
|
2193
|
-
2
|
|
2194
|
-
)
|
|
2195
|
-
);
|
|
2196
|
-
return;
|
|
2197
|
-
}
|
|
2049
|
+
if (await this.#fetchAndCacheOptions()) return;
|
|
2198
2050
|
this.#finishLoading();
|
|
2199
|
-
|
|
2200
|
-
"[ApplePayButton] #finishLoading done",
|
|
2201
|
-
JSON.stringify(
|
|
2202
|
-
{
|
|
2203
|
-
country: this.#country,
|
|
2204
|
-
offer_sku: this.#offer?.sku_id
|
|
2205
|
-
},
|
|
2206
|
-
null,
|
|
2207
|
-
2
|
|
2208
|
-
)
|
|
2209
|
-
);
|
|
2210
|
-
} catch (error) {
|
|
2211
|
-
console.log(
|
|
2212
|
-
"[ApplePayButton] #run failed",
|
|
2213
|
-
JSON.stringify(
|
|
2214
|
-
{
|
|
2215
|
-
country: this.#country,
|
|
2216
|
-
offer_sku: this.#offer?.sku_id,
|
|
2217
|
-
error: error instanceof Error ? {
|
|
2218
|
-
name: error.name,
|
|
2219
|
-
message: error.message,
|
|
2220
|
-
stack: error.stack
|
|
2221
|
-
} : error
|
|
2222
|
-
},
|
|
2223
|
-
null,
|
|
2224
|
-
2
|
|
2225
|
-
)
|
|
2226
|
-
);
|
|
2051
|
+
} catch {
|
|
2227
2052
|
this.style.display = "none";
|
|
2228
2053
|
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2229
2054
|
} finally {
|
|
2230
|
-
console.log(
|
|
2231
|
-
"[ApplePayButton] #run finally",
|
|
2232
|
-
JSON.stringify(
|
|
2233
|
-
{
|
|
2234
|
-
rendering: this.#rendering
|
|
2235
|
-
},
|
|
2236
|
-
null,
|
|
2237
|
-
2
|
|
2238
|
-
)
|
|
2239
|
-
);
|
|
2240
2055
|
this.#rendering = false;
|
|
2241
2056
|
}
|
|
2242
2057
|
}
|
|
@@ -1120,10 +1120,10 @@ var isApplePayAvailable = async () => {
|
|
|
1120
1120
|
if (bypassApplePayChecks()) {
|
|
1121
1121
|
return true;
|
|
1122
1122
|
}
|
|
1123
|
-
|
|
1123
|
+
const applePaySession = window.ApplePaySession;
|
|
1124
|
+
if (!applePaySession && !isAppleDeviceOrSafari()) {
|
|
1124
1125
|
return false;
|
|
1125
1126
|
}
|
|
1126
|
-
const applePaySession = window.ApplePaySession;
|
|
1127
1127
|
if (!applePaySession) {
|
|
1128
1128
|
return false;
|
|
1129
1129
|
}
|
|
@@ -2035,203 +2035,18 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2035
2035
|
// ─── Render pipeline ────────────────────────────────────────────────────────
|
|
2036
2036
|
async #run() {
|
|
2037
2037
|
try {
|
|
2038
|
-
console.log(
|
|
2039
|
-
"[ApplePayButton] #run start",
|
|
2040
|
-
JSON.stringify(
|
|
2041
|
-
{
|
|
2042
|
-
country: this.#country,
|
|
2043
|
-
offer_sku: this.#offer?.sku_id,
|
|
2044
|
-
entry_point: this.#entryPoint
|
|
2045
|
-
},
|
|
2046
|
-
null,
|
|
2047
|
-
2
|
|
2048
|
-
)
|
|
2049
|
-
);
|
|
2050
2038
|
this.#renderTemplate();
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
{
|
|
2055
|
-
country: this.#country,
|
|
2056
|
-
offer_sku: this.#offer?.sku_id
|
|
2057
|
-
},
|
|
2058
|
-
null,
|
|
2059
|
-
2
|
|
2060
|
-
)
|
|
2061
|
-
);
|
|
2062
|
-
const availabilityBlocked = await this.#checkAvailability();
|
|
2063
|
-
console.log(
|
|
2064
|
-
"[ApplePayButton] #checkAvailability result",
|
|
2065
|
-
JSON.stringify(
|
|
2066
|
-
{
|
|
2067
|
-
blocked: availabilityBlocked,
|
|
2068
|
-
country: this.#country,
|
|
2069
|
-
offer_sku: this.#offer?.sku_id
|
|
2070
|
-
},
|
|
2071
|
-
null,
|
|
2072
|
-
2
|
|
2073
|
-
)
|
|
2074
|
-
);
|
|
2075
|
-
if (availabilityBlocked) {
|
|
2076
|
-
console.log(
|
|
2077
|
-
"[ApplePayButton] #run early return after #checkAvailability",
|
|
2078
|
-
JSON.stringify(
|
|
2079
|
-
{
|
|
2080
|
-
country: this.#country,
|
|
2081
|
-
offer_sku: this.#offer?.sku_id
|
|
2082
|
-
},
|
|
2083
|
-
null,
|
|
2084
|
-
2
|
|
2085
|
-
)
|
|
2086
|
-
);
|
|
2087
|
-
return;
|
|
2088
|
-
}
|
|
2089
|
-
const offerMissing = this.#checkOffer();
|
|
2090
|
-
console.log(
|
|
2091
|
-
"[ApplePayButton] #checkOffer result",
|
|
2092
|
-
JSON.stringify(
|
|
2093
|
-
{
|
|
2094
|
-
blocked: offerMissing,
|
|
2095
|
-
country: this.#country,
|
|
2096
|
-
offer_sku: this.#offer?.sku_id
|
|
2097
|
-
},
|
|
2098
|
-
null,
|
|
2099
|
-
2
|
|
2100
|
-
)
|
|
2101
|
-
);
|
|
2102
|
-
if (offerMissing) {
|
|
2103
|
-
console.log(
|
|
2104
|
-
"[ApplePayButton] #run early return after #checkOffer",
|
|
2105
|
-
JSON.stringify(
|
|
2106
|
-
{
|
|
2107
|
-
country: this.#country,
|
|
2108
|
-
offer_sku: this.#offer?.sku_id
|
|
2109
|
-
},
|
|
2110
|
-
null,
|
|
2111
|
-
2
|
|
2112
|
-
)
|
|
2113
|
-
);
|
|
2114
|
-
return;
|
|
2115
|
-
}
|
|
2116
|
-
const sessionBlocked = await this.#checkSession();
|
|
2117
|
-
console.log(
|
|
2118
|
-
"[ApplePayButton] #checkSession result",
|
|
2119
|
-
JSON.stringify(
|
|
2120
|
-
{
|
|
2121
|
-
blocked: sessionBlocked,
|
|
2122
|
-
country: this.#country,
|
|
2123
|
-
offer_sku: this.#offer?.sku_id,
|
|
2124
|
-
session_user_type: this.#sessionData?.userType,
|
|
2125
|
-
session_logged_in: this.#sessionData?.loggedIn
|
|
2126
|
-
},
|
|
2127
|
-
null,
|
|
2128
|
-
2
|
|
2129
|
-
)
|
|
2130
|
-
);
|
|
2131
|
-
if (sessionBlocked) {
|
|
2132
|
-
console.log(
|
|
2133
|
-
"[ApplePayButton] #run early return after #checkSession",
|
|
2134
|
-
JSON.stringify(
|
|
2135
|
-
{
|
|
2136
|
-
country: this.#country,
|
|
2137
|
-
offer_sku: this.#offer?.sku_id
|
|
2138
|
-
},
|
|
2139
|
-
null,
|
|
2140
|
-
2
|
|
2141
|
-
)
|
|
2142
|
-
);
|
|
2143
|
-
return;
|
|
2144
|
-
}
|
|
2039
|
+
if (await this.#checkAvailability()) return;
|
|
2040
|
+
if (this.#checkOffer()) return;
|
|
2041
|
+
if (await this.#checkSession()) return;
|
|
2145
2042
|
this.#captureReturnUrl();
|
|
2146
|
-
console.log(
|
|
2147
|
-
"[ApplePayButton] #captureReturnUrl done",
|
|
2148
|
-
JSON.stringify(
|
|
2149
|
-
{
|
|
2150
|
-
return_url: this.#returnUrl
|
|
2151
|
-
},
|
|
2152
|
-
null,
|
|
2153
|
-
2
|
|
2154
|
-
)
|
|
2155
|
-
);
|
|
2156
2043
|
this.#computeBillingCountries();
|
|
2157
|
-
|
|
2158
|
-
"[ApplePayButton] #computeBillingCountries done",
|
|
2159
|
-
JSON.stringify(
|
|
2160
|
-
{
|
|
2161
|
-
supported_billing_countries: this.#supportedBillingCountries
|
|
2162
|
-
},
|
|
2163
|
-
null,
|
|
2164
|
-
2
|
|
2165
|
-
)
|
|
2166
|
-
);
|
|
2167
|
-
const optionsBlocked = await this.#fetchAndCacheOptions();
|
|
2168
|
-
console.log(
|
|
2169
|
-
"[ApplePayButton] #fetchAndCacheOptions result",
|
|
2170
|
-
JSON.stringify(
|
|
2171
|
-
{
|
|
2172
|
-
blocked: optionsBlocked,
|
|
2173
|
-
has_apple_pay_option: Boolean(this.#paymentOptions?.options?.apple_pay)
|
|
2174
|
-
},
|
|
2175
|
-
null,
|
|
2176
|
-
2
|
|
2177
|
-
)
|
|
2178
|
-
);
|
|
2179
|
-
if (optionsBlocked) {
|
|
2180
|
-
console.log(
|
|
2181
|
-
"[ApplePayButton] #run early return after #fetchAndCacheOptions",
|
|
2182
|
-
JSON.stringify(
|
|
2183
|
-
{
|
|
2184
|
-
country: this.#country,
|
|
2185
|
-
offer_sku: this.#offer?.sku_id
|
|
2186
|
-
},
|
|
2187
|
-
null,
|
|
2188
|
-
2
|
|
2189
|
-
)
|
|
2190
|
-
);
|
|
2191
|
-
return;
|
|
2192
|
-
}
|
|
2044
|
+
if (await this.#fetchAndCacheOptions()) return;
|
|
2193
2045
|
this.#finishLoading();
|
|
2194
|
-
|
|
2195
|
-
"[ApplePayButton] #finishLoading done",
|
|
2196
|
-
JSON.stringify(
|
|
2197
|
-
{
|
|
2198
|
-
country: this.#country,
|
|
2199
|
-
offer_sku: this.#offer?.sku_id
|
|
2200
|
-
},
|
|
2201
|
-
null,
|
|
2202
|
-
2
|
|
2203
|
-
)
|
|
2204
|
-
);
|
|
2205
|
-
} catch (error) {
|
|
2206
|
-
console.log(
|
|
2207
|
-
"[ApplePayButton] #run failed",
|
|
2208
|
-
JSON.stringify(
|
|
2209
|
-
{
|
|
2210
|
-
country: this.#country,
|
|
2211
|
-
offer_sku: this.#offer?.sku_id,
|
|
2212
|
-
error: error instanceof Error ? {
|
|
2213
|
-
name: error.name,
|
|
2214
|
-
message: error.message,
|
|
2215
|
-
stack: error.stack
|
|
2216
|
-
} : error
|
|
2217
|
-
},
|
|
2218
|
-
null,
|
|
2219
|
-
2
|
|
2220
|
-
)
|
|
2221
|
-
);
|
|
2046
|
+
} catch {
|
|
2222
2047
|
this.style.display = "none";
|
|
2223
2048
|
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2224
2049
|
} finally {
|
|
2225
|
-
console.log(
|
|
2226
|
-
"[ApplePayButton] #run finally",
|
|
2227
|
-
JSON.stringify(
|
|
2228
|
-
{
|
|
2229
|
-
rendering: this.#rendering
|
|
2230
|
-
},
|
|
2231
|
-
null,
|
|
2232
|
-
2
|
|
2233
|
-
)
|
|
2234
|
-
);
|
|
2235
2050
|
this.#rendering = false;
|
|
2236
2051
|
}
|
|
2237
2052
|
}
|
|
@@ -1128,10 +1128,10 @@ var isApplePayAvailable = async () => {
|
|
|
1128
1128
|
if (bypassApplePayChecks()) {
|
|
1129
1129
|
return true;
|
|
1130
1130
|
}
|
|
1131
|
-
|
|
1131
|
+
const applePaySession = window.ApplePaySession;
|
|
1132
|
+
if (!applePaySession && !isAppleDeviceOrSafari()) {
|
|
1132
1133
|
return false;
|
|
1133
1134
|
}
|
|
1134
|
-
const applePaySession = window.ApplePaySession;
|
|
1135
1135
|
if (!applePaySession) {
|
|
1136
1136
|
return false;
|
|
1137
1137
|
}
|
|
@@ -2043,203 +2043,18 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2043
2043
|
// ─── Render pipeline ────────────────────────────────────────────────────────
|
|
2044
2044
|
async #run() {
|
|
2045
2045
|
try {
|
|
2046
|
-
console.log(
|
|
2047
|
-
"[ApplePayButton] #run start",
|
|
2048
|
-
JSON.stringify(
|
|
2049
|
-
{
|
|
2050
|
-
country: this.#country,
|
|
2051
|
-
offer_sku: this.#offer?.sku_id,
|
|
2052
|
-
entry_point: this.#entryPoint
|
|
2053
|
-
},
|
|
2054
|
-
null,
|
|
2055
|
-
2
|
|
2056
|
-
)
|
|
2057
|
-
);
|
|
2058
2046
|
this.#renderTemplate();
|
|
2059
|
-
|
|
2060
|
-
|
|
2061
|
-
|
|
2062
|
-
{
|
|
2063
|
-
country: this.#country,
|
|
2064
|
-
offer_sku: this.#offer?.sku_id
|
|
2065
|
-
},
|
|
2066
|
-
null,
|
|
2067
|
-
2
|
|
2068
|
-
)
|
|
2069
|
-
);
|
|
2070
|
-
const availabilityBlocked = await this.#checkAvailability();
|
|
2071
|
-
console.log(
|
|
2072
|
-
"[ApplePayButton] #checkAvailability result",
|
|
2073
|
-
JSON.stringify(
|
|
2074
|
-
{
|
|
2075
|
-
blocked: availabilityBlocked,
|
|
2076
|
-
country: this.#country,
|
|
2077
|
-
offer_sku: this.#offer?.sku_id
|
|
2078
|
-
},
|
|
2079
|
-
null,
|
|
2080
|
-
2
|
|
2081
|
-
)
|
|
2082
|
-
);
|
|
2083
|
-
if (availabilityBlocked) {
|
|
2084
|
-
console.log(
|
|
2085
|
-
"[ApplePayButton] #run early return after #checkAvailability",
|
|
2086
|
-
JSON.stringify(
|
|
2087
|
-
{
|
|
2088
|
-
country: this.#country,
|
|
2089
|
-
offer_sku: this.#offer?.sku_id
|
|
2090
|
-
},
|
|
2091
|
-
null,
|
|
2092
|
-
2
|
|
2093
|
-
)
|
|
2094
|
-
);
|
|
2095
|
-
return;
|
|
2096
|
-
}
|
|
2097
|
-
const offerMissing = this.#checkOffer();
|
|
2098
|
-
console.log(
|
|
2099
|
-
"[ApplePayButton] #checkOffer result",
|
|
2100
|
-
JSON.stringify(
|
|
2101
|
-
{
|
|
2102
|
-
blocked: offerMissing,
|
|
2103
|
-
country: this.#country,
|
|
2104
|
-
offer_sku: this.#offer?.sku_id
|
|
2105
|
-
},
|
|
2106
|
-
null,
|
|
2107
|
-
2
|
|
2108
|
-
)
|
|
2109
|
-
);
|
|
2110
|
-
if (offerMissing) {
|
|
2111
|
-
console.log(
|
|
2112
|
-
"[ApplePayButton] #run early return after #checkOffer",
|
|
2113
|
-
JSON.stringify(
|
|
2114
|
-
{
|
|
2115
|
-
country: this.#country,
|
|
2116
|
-
offer_sku: this.#offer?.sku_id
|
|
2117
|
-
},
|
|
2118
|
-
null,
|
|
2119
|
-
2
|
|
2120
|
-
)
|
|
2121
|
-
);
|
|
2122
|
-
return;
|
|
2123
|
-
}
|
|
2124
|
-
const sessionBlocked = await this.#checkSession();
|
|
2125
|
-
console.log(
|
|
2126
|
-
"[ApplePayButton] #checkSession result",
|
|
2127
|
-
JSON.stringify(
|
|
2128
|
-
{
|
|
2129
|
-
blocked: sessionBlocked,
|
|
2130
|
-
country: this.#country,
|
|
2131
|
-
offer_sku: this.#offer?.sku_id,
|
|
2132
|
-
session_user_type: this.#sessionData?.userType,
|
|
2133
|
-
session_logged_in: this.#sessionData?.loggedIn
|
|
2134
|
-
},
|
|
2135
|
-
null,
|
|
2136
|
-
2
|
|
2137
|
-
)
|
|
2138
|
-
);
|
|
2139
|
-
if (sessionBlocked) {
|
|
2140
|
-
console.log(
|
|
2141
|
-
"[ApplePayButton] #run early return after #checkSession",
|
|
2142
|
-
JSON.stringify(
|
|
2143
|
-
{
|
|
2144
|
-
country: this.#country,
|
|
2145
|
-
offer_sku: this.#offer?.sku_id
|
|
2146
|
-
},
|
|
2147
|
-
null,
|
|
2148
|
-
2
|
|
2149
|
-
)
|
|
2150
|
-
);
|
|
2151
|
-
return;
|
|
2152
|
-
}
|
|
2047
|
+
if (await this.#checkAvailability()) return;
|
|
2048
|
+
if (this.#checkOffer()) return;
|
|
2049
|
+
if (await this.#checkSession()) return;
|
|
2153
2050
|
this.#captureReturnUrl();
|
|
2154
|
-
console.log(
|
|
2155
|
-
"[ApplePayButton] #captureReturnUrl done",
|
|
2156
|
-
JSON.stringify(
|
|
2157
|
-
{
|
|
2158
|
-
return_url: this.#returnUrl
|
|
2159
|
-
},
|
|
2160
|
-
null,
|
|
2161
|
-
2
|
|
2162
|
-
)
|
|
2163
|
-
);
|
|
2164
2051
|
this.#computeBillingCountries();
|
|
2165
|
-
|
|
2166
|
-
"[ApplePayButton] #computeBillingCountries done",
|
|
2167
|
-
JSON.stringify(
|
|
2168
|
-
{
|
|
2169
|
-
supported_billing_countries: this.#supportedBillingCountries
|
|
2170
|
-
},
|
|
2171
|
-
null,
|
|
2172
|
-
2
|
|
2173
|
-
)
|
|
2174
|
-
);
|
|
2175
|
-
const optionsBlocked = await this.#fetchAndCacheOptions();
|
|
2176
|
-
console.log(
|
|
2177
|
-
"[ApplePayButton] #fetchAndCacheOptions result",
|
|
2178
|
-
JSON.stringify(
|
|
2179
|
-
{
|
|
2180
|
-
blocked: optionsBlocked,
|
|
2181
|
-
has_apple_pay_option: Boolean(this.#paymentOptions?.options?.apple_pay)
|
|
2182
|
-
},
|
|
2183
|
-
null,
|
|
2184
|
-
2
|
|
2185
|
-
)
|
|
2186
|
-
);
|
|
2187
|
-
if (optionsBlocked) {
|
|
2188
|
-
console.log(
|
|
2189
|
-
"[ApplePayButton] #run early return after #fetchAndCacheOptions",
|
|
2190
|
-
JSON.stringify(
|
|
2191
|
-
{
|
|
2192
|
-
country: this.#country,
|
|
2193
|
-
offer_sku: this.#offer?.sku_id
|
|
2194
|
-
},
|
|
2195
|
-
null,
|
|
2196
|
-
2
|
|
2197
|
-
)
|
|
2198
|
-
);
|
|
2199
|
-
return;
|
|
2200
|
-
}
|
|
2052
|
+
if (await this.#fetchAndCacheOptions()) return;
|
|
2201
2053
|
this.#finishLoading();
|
|
2202
|
-
|
|
2203
|
-
"[ApplePayButton] #finishLoading done",
|
|
2204
|
-
JSON.stringify(
|
|
2205
|
-
{
|
|
2206
|
-
country: this.#country,
|
|
2207
|
-
offer_sku: this.#offer?.sku_id
|
|
2208
|
-
},
|
|
2209
|
-
null,
|
|
2210
|
-
2
|
|
2211
|
-
)
|
|
2212
|
-
);
|
|
2213
|
-
} catch (error) {
|
|
2214
|
-
console.log(
|
|
2215
|
-
"[ApplePayButton] #run failed",
|
|
2216
|
-
JSON.stringify(
|
|
2217
|
-
{
|
|
2218
|
-
country: this.#country,
|
|
2219
|
-
offer_sku: this.#offer?.sku_id,
|
|
2220
|
-
error: error instanceof Error ? {
|
|
2221
|
-
name: error.name,
|
|
2222
|
-
message: error.message,
|
|
2223
|
-
stack: error.stack
|
|
2224
|
-
} : error
|
|
2225
|
-
},
|
|
2226
|
-
null,
|
|
2227
|
-
2
|
|
2228
|
-
)
|
|
2229
|
-
);
|
|
2054
|
+
} catch {
|
|
2230
2055
|
this.style.display = "none";
|
|
2231
2056
|
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2232
2057
|
} finally {
|
|
2233
|
-
console.log(
|
|
2234
|
-
"[ApplePayButton] #run finally",
|
|
2235
|
-
JSON.stringify(
|
|
2236
|
-
{
|
|
2237
|
-
rendering: this.#rendering
|
|
2238
|
-
},
|
|
2239
|
-
null,
|
|
2240
|
-
2
|
|
2241
|
-
)
|
|
2242
|
-
);
|
|
2243
2058
|
this.#rendering = false;
|
|
2244
2059
|
}
|
|
2245
2060
|
}
|
|
@@ -1120,10 +1120,10 @@ var isApplePayAvailable = async () => {
|
|
|
1120
1120
|
if (bypassApplePayChecks()) {
|
|
1121
1121
|
return true;
|
|
1122
1122
|
}
|
|
1123
|
-
|
|
1123
|
+
const applePaySession = window.ApplePaySession;
|
|
1124
|
+
if (!applePaySession && !isAppleDeviceOrSafari()) {
|
|
1124
1125
|
return false;
|
|
1125
1126
|
}
|
|
1126
|
-
const applePaySession = window.ApplePaySession;
|
|
1127
1127
|
if (!applePaySession) {
|
|
1128
1128
|
return false;
|
|
1129
1129
|
}
|
|
@@ -2035,203 +2035,18 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2035
2035
|
// ─── Render pipeline ────────────────────────────────────────────────────────
|
|
2036
2036
|
async #run() {
|
|
2037
2037
|
try {
|
|
2038
|
-
console.log(
|
|
2039
|
-
"[ApplePayButton] #run start",
|
|
2040
|
-
JSON.stringify(
|
|
2041
|
-
{
|
|
2042
|
-
country: this.#country,
|
|
2043
|
-
offer_sku: this.#offer?.sku_id,
|
|
2044
|
-
entry_point: this.#entryPoint
|
|
2045
|
-
},
|
|
2046
|
-
null,
|
|
2047
|
-
2
|
|
2048
|
-
)
|
|
2049
|
-
);
|
|
2050
2038
|
this.#renderTemplate();
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
{
|
|
2055
|
-
country: this.#country,
|
|
2056
|
-
offer_sku: this.#offer?.sku_id
|
|
2057
|
-
},
|
|
2058
|
-
null,
|
|
2059
|
-
2
|
|
2060
|
-
)
|
|
2061
|
-
);
|
|
2062
|
-
const availabilityBlocked = await this.#checkAvailability();
|
|
2063
|
-
console.log(
|
|
2064
|
-
"[ApplePayButton] #checkAvailability result",
|
|
2065
|
-
JSON.stringify(
|
|
2066
|
-
{
|
|
2067
|
-
blocked: availabilityBlocked,
|
|
2068
|
-
country: this.#country,
|
|
2069
|
-
offer_sku: this.#offer?.sku_id
|
|
2070
|
-
},
|
|
2071
|
-
null,
|
|
2072
|
-
2
|
|
2073
|
-
)
|
|
2074
|
-
);
|
|
2075
|
-
if (availabilityBlocked) {
|
|
2076
|
-
console.log(
|
|
2077
|
-
"[ApplePayButton] #run early return after #checkAvailability",
|
|
2078
|
-
JSON.stringify(
|
|
2079
|
-
{
|
|
2080
|
-
country: this.#country,
|
|
2081
|
-
offer_sku: this.#offer?.sku_id
|
|
2082
|
-
},
|
|
2083
|
-
null,
|
|
2084
|
-
2
|
|
2085
|
-
)
|
|
2086
|
-
);
|
|
2087
|
-
return;
|
|
2088
|
-
}
|
|
2089
|
-
const offerMissing = this.#checkOffer();
|
|
2090
|
-
console.log(
|
|
2091
|
-
"[ApplePayButton] #checkOffer result",
|
|
2092
|
-
JSON.stringify(
|
|
2093
|
-
{
|
|
2094
|
-
blocked: offerMissing,
|
|
2095
|
-
country: this.#country,
|
|
2096
|
-
offer_sku: this.#offer?.sku_id
|
|
2097
|
-
},
|
|
2098
|
-
null,
|
|
2099
|
-
2
|
|
2100
|
-
)
|
|
2101
|
-
);
|
|
2102
|
-
if (offerMissing) {
|
|
2103
|
-
console.log(
|
|
2104
|
-
"[ApplePayButton] #run early return after #checkOffer",
|
|
2105
|
-
JSON.stringify(
|
|
2106
|
-
{
|
|
2107
|
-
country: this.#country,
|
|
2108
|
-
offer_sku: this.#offer?.sku_id
|
|
2109
|
-
},
|
|
2110
|
-
null,
|
|
2111
|
-
2
|
|
2112
|
-
)
|
|
2113
|
-
);
|
|
2114
|
-
return;
|
|
2115
|
-
}
|
|
2116
|
-
const sessionBlocked = await this.#checkSession();
|
|
2117
|
-
console.log(
|
|
2118
|
-
"[ApplePayButton] #checkSession result",
|
|
2119
|
-
JSON.stringify(
|
|
2120
|
-
{
|
|
2121
|
-
blocked: sessionBlocked,
|
|
2122
|
-
country: this.#country,
|
|
2123
|
-
offer_sku: this.#offer?.sku_id,
|
|
2124
|
-
session_user_type: this.#sessionData?.userType,
|
|
2125
|
-
session_logged_in: this.#sessionData?.loggedIn
|
|
2126
|
-
},
|
|
2127
|
-
null,
|
|
2128
|
-
2
|
|
2129
|
-
)
|
|
2130
|
-
);
|
|
2131
|
-
if (sessionBlocked) {
|
|
2132
|
-
console.log(
|
|
2133
|
-
"[ApplePayButton] #run early return after #checkSession",
|
|
2134
|
-
JSON.stringify(
|
|
2135
|
-
{
|
|
2136
|
-
country: this.#country,
|
|
2137
|
-
offer_sku: this.#offer?.sku_id
|
|
2138
|
-
},
|
|
2139
|
-
null,
|
|
2140
|
-
2
|
|
2141
|
-
)
|
|
2142
|
-
);
|
|
2143
|
-
return;
|
|
2144
|
-
}
|
|
2039
|
+
if (await this.#checkAvailability()) return;
|
|
2040
|
+
if (this.#checkOffer()) return;
|
|
2041
|
+
if (await this.#checkSession()) return;
|
|
2145
2042
|
this.#captureReturnUrl();
|
|
2146
|
-
console.log(
|
|
2147
|
-
"[ApplePayButton] #captureReturnUrl done",
|
|
2148
|
-
JSON.stringify(
|
|
2149
|
-
{
|
|
2150
|
-
return_url: this.#returnUrl
|
|
2151
|
-
},
|
|
2152
|
-
null,
|
|
2153
|
-
2
|
|
2154
|
-
)
|
|
2155
|
-
);
|
|
2156
2043
|
this.#computeBillingCountries();
|
|
2157
|
-
|
|
2158
|
-
"[ApplePayButton] #computeBillingCountries done",
|
|
2159
|
-
JSON.stringify(
|
|
2160
|
-
{
|
|
2161
|
-
supported_billing_countries: this.#supportedBillingCountries
|
|
2162
|
-
},
|
|
2163
|
-
null,
|
|
2164
|
-
2
|
|
2165
|
-
)
|
|
2166
|
-
);
|
|
2167
|
-
const optionsBlocked = await this.#fetchAndCacheOptions();
|
|
2168
|
-
console.log(
|
|
2169
|
-
"[ApplePayButton] #fetchAndCacheOptions result",
|
|
2170
|
-
JSON.stringify(
|
|
2171
|
-
{
|
|
2172
|
-
blocked: optionsBlocked,
|
|
2173
|
-
has_apple_pay_option: Boolean(this.#paymentOptions?.options?.apple_pay)
|
|
2174
|
-
},
|
|
2175
|
-
null,
|
|
2176
|
-
2
|
|
2177
|
-
)
|
|
2178
|
-
);
|
|
2179
|
-
if (optionsBlocked) {
|
|
2180
|
-
console.log(
|
|
2181
|
-
"[ApplePayButton] #run early return after #fetchAndCacheOptions",
|
|
2182
|
-
JSON.stringify(
|
|
2183
|
-
{
|
|
2184
|
-
country: this.#country,
|
|
2185
|
-
offer_sku: this.#offer?.sku_id
|
|
2186
|
-
},
|
|
2187
|
-
null,
|
|
2188
|
-
2
|
|
2189
|
-
)
|
|
2190
|
-
);
|
|
2191
|
-
return;
|
|
2192
|
-
}
|
|
2044
|
+
if (await this.#fetchAndCacheOptions()) return;
|
|
2193
2045
|
this.#finishLoading();
|
|
2194
|
-
|
|
2195
|
-
"[ApplePayButton] #finishLoading done",
|
|
2196
|
-
JSON.stringify(
|
|
2197
|
-
{
|
|
2198
|
-
country: this.#country,
|
|
2199
|
-
offer_sku: this.#offer?.sku_id
|
|
2200
|
-
},
|
|
2201
|
-
null,
|
|
2202
|
-
2
|
|
2203
|
-
)
|
|
2204
|
-
);
|
|
2205
|
-
} catch (error) {
|
|
2206
|
-
console.log(
|
|
2207
|
-
"[ApplePayButton] #run failed",
|
|
2208
|
-
JSON.stringify(
|
|
2209
|
-
{
|
|
2210
|
-
country: this.#country,
|
|
2211
|
-
offer_sku: this.#offer?.sku_id,
|
|
2212
|
-
error: error instanceof Error ? {
|
|
2213
|
-
name: error.name,
|
|
2214
|
-
message: error.message,
|
|
2215
|
-
stack: error.stack
|
|
2216
|
-
} : error
|
|
2217
|
-
},
|
|
2218
|
-
null,
|
|
2219
|
-
2
|
|
2220
|
-
)
|
|
2221
|
-
);
|
|
2046
|
+
} catch {
|
|
2222
2047
|
this.style.display = "none";
|
|
2223
2048
|
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2224
2049
|
} finally {
|
|
2225
|
-
console.log(
|
|
2226
|
-
"[ApplePayButton] #run finally",
|
|
2227
|
-
JSON.stringify(
|
|
2228
|
-
{
|
|
2229
|
-
rendering: this.#rendering
|
|
2230
|
-
},
|
|
2231
|
-
null,
|
|
2232
|
-
2
|
|
2233
|
-
)
|
|
2234
|
-
);
|
|
2235
2050
|
this.#rendering = false;
|
|
2236
2051
|
}
|
|
2237
2052
|
}
|
|
@@ -13,10 +13,10 @@ var isApplePayAvailable = async () => {
|
|
|
13
13
|
if (bypassApplePayChecks()) {
|
|
14
14
|
return true;
|
|
15
15
|
}
|
|
16
|
-
|
|
16
|
+
const applePaySession = window.ApplePaySession;
|
|
17
|
+
if (!applePaySession && !isAppleDeviceOrSafari()) {
|
|
17
18
|
return false;
|
|
18
19
|
}
|
|
19
|
-
const applePaySession = window.ApplePaySession;
|
|
20
20
|
if (!applePaySession) {
|
|
21
21
|
return false;
|
|
22
22
|
}
|
package/dist/src/index.js
CHANGED
|
@@ -1125,10 +1125,10 @@ var isApplePayAvailable = async () => {
|
|
|
1125
1125
|
if (bypassApplePayChecks()) {
|
|
1126
1126
|
return true;
|
|
1127
1127
|
}
|
|
1128
|
-
|
|
1128
|
+
const applePaySession = window.ApplePaySession;
|
|
1129
|
+
if (!applePaySession && !isAppleDeviceOrSafari()) {
|
|
1129
1130
|
return false;
|
|
1130
1131
|
}
|
|
1131
|
-
const applePaySession = window.ApplePaySession;
|
|
1132
1132
|
if (!applePaySession) {
|
|
1133
1133
|
return false;
|
|
1134
1134
|
}
|
|
@@ -2040,203 +2040,18 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
|
|
|
2040
2040
|
// ─── Render pipeline ────────────────────────────────────────────────────────
|
|
2041
2041
|
async #run() {
|
|
2042
2042
|
try {
|
|
2043
|
-
console.log(
|
|
2044
|
-
"[ApplePayButton] #run start",
|
|
2045
|
-
JSON.stringify(
|
|
2046
|
-
{
|
|
2047
|
-
country: this.#country,
|
|
2048
|
-
offer_sku: this.#offer?.sku_id,
|
|
2049
|
-
entry_point: this.#entryPoint
|
|
2050
|
-
},
|
|
2051
|
-
null,
|
|
2052
|
-
2
|
|
2053
|
-
)
|
|
2054
|
-
);
|
|
2055
2043
|
this.#renderTemplate();
|
|
2056
|
-
|
|
2057
|
-
|
|
2058
|
-
|
|
2059
|
-
{
|
|
2060
|
-
country: this.#country,
|
|
2061
|
-
offer_sku: this.#offer?.sku_id
|
|
2062
|
-
},
|
|
2063
|
-
null,
|
|
2064
|
-
2
|
|
2065
|
-
)
|
|
2066
|
-
);
|
|
2067
|
-
const availabilityBlocked = await this.#checkAvailability();
|
|
2068
|
-
console.log(
|
|
2069
|
-
"[ApplePayButton] #checkAvailability result",
|
|
2070
|
-
JSON.stringify(
|
|
2071
|
-
{
|
|
2072
|
-
blocked: availabilityBlocked,
|
|
2073
|
-
country: this.#country,
|
|
2074
|
-
offer_sku: this.#offer?.sku_id
|
|
2075
|
-
},
|
|
2076
|
-
null,
|
|
2077
|
-
2
|
|
2078
|
-
)
|
|
2079
|
-
);
|
|
2080
|
-
if (availabilityBlocked) {
|
|
2081
|
-
console.log(
|
|
2082
|
-
"[ApplePayButton] #run early return after #checkAvailability",
|
|
2083
|
-
JSON.stringify(
|
|
2084
|
-
{
|
|
2085
|
-
country: this.#country,
|
|
2086
|
-
offer_sku: this.#offer?.sku_id
|
|
2087
|
-
},
|
|
2088
|
-
null,
|
|
2089
|
-
2
|
|
2090
|
-
)
|
|
2091
|
-
);
|
|
2092
|
-
return;
|
|
2093
|
-
}
|
|
2094
|
-
const offerMissing = this.#checkOffer();
|
|
2095
|
-
console.log(
|
|
2096
|
-
"[ApplePayButton] #checkOffer result",
|
|
2097
|
-
JSON.stringify(
|
|
2098
|
-
{
|
|
2099
|
-
blocked: offerMissing,
|
|
2100
|
-
country: this.#country,
|
|
2101
|
-
offer_sku: this.#offer?.sku_id
|
|
2102
|
-
},
|
|
2103
|
-
null,
|
|
2104
|
-
2
|
|
2105
|
-
)
|
|
2106
|
-
);
|
|
2107
|
-
if (offerMissing) {
|
|
2108
|
-
console.log(
|
|
2109
|
-
"[ApplePayButton] #run early return after #checkOffer",
|
|
2110
|
-
JSON.stringify(
|
|
2111
|
-
{
|
|
2112
|
-
country: this.#country,
|
|
2113
|
-
offer_sku: this.#offer?.sku_id
|
|
2114
|
-
},
|
|
2115
|
-
null,
|
|
2116
|
-
2
|
|
2117
|
-
)
|
|
2118
|
-
);
|
|
2119
|
-
return;
|
|
2120
|
-
}
|
|
2121
|
-
const sessionBlocked = await this.#checkSession();
|
|
2122
|
-
console.log(
|
|
2123
|
-
"[ApplePayButton] #checkSession result",
|
|
2124
|
-
JSON.stringify(
|
|
2125
|
-
{
|
|
2126
|
-
blocked: sessionBlocked,
|
|
2127
|
-
country: this.#country,
|
|
2128
|
-
offer_sku: this.#offer?.sku_id,
|
|
2129
|
-
session_user_type: this.#sessionData?.userType,
|
|
2130
|
-
session_logged_in: this.#sessionData?.loggedIn
|
|
2131
|
-
},
|
|
2132
|
-
null,
|
|
2133
|
-
2
|
|
2134
|
-
)
|
|
2135
|
-
);
|
|
2136
|
-
if (sessionBlocked) {
|
|
2137
|
-
console.log(
|
|
2138
|
-
"[ApplePayButton] #run early return after #checkSession",
|
|
2139
|
-
JSON.stringify(
|
|
2140
|
-
{
|
|
2141
|
-
country: this.#country,
|
|
2142
|
-
offer_sku: this.#offer?.sku_id
|
|
2143
|
-
},
|
|
2144
|
-
null,
|
|
2145
|
-
2
|
|
2146
|
-
)
|
|
2147
|
-
);
|
|
2148
|
-
return;
|
|
2149
|
-
}
|
|
2044
|
+
if (await this.#checkAvailability()) return;
|
|
2045
|
+
if (this.#checkOffer()) return;
|
|
2046
|
+
if (await this.#checkSession()) return;
|
|
2150
2047
|
this.#captureReturnUrl();
|
|
2151
|
-
console.log(
|
|
2152
|
-
"[ApplePayButton] #captureReturnUrl done",
|
|
2153
|
-
JSON.stringify(
|
|
2154
|
-
{
|
|
2155
|
-
return_url: this.#returnUrl
|
|
2156
|
-
},
|
|
2157
|
-
null,
|
|
2158
|
-
2
|
|
2159
|
-
)
|
|
2160
|
-
);
|
|
2161
2048
|
this.#computeBillingCountries();
|
|
2162
|
-
|
|
2163
|
-
"[ApplePayButton] #computeBillingCountries done",
|
|
2164
|
-
JSON.stringify(
|
|
2165
|
-
{
|
|
2166
|
-
supported_billing_countries: this.#supportedBillingCountries
|
|
2167
|
-
},
|
|
2168
|
-
null,
|
|
2169
|
-
2
|
|
2170
|
-
)
|
|
2171
|
-
);
|
|
2172
|
-
const optionsBlocked = await this.#fetchAndCacheOptions();
|
|
2173
|
-
console.log(
|
|
2174
|
-
"[ApplePayButton] #fetchAndCacheOptions result",
|
|
2175
|
-
JSON.stringify(
|
|
2176
|
-
{
|
|
2177
|
-
blocked: optionsBlocked,
|
|
2178
|
-
has_apple_pay_option: Boolean(this.#paymentOptions?.options?.apple_pay)
|
|
2179
|
-
},
|
|
2180
|
-
null,
|
|
2181
|
-
2
|
|
2182
|
-
)
|
|
2183
|
-
);
|
|
2184
|
-
if (optionsBlocked) {
|
|
2185
|
-
console.log(
|
|
2186
|
-
"[ApplePayButton] #run early return after #fetchAndCacheOptions",
|
|
2187
|
-
JSON.stringify(
|
|
2188
|
-
{
|
|
2189
|
-
country: this.#country,
|
|
2190
|
-
offer_sku: this.#offer?.sku_id
|
|
2191
|
-
},
|
|
2192
|
-
null,
|
|
2193
|
-
2
|
|
2194
|
-
)
|
|
2195
|
-
);
|
|
2196
|
-
return;
|
|
2197
|
-
}
|
|
2049
|
+
if (await this.#fetchAndCacheOptions()) return;
|
|
2198
2050
|
this.#finishLoading();
|
|
2199
|
-
|
|
2200
|
-
"[ApplePayButton] #finishLoading done",
|
|
2201
|
-
JSON.stringify(
|
|
2202
|
-
{
|
|
2203
|
-
country: this.#country,
|
|
2204
|
-
offer_sku: this.#offer?.sku_id
|
|
2205
|
-
},
|
|
2206
|
-
null,
|
|
2207
|
-
2
|
|
2208
|
-
)
|
|
2209
|
-
);
|
|
2210
|
-
} catch (error) {
|
|
2211
|
-
console.log(
|
|
2212
|
-
"[ApplePayButton] #run failed",
|
|
2213
|
-
JSON.stringify(
|
|
2214
|
-
{
|
|
2215
|
-
country: this.#country,
|
|
2216
|
-
offer_sku: this.#offer?.sku_id,
|
|
2217
|
-
error: error instanceof Error ? {
|
|
2218
|
-
name: error.name,
|
|
2219
|
-
message: error.message,
|
|
2220
|
-
stack: error.stack
|
|
2221
|
-
} : error
|
|
2222
|
-
},
|
|
2223
|
-
null,
|
|
2224
|
-
2
|
|
2225
|
-
)
|
|
2226
|
-
);
|
|
2051
|
+
} catch {
|
|
2227
2052
|
this.style.display = "none";
|
|
2228
2053
|
this.querySelector(SEL_CONTAINER)?.remove();
|
|
2229
2054
|
} finally {
|
|
2230
|
-
console.log(
|
|
2231
|
-
"[ApplePayButton] #run finally",
|
|
2232
|
-
JSON.stringify(
|
|
2233
|
-
{
|
|
2234
|
-
rendering: this.#rendering
|
|
2235
|
-
},
|
|
2236
|
-
null,
|
|
2237
|
-
2
|
|
2238
|
-
)
|
|
2239
|
-
);
|
|
2240
2055
|
this.#rendering = false;
|
|
2241
2056
|
}
|
|
2242
2057
|
}
|
package/package.json
CHANGED