@economist/web-apple-pay 0.1.3-beta.48 → 0.1.3-beta.49

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
@@ -1944,14 +1944,15 @@ var ApplePayEntryPoint = /* @__PURE__ */ ((ApplePayEntryPoint3) => {
1944
1944
  ApplePayEntryPoint3["DUAL_OFFER_BANNER"] = "dual_offer_banner";
1945
1945
  return ApplePayEntryPoint3;
1946
1946
  })(ApplePayEntryPoint || {});
1947
- var APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY = "subscribe-experiment-calibration";
1948
- var APPLE_PAY_EXPRESS_BANNERS_VARIANTS = {
1947
+ var APPLE_PAY_EXPRESS_EXPERIMENT_KEY = "apple-pay-express-feature-flag-placeholder";
1948
+ var APPLE_PAY_EXPRESS_VARIANTS = {
1949
1949
  CONTROL: "control",
1950
1950
  TREATMENT: "treatment"
1951
1951
  };
1952
1952
 
1953
1953
  // src/apple-pay-button.ts
1954
1954
  var FEATURE_APPLE_PAY_EXPRESS_CHECKOUT = "FEATURE_APPLE_PAY_EXPRESS_CHECKOUT";
1955
+ var APPLE_PAY_EXPRESS_GATING_DISABLED = true;
1955
1956
  var TOTAL_LABEL = "The Economist";
1956
1957
  var DEFAULT_CURRENCY = "USD";
1957
1958
  var DEFAULT_TOTAL = "0.00";
@@ -1970,7 +1971,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1970
1971
  * Creates and configures an ApplePayButton when the Amplitude experiment is enabled.
1971
1972
  *
1972
1973
  * Reads the experiment variant from `window.experimentIntegration.getVariant` using
1973
- * {@link APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY}. The host page is responsible
1974
+ * {@link APPLE_PAY_EXPRESS_EXPERIMENT_KEY}. The host page is responsible
1974
1975
  * for setting up `window.experimentIntegration` before calling this method.
1975
1976
  *
1976
1977
  * - `treatment` → button created and returned
@@ -1993,17 +1994,13 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1993
1994
  return null;
1994
1995
  }
1995
1996
  const experimentValue = window.experimentIntegration?.getVariant?.(
1996
- APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY
1997
+ APPLE_PAY_EXPRESS_EXPERIMENT_KEY
1997
1998
  );
1998
- const isTreatment = experimentValue === APPLE_PAY_EXPRESS_BANNERS_VARIANTS.TREATMENT;
1999
+ const isTreatment = experimentValue === APPLE_PAY_EXPRESS_VARIANTS.TREATMENT;
1999
2000
  const hasUrlParamFlag = new URLSearchParams(window.location.search).has(
2000
2001
  FEATURE_APPLE_PAY_EXPRESS_CHECKOUT
2001
2002
  );
