-
Notifications
You must be signed in to change notification settings - Fork 123
Feat: React PayPal JS V6 #695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
* initial package.json and rollup updates, changes tsconfig to bundler and adds v6 specific tsconfig * upgrade react-paypal-js typescript package to v5.3.3 * update tsconfig for v6 namespace * chore: add changeset * align rollup version and update playwright yml * change playwright.yml download deps command * update actions checkout and setup-node to v4 * update .nvmrc * try different method for installing dependencies * fix package dependency issues related to rollup and terser * revert change to download deps step * update package-lock * test fix for rollup option deps bug * update build script * test adding cache to setup node action, update install command, and remove rollup force install in github workflows * re-add force rollup install in github workflows * run npm install to update package-lock with new package versions from typescript upgrade * revert changes to download deps and setup node steps in github workflows * install with update to package.json * leverage fresh package-lock and remove all artifactory package resolution paths * fix check annotations warnings * add new line at the end of gitignore
…re/react-paypal-js-v6
🦋 Changeset detectedLatest commit: a2a8807 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
* Feat: Upgrade Typescript to v5 in react-paypal-js (#685) * initial package.json and rollup updates, changes tsconfig to bundler and adds v6 specific tsconfig * upgrade react-paypal-js typescript package to v5.3.3 * update tsconfig for v6 namespace * chore: add changeset * align rollup version and update playwright yml * change playwright.yml download deps command * update actions checkout and setup-node to v4 * update .nvmrc * try different method for installing dependencies * fix package dependency issues related to rollup and terser * revert change to download deps step * update package-lock * test fix for rollup option deps bug * update build script * test adding cache to setup node action, update install command, and remove rollup force install in github workflows * re-add force rollup install in github workflows * run npm install to update package-lock with new package versions from typescript upgrade * revert changes to download deps and setup node steps in github workflows * install with update to package.json * leverage fresh package-lock and remove all artifactory package resolution paths * fix check annotations warnings * add new line at the end of gitignore * add ssr checks to load core sdk script func and add initial instance provider * add a basic set of hooks * update exports * mark usePayPalInstance hook as exportable * add isServer util and apply where appropriate * clean up usePayPalInstance file * update exports * create v6 specific utils file * add reducer to manage various state, fix missed isServer condition in paypal-js * update paypal sdk instance provider name * remove json.stringify operation from memoizedOptions * clean up useMemo * clean up useMemo import * update provider to account for useEffect during ssr * add tests for client-side and server-side instance provider * add instance provider context test * add context test and clean up other provider tests * update initial to pending state useEffect with empty dependency array * configure provider to handle memoization of create instance and script options * memoize context to prevent rerenders * remove duplicate isServer * swap deep equality check packages * update isServer to a function that also checks whether the document is present * fix tests and missed isServer uses * remove isServer from eligibility useEffect * add changeset * add ref for initial hydration * remove abort controller * flatten create instance options props object * update naming convention * update tests to reflect name and prop passing changes * remove dead code isServer check * update jsdoc * update imports to correct values * add console warning to loadCoreSdkScript * remove create instance and script options from reducer state * remove sdkInstance check in loading useEffect
* update loadCoreSdkScript with a condition to check if a core script already exists * enhance window.paypal check to include version * chore: add changeset
…re/react-paypal-js-v6
| return ref.current; | ||
| } | ||
|
|
||
| export function useProxyProps<T extends Record<PropertyKey, unknown>>( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added useProxyProps here, from this branch:
https://github.com/paypal/paypal-js/pull/702/files#r2433808433
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this file should also be a .d.ts file, but I got some errors when I tried to change it. Might be because package.json needs to be updated. Noting that here to handle at some point.
…-file chore: Breakout enums from type file
feat: Use Venmo One Time Payment Session Hook
…er-hook usePayLaterOneTimePaymentSession
82a6625 to
0b82647
Compare
…ript-version add typecheck to lint command for CI
| export interface PayLaterOneTimePaymentSessionReturn { | ||
| handleClick: () => Promise<void>; | ||
| handleCancel: () => void; | ||
| handleDestroy: () => void; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should consolidate this return type.
* add inital paypal otp payment session hook * add tests * address review comments * update hook after boilerplate agreement * remove hook jsdoc comment * address review comments * review pr comments * Refactor tests to mock useProxyProps * add pay later hook * refactor after convo * some notes * remove unused code * wip * rename types file * use correct types * useProxyProps * fix error message * remove comment * tests placeholder * add test watch command * test stubs * wip * wip * tests wip * use optional chaining * proxy callback test * some docs * test wip * test wip * fixed * cleanup * rename * some cleanup * fix venmo test file * add tests * update tests * remove callback proxying tests --------- Co-authored-by: Hamza Nasir <munasir@paypal.com> Co-authored-by: Muhammad Hamza Nasir <mhamzanasir97@gmail.com> Co-authored-by: Andrew Kos <akos123@gmail.com>
* add paypal save payment session hook * fix typo * fix another typo
…re/react-paypal-js-v6
…re/react-paypal-js-v6
* initial provider refactoring and deep compare updates * fix infinite loop and refactor create sdk instance useEffect * remove ts doc comment for the provider * refactor provider tests * remove dequal from react-paypal-js dependencies * remove initial from instance loading state enum * add jsdoc for isEqualComponentsArray helper * fix test * revert paypal-js changes
…re/react-paypal-js-v6
…re/react-paypal-js-v6
…re/react-paypal-js-v6
packages/react-paypal-js/src/v6/components/providerTestUtils.ts
Outdated
Show resolved
Hide resolved
| console.warn( | ||
| "Failed to get eligible payment methods:", | ||
| error, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Given the error handling strategy we're going to implement, should we put an error in context in this scenario? If so, do we still need to console.warn outside of whatever development error logging we do?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, I think we need an eligibility error key in context and with that update we can replace the console.warn
| } | ||
| } | ||
|
|
||
| export const PayPalContext = createContext<PayPalContextState | null>(null); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think if we set the initial state here, instead of null, we can just use PayPalContextState and not need the PayPalContext type/variable. I'm gonna try it in my error handling PR: #721
* remove shared test utils file * update load core sdk script tests * add a changeset * Revert "update load core sdk script tests" This reverts commit 8e8e712. * re-apply test fix
* add datanamespace option to the provider * update exported session hooks
* refactor pay later types * refactor paypal otp types * remove provider type declaration file * remove venmo type declaration file * remove save payment declaration file and add base payment session return interface * apple base payment session return type * fix build errors
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very exciting work 🥳 Great job @EvanReinstein @kand @hamzanasir 👏
No description provided.