@economist/web-apple-pay 0.1.3-beta.24 → 0.1.3-beta.26

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
@@ -320,28 +320,41 @@ var apple_pay_modal_template_default = `<style>
320
320
  cursor: not-allowed;
321
321
  }
322
322
 
323
- .apm__cta[aria-busy="true"] > * {
324
- visibility: hidden;
323
+ .apm__cta-content {
324
+ display: flex;
325
+ align-items: center;
326
+ gap: 0.375rem;
327
+ }
328
+
329
+ .apm__cta-label {
330
+ display: inline-flex;
331
+ align-items: center;
332
+ gap: 0.375rem;
325
333
  }
326
334
 
327
- .apm__cta[aria-busy="true"]::after {
335
+ .apm__cta-loading {
336
+ display: none;
337
+ }
338
+
339
+ .apm__cta[aria-busy="true"]::before {
328
340
  content: '';
329
341
  position: absolute;
330
- left: 50%;
331
342
  top: 50%;
332
- margin-left: -0.625rem;
333
- margin-top: -0.625rem;
343
+ left: 50%;
334
344
  width: 1.25rem;
335
345
  height: 1.25rem;
336
- border: 2px solid rgba(255, 255, 255, 0.2);
346
+ border: 2px solid rgba(255, 255, 255, 0.25);
337
347
  border-top-color: #fff;
338
348
  border-radius: 50%;
339
349
  animation: apm-cta-spinner 0.8s linear infinite;
340
350
  }
341
351
 
342
352
  @keyframes apm-cta-spinner {
353
+ from {
354
+ transform: translate(-50%, -50%) rotate(0deg);
355
+ }
343
356
  to {
344
- transform: rotate(360deg);
357
+ transform: translate(-50%, -50%) rotate(360deg);
345
358
  }
346
359
  }
347
360
 
@@ -518,11 +531,14 @@ var apple_pay_modal_template_default = `<style>
518
531
  </div>
519
532
  <button class="apm__cta" id="apple-pay-modal-cta" aria-label="Continue with Apple Pay">
520
533
  <span class="apm__cta-content">
521
- Continue with
522
- <svg width="51" height="22" aria-hidden="true" role="img">
523
- <use href="#apple-pay-logo" />
524
- </svg>
534
+ <span class="apm__cta-label">
535
+ Continue with
536
+ <svg width="51" height="22" aria-hidden="true" role="img">
537
+ <use href="#apple-pay-logo" />
538
+ </svg>
539
+ </span>
525
540
  </span>
541
+ <span class="apm__cta-loading" aria-hidden="true">Loading...</span>
526
542
  </button>
527
543
  </div>
528
544
  </div>
@@ -1035,28 +1051,34 @@ var apple_pay_button_template_default = `<style>
1035
1051
  cursor: default;
1036
1052
  }
1037
1053
 
1038
- teg-apple-pay-button .apple-pay-btn.wap-loading svg {
1039
- visibility: hidden;
1040
- }
1041
-
1042
- teg-apple-pay-button .apple-pay-btn.wap-loading::after {
1054
+ teg-apple-pay-button .apple-pay-btn.wap-loading::before {
1043
1055
  content: '';
1044
1056
  position: absolute;
1045
- left: 50%;
1046
1057
  top: 50%;
1047
- margin-left: -0.625rem;
1048
- margin-top: -0.625rem;
1058
+ left: 50%;
1049
1059
  width: 1.25rem;
1050
1060
  height: 1.25rem;
1051
- border: 2px solid rgba(255, 255, 255, 0.2);
1061
+ border: 2px solid rgba(255, 255, 255, 0.25);
1052
1062
  border-top-color: #fff;
1053
1063
  border-radius: 50%;
1054
1064
  animation: wap-button-spinner 0.8s linear infinite;
1055
1065
  }
1056
1066
 
1067
+ teg-apple-pay-button .apple-pay-btn__logo {
1068
+ display: inline-flex;
1069
+ align-items: center;
1070
+ }
1071
+
1072
+ teg-apple-pay-button .apple-pay-btn__loading {
1073
+ display: none;
1074
+ }
1075
+
1057
1076
  @keyframes wap-button-spinner {
1077
+ from {
1078
+ transform: translate(-50%, -50%) rotate(0deg);
1079
+ }
1058
1080
  to {
1059
- transform: rotate(360deg);
1081
+ transform: translate(-50%, -50%) rotate(360deg);
1060
1082
  }
1061
1083
  }
1062
1084
  </style>
@@ -1068,9 +1090,12 @@ var apple_pay_button_template_default = `<style>
1068
1090
  aria-label="Pay with Apple Pay"
1069
1091
  data-analytics="paywall:apple-pay-checkout"
1070
1092
  >