2002
- console.log(`Apple Pay button experiment: variant="${experimentValue}`);
2003
- if (!isTreatment && !hasUrlParamFlag) {
2004
- console.log(
2005
- `Apple Pay button suppressed: experiment variant is "${experimentValue}" and URL param "${FEATURE_APPLE_PAY_EXPRESS_CHECKOUT}" is not present.`
2006
- );
2003
+ if (!APPLE_PAY_EXPRESS_GATING_DISABLED && !isTreatment && !hasUrlParamFlag) {
2007
2004
  return null;
2008
2005
  }
2009
2006
  _ApplePayButton.define();
@@ -1,17 +1,5 @@
1
1
  import type { Offer, ProductVariant } from './types/offer.types';
2
2
  import { ApplePayEntryPoint } from './constants';
3
- /**
4
- * The host page is responsible for setting up `window.experimentIntegration`
5
- * with a `getVariant` method that returns the variant value for a given flag key.
6
- * web-apple-pay reads the experiment variant from here to decide whether to show or hide the button.
7
- */
8
- declare global {
9
- interface Window {
10
- experimentIntegration?: {
11
- getVariant: (flagKey: string) => string | undefined;
12
- };
13
- }
14
- }
15
3
  export declare const APPLE_PAY_EXCLUDED_VARIANTS: readonly ProductVariant[];
16
4
  export declare class ApplePayButton extends HTMLElement {
17
5
  #private;
@@ -21,7 +9,7 @@ export declare class ApplePayButton extends HTMLElement {
21
9
  * Creates and configures an ApplePayButton when the Amplitude experiment is enabled.
22
10
  *
23
11
  * Reads the experiment variant from `window.experimentIntegration.getVariant` using
24
- * {@link APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY}. The host page is responsible
12
+ * {@link APPLE_PAY_EXPRESS_EXPERIMENT_KEY}. The host page is responsible
25
13
  * for setting up `window.experimentIntegration` before calling this method.
26
14
  *
27
15
  * - `treatment` → button created and returned
@@ -1933,14 +1933,15 @@ var getSupportedBillingCountries = (offerCountry, offerVariant) => {
1933
1933
  };
1934
1934
 
1935
1935
  // src/constants.ts
1936
- var APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY = "subscribe-experiment-calibration";
1937
- var APPLE_PAY_EXPRESS_BANNERS_VARIANTS = {
1936
+ var APPLE_PAY_EXPRESS_EXPERIMENT_KEY = "apple-pay-express-feature-flag-placeholder";
1937
+ var APPLE_PAY_EXPRESS_VARIANTS = {
1938
1938
  CONTROL: "control",
1939
1939
  TREATMENT: "treatment"
1940
1940
  };
1941
1941
 
1942
1942
  // src/apple-pay-button.ts
1943
1943
  var FEATURE_APPLE_PAY_EXPRESS_CHECKOUT = "FEATURE_APPLE_PAY_EXPRESS_CHECKOUT";
1944
+ var APPLE_PAY_EXPRESS_GATING_DISABLED = true;
1944
1945
  var TOTAL_LABEL = "The Economist";
1945
1946
  var DEFAULT_CURRENCY = "USD";
1946
1947
  var DEFAULT_TOTAL = "0.00";
@@ -1959,7 +1960,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1959
1960
  * Creates and configures an ApplePayButton when the Amplitude experiment is enabled.
1960
1961
  *
1961
1962
  * Reads the experiment variant from `window.experimentIntegration.getVariant` using
1962
- * {@link APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY}. The host page is responsible
1963
+ * {@link APPLE_PAY_EXPRESS_EXPERIMENT_KEY}. The host page is responsible
1963
1964
  * for setting up `window.experimentIntegration` before calling this method.
1964
1965
  *
1965
1966
  * - `treatment` → button created and returned
@@ -1982,17 +1983,13 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1982
1983
  return null;
1983
1984
  }
1984
1985
  const experimentValue = window.experimentIntegration?.getVariant?.(
1985
- APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY
1986
+ APPLE_PAY_EXPRESS_EXPERIMENT_KEY
1986
1987
  );
1987
- const isTreatment = experimentValue === APPLE_PAY_EXPRESS_BANNERS_VARIANTS.TREATMENT;
1988
+ const isTreatment = experimentValue === APPLE_PAY_EXPRESS_VARIANTS.TREATMENT;
1988
1989
  const hasUrlParamFlag = new URLSearchParams(window.location.search).has(
1989
1990
  FEATURE_APPLE_PAY_EXPRESS_CHECKOUT
1990
1991
  );
1991
- console.log(`Apple Pay button experiment: variant="${experimentValue}`);
1992
- if (!isTreatment && !hasUrlParamFlag) {
1993
- console.log(
1994
- `Apple Pay button suppressed: experiment variant is "${experimentValue}" and URL param "${FEATURE_APPLE_PAY_EXPRESS_CHECKOUT}" is not present.`
1995
- );
1992
+ if (!APPLE_PAY_EXPRESS_GATING_DISABLED && !isTreatment && !hasUrlParamFlag) {
1996
1993
  return null;
1997
1994
  }
1998
1995
  _ApplePayButton.define();
@@ -1941,14 +1941,15 @@ var getSupportedBillingCountries = (offerCountry, offerVariant) => {
1941
1941
  };
1942
1942
 
1943
1943
  // src/constants.ts
1944
- var APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY = "subscribe-experiment-calibration";
1945
- var APPLE_PAY_EXPRESS_BANNERS_VARIANTS = {
1944
+ var APPLE_PAY_EXPRESS_EXPERIMENT_KEY = "apple-pay-express-feature-flag-placeholder";
1945
+ var APPLE_PAY_EXPRESS_VARIANTS = {
1946
1946
  CONTROL: "control",
1947
1947
  TREATMENT: "treatment"
1948
1948
  };
1949
1949
 
1950
1950
  // src/apple-pay-button.ts
1951
1951
  var FEATURE_APPLE_PAY_EXPRESS_CHECKOUT = "FEATURE_APPLE_PAY_EXPRESS_CHECKOUT";
1952
+ var APPLE_PAY_EXPRESS_GATING_DISABLED = true;
1952
1953
  var TOTAL_LABEL = "The Economist";
1953
1954
  var DEFAULT_CURRENCY = "USD";
1954
1955
  var DEFAULT_TOTAL = "0.00";
@@ -1967,7 +1968,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1967
1968
  * Creates and configures an ApplePayButton when the Amplitude experiment is enabled.
1968
1969
  *
1969
1970
  * Reads the experiment variant from `window.experimentIntegration.getVariant` using
1970
- * {@link APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY}. The host page is responsible
1971
+ * {@link APPLE_PAY_EXPRESS_EXPERIMENT_KEY}. The host page is responsible
1971
1972
  * for setting up `window.experimentIntegration` before calling this method.
1972
1973
  *
1973
1974
  * - `treatment` → button created and returned
@@ -1990,17 +1991,13 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1990
1991
  return null;
1991
1992
  }
1992
1993
  const experimentValue = window.experimentIntegration?.getVariant?.(
1993
- APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY
1994
+ APPLE_PAY_EXPRESS_EXPERIMENT_KEY
1994
1995
  );
1995
- const isTreatment = experimentValue === APPLE_PAY_EXPRESS_BANNERS_VARIANTS.TREATMENT;
1996
+ const isTreatment = experimentValue === APPLE_PAY_EXPRESS_VARIANTS.TREATMENT;
1996
1997
  const hasUrlParamFlag = new URLSearchParams(window.location.search).has(
1997
1998
  FEATURE_APPLE_PAY_EXPRESS_CHECKOUT
1998
1999
  );
1999
- console.log(`Apple Pay button experiment: variant="${experimentValue}`);
2000
- if (!isTreatment && !hasUrlParamFlag) {
2001
- console.log(
2002
- `Apple Pay button suppressed: experiment variant is "${experimentValue}" and URL param "${FEATURE_APPLE_PAY_EXPRESS_CHECKOUT}" is not present.`
2003
- );
2000
+ if (!APPLE_PAY_EXPRESS_GATING_DISABLED && !isTreatment && !hasUrlParamFlag) {
2004
2001
  return null;
2005
2002
  }
2006
2003
  _ApplePayButton.define();
@@ -1933,14 +1933,15 @@ var getSupportedBillingCountries = (offerCountry, offerVariant) => {
1933
1933
  };
1934
1934
 
1935
1935
  // src/constants.ts
1936
- var APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY = "subscribe-experiment-calibration";
1937
- var APPLE_PAY_EXPRESS_BANNERS_VARIANTS = {
1936
+ var APPLE_PAY_EXPRESS_EXPERIMENT_KEY = "apple-pay-express-feature-flag-placeholder";
1937
+ var APPLE_PAY_EXPRESS_VARIANTS = {
1938
1938
  CONTROL: "control",
1939
1939
  TREATMENT: "treatment"
1940
1940
  };
1941
1941
 
1942
1942
  // src/apple-pay-button.ts
1943
1943
  var FEATURE_APPLE_PAY_EXPRESS_CHECKOUT = "FEATURE_APPLE_PAY_EXPRESS_CHECKOUT";
1944
+ var APPLE_PAY_EXPRESS_GATING_DISABLED = true;
1944
1945
  var TOTAL_LABEL = "The Economist";
1945
1946
  var DEFAULT_CURRENCY = "USD";
1946
1947
  var DEFAULT_TOTAL = "0.00";
@@ -1959,7 +1960,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1959
1960
  * Creates and configures an ApplePayButton when the Amplitude experiment is enabled.
1960
1961
  *
1961
1962
  * Reads the experiment variant from `window.experimentIntegration.getVariant` using
1962
- * {@link APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY}. The host page is responsible
1963
+ * {@link APPLE_PAY_EXPRESS_EXPERIMENT_KEY}. The host page is responsible
1963
1964
  * for setting up `window.experimentIntegration` before calling this method.
1964
1965
  *
1965
1966
  * - `treatment` → button created and returned
@@ -1982,17 +1983,13 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1982
1983
  return null;
1983
1984
  }
1984
1985
  const experimentValue = window.experimentIntegration?.getVariant?.(
1985
- APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY
1986
+ APPLE_PAY_EXPRESS_EXPERIMENT_KEY
1986
1987
  );
1987
- const isTreatment = experimentValue === APPLE_PAY_EXPRESS_BANNERS_VARIANTS.TREATMENT;
1988
+ const isTreatment = experimentValue === APPLE_PAY_EXPRESS_VARIANTS.TREATMENT;
1988
1989
  const hasUrlParamFlag = new URLSearchParams(window.location.search).has(
1989
1990
  FEATURE_APPLE_PAY_EXPRESS_CHECKOUT
1990
1991
  );
1991
- console.log(`Apple Pay button experiment: variant="${experimentValue}`);
1992
- if (!isTreatment && !hasUrlParamFlag) {
1993
- console.log(
1994
- `Apple Pay button suppressed: experiment variant is "${experimentValue}" and URL param "${FEATURE_APPLE_PAY_EXPRESS_CHECKOUT}" is not present.`
1995
- );
1992
+ if (!APPLE_PAY_EXPRESS_GATING_DISABLED && !isTreatment && !hasUrlParamFlag) {
1996
1993
  return null;
1997
1994
  }
1998
1995
  _ApplePayButton.define();
@@ -4,18 +4,22 @@ export declare enum ApplePayEntryPoint {
4
4
  DUAL_OFFER_BANNER = "dual_offer_banner"
5
5
  }
6
6
  /**
7
- * Amplitude experiment flag key for Apple Pay Express Checkout from Banners.
7
+ * Amplitude experiment key for Apple Pay Express Checkout.
8
8
  * This package reads the variant for this key internally via
9
9
  * `window.experimentIntegration.getVariant()` — set up by the host page
10
- * before `createIfEnabled` is called.
10
+ * before `createIfEnabled` is called. Gates all entry points (paywall, regwall, banner).
11
+ *
12
+ * TODO: Replace with the confirmed Amplitude experiment key once available.
13
+ * The current value is a placeholder and must be verified against the
14
+ * Amplitude experiment dashboard before going to production.
11
15
  */
12
- export declare const APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY = "subscribe-experiment-calibration";
16
+ export declare const APPLE_PAY_EXPRESS_EXPERIMENT_KEY = "apple-pay-express-feature-flag-placeholder";
13
17
  /**
14
- * Amplitude variant values for the Apple Pay Express Banners experiment.
18
+ * Amplitude variant values for the Apple Pay Express Checkout experiment.
15
19
  * CONTROL → button hidden (baseline)
16
20
  * TREATMENT → button shown
17
21
  */
18
- export declare const APPLE_PAY_EXPRESS_BANNERS_VARIANTS: {
22
+ export declare const APPLE_PAY_EXPRESS_VARIANTS: {
19
23
  readonly CONTROL: "control";
20
24
  readonly TREATMENT: "treatment";
21
25
  };
@@ -5,13 +5,13 @@ var ApplePayEntryPoint = /* @__PURE__ */ ((ApplePayEntryPoint2) => {
5
5
  ApplePayEntryPoint2["DUAL_OFFER_BANNER"] = "dual_offer_banner";
6
6
  return ApplePayEntryPoint2;
7
7
  })(ApplePayEntryPoint || {});
8
- var APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY = "subscribe-experiment-calibration";
9
- var APPLE_PAY_EXPRESS_BANNERS_VARIANTS = {
8
+ var APPLE_PAY_EXPRESS_EXPERIMENT_KEY = "apple-pay-express-feature-flag-placeholder";
9
+ var APPLE_PAY_EXPRESS_VARIANTS = {
10
10
  CONTROL: "control",
11
11
  TREATMENT: "treatment"
12
12
  };
13
13
  export {
14
- APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY,
15
- APPLE_PAY_EXPRESS_BANNERS_VARIANTS,
14
+ APPLE_PAY_EXPRESS_EXPERIMENT_KEY,
15
+ APPLE_PAY_EXPRESS_VARIANTS,
16
16
  ApplePayEntryPoint
17
17
  };
package/dist/src/index.js CHANGED
@@ -1944,14 +1944,15 @@ var ApplePayEntryPoint = /* @__PURE__ */ ((ApplePayEntryPoint3) => {
1944
1944
  ApplePayEntryPoint3["DUAL_OFFER_BANNER"] = "dual_offer_banner";
1945
1945
  return ApplePayEntryPoint3;
1946
1946
  })(ApplePayEntryPoint || {});
1947
- var APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY = "subscribe-experiment-calibration";
1948
- var APPLE_PAY_EXPRESS_BANNERS_VARIANTS = {
1947
+ var APPLE_PAY_EXPRESS_EXPERIMENT_KEY = "apple-pay-express-feature-flag-placeholder";
1948
+ var APPLE_PAY_EXPRESS_VARIANTS = {
1949
1949
  CONTROL: "control",
1950
1950
  TREATMENT: "treatment"
1951
1951
  };
1952
1952
 
1953
1953
  // src/apple-pay-button.ts
1954
1954
  var FEATURE_APPLE_PAY_EXPRESS_CHECKOUT = "FEATURE_APPLE_PAY_EXPRESS_CHECKOUT";
1955
+ var APPLE_PAY_EXPRESS_GATING_DISABLED = true;
1955
1956
  var TOTAL_LABEL = "The Economist";
1956
1957
  var DEFAULT_CURRENCY = "USD";
1957
1958
  var DEFAULT_TOTAL = "0.00";
@@ -1970,7 +1971,7 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1970
1971
  * Creates and configures an ApplePayButton when the Amplitude experiment is enabled.
1971
1972
  *
1972
1973
  * Reads the experiment variant from `window.experimentIntegration.getVariant` using
1973
- * {@link APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY}. The host page is responsible
1974
+ * {@link APPLE_PAY_EXPRESS_EXPERIMENT_KEY}. The host page is responsible
1974
1975
  * for setting up `window.experimentIntegration` before calling this method.
1975
1976
  *
1976
1977
  * - `treatment` → button created and returned
@@ -1993,17 +1994,13 @@ var ApplePayButton = class _ApplePayButton extends HTMLElement {
1993
1994
  return null;
1994
1995
  }
1995
1996
  const experimentValue = window.experimentIntegration?.getVariant?.(
1996
- APPLE_PAY_EXPRESS_BANNERS_EXPERIMENT_KEY
1997
+ APPLE_PAY_EXPRESS_EXPERIMENT_KEY
1997
1998
  );
1998
- const isTreatment = experimentValue === APPLE_PAY_EXPRESS_BANNERS_VARIANTS.TREATMENT;
1999
+ const isTreatment = experimentValue === APPLE_PAY_EXPRESS_VARIANTS.TREATMENT;
1999
2000
  const hasUrlParamFlag = new URLSearchParams(window.location.search).has(
2000
2001
  FEATURE_APPLE_PAY_EXPRESS_CHECKOUT
2001
2002
  );
2002
- console.log(`Apple Pay button experiment: variant="${experimentValue}`);
2003
- if (!isTreatment && !hasUrlParamFlag) {
2004
- console.log(
2005
- `Apple Pay button suppressed: experiment variant is "${experimentValue}" and URL param "${FEATURE_APPLE_PAY_EXPRESS_CHECKOUT}" is not present.`
2006
- );
2003
+ if (!APPLE_PAY_EXPRESS_GATING_DISABLED && !isTreatment && !hasUrlParamFlag) {
2007
2004
  return null;
2008
2005
  }
2009
2006
  _ApplePayButton.define();
File without changes
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.48",
4
+ "version": "0.1.3-beta.49",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",