@economist/web-apple-pay 2.0.0-beta.2 → 2.0.0-beta.4

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.
Files changed (56) hide show
  1. package/README.md +20 -12
  2. package/dist/index.js +681 -361
  3. package/dist/src/apple-pay-button.d.ts +18 -16
  4. package/dist/src/apple-pay-button.js +670 -352
  5. package/dist/src/apple-pay-button.stories.js +667 -351
  6. package/dist/src/apple-pay-modal.js +44 -39
  7. package/dist/src/apple-pay-modal.stories.js +667 -351
  8. package/dist/src/clients/payment-checkout/apple-session.d.ts +14 -1
  9. package/dist/src/clients/payment-checkout/apple-session.js +66 -17
  10. package/dist/src/clients/payment-checkout/billing-contact-details.js +43 -0
  11. package/dist/src/clients/payment-checkout/delivery-contact-details.d.ts +16 -0
  12. package/dist/src/clients/payment-checkout/delivery-contact-details.js +397 -0
  13. package/dist/src/clients/payment-checkout/detects.d.ts +5 -0
  14. package/dist/src/clients/payment-checkout/detects.js +18 -14
  15. package/dist/src/clients/payment-checkout/messages.d.ts +6 -0
  16. package/dist/src/clients/payment-checkout/messages.js +7 -1
  17. package/dist/src/clients/payment-checkout/payment-handler.d.ts +10 -1
  18. package/dist/src/clients/payment-checkout/payment-handler.js +414 -36
  19. package/dist/src/clients/payment-checkout/session.js +13 -1
  20. package/dist/src/clients/payment-checkout/types.d.ts +11 -0
  21. package/dist/src/constants.d.ts +7 -28
  22. package/dist/src/constants.js +3 -7
  23. package/dist/src/index.d.ts +2 -4
  24. package/dist/src/index.js +681 -361
  25. package/dist/src/types/offer.types.d.ts +1 -1
  26. package/dist/src/utils/address-rules.d.ts +29 -0
  27. package/dist/src/utils/address-rules.js +260 -0
  28. package/dist/src/utils/addressParityFlag.d.ts +13 -0
  29. package/dist/src/utils/addressParityFlag.js +5 -0
  30. package/dist/src/utils/applePayExpressEligibility.d.ts +5 -6
  31. package/dist/src/utils/applePayExpressEligibility.js +2 -2
  32. package/dist/src/utils/billing-countries.js +46 -37
  33. package/dist/src/utils/buttonCopyFlag.d.ts +22 -0
  34. package/dist/src/utils/buttonCopyFlag.js +12 -0
  35. package/dist/src/utils/delivery-countries.d.ts +9 -0
  36. package/dist/src/utils/delivery-countries.js +255 -0
  37. package/dist/src/utils/expressCheckoutRedirect.d.ts +20 -2
  38. package/dist/src/utils/expressCheckoutRedirect.js +13 -1
  39. package/dist/src/utils/expressCheckoutTracking.d.ts +13 -20
  40. package/dist/src/utils/expressCheckoutTracking.js +22 -37
  41. package/dist/src/utils/latin-characters.d.ts +3 -0
  42. package/dist/src/utils/latin-characters.js +10 -0
  43. package/dist/src/utils/price-zones.d.ts +7 -0
  44. package/dist/src/utils/price-zones.js +212 -0
  45. package/dist/src/utils/print-variants.d.ts +5 -0
  46. package/dist/src/utils/print-variants.js +10 -0
  47. package/dist/src/utils/printOffersFlag.d.ts +11 -0
  48. package/dist/src/utils/printOffersFlag.js +5 -0
  49. package/dist/src/utils/recaptcha.d.ts +3 -2
  50. package/dist/src/utils/recaptcha.js +17 -8
  51. package/package.json +1 -1
  52. package/dist/src/apple-pay-logo.d.ts +0 -1
  53. package/dist/src/apple-pay-logo.js +0 -14
  54. package/dist/src/types/experiment-integration.d.js +0 -0
  55. package/dist/src/utils/getExperimentKeyFromNextData.d.ts +0 -8
  56. package/dist/src/utils/getExperimentKeyFromNextData.js +0 -9