1071
- <svg width="51" height="22" aria-label="Apple Pay" role="img">
1072
- <use href="#apple-pay-logo" />
1073
- </svg>
1093
+ <span class="apple-pay-btn__logo">
1094
+ <svg width="51" height="22" aria-label="Apple Pay" role="img">
1095
+ <use href="#apple-pay-logo" />
1096
+ </svg>
1097
+ </span>
1098
+ <span class="apple-pay-btn__loading" aria-hidden="true">Loading...</span>
1074
1099
  </button>
1075
1100
  </div>
1076
1101
  `;
@@ -1182,6 +1207,7 @@ var validateAppleMerchant = (data) => {
1182
1207
  });
1183
1208
  };
1184
1209
  var performPurchase = (data) => {
1210
+ console.log("[web-apple-pay] /v1/wallet/purchase payload", data);
1185
1211
  return apiFetch("/v1/wallet/purchase", {
1186
1212
  method: "POST",
1187
1213
  body: JSON.stringify(data),
@@ -1929,7 +1955,9 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1929
1955
  const button = document.createElement(_ApplePayButton.tag);
1930
1956
  button.offer = offer;
1931
1957
  button.country = country;
1932
- button.entryPoint = entryPoint;
1958
+ if (entryPoint) {
1959
+ button.entryPoint = entryPoint;
1960
+ }
1933
1961
  return button;
1934
1962
  }
1935
1963
  /**
@@ -2239,6 +2267,13 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
2239
2267
  }
2240
2268
  };
2241
2269
 
2270
+ // src/constants.ts
2271
+ var ApplePayEntryPoint = /* @__PURE__ */ ((ApplePayEntryPoint2) => {
2272
+ ApplePayEntryPoint2["PAYWALL"] = "article_paywall";
2273
+ ApplePayEntryPoint2["REGWALL"] = "article_regwall";
2274
+ return ApplePayEntryPoint2;
2275
+ })(ApplePayEntryPoint || {});
2276
+
2242
2277
  // src/index.ts
2243
2278
  function defineApplePayElements() {
2244
2279
  ApplePayButton.define();
@@ -2247,6 +2282,7 @@ function defineApplePayElements() {
2247
2282
  export {
2248
2283
  APPLE_PAY_EXCLUDED_VARIANTS,
2249
2284
  ApplePayButton,
2285
+ ApplePayEntryPoint,
2250
2286
  ApplePayModal,
2251
2287
  configureApplePay,
2252
2288
  defineApplePayElements,
@@ -1,4 +1,5 @@
1
1
  import type { Offer, ProductVariant } from './types/offer.types';
2
+ import { ApplePayEntryPoint } from './constants';
2
3
  export declare const APPLE_PAY_EXCLUDED_VARIANTS: readonly ProductVariant[];
3
4
  export declare class ApplePayButton extends HTMLElement {
4
5
  #private;
@@ -7,13 +8,13 @@ export declare class ApplePayButton extends HTMLElement {
7
8
  /**
8
9
  * Creates and configures an ApplePayButton if the feature flag is present.
9
10
  */
10
- static createIfEnabled(offer: Offer | undefined, country: string, entryPoint: string): ApplePayButton | null;
11
+ static createIfEnabled(offer: Offer | undefined, country: string, entryPoint?: ApplePayEntryPoint): ApplePayButton | null;
11
12
  get offer(): Offer | null;
12
13
  set offer(value: Offer | null);
13
14
  get country(): string;
14
15
  set country(value: string);
15
- get entryPoint(): string;
16
- set entryPoint(value: string);
16
+ get entryPoint(): ApplePayEntryPoint | '';
17
+ set entryPoint(value: ApplePayEntryPoint);
17
18
  /**
18
19
  * Awaitable contract for the component's current render lifecycle.
19
20
  *
@@ -320,28 +320,41 @@ var apple_pay_modal_template_default = `<style>
320
320
  cursor: not-allowed;
321
321
  }
322
322
 
