@revenuecat/purchases-js-vega 1.78.0 → 1.78.1

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.
@@ -367,6 +367,7 @@ export declare interface FlagsConfig {
367
367
  * @defaultValue false
368
368
  */
369
369
  hideBackButton?: boolean;
370
+ /* Excluded from this release type: payrailsCheckoutEnabled */
370
371
  /**
371
372
  * If set to true, the SDK injects the branding app icon as an
372
373
  * `apple-touch-icon` link tag so it appears in the Apple Pay sheet.
@@ -1274,6 +1275,8 @@ export declare interface Price {
1274
1275
  readonly formattedPrice: string;
1275
1276
  }
1276
1277
 
1278
+ declare type PriceCurrencyDisplay = "narrowSymbol" | "code";
1279
+
1277
1280
  declare interface PriceResponse {
1278
1281
  amount_micros: number;
1279
1282
  currency: string;
@@ -2594,9 +2597,10 @@ export declare class Purchases extends Purchases_2 {
2594
2597
  declare class Translator {
2595
2598
  readonly selectedLocale: string;
2596
2599
  readonly defaultLocale: string;
2600
+ private readonly priceCurrencyDisplay;
2597
2601
  readonly locales: Record<string, LocaleTranslations>;
2598
2602
  static fallback(): Translator;
2599
- constructor(customTranslations?: CustomTranslations, selectedLocale?: string, defaultLocale?: string);
2603
+ constructor(customTranslations?: CustomTranslations, selectedLocale?: string, defaultLocale?: string, priceCurrencyDisplay?: PriceCurrencyDisplay);
2600
2604
  override(customTranslations: CustomTranslations): void;
2601
2605
  formatPrice(priceInMicros: number, currency: string): string;
2602
2606
  /**
@@ -6198,7 +6198,7 @@ function getPackageType(packageIdentifier) {
6198
6198
  return packageIdentifier.startsWith("$rc_") ? "unknown" : "custom";
6199
6199
  }
6200
6200
  }
6201
- const VERSION = "1.78.0", PAYRAILS_CHECKOUT_ENABLED = !1, RC_ENDPOINT = "https://api.revenuecat.com", RC_ANALYTICS_ENDPOINT = "https://e.revenue.cat";
6201
+ const VERSION = "1.78.1", RC_ENDPOINT = "https://api.revenuecat.com", RC_ANALYTICS_ENDPOINT = "https://e.revenue.cat";
6202
6202
  var StatusCodes;
6203
6203
  (function(StatusCodes2) {
6204
6204
  StatusCodes2[StatusCodes2.CONTINUE = 100] = "CONTINUE", StatusCodes2[StatusCodes2.SWITCHING_PROTOCOLS = 101] = "SWITCHING_PROTOCOLS", StatusCodes2[StatusCodes2.PROCESSING = 102] = "PROCESSING", StatusCodes2[StatusCodes2.EARLY_HINTS = 103] = "EARLY_HINTS", StatusCodes2[StatusCodes2.OK = 200] = "OK", StatusCodes2[StatusCodes2.CREATED = 201] = "CREATED", StatusCodes2[StatusCodes2.ACCEPTED = 202] = "ACCEPTED", StatusCodes2[StatusCodes2.NON_AUTHORITATIVE_INFORMATION = 203] = "NON_AUTHORITATIVE_INFORMATION", StatusCodes2[StatusCodes2.NO_CONTENT = 204] = "NO_CONTENT", StatusCodes2[StatusCodes2.RESET_CONTENT = 205] = "RESET_CONTENT", StatusCodes2[StatusCodes2.PARTIAL_CONTENT = 206] = "PARTIAL_CONTENT", StatusCodes2[StatusCodes2.MULTI_STATUS = 207] = "MULTI_STATUS", StatusCodes2[StatusCodes2.MULTIPLE_CHOICES = 300] = "MULTIPLE_CHOICES", StatusCodes2[StatusCodes2.MOVED_PERMANENTLY = 301] = "MOVED_PERMANENTLY", StatusCodes2[StatusCodes2.MOVED_TEMPORARILY = 302] = "MOVED_TEMPORARILY", StatusCodes2[StatusCodes2.SEE_OTHER = 303] = "SEE_OTHER", StatusCodes2[StatusCodes2.NOT_MODIFIED = 304] = "NOT_MODIFIED", StatusCodes2[StatusCodes2.USE_PROXY = 305] = "USE_PROXY", StatusCodes2[StatusCodes2.TEMPORARY_REDIRECT = 307] = "TEMPORARY_REDIRECT", StatusCodes2[StatusCodes2.PERMANENT_REDIRECT = 308] = "PERMANENT_REDIRECT", StatusCodes2[StatusCodes2.BAD_REQUEST = 400] = "BAD_REQUEST", StatusCodes2[StatusCodes2.UNAUTHORIZED = 401] = "UNAUTHORIZED", StatusCodes2[StatusCodes2.PAYMENT_REQUIRED = 402] = "PAYMENT_REQUIRED", StatusCodes2[StatusCodes2.FORBIDDEN = 403] = "FORBIDDEN", StatusCodes2[StatusCodes2.NOT_FOUND = 404] = "NOT_FOUND", StatusCodes2[StatusCodes2.METHOD_NOT_ALLOWED = 405] = "METHOD_NOT_ALLOWED", StatusCodes2[StatusCodes2.NOT_ACCEPTABLE = 406] = "NOT_ACCEPTABLE", StatusCodes2[StatusCodes2.PROXY_AUTHENTICATION_REQUIRED = 407] = "PROXY_AUTHENTICATION_REQUIRED", StatusCodes2[StatusCodes2.REQUEST_TIMEOUT = 408] = "REQUEST_TIMEOUT", StatusCodes2[StatusCodes2.CONFLICT = 409] = "CONFLICT", StatusCodes2[StatusCodes2.GONE = 410] = "GONE", StatusCodes2[StatusCodes2.LENGTH_REQUIRED = 411] = "LENGTH_REQUIRED", StatusCodes2[StatusCodes2.PRECONDITION_FAILED = 412] = "PRECONDITION_FAILED", StatusCodes2[StatusCodes2.REQUEST_TOO_LONG = 413] = "REQUEST_TOO_LONG", StatusCodes2[StatusCodes2.REQUEST_URI_TOO_LONG = 414] = "REQUEST_URI_TOO_LONG", StatusCodes2[StatusCodes2.UNSUPPORTED_MEDIA_TYPE = 415] = "UNSUPPORTED_MEDIA_TYPE", StatusCodes2[StatusCodes2.REQUESTED_RANGE_NOT_SATISFIABLE = 416] = "REQUESTED_RANGE_NOT_SATISFIABLE", StatusCodes2[StatusCodes2.EXPECTATION_FAILED = 417] = "EXPECTATION_FAILED", StatusCodes2[StatusCodes2.IM_A_TEAPOT = 418] = "IM_A_TEAPOT", StatusCodes2[StatusCodes2.INSUFFICIENT_SPACE_ON_RESOURCE = 419] = "INSUFFICIENT_SPACE_ON_RESOURCE", StatusCodes2[StatusCodes2.METHOD_FAILURE = 420] = "METHOD_FAILURE", StatusCodes2[StatusCodes2.MISDIRECTED_REQUEST = 421] = "MISDIRECTED_REQUEST", StatusCodes2[StatusCodes2.UNPROCESSABLE_ENTITY = 422] = "UNPROCESSABLE_ENTITY", StatusCodes2[StatusCodes2.LOCKED = 423] = "LOCKED", StatusCodes2[StatusCodes2.FAILED_DEPENDENCY = 424] = "FAILED_DEPENDENCY", StatusCodes2[StatusCodes2.UPGRADE_REQUIRED = 426] = "UPGRADE_REQUIRED", StatusCodes2[StatusCodes2.PRECONDITION_REQUIRED = 428] = "PRECONDITION_REQUIRED", StatusCodes2[StatusCodes2.TOO_MANY_REQUESTS = 429] = "TOO_MANY_REQUESTS", StatusCodes2[StatusCodes2.REQUEST_HEADER_FIELDS_TOO_LARGE = 431] = "REQUEST_HEADER_FIELDS_TOO_LARGE", StatusCodes2[StatusCodes2.UNAVAILABLE_FOR_LEGAL_REASONS = 451] = "UNAVAILABLE_FOR_LEGAL_REASONS", StatusCodes2[StatusCodes2.INTERNAL_SERVER_ERROR = 500] = "INTERNAL_SERVER_ERROR", StatusCodes2[StatusCodes2.NOT_IMPLEMENTED = 501] = "NOT_IMPLEMENTED", StatusCodes2[StatusCodes2.BAD_GATEWAY = 502] = "BAD_GATEWAY", StatusCodes2[StatusCodes2.SERVICE_UNAVAILABLE = 503] = "SERVICE_UNAVAILABLE", StatusCodes2[StatusCodes2.GATEWAY_TIMEOUT = 504] = "GATEWAY_TIMEOUT", StatusCodes2[StatusCodes2.HTTP_VERSION_NOT_SUPPORTED = 505] = "HTTP_VERSION_NOT_SUPPORTED", StatusCodes2[StatusCodes2.INSUFFICIENT_STORAGE = 507] = "INSUFFICIENT_STORAGE", StatusCodes2[StatusCodes2.NETWORK_AUTHENTICATION_REQUIRED = 511] = "NETWORK_AUTHENTICATION_REQUIRED";
@@ -9804,9 +9804,9 @@ const capitalize$1 = (value) => {
9804
9804
  useMultipleWords: !1
9805
9805
  };
9806
9806
  class Translator {
9807
- constructor(customTranslations = {}, selectedLocale = englishLocale, defaultLocale = englishLocale) {
9807
+ constructor(customTranslations = {}, selectedLocale = englishLocale, defaultLocale = englishLocale, priceCurrencyDisplay = "narrowSymbol") {
9808
9808
  __publicField(this, "locales", {});
9809
- this.selectedLocale = selectedLocale, this.defaultLocale = defaultLocale;
9809
+ this.selectedLocale = selectedLocale, this.defaultLocale = defaultLocale, this.priceCurrencyDisplay = priceCurrencyDisplay;
9810
9810
  const locales = {};
9811
9811
  Object.entries(supportedLanguages).forEach(([locale, translations]) => {
9812
9812
  locales[locale] = new LocaleTranslations(translations, locale);
@@ -9827,7 +9827,7 @@ class Translator {
9827
9827
  });
9828
9828
  }
9829
9829
  formatPrice(priceInMicros, currency) {
9830
- const additionalFormattingOptions = { currencyDisplay: "narrowSymbol" };
9830
+ const additionalFormattingOptions = { currencyDisplay: this.priceCurrencyDisplay };
9831
9831
  priceInMicros === 0 && (additionalFormattingOptions.maximumFractionDigits = 0);
9832
9832
  try {
9833
9833
  return formatPrice(
@@ -25092,7 +25092,7 @@ function getActiveCheckoutPurchaseOption(productDetails, fallbackPurchaseOption,
25092
25092
  function Purchases_ui($$anchor, $$props) {
25093
25093
  var _a3;
25094
25094
  push($$props, !0);
25095
- const customTranslations = prop($$props, "customTranslations", 19, () => ({})), skipSuccessPage = prop($$props, "skipSuccessPage", 3, !1), showDiscountCodeField = prop($$props, "showDiscountCodeField", 3, !1), discountCode = prop($$props, "discountCode", 3, void 0), productChange = prop($$props, "productChange", 3, void 0), onProductChangeFinished = prop($$props, "onProductChangeFinished", 3, void 0), hideBackButton = prop($$props, "hideBackButton", 3, !1), emailError = $$props.customerEmail ? validateEmail($$props.customerEmail) : null;
25095
+ const customTranslations = prop($$props, "customTranslations", 19, () => ({})), skipSuccessPage = prop($$props, "skipSuccessPage", 3, !1), showDiscountCodeField = prop($$props, "showDiscountCodeField", 3, !1), discountCode = prop($$props, "discountCode", 3, void 0), productChange = prop($$props, "productChange", 3, void 0), onProductChangeFinished = prop($$props, "onProductChangeFinished", 3, void 0), hideBackButton = prop($$props, "hideBackButton", 3, !1), payrailsCheckoutEnabled = prop($$props, "payrailsCheckoutEnabled", 3, !1), emailError = $$props.customerEmail ? validateEmail($$props.customerEmail) : null;
25096
25096
  let email = /* @__PURE__ */ state(proxy(emailError ? void 0 : $$props.customerEmail)), productDetails = proxy($$props.rcPackage.product), latestCheckoutPricingResponse = /* @__PURE__ */ state(null);
25097
25097
  const lastTaxCustomerDetailsStore = writable(null);
25098
25098
  let purchaseOptionToUse = /* @__PURE__ */ user_derived(() => getActiveCheckoutPurchaseOption(productDetails, $$props.purchaseOption, get$1(latestCheckoutPricingResponse))), lastError = /* @__PURE__ */ state(null), draftDiscountCode = /* @__PURE__ */ state(proxy(discountCode() ?? "")), discountCodeError = /* @__PURE__ */ state(null), isUpdatingDiscountCode = /* @__PURE__ */ state(!1), isPaymentProcessing = /* @__PURE__ */ state(!1), currentPage = /* @__PURE__ */ state("payment-entry-loading"), operationResult = /* @__PURE__ */ state(null), initialGatewayParams = /* @__PURE__ */ state(proxy({})), payrailsGatewayParams = /* @__PURE__ */ state(null), managementUrl = /* @__PURE__ */ state(null), currentPriceBreakdown = /* @__PURE__ */ state(void 0), appliedDiscountCode = /* @__PURE__ */ user_derived(() => {
@@ -25106,7 +25106,7 @@ function Purchases_ui($$anchor, $$props) {
25106
25106
  elements_configuration: get$1(latestCheckoutPricingResponse).gateway_params.elements_configuration
25107
25107
  } : {}
25108
25108
  };
25109
- }), originalHtmlHeight = /* @__PURE__ */ state(null), originalHtmlOverflow = /* @__PURE__ */ state(null), originalBodyHeight = /* @__PURE__ */ state(null), translator = new Translator(customTranslations(), $$props.selectedLocale, $$props.defaultLocale), translatorStore = writable(translator);
25109
+ }), originalHtmlHeight = /* @__PURE__ */ state(null), originalHtmlOverflow = /* @__PURE__ */ state(null), originalBodyHeight = /* @__PURE__ */ state(null), translator = new Translator(customTranslations(), $$props.selectedLocale, $$props.defaultLocale, "code"), translatorStore = writable(translator);
25110
25110
  const brandingAppearanceStore = writable(((_a3 = $$props.brandingInfo) == null ? void 0 : _a3.appearance) ?? null);
