@revenuecat/purchases-js 0.13.1 → 0.15.0

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/README.md CHANGED
@@ -47,11 +47,50 @@ npm install
47
47
  npm run build:dev
48
48
  ```
49
49
 
50
- To avoid publishing the package you can set it up as a local dependency.
51
- In your testing project install the library as.
50
+ To avoid publishing the package you can use Yarn's link feature:
51
+
52
+ 1. In the purchases-js directory, register the package:
53
+
54
+ ```bash
55
+ yarn link
56
+ ```
57
+
58
+ 2. In your testing project, link to the registered package:
59
+
60
+ ```bash
61
+ yarn link "@revenuecat/purchases-js"
62
+ ```
63
+
64
+ > **Note:** Any changes you make to the library will be automatically reflected in your testing project after running `npm run build:dev` or `npm run build`.
65
+
66
+ ## Running Storybook
67
+
68
+ ```bash
69
+ npm run storybook
70
+ ```
71
+
72
+ ### Environment Setup for Needs Payment Info Stories
73
+
74
+ > **Note:** This setup is only required if you need to test Storybook stories involving the `state-needs-payment-info` component.
75
+
76
+ To run these specific stories, you'll need to set up some environment variables. There are two options:
77
+
78
+ ### Option 1: Internal Teams
79
+
80
+ Internal team members can find the required environment variables in 1Password.
81
+
82
+ ### Option 2: Setup Manually
83
+
84
+ 1. Create a test account in Stripe
85
+ 2. Go to settings, API keys, and create a restricted key with the following permissions:
86
+ - Setup intent (read/write)
87
+ - Payment methods (read/write)
88
+ 3. Create a `.env.development.local` file and set the following variables:
52
89
 
53
90
  ```bash
54
- npm i /path/to/purchases-js
91
+ VITE_STORYBOOK_RESTRICTED_SECRET="sk_test_1234567890"
92
+ VITE_STORYBOOK_PUBLISHABLE_API_KEY="pk_test_1234567890"
93
+ VITE_STORYBOOK_ACCOUNT_ID="acct_1234567890"
55
94
  ```
56
95
 
57
96
  ## Running tests
@@ -637,6 +637,15 @@ export declare interface PurchaseParams {
637
637
  * The email of the user. If undefined, RevenueCat will ask the customer for their email.
638
638
  */
639
639
  customerEmail?: string;
640
+ /**
641
+ * The locale to use for the purchase flow. If not specified, English will be used
642
+ */
643
+ selectedLocale?: string;
644
+ /**
645
+ * The default locale to use if the selectedLocale is not available.
646
+ * Defaults to english.
647
+ */
648
+ defaultLocale?: string;
640
649
  }
641
650
 
642
651
  /**
@@ -769,7 +778,7 @@ export declare class Purchases {
769
778
  /**
770
779
  * Generates an anonymous app user ID that follows RevenueCat's format.
771
780
  * This can be used when you don't have a user identifier system in place.
772
- * The generated ID will be in the format: $RCAnonymousID:<UUID without dashes>
781
+ * The generated ID will be in the format: $RCAnonymousID:\<UUID without dashes\>
773
782
  * Example: $RCAnonymousID:123e4567e89b12d3a456426614174000
774
783
  * @returns A new anonymous app user ID string
775
784
  * @public
@@ -792,7 +801,7 @@ export declare class Purchases {
792
801
  * Underlying error message. This provides more details on the error and
793
802
  * can be useful for debugging and logging.
794
803
  */
795
- readonly underlyingErrorMessage?: (string | null) | undefined;
804
+ readonly underlyingErrorMessage?: string | null | undefined;
796
805
  /**
797
806
  * Contains extra information that is available in certain types of errors.
798
807
  */
@@ -811,7 +820,7 @@ export declare class Purchases {
811
820
  * Underlying error message. This provides more details on the error and
812
821
  * can be useful for debugging and logging.
813
822
  */
814
- underlyingErrorMessage?: (string | null) | undefined,
823
+ underlyingErrorMessage?: string | null | undefined,
815
824
  /**
816
825
  * Contains extra information that is available in certain types of errors.
817
826
  */