323
- .apm__cta[aria-busy="true"] > * {
324
- visibility: hidden;
323
+ .apm__cta-content {
324
+ display: flex;
325
+ align-items: center;
326
+ gap: 0.375rem;
327
+ }
328
+
329
+ .apm__cta-label {
330
+ display: inline-flex;
331
+ align-items: center;
332
+ gap: 0.375rem;
325
333
  }
326
334
 
327
- .apm__cta[aria-busy="true"]::after {
335
+ .apm__cta-loading {
336
+ display: none;
337
+ }
338
+
339
+ .apm__cta[aria-busy="true"]::before {
328
340
  content: '';
329
341
  position: absolute;
330
- left: 50%;
331
342
  top: 50%;
332
- margin-left: -0.625rem;
333
- margin-top: -0.625rem;
343
+ left: 50%;
334
344
  width: 1.25rem;
335
345
  height: 1.25rem;
336
- border: 2px solid rgba(255, 255, 255, 0.2);
346
+ border: 2px solid rgba(255, 255, 255, 0.25);
337
347
  border-top-color: #fff;
338
348
  border-radius: 50%;
339
349
  animation: apm-cta-spinner 0.8s linear infinite;
340
350
  }
341
351
 
342
352
  @keyframes apm-cta-spinner {
353
+ from {
354
+ transform: translate(-50%, -50%) rotate(0deg);
355
+ }
343
356
  to {
344
- transform: rotate(360deg);
357
+ transform: translate(-50%, -50%) rotate(360deg);
345
358
  }
346
359
  }
347
360
 
@@ -518,11 +531,14 @@ var apple_pay_modal_template_default = `<style>
518
531
  </div>
519
532
  <button class="apm__cta" id="apple-pay-modal-cta" aria-label="Continue with Apple Pay">
520
533
  <span class="apm__cta-content">
521
- Continue with
522
- <svg width="51" height="22" aria-hidden="true" role="img">
523
- <use href="#apple-pay-logo" />
524
- </svg>
534
+ <span class="apm__cta-label">
535
+ Continue with
536
+ <svg width="51" height="22" aria-hidden="true" role="img">
537
+ <use href="#apple-pay-logo" />
538
+ </svg>
539
+ </span>
525
540
  </span>
541
+ <span class="apm__cta-loading" aria-hidden="true">Loading...</span>
526
542
  </button>
527
543
  </div>
528
544
  </div>
@@ -1030,28 +1046,34 @@ var apple_pay_button_template_default = `<style>
1030
1046
  cursor: default;
1031
1047
  }
1032
1048
 
1033
- teg-apple-pay-button .apple-pay-btn.wap-loading svg {
1034
- visibility: hidden;
1035
- }
1036
-
1037
- teg-apple-pay-button .apple-pay-btn.wap-loading::after {
1049
+ teg-apple-pay-button .apple-pay-btn.wap-loading::before {
1038
1050
  content: '';
1039
1051
  position: absolute;
1040
- left: 50%;
1041
1052
  top: 50%;
1042
- margin-left: -0.625rem;
1043
- margin-top: -0.625rem;
1053
+ left: 50%;
1044
1054
  width: 1.25rem;
1045
1055
  height: 1.25rem;
1046
- border: 2px solid rgba(255, 255, 255, 0.2);
1056
+ border: 2px solid rgba(255, 255, 255, 0.25);
1047
1057
  border-top-color: #fff;
1048
1058
  border-radius: 50%;
1049
1059
  animation: wap-button-spinner 0.8s linear infinite;
1050
1060
  }
1051
1061
 
1062
+ teg-apple-pay-button .apple-pay-btn__logo {
1063
+ display: inline-flex;
1064
+ align-items: center;
1065
+ }
1066
+
1067
+ teg-apple-pay-button .apple-pay-btn__loading {
1068
+ display: none;
1069
+ }
1070
+
1052
1071
  @keyframes wap-button-spinner {
1072
+ from {
1073
+ transform: translate(-50%, -50%) rotate(0deg);
1074
+ }
1053
1075
  to {
1054
- transform: rotate(360deg);
1076
+ transform: translate(-50%, -50%) rotate(360deg);
1055
1077
  }
1056
1078
  }
1057
1079
  </style>
@@ -1063,9 +1085,12 @@ var apple_pay_button_template_default = `<style>
1063
1085
  aria-label="Pay with Apple Pay"
1064
1086
  data-analytics="paywall:apple-pay-checkout"
1065
1087
  >
1066
- <svg width="51" height="22" aria-label="Apple Pay" role="img">
1067
- <use href="#apple-pay-logo" />
1068
- </svg>
1088
+ <span class="apple-pay-btn__logo">
1089
+ <svg width="51" height="22" aria-label="Apple Pay" role="img">
1090
+ <use href="#apple-pay-logo" />
1091
+ </svg>
1092
+ </span>
1093
+ <span class="apple-pay-btn__loading" aria-hidden="true">Loading...</span>
1069
1094
  </button>
1070
1095
  </div>
1071
1096
  `;
@@ -1177,6 +1202,7 @@ var validateAppleMerchant = (data) => {
1177
1202
  });
1178
1203
  };