25111
25111
  setContext(translatorContextKey, translatorStore), setContext(brandingContextKey, brandingAppearanceStore), onMount(() => {
25112
25112
  $$props.isInElement || (set(originalHtmlHeight, getDocument().documentElement.style.height, !0), set(originalHtmlOverflow, getDocument().documentElement.style.overflow, !0), set(originalBodyHeight, getDocument().body.style.height, !0), getDocument().documentElement.style.height = "100%", getDocument().body.style.height = "100%", getDocument().documentElement.style.overflow = "hidden");
@@ -25205,7 +25205,7 @@ function Purchases_ui($$anchor, $$props) {
25205
25205
  return;
25206
25206
  }
25207
25207
  if (isPayrailsCheckoutStartResponse(result)) {
25208
- if (!PAYRAILS_CHECKOUT_ENABLED)
25208
+ if (!payrailsCheckoutEnabled())
25209
25209
  throw new PurchaseFlowError(PurchaseFlowErrorCode.ErrorSettingUpPurchase, "This checkout requires a newer version of the SDK. Update to the latest version of @revenuecat/purchases-js.");
25210
25210
  set(payrailsGatewayParams, result.payrails_gateway_params, !0);
25211
25211
  } else
@@ -26962,7 +26962,7 @@ function Paddle_purchases_ui($$anchor, $$props) {
26962
26962
  var _a3, _b, _c;
26963
26963
  push($$props, !0);
26964
26964
  const customTranslations = prop($$props, "customTranslations", 19, () => ({})), skipSuccessPage = prop($$props, "skipSuccessPage", 3, !1), hideBackButton = prop($$props, "hideBackButton", 3, !1);
26965
- let translator = new Translator(customTranslations(), $$props.selectedLocale, $$props.defaultLocale), translatorStore = writable(translator);
26965
+ let translator = new Translator(customTranslations(), $$props.selectedLocale, $$props.defaultLocale, "code"), translatorStore = writable(translator);
26966
26966
  const brandingAppearanceStore = writable(((_a3 = $$props.brandingInfo) == null ? void 0 : _a3.appearance) ?? null);
26967
26967
  setContext(translatorContextKey, translatorStore), setContext(brandingContextKey, brandingAppearanceStore), setContext(eventsTrackerContextKey, $$props.eventsTracker);
26968
26968
  let isSandbox = /* @__PURE__ */ state(!1), operationResult = /* @__PURE__ */ state(null), error2 = /* @__PURE__ */ state(null), currentPage = /* @__PURE__ */ state("waiting"), checkoutCompleted = /* @__PURE__ */ state(!1), startResponse = /* @__PURE__ */ state(null);
@@ -27421,7 +27421,7 @@ function Stripe_checkout_purchases_ui($$anchor, $$props) {
27421
27421
  var _a3;
27422
27422
  push($$props, !0);
27423
27423
  const customTranslations = prop($$props, "customTranslations", 19, () => ({})), skipSuccessPage = prop($$props, "skipSuccessPage", 3, !1), onClose = prop($$props, "onClose", 3, void 0), productChange = prop($$props, "productChange", 3, void 0), onProductChangeFinished = prop($$props, "onProductChangeFinished", 3, void 0), hideBackButton = prop($$props, "hideBackButton", 3, !1);
27424
- let productDetails = $$props.rcPackage.product, translator = new Translator(customTranslations(), $$props.selectedLocale, $$props.defaultLocale), translatorStore = writable(translator);
27424
+ let productDetails = $$props.rcPackage.product, translator = new Translator(customTranslations(), $$props.selectedLocale, $$props.defaultLocale, "code"), translatorStore = writable(translator);
27425
27425
  setContext(translatorContextKey, translatorStore), setContext(eventsTrackerContextKey, $$props.eventsTracker);
27426
27426
  const brandingAppearanceStore = writable(((_a3 = $$props.brandingInfo) == null ? void 0 : _a3.appearance) ?? null);
27427
27427
  setContext(brandingContextKey, brandingAppearanceStore);
@@ -31639,7 +31639,8 @@ let Purchases$1 = (_prepareForQuickPurchases_dec = [requiresLoadedResources], _p
31639
31639
  discountCode,
31640
31640
  onDiscountCodeChanged,
31641
31641
  skipSuccessPage,
31642
- hideBackButton: this.shouldHideCheckoutBackButton()
31642
+ hideBackButton: this.shouldHideCheckoutBackButton(),
31643
+ payrailsCheckoutEnabled: this._flags.payrailsCheckoutEnabled === !0
31643
31644
  }
31644
31645
  });
31645
31646
  });