@@ -2,32 +2,11 @@ export declare enum ApplePayEntryPoint {
2
2
  PAYWALL = "article_paywall",
3
3
  REGWALL = "article_regwall",
4
4
  DUAL_OFFER_BANNER = "dual_offer_banner",
5
- FREE_TRIAL_BANNER = "free_trial_banner"
5
+ FREE_TRIAL_BANNER = "free_trial_banner",
6
+ /** Post-registration free-trial popup. Not Amplitude-gated. */
7
+ FREE_TRIAL_POPUP = "free_trial_popup",
8
+ /** /subscribe offers page (sma-checkout). Not Amplitude-gated. */
9
+ SUBSCRIBE = "subscribe",
10
+ /** Sales pages in sma-checkout (Black Friday and other promotions). Not Amplitude-gated. */
11
+ SALES_PAGE = "sales_page"
6
12
  }
7
- /**
8
- * Amplitude experiment key for Apple Pay Express Checkout on article paywalls
9
- * (`ApplePayEntryPoint.PAYWALL`, e.g. single-offer-paywall / multi-offer paywall).
10
- *
11
- * Fail-closed when the variant is missing or not `treatment`; the QA URL param
12
- * `FEATURE_APPLE_PAY_EXPRESS_CHECKOUT` can show the button without treatment.
13
- * Eligibility for this flag ignores homepage and requires Safari/Apple device
14
- * (plus `isApplePayAvailable` before `$exposure`).
15
- *
16
- * Must match the Feature experiment key in Amplitude and host app constants
17
- * (Engagement / Insider / Podcasts) while those still bridge the experiment.
18
- */
19
- export declare const APPLE_PAY_EXPRESS_PAYWALLS_EXPERIMENT_KEY = "apple-pay-express-checkout-on-paywalls";
20
- /**
21
- * Known Amplitude experiment flag keys for Apple Pay Express Checkout.
22
- * Narrowed so callers cannot pass an arbitrary typo'd string.
23
- */
24
- export type ApplePayExperimentFlagKey = typeof APPLE_PAY_EXPRESS_PAYWALLS_EXPERIMENT_KEY;
25
- /**
26
- * Amplitude variant values for the Apple Pay Express Checkout experiment.
27
- * CONTROL → button hidden (baseline)
28
- * TREATMENT → button shown
29
- */
30
- export declare const APPLE_PAY_EXPRESS_VARIANTS: {
31
- readonly CONTROL: "control";
32
- readonly TREATMENT: "treatment";
33
- };
@@ -4,15 +4,11 @@ var ApplePayEntryPoint = /* @__PURE__ */ ((ApplePayEntryPoint2) => {
4
4
  ApplePayEntryPoint2["REGWALL"] = "article_regwall";
5
5
  ApplePayEntryPoint2["DUAL_OFFER_BANNER"] = "dual_offer_banner";
6
6
  ApplePayEntryPoint2["FREE_TRIAL_BANNER"] = "free_trial_banner";
7
+ ApplePayEntryPoint2["FREE_TRIAL_POPUP"] = "free_trial_popup";
8
+ ApplePayEntryPoint2["SUBSCRIBE"] = "subscribe";
9
+ ApplePayEntryPoint2["SALES_PAGE"] = "sales_page";
7
10
  return ApplePayEntryPoint2;
8
11
  })(ApplePayEntryPoint || {});
9
- var APPLE_PAY_EXPRESS_PAYWALLS_EXPERIMENT_KEY = "apple-pay-express-checkout-on-paywalls";
10
- var APPLE_PAY_EXPRESS_VARIANTS = {
11
- CONTROL: "control",
12
- TREATMENT: "treatment"
13
- };
14
12
  export {
15
- APPLE_PAY_EXPRESS_PAYWALLS_EXPERIMENT_KEY,
16
- APPLE_PAY_EXPRESS_VARIANTS,
17
13
  ApplePayEntryPoint
18
14
  };
@@ -1,9 +1,7 @@
1
- export { ApplePayButton, APPLE_PAY_EXCLUDED_VARIANTS, } from './apple-pay-button';
1
+ export { ApplePayButton, APPLE_PAY_EXCLUDED_VARIANTS, getExcludedVariants, } from './apple-pay-button';
2
2
  export { ApplePayModal } from './apple-pay-modal';
3
- export { ensureApplePayLogoSymbol } from './apple-pay-logo';
4
3
  export { configureApplePay } from './clients/payment-checkout/config';
5
- export { ApplePayEntryPoint, APPLE_PAY_EXPRESS_PAYWALLS_EXPERIMENT_KEY, APPLE_PAY_EXPRESS_VARIANTS, } from './constants';
6
- export type { ApplePayExperimentFlagKey } from './constants';
4
+ export { ApplePayEntryPoint } from './constants';
7
5
  export type { ApplePayRuntimeConfig } from './clients/payment-checkout/config';
8
6
  export type { Offer } from './types/offer.types';
9
7
  export declare function defineApplePayElements(): void;