1179
1204
  var performPurchase = (data) => {
1205
+ console.log("[web-apple-pay] /v1/wallet/purchase payload", data);
1180
1206
  return apiFetch("/v1/wallet/purchase", {
1181
1207
  method: "POST",
1182
1208
  body: JSON.stringify(data),
@@ -1924,7 +1950,9 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1924
1950
  const button = document.createElement(_ApplePayButton.tag);
1925
1951
  button.offer = offer;
1926
1952
  button.country = country;
1927
- button.entryPoint = entryPoint;
1953
+ if (entryPoint) {
1954
+ button.entryPoint = entryPoint;
1955
+ }
1928
1956
  return button;
1929
1957
  }
1930
1958
  /**
@@ -320,28 +320,41 @@ var apple_pay_modal_template_default = `<style>
320
320
  cursor: not-allowed;
321
321
  }
322
322
 
323
- .apm__cta[aria-busy="true"] > * {
324
- visibility: hidden;
323
+ .apm__cta-content {
324
+ display: flex;
325
+ align-items: center;
326
+ gap: 0.375rem;
327
+ }
328
+
329
+ .apm__cta-label {
330
+ display: inline-flex;
331
+ align-items: center;
332
+ gap: 0.375rem;
325
333
  }
326
334
 
327
- .apm__cta[aria-busy="true"]::after {
335
+ .apm__cta-loading {
336
+ display: none;
337
+ }
338
+
339
+ .apm__cta[aria-busy="true"]::before {
328
340
  content: '';
329
341
  position: absolute;
330
- left: 50%;
331
342
  top: 50%;
332
- margin-left: -0.625rem;
333
- margin-top: -0.625rem;
343
+ left: 50%;
334
344
  width: 1.25rem;
335
345
  height: 1.25rem;
336
- border: 2px solid rgba(255, 255, 255, 0.2);
346
+ border: 2px solid rgba(255, 255, 255, 0.25);
337
347
  border-top-color: #fff;
338
348
  border-radius: 50%;
339
349
  animation: apm-cta-spinner 0.8s linear infinite;
340
350
  }
341
351
 
342
352
  @keyframes apm-cta-spinner {
353
+ from {
354
+ transform: translate(-50%, -50%) rotate(0deg);
355
+ }
343
356
  to {
344
- transform: rotate(360deg);
357
+ transform: translate(-50%, -50%) rotate(360deg);
345
358
  }
346
359
  }
347
360
 
@@ -518,11 +531,14 @@ var apple_pay_modal_template_default = `<style>
518
531
  </div>
519
532
  <button class="apm__cta" id="apple-pay-modal-cta" aria-label="Continue with Apple Pay">
520
533
  <span class="apm__cta-content">
521
- Continue with
522
- <svg width="51" height="22" aria-hidden="true" role="img">
523
- <use href="#apple-pay-logo" />
524
- </svg>
534
+ <span class="apm__cta-label">
535
+ Continue with
536
+ <svg width="51" height="22" aria-hidden="true" role="img">
537
+ <use href="#apple-pay-logo" />
538
+ </svg>
539
+ </span>
525
540
  </span>
541
+ <span class="apm__cta-loading" aria-hidden="true">Loading...</span>
526
542
  </button>
527
543
  </div>
528
544
  </div>
@@ -1038,28 +1054,34 @@ var apple_pay_button_template_default = `<style>
1038
1054
  cursor: default;
1039
1055
  }
1040
1056
 
1041
- teg-apple-pay-button .apple-pay-btn.wap-loading svg {
1042
- visibility: hidden;
1043
- }
1044
-
1045
- teg-apple-pay-button .apple-pay-btn.wap-loading::after {
1057
+ teg-apple-pay-button .apple-pay-btn.wap-loading::before {
1046
1058
  content: '';
1047
1059
  position: absolute;
1048
- left: 50%;
1049
1060
  top: 50%;
1050
- margin-left: -0.625rem;
1051
- margin-top: -0.625rem;
1061
+ left: 50%;
1052
1062
  width: 1.25rem;
1053
1063
  height: 1.25rem;
1054
- border: 2px solid rgba(255, 255, 255, 0.2);
1064
+ border: 2px solid rgba(255, 255, 255, 0.25);
1055
1065
  border-top-color: #fff;
1056
1066
  border-radius: 50%;
1057
1067
  animation: wap-button-spinner 0.8s linear infinite;
1058
1068
  }
1059
1069
 
1070
+ teg-apple-pay-button .apple-pay-btn__logo {
1071
+ display: inline-flex;
1072
+ align-items: center;
1073
+ }
1074
+
1075
+ teg-apple-pay-button .apple-pay-btn__loading {
1076
+ display: none;
1077
+ }
1078
+
1060
1079
  @keyframes wap-button-spinner {
1080
+ from {
1081
+ transform: translate(-50%, -50%) rotate(0deg);
1082
+ }
1061
1083
  to {
1062
- transform: rotate(360deg);
1084
+ transform: translate(-50%, -50%) rotate(360deg);
1063
1085
  }
1064
1086
  }
1065
1087
  </style>
@@ -1071,9 +1093,12 @@ var apple_pay_button_template_default = `<style>
1071
1093
  aria-label="Pay with Apple Pay"
1072
1094
  data-analytics="paywall:apple-pay-checkout"
1073
1095
  >
1074
- <svg width="51" height="22" aria-label="Apple Pay" role="img">
1075
- <use href="#apple-pay-logo" />
1076
- </svg>
1096
+ <span class="apple-pay-btn__logo">
1097
+ <svg width="51" height="22" aria-label="Apple Pay" role="img">
1098
+ <use href="#apple-pay-logo" />
1099
+ </svg>
1100
+ </span>
1101
+ <span class="apple-pay-btn__loading" aria-hidden="true">Loading...</span>
1077
1102
  </button>
1078
1103
  </div>
1079
1104
  `;
@@ -1185,6 +1210,7 @@ var validateAppleMerchant = (data) => {
1185
1210
  });
1186
1211
  };
1187
1212
  var performPurchase = (data) => {
1213
+ console.log("[web-apple-pay] /v1/wallet/purchase payload", data);
1188
1214
  return apiFetch("/v1/wallet/purchase", {
1189
1215
  method: "POST",
1190
1216
  body: JSON.stringify(data),
@@ -1932,7 +1958,9 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1932
1958
  const button = document.createElement(_ApplePayButton.tag);
1933
1959
  button.offer = offer;
1934
1960
  button.country = country;
1935
- button.entryPoint = entryPoint;
1961
+ if (entryPoint) {
1962
+ button.entryPoint = entryPoint;
1963
+ }
1936
1964
  return button;
1937
1965
  }
1938
1966
  /**
@@ -320,28 +320,41 @@ var apple_pay_modal_template_default = `<style>
320
320
  cursor: not-allowed;
321
321
  }
322
322
 
323
- .apm__cta[aria-busy="true"] > * {
324
- visibility: hidden;
323
+ .apm__cta-content {
324
+ display: flex;
325
+ align-items: center;
326
+ gap: 0.375rem;
327
+ }
328
+
329
+ .apm__cta-label {
330
+ display: inline-flex;
331
+ align-items: center;
332
+ gap: 0.375rem;
325
333
  }
326
334
 
327
- .apm__cta[aria-busy="true"]::after {
335
+ .apm__cta-loading {
336
+ display: none;
337
+ }
338
+
339
+ .apm__cta[aria-busy="true"]::before {
328
340
  content: '';
329
341
  position: absolute;
330
- left: 50%;
331
342
  top: 50%;
332
- margin-left: -0.625rem;
333
- margin-top: -0.625rem;
343
+ left: 50%;
334
344
  width: 1.25rem;
335
345
  height: 1.25rem;
336
- border: 2px solid rgba(255, 255, 255, 0.2);
346
+ border: 2px solid rgba(255, 255, 255, 0.25);
337
347
  border-top-color: #fff;
338
348
  border-radius: 50%;
339
349
  animation: apm-cta-spinner 0.8s linear infinite;
340
350
  }
341
351
 
342
352
  @keyframes apm-cta-spinner {
353
+ from {
354
+ transform: translate(-50%, -50%) rotate(0deg);
355
+ }
343
356
  to {
344
- transform: rotate(360deg);
357
+ transform: translate(-50%, -50%) rotate(360deg);
345
358
  }
346
359
  }
347
360
 
@@ -518,11 +531,14 @@ var apple_pay_modal_template_default = `<style>
518
531
  </div>
519
532
  <button class="apm__cta" id="apple-pay-modal-cta" aria-label="Continue with Apple Pay">
520
533
  <span class="apm__cta-content">
521
- Continue with
522
- <svg width="51" height="22" aria-hidden="true" role="img">
523
- <use href="#apple-pay-logo" />
524
- </svg>
534
+ <span class="apm__cta-label">
535
+ Continue with
536
+ <svg width="51" height="22" aria-hidden="true" role="img">
537
+ <use href="#apple-pay-logo" />
538
+ </svg>
539
+ </span>
525
540
  </span>
541
+ <span class="apm__cta-loading" aria-hidden="true">Loading...</span>
526
542
  </button>
527
543
  </div>
528
544
  </div>
@@ -320,28 +320,41 @@ var apple_pay_modal_template_default = `<style>
320
320
  cursor: not-allowed;
321
321
  }
322
322
 
323
- .apm__cta[aria-busy="true"] > * {
324
- visibility: hidden;
323
+ .apm__cta-content {
324
+ display: flex;
325
+ align-items: center;
326
+ gap: 0.375rem;
327
+ }
328
+
329
+ .apm__cta-label {
330
+ display: inline-flex;
331
+ align-items: center;
332
+ gap: 0.375rem;
325
333
  }
326
334
 
327
- .apm__cta[aria-busy="true"]::after {
335
+ .apm__cta-loading {
336
+ display: none;
337
+ }
338
+
339
+ .apm__cta[aria-busy="true"]::before {
328
340
  content: '';
329
341
  position: absolute;
330
- left: 50%;
331
342
  top: 50%;
332
- margin-left: -0.625rem;
333
- margin-top: -0.625rem;
343
+ left: 50%;
334
344
  width: 1.25rem;
335
345
  height: 1.25rem;
336
- border: 2px solid rgba(255, 255, 255, 0.2);
346
+ border: 2px solid rgba(255, 255, 255, 0.25);
337
347
  border-top-color: #fff;
338
348
  border-radius: 50%;
339
349
  animation: apm-cta-spinner 0.8s linear infinite;
340
350
  }
341
351
 
342
352
  @keyframes apm-cta-spinner {
353
+ from {
354
+ transform: translate(-50%, -50%) rotate(0deg);
355
+ }
343
356
  to {
344
- transform: rotate(360deg);
357
+ transform: translate(-50%, -50%) rotate(360deg);
345
358
  }
346
359
  }
347
360
 
@@ -518,11 +531,14 @@ var apple_pay_modal_template_default = `<style>
518
531
  </div>
519
532
  <button class="apm__cta" id="apple-pay-modal-cta" aria-label="Continue with Apple Pay">
520
533
  <span class="apm__cta-content">
521
- Continue with
522
- <svg width="51" height="22" aria-hidden="true" role="img">
523
- <use href="#apple-pay-logo" />
524
- </svg>
534
+ <span class="apm__cta-label">
535
+ Continue with
536
+ <svg width="51" height="22" aria-hidden="true" role="img">
537
+ <use href="#apple-pay-logo" />
538
+ </svg>
539
+ </span>
525
540
  </span>
541
+ <span class="apm__cta-loading" aria-hidden="true">Loading...</span>
526
542
  </button>
527
543
  </div>
528
544
  </div>
@@ -1030,28 +1046,34 @@ var apple_pay_button_template_default = `<style>
1030
1046
  cursor: default;
1031
1047
  }
1032
1048
 
1033
- teg-apple-pay-button .apple-pay-btn.wap-loading svg {
1034
- visibility: hidden;
1035
- }
1036
-
1037
- teg-apple-pay-button .apple-pay-btn.wap-loading::after {
1049
+ teg-apple-pay-button .apple-pay-btn.wap-loading::before {
1038
1050
  content: '';
1039
1051
  position: absolute;
1040
- left: 50%;
1041
1052
  top: 50%;
1042
- margin-left: -0.625rem;
1043
- margin-top: -0.625rem;
1053
+ left: 50%;
1044
1054
  width: 1.25rem;
1045
1055
  height: 1.25rem;
1046
- border: 2px solid rgba(255, 255, 255, 0.2);
1056
+ border: 2px solid rgba(255, 255, 255, 0.25);
1047
1057
  border-top-color: #fff;
1048
1058
  border-radius: 50%;
1049
1059
  animation: wap-button-spinner 0.8s linear infinite;
1050
1060
  }
1051
1061
 
1062
+ teg-apple-pay-button .apple-pay-btn__logo {
1063
+ display: inline-flex;
1064
+ align-items: center;
1065
+ }
1066
+
1067
+ teg-apple-pay-button .apple-pay-btn__loading {
1068
+ display: none;
1069
+ }
1070
+
1052
1071
  @keyframes wap-button-spinner {
1072
+ from {
1073
+ transform: translate(-50%, -50%) rotate(0deg);
1074
+ }
1053
1075
  to {
1054
- transform: rotate(360deg);
1076
+ transform: translate(-50%, -50%) rotate(360deg);
1055
1077
  }
1056
1078
  }
1057
1079
  </style>
@@ -1063,9 +1085,12 @@ var apple_pay_button_template_default = `<style>
1063
1085
  aria-label="Pay with Apple Pay"
1064
1086
  data-analytics="paywall:apple-pay-checkout"
1065
1087
  >
1066
- <svg width="51" height="22" aria-label="Apple Pay" role="img">
1067
- <use href="#apple-pay-logo" />
1068
- </svg>
1088
+ <span class="apple-pay-btn__logo">
1089
+ <svg width="51" height="22" aria-label="Apple Pay" role="img">
1090
+ <use href="#apple-pay-logo" />
1091
+ </svg>
1092
+ </span>
1093
+ <span class="apple-pay-btn__loading" aria-hidden="true">Loading...</span>
1069
1094
  </button>
1070
1095
  </div>
1071
1096
  `;
@@ -1177,6 +1202,7 @@ var validateAppleMerchant = (data) => {
1177
1202
  });
1178
1203
  };
1179
1204
  var performPurchase = (data) => {
1205
+ console.log("[web-apple-pay] /v1/wallet/purchase payload", data);
1180
1206
  return apiFetch("/v1/wallet/purchase", {
1181
1207
  method: "POST",
1182
1208
  body: JSON.stringify(data),
@@ -1924,7 +1950,9 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1924
1950
  const button = document.createElement(_ApplePayButton.tag);
1925
1951
  button.offer = offer;
1926
1952
  button.country = country;
1927
- button.entryPoint = entryPoint;
1953
+ if (entryPoint) {
1954
+ button.entryPoint = entryPoint;
1955
+ }
1928
1956
  return button;
1929
1957
  }
1930
1958
  /**
@@ -69,6 +69,7 @@ var validateAppleMerchant = (data) => {
69
69
  });
70
70
  };
71
71
  var performPurchase = (data) => {
72
+ console.log("[web-apple-pay] /v1/wallet/purchase payload", data);
72
73
  return apiFetch("/v1/wallet/purchase", {
73
74
  method: "POST",
74
75
  body: JSON.stringify(data),
@@ -55,6 +55,7 @@ var apiFetch = async (path, options = {}) => {
55
55
  return response.json();
56
56
  };
57
57
  var performPurchase = (data) => {
58
+ console.log("[web-apple-pay] /v1/wallet/purchase payload", data);
58
59
  return apiFetch("/v1/wallet/purchase", {
59
60
  method: "POST",
60
61
  body: JSON.stringify(data),
@@ -0,0 +1,4 @@
1
+ export declare enum ApplePayEntryPoint {
2
+ PAYWALL = "article_paywall",
3
+ REGWALL = "article_regwall"
4
+ }
@@ -0,0 +1,9 @@
1
+ // src/constants.ts
2
+ var ApplePayEntryPoint = /* @__PURE__ */ ((ApplePayEntryPoint2) => {
3
+ ApplePayEntryPoint2["PAYWALL"] = "article_paywall";
4
+ ApplePayEntryPoint2["REGWALL"] = "article_regwall";
5
+ return ApplePayEntryPoint2;
6
+ })(ApplePayEntryPoint || {});
7
+ export {
8
+ ApplePayEntryPoint
9
+ };
@@ -2,6 +2,7 @@ export { ApplePayButton, APPLE_PAY_EXCLUDED_VARIANTS, } from './apple-pay-button
2
2
  export { ApplePayModal } from './apple-pay-modal';
3
3
  export { ensureApplePayLogoSymbol } from './apple-pay-logo';
4
4
  export { configureApplePay } from './clients/payment-checkout/config';
5
+ export { ApplePayEntryPoint } from './constants';
5
6
  export type { ApplePayRuntimeConfig } from './clients/payment-checkout/config';
6
7
  export type { Offer } from './types/offer.types';
7
8
  export declare function defineApplePayElements(): void;
package/dist/src/index.js CHANGED
@@ -320,28 +320,41 @@ var apple_pay_modal_template_default = `<style>
320
320
  cursor: not-allowed;
321
321
  }
322
322
 
323
- .apm__cta[aria-busy="true"] > * {
324
- visibility: hidden;
323
+ .apm__cta-content {
324
+ display: flex;
325
+ align-items: center;
326
+ gap: 0.375rem;
327
+ }
328
+
329
+ .apm__cta-label {
330
+ display: inline-flex;
331
+ align-items: center;
332
+ gap: 0.375rem;
325
333
  }
326
334
 
327
- .apm__cta[aria-busy="true"]::after {
335
+ .apm__cta-loading {
336
+ display: none;
337
+ }
338
+
339
+ .apm__cta[aria-busy="true"]::before {
328
340
  content: '';
329
341
  position: absolute;
330
- left: 50%;
331
342
  top: 50%;
332
- margin-left: -0.625rem;
333
- margin-top: -0.625rem;
343
+ left: 50%;
334
344
  width: 1.25rem;
335
345
  height: 1.25rem;
336
- border: 2px solid rgba(255, 255, 255, 0.2);
346
+ border: 2px solid rgba(255, 255, 255, 0.25);
337
347
  border-top-color: #fff;
338
348
  border-radius: 50%;
339
349
  animation: apm-cta-spinner 0.8s linear infinite;
340
350
  }
341
351
 
342
352
  @keyframes apm-cta-spinner {
353
+ from {
354
+ transform: translate(-50%, -50%) rotate(0deg);
355
+ }
343
356
  to {
344
- transform: rotate(360deg);
357
+ transform: translate(-50%, -50%) rotate(360deg);
345
358
  }
346
359
  }
347
360
 
@@ -518,11 +531,14 @@ var apple_pay_modal_template_default = `<style>
518
531
  </div>
519
532
  <button class="apm__cta" id="apple-pay-modal-cta" aria-label="Continue with Apple Pay">
520
533
  <span class="apm__cta-content">
521
- Continue with
522
- <svg width="51" height="22" aria-hidden="true" role="img">
523
- <use href="#apple-pay-logo" />
524
- </svg>
534
+ <span class="apm__cta-label">
535
+ Continue with
536
+ <svg width="51" height="22" aria-hidden="true" role="img">
537
+ <use href="#apple-pay-logo" />
538
+ </svg>
539
+ </span>
525
540
  </span>
541
+ <span class="apm__cta-loading" aria-hidden="true">Loading...</span>
526
542
  </button>
527
543
  </div>
528
544
  </div>
@@ -1035,28 +1051,34 @@ var apple_pay_button_template_default = `<style>
1035
1051
  cursor: default;
1036
1052
  }
1037
1053
 
1038
- teg-apple-pay-button .apple-pay-btn.wap-loading svg {
1039
- visibility: hidden;
1040
- }
1041
-
1042
- teg-apple-pay-button .apple-pay-btn.wap-loading::after {
1054
+ teg-apple-pay-button .apple-pay-btn.wap-loading::before {
1043
1055
  content: '';
1044
1056
  position: absolute;
1045
- left: 50%;
1046
1057
  top: 50%;
1047
- margin-left: -0.625rem;
1048
- margin-top: -0.625rem;
1058
+ left: 50%;
1049
1059
  width: 1.25rem;
1050
1060
  height: 1.25rem;
1051
- border: 2px solid rgba(255, 255, 255, 0.2);
1061
+ border: 2px solid rgba(255, 255, 255, 0.25);
1052
1062
  border-top-color: #fff;
1053
1063
  border-radius: 50%;
1054
1064
  animation: wap-button-spinner 0.8s linear infinite;
1055
1065
  }
1056
1066
 
1067
+ teg-apple-pay-button .apple-pay-btn__logo {
1068
+ display: inline-flex;
1069
+ align-items: center;
1070
+ }
1071
+
1072
+ teg-apple-pay-button .apple-pay-btn__loading {
1073
+ display: none;
1074
+ }
1075
+
1057
1076
  @keyframes wap-button-spinner {
1077
+ from {
1078
+ transform: translate(-50%, -50%) rotate(0deg);
1079
+ }
1058
1080
  to {
1059
- transform: rotate(360deg);
1081
+ transform: translate(-50%, -50%) rotate(360deg);
1060
1082
  }
1061
1083
  }
1062
1084
  </style>
@@ -1068,9 +1090,12 @@ var apple_pay_button_template_default = `<style>
1068
1090
  aria-label="Pay with Apple Pay"
1069
1091
  data-analytics="paywall:apple-pay-checkout"
1070
1092
  >
1071
- <svg width="51" height="22" aria-label="Apple Pay" role="img">
1072
- <use href="#apple-pay-logo" />
1073
- </svg>
1093
+ <span class="apple-pay-btn__logo">
1094
+ <svg width="51" height="22" aria-label="Apple Pay" role="img">
1095
+ <use href="#apple-pay-logo" />
1096
+ </svg>
1097
+ </span>
1098
+ <span class="apple-pay-btn__loading" aria-hidden="true">Loading...</span>
1074
1099
  </button>
1075
1100
  </div>
1076
1101
  `;
@@ -1182,6 +1207,7 @@ var validateAppleMerchant = (data) => {
1182
1207
  });
1183
1208
  };
1184
1209
  var performPurchase = (data) => {
1210
+ console.log("[web-apple-pay] /v1/wallet/purchase payload", data);
1185
1211
  return apiFetch("/v1/wallet/purchase", {
1186
1212
  method: "POST",
1187
1213
  body: JSON.stringify(data),
@@ -1929,7 +1955,9 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1929
1955
  const button = document.createElement(_ApplePayButton.tag);
1930
1956
  button.offer = offer;
1931
1957
  button.country = country;
1932
- button.entryPoint = entryPoint;
1958
+ if (entryPoint) {
1959
+ button.entryPoint = entryPoint;
1960
+ }
1933
1961
  return button;
1934
1962
  }
1935
1963
  /**
@@ -2239,6 +2267,13 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
2239
2267
  }
2240
2268
  };
2241
2269
 
2270
+ // src/constants.ts
2271
+ var ApplePayEntryPoint = /* @__PURE__ */ ((ApplePayEntryPoint2) => {
2272
+ ApplePayEntryPoint2["PAYWALL"] = "article_paywall";
2273
+ ApplePayEntryPoint2["REGWALL"] = "article_regwall";
2274
+ return ApplePayEntryPoint2;
2275
+ })(ApplePayEntryPoint || {});
2276
+
2242
2277
  // src/index.ts
2243
2278
  function defineApplePayElements() {
2244
2279
  ApplePayButton.define();
@@ -2247,6 +2282,7 @@ function defineApplePayElements() {
2247
2282
  export {
2248
2283
  APPLE_PAY_EXCLUDED_VARIANTS,
2249
2284
  ApplePayButton,
2285
+ ApplePayEntryPoint,
2250
2286
  ApplePayModal,
2251
2287
  configureApplePay,
2252
2288
  defineApplePayElements,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@economist/web-apple-pay",
3
3
  "description": "Web component package for Apple Pay checkout UI",
4
- "version": "0.1.3-beta.24",
4
+ "version": "0.1.3-beta.26",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",