Refactor react package to re-export from core#142
Open
TaprootFreak wants to merge 5 commits intodevelopfrom
Open
Refactor react package to re-export from core#142TaprootFreak wants to merge 5 commits intodevelopfrom
TaprootFreak wants to merge 5 commits intodevelopfrom
Conversation
Replace duplicated definitions, utils, and validations in the react package with thin re-exports from @dfx.swiss/core. This eliminates code duplication across the two packages and establishes core as the single source of truth for types and utilities. - Add missing Utils methods to core (createRules, formatIban, toBase64) - Replace 19 definition files with re-exports from core - Replace utils.ts and validations.ts with re-exports from core - Update kyc.hook to use buildKycUrl(apiUrl) instead of process.env - Update sell.hook and swap.hook to use function-style confirm URLs - Remove redundant ibantools/libphonenumber-js deps from react - Delete duplicate blocked-iban.json from react - No breaking changes to the public API
Merge origin/develop into feature branch, resolving conflicts by keeping re-export pattern. Sync new additions from develop: - Add STOPPED to TransactionState in core - Add KycStepCancelable, SupportIssueInternalState, Department exports to core/src/index.ts - Add CheckStatus, AmlReason exports to core/src/index.ts - Replace react/definitions/aml.ts with re-export from core
The previous range ^0.1.1-beta.1 does not match the current core version 0.2.0-beta.7, causing npm install to fail in CI.
The kycUrl memoized value was used in 12 callbacks without being listed as a dependency. While defaultUrl never changes at runtime, correct dependency arrays are required for React hooks consistency.
Re-exports all *Url values, buildKycUrl, AuthWalletType, UpdateUser, ApiKey and the SignMessage type so consumers can import from the package root instead of definition sub-paths. Closes #148
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@dfx.swiss/reactwith thin re-exports from@dfx.swiss/core@dfx.swiss/coreas single source of truth for all types, enums, utilities, and validation logic@dfx.swiss/react— closes Missing barrel exports in @dfx.swiss/react index.ts #148Changes
Core (
@dfx.swiss/core)Utilswith 3 methods previously only in react:createRules,formatIban,toBase64STOPPEDtoTransactionStateenumsrc/index.ts:CheckStatus,AmlReason,KycStepCancelable,SupportIssueInternalState,DepartmentReact (
@dfx.swiss/react)@dfx.swiss/coreas dependency (^0.2.0-beta.7), removedibantools/libphonenumber-js(now transitive via core)tsconfig.build.jsonutils.ts+validations.tswith re-exports from coreblocked-iban.jsonkyc.hook.ts:KycUrl(process.env) →buildKycUrl(defaultUrl)(framework-agnostic), fixedkycUrlin alluseCallbackdependency arrayssell.hook.ts/swap.hook.ts: string-replace URL pattern → function call (SellUrl.confirm(id))src/index.ts(closes Missing barrel exports in @dfx.swiss/react index.ts #148):AssetUrl,AuthUrl,AuthWalletType,BankUrl,BankAccountUrl,BuyUrl,CountryUrl,FiatUrl,buildKycUrl,LanguageUrl,PaymentRoutesUrl,PaymentLinksUrl,SellUrl,SettingsUrl,SupportUrl,SwapUrl,TransactionUrl,UserUrl,UpdateUser,ApiKey, and theSignMessagetypeBreaking Changes
None. The public API surface of
@dfx.swiss/reactis identical (plus the newly exposed barrel exports listed above).Test plan
@dfx.swiss/corebuilds successfully@dfx.swiss/reactbuilds successfully@dfx.swiss/react-componentsbuilds successfullydevelop— no stale conflicts@dfx.swiss/services-reactbuilds against updated react package (tsc --noEmit: 0 errors; webpack dev build: 0 errors, only pre-existing source-map warnings)buildKycUrl(9×) and all other*Urlexports (138×)Closes #148